webpack 5.106.2 → 5.107.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 (235) hide show
  1. package/README.md +2 -2
  2. package/lib/APIPlugin.js +1 -1
  3. package/lib/BannerPlugin.js +3 -4
  4. package/lib/Cache.js +3 -6
  5. package/lib/Chunk.js +21 -25
  6. package/lib/ChunkGroup.js +57 -15
  7. package/lib/CompatibilityPlugin.js +8 -7
  8. package/lib/Compilation.js +67 -37
  9. package/lib/Compiler.js +4 -13
  10. package/lib/ContextModule.js +2 -2
  11. package/lib/DefinePlugin.js +2 -2
  12. package/lib/Dependency.js +22 -1
  13. package/lib/DependencyTemplate.js +2 -1
  14. package/lib/EnvironmentPlugin.js +1 -1
  15. package/lib/EvalSourceMapDevToolPlugin.js +8 -10
  16. package/lib/ExportsInfo.js +30 -34
  17. package/lib/ExternalModule.js +91 -26
  18. package/lib/ExternalModuleFactoryPlugin.js +7 -1
  19. package/lib/FileSystemInfo.js +187 -72
  20. package/lib/Generator.js +3 -3
  21. package/lib/HotModuleReplacementPlugin.js +26 -8
  22. package/lib/IgnorePlugin.js +2 -1
  23. package/lib/Module.js +20 -19
  24. package/lib/ModuleFactory.js +1 -1
  25. package/lib/ModuleNotFoundError.js +3 -84
  26. package/lib/ModuleSourceTypeConstants.js +51 -19
  27. package/lib/ModuleTypeConstants.js +12 -3
  28. package/lib/MultiCompiler.js +2 -2
  29. package/lib/NodeStuffPlugin.js +1 -1
  30. package/lib/NormalModule.js +119 -77
  31. package/lib/NormalModuleFactory.js +47 -27
  32. package/lib/Parser.js +1 -1
  33. package/lib/ProgressPlugin.js +129 -56
  34. package/lib/RuntimeGlobals.js +5 -5
  35. package/lib/RuntimeModule.js +9 -7
  36. package/lib/RuntimePlugin.js +12 -1
  37. package/lib/SourceMapDevToolPlugin.js +250 -49
  38. package/lib/Template.js +1 -1
  39. package/lib/TemplatedPathPlugin.js +22 -4
  40. package/lib/WarnCaseSensitiveModulesPlugin.js +70 -2
  41. package/lib/WarnDeprecatedOptionPlugin.js +1 -1
  42. package/lib/WarnNoModeSetPlugin.js +16 -1
  43. package/lib/Watching.js +2 -3
  44. package/lib/WebpackError.js +3 -77
  45. package/lib/WebpackIsIncludedPlugin.js +1 -1
  46. package/lib/WebpackOptionsApply.js +13 -1
  47. package/lib/asset/AssetBytesGenerator.js +12 -8
  48. package/lib/asset/AssetGenerator.js +36 -22
  49. package/lib/asset/AssetModulesPlugin.js +6 -8
  50. package/lib/asset/AssetSourceGenerator.js +12 -8
  51. package/lib/buildChunkGraph.js +4 -6
  52. package/lib/cache/PackFileCacheStrategy.js +4 -4
  53. package/lib/cli.js +3 -1
  54. package/lib/config/defaults.js +197 -10
  55. package/lib/config/normalization.js +3 -1
  56. package/lib/css/CssGenerator.js +320 -105
  57. package/lib/css/CssInjectStyleRuntimeModule.js +44 -42
  58. package/lib/css/CssLoadingRuntimeModule.js +22 -4
  59. package/lib/{CssModule.js → css/CssModule.js} +15 -15
  60. package/lib/css/CssModulesPlugin.js +168 -88
  61. package/lib/css/CssParser.js +566 -269
  62. package/lib/css/walkCssTokens.js +148 -2
  63. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +1 -1
  64. package/lib/dependencies/CommonJsDependencyHelpers.js +63 -0
  65. package/lib/dependencies/CommonJsExportRequireDependency.js +54 -10
  66. package/lib/dependencies/CommonJsExportsParserPlugin.js +1 -1
  67. package/lib/dependencies/CommonJsFullRequireDependency.js +32 -9
  68. package/lib/dependencies/CommonJsImportsParserPlugin.js +112 -4
  69. package/lib/dependencies/CommonJsRequireDependency.js +67 -4
  70. package/lib/dependencies/ContextDependency.js +1 -1
  71. package/lib/dependencies/ContextDependencyHelpers.js +1 -1
  72. package/lib/dependencies/CreateRequireParserPlugin.js +1 -1
  73. package/lib/dependencies/CriticalDependencyWarning.js +1 -1
  74. package/lib/dependencies/CssIcssExportDependency.js +332 -67
  75. package/lib/dependencies/CssIcssImportDependency.js +49 -7
  76. package/lib/dependencies/CssIcssSymbolDependency.js +11 -3
  77. package/lib/dependencies/CssImportDependency.js +8 -0
  78. package/lib/dependencies/CssUrlDependency.js +28 -2
  79. package/lib/dependencies/HarmonyDetectionParserPlugin.js +22 -2
  80. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +8 -7
  81. package/lib/dependencies/HarmonyExportExpressionDependency.js +22 -14
  82. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +110 -3
  83. package/lib/dependencies/HarmonyImportDependency.js +10 -2
  84. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +22 -1
  85. package/lib/dependencies/HarmonyImportSpecifierDependency.js +1 -1
  86. package/lib/{HarmonyLinkingError.js → dependencies/HarmonyLinkingError.js} +5 -3
  87. package/lib/dependencies/HtmlInlineScriptDependency.js +133 -0
  88. package/lib/dependencies/HtmlInlineStyleDependency.js +101 -0
  89. package/lib/dependencies/HtmlScriptSrcDependency.js +557 -0
  90. package/lib/dependencies/HtmlSourceDependency.js +128 -0
  91. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
  92. package/lib/dependencies/ImportParserPlugin.js +2 -2
  93. package/lib/dependencies/ImportPhase.js +1 -1
  94. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +1 -1
  95. package/lib/{RequireJsStuffPlugin.js → dependencies/RequireJsStuffPlugin.js} +7 -7
  96. package/lib/dependencies/SystemPlugin.js +1 -1
  97. package/lib/dependencies/WebAssemblyImportDependency.js +1 -1
  98. package/lib/dependencies/WorkerPlugin.js +2 -2
  99. package/lib/{DelegatedModule.js → dll/DelegatedModule.js} +31 -31
  100. package/lib/{DelegatedModuleFactoryPlugin.js → dll/DelegatedModuleFactoryPlugin.js} +4 -4
  101. package/lib/{DelegatedPlugin.js → dll/DelegatedPlugin.js} +2 -2
  102. package/lib/{DllEntryPlugin.js → dll/DllEntryPlugin.js} +4 -4
  103. package/lib/{DllModule.js → dll/DllModule.js} +24 -24
  104. package/lib/{DllModuleFactory.js → dll/DllModuleFactory.js} +4 -4
  105. package/lib/{DllPlugin.js → dll/DllPlugin.js} +6 -5
  106. package/lib/{DllReferencePlugin.js → dll/DllReferencePlugin.js} +14 -14
  107. package/lib/{LibManifestPlugin.js → dll/LibManifestPlugin.js} +9 -9
  108. package/lib/{AsyncDependencyToInitialChunkError.js → errors/AsyncDependencyToInitialChunkError.js} +2 -2
  109. package/lib/errors/BuildCycleError.js +1 -1
  110. package/lib/{ChunkRenderError.js → errors/ChunkRenderError.js} +1 -1
  111. package/lib/{CodeGenerationError.js → errors/CodeGenerationError.js} +1 -1
  112. package/lib/{CommentCompilationWarning.js → errors/CommentCompilationWarning.js} +3 -3
  113. package/lib/{ConcurrentCompilationError.js → errors/ConcurrentCompilationError.js} +4 -2
  114. package/lib/{EnvironmentNotSupportAsyncWarning.js → errors/EnvironmentNotSupportAsyncWarning.js} +4 -4
  115. package/lib/{HookWebpackError.js → errors/HookWebpackError.js} +5 -5
  116. package/lib/{IgnoreErrorModuleFactory.js → errors/IgnoreErrorModuleFactory.js} +4 -4
  117. package/lib/{InvalidDependenciesModuleWarning.js → errors/InvalidDependenciesModuleWarning.js} +3 -3
  118. package/lib/errors/JSONParseError.js +114 -0
  119. package/lib/{ModuleBuildError.js → errors/ModuleBuildError.js} +5 -5
  120. package/lib/{ModuleDependencyError.js → errors/ModuleDependencyError.js} +2 -2
  121. package/lib/{ModuleDependencyWarning.js → errors/ModuleDependencyWarning.js} +4 -4
  122. package/lib/{ModuleError.js → errors/ModuleError.js} +5 -5
  123. package/lib/{ModuleHashingError.js → errors/ModuleHashingError.js} +1 -1
  124. package/lib/errors/ModuleNotFoundError.js +91 -0
  125. package/lib/{ModuleParseError.js → errors/ModuleParseError.js} +8 -6
  126. package/lib/{ModuleRestoreError.js → errors/ModuleRestoreError.js} +1 -1
  127. package/lib/{ModuleStoreError.js → errors/ModuleStoreError.js} +1 -1
  128. package/lib/{ModuleWarning.js → errors/ModuleWarning.js} +5 -5
  129. package/lib/{NodeStuffInWebError.js → errors/NodeStuffInWebError.js} +4 -4
  130. package/lib/errors/NonErrorEmittedError.js +28 -0
  131. package/lib/{UnhandledSchemeError.js → errors/UnhandledSchemeError.js} +2 -2
  132. package/lib/{UnsupportedFeatureWarning.js → errors/UnsupportedFeatureWarning.js} +3 -3
  133. package/lib/errors/WebpackError.js +84 -0
  134. package/lib/html/HtmlGenerator.js +379 -0
  135. package/lib/html/HtmlModulesPlugin.js +429 -0
  136. package/lib/html/HtmlParser.js +1489 -0
  137. package/lib/html/walkHtmlTokens.js +3249 -0
  138. package/lib/ids/IdHelpers.js +2 -1
  139. package/lib/index.js +36 -15
  140. package/lib/javascript/JavascriptModulesPlugin.js +91 -10
  141. package/lib/javascript/JavascriptParser.js +197 -16
  142. package/lib/javascript/JavascriptParserHelpers.js +1 -1
  143. package/lib/json/JsonParser.js +7 -16
  144. package/lib/library/AbstractLibraryPlugin.js +1 -1
  145. package/lib/library/EnableLibraryPlugin.js +1 -1
  146. package/lib/{FalseIIFEUmdWarning.js → library/FalseIIFEUmdWarning.js} +1 -1
  147. package/lib/library/ModuleLibraryPlugin.js +74 -0
  148. package/lib/node/NodeEnvironmentPlugin.js +4 -2
  149. package/lib/node/nodeConsole.js +113 -64
  150. package/lib/optimize/ConcatenatedModule.js +51 -6
  151. package/lib/optimize/InnerGraph.js +1 -1
  152. package/lib/optimize/InnerGraphPlugin.js +11 -1
  153. package/lib/optimize/MinMaxSizeWarning.js +4 -4
  154. package/lib/optimize/ModuleConcatenationPlugin.js +15 -7
  155. package/lib/optimize/RealContentHashPlugin.js +89 -26
  156. package/lib/optimize/SideEffectsFlagPlugin.js +112 -5
  157. package/lib/optimize/SplitChunksPlugin.js +5 -5
  158. package/lib/performance/AssetsOverSizeLimitWarning.js +2 -2
  159. package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
  160. package/lib/performance/NoAsyncChunksWarning.js +5 -3
  161. package/lib/performance/SizeLimitsPlugin.js +1 -1
  162. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +4 -1
  163. package/lib/rules/UseEffectRulePlugin.js +4 -3
  164. package/lib/runtime/AutoPublicPathRuntimeModule.js +3 -3
  165. package/lib/runtime/GetChunkFilenameRuntimeModule.js +5 -5
  166. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +119 -13
  167. package/lib/runtime/SetAnonymousDefaultNameRuntimeModule.js +35 -0
  168. package/lib/schemes/DataUriPlugin.js +13 -1
  169. package/lib/schemes/VirtualUrlPlugin.js +1 -1
  170. package/lib/serialization/SerializerMiddleware.js +2 -2
  171. package/lib/sharing/ConsumeSharedPlugin.js +4 -10
  172. package/lib/sharing/ConsumeSharedRuntimeModule.js +8 -4
  173. package/lib/sharing/ProvideSharedModule.js +1 -1
  174. package/lib/sharing/ProvideSharedPlugin.js +5 -5
  175. package/lib/sharing/resolveMatchedConfigs.js +1 -1
  176. package/lib/stats/DefaultStatsFactoryPlugin.js +2 -2
  177. package/lib/stats/DefaultStatsPresetPlugin.js +1 -1
  178. package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
  179. package/lib/stats/StatsFactory.js +1 -1
  180. package/lib/typescript/TypeScriptPlugin.js +210 -0
  181. package/lib/url/URLParserPlugin.js +2 -2
  182. package/lib/util/AsyncQueue.js +2 -2
  183. package/lib/util/Hash.js +2 -2
  184. package/lib/util/LocConverter.js +53 -0
  185. package/lib/util/SortableSet.js +1 -1
  186. package/lib/util/cleverMerge.js +2 -2
  187. package/lib/util/comparators.js +3 -3
  188. package/lib/util/concatenate.js +3 -3
  189. package/lib/util/conventions.js +42 -1
  190. package/lib/util/createMappings.js +118 -0
  191. package/lib/{formatLocation.js → util/formatLocation.js} +2 -2
  192. package/lib/{SizeFormatHelpers.js → util/formatSize.js} +3 -1
  193. package/lib/util/fs.js +8 -8
  194. package/lib/util/hash/md4.js +1 -1
  195. package/lib/util/hash/xxhash64.js +1 -1
  196. package/lib/util/identifier.js +48 -0
  197. package/lib/util/internalSerializables.js +35 -19
  198. package/lib/util/magicComment.js +10 -7
  199. package/lib/util/parseJson.js +2 -73
  200. package/lib/util/source.js +21 -0
  201. package/lib/util/topologicalSort.js +69 -0
  202. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -4
  203. package/lib/wasm-async/AsyncWebAssemblyParser.js +1 -1
  204. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +5 -3
  205. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +1 -1
  206. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +5 -3
  207. package/lib/webpack.js +3 -1
  208. package/package.json +24 -22
  209. package/schemas/WebpackOptions.check.js +1 -1
  210. package/schemas/WebpackOptions.json +129 -12
  211. package/schemas/plugins/{DllPlugin.check.d.ts → HtmlGeneratorOptions.check.d.ts} +1 -1
  212. package/schemas/plugins/HtmlGeneratorOptions.check.js +6 -0
  213. package/schemas/plugins/HtmlGeneratorOptions.json +3 -0
  214. package/schemas/plugins/ProgressPlugin.check.js +1 -1
  215. package/schemas/plugins/ProgressPlugin.json +22 -0
  216. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  217. package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
  218. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  219. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  220. package/schemas/plugins/container/ModuleFederationPlugin.json +1 -0
  221. package/schemas/plugins/{DllReferencePlugin.check.d.ts → css/CssAutoOrModuleParserOptions.check.d.ts} +1 -1
  222. package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +6 -0
  223. package/schemas/plugins/css/CssAutoOrModuleParserOptions.json +3 -0
  224. package/schemas/plugins/dll/DllPlugin.check.d.ts +7 -0
  225. package/schemas/plugins/dll/DllReferencePlugin.check.d.ts +7 -0
  226. package/types.d.ts +1153 -233
  227. package/lib/CaseSensitiveModulesWarning.js +0 -80
  228. package/lib/GraphHelpers.js +0 -49
  229. package/lib/NoModeWarning.js +0 -23
  230. package/lib/css/CssMergeStyleSheetsRuntimeModule.js +0 -57
  231. /package/lib/{AbstractMethodError.js → errors/AbstractMethodError.js} +0 -0
  232. /package/schemas/plugins/{DllPlugin.check.js → dll/DllPlugin.check.js} +0 -0
  233. /package/schemas/plugins/{DllPlugin.json → dll/DllPlugin.json} +0 -0
  234. /package/schemas/plugins/{DllReferencePlugin.check.js → dll/DllReferencePlugin.check.js} +0 -0
  235. /package/schemas/plugins/{DllReferencePlugin.json → dll/DllReferencePlugin.json} +0 -0
