@atlaspack/runtime-js 2.14.5-canary.136 → 2.14.5-canary.138
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 +24 -0
- package/lib/JSRuntime.js +10 -4
- package/package.json +7 -7
- package/src/JSRuntime.js +14 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaspack/runtime-js
|
|
2
2
|
|
|
3
|
+
## 2.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#721](https://github.com/atlassian-labs/atlaspack/pull/721) [`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd) Thanks [@benjervis](https://github.com/benjervis)! - Add support for bundle merging based on `webpackChunkName` comments.
|
|
8
|
+
|
|
9
|
+
Adding a `webpackChunkName` comment to an import will allow the bundler to merge multiple imports into a single bundle.
|
|
10
|
+
|
|
11
|
+
e.g.:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import(/* webpackChunkName: "my-chunk" */ './my-module');
|
|
15
|
+
import(/* webpackChunkName: "my-chunk" */ './another-module');
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This can be enabled with the feature flag `supportWebpackChunkName`.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
23
|
+
- @atlaspack/feature-flags@2.20.0
|
|
24
|
+
- @atlaspack/utils@2.17.3
|
|
25
|
+
- @atlaspack/plugin@2.14.21
|
|
26
|
+
|
|
3
27
|
## 2.15.2
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/lib/JSRuntime.js
CHANGED
|
@@ -375,10 +375,16 @@ function getLoaderRuntime({
|
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
377
|
let externalBundles = bundleGraph.getBundlesInBundleGroup(bundleGroup);
|
|
378
|
-
let
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
378
|
+
let potentialMainBundle;
|
|
379
|
+
if ((0, _featureFlags().getFeatureFlag)('supportWebpackChunkName')) {
|
|
380
|
+
potentialMainBundle = externalBundles.find(bundle => bundle.getEntryAssets().some(asset => asset.id === bundleGroup.entryAssetId));
|
|
381
|
+
} else {
|
|
382
|
+
potentialMainBundle = externalBundles.find(bundle => {
|
|
383
|
+
var _bundle$getMainEntry;
|
|
384
|
+
return ((_bundle$getMainEntry = bundle.getMainEntry()) === null || _bundle$getMainEntry === void 0 ? void 0 : _bundle$getMainEntry.id) === bundleGroup.entryAssetId;
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
let mainBundle = (0, _nullthrows().default)(potentialMainBundle);
|
|
382
388
|
|
|
383
389
|
// CommonJS is a synchronous module system, so there is no need to load bundles in parallel.
|
|
384
390
|
// Importing of the other bundles will be handled by the bundle group entry.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/runtime-js",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.138+eda07caaf",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"node": ">= 16.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atlaspack/diagnostic": "2.14.1-canary.
|
|
19
|
-
"@atlaspack/domain-sharding": "2.14.1-canary.
|
|
20
|
-
"@atlaspack/feature-flags": "2.14.1-canary.
|
|
21
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
22
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
18
|
+
"@atlaspack/diagnostic": "2.14.1-canary.206+eda07caaf",
|
|
19
|
+
"@atlaspack/domain-sharding": "2.14.1-canary.206+eda07caaf",
|
|
20
|
+
"@atlaspack/feature-flags": "2.14.1-canary.206+eda07caaf",
|
|
21
|
+
"@atlaspack/plugin": "2.14.5-canary.138+eda07caaf",
|
|
22
|
+
"@atlaspack/utils": "2.14.5-canary.138+eda07caaf",
|
|
23
23
|
"nullthrows": "^1.1.1"
|
|
24
24
|
},
|
|
25
25
|
"type": "commonjs",
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "eda07caafd2ebb814bbdbfd0ec12fa63124e213f"
|
|
27
27
|
}
|
package/src/JSRuntime.js
CHANGED
|
@@ -458,11 +458,21 @@ function getLoaderRuntime({
|
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
let externalBundles = bundleGraph.getBundlesInBundleGroup(bundleGroup);
|
|
461
|
-
let
|
|
462
|
-
|
|
461
|
+
let potentialMainBundle;
|
|
462
|
+
|
|
463
|
+
if (getFeatureFlag('supportWebpackChunkName')) {
|
|
464
|
+
potentialMainBundle = externalBundles.find((bundle) =>
|
|
465
|
+
bundle
|
|
466
|
+
.getEntryAssets()
|
|
467
|
+
.some((asset) => asset.id === bundleGroup.entryAssetId),
|
|
468
|
+
);
|
|
469
|
+
} else {
|
|
470
|
+
potentialMainBundle = externalBundles.find(
|
|
463
471
|
(bundle) => bundle.getMainEntry()?.id === bundleGroup.entryAssetId,
|
|
464
|
-
)
|
|
465
|
-
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
let mainBundle = nullthrows(potentialMainBundle);
|
|
466
476
|
|
|
467
477
|
// CommonJS is a synchronous module system, so there is no need to load bundles in parallel.
|
|
468
478
|
// Importing of the other bundles will be handled by the bundle group entry.
|