@atlaspack/packager-js 2.14.5-canary.29 → 2.14.5-canary.292

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.
@@ -12,12 +12,12 @@
12
12
  typeof globalThis !== 'undefined'
13
13
  ? globalThis
14
14
  : typeof self !== 'undefined'
15
- ? self
16
- : typeof window !== 'undefined'
17
- ? window
18
- : typeof global !== 'undefined'
19
- ? global
20
- : {};
15
+ ? self
16
+ : typeof window !== 'undefined'
17
+ ? window
18
+ : typeof global !== 'undefined'
19
+ ? global
20
+ : {};
21
21
  /* eslint-enable no-undef */
22
22
 
23
23
  // Save the require from previous bundle to this closure if any
package/lib/helpers.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.prelude = exports.helpers = exports.fnExpr = exports.bundleQueuePrelude = void 0;
7
- const prelude = parcelRequireName => `
6
+ exports.preludeOld = exports.preludeNew = exports.helpers = exports.fnExpr = exports.bundleQueuePrelude = void 0;
7
+ const preludeOld = parcelRequireName => `
8
8
  var $parcel$modules = {};
9
9
  var $parcel$inits = {};
10
10
 
@@ -37,7 +37,42 @@ if (parcelRequire == null) {
37
37
 
38
38
  var parcelRegister = parcelRequire.register;
39
39
  `;
40
- exports.prelude = prelude;
40
+ exports.preludeOld = preludeOld;
41
+ const preludeNew = parcelRequireName => `
42
+ var $parcel$modules = {};
43
+ var $parcel$inits = {};
44
+
45
+ var parcelRequire = $parcel$global[${JSON.stringify(parcelRequireName)}];
46
+
47
+ if (parcelRequire == null) {
48
+ parcelRequire = function(id) {
49
+ var mod = $parcel$modules[id];
50
+ if (mod !== undefined) {
51
+ return mod.exports;
52
+ }
53
+ var init = $parcel$inits[id];
54
+ if (init !== undefined) {
55
+ delete $parcel$inits[id];
56
+ var module = {id: id, exports: {}};
57
+ $parcel$modules[id] = module;
58
+ init.call(module.exports, module, module.exports);
59
+ return module.exports;
60
+ }
61
+ var err = new Error("Cannot find module '" + id + "'");
62
+ err.code = 'MODULE_NOT_FOUND';
63
+ throw err;
64
+ };
65
+
66
+ parcelRequire.register = function register(id, init) {
67
+ $parcel$inits[id] = init;
68
+ };
69
+
70
+ $parcel$global[${JSON.stringify(parcelRequireName)}] = parcelRequire;
71
+ }
72
+
73
+ var parcelRegister = parcelRequire.register;
74
+ `;
75
+ exports.preludeNew = preludeNew;
41
76
  const fnExpr = (env, params, body) => {
42
77
  let block = `{ ${body.join(' ')} }`;
43
78
  if (env.supports('arrow-functions')) {
package/lib/index.js CHANGED
@@ -41,6 +41,13 @@ function _nullthrows() {
41
41
  }
42
42
  var _DevPackager = require("./DevPackager");
43
43
  var _ScopeHoistingPackager = require("./ScopeHoistingPackager");
44
+ function _featureFlags() {
45
+ const data = require("@atlaspack/feature-flags");
46
+ _featureFlags = function () {
47
+ return data;
48
+ };
49
+ return data;
50
+ }
44
51
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
52
  const CONFIG_SCHEMA = {
46
53
  type: 'object',
@@ -48,7 +55,7 @@ const CONFIG_SCHEMA = {
48
55
  unstable_asyncBundleRuntime: {
49
56
  type: 'boolean'
50
57
  },
51
- unstable_forceSkipWrapAssets: {
58
+ unstable_manualStaticBindingExports: {
52
59
  type: 'array',
53
60
  items: {
54
61
  type: 'string'
@@ -70,7 +77,7 @@ var _default = exports.default = new (_plugin().Packager)({
70
77
  if (conf !== null && conf !== void 0 && conf.contents) {
71
78
  _utils().validateSchema.diagnostic(CONFIG_SCHEMA, {
72
79
  data: conf === null || conf === void 0 ? void 0 : conf.contents,
73
- source: await options.inputFS.readFile(conf.filePath, 'utf8'),
80
+ source: (0, _featureFlags().getFeatureFlag)('schemaValidationDeferSourceLoading') ? () => options.inputFS.readFileSync(conf.filePath, 'utf8') : await options.inputFS.readFile(conf.filePath, 'utf8'),
74
81
  filePath: conf.filePath,
75
82
  prependKey: `/${(0, _diagnostic().encodeJSONKeyComponent)(packageKey)}`
76
83
  }, packageKey, `Invalid config for ${packageKey}`);
@@ -85,7 +92,7 @@ var _default = exports.default = new (_plugin().Packager)({
85
92
  return {
86
93
  parcelRequireName: 'parcelRequire' + (0, _rust().hashString)(name).slice(-4),
87
94
  unstable_asyncBundleRuntime: Boolean(conf === null || conf === void 0 || (_conf$contents = conf.contents) === null || _conf$contents === void 0 ? void 0 : _conf$contents.unstable_asyncBundleRuntime),
88
- unstable_forceSkipWrapAssets: (conf === null || conf === void 0 || (_conf$contents2 = conf.contents) === null || _conf$contents2 === void 0 ? void 0 : _conf$contents2.unstable_forceSkipWrapAssets) ?? []
95
+ unstable_manualStaticBindingExports: (conf === null || conf === void 0 || (_conf$contents2 = conf.contents) === null || _conf$contents2 === void 0 ? void 0 : _conf$contents2.unstable_manualStaticBindingExports) ?? null
89
96
  };
90
97
  },
91
98
  async package({
@@ -100,6 +107,7 @@ var _default = exports.default = new (_plugin().Packager)({
100
107
  // If this is a non-module script, and there is only one asset with no dependencies,
101
108
  // then we don't need to package at all and can pass through the original code un-wrapped.
102
109
  let contents, map;
110
+ let scopeHoistingStats;
103
111
  if (bundle.env.sourceType === 'script') {
104
112
  let entries = bundle.getEntryAssets();
105
113
  if (entries.length === 1 && bundleGraph.getDependencies(entries[0]).length === 0) {
@@ -108,11 +116,22 @@ var _default = exports.default = new (_plugin().Packager)({
108
116
  }
109
117
  }
110
118
  if (contents == null) {
111
- let packager = bundle.env.shouldScopeHoist ? new _ScopeHoistingPackager.ScopeHoistingPackager(options, bundleGraph, bundle, (0, _nullthrows().default)(config).parcelRequireName, (0, _nullthrows().default)(config).unstable_asyncBundleRuntime, (0, _nullthrows().default)(config).unstable_forceSkipWrapAssets, logger) : new _DevPackager.DevPackager(options, bundleGraph, bundle, (0, _nullthrows().default)(config).parcelRequireName);
112
- ({
113
- contents,
114
- map
115
- } = await packager.package());
119
+ if (bundle.env.shouldScopeHoist) {
120
+ let packager = new _ScopeHoistingPackager.ScopeHoistingPackager(options, bundleGraph, bundle, (0, _nullthrows().default)(config).parcelRequireName, (0, _nullthrows().default)(config).unstable_asyncBundleRuntime, (0, _nullthrows().default)(config).unstable_manualStaticBindingExports, logger);
121
+ let packageResult = await packager.package();
122
+ ({
123
+ contents,
124
+ map
125
+ } = packageResult);
126
+ scopeHoistingStats = packageResult.scopeHoistingStats;
127
+ } else {
128
+ let packager = new _DevPackager.DevPackager(options, bundleGraph, bundle, (0, _nullthrows().default)(config).parcelRequireName);
129
+ let packageResult = await packager.package();
130
+ ({
131
+ contents,
132
+ map
133
+ } = packageResult);
134
+ }
116
135
  }
117
136
  contents += '\n' + (await getSourceMapSuffix(getSourceMapReference, map));
118
137
 
@@ -130,7 +149,7 @@ var _default = exports.default = new (_plugin().Packager)({
130
149
  getReplacement: s => JSON.stringify(s).slice(1, -1)
131
150
  }));
132
151
  }
133
- return (0, _utils().replaceInlineReferences)({
152
+ let result = await (0, _utils().replaceInlineReferences)({
134
153
  bundle,
135
154
  bundleGraph,
136
155
  contents,
@@ -141,6 +160,13 @@ var _default = exports.default = new (_plugin().Packager)({
141
160
  getInlineBundleContents,
142
161
  map
143
162
  });
163
+ if (_utils().debugTools['scope-hoisting-stats']) {
164
+ return {
165
+ ...result,
166
+ scopeHoistingStats
167
+ };
168
+ }
169
+ return result;
144
170
  }
145
171
  });
146
172
  async function getSourceMapSuffix(getSourceMapReference, map) {
@@ -0,0 +1,7 @@
1
+ import type { ScopeHoistingPackager, OutputFormat } from './ScopeHoistingPackager';
2
+ export declare class CJSOutputFormat implements OutputFormat {
3
+ packager: ScopeHoistingPackager;
4
+ constructor(packager: ScopeHoistingPackager);
5
+ buildBundlePrelude(): [string, number];
6
+ buildBundlePostlude(): [string, number];
7
+ }
@@ -0,0 +1,15 @@
1
+ import type { BundleGraph, PluginOptions, NamedBundle } from '@atlaspack/types';
2
+ import SourceMap from '@atlaspack/source-map';
3
+ export declare class DevPackager {
4
+ options: PluginOptions;
5
+ bundleGraph: BundleGraph<NamedBundle>;
6
+ bundle: NamedBundle;
7
+ parcelRequireName: string;
8
+ constructor(options: PluginOptions, bundleGraph: BundleGraph<NamedBundle>, bundle: NamedBundle, parcelRequireName: string);
9
+ package(): Promise<{
10
+ contents: string;
11
+ map: SourceMap | null | undefined;
12
+ }>;
13
+ getPrefix(): string;
14
+ isEntry(): boolean;
15
+ }
@@ -0,0 +1,7 @@
1
+ import type { ScopeHoistingPackager, OutputFormat } from './ScopeHoistingPackager';
2
+ export declare class ESMOutputFormat implements OutputFormat {
3
+ packager: ScopeHoistingPackager;
4
+ constructor(packager: ScopeHoistingPackager);
5
+ buildBundlePrelude(): [string, number];
6
+ buildBundlePostlude(): [string, number];
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { ScopeHoistingPackager, OutputFormat } from './ScopeHoistingPackager';
2
+ export declare class GlobalOutputFormat implements OutputFormat {
3
+ packager: ScopeHoistingPackager;
4
+ constructor(packager: ScopeHoistingPackager);
5
+ buildBundlePrelude(): [string, number];
6
+ buildBundlePostlude(): [string, number];
7
+ }
@@ -0,0 +1,73 @@
1
+ import type { Asset, BundleGraph, Dependency, PluginOptions, NamedBundle, PluginLogger } from '@atlaspack/types';
2
+ import SourceMap from '@atlaspack/source-map';
3
+ export interface OutputFormat {
4
+ buildBundlePrelude(): [string, number];
5
+ buildBundlePostlude(): [string, number];
6
+ }
7
+ export type PackageResult = {
8
+ contents: string;
9
+ map: SourceMap | null | undefined;
10
+ scopeHoistingStats?: {
11
+ totalAssets: number;
12
+ wrappedAssets: number;
13
+ };
14
+ };
15
+ export declare class ScopeHoistingPackager {
16
+ options: PluginOptions;
17
+ bundleGraph: BundleGraph<NamedBundle>;
18
+ bundle: NamedBundle;
19
+ parcelRequireName: string;
20
+ useAsyncBundleRuntime: boolean;
21
+ outputFormat: OutputFormat;
22
+ isAsyncBundle: boolean;
23
+ globalNames: ReadonlySet<string>;
24
+ manualStaticBindingExports: RegExp[] | null;
25
+ assetOutputs: Map<Asset, {
26
+ code: string;
27
+ map: Buffer | null | undefined;
28
+ }>;
29
+ exportedSymbols: Map<string, {
30
+ asset: Asset;
31
+ exportSymbol: string;
32
+ local: string;
33
+ exportAs: Array<string>;
34
+ }>;
35
+ externals: Map<string, Map<string, string>>;
36
+ topLevelNames: Map<string, number>;
37
+ seenAssets: Set<Asset>;
38
+ wrappedAssets: Set<Asset>;
39
+ constantAssets: Set<Asset>;
40
+ hoistedRequires: Map<Dependency, Map<Asset, string>>;
41
+ seenHoistedRequires: Set<string>;
42
+ needsPrelude: boolean;
43
+ usedHelpers: Set<string>;
44
+ externalAssets: Set<Asset>;
45
+ logger: PluginLogger;
46
+ useBothScopeHoistingImprovements: boolean;
47
+ referencedAssetsCache: Map<string, Set<Asset>>;
48
+ constructor(options: PluginOptions, bundleGraph: BundleGraph<NamedBundle>, bundle: NamedBundle, parcelRequireName: string, useAsyncBundleRuntime: boolean, manualStaticBindingExports: string[] | null, logger: PluginLogger);
49
+ package(): Promise<PackageResult>;
50
+ shouldBundleQueue(bundle: NamedBundle): boolean;
51
+ runWhenReady(bundle: NamedBundle, codeToRun: string): string;
52
+ isAssetReferencedInBundle(bundle: NamedBundle, asset: Asset): boolean;
53
+ loadAssets(): Promise<void>;
54
+ isReExported(asset: Asset): boolean;
55
+ buildExportedSymbols(): void;
56
+ getTopLevelName(name: string): string;
57
+ getPropertyAccess(obj: string, property: string): string;
58
+ visitAsset(asset: Asset): [string, SourceMap | null | undefined, number];
59
+ getAssetFilePath(asset: Asset): string;
60
+ buildAsset(asset: Asset, code: string, map?: Buffer | null): [string, SourceMap | null | undefined, number];
61
+ buildReplacements(asset: Asset, deps: Array<Dependency>): [Map<string, Array<Dependency>>, Map<string, string>];
62
+ addExternal(dep: Dependency, replacements?: Map<string, string>, referencedBundle?: NamedBundle): void;
63
+ isWrapped(resolved: Asset, parentAsset: Asset): boolean;
64
+ getSymbolResolution(parentAsset: Asset, resolved: Asset, imported: string, dep?: Dependency, replacements?: Map<string, string>): string;
65
+ getHoistedParcelRequires(parentAsset: Asset, dep: Dependency, resolved: Asset): [string, number];
66
+ buildAssetPrelude(asset: Asset, deps: Array<Dependency>, replacements: Map<string, string>): [string, number, string];
67
+ buildBundlePrelude(): [string, number];
68
+ needsDefaultInterop(asset: Asset): boolean;
69
+ shouldSkipAsset(asset: Asset): boolean;
70
+ isScriptEntry(asset: Asset): boolean;
71
+ buildFunctionExpression(args: Array<string>, expr: string): string;
72
+ hasConditionalDependency(): boolean;
73
+ }
@@ -0,0 +1,12 @@
1
+ import type { Environment } from '@atlaspack/types';
2
+ export declare const preludeOld: (parcelRequireName: string) => string;
3
+ export declare const preludeNew: (parcelRequireName: string) => string;
4
+ export declare const fnExpr: (env: Environment, params: Array<string>, body: Array<string>) => string;
5
+ export declare const bundleQueuePrelude: (env: Environment) => string;
6
+ export declare const helpers: {
7
+ readonly $parcel$export: "\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n";
8
+ readonly $parcel$exportWildcard: "\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n";
9
+ readonly $parcel$interopDefault: "\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n";
10
+ readonly $parcel$global: (env: Environment) => string;
11
+ readonly $parcel$defineInteropFlag: "\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true, configurable: true});\n}\n";
12
+ };
@@ -0,0 +1,3 @@
1
+ import { Packager } from '@atlaspack/plugin';
2
+ declare const _default: Packager<unknown, unknown>;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import type { BundleGraph, Dependency, NamedBundle } from '@atlaspack/types';
2
+ import type SourceMap from '@atlaspack/source-map';
3
+ export declare function replaceScriptDependencies(bundleGraph: BundleGraph<NamedBundle>, bundle: NamedBundle, code: string, map: SourceMap | null | undefined, parcelRequireName: string): string;
4
+ export declare function getSpecifier(dep: Dependency): string;
5
+ export declare function isValidIdentifier(id: string): boolean;
6
+ export declare function makeValidIdentifier(name: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/packager-js",
3
- "version": "2.14.5-canary.29+15c6d7000",
3
+ "version": "2.14.5-canary.292+98b80ebe1",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,22 +9,27 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/index.js",
13
- "source": "src/index.js",
12
+ "main": "./lib/index.js",
13
+ "source": "./src/index.ts",
14
+ "types": "./lib/types/index.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/diagnostic": "2.14.1-canary.97+15c6d7000",
19
- "@atlaspack/feature-flags": "2.14.1-canary.97+15c6d7000",
20
- "@atlaspack/plugin": "2.14.5-canary.29+15c6d7000",
21
- "@atlaspack/rust": "3.2.1-canary.29+15c6d7000",
22
- "@atlaspack/types": "2.14.5-canary.29+15c6d7000",
23
- "@atlaspack/utils": "2.14.5-canary.29+15c6d7000",
24
- "@parcel/source-map": "^2.1.1",
19
+ "@atlaspack/diagnostic": "2.14.1-canary.360+98b80ebe1",
20
+ "@atlaspack/feature-flags": "2.14.1-canary.360+98b80ebe1",
21
+ "@atlaspack/plugin": "2.14.5-canary.292+98b80ebe1",
22
+ "@atlaspack/rust": "3.2.1-canary.292+98b80ebe1",
23
+ "@atlaspack/source-map": "3.1.1-canary.4071+98b80ebe1",
24
+ "@atlaspack/types": "2.14.5-canary.292+98b80ebe1",
25
+ "@atlaspack/utils": "2.14.5-canary.292+98b80ebe1",
25
26
  "globals": "^13.2.0",
26
- "nullthrows": "^1.1.1"
27
+ "nullthrows": "^1.1.1",
28
+ "outdent": "^0.8.0"
27
29
  },
28
30
  "type": "commonjs",
29
- "gitHead": "15c6d7000bd89da876bc590aa75b17a619a41896"
30
- }
31
+ "scripts": {
32
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
33
+ },
34
+ "gitHead": "98b80ebe1e2b1114dd1d3f076dc28a70aaa86aaa"
35
+ }
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import type {
3
2
  ScopeHoistingPackager,
4
3
  OutputFormat,
@@ -1,4 +1,3 @@
1
- // @flow strict-local
2
1
  import type {BundleGraph, PluginOptions, NamedBundle} from '@atlaspack/types';
3
2
 
4
3
  import {
@@ -7,7 +6,8 @@ import {
7
6
  countLines,
8
7
  normalizeSeparators,
9
8
  } from '@atlaspack/utils';
10
- import SourceMap from '@parcel/source-map';
9
+ import SourceMap from '@atlaspack/source-map';
10
+ import {getFeatureFlag} from '@atlaspack/feature-flags';
11
11
  import invariant from 'assert';
12
12
  import path from 'path';
13
13
  import fs from 'fs';
@@ -36,7 +36,10 @@ export class DevPackager {
36
36
  this.parcelRequireName = parcelRequireName;
37
37
  }
38
38
 
39
- async package(): Promise<{|contents: string, map: ?SourceMap|}> {
39
+ async package(): Promise<{
40
+ contents: string;
41
+ map: SourceMap | null | undefined;
42
+ }> {
40
43
  // Load assets
41
44
  let queue = new PromiseQueue({maxConcurrent: 32});
42
45
  this.bundle.traverseAssets((asset) => {
@@ -58,7 +61,13 @@ export class DevPackager {
58
61
 
59
62
  let prefix = this.getPrefix();
60
63
  let lineOffset = countLines(prefix);
61
- let script: ?{|code: string, mapBuffer: ?Buffer|} = null;
64
+ let script:
65
+ | {
66
+ code: string;
67
+ mapBuffer: Buffer | null | undefined;
68
+ }
69
+ | null
70
+ | undefined = null;
62
71
 
63
72
  this.bundle.traverse((node) => {
64
73
  let wrapped = first ? '' : ',';
@@ -93,11 +102,12 @@ export class DevPackager {
93
102
  this.bundle.env.sourceType === 'script' &&
94
103
  asset === this.bundle.getMainEntry()
95
104
  ) {
105
+ // @ts-expect-error TS2322
96
106
  script = results[i++];
97
107
  return;
98
108
  }
99
109
 
100
- let deps = {};
110
+ let deps: Record<string, any> = {};
101
111
  let dependencies = this.bundleGraph.getDependencies(asset);
102
112
  for (let dep of dependencies) {
103
113
  let resolved = this.bundleGraph.getResolvedAsset(dep, this.bundle);
@@ -112,6 +122,19 @@ export class DevPackager {
112
122
  }
113
123
  }
114
124
 
125
+ if (getFeatureFlag('hmrImprovements')) {
126
+ // Add dependencies for parcelRequire calls added by runtimes
127
+ // so that the HMR runtime can correctly traverse parents.
128
+ let hmrDeps = asset.meta.hmrDeps;
129
+ if (this.options.hmrOptions && Array.isArray(hmrDeps)) {
130
+ for (let id of hmrDeps) {
131
+ invariant(typeof id === 'string');
132
+ deps[id] = id;
133
+ }
134
+ }
135
+ }
136
+
137
+ // @ts-expect-error TS2339
115
138
  let {code, mapBuffer} = results[i];
116
139
  let output = code || '';
117
140
  wrapped +=
@@ -192,6 +215,7 @@ export class DevPackager {
192
215
  // runtimes with a parcelRequire call.
193
216
  if (this.bundle.env.sourceType === 'script' && script) {
194
217
  let entryMap;
218
+ // @ts-expect-error TS2339
195
219
  let mapBuffer = script.mapBuffer;
196
220
  if (mapBuffer) {
197
221
  entryMap = new SourceMap(this.options.projectRoot, mapBuffer);
@@ -199,6 +223,7 @@ export class DevPackager {
199
223
  contents += replaceScriptDependencies(
200
224
  this.bundleGraph,
201
225
  this.bundle,
226
+ // @ts-expect-error TS2339
202
227
  script.code,
203
228
  entryMap,
204
229
  this.parcelRequireName,
@@ -215,7 +240,7 @@ export class DevPackager {
215
240
  }
216
241
 
217
242
  getPrefix(): string {
218
- let interpreter: ?string;
243
+ let interpreter: string | null | undefined;
219
244
  let mainEntry = this.bundle.getMainEntry();
220
245
  if (mainEntry && this.isEntry() && !this.bundle.target.env.isBrowser()) {
221
246
  let _interpreter = mainEntry.meta.interpreter;
@@ -224,7 +249,7 @@ export class DevPackager {
224
249
  }
225
250
 
226
251
  let importScripts = '';
227
- if (this.bundle.env.isWorker()) {
252
+ if (this.bundle.env.isWorker() || this.bundle.env.isTesseract()) {
228
253
  let bundles = this.bundleGraph.getReferencedBundles(this.bundle);
229
254
  for (let b of bundles) {
230
255
  importScripts += `importScripts("${relativeBundlePath(
@@ -246,7 +271,8 @@ export class DevPackager {
246
271
  return (
247
272
  !this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') ||
248
273
  this.bundle.env.isIsolated() ||
249
- this.bundle.bundleBehavior === 'isolated'
274
+ this.bundle.bundleBehavior === 'isolated' ||
275
+ this.bundle.bundleBehavior === 'inlineIsolated'
250
276
  );
251
277
  }
252
278
  }
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import type {
3
2
  ScopeHoistingPackager,
4
3
  OutputFormat,
@@ -18,7 +17,7 @@ export class ESMOutputFormat implements OutputFormat {
18
17
  for (let [source, specifiers] of this.packager.externals) {
19
18
  let defaultSpecifier = null;
20
19
  let namespaceSpecifier = null;
21
- let namedSpecifiers = [];
20
+ let namedSpecifiers: Array<string> = [];
22
21
  for (let [imported, symbol] of specifiers) {
23
22
  if (imported === 'default' /* || isCommonJS*/) {
24
23
  defaultSpecifier = symbol;
@@ -77,14 +76,14 @@ export class ESMOutputFormat implements OutputFormat {
77
76
  buildBundlePostlude(): [string, number] {
78
77
  let res = '';
79
78
  let lines = 0;
80
- let exportSpecifiers = [];
79
+ let exportSpecifiers: Array<string> = [];
81
80
  for (let {
82
81
  asset,
83
82
  exportSymbol,
84
83
  local,
85
84
  exportAs,
86
85
  } of this.packager.exportedSymbols.values()) {
87
- if (this.packager.wrappedAssets.has(asset.id)) {
86
+ if (this.packager.wrappedAssets.has(asset)) {
88
87
  let obj = `parcelRequire("${this.packager.bundleGraph.getAssetPublicId(
89
88
  asset,
90
89
  )}")`;
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import type {
3
2
  ScopeHoistingPackager,
4
3
  OutputFormat,