webpack 5.108.4 → 5.109.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.
- package/bin/webpack.js +12 -0
- package/lib/APIPlugin.js +48 -29
- package/lib/CacheFacade.js +8 -0
- package/lib/ChunkGraph.js +17 -15
- package/lib/ChunkGroup.js +1 -0
- package/lib/CompatibilityPlugin.js +62 -29
- package/lib/Compilation.js +58 -6
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextModule.js +239 -6
- package/lib/ContextModuleFactory.js +139 -14
- package/lib/DefinePlugin.js +433 -112
- package/lib/Entrypoint.js +1 -1
- package/lib/ExportsInfo.js +22 -5
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +107 -5
- package/lib/ExternalModuleFactoryPlugin.js +20 -1
- package/lib/FileSystemInfo.js +256 -100
- package/lib/FlagDependencyUsagePlugin.js +33 -12
- package/lib/HotModuleReplacementPlugin.js +18 -15
- package/lib/InitFragment.js +20 -32
- package/lib/Module.js +3 -0
- package/lib/ModuleFilenameHelpers.js +2 -2
- package/lib/ModuleTypeConstants.js +8 -1
- package/lib/MultiCompiler.js +13 -2
- package/lib/MultiWatching.js +1 -0
- package/lib/NodeStuffPlugin.js +51 -33
- package/lib/NormalModule.js +175 -401
- package/lib/NormalModuleFactory.js +76 -2
- package/lib/ProgressPlugin.js +211 -119
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RuntimeGlobals.js +47 -0
- package/lib/RuntimePlugin.js +67 -107
- package/lib/RuntimeTemplate.js +304 -16
- package/lib/Template.js +23 -3
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WebpackIsIncludedPlugin.js +1 -1
- package/lib/WebpackOptionsApply.js +24 -19
- package/lib/asset/AssetGenerator.js +110 -28
- package/lib/asset/AssetModulesPlugin.js +92 -2
- package/lib/asset/WebManifestGenerator.js +164 -0
- package/lib/asset/WebManifestParser.js +130 -0
- package/lib/async-modules/AwaitDependenciesInitFragment.js +14 -4
- package/lib/async-modules/isGeneratorLowered.js +26 -0
- package/lib/cache/PackFileCacheStrategy.js +9 -3
- package/lib/config/browserslistTargetHandler.js +40 -0
- package/lib/config/defaults.js +219 -29
- package/lib/config/normalization.js +26 -0
- package/lib/config/target.js +9 -1
- package/lib/container/HoistContainerReferencesPlugin.js +47 -55
- package/lib/css/CssGenerator.js +40 -31
- package/lib/css/CssLoadingRuntimeModule.js +5 -1
- package/lib/css/CssModulesPlugin.js +13 -0
- package/lib/css/CssParser.js +729 -313
- package/lib/css/syntax.js +1371 -861
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +6 -6
- package/lib/dependencies/AMDPlugin.js +2 -2
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +13 -13
- package/lib/dependencies/CommonJsDependencyHelpers.js +39 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +19 -0
- package/lib/dependencies/CommonJsExportsDependency.js +47 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +10 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +18 -18
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/CommonJsRequireDependency.js +26 -1
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +32 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CreateRequireParserPlugin.js +6 -6
- package/lib/dependencies/CssIcssExportDependency.js +162 -71
- package/lib/dependencies/CssUrlDependency.js +35 -4
- package/lib/dependencies/ExternalModuleInitFragmentDependency.js +2 -2
- package/lib/dependencies/HarmonyCompatibilityDependency.js +32 -14
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +43 -13
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +2 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +7 -19
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +17 -9
- package/lib/dependencies/HarmonyImportDependency.js +13 -2
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +11 -11
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +10 -7
- package/lib/dependencies/HarmonyModulesPlugin.js +6 -0
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/HtmlEntryDependency.js +797 -172
- package/lib/dependencies/HtmlSourceDependency.js +26 -0
- package/lib/dependencies/ImportDependency.js +43 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +31 -18
- package/lib/dependencies/ImportMetaContextPlugin.js +38 -7
- package/lib/dependencies/ImportMetaGlobDependency.js +81 -0
- package/lib/dependencies/ImportMetaGlobDependencyParserPlugin.js +78 -0
- package/lib/dependencies/ImportMetaGlobHelpers.js +660 -0
- package/lib/dependencies/ImportMetaPlugin.js +532 -180
- package/lib/dependencies/ImportMetaResolveDependency.js +90 -0
- package/lib/dependencies/ImportParserPlugin.js +80 -17
- package/lib/dependencies/ImportPhase.js +10 -8
- package/lib/dependencies/LoaderPlugin.js +5 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +3 -6
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +4 -11
- package/lib/dependencies/SystemPlugin.js +2 -4
- package/lib/dependencies/TopLevelAwaitDependency.js +93 -0
- package/lib/dependencies/URLDependency.js +141 -21
- package/lib/dependencies/{WorkerPlugin.js → WorkerAndWorkletPlugin.js} +324 -112
- package/lib/dependencies/WorkerDependency.js +86 -18
- package/lib/dependencies/WorkletDependency.js +278 -0
- package/lib/dll/DelegatedModuleFactoryPlugin.js +19 -0
- package/lib/errors/EnvironmentNotSupportAsyncWarning.js +1 -1
- package/lib/errors/LoaderLoadingError.js +20 -0
- package/lib/errors/ModuleParseError.js +39 -22
- package/lib/errors/NodeStuffInWebError.js +1 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +47 -14
- package/lib/esm/ModuleChunkLoadingPlugin.js +8 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +29 -1
- package/lib/hmr/lazyCompilationBackend.js +51 -12
- package/lib/html/HtmlGenerator.js +907 -15
- package/lib/html/HtmlModule.js +2 -2
- package/lib/html/HtmlModulesPlugin.js +610 -166
- package/lib/html/HtmlParser.js +603 -247
- package/lib/html/favicon.svg +1 -0
- package/lib/html/syntax.js +3451 -2762
- package/lib/ids/IdHelpers.js +25 -11
- package/lib/index.js +6 -0
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +4 -5
- package/lib/javascript/BasicEvaluatedExpression.js +366 -48
- package/lib/javascript/JavascriptGenerator.js +197 -49
- package/lib/javascript/JavascriptModulesPlugin.js +178 -24
- package/lib/javascript/JavascriptParser.js +704 -355
- package/lib/javascript/JavascriptParserHelpers.js +3 -6
- package/lib/javascript/syntax.js +5037 -0
- package/lib/library/ModuleLibraryPlugin.js +38 -1
- package/lib/loaders/LoaderRunner.js +714 -0
- package/lib/loaders/loadLoader.js +100 -0
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +29 -2
- package/lib/node/ReadFileCompileWasmPlugin.js +24 -2
- package/lib/optimize/AggressiveMergingPlugin.js +19 -15
- package/lib/optimize/ConcatenatedModule.js +139 -31
- package/lib/optimize/FlagIncludedChunksPlugin.js +13 -3
- package/lib/optimize/InnerGraphPlugin.js +50 -30
- package/lib/optimize/ModuleConcatenationPlugin.js +139 -24
- package/lib/optimize/SideEffectsFlagPlugin.js +86 -43
- package/lib/optimize/SplitChunksPlugin.js +146 -44
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +15 -0
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +24 -13
- package/lib/prefetch/ResourceHintPlugin.js +687 -0
- package/lib/prefetch/ResourceHintRuntimeModule.js +149 -0
- package/lib/prefetch/StartupAssetHintRuntimeModule.js +210 -0
- package/lib/prefetch/parseResourceHintOptions.js +103 -0
- package/lib/rules/RuleSetCompiler.js +114 -0
- package/lib/runtime/AsyncModuleGeneratorRuntimeModule.js +56 -0
- package/lib/runtime/AsyncModuleRuntimeModule.js +24 -8
- package/lib/runtime/AutoPublicPathRuntimeModule.js +7 -1
- package/lib/runtime/CommonJsWrapRuntimeModule.js +37 -0
- package/lib/runtime/GetWorkletBootstrapRuntimeModule.js +59 -0
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +204 -8
- package/lib/runtime/SetAnonymousDefaultNameRuntimeModule.js +4 -1
- package/lib/schemes/HttpUriPlugin.js +40 -1
- package/lib/schemes/VirtualUrlPlugin.js +1 -2
- package/lib/serialization/BinaryMiddleware.js +270 -938
- package/lib/serialization/FileMiddleware.js +29 -3
- package/lib/stats/DefaultStatsFactoryPlugin.js +229 -194
- package/lib/stats/DefaultStatsPresetPlugin.js +2 -0
- package/lib/stats/DefaultStatsPrinterPlugin.js +36 -168
- package/lib/stats/StatsFactory.js +46 -17
- package/lib/url/URLParserPlugin.js +66 -13
- package/lib/util/AsyncQueue.js +122 -72
- package/lib/util/SetHelpers.js +1 -1
- package/lib/util/StackedMap.js +122 -48
- package/lib/util/binarySearchBounds.js +2 -2
- package/lib/util/concatenate.js +40 -14
- package/lib/util/createHooksRegistry.js +13 -5
- package/lib/util/dataURL.js +2 -2
- package/lib/util/deterministicGrouping.js +7 -5
- package/lib/util/formatSize.js +6 -2
- package/lib/util/globUtils.js +710 -0
- package/lib/util/identifier.js +23 -6
- package/lib/util/implicitTypeLoaderFallback.js +62 -0
- package/lib/util/internalSerializables.js +88 -71
- package/lib/util/magicComment.js +121 -25
- package/lib/util/numberHash.js +2 -2
- package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +24 -18
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +33 -22
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +79 -16
- package/lib/web/FetchCompileAsyncWasmPlugin.js +19 -0
- package/lib/web/FetchCompileWasmPlugin.js +14 -0
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -0
- package/lib/webpack.js +65 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +3 -0
- package/module.d.ts +21 -0
- package/package.json +12 -11
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +759 -36
- package/schemas/plugins/HtmlParserOptions.check.js +1 -1
- package/schemas/plugins/ProgressPlugin.check.js +1 -1
- package/schemas/plugins/ProgressPlugin.json +17 -1
- package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
- package/schemas/plugins/container/ExternalsType.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.json +1 -0
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
- package/schemas/plugins/css/CssParserOptions.check.js +1 -1
- package/types.d.ts +1212 -99
package/lib/RuntimeGlobals.js
CHANGED
|
@@ -15,6 +15,13 @@ module.exports.amdDefine = "__webpack_require__.amdD";
|
|
|
15
15
|
*/
|
|
16
16
|
module.exports.amdOptions = "__webpack_require__.amdO";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* analyzable single-chunk `import()` that keeps `ensureChunk` timing and deduplication:
|
|
20
|
+
* resolves immediately for an installed chunk, else runs the literal import and installs it
|
|
21
|
+
* Signature: (chunkId, () => Promise) => Promise
|
|
22
|
+
*/
|
|
23
|
+
module.exports.analyzableChunkImport = "__webpack_require__.ei";
|
|
24
|
+
|
|
18
25
|
/**
|
|
19
26
|
* Creates an async module. The body function must be a async function.
|
|
20
27
|
* "module.exports" will be decorated with an AsyncModulePromise.
|
|
@@ -39,6 +46,15 @@ module.exports.asyncModuleDoneSymbol = "__webpack_require__.aD";
|
|
|
39
46
|
*/
|
|
40
47
|
module.exports.asyncModuleExportSymbol = "__webpack_require__.aE";
|
|
41
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Drives an async module body written as a generator function (used when the
|
|
51
|
+
* target environment supports generators but not `async`/`await`).
|
|
52
|
+
* It runs the generator, resolving each `yield`ed dependency promise, so the
|
|
53
|
+
* body reads like a plain `async` function without emitting `async`/`await`.
|
|
54
|
+
* Signature: function(body: GeneratorFunction) => (handleDependencies, result) => void
|
|
55
|
+
*/
|
|
56
|
+
module.exports.asyncModuleGenerator = "__webpack_require__.aG";
|
|
57
|
+
|
|
42
58
|
/**
|
|
43
59
|
* the baseURI of current document
|
|
44
60
|
*/
|
|
@@ -54,6 +70,11 @@ module.exports.chunkCallback = "webpackChunk";
|
|
|
54
70
|
*/
|
|
55
71
|
module.exports.chunkName = "__webpack_require__.cn";
|
|
56
72
|
|
|
73
|
+
/**
|
|
74
|
+
* wrap and eagerly execute a CommonJS module body, returning its exports
|
|
75
|
+
*/
|
|
76
|
+
module.exports.commonJsWrap = "__webpack_require__.cjs";
|
|
77
|
+
|
|
57
78
|
/**
|
|
58
79
|
* compatibility get default export
|
|
59
80
|
*/
|
|
@@ -195,6 +216,12 @@ module.exports.getTrustedTypesPolicy = "__webpack_require__.tt";
|
|
|
195
216
|
*/
|
|
196
217
|
module.exports.getUpdateManifestFilename = "__webpack_require__.hmrF";
|
|
197
218
|
|
|
219
|
+
/**
|
|
220
|
+
* the object url of the worklet bootstrap script (sets up `self`, `location` and
|
|
221
|
+
* a throwing `importScripts` before worklet chunks are added)
|
|
222
|
+
*/
|
|
223
|
+
module.exports.getWorkletBootstrap = "__webpack_require__.wb";
|
|
224
|
+
|
|
198
225
|
/**
|
|
199
226
|
* the global object
|
|
200
227
|
*/
|
|
@@ -331,6 +358,12 @@ module.exports.nodeModuleDecorator = "__webpack_require__.nmd";
|
|
|
331
358
|
*/
|
|
332
359
|
module.exports.onChunksLoaded = "__webpack_require__.O";
|
|
333
360
|
|
|
361
|
+
/**
|
|
362
|
+
* the asset prefetch function: injects a
|
|
363
|
+
* `<link rel="prefetch">` for an asset module URL
|
|
364
|
+
*/
|
|
365
|
+
module.exports.prefetchAsset = "__webpack_require__.PA";
|
|
366
|
+
|
|
334
367
|
/**
|
|
335
368
|
* the chunk prefetch function
|
|
336
369
|
*/
|
|
@@ -341,6 +374,12 @@ module.exports.prefetchChunk = "__webpack_require__.E";
|
|
|
341
374
|
*/
|
|
342
375
|
module.exports.prefetchChunkHandlers = "__webpack_require__.F";
|
|
343
376
|
|
|
377
|
+
/**
|
|
378
|
+
* the asset preload function: injects a
|
|
379
|
+
* `<link rel="preload">` for an asset module URL
|
|
380
|
+
*/
|
|
381
|
+
module.exports.preloadAsset = "__webpack_require__.LA";
|
|
382
|
+
|
|
344
383
|
/**
|
|
345
384
|
* the chunk preload function
|
|
346
385
|
*/
|
|
@@ -402,6 +441,14 @@ module.exports.shareScopeMap = "__webpack_require__.S";
|
|
|
402
441
|
*/
|
|
403
442
|
module.exports.startup = "__webpack_require__.x";
|
|
404
443
|
|
|
444
|
+
/**
|
|
445
|
+
* marker requirement that adds the startup runtime module which fires
|
|
446
|
+
* `<link rel="prefetch|preload">` for `new URL(..., import.meta.url)`
|
|
447
|
+
* assets with `webpackPrefetch` / `webpackPreload` hints, before any
|
|
448
|
+
* chunk module evaluates
|
|
449
|
+
*/
|
|
450
|
+
module.exports.startupAssetHints = "__webpack_require__.SAH";
|
|
451
|
+
|
|
405
452
|
/**
|
|
406
453
|
* method to startup an entrypoint with needed chunks.
|
|
407
454
|
* Signature: (moduleId: Id, chunkIds: Id[]) => any.
|
package/lib/RuntimePlugin.js
CHANGED
|
@@ -9,9 +9,11 @@ const RuntimeGlobals = require("./RuntimeGlobals");
|
|
|
9
9
|
const { getPresentKinds } = require("./TemplatedPathPlugin");
|
|
10
10
|
const RuntimeRequirementsDependency = require("./dependencies/RuntimeRequirementsDependency");
|
|
11
11
|
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
|
|
12
|
+
const AsyncModuleGeneratorRuntimeModule = require("./runtime/AsyncModuleGeneratorRuntimeModule");
|
|
12
13
|
const AsyncModuleRuntimeModule = require("./runtime/AsyncModuleRuntimeModule");
|
|
13
14
|
const AutoPublicPathRuntimeModule = require("./runtime/AutoPublicPathRuntimeModule");
|
|
14
15
|
const BaseUriRuntimeModule = require("./runtime/BaseUriRuntimeModule");
|
|
16
|
+
const CommonJsWrapRuntimeModule = require("./runtime/CommonJsWrapRuntimeModule");
|
|
15
17
|
const CompatGetDefaultExportRuntimeModule = require("./runtime/CompatGetDefaultExportRuntimeModule");
|
|
16
18
|
const CompatRuntimeModule = require("./runtime/CompatRuntimeModule");
|
|
17
19
|
const CreateFakeNamespaceObjectRuntimeModule = require("./runtime/CreateFakeNamespaceObjectRuntimeModule");
|
|
@@ -22,6 +24,7 @@ const EnsureChunkRuntimeModule = require("./runtime/EnsureChunkRuntimeModule");
|
|
|
22
24
|
const GetChunkFilenameRuntimeModule = require("./runtime/GetChunkFilenameRuntimeModule");
|
|
23
25
|
const GetMainFilenameRuntimeModule = require("./runtime/GetMainFilenameRuntimeModule");
|
|
24
26
|
const GetTrustedTypesPolicyRuntimeModule = require("./runtime/GetTrustedTypesPolicyRuntimeModule");
|
|
27
|
+
const GetWorkletBootstrapRuntimeModule = require("./runtime/GetWorkletBootstrapRuntimeModule");
|
|
25
28
|
const GlobalRuntimeModule = require("./runtime/GlobalRuntimeModule");
|
|
26
29
|
const HasOwnPropertyRuntimeModule = require("./runtime/HasOwnPropertyRuntimeModule");
|
|
27
30
|
const LoadScriptRuntimeModule = require("./runtime/LoadScriptRuntimeModule");
|
|
@@ -77,6 +80,7 @@ const GLOBALS_ON_REQUIRE = [
|
|
|
77
80
|
RuntimeGlobals.scriptNonce,
|
|
78
81
|
RuntimeGlobals.uncaughtErrorHandler,
|
|
79
82
|
RuntimeGlobals.asyncModule,
|
|
83
|
+
RuntimeGlobals.asyncModuleGenerator,
|
|
80
84
|
RuntimeGlobals.wasmInstances,
|
|
81
85
|
RuntimeGlobals.instantiateWasm,
|
|
82
86
|
RuntimeGlobals.shareScopeMap,
|
|
@@ -115,6 +119,33 @@ const TREE_DEPENDENCIES = {
|
|
|
115
119
|
[RuntimeGlobals.shareScopeMap]: [RuntimeGlobals.hasOwnProperty]
|
|
116
120
|
};
|
|
117
121
|
|
|
122
|
+
// Tree runtime requirements whose only effect is attaching a zero-arg runtime
|
|
123
|
+
// module to the chunk. Conditional / argument-taking ones stay as explicit taps.
|
|
124
|
+
/** @type {[string, (new () => import("./RuntimeModule"))][]} */
|
|
125
|
+
const SIMPLE_TREE_RUNTIME_MODULES = [
|
|
126
|
+
[RuntimeGlobals.definePropertyGetters, DefinePropertyGettersRuntimeModule],
|
|
127
|
+
[RuntimeGlobals.makeNamespaceObject, MakeNamespaceObjectRuntimeModule],
|
|
128
|
+
[
|
|
129
|
+
RuntimeGlobals.createFakeNamespaceObject,
|
|
130
|
+
CreateFakeNamespaceObjectRuntimeModule
|
|
131
|
+
],
|
|
132
|
+
[RuntimeGlobals.hasOwnProperty, HasOwnPropertyRuntimeModule],
|
|
133
|
+
[RuntimeGlobals.compatGetDefaultExport, CompatGetDefaultExportRuntimeModule],
|
|
134
|
+
[RuntimeGlobals.commonJsWrap, CommonJsWrapRuntimeModule],
|
|
135
|
+
[
|
|
136
|
+
RuntimeGlobals.setAnonymousDefaultName,
|
|
137
|
+
SetAnonymousDefaultNameRuntimeModule
|
|
138
|
+
],
|
|
139
|
+
[RuntimeGlobals.runtimeId, RuntimeIdRuntimeModule],
|
|
140
|
+
[RuntimeGlobals.global, GlobalRuntimeModule],
|
|
141
|
+
[RuntimeGlobals.shareScopeMap, ShareRuntimeModule],
|
|
142
|
+
[RuntimeGlobals.relativeUrl, RelativeUrlRuntimeModule],
|
|
143
|
+
[RuntimeGlobals.worker, WorkerRuntimeModule],
|
|
144
|
+
[RuntimeGlobals.onChunksLoaded, OnChunksLoadedRuntimeModule],
|
|
145
|
+
[RuntimeGlobals.scriptNonce, NonceRuntimeModule],
|
|
146
|
+
[RuntimeGlobals.toBinary, ToBinaryRuntimeModule]
|
|
147
|
+
];
|
|
148
|
+
|
|
118
149
|
/**
|
|
119
150
|
* @param {string} template path template
|
|
120
151
|
* @returns {boolean} true when it references the compilation `[fullhash]`/`[hash]`
|
|
@@ -194,36 +225,20 @@ class RuntimePlugin {
|
|
|
194
225
|
for (const dep of deps) set.add(dep);
|
|
195
226
|
});
|
|
196
227
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
209
|
-
compilation.addRuntimeModule(
|
|
210
|
-
chunk,
|
|
211
|
-
new MakeNamespaceObjectRuntimeModule()
|
|
212
|
-
);
|
|
213
|
-
return true;
|
|
214
|
-
});
|
|
215
|
-
compilation.hooks.runtimeRequirementInTree
|
|
216
|
-
.for(RuntimeGlobals.createFakeNamespaceObject)
|
|
217
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
218
|
-
compilation.addRuntimeModule(
|
|
219
|
-
chunk,
|
|
220
|
-
new CreateFakeNamespaceObjectRuntimeModule()
|
|
221
|
-
);
|
|
222
|
-
return true;
|
|
223
|
-
});
|
|
228
|
+
for (const [
|
|
229
|
+
runtimeGlobal,
|
|
230
|
+
RuntimeModule
|
|
231
|
+
] of SIMPLE_TREE_RUNTIME_MODULES) {
|
|
232
|
+
compilation.hooks.runtimeRequirementInTree
|
|
233
|
+
.for(runtimeGlobal)
|
|
234
|
+
.tap(PLUGIN_NAME, (chunk) => {
|
|
235
|
+
compilation.addRuntimeModule(chunk, new RuntimeModule());
|
|
236
|
+
return true;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
224
239
|
compilation.hooks.runtimeRequirementInTree
|
|
225
240
|
.for(RuntimeGlobals.makeOptimizedDeferredNamespaceObject)
|
|
226
|
-
.tap(
|
|
241
|
+
.tap(PLUGIN_NAME, (chunk, runtimeRequirement) => {
|
|
227
242
|
compilation.addRuntimeModule(
|
|
228
243
|
chunk,
|
|
229
244
|
new MakeOptimizedDeferredNamespaceObjectRuntimeModule(
|
|
@@ -234,7 +249,7 @@ class RuntimePlugin {
|
|
|
234
249
|
});
|
|
235
250
|
compilation.hooks.runtimeRequirementInTree
|
|
236
251
|
.for(RuntimeGlobals.makeDeferredNamespaceObject)
|
|
237
|
-
.tap(
|
|
252
|
+
.tap(PLUGIN_NAME, (chunk, runtimeRequirement) => {
|
|
238
253
|
compilation.addRuntimeModule(
|
|
239
254
|
chunk,
|
|
240
255
|
new MakeDeferredNamespaceObjectRuntimeModule(
|
|
@@ -243,39 +258,6 @@ class RuntimePlugin {
|
|
|
243
258
|
);
|
|
244
259
|
return true;
|
|
245
260
|
});
|
|
246
|
-
compilation.hooks.runtimeRequirementInTree
|
|
247
|
-
.for(RuntimeGlobals.hasOwnProperty)
|
|
248
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
249
|
-
compilation.addRuntimeModule(
|
|
250
|
-
chunk,
|
|
251
|
-
new HasOwnPropertyRuntimeModule()
|
|
252
|
-
);
|
|
253
|
-
return true;
|
|
254
|
-
});
|
|
255
|
-
compilation.hooks.runtimeRequirementInTree
|
|
256
|
-
.for(RuntimeGlobals.compatGetDefaultExport)
|
|
257
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
258
|
-
compilation.addRuntimeModule(
|
|
259
|
-
chunk,
|
|
260
|
-
new CompatGetDefaultExportRuntimeModule()
|
|
261
|
-
);
|
|
262
|
-
return true;
|
|
263
|
-
});
|
|
264
|
-
compilation.hooks.runtimeRequirementInTree
|
|
265
|
-
.for(RuntimeGlobals.setAnonymousDefaultName)
|
|
266
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
267
|
-
compilation.addRuntimeModule(
|
|
268
|
-
chunk,
|
|
269
|
-
new SetAnonymousDefaultNameRuntimeModule()
|
|
270
|
-
);
|
|
271
|
-
return true;
|
|
272
|
-
});
|
|
273
|
-
compilation.hooks.runtimeRequirementInTree
|
|
274
|
-
.for(RuntimeGlobals.runtimeId)
|
|
275
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
276
|
-
compilation.addRuntimeModule(chunk, new RuntimeIdRuntimeModule());
|
|
277
|
-
return true;
|
|
278
|
-
});
|
|
279
261
|
compilation.hooks.runtimeRequirementInTree
|
|
280
262
|
.for(RuntimeGlobals.publicPath)
|
|
281
263
|
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
@@ -289,8 +271,11 @@ class RuntimePlugin {
|
|
|
289
271
|
|
|
290
272
|
if (publicPath === "auto") {
|
|
291
273
|
const module = new AutoPublicPathRuntimeModule();
|
|
274
|
+
// A worklet chunk reads `import.meta.url`, so it needs neither the
|
|
275
|
+
// worker-scope detection nor the `globalThis` polyfill.
|
|
292
276
|
if (
|
|
293
277
|
scriptType !== "module" &&
|
|
278
|
+
!(entryOptions && entryOptions.worklet) &&
|
|
294
279
|
!outputOptions.environment.globalThis
|
|
295
280
|
) {
|
|
296
281
|
set.add(RuntimeGlobals.global);
|
|
@@ -308,12 +293,6 @@ class RuntimePlugin {
|
|
|
308
293
|
}
|
|
309
294
|
return true;
|
|
310
295
|
});
|
|
311
|
-
compilation.hooks.runtimeRequirementInTree
|
|
312
|
-
.for(RuntimeGlobals.global)
|
|
313
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
314
|
-
compilation.addRuntimeModule(chunk, new GlobalRuntimeModule());
|
|
315
|
-
return true;
|
|
316
|
-
});
|
|
317
296
|
compilation.hooks.runtimeRequirementInTree
|
|
318
297
|
.for(RuntimeGlobals.asyncModule)
|
|
319
298
|
.tap(PLUGIN_NAME, (chunk) => {
|
|
@@ -324,6 +303,16 @@ class RuntimePlugin {
|
|
|
324
303
|
);
|
|
325
304
|
return true;
|
|
326
305
|
});
|
|
306
|
+
compilation.hooks.runtimeRequirementInTree
|
|
307
|
+
.for(RuntimeGlobals.asyncModuleGenerator)
|
|
308
|
+
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
309
|
+
set.add(RuntimeGlobals.asyncModule);
|
|
310
|
+
compilation.addRuntimeModule(
|
|
311
|
+
chunk,
|
|
312
|
+
new AsyncModuleGeneratorRuntimeModule()
|
|
313
|
+
);
|
|
314
|
+
return true;
|
|
315
|
+
});
|
|
327
316
|
compilation.hooks.runtimeRequirementInTree
|
|
328
317
|
.for(RuntimeGlobals.systemContext)
|
|
329
318
|
.tap(PLUGIN_NAME, (chunk) => {
|
|
@@ -375,6 +364,16 @@ class RuntimePlugin {
|
|
|
375
364
|
);
|
|
376
365
|
return true;
|
|
377
366
|
});
|
|
367
|
+
compilation.hooks.runtimeRequirementInTree
|
|
368
|
+
.for(RuntimeGlobals.getWorkletBootstrap)
|
|
369
|
+
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
370
|
+
set.add(RuntimeGlobals.baseURI);
|
|
371
|
+
compilation.addRuntimeModule(
|
|
372
|
+
chunk,
|
|
373
|
+
new GetWorkletBootstrapRuntimeModule()
|
|
374
|
+
);
|
|
375
|
+
return true;
|
|
376
|
+
});
|
|
378
377
|
compilation.hooks.runtimeRequirementInTree
|
|
379
378
|
.for(RuntimeGlobals.getChunkCssFilename)
|
|
380
379
|
.tap(PLUGIN_NAME, (chunk, set, { chunkGraph }) => {
|
|
@@ -467,12 +466,6 @@ class RuntimePlugin {
|
|
|
467
466
|
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
468
467
|
set.add(RuntimeGlobals.ensureChunkHandlers);
|
|
469
468
|
});
|
|
470
|
-
compilation.hooks.runtimeRequirementInTree
|
|
471
|
-
.for(RuntimeGlobals.shareScopeMap)
|
|
472
|
-
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
473
|
-
compilation.addRuntimeModule(chunk, new ShareRuntimeModule());
|
|
474
|
-
return true;
|
|
475
|
-
});
|
|
476
469
|
compilation.hooks.runtimeRequirementInTree
|
|
477
470
|
.for(RuntimeGlobals.loadScript)
|
|
478
471
|
.tap(PLUGIN_NAME, (chunk, set) => {
|
|
@@ -519,27 +512,6 @@ class RuntimePlugin {
|
|
|
519
512
|
);
|
|
520
513
|
return true;
|
|
521
514
|
});
|
|
522
|
-
compilation.hooks.runtimeRequirementInTree
|
|
523
|
-
.for(RuntimeGlobals.relativeUrl)
|
|
524
|
-
.tap(PLUGIN_NAME, (chunk, _set) => {
|
|
525
|
-
compilation.addRuntimeModule(chunk, new RelativeUrlRuntimeModule());
|
|
526
|
-
return true;
|
|
527
|
-
});
|
|
528
|
-
compilation.hooks.runtimeRequirementInTree
|
|
529
|
-
.for(RuntimeGlobals.worker)
|
|
530
|
-
.tap(PLUGIN_NAME, (chunk, _set) => {
|
|
531
|
-
compilation.addRuntimeModule(chunk, new WorkerRuntimeModule());
|
|
532
|
-
return true;
|
|
533
|
-
});
|
|
534
|
-
compilation.hooks.runtimeRequirementInTree
|
|
535
|
-
.for(RuntimeGlobals.onChunksLoaded)
|
|
536
|
-
.tap(PLUGIN_NAME, (chunk, _set) => {
|
|
537
|
-
compilation.addRuntimeModule(
|
|
538
|
-
chunk,
|
|
539
|
-
new OnChunksLoadedRuntimeModule()
|
|
540
|
-
);
|
|
541
|
-
return true;
|
|
542
|
-
});
|
|
543
515
|
compilation.hooks.runtimeRequirementInTree
|
|
544
516
|
.for(RuntimeGlobals.baseURI)
|
|
545
517
|
.tap(PLUGIN_NAME, (chunk) => {
|
|
@@ -548,18 +520,6 @@ class RuntimePlugin {
|
|
|
548
520
|
return true;
|
|
549
521
|
}
|
|
550
522
|
});
|
|
551
|
-
compilation.hooks.runtimeRequirementInTree
|
|
552
|
-
.for(RuntimeGlobals.scriptNonce)
|
|
553
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
554
|
-
compilation.addRuntimeModule(chunk, new NonceRuntimeModule());
|
|
555
|
-
return true;
|
|
556
|
-
});
|
|
557
|
-
compilation.hooks.runtimeRequirementInTree
|
|
558
|
-
.for(RuntimeGlobals.toBinary)
|
|
559
|
-
.tap(PLUGIN_NAME, (chunk) => {
|
|
560
|
-
compilation.addRuntimeModule(chunk, new ToBinaryRuntimeModule());
|
|
561
|
-
return true;
|
|
562
|
-
});
|
|
563
523
|
// TODO webpack 6: remove CompatRuntimeModule
|
|
564
524
|
compilation.hooks.additionalTreeRuntimeRequirements.tap(
|
|
565
525
|
PLUGIN_NAME,
|