webpack 5.106.2 → 5.107.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/README.md +2 -2
- package/lib/APIPlugin.js +1 -1
- package/lib/Cache.js +3 -6
- package/lib/CompatibilityPlugin.js +8 -7
- package/lib/Compilation.js +34 -26
- package/lib/Compiler.js +4 -13
- package/lib/ContextModule.js +2 -2
- package/lib/DefinePlugin.js +2 -2
- package/lib/Dependency.js +22 -1
- package/lib/DependencyTemplate.js +2 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/EvalSourceMapDevToolPlugin.js +8 -9
- package/lib/ExternalModule.js +76 -15
- package/lib/ExternalModuleFactoryPlugin.js +5 -0
- package/lib/FileSystemInfo.js +187 -72
- package/lib/Generator.js +3 -3
- package/lib/HotModuleReplacementPlugin.js +26 -8
- package/lib/IgnorePlugin.js +2 -1
- package/lib/Module.js +19 -18
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleSourceTypeConstants.js +31 -1
- package/lib/ModuleTypeConstants.js +12 -3
- package/lib/MultiCompiler.js +2 -2
- package/lib/NodeStuffPlugin.js +1 -1
- package/lib/NormalModule.js +13 -31
- package/lib/NormalModuleFactory.js +10 -2
- package/lib/Parser.js +1 -1
- package/lib/ProgressPlugin.js +129 -56
- package/lib/RuntimeGlobals.js +5 -5
- package/lib/RuntimeModule.js +9 -7
- package/lib/RuntimePlugin.js +11 -0
- package/lib/WarnCaseSensitiveModulesPlugin.js +70 -2
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +16 -1
- package/lib/Watching.js +2 -3
- package/lib/WebpackError.js +3 -77
- package/lib/WebpackIsIncludedPlugin.js +1 -1
- package/lib/WebpackOptionsApply.js +13 -1
- package/lib/asset/AssetBytesGenerator.js +6 -2
- package/lib/asset/AssetGenerator.js +22 -8
- package/lib/asset/AssetModulesPlugin.js +3 -1
- package/lib/asset/AssetSourceGenerator.js +6 -2
- package/lib/buildChunkGraph.js +4 -6
- package/lib/cache/PackFileCacheStrategy.js +4 -4
- package/lib/cli.js +3 -1
- package/lib/config/defaults.js +197 -10
- package/lib/config/normalization.js +3 -1
- package/lib/css/CssGenerator.js +320 -105
- package/lib/css/CssInjectStyleRuntimeModule.js +44 -42
- package/lib/css/CssLoadingRuntimeModule.js +22 -4
- package/lib/{CssModule.js → css/CssModule.js} +15 -15
- package/lib/css/CssModulesPlugin.js +166 -86
- package/lib/css/CssParser.js +566 -269
- package/lib/css/walkCssTokens.js +148 -2
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +63 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +54 -10
- package/lib/dependencies/CommonJsExportsParserPlugin.js +1 -1
- package/lib/dependencies/CommonJsFullRequireDependency.js +32 -9
- package/lib/dependencies/CommonJsImportsParserPlugin.js +4 -3
- package/lib/dependencies/CommonJsRequireDependency.js +67 -4
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +1 -1
- package/lib/dependencies/CreateRequireParserPlugin.js +1 -1
- package/lib/dependencies/CriticalDependencyWarning.js +1 -1
- package/lib/dependencies/CssIcssExportDependency.js +332 -67
- package/lib/dependencies/CssIcssImportDependency.js +49 -7
- package/lib/dependencies/CssIcssSymbolDependency.js +11 -3
- package/lib/dependencies/CssImportDependency.js +8 -0
- package/lib/dependencies/CssUrlDependency.js +25 -0
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +1 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +8 -7
- package/lib/dependencies/HarmonyExportExpressionDependency.js +22 -14
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +110 -3
- package/lib/dependencies/HarmonyImportDependency.js +10 -2
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +22 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +1 -1
- package/lib/{HarmonyLinkingError.js → dependencies/HarmonyLinkingError.js} +5 -3
- package/lib/dependencies/HtmlInlineScriptDependency.js +133 -0
- package/lib/dependencies/HtmlInlineStyleDependency.js +101 -0
- package/lib/dependencies/HtmlScriptSrcDependency.js +318 -0
- package/lib/dependencies/HtmlSourceDependency.js +127 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/ImportParserPlugin.js +2 -2
- package/lib/dependencies/ImportPhase.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +1 -1
- package/lib/{RequireJsStuffPlugin.js → dependencies/RequireJsStuffPlugin.js} +7 -7
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/WebAssemblyImportDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +2 -2
- package/lib/{DelegatedModule.js → dll/DelegatedModule.js} +31 -31
- package/lib/{DelegatedModuleFactoryPlugin.js → dll/DelegatedModuleFactoryPlugin.js} +4 -4
- package/lib/{DelegatedPlugin.js → dll/DelegatedPlugin.js} +2 -2
- package/lib/{DllEntryPlugin.js → dll/DllEntryPlugin.js} +4 -4
- package/lib/{DllModule.js → dll/DllModule.js} +24 -24
- package/lib/{DllModuleFactory.js → dll/DllModuleFactory.js} +4 -4
- package/lib/{DllPlugin.js → dll/DllPlugin.js} +6 -5
- package/lib/{DllReferencePlugin.js → dll/DllReferencePlugin.js} +14 -14
- package/lib/{LibManifestPlugin.js → dll/LibManifestPlugin.js} +9 -9
- package/lib/{AsyncDependencyToInitialChunkError.js → errors/AsyncDependencyToInitialChunkError.js} +2 -2
- package/lib/errors/BuildCycleError.js +1 -1
- package/lib/{ChunkRenderError.js → errors/ChunkRenderError.js} +1 -1
- package/lib/{CodeGenerationError.js → errors/CodeGenerationError.js} +1 -1
- package/lib/{CommentCompilationWarning.js → errors/CommentCompilationWarning.js} +3 -3
- package/lib/{ConcurrentCompilationError.js → errors/ConcurrentCompilationError.js} +4 -2
- package/lib/{EnvironmentNotSupportAsyncWarning.js → errors/EnvironmentNotSupportAsyncWarning.js} +4 -4
- package/lib/{HookWebpackError.js → errors/HookWebpackError.js} +5 -5
- package/lib/{IgnoreErrorModuleFactory.js → errors/IgnoreErrorModuleFactory.js} +4 -4
- package/lib/{InvalidDependenciesModuleWarning.js → errors/InvalidDependenciesModuleWarning.js} +3 -3
- package/lib/errors/JSONParseError.js +114 -0
- package/lib/{ModuleBuildError.js → errors/ModuleBuildError.js} +5 -5
- package/lib/{ModuleDependencyError.js → errors/ModuleDependencyError.js} +2 -2
- package/lib/{ModuleDependencyWarning.js → errors/ModuleDependencyWarning.js} +4 -4
- package/lib/{ModuleError.js → errors/ModuleError.js} +5 -5
- package/lib/{ModuleHashingError.js → errors/ModuleHashingError.js} +1 -1
- package/lib/{ModuleNotFoundError.js → errors/ModuleNotFoundError.js} +2 -2
- package/lib/{ModuleParseError.js → errors/ModuleParseError.js} +8 -6
- package/lib/{ModuleRestoreError.js → errors/ModuleRestoreError.js} +1 -1
- package/lib/{ModuleStoreError.js → errors/ModuleStoreError.js} +1 -1
- package/lib/{ModuleWarning.js → errors/ModuleWarning.js} +5 -5
- package/lib/{NodeStuffInWebError.js → errors/NodeStuffInWebError.js} +4 -4
- package/lib/errors/NonErrorEmittedError.js +28 -0
- package/lib/{UnhandledSchemeError.js → errors/UnhandledSchemeError.js} +2 -2
- package/lib/{UnsupportedFeatureWarning.js → errors/UnsupportedFeatureWarning.js} +3 -3
- package/lib/errors/WebpackError.js +84 -0
- package/lib/html/HtmlGenerator.js +379 -0
- package/lib/html/HtmlModulesPlugin.js +433 -0
- package/lib/html/HtmlParser.js +1489 -0
- package/lib/html/walkHtmlTokens.js +2733 -0
- package/lib/ids/IdHelpers.js +2 -1
- package/lib/index.js +34 -15
- package/lib/javascript/JavascriptModulesPlugin.js +89 -8
- package/lib/javascript/JavascriptParser.js +197 -16
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/json/JsonParser.js +7 -16
- package/lib/library/AbstractLibraryPlugin.js +1 -1
- package/lib/library/EnableLibraryPlugin.js +1 -1
- package/lib/{FalseIIFEUmdWarning.js → library/FalseIIFEUmdWarning.js} +1 -1
- package/lib/library/ModuleLibraryPlugin.js +74 -0
- package/lib/node/NodeEnvironmentPlugin.js +4 -2
- package/lib/node/nodeConsole.js +113 -64
- package/lib/optimize/ConcatenatedModule.js +51 -6
- package/lib/optimize/InnerGraph.js +1 -1
- package/lib/optimize/InnerGraphPlugin.js +11 -1
- package/lib/optimize/MinMaxSizeWarning.js +4 -4
- package/lib/optimize/ModuleConcatenationPlugin.js +15 -7
- package/lib/optimize/RealContentHashPlugin.js +89 -26
- package/lib/optimize/SideEffectsFlagPlugin.js +111 -3
- package/lib/optimize/SplitChunksPlugin.js +1 -1
- package/lib/performance/AssetsOverSizeLimitWarning.js +2 -2
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/NoAsyncChunksWarning.js +5 -3
- package/lib/performance/SizeLimitsPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +4 -1
- package/lib/rules/UseEffectRulePlugin.js +4 -3
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +119 -13
- package/lib/runtime/SetAnonymousDefaultNameRuntimeModule.js +35 -0
- package/lib/schemes/DataUriPlugin.js +13 -1
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +2 -2
- package/lib/sharing/ConsumeSharedRuntimeModule.js +8 -4
- package/lib/sharing/ProvideSharedModule.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +2 -2
- package/lib/stats/DefaultStatsPresetPlugin.js +1 -1
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/stats/StatsFactory.js +1 -1
- package/lib/typescript/TypeScriptPlugin.js +210 -0
- package/lib/url/URLParserPlugin.js +2 -2
- package/lib/util/AsyncQueue.js +2 -2
- package/lib/util/Hash.js +2 -2
- package/lib/util/LocConverter.js +53 -0
- package/lib/util/SortableSet.js +1 -1
- package/lib/util/cleverMerge.js +2 -2
- package/lib/util/comparators.js +3 -3
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +42 -1
- package/lib/util/createMappings.js +118 -0
- package/lib/{formatLocation.js → util/formatLocation.js} +2 -2
- package/lib/{SizeFormatHelpers.js → util/formatSize.js} +3 -1
- package/lib/util/fs.js +8 -8
- package/lib/util/hash/md4.js +1 -1
- package/lib/util/hash/xxhash64.js +1 -1
- package/lib/util/identifier.js +48 -0
- package/lib/util/internalSerializables.js +35 -19
- package/lib/util/magicComment.js +10 -7
- package/lib/util/parseJson.js +2 -73
- package/lib/util/source.js +21 -0
- package/lib/util/topologicalSort.js +69 -0
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -2
- package/lib/wasm-async/AsyncWebAssemblyParser.js +1 -1
- package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +5 -3
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +1 -1
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +5 -3
- package/lib/webpack.js +3 -1
- package/package.json +22 -20
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +118 -3
- package/schemas/plugins/{DllPlugin.check.d.ts → HtmlGeneratorOptions.check.d.ts} +1 -1
- package/schemas/plugins/HtmlGeneratorOptions.check.js +6 -0
- package/schemas/plugins/HtmlGeneratorOptions.json +3 -0
- package/schemas/plugins/ProgressPlugin.check.js +1 -1
- package/schemas/plugins/ProgressPlugin.json +22 -0
- package/schemas/plugins/{DllReferencePlugin.check.d.ts → css/CssAutoOrModuleParserOptions.check.d.ts} +1 -1
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.json +3 -0
- package/schemas/plugins/dll/DllPlugin.check.d.ts +7 -0
- package/schemas/plugins/dll/DllReferencePlugin.check.d.ts +7 -0
- package/types.d.ts +810 -101
- package/lib/CaseSensitiveModulesWarning.js +0 -80
- package/lib/GraphHelpers.js +0 -49
- package/lib/NoModeWarning.js +0 -23
- package/lib/css/CssMergeStyleSheetsRuntimeModule.js +0 -57
- /package/lib/{AbstractMethodError.js → errors/AbstractMethodError.js} +0 -0
- /package/schemas/plugins/{DllPlugin.check.js → dll/DllPlugin.check.js} +0 -0
- /package/schemas/plugins/{DllPlugin.json → dll/DllPlugin.json} +0 -0
- /package/schemas/plugins/{DllReferencePlugin.check.js → dll/DllReferencePlugin.check.js} +0 -0
- /package/schemas/plugins/{DllReferencePlugin.json → dll/DllReferencePlugin.json} +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const { CSS_TEXT_TYPE } = require("../ModuleSourceTypeConstants");
|
|
8
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
9
|
+
const ModuleDependency = require("./ModuleDependency");
|
|
10
|
+
|
|
11
|
+
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
|
12
|
+
/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */
|
|
13
|
+
/** @typedef {import("../Dependency")} Dependency */
|
|
14
|
+
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
|
15
|
+
/** @typedef {import("../Module")} Module */
|
|
16
|
+
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
|
17
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
18
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
19
|
+
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents an inline `<style>...</style>` block in an HTML module. The
|
|
23
|
+
* tag's content is fed into webpack's CSS pipeline as a virtual CSS module
|
|
24
|
+
* with `exportType: "text"` so `url()` and `\@import` references are
|
|
25
|
+
* resolved relative to the HTML file. At render time the original content
|
|
26
|
+
* range is replaced with the processed CSS text read from the CSS module's
|
|
27
|
+
* code generation data.
|
|
28
|
+
*/
|
|
29
|
+
class HtmlInlineStyleDependency extends ModuleDependency {
|
|
30
|
+
/**
|
|
31
|
+
* Creates an instance of HtmlInlineStyleDependency.
|
|
32
|
+
* @param {string} request virtual request resolving to the inline CSS (data URI)
|
|
33
|
+
* @param {Range} range range of the inline CSS content (between `<style>` and `</style>`)
|
|
34
|
+
*/
|
|
35
|
+
constructor(request, range) {
|
|
36
|
+
super(request);
|
|
37
|
+
this.range = range;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get type() {
|
|
41
|
+
return "html inline style";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get category() {
|
|
45
|
+
return "html-style";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Serializes this instance into the provided serializer context.
|
|
50
|
+
* @param {ObjectSerializerContext} context context
|
|
51
|
+
*/
|
|
52
|
+
serialize(context) {
|
|
53
|
+
super.serialize(context);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Restores this instance from the provided deserializer context.
|
|
58
|
+
* @param {ObjectDeserializerContext} context context
|
|
59
|
+
*/
|
|
60
|
+
deserialize(context) {
|
|
61
|
+
super.deserialize(context);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
HtmlInlineStyleDependency.Template = class HtmlInlineStyleDependencyTemplate extends (
|
|
66
|
+
ModuleDependency.Template
|
|
67
|
+
) {
|
|
68
|
+
/**
|
|
69
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
70
|
+
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
71
|
+
* @param {ReplaceSource} source the current replace source which can be modified
|
|
72
|
+
* @param {DependencyTemplateContext} templateContext the context object
|
|
73
|
+
* @returns {void}
|
|
74
|
+
*/
|
|
75
|
+
apply(dependency, source, { moduleGraph, runtime, codeGenerationResults }) {
|
|
76
|
+
const dep = /** @type {HtmlInlineStyleDependency} */ (dependency);
|
|
77
|
+
const module = /** @type {Module} */ (moduleGraph.getModule(dep));
|
|
78
|
+
|
|
79
|
+
/** @type {string} */
|
|
80
|
+
let cssText = "";
|
|
81
|
+
|
|
82
|
+
if (module) {
|
|
83
|
+
const codeGen =
|
|
84
|
+
/** @type {CodeGenerationResults} */
|
|
85
|
+
(codeGenerationResults).get(module, runtime);
|
|
86
|
+
const cssTextSource = codeGen.sources.get(CSS_TEXT_TYPE);
|
|
87
|
+
if (cssTextSource) {
|
|
88
|
+
cssText = /** @type {string} */ (cssTextSource.source());
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
source.replace(dep.range[0], dep.range[1] - 1, cssText);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
makeSerializable(
|
|
97
|
+
HtmlInlineStyleDependency,
|
|
98
|
+
"webpack/lib/dependencies/HtmlInlineStyleDependency"
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
module.exports = HtmlInlineStyleDependency;
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
8
|
+
const CssUrlDependency = require("./CssUrlDependency");
|
|
9
|
+
const ModuleDependency = require("./ModuleDependency");
|
|
10
|
+
|
|
11
|
+
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
|
12
|
+
/** @typedef {import("../Chunk")} Chunk */
|
|
13
|
+
/** @typedef {import("../Dependency")} Dependency */
|
|
14
|
+
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
|
15
|
+
/** @typedef {import("../Entrypoint")} Entrypoint */
|
|
16
|
+
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
|
17
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
18
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
19
|
+
|
|
20
|
+
/** @typedef {"script-classic" | "script-module" | "modulepreload" | "stylesheet"} HtmlScriptElementKind */
|
|
21
|
+
|
|
22
|
+
class HtmlScriptSrcDependency extends ModuleDependency {
|
|
23
|
+
/**
|
|
24
|
+
* Creates an instance of HtmlScriptSrcDependency.
|
|
25
|
+
* @param {string} request request
|
|
26
|
+
* @param {Range} range range of the attribute value in the source
|
|
27
|
+
* @param {string} entryName name of the entry this script src is bundled into
|
|
28
|
+
* @param {string=} category dependency category used for resolving and grouping
|
|
29
|
+
* @param {HtmlScriptElementKind=} elementKind shape of the originating HTML element; used when expanding sibling tags for split/runtime chunks
|
|
30
|
+
* @param {number=} tagStart position of the opening `<` of the originating tag in the source; sibling tags emitted for additional entry chunks are inserted right before this
|
|
31
|
+
* @param {number=} tagOpenEnd position of the character immediately after the opening tag's `>` in the source; combined with `tagStart` this lets the template clone the original opening tag verbatim (preserving attributes like `nonce`, `crossorigin`, `referrerpolicy`, `defer`, `async`) when generating sibling tags
|
|
32
|
+
*/
|
|
33
|
+
constructor(
|
|
34
|
+
request,
|
|
35
|
+
range,
|
|
36
|
+
entryName,
|
|
37
|
+
category,
|
|
38
|
+
elementKind,
|
|
39
|
+
tagStart,
|
|
40
|
+
tagOpenEnd
|
|
41
|
+
) {
|
|
42
|
+
super(request);
|
|
43
|
+
this.range = range;
|
|
44
|
+
this.entryName = entryName;
|
|
45
|
+
/** @type {string} */
|
|
46
|
+
this._category = category || "commonjs";
|
|
47
|
+
/** @type {HtmlScriptElementKind} */
|
|
48
|
+
this.elementKind = elementKind || "script-classic";
|
|
49
|
+
/** @type {number} */
|
|
50
|
+
this.tagStart = tagStart === undefined ? -1 : tagStart;
|
|
51
|
+
/** @type {number} */
|
|
52
|
+
this.tagOpenEnd = tagOpenEnd === undefined ? -1 : tagOpenEnd;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get type() {
|
|
56
|
+
return "html script src";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get category() {
|
|
60
|
+
return this._category;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Serializes this instance into the provided serializer context.
|
|
65
|
+
* @param {ObjectSerializerContext} context context
|
|
66
|
+
*/
|
|
67
|
+
serialize(context) {
|
|
68
|
+
const { write } = context;
|
|
69
|
+
write(this.entryName);
|
|
70
|
+
write(this._category);
|
|
71
|
+
write(this.elementKind);
|
|
72
|
+
write(this.tagStart);
|
|
73
|
+
write(this.tagOpenEnd);
|
|
74
|
+
super.serialize(context);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Restores this instance from the provided deserializer context.
|
|
79
|
+
* @param {ObjectDeserializerContext} context context
|
|
80
|
+
*/
|
|
81
|
+
deserialize(context) {
|
|
82
|
+
const { read } = context;
|
|
83
|
+
this.entryName = read();
|
|
84
|
+
this._category = read();
|
|
85
|
+
this.elementKind = read();
|
|
86
|
+
this.tagStart = read();
|
|
87
|
+
this.tagOpenEnd = read();
|
|
88
|
+
super.deserialize(context);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {Chunk} chunk a chunk
|
|
94
|
+
* @param {import("../Compilation")} compilation compilation
|
|
95
|
+
* @param {"javascript" | "css"} contentHashType which content hash to plug into the filename template
|
|
96
|
+
* @returns {string} chunk filename path (no public-path prefix)
|
|
97
|
+
*/
|
|
98
|
+
const getChunkFilename = (chunk, compilation, contentHashType) => {
|
|
99
|
+
const outputOptions = compilation.outputOptions;
|
|
100
|
+
let filenameTemplate;
|
|
101
|
+
if (contentHashType === "css") {
|
|
102
|
+
// For a CSS-typed chunk, use the same template the CSS pipeline
|
|
103
|
+
// will use when it actually emits the `.css` file, so the `<link
|
|
104
|
+
// rel="stylesheet" href>` URL we write into the HTML matches the
|
|
105
|
+
// asset on disk.
|
|
106
|
+
filenameTemplate =
|
|
107
|
+
require("../css/CssModulesPlugin").getChunkFilenameTemplate(
|
|
108
|
+
chunk,
|
|
109
|
+
outputOptions
|
|
110
|
+
);
|
|
111
|
+
} else {
|
|
112
|
+
filenameTemplate =
|
|
113
|
+
chunk.filenameTemplate ||
|
|
114
|
+
(chunk.canBeInitial()
|
|
115
|
+
? outputOptions.filename
|
|
116
|
+
: outputOptions.chunkFilename);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return compilation.getPath(filenameTemplate, {
|
|
120
|
+
chunk,
|
|
121
|
+
contentHashType
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {Entrypoint} entrypoint entrypoint
|
|
127
|
+
* @returns {Chunk[]} every chunk this entrypoint needs in load order: the
|
|
128
|
+
* runtime chunk first (when `optimization.runtimeChunk` splits it off), then
|
|
129
|
+
* any intermediate chunks (e.g. from `optimization.splitChunks`), and finally
|
|
130
|
+
* the entry chunk itself. The entry chunk is always returned last so callers
|
|
131
|
+
* can identify it as the tag whose `src`/`href` attribute is being rewritten
|
|
132
|
+
* in place. Chunks that are already loaded by an ancestor (`dependOn`) entry's
|
|
133
|
+
* own script tag — i.e. the parent entrypoint's entry chunk *and* its runtime
|
|
134
|
+
* chunk — are skipped, otherwise they would be loaded twice when the same
|
|
135
|
+
* HTML contains tags for both the leader and the dependant entries.
|
|
136
|
+
*/
|
|
137
|
+
const getEntrypointChunksInLoadOrder = (entrypoint) => {
|
|
138
|
+
const entryChunk = /** @type {Chunk} */ (entrypoint.getEntrypointChunk());
|
|
139
|
+
const runtimeChunk = entrypoint.getRuntimeChunk();
|
|
140
|
+
|
|
141
|
+
/** @type {Set<Chunk>} */
|
|
142
|
+
const chunksLoadedByAncestorTags = new Set();
|
|
143
|
+
/** @type {Set<import("../ChunkGroup")>} */
|
|
144
|
+
const visitedGroups = new Set();
|
|
145
|
+
const walk = (/** @type {import("../ChunkGroup")} */ group) => {
|
|
146
|
+
if (visitedGroups.has(group)) return;
|
|
147
|
+
visitedGroups.add(group);
|
|
148
|
+
for (const parent of group.parentsIterable) {
|
|
149
|
+
if (
|
|
150
|
+
typeof (/** @type {Entrypoint} */ (parent).getEntrypointChunk) ===
|
|
151
|
+
"function"
|
|
152
|
+
) {
|
|
153
|
+
const parentEntry =
|
|
154
|
+
/** @type {Entrypoint} */
|
|
155
|
+
(parent).getEntrypointChunk();
|
|
156
|
+
if (parentEntry) chunksLoadedByAncestorTags.add(parentEntry);
|
|
157
|
+
const parentRuntime =
|
|
158
|
+
/** @type {Entrypoint} */
|
|
159
|
+
(parent).getRuntimeChunk();
|
|
160
|
+
if (parentRuntime) chunksLoadedByAncestorTags.add(parentRuntime);
|
|
161
|
+
}
|
|
162
|
+
walk(parent);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
walk(entrypoint);
|
|
166
|
+
|
|
167
|
+
/** @type {Chunk[]} */
|
|
168
|
+
const ordered = [];
|
|
169
|
+
/** @type {Set<Chunk>} */
|
|
170
|
+
const seen = new Set();
|
|
171
|
+
const push = (/** @type {Chunk | null | undefined} */ chunk) => {
|
|
172
|
+
if (!chunk || seen.has(chunk) || chunk === entryChunk) return;
|
|
173
|
+
if (chunksLoadedByAncestorTags.has(chunk)) return;
|
|
174
|
+
seen.add(chunk);
|
|
175
|
+
ordered.push(chunk);
|
|
176
|
+
};
|
|
177
|
+
if (runtimeChunk !== entryChunk) {
|
|
178
|
+
push(runtimeChunk);
|
|
179
|
+
}
|
|
180
|
+
for (const chunk of entrypoint.chunks) {
|
|
181
|
+
push(chunk);
|
|
182
|
+
}
|
|
183
|
+
ordered.push(entryChunk);
|
|
184
|
+
return ordered;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Clone the original `<script>`/`<link>` opening tag with its `src`/`href`
|
|
189
|
+
* value swapped for a different chunk URL. Reusing the source text verbatim
|
|
190
|
+
* preserves attributes such as `nonce`, `crossorigin`, `referrerpolicy`,
|
|
191
|
+
* `defer`, and `async` so the sibling tags load with the same semantics as
|
|
192
|
+
* the entry tag that's already there. `integrity` is dropped because it's
|
|
193
|
+
* content-specific. When the original tag was upgraded to a module script
|
|
194
|
+
* (either by the author or by the `output.module` auto-upgrade in
|
|
195
|
+
* `HtmlParser`), the sibling is forced to `type="module"` regardless of what
|
|
196
|
+
* the source originally said.
|
|
197
|
+
* @param {string} originalTag the opening tag's source text including `>`
|
|
198
|
+
* @param {number} srcStartInTag offset of the src/href value start within `originalTag`
|
|
199
|
+
* @param {number} srcEndInTag offset of the src/href value end within `originalTag`
|
|
200
|
+
* @param {string} newUrl URL to put into the cloned tag's src/href slot
|
|
201
|
+
* @param {HtmlScriptElementKind} elementKind shape of the originating tag
|
|
202
|
+
* @returns {string} the sibling tag's HTML (including a closing `</script>` for script tags)
|
|
203
|
+
*/
|
|
204
|
+
const cloneTagWithUrl = (
|
|
205
|
+
originalTag,
|
|
206
|
+
srcStartInTag,
|
|
207
|
+
srcEndInTag,
|
|
208
|
+
newUrl,
|
|
209
|
+
elementKind
|
|
210
|
+
) => {
|
|
211
|
+
let body =
|
|
212
|
+
originalTag.slice(0, srcStartInTag) +
|
|
213
|
+
newUrl +
|
|
214
|
+
originalTag.slice(srcEndInTag);
|
|
215
|
+
|
|
216
|
+
// Strip dangerous-to-copy attributes from the cloned tag — currently
|
|
217
|
+
// just `integrity`. The match handles all three quoting styles
|
|
218
|
+
// (`"…"`, `'…'`, unquoted) and the bare-attribute form.
|
|
219
|
+
body = body.replace(
|
|
220
|
+
/\s+integrity(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?(?=[\s/>])/gi,
|
|
221
|
+
""
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
if (elementKind === "script-module") {
|
|
225
|
+
if (/\stype\s*=/i.test(body)) {
|
|
226
|
+
body = body.replace(
|
|
227
|
+
/(\stype\s*=\s*)(?:"[^"]*"|'[^']*'|[^\s>]+)/i,
|
|
228
|
+
'$1"module"'
|
|
229
|
+
);
|
|
230
|
+
} else {
|
|
231
|
+
body = body.replace(/^<script\b/i, '<script type="module"');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// `<link>` is a void element — no closing tag. `<script>` needs `</script>`.
|
|
236
|
+
return elementKind === "modulepreload" || elementKind === "stylesheet"
|
|
237
|
+
? body
|
|
238
|
+
: `${body}</script>`;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
HtmlScriptSrcDependency.Template = class HtmlScriptSrcDependencyTemplate extends (
|
|
242
|
+
ModuleDependency.Template
|
|
243
|
+
) {
|
|
244
|
+
/**
|
|
245
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
246
|
+
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
247
|
+
* @param {ReplaceSource} source the current replace source which can be modified
|
|
248
|
+
* @param {DependencyTemplateContext} templateContext the context object
|
|
249
|
+
* @returns {void}
|
|
250
|
+
*/
|
|
251
|
+
apply(dependency, source, templateContext) {
|
|
252
|
+
const { runtimeTemplate } = templateContext;
|
|
253
|
+
const dep = /** @type {HtmlScriptSrcDependency} */ (dependency);
|
|
254
|
+
const compilation = runtimeTemplate.compilation;
|
|
255
|
+
const entrypoint = /** @type {Entrypoint | undefined} */ (
|
|
256
|
+
compilation.entrypoints.get(dep.entryName)
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
if (!entrypoint) {
|
|
260
|
+
source.replace(dep.range[0], dep.range[1] - 1, "data:,");
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const orderedChunks = getEntrypointChunksInLoadOrder(entrypoint);
|
|
265
|
+
const entryChunk = orderedChunks[orderedChunks.length - 1];
|
|
266
|
+
const contentHashType =
|
|
267
|
+
dep.elementKind === "stylesheet" ? "css" : "javascript";
|
|
268
|
+
const entryUrl = `${CssUrlDependency.PUBLIC_PATH_AUTO}${getChunkFilename(
|
|
269
|
+
entryChunk,
|
|
270
|
+
compilation,
|
|
271
|
+
contentHashType
|
|
272
|
+
)}`;
|
|
273
|
+
source.replace(dep.range[0], dep.range[1] - 1, entryUrl);
|
|
274
|
+
|
|
275
|
+
if (
|
|
276
|
+
orderedChunks.length <= 1 ||
|
|
277
|
+
dep.tagStart < 0 ||
|
|
278
|
+
dep.tagOpenEnd <= dep.tagStart
|
|
279
|
+
) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// The browser must load every chunk in dependency order, not just the
|
|
284
|
+
// entry chunk. Clone the original tag for each non-entry chunk so the
|
|
285
|
+
// preserved attributes (nonce, crossorigin, …) match the entry tag,
|
|
286
|
+
// and insert the clones before the original tag's `<`.
|
|
287
|
+
const originalContent = /** @type {string} */ (source.original().source());
|
|
288
|
+
const originalTag = originalContent.slice(dep.tagStart, dep.tagOpenEnd);
|
|
289
|
+
const srcStartInTag = dep.range[0] - dep.tagStart;
|
|
290
|
+
const srcEndInTag = dep.range[1] - dep.tagStart;
|
|
291
|
+
|
|
292
|
+
const siblings = [];
|
|
293
|
+
for (let i = 0; i < orderedChunks.length - 1; i++) {
|
|
294
|
+
const url = `${CssUrlDependency.PUBLIC_PATH_AUTO}${getChunkFilename(
|
|
295
|
+
orderedChunks[i],
|
|
296
|
+
compilation,
|
|
297
|
+
contentHashType
|
|
298
|
+
)}`;
|
|
299
|
+
siblings.push(
|
|
300
|
+
cloneTagWithUrl(
|
|
301
|
+
originalTag,
|
|
302
|
+
srcStartInTag,
|
|
303
|
+
srcEndInTag,
|
|
304
|
+
url,
|
|
305
|
+
dep.elementKind
|
|
306
|
+
)
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
source.insert(dep.tagStart, siblings.join(""));
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
makeSerializable(
|
|
314
|
+
HtmlScriptSrcDependency,
|
|
315
|
+
"webpack/lib/dependencies/HtmlScriptSrcDependency"
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
module.exports = HtmlScriptSrcDependency;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Alexander Akait @alexander-akait
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const RawDataUrlModule = require("../asset/RawDataUrlModule");
|
|
9
|
+
const makeSerializable = require("../util/makeSerializable");
|
|
10
|
+
const memoize = require("../util/memoize");
|
|
11
|
+
const ModuleDependency = require("./ModuleDependency");
|
|
12
|
+
|
|
13
|
+
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
|
14
|
+
/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */
|
|
15
|
+
/** @typedef {import("../Dependency")} Dependency */
|
|
16
|
+
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
|
17
|
+
/** @typedef {import("../Module")} Module */
|
|
18
|
+
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
|
19
|
+
/** @typedef {import("../Module").CodeGenerationResultData} CodeGenerationResultData */
|
|
20
|
+
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
|
21
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
22
|
+
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
23
|
+
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
|
24
|
+
|
|
25
|
+
const getIgnoredRawDataUrlModule = memoize(
|
|
26
|
+
() => new RawDataUrlModule("data:,", "ignored-asset", "(ignored asset)")
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
class HtmlSourceDependency extends ModuleDependency {
|
|
30
|
+
/**
|
|
31
|
+
* Creates an instance of HtmlSourceDependency.
|
|
32
|
+
* @param {string} request request
|
|
33
|
+
* @param {Range} range range of the argument
|
|
34
|
+
*/
|
|
35
|
+
constructor(request, range) {
|
|
36
|
+
super(request);
|
|
37
|
+
this.range = range;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get type() {
|
|
41
|
+
return "html source()";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get category() {
|
|
45
|
+
return "url";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates an ignored module.
|
|
50
|
+
* @param {string} context context directory
|
|
51
|
+
* @returns {Module} ignored module
|
|
52
|
+
*/
|
|
53
|
+
createIgnoredModule(context) {
|
|
54
|
+
return getIgnoredRawDataUrlModule();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Serializes this instance into the provided serializer context.
|
|
59
|
+
* @param {ObjectSerializerContext} context context
|
|
60
|
+
*/
|
|
61
|
+
serialize(context) {
|
|
62
|
+
super.serialize(context);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Restores this instance from the provided deserializer context.
|
|
67
|
+
* @param {ObjectDeserializerContext} context context
|
|
68
|
+
*/
|
|
69
|
+
deserialize(context) {
|
|
70
|
+
super.deserialize(context);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
HtmlSourceDependency.Template = class HtmlSourceDependencyTemplate extends (
|
|
75
|
+
ModuleDependency.Template
|
|
76
|
+
) {
|
|
77
|
+
/**
|
|
78
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
79
|
+
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
80
|
+
* @param {ReplaceSource} source the current replace source which can be modified
|
|
81
|
+
* @param {DependencyTemplateContext} templateContext the context object
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
84
|
+
apply(
|
|
85
|
+
dependency,
|
|
86
|
+
source,
|
|
87
|
+
{ moduleGraph, runtimeTemplate, codeGenerationResults }
|
|
88
|
+
) {
|
|
89
|
+
const dep = /** @type {HtmlSourceDependency} */ (dependency);
|
|
90
|
+
const module = /** @type {Module} */ (moduleGraph.getModule(dep));
|
|
91
|
+
|
|
92
|
+
/** @type {string | undefined} */
|
|
93
|
+
const newValue = this.assetUrl({
|
|
94
|
+
module,
|
|
95
|
+
codeGenerationResults
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
source.replace(dep.range[0], dep.range[1] - 1, newValue);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Returns the url of the asset.
|
|
103
|
+
* @param {object} options options object
|
|
104
|
+
* @param {Module} options.module the module
|
|
105
|
+
* @param {RuntimeSpec=} options.runtime runtime
|
|
106
|
+
* @param {CodeGenerationResults} options.codeGenerationResults the code generation results
|
|
107
|
+
* @returns {string} the url of the asset
|
|
108
|
+
*/
|
|
109
|
+
assetUrl({ runtime, module, codeGenerationResults }) {
|
|
110
|
+
if (!module) {
|
|
111
|
+
return "data:,";
|
|
112
|
+
}
|
|
113
|
+
const codeGen = codeGenerationResults.get(module, runtime);
|
|
114
|
+
const data = codeGen.data;
|
|
115
|
+
if (!data) return "data:,";
|
|
116
|
+
const url = data.get("url");
|
|
117
|
+
if (!url || !url["css-url"]) return "data:,";
|
|
118
|
+
return url["css-url"];
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
makeSerializable(
|
|
123
|
+
HtmlSourceDependency,
|
|
124
|
+
"webpack/lib/dependencies/HtmlSourceDependency"
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
module.exports = HtmlSourceDependency;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
|
|
9
|
-
const CommentCompilationWarning = require("../CommentCompilationWarning");
|
|
10
|
-
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
|
9
|
+
const CommentCompilationWarning = require("../errors/CommentCompilationWarning");
|
|
10
|
+
const UnsupportedFeatureWarning = require("../errors/UnsupportedFeatureWarning");
|
|
11
11
|
const {
|
|
12
12
|
VariableInfo,
|
|
13
13
|
getImportAttributes
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
const memoize = require("../util/memoize");
|
|
9
9
|
|
|
10
10
|
const getCommentCompilationWarning = memoize(() =>
|
|
11
|
-
require("../CommentCompilationWarning")
|
|
11
|
+
require("../errors/CommentCompilationWarning")
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
const {
|
|
9
9
|
JAVASCRIPT_MODULE_TYPE_AUTO,
|
|
10
10
|
JAVASCRIPT_MODULE_TYPE_DYNAMIC
|
|
11
|
-
} = require("
|
|
12
|
-
const RuntimeGlobals = require("
|
|
13
|
-
const ConstDependency = require("./dependencies/ConstDependency");
|
|
11
|
+
} = require("../ModuleTypeConstants");
|
|
12
|
+
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
14
13
|
const {
|
|
15
14
|
toConstantDependency
|
|
16
|
-
} = require("
|
|
15
|
+
} = require("../javascript/JavascriptParserHelpers");
|
|
16
|
+
const ConstDependency = require("./ConstDependency");
|
|
17
17
|
|
|
18
|
-
/** @typedef {import("
|
|
19
|
-
/** @typedef {import("
|
|
20
|
-
/** @typedef {import("
|
|
18
|
+
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
|
19
|
+
/** @typedef {import("../Compiler")} Compiler */
|
|
20
|
+
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
|
21
21
|
|
|
22
22
|
const PLUGIN_NAME = "RequireJsStuffPlugin";
|
|
23
23
|
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
JAVASCRIPT_MODULE_TYPE_DYNAMIC
|
|
11
11
|
} = require("../ModuleTypeConstants");
|
|
12
12
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
13
|
-
const WebpackError = require("../WebpackError");
|
|
13
|
+
const WebpackError = require("../errors/WebpackError");
|
|
14
14
|
const {
|
|
15
15
|
evaluateToString,
|
|
16
16
|
expressionIsUnsupported,
|
|
@@ -12,7 +12,7 @@ const ModuleDependency = require("./ModuleDependency");
|
|
|
12
12
|
/** @typedef {import("@webassemblyjs/ast").ModuleImportDescription} ModuleImportDescription */
|
|
13
13
|
/** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
|
|
14
14
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
|
15
|
-
/** @typedef {import("../WebpackError")} WebpackError */
|
|
15
|
+
/** @typedef {import("../errors/WebpackError")} WebpackError */
|
|
16
16
|
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
17
17
|
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
18
18
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
const { pathToFileURL } = require("url");
|
|
9
9
|
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
|
|
10
|
-
const CommentCompilationWarning = require("../CommentCompilationWarning");
|
|
11
10
|
const {
|
|
12
11
|
JAVASCRIPT_MODULE_TYPE_AUTO,
|
|
13
12
|
JAVASCRIPT_MODULE_TYPE_ESM
|
|
14
13
|
} = require("../ModuleTypeConstants");
|
|
15
|
-
const
|
|
14
|
+
const CommentCompilationWarning = require("../errors/CommentCompilationWarning");
|
|
15
|
+
const UnsupportedFeatureWarning = require("../errors/UnsupportedFeatureWarning");
|
|
16
16
|
const EnableChunkLoadingPlugin = require("../javascript/EnableChunkLoadingPlugin");
|
|
17
17
|
const { equals } = require("../util/ArrayHelpers");
|
|
18
18
|
const createHash = require("../util/createHash");
|