webpack 5.90.0 → 5.90.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/lib/APIPlugin.js +16 -12
- package/lib/Compilation.js +1 -1
- package/lib/ConditionalInitFragment.js +3 -3
- package/lib/DefinePlugin.js +47 -26
- package/lib/EvalSourceMapDevToolPlugin.js +1 -1
- package/lib/InitFragment.js +7 -7
- package/lib/NodeStuffPlugin.js +3 -3
- package/lib/Stats.js +4 -0
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +53 -0
- package/lib/config/browserslistTargetHandler.js +18 -16
- package/lib/config/defaults.js +1 -0
- package/lib/dependencies/AMDDefineDependency.js +4 -4
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +126 -34
- package/lib/dependencies/AMDPlugin.js +11 -4
- package/lib/dependencies/AMDRequireArrayDependency.js +13 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +159 -43
- package/lib/dependencies/AMDRequireDependency.js +2 -2
- package/lib/dependencies/AMDRequireItemDependency.js +1 -1
- package/lib/dependencies/ExternalModuleDependency.js +9 -0
- package/lib/dependencies/ExternalModuleInitFragment.js +10 -3
- package/lib/dependencies/HarmonyExportInitFragment.js +2 -2
- package/lib/dependencies/LocalModuleDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +3 -2
- package/lib/dependencies/getFunctionExpression.js +2 -2
- package/lib/javascript/JavascriptParser.js +212 -74
- package/lib/optimize/MangleExportsPlugin.js +5 -1
- package/lib/util/chainedImports.js +7 -6
- package/lib/util/comparators.js +59 -23
- package/lib/util/numberHash.js +64 -52
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +53 -28
- package/package.json +3 -58
- package/types.d.ts +101 -74
package/lib/APIPlugin.js
CHANGED
@@ -24,10 +24,12 @@ const ChunkNameRuntimeModule = require("./runtime/ChunkNameRuntimeModule");
|
|
24
24
|
const GetFullHashRuntimeModule = require("./runtime/GetFullHashRuntimeModule");
|
25
25
|
|
26
26
|
/** @typedef {import("./Compiler")} Compiler */
|
27
|
+
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
27
28
|
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
29
|
+
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
|
28
30
|
|
29
31
|
/**
|
30
|
-
* @param {boolean} module true if ES module
|
32
|
+
* @param {boolean | undefined} module true if ES module
|
31
33
|
* @param {string} importMetaName `import.meta` name
|
32
34
|
* @returns {Record<string, {expr: string, req: string[] | null, type?: string, assign: boolean}>} replacements
|
33
35
|
*/
|
@@ -150,7 +152,9 @@ class APIPlugin {
|
|
150
152
|
compiler.hooks.compilation.tap(
|
151
153
|
PLUGIN_NAME,
|
152
154
|
(compilation, { normalModuleFactory }) => {
|
153
|
-
const
|
155
|
+
const importMetaName = /** @type {string} */ (
|
156
|
+
compilation.outputOptions.importMetaName
|
157
|
+
);
|
154
158
|
const REPLACEMENTS = getReplacements(
|
155
159
|
this.options.module,
|
156
160
|
importMetaName
|
@@ -166,7 +170,7 @@ class APIPlugin {
|
|
166
170
|
.tap(PLUGIN_NAME, chunk => {
|
167
171
|
compilation.addRuntimeModule(
|
168
172
|
chunk,
|
169
|
-
new ChunkNameRuntimeModule(chunk.name)
|
173
|
+
new ChunkNameRuntimeModule(/** @type {string} */ (chunk.name))
|
170
174
|
);
|
171
175
|
return true;
|
172
176
|
});
|
@@ -218,7 +222,7 @@ class APIPlugin {
|
|
218
222
|
if (info.assign === false) {
|
219
223
|
parser.hooks.assign.for(key).tap(PLUGIN_NAME, expr => {
|
220
224
|
const err = new WebpackError(`${key} must not be assigned`);
|
221
|
-
err.loc = expr.loc;
|
225
|
+
err.loc = /** @type {DependencyLocation} */ (expr.loc);
|
222
226
|
throw err;
|
223
227
|
});
|
224
228
|
}
|
@@ -234,9 +238,9 @@ class APIPlugin {
|
|
234
238
|
.tap(PLUGIN_NAME, expr => {
|
235
239
|
const dep = new ConstDependency(
|
236
240
|
JSON.stringify(parser.state.module.layer),
|
237
|
-
expr.range
|
241
|
+
/** @type {Range} */ (expr.range)
|
238
242
|
);
|
239
|
-
dep.loc = expr.loc;
|
243
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
240
244
|
parser.state.module.addPresentationalDependency(dep);
|
241
245
|
return true;
|
242
246
|
});
|
@@ -248,7 +252,7 @@ class APIPlugin {
|
|
248
252
|
: new BasicEvaluatedExpression().setString(
|
249
253
|
parser.state.module.layer
|
250
254
|
)
|
251
|
-
).setRange(expr.range)
|
255
|
+
).setRange(/** @type {Range} */ (expr.range))
|
252
256
|
);
|
253
257
|
parser.hooks.evaluateTypeof
|
254
258
|
.for("__webpack_layer__")
|
@@ -257,7 +261,7 @@ class APIPlugin {
|
|
257
261
|
.setString(
|
258
262
|
parser.state.module.layer === null ? "object" : "string"
|
259
263
|
)
|
260
|
-
.setRange(expr.range)
|
264
|
+
.setRange(/** @type {Range} */ (expr.range))
|
261
265
|
);
|
262
266
|
|
263
267
|
parser.hooks.expression
|
@@ -267,10 +271,10 @@ class APIPlugin {
|
|
267
271
|
"__webpack_module__.id";
|
268
272
|
const dep = new ConstDependency(
|
269
273
|
parser.state.module.moduleArgument + ".id",
|
270
|
-
expr.range,
|
274
|
+
/** @type {Range} */ (expr.range),
|
271
275
|
[RuntimeGlobals.moduleId]
|
272
276
|
);
|
273
|
-
dep.loc = expr.loc;
|
277
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
274
278
|
parser.state.module.addPresentationalDependency(dep);
|
275
279
|
return true;
|
276
280
|
});
|
@@ -282,10 +286,10 @@ class APIPlugin {
|
|
282
286
|
"__webpack_module__";
|
283
287
|
const dep = new ConstDependency(
|
284
288
|
parser.state.module.moduleArgument,
|
285
|
-
expr.range,
|
289
|
+
/** @type {Range} */ (expr.range),
|
286
290
|
[RuntimeGlobals.module]
|
287
291
|
);
|
288
|
-
dep.loc = expr.loc;
|
292
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
289
293
|
parser.state.module.addPresentationalDependency(dep);
|
290
294
|
return true;
|
291
295
|
});
|
package/lib/Compilation.js
CHANGED
@@ -1087,7 +1087,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1087
1087
|
}
|
1088
1088
|
|
1089
1089
|
/**
|
1090
|
-
* @param {StatsOptions | string} optionsOrPreset stats option value
|
1090
|
+
* @param {StatsOptions | string | undefined} optionsOrPreset stats option value
|
1091
1091
|
* @param {CreateStatsOptionsContext} context context
|
1092
1092
|
* @returns {NormalizedStatsOptions} normalized options
|
1093
1093
|
*/
|
@@ -62,8 +62,8 @@ class ConditionalInitFragment extends InitFragment {
|
|
62
62
|
}
|
63
63
|
|
64
64
|
/**
|
65
|
-
* @param {
|
66
|
-
* @returns {string|Source} the source code that will be included as initialization code
|
65
|
+
* @param {GenerateContext} context context
|
66
|
+
* @returns {string | Source} the source code that will be included as initialization code
|
67
67
|
*/
|
68
68
|
getContent(context) {
|
69
69
|
if (this.runtimeCondition === false || !this.content) return "";
|
@@ -79,7 +79,7 @@ class ConditionalInitFragment extends InitFragment {
|
|
79
79
|
}
|
80
80
|
|
81
81
|
/**
|
82
|
-
* @param {
|
82
|
+
* @param {GenerateContext} context context
|
83
83
|
* @returns {string|Source=} the source code that will be included at the end of the module
|
84
84
|
*/
|
85
85
|
getEndContent(context) {
|
package/lib/DefinePlugin.js
CHANGED
@@ -23,9 +23,11 @@ const createHash = require("./util/createHash");
|
|
23
23
|
|
24
24
|
/** @typedef {import("estree").Expression} Expression */
|
25
25
|
/** @typedef {import("./Compiler")} Compiler */
|
26
|
+
/** @typedef {import("./Module").BuildInfo} BuildInfo */
|
26
27
|
/** @typedef {import("./NormalModule")} NormalModule */
|
27
28
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
28
29
|
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
30
|
+
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
|
29
31
|
/** @typedef {import("./logging/Logger").Logger} Logger */
|
30
32
|
|
31
33
|
/** @typedef {null|undefined|RegExp|Function|string|number|boolean|bigint|undefined} CodeValuePrimitive */
|
@@ -66,7 +68,7 @@ class RuntimeValue {
|
|
66
68
|
* @returns {CodeValuePrimitive} code
|
67
69
|
*/
|
68
70
|
exec(parser, valueCacheVersions, key) {
|
69
|
-
const buildInfo = parser.state.module.buildInfo;
|
71
|
+
const buildInfo = /** @type {BuildInfo} */ (parser.state.module.buildInfo);
|
70
72
|
if (this.options === true) {
|
71
73
|
buildInfo.cacheable = false;
|
72
74
|
} else {
|
@@ -136,19 +138,21 @@ const stringifyObj = (
|
|
136
138
|
let code;
|
137
139
|
let arr = Array.isArray(obj);
|
138
140
|
if (arr) {
|
139
|
-
code = `[${
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
141
|
+
code = `[${
|
142
|
+
/** @type {any[]} */ (obj)
|
143
|
+
.map(code =>
|
144
|
+
toCode(
|
145
|
+
code,
|
146
|
+
parser,
|
147
|
+
valueCacheVersions,
|
148
|
+
key,
|
149
|
+
runtimeTemplate,
|
150
|
+
logger,
|
151
|
+
null
|
152
|
+
)
|
149
153
|
)
|
150
|
-
|
151
|
-
|
154
|
+
.join(",")
|
155
|
+
}]`;
|
152
156
|
} else {
|
153
157
|
let keys = Object.keys(obj);
|
154
158
|
if (objKeys) {
|
@@ -157,7 +161,7 @@ const stringifyObj = (
|
|
157
161
|
}
|
158
162
|
code = `{${keys
|
159
163
|
.map(key => {
|
160
|
-
const code = obj[key];
|
164
|
+
const code = /** @type {{[k: string]: any}} */ (obj)[key];
|
161
165
|
return (
|
162
166
|
JSON.stringify(key) +
|
163
167
|
":" +
|
@@ -263,6 +267,10 @@ const toCode = (
|
|
263
267
|
return strCode;
|
264
268
|
};
|
265
269
|
|
270
|
+
/**
|
271
|
+
* @param {CodeValue} code code
|
272
|
+
* @returns {string | undefined} result
|
273
|
+
*/
|
266
274
|
const toCacheVersion = code => {
|
267
275
|
if (code === null) {
|
268
276
|
return "null";
|
@@ -285,7 +293,7 @@ const toCacheVersion = code => {
|
|
285
293
|
if (typeof code === "object") {
|
286
294
|
const items = Object.keys(code).map(key => ({
|
287
295
|
key,
|
288
|
-
value: toCacheVersion(code[key])
|
296
|
+
value: toCacheVersion(/** @type {Record<string, any>} */ (code)[key])
|
289
297
|
}));
|
290
298
|
if (items.some(({ value }) => value === undefined)) return undefined;
|
291
299
|
return `{${items.map(({ key, value }) => `${key}: ${value}`).join(", ")}}`;
|
@@ -353,14 +361,21 @@ class DefinePlugin {
|
|
353
361
|
const handler = parser => {
|
354
362
|
const mainValue = compilation.valueCacheVersions.get(VALUE_DEP_MAIN);
|
355
363
|
parser.hooks.program.tap(PLUGIN_NAME, () => {
|
356
|
-
const
|
364
|
+
const buildInfo = /** @type {BuildInfo} */ (
|
365
|
+
parser.state.module.buildInfo
|
366
|
+
);
|
357
367
|
if (!buildInfo.valueDependencies)
|
358
368
|
buildInfo.valueDependencies = new Map();
|
359
369
|
buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue);
|
360
370
|
});
|
361
371
|
|
372
|
+
/**
|
373
|
+
* @param {string} key key
|
374
|
+
*/
|
362
375
|
const addValueDependency = key => {
|
363
|
-
const
|
376
|
+
const buildInfo = /** @type {BuildInfo} */ (
|
377
|
+
parser.state.module.buildInfo
|
378
|
+
);
|
364
379
|
buildInfo.valueDependencies.set(
|
365
380
|
VALUE_DEP_PREFIX + key,
|
366
381
|
compilation.valueCacheVersions.get(VALUE_DEP_PREFIX + key)
|
@@ -376,7 +391,7 @@ class DefinePlugin {
|
|
376
391
|
|
377
392
|
/**
|
378
393
|
* Walk definitions
|
379
|
-
* @param {
|
394
|
+
* @param {Record<string, CodeValue>} definitions Definitions map
|
380
395
|
* @param {string} prefix Prefix string
|
381
396
|
* @returns {void}
|
382
397
|
*/
|
@@ -389,7 +404,10 @@ class DefinePlugin {
|
|
389
404
|
!(code instanceof RuntimeValue) &&
|
390
405
|
!(code instanceof RegExp)
|
391
406
|
) {
|
392
|
-
walkDefinitions(
|
407
|
+
walkDefinitions(
|
408
|
+
/** @type {Record<string, CodeValue>} */ (code),
|
409
|
+
prefix + key + "."
|
410
|
+
);
|
393
411
|
applyObjectDefine(prefix + key, code);
|
394
412
|
return;
|
395
413
|
}
|
@@ -458,7 +476,7 @@ class DefinePlugin {
|
|
458
476
|
)
|
459
477
|
);
|
460
478
|
recurse = false;
|
461
|
-
res.setRange(expr.range);
|
479
|
+
res.setRange(/** @type {Range} */ (expr.range));
|
462
480
|
return res;
|
463
481
|
});
|
464
482
|
parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => {
|
@@ -470,7 +488,7 @@ class DefinePlugin {
|
|
470
488
|
originalKey,
|
471
489
|
runtimeTemplate,
|
472
490
|
logger,
|
473
|
-
!parser.isAsiPosition(expr.range[0]),
|
491
|
+
!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
|
474
492
|
parser.destructuringAssignmentPropertiesFor(expr)
|
475
493
|
);
|
476
494
|
|
@@ -517,7 +535,7 @@ class DefinePlugin {
|
|
517
535
|
: "typeof (" + codeCode + ")";
|
518
536
|
const res = parser.evaluate(typeofCode);
|
519
537
|
recurseTypeof = false;
|
520
|
-
res.setRange(expr.range);
|
538
|
+
res.setRange(/** @type {Range} */ (expr.range));
|
521
539
|
return res;
|
522
540
|
});
|
523
541
|
parser.hooks.typeof.for(key).tap(PLUGIN_NAME, expr => {
|
@@ -559,7 +577,7 @@ class DefinePlugin {
|
|
559
577
|
return new BasicEvaluatedExpression()
|
560
578
|
.setTruthy()
|
561
579
|
.setSideEffects(false)
|
562
|
-
.setRange(expr.range);
|
580
|
+
.setRange(/** @type {Range} */ (expr.range));
|
563
581
|
});
|
564
582
|
parser.hooks.evaluateTypeof
|
565
583
|
.for(key)
|
@@ -576,7 +594,7 @@ class DefinePlugin {
|
|
576
594
|
key,
|
577
595
|
runtimeTemplate,
|
578
596
|
logger,
|
579
|
-
!parser.isAsiPosition(expr.range[0]),
|
597
|
+
!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
|
580
598
|
parser.destructuringAssignmentPropertiesFor(expr)
|
581
599
|
);
|
582
600
|
|
@@ -622,7 +640,7 @@ class DefinePlugin {
|
|
622
640
|
|
623
641
|
/**
|
624
642
|
* Walk definitions
|
625
|
-
* @param {
|
643
|
+
* @param {Record<string, CodeValue>} definitions Definitions map
|
626
644
|
* @param {string} prefix Prefix string
|
627
645
|
* @returns {void}
|
628
646
|
*/
|
@@ -649,7 +667,10 @@ class DefinePlugin {
|
|
649
667
|
!(code instanceof RuntimeValue) &&
|
650
668
|
!(code instanceof RegExp)
|
651
669
|
) {
|
652
|
-
walkDefinitionsForValues(
|
670
|
+
walkDefinitionsForValues(
|
671
|
+
/** @type {Record<string, CodeValue>} */ (code),
|
672
|
+
prefix + key + "."
|
673
|
+
);
|
653
674
|
}
|
654
675
|
});
|
655
676
|
};
|
@@ -129,7 +129,7 @@ class EvalSourceMapDevToolPlugin {
|
|
129
129
|
|
130
130
|
// Clone (flat) the sourcemap to ensure that the mutations below do not persist.
|
131
131
|
sourceMap = { ...sourceMap };
|
132
|
-
const context = compiler.options.context;
|
132
|
+
const context = /** @type {string} */ (compiler.options.context);
|
133
133
|
const root = compiler.root;
|
134
134
|
const modules = sourceMap.sources.map(source => {
|
135
135
|
if (!source.startsWith("webpack://")) return source;
|
package/lib/InitFragment.js
CHANGED
@@ -36,15 +36,15 @@ const sortFragmentWithIndex = ([a, i], [b, j]) => {
|
|
36
36
|
};
|
37
37
|
|
38
38
|
/**
|
39
|
-
* @template
|
39
|
+
* @template GenerateContext
|
40
40
|
*/
|
41
41
|
class InitFragment {
|
42
42
|
/**
|
43
|
-
* @param {string|Source} content the source code that will be included as initialization code
|
43
|
+
* @param {string | Source} content the source code that will be included as initialization code
|
44
44
|
* @param {number} stage category of initialization code (contribute to order)
|
45
45
|
* @param {number} position position in the category (contribute to order)
|
46
46
|
* @param {string=} key unique key to avoid emitting the same initialization code twice
|
47
|
-
* @param {string|Source=} endContent the source code that will be included at the end of the module
|
47
|
+
* @param {string | Source=} endContent the source code that will be included at the end of the module
|
48
48
|
*/
|
49
49
|
constructor(content, stage, position, key, endContent) {
|
50
50
|
this.content = content;
|
@@ -55,15 +55,15 @@ class InitFragment {
|
|
55
55
|
}
|
56
56
|
|
57
57
|
/**
|
58
|
-
* @param {
|
59
|
-
* @returns {string|Source} the source code that will be included as initialization code
|
58
|
+
* @param {GenerateContext} context context
|
59
|
+
* @returns {string | Source} the source code that will be included as initialization code
|
60
60
|
*/
|
61
61
|
getContent(context) {
|
62
62
|
return this.content;
|
63
63
|
}
|
64
64
|
|
65
65
|
/**
|
66
|
-
* @param {
|
66
|
+
* @param {GenerateContext} context context
|
67
67
|
* @returns {string|Source=} the source code that will be included at the end of the module
|
68
68
|
*/
|
69
69
|
getEndContent(context) {
|
@@ -91,7 +91,7 @@ class InitFragment {
|
|
91
91
|
for (const [fragment] of sortedFragments) {
|
92
92
|
if (
|
93
93
|
typeof (
|
94
|
-
/** @type {InitFragment<T> & { mergeAll?: (fragments: InitFragment[]) => InitFragment[] }} */
|
94
|
+
/** @type {InitFragment<T> & { mergeAll?: (fragments: InitFragment<Context>[]) => InitFragment<Context>[] }} */
|
95
95
|
(fragment).mergeAll
|
96
96
|
) === "function"
|
97
97
|
) {
|
package/lib/NodeStuffPlugin.js
CHANGED
@@ -136,7 +136,7 @@ class NodeStuffPlugin {
|
|
136
136
|
|
137
137
|
/**
|
138
138
|
* @param {string} expressionName expression name
|
139
|
-
* @param {(value: string) =>
|
139
|
+
* @param {(value: string) => string} fn function
|
140
140
|
* @returns {void}
|
141
141
|
*/
|
142
142
|
const setUrlModuleConstant = (expressionName, fn) => {
|
@@ -153,10 +153,10 @@ class NodeStuffPlugin {
|
|
153
153
|
],
|
154
154
|
undefined,
|
155
155
|
fn("__webpack_fileURLToPath__"),
|
156
|
-
expr.range,
|
156
|
+
/** @type {Range} */ (expr.range),
|
157
157
|
expressionName
|
158
158
|
);
|
159
|
-
dep.loc = expr.loc;
|
159
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
160
160
|
parser.state.module.addPresentationalDependency(dep);
|
161
161
|
|
162
162
|
return true;
|
package/lib/Stats.js
CHANGED
@@ -42,8 +42,8 @@ class AwaitDependenciesInitFragment extends InitFragment {
|
|
42
42
|
}
|
43
43
|
|
44
44
|
/**
|
45
|
-
* @param {
|
46
|
-
* @returns {string|Source} the source code that will be included as initialization code
|
45
|
+
* @param {GenerateContext} context context
|
46
|
+
* @returns {string | Source} the source code that will be included as initialization code
|
47
47
|
*/
|
48
48
|
getContent({ runtimeRequirements }) {
|
49
49
|
runtimeRequirements.add(RuntimeGlobals.module);
|
package/lib/buildChunkGraph.js
CHANGED
@@ -266,12 +266,18 @@ const visitModules = (
|
|
266
266
|
/** @type {Map<DependenciesBlock, ChunkGroupInfo>} */
|
267
267
|
const blockChunkGroups = new Map();
|
268
268
|
|
269
|
+
/** @type {Map<ChunkGroupInfo, DependenciesBlock>} */
|
270
|
+
const blockByChunkGroups = new Map();
|
271
|
+
|
269
272
|
/** @type {Map<string, ChunkGroupInfo>} */
|
270
273
|
const namedChunkGroups = new Map();
|
271
274
|
|
272
275
|
/** @type {Map<string, ChunkGroupInfo>} */
|
273
276
|
const namedAsyncEntrypoints = new Map();
|
274
277
|
|
278
|
+
/** @type {Set<ChunkGroupInfo>} */
|
279
|
+
const outdatedOrderIndexChunkGroups = new Set();
|
280
|
+
|
275
281
|
const ADD_AND_ENTER_ENTRY_MODULE = 0;
|
276
282
|
const ADD_AND_ENTER_MODULE = 1;
|
277
283
|
const ENTER_MODULE = 2;
|
@@ -524,6 +530,7 @@ const visitModules = (
|
|
524
530
|
blockConnections.set(b, []);
|
525
531
|
}
|
526
532
|
blockChunkGroups.set(b, /** @type {ChunkGroupInfo} */ (cgi));
|
533
|
+
blockByChunkGroups.set(cgi, b);
|
527
534
|
} else if (entryOptions) {
|
528
535
|
entrypoint = /** @type {Entrypoint} */ (cgi.chunkGroup);
|
529
536
|
} else {
|
@@ -1208,6 +1215,7 @@ const visitModules = (
|
|
1208
1215
|
chunkGroupsForCombining.add(cgi);
|
1209
1216
|
}
|
1210
1217
|
}
|
1218
|
+
outdatedOrderIndexChunkGroups.add(info);
|
1211
1219
|
}
|
1212
1220
|
outdatedChunkGroupInfo.clear();
|
1213
1221
|
};
|
@@ -1254,6 +1262,51 @@ const visitModules = (
|
|
1254
1262
|
}
|
1255
1263
|
}
|
1256
1264
|
|
1265
|
+
for (const info of outdatedOrderIndexChunkGroups) {
|
1266
|
+
const { chunkGroup, runtime } = info;
|
1267
|
+
|
1268
|
+
const block = blockByChunkGroups.get(info);
|
1269
|
+
|
1270
|
+
if (!block) {
|
1271
|
+
continue;
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
let preOrderIndex = 0;
|
1275
|
+
let postOrderIndex = 0;
|
1276
|
+
|
1277
|
+
const process = (current, visited = new Set()) => {
|
1278
|
+
if (visited.has(current)) {
|
1279
|
+
return;
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
visited.add(current);
|
1283
|
+
|
1284
|
+
const blockModules = getBlockModules(current, runtime);
|
1285
|
+
if (blockModules === undefined) {
|
1286
|
+
return;
|
1287
|
+
}
|
1288
|
+
|
1289
|
+
for (let i = 0; i < blockModules.length; i += 2) {
|
1290
|
+
const refModule = /** @type {Module} */ (blockModules[i]);
|
1291
|
+
const activeState = /** @type {ConnectionState} */ (
|
1292
|
+
blockModules[i + 1]
|
1293
|
+
);
|
1294
|
+
if (activeState === false) {
|
1295
|
+
continue;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
if (refModule) {
|
1299
|
+
chunkGroup.setModulePreOrderIndex(refModule, preOrderIndex++);
|
1300
|
+
process(refModule, visited);
|
1301
|
+
chunkGroup.setModulePostOrderIndex(refModule, postOrderIndex++);
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
};
|
1305
|
+
|
1306
|
+
process(block);
|
1307
|
+
}
|
1308
|
+
outdatedOrderIndexChunkGroups.clear();
|
1309
|
+
|
1257
1310
|
logger.log(
|
1258
1311
|
`${statProcessedQueueItems} queue items processed (${statProcessedBlocks} blocks)`
|
1259
1312
|
);
|
@@ -90,7 +90,9 @@ const resolve = browsers => {
|
|
90
90
|
// safari TP supports all features for normal safari
|
91
91
|
parsedVersion === "TP"
|
92
92
|
? [Infinity, Infinity]
|
93
|
-
: parsedVersion.
|
93
|
+
: parsedVersion.includes("-")
|
94
|
+
? parsedVersion.split("-")[0].split(".")
|
95
|
+
: parsedVersion.split(".");
|
94
96
|
if (typeof requiredVersion === "number") {
|
95
97
|
return +parsedMajor >= requiredVersion;
|
96
98
|
}
|
@@ -118,8 +120,8 @@ const resolve = browsers => {
|
|
118
120
|
samsung: [8, 2],
|
119
121
|
android: 63,
|
120
122
|
and_qq: [10, 4],
|
121
|
-
|
122
|
-
|
123
|
+
baidu: [13, 18],
|
124
|
+
and_uc: [15, 5],
|
123
125
|
kaios: [3, 0],
|
124
126
|
node: [12, 17]
|
125
127
|
});
|
@@ -144,7 +146,7 @@ const resolve = browsers => {
|
|
144
146
|
android: 37,
|
145
147
|
and_qq: [10, 4],
|
146
148
|
// Supported correctly in strict mode, otherwise supported without block scope
|
147
|
-
|
149
|
+
baidu: [13, 18],
|
148
150
|
and_uc: [12, 12],
|
149
151
|
kaios: [2, 5],
|
150
152
|
node: [6, 0]
|
@@ -222,9 +224,9 @@ const resolve = browsers => {
|
|
222
224
|
ios_saf: 14,
|
223
225
|
samsung: [9, 2],
|
224
226
|
android: 67,
|
225
|
-
|
226
|
-
|
227
|
-
|
227
|
+
and_qq: [13, 1],
|
228
|
+
baidu: [13, 18],
|
229
|
+
and_uc: [15, 5],
|
228
230
|
kaios: [3, 0],
|
229
231
|
node: [10, 4]
|
230
232
|
}),
|
@@ -244,8 +246,8 @@ const resolve = browsers => {
|
|
244
246
|
samsung: [8, 0],
|
245
247
|
android: 61,
|
246
248
|
and_qq: [10, 4],
|
247
|
-
|
248
|
-
|
249
|
+
baidu: [13, 18],
|
250
|
+
and_uc: [15, 5],
|
249
251
|
kaios: [3, 0],
|
250
252
|
node: [12, 17]
|
251
253
|
}),
|
@@ -319,14 +321,14 @@ const resolve = browsers => {
|
|
319
321
|
// ie: Not supported,
|
320
322
|
opera: 42,
|
321
323
|
op_mob: 42,
|
322
|
-
safari:
|
323
|
-
ios_saf:
|
324
|
-
samsung: 6,
|
324
|
+
safari: 11,
|
325
|
+
ios_saf: 11,
|
326
|
+
samsung: [6, 2],
|
325
327
|
android: 55,
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
328
|
+
and_qq: [13, 1],
|
329
|
+
baidu: [13, 18],
|
330
|
+
and_uc: [15, 5],
|
331
|
+
kaios: 3,
|
330
332
|
node: [7, 6]
|
331
333
|
}),
|
332
334
|
browser: browserProperty,
|
package/lib/config/defaults.js
CHANGED
@@ -108,10 +108,10 @@ const DEFINITIONS = {
|
|
108
108
|
class AMDDefineDependency extends NullDependency {
|
109
109
|
/**
|
110
110
|
* @param {Range} range range
|
111
|
-
* @param {Range} arrayRange array range
|
112
|
-
* @param {Range} functionRange function range
|
113
|
-
* @param {Range} objectRange object range
|
114
|
-
* @param {boolean} namedModule true, when define is called with a name
|
111
|
+
* @param {Range | null} arrayRange array range
|
112
|
+
* @param {Range | null} functionRange function range
|
113
|
+
* @param {Range | null} objectRange object range
|
114
|
+
* @param {boolean | null} namedModule true, when define is called with a name
|
115
115
|
*/
|
116
116
|
constructor(range, arrayRange, functionRange, objectRange, namedModule) {
|
117
117
|
super();
|