@@ -0,0 +1,210 @@
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 mod = require("module");
9
+ const {
10
+ JAVASCRIPT_MODULE_TYPE_AUTO,
11
+ JAVASCRIPT_MODULE_TYPE_DYNAMIC,
12
+ JAVASCRIPT_MODULE_TYPE_ESM
13
+ } = require("../ModuleTypeConstants");
14
+ const NormalModule = require("../NormalModule");
15
+ const ModuleBuildError = require("../errors/ModuleBuildError");
16
+ const memoize = require("../util/memoize");
17
+ const removeBOM = require("../util/removeBOM");
18
+
19
+ /** @typedef {import("webpack-sources").RawSourceMap} RawSourceMap */
20
+ /** @typedef {import("../Compiler")} Compiler */
21
+ /** @typedef {import("../NormalModule")} NormalModuleType */
22
+ /** @typedef {import("../NormalModule").Result} Result */
23
+ /** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
24
+
25
+ const getSourceMapSource = memoize(
26
+ () => require("webpack-sources").SourceMapSource
27
+ );
28
+
29
+ const PLUGIN_NAME = "TypeScriptPlugin";
30
+
31
+ /** @type {Set<string>} */
32
+ const JS_MODULE_TYPES = new Set([
33
+ JAVASCRIPT_MODULE_TYPE_AUTO,
34
+ JAVASCRIPT_MODULE_TYPE_DYNAMIC,
35
+ JAVASCRIPT_MODULE_TYPE_ESM
36
+ ]);
37
+
38
+ const TS_RESOURCE_RE = /\.(?:[mc]?tsx?)$/i;
39
+ const TSX_RESOURCE_RE = /\.[mc]?tsx$/i;
40
+ const TS_DATA_URI_RE = /^data:(?:text|application)\/typescript/i;
41
+
42
+ const TSX_NOT_SUPPORTED =
43
+ "experiments.typescript does not support .tsx/JSX. " +
44
+ "Use a TSX-capable loader (e.g. swc-loader, esbuild-loader, ts-loader) for .tsx files.";
45
+
46
+ const NODE_API_MISSING =
47
+ "experiments.typescript requires Node.js >= 22.6. " +
48
+ "`module.stripTypeScriptTypes` is not available on this Node.js version.";
49
+
50
+ /**
51
+ * Whether the resource (path or `data:` URI) should go through the TypeScript
52
+ * transform. Returns true for `.ts`, `.cts`, `.mts`, and the JSX-flavoured
53
+ * variants (so the `.tsx` branch can throw a friendly error), as well as the
54
+ * `text/typescript` / `application/typescript` data URIs.
55
+ * @param {string} resource module resource (without query string)
56
+ * @returns {boolean} true if the resource should be transformed
57
+ */
58
+ const isTypeScriptResource = (resource) =>
59
+ TS_RESOURCE_RE.test(resource) || TS_DATA_URI_RE.test(resource);
60
+
61
+ /**
62
+ * Build a line-granularity identity source map for a strip-types output.
63
+ * `mode: "strip"` replaces type annotations with whitespace, so the stripped
64
+ * output preserves the original line layout — an identity mapping is correct.
65
+ * Node's API does not emit a source map in strip mode (`sourceMap: true` is
66
+ * rejected on Node 22+ and Node 26+), so we construct one by hand.
67
+ * @param {string} resource module resource path
68
+ * @param {string} originalSource pre-strip source content
69
+ * @returns {RawSourceMap} identity source map
70
+ */
71
+ const createIdentitySourceMap = (resource, originalSource) => {
72
+ const lineCount = (originalSource.match(/\n/g) || []).length + 1;
73
+ // Mappings: each line emits a single segment at column 0 mapping to
74
+ // column 0 of the same line in the source. `AAAA` for line 1, `;AACA`
75
+ // for each subsequent line (cumulative source-line delta of +1 per line).
76
+ const mappings = `AAAA${";AACA".repeat(lineCount - 1)}`;
77
+
78
+ return {
79
+ version: 3,
80
+ file: resource,
81
+ sources: [resource],
82
+ sourcesContent: [originalSource],
83
+ names: [],
84
+ mappings
85
+ };
86
+ };
87
+
88
+ /**
89
+ * Compose the strip-types source map with an upstream loader source map so the
90
+ * final map points back to the loader's original input (e.g. a `.vue` /
91
+ * `.svelte` / custom loader that emits TS code).
92
+ * @param {string} resource module resource
93
+ * @param {string} strippedSource post-strip JS
94
+ * @param {RawSourceMap} stripMap identity map for the strip step
95
+ * @param {string} preStripSource pre-strip TS (loader output)
96
+ * @param {string | RawSourceMap} loaderSourceMap upstream loader source map
97
+ * @returns {RawSourceMap} composed map
98
+ */
99
+ const composeWithLoaderSourceMap = (
100
+ resource,
101
+ strippedSource,
102
+ stripMap,
103
+ preStripSource,
104
+ loaderSourceMap
105
+ ) => {
106
+ const SourceMapSource = getSourceMapSource();
107
+ const composed = new SourceMapSource(
108
+ strippedSource,
109
+ resource,
110
+ stripMap,
111
+ preStripSource,
112
+ loaderSourceMap,
113
+ true
114
+ );
115
+ return /** @type {RawSourceMap} */ (composed.sourceAndMap().map) || stripMap;
116
+ };
117
+
118
+ /**
119
+ * Run `module.stripTypeScriptTypes` on the input, wrapping any thrown
120
+ * `TypeScript ...` errors as `ModuleBuildError` so they surface as
121
+ * per-module build errors instead of uncaught exceptions.
122
+ * @param {string} input pre-strip TS source (BOM-free string)
123
+ * @returns {string} stripped JS
124
+ */
125
+ const stripTypes = (input) => {
126
+ try {
127
+ // Pass only `mode`. `sourceUrl` would emit a `//# sourceURL=…` pragma
128
+ // into the output (V8 debugger hint), and `sourceMap: true` is
129
+ // rejected in strip mode — we build the source map by hand instead.
130
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
131
+ return mod.stripTypeScriptTypes(input, { mode: "strip" });
132
+ } catch (err) {
133
+ throw new ModuleBuildError(/** @type {Error} */ (err));
134
+ }
135
+ };
136
+
137
+ /**
138
+ * Coerce a Buffer-or-string source to a UTF-8 string, dropping any BOM.
139
+ * @param {string | Buffer} source raw source from the loader pipeline
140
+ * @returns {string} UTF-8 string without BOM
141
+ */
142
+ const toBomFreeString = (source) => {
143
+ const text = Buffer.isBuffer(source) ? source.toString("utf8") : source;
144
+ const stripped = removeBOM(text);
145
+ return typeof stripped === "string" ? stripped : stripped.toString("utf8");
146
+ };
147
+
148
+ class TypeScriptPlugin {
149
+ /**
150
+ * @param {Compiler} compiler webpack compiler
151
+ * @returns {void}
152
+ */
153
+ apply(compiler) {
154
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
155
+ NormalModule.getCompilationHooks(compilation).processResult.tap(
156
+ PLUGIN_NAME,
157
+ (result, module) => this._processResult(result, module)
158
+ );
159
+ });
160
+ }
161
+
162
+ /**
163
+ * processResult tap body. Returns the input untouched unless this is a
164
+ * TypeScript module that needs to be transformed.
165
+ * @param {Result} result loader result tuple
166
+ * @param {NormalModuleType} module the normal module
167
+ * @returns {Result} possibly transformed result
168
+ */
169
+ _processResult(result, module) {
170
+ if (!JS_MODULE_TYPES.has(module.type)) return result;
171
+
172
+ const parser = /** @type {JavascriptParser} */ (module.parser);
173
+ if (!parser.options.typescript) return result;
174
+
175
+ const resource = module.nameForCondition();
176
+ if (!resource || !isTypeScriptResource(resource)) return result;
177
+
178
+ if (TSX_RESOURCE_RE.test(resource)) {
179
+ throw new ModuleBuildError(new Error(TSX_NOT_SUPPORTED));
180
+ }
181
+
182
+ if (!("stripTypeScriptTypes" in mod)) {
183
+ throw new ModuleBuildError(new Error(NODE_API_MISSING));
184
+ }
185
+
186
+ const [rawSource, loaderSourceMap, ...rest] = result;
187
+ const preStripSource = toBomFreeString(rawSource);
188
+ const strippedSource = stripTypes(preStripSource);
189
+
190
+ const needSourceMap = module.useSourceMap || module.useSimpleSourceMap;
191
+ const stripMap = needSourceMap
192
+ ? createIdentitySourceMap(module.resource, preStripSource)
193
+ : undefined;
194
+
195
+ const outputSourceMap =
196
+ stripMap && loaderSourceMap
197
+ ? composeWithLoaderSourceMap(
198
+ module.resource,
199
+ strippedSource,
200
+ stripMap,
201
+ preStripSource,
202
+ loaderSourceMap
203
+ )
204
+ : stripMap || loaderSourceMap;
205
+
206
+ return [strippedSource, outputSourceMap, ...rest];
207
+ }
208
+ }
209
+
210
+ module.exports = TypeScriptPlugin;
@@ -6,13 +6,13 @@
6
6
  "use strict";
