webpack 5.45.0 → 5.47.1
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/bin/webpack.js +0 -0
- package/lib/NormalModule.js +10 -12
- package/lib/NormalModuleFactory.js +2 -8
- package/lib/Template.js +1 -4
- package/lib/asset/AssetGenerator.js +29 -16
- package/lib/asset/AssetModulesPlugin.js +23 -18
- package/lib/config/defaults.js +12 -18
- package/lib/dependencies/AMDRequireDependency.js +2 -8
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +3 -6
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +2 -4
- package/lib/dependencies/HarmonyImportDependency.js +1 -5
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +5 -40
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +2 -2
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +2 -10
- package/lib/dependencies/ModuleDependency.js +1 -8
- package/lib/hmr/HotModuleReplacement.runtime.js +66 -60
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +2 -8
- package/lib/javascript/JavascriptModulesPlugin.js +51 -30
- package/lib/javascript/JavascriptParser.js +9 -14
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +5 -4
- package/lib/rules/{ObjectMatcherRulePlugin.js → DescriptionDataMatcherRulePlugin.js} +10 -14
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +5 -1
- package/lib/schemes/DataUriPlugin.js +7 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +32 -2
- package/lib/stats/DefaultStatsPresetPlugin.js +6 -2
- package/lib/stats/DefaultStatsPrinterPlugin.js +51 -9
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -2
- package/package.json +2 -3
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +8 -7
- package/types.d.ts +68 -41
package/bin/webpack.js
CHANGED
File without changes
|
package/lib/NormalModule.js
CHANGED
@@ -293,13 +293,9 @@ class NormalModule extends Module {
|
|
293
293
|
*/
|
294
294
|
identifier() {
|
295
295
|
if (this.layer === null) {
|
296
|
-
|
297
|
-
return this.request;
|
298
|
-
} else {
|
299
|
-
return `${this.type}|${this.request}`;
|
300
|
-
}
|
296
|
+
return this.request;
|
301
297
|
} else {
|
302
|
-
return `${this.
|
298
|
+
return `${this.request}|${this.layer}`;
|
303
299
|
}
|
304
300
|
}
|
305
301
|
|
@@ -354,18 +350,20 @@ class NormalModule extends Module {
|
|
354
350
|
this.resource = m.resource;
|
355
351
|
this.matchResource = m.matchResource;
|
356
352
|
this.loaders = m.loaders;
|
357
|
-
this._sourceTypes = m._sourceTypes;
|
358
|
-
this._sourceSizes = m._sourceSizes;
|
359
353
|
}
|
360
354
|
|
361
355
|
/**
|
362
356
|
* Assuming this module is in the cache. Remove internal references to allow freeing some memory.
|
363
357
|
*/
|
364
358
|
cleanupForCache() {
|
365
|
-
// Make sure to cache types and sizes before cleanup
|
366
|
-
|
367
|
-
|
368
|
-
|
359
|
+
// Make sure to cache types and sizes before cleanup when this module has been built
|
360
|
+
// They are accessed by the stats and we don't want them to crash after cleanup
|
361
|
+
// TODO reconsider this for webpack 6
|
362
|
+
if (this.buildInfo) {
|
363
|
+
if (this._sourceTypes === undefined) this.getSourceTypes();
|
364
|
+
for (const type of this._sourceTypes) {
|
365
|
+
this.size(type);
|
366
|
+
}
|
369
367
|
}
|
370
368
|
super.cleanupForCache();
|
371
369
|
this.parser = undefined;
|
@@ -20,7 +20,7 @@ const ModuleGraph = require("./ModuleGraph");
|
|
20
20
|
const NormalModule = require("./NormalModule");
|
21
21
|
const BasicEffectRulePlugin = require("./rules/BasicEffectRulePlugin");
|
22
22
|
const BasicMatcherRulePlugin = require("./rules/BasicMatcherRulePlugin");
|
23
|
-
const
|
23
|
+
const DescriptionDataMatcherRulePlugin = require("./rules/DescriptionDataMatcherRulePlugin");
|
24
24
|
const RuleSetCompiler = require("./rules/RuleSetCompiler");
|
25
25
|
const UseEffectRulePlugin = require("./rules/UseEffectRulePlugin");
|
26
26
|
const LazySet = require("./util/LazySet");
|
@@ -44,7 +44,6 @@ const { parseResource } = require("./util/identifier");
|
|
44
44
|
* @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions
|
45
45
|
* @property {string} context
|
46
46
|
* @property {string} request
|
47
|
-
* @property {Record<string, any> | undefined} assertions
|
48
47
|
* @property {ModuleDependency[]} dependencies
|
49
48
|
* @property {Object} createData
|
50
49
|
* @property {LazySet<string>} fileDependencies
|
@@ -183,8 +182,7 @@ const ruleSetCompiler = new RuleSetCompiler([
|
|
183
182
|
new BasicMatcherRulePlugin("issuer"),
|
184
183
|
new BasicMatcherRulePlugin("compiler"),
|
185
184
|
new BasicMatcherRulePlugin("issuerLayer"),
|
186
|
-
new
|
187
|
-
new ObjectMatcherRulePlugin("descriptionData"),
|
185
|
+
new DescriptionDataMatcherRulePlugin(),
|
188
186
|
new BasicEffectRulePlugin("type"),
|
189
187
|
new BasicEffectRulePlugin("sideEffects"),
|
190
188
|
new BasicEffectRulePlugin("parser"),
|
@@ -341,7 +339,6 @@ class NormalModuleFactory extends ModuleFactory {
|
|
341
339
|
context,
|
342
340
|
dependencies,
|
343
341
|
request,
|
344
|
-
assertions,
|
345
342
|
resolveOptions,
|
346
343
|
fileDependencies,
|
347
344
|
missingDependencies,
|
@@ -450,7 +447,6 @@ class NormalModuleFactory extends ModuleFactory {
|
|
450
447
|
resourceQuery: resourceDataForRules.query,
|
451
448
|
resourceFragment: resourceDataForRules.fragment,
|
452
449
|
scheme,
|
453
|
-
assertions,
|
454
450
|
mimetype: matchResourceData ? "" : resourceData.data.mimetype || "",
|
455
451
|
dependency: dependencyType,
|
456
452
|
descriptionData: matchResourceData
|
@@ -698,7 +694,6 @@ class NormalModuleFactory extends ModuleFactory {
|
|
698
694
|
const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS;
|
699
695
|
const dependency = dependencies[0];
|
700
696
|
const request = dependency.request;
|
701
|
-
const assertions = dependency.assertions;
|
702
697
|
const contextInfo = data.contextInfo;
|
703
698
|
const fileDependencies = new LazySet();
|
704
699
|
const missingDependencies = new LazySet();
|
@@ -709,7 +704,6 @@ class NormalModuleFactory extends ModuleFactory {
|
|
709
704
|
resolveOptions,
|
710
705
|
context,
|
711
706
|
request,
|
712
|
-
assertions,
|
713
707
|
dependencies,
|
714
708
|
fileDependencies,
|
715
709
|
missingDependencies,
|
package/lib/Template.js
CHANGED
@@ -350,7 +350,7 @@ class Template {
|
|
350
350
|
|
351
351
|
/**
|
352
352
|
* @param {RuntimeModule[]} runtimeModules array of runtime modules in order
|
353
|
-
* @param {RenderContext & { codeGenerationResults?: CodeGenerationResults
|
353
|
+
* @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context
|
354
354
|
* @returns {Source} rendered runtime modules in a Source object
|
355
355
|
*/
|
356
356
|
static renderRuntimeModules(runtimeModules, renderContext) {
|
@@ -382,12 +382,10 @@ class Template {
|
|
382
382
|
source.add("\n\n");
|
383
383
|
} else if (renderContext.runtimeTemplate.supportsArrowFunction()) {
|
384
384
|
source.add("(() => {\n");
|
385
|
-
if (renderContext.useStrict) source.add('\t"use strict";\n');
|
386
385
|
source.add(new PrefixSource("\t", runtimeSource));
|
387
386
|
source.add("\n})();\n\n");
|
388
387
|
} else {
|
389
388
|
source.add("!function() {\n");
|
390
|
-
if (renderContext.useStrict) source.add('\t"use strict";\n');
|
391
389
|
source.add(new PrefixSource("\t", runtimeSource));
|
392
390
|
source.add("\n}();\n\n");
|
393
391
|
}
|
@@ -406,7 +404,6 @@ class Template {
|
|
406
404
|
"/******/ ",
|
407
405
|
new ConcatSource(
|
408
406
|
"function(__webpack_require__) { // webpackRuntimeModules\n",
|
409
|
-
'"use strict";\n\n',
|
410
407
|
this.renderRuntimeModules(runtimeModules, renderContext),
|
411
408
|
"}\n"
|
412
409
|
)
|
@@ -141,7 +141,9 @@ class AssetGenerator extends Generator {
|
|
141
141
|
module.resourceResolveData &&
|
142
142
|
module.resourceResolveData.mimetype !== undefined
|
143
143
|
) {
|
144
|
-
mimeType =
|
144
|
+
mimeType =
|
145
|
+
module.resourceResolveData.mimetype +
|
146
|
+
module.resourceResolveData.parameters;
|
145
147
|
} else if (ext) {
|
146
148
|
mimeType = mimeTypes.lookup(ext);
|
147
149
|
}
|
@@ -156,22 +158,33 @@ class AssetGenerator extends Generator {
|
|
156
158
|
}
|
157
159
|
|
158
160
|
let encodedContent;
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
encodedContent =
|
168
|
-
|
169
|
-
|
161
|
+
if (
|
162
|
+
module.resourceResolveData &&
|
163
|
+
module.resourceResolveData.encoding === encoding
|
164
|
+
) {
|
165
|
+
encodedContent = module.resourceResolveData.encodedContent;
|
166
|
+
} else {
|
167
|
+
switch (encoding) {
|
168
|
+
case "base64": {
|
169
|
+
encodedContent = originalSource.buffer().toString("base64");
|
170
|
+
break;
|
171
|
+
}
|
172
|
+
case false: {
|
173
|
+
const content = originalSource.source();
|
174
|
+
|
175
|
+
if (typeof content !== "string") {
|
176
|
+
encodedContent = content.toString("utf-8");
|
177
|
+
}
|
178
|
+
|
179
|
+
encodedContent = encodeURIComponent(encodedContent).replace(
|
180
|
+
/[!'()*]/g,
|
181
|
+
character => "%" + character.codePointAt(0).toString(16)
|
182
|
+
);
|
183
|
+
break;
|
170
184
|
}
|
171
|
-
|
185
|
+
default:
|
186
|
+
throw new Error(`Unsupported encoding '${encoding}'`);
|
172
187
|
}
|
173
|
-
default:
|
174
|
-
throw new Error(`Unsupported encoding '${encoding}'`);
|
175
188
|
}
|
176
189
|
|
177
190
|
encodedSource = `data:${mimeType}${
|
@@ -216,7 +229,7 @@ class AssetGenerator extends Generator {
|
|
216
229
|
}
|
217
230
|
);
|
218
231
|
let publicPath;
|
219
|
-
if (this.publicPath) {
|
232
|
+
if (this.publicPath !== undefined) {
|
220
233
|
const { path, info } =
|
221
234
|
runtimeTemplate.compilation.getAssetPathWithInfo(
|
222
235
|
this.publicPath,
|
@@ -172,24 +172,29 @@ class AssetModulesPlugin {
|
|
172
172
|
);
|
173
173
|
if (modules) {
|
174
174
|
for (const module of modules) {
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
175
|
+
try {
|
176
|
+
const codeGenResult = codeGenerationResults.get(
|
177
|
+
module,
|
178
|
+
chunk.runtime
|
179
|
+
);
|
180
|
+
result.push({
|
181
|
+
render: () => codeGenResult.sources.get(type),
|
182
|
+
filename:
|
183
|
+
module.buildInfo.filename ||
|
184
|
+
codeGenResult.data.get("filename"),
|
185
|
+
info:
|
186
|
+
module.buildInfo.assetInfo ||
|
187
|
+
codeGenResult.data.get("assetInfo"),
|
188
|
+
auxiliary: true,
|
189
|
+
identifier: `assetModule${chunkGraph.getModuleId(module)}`,
|
190
|
+
hash:
|
191
|
+
module.buildInfo.fullContentHash ||
|
192
|
+
codeGenResult.data.get("fullContentHash")
|
193
|
+
});
|
194
|
+
} catch (e) {
|
195
|
+
e.message += `\nduring rendering of asset ${module.identifier()}`;
|
196
|
+
throw e;
|
197
|
+
}
|
193
198
|
}
|
194
199
|
}
|
195
200
|
|
package/lib/config/defaults.js
CHANGED
@@ -482,6 +482,18 @@ const applyModuleDefaults = (
|
|
482
482
|
or: ["text/javascript", "application/javascript"]
|
483
483
|
},
|
484
484
|
...esm
|
485
|
+
},
|
486
|
+
{
|
487
|
+
dependency: "url",
|
488
|
+
oneOf: [
|
489
|
+
{
|
490
|
+
scheme: /^data$/,
|
491
|
+
type: "asset/inline"
|
492
|
+
},
|
493
|
+
{
|
494
|
+
type: "asset/resource"
|
495
|
+
}
|
496
|
+
]
|
485
497
|
}
|
486
498
|
];
|
487
499
|
if (asyncWebAssembly) {
|
@@ -529,24 +541,6 @@ const applyModuleDefaults = (
|
|
529
541
|
...wasm
|
530
542
|
});
|
531
543
|
}
|
532
|
-
rules.push(
|
533
|
-
{
|
534
|
-
dependency: "url",
|
535
|
-
oneOf: [
|
536
|
-
{
|
537
|
-
scheme: /^data$/,
|
538
|
-
type: "asset/inline"
|
539
|
-
},
|
540
|
-
{
|
541
|
-
type: "asset/resource"
|
542
|
-
}
|
543
|
-
]
|
544
|
-
},
|
545
|
-
{
|
546
|
-
assert: { type: "json" },
|
547
|
-
type: "json"
|
548
|
-
}
|
549
|
-
);
|
550
544
|
return rules;
|
551
545
|
});
|
552
546
|
};
|
@@ -123,10 +123,7 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends (
|
|
123
123
|
|
124
124
|
source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock);
|
125
125
|
|
126
|
-
source.insert(
|
127
|
-
dep.arrayRange[0] + 0.9,
|
128
|
-
"var __WEBPACK_AMD_REQUIRE_ARRAY__ = "
|
129
|
-
);
|
126
|
+
source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = ");
|
130
127
|
|
131
128
|
source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; (");
|
132
129
|
|
@@ -160,10 +157,7 @@ AMDRequireDependency.Template = class AMDRequireDependencyTemplate extends (
|
|
160
157
|
|
161
158
|
source.replace(dep.outerRange[0], dep.arrayRange[0] - 1, startBlock);
|
162
159
|
|
163
|
-
source.insert(
|
164
|
-
dep.arrayRange[0] + 0.9,
|
165
|
-
"var __WEBPACK_AMD_REQUIRE_ARRAY__ = "
|
166
|
-
);
|
160
|
+
source.insert(dep.arrayRange[0], "var __WEBPACK_AMD_REQUIRE_ARRAY__ = ");
|
167
161
|
|
168
162
|
source.replace(dep.arrayRange[1], dep.functionRange[0] - 1, "; (");
|
169
163
|
|
@@ -12,8 +12,7 @@ const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency")
|
|
12
12
|
const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency");
|
13
13
|
const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency");
|
14
14
|
const {
|
15
|
-
harmonySpecifierTag
|
16
|
-
getAssertions
|
15
|
+
harmonySpecifierTag
|
17
16
|
} = require("./HarmonyImportDependencyParserPlugin");
|
18
17
|
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
|
19
18
|
|
@@ -49,8 +48,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|
49
48
|
parser.state.module.addPresentationalDependency(clearDep);
|
50
49
|
const sideEffectDep = new HarmonyImportSideEffectDependency(
|
51
50
|
source,
|
52
|
-
parser.state.lastHarmonyImportOrder
|
53
|
-
getAssertions(statement)
|
51
|
+
parser.state.lastHarmonyImportOrder
|
54
52
|
);
|
55
53
|
sideEffectDep.loc = Object.create(statement.loc);
|
56
54
|
sideEffectDep.loc.index = -1;
|
@@ -129,8 +127,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|
129
127
|
harmonyNamedExports,
|
130
128
|
null,
|
131
129
|
this.strictExportPresence,
|
132
|
-
null
|
133
|
-
settings.assertions
|
130
|
+
null
|
134
131
|
);
|
135
132
|
} else {
|
136
133
|
dep = new HarmonyExportSpecifierDependency(id, name);
|
@@ -159,7 +159,6 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
159
159
|
* @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency> | Iterable<HarmonyExportImportedSpecifierDependency>} otherStarExports other star exports in the module before this import
|
160
160
|
* @param {boolean} strictExportPresence when true, missing exports in the imported module lead to errors instead of warnings
|
161
161
|
* @param {HarmonyStarExportsList} allStarExports all star exports in the module
|
162
|
-
* @param {Record<string, any>=} assertions import assertions
|
163
162
|
*/
|
164
163
|
constructor(
|
165
164
|
request,
|
@@ -169,10 +168,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
169
168
|
activeExports,
|
170
169
|
otherStarExports,
|
171
170
|
strictExportPresence,
|
172
|
-
allStarExports
|
173
|
-
assertions
|
171
|
+
allStarExports
|
174
172
|
) {
|
175
|
-
super(request, sourceOrder
|
173
|
+
super(request, sourceOrder);
|
176
174
|
|
177
175
|
this.ids = ids;
|
178
176
|
this.name = name;
|
@@ -32,12 +32,10 @@ class HarmonyImportDependency extends ModuleDependency {
|
|
32
32
|
*
|
33
33
|
* @param {string} request request string
|
34
34
|
* @param {number} sourceOrder source order
|
35
|
-
* @param {Record<string, any>=} assertions import assertions
|
36
35
|
*/
|
37
|
-
constructor(request, sourceOrder
|
36
|
+
constructor(request, sourceOrder) {
|
38
37
|
super(request);
|
39
38
|
this.sourceOrder = sourceOrder;
|
40
|
-
this.assertions = assertions;
|
41
39
|
}
|
42
40
|
|
43
41
|
get category() {
|
@@ -203,14 +201,12 @@ class HarmonyImportDependency extends ModuleDependency {
|
|
203
201
|
serialize(context) {
|
204
202
|
const { write } = context;
|
205
203
|
write(this.sourceOrder);
|
206
|
-
write(this.assertions);
|
207
204
|
super.serialize(context);
|
208
205
|
}
|
209
206
|
|
210
207
|
deserialize(context) {
|
211
208
|
const { read } = context;
|
212
209
|
this.sourceOrder = read();
|
213
|
-
this.assertions = read();
|
214
210
|
super.deserialize(context);
|
215
211
|
}
|
216
212
|
}
|
@@ -14,11 +14,7 @@ const HarmonyExports = require("./HarmonyExports");
|
|
14
14
|
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
|
15
15
|
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
16
16
|
|
17
|
-
/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */
|
18
|
-
/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */
|
19
17
|
/** @typedef {import("estree").Identifier} Identifier */
|
20
|
-
/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */
|
21
|
-
/** @typedef {import("estree").ImportExpression} ImportExpression */
|
22
18
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
23
19
|
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */
|
24
20
|
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
@@ -33,32 +29,8 @@ const harmonySpecifierTag = Symbol("harmony import");
|
|
33
29
|
* @property {number} sourceOrder
|
34
30
|
* @property {string} name
|
35
31
|
* @property {boolean} await
|
36
|
-
* @property {Record<string, any> | undefined} assertions
|
37
32
|
*/
|
38
33
|
|
39
|
-
/**
|
40
|
-
* @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions
|
41
|
-
* @returns {Record<string, any> | undefined} assertions
|
42
|
-
*/
|
43
|
-
function getAssertions(node) {
|
44
|
-
// TODO remove cast when @types/estree has been updated to import assertions
|
45
|
-
const assertions = /** @type {{ assertions?: ImportAttributeNode[] }} */ (
|
46
|
-
node
|
47
|
-
).assertions;
|
48
|
-
if (assertions === undefined) {
|
49
|
-
return undefined;
|
50
|
-
}
|
51
|
-
const result = {};
|
52
|
-
for (const assertion of assertions) {
|
53
|
-
const key =
|
54
|
-
assertion.key.type === "Identifier"
|
55
|
-
? assertion.key.name
|
56
|
-
: assertion.key.value;
|
57
|
-
result[key] = assertion.value.value;
|
58
|
-
}
|
59
|
-
return result;
|
60
|
-
}
|
61
|
-
|
62
34
|
module.exports = class HarmonyImportDependencyParserPlugin {
|
63
35
|
constructor(options) {
|
64
36
|
this.strictExportPresence = options.strictExportPresence;
|
@@ -93,11 +65,9 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
93
65
|
clearDep.loc = statement.loc;
|
94
66
|
parser.state.module.addPresentationalDependency(clearDep);
|
95
67
|
parser.unsetAsiPosition(statement.range[1]);
|
96
|
-
const assertions = getAssertions(statement);
|
97
68
|
const sideEffectDep = new HarmonyImportSideEffectDependency(
|
98
69
|
source,
|
99
|
-
parser.state.lastHarmonyImportOrder
|
100
|
-
assertions
|
70
|
+
parser.state.lastHarmonyImportOrder
|
101
71
|
);
|
102
72
|
sideEffectDep.loc = statement.loc;
|
103
73
|
parser.state.module.addDependency(sideEffectDep);
|
@@ -112,8 +82,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
112
82
|
name,
|
113
83
|
source,
|
114
84
|
ids,
|
115
|
-
sourceOrder: parser.state.lastHarmonyImportOrder
|
116
|
-
assertions: getAssertions(statement)
|
85
|
+
sourceOrder: parser.state.lastHarmonyImportOrder
|
117
86
|
});
|
118
87
|
return true;
|
119
88
|
}
|
@@ -128,8 +97,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
128
97
|
settings.ids,
|
129
98
|
settings.name,
|
130
99
|
expr.range,
|
131
|
-
this.strictExportPresence
|
132
|
-
settings.assertions
|
100
|
+
this.strictExportPresence
|
133
101
|
);
|
134
102
|
dep.shorthand = parser.scope.inShorthand;
|
135
103
|
dep.directImport = true;
|
@@ -150,8 +118,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
150
118
|
ids,
|
151
119
|
settings.name,
|
152
120
|
expr.range,
|
153
|
-
this.strictExportPresence
|
154
|
-
settings.assertions
|
121
|
+
this.strictExportPresence
|
155
122
|
);
|
156
123
|
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
|
157
124
|
dep.loc = expr.loc;
|
@@ -171,8 +138,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
171
138
|
ids,
|
172
139
|
settings.name,
|
173
140
|
callee.range,
|
174
|
-
this.strictExportPresence
|
175
|
-
settings.assertions
|
141
|
+
this.strictExportPresence
|
176
142
|
);
|
177
143
|
dep.directImport = members.length === 0;
|
178
144
|
dep.call = true;
|
@@ -240,4 +206,3 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
240
206
|
};
|
241
207
|
|
242
208
|
module.exports.harmonySpecifierTag = harmonySpecifierTag;
|
243
|
-
module.exports.getAssertions = getAssertions;
|
@@ -20,8 +20,8 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
|
|
20
20
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
21
21
|
|
22
22
|
class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
|
23
|
-
constructor(request, sourceOrder
|
24
|
-
super(request, sourceOrder
|
23
|
+
constructor(request, sourceOrder) {
|
24
|
+
super(request, sourceOrder);
|
25
25
|
}
|
26
26
|
|
27
27
|
get type() {
|
@@ -29,16 +29,8 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
|
|
29
29
|
const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids");
|
30
30
|
|
31
31
|
class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
32
|
-
constructor(
|
33
|
-
request,
|
34
|
-
sourceOrder,
|
35
|
-
ids,
|
36
|
-
name,
|
37
|
-
range,
|
38
|
-
strictExportPresence,
|
39
|
-
assertions
|
40
|
-
) {
|
41
|
-
super(request, sourceOrder, assertions);
|
32
|
+
constructor(request, sourceOrder, ids, name, range, strictExportPresence) {
|
33
|
+
super(request, sourceOrder);
|
42
34
|
this.ids = ids;
|
43
35
|
this.name = name;
|
44
36
|
this.range = range;
|
@@ -22,20 +22,13 @@ class ModuleDependency extends Dependency {
|
|
22
22
|
this.request = request;
|
23
23
|
this.userRequest = request;
|
24
24
|
this.range = undefined;
|
25
|
-
// assertions must be serialized by subclasses that use it
|
26
|
-
/** @type {Record<string, any> | undefined} */
|
27
|
-
this.assertions = undefined;
|
28
25
|
}
|
29
26
|
|
30
27
|
/**
|
31
28
|
* @returns {string | null} an identifier to merge equal requests
|
32
29
|
*/
|
33
30
|
getResourceIdentifier() {
|
34
|
-
|
35
|
-
if (this.assertions !== undefined) {
|
36
|
-
str += JSON.stringify(this.assertions);
|
37
|
-
}
|
38
|
-
return str;
|
31
|
+
return `module${this.request}`;
|
39
32
|
}
|
40
33
|
|
41
34
|
/**
|