@atlaspack/bundler-default 2.14.5-dev.73 → 2.14.5-dev.93

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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @atlaspack/bundler-default
2
2
 
3
+ ## 3.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
8
+ - @atlaspack/feature-flags@2.18.2
9
+ - @atlaspack/graph@3.5.4
10
+ - @atlaspack/utils@2.15.2
11
+ - @atlaspack/plugin@2.14.14
12
+
13
+ ## 3.0.4
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
18
+ - @atlaspack/feature-flags@2.18.1
19
+ - @atlaspack/utils@2.15.1
20
+ - @atlaspack/graph@3.5.3
21
+ - @atlaspack/plugin@2.14.13
22
+
23
+ ## 3.0.3
24
+
25
+ ### Patch Changes
26
+
27
+ - [#622](https://github.com/atlassian-labs/atlaspack/pull/622) [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c) Thanks [@benjervis](https://github.com/benjervis)! - Change the overlap calculation system in findMergeCandidates to improve performance
28
+
29
+ - Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2), [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
30
+ - @atlaspack/feature-flags@2.18.0
31
+ - @atlaspack/utils@2.15.0
32
+ - @atlaspack/graph@3.5.2
33
+ - @atlaspack/plugin@2.14.12
34
+
3
35
  ## 3.0.2
4
36
 
5
37
  ### Patch Changes
@@ -25,6 +25,13 @@ function _graph() {
25
25
  };
26
26
  return data;
27
27
  }
28
+ function _utils() {
29
+ const data = require("@atlaspack/utils");
30
+ _utils = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
28
35
  var _memoize = require("./memoize");
29
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
37
  function getBundlesForBundleGroup(bundleGraph, bundleGroupId) {
@@ -37,16 +44,16 @@ function getBundlesForBundleGroup(bundleGraph, bundleGroupId) {
37
44
  }, bundleGroupId);
38
45
  return count;
39
46
  }
