webpack 5.103.0 → 5.104.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/hot/dev-server.js +18 -3
  2. package/hot/emitter-event-target.js +7 -0
  3. package/hot/lazy-compilation-node.js +45 -29
  4. package/hot/lazy-compilation-universal.js +18 -0
  5. package/hot/lazy-compilation-web.js +15 -5
  6. package/hot/load-http.js +7 -0
  7. package/hot/only-dev-server.js +19 -4
  8. package/lib/APIPlugin.js +6 -0
  9. package/lib/Chunk.js +1 -1
  10. package/lib/ChunkGraph.js +9 -7
  11. package/lib/ChunkGroup.js +8 -5
  12. package/lib/CleanPlugin.js +6 -3
  13. package/lib/CodeGenerationResults.js +2 -1
  14. package/lib/CompatibilityPlugin.js +3 -0
  15. package/lib/Compilation.js +33 -19
  16. package/lib/Compiler.js +3 -3
  17. package/lib/ContextModule.js +6 -3
  18. package/lib/ContextModuleFactory.js +6 -4
  19. package/lib/DefinePlugin.js +34 -3
  20. package/lib/DelegatedModule.js +7 -4
  21. package/lib/DllModule.js +6 -3
  22. package/lib/DotenvPlugin.js +11 -6
  23. package/lib/ExportsInfo.js +5 -5
  24. package/lib/ExternalModule.js +8 -7
  25. package/lib/ExternalModuleFactoryPlugin.js +1 -1
  26. package/lib/FileSystemInfo.js +1 -1
  27. package/lib/Generator.js +10 -7
  28. package/lib/HookWebpackError.js +33 -4
  29. package/lib/HotModuleReplacementPlugin.js +22 -0
  30. package/lib/ManifestPlugin.js +1 -1
  31. package/lib/Module.js +24 -15
  32. package/lib/ModuleBuildError.js +1 -1
  33. package/lib/ModuleError.js +1 -1
  34. package/lib/ModuleFilenameHelpers.js +1 -1
  35. package/lib/ModuleGraph.js +27 -12
  36. package/lib/ModuleGraphConnection.js +2 -2
  37. package/lib/ModuleSourceTypeConstants.js +189 -0
  38. package/lib/ModuleTypeConstants.js +1 -4
  39. package/lib/ModuleWarning.js +1 -1
  40. package/lib/NodeStuffPlugin.js +52 -42
  41. package/lib/NormalModule.js +6 -4
  42. package/lib/NormalModuleFactory.js +7 -10
  43. package/lib/Parser.js +1 -1
  44. package/lib/RawModule.js +7 -4
  45. package/lib/RuntimeModule.js +1 -1
  46. package/lib/RuntimeTemplate.js +5 -1
  47. package/lib/SizeFormatHelpers.js +1 -1
  48. package/lib/SourceMapDevToolPlugin.js +6 -1
  49. package/lib/Template.js +17 -6
  50. package/lib/TemplatedPathPlugin.js +5 -6
  51. package/lib/WebpackError.js +0 -1
  52. package/lib/WebpackOptionsApply.js +37 -9
  53. package/lib/asset/AssetBytesGenerator.js +15 -11
  54. package/lib/asset/AssetGenerator.js +30 -24
  55. package/lib/asset/AssetSourceGenerator.js +15 -11
  56. package/lib/asset/RawDataUrlModule.js +6 -3
  57. package/lib/buildChunkGraph.js +4 -2
  58. package/lib/cache/PackFileCacheStrategy.js +6 -5
  59. package/lib/cli.js +2 -43
  60. package/lib/config/browserslistTargetHandler.js +19 -0
  61. package/lib/config/defaults.js +128 -43
  62. package/lib/config/normalization.js +2 -2
  63. package/lib/config/target.js +5 -0
  64. package/lib/container/ContainerEntryModule.js +6 -3
  65. package/lib/container/FallbackModule.js +6 -3
  66. package/lib/container/RemoteModule.js +1 -3
  67. package/lib/css/CssGenerator.js +26 -24
  68. package/lib/css/CssLoadingRuntimeModule.js +12 -4
  69. package/lib/css/CssModulesPlugin.js +29 -74
  70. package/lib/css/CssParser.js +828 -341
  71. package/lib/css/walkCssTokens.js +33 -13
  72. package/lib/dependencies/CachedConstDependency.js +24 -10
  73. package/lib/dependencies/CommonJsRequireContextDependency.js +1 -1
  74. package/lib/dependencies/ContextDependencyHelpers.js +2 -2
  75. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +3 -1
  76. package/lib/dependencies/CssIcssExportDependency.js +242 -104
  77. package/lib/dependencies/CssIcssImportDependency.js +61 -4
  78. package/lib/dependencies/CssIcssSymbolDependency.js +2 -6
  79. package/lib/dependencies/CssImportDependency.js +2 -1
  80. package/lib/dependencies/CssUrlDependency.js +3 -2
  81. package/lib/dependencies/DynamicExports.js +7 -7
  82. package/lib/dependencies/ExternalModuleDependency.js +7 -4
  83. package/lib/dependencies/ExternalModuleInitFragment.js +2 -1
  84. package/lib/dependencies/ExternalModuleInitFragmentDependency.js +2 -1
  85. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +3 -2
  86. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +6 -4
  87. package/lib/dependencies/HarmonyExports.js +4 -4
  88. package/lib/dependencies/HarmonyImportDependency.js +8 -3
  89. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
  90. package/lib/dependencies/ImportMetaPlugin.js +57 -0
  91. package/lib/dependencies/ImportParserPlugin.js +2 -2
  92. package/lib/dependencies/LocalModulesHelpers.js +3 -3
  93. package/lib/dependencies/WorkerPlugin.js +2 -2
  94. package/lib/dependencies/getFunctionExpression.js +1 -1
  95. package/lib/esm/ModuleChunkFormatPlugin.js +5 -4
  96. package/lib/hmr/HotModuleReplacement.runtime.js +2 -1
  97. package/lib/hmr/LazyCompilationPlugin.js +4 -3
  98. package/lib/ids/IdHelpers.js +16 -7
  99. package/lib/javascript/ChunkHelpers.js +1 -1
  100. package/lib/javascript/JavascriptGenerator.js +4 -3
  101. package/lib/javascript/JavascriptModulesPlugin.js +57 -24
  102. package/lib/javascript/JavascriptParser.js +19 -6
  103. package/lib/json/JsonGenerator.js +5 -4
  104. package/lib/json/JsonParser.js +2 -1
  105. package/lib/library/AbstractLibraryPlugin.js +1 -1
  106. package/lib/library/AmdLibraryPlugin.js +4 -1
  107. package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
  108. package/lib/library/ModuleLibraryPlugin.js +41 -13
  109. package/lib/library/SystemLibraryPlugin.js +4 -1
  110. package/lib/library/UmdLibraryPlugin.js +1 -1
  111. package/lib/logging/Logger.js +5 -4
  112. package/lib/logging/createConsoleLogger.js +2 -2
  113. package/lib/optimize/ConcatenatedModule.js +47 -32
  114. package/lib/optimize/ModuleConcatenationPlugin.js +5 -4
  115. package/lib/optimize/SideEffectsFlagPlugin.js +3 -2
  116. package/lib/optimize/SplitChunksPlugin.js +60 -46
  117. package/lib/rules/RuleSetCompiler.js +1 -1
  118. package/lib/runtime/GetChunkFilenameRuntimeModule.js +3 -2
  119. package/lib/schemes/HttpUriPlugin.js +97 -10
  120. package/lib/serialization/AggregateErrorSerializer.js +1 -2
  121. package/lib/serialization/ObjectMiddleware.js +0 -2
  122. package/lib/serialization/SingleItemMiddleware.js +1 -1
  123. package/lib/sharing/ConsumeSharedModule.js +1 -1
  124. package/lib/sharing/ConsumeSharedPlugin.js +5 -3
  125. package/lib/sharing/ProvideSharedModule.js +1 -1
  126. package/lib/sharing/resolveMatchedConfigs.js +15 -9
  127. package/lib/sharing/utils.js +1 -1
  128. package/lib/stats/DefaultStatsFactoryPlugin.js +8 -5
  129. package/lib/stats/DefaultStatsPresetPlugin.js +1 -1
  130. package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
  131. package/lib/util/StringXor.js +1 -1
  132. package/lib/util/URLAbsoluteSpecifier.js +2 -2
  133. package/lib/util/binarySearchBounds.js +2 -2
  134. package/lib/util/comparators.js +53 -76
  135. package/lib/util/compileBooleanMatcher.js +78 -6
  136. package/lib/util/createHash.js +20 -199
  137. package/lib/util/deprecation.js +1 -1
  138. package/lib/util/deterministicGrouping.js +6 -3
  139. package/lib/util/fs.js +75 -75
  140. package/lib/util/hash/BatchedHash.js +10 -9
  141. package/lib/util/hash/BulkUpdateHash.js +138 -0
  142. package/lib/util/hash/DebugHash.js +75 -0
  143. package/lib/util/hash/hash-digest.js +216 -0
  144. package/lib/util/identifier.js +82 -17
  145. package/lib/util/internalSerializables.js +2 -6
  146. package/lib/util/runtime.js +3 -3
  147. package/lib/util/source.js +2 -2
  148. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +3 -2
  149. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +3 -2
  150. package/lib/wasm-sync/WebAssemblyGenerator.js +9 -6
  151. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +3 -2
  152. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +6 -2
  153. package/lib/webpack.js +1 -1
  154. package/package.json +30 -25
  155. package/schemas/WebpackOptions.check.js +1 -1
  156. package/schemas/WebpackOptions.json +59 -82
  157. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
  158. package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
  159. package/types.d.ts +225 -158
  160. package/lib/ModuleSourceTypesConstants.js +0 -117
  161. package/lib/dependencies/CssIcssFromIdentifierDependency.js +0 -124
  162. package/lib/dependencies/CssIcssGlobalIdentifierDependency.js +0 -48
  163. package/lib/dependencies/CssIcssLocalIdentifierDependency.js +0 -61
  164. package/lib/dependencies/CssIcssSelfLocalIdentifierDependency.js +0 -190
  165. package/lib/util/jsonParseEvenBetterErrors.js +0 -10
  166. package/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts +0 -7
  167. package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +0 -6
  168. package/schemas/plugins/css/CssAutoGeneratorOptions.json +0 -3
  169. package/schemas/plugins/css/CssAutoParserOptions.check.d.ts +0 -7
  170. package/schemas/plugins/css/CssAutoParserOptions.check.js +0 -6
  171. package/schemas/plugins/css/CssAutoParserOptions.json +0 -3
  172. package/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts +0 -7
  173. package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +0 -6
  174. package/schemas/plugins/css/CssGlobalGeneratorOptions.json +0 -3
  175. package/schemas/plugins/css/CssGlobalParserOptions.check.d.ts +0 -7
  176. package/schemas/plugins/css/CssGlobalParserOptions.check.js +0 -6
  177. package/schemas/plugins/css/CssGlobalParserOptions.json +0 -3
