@atlaspack/bundler-default 2.12.1-dev.3502 → 2.12.1-dev.3520
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/bundlerConfig.js +2 -1
- package/lib/idealGraph.js +8 -1
- package/package.json +9 -9
- package/src/bundlerConfig.js +4 -0
- package/src/idealGraph.js +22 -1
package/lib/bundlerConfig.js
CHANGED
|
@@ -172,6 +172,7 @@ async function loadBundlerConfig(config, options, logger) {
|
|
|
172
172
|
maxParallelRequests: modeConfig.maxParallelRequests ?? defaults.maxParallelRequests,
|
|
173
173
|
projectRoot: options.projectRoot,
|
|
174
174
|
disableSharedBundles: modeConfig.disableSharedBundles ?? defaults.disableSharedBundles,
|
|
175
|
-
manualSharedBundles: modeConfig.manualSharedBundles ?? defaults.manualSharedBundles
|
|
175
|
+
manualSharedBundles: modeConfig.manualSharedBundles ?? defaults.manualSharedBundles,
|
|
176
|
+
loadConditionalBundlesInParallel: modeConfig.loadConditionalBundlesInParallel
|
|
176
177
|
};
|
|
177
178
|
}
|
package/lib/idealGraph.js
CHANGED
|
@@ -264,6 +264,13 @@ function createIdealGraph(assetGraph, config, entries, logger) {
|
|
|
264
264
|
value: bundle,
|
|
265
265
|
type: 'bundle'
|
|
266
266
|
}), dependencyPriorityEdges[dependency.priority]);
|
|
267
|
+
if ((config.loadConditionalBundlesInParallel ?? !bundle.env.shouldScopeHoist) && dependency.priority === 'conditional') {
|
|
268
|
+
// When configured (or serving code in development), serve conditional bundles in parallel so we don't get module not found errors
|
|
269
|
+
let [referencingBundleRoot, bundleGroupNodeId] = (0, _nullthrows().default)(stack[stack.length - 1]);
|
|
270
|
+
let referencingBundleId = (0, _nullthrows().default)(bundleRoots.get(referencingBundleRoot))[0];
|
|
271
|
+
bundleRoots.set(childAsset, [bundleId, bundleGroupNodeId]);
|
|
272
|
+
bundleGraph.addEdge(referencingBundleId, bundleId);
|
|
273
|
+
}
|
|
267
274
|
} else if (dependency.priority === 'parallel' || childAsset.bundleBehavior === 'inline') {
|
|
268
275
|
// The referencing bundleRoot is the root of a Bundle that first brings in another bundle (essentially the FIRST parent of a bundle, this may or may not be a bundleGroup)
|
|
269
276
|
let [referencingBundleRoot, bundleGroupNodeId] = (0, _nullthrows().default)(stack[stack.length - 1]);
|
|
@@ -419,7 +426,7 @@ function createIdealGraph(assetGraph, config, entries, logger) {
|
|
|
419
426
|
let bundleRoot = assets[0];
|
|
420
427
|
let bundle = (0, _nullthrows().default)(bundleGraph.getNode((0, _nullthrows().default)(bundles.get(bundleRoot.id))));
|
|
421
428
|
if (bundle !== 'root' && bundle.bundleBehavior == null && !bundle.env.isIsolated() && bundle.env.context === root.env.context) {
|
|
422
|
-
bundleRootGraph.addEdge(bundleRootId, (0, _nullthrows().default)(assetToBundleRootNodeId.get(bundleRoot)), dependency.priority === 'parallel' ? bundleRootEdgeTypes.parallel : bundleRootEdgeTypes.lazy);
|
|
429
|
+
bundleRootGraph.addEdge(bundleRootId, (0, _nullthrows().default)(assetToBundleRootNodeId.get(bundleRoot)), dependency.priority === 'parallel' || (config.loadConditionalBundlesInParallel ?? !bundle.env.shouldScopeHoist) && dependency.priority === 'conditional' ? bundleRootEdgeTypes.parallel : bundleRootEdgeTypes.lazy);
|
|
423
430
|
}
|
|
424
431
|
}
|
|
425
432
|
if (dependency.priority !== 'sync') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/bundler-default",
|
|
3
|
-
"version": "2.12.1-dev.
|
|
3
|
+
"version": "2.12.1-dev.3520+8a5346e28",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"source": "src/DefaultBundler.js",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">= 16.0.0",
|
|
16
|
-
"parcel": "^2.12.1-dev.
|
|
16
|
+
"parcel": "^2.12.1-dev.3520+8a5346e28"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/diagnostic": "2.12.1-dev.
|
|
20
|
-
"@atlaspack/feature-flags": "2.12.1-dev.
|
|
21
|
-
"@atlaspack/graph": "3.2.1-dev.
|
|
22
|
-
"@atlaspack/plugin": "2.12.1-dev.
|
|
23
|
-
"@atlaspack/rust": "2.12.1-dev.
|
|
24
|
-
"@atlaspack/utils": "2.12.1-dev.
|
|
19
|
+
"@atlaspack/diagnostic": "2.12.1-dev.3520+8a5346e28",
|
|
20
|
+
"@atlaspack/feature-flags": "2.12.1-dev.3520+8a5346e28",
|
|
21
|
+
"@atlaspack/graph": "3.2.1-dev.3520+8a5346e28",
|
|
22
|
+
"@atlaspack/plugin": "2.12.1-dev.3520+8a5346e28",
|
|
23
|
+
"@atlaspack/rust": "2.12.1-dev.3520+8a5346e28",
|
|
24
|
+
"@atlaspack/utils": "2.12.1-dev.3520+8a5346e28",
|
|
25
25
|
"nullthrows": "^1.1.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "8a5346e28c1bb3b9cd40f1c4e77c66dd6666f1e4"
|
|
28
28
|
}
|
package/src/bundlerConfig.js
CHANGED
|
@@ -27,6 +27,7 @@ type BaseBundlerConfig = {|
|
|
|
27
27
|
maxParallelRequests?: number,
|
|
28
28
|
disableSharedBundles?: boolean,
|
|
29
29
|
manualSharedBundles?: ManualSharedBundles,
|
|
30
|
+
loadConditionalBundlesInParallel?: boolean,
|
|
30
31
|
|};
|
|
31
32
|
|
|
32
33
|
type BundlerConfig = {|
|
|
@@ -40,6 +41,7 @@ export type ResolvedBundlerConfig = {|
|
|
|
40
41
|
projectRoot: string,
|
|
41
42
|
disableSharedBundles: boolean,
|
|
42
43
|
manualSharedBundles: ManualSharedBundles,
|
|
44
|
+
loadConditionalBundlesInParallel?: boolean,
|
|
43
45
|
|};
|
|
44
46
|
|
|
45
47
|
function resolveModeConfig(
|
|
@@ -226,5 +228,7 @@ export async function loadBundlerConfig(
|
|
|
226
228
|
modeConfig.disableSharedBundles ?? defaults.disableSharedBundles,
|
|
227
229
|
manualSharedBundles:
|
|
228
230
|
modeConfig.manualSharedBundles ?? defaults.manualSharedBundles,
|
|
231
|
+
loadConditionalBundlesInParallel:
|
|
232
|
+
modeConfig.loadConditionalBundlesInParallel,
|
|
229
233
|
};
|
|
230
234
|
}
|
package/src/idealGraph.js
CHANGED
|
@@ -362,6 +362,24 @@ export function createIdealGraph(
|
|
|
362
362
|
),
|
|
363
363
|
dependencyPriorityEdges[dependency.priority],
|
|
364
364
|
);
|
|
365
|
+
|
|
366
|
+
if (
|
|
367
|
+
(config.loadConditionalBundlesInParallel ??
|
|
368
|
+
!bundle.env.shouldScopeHoist) &&
|
|
369
|
+
dependency.priority === 'conditional'
|
|
370
|
+
) {
|
|
371
|
+
// When configured (or serving code in development), serve conditional bundles in parallel so we don't get module not found errors
|
|
372
|
+
let [referencingBundleRoot, bundleGroupNodeId] = nullthrows(
|
|
373
|
+
stack[stack.length - 1],
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
let referencingBundleId = nullthrows(
|
|
377
|
+
bundleRoots.get(referencingBundleRoot),
|
|
378
|
+
)[0];
|
|
379
|
+
|
|
380
|
+
bundleRoots.set(childAsset, [bundleId, bundleGroupNodeId]);
|
|
381
|
+
bundleGraph.addEdge(referencingBundleId, bundleId);
|
|
382
|
+
}
|
|
365
383
|
} else if (
|
|
366
384
|
dependency.priority === 'parallel' ||
|
|
367
385
|
childAsset.bundleBehavior === 'inline'
|
|
@@ -582,7 +600,10 @@ export function createIdealGraph(
|
|
|
582
600
|
bundleRootGraph.addEdge(
|
|
583
601
|
bundleRootId,
|
|
584
602
|
nullthrows(assetToBundleRootNodeId.get(bundleRoot)),
|
|
585
|
-
dependency.priority === 'parallel'
|
|
603
|
+
dependency.priority === 'parallel' ||
|
|
604
|
+
((config.loadConditionalBundlesInParallel ??
|
|
605
|
+
!bundle.env.shouldScopeHoist) &&
|
|
606
|
+
dependency.priority === 'conditional')
|
|
586
607
|
? bundleRootEdgeTypes.parallel
|
|
587
608
|
: bundleRootEdgeTypes.lazy,
|
|
588
609
|
);
|