webpack 5.90.3 → 5.92.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 +5 -5
- package/bin/webpack.js +6 -3
- package/lib/APIPlugin.js +14 -6
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +3 -1
- package/lib/Cache.js +8 -2
- package/lib/CacheFacade.js +3 -3
- package/lib/Chunk.js +7 -4
- package/lib/ChunkGraph.js +52 -25
- package/lib/ChunkGroup.js +23 -17
- package/lib/CleanPlugin.js +8 -6
- package/lib/Compilation.js +295 -120
- package/lib/Compiler.js +223 -87
- package/lib/ConcatenationScope.js +3 -3
- package/lib/ConditionalInitFragment.js +4 -5
- package/lib/ContextModule.js +95 -41
- package/lib/ContextModuleFactory.js +4 -2
- package/lib/ContextReplacementPlugin.js +3 -2
- package/lib/DefinePlugin.js +18 -6
- package/lib/Dependency.js +12 -10
- package/lib/DependencyTemplate.js +17 -7
- package/lib/DllModule.js +1 -0
- package/lib/DllReferencePlugin.js +7 -3
- package/lib/EntryOptionPlugin.js +4 -1
- package/lib/EntryPlugin.js +6 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/EvalDevToolModulePlugin.js +11 -0
- package/lib/ExportsInfo.js +23 -8
- package/lib/ExternalModule.js +160 -35
- package/lib/ExternalModuleFactoryPlugin.js +37 -2
- package/lib/FileSystemInfo.js +69 -42
- package/lib/FlagDependencyExportsPlugin.js +21 -7
- package/lib/Generator.js +4 -4
- package/lib/HookWebpackError.js +2 -2
- package/lib/HotModuleReplacementPlugin.js +108 -45
- package/lib/IgnorePlugin.js +4 -1
- package/lib/InitFragment.js +5 -3
- package/lib/LibManifestPlugin.js +17 -9
- package/lib/Module.js +41 -14
- package/lib/ModuleFactory.js +3 -3
- package/lib/ModuleFilenameHelpers.js +30 -17
- package/lib/ModuleGraph.js +60 -31
- package/lib/ModuleGraphConnection.js +2 -1
- package/lib/MultiCompiler.js +62 -9
- package/lib/NodeStuffPlugin.js +14 -3
- package/lib/NormalModule.js +13 -13
- package/lib/NormalModuleFactory.js +18 -9
- package/lib/NormalModuleReplacementPlugin.js +5 -1
- package/lib/Parser.js +1 -1
- package/lib/PlatformPlugin.js +39 -0
- package/lib/ProgressPlugin.js +1 -1
- package/lib/ProvidePlugin.js +3 -1
- package/lib/RawModule.js +2 -1
- package/lib/RecordIdsPlugin.js +4 -4
- package/lib/ResolverFactory.js +6 -4
- package/lib/RuntimeModule.js +4 -4
- package/lib/RuntimePlugin.js +1 -0
- package/lib/RuntimeTemplate.js +124 -52
- package/lib/SourceMapDevToolPlugin.js +4 -1
- package/lib/Stats.js +11 -4
- package/lib/Template.js +5 -5
- package/lib/TemplatedPathPlugin.js +48 -7
- package/lib/Watching.js +67 -60
- package/lib/WebpackError.js +6 -6
- package/lib/WebpackOptionsApply.js +18 -5
- package/lib/asset/AssetGenerator.js +15 -0
- package/lib/asset/RawDataUrlModule.js +3 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +120 -67
- package/lib/cache/IdleFileCachePlugin.js +8 -3
- package/lib/cache/MemoryCachePlugin.js +1 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
- package/lib/cache/PackFileCacheStrategy.js +51 -18
- package/lib/cache/ResolverCachePlugin.js +22 -14
- package/lib/cache/getLazyHashedEtag.js +2 -2
- package/lib/cli.js +5 -5
- package/lib/config/browserslistTargetHandler.js +7 -1
- package/lib/config/defaults.js +108 -34
- package/lib/config/normalization.js +3 -1
- package/lib/config/target.js +18 -11
- package/lib/container/ContainerEntryDependency.js +2 -1
- package/lib/container/ContainerEntryModule.js +4 -2
- package/lib/container/ContainerPlugin.js +14 -10
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/RemoteRuntimeModule.js +12 -3
- package/lib/css/CssExportsGenerator.js +68 -25
- package/lib/css/CssGenerator.js +34 -6
- package/lib/css/CssLoadingRuntimeModule.js +217 -98
- package/lib/css/CssModulesPlugin.js +238 -107
- package/lib/css/CssParser.js +24 -15
- package/lib/css/walkCssTokens.js +1 -1
- package/lib/debug/ProfilingPlugin.js +28 -3
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +9 -5
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +4 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +2 -1
- package/lib/dependencies/CommonJsExportRequireDependency.js +33 -18
- package/lib/dependencies/CommonJsExportsDependency.js +13 -5
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -15
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -2
- package/lib/dependencies/ContextDependencyHelpers.js +49 -29
- package/lib/dependencies/ContextElementDependency.js +8 -1
- package/lib/dependencies/CssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +71 -9
- package/lib/dependencies/CssUrlDependency.js +10 -7
- package/lib/dependencies/ExportsInfoDependency.js +5 -4
- package/lib/dependencies/ExternalModuleDependency.js +4 -2
- package/lib/dependencies/ExternalModuleInitFragment.js +5 -3
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -4
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +43 -23
- package/lib/dependencies/HarmonyExportHeaderDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +73 -32
- package/lib/dependencies/HarmonyExportInitFragment.js +10 -2
- package/lib/dependencies/HarmonyImportDependency.js +28 -12
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +70 -19
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -6
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +47 -35
- package/lib/dependencies/ImportDependency.js +9 -2
- package/lib/dependencies/ImportEagerDependency.js +4 -2
- package/lib/dependencies/ImportMetaContextDependency.js +7 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +25 -14
- package/lib/dependencies/ImportMetaPlugin.js +1 -1
- package/lib/dependencies/ImportParserPlugin.js +15 -5
- package/lib/dependencies/ImportWeakDependency.js +4 -2
- package/lib/dependencies/LoaderDependency.js +2 -1
- package/lib/dependencies/LoaderImportDependency.js +2 -1
- package/lib/dependencies/LoaderPlugin.js +2 -2
- package/lib/dependencies/ModuleDependency.js +4 -5
- package/lib/dependencies/PureExpressionDependency.js +64 -47
- package/lib/dependencies/RequireContextPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +26 -14
- package/lib/dependencies/RequireEnsureDependency.js +1 -1
- package/lib/dependencies/URLDependency.js +7 -4
- package/lib/dependencies/WorkerDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +2 -1
- package/lib/dependencies/getFunctionExpression.js +3 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +92 -3
- package/lib/hmr/LazyCompilationPlugin.js +2 -2
- package/lib/ids/ChunkModuleIdRangePlugin.js +1 -1
- package/lib/ids/DeterministicChunkIdsPlugin.js +1 -1
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +6 -6
- package/lib/ids/NamedChunkIdsPlugin.js +1 -1
- package/lib/ids/NamedModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +2 -2
- package/lib/index.js +11 -0
- package/lib/javascript/BasicEvaluatedExpression.js +2 -2
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +0 -1
- package/lib/javascript/JavascriptModulesPlugin.js +174 -17
- package/lib/javascript/JavascriptParser.js +204 -71
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/javascript/StartupHelpers.js +22 -5
- package/lib/library/AbstractLibraryPlugin.js +2 -2
- package/lib/library/AmdLibraryPlugin.js +2 -2
- package/lib/library/AssignLibraryPlugin.js +3 -3
- package/lib/library/ExportPropertyLibraryPlugin.js +2 -2
- package/lib/library/JsonpLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +2 -2
- package/lib/library/SystemLibraryPlugin.js +2 -2
- package/lib/library/UmdLibraryPlugin.js +33 -12
- package/lib/logging/Logger.js +27 -2
- package/lib/logging/createConsoleLogger.js +13 -9
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -1
- package/lib/node/NodeEnvironmentPlugin.js +14 -8
- package/lib/node/NodeTemplatePlugin.js +1 -1
- package/lib/node/NodeWatchFileSystem.js +37 -26
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/ReadFileCompileWasmPlugin.js +1 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/nodeConsole.js +24 -1
- package/lib/optimize/AggressiveMergingPlugin.js +1 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +140 -121
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/InnerGraph.js +8 -3
- package/lib/optimize/InnerGraphPlugin.js +36 -13
- package/lib/optimize/LimitChunkCountPlugin.js +1 -2
- package/lib/optimize/ModuleConcatenationPlugin.js +13 -3
- package/lib/optimize/RealContentHashPlugin.js +3 -3
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/RuntimeChunkPlugin.js +6 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +48 -17
- package/lib/optimize/SplitChunksPlugin.js +10 -10
- package/lib/performance/SizeLimitsPlugin.js +13 -2
- package/lib/rules/ObjectMatcherRulePlugin.js +15 -1
- package/lib/rules/RuleSetCompiler.js +9 -7
- package/lib/runtime/EnsureChunkRuntimeModule.js +2 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +2 -1
- package/lib/runtime/LoadScriptRuntimeModule.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +4 -4
- package/lib/serialization/FileMiddleware.js +4 -3
- package/lib/serialization/NullPrototypeObjectSerializer.js +2 -2
- package/lib/serialization/ObjectMiddleware.js +8 -5
- package/lib/serialization/PlainObjectSerializer.js +2 -2
- package/lib/serialization/Serializer.js +19 -0
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/serialization/SingleItemMiddleware.js +2 -2
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedModule.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +17 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -2
- package/lib/sharing/ProvideSharedPlugin.js +13 -6
- package/lib/sharing/resolveMatchedConfigs.js +3 -3
- package/lib/sharing/utils.js +13 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +20 -20
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/stats/StatsFactory.js +2 -2
- package/lib/stats/StatsPrinter.js +6 -6
- package/lib/util/ArrayQueue.js +14 -21
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/util/Queue.js +8 -2
- package/lib/util/SortableSet.js +16 -4
- package/lib/util/StackedCacheMap.js +26 -0
- package/lib/util/TupleQueue.js +8 -2
- package/lib/util/WeakTupleMap.js +57 -13
- package/lib/util/binarySearchBounds.js +1 -1
- package/lib/util/cleverMerge.js +26 -13
- package/lib/util/comparators.js +37 -15
- package/lib/util/conventions.js +129 -0
- package/lib/util/createHash.js +3 -5
- package/lib/util/deprecation.js +3 -3
- package/lib/util/deterministicGrouping.js +2 -2
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +383 -69
- package/lib/util/hash/BatchedHash.js +3 -0
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/identifier.js +5 -5
- package/lib/util/mergeScope.js +79 -0
- package/lib/util/runtime.js +2 -17
- package/lib/util/semver.js +3 -0
- package/lib/util/smartGrouping.js +3 -3
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +4 -2
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -2
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +16 -7
- package/lib/wasm-sync/WebAssemblyGenerator.js +40 -19
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +1 -1
- package/lib/wasm-sync/WebAssemblyParser.js +7 -4
- package/lib/wasm-sync/WebAssemblyUtils.js +2 -1
- package/lib/web/FetchCompileWasmPlugin.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +3 -2
- package/lib/webpack.js +19 -6
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -1
- package/package.json +40 -39
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +97 -8
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +5 -1
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
- package/types.d.ts +1826 -639
@@ -14,13 +14,13 @@ const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__";
|
|
14
14
|
const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";
|
15
15
|
|
16
16
|
/**
|
17
|
-
* @typedef {
|
17
|
+
* @typedef {object} ExternalModuleInfo
|
18
18
|
* @property {number} index
|
19
19
|
* @property {Module} module
|
20
20
|
*/
|
21
21
|
|
22
22
|
/**
|
23
|
-
* @typedef {
|
23
|
+
* @typedef {object} ConcatenatedModuleInfo
|
24
24
|
* @property {number} index
|
25
25
|
* @property {Module} module
|
26
26
|
* @property {Map<string, string>} exportMap mapping from export name to symbol
|
@@ -31,7 +31,7 @@ const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";
|
|
31
31
|
/** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo} ModuleInfo */
|
32
32
|
|
33
33
|
/**
|
34
|
-
* @typedef {
|
34
|
+
* @typedef {object} ModuleReferenceOptions
|
35
35
|
* @property {string[]} ids the properties/exports of the module
|
36
36
|
* @property {boolean} call true, when this referenced export is called
|
37
37
|
* @property {boolean} directImport true, when this referenced export is directly imported (not via property access)
|
@@ -37,17 +37,16 @@ const wrapInCondition = (condition, source) => {
|
|
37
37
|
};
|
38
38
|
|
39
39
|
/**
|
40
|
-
* @
|
41
|
-
* @extends {InitFragment<Context>}
|
40
|
+
* @extends {InitFragment<GenerateContext>}
|
42
41
|
*/
|
43
42
|
class ConditionalInitFragment extends InitFragment {
|
44
43
|
/**
|
45
|
-
* @param {string|Source} content the source code that will be included as initialization code
|
44
|
+
* @param {string | Source | undefined} content the source code that will be included as initialization code
|
46
45
|
* @param {number} stage category of initialization code (contribute to order)
|
47
46
|
* @param {number} position position in the category (contribute to order)
|
48
47
|
* @param {string | undefined} key unique key to avoid emitting the same initialization code twice
|
49
48
|
* @param {RuntimeSpec | boolean} runtimeCondition in which runtime this fragment should be executed
|
50
|
-
* @param {string|Source=} endContent the source code that will be included at the end of the module
|
49
|
+
* @param {string | Source=} endContent the source code that will be included at the end of the module
|
51
50
|
*/
|
52
51
|
constructor(
|
53
52
|
content,
|
@@ -63,7 +62,7 @@ class ConditionalInitFragment extends InitFragment {
|
|
63
62
|
|
64
63
|
/**
|
65
64
|
* @param {GenerateContext} context context
|
66
|
-
* @returns {string | Source} the source code that will be included as initialization code
|
65
|
+
* @returns {string | Source | undefined} the source code that will be included as initialization code
|
67
66
|
*/
|
68
67
|
getContent(context) {
|
69
68
|
if (this.runtimeCondition === false || !this.content) return "";
|
package/lib/ContextModule.js
CHANGED
@@ -29,10 +29,14 @@ const makeSerializable = require("./util/makeSerializable");
|
|
29
29
|
|
30
30
|
/** @typedef {import("webpack-sources").Source} Source */
|
31
31
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
32
|
+
/** @typedef {import("./Chunk")} Chunk */
|
32
33
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
34
|
+
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
|
33
35
|
/** @typedef {import("./ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */
|
34
36
|
/** @typedef {import("./Compilation")} Compilation */
|
37
|
+
/** @typedef {import("./Dependency")} Dependency */
|
35
38
|
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
39
|
+
/** @typedef {import("./Module").BuildInfo} BuildInfo */
|
36
40
|
/** @typedef {import("./Module").BuildMeta} BuildMeta */
|
37
41
|
/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */
|
38
42
|
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
|
@@ -44,6 +48,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
44
48
|
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
45
49
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
46
50
|
/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */
|
51
|
+
/** @typedef {import("./javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
47
52
|
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
48
53
|
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
49
54
|
/** @template T @typedef {import("./util/LazySet")<T>} LazySet<T> */
|
@@ -52,7 +57,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
52
57
|
/** @typedef {"sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"} ContextMode Context mode */
|
53
58
|
|
54
59
|
/**
|
55
|
-
* @typedef {
|
60
|
+
* @typedef {object} ContextOptions
|
56
61
|
* @property {ContextMode} mode
|
57
62
|
* @property {boolean} recursive
|
58
63
|
* @property {RegExp} regExp
|
@@ -66,10 +71,11 @@ const makeSerializable = require("./util/makeSerializable");
|
|
66
71
|
* @property {string=} category
|
67
72
|
* @property {(string[][] | null)=} referencedExports exports referenced from modules (won't be mangled)
|
68
73
|
* @property {string=} layer
|
74
|
+
* @property {ImportAttributes=} attributes
|
69
75
|
*/
|
70
76
|
|
71
77
|
/**
|
72
|
-
* @typedef {
|
78
|
+
* @typedef {object} ContextModuleOptionsExtras
|
73
79
|
* @property {false|string|string[]} resource
|
74
80
|
* @property {string=} resourceQuery
|
75
81
|
* @property {string=} resourceFragment
|
@@ -91,6 +97,10 @@ const makeSerializable = require("./util/makeSerializable");
|
|
91
97
|
* @param {ResolveDependenciesCallback} callback
|
92
98
|
*/
|
93
99
|
|
100
|
+
/** @typedef {1 | 3 | 7 | 9} FakeMapType */
|
101
|
+
|
102
|
+
/** @typedef {Map<string, string | number> | FakeMapType} FakeMap */
|
103
|
+
|
94
104
|
const SNAPSHOT_OPTIONS = { timestamp: true };
|
95
105
|
|
96
106
|
const TYPES = new Set(["javascript"]);
|
@@ -131,6 +141,7 @@ class ContextModule extends Module {
|
|
131
141
|
}
|
132
142
|
|
133
143
|
// Info from Factory
|
144
|
+
/** @type {ResolveDependencies | undefined} */
|
134
145
|
this.resolveDependencies = resolveDependencies;
|
135
146
|
if (options && options.resolveOptions !== undefined) {
|
136
147
|
this.resolveOptions = options.resolveOptions;
|
@@ -172,6 +183,12 @@ class ContextModule extends Module {
|
|
172
183
|
this.resolveDependencies = undefined;
|
173
184
|
}
|
174
185
|
|
186
|
+
/**
|
187
|
+
* @private
|
188
|
+
* @param {RegExp} regexString RegExp as a string
|
189
|
+
* @param {boolean=} stripSlash do we need to strip a slsh
|
190
|
+
* @returns {string} pretty RegExp
|
191
|
+
*/
|
175
192
|
_prettyRegExp(regexString, stripSlash = true) {
|
176
193
|
const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C");
|
177
194
|
return stripSlash ? str.substring(1, str.length - 1) : str;
|
@@ -296,7 +313,9 @@ class ContextModule extends Module {
|
|
296
313
|
if (this.options.groupOptions) {
|
297
314
|
const groupOptions = this.options.groupOptions;
|
298
315
|
for (const key of Object.keys(groupOptions)) {
|
299
|
-
identifier += ` ${key}: ${
|
316
|
+
identifier += ` ${key}: ${
|
317
|
+
groupOptions[/** @type {keyof RawChunkGroupOptions} */ (key)]
|
318
|
+
}`;
|
300
319
|
}
|
301
320
|
}
|
302
321
|
if (this.options.namespaceObject === "strict") {
|
@@ -385,11 +404,13 @@ class ContextModule extends Module {
|
|
385
404
|
// build if enforced
|
386
405
|
if (this._forceBuild) return callback(null, true);
|
387
406
|
|
407
|
+
const buildInfo = /** @type {BuildInfo} */ (this.buildInfo);
|
408
|
+
|
388
409
|
// always build when we have no snapshot and context
|
389
|
-
if (!
|
410
|
+
if (!buildInfo.snapshot)
|
390
411
|
return callback(null, Boolean(this.context || this.options.resource));
|
391
412
|
|
392
|
-
fileSystemInfo.checkSnapshotValid(
|
413
|
+
fileSystemInfo.checkSnapshotValid(buildInfo.snapshot, (err, valid) => {
|
393
414
|
callback(err, !valid);
|
394
415
|
});
|
395
416
|
}
|
@@ -415,7 +436,8 @@ class ContextModule extends Module {
|
|
415
436
|
this.dependencies.length = 0;
|
416
437
|
this.blocks.length = 0;
|
417
438
|
const startTime = Date.now();
|
418
|
-
|
439
|
+
/** @type {ResolveDependencies} */
|
440
|
+
(this.resolveDependencies)(fs, this.options, (err, dependencies) => {
|
419
441
|
if (err) {
|
420
442
|
return callback(
|
421
443
|
makeWebpackError(err, "ContextModule.resolveDependencies")
|
@@ -516,7 +538,8 @@ class ContextModule extends Module {
|
|
516
538
|
SNAPSHOT_OPTIONS,
|
517
539
|
(err, snapshot) => {
|
518
540
|
if (err) return callback(err);
|
519
|
-
|
541
|
+
/** @type {BuildInfo} */
|
542
|
+
(this.buildInfo).snapshot = snapshot;
|
520
543
|
callback();
|
521
544
|
}
|
522
545
|
);
|
@@ -547,35 +570,37 @@ class ContextModule extends Module {
|
|
547
570
|
}
|
548
571
|
|
549
572
|
/**
|
550
|
-
* @param {
|
573
|
+
* @param {Dependency[]} dependencies all dependencies
|
551
574
|
* @param {ChunkGraph} chunkGraph chunk graph
|
552
|
-
* @returns {
|
575
|
+
* @returns {Map<string, string | number>} map with user requests
|
553
576
|
*/
|
554
577
|
getUserRequestMap(dependencies, chunkGraph) {
|
555
578
|
const moduleGraph = chunkGraph.moduleGraph;
|
556
579
|
// if we filter first we get a new array
|
557
580
|
// therefore we don't need to create a clone of dependencies explicitly
|
558
581
|
// therefore the order of this is !important!
|
559
|
-
const sortedDependencies =
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
582
|
+
const sortedDependencies =
|
583
|
+
/** @type {ContextElementDependency[]} */
|
584
|
+
(dependencies)
|
585
|
+
.filter(dependency => moduleGraph.getModule(dependency))
|
586
|
+
.sort((a, b) => {
|
587
|
+
if (a.userRequest === b.userRequest) {
|
588
|
+
return 0;
|
589
|
+
}
|
590
|
+
return a.userRequest < b.userRequest ? -1 : 1;
|
591
|
+
});
|
567
592
|
const map = Object.create(null);
|
568
593
|
for (const dep of sortedDependencies) {
|
569
|
-
const module = moduleGraph.getModule(dep);
|
594
|
+
const module = /** @type {Module} */ (moduleGraph.getModule(dep));
|
570
595
|
map[dep.userRequest] = chunkGraph.getModuleId(module);
|
571
596
|
}
|
572
597
|
return map;
|
573
598
|
}
|
574
599
|
|
575
600
|
/**
|
576
|
-
* @param {
|
601
|
+
* @param {Dependency[]} dependencies all dependencies
|
577
602
|
* @param {ChunkGraph} chunkGraph chunk graph
|
578
|
-
* @returns {
|
603
|
+
* @returns {FakeMap} fake map
|
579
604
|
*/
|
580
605
|
getFakeMap(dependencies, chunkGraph) {
|
581
606
|
if (!this.options.namespaceObject) {
|
@@ -589,7 +614,9 @@ class ContextModule extends Module {
|
|
589
614
|
// therefore we don't need to create a clone of dependencies explicitly
|
590
615
|
// therefore the order of this is !important!
|
591
616
|
const sortedModules = dependencies
|
592
|
-
.map(
|
617
|
+
.map(
|
618
|
+
dependency => /** @type {Module} */ (moduleGraph.getModule(dependency))
|
619
|
+
)
|
593
620
|
.filter(Boolean)
|
594
621
|
.sort(comparator);
|
595
622
|
const fakeMap = Object.create(null);
|
@@ -638,12 +665,21 @@ class ContextModule extends Module {
|
|
638
665
|
return fakeMap;
|
639
666
|
}
|
640
667
|
|
668
|
+
/**
|
669
|
+
* @param {FakeMap} fakeMap fake map
|
670
|
+
* @returns {string} fake map init statement
|
671
|
+
*/
|
641
672
|
getFakeMapInitStatement(fakeMap) {
|
642
673
|
return typeof fakeMap === "object"
|
643
674
|
? `var fakeMap = ${JSON.stringify(fakeMap, null, "\t")};`
|
644
675
|
: "";
|
645
676
|
}
|
646
677
|
|
678
|
+
/**
|
679
|
+
* @param {FakeMapType} type type
|
680
|
+
* @param {boolean=} asyncModule is async module
|
681
|
+
* @returns {string} return result
|
682
|
+
*/
|
647
683
|
getReturn(type, asyncModule) {
|
648
684
|
if (type === 9) {
|
649
685
|
return `${RuntimeGlobals.require}(id)`;
|
@@ -653,6 +689,12 @@ class ContextModule extends Module {
|
|
653
689
|
})`;
|
654
690
|
}
|
655
691
|
|
692
|
+
/**
|
693
|
+
* @param {FakeMap} fakeMap fake map
|
694
|
+
* @param {boolean=} asyncModule us async module
|
695
|
+
* @param {string=} fakeMapDataExpression fake map data expression
|
696
|
+
* @returns {string} module object source
|
697
|
+
*/
|
656
698
|
getReturnModuleObjectSource(
|
657
699
|
fakeMap,
|
658
700
|
asyncModule,
|
@@ -667,8 +709,8 @@ class ContextModule extends Module {
|
|
667
709
|
}
|
668
710
|
|
669
711
|
/**
|
670
|
-
* @param {
|
671
|
-
* @param {
|
712
|
+
* @param {Dependency[]} dependencies dependencies
|
713
|
+
* @param {ModuleId} id module id
|
672
714
|
* @param {ChunkGraph} chunkGraph the chunk graph
|
673
715
|
* @returns {string} source code
|
674
716
|
*/
|
@@ -701,8 +743,8 @@ webpackContext.id = ${JSON.stringify(id)};`;
|
|
701
743
|
}
|
702
744
|
|
703
745
|
/**
|
704
|
-
* @param {
|
705
|
-
* @param {
|
746
|
+
* @param {Dependency[]} dependencies dependencies
|
747
|
+
* @param {ModuleId} id module id
|
706
748
|
* @param {ChunkGraph} chunkGraph the chunk graph
|
707
749
|
* @returns {string} source code
|
708
750
|
*/
|
@@ -740,9 +782,9 @@ module.exports = webpackContext;`;
|
|
740
782
|
}
|
741
783
|
|
742
784
|
/**
|
743
|
-
* @param {
|
744
|
-
* @param {
|
745
|
-
* @param {
|
785
|
+
* @param {Dependency[]} dependencies dependencies
|
786
|
+
* @param {ModuleId} id module id
|
787
|
+
* @param {object} context context
|
746
788
|
* @param {ChunkGraph} context.chunkGraph the chunk graph
|
747
789
|
* @param {RuntimeTemplate} context.runtimeTemplate the chunk graph
|
748
790
|
* @returns {string} source code
|
@@ -789,9 +831,9 @@ module.exports = webpackAsyncContext;`;
|
|
789
831
|
}
|
790
832
|
|
791
833
|
/**
|
792
|
-
* @param {
|
793
|
-
* @param {
|
794
|
-
* @param {
|
834
|
+
* @param {Dependency[]} dependencies dependencies
|
835
|
+
* @param {ModuleId} id module id
|
836
|
+
* @param {object} context context
|
795
837
|
* @param {ChunkGraph} context.chunkGraph the chunk graph
|
796
838
|
* @param {RuntimeTemplate} context.runtimeTemplate the chunk graph
|
797
839
|
* @returns {string} source code
|
@@ -803,7 +845,7 @@ module.exports = webpackAsyncContext;`;
|
|
803
845
|
const thenFunction =
|
804
846
|
fakeMap !== 9
|
805
847
|
? `${arrow ? "id =>" : "function(id)"} {
|
806
|
-
${this.getReturnModuleObjectSource(fakeMap)}
|
848
|
+
${this.getReturnModuleObjectSource(fakeMap, true)}
|
807
849
|
}`
|
808
850
|
: RuntimeGlobals.require;
|
809
851
|
return `var map = ${JSON.stringify(map, null, "\t")};
|
@@ -833,10 +875,10 @@ module.exports = webpackAsyncContext;`;
|
|
833
875
|
}
|
834
876
|
|
835
877
|
/**
|
836
|
-
* @param {
|
837
|
-
* @param {
|
838
|
-
* @param {
|
839
|
-
* @param {
|
878
|
+
* @param {AsyncDependenciesBlock} block block
|
879
|
+
* @param {Dependency[]} dependencies dependencies
|
880
|
+
* @param {ModuleId} id module id
|
881
|
+
* @param {object} options options object
|
840
882
|
* @param {RuntimeTemplate} options.runtimeTemplate the runtime template
|
841
883
|
* @param {ChunkGraph} options.chunkGraph the chunk graph
|
842
884
|
* @returns {string} source code
|
@@ -883,9 +925,9 @@ module.exports = webpackAsyncContext;`;
|
|
883
925
|
}
|
884
926
|
|
885
927
|
/**
|
886
|
-
* @param {
|
887
|
-
* @param {
|
888
|
-
* @param {
|
928
|
+
* @param {AsyncDependenciesBlock[]} blocks blocks
|
929
|
+
* @param {ModuleId} id module id
|
930
|
+
* @param {object} context context
|
889
931
|
* @param {ChunkGraph} context.chunkGraph the chunk graph
|
890
932
|
* @param {RuntimeTemplate} context.runtimeTemplate the chunk graph
|
891
933
|
* @returns {string} source code
|
@@ -902,10 +944,12 @@ module.exports = webpackAsyncContext;`;
|
|
902
944
|
const hasFakeMap = typeof fakeMap === "object";
|
903
945
|
const items = blocks
|
904
946
|
.map(block => {
|
905
|
-
const dependency =
|
947
|
+
const dependency =
|
948
|
+
/** @type {ContextElementDependency} */
|
949
|
+
(block.dependencies[0]);
|
906
950
|
return {
|
907
951
|
dependency: dependency,
|
908
|
-
module: moduleGraph.getModule(dependency),
|
952
|
+
module: /** @type {Module} */ (moduleGraph.getModule(dependency)),
|
909
953
|
block: block,
|
910
954
|
userRequest: dependency.userRequest,
|
911
955
|
chunks: undefined
|
@@ -995,6 +1039,11 @@ webpackAsyncContext.id = ${JSON.stringify(id)};
|
|
995
1039
|
module.exports = webpackAsyncContext;`;
|
996
1040
|
}
|
997
1041
|
|
1042
|
+
/**
|
1043
|
+
* @param {ModuleId} id module id
|
1044
|
+
* @param {RuntimeTemplate} runtimeTemplate runtime template
|
1045
|
+
* @returns {string} source for empty async context
|
1046
|
+
*/
|
998
1047
|
getSourceForEmptyContext(id, runtimeTemplate) {
|
999
1048
|
return `function webpackEmptyContext(req) {
|
1000
1049
|
var e = new Error("Cannot find module '" + req + "'");
|
@@ -1007,6 +1056,11 @@ webpackEmptyContext.id = ${JSON.stringify(id)};
|
|
1007
1056
|
module.exports = webpackEmptyContext;`;
|
1008
1057
|
}
|
1009
1058
|
|
1059
|
+
/**
|
1060
|
+
* @param {ModuleId} id module id
|
1061
|
+
* @param {RuntimeTemplate} runtimeTemplate runtime template
|
1062
|
+
* @returns {string} source for empty async context
|
1063
|
+
*/
|
1010
1064
|
getSourceForEmptyAsyncContext(id, runtimeTemplate) {
|
1011
1065
|
const arrow = runtimeTemplate.supportsArrowFunction();
|
1012
1066
|
return `function webpackEmptyAsyncContext(req) {
|
@@ -289,7 +289,8 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
|
|
289
289
|
exclude,
|
290
290
|
referencedExports,
|
291
291
|
category,
|
292
|
-
typePrefix
|
292
|
+
typePrefix,
|
293
|
+
attributes
|
293
294
|
} = options;
|
294
295
|
if (!regExp || !resource) return callback(null, []);
|
295
296
|
|
@@ -365,7 +366,8 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
|
|
365
366
|
typePrefix,
|
366
367
|
category,
|
367
368
|
referencedExports,
|
368
|
-
obj.context
|
369
|
+
obj.context,
|
370
|
+
attributes
|
369
371
|
);
|
370
372
|
dep.optional = true;
|
371
373
|
return dep;
|
@@ -9,6 +9,7 @@ const ContextElementDependency = require("./dependencies/ContextElementDependenc
|
|
9
9
|
const { join } = require("./util/fs");
|
10
10
|
|
11
11
|
/** @typedef {import("./Compiler")} Compiler */
|
12
|
+
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
12
13
|
|
13
14
|
class ContextReplacementPlugin {
|
14
15
|
/**
|
@@ -104,7 +105,7 @@ class ContextReplacementPlugin {
|
|
104
105
|
result.resource = newContentResource;
|
105
106
|
} else {
|
106
107
|
result.resource = join(
|
107
|
-
compiler.inputFileSystem,
|
108
|
+
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
|
108
109
|
result.resource,
|
109
110
|
newContentResource
|
110
111
|
);
|
@@ -132,7 +133,7 @@ class ContextReplacementPlugin {
|
|
132
133
|
) {
|
133
134
|
// When the function changed it to an relative path
|
134
135
|
result.resource = join(
|
135
|
-
compiler.inputFileSystem,
|
136
|
+
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
|
136
137
|
origResource,
|
137
138
|
result.resource
|
138
139
|
);
|
package/lib/DefinePlugin.js
CHANGED
@@ -27,6 +27,7 @@ const createHash = require("./util/createHash");
|
|
27
27
|
/** @typedef {import("./NormalModule")} NormalModule */
|
28
28
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
29
29
|
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
30
|
+
/** @typedef {import("./javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
|
30
31
|
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
|
31
32
|
/** @typedef {import("./logging/Logger").Logger} Logger */
|
32
33
|
|
@@ -34,7 +35,7 @@ const createHash = require("./util/createHash");
|
|
34
35
|
/** @typedef {RecursiveArrayOrRecord<CodeValuePrimitive|RuntimeValue>} CodeValue */
|
35
36
|
|
36
37
|
/**
|
37
|
-
* @typedef {
|
38
|
+
* @typedef {object} RuntimeValueOptions
|
38
39
|
* @property {string[]=} fileDependencies
|
39
40
|
* @property {string[]=} contextDependencies
|
40
41
|
* @property {string[]=} missingDependencies
|
@@ -114,6 +115,15 @@ class RuntimeValue {
|
|
114
115
|
}
|
115
116
|
}
|
116
117
|
|
118
|
+
/**
|
119
|
+
* @param {Set<DestructuringAssignmentProperty> | undefined} properties properties
|
120
|
+
* @returns {Set<string> | undefined} used keys
|
121
|
+
*/
|
122
|
+
function getObjKeys(properties) {
|
123
|
+
if (!properties) return undefined;
|
124
|
+
return new Set([...properties].map(p => p.id));
|
125
|
+
}
|
126
|
+
|
117
127
|
/**
|
118
128
|
* @param {any[]|{[k: string]: any}} obj obj
|
119
129
|
* @param {JavascriptParser} parser Parser
|
@@ -308,8 +318,10 @@ const PLUGIN_NAME = "DefinePlugin";
|
|
308
318
|
const VALUE_DEP_PREFIX = `webpack/${PLUGIN_NAME} `;
|
309
319
|
const VALUE_DEP_MAIN = `webpack/${PLUGIN_NAME}_hash`;
|
310
320
|
const TYPEOF_OPERATOR_REGEXP = /^typeof\s+/;
|
311
|
-
const WEBPACK_REQUIRE_FUNCTION_REGEXP =
|
312
|
-
|
321
|
+
const WEBPACK_REQUIRE_FUNCTION_REGEXP = new RegExp(
|
322
|
+
`${RuntimeGlobals.require}\\s*(!?\\.)`
|
323
|
+
);
|
324
|
+
const WEBPACK_REQUIRE_IDENTIFIER_REGEXP = new RegExp(RuntimeGlobals.require);
|
313
325
|
|
314
326
|
class DefinePlugin {
|
315
327
|
/**
|
@@ -489,7 +501,7 @@ class DefinePlugin {
|
|
489
501
|
runtimeTemplate,
|
490
502
|
logger,
|
491
503
|
!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
|
492
|
-
|
504
|
+
null
|
493
505
|
);
|
494
506
|
|
495
507
|
if (parser.scope.inShorthand) {
|
@@ -564,7 +576,7 @@ class DefinePlugin {
|
|
564
576
|
/**
|
565
577
|
* Apply Object
|
566
578
|
* @param {string} key Key
|
567
|
-
* @param {
|
579
|
+
* @param {object} obj Object
|
568
580
|
* @returns {void}
|
569
581
|
*/
|
570
582
|
const applyObjectDefine = (key, obj) => {
|
@@ -595,7 +607,7 @@ class DefinePlugin {
|
|
595
607
|
runtimeTemplate,
|
596
608
|
logger,
|
597
609
|
!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
|
598
|
-
parser.destructuringAssignmentPropertiesFor(expr)
|
610
|
+
getObjKeys(parser.destructuringAssignmentPropertiesFor(expr))
|
599
611
|
);
|
600
612
|
|
601
613
|
if (parser.scope.inShorthand) {
|
package/lib/Dependency.js
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
const RawModule = require("./RawModule");
|
8
9
|
const memoize = require("./util/memoize");
|
9
10
|
|
10
11
|
/** @typedef {import("webpack-sources").Source} Source */
|
@@ -23,35 +24,35 @@ const memoize = require("./util/memoize");
|
|
23
24
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
24
25
|
|
25
26
|
/**
|
26
|
-
* @typedef {
|
27
|
+
* @typedef {object} UpdateHashContext
|
27
28
|
* @property {ChunkGraph} chunkGraph
|
28
29
|
* @property {RuntimeSpec} runtime
|
29
30
|
* @property {RuntimeTemplate=} runtimeTemplate
|
30
31
|
*/
|
31
32
|
|
32
33
|
/**
|
33
|
-
* @typedef {
|
34
|
+
* @typedef {object} SourcePosition
|
34
35
|
* @property {number} line
|
35
36
|
* @property {number=} column
|
36
37
|
*/
|
37
38
|
|
38
39
|
/**
|
39
|
-
* @typedef {
|
40
|
+
* @typedef {object} RealDependencyLocation
|
40
41
|
* @property {SourcePosition} start
|
41
42
|
* @property {SourcePosition=} end
|
42
43
|
* @property {number=} index
|
43
44
|
*/
|
44
45
|
|
45
46
|
/**
|
46
|
-
* @typedef {
|
47
|
+
* @typedef {object} SyntheticDependencyLocation
|
47
48
|
* @property {string} name
|
48
49
|
* @property {number=} index
|
49
50
|
*/
|
50
51
|
|
51
|
-
/** @typedef {SyntheticDependencyLocation|RealDependencyLocation} DependencyLocation */
|
52
|
+
/** @typedef {SyntheticDependencyLocation | RealDependencyLocation} DependencyLocation */
|
52
53
|
|
53
54
|
/**
|
54
|
-
* @typedef {
|
55
|
+
* @typedef {object} ExportSpec
|
55
56
|
* @property {string} name the name of the export
|
56
57
|
* @property {boolean=} canMangle can the export be renamed (defaults to true)
|
57
58
|
* @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts
|
@@ -63,7 +64,7 @@ const memoize = require("./util/memoize");
|
|
63
64
|
*/
|
64
65
|
|
65
66
|
/**
|
66
|
-
* @typedef {
|
67
|
+
* @typedef {object} ExportsSpec
|
67
68
|
* @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports
|
68
69
|
* @property {Set<string>=} excludeExports when exports = true, list of unaffected exports
|
69
70
|
* @property {Set<string>=} hideExports list of maybe prior exposed, but now hidden exports
|
@@ -75,15 +76,16 @@ const memoize = require("./util/memoize");
|
|
75
76
|
*/
|
76
77
|
|
77
78
|
/**
|
78
|
-
* @typedef {
|
79
|
+
* @typedef {object} ReferencedExport
|
79
80
|
* @property {string[]} name name of the referenced export
|
80
81
|
* @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true
|
81
82
|
*/
|
82
83
|
|
84
|
+
/** @typedef {function(ModuleGraphConnection, RuntimeSpec): ConnectionState} GetConditionFn */
|
85
|
+
|
83
86
|
const TRANSITIVE = Symbol("transitive");
|
84
87
|
|
85
88
|
const getIgnoredModule = memoize(() => {
|
86
|
-
const RawModule = require("./RawModule");
|
87
89
|
return new RawModule("/* (ignored) */", `ignored`, `(ignored)`);
|
88
90
|
});
|
89
91
|
|
@@ -235,7 +237,7 @@ class Dependency {
|
|
235
237
|
|
236
238
|
/**
|
237
239
|
* @param {ModuleGraph} moduleGraph module graph
|
238
|
-
* @returns {null | false |
|
240
|
+
* @returns {null | false | GetConditionFn} function to determine if the connection is active
|
239
241
|
*/
|
240
242
|
getCondition(moduleGraph) {
|
241
243
|
return null;
|
@@ -13,21 +13,25 @@
|
|
13
13
|
/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */
|
14
14
|
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
15
15
|
/** @typedef {import("./Generator").GenerateContext} GenerateContext */
|
16
|
-
/** @template T @typedef {import("./InitFragment")<T>} InitFragment */
|
17
16
|
/** @typedef {import("./Module")} Module */
|
17
|
+
/** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
|
18
18
|
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
19
19
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
20
20
|
|
21
21
|
/**
|
22
|
-
* @
|
22
|
+
* @template T
|
23
|
+
* @typedef {import("./InitFragment")<T>} InitFragment
|
24
|
+
*/
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @typedef {object} DependencyTemplateContext
|
23
28
|
* @property {RuntimeTemplate} runtimeTemplate the runtime template
|
24
29
|
* @property {DependencyTemplates} dependencyTemplates the dependency templates
|
25
30
|
* @property {ModuleGraph} moduleGraph the module graph
|
26
31
|
* @property {ChunkGraph} chunkGraph the chunk graph
|
27
|
-
* @property {
|
32
|
+
* @property {RuntimeRequirements} runtimeRequirements the requirements for runtime
|
28
33
|
* @property {Module} module current module
|
29
|
-
* @property {RuntimeSpec} runtime current
|
30
|
-
* @property {RuntimeSpec[]} [runtimes] current runtimes, for which code is generated
|
34
|
+
* @property {RuntimeSpec} runtime current runtimes, for which code is generated
|
31
35
|
* @property {InitFragment<GenerateContext>[]} initFragments mutable array of init fragments for the current module
|
32
36
|
* @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules
|
33
37
|
* @property {CodeGenerationResults} codeGenerationResults the code generation results
|
@@ -35,8 +39,14 @@
|
|
35
39
|
*/
|
36
40
|
|
37
41
|
/**
|
38
|
-
* @typedef {
|
39
|
-
* @property {
|
42
|
+
* @typedef {object} CssDependencyTemplateContextExtras
|
43
|
+
* @property {CssExportsData} cssExportsData the css exports data
|
44
|
+
*/
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @typedef {object} CssExportsData
|
48
|
+
* @property {boolean} esModule whether export __esModule
|
49
|
+
* @property {Map<string, string>} exports the css exports
|
40
50
|
*/
|
41
51
|
|
42
52
|
/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */
|