@atlaspack/bundler-default 2.14.5-canary.9 → 2.14.5-dev.55

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,84 @@
1
1
  # @atlaspack/bundler-default
2
2
 
3
+ ## 2.16.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`e052521`](https://github.com/atlassian-labs/atlaspack/commit/e0525210850ed1606146eb86991049cf567c5dec), [`15c6d70`](https://github.com/atlassian-labs/atlaspack/commit/15c6d7000bd89da876bc590aa75b17a619a41896), [`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6), [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`42a775d`](https://github.com/atlassian-labs/atlaspack/commit/42a775de8eec638ad188f3271964170d8c04d84b), [`29c2f10`](https://github.com/atlassian-labs/atlaspack/commit/29c2f106de9679adfb5afa04e1910471dc65a427), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b), [`1ef91fc`](https://github.com/atlassian-labs/atlaspack/commit/1ef91fcc863fdd2831511937083dbbc1263b3d9d)]:
8
+ - @atlaspack/rust@3.3.4
9
+ - @atlaspack/feature-flags@2.16.0
10
+ - @atlaspack/utils@2.14.9
11
+ - @atlaspack/graph@3.4.7
12
+ - @atlaspack/plugin@2.14.9
13
+
14
+ ## 2.16.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b), [`1ab0a27`](https://github.com/atlassian-labs/atlaspack/commit/1ab0a275aeca40350415e2b03e7440d1dddc6228), [`b8a4ae8`](https://github.com/atlassian-labs/atlaspack/commit/b8a4ae8f83dc0a83d8b145c5f729936ce52080a3)]:
19
+ - @atlaspack/feature-flags@2.15.1
20
+ - @atlaspack/rust@3.3.3
21
+ - @atlaspack/graph@3.4.6
22
+ - @atlaspack/utils@2.14.8
23
+ - @atlaspack/plugin@2.14.8
24
+
25
+ ## 2.16.0
26
+
27
+ ### Minor Changes
28
+
29
+ - [#547](https://github.com/atlassian-labs/atlaspack/pull/547) [`a1773d2`](https://github.com/atlassian-labs/atlaspack/commit/a1773d2a62d0ef7805ac7524621dcabcc1afe929) Thanks [@benjervis](https://github.com/benjervis)! - Add a feature flag for resolving the configuration for `@atlaspack/bundler-default` from CWD, rather than exclusively from the project root.
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [[`a1773d2`](https://github.com/atlassian-labs/atlaspack/commit/a1773d2a62d0ef7805ac7524621dcabcc1afe929), [`556d6ab`](https://github.com/atlassian-labs/atlaspack/commit/556d6ab8ede759fa7f37fcd3f4da336ef1c55e8f)]:
34
+ - @atlaspack/feature-flags@2.15.0
35
+ - @atlaspack/rust@3.3.2
36
+ - @atlaspack/graph@3.4.5
37
+ - @atlaspack/utils@2.14.7
38
+ - @atlaspack/plugin@2.14.7
39
+
40
+ ## 2.15.1
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [[`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09)]:
45
+ - @atlaspack/feature-flags@2.14.4
46
+ - @atlaspack/rust@3.3.1
47
+ - @atlaspack/graph@3.4.4
48
+ - @atlaspack/utils@2.14.6
49
+ - @atlaspack/plugin@2.14.6
50
+
51
+ ## 2.15.0
52
+
53
+ ### Minor Changes
54
+
55
+ - [#535](https://github.com/atlassian-labs/atlaspack/pull/535) [`a4bc259`](https://github.com/atlassian-labs/atlaspack/commit/a4bc2590196b6c1e743e4edcb0337e8c4c240ab4) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add `sharedBundleMergeThreshold` config option
56
+
57
+ In apps with lots of dynamic imports, many shared bundles are often removed
58
+ from the output to prevent an overload in network requests according to the
59
+ `maxParallelRequests` config. In these cases, setting `sharedBundleMergeThreshold` can
60
+ merge shared bundles with a high overlap in their source bundles (bundles that share the bundle).
61
+ This config trades-off potential overfetching to reduce asset duplication.
62
+
63
+ The following config would merge shared bundles that have a 75% or higher overlap in source bundles.
64
+
65
+ ```json
66
+ {
67
+ "@atlaspack/bundler-default": {
68
+ "sharedBundleMergeThreshold": 0.75
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Patch Changes
74
+
75
+ - Updated dependencies [[`11d6f16`](https://github.com/atlassian-labs/atlaspack/commit/11d6f16b6397dee2f217167e5c98b39edb63f7a7), [`e2ba0f6`](https://github.com/atlassian-labs/atlaspack/commit/e2ba0f69702656f3d1ce95ab1454e35062b13b39), [`d2c50c2`](https://github.com/atlassian-labs/atlaspack/commit/d2c50c2c020888b33bb25b8690d9320c2b69e2a6), [`46a90dc`](https://github.com/atlassian-labs/atlaspack/commit/46a90dccd019a26b222c878a92d23acc75dc67c5)]:
76
+ - @atlaspack/feature-flags@2.14.3
77
+ - @atlaspack/rust@3.3.0
78
+ - @atlaspack/graph@3.4.3
79
+ - @atlaspack/utils@2.14.5
80
+ - @atlaspack/plugin@2.14.5
81
+
3
82
  ## 2.14.4
4
83
 
5
84
  ### Patch Changes
@@ -11,6 +11,13 @@ function _diagnostic() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _featureFlags() {
15
+ const data = require("@atlaspack/feature-flags");
16
+ _featureFlags = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _utils() {
15
22
  const data = require("@atlaspack/utils");
16
23
  _utils = function () {
@@ -125,9 +132,17 @@ const CONFIG_SCHEMA = {
125
132
  additionalProperties: false
126
133
  };
127
134
  async function loadBundlerConfig(config, options, logger) {
128
- let conf = await config.getConfig([], {
129
- packageKey: '@atlaspack/bundler-default'
130
- });
135
+ var _conf;
136
+ let conf;
137
+ if ((0, _featureFlags().getFeatureFlag)('resolveBundlerConfigFromCwd')) {
138
+ conf = await config.getConfigFrom(`${process.cwd()}/index`, [], {
139
+ packageKey: '@atlaspack/bundler-default'
140
+ });
141
+ } else {
142
+ conf = await config.getConfig([], {
143
+ packageKey: '@atlaspack/bundler-default'
144
+ });
145
+ }
131
146
  if (!conf) {
132
147
  const modDefault = {
133
148
  ...HTTP_OPTIONS['2'],
@@ -135,7 +150,7 @@ async function loadBundlerConfig(config, options, logger) {
135
150
  };
136
151
  return modDefault;
137
152
  }
138
- (0, _assert().default)((conf === null || conf === void 0 ? void 0 : conf.contents) != null);
153
+ (0, _assert().default)(((_conf = conf) === null || _conf === void 0 ? void 0 : _conf.contents) != null);
139
154
  let modeConfig = resolveModeConfig(conf.contents, options.mode);
140
155
 
141
156
  // minBundles will be ignored if shared bundles are disabled
package/lib/idealGraph.js CHANGED
@@ -108,15 +108,7 @@ function createIdealGraph(assetGraph, config, entries, logger) {
108
108
  }
109
109
  let assets = [];
110
110
  let assetToIndex = new Map();
111
- //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
112
- let manualSharedMap = new Map();
113
- // May need a map to be able to look up NON- bundle root assets which need special case instructions
114
- // Use this when placing assets into bundles, to avoid duplication
115
- let manualAssetToBundle = new Map();
116
- let {
117
- manualAssetToConfig,
118
- constantModuleToMSB
119
- } = function makeManualAssetToConfigLookup() {
111
+ function makeManualAssetToConfigLookup() {
120
112
  let manualAssetToConfig = new Map();
121
113
  let constantModuleToMSB = new (_utils().DefaultMap)(() => []);
122
114
  if (config.manualSharedBundles.length === 0) {
@@ -182,7 +174,17 @@ function createIdealGraph(assetGraph, config, entries, logger) {
182
174
  manualAssetToConfig,
183
175
  constantModuleToMSB
184
176
  };
185
- }();
177
+ }
178
+
179
+ //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
180
+ let manualSharedMap = new Map();
181
+ // May need a map to be able to look up NON- bundle root assets which need special case instructions
182
+ // Use this when placing assets into bundles, to avoid duplication
183
+ let manualAssetToBundle = new Map();
184
+ let {
185
+ manualAssetToConfig,
186
+ constantModuleToMSB
187
+ } = makeManualAssetToConfigLookup();
186
188
  let manualBundleToInternalizedAsset = new (_utils().DefaultMap)(() => []);
187
189
 
188
190
  /**
@@ -952,8 +954,8 @@ function createIdealGraph(assetGraph, config, entries, logger) {
952
954
  }
953
955
  }
954
956
  function mergeBundles(bundleGraph, bundleToKeepId, bundleToRemoveId, assetReference) {
955
- let bundleToKeep = (0, _nullthrows().default)(bundleGraph.getNode(bundleToKeepId), '18');
956
- let bundleToRemove = (0, _nullthrows().default)(bundleGraph.getNode(bundleToRemoveId), '19');
957
+ let bundleToKeep = (0, _nullthrows().default)(bundleGraph.getNode(bundleToKeepId));
958
+ let bundleToRemove = (0, _nullthrows().default)(bundleGraph.getNode(bundleToRemoveId));
957
959
  (0, _assert().default)(bundleToKeep !== 'root' && bundleToRemove !== 'root');
958
960
  for (let asset of bundleToRemove.assets) {
959
961
  bundleToKeep.assets.add(asset);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/bundler-default",
3
- "version": "2.14.5-canary.9+4c1714103",
3
+ "version": "2.14.5-dev.55+5a11f33c5",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -16,13 +16,13 @@
16
16
  "node": ">= 16.0.0"
17
17
  },
18
18
  "dependencies": {
19
- "@atlaspack/diagnostic": "2.14.1-canary.77+4c1714103",
20
- "@atlaspack/feature-flags": "2.14.1-canary.77+4c1714103",
21
- "@atlaspack/graph": "3.4.1-canary.77+4c1714103",
22
- "@atlaspack/plugin": "2.14.5-canary.9+4c1714103",
23
- "@atlaspack/rust": "3.2.1-canary.9+4c1714103",
24
- "@atlaspack/utils": "2.14.5-canary.9+4c1714103",
19
+ "@atlaspack/diagnostic": "2.14.1-dev.123+5a11f33c5",
20
+ "@atlaspack/feature-flags": "2.14.1-dev.123+5a11f33c5",
21
+ "@atlaspack/graph": "3.4.1-dev.123+5a11f33c5",
22
+ "@atlaspack/plugin": "2.14.5-dev.55+5a11f33c5",
23
+ "@atlaspack/rust": "3.2.1-dev.55+5a11f33c5",
24
+ "@atlaspack/utils": "2.14.5-dev.55+5a11f33c5",
25
25
  "nullthrows": "^1.1.1"
26
26
  },
27
- "gitHead": "4c1714103dab2aa9039c488f381551d2b65d1d01"
27
+ "gitHead": "5a11f33c51ff74d1cf8d4b72cfa0fda833aa980a"
28
28
  }
@@ -7,6 +7,7 @@ import type {
7
7
  BuildMode,
8
8
  PluginLogger,
9
9
  } from '@atlaspack/types';
10
+ import {getFeatureFlag} from '@atlaspack/feature-flags';
10
11
  import {type SchemaEntity, validateSchema} from '@atlaspack/utils';
11
12
  import invariant from 'assert';
12
13
 
@@ -155,9 +156,17 @@ export async function loadBundlerConfig(
155
156
  options: PluginOptions,
156
157
  logger: PluginLogger,
157
158
  ): Promise<ResolvedBundlerConfig> {
158
- let conf = await config.getConfig<BundlerConfig>([], {
159
- packageKey: '@atlaspack/bundler-default',
160
- });
159
+ let conf;
160
+
161
+ if (getFeatureFlag('resolveBundlerConfigFromCwd')) {
162
+ conf = await config.getConfigFrom(`${process.cwd()}/index`, [], {
163
+ packageKey: '@atlaspack/bundler-default',
164
+ });
165
+ } else {
166
+ conf = await config.getConfig<BundlerConfig>([], {
167
+ packageKey: '@atlaspack/bundler-default',
168
+ });
169
+ }
161
170
 
162
171
  if (!conf) {
163
172
  const modDefault = {
package/src/idealGraph.js CHANGED
@@ -1262,11 +1262,8 @@ export function createIdealGraph(
1262
1262
  bundleToRemoveId: NodeId,
1263
1263
  assetReference: DefaultMap<Asset, Array<[Dependency, Bundle]>>,
1264
1264
  ) {
1265
- let bundleToKeep = nullthrows(bundleGraph.getNode(bundleToKeepId), '18');
1266
- let bundleToRemove = nullthrows(
1267
- bundleGraph.getNode(bundleToRemoveId),
1268
- '19',
1269
- );
1265
+ let bundleToKeep = nullthrows(bundleGraph.getNode(bundleToKeepId));
1266
+ let bundleToRemove = nullthrows(bundleGraph.getNode(bundleToRemoveId));
1270
1267
  invariant(bundleToKeep !== 'root' && bundleToRemove !== 'root');
1271
1268
  for (let asset of bundleToRemove.assets) {
1272
1269
  bundleToKeep.assets.add(asset);