Opened 11 years ago
Closed 10 years ago
#14092 closed enhancement (fixed)
AMD loader support for Dojo 1.6 built layer files
Reported by: | Chris Mitchell | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7.3 |
Component: | Core | Version: | 1.6.1 |
Keywords: | Cc: | [email protected]…, cjolif | |
Blocked By: | #14989 | Blocking: |
Description (last modified by )
The Dojo 1.7 AMD loader supports loading Dojo 1.6 formatted source modules, but does not support optimized/built layers for modules. We have received a number of requests from users that are doing early testing on 1.7beta6 for this support. Please consider for 1.7.1, since 1.7 is now feature frozen.
Change History (41)
comment:1 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Milestone: | 1.7 → 1.7.1 |
comment:2 Changed 11 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 11 years ago by
Cc: | cjolif added |
---|
comment:4 Changed 11 years ago by
Milestone: | 1.7.1 → future |
---|---|
Status: | new → assigned |
comment:5 Changed 11 years ago by
comment:10 Changed 10 years ago by
Milestone: | future → 1.7.2 |
---|
comment:14 Changed 10 years ago by
preloadLocalizations works as per 1.6- by default. It is possible to force the builder to omit the preloadLocalization calls by
- setting the build control flag
preloadLocalizations
to falsy
- not setting
preloadLocalizations
and setting the build control property
defaultConfig.async
to truthy
If preloadLocalizations
is truthy, then preloadLocalization calls will be inserted into layer modules unconditionally.
comment:15 Changed 10 years ago by
Milestone: | 1.7.2 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
v1.6 flattened NLS bundles often contain multiple dojo.provide's and never look like unbuilt v1.6- bundles. This causes the evalBundle
in the "dojo-v1x-i18n-Api" has branch as given by the previous repairs to this ticket to fail because it must use
checkForLegacyModules
to find legacy-style global variables defined consequent to evaluating the bundle.
Also, v1.6 converted localized bundle module names to legal JavaScript? ids by replacing the locale dashes with underscores. This causes checkForLegacyModules
in the previous repairs to this ticket to fail.
comment:17 Changed 10 years ago by
Status: | reopened → assigned |
---|
comment:19 Changed 10 years ago by
Milestone: | → 1.7.3 |
---|
comment:20 Changed 10 years ago by
Once built (using the standard build profile w/ noref), dojo/cldr/nls/en/*
are getting defined as nonmodule. This is not so good! I’m still trying to trace out why this is happening but thought I’d put feedback here in case someone else might know more quickly.
comment:21 Changed 10 years ago by
I’m still not sure why or where this is happening, but the cache entry for the bundle is becoming closured by evalBundle
which means that the wrong define
is called (the one from inside evalBundle
and the module value is never defined. Replacing evalBundle
with a no-op function “fixes” the problem.
comment:22 Changed 10 years ago by
This is happening because dijit/nls/dijit-all_en-us
is treated as a legacy i18n bundle, so *that* module gets wrapped in the evalBundle
closure, and then define
is shadowed for *all* the functions. Since we aren’t looking for any deferred calls to define, patching evalBundle to look like this seems like it would work:
new Function("bundle", "__evalError", "__checkForLegacyModules", "__mid", "var __amdResult, define = function(x){__amdResult= x;}," + "ret = [(function(){" + "try{eval(arguments[0]);}catch(e){}" + "if(__amdResult)return 0;" + "if((__checkForLegacyModules = __checkForLegacyModules(__mid)))return __checkForLegacyModules;" + "try{return eval('('+arguments[0]+')');}" + "catch(e){__evalError.e = e; return __evalError;}" + "})(bundle),__amdResult]; define = this.define; return ret;" )
The only change here is basically that after evaluating the return value, define is replaced with the global define again.
Rawld, thoughts please? (This same fix applies for both before and after [28053].)
Also, even with this change and a noref build, when loading cross-domain, extra requests are being triggered for the /en/ bundles.
comment:23 Changed 10 years ago by
Blocked By: | 14989 added |
---|
comment:24 Changed 10 years ago by
The problem is that the current design doesn't account for flattened (built) NLS resources which were added in 1.7.2. The evalBundle function must detect and properly process the following
- single NLS bundles expressed as AMD a single AMD module
- multiple NLS bundles expressed as an AMD a layer
- single legacy AMD bundles
- multiple NLS bundles expressed as a flattened NLS layer as built by the legacy builder
The current design fails to handle Case 2.
comment:28 Changed 10 years ago by
@csnover: I've tested both not xdomain and xdomain and it seems to work afer 28126; let me know what you find at your convenience.
Keeping ticket open until I get confirmation from others that this repair works universally.
comment:29 follow-up: 31 Changed 10 years ago by
comment:30 Changed 10 years ago by
Priority: | high → blocker |
---|
Rawld, could you please confirm my previous question? Also, these patches for correctly evaluating built NLS layers need to be backported to 1.7.3.
comment:31 Changed 10 years ago by
comment:33 Changed 10 years ago by
Replying to csnover:
[28124] through [28126] and comment:22.
my response to comment:22 is at comment:24. I confirm that [28126] is the best fix I know of at this time. afaik, this is working correctly in trunk. I've rx'd no additional reports/complaints since comment:28, now 6 weeks ago.
This issue was partially fixed by #13845. However additional problems arise with for example resource bundles loading.