webpack 5.108.3 → 5.109.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.
- package/lib/APIPlugin.js +48 -29
- package/lib/CacheFacade.js +8 -0
- package/lib/ChunkGroup.js +1 -0
- package/lib/CompatibilityPlugin.js +31 -29
- package/lib/Compilation.js +50 -8
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextModule.js +239 -6
- package/lib/ContextModuleFactory.js +139 -14
- package/lib/DefinePlugin.js +396 -101
- package/lib/Entrypoint.js +1 -1
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +107 -5
- package/lib/ExternalModuleFactoryPlugin.js +20 -1
- package/lib/FileSystemInfo.js +130 -74
- package/lib/FlagDependencyExportsPlugin.js +55 -8
- package/lib/HotModuleReplacementPlugin.js +18 -15
- package/lib/LazyBarrel.js +30 -3
- 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 +169 -405
- 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 +33 -0
- package/lib/RuntimeTemplate.js +304 -16
- 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 +222 -32
- package/lib/config/normalization.js +26 -0
- package/lib/config/target.js +9 -1
- package/lib/css/CssGenerator.js +73 -73
- package/lib/css/CssLoadingRuntimeModule.js +5 -1
- package/lib/css/CssModulesPlugin.js +92 -53
- package/lib/css/CssParser.js +843 -302
- package/lib/css/syntax.js +1219 -483
- 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/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 +190 -87
- 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/HarmonyExportDependencyParserPlugin.js +7 -19
- package/lib/dependencies/HarmonyImportDependency.js +12 -1
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +34 -107
- package/lib/dependencies/HarmonyImportGuard.js +192 -20
- 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 +87 -26
- 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 +32 -8
- package/lib/html/HtmlGenerator.js +940 -91
- package/lib/html/HtmlModule.js +3 -2
- package/lib/html/HtmlModulesPlugin.js +625 -170
- package/lib/html/HtmlParser.js +812 -340
- package/lib/html/favicon.svg +1 -0
- package/lib/html/syntax.js +2116 -834
- package/lib/ids/IdHelpers.js +1 -1
- 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 +711 -355
- package/lib/javascript/JavascriptParserHelpers.js +3 -6
- package/lib/javascript/syntax.js +4380 -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 +19 -0
- package/lib/node/ReadFileCompileWasmPlugin.js +14 -0
- package/lib/optimize/ConcatenatedModule.js +120 -16
- package/lib/optimize/FlagIncludedChunksPlugin.js +13 -3
- package/lib/optimize/InnerGraphPlugin.js +50 -30
- package/lib/optimize/ModuleConcatenationPlugin.js +69 -3
- package/lib/optimize/SideEffectsFlagPlugin.js +86 -43
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +15 -0
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +24 -13
- package/lib/prefetch/ResourceHintPlugin.js +663 -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/FileMiddleware.js +29 -3
- package/lib/stats/DefaultStatsFactoryPlugin.js +32 -3
- package/lib/stats/DefaultStatsPresetPlugin.js +2 -0
- package/lib/stats/DefaultStatsPrinterPlugin.js +12 -2
- package/lib/stats/StatsFactory.js +15 -8
- package/lib/url/URLParserPlugin.js +98 -19
- package/lib/util/AsyncQueue.js +122 -72
- package/lib/util/LocConverter.js +9 -8
- package/lib/util/SetHelpers.js +1 -1
- package/lib/util/SourceProcessor.js +41 -28
- 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 +14 -13
- 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 +1300 -325
|
@@ -5,16 +5,23 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
const {
|
|
9
|
+
ASSET_URL_TYPE,
|
|
10
|
+
JAVASCRIPT_TYPE
|
|
11
|
+
} = require("../ModuleSourceTypeConstants");
|
|
8
12
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
9
13
|
const RawDataUrlModule = require("../asset/RawDataUrlModule");
|
|
10
14
|
const {
|
|
11
15
|
getDependencyUsedByExportsCondition
|
|
12
16
|
} = require("../optimize/InnerGraph");
|
|
17
|
+
const { toJsStringLiteral } = require("../util/identifier");
|
|
13
18
|
const makeSerializable = require("../util/makeSerializable");
|
|
14
19
|
const memoize = require("../util/memoize");
|
|
15
20
|
const ModuleDependency = require("./ModuleDependency");
|
|
16
21
|
|
|
17
22
|
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
|
23
|
+
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
|
24
|
+
/** @typedef {import("../Compilation")} Compilation */
|
|
18
25
|
/** @typedef {import("../Dependency")} Dependency */
|
|
19
26
|
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
|
20
27
|
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
|
@@ -22,13 +29,71 @@ const ModuleDependency = require("./ModuleDependency");
|
|
|
22
29
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
|
23
30
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
|
24
31
|
/** @typedef {import("../optimize/InnerGraph").UsedByExports} UsedByExports */
|
|
25
|
-
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext<[Range, boolean, UsedByExports | undefined]>} ObjectDeserializerContext */
|
|
26
|
-
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext<[Range, boolean, UsedByExports | undefined]>} ObjectSerializerContext */
|
|
32
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext<[Range, boolean, UsedByExports | undefined, true | undefined, true | undefined, ("high" | "low" | "auto" | undefined), string | undefined, string | undefined, string | undefined]>} ObjectDeserializerContext */
|
|
33
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext<[Range, boolean, UsedByExports | undefined, true | undefined, true | undefined, ("high" | "low" | "auto" | undefined), string | undefined, string | undefined, string | undefined]>} ObjectSerializerContext */
|
|
27
34
|
|
|
28
35
|
const getIgnoredRawDataUrlModule = memoize(
|
|
29
36
|
() => new RawDataUrlModule("data:,", "ignored-asset", "(ignored asset)")
|
|
30
37
|
);
|
|
31
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the static literal specifier (already quoted) for `new URL(<here>, import.meta.url)`,
|
|
41
|
+
* or `null` when the asset url can't be determined statically (e.g. a runtime/dynamic publicPath).
|
|
42
|
+
* @param {URLDependency} dep the dependency
|
|
43
|
+
* @param {DependencyTemplateContext} templateContext the template context
|
|
44
|
+
* @returns {string | null} a JS string literal, or `null` to fall back to the runtime form
|
|
45
|
+
*/
|
|
46
|
+
const getAnalyzableUrlSpecifier = (dep, templateContext) => {
|
|
47
|
+
const {
|
|
48
|
+
module: consumingModule,
|
|
49
|
+
moduleGraph,
|
|
50
|
+
chunkGraph,
|
|
51
|
+
runtime,
|
|
52
|
+
codeGenerationResults,
|
|
53
|
+
runtimeTemplate
|
|
54
|
+
} = templateContext;
|
|
55
|
+
const assetModule = moduleGraph.getModule(dep);
|
|
56
|
+
if (!assetModule || !codeGenerationResults.has(assetModule, runtime)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const urlData = codeGenerationResults.getData(assetModule, runtime, "url");
|
|
60
|
+
if (!urlData) return null;
|
|
61
|
+
|
|
62
|
+
const jsUrl = urlData[JAVASCRIPT_TYPE];
|
|
63
|
+
if (typeof jsUrl === "string") {
|
|
64
|
+
// The asset concatenates the runtime publicPath; rebuild a literal from the
|
|
65
|
+
// resolved filename. The base is the consuming chunk (`import.meta.url`).
|
|
66
|
+
if (jsUrl.includes(RuntimeGlobals.require)) {
|
|
67
|
+
const filename = codeGenerationResults.getData(
|
|
68
|
+
assetModule,
|
|
69
|
+
runtime,
|
|
70
|
+
"filename"
|
|
71
|
+
);
|
|
72
|
+
if (typeof filename !== "string") return null;
|
|
73
|
+
const { publicPath } = runtimeTemplate.outputOptions;
|
|
74
|
+
if (publicPath === "auto") {
|
|
75
|
+
const undo = runtimeTemplate._getModuleUndoPath(
|
|
76
|
+
consumingModule,
|
|
77
|
+
chunkGraph
|
|
78
|
+
);
|
|
79
|
+
return undo === null ? null : toJsStringLiteral(undo + filename);
|
|
80
|
+
}
|
|
81
|
+
if (typeof publicPath === "string" && !publicPath.includes("[")) {
|
|
82
|
+
return toJsStringLiteral(publicPath + filename);
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
// An already-quoted literal (generator `publicPath` / data: url) is used as-is;
|
|
87
|
+
// a raw value (external asset) is normalized to a quoted string.
|
|
88
|
+
return jsUrl.startsWith('"') ? jsUrl : toJsStringLiteral(jsUrl);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Wrapper dropped: the asset is consumed as `asset-url` (absolute publicPath),
|
|
92
|
+
// so its resolved url is already a chunk-independent literal.
|
|
93
|
+
const assetUrl = urlData[ASSET_URL_TYPE];
|
|
94
|
+
return typeof assetUrl === "string" ? toJsStringLiteral(assetUrl) : null;
|
|
95
|
+
};
|
|
96
|
+
|
|
32
97
|
class URLDependency extends ModuleDependency {
|
|
33
98
|
/**
|
|
34
99
|
* Creates an instance of URLDependency.
|
|
@@ -45,6 +110,18 @@ class URLDependency extends ModuleDependency {
|
|
|
45
110
|
this.relative = relative || false;
|
|
46
111
|
/** @type {UsedByExports | undefined} */
|
|
47
112
|
this.usedByExports = undefined;
|
|
113
|
+
/** @type {true | undefined} */
|
|
114
|
+
this.prefetch = undefined;
|
|
115
|
+
/** @type {true | undefined} */
|
|
116
|
+
this.preload = undefined;
|
|
117
|
+
/** @type {"high" | "low" | "auto" | undefined} */
|
|
118
|
+
this.fetchPriority = undefined;
|
|
119
|
+
/** @type {string | undefined} */
|
|
120
|
+
this.asAttribute = undefined;
|
|
121
|
+
/** @type {string | undefined} */
|
|
122
|
+
this.typeAttribute = undefined;
|
|
123
|
+
/** @type {string | undefined} */
|
|
124
|
+
this.mediaAttribute = undefined;
|
|
48
125
|
}
|
|
49
126
|
|
|
50
127
|
get type() {
|
|
@@ -81,7 +158,13 @@ class URLDependency extends ModuleDependency {
|
|
|
81
158
|
context
|
|
82
159
|
.write(this.outerRange)
|
|
83
160
|
.write(this.relative)
|
|
84
|
-
.write(this.usedByExports)
|
|
161
|
+
.write(this.usedByExports)
|
|
162
|
+
.write(this.prefetch)
|
|
163
|
+
.write(this.preload)
|
|
164
|
+
.write(this.fetchPriority)
|
|
165
|
+
.write(this.asAttribute)
|
|
166
|
+
.write(this.typeAttribute)
|
|
167
|
+
.write(this.mediaAttribute);
|
|
85
168
|
super.serialize(context);
|
|
86
169
|
}
|
|
87
170
|
|
|
@@ -95,7 +178,19 @@ class URLDependency extends ModuleDependency {
|
|
|
95
178
|
this.relative = c1.read();
|
|
96
179
|
const c2 = c1.rest;
|
|
97
180
|
this.usedByExports = c2.read();
|
|
98
|
-
|
|
181
|
+
const c3 = c2.rest;
|
|
182
|
+
this.prefetch = c3.read();
|
|
183
|
+
const c4 = c3.rest;
|
|
184
|
+
this.preload = c4.read();
|
|
185
|
+
const c5 = c4.rest;
|
|
186
|
+
this.fetchPriority = c5.read();
|
|
187
|
+
const c6 = c5.rest;
|
|
188
|
+
this.asAttribute = c6.read();
|
|
189
|
+
const c7 = c6.rest;
|
|
190
|
+
this.typeAttribute = c7.read();
|
|
191
|
+
const c8 = c7.rest;
|
|
192
|
+
this.mediaAttribute = c8.read();
|
|
193
|
+
super.deserialize(c8.rest);
|
|
99
194
|
}
|
|
100
195
|
}
|
|
101
196
|
|
|
@@ -129,36 +224,61 @@ URLDependency.Template = class URLDependencyTemplate extends (
|
|
|
129
224
|
return;
|
|
130
225
|
}
|
|
131
226
|
|
|
227
|
+
// For ESM module output, emit the analyzable `new URL("./asset", import.meta.url)`
|
|
228
|
+
// form (literal specifier, no runtime helpers) so other bundlers and webpack itself
|
|
229
|
+
// can statically follow the asset. `url: "relative"` and prefetch/preload hints
|
|
230
|
+
// (which need the runtime asset reference) keep the runtime form.
|
|
231
|
+
if (
|
|
232
|
+
!dep.relative &&
|
|
233
|
+
!dep.prefetch &&
|
|
234
|
+
!dep.preload &&
|
|
235
|
+
runtimeTemplate.supportsAnalyzableEsm()
|
|
236
|
+
) {
|
|
237
|
+
const specifier = getAnalyzableUrlSpecifier(dep, templateContext);
|
|
238
|
+
if (specifier !== null) {
|
|
239
|
+
source.replace(
|
|
240
|
+
dep.range[0],
|
|
241
|
+
dep.range[1] - 1,
|
|
242
|
+
`/* asset import */ ${specifier}, ${runtimeTemplate.outputOptions.importMetaName}.url`
|
|
243
|
+
);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
132
248
|
runtimeRequirements.add(RuntimeGlobals.require);
|
|
133
249
|
|
|
250
|
+
const module = moduleGraph.getModule(dep);
|
|
251
|
+
const moduleRaw = runtimeTemplate.moduleRaw({
|
|
252
|
+
chunkGraph,
|
|
253
|
+
module,
|
|
254
|
+
request: dep.request,
|
|
255
|
+
runtimeRequirements,
|
|
256
|
+
weak: false
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Resource hints fire eagerly at chunk startup via the marker
|
|
260
|
+
// requirement / `StartupAssetHintRuntimeModule`; the call site stays
|
|
261
|
+
// a plain URL expression, so the browser is already prefetching by
|
|
262
|
+
// the time user code reaches this line.
|
|
263
|
+
if (dep.prefetch || dep.preload) {
|
|
264
|
+
runtimeRequirements.add(RuntimeGlobals.startupAssetHints);
|
|
265
|
+
if (dep.prefetch) runtimeRequirements.add(RuntimeGlobals.prefetchAsset);
|
|
266
|
+
if (dep.preload) runtimeRequirements.add(RuntimeGlobals.preloadAsset);
|
|
267
|
+
}
|
|
268
|
+
|
|
134
269
|
if (dep.relative) {
|
|
135
270
|
runtimeRequirements.add(RuntimeGlobals.relativeUrl);
|
|
136
271
|
source.replace(
|
|
137
272
|
dep.outerRange[0],
|
|
138
273
|
dep.outerRange[1] - 1,
|
|
139
|
-
`/* asset import */ new ${
|
|
140
|
-
RuntimeGlobals.relativeUrl
|
|
141
|
-
}(${runtimeTemplate.moduleRaw({
|
|
142
|
-
chunkGraph,
|
|
143
|
-
module: moduleGraph.getModule(dep),
|
|
144
|
-
request: dep.request,
|
|
145
|
-
runtimeRequirements,
|
|
146
|
-
weak: false
|
|
147
|
-
})})`
|
|
274
|
+
`/* asset import */ new ${RuntimeGlobals.relativeUrl}(${moduleRaw})`
|
|
148
275
|
);
|
|
149
276
|
} else {
|
|
150
277
|
runtimeRequirements.add(RuntimeGlobals.baseURI);
|
|
151
|
-
|
|
152
278
|
source.replace(
|
|
153
279
|
dep.range[0],
|
|
154
280
|
dep.range[1] - 1,
|
|
155
|
-
`/* asset import */ ${
|
|
156
|
-
chunkGraph,
|
|
157
|
-
module: moduleGraph.getModule(dep),
|
|
158
|
-
request: dep.request,
|
|
159
|
-
runtimeRequirements,
|
|
160
|
-
weak: false
|
|
161
|
-
})}, ${RuntimeGlobals.baseURI}`
|
|
281
|
+
`/* asset import */ ${moduleRaw}, ${RuntimeGlobals.baseURI}`
|
|
162
282
|
);
|
|
163
283
|
}
|
|
164
284
|
}
|