webpack 5.73.0 → 5.75.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 +16 -12
- package/hot/dev-server.js +17 -4
- package/lib/BannerPlugin.js +1 -1
- package/lib/Compilation.js +4 -1
- package/lib/EvalSourceMapDevToolPlugin.js +7 -3
- package/lib/FileSystemInfo.js +35 -14
- package/lib/NodeStuffPlugin.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/WebpackOptionsApply.js +22 -0
- package/lib/buildChunkGraph.js +2 -1
- package/lib/config/defaults.js +2 -2
- package/lib/config/normalization.js +2 -3
- package/lib/container/ModuleFederationPlugin.js +2 -0
- package/lib/css/CssLoadingRuntimeModule.js +9 -7
- package/lib/css/CssParser.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/ProvidedDependency.js +31 -8
- package/lib/dependencies/WorkerPlugin.js +2 -0
- package/lib/ids/IdHelpers.js +1 -1
- package/lib/index.js +6 -0
- package/lib/javascript/JavascriptParser.js +7 -2
- package/lib/optimize/ConcatenatedModule.js +40 -17
- package/lib/runtime/AsyncModuleRuntimeModule.js +0 -2
- package/lib/runtime/LoadScriptRuntimeModule.js +11 -9
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/wasm-sync/WebAssemblyParser.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +11 -9
- package/package.json +8 -7
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +31 -2
- package/types.d.ts +196 -126
@@ -21,7 +21,7 @@ const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency
|
|
21
21
|
const JavascriptParser = require("../javascript/JavascriptParser");
|
22
22
|
const { equals } = require("../util/ArrayHelpers");
|
23
23
|
const LazySet = require("../util/LazySet");
|
24
|
-
const { concatComparators
|
24
|
+
const { concatComparators } = require("../util/comparators");
|
25
25
|
const createHash = require("../util/createHash");
|
26
26
|
const { makePathsRelative } = require("../util/identifier");
|
27
27
|
const makeSerializable = require("../util/makeSerializable");
|
@@ -185,23 +185,25 @@ const RESERVED_NAMES = new Set(
|
|
185
185
|
.split(",")
|
186
186
|
);
|
187
187
|
|
188
|
-
const
|
189
|
-
|
190
|
-
|
191
|
-
if (isNaN(
|
192
|
-
if (!isNaN(
|
188
|
+
const createComparator = (property, comparator) => (a, b) =>
|
189
|
+
comparator(a[property], b[property]);
|
190
|
+
const compareNumbers = (a, b) => {
|
191
|
+
if (isNaN(a)) {
|
192
|
+
if (!isNaN(b)) {
|
193
193
|
return 1;
|
194
194
|
}
|
195
195
|
} else {
|
196
|
-
if (isNaN(
|
196
|
+
if (isNaN(b)) {
|
197
197
|
return -1;
|
198
198
|
}
|
199
|
-
if (
|
200
|
-
return
|
199
|
+
if (a !== b) {
|
200
|
+
return a < b ? -1 : 1;
|
201
201
|
}
|
202
202
|
}
|
203
203
|
return 0;
|
204
204
|
};
|
205
|
+
const bySourceOrder = createComparator("sourceOrder", compareNumbers);
|
206
|
+
const byRangeStart = createComparator("rangeStart", compareNumbers);
|
205
207
|
|
206
208
|
const joinIterableWithComma = iterable => {
|
207
209
|
// This is more performant than Array.from().join(", ")
|
@@ -885,6 +887,9 @@ class ConcatenatedModule extends Module {
|
|
885
887
|
for (const c of moduleGraph.getOutgoingConnections(this))
|
886
888
|
connections.push(c);
|
887
889
|
}
|
890
|
+
/**
|
891
|
+
* @type {Array<{ connection: ModuleGraphConnection, sourceOrder: number, rangeStart: number }>}
|
892
|
+
*/
|
888
893
|
const references = connections
|
889
894
|
.filter(connection => {
|
890
895
|
if (!(connection.dependency instanceof HarmonyImportDependency))
|
@@ -896,15 +901,33 @@ class ConcatenatedModule extends Module {
|
|
896
901
|
connection.isTargetActive(runtime)
|
897
902
|
);
|
898
903
|
})
|
899
|
-
.map(connection =>
|
900
|
-
|
901
|
-
sourceOrder: /** @type {HarmonyImportDependency} */ (
|
904
|
+
.map(connection => {
|
905
|
+
const dep = /** @type {HarmonyImportDependency} */ (
|
902
906
|
connection.dependency
|
903
|
-
)
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
907
|
+
);
|
908
|
+
return {
|
909
|
+
connection,
|
910
|
+
sourceOrder: dep.sourceOrder,
|
911
|
+
rangeStart: dep.range && dep.range[0]
|
912
|
+
};
|
913
|
+
});
|
914
|
+
/**
|
915
|
+
* bySourceOrder
|
916
|
+
* @example
|
917
|
+
* import a from "a"; // sourceOrder=1
|
918
|
+
* import b from "b"; // sourceOrder=2
|
919
|
+
*
|
920
|
+
* byRangeStart
|
921
|
+
* @example
|
922
|
+
* import {a, b} from "a"; // sourceOrder=1
|
923
|
+
* a.a(); // first range
|
924
|
+
* b.b(); // second range
|
925
|
+
*
|
926
|
+
* If there is no reexport, we have the same source.
|
927
|
+
* If there is reexport, but module has side effects, this will lead to reexport module only.
|
928
|
+
* If there is side-effects-free reexport, we can get simple deterministic result with range start comparison.
|
929
|
+
*/
|
930
|
+
references.sort(concatComparators(bySourceOrder, byRangeStart));
|
908
931
|
/** @type {Map<Module, { connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} */
|
909
932
|
const referencesMap = new Map();
|
910
933
|
for (const { connection } of references) {
|
@@ -74,7 +74,6 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
|
|
74
74
|
`${fn} = ${runtimeTemplate.basicFunction("module, body, hasAwait", [
|
75
75
|
"var queue;",
|
76
76
|
"hasAwait && ((queue = []).d = 1);",
|
77
|
-
"if(queue) queue.moduleId = module.id;",
|
78
77
|
"var depQueues = new Set();",
|
79
78
|
"var exports = module.exports;",
|
80
79
|
"var currentDeps;",
|
@@ -89,7 +88,6 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
|
|
89
88
|
`queue && fn(queue), depQueues.forEach(fn), promise["catch"](${runtimeTemplate.emptyFunction()})`,
|
90
89
|
"fn"
|
91
90
|
)};`,
|
92
|
-
"promise.moduleId = module.id;",
|
93
91
|
"module.exports = promise;",
|
94
92
|
`body(${runtimeTemplate.basicFunction("deps", [
|
95
93
|
"currentDeps = wrapDeps(deps);",
|
@@ -87,13 +87,15 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
|
|
87
87
|
: "url"
|
88
88
|
};`,
|
89
89
|
crossOriginLoading
|
90
|
-
?
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
90
|
+
? crossOriginLoading === "use-credentials"
|
91
|
+
? 'script.crossOrigin = "use-credentials";'
|
92
|
+
: Template.asString([
|
93
|
+
"if (script.src.indexOf(window.location.origin + '/') !== 0) {",
|
94
|
+
Template.indent(
|
95
|
+
`script.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
|
96
|
+
),
|
97
|
+
"}"
|
98
|
+
])
|
97
99
|
: ""
|
98
100
|
]);
|
99
101
|
|
@@ -144,8 +146,8 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
|
|
144
146
|
)});`,
|
145
147
|
"if(prev) return prev(event);"
|
146
148
|
])
|
147
|
-
)
|
148
|
-
|
149
|
+
) +
|
150
|
+
";",
|
149
151
|
`var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), ${loadTimeout});`,
|
150
152
|
"script.onerror = onScriptComplete.bind(null, script.onerror);",
|
151
153
|
"script.onload = onScriptComplete.bind(null, script.onload);",
|
@@ -1153,7 +1153,7 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
1153
1153
|
chunkOrigin: items => "> " + joinOneLine(items),
|
1154
1154
|
"errors[].error": joinError(true),
|
1155
1155
|
"warnings[].error": joinError(false),
|
1156
|
-
loggingGroup: items => joinExplicitNewLine(items, "").
|
1156
|
+
loggingGroup: items => joinExplicitNewLine(items, "").trimEnd(),
|
1157
1157
|
moduleTraceItem: items => " @ " + joinOneLine(items),
|
1158
1158
|
moduleTraceDependency: joinOneLine
|
1159
1159
|
};
|
@@ -17,7 +17,7 @@ const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDe
|
|
17
17
|
/** @typedef {import("../Parser").ParserState} ParserState */
|
18
18
|
/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */
|
19
19
|
|
20
|
-
const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]);
|
20
|
+
const JS_COMPAT_TYPES = new Set(["i32", "i64", "f32", "f64"]);
|
21
21
|
|
22
22
|
/**
|
23
23
|
* @param {t.Signature} signature the func signature
|
@@ -263,15 +263,17 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
263
263
|
'link.as = "script";',
|
264
264
|
`link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`,
|
265
265
|
crossOriginLoading
|
266
|
-
?
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
266
|
+
? crossOriginLoading === "use-credentials"
|
267
|
+
? 'link.crossOrigin = "use-credentials";'
|
268
|
+
: Template.asString([
|
269
|
+
"if (link.href.indexOf(window.location.origin + '/') !== 0) {",
|
270
|
+
Template.indent(
|
271
|
+
`link.crossOrigin = ${JSON.stringify(
|
272
|
+
crossOriginLoading
|
273
|
+
)};`
|
274
|
+
),
|
275
|
+
"}"
|
276
|
+
])
|
275
277
|
: ""
|
276
278
|
]),
|
277
279
|
chunk
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.75.0",
|
4
4
|
"author": "Tobias Koppers @sokra",
|
5
5
|
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
6
6
|
"license": "MIT",
|
@@ -10,11 +10,11 @@
|
|
10
10
|
"@webassemblyjs/ast": "1.11.1",
|
11
11
|
"@webassemblyjs/wasm-edit": "1.11.1",
|
12
12
|
"@webassemblyjs/wasm-parser": "1.11.1",
|
13
|
-
"acorn": "^8.
|
13
|
+
"acorn": "^8.7.1",
|
14
14
|
"acorn-import-assertions": "^1.7.6",
|
15
15
|
"browserslist": "^4.14.5",
|
16
16
|
"chrome-trace-event": "^1.0.2",
|
17
|
-
"enhanced-resolve": "^5.
|
17
|
+
"enhanced-resolve": "^5.10.0",
|
18
18
|
"es-module-lexer": "^0.9.0",
|
19
19
|
"eslint-scope": "5.1.1",
|
20
20
|
"events": "^3.2.0",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"schema-utils": "^3.1.0",
|
28
28
|
"tapable": "^2.1.1",
|
29
29
|
"terser-webpack-plugin": "^5.1.3",
|
30
|
-
"watchpack": "^2.
|
30
|
+
"watchpack": "^2.4.0",
|
31
31
|
"webpack-sources": "^3.2.3"
|
32
32
|
},
|
33
33
|
"peerDependenciesMeta": {
|
@@ -84,7 +84,7 @@
|
|
84
84
|
"mini-svg-data-uri": "^1.2.3",
|
85
85
|
"nyc": "^15.1.0",
|
86
86
|
"open-cli": "^6.0.1",
|
87
|
-
"prettier": "^2.
|
87
|
+
"prettier": "^2.7.1",
|
88
88
|
"pretty-format": "^27.0.2",
|
89
89
|
"pug": "^3.0.0",
|
90
90
|
"pug-loader": "^2.4.0",
|
@@ -98,9 +98,9 @@
|
|
98
98
|
"style-loader": "^2.0.0",
|
99
99
|
"terser": "^5.7.0",
|
100
100
|
"toml": "^3.0.0",
|
101
|
-
"tooling": "webpack/tooling#v1.
|
101
|
+
"tooling": "webpack/tooling#v1.22.0",
|
102
102
|
"ts-loader": "^8.0.2",
|
103
|
-
"typescript": "^4.
|
103
|
+
"typescript": "^4.8.4",
|
104
104
|
"url-loader": "^4.1.0",
|
105
105
|
"wast-loader": "^1.11.0",
|
106
106
|
"webassembly-feature": "1.3.0",
|
@@ -121,6 +121,7 @@
|
|
121
121
|
"url": "https://opencollective.com/webpack"
|
122
122
|
},
|
123
123
|
"homepage": "https://github.com/webpack/webpack",
|
124
|
+
"bugs": "https://github.com/webpack/webpack/issues",
|
124
125
|
"main": "lib/index.js",
|
125
126
|
"bin": {
|
126
127
|
"webpack": "bin/webpack.js"
|