webpack 5.88.2 → 5.90.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 +3 -0
- package/bin/webpack.js +1 -3
- package/hot/log.js +0 -2
- package/lib/APIPlugin.js +1 -1
- package/lib/ChunkGraph.js +1 -1
- package/lib/CleanPlugin.js +12 -12
- package/lib/Compilation.js +25 -16
- package/lib/Compiler.js +13 -0
- package/lib/ConcatenationScope.js +2 -2
- package/lib/ContextModule.js +4 -4
- package/lib/ContextModuleFactory.js +1 -1
- package/lib/DependencyTemplate.js +3 -1
- package/lib/EnvironmentNotSupportAsyncWarning.js +52 -0
- package/lib/EvalDevToolModulePlugin.js +1 -1
- package/lib/EvalSourceMapDevToolPlugin.js +1 -1
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +47 -12
- package/lib/ExternalModuleFactoryPlugin.js +1 -1
- package/lib/FileSystemInfo.js +20 -3
- package/lib/FlagDependencyExportsPlugin.js +1 -1
- package/lib/Generator.js +1 -0
- package/lib/HotModuleReplacementPlugin.js +3 -3
- package/lib/LibManifestPlugin.js +4 -1
- package/lib/Module.js +2 -1
- package/lib/ModuleFilenameHelpers.js +1 -1
- package/lib/ModuleInfoHeaderPlugin.js +1 -1
- package/lib/MultiStats.js +2 -2
- package/lib/NodeStuffPlugin.js +48 -0
- package/lib/NormalModule.js +13 -11
- package/lib/NormalModuleFactory.js +7 -7
- package/lib/RuntimeTemplate.js +15 -11
- package/lib/SourceMapDevToolPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +4 -3
- package/lib/asset/AssetModulesPlugin.js +2 -3
- package/lib/cache/AddManagedPathsPlugin.js +6 -1
- package/lib/cache/IdleFileCachePlugin.js +12 -5
- package/lib/cache/PackFileCacheStrategy.js +3 -3
- package/lib/cache/ResolverCachePlugin.js +2 -2
- package/lib/config/browserslistTargetHandler.js +24 -5
- package/lib/config/defaults.js +87 -52
- package/lib/config/normalization.js +17 -18
- package/lib/config/target.js +5 -0
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/css/CssExportsGenerator.js +14 -1
- package/lib/css/CssGenerator.js +14 -1
- package/lib/css/CssLoadingRuntimeModule.js +23 -23
- package/lib/css/CssModulesPlugin.js +68 -32
- package/lib/css/CssParser.js +8 -3
- package/lib/debug/ProfilingPlugin.js +2 -2
- package/lib/dependencies/CachedConstDependency.js +8 -1
- package/lib/dependencies/CommonJsFullRequireDependency.js +27 -6
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -5
- package/lib/dependencies/ContextElementDependency.js +1 -1
- package/lib/dependencies/ExternalModuleDependency.js +98 -0
- package/lib/dependencies/ExternalModuleInitFragment.js +124 -0
- package/lib/dependencies/HarmonyAcceptDependency.js +1 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +7 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +18 -18
- package/lib/dependencies/HarmonyExportInitFragment.js +4 -4
- package/lib/dependencies/HarmonyImportDependency.js +4 -4
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +6 -6
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +13 -63
- package/lib/dependencies/ImportDependency.js +26 -6
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +2 -1
- package/lib/dependencies/PureExpressionDependency.js +12 -4
- package/lib/dependencies/RequireIncludeDependency.js +1 -1
- package/lib/dependencies/WebpackIsIncludedDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +7 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +6 -6
- package/lib/hmr/HotModuleReplacement.runtime.js +3 -5
- package/lib/hmr/lazyCompilationBackend.js +4 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/index.js +4 -0
- package/lib/javascript/JavascriptGenerator.js +16 -1
- package/lib/javascript/JavascriptModulesPlugin.js +33 -33
- package/lib/javascript/JavascriptParser.js +18 -6
- package/lib/json/JsonGenerator.js +1 -1
- package/lib/library/AmdLibraryPlugin.js +5 -1
- package/lib/library/AssignLibraryPlugin.js +1 -1
- package/lib/library/SystemLibraryPlugin.js +1 -1
- package/lib/library/UmdLibraryPlugin.js +39 -39
- package/lib/logging/createConsoleLogger.js +1 -19
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +8 -8
- package/lib/node/RequireChunkLoadingRuntimeModule.js +8 -8
- package/lib/node/nodeConsole.js +1 -5
- package/lib/optimize/ConcatenatedModule.js +7 -7
- package/lib/optimize/InnerGraphPlugin.js +9 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +123 -47
- package/lib/optimize/SideEffectsFlagPlugin.js +15 -3
- package/lib/optimize/SplitChunksPlugin.js +16 -16
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +2 -2
- package/lib/rules/RuleSetCompiler.js +1 -1
- package/lib/runtime/AutoPublicPathRuntimeModule.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +4 -4
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +4 -4
- package/lib/runtime/LoadScriptRuntimeModule.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +23 -22
- package/lib/runtime/StartupEntrypointRuntimeModule.js +2 -2
- package/lib/schemes/HttpUriPlugin.js +1 -1
- package/lib/serialization/FileMiddleware.js +4 -4
- package/lib/serialization/ObjectMiddleware.js +4 -4
- package/lib/sharing/ConsumeSharedPlugin.js +5 -5
- package/lib/sharing/ConsumeSharedRuntimeModule.js +8 -4
- package/lib/sharing/ProvideSharedModule.js +2 -2
- package/lib/sharing/SharePlugin.js +2 -2
- package/lib/sharing/ShareRuntimeModule.js +1 -1
- package/lib/sharing/utils.js +24 -28
- package/lib/stats/DefaultStatsFactoryPlugin.js +10 -10
- package/lib/stats/DefaultStatsPresetPlugin.js +3 -7
- package/lib/stats/DefaultStatsPrinterPlugin.js +34 -31
- package/lib/util/chainedImports.js +96 -0
- package/lib/util/cleverMerge.js +4 -4
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/identifier.js +2 -2
- package/lib/util/internalSerializables.js +6 -0
- package/lib/util/runtime.js +18 -1
- package/lib/util/semver.js +19 -24
- package/lib/util/smartGrouping.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +2 -2
- package/lib/wasm-async/AsyncWebAssemblyParser.js +6 -0
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +13 -13
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -6
- package/package.json +23 -23
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +140 -32
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssAutoParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssAutoParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoParserOptions.json +3 -0
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssGlobalGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssGlobalParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssGlobalParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssGlobalParserOptions.json +3 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssModuleParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssModuleParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssModuleParserOptions.json +3 -0
- package/schemas/plugins/css/CssParserOptions.check.js +1 -1
- package/types.d.ts +180 -22
@@ -447,7 +447,7 @@ class HotModuleReplacementPlugin {
|
|
447
447
|
: compilation.codeGenerationResults.getHash(
|
448
448
|
module,
|
449
449
|
chunk.runtime
|
450
|
-
|
450
|
+
);
|
451
451
|
if (records.chunkModuleHashes[key] !== hash) {
|
452
452
|
updatedModules.add(module, chunk);
|
453
453
|
}
|
@@ -571,7 +571,7 @@ class HotModuleReplacementPlugin {
|
|
571
571
|
: compilation.codeGenerationResults.getHash(
|
572
572
|
module,
|
573
573
|
newRuntime
|
574
|
-
|
574
|
+
);
|
575
575
|
if (hash !== oldHash) {
|
576
576
|
if (module.type === WEBPACK_MODULE_TYPE_RUNTIME) {
|
577
577
|
newRuntimeModules = newRuntimeModules || [];
|
@@ -735,7 +735,7 @@ To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename
|
|
735
735
|
Array.from(removedModules, m =>
|
736
736
|
chunkGraph.getModuleId(m)
|
737
737
|
)
|
738
|
-
|
738
|
+
)
|
739
739
|
};
|
740
740
|
|
741
741
|
const source = new RawSource(JSON.stringify(hotUpdateMainJson));
|
package/lib/LibManifestPlugin.js
CHANGED
@@ -46,7 +46,10 @@ class LibManifestPlugin {
|
|
46
46
|
*/
|
47
47
|
apply(compiler) {
|
48
48
|
compiler.hooks.emit.tapAsync(
|
49
|
-
|
49
|
+
{
|
50
|
+
name: "LibManifestPlugin",
|
51
|
+
stage: 110
|
52
|
+
},
|
50
53
|
(compilation, callback) => {
|
51
54
|
const moduleGraph = compilation.moduleGraph;
|
52
55
|
asyncLib.forEach(
|
package/lib/Module.js
CHANGED
@@ -59,7 +59,8 @@ const makeSerializable = require("./util/makeSerializable");
|
|
59
59
|
* @property {RuntimeTemplate} runtimeTemplate the runtime template
|
60
60
|
* @property {ModuleGraph} moduleGraph the module graph
|
61
61
|
* @property {ChunkGraph} chunkGraph the chunk graph
|
62
|
-
* @property {RuntimeSpec} runtime the
|
62
|
+
* @property {RuntimeSpec} runtime the runtime code should be generated for
|
63
|
+
* @property {RuntimeSpec[]} [runtimes] the runtimes code should be generated for
|
63
64
|
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules
|
64
65
|
* @property {CodeGenerationResults} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)
|
65
66
|
* @property {Compilation=} compilation the compilation
|
package/lib/MultiStats.js
CHANGED
package/lib/NodeStuffPlugin.js
CHANGED
@@ -13,6 +13,7 @@ const NodeStuffInWebError = require("./NodeStuffInWebError");
|
|
13
13
|
const RuntimeGlobals = require("./RuntimeGlobals");
|
14
14
|
const CachedConstDependency = require("./dependencies/CachedConstDependency");
|
15
15
|
const ConstDependency = require("./dependencies/ConstDependency");
|
16
|
+
const ExternalModuleDependency = require("./dependencies/ExternalModuleDependency");
|
16
17
|
const {
|
17
18
|
evaluateToString,
|
18
19
|
expressionIsUnsupported
|
@@ -52,6 +53,11 @@ class NodeStuffPlugin {
|
|
52
53
|
compiler.hooks.compilation.tap(
|
53
54
|
PLUGIN_NAME,
|
54
55
|
(compilation, { normalModuleFactory }) => {
|
56
|
+
compilation.dependencyTemplates.set(
|
57
|
+
ExternalModuleDependency,
|
58
|
+
new ExternalModuleDependency.Template()
|
59
|
+
);
|
60
|
+
|
55
61
|
/**
|
56
62
|
* @param {JavascriptParser} parser the parser
|
57
63
|
* @param {JavascriptParserOptions} parserOptions options
|
@@ -128,6 +134,35 @@ class NodeStuffPlugin {
|
|
128
134
|
});
|
129
135
|
};
|
130
136
|
|
137
|
+
/**
|
138
|
+
* @param {string} expressionName expression name
|
139
|
+
* @param {(value: string) => void} fn function
|
140
|
+
* @returns {void}
|
141
|
+
*/
|
142
|
+
const setUrlModuleConstant = (expressionName, fn) => {
|
143
|
+
parser.hooks.expression
|
144
|
+
.for(expressionName)
|
145
|
+
.tap(PLUGIN_NAME, expr => {
|
146
|
+
const dep = new ExternalModuleDependency(
|
147
|
+
"url",
|
148
|
+
[
|
149
|
+
{
|
150
|
+
name: "fileURLToPath",
|
151
|
+
value: "__webpack_fileURLToPath__"
|
152
|
+
}
|
153
|
+
],
|
154
|
+
undefined,
|
155
|
+
fn("__webpack_fileURLToPath__"),
|
156
|
+
expr.range,
|
157
|
+
expressionName
|
158
|
+
);
|
159
|
+
dep.loc = expr.loc;
|
160
|
+
parser.state.module.addPresentationalDependency(dep);
|
161
|
+
|
162
|
+
return true;
|
163
|
+
});
|
164
|
+
};
|
165
|
+
|
131
166
|
/**
|
132
167
|
* @param {string} expressionName expression name
|
133
168
|
* @param {string} value value
|
@@ -150,6 +185,12 @@ class NodeStuffPlugin {
|
|
150
185
|
"__filename is a Node.js feature and isn't available in browsers."
|
151
186
|
);
|
152
187
|
break;
|
188
|
+
case "node-module":
|
189
|
+
setUrlModuleConstant(
|
190
|
+
"__filename",
|
191
|
+
functionName => `${functionName}(import.meta.url)`
|
192
|
+
);
|
193
|
+
break;
|
153
194
|
case true:
|
154
195
|
setModuleConstant("__filename", module =>
|
155
196
|
relative(compiler.inputFileSystem, context, module.resource)
|
@@ -177,6 +218,13 @@ class NodeStuffPlugin {
|
|
177
218
|
"__dirname is a Node.js feature and isn't available in browsers."
|
178
219
|
);
|
179
220
|
break;
|
221
|
+
case "node-module":
|
222
|
+
setUrlModuleConstant(
|
223
|
+
"__dirname",
|
224
|
+
functionName =>
|
225
|
+
`${functionName}(import.meta.url + "/..").slice(0, -1)`
|
226
|
+
);
|
227
|
+
break;
|
180
228
|
case true:
|
181
229
|
setModuleConstant("__dirname", module =>
|
182
230
|
relative(compiler.inputFileSystem, context, module.context)
|
package/lib/NormalModule.js
CHANGED
@@ -132,14 +132,14 @@ const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
|
|
132
132
|
const mapper = !sourceRoot
|
133
133
|
? source => source
|
134
134
|
: sourceRoot.endsWith("/")
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
135
|
+
? source =>
|
136
|
+
source.startsWith("/")
|
137
|
+
? `${sourceRoot.slice(0, -1)}${source}`
|
138
|
+
: `${sourceRoot}${source}`
|
139
|
+
: source =>
|
140
|
+
source.startsWith("/")
|
141
|
+
? `${sourceRoot}${source}`
|
142
|
+
: `${sourceRoot}/${source}`;
|
143
143
|
const newSources = sourceMap.sources.map(source =>
|
144
144
|
contextifySourceUrl(context, mapper(source), associatedObjectForCache)
|
145
145
|
);
|
@@ -782,7 +782,7 @@ class NormalModule extends Module {
|
|
782
782
|
currentLoader
|
783
783
|
? compilation.runtimeTemplate.requestShortener.shorten(
|
784
784
|
currentLoader.loader
|
785
|
-
|
785
|
+
)
|
786
786
|
: "unknown"
|
787
787
|
}) didn't return a Buffer or String`
|
788
788
|
);
|
@@ -1181,6 +1181,7 @@ class NormalModule extends Module {
|
|
1181
1181
|
moduleGraph,
|
1182
1182
|
chunkGraph,
|
1183
1183
|
runtime,
|
1184
|
+
runtimes,
|
1184
1185
|
concatenationScope,
|
1185
1186
|
codeGenerationResults,
|
1186
1187
|
sourceTypes
|
@@ -1204,7 +1205,7 @@ class NormalModule extends Module {
|
|
1204
1205
|
const source = this.error
|
1205
1206
|
? new RawSource(
|
1206
1207
|
"throw new Error(" + JSON.stringify(this.error.message) + ");"
|
1207
|
-
|
1208
|
+
)
|
1208
1209
|
: this.generator.generate(this, {
|
1209
1210
|
dependencyTemplates,
|
1210
1211
|
runtimeTemplate,
|
@@ -1212,11 +1213,12 @@ class NormalModule extends Module {
|
|
1212
1213
|
chunkGraph,
|
1213
1214
|
runtimeRequirements,
|
1214
1215
|
runtime,
|
1216
|
+
runtimes,
|
1215
1217
|
concatenationScope,
|
1216
1218
|
codeGenerationResults,
|
1217
1219
|
getData,
|
1218
1220
|
type
|
1219
|
-
|
1221
|
+
});
|
1220
1222
|
|
1221
1223
|
if (source) {
|
1222
1224
|
sources.set(type, new CachedSource(source));
|
@@ -411,8 +411,8 @@ class NormalModuleFactory extends ModuleFactory {
|
|
411
411
|
noPreAutoLoaders || noPrePostAutoLoaders
|
412
412
|
? 2
|
413
413
|
: noAutoLoaders
|
414
|
-
|
415
|
-
|
414
|
+
? 1
|
415
|
+
: 0
|
416
416
|
)
|
417
417
|
.split(/!+/);
|
418
418
|
unresolvedResource = rawElements.pop();
|
@@ -676,7 +676,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|
676
676
|
resolveOptions || EMPTY_RESOLVE_OPTIONS,
|
677
677
|
"dependencyType",
|
678
678
|
dependencyType
|
679
|
-
|
679
|
+
)
|
680
680
|
: resolveOptions
|
681
681
|
);
|
682
682
|
this.resolveResource(
|
@@ -1063,10 +1063,10 @@ If changing the source code is not an option there is also a resolve options cal
|
|
1063
1063
|
const type = /\.mjs$/i.test(parsedResult.path)
|
1064
1064
|
? "module"
|
1065
1065
|
: /\.cjs$/i.test(parsedResult.path)
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1066
|
+
? "commonjs"
|
1067
|
+
: resolveRequest.descriptionFileData === undefined
|
1068
|
+
? undefined
|
1069
|
+
: resolveRequest.descriptionFileData.type;
|
1070
1070
|
|
1071
1071
|
const resolved = {
|
1072
1072
|
loader: parsedResult.path,
|
package/lib/RuntimeTemplate.js
CHANGED
@@ -102,6 +102,10 @@ class RuntimeTemplate {
|
|
102
102
|
return this.outputOptions.environment.arrowFunction;
|
103
103
|
}
|
104
104
|
|
105
|
+
supportsAsyncFunction() {
|
106
|
+
return this.outputOptions.environment.asyncFunction;
|
107
|
+
}
|
108
|
+
|
105
109
|
supportsOptionalChaining() {
|
106
110
|
return this.outputOptions.environment.optionalChaining;
|
107
111
|
}
|
@@ -222,7 +226,7 @@ class RuntimeTemplate {
|
|
222
226
|
? `var [${items.join(", ")}] = ${value};`
|
223
227
|
: Template.asString(
|
224
228
|
items.map((item, i) => `var ${item} = ${value}[${i}];`)
|
225
|
-
|
229
|
+
);
|
226
230
|
}
|
227
231
|
|
228
232
|
destructureObject(items, value) {
|
@@ -230,7 +234,7 @@ class RuntimeTemplate {
|
|
230
234
|
? `var {${items.join(", ")}} = ${value};`
|
231
235
|
: Template.asString(
|
232
236
|
items.map(item => `var ${item} = ${value}${propertyAccess([item])};`)
|
233
|
-
|
237
|
+
);
|
234
238
|
}
|
235
239
|
|
236
240
|
iife(args, body) {
|
@@ -242,7 +246,7 @@ class RuntimeTemplate {
|
|
242
246
|
? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}`
|
243
247
|
: `${array}.forEach(function(${variable}) {\n${Template.indent(
|
244
248
|
body
|
245
|
-
|
249
|
+
)}\n});`;
|
246
250
|
}
|
247
251
|
|
248
252
|
/**
|
@@ -343,10 +347,10 @@ class RuntimeTemplate {
|
|
343
347
|
moduleId === null
|
344
348
|
? JSON.stringify("Module is not available (weak dependency)")
|
345
349
|
: idExpr
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
+
? `"Module '" + ${idExpr} + "' is not available (weak dependency)"`
|
351
|
+
: JSON.stringify(
|
352
|
+
`Module '${moduleId}' is not available (weak dependency)`
|
353
|
+
);
|
350
354
|
const comment = request ? Template.toNormalComment(request) + " " : "";
|
351
355
|
const errorStatements =
|
352
356
|
`var e = new Error(${errorMessage}); ` +
|
@@ -840,8 +844,8 @@ class RuntimeTemplate {
|
|
840
844
|
return asiSafe
|
841
845
|
? `(${importVar}_default()${propertyAccess(exportName, 1)})`
|
842
846
|
: asiSafe === false
|
843
|
-
|
844
|
-
|
847
|
+
? `;(${importVar}_default()${propertyAccess(exportName, 1)})`
|
848
|
+
: `${importVar}_default.a${propertyAccess(exportName, 1)}`;
|
845
849
|
}
|
846
850
|
case "default-only":
|
847
851
|
case "default-with-named":
|
@@ -898,8 +902,8 @@ class RuntimeTemplate {
|
|
898
902
|
return asiSafe
|
899
903
|
? `(0,${access})`
|
900
904
|
: asiSafe === false
|
901
|
-
|
902
|
-
|
905
|
+
? `;(0,${access})`
|
906
|
+
: `/*#__PURE__*/Object(${access})`;
|
903
907
|
}
|
904
908
|
return access;
|
905
909
|
} else {
|
@@ -486,7 +486,7 @@ class SourceMapDevToolPlugin {
|
|
486
486
|
outputFs,
|
487
487
|
`/${options.fileContext}`,
|
488
488
|
`/${filename}`
|
489
|
-
|
489
|
+
)
|
490
490
|
: filename,
|
491
491
|
contentHash: sourceMapContentHash
|
492
492
|
};
|
@@ -501,7 +501,7 @@ class SourceMapDevToolPlugin {
|
|
501
501
|
outputFs,
|
502
502
|
dirname(outputFs, `/${file}`),
|
503
503
|
`/${sourceMapFile}`
|
504
|
-
|
504
|
+
);
|
505
505
|
/** @type {Source} */
|
506
506
|
let asset = new RawSource(source);
|
507
507
|
if (currentSourceMappingURLComment !== false) {
|
@@ -307,7 +307,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
307
307
|
|
308
308
|
if (options.experiments.css) {
|
309
309
|
const CssModulesPlugin = require("./css/CssModulesPlugin");
|
310
|
-
new CssModulesPlugin(
|
310
|
+
new CssModulesPlugin().apply(compiler);
|
311
311
|
}
|
312
312
|
|
313
313
|
if (options.experiments.lazyCompilation) {
|
@@ -329,7 +329,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
329
329
|
options.externalsPresets.node ? "node" : "web"
|
330
330
|
}.js`
|
331
331
|
)
|
332
|
-
|
332
|
+
}),
|
333
333
|
entries: !lazyOptions || lazyOptions.entries !== false,
|
334
334
|
imports: !lazyOptions || lazyOptions.imports !== false,
|
335
335
|
test: (lazyOptions && lazyOptions.test) || undefined
|
@@ -588,7 +588,8 @@ class WebpackOptionsApply extends OptionsApply {
|
|
588
588
|
const AddManagedPathsPlugin = require("./cache/AddManagedPathsPlugin");
|
589
589
|
new AddManagedPathsPlugin(
|
590
590
|
options.snapshot.managedPaths,
|
591
|
-
options.snapshot.immutablePaths
|
591
|
+
options.snapshot.immutablePaths,
|
592
|
+
options.snapshot.unmanagedPaths
|
592
593
|
).apply(compiler);
|
593
594
|
|
594
595
|
if (options.cache && typeof options.cache === "object") {
|
@@ -208,9 +208,8 @@ class AssetModulesPlugin {
|
|
208
208
|
codeGenResult.data.get("fullContentHash")
|
209
209
|
});
|
210
210
|
} catch (e) {
|
211
|
-
/** @type {Error} */ (
|
212
|
-
|
213
|
-
).message += `\nduring rendering of asset ${module.identifier()}`;
|
211
|
+
/** @type {Error} */ (e).message +=
|
212
|
+
`\nduring rendering of asset ${module.identifier()}`;
|
214
213
|
throw e;
|
215
214
|
}
|
216
215
|
}
|
@@ -11,10 +11,12 @@ class AddManagedPathsPlugin {
|
|
11
11
|
/**
|
12
12
|
* @param {Iterable<string | RegExp>} managedPaths list of managed paths
|
13
13
|
* @param {Iterable<string | RegExp>} immutablePaths list of immutable paths
|
14
|
+
* @param {Iterable<string | RegExp>} unmanagedPaths list of unmanaged paths
|
14
15
|
*/
|
15
|
-
constructor(managedPaths, immutablePaths) {
|
16
|
+
constructor(managedPaths, immutablePaths, unmanagedPaths) {
|
16
17
|
this.managedPaths = new Set(managedPaths);
|
17
18
|
this.immutablePaths = new Set(immutablePaths);
|
19
|
+
this.unmanagedPaths = new Set(unmanagedPaths);
|
18
20
|
}
|
19
21
|
|
20
22
|
/**
|
@@ -29,6 +31,9 @@ class AddManagedPathsPlugin {
|
|
29
31
|
for (const immutablePath of this.immutablePaths) {
|
30
32
|
compiler.immutablePaths.add(immutablePath);
|
31
33
|
}
|
34
|
+
for (const unmanagedPath of this.unmanagedPaths) {
|
35
|
+
compiler.unmanagedPaths.add(unmanagedPath);
|
36
|
+
}
|
32
37
|
}
|
33
38
|
}
|
34
39
|
|
@@ -199,11 +199,18 @@ class IdleFileCachePlugin {
|
|
199
199
|
}s.`
|
200
200
|
);
|
201
201
|
}
|
202
|
-
idleTimer = setTimeout(
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
202
|
+
idleTimer = setTimeout(
|
203
|
+
() => {
|
204
|
+
idleTimer = undefined;
|
205
|
+
isIdle = true;
|
206
|
+
resolvedPromise.then(processIdleTasks);
|
207
|
+
},
|
208
|
+
Math.min(
|
209
|
+
isInitialStore ? idleTimeoutForInitialStore : Infinity,
|
210
|
+
isLargeChange ? idleTimeoutAfterLargeChanges : Infinity,
|
211
|
+
idleTimeout
|
212
|
+
)
|
213
|
+
);
|
207
214
|
idleTimer.unref();
|
208
215
|
}
|
209
216
|
);
|
@@ -539,7 +539,7 @@ class Pack {
|
|
539
539
|
map.set(identifier, content.content.get(identifier));
|
540
540
|
}
|
541
541
|
return new PackContentItems(map);
|
542
|
-
|
542
|
+
})
|
543
543
|
: undefined;
|
544
544
|
}
|
545
545
|
}
|
@@ -1046,8 +1046,8 @@ class PackFileCacheStrategy {
|
|
1046
1046
|
compression === "brotli"
|
1047
1047
|
? ".pack.br"
|
1048
1048
|
: compression === "gzip"
|
1049
|
-
|
1050
|
-
|
1049
|
+
? ".pack.gz"
|
1050
|
+
: ".pack";
|
1051
1051
|
this.snapshot = snapshot;
|
1052
1052
|
/** @type {Set<string>} */
|
1053
1053
|
this.buildDependencies = new Set();
|
@@ -264,7 +264,7 @@ class ResolverCachePlugin {
|
|
264
264
|
yields = undefined;
|
265
265
|
callbacks = false;
|
266
266
|
}
|
267
|
-
|
267
|
+
}
|
268
268
|
: (err, result) => {
|
269
269
|
if (callbacks === undefined) {
|
270
270
|
callback(err, result);
|
@@ -276,7 +276,7 @@ class ResolverCachePlugin {
|
|
276
276
|
activeRequests.delete(identifier);
|
277
277
|
callbacks = false;
|
278
278
|
}
|
279
|
-
|
279
|
+
};
|
280
280
|
/**
|
281
281
|
* @param {Error=} err error if any
|
282
282
|
* @param {CacheEntry=} cacheEntry cache entry
|
@@ -60,11 +60,11 @@ const load = (input, context) => {
|
|
60
60
|
const config = query
|
61
61
|
? query
|
62
62
|
: configPath
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
? browserslist.loadConfig({
|
64
|
+
config: configPath,
|
65
|
+
env
|
66
|
+
})
|
67
|
+
: browserslist.loadConfig({ path: context, env });
|
68
68
|
|
69
69
|
if (!config) return;
|
70
70
|
return browserslist(config);
|
@@ -310,6 +310,25 @@ const resolve = browsers => {
|
|
310
310
|
kaios: [2, 5],
|
311
311
|
node: 4
|
312
312
|
}),
|
313
|
+
asyncFunction: rawChecker({
|
314
|
+
chrome: 55,
|
315
|
+
and_chr: 55,
|
316
|
+
edge: 15,
|
317
|
+
firefox: 52,
|
318
|
+
and_ff: 52,
|
319
|
+
// ie: Not supported,
|
320
|
+
opera: 42,
|
321
|
+
op_mob: 42,
|
322
|
+
safari: [10, 1],
|
323
|
+
ios_saf: [10, 3],
|
324
|
+
samsung: 6,
|
325
|
+
android: 55,
|
326
|
+
// and_qq: Unknown support
|
327
|
+
// baidu: Unknown support
|
328
|
+
// and_uc: Unknown support
|
329
|
+
// kaios: Unknown support
|
330
|
+
node: [7, 6]
|
331
|
+
}),
|
313
332
|
browser: browserProperty,
|
314
333
|
electron: false,
|
315
334
|
node: nodeProperty,
|