@atlaspack/packager-js 2.21.1 → 2.21.2

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,21 @@
1
1
  # @atlaspack/packager-js
2
2
 
3
+ ## 2.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
8
+
9
+ - [#755](https://github.com/atlassian-labs/atlaspack/pull/755) [`b6e72b6`](https://github.com/atlassian-labs/atlaspack/commit/b6e72b6dd2b517cbb0e700fa69e63332d3eacb1e) Thanks [@benjervis](https://github.com/benjervis)! - Allow runtime assets to be marked as requiring execution on load
10
+
11
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
12
+ - @atlaspack/feature-flags@2.23.1
13
+ - @atlaspack/diagnostic@2.14.3
14
+ - @atlaspack/plugin@2.14.26
15
+ - @atlaspack/types@2.15.16
16
+ - @atlaspack/utils@2.18.3
17
+ - @atlaspack/rust@3.6.1
18
+
3
19
  ## 2.21.1
4
20
 
5
21
  ### Patch Changes
@@ -190,10 +190,17 @@ class ScopeHoistingPackager {
190
190
  let entries = this.bundle.getEntryAssets();
191
191
  let mainEntry = this.bundle.getMainEntry();
192
192
  if (this.isAsyncBundle) {
193
- // In async bundles we don't want the main entry to execute until we require it
194
- // as there might be dependencies in a sibling bundle that hasn't loaded yet.
195
- if ((0, _featureFlags().getFeatureFlag)('supportWebpackChunkName')) {
196
- entries = [];
193
+ if ((0, _featureFlags().getFeatureFlag)('applyScopeHoistingImprovement') || (0, _featureFlags().getFeatureFlag)('supportWebpackChunkName')) {
194
+ // Generally speaking, async bundles should not be executed on load, as
195
+ // they're just collections of assets that other assets require.
196
+ // However, there are some special cases where a runtime asset needs to be
197
+ // injected, but no other asset will require it (mostly the bundle
198
+ // manifest).
199
+ // In this case, those assets need to be required on load.
200
+ entries = entries.filter(a => {
201
+ var _a$meta;
202
+ return (_a$meta = a.meta) === null || _a$meta === void 0 ? void 0 : _a$meta.runtimeAssetRequiringExecutionOnLoad;
203
+ });
197
204
  } else {
198
205
  entries = entries.filter(a => {
199
206
  var _mainEntry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/packager-js",
3
- "version": "2.21.1",
3
+ "version": "2.21.2",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,13 +16,13 @@
16
16
  "node": ">= 16.0.0"
17
17
  },
18
18
  "dependencies": {
19
- "@atlaspack/diagnostic": "2.14.2",
20
- "@atlaspack/feature-flags": "2.23.0",
21
- "@atlaspack/plugin": "2.14.25",
22
- "@atlaspack/rust": "3.6.0",
19
+ "@atlaspack/diagnostic": "2.14.3",
20
+ "@atlaspack/feature-flags": "2.23.1",
21
+ "@atlaspack/plugin": "2.14.26",
22
+ "@atlaspack/rust": "3.6.1",
23
23
  "@parcel/source-map": "^2.1.1",
24
- "@atlaspack/types": "2.15.15",
25
- "@atlaspack/utils": "2.18.2",
24
+ "@atlaspack/types": "2.15.16",
25
+ "@atlaspack/utils": "2.18.3",
26
26
  "globals": "^13.2.0",
27
27
  "nullthrows": "^1.1.1",
28
28
  "outdent": "^0.8.0"
@@ -220,10 +220,19 @@ export class ScopeHoistingPackager {
220
220
  let entries = this.bundle.getEntryAssets();
221
221
  let mainEntry = this.bundle.getMainEntry();
222
222
  if (this.isAsyncBundle) {
223
- // In async bundles we don't want the main entry to execute until we require it
224
- // as there might be dependencies in a sibling bundle that hasn't loaded yet.
225
- if (getFeatureFlag('supportWebpackChunkName')) {
226
- entries = [];
223
+ if (
224
+ getFeatureFlag('applyScopeHoistingImprovement') ||
225
+ getFeatureFlag('supportWebpackChunkName')
226
+ ) {
227
+ // Generally speaking, async bundles should not be executed on load, as
228
+ // they're just collections of assets that other assets require.
229
+ // However, there are some special cases where a runtime asset needs to be
230
+ // injected, but no other asset will require it (mostly the bundle
231
+ // manifest).
232
+ // In this case, those assets need to be required on load.
233
+ entries = entries.filter(
234
+ (a) => a.meta?.runtimeAssetRequiringExecutionOnLoad,
235
+ );
227
236
  } else {
228
237
  entries = entries.filter((a) => a.id !== mainEntry?.id);
229
238
  }