7
7
 
8
8
  const { pathToFileURL } = require("url");
9
- const CommentCompilationWarning = require("../CommentCompilationWarning");
10
9
  const RuntimeGlobals = require("../RuntimeGlobals");
11
- const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
12
10
  const ConstDependency = require("../dependencies/ConstDependency");
13
11
  const ContextDependencyHelpers = require("../dependencies/ContextDependencyHelpers");
14
12
  const URLContextDependency = require("../dependencies/URLContextDependency");
15
13
  const URLDependency = require("../dependencies/URLDependency");
14
+ const CommentCompilationWarning = require("../errors/CommentCompilationWarning");
15
+ const UnsupportedFeatureWarning = require("../errors/UnsupportedFeatureWarning");
16
16
  const BasicEvaluatedExpression = require("../javascript/BasicEvaluatedExpression");
17
17
  const { approve } = require("../javascript/JavascriptParserHelpers");
18
18
  const InnerGraph = require("../optimize/InnerGraph");
@@ -6,8 +6,8 @@
6
6
  "use strict";
7
7
 
8
8
  const { AsyncSeriesHook, SyncHook } = require("tapable");
9
- const { makeWebpackError } = require("../HookWebpackError");
10
- const WebpackError = require("../WebpackError");
9
+ const { makeWebpackError } = require("../errors/HookWebpackError");
10
+ const WebpackError = require("../errors/WebpackError");
11
11
  const ArrayQueue = require("./ArrayQueue");
