webpack 5.90.2 → 5.91.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 +5 -1
- package/lib/APIPlugin.js +8 -4
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +3 -1
- package/lib/Cache.js +7 -1
- package/lib/CacheFacade.js +3 -3
- package/lib/ChunkGraph.js +32 -18
- package/lib/ChunkGroup.js +14 -14
- package/lib/CleanPlugin.js +7 -5
- package/lib/Compilation.js +263 -94
- package/lib/Compiler.js +199 -83
- package/lib/ConditionalInitFragment.js +4 -5
- package/lib/ContextModule.js +4 -1
- package/lib/ContextModuleFactory.js +4 -2
- package/lib/ContextReplacementPlugin.js +3 -2
- package/lib/CssModule.js +0 -3
- package/lib/DefinePlugin.js +4 -2
- package/lib/DelegatedModule.js +2 -1
- package/lib/Dependency.js +4 -2
- package/lib/DependencyTemplate.js +7 -2
- package/lib/DllModule.js +3 -1
- package/lib/DllReferencePlugin.js +6 -2
- package/lib/EntryOptionPlugin.js +4 -1
- package/lib/EntryPlugin.js +6 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/ExportsInfo.js +1 -4
- package/lib/ExternalModule.js +120 -25
- package/lib/ExternalModuleFactoryPlugin.js +37 -2
- package/lib/FileSystemInfo.js +1 -1
- package/lib/Generator.js +2 -1
- package/lib/HookWebpackError.js +2 -2
- package/lib/InitFragment.js +5 -3
- package/lib/LibManifestPlugin.js +15 -7
- package/lib/Module.js +54 -5
- package/lib/ModuleFilenameHelpers.js +1 -1
- package/lib/ModuleGraph.js +56 -27
- package/lib/ModuleGraphConnection.js +2 -1
- package/lib/MultiCompiler.js +61 -17
- package/lib/NodeStuffPlugin.js +14 -3
- package/lib/NormalModule.js +239 -86
- package/lib/NormalModuleFactory.js +163 -32
- package/lib/NormalModuleReplacementPlugin.js +5 -1
- package/lib/ProvidePlugin.js +3 -1
- package/lib/RawModule.js +4 -2
- package/lib/ResolverFactory.js +5 -1
- package/lib/RuntimeModule.js +6 -5
- package/lib/RuntimePlugin.js +1 -0
- package/lib/RuntimeTemplate.js +102 -34
- package/lib/SourceMapDevToolPlugin.js +4 -1
- package/lib/Stats.js +12 -5
- package/lib/TemplatedPathPlugin.js +32 -6
- package/lib/Watching.js +67 -60
- package/lib/WebpackError.js +6 -6
- package/lib/WebpackOptionsApply.js +18 -5
- package/lib/asset/RawDataUrlModule.js +5 -2
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +220 -392
- 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 +49 -16
- package/lib/cache/ResolverCachePlugin.js +14 -6
- package/lib/cache/getLazyHashedEtag.js +1 -1
- package/lib/config/defaults.js +24 -1
- package/lib/config/normalization.js +3 -1
- package/lib/container/ContainerEntryDependency.js +2 -1
- package/lib/container/ContainerEntryModule.js +5 -2
- package/lib/container/ContainerPlugin.js +14 -10
- package/lib/container/FallbackModule.js +3 -2
- package/lib/container/RemoteModule.js +2 -1
- package/lib/container/RemoteRuntimeModule.js +12 -3
- package/lib/css/CssExportsGenerator.js +34 -17
- package/lib/css/CssGenerator.js +20 -2
- package/lib/css/CssLoadingRuntimeModule.js +212 -96
- package/lib/css/CssModulesPlugin.js +47 -13
- package/lib/debug/ProfilingPlugin.js +27 -2
- 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/CssLocalIdentifierDependency.js +63 -8
- package/lib/dependencies/CssUrlDependency.js +5 -3
- package/lib/dependencies/ExportsInfoDependency.js +4 -3
- 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 +44 -16
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -6
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +21 -10
- 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/ImportParserPlugin.js +12 -4
- package/lib/dependencies/ImportWeakDependency.js +4 -2
- package/lib/dependencies/LoaderDependency.js +2 -1
- package/lib/dependencies/LoaderImportDependency.js +2 -1
- package/lib/dependencies/ModuleDependency.js +4 -5
- package/lib/dependencies/PureExpressionDependency.js +4 -1
- 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 +6 -5
- package/lib/dependencies/getFunctionExpression.js +3 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +2 -1
- package/lib/hmr/LazyCompilationPlugin.js +2 -1
- package/lib/javascript/BasicEvaluatedExpression.js +2 -2
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/JavascriptParser.js +169 -57
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/javascript/StartupHelpers.js +22 -5
- package/lib/logging/Logger.js +27 -2
- package/lib/logging/createConsoleLogger.js +11 -7
- package/lib/node/NodeEnvironmentPlugin.js +13 -7
- package/lib/node/NodeWatchFileSystem.js +37 -26
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/nodeConsole.js +24 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +140 -55
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/InnerGraph.js +7 -2
- package/lib/optimize/InnerGraphPlugin.js +36 -13
- package/lib/optimize/ModuleConcatenationPlugin.js +12 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/RuntimeChunkPlugin.js +6 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +46 -15
- package/lib/optimize/SplitChunksPlugin.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +11 -0
- package/lib/rules/ObjectMatcherRulePlugin.js +4 -0
- package/lib/runtime/EnsureChunkRuntimeModule.js +2 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +2 -1
- package/lib/serialization/FileMiddleware.js +1 -0
- package/lib/serialization/ObjectMiddleware.js +2 -0
- package/lib/serialization/Serializer.js +19 -0
- package/lib/sharing/ConsumeSharedModule.js +3 -2
- package/lib/sharing/ConsumeSharedPlugin.js +17 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -2
- package/lib/sharing/ProvideSharedModule.js +2 -1
- package/lib/sharing/ProvideSharedPlugin.js +12 -5
- package/lib/sharing/resolveMatchedConfigs.js +2 -2
- package/lib/sharing/utils.js +13 -6
- package/lib/util/StackedCacheMap.js +26 -0
- package/lib/util/WeakTupleMap.js +57 -13
- package/lib/util/cleverMerge.js +24 -11
- package/lib/util/comparators.js +34 -14
- package/lib/util/conventions.js +129 -0
- package/lib/util/fs.js +379 -65
- package/lib/util/hash/BatchedHash.js +3 -0
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/memoize.js +2 -0
- package/lib/util/runtime.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -2
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +15 -6
- package/lib/wasm-sync/WebAssemblyGenerator.js +27 -6
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +2 -1
- package/lib/wasm-sync/WebAssemblyParser.js +7 -4
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -1
- package/lib/webpack.js +11 -5
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -1
- package/package.json +25 -26
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +69 -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 +1772 -673
@@ -15,6 +15,7 @@ const ImportDependency = require("./ImportDependency");
|
|
15
15
|
/** @typedef {import("../Module")} Module */
|
16
16
|
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
17
17
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
18
|
+
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
|
18
19
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
19
20
|
|
20
21
|
class ImportWeakDependency extends ImportDependency {
|
@@ -22,9 +23,10 @@ class ImportWeakDependency extends ImportDependency {
|
|
22
23
|
* @param {string} request the request
|
23
24
|
* @param {Range} range expression range
|
24
25
|
* @param {(string[][] | null)=} referencedExports list of referenced exports
|
26
|
+
* @param {Attributes=} attributes assertions
|
25
27
|
*/
|
26
|
-
constructor(request, range, referencedExports) {
|
27
|
-
super(request, range, referencedExports);
|
28
|
+
constructor(request, range, referencedExports, attributes) {
|
29
|
+
super(request, range, referencedExports, attributes);
|
28
30
|
this.weak = true;
|
29
31
|
}
|
30
32
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
const ModuleDependency = require("./ModuleDependency");
|
9
9
|
|
10
|
+
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
10
11
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
11
12
|
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
12
13
|
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
@@ -30,7 +31,7 @@ class LoaderDependency extends ModuleDependency {
|
|
30
31
|
|
31
32
|
/**
|
32
33
|
* @param {ModuleGraph} moduleGraph module graph
|
33
|
-
* @returns {null | false |
|
34
|
+
* @returns {null | false | GetConditionFn} function to determine if the connection is active
|
34
35
|
*/
|
35
36
|
getCondition(moduleGraph) {
|
36
37
|
return false;
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
const ModuleDependency = require("./ModuleDependency");
|
9
9
|
|
10
|
+
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
10
11
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
11
12
|
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
12
13
|
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
@@ -31,7 +32,7 @@ class LoaderImportDependency extends ModuleDependency {
|
|
31
32
|
|
32
33
|
/**
|
33
34
|
* @param {ModuleGraph} moduleGraph module graph
|
34
|
-
* @returns {null | false |
|
35
|
+
* @returns {null | false | GetConditionFn} function to determine if the connection is active
|
35
36
|
*/
|
36
37
|
getCondition(moduleGraph) {
|
37
38
|
return false;
|
@@ -7,15 +7,14 @@
|
|
7
7
|
|
8
8
|
const Dependency = require("../Dependency");
|
9
9
|
const DependencyTemplate = require("../DependencyTemplate");
|
10
|
-
const
|
10
|
+
const RawModule = require("../RawModule");
|
11
11
|
|
12
12
|
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
13
13
|
/** @typedef {import("../Module")} Module */
|
14
|
+
/** @typedef {import("../javascript/JavascriptParser").Attributes} Attributes */
|
14
15
|
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
15
16
|
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
16
17
|
|
17
|
-
const getRawModule = memoize(() => require("../RawModule"));
|
18
|
-
|
19
18
|
class ModuleDependency extends Dependency {
|
20
19
|
/**
|
21
20
|
* @param {string} request request path which needs resolving
|
@@ -25,8 +24,9 @@ class ModuleDependency extends Dependency {
|
|
25
24
|
this.request = request;
|
26
25
|
this.userRequest = request;
|
27
26
|
this.range = undefined;
|
27
|
+
// TODO move it to subclasses and rename
|
28
28
|
// assertions must be serialized by subclasses that use it
|
29
|
-
/** @type {
|
29
|
+
/** @type {Attributes | undefined} */
|
30
30
|
this.assertions = undefined;
|
31
31
|
this._context = undefined;
|
32
32
|
}
|
@@ -61,7 +61,6 @@ class ModuleDependency extends Dependency {
|
|
61
61
|
* @returns {Module | null} a module
|
62
62
|
*/
|
63
63
|
createIgnoredModule(context) {
|
64
|
-
const RawModule = getRawModule();
|
65
64
|
return new RawModule(
|
66
65
|
"/* (ignored) */",
|
67
66
|
`ignored|${context}|${this.request}`,
|
@@ -15,6 +15,7 @@ const NullDependency = require("./NullDependency");
|
|
15
15
|
/** @typedef {import("../Dependency")} Dependency */
|
16
16
|
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
17
17
|
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
18
|
+
/** @typedef {import("../Module")} Module */
|
18
19
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
19
20
|
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
20
21
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
@@ -106,7 +107,9 @@ PureExpressionDependency.Template = class PureExpressionDependencyTemplate exten
|
|
106
107
|
|
107
108
|
const usedByExports = dep.usedByExports;
|
108
109
|
if (usedByExports !== false) {
|
109
|
-
const selfModule =
|
110
|
+
const selfModule =
|
111
|
+
/** @type {Module} */
|
112
|
+
(moduleGraph.getParentModule(dep));
|
110
113
|
const exportsInfo = moduleGraph.getExportsInfo(selfModule);
|
111
114
|
const merged = deepMergeRuntime(runtimes, runtime);
|
112
115
|
const runtimeCondition = filterRuntime(merged, runtime => {
|
@@ -11,9 +11,16 @@ const RequireEnsureItemDependency = require("./RequireEnsureItemDependency");
|
|
11
11
|
const getFunctionExpression = require("./getFunctionExpression");
|
12
12
|
|
13
13
|
/** @typedef {import("../ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
|
14
|
+
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
15
|
+
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
14
16
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
17
|
+
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
15
18
|
|
16
19
|
module.exports = class RequireEnsureDependenciesBlockParserPlugin {
|
20
|
+
/**
|
21
|
+
* @param {JavascriptParser} parser the parser
|
22
|
+
* @returns {void}
|
23
|
+
*/
|
17
24
|
apply(parser) {
|
18
25
|
parser.hooks.call
|
19
26
|
.for("require.ensure")
|
@@ -45,9 +52,12 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin {
|
|
45
52
|
const dependenciesExpr = parser.evaluateExpression(
|
46
53
|
expr.arguments[0]
|
47
54
|
);
|
48
|
-
const dependenciesItems =
|
49
|
-
|
50
|
-
|
55
|
+
const dependenciesItems =
|
56
|
+
/** @type {BasicEvaluatedExpression[]} */ (
|
57
|
+
dependenciesExpr.isArray()
|
58
|
+
? dependenciesExpr.items
|
59
|
+
: [dependenciesExpr]
|
60
|
+
);
|
51
61
|
const successExpressionArg = expr.arguments[1];
|
52
62
|
const successExpression =
|
53
63
|
getFunctionExpression(successExpressionArg);
|
@@ -60,32 +70,34 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin {
|
|
60
70
|
}
|
61
71
|
|
62
72
|
const depBlock = new RequireEnsureDependenciesBlock(
|
63
|
-
/** @type {ChunkGroupOptions & { entryOptions?: TODO }} */
|
64
|
-
|
65
|
-
)
|
66
|
-
expr.loc
|
73
|
+
/** @type {ChunkGroupOptions & { entryOptions?: TODO }} */
|
74
|
+
(chunkName),
|
75
|
+
/** @type {DependencyLocation} */ (expr.loc)
|
67
76
|
);
|
68
77
|
const errorCallbackExists =
|
69
78
|
expr.arguments.length === 4 ||
|
70
79
|
(!chunkName && expr.arguments.length === 3);
|
71
80
|
const dep = new RequireEnsureDependency(
|
72
|
-
expr.range,
|
73
|
-
expr.arguments[1].range,
|
74
|
-
errorCallbackExists &&
|
81
|
+
/** @type {Range} */ (expr.range),
|
82
|
+
/** @type {Range} */ (expr.arguments[1].range),
|
83
|
+
errorCallbackExists &&
|
84
|
+
/** @type {Range} */ (expr.arguments[2].range)
|
75
85
|
);
|
76
|
-
dep.loc = expr.loc;
|
86
|
+
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
77
87
|
depBlock.addDependency(dep);
|
78
88
|
const old = parser.state.current;
|
79
|
-
parser.state.current = depBlock;
|
89
|
+
parser.state.current = /** @type {TODO} */ (depBlock);
|
80
90
|
try {
|
81
91
|
let failed = false;
|
82
92
|
parser.inScope([], () => {
|
83
93
|
for (const ee of dependenciesItems) {
|
84
94
|
if (ee.isString()) {
|
85
95
|
const ensureDependency = new RequireEnsureItemDependency(
|
86
|
-
ee.string
|
96
|
+
/** @type {string} */ (ee.string)
|
87
97
|
);
|
88
|
-
ensureDependency.loc =
|
98
|
+
ensureDependency.loc =
|
99
|
+
/** @type {DependencyLocation} */
|
100
|
+
(expr.loc);
|
89
101
|
depBlock.addDependency(ensureDependency);
|
90
102
|
} else {
|
91
103
|
failed = true;
|
@@ -21,7 +21,7 @@ class RequireEnsureDependency extends NullDependency {
|
|
21
21
|
/**
|
22
22
|
* @param {Range} range range
|
23
23
|
* @param {Range} contentRange content range
|
24
|
-
* @param {Range} errorHandlerRange error handler range
|
24
|
+
* @param {Range | false} errorHandlerRange error handler range
|
25
25
|
*/
|
26
26
|
constructor(range, contentRange, errorHandlerRange) {
|
27
27
|
super();
|
@@ -6,6 +6,7 @@
|
|
6
6
|
"use strict";
|
7
7
|
|
8
8
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
9
|
+
const RawDataUrlModule = require("../asset/RawDataUrlModule");
|
9
10
|
const {
|
10
11
|
getDependencyUsedByExportsCondition
|
11
12
|
} = require("../optimize/InnerGraph");
|
@@ -16,6 +17,7 @@ const ModuleDependency = require("./ModuleDependency");
|
|
16
17
|
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
17
18
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
18
19
|
/** @typedef {import("../Dependency")} Dependency */
|
20
|
+
/** @typedef {import("../Dependency").GetConditionFn} GetConditionFn */
|
19
21
|
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
20
22
|
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
21
23
|
/** @typedef {import("../Module")} Module */
|
@@ -28,7 +30,9 @@ const ModuleDependency = require("./ModuleDependency");
|
|
28
30
|
/** @typedef {import("../util/Hash")} Hash */
|
29
31
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
30
32
|
|
31
|
-
const
|
33
|
+
const getIgnoredRawDataUrlModule = memoize(() => {
|
34
|
+
return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`);
|
35
|
+
});
|
32
36
|
|
33
37
|
class URLDependency extends ModuleDependency {
|
34
38
|
/**
|
@@ -56,7 +60,7 @@ class URLDependency extends ModuleDependency {
|
|
56
60
|
|
57
61
|
/**
|
58
62
|
* @param {ModuleGraph} moduleGraph module graph
|
59
|
-
* @returns {null | false |
|
63
|
+
* @returns {null | false | GetConditionFn} function to determine if the connection is active
|
60
64
|
*/
|
61
65
|
getCondition(moduleGraph) {
|
62
66
|
return getDependencyUsedByExportsCondition(
|
@@ -71,8 +75,7 @@ class URLDependency extends ModuleDependency {
|
|
71
75
|
* @returns {Module | null} a module
|
72
76
|
*/
|
73
77
|
createIgnoredModule(context) {
|
74
|
-
|
75
|
-
return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`);
|
78
|
+
return getIgnoredRawDataUrlModule();
|
76
79
|
}
|
77
80
|
|
78
81
|
/**
|
@@ -29,7 +29,7 @@ class WorkerDependency extends ModuleDependency {
|
|
29
29
|
* @param {string} request request
|
30
30
|
* @param {Range} range range
|
31
31
|
* @param {Object} workerDependencyOptions options
|
32
|
-
* @param {string} workerDependencyOptions.publicPath public path for the worker
|
32
|
+
* @param {string=} workerDependencyOptions.publicPath public path for the worker
|
33
33
|
*/
|
34
34
|
constructor(request, range, workerDependencyOptions) {
|
35
35
|
super(request);
|
@@ -71,10 +71,10 @@ const PLUGIN_NAME = "WorkerPlugin";
|
|
71
71
|
|
72
72
|
class WorkerPlugin {
|
73
73
|
/**
|
74
|
-
* @param {ChunkLoading} chunkLoading chunk loading
|
75
|
-
* @param {WasmLoading} wasmLoading wasm loading
|
76
|
-
* @param {OutputModule} module output module
|
77
|
-
* @param {WorkerPublicPath} workerPublicPath worker public path
|
74
|
+
* @param {ChunkLoading=} chunkLoading chunk loading
|
75
|
+
* @param {WasmLoading=} wasmLoading wasm loading
|
76
|
+
* @param {OutputModule=} module output module
|
77
|
+
* @param {WorkerPublicPath=} workerPublicPath worker public path
|
78
78
|
*/
|
79
79
|
constructor(chunkLoading, wasmLoading, module, workerPublicPath) {
|
80
80
|
this._chunkLoading = chunkLoading;
|
@@ -369,7 +369,8 @@ class WorkerPlugin {
|
|
369
369
|
);
|
370
370
|
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
371
371
|
parser.state.module.addPresentationalDependency(dep);
|
372
|
-
|
372
|
+
/** @type {TODO} */
|
373
|
+
(expressions).type = undefined;
|
373
374
|
}
|
374
375
|
} else if (insertType === "comma") {
|
375
376
|
if (this._module || hasSpreadInOptions) {
|
@@ -5,12 +5,14 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
/** @typedef {import("estree").ArrowFunctionExpression} ArrowFunctionExpression */
|
8
9
|
/** @typedef {import("estree").Expression} Expression */
|
10
|
+
/** @typedef {import("estree").FunctionExpression} FunctionExpression */
|
9
11
|
/** @typedef {import("estree").SpreadElement} SpreadElement */
|
10
12
|
|
11
13
|
/**
|
12
14
|
* @param {Expression | SpreadElement} expr expressions
|
13
|
-
* @returns {{fn:
|
15
|
+
* @returns {{fn: FunctionExpression | ArrowFunctionExpression, expressions: (Expression | SpreadElement)[], needThis: boolean | undefined } | undefined} function expression with additional information
|
14
16
|
*/
|
15
17
|
module.exports = expr => {
|
16
18
|
// <FunctionExpression>
|
@@ -19,6 +19,7 @@ const { getUndoPath } = require("../util/identifier");
|
|
19
19
|
|
20
20
|
/** @typedef {import("../Chunk")} Chunk */
|
21
21
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
22
|
+
/** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
22
23
|
|
23
24
|
/**
|
24
25
|
* @typedef {Object} JsonpCompilationPluginHooks
|
@@ -52,7 +53,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
|
|
52
53
|
}
|
53
54
|
|
54
55
|
/**
|
55
|
-
* @param {
|
56
|
+
* @param {ReadOnlyRuntimeRequirements} runtimeRequirements runtime requirements
|
56
57
|
*/
|
57
58
|
constructor(runtimeRequirements) {
|
58
59
|
super("import chunk loading", RuntimeModule.STAGE_ATTACH);
|
@@ -27,6 +27,7 @@ const { registerNotSerializable } = require("../util/serialization");
|
|
27
27
|
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
28
28
|
/** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */
|
29
29
|
/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */
|
30
|
+
/** @typedef {import("../Module").SourceTypes} SourceTypes */
|
30
31
|
/** @typedef {import("../ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
|
31
32
|
/** @typedef {import("../ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
|
32
33
|
/** @typedef {import("../RequestShortener")} RequestShortener */
|
@@ -190,7 +191,7 @@ class LazyCompilationProxyModule extends Module {
|
|
190
191
|
}
|
191
192
|
|
192
193
|
/**
|
193
|
-
* @returns {
|
194
|
+
* @returns {SourceTypes} types available (do not mutate)
|
194
195
|
*/
|
195
196
|
getSourceTypes() {
|
196
197
|
return TYPES;
|
@@ -27,7 +27,7 @@ const TypeBigInt = 13;
|
|
27
27
|
class BasicEvaluatedExpression {
|
28
28
|
constructor() {
|
29
29
|
this.type = TypeUnknown;
|
30
|
-
/** @type {
|
30
|
+
/** @type {Range | undefined} */
|
31
31
|
this.range = undefined;
|
32
32
|
/** @type {boolean} */
|
33
33
|
this.falsy = false;
|
@@ -420,7 +420,7 @@ class BasicEvaluatedExpression {
|
|
420
420
|
*
|
421
421
|
* @param {BasicEvaluatedExpression | null | undefined} prefix Expression to be added before the innerExpressions
|
422
422
|
* @param {BasicEvaluatedExpression | null | undefined} postfix Expression to be added after the innerExpressions
|
423
|
-
* @param {BasicEvaluatedExpression[]} innerExpressions Expressions to be wrapped
|
423
|
+
* @param {BasicEvaluatedExpression[] | undefined} innerExpressions Expressions to be wrapped
|
424
424
|
* @returns {this} this
|
425
425
|
*/
|
426
426
|
setWrapped(prefix, postfix, innerExpressions) {
|
@@ -11,8 +11,8 @@ const Entrypoint = require("../Entrypoint");
|
|
11
11
|
|
12
12
|
/**
|
13
13
|
* @param {Entrypoint} entrypoint a chunk group
|
14
|
-
* @param {Chunk=} excludedChunk1 current chunk which is excluded
|
15
|
-
* @param {Chunk=} excludedChunk2 runtime chunk which is excluded
|
14
|
+
* @param {(Chunk | null)=} excludedChunk1 current chunk which is excluded
|
15
|
+
* @param {(Chunk | null)=} excludedChunk2 runtime chunk which is excluded
|
16
16
|
* @returns {Set<Chunk>} chunks
|
17
17
|
*/
|
18
18
|
const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => {
|