webpack 5.68.0 → 5.70.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/lib/BannerPlugin.js +10 -4
- package/lib/ChunkGraph.js +1 -2
- package/lib/CleanPlugin.js +64 -18
- package/lib/Compilation.js +43 -17
- package/lib/ContextModule.js +90 -26
- package/lib/ContextModuleFactory.js +65 -21
- package/lib/EntryOptionPlugin.js +1 -0
- package/lib/ExportsInfo.js +4 -4
- package/lib/Generator.js +1 -0
- package/lib/ModuleHashingError.js +29 -0
- package/lib/NodeStuffPlugin.js +10 -0
- package/lib/NormalModule.js +21 -16
- package/lib/NormalModuleFactory.js +40 -35
- package/lib/ProgressPlugin.js +4 -5
- package/lib/RuntimeTemplate.js +1 -0
- package/lib/TemplatedPathPlugin.js +48 -23
- package/lib/WebpackOptionsApply.js +2 -0
- package/lib/asset/AssetGenerator.js +122 -33
- package/lib/buildChunkGraph.js +1 -1
- package/lib/cache/ResolverCachePlugin.js +89 -28
- package/lib/config/browserslistTargetHandler.js +3 -5
- package/lib/config/defaults.js +7 -2
- package/lib/config/normalization.js +1 -0
- package/lib/css/CssLoadingRuntimeModule.js +63 -70
- package/lib/css/CssModulesPlugin.js +2 -1
- package/lib/debug/ProfilingPlugin.js +3 -4
- package/lib/dependencies/ContextDependencyHelpers.js +1 -1
- package/lib/dependencies/ContextElementDependency.js +8 -2
- package/lib/dependencies/ExportsInfoDependency.js +6 -0
- package/lib/dependencies/HarmonyAcceptImportDependency.js +5 -3
- package/lib/dependencies/HarmonyExportInitFragment.js +4 -1
- package/lib/dependencies/ImportContextDependency.js +0 -2
- package/lib/dependencies/ImportMetaContextDependency.js +35 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +252 -0
- package/lib/dependencies/ImportMetaContextPlugin.js +59 -0
- package/lib/dependencies/LoaderPlugin.js +2 -0
- package/lib/dependencies/RequireContextDependency.js +0 -16
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +24 -8
- package/lib/index.js +5 -0
- package/lib/javascript/JavascriptModulesPlugin.js +27 -2
- package/lib/javascript/StartupHelpers.js +3 -2
- package/lib/library/AssignLibraryPlugin.js +8 -2
- package/lib/node/NodeTargetPlugin.js +1 -0
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +22 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +22 -7
- package/lib/optimize/ConcatenatedModule.js +10 -4
- package/lib/schemes/HttpUriPlugin.js +68 -6
- package/lib/serialization/FileMiddleware.js +44 -9
- package/lib/util/compileBooleanMatcher.js +1 -1
- package/lib/util/deterministicGrouping.js +1 -1
- package/lib/util/identifier.js +65 -44
- package/lib/util/internalSerializables.js +2 -0
- package/lib/util/nonNumericOnlyHash.js +22 -0
- package/lib/util/semver.js +17 -10
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +15 -5
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +30 -20
- package/module.d.ts +15 -0
- package/package.json +13 -13
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +17 -1
- package/schemas/plugins/schemes/HttpUriPlugin.check.js +1 -1
- package/schemas/plugins/schemes/HttpUriPlugin.json +4 -0
- package/types.d.ts +203 -91
@@ -51,6 +51,20 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
51
51
|
this._runtimeRequirements = runtimeRequirements;
|
52
52
|
}
|
53
53
|
|
54
|
+
/**
|
55
|
+
* @private
|
56
|
+
* @param {Chunk} chunk chunk
|
57
|
+
* @returns {string} generated code
|
58
|
+
*/
|
59
|
+
_generateBaseUri(chunk) {
|
60
|
+
const options = chunk.getEntryOptions();
|
61
|
+
if (options && options.baseUri) {
|
62
|
+
return `${RuntimeGlobals.baseURI} = ${JSON.stringify(options.baseUri)};`;
|
63
|
+
} else {
|
64
|
+
return `${RuntimeGlobals.baseURI} = document.baseURI || self.location.href;`;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
54
68
|
/**
|
55
69
|
* @returns {string} runtime code
|
56
70
|
*/
|
@@ -103,11 +117,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
103
117
|
: undefined;
|
104
118
|
|
105
119
|
return Template.asString([
|
106
|
-
withBaseURI
|
107
|
-
? Template.asString([
|
108
|
-
`${RuntimeGlobals.baseURI} = document.baseURI || self.location.href;`
|
109
|
-
])
|
110
|
-
: "// no baseURI",
|
120
|
+
withBaseURI ? this._generateBaseUri(chunk) : "// no baseURI",
|
111
121
|
"",
|
112
122
|
"// object to store loaded and loading chunks",
|
113
123
|
"// undefined = chunk not loaded, null = chunk preloaded/prefetched",
|
@@ -15,6 +15,8 @@ const { getInitialChunkIds } = require("../javascript/StartupHelpers");
|
|
15
15
|
const compileBooleanMatcher = require("../util/compileBooleanMatcher");
|
16
16
|
const { getUndoPath } = require("../util/identifier");
|
17
17
|
|
18
|
+
/** @typedef {import("../Chunk")} Chunk */
|
19
|
+
|
18
20
|
class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
19
21
|
constructor(runtimeRequirements, withCreateScriptUrl) {
|
20
22
|
super("importScripts chunk loading", RuntimeModule.STAGE_ATTACH);
|
@@ -22,6 +24,33 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|
22
24
|
this._withCreateScriptUrl = withCreateScriptUrl;
|
23
25
|
}
|
24
26
|
|
27
|
+
/**
|
28
|
+
* @private
|
29
|
+
* @param {Chunk} chunk chunk
|
30
|
+
* @returns {string} generated code
|
31
|
+
*/
|
32
|
+
_generateBaseUri(chunk) {
|
33
|
+
const options = chunk.getEntryOptions();
|
34
|
+
if (options && options.baseUri) {
|
35
|
+
return `${RuntimeGlobals.baseURI} = ${JSON.stringify(options.baseUri)};`;
|
36
|
+
}
|
37
|
+
const outputName = this.compilation.getPath(
|
38
|
+
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
|
39
|
+
{
|
40
|
+
chunk,
|
41
|
+
contentHashType: "javascript"
|
42
|
+
}
|
43
|
+
);
|
44
|
+
const rootOutputDir = getUndoPath(
|
45
|
+
outputName,
|
46
|
+
this.compilation.outputOptions.path,
|
47
|
+
false
|
48
|
+
);
|
49
|
+
return `${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify(
|
50
|
+
rootOutputDir ? "/../" + rootOutputDir : ""
|
51
|
+
)};`;
|
52
|
+
}
|
53
|
+
|
25
54
|
/**
|
26
55
|
* @returns {string} runtime code
|
27
56
|
*/
|
@@ -55,31 +84,12 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|
55
84
|
);
|
56
85
|
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
|
57
86
|
|
58
|
-
const outputName = this.compilation.getPath(
|
59
|
-
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
|
60
|
-
{
|
61
|
-
chunk,
|
62
|
-
contentHashType: "javascript"
|
63
|
-
}
|
64
|
-
);
|
65
|
-
const rootOutputDir = getUndoPath(
|
66
|
-
outputName,
|
67
|
-
this.compilation.outputOptions.path,
|
68
|
-
false
|
69
|
-
);
|
70
|
-
|
71
87
|
const stateExpression = withHmr
|
72
88
|
? `${RuntimeGlobals.hmrRuntimeStatePrefix}_importScripts`
|
73
89
|
: undefined;
|
74
90
|
|
75
91
|
return Template.asString([
|
76
|
-
withBaseURI
|
77
|
-
? Template.asString([
|
78
|
-
`${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify(
|
79
|
-
rootOutputDir ? "/../" + rootOutputDir : ""
|
80
|
-
)};`
|
81
|
-
])
|
82
|
-
: "// no baseURI",
|
92
|
+
withBaseURI ? this._generateBaseUri(chunk) : "// no baseURI",
|
83
93
|
"",
|
84
94
|
"// object to store loaded chunks",
|
85
95
|
'// "1" means "already loaded"',
|
package/module.d.ts
CHANGED
@@ -129,6 +129,7 @@ declare namespace webpack {
|
|
129
129
|
used: boolean;
|
130
130
|
provideInfo: boolean | null | undefined;
|
131
131
|
useInfo: boolean | null | undefined;
|
132
|
+
canMangle: boolean;
|
132
133
|
}
|
133
134
|
|
134
135
|
interface ExportsInfo {
|
@@ -147,6 +148,20 @@ interface ImportMeta {
|
|
147
148
|
url: string;
|
148
149
|
webpack: number;
|
149
150
|
webpackHot: webpack.Hot;
|
151
|
+
webpackContext: (
|
152
|
+
request: string,
|
153
|
+
options?: {
|
154
|
+
recursive?: boolean;
|
155
|
+
regExp?: RegExp;
|
156
|
+
include?: RegExp;
|
157
|
+
exclude?: RegExp;
|
158
|
+
preload?: boolean | number;
|
159
|
+
prefetch?: boolean | number;
|
160
|
+
chunkName?: string;
|
161
|
+
exports?: string | string[][];
|
162
|
+
mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once";
|
163
|
+
}
|
164
|
+
) => webpack.Context;
|
150
165
|
}
|
151
166
|
|
152
167
|
declare const __resourceQuery: string;
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.70.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",
|
7
7
|
"dependencies": {
|
8
|
-
"@types/eslint-scope": "^3.7.
|
9
|
-
"@types/estree": "^0.0.
|
8
|
+
"@types/eslint-scope": "^3.7.3",
|
9
|
+
"@types/estree": "^0.0.51",
|
10
10
|
"@webassemblyjs/ast": "1.11.1",
|
11
11
|
"@webassemblyjs/wasm-edit": "1.11.1",
|
12
12
|
"@webassemblyjs/wasm-parser": "1.11.1",
|
@@ -14,7 +14,7 @@
|
|
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.9.2",
|
18
18
|
"es-module-lexer": "^0.9.0",
|
19
19
|
"eslint-scope": "5.1.1",
|
20
20
|
"events": "^3.2.0",
|
@@ -39,8 +39,8 @@
|
|
39
39
|
"@babel/core": "^7.11.1",
|
40
40
|
"@babel/preset-react": "^7.10.4",
|
41
41
|
"@types/es-module-lexer": "^0.4.1",
|
42
|
-
"@types/jest": "^27.0
|
43
|
-
"@types/node": "^
|
42
|
+
"@types/jest": "^27.4.0",
|
43
|
+
"@types/node": "^17.0.16",
|
44
44
|
"assemblyscript": "^0.19.16",
|
45
45
|
"babel-loader": "^8.1.0",
|
46
46
|
"benchmark": "^2.1.4",
|
@@ -56,7 +56,7 @@
|
|
56
56
|
"es6-promise-polyfill": "^1.2.0",
|
57
57
|
"eslint": "^7.14.0",
|
58
58
|
"eslint-config-prettier": "^8.1.0",
|
59
|
-
"eslint-plugin-jest": "^24.
|
59
|
+
"eslint-plugin-jest": "^24.7.0",
|
60
60
|
"eslint-plugin-jsdoc": "^33.0.0",
|
61
61
|
"eslint-plugin-node": "^11.0.0",
|
62
62
|
"eslint-plugin-prettier": "^4.0.0",
|
@@ -66,10 +66,10 @@
|
|
66
66
|
"husky": "^6.0.0",
|
67
67
|
"is-ci": "^3.0.0",
|
68
68
|
"istanbul": "^0.4.5",
|
69
|
-
"jest": "^27.
|
70
|
-
"jest-circus": "^27.
|
71
|
-
"jest-cli": "^27.
|
72
|
-
"jest-diff": "^27.
|
69
|
+
"jest": "^27.5.0",
|
70
|
+
"jest-circus": "^27.5.0",
|
71
|
+
"jest-cli": "^27.5.0",
|
72
|
+
"jest-diff": "^27.5.0",
|
73
73
|
"jest-junit": "^13.0.0",
|
74
74
|
"json-loader": "^0.5.7",
|
75
75
|
"json5": "^2.1.3",
|
@@ -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.21.0",
|
102
102
|
"ts-loader": "^8.0.2",
|
103
|
-
"typescript": "^4.
|
103
|
+
"typescript": "^4.5.5",
|
104
104
|
"url-loader": "^4.1.0",
|
105
105
|
"wast-loader": "^1.11.0",
|
106
106
|
"webassembly-feature": "1.3.0",
|