@atlaspack/bundler-default 2.14.5-dev.1c70d50f9.99 → 2.14.5-dev.69

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,49 +1,5 @@
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
-
35
- ## 3.0.2
36
-
37
- ### Patch Changes
38
-
39
- - [#613](https://github.com/atlassian-labs/atlaspack/pull/613) [`4ca19d8`](https://github.com/atlassian-labs/atlaspack/commit/4ca19d8060dfcd279183e4039f2ecb43334ac44c) Thanks [@marcins](https://github.com/marcins)! - Ensure that constant modules are correctly included in MSBs even if they wouldn't otherwise be.
40
-
41
- - Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
42
- - @atlaspack/feature-flags@2.17.0
43
- - @atlaspack/graph@3.5.1
44
- - @atlaspack/utils@2.14.11
45
- - @atlaspack/plugin@2.14.11
46
-
47
3
  ## 3.0.1
48
4
 
49
5
  ### Patch Changes
@@ -25,13 +25,6 @@ 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
- }
35
28
  var _memoize = require("./memoize");
36
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
30
  function getBundlesForBundleGroup(bundleGraph, bundleGroupId) {
@@ -44,16 +37,16 @@ function getBundlesForBundleGroup(bundleGraph, bundleGroupId) {
44
37
  }, bundleGroupId);
45
38
  return count;
46
39
  }
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;
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();
51
44
  };
52
45
 
53
46
  // Returns a decimal showing the proportion source bundles are common to
54
47
  // both bundles versus the total number of source bundles.
55
48
  function checkBundleThreshold(bundleA, bundleB, threshold) {
56
- return getBundleOverlap(bundleA.bundle.sourceBundles, bundleB.bundle.sourceBundles) >= threshold;
49
+ return getBundleOverlapBitSet(bundleA.sourceBundleBitSet, bundleB.sourceBundleBitSet) >= threshold;
57
50
  }
58
51
  let checkSharedSourceBundles = (0, _memoize.memoize)((bundle, importantAncestorBundles) => {
59
52
  return importantAncestorBundles.every(ancestorId => bundle.sourceBundles.has(ancestorId));
@@ -107,9 +100,14 @@ function getPossibleMergeCandidates(bundleGraph, bundles) {
107
100
  let mergeCandidates = bundles.map(bundleId => {
108
101
  let bundle = bundleGraph.getNode(bundleId);
109
102
  (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
+ }
110
107
  return {
111
108
  id: bundleId,
112
109
  bundle,
110
+ sourceBundleBitSet,
113
111
  contentKey: bundleId.toString()
114
112
  };
115
113
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/bundler-default",
3
- "version": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
3
+ "version": "2.14.5-dev.69+67cb517ae",
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.1c70d50f9.167+1c70d50f9",
20
- "@atlaspack/feature-flags": "2.14.1-dev.1c70d50f9.167+1c70d50f9",
21
- "@atlaspack/graph": "3.4.1-dev.1c70d50f9.167+1c70d50f9",
22
- "@atlaspack/plugin": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
23
- "@atlaspack/rust": "3.2.1-dev.1c70d50f9.99+1c70d50f9",
24
- "@atlaspack/utils": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
19
+ "@atlaspack/diagnostic": "2.14.1-dev.137+67cb517ae",
20
+ "@atlaspack/feature-flags": "2.14.1-dev.137+67cb517ae",
21
+ "@atlaspack/graph": "3.4.1-dev.137+67cb517ae",
22
+ "@atlaspack/plugin": "2.14.5-dev.69+67cb517ae",
23
+ "@atlaspack/rust": "3.2.1-dev.69+67cb517ae",
24
+ "@atlaspack/utils": "2.14.5-dev.69+67cb517ae",
25
25
  "many-keys-map": "^1.0.3",
26
26
  "nullthrows": "^1.1.1"
27
27
  },
28
- "gitHead": "1c70d50f914cb662515b0b61053e51a06f3af234"
28
+ "gitHead": "67cb517ae793046fb5a0d2ef02ba74510fefccf3"
29
29
  }
@@ -2,9 +2,8 @@
2
2
 
3
3
  import invariant from 'assert';
4
4
  import nullthrows from 'nullthrows';
5
- import {ContentGraph} from '@atlaspack/graph';
5
+ import {ContentGraph, BitSet} from '@atlaspack/graph';
6
6
  import type {NodeId} from '@atlaspack/graph';
7
- import {setUnion, setIntersectStatic} from '@atlaspack/utils';
8
7
  import type {Bundle, IdealBundleGraph} from './idealGraph';
9
8
  import {memoize, clearCaches} from './memoize';
10
9
 
@@ -21,14 +20,14 @@ function getBundlesForBundleGroup(
21
20
  return count;
22
21
  }
23
22
 
24
- let getBundleOverlap = (
25
- sourceBundlesA: Set<NodeId>,
26
- sourceBundlesB: Set<NodeId>,
23
+ let getBundleOverlapBitSet = (
24
+ sourceBundlesA: BitSet,
25
+ sourceBundlesB: BitSet,
27
26
  ): number => {
28
- let allSourceBundles = setUnion(sourceBundlesA, sourceBundlesB);
29
- let sharedSourceBundles = setIntersectStatic(sourceBundlesA, sourceBundlesB);
27
+ let allSourceBundles = BitSet.union(sourceBundlesA, sourceBundlesB);
28
+ let sharedSourceBundles = BitSet.intersect(sourceBundlesA, sourceBundlesB);
30
29
 
31
- return sharedSourceBundles.size / allSourceBundles.size;
30
+ return sharedSourceBundles.size() / allSourceBundles.size();
32
31
  };
33
32
 
34
33
  // Returns a decimal showing the proportion source bundles are common to
@@ -39,9 +38,9 @@ function checkBundleThreshold(
39
38
  threshold: number,
40
39
  ): boolean {
41
40
  return (
42
- getBundleOverlap(
43
- bundleA.bundle.sourceBundles,
44
- bundleB.bundle.sourceBundles,
41
+ getBundleOverlapBitSet(
42
+ bundleA.sourceBundleBitSet,
43
+ bundleB.sourceBundleBitSet,
45
44
  ) >= threshold
46
45
  );
47
46
  }
@@ -148,6 +147,7 @@ function getMergeClusters(
148
147
  type MergeCandidate = {|
149
148
  bundle: Bundle,
150
149
  id: NodeId,
150
+ sourceBundleBitSet: BitSet,
151
151
  contentKey: string,
152
152
  |};
153
153
  function getPossibleMergeCandidates(
@@ -158,9 +158,15 @@ 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
+
161
166
  return {
162
167
  id: bundleId,
163
168
  bundle,
169
+ sourceBundleBitSet,
164
170
  contentKey: bundleId.toString(),
165
171
  };
166
172
  });