40
- let getBundleOverlapBitSet = (sourceBundlesA, sourceBundlesB) => {
41
- let allSourceBundles = _graph().BitSet.union(sourceBundlesA, sourceBundlesB);
42
- let sharedSourceBundles = _graph().BitSet.intersect(sourceBundlesA, sourceBundlesB);
43
- return sharedSourceBundles.size() / allSourceBundles.size();
47
+ let getBundleOverlap = (sourceBundlesA, sourceBundlesB) => {
48
+ let allSourceBundles = (0, _utils().setUnion)(sourceBundlesA, sourceBundlesB);
49
+ let sharedSourceBundles = (0, _utils().setIntersectStatic)(sourceBundlesA, sourceBundlesB);
50
+ return sharedSourceBundles.size / allSourceBundles.size;
44
51
  };
45
52
 
46
53
  // Returns a decimal showing the proportion source bundles are common to
47
54
  // both bundles versus the total number of source bundles.
48
55
  function checkBundleThreshold(bundleA, bundleB, threshold) {
49
- return getBundleOverlapBitSet(bundleA.sourceBundleBitSet, bundleB.sourceBundleBitSet) >= threshold;
56
+ return getBundleOverlap(bundleA.bundle.sourceBundles, bundleB.bundle.sourceBundles) >= threshold;
50
57
  }
51
58
  let checkSharedSourceBundles = (0, _memoize.memoize)((bundle, importantAncestorBundles) => {
52
59
  return importantAncestorBundles.every(ancestorId => bundle.sourceBundles.has(ancestorId));
@@ -100,14 +107,9 @@ function getPossibleMergeCandidates(bundleGraph, bundles) {
100
107
  let mergeCandidates = bundles.map(bundleId => {
101
108
  let bundle = bundleGraph.getNode(bundleId);
102
109
  (0, _assert().default)(bundle && bundle !== 'root', 'Bundle should exist');
103
- let sourceBundleBitSet = new (_graph().BitSet)(bundleGraph.nodes.length);
104
- for (let sourceBundle of bundle.sourceBundles) {
105
- sourceBundleBitSet.add(sourceBundle);
106
- }
107
110
  return {
108
111
  id: bundleId,
109
112
  bundle,
110
- sourceBundleBitSet,
111
113
  contentKey: bundleId.toString()
112
114
  };
113
115
  });
package/lib/idealGraph.js CHANGED
@@ -109,15 +109,7 @@ function createIdealGraph(assetGraph, config, entries, logger) {
109
109
  }
110
110
  let assets = [];
111
111
  let assetToIndex = new Map();
112
- //Manual is a map of the user-given name to the bundle node Id that corresponds to ALL the assets that match any glob in that user-specified array
113
- let manualSharedMap = new Map();
114
- // May need a map to be able to look up NON- bundle root assets which need special case instructions
115
- // Use this when placing assets into bundles, to avoid duplication
116
- let manualAssetToBundle = new Map();
117
- let {
118
- manualAssetToConfig,
119
- constantModuleToMSB
120
- } = function makeManualAssetToConfigLookup() {
112
+ function makeManualAssetToConfigLookup() {
121
113
  let manualAssetToConfig = new Map();
122
114
  let constantModuleToMSB = new (_utils().DefaultMap)(() => []);
123
115
  if (config.manualSharedBundles.length === 0) {
@@ -181,7 +173,17 @@ function createIdealGraph(assetGraph, config, entries, logger) {
181
173
  manualAssetToConfig,
182
174
  constantModuleToMSB
183
175
  };
184
- }();
176
+ }
177
+
178
+ //Manual is a map of the user-given name to the bundle node Id that corresponds to ALL the assets that match any glob in that user-specified array
179
+ let manualSharedMap = new Map();
180
+ // May need a map to be able to look up NON- bundle root assets which need special case instructions
181
+ // Use this when placing assets into bundles, to avoid duplication
182
+ let manualAssetToBundle = new Map();
183
+ let {
184
+ manualAssetToConfig,
185
+ constantModuleToMSB
186
+ } = makeManualAssetToConfigLookup();
185
187
  let manualBundleToInternalizedAsset = new (_utils().DefaultMap)(() => []);
186
188
  let mergeSourceBundleLookup = new Map();
187
189
  let mergeSourceBundleAssets = new Set((_config$sharedBundleM = config.sharedBundleMerge) === null || _config$sharedBundleM === void 0 ? void 0 : _config$sharedBundleM.flatMap(c => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/bundler-default",
3
- "version": "2.14.5-dev.73+84eec3484",
3
+ "version": "2.14.5-dev.93+207d003c0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -16,14 +16,14 @@
16
16
  "node": ">= 16.0.0"
17
17
  },
18
18
  "dependencies": {
19
- "@atlaspack/diagnostic": "2.14.1-dev.141+84eec3484",
20
- "@atlaspack/feature-flags": "2.14.1-dev.141+84eec3484",
21
- "@atlaspack/graph": "3.4.1-dev.141+84eec3484",
22
- "@atlaspack/plugin": "2.14.5-dev.73+84eec3484",
23
- "@atlaspack/rust": "3.2.1-dev.73+84eec3484",
24
- "@atlaspack/utils": "2.14.5-dev.73+84eec3484",
19
+ "@atlaspack/diagnostic": "2.14.1-dev.161+207d003c0",
20
+ "@atlaspack/feature-flags": "2.14.1-dev.161+207d003c0",
21
+ "@atlaspack/graph": "3.4.1-dev.161+207d003c0",
22
+ "@atlaspack/plugin": "2.14.5-dev.93+207d003c0",
23
+ "@atlaspack/rust": "3.2.1-dev.93+207d003c0",
24
+ "@atlaspack/utils": "2.14.5-dev.93+207d003c0",
25
25
  "many-keys-map": "^1.0.3",
26
26
  "nullthrows": "^1.1.1"
27
27
  },
28
- "gitHead": "84eec348413c647de4872f902c4bc8ff54c347f3"
28
+ "gitHead": "207d003c0f1d4ffa6a1c52d2f8841d998616c523"
29
29
  }
@@ -2,8 +2,9 @@
2
2
 
3
3
  import invariant from 'assert';
4
4
  import nullthrows from 'nullthrows';
5
- import {ContentGraph, BitSet} from '@atlaspack/graph';
5
+ import {ContentGraph} from '@atlaspack/graph';
6
6
  import type {NodeId} from '@atlaspack/graph';
7
+ import {setUnion, setIntersectStatic} from '@atlaspack/utils';
7
8
  import type {Bundle, IdealBundleGraph} from './idealGraph';
8
9
  import {memoize, clearCaches} from './memoize';
9
10
 
@@ -20,14 +21,14 @@ function getBundlesForBundleGroup(
20
21
  return count;
21
22
  }
22
23
 
23
- let getBundleOverlapBitSet = (
24
- sourceBundlesA: BitSet,
25
- sourceBundlesB: BitSet,
24
+ let getBundleOverlap = (
25
+ sourceBundlesA: Set<NodeId>,
26
+ sourceBundlesB: Set<NodeId>,
26
27
  ): number => {
27
- let allSourceBundles = BitSet.union(sourceBundlesA, sourceBundlesB);
28
- let sharedSourceBundles = BitSet.intersect(sourceBundlesA, sourceBundlesB);
28
+ let allSourceBundles = setUnion(sourceBundlesA, sourceBundlesB);
29
+ let sharedSourceBundles = setIntersectStatic(sourceBundlesA, sourceBundlesB);
29
30
 
30
- return sharedSourceBundles.size() / allSourceBundles.size();
31
+ return sharedSourceBundles.size / allSourceBundles.size;
31
32
  };
32
33
 
33
34
  // Returns a decimal showing the proportion source bundles are common to
@@ -38,9 +39,9 @@ function checkBundleThreshold(
38
39
  threshold: number,
39
40
  ): boolean {
40
41
  return (
41
- getBundleOverlapBitSet(
42
- bundleA.sourceBundleBitSet,
43
- bundleB.sourceBundleBitSet,
42
+ getBundleOverlap(
43
+ bundleA.bundle.sourceBundles,
44
+ bundleB.bundle.sourceBundles,
44
45
  ) >= threshold
45
46
  );
46
47
  }
@@ -147,7 +148,6 @@ function getMergeClusters(
147
148
  type MergeCandidate = {|
148
149
  bundle: Bundle,
149
150
  id: NodeId,
150
- sourceBundleBitSet: BitSet,
151
151
  contentKey: string,
152
152
  |};
153
153
  function getPossibleMergeCandidates(
@@ -158,15 +158,9 @@ function getPossibleMergeCandidates(
158
158
  let bundle = bundleGraph.getNode(bundleId);
159
159
  invariant(bundle && bundle !== 'root', 'Bundle should exist');
160
160
 
161
- let sourceBundleBitSet = new BitSet(bundleGraph.nodes.length);
162
- for (let sourceBundle of bundle.sourceBundles) {
163
- sourceBundleBitSet.add(sourceBundle);
164
- }
165
-
166
161
  return {
167
162
  id: bundleId,
168
163
  bundle,
169
- sourceBundleBitSet,
170
164
  contentKey: bundleId.toString(),
171
165
  };
172
166
  });