@atlaspack/packager-js 2.19.1 → 2.20.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaspack/packager-js
2
2
 
3
+ ## 2.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#731](https://github.com/atlassian-labs/atlaspack/pull/731) [`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2) Thanks [@marcins](https://github.com/marcins)! - Implement "inline isolated" scripts
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
12
+ - @atlaspack/feature-flags@2.21.0
13
+ - @atlaspack/utils@2.18.0
14
+ - @atlaspack/rust@3.5.0
15
+ - @atlaspack/types@2.15.13
16
+ - @atlaspack/plugin@2.14.23
17
+
3
18
  ## 2.19.1
4
19
 
5
20
  ### Patch Changes
@@ -212,7 +212,7 @@ class DevPackager {
212
212
  );
213
213
  }
214
214
  isEntry() {
215
- return !this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') || this.bundle.env.isIsolated() || this.bundle.bundleBehavior === 'isolated';
215
+ return !this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') || this.bundle.env.isIsolated() || this.bundle.bundleBehavior === 'isolated' || this.bundle.bundleBehavior === 'inlineIsolated';
216
216
  }
217
217
  }
218
218
  exports.DevPackager = DevPackager;
@@ -116,7 +116,7 @@ class ScopeHoistingPackager {
116
116
  this.logger = logger;
117
117
  let OutputFormat = OUTPUT_FORMATS[this.bundle.env.outputFormat];
118
118
  this.outputFormat = new OutputFormat(this);
119
- this.isAsyncBundle = this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') && !this.bundle.env.isIsolated() && this.bundle.bundleBehavior !== 'isolated';
119
+ this.isAsyncBundle = this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') && !this.bundle.env.isIsolated() && this.bundle.bundleBehavior !== 'isolated' && this.bundle.bundleBehavior !== 'inlineIsolated';
120
120
  this.globalNames = GLOBALS_BY_CONTEXT[bundle.env.context];
121
121
  }
122
122
  async package() {
@@ -267,7 +267,7 @@ class ScopeHoistingPackager {
267
267
  // If the bundle is a conditional bundle
268
268
  isConditionalBundle = this.hasConditionalDependency();
269
269
  }
270
- return this.useAsyncBundleRuntime && bundle.type === 'js' && bundle.bundleBehavior !== 'inline' && bundle.env.outputFormat === 'esmodule' && !bundle.env.isIsolated() && bundle.bundleBehavior !== 'isolated' && (hasHtmlReference || hasConditionalReference || isConditionalBundle);
270
+ return this.useAsyncBundleRuntime && bundle.type === 'js' && bundle.bundleBehavior !== 'inline' && bundle.bundleBehavior !== 'inlineIsolated' && bundle.env.outputFormat === 'esmodule' && !bundle.env.isIsolated() && bundle.bundleBehavior !== 'isolated' && (hasHtmlReference || hasConditionalReference || isConditionalBundle);
271
271
  }
272
272
  runWhenReady(bundle, codeToRun) {
273
273
  let deps = this.bundleGraph.getReferencedBundles(bundle).filter(b => this.shouldBundleQueue(b)).map(b => b.publicId);
@@ -1225,7 +1225,7 @@ ${code}
1225
1225
  // Add the prelude if this is potentially the first JS bundle to load in a
1226
1226
  // particular context (e.g. entry scripts in HTML, workers, etc.).
1227
1227
  let parentBundles = this.bundleGraph.getParentBundles(this.bundle);
1228
- let mightBeFirstJS = parentBundles.length === 0 || parentBundles.some(b => b.type !== 'js') || this.bundleGraph.getBundleGroupsContainingBundle(this.bundle).some(g => this.bundleGraph.isEntryBundleGroup(g)) || this.bundle.env.isIsolated() || this.bundle.bundleBehavior === 'isolated' ||
1228
+ let mightBeFirstJS = parentBundles.length === 0 || parentBundles.some(b => b.type !== 'js') || this.bundleGraph.getBundleGroupsContainingBundle(this.bundle).some(g => this.bundleGraph.isEntryBundleGroup(g)) || this.bundle.env.isIsolated() || this.bundle.bundleBehavior === 'isolated' || this.bundle.bundleBehavior === 'inlineIsolated' ||
1229
1229
  // Conditional deps may be loaded before entrypoints on the server
1230
1230
  this.hasConditionalDependency();
1231
1231
  if (mightBeFirstJS) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/packager-js",
3
- "version": "2.19.1",
3
+ "version": "2.20.0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,12 +17,12 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@atlaspack/diagnostic": "2.14.2",
20
- "@atlaspack/feature-flags": "2.20.1",
21
- "@atlaspack/plugin": "2.14.22",
22
- "@atlaspack/rust": "3.4.2",
20
+ "@atlaspack/feature-flags": "2.21.0",
21
+ "@atlaspack/plugin": "2.14.23",
22
+ "@atlaspack/rust": "3.5.0",
23
23
  "@parcel/source-map": "^2.1.1",
24
- "@atlaspack/types": "2.15.12",
25
- "@atlaspack/utils": "2.17.4",
24
+ "@atlaspack/types": "2.15.13",
25
+ "@atlaspack/utils": "2.18.0",
26
26
  "globals": "^13.2.0",
27
27
  "nullthrows": "^1.1.1",
28
28
  "outdent": "^0.8.0"
@@ -272,7 +272,8 @@ export class DevPackager {
272
272
  return (
273
273
  !this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') ||
274
274
  this.bundle.env.isIsolated() ||
275
- this.bundle.bundleBehavior === 'isolated'
275
+ this.bundle.bundleBehavior === 'isolated' ||
276
+ this.bundle.bundleBehavior === 'inlineIsolated'
276
277
  );
277
278
  }
278
279
  }
@@ -131,7 +131,8 @@ export class ScopeHoistingPackager {
131
131
  this.isAsyncBundle =
132
132
  this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') &&
133
133
  !this.bundle.env.isIsolated() &&
134
- this.bundle.bundleBehavior !== 'isolated';
134
+ this.bundle.bundleBehavior !== 'isolated' &&
135
+ this.bundle.bundleBehavior !== 'inlineIsolated';
135
136
 
136
137
  this.globalNames = GLOBALS_BY_CONTEXT[bundle.env.context];
137
138
  }
@@ -323,6 +324,7 @@ export class ScopeHoistingPackager {
323
324
  this.useAsyncBundleRuntime &&
324
325
  bundle.type === 'js' &&
325
326
  bundle.bundleBehavior !== 'inline' &&
327
+ bundle.bundleBehavior !== 'inlineIsolated' &&
326
328
  bundle.env.outputFormat === 'esmodule' &&
327
329
  !bundle.env.isIsolated() &&
328
330
  bundle.bundleBehavior !== 'isolated' &&
@@ -1651,6 +1653,7 @@ ${code}
1651
1653
  .some((g) => this.bundleGraph.isEntryBundleGroup(g)) ||
1652
1654
  this.bundle.env.isIsolated() ||
1653
1655
  this.bundle.bundleBehavior === 'isolated' ||
1656
+ this.bundle.bundleBehavior === 'inlineIsolated' ||
1654
1657
  // Conditional deps may be loaded before entrypoints on the server
1655
1658
  this.hasConditionalDependency();
1656
1659