webpack 5.89.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/README.md +3 -0
- package/bin/webpack.js +1 -3
- package/hot/log.js +0 -2
- package/lib/APIPlugin.js +17 -13
- package/lib/ChunkGraph.js +1 -1
- package/lib/CleanPlugin.js +12 -12
- package/lib/Compilation.js +26 -17
- package/lib/Compiler.js +13 -0
- package/lib/ConcatenationScope.js +2 -2
- package/lib/ConditionalInitFragment.js +3 -3
- package/lib/ContextModule.js +4 -4
- package/lib/ContextModuleFactory.js +1 -1
- package/lib/DefinePlugin.js +47 -26
- package/lib/DependencyTemplate.js +3 -1
- package/lib/EnvironmentNotSupportAsyncWarning.js +52 -0
- package/lib/EvalDevToolModulePlugin.js +1 -1
- package/lib/EvalSourceMapDevToolPlugin.js +2 -2
- 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/InitFragment.js +7 -7
- 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/Stats.js +4 -0
- package/lib/WebpackOptionsApply.js +4 -3
- package/lib/asset/AssetModulesPlugin.js +2 -3
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +53 -0
- 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 +35 -14
- package/lib/config/defaults.js +88 -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/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/CachedConstDependency.js +8 -1
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -1
- package/lib/dependencies/ContextElementDependency.js +1 -1
- package/lib/dependencies/ExternalModuleDependency.js +107 -0
- package/lib/dependencies/ExternalModuleInitFragment.js +131 -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 +6 -6
- package/lib/dependencies/HarmonyImportDependency.js +4 -4
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +6 -6
- package/lib/dependencies/ImportDependency.js +26 -6
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +2 -1
- package/lib/dependencies/LocalModuleDependency.js +1 -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 +10 -3
- package/lib/dependencies/getFunctionExpression.js +2 -2
- 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 +220 -74
- 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/MangleExportsPlugin.js +5 -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 +7 -6
- package/lib/util/cleverMerge.js +4 -4
- package/lib/util/comparators.js +59 -23
- 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/numberHash.js +64 -52
- 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 +53 -28
- 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 +25 -80
- 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 +273 -94
@@ -183,7 +183,7 @@ class JsonGenerator extends Generator {
|
|
183
183
|
const jsonStr = /** @type {string} */ (stringifySafe(finalJson));
|
184
184
|
const jsonExpr =
|
185
185
|
jsonStr.length > 20 && typeof finalJson === "object"
|
186
|
-
?
|
186
|
+
? `/*#__PURE__*/JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')`
|
187
187
|
: jsonStr;
|
188
188
|
/** @type {string} */
|
189
189
|
let content;
|
@@ -87,7 +87,11 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
87
87
|
const modern = runtimeTemplate.supportsArrowFunction();
|
88
88
|
const modules = chunkGraph
|
89
89
|
.getChunkModules(chunk)
|
90
|
-
.filter(
|
90
|
+
.filter(
|
91
|
+
m =>
|
92
|
+
m instanceof ExternalModule &&
|
93
|
+
(m.externalType === "amd" || m.externalType === "amd-require")
|
94
|
+
);
|
91
95
|
const externals = /** @type {ExternalModule[]} */ (modules);
|
92
96
|
const externalsDepsArray = JSON.stringify(
|
93
97
|
externals.map(m =>
|
@@ -295,7 +295,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
|
295
295
|
const exportAccess = options.export
|
296
296
|
? propertyAccess(
|
297
297
|
Array.isArray(options.export) ? options.export : [options.export]
|
298
|
-
|
298
|
+
)
|
299
299
|
: "";
|
300
300
|
const result = new ConcatSource(source);
|
301
301
|
if (staticExports) {
|
@@ -243,8 +243,8 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
243
243
|
const factoryArguments =
|
244
244
|
requiredExternals.length > 0
|
245
245
|
? externalsArguments(requiredExternals) +
|
246
|
-
|
247
|
-
|
246
|
+
", " +
|
247
|
+
externalsRootArray(optionalExternals)
|
248
248
|
: externalsRootArray(optionalExternals);
|
249
249
|
amdFactory =
|
250
250
|
`function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` +
|
@@ -283,55 +283,55 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
283
283
|
(requiredExternals.length > 0
|
284
284
|
? names.amd && namedDefine === true
|
285
285
|
? " define(" +
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
286
|
+
libraryName(names.amd) +
|
287
|
+
", " +
|
288
|
+
externalsDepsArray(requiredExternals) +
|
289
|
+
", " +
|
290
|
+
amdFactory +
|
291
|
+
");\n"
|
292
292
|
: " define(" +
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
293
|
+
externalsDepsArray(requiredExternals) +
|
294
|
+
", " +
|
295
|
+
amdFactory +
|
296
|
+
");\n"
|
297
297
|
: names.amd && namedDefine === true
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
298
|
+
? " define(" +
|
299
|
+
libraryName(names.amd) +
|
300
|
+
", [], " +
|
301
|
+
amdFactory +
|
302
|
+
");\n"
|
303
|
+
: " define([], " + amdFactory + ");\n") +
|
304
304
|
(names.root || names.commonjs
|
305
305
|
? getAuxiliaryComment("commonjs") +
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
306
|
+
" else if(typeof exports === 'object')\n" +
|
307
|
+
" exports[" +
|
308
|
+
libraryName(names.commonjs || names.root) +
|
309
|
+
"] = factory(" +
|
310
|
+
externalsRequireArray("commonjs") +
|
311
|
+
");\n" +
|
312
|
+
getAuxiliaryComment("root") +
|
313
|
+
" else\n" +
|
314
|
+
" " +
|
315
|
+
replaceKeys(
|
316
316
|
accessorAccess(
|
317
317
|
"root",
|
318
318
|
/** @type {string | string[]} */ (names.root) ||
|
319
319
|
/** @type {string} */ (names.commonjs)
|
320
320
|
)
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
321
|
+
) +
|
322
|
+
" = factory(" +
|
323
|
+
externalsRootArray(externals) +
|
324
|
+
");\n"
|
325
325
|
: " else {\n" +
|
326
|
-
|
326
|
+
(externals.length > 0
|
327
327
|
? " var a = typeof exports === 'object' ? factory(" +
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
328
|
+
externalsRequireArray("commonjs") +
|
329
|
+
") : factory(" +
|
330
|
+
externalsRootArray(externals) +
|
331
|
+
");\n"
|
332
332
|
: " var a = factory();\n") +
|
333
|
-
|
334
|
-
|
333
|
+
" for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" +
|
334
|
+
" }\n") +
|
335
335
|
`})(${runtimeTemplate.outputOptions.globalObject}, ${
|
336
336
|
runtimeTemplate.supportsArrowFunction()
|
337
337
|
? `(${externalsArguments(externals)}) =>`
|
@@ -45,11 +45,7 @@ const { LogType } = require("./Logger");
|
|
45
45
|
const filterToFunction = item => {
|
46
46
|
if (typeof item === "string") {
|
47
47
|
const regExp = new RegExp(
|
48
|
-
`[\\\\/]${item.replace(
|
49
|
-
// eslint-disable-next-line no-useless-escape
|
50
|
-
/[-[\]{}()*+?.\\^$|]/g,
|
51
|
-
"\\$&"
|
52
|
-
)}([\\\\/]|$|!|\\?)`
|
48
|
+
`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)`
|
53
49
|
);
|
54
50
|
return ident => regExp.test(ident);
|
55
51
|
}
|
@@ -114,9 +110,7 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
114
110
|
switch (type) {
|
115
111
|
case LogType.debug:
|
116
112
|
if (!debug) return;
|
117
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
118
113
|
if (typeof console.debug === "function") {
|
119
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
120
114
|
console.debug(...labeledArgs());
|
121
115
|
} else {
|
122
116
|
console.log(...labeledArgs());
|
@@ -145,9 +139,7 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
145
139
|
case LogType.groupCollapsed:
|
146
140
|
if (!debug && loglevel > LogLevel.log) return;
|
147
141
|
if (!debug && loglevel > LogLevel.verbose) {
|
148
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
149
142
|
if (typeof console.groupCollapsed === "function") {
|
150
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
151
143
|
console.groupCollapsed(...labeledArgs());
|
152
144
|
} else {
|
153
145
|
console.log(...labeledArgs());
|
@@ -157,9 +149,7 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
157
149
|
// falls through
|
158
150
|
case LogType.group:
|
159
151
|
if (!debug && loglevel > LogLevel.log) return;
|
160
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
161
152
|
if (typeof console.group === "function") {
|
162
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
163
153
|
console.group(...labeledArgs());
|
164
154
|
} else {
|
165
155
|
console.log(...labeledArgs());
|
@@ -167,9 +157,7 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
167
157
|
break;
|
168
158
|
case LogType.groupEnd:
|
169
159
|
if (!debug && loglevel > LogLevel.log) return;
|
170
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
171
160
|
if (typeof console.groupEnd === "function") {
|
172
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
173
161
|
console.groupEnd();
|
174
162
|
}
|
175
163
|
break;
|
@@ -185,24 +173,18 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
185
173
|
break;
|
186
174
|
}
|
187
175
|
case LogType.profile:
|
188
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
189
176
|
if (typeof console.profile === "function") {
|
190
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
191
177
|
console.profile(...labeledArgs());
|
192
178
|
}
|
193
179
|
break;
|
194
180
|
case LogType.profileEnd:
|
195
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
196
181
|
if (typeof console.profileEnd === "function") {
|
197
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
198
182
|
console.profileEnd(...labeledArgs());
|
199
183
|
}
|
200
184
|
break;
|
201
185
|
case LogType.clear:
|
202
186
|
if (!debug && loglevel > LogLevel.log) return;
|
203
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
204
187
|
if (typeof console.clear === "function") {
|
205
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
206
188
|
console.clear();
|
207
189
|
}
|
208
190
|
break;
|
@@ -113,10 +113,10 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|
113
113
|
withOnChunkLoad
|
114
114
|
? `${
|
115
115
|
RuntimeGlobals.onChunksLoaded
|
116
|
-
|
116
|
+
}.readFileVm = ${runtimeTemplate.returningFunction(
|
117
117
|
"installedChunks[chunkId] === 0",
|
118
118
|
"chunkId"
|
119
|
-
|
119
|
+
)};`
|
120
120
|
: "// no on chunks loaded",
|
121
121
|
"",
|
122
122
|
withLoading || withExternalInstallChunk
|
@@ -141,7 +141,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|
141
141
|
]),
|
142
142
|
"}",
|
143
143
|
withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : ""
|
144
|
-
|
144
|
+
])};`
|
145
145
|
: "// no chunk install function needed",
|
146
146
|
"",
|
147
147
|
withLoading
|
@@ -192,17 +192,17 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|
192
192
|
"}"
|
193
193
|
]),
|
194
194
|
"}"
|
195
|
-
|
195
|
+
])
|
196
196
|
: Template.indent(["installedChunks[chunkId] = 0;"]),
|
197
197
|
"};"
|
198
|
-
|
198
|
+
])
|
199
199
|
: "// no chunk loading",
|
200
200
|
"",
|
201
201
|
withExternalInstallChunk
|
202
202
|
? Template.asString([
|
203
203
|
`module.exports = ${RuntimeGlobals.require};`,
|
204
204
|
`${RuntimeGlobals.externalInstallChunk} = installChunk;`
|
205
|
-
|
205
|
+
])
|
206
206
|
: "// no external install chunk",
|
207
207
|
"",
|
208
208
|
withHmr
|
@@ -263,7 +263,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|
263
263
|
/\$hmrInvalidateModuleHandlers\$/g,
|
264
264
|
RuntimeGlobals.hmrInvalidateModuleHandlers
|
265
265
|
)
|
266
|
-
|
266
|
+
])
|
267
267
|
: "// no HMR",
|
268
268
|
"",
|
269
269
|
withHmrManifest
|
@@ -291,7 +291,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|
291
291
|
"});"
|
292
292
|
]),
|
293
293
|
"}"
|
294
|
-
|
294
|
+
])
|
295
295
|
: "// no HMR manifest"
|
296
296
|
]);
|
297
297
|
}
|
@@ -113,10 +113,10 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|
113
113
|
withOnChunkLoad
|
114
114
|
? `${
|
115
115
|
RuntimeGlobals.onChunksLoaded
|
116
|
-
|
116
|
+
}.require = ${runtimeTemplate.returningFunction(
|
117
117
|
"installedChunks[chunkId]",
|
118
118
|
"chunkId"
|
119
|
-
|
119
|
+
)};`
|
120
120
|
: "// no on chunks loaded",
|
121
121
|
"",
|
122
122
|
withLoading || withExternalInstallChunk
|
@@ -135,7 +135,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|
135
135
|
"for(var i = 0; i < chunkIds.length; i++)",
|
136
136
|
Template.indent("installedChunks[chunkIds[i]] = 1;"),
|
137
137
|
withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : ""
|
138
|
-
|
138
|
+
])};`
|
139
139
|
: "// no chunk install function needed",
|
140
140
|
"",
|
141
141
|
withLoading
|
@@ -162,17 +162,17 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|
162
162
|
""
|
163
163
|
]),
|
164
164
|
"}"
|
165
|
-
|
165
|
+
]
|
166
166
|
: "installedChunks[chunkId] = 1;"
|
167
167
|
)};`
|
168
|
-
|
168
|
+
])
|
169
169
|
: "// no chunk loading",
|
170
170
|
"",
|
171
171
|
withExternalInstallChunk
|
172
172
|
? Template.asString([
|
173
173
|
`module.exports = ${RuntimeGlobals.require};`,
|
174
174
|
`${RuntimeGlobals.externalInstallChunk} = installChunk;`
|
175
|
-
|
175
|
+
])
|
176
176
|
: "// no external install chunk",
|
177
177
|
"",
|
178
178
|
withHmr
|
@@ -220,7 +220,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|
220
220
|
/\$hmrInvalidateModuleHandlers\$/g,
|
221
221
|
RuntimeGlobals.hmrInvalidateModuleHandlers
|
222
222
|
)
|
223
|
-
|
223
|
+
])
|
224
224
|
: "// no HMR",
|
225
225
|
"",
|
226
226
|
withHmrManifest
|
@@ -236,7 +236,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|
236
236
|
"})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });"
|
237
237
|
]),
|
238
238
|
"}"
|
239
|
-
|
239
|
+
])
|
240
240
|
: "// no HMR manifest"
|
241
241
|
]);
|
242
242
|
}
|
package/lib/node/nodeConsole.js
CHANGED
@@ -102,17 +102,13 @@ module.exports = ({ colors, appendOnly, stream }) => {
|
|
102
102
|
else if (currentIndent.length >= 2)
|
103
103
|
currentIndent = currentIndent.slice(0, currentIndent.length - 2);
|
104
104
|
},
|
105
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
106
105
|
profile: console.profile && (name => console.profile(name)),
|
107
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
108
106
|
profileEnd: console.profileEnd && (name => console.profileEnd(name)),
|
109
107
|
clear:
|
110
108
|
!appendOnly &&
|
111
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
112
109
|
console.clear &&
|
113
110
|
(() => {
|
114
111
|
clearStatusMessage();
|
115
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
116
112
|
console.clear();
|
117
113
|
writeStatusMessage();
|
118
114
|
}),
|
@@ -136,6 +132,6 @@ module.exports = ({ colors, appendOnly, stream }) => {
|
|
136
132
|
currentStatusMessage = [name, ...args];
|
137
133
|
writeStatusMessage();
|
138
134
|
}
|
139
|
-
|
135
|
+
}
|
140
136
|
};
|
141
137
|
};
|
@@ -335,10 +335,10 @@ const getFinalBinding = (
|
|
335
335
|
const defaultExport = asCall
|
336
336
|
? `${info.interopDefaultAccessName}()`
|
337
337
|
: asiSafe
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
338
|
+
? `(${info.interopDefaultAccessName}())`
|
339
|
+
: asiSafe === false
|
340
|
+
? `;(${info.interopDefaultAccessName}())`
|
341
|
+
: `${info.interopDefaultAccessName}.a`;
|
342
342
|
return {
|
343
343
|
info,
|
344
344
|
rawName: defaultExport,
|
@@ -568,8 +568,8 @@ const getFinalName = (
|
|
568
568
|
return asiSafe
|
569
569
|
? `(0,${reference})`
|
570
570
|
: asiSafe === false
|
571
|
-
|
572
|
-
|
571
|
+
? `;(0,${reference})`
|
572
|
+
: `/*#__PURE__*/Object(${reference})`;
|
573
573
|
}
|
574
574
|
return reference;
|
575
575
|
}
|
@@ -1541,7 +1541,7 @@ class ConcatenatedModule extends Module {
|
|
1541
1541
|
nsObj.length > 0
|
1542
1542
|
? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join(
|
1543
1543
|
","
|
1544
|
-
|
1544
|
+
)}\n});\n`
|
1545
1545
|
: "";
|
1546
1546
|
if (nsObj.length > 0)
|
1547
1547
|
runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
|
@@ -177,7 +177,6 @@ class InnerGraphPlugin {
|
|
177
177
|
) {
|
178
178
|
pureDeclarators.add(decl);
|
179
179
|
}
|
180
|
-
return true;
|
181
180
|
}
|
182
181
|
}
|
183
182
|
});
|
@@ -336,6 +335,15 @@ class InnerGraphPlugin {
|
|
336
335
|
parser.walkExpression(decl.init);
|
337
336
|
InnerGraph.setTopLevelSymbol(parser.state, undefined);
|
338
337
|
return true;
|
338
|
+
} else if (
|
339
|
+
decl.id.type === "Identifier" &&
|
340
|
+
decl.init &&
|
341
|
+
decl.init.type === "ClassExpression" &&
|
342
|
+
classWithTopLevelSymbol.has(decl.init)
|
343
|
+
) {
|
344
|
+
parser.walkExpression(decl.init);
|
345
|
+
InnerGraph.setTopLevelSymbol(parser.state, undefined);
|
346
|
+
return true;
|
339
347
|
}
|
340
348
|
});
|
341
349
|
|
@@ -88,7 +88,11 @@ const mangleExportsInfo = (deterministic, exportsInfo, isNamespace) => {
|
|
88
88
|
used === UsageState.OnlyPropertiesUsed ||
|
89
89
|
used === UsageState.Unused
|
90
90
|
) {
|
91
|
-
mangleExportsInfo(
|
91
|
+
mangleExportsInfo(
|
92
|
+
deterministic,
|
93
|
+
/** @type {ExportsInfo} */ (exportInfo.exportsInfo),
|
94
|
+
false
|
95
|
+
);
|
92
96
|
}
|
93
97
|
}
|
94
98
|
}
|
@@ -284,8 +284,8 @@ class ModuleConcatenationPlugin {
|
|
284
284
|
filteredRuntime === true
|
285
285
|
? chunkRuntime
|
286
286
|
: filteredRuntime === false
|
287
|
-
|
288
|
-
|
287
|
+
? undefined
|
288
|
+
: filteredRuntime;
|
289
289
|
|
290
290
|
// create a configuration with the root
|
291
291
|
const currentConfiguration = new ConcatConfiguration(
|