@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 +25 -0
- package/dist/ESMOutputFormat.js +1 -1
- package/dist/ScopeHoistingPackager.js +67 -64
- package/lib/ESMOutputFormat.js +1 -1
- package/lib/ScopeHoistingPackager.js +61 -73
- package/lib/types/ScopeHoistingPackager.d.ts +6 -8
- package/package.json +9 -10
- package/src/ESMOutputFormat.ts +1 -1
- package/src/ScopeHoistingPackager.ts +80 -88
- package/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +0 -201
|
@@ -90,14 +90,13 @@ export class ScopeHoistingPackager {
|
|
|
90
90
|
outputFormat: OutputFormat;
|
|
91
91
|
isAsyncBundle: boolean;
|
|
92
92
|
globalNames: ReadonlySet<string>;
|
|
93
|
-
// @ts-expect-error TS2564
|
|
94
93
|
assetOutputs: Map<
|
|
95
|
-
|
|
94
|
+
Asset,
|
|
96
95
|
{
|
|
97
96
|
code: string;
|
|
98
97
|
map: Buffer | null | undefined;
|
|
99
98
|
}
|
|
100
|
-
|
|
99
|
+
> = new Map();
|
|
101
100
|
exportedSymbols: Map<
|
|
102
101
|
string,
|
|
103
102
|
{
|
|
@@ -109,9 +108,10 @@ export class ScopeHoistingPackager {
|
|
|
109
108
|
> = new Map();
|
|
110
109
|
externals: Map<string, Map<string, string>> = new Map();
|
|
111
110
|
topLevelNames: Map<string, number> = new Map();
|
|
112
|
-
seenAssets: Set<
|
|
113
|
-
wrappedAssets: Set<
|
|
114
|
-
|
|
111
|
+
seenAssets: Set<Asset> = new Set();
|
|
112
|
+
wrappedAssets: Set<Asset> = new Set();
|
|
113
|
+
constantAssets: Set<Asset> = new Set();
|
|
114
|
+
hoistedRequires: Map<Dependency, Map<Asset, string>> = new Map();
|
|
115
115
|
seenHoistedRequires: Set<string> = new Set();
|
|
116
116
|
needsPrelude: boolean = false;
|
|
117
117
|
usedHelpers: Set<string> = new Set();
|
|
@@ -152,8 +152,7 @@ export class ScopeHoistingPackager {
|
|
|
152
152
|
contents: string;
|
|
153
153
|
map: SourceMap | null | undefined;
|
|
154
154
|
}> {
|
|
155
|
-
|
|
156
|
-
await this.loadAssets();
|
|
155
|
+
await this.loadAssets();
|
|
157
156
|
this.buildExportedSymbols();
|
|
158
157
|
|
|
159
158
|
// If building a library, the target is actually another bundler rather
|
|
@@ -174,14 +173,13 @@ export class ScopeHoistingPackager {
|
|
|
174
173
|
|
|
175
174
|
let res = '';
|
|
176
175
|
let lineCount = 0;
|
|
177
|
-
|
|
178
|
-
let sourceMap = null;
|
|
176
|
+
let sourceMap: SourceMap | null | undefined = null;
|
|
179
177
|
let processAsset = (asset: Asset) => {
|
|
180
178
|
this.seenHoistedRequires.clear();
|
|
181
179
|
let [content, map, lines] = this.visitAsset(asset);
|
|
182
180
|
|
|
183
|
-
// @ts-expect-error TS7005
|
|
184
181
|
if (sourceMap && map) {
|
|
182
|
+
// @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
|
|
185
183
|
sourceMap.addSourceMap(map, lineCount);
|
|
186
184
|
} else if (this.bundle.env.sourceMap) {
|
|
187
185
|
sourceMap = map;
|
|
@@ -196,8 +194,8 @@ export class ScopeHoistingPackager {
|
|
|
196
194
|
this.useBothScopeHoistingImprovements
|
|
197
195
|
) {
|
|
198
196
|
// Write out all constant modules used by this bundle
|
|
199
|
-
for (let asset of constantAssets) {
|
|
200
|
-
if (!this.seenAssets.has(asset
|
|
197
|
+
for (let asset of this.constantAssets) {
|
|
198
|
+
if (!this.seenAssets.has(asset)) {
|
|
201
199
|
processAsset(asset);
|
|
202
200
|
}
|
|
203
201
|
}
|
|
@@ -205,8 +203,8 @@ export class ScopeHoistingPackager {
|
|
|
205
203
|
|
|
206
204
|
// Hoist wrapped asset to the top of the bundle to ensure that they are registered
|
|
207
205
|
// before they are used.
|
|
208
|
-
for (let asset of wrappedAssets) {
|
|
209
|
-
if (!this.seenAssets.has(asset
|
|
206
|
+
for (let asset of this.wrappedAssets) {
|
|
207
|
+
if (!this.seenAssets.has(asset)) {
|
|
210
208
|
processAsset(asset);
|
|
211
209
|
}
|
|
212
210
|
}
|
|
@@ -214,7 +212,7 @@ export class ScopeHoistingPackager {
|
|
|
214
212
|
// Add each asset that is directly connected to the bundle. Dependencies will be handled
|
|
215
213
|
// by replacing `import` statements in the code.
|
|
216
214
|
this.bundle.traverseAssets((asset, _, actions) => {
|
|
217
|
-
if (this.seenAssets.has(asset
|
|
215
|
+
if (this.seenAssets.has(asset)) {
|
|
218
216
|
actions.skipChildren();
|
|
219
217
|
return;
|
|
220
218
|
}
|
|
@@ -226,7 +224,7 @@ export class ScopeHoistingPackager {
|
|
|
226
224
|
let [prelude, preludeLines] = this.buildBundlePrelude();
|
|
227
225
|
res = prelude + res;
|
|
228
226
|
lineCount += preludeLines;
|
|
229
|
-
// @ts-expect-error TS2339
|
|
227
|
+
// @ts-expect-error TS2339 - offsetLines method exists but missing from @parcel/source-map type definitions
|
|
230
228
|
sourceMap?.offsetLines(1, preludeLines);
|
|
231
229
|
|
|
232
230
|
let entries = this.bundle.getEntryAssets();
|
|
@@ -255,7 +253,7 @@ export class ScopeHoistingPackager {
|
|
|
255
253
|
|
|
256
254
|
// If any of the entry assets are wrapped, call parcelRequire so they are executed.
|
|
257
255
|
for (let entry of entries) {
|
|
258
|
-
if (this.wrappedAssets.has(entry
|
|
256
|
+
if (this.wrappedAssets.has(entry) && !this.isScriptEntry(entry)) {
|
|
259
257
|
let parcelRequire = `parcelRequire(${JSON.stringify(
|
|
260
258
|
this.bundleGraph.getAssetPublicId(entry),
|
|
261
259
|
)});\n`;
|
|
@@ -299,9 +297,7 @@ export class ScopeHoistingPackager {
|
|
|
299
297
|
lineCount++;
|
|
300
298
|
|
|
301
299
|
let mainEntry = nullthrows(this.bundle.getMainEntry());
|
|
302
|
-
let {code, map: mapBuffer} = nullthrows(
|
|
303
|
-
this.assetOutputs.get(mainEntry.id),
|
|
304
|
-
);
|
|
300
|
+
let {code, map: mapBuffer} = nullthrows(this.assetOutputs.get(mainEntry));
|
|
305
301
|
let map;
|
|
306
302
|
if (mapBuffer) {
|
|
307
303
|
map = new SourceMap(this.options.projectRoot, mapBuffer);
|
|
@@ -314,7 +310,7 @@ export class ScopeHoistingPackager {
|
|
|
314
310
|
this.parcelRequireName,
|
|
315
311
|
);
|
|
316
312
|
if (sourceMap && map) {
|
|
317
|
-
// @ts-expect-error TS2339
|
|
313
|
+
// @ts-expect-error TS2339 - addSourceMap method exists but missing from @parcel/source-map type definitions
|
|
318
314
|
sourceMap.addSourceMap(map, lineCount);
|
|
319
315
|
}
|
|
320
316
|
}
|
|
@@ -399,13 +395,11 @@ export class ScopeHoistingPackager {
|
|
|
399
395
|
return `$parcel$global.rwr(${params.join(', ')});`;
|
|
400
396
|
}
|
|
401
397
|
|
|
402
|
-
async loadAssets()
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
let wrapped: Array<Asset> = [];
|
|
408
|
-
let constant: Array<Asset> = [];
|
|
398
|
+
async loadAssets() {
|
|
399
|
+
type QueueItem = [Asset, {code: string; map: Buffer | undefined | null}];
|
|
400
|
+
let queue = new PromiseQueue<QueueItem>({
|
|
401
|
+
maxConcurrent: 32,
|
|
402
|
+
});
|
|
409
403
|
|
|
410
404
|
this.bundle.traverseAssets((asset) => {
|
|
411
405
|
queue.add(async () => {
|
|
@@ -414,7 +408,7 @@ export class ScopeHoistingPackager {
|
|
|
414
408
|
this.bundle.env.sourceMap ? asset.getMapBuffer() : null,
|
|
415
409
|
]);
|
|
416
410
|
|
|
417
|
-
return [asset
|
|
411
|
+
return [asset, {code, map}];
|
|
418
412
|
});
|
|
419
413
|
|
|
420
414
|
if (
|
|
@@ -432,14 +426,13 @@ export class ScopeHoistingPackager {
|
|
|
432
426
|
.getIncomingDependencies(asset)
|
|
433
427
|
.some((dep) => dep.priority === 'lazy')
|
|
434
428
|
) {
|
|
435
|
-
this.wrappedAssets.add(asset
|
|
436
|
-
wrapped.push(asset);
|
|
429
|
+
this.wrappedAssets.add(asset);
|
|
437
430
|
} else if (
|
|
438
431
|
(getFeatureFlag('inlineConstOptimisationFix') ||
|
|
439
432
|
this.useBothScopeHoistingImprovements) &&
|
|
440
433
|
asset.meta.isConstantModule
|
|
441
434
|
) {
|
|
442
|
-
|
|
435
|
+
this.constantAssets.add(asset);
|
|
443
436
|
}
|
|
444
437
|
}
|
|
445
438
|
});
|
|
@@ -453,20 +446,21 @@ export class ScopeHoistingPackager {
|
|
|
453
446
|
if (!getFeatureFlag('applyScopeHoistingImprovementV2')) {
|
|
454
447
|
// Make all entry assets wrapped, to avoid any top level hoisting
|
|
455
448
|
for (let entryAsset of this.bundle.getEntryAssets()) {
|
|
456
|
-
if (!this.wrappedAssets.has(entryAsset
|
|
457
|
-
this.wrappedAssets.add(entryAsset
|
|
458
|
-
wrapped.push(entryAsset);
|
|
449
|
+
if (!this.wrappedAssets.has(entryAsset)) {
|
|
450
|
+
this.wrappedAssets.add(entryAsset);
|
|
459
451
|
}
|
|
460
452
|
}
|
|
461
453
|
}
|
|
462
454
|
|
|
463
|
-
|
|
455
|
+
// We need to make a new copy here so that we can add to the list and
|
|
456
|
+
// iterate the newly added items, without mutating the wrappedAssets set
|
|
457
|
+
let moduleGroupParents = [...this.wrappedAssets.values()];
|
|
464
458
|
|
|
465
459
|
if (getFeatureFlag('applyScopeHoistingImprovementV2')) {
|
|
466
460
|
// The main entry needs to be check to find assets that would have gone in
|
|
467
461
|
// the top level scope
|
|
468
462
|
let mainEntry = this.bundle.getMainEntry();
|
|
469
|
-
if (mainEntry && !this.wrappedAssets.has(mainEntry
|
|
463
|
+
if (mainEntry && !this.wrappedAssets.has(mainEntry)) {
|
|
470
464
|
moduleGroupParents.unshift(mainEntry);
|
|
471
465
|
}
|
|
472
466
|
}
|
|
@@ -477,7 +471,7 @@ export class ScopeHoistingPackager {
|
|
|
477
471
|
return;
|
|
478
472
|
}
|
|
479
473
|
|
|
480
|
-
if (this.wrappedAssets.has(asset
|
|
474
|
+
if (this.wrappedAssets.has(asset)) {
|
|
481
475
|
actions.skipChildren();
|
|
482
476
|
return;
|
|
483
477
|
}
|
|
@@ -486,8 +480,7 @@ export class ScopeHoistingPackager {
|
|
|
486
480
|
!asset.meta.isConstantModule &&
|
|
487
481
|
(assignedAssets.has(asset) || this.isReExported(asset))
|
|
488
482
|
) {
|
|
489
|
-
|
|
490
|
-
this.wrappedAssets.add(asset.id);
|
|
483
|
+
this.wrappedAssets.add(asset);
|
|
491
484
|
|
|
492
485
|
// This also needs to be added to the traversal so that we iterate
|
|
493
486
|
// it during this check.
|
|
@@ -501,28 +494,25 @@ export class ScopeHoistingPackager {
|
|
|
501
494
|
}, moduleGroupParentAsset);
|
|
502
495
|
}
|
|
503
496
|
} else {
|
|
504
|
-
for (let wrappedAssetRoot of
|
|
497
|
+
for (let wrappedAssetRoot of this.wrappedAssets) {
|
|
505
498
|
this.bundle.traverseAssets((asset, _, actions) => {
|
|
506
499
|
if (asset === wrappedAssetRoot) {
|
|
507
500
|
return;
|
|
508
501
|
}
|
|
509
502
|
|
|
510
|
-
if (this.wrappedAssets.has(asset
|
|
503
|
+
if (this.wrappedAssets.has(asset)) {
|
|
511
504
|
actions.skipChildren();
|
|
512
505
|
return;
|
|
513
506
|
}
|
|
514
507
|
|
|
515
508
|
if (!asset.meta.isConstantModule) {
|
|
516
|
-
this.wrappedAssets.add(asset
|
|
517
|
-
wrapped.push(asset);
|
|
509
|
+
this.wrappedAssets.add(asset);
|
|
518
510
|
}
|
|
519
511
|
}, wrappedAssetRoot);
|
|
520
512
|
}
|
|
521
513
|
}
|
|
522
514
|
|
|
523
|
-
// @ts-expect-error TS2769
|
|
524
515
|
this.assetOutputs = new Map(await queue.run());
|
|
525
|
-
return {wrapped, constant};
|
|
526
516
|
}
|
|
527
517
|
|
|
528
518
|
isReExported(asset: Asset): boolean {
|
|
@@ -555,7 +545,7 @@ export class ScopeHoistingPackager {
|
|
|
555
545
|
|
|
556
546
|
// TODO: handle ESM exports of wrapped entry assets...
|
|
557
547
|
let entry = this.bundle.getMainEntry();
|
|
558
|
-
if (entry && !this.wrappedAssets.has(entry
|
|
548
|
+
if (entry && !this.wrappedAssets.has(entry)) {
|
|
559
549
|
let hasNamespace = entry.symbols.hasExportSymbol('*');
|
|
560
550
|
|
|
561
551
|
for (let {
|
|
@@ -637,10 +627,10 @@ export class ScopeHoistingPackager {
|
|
|
637
627
|
}
|
|
638
628
|
|
|
639
629
|
visitAsset(asset: Asset): [string, SourceMap | null | undefined, number] {
|
|
640
|
-
invariant(!this.seenAssets.has(asset
|
|
641
|
-
this.seenAssets.add(asset
|
|
630
|
+
invariant(!this.seenAssets.has(asset), 'Already visited asset');
|
|
631
|
+
this.seenAssets.add(asset);
|
|
642
632
|
|
|
643
|
-
let {code, map} = nullthrows(this.assetOutputs.get(asset
|
|
633
|
+
let {code, map} = nullthrows(this.assetOutputs.get(asset));
|
|
644
634
|
return this.buildAsset(asset, code, map);
|
|
645
635
|
}
|
|
646
636
|
|
|
@@ -653,7 +643,7 @@ export class ScopeHoistingPackager {
|
|
|
653
643
|
code: string,
|
|
654
644
|
map?: Buffer | null,
|
|
655
645
|
): [string, SourceMap | null | undefined, number] {
|
|
656
|
-
let shouldWrap = this.wrappedAssets.has(asset
|
|
646
|
+
let shouldWrap = this.wrappedAssets.has(asset);
|
|
657
647
|
let deps = this.bundleGraph.getDependencies(asset);
|
|
658
648
|
|
|
659
649
|
let sourceMap =
|
|
@@ -680,17 +670,24 @@ export class ScopeHoistingPackager {
|
|
|
680
670
|
continue;
|
|
681
671
|
}
|
|
682
672
|
|
|
683
|
-
if (
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
673
|
+
if (this.bundle.hasAsset(resolved) && !this.seenAssets.has(resolved)) {
|
|
674
|
+
if (
|
|
675
|
+
this.useBothScopeHoistingImprovements &&
|
|
676
|
+
this.wrappedAssets.has(resolved)
|
|
677
|
+
) {
|
|
678
|
+
// When the dep is wrapped then we just need to drop a side effect
|
|
679
|
+
// require instead of inlining
|
|
680
|
+
depCode += `parcelRequire("${this.bundleGraph.getAssetPublicId(resolved)}");\n`;
|
|
681
|
+
lineCount += 1;
|
|
682
|
+
} else {
|
|
683
|
+
let [code, map, lines] = this.visitAsset(resolved);
|
|
684
|
+
depCode += code + '\n';
|
|
685
|
+
if (sourceMap && map) {
|
|
686
|
+
// @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
|
|
687
|
+
sourceMap.addSourceMap(map, lineCount);
|
|
688
|
+
}
|
|
689
|
+
lineCount += lines + 1;
|
|
692
690
|
}
|
|
693
|
-
lineCount += lines + 1;
|
|
694
691
|
}
|
|
695
692
|
}
|
|
696
693
|
|
|
@@ -724,9 +721,7 @@ export class ScopeHoistingPackager {
|
|
|
724
721
|
code += append;
|
|
725
722
|
|
|
726
723
|
let lineCount = 0;
|
|
727
|
-
|
|
728
|
-
let depContent: Array<[string, NodeSourceMap | null | undefined, number]> =
|
|
729
|
-
[];
|
|
724
|
+
let depContent: Array<[string, SourceMap | null | undefined, number]> = [];
|
|
730
725
|
if (depMap.size === 0 && replacements.size === 0) {
|
|
731
726
|
// If there are no dependencies or replacements, use a simple function to count the number of lines.
|
|
732
727
|
lineCount = countLines(code) - 1;
|
|
@@ -785,7 +780,7 @@ export class ScopeHoistingPackager {
|
|
|
785
780
|
|
|
786
781
|
if (
|
|
787
782
|
this.bundle.hasAsset(resolved) &&
|
|
788
|
-
!this.seenAssets.has(resolved
|
|
783
|
+
!this.seenAssets.has(resolved)
|
|
789
784
|
) {
|
|
790
785
|
// If this asset is wrapped, we need to hoist the code for the dependency
|
|
791
786
|
// outside our parcelRequire.register wrapper. This is safe because all
|
|
@@ -794,7 +789,7 @@ export class ScopeHoistingPackager {
|
|
|
794
789
|
if (this.useBothScopeHoistingImprovements) {
|
|
795
790
|
if (
|
|
796
791
|
!resolved.meta.isConstantModule &&
|
|
797
|
-
!this.wrappedAssets.has(resolved
|
|
792
|
+
!this.wrappedAssets.has(resolved)
|
|
798
793
|
) {
|
|
799
794
|
let [depCode, depMap, depLines] =
|
|
800
795
|
this.visitAsset(resolved);
|
|
@@ -844,7 +839,7 @@ export class ScopeHoistingPackager {
|
|
|
844
839
|
}
|
|
845
840
|
|
|
846
841
|
if (map) {
|
|
847
|
-
// @ts-expect-error TS2551
|
|
842
|
+
// @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
|
|
848
843
|
sourceMap.addSourceMap(map, lineCount);
|
|
849
844
|
}
|
|
850
845
|
}
|
|
@@ -901,7 +896,7 @@ ${code}
|
|
|
901
896
|
if (!depCode) continue;
|
|
902
897
|
code += depCode + '\n';
|
|
903
898
|
if (sourceMap && map) {
|
|
904
|
-
// @ts-expect-error TS2551
|
|
899
|
+
// @ts-expect-error TS2551 - addSourceMap method exists but missing from @parcel/source-map type definitions
|
|
905
900
|
sourceMap.addSourceMap(map, lineCount);
|
|
906
901
|
}
|
|
907
902
|
lineCount += lines + 1;
|
|
@@ -1020,7 +1015,7 @@ ${code}
|
|
|
1020
1015
|
// If this asset is wrapped, we need to replace the exports namespace with `module.exports`,
|
|
1021
1016
|
// which will be provided to us by the wrapper.
|
|
1022
1017
|
if (
|
|
1023
|
-
this.wrappedAssets.has(asset
|
|
1018
|
+
this.wrappedAssets.has(asset) ||
|
|
1024
1019
|
(this.bundle.env.outputFormat === 'commonjs' &&
|
|
1025
1020
|
asset === this.bundle.getMainEntry())
|
|
1026
1021
|
) {
|
|
@@ -1147,12 +1142,9 @@ ${code}
|
|
|
1147
1142
|
}
|
|
1148
1143
|
}
|
|
1149
1144
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
imported,
|
|
1154
|
-
this.bundle,
|
|
1155
|
-
).symbol;
|
|
1145
|
+
renamed =
|
|
1146
|
+
this.bundleGraph.getSymbolResolution(entry, imported, this.bundle)
|
|
1147
|
+
.symbol || undefined;
|
|
1156
1148
|
}
|
|
1157
1149
|
}
|
|
1158
1150
|
|
|
@@ -1210,7 +1202,7 @@ ${code}
|
|
|
1210
1202
|
}
|
|
1211
1203
|
return (
|
|
1212
1204
|
(!this.bundle.hasAsset(resolved) && !this.externalAssets.has(resolved)) ||
|
|
1213
|
-
(this.wrappedAssets.has(resolved
|
|
1205
|
+
(this.wrappedAssets.has(resolved) && resolved !== parentAsset)
|
|
1214
1206
|
);
|
|
1215
1207
|
}
|
|
1216
1208
|
|
|
@@ -1260,14 +1252,14 @@ ${code}
|
|
|
1260
1252
|
(!this.bundle.hasAsset(resolvedAsset) ||
|
|
1261
1253
|
!this.shouldSkipAsset(resolvedAsset))
|
|
1262
1254
|
) {
|
|
1263
|
-
let hoisted = this.hoistedRequires.get(dep
|
|
1255
|
+
let hoisted = this.hoistedRequires.get(dep);
|
|
1264
1256
|
if (!hoisted) {
|
|
1265
1257
|
hoisted = new Map();
|
|
1266
|
-
this.hoistedRequires.set(dep
|
|
1258
|
+
this.hoistedRequires.set(dep, hoisted);
|
|
1267
1259
|
}
|
|
1268
1260
|
|
|
1269
1261
|
hoisted.set(
|
|
1270
|
-
resolvedAsset
|
|
1262
|
+
resolvedAsset,
|
|
1271
1263
|
`var $${publicId} = parcelRequire(${JSON.stringify(publicId)});`,
|
|
1272
1264
|
);
|
|
1273
1265
|
}
|
|
@@ -1309,7 +1301,7 @@ ${code}
|
|
|
1309
1301
|
// Resolve to the namespace object if requested or this is a CJS default interop reqiure.
|
|
1310
1302
|
if (
|
|
1311
1303
|
parentAsset === resolvedAsset &&
|
|
1312
|
-
this.wrappedAssets.has(resolvedAsset
|
|
1304
|
+
this.wrappedAssets.has(resolvedAsset)
|
|
1313
1305
|
) {
|
|
1314
1306
|
// Directly use module.exports for wrapped assets importing themselves.
|
|
1315
1307
|
return 'module.exports';
|
|
@@ -1352,7 +1344,7 @@ ${code}
|
|
|
1352
1344
|
return ['', 0];
|
|
1353
1345
|
}
|
|
1354
1346
|
|
|
1355
|
-
let hoisted = this.hoistedRequires.get(dep
|
|
1347
|
+
let hoisted = this.hoistedRequires.get(dep);
|
|
1356
1348
|
let res = '';
|
|
1357
1349
|
let lineCount = 0;
|
|
1358
1350
|
let isWrapped = this.isWrapped(resolved, parentAsset);
|
|
@@ -1364,7 +1356,7 @@ ${code}
|
|
|
1364
1356
|
if (
|
|
1365
1357
|
isWrapped &&
|
|
1366
1358
|
!dep.meta.shouldWrap &&
|
|
1367
|
-
(!hoisted || hoisted.keys().next().value !== resolved
|
|
1359
|
+
(!hoisted || hoisted.keys().next().value !== resolved) &&
|
|
1368
1360
|
!this.bundleGraph.isDependencySkipped(dep) &&
|
|
1369
1361
|
!this.shouldSkipAsset(resolved)
|
|
1370
1362
|
) {
|
|
@@ -1406,7 +1398,7 @@ ${code}
|
|
|
1406
1398
|
let prependLineCount = 0;
|
|
1407
1399
|
let append = '';
|
|
1408
1400
|
|
|
1409
|
-
let shouldWrap = this.wrappedAssets.has(asset
|
|
1401
|
+
let shouldWrap = this.wrappedAssets.has(asset);
|
|
1410
1402
|
let usedSymbols = nullthrows(this.bundleGraph.getUsedSymbols(asset));
|
|
1411
1403
|
let assetId = asset.meta.id;
|
|
1412
1404
|
invariant(typeof assetId === 'string');
|
|
@@ -1674,11 +1666,11 @@ ${code}
|
|
|
1674
1666
|
}
|
|
1675
1667
|
|
|
1676
1668
|
for (let helper of this.usedHelpers) {
|
|
1677
|
-
|
|
1678
|
-
let currentHelper = helpers[helper];
|
|
1669
|
+
let currentHelper = (helpers as Record<string, any>)[helper];
|
|
1679
1670
|
if (typeof currentHelper === 'function') {
|
|
1680
|
-
|
|
1681
|
-
|
|
1671
|
+
currentHelper = (helpers as Record<string, any>)[helper](
|
|
1672
|
+
this.bundle.env,
|
|
1673
|
+
);
|
|
1682
1674
|
}
|
|
1683
1675
|
res += currentHelper;
|
|
1684
1676
|
if (enableSourceMaps) {
|