@atlaspack/runtime-js 2.12.1-canary.3567 → 2.12.1-canary.3568
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/JSRuntime.js +6 -3
- package/package.json +7 -7
- package/src/JSRuntime.js +20 -10
package/lib/JSRuntime.js
CHANGED
|
@@ -406,9 +406,12 @@ function getLoaderRuntime({
|
|
|
406
406
|
let conditionalDependencies = externalBundles.flatMap(to => getDependencies(to).conditionalDependencies);
|
|
407
407
|
for (const cond of bundleGraph.getConditionsForDependencies(conditionalDependencies, bundle)) {
|
|
408
408
|
// This bundle has a conditional dependency, we need to load the bundle group
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
const ifTrueLoaders = cond.ifTrueBundles.map(targetBundle => getLoaderForBundle(bundle, targetBundle));
|
|
410
|
+
const ifFalseLoaders = cond.ifFalseBundles.map(targetBundle => getLoaderForBundle(bundle, targetBundle));
|
|
411
|
+
if (ifTrueLoaders.length > 0 || ifFalseLoaders.length > 0) {
|
|
412
|
+
// Load conditional bundles with helper (and a dev mode with additional hints)
|
|
413
|
+
loaderModules.push(`require('./helpers/conditional-loader${options.mode === 'development' ? '-dev' : ''}')('${cond.key}', function (){return Promise.all([${ifTrueLoaders.join(',')}]);}, function (){return Promise.all([${ifFalseLoaders.join(',')}]);})`);
|
|
414
|
+
}
|
|
412
415
|
}
|
|
413
416
|
}
|
|
414
417
|
for (let to of externalBundles) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/runtime-js",
|
|
3
|
-
"version": "2.12.1-canary.
|
|
3
|
+
"version": "2.12.1-canary.3568+2bb7fb28f",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
"main": "lib/JSRuntime.js",
|
|
13
13
|
"source": "src/JSRuntime.js",
|
|
14
14
|
"engines": {
|
|
15
|
-
"atlaspack": "2.12.1-canary.
|
|
15
|
+
"atlaspack": "2.12.1-canary.3568+2bb7fb28f",
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/diagnostic": "2.12.1-canary.
|
|
20
|
-
"@atlaspack/feature-flags": "2.12.1-canary.
|
|
21
|
-
"@atlaspack/plugin": "2.12.1-canary.
|
|
22
|
-
"@atlaspack/utils": "2.12.1-canary.
|
|
19
|
+
"@atlaspack/diagnostic": "2.12.1-canary.3568+2bb7fb28f",
|
|
20
|
+
"@atlaspack/feature-flags": "2.12.1-canary.3568+2bb7fb28f",
|
|
21
|
+
"@atlaspack/plugin": "2.12.1-canary.3568+2bb7fb28f",
|
|
22
|
+
"@atlaspack/utils": "2.12.1-canary.3568+2bb7fb28f",
|
|
23
23
|
"nullthrows": "^1.1.1"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "2bb7fb28f58d6d8e17c7917c4d0be72df125c328"
|
|
26
26
|
}
|
package/src/JSRuntime.js
CHANGED
|
@@ -483,17 +483,27 @@ function getLoaderRuntime({
|
|
|
483
483
|
bundle,
|
|
484
484
|
)) {
|
|
485
485
|
// This bundle has a conditional dependency, we need to load the bundle group
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}')('${cond.key}', function (){return Promise.all([${cond.ifTrueBundles
|
|
492
|
-
.map((targetBundle) => getLoaderForBundle(bundle, targetBundle))
|
|
493
|
-
.join(',')}]);}, function (){return Promise.all([${cond.ifFalseBundles
|
|
494
|
-
.map((targetBundle) => getLoaderForBundle(bundle, targetBundle))
|
|
495
|
-
.join(',')}]);})`,
|
|
486
|
+
const ifTrueLoaders = cond.ifTrueBundles.map((targetBundle) =>
|
|
487
|
+
getLoaderForBundle(bundle, targetBundle),
|
|
488
|
+
);
|
|
489
|
+
const ifFalseLoaders = cond.ifFalseBundles.map((targetBundle) =>
|
|
490
|
+
getLoaderForBundle(bundle, targetBundle),
|
|
496
491
|
);
|
|
492
|
+
|
|
493
|
+
if (ifTrueLoaders.length > 0 || ifFalseLoaders.length > 0) {
|
|
494
|
+
// Load conditional bundles with helper (and a dev mode with additional hints)
|
|
495
|
+
loaderModules.push(
|
|
496
|
+
`require('./helpers/conditional-loader${
|
|
497
|
+
options.mode === 'development' ? '-dev' : ''
|
|
498
|
+
}')('${
|
|
499
|
+
cond.key
|
|
500
|
+
}', function (){return Promise.all([${ifTrueLoaders.join(
|
|
501
|
+
',',
|
|
502
|
+
)}]);}, function (){return Promise.all([${ifFalseLoaders.join(
|
|
503
|
+
',',
|
|
504
|
+
)}]);})`,
|
|
505
|
+
);
|
|
506
|
+
}
|
|
497
507
|
}
|
|
498
508
|
}
|
|
499
509
|
|