Opened 8 years ago

Closed 8 years ago

#12432 closed enhancement (fixed)

Granular dependency lists

Reported by: Kris Zyp Owned by: Kris Zyp
Priority: high Milestone: 1.7
Component: General Version: 1.6.0
Keywords: Cc: ben hockey
Blocked By: Blocking:

Description (last modified by bill)

When possible Dojo code should be upgraded to use precise dependency references rather than namespace properties and reliance on assuming base being loaded. Modules that precisely indicate there dependencies can be used in builds where only needed code is built and the entirety of base does not need to be used. This is important for very lightweight mobile applications. Using dependency references also reduces property lookups at runtime, as target functions can be directly as local variables. For example, old code might look like:

  define(["dojo"], function(dojo){
     dojo.connect(...);
  });

Upgraded code:

  define(["dojo/_base/connect"], function(connect){
     connect(...);
  });

The connect call is faster because there is no property lookup, and a build can be created that only loads dojo/_base/connect and not the entire base.

Change History (35)

comment:1 Changed 8 years ago by ben hockey

Cc: ben hockey added

comment:2 Changed 8 years ago by Kris Zyp

(In [24472]) Removed query and query-sizzle as part of query delegation refactor, refs #12432

comment:3 Changed 8 years ago by Rawld Gill

(In [24600]) changed usage of config-has mapping in [24542] to fix dojo not defined error; refs #12432; !strict

comment:4 Changed 8 years ago by Chris Mitchell

Type: enhancementdefect

comment:5 Changed 8 years ago by Chris Mitchell

Component: GeneralDojoX Mobile

comment:6 Changed 8 years ago by Chris Mitchell

Keywords: 1.7-mobile added

comment:7 Changed 8 years ago by Chris Mitchell

Keywords: 1.7-mobile removed

comment:8 Changed 8 years ago by Chris Mitchell

Component: DojoX MobileGeneral

sorry, updated wrong ticket

comment:9 Changed 8 years ago by Chris Mitchell

Type: defectenhancement

comment:10 Changed 8 years ago by Rawld Gill

(In [24649]) added missing dependency; refs #12432; !strict

comment:11 Changed 8 years ago by Chris Mitchell

Related tickets:

#12844 - AMD conversion with minimal dependency lists for GFX-related modules

#12863 - AMD conversion with minimal dependency lists for non-GFX dojox modules

comment:12 Changed 8 years ago by Chris Mitchell

Priority: normalhigh

comment:13 Changed 8 years ago by Kris Zyp

(In [24856]) Dependency list improvements, refs #12432 !strict

comment:14 Changed 8 years ago by ben hockey

(In [24927]) added dependency needed for dojo.mixin and missed in r24856. refs #12432 !strict

comment:15 Changed 8 years ago by ben hockey

(In [24930]) added dependency needed for dojo.indexOf refs #12432 !strict

comment:16 Changed 8 years ago by bill

(In [25087]) Convert parser to granular dependencies (although it ends up pulling in most of dojo/_base anyway).

Previously the parser was using dojo.query() in certain cases but not pulling it in, so that apps could pick to include/exclude it. That's no longer possible, but as an alternate they can just set the default query engine to be a stub file (see dojo/query.js).

Refs #12432 !strict.

comment:17 Changed 8 years ago by bill

(In [25104]) Use true arg to aspect.after() so my handler doesn't affect the return value of the original function. Refs #12432, fixes #13033 !strict. Also fixing a missing require in grid test file.

comment:18 Changed 8 years ago by Douglas Hays

(In [25106]) Fixes #13035. Within dijit, replaced define(dojo? with

"dojo/_base/kernel" et al.

comment:19 Changed 8 years ago by bill

(In [25252]) More granular dependencies for dojo core modules, patch from Akira Sudoh (IBM, CCLA), thanks! Refs #12432 !strict.

comment:20 Changed 8 years ago by bill

(In [25372]) Explicitly require of dijit._base.popup where it's used, especially for AMD mode where it won't be included automatically. (A further improvement would be to start using dijit/popup.js instead of dijit/_base/popup.js, but that involves an API change.) Refs #12432 !strict.

comment:21 Changed 8 years ago by bill

(In [25400]) fix missing dependencies, refs #12432 !strict

comment:22 Changed 8 years ago by bill

(In [25402]) In async mode, avoid loading modules we aren't using directly. Refs #12432 !strict.

comment:23 Changed 8 years ago by ben hockey

(In [25413]) refs #12314 #12432 #12863 modifying dojox.mvc to make better use of AMD dependencies. !strict

comment:24 Changed 8 years ago by ben hockey

(In [25414]) refs #12314 #12432 #12863 removed unneeded 'exports' dep in dojox/mvc/Bind.js !strict

comment:25 Changed 8 years ago by ben hockey

(In [25476]) remove unnecessary dependency in dojo/string. refs #12432

comment:26 Changed 8 years ago by bill

(In [25613]) Remove dojo/query dependency from manager.js, and move deprecated getDependents() from _WidgetBase to _Widget so that _WidgetBase doesn't have dependency on dojo.query() either. Also, the explicit NodeList dependency in each of those files was unnecessary since NodeList wasn't being used directly.

Refs #12432 !strict

comment:27 Changed 8 years ago by ben hockey

(In [25684]) granular base dependencies for dojo/date/locale. refs #12432 !strict

comment:28 Changed 8 years ago by ben hockey

(In [25685]) granular base dependencies for dojo/cldr/supplemental. refs #12432 !strict

comment:29 Changed 8 years ago by ben hockey

(In [25686]) granular base dependencies for dojo/date/stamp. refs #12432 !strict

comment:30 Changed 8 years ago by ben hockey

(In [25690]) change i18n to only pull in the xhr dependency when it needs it. refs #12432 !strict

comment:31 Changed 8 years ago by bill

Description: modified (diff)

comment:32 Changed 8 years ago by bill

(In [25753]) Split off _FormValueWidget to a separate file for baseless AMD support. Refs #12432 !strict.

comment:33 Changed 8 years ago by Bryan Forbes

(In [25787]) Make AdapterRegistry?'s dependency list more granular. refs #12432 !strict

comment:34 Changed 8 years ago by Chris Mitchell

can we close out this ticket now for 1.7?

comment:35 Changed 8 years ago by Kris Zyp

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.