webpack 5.90.3 → 5.91.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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/README.md +5 -5
- package/bin/webpack.js +5 -1
- package/lib/APIPlugin.js +8 -4
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +3 -1
- package/lib/Cache.js +7 -1
- package/lib/CacheFacade.js +3 -3
- package/lib/ChunkGraph.js +32 -18
- package/lib/ChunkGroup.js +14 -14
- package/lib/CleanPlugin.js +7 -5
- package/lib/Compilation.js +262 -93
- package/lib/Compiler.js +199 -83
- package/lib/ConditionalInitFragment.js +4 -5
- package/lib/ContextModule.js +2 -0
- package/lib/ContextModuleFactory.js +4 -2
- package/lib/ContextReplacementPlugin.js +3 -2
- package/lib/DefinePlugin.js +4 -2
- package/lib/Dependency.js +4 -2
- package/lib/DependencyTemplate.js +7 -2
- package/lib/DllModule.js +1 -0
- package/lib/DllReferencePlugin.js +6 -2
- package/lib/EntryOptionPlugin.js +4 -1
- package/lib/EntryPlugin.js +6 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/ExportsInfo.js +1 -4
- package/lib/ExternalModule.js +118 -24
- package/lib/ExternalModuleFactoryPlugin.js +37 -2
- package/lib/FileSystemInfo.js +1 -1
- package/lib/Generator.js +2 -1
- package/lib/HookWebpackError.js +2 -2
- package/lib/InitFragment.js +5 -3
- package/lib/LibManifestPlugin.js +15 -7
- package/lib/Module.js +30 -2
- package/lib/ModuleFilenameHelpers.js +1 -1
- package/lib/ModuleGraph.js +56 -27
- package/lib/ModuleGraphConnection.js +2 -1
- package/lib/MultiCompiler.js +26 -8
- package/lib/NodeStuffPlugin.js +14 -3
- package/lib/NormalModule.js +3 -1
- package/lib/NormalModuleFactory.js +1 -1
- package/lib/NormalModuleReplacementPlugin.js +5 -1
- package/lib/ProvidePlugin.js +3 -1
- package/lib/RawModule.js +2 -1
- package/lib/ResolverFactory.js +3 -1
- package/lib/RuntimeModule.js +4 -4
- package/lib/RuntimePlugin.js +1 -0
- package/lib/RuntimeTemplate.js +102 -34
- package/lib/SourceMapDevToolPlugin.js +4 -1
- package/lib/Stats.js +10 -3
- package/lib/TemplatedPathPlugin.js +32 -6
- package/lib/Watching.js +67 -60
- package/lib/WebpackError.js +6 -6
- package/lib/WebpackOptionsApply.js +18 -5
- package/lib/asset/RawDataUrlModule.js +3 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +117 -64
- package/lib/cache/IdleFileCachePlugin.js +8 -3
- package/lib/cache/MemoryCachePlugin.js +1 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
- package/lib/cache/PackFileCacheStrategy.js +49 -16
- package/lib/cache/ResolverCachePlugin.js +14 -6
- package/lib/cache/getLazyHashedEtag.js +1 -1
- package/lib/config/defaults.js +24 -1
- package/lib/config/normalization.js +3 -1
- package/lib/container/ContainerEntryDependency.js +2 -1
- package/lib/container/ContainerEntryModule.js +3 -1
- package/lib/container/ContainerPlugin.js +14 -10
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/RemoteRuntimeModule.js +12 -3
- package/lib/css/CssExportsGenerator.js +34 -17
- package/lib/css/CssGenerator.js +20 -2
- package/lib/css/CssLoadingRuntimeModule.js +212 -96
- package/lib/css/CssModulesPlugin.js +47 -13
- package/lib/debug/ProfilingPlugin.js +27 -2
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +9 -5
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +4 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +2 -1
- package/lib/dependencies/CommonJsExportRequireDependency.js +33 -18
- package/lib/dependencies/CommonJsExportsDependency.js +13 -5
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -15
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -2
- package/lib/dependencies/ContextDependencyHelpers.js +49 -29
- package/lib/dependencies/ContextElementDependency.js +8 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +63 -8
- package/lib/dependencies/CssUrlDependency.js +5 -3
- package/lib/dependencies/ExportsInfoDependency.js +4 -3
- package/lib/dependencies/ExternalModuleInitFragment.js +5 -3
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -4
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +43 -23
- package/lib/dependencies/HarmonyExportHeaderDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +73 -32
- package/lib/dependencies/HarmonyExportInitFragment.js +10 -2
- package/lib/dependencies/HarmonyImportDependency.js +28 -12
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +44 -16
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -6
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +6 -5
- package/lib/dependencies/ImportDependency.js +9 -2
- package/lib/dependencies/ImportEagerDependency.js +4 -2
- package/lib/dependencies/ImportMetaContextDependency.js +7 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +25 -14
- package/lib/dependencies/ImportParserPlugin.js +12 -4
- package/lib/dependencies/ImportWeakDependency.js +4 -2
- package/lib/dependencies/LoaderDependency.js +2 -1
- package/lib/dependencies/LoaderImportDependency.js +2 -1
- package/lib/dependencies/ModuleDependency.js +4 -5
- package/lib/dependencies/PureExpressionDependency.js +4 -1
- package/lib/dependencies/RequireContextPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +26 -14
- package/lib/dependencies/RequireEnsureDependency.js +1 -1
- package/lib/dependencies/URLDependency.js +7 -4
- package/lib/dependencies/WorkerPlugin.js +2 -1
- package/lib/dependencies/getFunctionExpression.js +3 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +2 -1
- package/lib/javascript/BasicEvaluatedExpression.js +2 -2
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/JavascriptParser.js +169 -57
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/javascript/StartupHelpers.js +22 -5
- package/lib/logging/Logger.js +27 -2
- package/lib/logging/createConsoleLogger.js +11 -7
- package/lib/node/NodeEnvironmentPlugin.js +13 -7
- package/lib/node/NodeWatchFileSystem.js +37 -26
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/nodeConsole.js +24 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +138 -54
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/InnerGraph.js +7 -2
- package/lib/optimize/InnerGraphPlugin.js +36 -13
- package/lib/optimize/ModuleConcatenationPlugin.js +12 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/RuntimeChunkPlugin.js +6 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +46 -15
- package/lib/optimize/SplitChunksPlugin.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +11 -0
- package/lib/rules/ObjectMatcherRulePlugin.js +4 -0
- package/lib/runtime/EnsureChunkRuntimeModule.js +2 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +2 -1
- package/lib/serialization/FileMiddleware.js +1 -0
- package/lib/serialization/ObjectMiddleware.js +2 -0
- package/lib/serialization/Serializer.js +19 -0
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ConsumeSharedPlugin.js +17 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -2
- package/lib/sharing/ProvideSharedPlugin.js +12 -5
- package/lib/sharing/resolveMatchedConfigs.js +2 -2
- package/lib/sharing/utils.js +13 -6
- package/lib/util/StackedCacheMap.js +26 -0
- package/lib/util/WeakTupleMap.js +57 -13
- package/lib/util/cleverMerge.js +24 -11
- package/lib/util/comparators.js +34 -14
- package/lib/util/conventions.js +129 -0
- package/lib/util/fs.js +379 -65
- package/lib/util/hash/BatchedHash.js +3 -0
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/runtime.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -2
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +15 -6
- package/lib/wasm-sync/WebAssemblyGenerator.js +27 -6
- package/lib/wasm-sync/WebAssemblyParser.js +7 -4
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -1
- package/lib/webpack.js +7 -3
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -1
- package/package.json +25 -26
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +69 -8
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +5 -1
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
- package/types.d.ts +1668 -613
@@ -37,7 +37,9 @@ const {
|
|
37
37
|
subtractRuntimeCondition
|
38
38
|
} = require("../util/runtime");
|
39
39
|
|
40
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
40
41
|
/** @typedef {import("eslint-scope").Scope} Scope */
|
42
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
41
43
|
/** @typedef {import("webpack-sources").Source} Source */
|
42
44
|
/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
43
45
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
@@ -48,10 +50,12 @@ const {
|
|
48
50
|
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
49
51
|
/** @typedef {import("../DependencyTemplates")} DependencyTemplates */
|
50
52
|
/** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */
|
51
|
-
/** @
|
53
|
+
/** @typedef {import("../Module").BuildInfo} BuildInfo */
|
54
|
+
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
52
55
|
/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */
|
53
56
|
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
54
57
|
/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */
|
58
|
+
/** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
55
59
|
/** @typedef {import("../Module").SourceTypes} SourceTypes */
|
56
60
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
57
61
|
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
@@ -61,14 +65,27 @@ const {
|
|
61
65
|
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
62
66
|
/** @typedef {import("../WebpackError")} WebpackError */
|
63
67
|
/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
|
68
|
+
/** @typedef {import("../javascript/JavascriptParser").Program} Program */
|
69
|
+
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
70
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
64
71
|
/** @typedef {import("../util/Hash")} Hash */
|
65
72
|
/** @typedef {typeof import("../util/Hash")} HashConstructor */
|
66
73
|
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
67
74
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
68
75
|
|
76
|
+
/**
|
77
|
+
* @template T
|
78
|
+
* @typedef {import("../InitFragment")<T>} InitFragment
|
79
|
+
*/
|
80
|
+
|
81
|
+
/**
|
82
|
+
* @template T
|
83
|
+
* @typedef {import("../util/comparators").Comparator<T>} Comparator
|
84
|
+
*/
|
85
|
+
|
69
86
|
// fix eslint-scope to support class properties correctly
|
70
87
|
// cspell:word Referencer
|
71
|
-
const ReferencerClass = Referencer;
|
88
|
+
const ReferencerClass = /** @type {any} */ (Referencer);
|
72
89
|
if (!ReferencerClass.prototype.PropertyDefinition) {
|
73
90
|
ReferencerClass.prototype.PropertyDefinition =
|
74
91
|
ReferencerClass.prototype.Property;
|
@@ -108,24 +125,24 @@ if (!ReferencerClass.prototype.PropertyDefinition) {
|
|
108
125
|
* @property {"concatenated"} type
|
109
126
|
* @property {Module} module
|
110
127
|
* @property {number} index
|
111
|
-
* @property {
|
128
|
+
* @property {Program | undefined} ast
|
112
129
|
* @property {Source} internalSource
|
113
130
|
* @property {ReplaceSource} source
|
114
131
|
* @property {InitFragment<ChunkRenderContext>[]=} chunkInitFragments
|
115
|
-
* @property {
|
132
|
+
* @property {ReadOnlyRuntimeRequirements} runtimeRequirements
|
116
133
|
* @property {Scope} globalScope
|
117
134
|
* @property {Scope} moduleScope
|
118
135
|
* @property {Map<string, string>} internalNames
|
119
|
-
* @property {Map<string, string>} exportMap
|
120
|
-
* @property {Map<string, string>} rawExportMap
|
136
|
+
* @property {Map<string, string> | undefined} exportMap
|
137
|
+
* @property {Map<string, string> | undefined} rawExportMap
|
121
138
|
* @property {string=} namespaceExportSymbol
|
122
|
-
* @property {string} namespaceObjectName
|
139
|
+
* @property {string | undefined} namespaceObjectName
|
123
140
|
* @property {boolean} interopNamespaceObjectUsed
|
124
|
-
* @property {string} interopNamespaceObjectName
|
141
|
+
* @property {string | undefined} interopNamespaceObjectName
|
125
142
|
* @property {boolean} interopNamespaceObject2Used
|
126
|
-
* @property {string} interopNamespaceObject2Name
|
143
|
+
* @property {string | undefined} interopNamespaceObject2Name
|
127
144
|
* @property {boolean} interopDefaultAccessUsed
|
128
|
-
* @property {string} interopDefaultAccessName
|
145
|
+
* @property {string | undefined} interopDefaultAccessName
|
129
146
|
*/
|
130
147
|
|
131
148
|
/**
|
@@ -150,6 +167,8 @@ if (!ReferencerClass.prototype.PropertyDefinition) {
|
|
150
167
|
* @property {ConcatenatedModuleInfo | ExternalModuleInfo} target
|
151
168
|
*/
|
152
169
|
|
170
|
+
/** @typedef {Set<string>} UsedNames */
|
171
|
+
|
153
172
|
const RESERVED_NAMES = new Set(
|
154
173
|
[
|
155
174
|
// internal names (should always be renamed)
|
@@ -190,6 +209,12 @@ const RESERVED_NAMES = new Set(
|
|
190
209
|
|
191
210
|
const createComparator = (property, comparator) => (a, b) =>
|
192
211
|
comparator(a[property], b[property]);
|
212
|
+
|
213
|
+
/**
|
214
|
+
* @param {number} a a
|
215
|
+
* @param {number} b b
|
216
|
+
* @returns {0 | 1 | -1} result
|
217
|
+
*/
|
193
218
|
const compareNumbers = (a, b) => {
|
194
219
|
if (isNaN(a)) {
|
195
220
|
if (!isNaN(b)) {
|
@@ -208,6 +233,10 @@ const compareNumbers = (a, b) => {
|
|
208
233
|
const bySourceOrder = createComparator("sourceOrder", compareNumbers);
|
209
234
|
const byRangeStart = createComparator("rangeStart", compareNumbers);
|
210
235
|
|
236
|
+
/**
|
237
|
+
* @param {Iterable<string>} iterable iterable object
|
238
|
+
* @returns {string} joined iterable object
|
239
|
+
*/
|
211
240
|
const joinIterableWithComma = iterable => {
|
212
241
|
// This is more performant than Array.from().join(", ")
|
213
242
|
// as it doesn't create an array
|
@@ -241,7 +270,7 @@ const joinIterableWithComma = iterable => {
|
|
241
270
|
* @param {RuntimeTemplate} runtimeTemplate the runtime template
|
242
271
|
* @param {Set<ConcatenatedModuleInfo>} neededNamespaceObjects modules for which a namespace object should be generated
|
243
272
|
* @param {boolean} asCall asCall
|
244
|
-
* @param {boolean} strictHarmonyModule strictHarmonyModule
|
273
|
+
* @param {boolean | undefined} strictHarmonyModule strictHarmonyModule
|
245
274
|
* @param {boolean | undefined} asiSafe asiSafe
|
246
275
|
* @param {Set<ExportInfo>} alreadyVisited alreadyVisited
|
247
276
|
* @returns {Binding} the final variable
|
@@ -270,7 +299,7 @@ const getFinalBinding = (
|
|
270
299
|
info.interopNamespaceObject2Used = true;
|
271
300
|
return {
|
272
301
|
info,
|
273
|
-
rawName: info.interopNamespaceObject2Name,
|
302
|
+
rawName: /** @type {string} */ (info.interopNamespaceObject2Name),
|
274
303
|
ids: exportName,
|
275
304
|
exportName
|
276
305
|
};
|
@@ -278,7 +307,7 @@ const getFinalBinding = (
|
|
278
307
|
info.interopNamespaceObjectUsed = true;
|
279
308
|
return {
|
280
309
|
info,
|
281
|
-
rawName: info.interopNamespaceObjectName,
|
310
|
+
rawName: /** @type {string} */ (info.interopNamespaceObjectName),
|
282
311
|
ids: exportName,
|
283
312
|
exportName
|
284
313
|
};
|
@@ -366,7 +395,7 @@ const getFinalBinding = (
|
|
366
395
|
neededNamespaceObjects.add(info);
|
367
396
|
return {
|
368
397
|
info,
|
369
|
-
rawName: info.namespaceObjectName,
|
398
|
+
rawName: /** @type {string} */ (info.namespaceObjectName),
|
370
399
|
ids: exportName,
|
371
400
|
exportName
|
372
401
|
};
|
@@ -393,7 +422,7 @@ const getFinalBinding = (
|
|
393
422
|
neededNamespaceObjects.add(info);
|
394
423
|
return {
|
395
424
|
info,
|
396
|
-
rawName: info.namespaceObjectName,
|
425
|
+
rawName: /** @type {string} */ (info.namespaceObjectName),
|
397
426
|
ids: exportName,
|
398
427
|
exportName
|
399
428
|
};
|
@@ -445,7 +474,7 @@ const getFinalBinding = (
|
|
445
474
|
const refInfo = moduleToInfoMap.get(reexport.module);
|
446
475
|
return getFinalBinding(
|
447
476
|
moduleGraph,
|
448
|
-
refInfo,
|
477
|
+
/** @type {ModuleInfo} */ (refInfo),
|
449
478
|
reexport.export
|
450
479
|
? [...reexport.export, ...exportName.slice(1)]
|
451
480
|
: exportName.slice(1),
|
@@ -455,7 +484,8 @@ const getFinalBinding = (
|
|
455
484
|
runtimeTemplate,
|
456
485
|
neededNamespaceObjects,
|
457
486
|
asCall,
|
458
|
-
|
487
|
+
/** @type {BuildMeta} */
|
488
|
+
(info.module.buildMeta).strictHarmonyModule,
|
459
489
|
asiSafe,
|
460
490
|
alreadyVisited
|
461
491
|
);
|
@@ -466,7 +496,7 @@ const getFinalBinding = (
|
|
466
496
|
);
|
467
497
|
return {
|
468
498
|
info,
|
469
|
-
rawName: info.namespaceObjectName,
|
499
|
+
rawName: /** @type {string} */ (info.namespaceObjectName),
|
470
500
|
ids: usedName,
|
471
501
|
exportName
|
472
502
|
};
|
@@ -508,8 +538,8 @@ const getFinalBinding = (
|
|
508
538
|
* @param {RuntimeTemplate} runtimeTemplate the runtime template
|
509
539
|
* @param {Set<ConcatenatedModuleInfo>} neededNamespaceObjects modules for which a namespace object should be generated
|
510
540
|
* @param {boolean} asCall asCall
|
511
|
-
* @param {boolean} callContext callContext
|
512
|
-
* @param {boolean} strictHarmonyModule strictHarmonyModule
|
541
|
+
* @param {boolean | undefined} callContext callContext
|
542
|
+
* @param {boolean | undefined} strictHarmonyModule strictHarmonyModule
|
513
543
|
* @param {boolean | undefined} asiSafe asiSafe
|
514
544
|
* @returns {string} the final name
|
515
545
|
*/
|
@@ -576,6 +606,12 @@ const getFinalName = (
|
|
576
606
|
}
|
577
607
|
};
|
578
608
|
|
609
|
+
/**
|
610
|
+
* @param {Scope | null} s scope
|
611
|
+
* @param {UsedNames} nameSet name set
|
612
|
+
* @param {TODO} scopeSet1 scope set 1
|
613
|
+
* @param {TODO} scopeSet2 scope set 2
|
614
|
+
*/
|
579
615
|
const addScopeSymbols = (s, nameSet, scopeSet1, scopeSet2) => {
|
580
616
|
let scope = s;
|
581
617
|
while (scope) {
|
@@ -589,6 +625,10 @@ const addScopeSymbols = (s, nameSet, scopeSet1, scopeSet2) => {
|
|
589
625
|
}
|
590
626
|
};
|
591
627
|
|
628
|
+
/**
|
629
|
+
* @param {Variable} variable variable
|
630
|
+
* @returns {Reference[]} references
|
631
|
+
*/
|
592
632
|
const getAllReferences = variable => {
|
593
633
|
let set = variable.references;
|
594
634
|
// Look for inner scope variables too (like in class Foo { t() { Foo } })
|
@@ -604,6 +644,11 @@ const getAllReferences = variable => {
|
|
604
644
|
return set;
|
605
645
|
};
|
606
646
|
|
647
|
+
/**
|
648
|
+
* @param {TODO} ast ast
|
649
|
+
* @param {TODO} node node
|
650
|
+
* @returns {TODO} result
|
651
|
+
*/
|
607
652
|
const getPathInAst = (ast, node) => {
|
608
653
|
if (ast === node) {
|
609
654
|
return [];
|
@@ -772,11 +817,14 @@ class ConcatenatedModule extends Module {
|
|
772
817
|
*/
|
773
818
|
build(options, compilation, resolver, fs, callback) {
|
774
819
|
const { rootModule } = this;
|
820
|
+
const { moduleArgument, exportsArgument } =
|
821
|
+
/** @type {BuildInfo} */
|
822
|
+
(rootModule.buildInfo);
|
775
823
|
this.buildInfo = {
|
776
824
|
strict: true,
|
777
825
|
cacheable: true,
|
778
|
-
moduleArgument
|
779
|
-
exportsArgument
|
826
|
+
moduleArgument,
|
827
|
+
exportsArgument,
|
780
828
|
fileDependencies: new LazySet(),
|
781
829
|
contextDependencies: new LazySet(),
|
782
830
|
missingDependencies: new LazySet(),
|
@@ -789,7 +837,7 @@ class ConcatenatedModule extends Module {
|
|
789
837
|
|
790
838
|
for (const m of this._modules) {
|
791
839
|
// populate cacheable
|
792
|
-
if (!m.buildInfo.cacheable) {
|
840
|
+
if (!(/** @type {BuildInfo} */ (m.buildInfo).cacheable)) {
|
793
841
|
this.buildInfo.cacheable = false;
|
794
842
|
}
|
795
843
|
|
@@ -797,7 +845,9 @@ class ConcatenatedModule extends Module {
|
|
797
845
|
for (const d of m.dependencies.filter(
|
798
846
|
dep =>
|
799
847
|
!(dep instanceof HarmonyImportDependency) ||
|
800
|
-
!this._modules.has(
|
848
|
+
!this._modules.has(
|
849
|
+
/** @type {Module} */ (compilation.moduleGraph.getModule(dep))
|
850
|
+
)
|
801
851
|
)) {
|
802
852
|
this.dependencies.push(d);
|
803
853
|
}
|
@@ -822,11 +872,14 @@ class ConcatenatedModule extends Module {
|
|
822
872
|
}
|
823
873
|
}
|
824
874
|
|
875
|
+
const { assets, assetsInfo, topLevelDeclarations } =
|
876
|
+
/** @type {BuildInfo} */ (m.buildInfo);
|
877
|
+
|
825
878
|
// populate topLevelDeclarations
|
826
|
-
if (
|
879
|
+
if (topLevelDeclarations) {
|
827
880
|
const topLevelDeclarations = this.buildInfo.topLevelDeclarations;
|
828
881
|
if (topLevelDeclarations !== undefined) {
|
829
|
-
for (const decl of
|
882
|
+
for (const decl of topLevelDeclarations) {
|
830
883
|
topLevelDeclarations.add(decl);
|
831
884
|
}
|
832
885
|
}
|
@@ -835,17 +888,17 @@ class ConcatenatedModule extends Module {
|
|
835
888
|
}
|
836
889
|
|
837
890
|
// populate assets
|
838
|
-
if (
|
891
|
+
if (assets) {
|
839
892
|
if (this.buildInfo.assets === undefined) {
|
840
893
|
this.buildInfo.assets = Object.create(null);
|
841
894
|
}
|
842
|
-
Object.assign(this.buildInfo.assets,
|
895
|
+
Object.assign(/** @type {BuildInfo} */ (this.buildInfo).assets, assets);
|
843
896
|
}
|
844
|
-
if (
|
897
|
+
if (assetsInfo) {
|
845
898
|
if (this.buildInfo.assetsInfo === undefined) {
|
846
899
|
this.buildInfo.assetsInfo = new Map();
|
847
900
|
}
|
848
|
-
for (const [key, value] of
|
901
|
+
for (const [key, value] of assetsInfo) {
|
849
902
|
this.buildInfo.assetsInfo.set(key, value);
|
850
903
|
}
|
851
904
|
}
|
@@ -1056,7 +1109,7 @@ class ConcatenatedModule extends Module {
|
|
1056
1109
|
hashFunction = "md4"
|
1057
1110
|
) {
|
1058
1111
|
const cachedMakePathsRelative = makePathsRelative.bindContextCache(
|
1059
|
-
rootModule.context,
|
1112
|
+
/** @type {string} */ (rootModule.context),
|
1060
1113
|
associatedObjectForCache
|
1061
1114
|
);
|
1062
1115
|
let identifiers = [];
|
@@ -1139,12 +1192,12 @@ class ConcatenatedModule extends Module {
|
|
1139
1192
|
const topLevelDeclarations = new Set();
|
1140
1193
|
|
1141
1194
|
// List of additional names in scope for module references
|
1142
|
-
/** @type {Map<string, { usedNames:
|
1195
|
+
/** @type {Map<string, { usedNames: UsedNames, alreadyCheckedScopes: Set<TODO> }>} */
|
1143
1196
|
const usedNamesInScopeInfo = new Map();
|
1144
1197
|
/**
|
1145
1198
|
* @param {string} module module identifier
|
1146
1199
|
* @param {string} id export id
|
1147
|
-
* @returns {{ usedNames:
|
1200
|
+
* @returns {{ usedNames: UsedNames, alreadyCheckedScopes: Set<TODO> }} info
|
1148
1201
|
*/
|
1149
1202
|
const getUsedNamesInScopeInfo = (module, id) => {
|
1150
1203
|
const key = `${module}-${id}`;
|
@@ -1174,6 +1227,10 @@ class ConcatenatedModule extends Module {
|
|
1174
1227
|
// We get ranges of all super class expressions to make
|
1175
1228
|
// renaming to work correctly
|
1176
1229
|
const superClassCache = new WeakMap();
|
1230
|
+
/**
|
1231
|
+
* @param {Scope} scope scope
|
1232
|
+
* @returns {TODO} result
|
1233
|
+
*/
|
1177
1234
|
const getSuperClassExpressions = scope => {
|
1178
1235
|
const cacheEntry = superClassCache.get(scope);
|
1179
1236
|
if (cacheEntry !== undefined) return cacheEntry;
|
@@ -1216,7 +1273,8 @@ class ConcatenatedModule extends Module {
|
|
1216
1273
|
runtimeTemplate,
|
1217
1274
|
neededNamespaceObjects,
|
1218
1275
|
false,
|
1219
|
-
|
1276
|
+
/** @type {BuildMeta} */
|
1277
|
+
(info.module.buildMeta).strictHarmonyModule,
|
1220
1278
|
true
|
1221
1279
|
);
|
1222
1280
|
if (!binding.ids) continue;
|
@@ -1227,8 +1285,10 @@ class ConcatenatedModule extends Module {
|
|
1227
1285
|
);
|
1228
1286
|
for (const expr of getSuperClassExpressions(reference.from)) {
|
1229
1287
|
if (
|
1230
|
-
expr.range[0] <=
|
1231
|
-
|
1288
|
+
expr.range[0] <=
|
1289
|
+
/** @type {Range} */ (reference.identifier.range)[0] &&
|
1290
|
+
expr.range[1] >=
|
1291
|
+
/** @type {Range} */ (reference.identifier.range)[1]
|
1232
1292
|
) {
|
1233
1293
|
for (const variable of expr.variables) {
|
1234
1294
|
usedNames.add(variable.name);
|
@@ -1287,7 +1347,7 @@ class ConcatenatedModule extends Module {
|
|
1287
1347
|
references.map(r => r.identifier).concat(variable.identifiers)
|
1288
1348
|
);
|
1289
1349
|
for (const identifier of allIdentifiers) {
|
1290
|
-
const r = identifier.range;
|
1350
|
+
const r = /** @type {Range} */ (identifier.range);
|
1291
1351
|
const path = getPathInAst(info.ast, identifier);
|
1292
1352
|
if (path && path.length > 1) {
|
1293
1353
|
const maybeProperty =
|
@@ -1325,7 +1385,9 @@ class ConcatenatedModule extends Module {
|
|
1325
1385
|
);
|
1326
1386
|
allUsedNames.add(namespaceObjectName);
|
1327
1387
|
}
|
1328
|
-
info.namespaceObjectName =
|
1388
|
+
info.namespaceObjectName =
|
1389
|
+
/** @type {string} */
|
1390
|
+
(namespaceObjectName);
|
1329
1391
|
topLevelDeclarations.add(namespaceObjectName);
|
1330
1392
|
break;
|
1331
1393
|
}
|
@@ -1342,7 +1404,8 @@ class ConcatenatedModule extends Module {
|
|
1342
1404
|
break;
|
1343
1405
|
}
|
1344
1406
|
}
|
1345
|
-
|
1407
|
+
const buildMeta = /** @type {BuildMeta} */ (info.module.buildMeta);
|
1408
|
+
if (buildMeta.exportsType !== "namespace") {
|
1346
1409
|
const externalNameInterop = this.findNewName(
|
1347
1410
|
"namespaceObject",
|
1348
1411
|
allUsedNames,
|
@@ -1354,8 +1417,8 @@ class ConcatenatedModule extends Module {
|
|
1354
1417
|
topLevelDeclarations.add(externalNameInterop);
|
1355
1418
|
}
|
1356
1419
|
if (
|
1357
|
-
|
1358
|
-
|
1420
|
+
buildMeta.exportsType === "default" &&
|
1421
|
+
buildMeta.defaultObject !== "redirect"
|
1359
1422
|
) {
|
1360
1423
|
const externalNameInterop = this.findNewName(
|
1361
1424
|
"namespaceObject2",
|
@@ -1367,10 +1430,7 @@ class ConcatenatedModule extends Module {
|
|
1367
1430
|
info.interopNamespaceObject2Name = externalNameInterop;
|
1368
1431
|
topLevelDeclarations.add(externalNameInterop);
|
1369
1432
|
}
|
1370
|
-
if (
|
1371
|
-
info.module.buildMeta.exportsType === "dynamic" ||
|
1372
|
-
!info.module.buildMeta.exportsType
|
1373
|
-
) {
|
1433
|
+
if (buildMeta.exportsType === "dynamic" || !buildMeta.exportsType) {
|
1374
1434
|
const externalNameInterop = this.findNewName(
|
1375
1435
|
"default",
|
1376
1436
|
allUsedNames,
|
@@ -1404,10 +1464,11 @@ class ConcatenatedModule extends Module {
|
|
1404
1464
|
neededNamespaceObjects,
|
1405
1465
|
match.call,
|
1406
1466
|
!match.directImport,
|
1407
|
-
|
1467
|
+
/** @type {BuildMeta} */
|
1468
|
+
(info.module.buildMeta).strictHarmonyModule,
|
1408
1469
|
match.asiSafe
|
1409
1470
|
);
|
1410
|
-
const r = reference.identifier.range;
|
1471
|
+
const r = /** @type {Range} */ (reference.identifier.range);
|
1411
1472
|
const source = info.source;
|
1412
1473
|
// range is extended by 2 chars to cover the appended "._"
|
1413
1474
|
source.replace(r[0], r[1] + 1, finalName);
|
@@ -1427,7 +1488,9 @@ class ConcatenatedModule extends Module {
|
|
1427
1488
|
const rootInfo = /** @type {ConcatenatedModuleInfo} */ (
|
1428
1489
|
moduleToInfoMap.get(this.rootModule)
|
1429
1490
|
);
|
1430
|
-
const strictHarmonyModule =
|
1491
|
+
const strictHarmonyModule =
|
1492
|
+
/** @type {BuildMeta} */
|
1493
|
+
(rootInfo.module.buildMeta).strictHarmonyModule;
|
1431
1494
|
const exportsInfo = moduleGraph.getExportsInfo(rootInfo.module);
|
1432
1495
|
for (const exportInfo of exportsInfo.orderedExports) {
|
1433
1496
|
const name = exportInfo.name;
|
@@ -1457,7 +1520,9 @@ class ConcatenatedModule extends Module {
|
|
1457
1520
|
exportInfo.isReexport() ? "reexport" : "binding"
|
1458
1521
|
} */ ${finalName}`;
|
1459
1522
|
} catch (e) {
|
1460
|
-
|
1523
|
+
/** @type {Error} */
|
1524
|
+
(e).message +=
|
1525
|
+
`\nwhile generating the root export '${name}' (used name: '${used}')`;
|
1461
1526
|
throw e;
|
1462
1527
|
}
|
1463
1528
|
});
|
@@ -1527,7 +1592,8 @@ class ConcatenatedModule extends Module {
|
|
1527
1592
|
neededNamespaceObjects,
|
1528
1593
|
false,
|
1529
1594
|
undefined,
|
1530
|
-
|
1595
|
+
/** @type {BuildMeta} */
|
1596
|
+
(info.module.buildMeta).strictHarmonyModule,
|
1531
1597
|
true
|
1532
1598
|
);
|
1533
1599
|
nsObj.push(
|
@@ -1698,7 +1764,9 @@ ${defineGetters}`
|
|
1698
1764
|
codeGenerationResults,
|
1699
1765
|
sourceTypes: TYPES
|
1700
1766
|
});
|
1701
|
-
const source =
|
1767
|
+
const source = /** @type {Source} */ (
|
1768
|
+
codeGenResult.sources.get("javascript")
|
1769
|
+
);
|
1702
1770
|
const data = codeGenResult.data;
|
1703
1771
|
const chunkInitFragments = data && data.get("chunkInitFragments");
|
1704
1772
|
const code = source.source().toString();
|
@@ -1730,7 +1798,7 @@ ${defineGetters}`
|
|
1730
1798
|
ignoreEval: true,
|
1731
1799
|
impliedStrict: true
|
1732
1800
|
});
|
1733
|
-
const globalScope = scopeManager.acquire(ast);
|
1801
|
+
const globalScope = /** @type {Scope} */ (scopeManager.acquire(ast));
|
1734
1802
|
const moduleScope = globalScope.childScopes[0];
|
1735
1803
|
const resultSource = new ReplaceSource(source);
|
1736
1804
|
info.runtimeRequirements = codeGenResult.runtimeRequirements;
|
@@ -1741,7 +1809,9 @@ ${defineGetters}`
|
|
1741
1809
|
info.globalScope = globalScope;
|
1742
1810
|
info.moduleScope = moduleScope;
|
1743
1811
|
} catch (err) {
|
1744
|
-
|
1812
|
+
/** @type {Error} */
|
1813
|
+
(err).message +=
|
1814
|
+
`\nwhile analyzing module ${m.identifier()} for concatenation`;
|
1745
1815
|
throw err;
|
1746
1816
|
}
|
1747
1817
|
}
|
@@ -1809,7 +1879,10 @@ ${defineGetters}`
|
|
1809
1879
|
`Unsupported concatenation entry type ${info.type}`
|
1810
1880
|
);
|
1811
1881
|
}
|
1812
|
-
map.set(
|
1882
|
+
map.set(
|
1883
|
+
/** @type {ModuleInfo} */ (item).module,
|
1884
|
+
/** @type {ModuleInfo} */ (item)
|
1885
|
+
);
|
1813
1886
|
return item;
|
1814
1887
|
} else {
|
1815
1888
|
/** @type {ReferenceToModuleInfo} */
|
@@ -1824,6 +1897,13 @@ ${defineGetters}`
|
|
1824
1897
|
return [list, map];
|
1825
1898
|
}
|
1826
1899
|
|
1900
|
+
/**
|
1901
|
+
* @param {string} oldName old name
|
1902
|
+
* @param {UsedNames} usedNamed1 used named 1
|
1903
|
+
* @param {UsedNames} usedNamed2 used named 2
|
1904
|
+
* @param {string} extraInfo extra info
|
1905
|
+
* @returns {string} found new name
|
1906
|
+
*/
|
1827
1907
|
findNewName(oldName, usedNamed1, usedNamed2, extraInfo) {
|
1828
1908
|
let name = oldName;
|
1829
1909
|
|
@@ -1889,6 +1969,10 @@ ${defineGetters}`
|
|
1889
1969
|
super.updateHash(hash, context);
|
1890
1970
|
}
|
1891
1971
|
|
1972
|
+
/**
|
1973
|
+
* @param {ObjectDeserializerContext} context context
|
1974
|
+
* @returns {ConcatenatedModule} ConcatenatedModule
|
1975
|
+
*/
|
1892
1976
|
static deserialize(context) {
|
1893
1977
|
const obj = new ConcatenatedModule({
|
1894
1978
|
identifier: undefined,
|
@@ -56,7 +56,7 @@ class EnsureChunkConditionsPlugin {
|
|
56
56
|
// We reached the entrypoint: fail
|
57
57
|
if (chunkGroup.isInitial()) {
|
58
58
|
throw new Error(
|
59
|
-
"Cannot
|
59
|
+
"Cannot fulfil chunk condition of " + module.identifier()
|
60
60
|
);
|
61
61
|
}
|
62
62
|
// Try placing in all parents
|
@@ -9,6 +9,7 @@ const { UsageState } = require("../ExportsInfo");
|
|
9
9
|
|
10
10
|
/** @typedef {import("estree").Node} AnyNode */
|
11
11
|
/** @typedef {import("../Dependency")} Dependency */
|
12
|
+
/** @typedef {import("../Module")} Module */
|
12
13
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
13
14
|
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
14
15
|
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
@@ -295,7 +296,9 @@ exports.isDependencyUsedByExports = (
|
|
295
296
|
) => {
|
296
297
|
if (usedByExports === false) return false;
|
297
298
|
if (usedByExports !== true && usedByExports !== undefined) {
|
298
|
-
const selfModule =
|
299
|
+
const selfModule =
|
300
|
+
/** @type {Module} */
|
301
|
+
(moduleGraph.getParentModule(dependency));
|
299
302
|
const exportsInfo = moduleGraph.getExportsInfo(selfModule);
|
300
303
|
let used = false;
|
301
304
|
for (const exportName of usedByExports) {
|
@@ -320,7 +323,9 @@ exports.getDependencyUsedByExportsCondition = (
|
|
320
323
|
) => {
|
321
324
|
if (usedByExports === false) return false;
|
322
325
|
if (usedByExports !== true && usedByExports !== undefined) {
|
323
|
-
const selfModule =
|
326
|
+
const selfModule =
|
327
|
+
/** @type {Module} */
|
328
|
+
(moduleGraph.getParentModule(dependency));
|
324
329
|
const exportsInfo = moduleGraph.getExportsInfo(selfModule);
|
325
330
|
return (connections, runtime) => {
|
326
331
|
for (const exportName of usedByExports) {
|
@@ -19,8 +19,10 @@ const InnerGraph = require("./InnerGraph");
|
|
19
19
|
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
20
20
|
/** @typedef {import("../Compiler")} Compiler */
|
21
21
|
/** @typedef {import("../Dependency")} Dependency */
|
22
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
22
23
|
/** @typedef {import("../dependencies/HarmonyImportSpecifierDependency")} HarmonyImportSpecifierDependency */
|
23
24
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
25
|
+
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
24
26
|
/** @typedef {import("./InnerGraph").InnerGraph} InnerGraph */
|
25
27
|
/** @typedef {import("./InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
26
28
|
|
@@ -123,7 +125,10 @@ class InnerGraphPlugin {
|
|
123
125
|
if (parser.scope.topLevelScope === true) {
|
124
126
|
if (
|
125
127
|
statement.type === "ClassDeclaration" &&
|
126
|
-
parser.isPure(
|
128
|
+
parser.isPure(
|
129
|
+
statement,
|
130
|
+
/** @type {Range} */ (statement.range)[0]
|
131
|
+
)
|
127
132
|
) {
|
128
133
|
const name = statement.id ? statement.id.name : "*default*";
|
129
134
|
const fn = InnerGraph.tagTopLevelSymbol(parser, name);
|
@@ -137,10 +142,12 @@ class InnerGraphPlugin {
|
|
137
142
|
if (
|
138
143
|
(decl.type === "ClassExpression" ||
|
139
144
|
decl.type === "ClassDeclaration") &&
|
140
|
-
parser.isPure(decl, decl.range[0])
|
145
|
+
parser.isPure(decl, /** @type {Range} */ (decl.range)[0])
|
141
146
|
) {
|
142
147
|
classWithTopLevelSymbol.set(decl, fn);
|
143
|
-
} else if (
|
148
|
+
} else if (
|
149
|
+
parser.isPure(decl, /** @type {Range} */ (statement.range)[0])
|
150
|
+
) {
|
144
151
|
statementWithTopLevelSymbol.set(statement, fn);
|
145
152
|
if (
|
146
153
|
!decl.type.endsWith("FunctionExpression") &&
|
@@ -164,11 +171,19 @@ class InnerGraphPlugin {
|
|
164
171
|
const name = decl.id.name;
|
165
172
|
if (
|
166
173
|
decl.init.type === "ClassExpression" &&
|
167
|
-
parser.isPure(
|
174
|
+
parser.isPure(
|
175
|
+
decl.init,
|
176
|
+
/** @type {Range} */ (decl.id.range)[1]
|
177
|
+
)
|
168
178
|
) {
|
169
179
|
const fn = InnerGraph.tagTopLevelSymbol(parser, name);
|
170
180
|
classWithTopLevelSymbol.set(decl.init, fn);
|
171
|
-
} else if (
|
181
|
+
} else if (
|
182
|
+
parser.isPure(
|
183
|
+
decl.init,
|
184
|
+
/** @type {Range} */ (decl.id.range)[1]
|
185
|
+
)
|
186
|
+
) {
|
172
187
|
const fn = InnerGraph.tagTopLevelSymbol(parser, name);
|
173
188
|
declWithTopLevelSymbol.set(decl, fn);
|
174
189
|
if (
|
@@ -214,9 +229,11 @@ class InnerGraphPlugin {
|
|
214
229
|
return;
|
215
230
|
default: {
|
216
231
|
const dep = new PureExpressionDependency(
|
217
|
-
purePart.range
|
232
|
+
/** @type {Range} */ (purePart.range)
|
218
233
|
);
|
219
|
-
dep.loc =
|
234
|
+
dep.loc =
|
235
|
+
/** @type {DependencyLocation} */
|
236
|
+
(statement.loc);
|
220
237
|
dep.usedByExports = usedByExports;
|
221
238
|
parser.state.module.addDependency(dep);
|
222
239
|
break;
|
@@ -238,7 +255,9 @@ class InnerGraphPlugin {
|
|
238
255
|
fn &&
|
239
256
|
parser.isPure(
|
240
257
|
expr,
|
241
|
-
statement.id
|
258
|
+
statement.id
|
259
|
+
? /** @type {Range} */ (statement.id.range)[1]
|
260
|
+
: /** @type {Range} */ (statement.range)[0]
|
242
261
|
)
|
243
262
|
) {
|
244
263
|
InnerGraph.setTopLevelSymbol(parser.state, fn);
|
@@ -272,7 +291,9 @@ class InnerGraphPlugin {
|
|
272
291
|
!element.static ||
|
273
292
|
parser.isPure(
|
274
293
|
expression,
|
275
|
-
element.key
|
294
|
+
element.key
|
295
|
+
? /** @type {Range} */ (element.key.range)[1]
|
296
|
+
: /** @type {Range} */ (element.range)[0]
|
276
297
|
)
|
277
298
|
) {
|
278
299
|
InnerGraph.setTopLevelSymbol(parser.state, fn);
|
@@ -284,9 +305,11 @@ class InnerGraphPlugin {
|
|
284
305
|
return;
|
285
306
|
default: {
|
286
307
|
const dep = new PureExpressionDependency(
|
287
|
-
expression.range
|
308
|
+
/** @type {Range} */ (expression.range)
|
288
309
|
);
|
289
|
-
dep.loc =
|
310
|
+
dep.loc =
|
311
|
+
/** @type {DependencyLocation} */
|
312
|
+
(expression.loc);
|
290
313
|
dep.usedByExports = usedByExports;
|
291
314
|
parser.state.module.addDependency(dep);
|
292
315
|
break;
|
@@ -321,9 +344,9 @@ class InnerGraphPlugin {
|
|
321
344
|
return;
|
322
345
|
default: {
|
323
346
|
const dep = new PureExpressionDependency(
|
324
|
-
decl.init.range
|
347
|
+
/** @type {Range} */ (decl.init.range)
|
325
348
|
);
|
326
|
-
dep.loc = decl.loc;
|
349
|
+
dep.loc = /** @type {DependencyLocation} */ (decl.loc);
|
327
350
|
dep.usedByExports = usedByExports;
|
328
351
|
parser.state.module.addDependency(dep);
|
329
352
|
break;
|