@atlaspack/runtime-js 2.15.3-typescript-bc4459c37.0 → 2.16.1-typescript-5ad950d33.0
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.ts +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
|
@@ -373,10 +373,16 @@ function getLoaderRuntime({
|
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
375
|
let externalBundles = bundleGraph.getBundlesInBundleGroup(bundleGroup);
|
|
376
|
-
let
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
376
|
+
let potentialMainBundle;
|
|
377
|
+
if ((0, _featureFlags().getFeatureFlag)('supportWebpackChunkName')) {
|
|
378
|
+
potentialMainBundle = externalBundles.find(bundle => bundle.getEntryAssets().some(asset => asset.id === bundleGroup.entryAssetId));
|
|
379
|
+
} else {
|
|
380
|
+
potentialMainBundle = externalBundles.find(bundle => {
|
|
381
|
+
var _bundle$getMainEntry;
|
|
382
|
+
return ((_bundle$getMainEntry = bundle.getMainEntry()) === null || _bundle$getMainEntry === void 0 ? void 0 : _bundle$getMainEntry.id) === bundleGroup.entryAssetId;
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
let mainBundle = (0, _nullthrows().default)(potentialMainBundle);
|
|
380
386
|
|
|
381
387
|
// CommonJS is a synchronous module system, so there is no need to load bundles in parallel.
|
|
382
388
|
// 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.
|
|
3
|
+
"version": "2.16.1-typescript-5ad950d33.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/diagnostic": "2.14.2-typescript-
|
|
20
|
-
"@atlaspack/domain-sharding": "2.14.2-typescript-
|
|
21
|
-
"@atlaspack/feature-flags": "2.
|
|
22
|
-
"@atlaspack/plugin": "2.14.
|
|
23
|
-
"@atlaspack/utils": "2.17.
|
|
19
|
+
"@atlaspack/diagnostic": "2.14.2-typescript-5ad950d33.0",
|
|
20
|
+
"@atlaspack/domain-sharding": "2.14.2-typescript-5ad950d33.0",
|
|
21
|
+
"@atlaspack/feature-flags": "2.20.1-typescript-5ad950d33.0",
|
|
22
|
+
"@atlaspack/plugin": "2.14.22-typescript-5ad950d33.0",
|
|
23
|
+
"@atlaspack/utils": "2.17.4-typescript-5ad950d33.0",
|
|
24
24
|
"nullthrows": "^1.1.1"
|
|
25
25
|
},
|
|
26
26
|
"type": "commonjs",
|
|
27
27
|
"scripts": {
|
|
28
28
|
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "5ad950d33a5f2255ebeb10c04a2e84c346e2de85"
|
|
31
31
|
}
|
package/src/JSRuntime.ts
CHANGED
|
@@ -462,11 +462,21 @@ function getLoaderRuntime({
|
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
let externalBundles = bundleGraph.getBundlesInBundleGroup(bundleGroup);
|
|
465
|
-
let
|
|
466
|
-
|
|
465
|
+
let potentialMainBundle;
|
|
466
|
+
|
|
467
|
+
if (getFeatureFlag('supportWebpackChunkName')) {
|
|
468
|
+
potentialMainBundle = externalBundles.find((bundle) =>
|
|
469
|
+
bundle
|
|
470
|
+
.getEntryAssets()
|
|
471
|
+
.some((asset) => asset.id === bundleGroup.entryAssetId),
|
|
472
|
+
);
|
|
473
|
+
} else {
|
|
474
|
+
potentialMainBundle = externalBundles.find(
|
|
467
475
|
(bundle) => bundle.getMainEntry()?.id === bundleGroup.entryAssetId,
|
|
468
|
-
)
|
|
469
|
-
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
let mainBundle = nullthrows(potentialMainBundle);
|
|
470
480
|
|
|
471
481
|
// CommonJS is a synchronous module system, so there is no need to load bundles in parallel.
|
|
472
482
|
// Importing of the other bundles will be handled by the bundle group entry.
|