@atlaspack/bundler-default 2.12.1-dev.3398 → 2.12.1-dev.3443

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.
@@ -53,6 +53,13 @@ function _diagnostic() {
53
53
  };
54
54
  return data;
55
55
  }
56
+ function _featureFlags() {
57
+ const data = require("@atlaspack/feature-flags");
58
+ _featureFlags = function () {
59
+ return data;
60
+ };
61
+ return data;
62
+ }
56
63
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
57
64
  // Default options by http version.
58
65
  const HTTP_OPTIONS = {
@@ -77,7 +84,8 @@ const HTTP_OPTIONS = {
77
84
  const dependencyPriorityEdges = {
78
85
  sync: 1,
79
86
  parallel: 2,
80
- lazy: 3
87
+ lazy: 3,
88
+ conditional: 4
81
89
  };
82
90
 
83
91
  // IdealGraph is the structure we will pass to decorate,
@@ -380,7 +388,7 @@ function createIdealGraph(assetGraph, config, entries, logger) {
380
388
  manualAssetToConfig.set(node.value, c);
381
389
  return;
382
390
  }
383
- if (node.type === 'dependency' && node.value.priority === 'lazy' && parentAsset) {
391
+ if (node.type === 'dependency' && (node.value.priority === 'lazy' || (0, _featureFlags().getFeatureFlag)('conditionalBundlingApi') && node.value.priority === 'conditional') && parentAsset) {
384
392
  // Don't walk past the bundle group assets
385
393
  actions.skipChildren();
386
394
  }
@@ -438,11 +446,11 @@ function createIdealGraph(assetGraph, config, entries, logger) {
438
446
  manualSharedBundleKey = manualSharedObject.name + ',' + childAsset.type;
439
447
  }
440
448
  if (
441
- // MSB Step 3: If a bundle for these globs already exsits, use it
449
+ // MSB Step 3: If a bundle for these globs already exists, use it
442
450
  manualSharedBundleKey != null && manualSharedMap.has(manualSharedBundleKey)) {
443
451
  bundleId = (0, _nullthrows().default)(manualSharedMap.get(manualSharedBundleKey));
444
452
  }
445
- if (dependency.priority === 'lazy' || childAsset.bundleBehavior === 'isolated' // An isolated Dependency, or Bundle must contain all assets it needs to load.
453
+ if (dependency.priority === 'lazy' || (0, _featureFlags().getFeatureFlag)('conditionalBundlingApi') && node.value.priority === 'conditional' || childAsset.bundleBehavior === 'isolated' // An isolated Dependency, or Bundle must contain all assets it needs to load.
446
454
  ) {
447
455
  if (bundleId == null) {
448
456
  let firstBundleGroup = (0, _nullthrows().default)(bundleGraph.getNode(stack[0][1]));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaspack/bundler-default",
3
- "version": "2.12.1-dev.3398+81c73b3cd",
4
- "license": "MIT",
3
+ "version": "2.12.1-dev.3443+d1170cfc7",
4
+ "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -13,15 +13,16 @@
13
13
  "source": "src/DefaultBundler.js",
14
14
  "engines": {
15
15
  "node": ">= 16.0.0",
16
- "parcel": "^2.12.1-dev.3398+81c73b3cd"
16
+ "parcel": "^2.12.1-dev.3443+d1170cfc7"
17
17
  },
18
18
  "dependencies": {
19
- "@atlaspack/diagnostic": "2.12.1-dev.3398+81c73b3cd",
20
- "@atlaspack/graph": "3.2.1-dev.3398+81c73b3cd",
21
- "@atlaspack/plugin": "2.12.1-dev.3398+81c73b3cd",
22
- "@atlaspack/rust": "2.12.1-dev.3398+81c73b3cd",
23
- "@atlaspack/utils": "2.12.1-dev.3398+81c73b3cd",
19
+ "@atlaspack/diagnostic": "2.12.1-dev.3443+d1170cfc7",
20
+ "@atlaspack/feature-flags": "2.12.1-dev.3443+d1170cfc7",
21
+ "@atlaspack/graph": "3.2.1-dev.3443+d1170cfc7",
22
+ "@atlaspack/plugin": "2.12.1-dev.3443+d1170cfc7",
23
+ "@atlaspack/rust": "2.12.1-dev.3443+d1170cfc7",
24
+ "@atlaspack/utils": "2.12.1-dev.3443+d1170cfc7",
24
25
  "nullthrows": "^1.1.1"
25
26
  },
26
- "gitHead": "81c73b3cdf93adf8b0013be9fed5422579bd5910"
27
+ "gitHead": "d1170cfc79beb290b2a066f472f68f71f7d7cb23"
27
28
  }
@@ -23,6 +23,7 @@ import {validateSchema, DefaultMap, globToRegex} from '@atlaspack/utils';
23
23
  import nullthrows from 'nullthrows';
24
24
  import path from 'path';
25
25
  import {encodeJSONKeyComponent} from '@atlaspack/diagnostic';
26
+ import {getFeatureFlag} from '@atlaspack/feature-flags';
26
27
 
27
28
  type Glob = string;
28
29
 
@@ -95,6 +96,7 @@ const dependencyPriorityEdges = {
95
96
  sync: 1,
96
97
  parallel: 2,
97
98
  lazy: 3,
99
+ conditional: 4,
98
100
  };
99
101
 
100
102
  type DependencyBundleGraph = ContentGraph<
@@ -495,7 +497,9 @@ function createIdealGraph(
495
497
 
496
498
  if (
497
499
  node.type === 'dependency' &&
498
- node.value.priority === 'lazy' &&
500
+ (node.value.priority === 'lazy' ||
501
+ (getFeatureFlag('conditionalBundlingApi') &&
502
+ node.value.priority === 'conditional')) &&
499
503
  parentAsset
500
504
  ) {
501
505
  // Don't walk past the bundle group assets
@@ -576,7 +580,7 @@ function createIdealGraph(
576
580
  }
577
581
 
578
582
  if (
579
- // MSB Step 3: If a bundle for these globs already exsits, use it
583
+ // MSB Step 3: If a bundle for these globs already exists, use it
580
584
  manualSharedBundleKey != null &&
581
585
  manualSharedMap.has(manualSharedBundleKey)
582
586
  ) {
@@ -584,6 +588,8 @@ function createIdealGraph(
584
588
  }
585
589
  if (
586
590
  dependency.priority === 'lazy' ||
591
+ (getFeatureFlag('conditionalBundlingApi') &&
592
+ node.value.priority === 'conditional') ||
587
593
  childAsset.bundleBehavior === 'isolated' // An isolated Dependency, or Bundle must contain all assets it needs to load.
588
594
  ) {
589
595
  if (bundleId == null) {