@atlaspack/bundler-default 2.13.2-canary.3689 → 2.13.2-canary.3691

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.
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addJSMonolithBundle = addJSMonolithBundle;
7
- function _assert() {
8
- const data = _interopRequireDefault(require("assert"));
9
- _assert = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
7
  function _nullthrows() {
15
8
  const data = _interopRequireDefault(require("nullthrows"));
16
9
  _nullthrows = function () {
@@ -44,37 +37,37 @@ function addJSMonolithBundle(bundleGraph, entryAsset, entryDep) {
44
37
  return;
45
38
  }
46
39
  let assets = bundleGraph.getDependencyAssets(dependency);
47
- (0, _assert().default)(assets.length === 1, 'Expected dependency to have exactly one asset');
48
- let asset = assets[0];
49
-
50
- // For assets marked as isolated, we create new bundles and let other
51
- // plugins like optimizers include them in the primary bundle
52
- if (asset.bundleBehavior === 'isolated') {
53
- // Create a new bundle to hold the isolated asset
54
- let isolatedBundle = bundleGraph.createBundle({
55
- entryAsset: asset,
56
- target,
57
- bundleBehavior: 'isolated'
58
- });
59
- bundleGraph.addAssetToBundle(asset, isolatedBundle);
40
+ for (const asset of assets) {
41
+ // For assets marked as isolated, we create new bundles and let other
42
+ // plugins like optimizers include them in the primary bundle
43
+ if (asset.bundleBehavior === 'isolated') {
44
+ // Create a new bundle to hold the isolated asset
45
+ let isolatedBundle = bundleGraph.createBundle({
46
+ entryAsset: asset,
47
+ target,
48
+ bundleBehavior: 'isolated'
49
+ });
50
+ bundleGraph.addAssetToBundle(asset, isolatedBundle);
60
51
 
61
- // Add the new bundle to the bundle graph, in its own bundle group
62
- bundleGraph.createBundleReference(bundle, isolatedBundle);
63
- bundleGraph.addBundleToBundleGroup(isolatedBundle, bundleGraph.createBundleGroup(dependency, target));
52
+ // Add the new bundle to the bundle graph, in its own bundle group
53
+ bundleGraph.createBundleReference(bundle, isolatedBundle);
54
+ bundleGraph.addBundleToBundleGroup(isolatedBundle, bundleGraph.createBundleGroup(dependency, target));
64
55
 
65
- // Nothing below the isolated asset needs to go in the main bundle, so
66
- // we can stop traversal here
67
- actions.skipChildren();
56
+ // Nothing below the isolated asset needs to go in the main bundle, so
57
+ // we can stop traversal here
58
+ actions.skipChildren();
68
59
 
69
- // To be properly isolated, all of this asset's dependencies need to go
70
- // in this new bundle
71
- bundleGraph.traverse(subNode => {
72
- if (subNode.type === 'asset' && subNode.value.type === 'js') {
73
- bundleGraph.addAssetToBundle(subNode.value, isolatedBundle);
74
- }
75
- }, asset, {
76
- skipUnusedDependencies: true
77
- });
60
+ // To be properly isolated, all of this asset's dependencies need to go
61
+ // in this new bundle
62
+ bundleGraph.traverse(subNode => {
63
+ if (subNode.type === 'asset' && subNode.value.type === 'js') {
64
+ bundleGraph.addAssetToBundle(subNode.value, isolatedBundle);
65
+ return;
66
+ }
67
+ }, asset, {
68
+ skipUnusedDependencies: true
69
+ });
70
+ }
78
71
  }
79
72
  }, entryAsset, {
80
73
  skipUnusedDependencies: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/bundler-default",
3
- "version": "2.13.2-canary.3689+8bc3db94c",
3
+ "version": "2.13.2-canary.3691+67df3f1af",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,17 +12,17 @@
12
12
  "main": "lib/DefaultBundler.js",
13
13
  "source": "src/DefaultBundler.js",
14
14
  "engines": {
15
- "atlaspack": "2.13.2-canary.3689+8bc3db94c",
15
+ "atlaspack": "2.13.2-canary.3691+67df3f1af",
16
16
  "node": ">= 16.0.0"
17
17
  },
18
18
  "dependencies": {
19
- "@atlaspack/diagnostic": "2.13.2-canary.3689+8bc3db94c",
20
- "@atlaspack/feature-flags": "2.13.2-canary.3689+8bc3db94c",
21
- "@atlaspack/graph": "3.3.2-canary.3689+8bc3db94c",
22
- "@atlaspack/plugin": "2.13.2-canary.3689+8bc3db94c",
23
- "@atlaspack/rust": "2.13.2-canary.3689+8bc3db94c",
24
- "@atlaspack/utils": "2.13.2-canary.3689+8bc3db94c",
19
+ "@atlaspack/diagnostic": "2.13.2-canary.3691+67df3f1af",
20
+ "@atlaspack/feature-flags": "2.13.2-canary.3691+67df3f1af",
21
+ "@atlaspack/graph": "3.3.2-canary.3691+67df3f1af",
22
+ "@atlaspack/plugin": "2.13.2-canary.3691+67df3f1af",
23
+ "@atlaspack/rust": "2.13.2-canary.3691+67df3f1af",
24
+ "@atlaspack/utils": "2.13.2-canary.3691+67df3f1af",
25
25
  "nullthrows": "^1.1.1"
26
26
  },
27
- "gitHead": "8bc3db94cc7382b22ca8207c92af8f6389c17e2e"
27
+ "gitHead": "67df3f1af1432d77ee6b8850010d976d3313693a"
28
28
  }
@@ -1,6 +1,5 @@
1
1
  // @flow strict-local
2
2
  import type {Asset, Dependency, MutableBundleGraph} from '@atlaspack/types';
3
- import invariant from 'assert';
4
3
  import nullthrows from 'nullthrows';
5
4
 
6
5
  export function addJSMonolithBundle(
@@ -38,48 +37,44 @@ export function addJSMonolithBundle(
38
37
  }
39
38
 
40
39
  let assets = bundleGraph.getDependencyAssets(dependency);
41
- invariant(
42
- assets.length === 1,
43
- 'Expected dependency to have exactly one asset',
44
- );
45
40
 
46
- let asset = assets[0];
41
+ for (const asset of assets) {
42
+ // For assets marked as isolated, we create new bundles and let other
43
+ // plugins like optimizers include them in the primary bundle
44
+ if (asset.bundleBehavior === 'isolated') {
45
+ // Create a new bundle to hold the isolated asset
46
+ let isolatedBundle = bundleGraph.createBundle({
47
+ entryAsset: asset,
48
+ target,
49
+ bundleBehavior: 'isolated',
50
+ });
47
51
 
48
- // For assets marked as isolated, we create new bundles and let other
49
- // plugins like optimizers include them in the primary bundle
50
- if (asset.bundleBehavior === 'isolated') {
51
- // Create a new bundle to hold the isolated asset
52
- let isolatedBundle = bundleGraph.createBundle({
53
- entryAsset: asset,
54
- target,
55
- bundleBehavior: 'isolated',
56
- });
52
+ bundleGraph.addAssetToBundle(asset, isolatedBundle);
57
53
 
58
- bundleGraph.addAssetToBundle(asset, isolatedBundle);
54
+ // Add the new bundle to the bundle graph, in its own bundle group
55
+ bundleGraph.createBundleReference(bundle, isolatedBundle);
56
+ bundleGraph.addBundleToBundleGroup(
57
+ isolatedBundle,
58
+ bundleGraph.createBundleGroup(dependency, target),
59
+ );
59
60
 
60
- // Add the new bundle to the bundle graph, in its own bundle group
61
- bundleGraph.createBundleReference(bundle, isolatedBundle);
62
- bundleGraph.addBundleToBundleGroup(
63
- isolatedBundle,
64
- bundleGraph.createBundleGroup(dependency, target),
65
- );
61
+ // Nothing below the isolated asset needs to go in the main bundle, so
62
+ // we can stop traversal here
63
+ actions.skipChildren();
66
64
 
67
- // Nothing below the isolated asset needs to go in the main bundle, so
68
- // we can stop traversal here
69
- actions.skipChildren();
70
-
71
- // To be properly isolated, all of this asset's dependencies need to go
72
- // in this new bundle
73
- bundleGraph.traverse(
74
- (subNode) => {
75
- if (subNode.type === 'asset' && subNode.value.type === 'js') {
76
- bundleGraph.addAssetToBundle(subNode.value, isolatedBundle);
77
- return;
78
- }
79
- },
80
- asset,
81
- {skipUnusedDependencies: true},
82
- );
65
+ // To be properly isolated, all of this asset's dependencies need to go
66
+ // in this new bundle
67
+ bundleGraph.traverse(
68
+ (subNode) => {
69
+ if (subNode.type === 'asset' && subNode.value.type === 'js') {
70
+ bundleGraph.addAssetToBundle(subNode.value, isolatedBundle);
71
+ return;
72
+ }
73
+ },
74
+ asset,
75
+ {skipUnusedDependencies: true},
76
+ );
77
+ }
83
78
  }
84
79
  },
85
80
  entryAsset,