@atlaspack/packager-js 2.23.2-dev-ts-project-refs-d30e9754f.0 → 2.23.3

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,30 @@
1
1
  # @atlaspack/packager-js
2
2
 
3
+ ## 2.23.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`236e546`](https://github.com/atlassian-labs/atlaspack/commit/236e5465863dca6044a7191e05260a5b924c342e), [`f07351a`](https://github.com/atlassian-labs/atlaspack/commit/f07351a2398b6a8e5155a2daad77e69b7dcb2b4b)]:
8
+ - @atlaspack/utils@3.0.1
9
+ - @atlaspack/feature-flags@2.25.3
10
+ - @atlaspack/types@2.15.23
11
+ - @atlaspack/plugin@2.14.33
12
+
13
+ ## 2.23.2
14
+
15
+ ### Patch Changes
16
+
17
+ - [#796](https://github.com/atlassian-labs/atlaspack/pull/796) [`0e967b0`](https://github.com/atlassian-labs/atlaspack/commit/0e967b0cf0fbd885588b81476ec1f25a507ffa94) Thanks [@benjervis](https://github.com/benjervis)! - Minor refactor of the internals of the scope hoisting packager. Some of the internal objects are now keyed on Assets rather than string asset IDs.
18
+
19
+ - [#801](https://github.com/atlassian-labs/atlaspack/pull/801) [`b104fd8`](https://github.com/atlassian-labs/atlaspack/commit/b104fd846ea17c583e68ddc6b309c5e1edee6938) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix incorrect output with skipped assets with scope hoisting improvements
20
+
21
+ - Updated dependencies [[`0207171`](https://github.com/atlassian-labs/atlaspack/commit/0207171e59e985c51e105aec2e0a99de174374bd), [`10ee3fa`](https://github.com/atlassian-labs/atlaspack/commit/10ee3fa5b75a92acde8973673d9b3c5b6f3958e5), [`bbe4e28`](https://github.com/atlassian-labs/atlaspack/commit/bbe4e28c89e5e9284bd730075d4d6f2a3cb37b21), [`1180103`](https://github.com/atlassian-labs/atlaspack/commit/118010351ed444f8178988afb3f77807154dd933), [`2bc93b1`](https://github.com/atlassian-labs/atlaspack/commit/2bc93b17cea07fd7cbb68acec84d8471345a22b4)]:
22
+ - @atlaspack/feature-flags@2.25.2
23
+ - @atlaspack/rust@3.8.2
24
+ - @atlaspack/utils@3.0.0
25
+ - @atlaspack/plugin@2.14.32
26
+ - @atlaspack/types@2.15.22
27
+
3
28
  ## 2.23.1
4
29
 
5
30
  ### Patch Changes
@@ -70,7 +70,7 @@ class ESMOutputFormat {
70
70
  let lines = 0;
71
71
  let exportSpecifiers = [];
72
72
  for (let { asset, exportSymbol, local, exportAs, } of this.packager.exportedSymbols.values()) {
73
- if (this.packager.wrappedAssets.has(asset.id)) {
73
+ if (this.packager.wrappedAssets.has(asset)) {
74
74
  let obj = `parcelRequire("${this.packager.bundleGraph.getAssetPublicId(asset)}")`;
75
75
  res += `\nvar ${local} = ${this.packager.getPropertyAccess(obj, exportSymbol)};`;
76
76
  lines++;
@@ -81,11 +81,13 @@ const OUTPUT_FORMATS = {
81
81
  };
82
82
  class ScopeHoistingPackager {
83
83
  constructor(options, bundleGraph, bundle, parcelRequireName, useAsyncBundleRuntime, logger) {
84
+ this.assetOutputs = new Map();
84
85
  this.exportedSymbols = new Map();
85
86
  this.externals = new Map();
86
87
  this.topLevelNames = new Map();
87
88
  this.seenAssets = new Set();
88
89
  this.wrappedAssets = new Set();
90
+ this.constantAssets = new Set();
89
91
  this.hoistedRequires = new Map();
90
92
  this.seenHoistedRequires = new Set();
91
93
  this.needsPrelude = false;
@@ -109,7 +111,7 @@ class ScopeHoistingPackager {
109
111
  this.globalNames = GLOBALS_BY_CONTEXT[bundle.env.context];
110
112
  }
111
113
  async package() {
112
- let { wrapped: wrappedAssets, constant: constantAssets } = await this.loadAssets();
114
+ await this.loadAssets();
113
115
  this.buildExportedSymbols();
114
116
  // If building a library, the target is actually another bundler rather
115
117
  // than the final output that could be loaded in a browser. So, loader
@@ -126,13 +128,12 @@ class ScopeHoistingPackager {
126
128
  }
127
129
  let res = '';
128
130
  let lineCount = 0;
129
- // @ts-expect-error TS7034
130
131
  let sourceMap = null;
131
132
  let processAsset = (asset) => {
132
133
  this.seenHoistedRequires.clear();
133
134
  let [content, map, lines] = this.visitAsset(asset);
134
- // @ts-expect-error TS7005
135
135
  if (sourceMap && map) {
136
+ // @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
136
137
  sourceMap.addSourceMap(map, lineCount);
137
138
  }
138
139
  else if (this.bundle.env.sourceMap) {
@@ -144,23 +145,23 @@ class ScopeHoistingPackager {
144
145
  if ((0, feature_flags_1.getFeatureFlag)('inlineConstOptimisationFix') ||
145
146
  this.useBothScopeHoistingImprovements) {
146
147
  // Write out all constant modules used by this bundle
147
- for (let asset of constantAssets) {
148
- if (!this.seenAssets.has(asset.id)) {
148
+ for (let asset of this.constantAssets) {
149
+ if (!this.seenAssets.has(asset)) {
149
150
  processAsset(asset);
150
151
  }
151
152
  }
152
153
  }
153
154
  // Hoist wrapped asset to the top of the bundle to ensure that they are registered
154
155
  // before they are used.
155
- for (let asset of wrappedAssets) {
156
- if (!this.seenAssets.has(asset.id)) {
156
+ for (let asset of this.wrappedAssets) {
157
+ if (!this.seenAssets.has(asset)) {
157
158
  processAsset(asset);
158
159
  }
159
160
  }
160
161
  // Add each asset that is directly connected to the bundle. Dependencies will be handled
161
162
  // by replacing `import` statements in the code.
162
163
  this.bundle.traverseAssets((asset, _, actions) => {
163
- if (this.seenAssets.has(asset.id)) {
164
+ if (this.seenAssets.has(asset)) {
164
165
  actions.skipChildren();
165
166
  return;
166
167
  }
@@ -170,7 +171,7 @@ class ScopeHoistingPackager {
170
171
  let [prelude, preludeLines] = this.buildBundlePrelude();
171
172
  res = prelude + res;
172
173
  lineCount += preludeLines;
173
- // @ts-expect-error TS2339
174
+ // @ts-expect-error TS2339 - offsetLines method exists but missing from @parcel/source-map type definitions
174
175
  sourceMap?.offsetLines(1, preludeLines);
175
176
  let entries = this.bundle.getEntryAssets();
176
177
  let mainEntry = this.bundle.getMainEntry();
@@ -193,7 +194,7 @@ class ScopeHoistingPackager {
193
194
  let needsBundleQueue = this.shouldBundleQueue(this.bundle);
194
195
  // If any of the entry assets are wrapped, call parcelRequire so they are executed.
195
196
  for (let entry of entries) {
196
- if (this.wrappedAssets.has(entry.id) && !this.isScriptEntry(entry)) {
197
+ if (this.wrappedAssets.has(entry) && !this.isScriptEntry(entry)) {
197
198
  let parcelRequire = `parcelRequire(${JSON.stringify(this.bundleGraph.getAssetPublicId(entry))});\n`;
198
199
  let entryExports = entry.symbols.get('*')?.local;
199
200
  if (entryExports &&
@@ -222,14 +223,14 @@ class ScopeHoistingPackager {
222
223
  res += '\n';
223
224
  lineCount++;
224
225
  let mainEntry = (0, nullthrows_1.default)(this.bundle.getMainEntry());
225
- let { code, map: mapBuffer } = (0, nullthrows_1.default)(this.assetOutputs.get(mainEntry.id));
226
+ let { code, map: mapBuffer } = (0, nullthrows_1.default)(this.assetOutputs.get(mainEntry));
226
227
  let map;
227
228
  if (mapBuffer) {
228
229
  map = new source_map_1.default(this.options.projectRoot, mapBuffer);
229
230
  }
230
231
  res += (0, utils_2.replaceScriptDependencies)(this.bundleGraph, this.bundle, code, map, this.parcelRequireName);
231
232
  if (sourceMap && map) {
232
- // @ts-expect-error TS2339
233
+ // @ts-expect-error TS2339 - addSourceMap method exists but missing from @parcel/source-map type definitions
233
234
  sourceMap.addSourceMap(map, lineCount);
234
235
  }
235
236
  }
@@ -295,16 +296,16 @@ class ScopeHoistingPackager {
295
296
  return `$parcel$global.rwr(${params.join(', ')});`;
296
297
  }
297
298
  async loadAssets() {
298
- let queue = new utils_1.PromiseQueue({ maxConcurrent: 32 });
299
- let wrapped = [];
300
- let constant = [];
299
+ let queue = new utils_1.PromiseQueue({
300
+ maxConcurrent: 32,
301
+ });
301
302
  this.bundle.traverseAssets((asset) => {
302
303
  queue.add(async () => {
303
304
  let [code, map] = await Promise.all([
304
305
  asset.getCode(),
305
306
  this.bundle.env.sourceMap ? asset.getMapBuffer() : null,
306
307
  ]);
307
- return [asset.id, { code, map }];
308
+ return [asset, { code, map }];
308
309
  });
309
310
  if (asset.meta.shouldWrap ||
310
311
  this.bundle.env.sourceType === 'script' ||
@@ -317,13 +318,12 @@ class ScopeHoistingPackager {
317
318
  this.bundleGraph
318
319
  .getIncomingDependencies(asset)
319
320
  .some((dep) => dep.priority === 'lazy')) {
320
- this.wrappedAssets.add(asset.id);
321
- wrapped.push(asset);
321
+ this.wrappedAssets.add(asset);
322
322
  }
323
323
  else if (((0, feature_flags_1.getFeatureFlag)('inlineConstOptimisationFix') ||
324
324
  this.useBothScopeHoistingImprovements) &&
325
325
  asset.meta.isConstantModule) {
326
- constant.push(asset);
326
+ this.constantAssets.add(asset);
327
327
  }
328
328
  }
329
329
  });
@@ -335,18 +335,19 @@ class ScopeHoistingPackager {
335
335
  if (!(0, feature_flags_1.getFeatureFlag)('applyScopeHoistingImprovementV2')) {
336
336
  // Make all entry assets wrapped, to avoid any top level hoisting
337
337
  for (let entryAsset of this.bundle.getEntryAssets()) {
338
- if (!this.wrappedAssets.has(entryAsset.id)) {
339
- this.wrappedAssets.add(entryAsset.id);
340
- wrapped.push(entryAsset);
338
+ if (!this.wrappedAssets.has(entryAsset)) {
339
+ this.wrappedAssets.add(entryAsset);
341
340
  }
342
341
  }
343
342
  }
344
- let moduleGroupParents = [...wrapped];
343
+ // We need to make a new copy here so that we can add to the list and
344
+ // iterate the newly added items, without mutating the wrappedAssets set
345
+ let moduleGroupParents = [...this.wrappedAssets.values()];
345
346
  if ((0, feature_flags_1.getFeatureFlag)('applyScopeHoistingImprovementV2')) {
346
347
  // The main entry needs to be check to find assets that would have gone in
347
348
  // the top level scope
348
349
  let mainEntry = this.bundle.getMainEntry();
349
- if (mainEntry && !this.wrappedAssets.has(mainEntry.id)) {
350
+ if (mainEntry && !this.wrappedAssets.has(mainEntry)) {
350
351
  moduleGroupParents.unshift(mainEntry);
351
352
  }
352
353
  }
@@ -355,14 +356,13 @@ class ScopeHoistingPackager {
355
356
  if (asset === moduleGroupParentAsset) {
356
357
  return;
357
358
  }
358
- if (this.wrappedAssets.has(asset.id)) {
359
+ if (this.wrappedAssets.has(asset)) {
359
360
  actions.skipChildren();
360
361
  return;
361
362
  }
362
363
  if (!asset.meta.isConstantModule &&
363
364
  (assignedAssets.has(asset) || this.isReExported(asset))) {
364
- wrapped.push(asset);
365
- this.wrappedAssets.add(asset.id);
365
+ this.wrappedAssets.add(asset);
366
366
  // This also needs to be added to the traversal so that we iterate
367
367
  // it during this check.
368
368
  moduleGroupParents.push(asset);
@@ -374,25 +374,22 @@ class ScopeHoistingPackager {
374
374
  }
375
375
  }
376
376
  else {
377
- for (let wrappedAssetRoot of [...wrapped]) {
377
+ for (let wrappedAssetRoot of this.wrappedAssets) {
378
378
  this.bundle.traverseAssets((asset, _, actions) => {
379
379
  if (asset === wrappedAssetRoot) {
380
380
  return;
381
381
  }
382
- if (this.wrappedAssets.has(asset.id)) {
382
+ if (this.wrappedAssets.has(asset)) {
383
383
  actions.skipChildren();
384
384
  return;
385
385
  }
386
386
  if (!asset.meta.isConstantModule) {
387
- this.wrappedAssets.add(asset.id);
388
- wrapped.push(asset);
387
+ this.wrappedAssets.add(asset);
389
388
  }
390
389
  }, wrappedAssetRoot);
391
390
  }
392
391
  }
393
- // @ts-expect-error TS2769
394
392
  this.assetOutputs = new Map(await queue.run());
395
- return { wrapped, constant };
396
393
  }
397
394
  isReExported(asset) {
398
395
  let parentSymbols = this.bundleGraph
@@ -414,7 +411,7 @@ class ScopeHoistingPackager {
414
411
  }
415
412
  // TODO: handle ESM exports of wrapped entry assets...
416
413
  let entry = this.bundle.getMainEntry();
417
- if (entry && !this.wrappedAssets.has(entry.id)) {
414
+ if (entry && !this.wrappedAssets.has(entry)) {
418
415
  let hasNamespace = entry.symbols.hasExportSymbol('*');
419
416
  for (let { asset, exportAs, symbol, exportSymbol, } of this.bundleGraph.getExportedSymbols(entry)) {
420
417
  if (typeof symbol === 'string') {
@@ -479,16 +476,16 @@ class ScopeHoistingPackager {
479
476
  return `${obj}[${JSON.stringify(property)}]`;
480
477
  }
481
478
  visitAsset(asset) {
482
- (0, assert_1.default)(!this.seenAssets.has(asset.id), 'Already visited asset');
483
- this.seenAssets.add(asset.id);
484
- let { code, map } = (0, nullthrows_1.default)(this.assetOutputs.get(asset.id));
479
+ (0, assert_1.default)(!this.seenAssets.has(asset), 'Already visited asset');
480
+ this.seenAssets.add(asset);
481
+ let { code, map } = (0, nullthrows_1.default)(this.assetOutputs.get(asset));
485
482
  return this.buildAsset(asset, code, map);
486
483
  }
487
484
  getAssetFilePath(asset) {
488
485
  return path_1.default.relative(this.options.projectRoot, asset.filePath);
489
486
  }
490
487
  buildAsset(asset, code, map) {
491
- let shouldWrap = this.wrappedAssets.has(asset.id);
488
+ let shouldWrap = this.wrappedAssets.has(asset);
492
489
  let deps = this.bundleGraph.getDependencies(asset);
493
490
  let sourceMap = this.bundle.env.sourceMap && map
494
491
  ? new source_map_1.default(this.options.projectRoot, map)
@@ -509,15 +506,23 @@ class ScopeHoistingPackager {
509
506
  }
510
507
  continue;
511
508
  }
512
- if (this.bundle.hasAsset(resolved) &&
513
- !this.seenAssets.has(resolved.id)) {
514
- let [code, map, lines] = this.visitAsset(resolved);
515
- depCode += code + '\n';
516
- if (sourceMap && map) {
517
- // @ts-expect-error TS2551
518
- sourceMap.addSourceMap(map, lineCount);
509
+ if (this.bundle.hasAsset(resolved) && !this.seenAssets.has(resolved)) {
510
+ if (this.useBothScopeHoistingImprovements &&
511
+ this.wrappedAssets.has(resolved)) {
512
+ // When the dep is wrapped then we just need to drop a side effect
513
+ // require instead of inlining
514
+ depCode += `parcelRequire("${this.bundleGraph.getAssetPublicId(resolved)}");\n`;
515
+ lineCount += 1;
516
+ }
517
+ else {
518
+ let [code, map, lines] = this.visitAsset(resolved);
519
+ depCode += code + '\n';
520
+ if (sourceMap && map) {
521
+ // @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
522
+ sourceMap.addSourceMap(map, lineCount);
523
+ }
524
+ lineCount += lines + 1;
519
525
  }
520
- lineCount += lines + 1;
521
526
  }
522
527
  }
523
528
  return [depCode, sourceMap, lineCount];
@@ -539,7 +544,6 @@ class ScopeHoistingPackager {
539
544
  }
540
545
  code += append;
541
546
  let lineCount = 0;
542
- // @ts-expect-error TS2552
543
547
  let depContent = [];
544
548
  if (depMap.size === 0 && replacements.size === 0) {
545
549
  // If there are no dependencies or replacements, use a simple function to count the number of lines.
@@ -585,14 +589,14 @@ class ScopeHoistingPackager {
585
589
  [res, lines] = this.getHoistedParcelRequires(asset, dep, resolved);
586
590
  }
587
591
  if (this.bundle.hasAsset(resolved) &&
588
- !this.seenAssets.has(resolved.id)) {
592
+ !this.seenAssets.has(resolved)) {
589
593
  // If this asset is wrapped, we need to hoist the code for the dependency
590
594
  // outside our parcelRequire.register wrapper. This is safe because all
591
595
  // assets referenced by this asset will also be wrapped. Otherwise, inline the
592
596
  // asset content where the import statement was.
593
597
  if (this.useBothScopeHoistingImprovements) {
594
598
  if (!resolved.meta.isConstantModule &&
595
- !this.wrappedAssets.has(resolved.id)) {
599
+ !this.wrappedAssets.has(resolved)) {
596
600
  let [depCode, depMap, depLines] = this.visitAsset(resolved);
597
601
  if (utils_1.debugTools['asset-file-names-in-output']) {
598
602
  let resolvedPath = this.getAssetFilePath(resolved);
@@ -637,7 +641,7 @@ class ScopeHoistingPackager {
637
641
  sourceMap.offsetLines(lineCount + 1, lines);
638
642
  }
639
643
  if (map) {
640
- // @ts-expect-error TS2551
644
+ // @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
641
645
  sourceMap.addSourceMap(map, lineCount);
642
646
  }
643
647
  }
@@ -681,7 +685,7 @@ ${code}
681
685
  continue;
682
686
  code += depCode + '\n';
683
687
  if (sourceMap && map) {
684
- // @ts-expect-error TS2551
688
+ // @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
685
689
  sourceMap.addSourceMap(map, lineCount);
686
690
  }
687
691
  lineCount += lines + 1;
@@ -759,7 +763,7 @@ ${code}
759
763
  }
760
764
  // If this asset is wrapped, we need to replace the exports namespace with `module.exports`,
761
765
  // which will be provided to us by the wrapper.
762
- if (this.wrappedAssets.has(asset.id) ||
766
+ if (this.wrappedAssets.has(asset) ||
763
767
  (this.bundle.env.outputFormat === 'commonjs' &&
764
768
  asset === this.bundle.getMainEntry())) {
765
769
  let exportsName = asset.symbols.get('*')?.local || `$${assetId}$exports`;
@@ -867,8 +871,9 @@ ${code}
867
871
  continue;
868
872
  }
869
873
  }
870
- // @ts-expect-error TS2322
871
- renamed = this.bundleGraph.getSymbolResolution(entry, imported, this.bundle).symbol;
874
+ renamed =
875
+ this.bundleGraph.getSymbolResolution(entry, imported, this.bundle)
876
+ .symbol || undefined;
872
877
  }
873
878
  }
874
879
  // Rename the specifier so that multiple local imports of the same imported specifier
@@ -913,7 +918,7 @@ ${code}
913
918
  return false;
914
919
  }
915
920
  return ((!this.bundle.hasAsset(resolved) && !this.externalAssets.has(resolved)) ||
916
- (this.wrappedAssets.has(resolved.id) && resolved !== parentAsset));
921
+ (this.wrappedAssets.has(resolved) && resolved !== parentAsset));
917
922
  }
918
923
  getSymbolResolution(parentAsset, resolved, imported, dep, replacements) {
919
924
  let { asset: resolvedAsset, exportSymbol, symbol, } = this.bundleGraph.getSymbolResolution(resolved, imported, this.bundle);
@@ -942,12 +947,12 @@ ${code}
942
947
  // parcelRequire.register'ed there), or if it is indeed registered in this bundle.
943
948
  (!this.bundle.hasAsset(resolvedAsset) ||
944
949
  !this.shouldSkipAsset(resolvedAsset))) {
945
- let hoisted = this.hoistedRequires.get(dep.id);
950
+ let hoisted = this.hoistedRequires.get(dep);
946
951
  if (!hoisted) {
947
952
  hoisted = new Map();
948
- this.hoistedRequires.set(dep.id, hoisted);
953
+ this.hoistedRequires.set(dep, hoisted);
949
954
  }
950
- hoisted.set(resolvedAsset.id, `var $${publicId} = parcelRequire(${JSON.stringify(publicId)});`);
955
+ hoisted.set(resolvedAsset, `var $${publicId} = parcelRequire(${JSON.stringify(publicId)});`);
951
956
  }
952
957
  if (isWrapped) {
953
958
  this.needsPrelude = true;
@@ -982,7 +987,7 @@ ${code}
982
987
  if (imported === '*' || exportSymbol === '*' || isDefaultInterop) {
983
988
  // Resolve to the namespace object if requested or this is a CJS default interop reqiure.
984
989
  if (parentAsset === resolvedAsset &&
985
- this.wrappedAssets.has(resolvedAsset.id)) {
990
+ this.wrappedAssets.has(resolvedAsset)) {
986
991
  // Directly use module.exports for wrapped assets importing themselves.
987
992
  return 'module.exports';
988
993
  }
@@ -1019,7 +1024,7 @@ ${code}
1019
1024
  if (resolved.type !== 'js') {
1020
1025
  return ['', 0];
1021
1026
  }
1022
- let hoisted = this.hoistedRequires.get(dep.id);
1027
+ let hoisted = this.hoistedRequires.get(dep);
1023
1028
  let res = '';
1024
1029
  let lineCount = 0;
1025
1030
  let isWrapped = this.isWrapped(resolved, parentAsset);
@@ -1029,7 +1034,7 @@ ${code}
1029
1034
  // so it runs first.
1030
1035
  if (isWrapped &&
1031
1036
  !dep.meta.shouldWrap &&
1032
- (!hoisted || hoisted.keys().next().value !== resolved.id) &&
1037
+ (!hoisted || hoisted.keys().next().value !== resolved) &&
1033
1038
  !this.bundleGraph.isDependencySkipped(dep) &&
1034
1039
  !this.shouldSkipAsset(resolved)) {
1035
1040
  this.needsPrelude = true;
@@ -1056,7 +1061,7 @@ ${code}
1056
1061
  let prepend = '';
1057
1062
  let prependLineCount = 0;
1058
1063
  let append = '';
1059
- let shouldWrap = this.wrappedAssets.has(asset.id);
1064
+ let shouldWrap = this.wrappedAssets.has(asset);
1060
1065
  let usedSymbols = (0, nullthrows_1.default)(this.bundleGraph.getUsedSymbols(asset));
1061
1066
  let assetId = asset.meta.id;
1062
1067
  (0, assert_1.default)(typeof assetId === 'string');
@@ -1252,10 +1257,8 @@ ${code}
1252
1257
  this.usedHelpers.add('$parcel$global');
1253
1258
  }
1254
1259
  for (let helper of this.usedHelpers) {
1255
- // @ts-expect-error TS7053
1256
1260
  let currentHelper = helpers_1.helpers[helper];
1257
1261
  if (typeof currentHelper === 'function') {
1258
- // @ts-expect-error TS7053
1259
1262
  currentHelper = helpers_1.helpers[helper](this.bundle.env);
1260
1263
  }
1261
1264
  res += currentHelper;
@@ -75,7 +75,7 @@ class ESMOutputFormat {
75
75
  local,
76
76
  exportAs
77
77
  } of this.packager.exportedSymbols.values()) {
78
- if (this.packager.wrappedAssets.has(asset.id)) {
78
+ if (this.packager.wrappedAssets.has(asset)) {
79
79
  let obj = `parcelRequire("${this.packager.bundleGraph.getAssetPublicId(asset)}")`;
80
80
  res += `\nvar ${local} = ${this.packager.getPropertyAccess(obj, exportSymbol)};`;
81
81
  lines++;