@@ -1,117 +0,0 @@
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
- /**
9
- * @type {ReadonlySet<never>}
10
- */
11
- const NO_TYPES = new Set();
12
-
13
- /**
14
- * @type {ReadonlySet<"asset">}
15
- */
16
- const ASSET_TYPES = new Set(["asset"]);
17
-
18
- /**
19
- * @type {ReadonlySet<"asset" | "javascript" | "asset">}
20
- */
21
- const ASSET_AND_JS_TYPES = new Set(["asset", "javascript"]);
22
-
23
- /**
24
- * @type {ReadonlySet<"css-url" | "asset">}
25
- */
26
- const ASSET_AND_CSS_URL_TYPES = new Set(["asset", "css-url"]);
27
-
28
- /**
29
- * @type {ReadonlySet<"javascript" | "css-url" | "asset">}
30
- */
31
- const ASSET_AND_JS_AND_CSS_URL_TYPES = new Set([
32
- "asset",
33
- "javascript",
34
- "css-url"
35
- ]);
36
-
37
- /**
38
- * @type {"javascript"}
39
- */
40
- const JS_TYPE = "javascript";
41
-
42
- /**
43
- * @type {ReadonlySet<"javascript">}
44
- */
45
- const JS_TYPES = new Set(["javascript"]);
46
-
47
- /**
48
- * @type {ReadonlySet<"javascript" | "css-url">}
49
- */
50
- const JS_AND_CSS_URL_TYPES = new Set(["javascript", "css-url"]);
51
-
52
- /**
53
- * @type {ReadonlySet<"javascript" | "css">}
54
- */
55
- const JS_AND_CSS_TYPES = new Set(["javascript", "css"]);
56
-
57
- /**
58
- * @type {"css"}
59
- */
60
- const CSS_TYPE = "css";
61
- /**
62
- * @type {ReadonlySet<"css">}
63
- */
64
- const CSS_TYPES = new Set(["css"]);
65
-
66
- /**
67
- * @type {ReadonlySet<"css-url">}
68
- */
69
- const CSS_URL_TYPES = new Set(["css-url"]);
70
- /**
71
- * @type {ReadonlySet<"css-import">}
72
- */
73
- const CSS_IMPORT_TYPES = new Set(["css-import"]);
74
-
75
- /**
76
- * @type {ReadonlySet<"webassembly">}
77
- */
78
- const WEBASSEMBLY_TYPES = new Set(["webassembly"]);
79
-
80
- /**
81
- * @type {ReadonlySet<"runtime">}
82
- */
83
- const RUNTIME_TYPES = new Set(["runtime"]);
84
-
85
- /**
86
- * @type {ReadonlySet<"remote" | "share-init">}
87
- */
88
- const REMOTE_AND_SHARE_INIT_TYPES = new Set(["remote", "share-init"]);
89
-
90
- /**
91
- * @type {ReadonlySet<"consume-shared">}
92
- */
93
- const CONSUME_SHARED_TYPES = new Set(["consume-shared"]);
94
-
95
- /**
96
- * @type {ReadonlySet<"share-init">}
97
- */
98
- const SHARED_INIT_TYPES = new Set(["share-init"]);
99
-
100
- module.exports.ASSET_AND_CSS_URL_TYPES = ASSET_AND_CSS_URL_TYPES;
101
- module.exports.ASSET_AND_JS_AND_CSS_URL_TYPES = ASSET_AND_JS_AND_CSS_URL_TYPES;
102
- module.exports.ASSET_AND_JS_TYPES = ASSET_AND_JS_TYPES;
103
- module.exports.ASSET_TYPES = ASSET_TYPES;
104
- module.exports.CONSUME_SHARED_TYPES = CONSUME_SHARED_TYPES;
105
- module.exports.CSS_IMPORT_TYPES = CSS_IMPORT_TYPES;
106
- module.exports.CSS_TYPE = CSS_TYPE;
107
- module.exports.CSS_TYPES = CSS_TYPES;
108
- module.exports.CSS_URL_TYPES = CSS_URL_TYPES;
109
- module.exports.JS_AND_CSS_TYPES = JS_AND_CSS_TYPES;
110
- module.exports.JS_AND_CSS_URL_TYPES = JS_AND_CSS_URL_TYPES;
111
- module.exports.JS_TYPE = JS_TYPE;
112
- module.exports.JS_TYPES = JS_TYPES;
113
- module.exports.NO_TYPES = NO_TYPES;
114
- module.exports.REMOTE_AND_SHARE_INIT_TYPES = REMOTE_AND_SHARE_INIT_TYPES;
115
- module.exports.RUNTIME_TYPES = RUNTIME_TYPES;
116
- module.exports.SHARED_INIT_TYPES = SHARED_INIT_TYPES;
117
- module.exports.WEBASSEMBLY_TYPES = WEBASSEMBLY_TYPES;
@@ -1,124 +0,0 @@
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 { cssExportConvention } = require("../util/conventions");
9
- const makeSerializable = require("../util/makeSerializable");
10
- const CssIcssExportDependency = require("./CssIcssExportDependency");
11
- const CssIcssImportDependency = require("./CssIcssImportDependency");
12
- const ModuleDependency = require("./ModuleDependency");
13
-
14
- /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
15
- /** @typedef {import("../Dependency")} Dependency */
16
- /** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
17
- /** @typedef {import("../ModuleGraph")} ModuleGraph */
18
- /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
19
- /** @typedef {import("../Module")} Module */
20
- /** @typedef {import("../CssModule")} CssModule */
21
- /** @typedef {import("../javascript/JavascriptParser").Range} Range */
22
- /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
23
- /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
24
- /** @typedef {import("../../declarations/WebpackOptions").CssGeneratorExportsConvention} CssGeneratorExportsConvention */
25
- /** @typedef {import("../css/CssGenerator")} CssGenerator */
26
- /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
27
-
28
- class CssIcssFromIdentifierDependency extends CssIcssImportDependency {
29
- /**
30
- * @param {string} request request request path which needs resolving
31
- * @param {"local" | "global"} mode mode of the parsed CSS
32
- * @param {Range} range the range of dependency
33
- * @param {string} name import class name
34
- * @param {string} exportName export class name
35
- * @param {string=} prefix prefix
36
- */
37
- constructor(request, mode, range, name, exportName, prefix) {
38
- super(request, range, mode, name);
39
- this.exportName = exportName;
40
- this.value = name;
41
- this.prefix = prefix;
42
- this.interpolationMode = CssIcssExportDependency.INTERPOLATION_MODE.VALUE;
43
- this.exportMode = CssIcssExportDependency.EXPORT_MODE.APPEND;
44
- }
45
-
46
- get type() {
47
- return "css from identifier";
48
- }
49
-
50
- /**
51
- * @returns {string | null} an identifier to merge equal requests
52
- */
53
- getResourceIdentifier() {
54
- return `${super.getResourceIdentifier()}|exportName${this.exportName}|prefix${this.prefix}`;
55
- }
56
-
57
- /**
58
- * @param {string} name export name
59
- * @param {CssGeneratorExportsConvention} convention convention of the export name
60
- * @returns {string[]} convention results
61
- */
62
- getExportsConventionNames(name, convention) {
63
- return cssExportConvention(name, convention);
64
- }
65
-
66
- /**
67
- * @param {ObjectSerializerContext} context context
68
- */
69
- serialize(context) {
70
- const { write } = context;
71
- write(this.exportName);
72
- write(this.prefix);
73
- write(this.interpolationMode);
74
- write(this.exportMode);
75
- super.serialize(context);
76
- }
77
-
78
- /**
79
- * @param {ObjectDeserializerContext} context context
80
- */
81
- deserialize(context) {
82
- const { read } = context;
83
- this.exportName = read();
84
- this.prefix = read();
85
- this.interpolationMode = read();
86
- this.exportMode = read();
87
- super.deserialize(context);
88
- }
89
- }
90
-
91
- CssIcssFromIdentifierDependency.Template = class CssIcssFromIdentifierDependencyTemplate extends (
92
- ModuleDependency.Template
93
- ) {
94
- /**
95
- * @param {Dependency} dependency the dependency for which the template should be applied
96
- * @param {ReplaceSource} source the current replace source which can be modified
97
- * @param {DependencyTemplateContext} templateContext the context object
98
- * @returns {void}
99
- */
100
- apply(dependency, source, templateContext) {
101
- const { moduleGraph } = templateContext;
102
- const dep = /** @type {CssIcssFromIdentifierDependency} */ (dependency);
103
- const module =
104
- /** @type {CssModule} */
105
- (moduleGraph.getModule(dep));
106
-
107
- if (!moduleGraph.getExportsInfo(module).isExportProvided(dep.name)) {
108
- return;
109
- }
110
-
111
- const template = new CssIcssExportDependency.Template();
112
- const originalName = dep.name;
113
- dep.name = dep.exportName;
114
- template.apply(dep, source, { ...templateContext, module });
115
- dep.name = originalName;
116
- }
117
- };
118
-
119
- makeSerializable(
120
- CssIcssFromIdentifierDependency,
121
- "webpack/lib/dependencies/CssIcssFromIdentifierDependency"
122
- );
123
-
124
- module.exports = CssIcssFromIdentifierDependency;
@@ -1,48 +0,0 @@
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 makeSerializable = require("../util/makeSerializable");
9
- const CssIcssExportDependency = require("./CssIcssExportDependency");
10
-
11
- /** @typedef {import("../css/CssParser").Range} Range */
12
- /** @typedef {import("../ModuleGraph")} ModuleGraph */
13
- /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
14
-
15
- class CssIcssGlobalIdentifierDependency extends CssIcssExportDependency {
16
- /**
17
- * @param {string} name export identifier name
18
- * @param {string} value identifier value
19
- * @param {string | undefined} reexport reexport name
20
- * @param {Range} range the range of dependency
21
- */
22
- constructor(name, value, reexport, range) {
23
- super(name, value, reexport, range);
24
- this.exportMode = CssIcssExportDependency.EXPORT_MODE.APPEND;
25
- }
26
-
27
- get type() {
28
- return "css global identifier";
29
- }
30
-
31
- /**
32
- * Returns the exported names
33
- * @param {ModuleGraph} moduleGraph module graph
34
- * @returns {ExportsSpec | undefined} export names
35
- */
36
- getExports(moduleGraph) {
37
- return undefined;
38
- }
39
- }
40
-
41
- CssIcssGlobalIdentifierDependency.Template = CssIcssExportDependency.Template;
42
-
43
- makeSerializable(
44
- CssIcssGlobalIdentifierDependency,
45
- "webpack/lib/dependencies/CssIcssGlobalDependency"
46
- );
47
-
48
- module.exports = CssIcssGlobalIdentifierDependency;
@@ -1,61 +0,0 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Ivan Kopeykin @vankop
4
- */
5
-
6
- "use strict";
7
-
8
- const makeSerializable = require("../util/makeSerializable");
9
- const CssIcssExportDependency = require("./CssIcssExportDependency");
10
-
11
- /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
12
- /** @typedef {import("../Dependency")} Dependency */
13
- /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
14
- /** @typedef {import("../css/CssParser").Range} Range */
15
- /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
16
- /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
17
-
18
- class CssIcssLocalIdentifierDependency extends CssIcssExportDependency {
19
- /**
20
- * @param {string} name name
21
- * @param {Range} range range
22
- * @param {string=} prefix prefix
23
- */
24
- constructor(name, range, prefix = "") {
25
- super(name, name, undefined, range);
26
- this.prefix = prefix;
27
- this.interpolationMode = CssIcssExportDependency.INTERPOLATION_MODE.VALUE;
28
- this.exportMode = CssIcssExportDependency.EXPORT_MODE.ONCE;
29
- }
30
-
31
- get type() {
32
- return "css local identifier";
33
- }
34
-
35
- /**
36
- * @param {ObjectSerializerContext} context context
37
- */
38
- serialize(context) {
39
- const { write } = context;
40
- write(this.prefix);
41
- super.serialize(context);
42
- }
43
-
44
- /**
45
- * @param {ObjectDeserializerContext} context context
46
- */
47
- deserialize(context) {
48
- const { read } = context;
49
- this.prefix = read();
50
- super.deserialize(context);
51
- }
52
- }
53
-
54
- CssIcssLocalIdentifierDependency.Template = CssIcssExportDependency.Template;
55
-
56
- makeSerializable(
57
- CssIcssLocalIdentifierDependency,
58
- "webpack/lib/dependencies/CssLocalIdentifierDependency"
59
- );
60
-
61
- module.exports = CssIcssLocalIdentifierDependency;
@@ -1,190 +0,0 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Ivan Kopeykin @vankop
4
- */
5
-
6
- "use strict";
7
-
8
- const Dependency = require("../Dependency");
9
- const WebpackError = require("../WebpackError");
10
- const makeSerializable = require("../util/makeSerializable");
11
- const CssIcssExportDependency = require("./CssIcssExportDependency");
12
- const CssLocalIdentifierDependency = require("./CssIcssLocalIdentifierDependency");
13
-
14
- /** @typedef {import("../../declarations/WebpackOptions").CssGeneratorExportsConvention} CssGeneratorExportsConvention */
15
- /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
16
- /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
17
- /** @typedef {import("../Dependency").ReferencedExports} ReferencedExports */
18
- /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
19
- /** @typedef {import("../ModuleGraph")} ModuleGraph */
20
- /** @typedef {import("../css/CssParser").Range} Range */
21
- /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
22
- /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
23
- /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
24
- /** @typedef {import("../CssModule")} CssModule */
25
- /** @typedef {import("../css/CssGenerator")} CssGenerator */
26
-
27
- class CssIcssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency {
28
- /**
29
- * @param {string} name name
30
- * @param {string | undefined} referencedExport referenced export name
31
- * @param {Range} range range
32
- * @param {string=} prefix prefix
33
- * @param {Set<string>=} declaredSet set of declared names (will only be active when in declared set)
34
- * @param {string=} reexport reexport name
35
- */
36
- constructor(
37
- name,
38
- referencedExport,
39
- range,
40
- prefix = "",
41
- declaredSet = undefined,
42
- reexport = undefined
43
- ) {
44
- super(name, range, prefix);
45
- this.declaredSet = declaredSet;
46
- this.referencedExport = referencedExport;
47
- this.reexport = reexport;
48
- this.interpolationMode = referencedExport
49
- ? CssIcssExportDependency.INTERPOLATION_MODE.NONE
50
- : CssIcssExportDependency.INTERPOLATION_MODE.VALUE;
51
- this.exportMode = referencedExport
52
- ? CssIcssExportDependency.EXPORT_MODE.APPEND
53
- : CssIcssExportDependency.EXPORT_MODE.ONCE;
54
- }
55
-
56
- get type() {
57
- return "css self local identifier";
58
- }
59
-
60
- get category() {
61
- return "self";
62
- }
63
-
64
- /**
65
- * @returns {string | null} an identifier to merge equal requests
66
- */
67
- getResourceIdentifier() {
68
- return "self";
69
- }
70
-
71
- /**
72
- * Returns the exported names
73
- * @param {ModuleGraph} moduleGraph module graph
74
- * @returns {ExportsSpec | undefined} export names
75
- */
76
- getExports(moduleGraph) {
77
- if (
78
- (this.declaredSet && !this.declaredSet.has(this.name)) ||
79
- this.referencedExport
80
- ) {
81
- return;
82
- }
83
- return super.getExports(moduleGraph);
84
- }
85
-
86
- /**
87
- * Returns list of exports referenced by this dependency
88
- * @param {ModuleGraph} moduleGraph module graph
89
- * @param {RuntimeSpec} runtime the runtime for which the module is analysed
90
- * @returns {ReferencedExports} referenced exports
91
- */
92
- getReferencedExports(moduleGraph, runtime) {
93
- if (this.declaredSet && !this.declaredSet.has(this.name)) {
94
- return Dependency.NO_EXPORTS_REFERENCED;
95
- }
96
- return [
97
- {
98
- name: [this.referencedExport || this.name],
99
- canMangle: true
100
- }
101
- ];
102
- }
103
-
104
- /**
105
- * Returns warnings
106
- * @param {ModuleGraph} moduleGraph module graph
107
- * @returns {WebpackError[] | null | undefined} warnings
108
- */
109
- getWarnings(moduleGraph) {
110
- if (this.referencedExport && !this.reexport) {
111
- const module = moduleGraph.getModule(this);
112
-
113
- if (
114
- module &&
115
- !moduleGraph
116
- .getExportsInfo(module)
117
- .isExportProvided(this.referencedExport)
118
- ) {
119
- const error = new WebpackError(
120
- `Self-referencing name "${this.referencedExport}" not found`
121
- );
122
- error.module = module;
123
-
124
- return [error];
125
- }
126
- }
127
-
128
- return null;
129
- }
130
-
131
- /**
132
- * @param {ObjectSerializerContext} context context
133
- */
134
- serialize(context) {
135
- const { write } = context;
136
- write(this.declaredSet);
137
- write(this.referencedExport);
138
- super.serialize(context);
139
- }
140
-
141
- /**
142
- * @param {ObjectDeserializerContext} context context
143
- */
144
- deserialize(context) {
145
- const { read } = context;
146
- this.declaredSet = read();
147
- this.referencedExport = read();
148
- super.deserialize(context);
149
- }
150
- }
151
-
152
- CssIcssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends (
153
- CssLocalIdentifierDependency.Template
154
- ) {
155
- /**
156
- * @param {Dependency} dependency the dependency for which the template should be applied
157
- * @param {ReplaceSource} source the current replace source which can be modified
158
- * @param {DependencyTemplateContext} templateContext the context object
159
- * @returns {void}
160
- */
161
- apply(dependency, source, templateContext) {
162
- const dep =
163
- /** @type {CssIcssSelfLocalIdentifierDependency} */
164
- (dependency);
165
- if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return;
166
- if (dep.referencedExport) {
167
- const { module: m, moduleGraph, cssData } = templateContext;
168
- const module = /** @type {CssModule} */ (m);
169
-
170
- if (
171
- !dep.reexport &&
172
- !moduleGraph
173
- .getExportsInfo(module)
174
- .isExportProvided(dep.referencedExport)
175
- ) {
176
- return;
177
- }
178
-
179
- dep.value = cssData.exports.get(dep.referencedExport) || "";
180
- }
181
- super.apply(dependency, source, templateContext);
182
- }
183
- };
184
-
185
- makeSerializable(
186
- CssIcssSelfLocalIdentifierDependency,
187
- "webpack/lib/dependencies/CssIcssSelfLocalIdentifierDependency"
188
- );
189
-
190
- module.exports = CssIcssSelfLocalIdentifierDependency;
@@ -1,10 +0,0 @@
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
- //#region runtime code: json-parse-even-better-errors, parseJsonError
9
- module.exports = "test";
10
- //#endregion
@@ -1,7 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- declare const check: (options: any) => boolean;
7
- export = check;
@@ -1,6 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- "use strict";function e(r,{instancePath:t="",parentData:o,parentDataProperty:n,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in r)if("esModule"!==t&&"exportsConvention"!==t&&"exportsOnly"!==t&&"localIdentName"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==r.esModule){const t=l;if("boolean"!=typeof r.esModule)return e.errors=[{params:{type:"boolean"}}],!1;var i=t===l}else i=!0;if(i){if(void 0!==r.exportsConvention){let t=r.exportsConvention;const o=l,n=l;let a=!1;const c=l;if("as-is"!==t&&"camel-case"!==t&&"camel-case-only"!==t&&"dashes"!==t&&"dashes-only"!==t){const e={params:{}};null===s?s=[e]:s.push(e),l++}var p=c===l;if(a=a||p,!a){const e=l;if(!(t instanceof Function)){const e={params:{}};null===s?s=[e]:s.push(e),l++}p=e===l,a=a||p}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,e.errors=s,!1}l=n,null!==s&&(n?s.length=n:s=null),i=o===l}else i=!0;if(i){if(void 0!==r.exportsOnly){const t=l;if("boolean"!=typeof r.exportsOnly)return e.errors=[{params:{type:"boolean"}}],!1;i=t===l}else i=!0;if(i)if(void 0!==r.localIdentName){const t=l;if("string"!=typeof r.localIdentName)return e.errors=[{params:{type:"string"}}],!1;i=t===l}else i=!0}}}}}return e.errors=s,0===l}function r(t,{instancePath:o="",parentData:n,parentDataProperty:a,rootData:s=t}={}){let l=null,i=0;return e(t,{instancePath:o,parentData:n,parentDataProperty:a,rootData:s})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;
@@ -1,3 +0,0 @@
1
- {
2
- "$ref": "../../WebpackOptions.json#/definitions/CssAutoGeneratorOptions"
3
- }
@@ -1,7 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- declare const check: (options: any) => boolean;
7
- export = check;
@@ -1,6 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- "use strict";function r(e,{instancePath:t="",parentData:o,parentDataProperty:a,rootData:n=e}={}){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{const t=0;for(const t in e)if("exportType"!==t&&"import"!==t&&"namedExports"!==t&&"url"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(0===t){if(void 0!==e.exportType){let t=e.exportType;const o=0;if("link"!==t&&"text"!==t&&"css-style-sheet"!==t)return r.errors=[{params:{}}],!1;var s=0===o}else s=!0;if(s){if(void 0!==e.import){const t=0;if("boolean"!=typeof e.import)return r.errors=[{params:{type:"boolean"}}],!1;s=0===t}else s=!0;if(s){if(void 0!==e.namedExports){const t=0;if("boolean"!=typeof e.namedExports)return r.errors=[{params:{type:"boolean"}}],!1;s=0===t}else s=!0;if(s)if(void 0!==e.url){const t=0;if("boolean"!=typeof e.url)return r.errors=[{params:{type:"boolean"}}],!1;s=0===t}else s=!0}}}}return r.errors=null,!0}function e(t,{instancePath:o="",parentData:a,parentDataProperty:n,rootData:s=t}={}){let p=null,i=0;return r(t,{instancePath:o,parentData:a,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),i=p.length),e.errors=p,0===i}module.exports=e,module.exports.default=e;
@@ -1,3 +0,0 @@
1
- {
2
- "$ref": "../../WebpackOptions.json#/definitions/CssAutoParserOptions"
3
- }
@@ -1,7 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- declare const check: (options: any) => boolean;
7
- export = check;
@@ -1,6 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- "use strict";function e(r,{instancePath:t="",parentData:o,parentDataProperty:n,rootData:a=r}={}){let s=null,l=0;if(0===l){if(!r||"object"!=typeof r||Array.isArray(r))return e.errors=[{params:{type:"object"}}],!1;{const t=l;for(const t in r)if("esModule"!==t&&"exportType"!==t&&"exportsConvention"!==t&&"exportsOnly"!==t&&"localIdentName"!==t)return e.errors=[{params:{additionalProperty:t}}],!1;if(t===l){if(void 0!==r.esModule){const t=l;if("boolean"!=typeof r.esModule)return e.errors=[{params:{type:"boolean"}}],!1;var i=t===l}else i=!0;if(i){if(void 0!==r.exportType){let t=r.exportType;const o=l;if("link"!==t&&"text"!==t&&"css-style-sheet"!==t)return e.errors=[{params:{}}],!1;i=o===l}else i=!0;if(i){if(void 0!==r.exportsConvention){let t=r.exportsConvention;const o=l,n=l;let a=!1;const c=l;if("as-is"!==t&&"camel-case"!==t&&"camel-case-only"!==t&&"dashes"!==t&&"dashes-only"!==t){const e={params:{}};null===s?s=[e]:s.push(e),l++}var p=c===l;if(a=a||p,!a){const e=l;if(!(t instanceof Function)){const e={params:{}};null===s?s=[e]:s.push(e),l++}p=e===l,a=a||p}if(!a){const r={params:{}};return null===s?s=[r]:s.push(r),l++,e.errors=s,!1}l=n,null!==s&&(n?s.length=n:s=null),i=o===l}else i=!0;if(i){if(void 0!==r.exportsOnly){const t=l;if("boolean"!=typeof r.exportsOnly)return e.errors=[{params:{type:"boolean"}}],!1;i=t===l}else i=!0;if(i)if(void 0!==r.localIdentName){const t=l;if("string"!=typeof r.localIdentName)return e.errors=[{params:{type:"string"}}],!1;i=t===l}else i=!0}}}}}}return e.errors=s,0===l}function r(t,{instancePath:o="",parentData:n,parentDataProperty:a,rootData:s=t}={}){let l=null,i=0;return e(t,{instancePath:o,parentData:n,parentDataProperty:a,rootData:s})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;
@@ -1,3 +0,0 @@
1
- {
2
- "$ref": "../../WebpackOptions.json#/definitions/CssGlobalGeneratorOptions"
3
- }
@@ -1,7 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- declare const check: (options: any) => boolean;
7
- export = check;
@@ -1,6 +0,0 @@
1
- /*
2
- * This file was automatically generated.
3
- * DO NOT MODIFY BY HAND.
4
- * Run `yarn fix:special` to update
5
- */
6
- "use strict";function r(e,{instancePath:t="",parentData:o,parentDataProperty:a,rootData:n=e}={}){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{const t=0;for(const t in e)if("exportType"!==t&&"import"!==t&&"namedExports"!==t&&"url"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(0===t){if(void 0!==e.exportType){let t=e.exportType;const o=0;if("link"!==t&&"text"!==t&&"css-style-sheet"!==t)return r.errors=[{params:{}}],!1;var s=0===o}else s=!0;if(s){if(void 0!==e.import){const t=0;if("boolean"!=typeof e.import)return r.errors=[{params:{type:"boolean"}}],!1;s=0===t}else s=!0;if(s){if(void 0!==e.namedExports){const t=0;if("boolean"!=typeof e.namedExports)return r.errors=[{params:{type:"boolean"}}],!1;s=0===t}else s=!0;if(s)if(void 0!==e.url){const t=0;if("boolean"!=typeof e.url)return r.errors=[{params:{type:"boolean"}}],!1;s=0===t}else s=!0}}}}return r.errors=null,!0}function e(t,{instancePath:o="",parentData:a,parentDataProperty:n,rootData:s=t}={}){let p=null,i=0;return r(t,{instancePath:o,parentData:a,parentDataProperty:n,rootData:s})||(p=null===p?r.errors:p.concat(r.errors),i=p.length),e.errors=p,0===i}module.exports=e,module.exports.default=e;
@@ -1,3 +0,0 @@
1
- {
2
- "$ref": "../../WebpackOptions.json#/definitions/CssGlobalParserOptions"
3
- }