12
12
 
13
13
  const QUEUED_STATE = 0;
package/lib/util/Hash.js CHANGED
@@ -33,7 +33,7 @@ class Hash {
33
33
  * @returns {Hash} updated hash
34
34
  */
35
35
  update(data, inputEncoding) {
36
- const AbstractMethodError = require("../AbstractMethodError");
36
+ const AbstractMethodError = require("../errors/AbstractMethodError");
37
37
 
38
38
  throw new AbstractMethodError();
39
39
  }
@@ -59,7 +59,7 @@ class Hash {
59
59
  * @returns {string | Buffer} digest
60
60
  */
61
61
  digest(encoding) {
62
- const AbstractMethodError = require("../AbstractMethodError");
62
+ const AbstractMethodError = require("../errors/AbstractMethodError");
63
63
 
64
64
  throw new AbstractMethodError();
65
65
  }
@@ -0,0 +1,53 @@
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
+ class LocConverter {
9
+ /**
10
+ * Creates an instance of LocConverter.
11
+ * @param {string} input input
12
+ */
13
+ constructor(input) {
14
+ this._input = input;
15
+ this.line = 1;
16
+ this.column = 0;
17
+ this.pos = 0;
18
+ }
19
+
20
+ /**
21
+ * Returns location converter.
22
+ * @param {number} pos position
23
+ * @returns {LocConverter} location converter
24
+ */
25
+ get(pos) {
26
+ if (this.pos !== pos) {
27
+ if (this.pos < pos) {
28
+ const str = this._input.slice(this.pos, pos);
29
+ let i = str.lastIndexOf("\n");
30
+ if (i === -1) {
31
+ this.column += str.length;
32
+ } else {
33
+ this.column = str.length - i - 1;
34
+ this.line++;
35
+ while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1) {
36
+ this.line++;
37
+ }
38
+ }
39
+ } else {
40
+ let i = this._input.lastIndexOf("\n", this.pos);
41
+ while (i >= pos) {
42
+ this.line--;
43
+ i = i > 0 ? this._input.lastIndexOf("\n", i - 1) : -1;
44
+ }
45
+ this.column = i === -1 ? pos : pos - i - 1;
46
+ }
47
+ this.pos = pos;
48
+ }
49
+ return this;
50
+ }
51
+ }
52
+
53
+ module.exports = LocConverter;
@@ -108,7 +108,7 @@ class SortableSet extends Set {
108
108
 
109
109
  /**
110
110
  * Get data from cache
111
- * @template {EXPECTED_ANY} R
111
+ * @template R
112
112
  * @param {(set: SortableSet<T>) => R} fn function to calculate value
113
113
  * @returns {R} returns result of fn(this), cached until set changes
114
114
  */
@@ -132,10 +132,10 @@ const parseCache = new WeakMap();
132
132
  * @returns {ParsedObject<T>} parsed object
133
133
  */
134
134
  const cachedParseObject = (obj) => {
135
- const entry = parseCache.get(/** @type {EXPECTED_OBJECT} */ (obj));
135
+ const entry = parseCache.get(obj);
136
136
  if (entry !== undefined) return entry;
137
137
  const result = parseObject(obj);
138
- parseCache.set(/** @type {EXPECTED_OBJECT} */ (obj), result);
138
+ parseCache.set(obj, result);
139
139
  return result;
140
140
  };
141
141
 
@@ -56,10 +56,10 @@ const { compareRuntime } = require("./runtime");
56
56
  * @returns {ParameterizedComparator<TArg, T>} comparator
57
57
  */
58
58
  const createCachedParameterizedComparator = (fn) => {
59
- /** @type {WeakMap<EXPECTED_OBJECT, Comparator<T>>} */
59
+ /** @type {WeakMap<TArg, Comparator<T>>} */
60
60
  const map = new WeakMap();
61
61
  return (arg) => {
62
- const cachedResult = map.get(/** @type {EXPECTED_OBJECT} */ (arg));
62
+ const cachedResult = map.get(arg);
63
63
  if (cachedResult !== undefined) return cachedResult;
64
64
  /**
65
65
  * Returns compare result.
@@ -68,7 +68,7 @@ const createCachedParameterizedComparator = (fn) => {
68
68
  * @returns {-1 | 0 | 1} compare result
69
69
  */
70
70
  const result = fn.bind(null, arg);
71
- map.set(/** @type {EXPECTED_OBJECT} */ (arg), result);
71
+ map.set(arg, result);
72
72
  return result;
73
73
  };
74
74
  };
@@ -7,10 +7,10 @@
7
7
 
8
8
  const Template = require("../Template");
9
9
 
10
- /** @typedef {import("eslint-scope").Scope} Scope */
11
- /** @typedef {import("eslint-scope").Reference} Reference */
12
- /** @typedef {import("eslint-scope").Variable} Variable */
13
10
  /** @typedef {import("estree").Node} Node */
11
+ /** @typedef {import("../javascript/JavascriptModulesPlugin").Scope} Scope */
12
+ /** @typedef {import("../javascript/JavascriptModulesPlugin").Reference} Reference */
13
+ /** @typedef {import("../javascript/JavascriptModulesPlugin").Variable} Variable */
14
14
  /** @typedef {import("../javascript/JavascriptParser").Range} Range */
15
15
  /** @typedef {Set<string>} UsedNames */
16
16
 
@@ -80,6 +80,26 @@ module.exports.camelCase = (input) => {
80
80
  .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, (m) => m.toUpperCase());
81
81
  };
82
82
 
83
+ /**
84
+ * Safely stringify an arbitrary value for an error message — falls back to
85
+ * `String(...)` when JSON.stringify would throw (BigInt, circular, etc.).
86
+ * @param {EXPECTED_ANY} value value to stringify
87
+ * @returns {string} stringified value
88
+ */
89
+ const safeStringify = (value) => {
90
+ try {
91
+ const json = JSON.stringify(value);
92
+ if (json !== undefined) return json;
93
+ } catch (_err) {
94
+ // fall through to String fallback
95
+ }
96
+ try {
97
+ return String(value);
98
+ } catch (_err) {
99
+ return "[value cannot be converted to string]";
100
+ }
101
+ };
102
+
83
103
  /**
84
104
  * Returns results.
85
105
  * @param {string} input input
@@ -90,7 +110,28 @@ module.exports.cssExportConvention = (input, convention) => {
90
110
  /** @type {Set<string>} */
91
111
  const set = new Set();
92
112
  if (typeof convention === "function") {
93
- set.add(convention(input));
113
+ const result = convention(input);
114
+ const validate = (/** @type {string} */ name) => {
115
+ if (typeof name !== "string" || name.length === 0) {
116
+ throw new Error(
117
+ `exportsConvention function must return a non-empty string or an array of non-empty strings, got ${safeStringify(result)}`
118
+ );
119
+ }
120
+ };
121
+ if (Array.isArray(result)) {
122
+ if (result.length === 0) {
123
+ throw new Error(
124
+ "exportsConvention function returned an empty array; it must return at least one name"
125
+ );
126
+ }
127
+ for (const name of result) {
128
+ validate(name);
129
+ set.add(name);
130
+ }
131
+ } else {
132
+ validate(result);
133
+ set.add(result);
134
+ }
94
135
  } else {
95
136
  switch (convention) {
96
137
  case "camel-case": {
@@ -0,0 +1,118 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ */
4
+
5
+ "use strict";
6
+
7
+ /**
8
+ * Utilities for building V3 source-map `mappings` strings without pulling in a
9
+ * full source-map library. The shape of the input is intentionally minimal —
10
+ * one slot per generated line, each holding zero, one, or many segments — so
11
+ * call sites that have a "one mapping per line" structure (like the CSS-module
12
+ * exports emit in `lib/css/CssGenerator.js`) can build mappings directly,
13
+ * while richer call sites can pass arrays of segments.
14
+ *
15
+ * TODO move this encoder into `webpack-sources` and replace the body of this
16
+ * file with re-exports. The public shape (`encodeVLQ`, `encodeMappings(lines)`,
17
+ * `MappingSegment`, `LineMappings`) is intended to match what would land
18
+ * upstream so call sites don't have to change.
19
+ */
20
+
21
+ const VLQ_BASE64 =
22
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
23
+
24
+ /**
25
+ * Encode a signed integer as a base64 VLQ string per the source-map V3 spec.
26
+ * @param {number} value signed integer to encode
27
+ * @returns {string} base64 VLQ encoded value
28
+ */
29
+ const encodeVLQ = (value) => {
30
+ let vlq = value < 0 ? (-value << 1) | 1 : value << 1;
31
+ let result = "";
32
+ do {
33
+ let digit = vlq & 0x1f;
34
+ vlq >>>= 5;
35
+ if (vlq > 0) digit |= 0x20;
36
+ result += VLQ_BASE64[digit];
37
+ } while (vlq > 0);
38
+ return result;
39
+ };
40
+
41
+ /**
42
+ * @typedef {object} MappingSegment
43
+ * @property {number=} generatedColumn 0-based generated column (defaults to 0)
44
+ * @property {number=} sourceIndex index into the surrounding source map's `sources` array; omit for a generated-only segment
45
+ * @property {number=} originalLine 0-based line in the original source (required when `sourceIndex` is set)
46
+ * @property {number=} originalColumn 0-based column in the original source (required when `sourceIndex` is set)
47
+ * @property {number=} nameIndex index into the surrounding source map's `names` array
48
+ */
49
+
50
+ /** @typedef {null | MappingSegment | MappingSegment[]} LineMappings */
51
+
52
+ /**
53
+ * Encode a V3 source-map `mappings` string from a per-generated-line
54
+ * description of segments.
55
+ *
56
+ * Each entry of `lines` describes the mappings for one generated line:
57
+ *
58
+ * - `null` (or `undefined`) — the line has no mappings.
59
+ * - a single `MappingSegment` — convenience for the common "one mapping at
60
+ * column 0" case.
61
+ * - `MappingSegment[]` — multiple segments on the same line.
62
+ *
63
+ * Lines are joined with `;`, segments within a line with `,`. All numeric
64
+ * fields are encoded as deltas relative to the previous emitted segment, per
65
+ * the V3 spec.
66
+ * @param {LineMappings[]} lines per-generated-line mapping segments
67
+ * @returns {string} VLQ-encoded V3 mappings string
68
+ */
69
+ const encodeMappings = (lines) => {
70
+ let prevSourceIndex = 0;
71
+ let prevOriginalLine = 0;
72
+ let prevOriginalColumn = 0;
73
+ let prevNameIndex = 0;
74
+
75
+ const encodedLines = [];
76
+
77
+ for (const line of lines) {
78
+ if (line === null || line === undefined) {
79
+ encodedLines.push("");
80
+ continue;
81
+ }
82
+
83
+ const segments = Array.isArray(line) ? line : [line];
84
+ let prevGeneratedColumn = 0;
85
+ const encodedSegments = [];
86
+
87
+ for (const segment of segments) {
88
+ const generatedColumn = segment.generatedColumn || 0;
89
+ let encoded = encodeVLQ(generatedColumn - prevGeneratedColumn);
90
+ prevGeneratedColumn = generatedColumn;
91
+
92
+ if (segment.sourceIndex !== undefined) {
93
+ const originalLine = /** @type {number} */ (segment.originalLine);
94
+ const originalColumn = /** @type {number} */ (segment.originalColumn);
95
+ encoded += encodeVLQ(segment.sourceIndex - prevSourceIndex);
96
+ encoded += encodeVLQ(originalLine - prevOriginalLine);
97
+ encoded += encodeVLQ(originalColumn - prevOriginalColumn);
98
+ prevSourceIndex = segment.sourceIndex;
99
+ prevOriginalLine = originalLine;
100
+ prevOriginalColumn = originalColumn;
101
+
102
+ if (segment.nameIndex !== undefined) {
103
+ encoded += encodeVLQ(segment.nameIndex - prevNameIndex);
104
+ prevNameIndex = segment.nameIndex;
105
+ }
106
+ }
107
+
108
+ encodedSegments.push(encoded);
109
+ }
110
+
111
+ encodedLines.push(encodedSegments.join(","));
112
+ }
113
+
114
+ return encodedLines.join(";");
115
+ };
116
+
117
+ module.exports.encodeMappings = encodeMappings;
118
+ module.exports.encodeVLQ = encodeVLQ;
@@ -5,8 +5,8 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
9
- /** @typedef {import("./Dependency").SourcePosition} SourcePosition */
8
+ /** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
9
+ /** @typedef {import("../Dependency").SourcePosition} SourcePosition */
10
10
 
11
11
  /**
12
12
  * Returns formatted position.
@@ -10,7 +10,7 @@
10
10
  * @param {number=} size the size in bytes
11
11
  * @returns {string} the formatted size
12
12
  */
13
- module.exports.formatSize = (size) => {
13
+ const formatSize = (size) => {
14
14
  if (typeof size !== "number" || Number.isNaN(size) === true) {
15
15
  return "unknown size";
16
16
  }
@@ -24,3 +24,5 @@ module.exports.formatSize = (size) => {
24
24
 
25
25
  return `${Number((size / 1024 ** index).toPrecision(3))} ${abbreviations[index]}`;
26
26
  };
27
+
28
+ module.exports = formatSize;
package/lib/util/fs.js CHANGED
@@ -244,12 +244,12 @@ const path = require("path");
244
244
  /**
245
245
  * Describes the stat sync shape.
246
246
  * @typedef {{
247
- * (path: PathLike, options?: undefined): IStats,
247
+ * (path: PathLike): IStats,
248
+ * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry?: true | undefined }): IStats,
249
+ * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry?: true | undefined }): IBigIntStats,
248
250
  * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined,
249
251
  * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined,
250
- * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats,
251
- * (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats,
252
- * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats,
252
+ * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: true | undefined }): IStats | IBigIntStats,
253
253
  * (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined,
254
254
  * }} StatSync
255
255
  */
@@ -267,12 +267,12 @@ const path = require("path");
267
267
  /**
268
268
  * Describes the l stat sync shape.
269
269
  * @typedef {{
270
- * (path: PathLike, options?: undefined): IStats,
270
+ * (path: PathLike): IStats,
271
+ * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry?: true | undefined }): IStats,
272
+ * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry?: true | undefined }): IBigIntStats,
271
273
  * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined,
272
274
  * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined,
273
- * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats,
274
- * (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats,
275
- * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats,
275
+ * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: true | undefined }): IStats | IBigIntStats,
276
276
  * (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined,
277
277
  * }} LStatSync
278
278
  */
@@ -11,7 +11,7 @@ const create = require("./wasm-hash");
11
11
  const md4 = new WebAssembly.Module(
12
12
  Buffer.from(
13
13
  // 2150 bytes
14
- "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqFEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvQCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCBCIOIAQgAyABKAIAIg8gBSAEIAIgAyAEc3FzampBA3ciCCACIANzcXNqakEHdyEJIAEoAgwiBiACIAggASgCCCIQIAMgAiAJIAIgCHNxc2pqQQt3IgogCCAJc3FzampBE3chCyABKAIUIgcgCSAKIAEoAhAiESAIIAkgCyAJIApzcXNqakEDdyIMIAogC3Nxc2pqQQd3IQ0gASgCHCIJIAsgDCABKAIYIgggCiALIA0gCyAMc3FzampBC3ciEiAMIA1zcXNqakETdyETIAEoAiQiFCANIBIgASgC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uevFeSQDQfaoyYEBJARBACQAC/sEAgN/AX4jACAAaq1CA4YhBCAAQcgAakFAcSICQQhrIAAiAUEBaiEAIAFBgAE6AAADQCAAIAJJQQAgAEEHcRsEQCAAQQA6AAAgAEEBaiEADAELCwNAIAAgAkkEQCAAQgA3AwAgAEEIaiEADAELCyAENwMAIAIQAEEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=",
15
15
  "base64"
16
16
  )
17
17
  );
@@ -11,7 +11,7 @@ const create = require("./wasm-hash");
11
11
  const xxhash64 = new WebAssembly.Module(
12
12
  Buffer.from(
13
13
  // 1160 bytes
14
- "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+A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