@ohos-ports/rspack-core 1.7.11-beta.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 (284) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +15 -0
  3. package/compiled/@swc/types/index.d.ts +2134 -0
  4. package/compiled/@swc/types/index.js +19 -0
  5. package/compiled/@swc/types/license +201 -0
  6. package/compiled/@swc/types/package.json +1 -0
  7. package/compiled/browserslist-load-config/index.d.ts +21 -0
  8. package/compiled/browserslist-load-config/index.js +252 -0
  9. package/compiled/browserslist-load-config/license +21 -0
  10. package/compiled/browserslist-load-config/package.json +1 -0
  11. package/compiled/tinypool/LICENSE +24 -0
  12. package/compiled/tinypool/README.md +20 -0
  13. package/compiled/tinypool/dist/common-Qw-RoVFD.js +28 -0
  14. package/compiled/tinypool/dist/entry/process.d.ts +1 -0
  15. package/compiled/tinypool/dist/entry/process.js +72 -0
  16. package/compiled/tinypool/dist/entry/utils.d.ts +7 -0
  17. package/compiled/tinypool/dist/entry/utils.js +3 -0
  18. package/compiled/tinypool/dist/entry/worker.d.ts +1 -0
  19. package/compiled/tinypool/dist/entry/worker.js +76 -0
  20. package/compiled/tinypool/dist/index.d.ts +195 -0
  21. package/compiled/tinypool/dist/index.js +820 -0
  22. package/compiled/tinypool/dist/utils-B--2TaWv.js +38 -0
  23. package/compiled/tinypool/dist/utils-De75vAgL.js +10 -0
  24. package/compiled/tinypool/package.json +39 -0
  25. package/compiled/watchpack/index.d.ts +217 -0
  26. package/compiled/watchpack/index.js +3124 -0
  27. package/compiled/watchpack/license +20 -0
  28. package/compiled/watchpack/package.json +1 -0
  29. package/compiled/webpack-sources/index.js +4675 -0
  30. package/compiled/webpack-sources/license +21 -0
  31. package/compiled/webpack-sources/package.json +1 -0
  32. package/compiled/webpack-sources/types.d.ts +458 -0
  33. package/dist/BuildInfo.d.ts +17 -0
  34. package/dist/Chunk.d.ts +16 -0
  35. package/dist/ChunkGraph.d.ts +9 -0
  36. package/dist/Chunks.d.ts +12 -0
  37. package/dist/CodeGenerationResults.d.ts +1 -0
  38. package/dist/Compilation.d.ts +438 -0
  39. package/dist/Compiler.d.ts +226 -0
  40. package/dist/ConcatenatedModule.d.ts +1 -0
  41. package/dist/ContextModule.d.ts +1 -0
  42. package/dist/ContextModuleFactory.d.ts +13 -0
  43. package/dist/Diagnostics.d.ts +7 -0
  44. package/dist/Entrypoint.d.ts +2 -0
  45. package/dist/ErrorHelpers.d.ts +3 -0
  46. package/dist/ExecuteModulePlugin.d.ts +4 -0
  47. package/dist/ExportsInfo.d.ts +20 -0
  48. package/dist/ExternalModule.d.ts +1 -0
  49. package/dist/FileSystem.d.ts +54 -0
  50. package/dist/FileSystemInfo.d.ts +5 -0
  51. package/dist/Module.d.ts +42 -0
  52. package/dist/ModuleGraph.d.ts +19 -0
  53. package/dist/ModuleTypeConstants.d.ts +8 -0
  54. package/dist/MultiCompiler.d.ts +82 -0
  55. package/dist/MultiStats.d.ts +23 -0
  56. package/dist/MultiWatching.d.ts +27 -0
  57. package/dist/NativeWatchFileSystem.d.ts +23 -0
  58. package/dist/NormalModule.d.ts +15 -0
  59. package/dist/NormalModuleFactory.d.ts +23 -0
  60. package/dist/Resolver.d.ts +30 -0
  61. package/dist/ResolverFactory.d.ts +17 -0
  62. package/dist/RspackError.d.ts +12 -0
  63. package/dist/RuleSetCompiler.d.ts +9 -0
  64. package/dist/RuntimeGlobals.d.ts +356 -0
  65. package/dist/RuntimeModule.d.ts +34 -0
  66. package/dist/Stats.d.ts +17 -0
  67. package/dist/Template.d.ts +77 -0
  68. package/dist/VirtualModulesPlugin.d.ts +12 -0
  69. package/dist/Watching.d.ts +56 -0
  70. package/dist/builtin-loader/index.d.ts +1 -0
  71. package/dist/builtin-loader/lightningcss/index.d.ts +117 -0
  72. package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +21 -0
  73. package/dist/builtin-loader/swc/index.d.ts +5 -0
  74. package/dist/builtin-loader/swc/pluginImport.d.ts +33 -0
  75. package/dist/builtin-loader/swc/types.d.ts +89 -0
  76. package/dist/builtin-plugin/APIPlugin.d.ts +9 -0
  77. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +9 -0
  78. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +9 -0
  79. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +9 -0
  80. package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
  81. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +14 -0
  82. package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +9 -0
  83. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +9 -0
  84. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +54 -0
  85. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +9 -0
  86. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +9 -0
  87. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +14 -0
  88. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +21 -0
  89. package/dist/builtin-plugin/CssModulesPlugin.d.ts +9 -0
  90. package/dist/builtin-plugin/DataUriPlugin.d.ts +9 -0
  91. package/dist/builtin-plugin/DefinePlugin.d.ts +16 -0
  92. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +7 -0
  93. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +7 -0
  94. package/dist/builtin-plugin/DllEntryPlugin.d.ts +12 -0
  95. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +11 -0
  96. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +12 -0
  97. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +9 -0
  98. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +25 -0
  99. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
  100. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +9 -0
  101. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +9 -0
  102. package/dist/builtin-plugin/EntryPlugin.d.ts +32 -0
  103. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +11 -0
  104. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +11 -0
  105. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +10 -0
  106. package/dist/builtin-plugin/ExternalsPlugin.d.ts +12 -0
  107. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +9 -0
  108. package/dist/builtin-plugin/FileUriPlugin.d.ts +9 -0
  109. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +9 -0
  110. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +9 -0
  111. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +9 -0
  112. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
  113. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +9 -0
  114. package/dist/builtin-plugin/HttpUriPlugin.d.ts +36 -0
  115. package/dist/builtin-plugin/IgnorePlugin.d.ts +19 -0
  116. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +9 -0
  117. package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
  118. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +15 -0
  119. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +10 -0
  120. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +9 -0
  121. package/dist/builtin-plugin/LibManifestPlugin.d.ts +17 -0
  122. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +32 -0
  123. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +14 -0
  124. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +9 -0
  125. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +9 -0
  126. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +9 -0
  127. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +7 -0
  128. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +9 -0
  129. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +9 -0
  130. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +9 -0
  131. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +7 -0
  132. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +7 -0
  133. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +9 -0
  134. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +9 -0
  135. package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
  136. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +10 -0
  137. package/dist/builtin-plugin/ProgressPlugin.d.ts +11 -0
  138. package/dist/builtin-plugin/ProvidePlugin.d.ts +10 -0
  139. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +9 -0
  140. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +9 -0
  141. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +9 -0
  142. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +49 -0
  143. package/dist/builtin-plugin/RslibPlugin.d.ts +11 -0
  144. package/dist/builtin-plugin/RstestPlugin.d.ts +11 -0
  145. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
  146. package/dist/builtin-plugin/RuntimePlugin.d.ts +29 -0
  147. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +9 -0
  148. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +19 -0
  149. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
  150. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +11 -0
  151. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +39 -0
  152. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +215 -0
  153. package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
  154. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +7 -0
  155. package/dist/builtin-plugin/WorkerPlugin.d.ts +14 -0
  156. package/dist/builtin-plugin/base.d.ts +45 -0
  157. package/dist/builtin-plugin/css-extract/index.d.ts +24 -0
  158. package/dist/builtin-plugin/css-extract/loader.d.ts +21 -0
  159. package/dist/builtin-plugin/css-extract/utils.d.ts +6 -0
  160. package/dist/builtin-plugin/html-plugin/hooks.d.ts +32 -0
  161. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -0
  162. package/dist/builtin-plugin/html-plugin/options.d.ts +82 -0
  163. package/dist/builtin-plugin/html-plugin/plugin.d.ts +24 -0
  164. package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
  165. package/dist/builtin-plugin/index.d.ts +84 -0
  166. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +10 -0
  167. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +12 -0
  168. package/dist/config/adapter.d.ts +8 -0
  169. package/dist/config/adapterRuleUse.d.ts +391 -0
  170. package/dist/config/browserslistTargetHandler.d.ts +15 -0
  171. package/dist/config/defaults.d.ts +13 -0
  172. package/dist/config/devServer.d.ts +314 -0
  173. package/dist/config/index.d.ts +5 -0
  174. package/dist/config/normalization.d.ts +174 -0
  175. package/dist/config/target.d.ts +93 -0
  176. package/dist/config/types.d.ts +2432 -0
  177. package/dist/container/ContainerPlugin.d.ts +41 -0
  178. package/dist/container/ContainerReferencePlugin.d.ts +34 -0
  179. package/dist/container/ModuleFederationManifestPlugin.d.ts +37 -0
  180. package/dist/container/ModuleFederationPlugin.d.ts +17 -0
  181. package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
  182. package/dist/container/ModuleFederationRuntimePlugin.d.ts +16 -0
  183. package/dist/container/index.d.ts +4 -0
  184. package/dist/container/options.d.ts +3 -0
  185. package/dist/cssExtractHmr.js +124 -0
  186. package/dist/cssExtractLoader.js +160 -0
  187. package/dist/error/ConcurrentCompilationError.d.ts +14 -0
  188. package/dist/exports.d.ts +178 -0
  189. package/dist/index.d.ts +10 -0
  190. package/dist/index.js +12638 -0
  191. package/dist/lib/AbstractMethodError.d.ts +23 -0
  192. package/dist/lib/Cache.d.ts +65 -0
  193. package/dist/lib/CacheFacade.d.ts +139 -0
  194. package/dist/lib/DllPlugin.d.ts +42 -0
  195. package/dist/lib/DllReferencePlugin.d.ts +119 -0
  196. package/dist/lib/EntryOptionPlugin.d.ts +33 -0
  197. package/dist/lib/EnvironmentPlugin.d.ts +22 -0
  198. package/dist/lib/HookWebpackError.d.ts +40 -0
  199. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  200. package/dist/lib/LoaderOptionsPlugin.d.ts +28 -0
  201. package/dist/lib/LoaderTargetPlugin.d.ts +24 -0
  202. package/dist/lib/ModuleFilenameHelpers.d.ts +53 -0
  203. package/dist/lib/WebpackError.d.ts +21 -0
  204. package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
  205. package/dist/lib/cache/getLazyHashedEtag.d.ts +35 -0
  206. package/dist/lib/cache/mergeEtags.d.ts +17 -0
  207. package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
  208. package/dist/loader-runner/ModuleError.d.ts +13 -0
  209. package/dist/loader-runner/index.d.ts +36 -0
  210. package/dist/loader-runner/loadLoader.d.ts +12 -0
  211. package/dist/loader-runner/service.d.ts +73 -0
  212. package/dist/loader-runner/utils.d.ts +7 -0
  213. package/dist/loader-runner/worker.d.ts +14 -0
  214. package/dist/logging/Logger.d.ts +61 -0
  215. package/dist/logging/createConsoleLogger.d.ts +35 -0
  216. package/dist/logging/truncateArgs.d.ts +16 -0
  217. package/dist/moduleFederationDefaultRuntime.js +1 -0
  218. package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
  219. package/dist/node/NodeTemplatePlugin.d.ts +18 -0
  220. package/dist/node/NodeWatchFileSystem.d.ts +18 -0
  221. package/dist/node/nodeConsole.d.ts +15 -0
  222. package/dist/rspack.d.ts +25 -0
  223. package/dist/rspackOptionsApply.d.ts +4 -0
  224. package/dist/runtime/cssExtractHmr.d.ts +4 -0
  225. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  226. package/dist/sharing/ConsumeSharedPlugin.d.ts +42 -0
  227. package/dist/sharing/ProvideSharedPlugin.d.ts +35 -0
  228. package/dist/sharing/SharePlugin.d.ts +53 -0
  229. package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
  230. package/dist/sharing/utils.d.ts +1 -0
  231. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +20 -0
  232. package/dist/stats/DefaultStatsPresetPlugin.d.ts +4 -0
  233. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +13 -0
  234. package/dist/stats/StatsFactory.d.ts +57 -0
  235. package/dist/stats/StatsPrinter.d.ts +57 -0
  236. package/dist/stats/statsFactoryUtils.d.ts +341 -0
  237. package/dist/swc.d.ts +7 -0
  238. package/dist/taps/compilation.d.ts +8 -0
  239. package/dist/taps/compiler.d.ts +2 -0
  240. package/dist/taps/contextModuleFactory.d.ts +2 -0
  241. package/dist/taps/index.d.ts +6 -0
  242. package/dist/taps/javascriptModules.d.ts +2 -0
  243. package/dist/taps/normalModuleFactory.d.ts +2 -0
  244. package/dist/taps/types.d.ts +11 -0
  245. package/dist/trace/index.d.ts +46 -0
  246. package/dist/trace/traceHookPlugin.d.ts +5 -0
  247. package/dist/util/ArrayQueue.d.ts +45 -0
  248. package/dist/util/AsyncTask.d.ts +7 -0
  249. package/dist/util/MergeCaller.d.ts +10 -0
  250. package/dist/util/SizeFormatHelpers.d.ts +10 -0
  251. package/dist/util/SplitChunkSize.d.ts +5 -0
  252. package/dist/util/assertNotNil.d.ts +1 -0
  253. package/dist/util/assetCondition.d.ts +2 -0
  254. package/dist/util/asyncLib.d.ts +54 -0
  255. package/dist/util/bindingVersionCheck.d.ts +5 -0
  256. package/dist/util/cleverMerge.d.ts +24 -0
  257. package/dist/util/comparators.d.ts +16 -0
  258. package/dist/util/createHash.d.ts +16 -0
  259. package/dist/util/createReadonlyMap.d.ts +1 -0
  260. package/dist/util/fake.d.ts +14 -0
  261. package/dist/util/fs.d.ts +375 -0
  262. package/dist/util/hash/index.d.ts +26 -0
  263. package/dist/util/hash/md4.d.ts +11 -0
  264. package/dist/util/hash/wasm-hash.d.ts +51 -0
  265. package/dist/util/hash/xxhash64.d.ts +11 -0
  266. package/dist/util/identifier.d.ts +31 -0
  267. package/dist/util/index.d.ts +9 -0
  268. package/dist/util/memoize.d.ts +2 -0
  269. package/dist/util/runtime.d.ts +2 -0
  270. package/dist/util/smartGrouping.d.ts +21 -0
  271. package/dist/util/source.d.ts +6 -0
  272. package/dist/util/validateConfig.d.ts +5 -0
  273. package/dist/worker.js +978 -0
  274. package/hot/dev-server.js +75 -0
  275. package/hot/emitter.js +21 -0
  276. package/hot/lazy-compilation-node.js +106 -0
  277. package/hot/lazy-compilation-web.js +98 -0
  278. package/hot/log-apply-result.js +49 -0
  279. package/hot/log.js +79 -0
  280. package/hot/only-dev-server.js +103 -0
  281. package/hot/poll.js +40 -0
  282. package/hot/signal.js +66 -0
  283. package/module.d.ts +273 -0
  284. package/package.json +79 -0
@@ -0,0 +1,4675 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ 780:
6
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
7
+
8
+ /*
9
+ MIT License http://www.opensource.org/licenses/mit-license.php
10
+ Author Tobias Koppers @sokra
11
+ */
12
+
13
+
14
+
15
+ const Source = __nccwpck_require__(422);
16
+ const streamAndGetSourceAndMap = __nccwpck_require__(334);
17
+ const streamChunksOfRawSource = __nccwpck_require__(771);
18
+ const streamChunksOfSourceMap = __nccwpck_require__(105);
19
+ const {
20
+ isDualStringBufferCachingEnabled,
21
+ } = __nccwpck_require__(357);
22
+
23
+ /** @typedef {import("./Source").HashLike} HashLike */
24
+ /** @typedef {import("./Source").MapOptions} MapOptions */
25
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
26
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
27
+ /** @typedef {import("./Source").SourceValue} SourceValue */
28
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
29
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
30
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
31
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
32
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
33
+
34
+ /**
35
+ * @typedef {object} BufferedMap
36
+ * @property {number} version version
37
+ * @property {string[]} sources sources
38
+ * @property {string[]} names name
39
+ * @property {string=} sourceRoot source root
40
+ * @property {(Buffer | "")[]=} sourcesContent sources content
41
+ * @property {Buffer=} mappings mappings
42
+ * @property {string} file file
43
+ */
44
+
45
+ /**
46
+ * @param {null | RawSourceMap} map map
47
+ * @returns {null | BufferedMap} buffered map
48
+ */
49
+ const mapToBufferedMap = (map) => {
50
+ if (typeof map !== "object" || !map) return map;
51
+ const bufferedMap =
52
+ /** @type {BufferedMap} */
53
+ (/** @type {unknown} */ ({ ...map }));
54
+ if (map.mappings) {
55
+ bufferedMap.mappings = Buffer.from(map.mappings, "utf8");
56
+ }
57
+ if (map.sourcesContent) {
58
+ bufferedMap.sourcesContent = map.sourcesContent.map(
59
+ (str) => str && Buffer.from(str, "utf8"),
60
+ );
61
+ }
62
+ return bufferedMap;
63
+ };
64
+
65
+ /**
66
+ * @param {null | BufferedMap} bufferedMap buffered map
67
+ * @returns {null | RawSourceMap} map
68
+ */
69
+ const bufferedMapToMap = (bufferedMap) => {
70
+ if (typeof bufferedMap !== "object" || !bufferedMap) return bufferedMap;
71
+ const map =
72
+ /** @type {RawSourceMap} */
73
+ (/** @type {unknown} */ ({ ...bufferedMap }));
74
+ if (bufferedMap.mappings) {
75
+ map.mappings = bufferedMap.mappings.toString("utf8");
76
+ }
77
+ if (bufferedMap.sourcesContent) {
78
+ map.sourcesContent = bufferedMap.sourcesContent.map(
79
+ (buffer) => buffer && buffer.toString("utf8"),
80
+ );
81
+ }
82
+ return map;
83
+ };
84
+
85
+ /** @typedef {{ map?: null | RawSourceMap, bufferedMap?: null | BufferedMap }} BufferEntry */
86
+ /** @typedef {Map<string, BufferEntry>} BufferedMaps */
87
+
88
+ /**
89
+ * @typedef {object} CachedData
90
+ * @property {boolean=} source source
91
+ * @property {Buffer} buffer buffer
92
+ * @property {number=} size size
93
+ * @property {BufferedMaps} maps maps
94
+ * @property {(string | Buffer)[]=} hash hash
95
+ */
96
+
97
+ class CachedSource extends Source {
98
+ /**
99
+ * @param {Source | (() => Source)} source source
100
+ * @param {CachedData=} cachedData cached data
101
+ */
102
+ constructor(source, cachedData) {
103
+ super();
104
+ this._source = source;
105
+ this._cachedSourceType = cachedData ? cachedData.source : undefined;
106
+ /**
107
+ * @private
108
+ * @type {undefined | string}
109
+ */
110
+ this._cachedSource = undefined;
111
+ this._cachedBuffer = cachedData ? cachedData.buffer : undefined;
112
+ this._cachedSize = cachedData ? cachedData.size : undefined;
113
+ /**
114
+ * @private
115
+ * @type {BufferedMaps}
116
+ */
117
+ this._cachedMaps = cachedData ? cachedData.maps : new Map();
118
+ this._cachedHashUpdate = cachedData ? cachedData.hash : undefined;
119
+ }
120
+
121
+ /**
122
+ * @returns {CachedData} cached data
123
+ */
124
+ getCachedData() {
125
+ /** @type {BufferedMaps} */
126
+ const bufferedMaps = new Map();
127
+ for (const pair of this._cachedMaps) {
128
+ const [, cacheEntry] = pair;
129
+ if (cacheEntry.bufferedMap === undefined) {
130
+ cacheEntry.bufferedMap = mapToBufferedMap(
131
+ this._getMapFromCacheEntry(cacheEntry),
132
+ );
133
+ }
134
+ bufferedMaps.set(pair[0], {
135
+ map: undefined,
136
+ bufferedMap: cacheEntry.bufferedMap,
137
+ });
138
+ }
139
+ return {
140
+ // We don't want to cache strings
141
+ // So if we have a caches sources
142
+ // create a buffer from it and only store
143
+ // if it was a Buffer or string
144
+ buffer: this._cachedSource
145
+ ? this.buffer()
146
+ : /** @type {Buffer} */ (this._cachedBuffer),
147
+ source:
148
+ this._cachedSourceType !== undefined
149
+ ? this._cachedSourceType
150
+ : typeof this._cachedSource === "string"
151
+ ? true
152
+ : Buffer.isBuffer(this._cachedSource)
153
+ ? false
154
+ : undefined,
155
+ size: this._cachedSize,
156
+ maps: bufferedMaps,
157
+ hash: this._cachedHashUpdate,
158
+ };
159
+ }
160
+
161
+ originalLazy() {
162
+ return this._source;
163
+ }
164
+
165
+ original() {
166
+ if (typeof this._source === "function") this._source = this._source();
167
+ return this._source;
168
+ }
169
+
170
+ /**
171
+ * @returns {SourceValue} source
172
+ */
173
+ source() {
174
+ const source = this._getCachedSource();
175
+ if (source !== undefined) return source;
176
+ return (this._cachedSource =
177
+ /** @type {string} */
178
+ (this.original().source()));
179
+ }
180
+
181
+ /**
182
+ * @private
183
+ * @param {BufferEntry} cacheEntry cache entry
184
+ * @returns {null | RawSourceMap} raw source map
185
+ */
186
+ _getMapFromCacheEntry(cacheEntry) {
187
+ if (cacheEntry.map !== undefined) {
188
+ return cacheEntry.map;
189
+ } else if (cacheEntry.bufferedMap !== undefined) {
190
+ return (cacheEntry.map = bufferedMapToMap(cacheEntry.bufferedMap));
191
+ }
192
+
193
+ return null;
194
+ }
195
+
196
+ /**
197
+ * @private
198
+ * @returns {undefined | string} cached source
199
+ */
200
+ _getCachedSource() {
201
+ if (this._cachedSource !== undefined) return this._cachedSource;
202
+ if (this._cachedBuffer && this._cachedSourceType !== undefined) {
203
+ const value = this._cachedSourceType
204
+ ? this._cachedBuffer.toString("utf8")
205
+ : this._cachedBuffer;
206
+ if (isDualStringBufferCachingEnabled()) {
207
+ this._cachedSource = /** @type {string} */ (value);
208
+ }
209
+ return /** @type {string} */ (value);
210
+ }
211
+ }
212
+
213
+ /**
214
+ * @returns {Buffer} buffer
215
+ */
216
+ buffer() {
217
+ if (this._cachedBuffer !== undefined) return this._cachedBuffer;
218
+ if (this._cachedSource !== undefined) {
219
+ const value = Buffer.isBuffer(this._cachedSource)
220
+ ? this._cachedSource
221
+ : Buffer.from(this._cachedSource, "utf8");
222
+ if (isDualStringBufferCachingEnabled()) {
223
+ this._cachedBuffer = value;
224
+ }
225
+ return value;
226
+ }
227
+ if (typeof this.original().buffer === "function") {
228
+ return (this._cachedBuffer = this.original().buffer());
229
+ }
230
+ const bufferOrString = this.source();
231
+ if (Buffer.isBuffer(bufferOrString)) {
232
+ return (this._cachedBuffer = bufferOrString);
233
+ }
234
+ const value = Buffer.from(bufferOrString, "utf8");
235
+ if (isDualStringBufferCachingEnabled()) {
236
+ this._cachedBuffer = value;
237
+ }
238
+ return value;
239
+ }
240
+
241
+ /**
242
+ * @returns {number} size
243
+ */
244
+ size() {
245
+ if (this._cachedSize !== undefined) return this._cachedSize;
246
+ if (this._cachedBuffer !== undefined) {
247
+ return (this._cachedSize = this._cachedBuffer.length);
248
+ }
249
+ const source = this._getCachedSource();
250
+ if (source !== undefined) {
251
+ return (this._cachedSize = Buffer.byteLength(source));
252
+ }
253
+ return (this._cachedSize = this.original().size());
254
+ }
255
+
256
+ /**
257
+ * @param {MapOptions=} options map options
258
+ * @returns {SourceAndMap} source and map
259
+ */
260
+ sourceAndMap(options) {
261
+ const key = options ? JSON.stringify(options) : "{}";
262
+ const cacheEntry = this._cachedMaps.get(key);
263
+ // Look for a cached map
264
+ if (cacheEntry !== undefined) {
265
+ // We have a cached map in some representation
266
+ const map = this._getMapFromCacheEntry(cacheEntry);
267
+
268
+ // Either get the cached source or compute it
269
+ return { source: this.source(), map };
270
+ }
271
+ // Look for a cached source
272
+ let source = this._getCachedSource();
273
+ // Compute the map
274
+ let map;
275
+ if (source !== undefined) {
276
+ map = this.original().map(options);
277
+ } else {
278
+ // Compute the source and map together.
279
+ const sourceAndMap = this.original().sourceAndMap(options);
280
+ source = /** @type {string} */ (sourceAndMap.source);
281
+ map = sourceAndMap.map;
282
+ this._cachedSource = source;
283
+ }
284
+ this._cachedMaps.set(key, {
285
+ map,
286
+ bufferedMap: undefined,
287
+ });
288
+ return { source, map };
289
+ }
290
+
291
+ /**
292
+ * @param {Options} options options
293
+ * @param {OnChunk} onChunk called for each chunk of code
294
+ * @param {OnSource} onSource called for each source
295
+ * @param {OnName} onName called for each name
296
+ * @returns {GeneratedSourceInfo} generated source info
297
+ */
298
+ streamChunks(options, onChunk, onSource, onName) {
299
+ const key = options ? JSON.stringify(options) : "{}";
300
+ if (
301
+ this._cachedMaps.has(key) &&
302
+ (this._cachedBuffer !== undefined || this._cachedSource !== undefined)
303
+ ) {
304
+ const { source, map } = this.sourceAndMap(options);
305
+ if (map) {
306
+ return streamChunksOfSourceMap(
307
+ /** @type {string} */
308
+ (source),
309
+ map,
310
+ onChunk,
311
+ onSource,
312
+ onName,
313
+ Boolean(options && options.finalSource),
314
+ true,
315
+ );
316
+ }
317
+ return streamChunksOfRawSource(
318
+ /** @type {string} */
319
+ (source),
320
+ onChunk,
321
+ onSource,
322
+ onName,
323
+ Boolean(options && options.finalSource),
324
+ );
325
+ }
326
+ const sourceAndMap = streamAndGetSourceAndMap(
327
+ this.original(),
328
+ options,
329
+ onChunk,
330
+ onSource,
331
+ onName,
332
+ );
333
+ this._cachedSource = sourceAndMap.source;
334
+ this._cachedMaps.set(key, {
335
+ map: /** @type {RawSourceMap} */ (sourceAndMap.map),
336
+ bufferedMap: undefined,
337
+ });
338
+ return sourceAndMap.result;
339
+ }
340
+
341
+ /**
342
+ * @param {MapOptions=} options map options
343
+ * @returns {RawSourceMap | null} map
344
+ */
345
+ map(options) {
346
+ const key = options ? JSON.stringify(options) : "{}";
347
+ const cacheEntry = this._cachedMaps.get(key);
348
+ if (cacheEntry !== undefined) {
349
+ return this._getMapFromCacheEntry(cacheEntry);
350
+ }
351
+ const map = this.original().map(options);
352
+ this._cachedMaps.set(key, {
353
+ map,
354
+ bufferedMap: undefined,
355
+ });
356
+ return map;
357
+ }
358
+
359
+ /**
360
+ * @param {HashLike} hash hash
361
+ * @returns {void}
362
+ */
363
+ updateHash(hash) {
364
+ if (this._cachedHashUpdate !== undefined) {
365
+ for (const item of this._cachedHashUpdate) hash.update(item);
366
+ return;
367
+ }
368
+ /** @type {(string | Buffer)[]} */
369
+ const update = [];
370
+ /** @type {string | undefined} */
371
+ let currentString;
372
+ const tracker = {
373
+ /**
374
+ * @param {string | Buffer} item item
375
+ * @returns {void}
376
+ */
377
+ update: (item) => {
378
+ if (typeof item === "string" && item.length < 10240) {
379
+ if (currentString === undefined) {
380
+ currentString = item;
381
+ } else {
382
+ currentString += item;
383
+ if (currentString.length > 102400) {
384
+ update.push(Buffer.from(currentString));
385
+ currentString = undefined;
386
+ }
387
+ }
388
+ } else {
389
+ if (currentString !== undefined) {
390
+ update.push(Buffer.from(currentString));
391
+ currentString = undefined;
392
+ }
393
+ update.push(item);
394
+ }
395
+ },
396
+ };
397
+ this.original().updateHash(/** @type {HashLike} */ (tracker));
398
+ if (currentString !== undefined) {
399
+ update.push(Buffer.from(currentString));
400
+ }
401
+ for (const item of update) hash.update(item);
402
+ this._cachedHashUpdate = update;
403
+ }
404
+ }
405
+
406
+ module.exports = CachedSource;
407
+
408
+
409
+ /***/ }),
410
+
411
+ /***/ 844:
412
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
413
+
414
+ /*
415
+ MIT License http://www.opensource.org/licenses/mit-license.php
416
+ Author Tobias Koppers @sokra
417
+ */
418
+
419
+
420
+
421
+ const Source = __nccwpck_require__(422);
422
+
423
+ /** @typedef {import("./Source").HashLike} HashLike */
424
+ /** @typedef {import("./Source").MapOptions} MapOptions */
425
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
426
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
427
+ /** @typedef {import("./Source").SourceValue} SourceValue */
428
+
429
+ /**
430
+ * @typedef {object} SourceLike
431
+ * @property {() => SourceValue} source source
432
+ * @property {(() => Buffer)=} buffer buffer
433
+ * @property {(() => number)=} size size
434
+ * @property {((options?: MapOptions) => RawSourceMap | null)=} map map
435
+ * @property {((options?: MapOptions) => SourceAndMap)=} sourceAndMap source and map
436
+ * @property {((hash: HashLike) => void)=} updateHash hash updater
437
+ */
438
+
439
+ class CompatSource extends Source {
440
+ /**
441
+ * @param {SourceLike} sourceLike source like
442
+ * @returns {Source} source
443
+ */
444
+ static from(sourceLike) {
445
+ return sourceLike instanceof Source
446
+ ? sourceLike
447
+ : new CompatSource(sourceLike);
448
+ }
449
+
450
+ /**
451
+ * @param {SourceLike} sourceLike source like
452
+ */
453
+ constructor(sourceLike) {
454
+ super();
455
+ this._sourceLike = sourceLike;
456
+ }
457
+
458
+ /**
459
+ * @returns {SourceValue} source
460
+ */
461
+ source() {
462
+ return this._sourceLike.source();
463
+ }
464
+
465
+ buffer() {
466
+ if (typeof this._sourceLike.buffer === "function") {
467
+ return this._sourceLike.buffer();
468
+ }
469
+ return super.buffer();
470
+ }
471
+
472
+ size() {
473
+ if (typeof this._sourceLike.size === "function") {
474
+ return this._sourceLike.size();
475
+ }
476
+ return super.size();
477
+ }
478
+
479
+ /**
480
+ * @param {MapOptions=} options map options
481
+ * @returns {RawSourceMap | null} map
482
+ */
483
+ map(options) {
484
+ if (typeof this._sourceLike.map === "function") {
485
+ return this._sourceLike.map(options);
486
+ }
487
+ return super.map(options);
488
+ }
489
+
490
+ /**
491
+ * @param {MapOptions=} options map options
492
+ * @returns {SourceAndMap} source and map
493
+ */
494
+ sourceAndMap(options) {
495
+ if (typeof this._sourceLike.sourceAndMap === "function") {
496
+ return this._sourceLike.sourceAndMap(options);
497
+ }
498
+ return super.sourceAndMap(options);
499
+ }
500
+
501
+ /**
502
+ * @param {HashLike} hash hash
503
+ * @returns {void}
504
+ */
505
+ updateHash(hash) {
506
+ if (typeof this._sourceLike.updateHash === "function") {
507
+ return this._sourceLike.updateHash(hash);
508
+ }
509
+ if (typeof this._sourceLike.map === "function") {
510
+ throw new Error(
511
+ "A Source-like object with a 'map' method must also provide an 'updateHash' method",
512
+ );
513
+ }
514
+ hash.update(this.buffer());
515
+ }
516
+ }
517
+
518
+ module.exports = CompatSource;
519
+
520
+
521
+ /***/ }),
522
+
523
+ /***/ 974:
524
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
525
+
526
+ /*
527
+ MIT License http://www.opensource.org/licenses/mit-license.php
528
+ Author Tobias Koppers @sokra
529
+ */
530
+
531
+
532
+
533
+ const RawSource = __nccwpck_require__(136);
534
+ const Source = __nccwpck_require__(422);
535
+ const { getMap, getSourceAndMap } = __nccwpck_require__(875);
536
+ const streamChunks = __nccwpck_require__(779);
537
+
538
+ /** @typedef {import("./CompatSource").SourceLike} SourceLike */
539
+ /** @typedef {import("./Source").HashLike} HashLike */
540
+ /** @typedef {import("./Source").MapOptions} MapOptions */
541
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
542
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
543
+ /** @typedef {import("./Source").SourceValue} SourceValue */
544
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
545
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
546
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
547
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
548
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
549
+
550
+ /** @typedef {string | Source | SourceLike} Child */
551
+
552
+ const stringsAsRawSources = new WeakSet();
553
+
554
+ class ConcatSource extends Source {
555
+ /**
556
+ * @param {Child[]} args children
557
+ */
558
+ constructor(...args) {
559
+ super();
560
+ /**
561
+ * @private
562
+ * @type {Child[]}
563
+ */
564
+ this._children = [];
565
+
566
+ for (const item of args) {
567
+ if (item instanceof ConcatSource) {
568
+ for (const child of item._children) {
569
+ this._children.push(child);
570
+ }
571
+ } else {
572
+ this._children.push(item);
573
+ }
574
+ }
575
+
576
+ this._isOptimized = args.length === 0;
577
+ }
578
+
579
+ /**
580
+ * @returns {Source[]} children
581
+ */
582
+ getChildren() {
583
+ if (!this._isOptimized) this._optimize();
584
+ return /** @type {Source[]} */ (this._children);
585
+ }
586
+
587
+ /**
588
+ * @param {Child} item item
589
+ * @returns {void}
590
+ */
591
+ add(item) {
592
+ if (item instanceof ConcatSource) {
593
+ for (const child of item._children) {
594
+ this._children.push(child);
595
+ }
596
+ } else {
597
+ this._children.push(item);
598
+ }
599
+ this._isOptimized = false;
600
+ }
601
+
602
+ /**
603
+ * @param {Child[]} items items
604
+ * @returns {void}
605
+ */
606
+ addAllSkipOptimizing(items) {
607
+ for (const item of items) {
608
+ this._children.push(item);
609
+ }
610
+ }
611
+
612
+ buffer() {
613
+ if (!this._isOptimized) this._optimize();
614
+ /** @type {Buffer[]} */
615
+ const buffers = [];
616
+ for (const child of /** @type {SourceLike[]} */ (this._children)) {
617
+ if (typeof child.buffer === "function") {
618
+ buffers.push(child.buffer());
619
+ } else {
620
+ const bufferOrString = child.source();
621
+ if (Buffer.isBuffer(bufferOrString)) {
622
+ buffers.push(bufferOrString);
623
+ } else {
624
+ // This will not happen
625
+ buffers.push(Buffer.from(bufferOrString, "utf8"));
626
+ }
627
+ }
628
+ }
629
+ return Buffer.concat(buffers);
630
+ }
631
+
632
+ /**
633
+ * @returns {SourceValue} source
634
+ */
635
+ source() {
636
+ if (!this._isOptimized) this._optimize();
637
+ let source = "";
638
+ for (const child of this._children) {
639
+ source += /** @type {Source} */ (child).source();
640
+ }
641
+ return source;
642
+ }
643
+
644
+ size() {
645
+ if (!this._isOptimized) this._optimize();
646
+ let size = 0;
647
+ for (const child of this._children) {
648
+ size += /** @type {Source} */ (child).size();
649
+ }
650
+ return size;
651
+ }
652
+
653
+ /**
654
+ * @param {MapOptions=} options map options
655
+ * @returns {RawSourceMap | null} map
656
+ */
657
+ map(options) {
658
+ return getMap(this, options);
659
+ }
660
+
661
+ /**
662
+ * @param {MapOptions=} options map options
663
+ * @returns {SourceAndMap} source and map
664
+ */
665
+ sourceAndMap(options) {
666
+ return getSourceAndMap(this, options);
667
+ }
668
+
669
+ /**
670
+ * @param {Options} options options
671
+ * @param {OnChunk} onChunk called for each chunk of code
672
+ * @param {OnSource} onSource called for each source
673
+ * @param {OnName} onName called for each name
674
+ * @returns {GeneratedSourceInfo} generated source info
675
+ */
676
+ streamChunks(options, onChunk, onSource, onName) {
677
+ if (!this._isOptimized) this._optimize();
678
+ if (this._children.length === 1) {
679
+ return /** @type {ConcatSource[]} */ (this._children)[0].streamChunks(
680
+ options,
681
+ onChunk,
682
+ onSource,
683
+ onName,
684
+ );
685
+ }
686
+ let currentLineOffset = 0;
687
+ let currentColumnOffset = 0;
688
+ const sourceMapping = new Map();
689
+ const nameMapping = new Map();
690
+ const finalSource = Boolean(options && options.finalSource);
691
+ let code = "";
692
+ let needToCloseMapping = false;
693
+ for (const item of /** @type {Source[]} */ (this._children)) {
694
+ /** @type {number[]} */
695
+ const sourceIndexMapping = [];
696
+ /** @type {number[]} */
697
+ const nameIndexMapping = [];
698
+ let lastMappingLine = 0;
699
+ const { generatedLine, generatedColumn, source } = streamChunks(
700
+ item,
701
+ options,
702
+ // eslint-disable-next-line no-loop-func
703
+ (
704
+ chunk,
705
+ generatedLine,
706
+ generatedColumn,
707
+ sourceIndex,
708
+ originalLine,
709
+ originalColumn,
710
+ nameIndex,
711
+ ) => {
712
+ const line = generatedLine + currentLineOffset;
713
+ const column =
714
+ generatedLine === 1
715
+ ? generatedColumn + currentColumnOffset
716
+ : generatedColumn;
717
+ if (needToCloseMapping) {
718
+ if (generatedLine !== 1 || generatedColumn !== 0) {
719
+ onChunk(
720
+ undefined,
721
+ currentLineOffset + 1,
722
+ currentColumnOffset,
723
+ -1,
724
+ -1,
725
+ -1,
726
+ -1,
727
+ );
728
+ }
729
+ needToCloseMapping = false;
730
+ }
731
+ const resultSourceIndex =
732
+ sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length
733
+ ? -1
734
+ : sourceIndexMapping[sourceIndex];
735
+ const resultNameIndex =
736
+ nameIndex < 0 || nameIndex >= nameIndexMapping.length
737
+ ? -1
738
+ : nameIndexMapping[nameIndex];
739
+ lastMappingLine = resultSourceIndex < 0 ? 0 : generatedLine;
740
+ let _chunk;
741
+ // When using finalSource, we process the entire source code at once at the end, rather than chunk by chunk
742
+ if (finalSource) {
743
+ if (chunk !== undefined) code += chunk;
744
+ } else {
745
+ _chunk = chunk;
746
+ }
747
+ if (resultSourceIndex < 0) {
748
+ onChunk(_chunk, line, column, -1, -1, -1, -1);
749
+ } else {
750
+ onChunk(
751
+ _chunk,
752
+ line,
753
+ column,
754
+ resultSourceIndex,
755
+ originalLine,
756
+ originalColumn,
757
+ resultNameIndex,
758
+ );
759
+ }
760
+ },
761
+ (i, source, sourceContent) => {
762
+ let globalIndex = sourceMapping.get(source);
763
+ if (globalIndex === undefined) {
764
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
765
+ onSource(globalIndex, source, sourceContent);
766
+ }
767
+ sourceIndexMapping[i] = globalIndex;
768
+ },
769
+ (i, name) => {
770
+ let globalIndex = nameMapping.get(name);
771
+ if (globalIndex === undefined) {
772
+ nameMapping.set(name, (globalIndex = nameMapping.size));
773
+ onName(globalIndex, name);
774
+ }
775
+ nameIndexMapping[i] = globalIndex;
776
+ },
777
+ );
778
+ if (source !== undefined) code += source;
779
+ if (
780
+ needToCloseMapping &&
781
+ (generatedLine !== 1 || generatedColumn !== 0)
782
+ ) {
783
+ onChunk(
784
+ undefined,
785
+ currentLineOffset + 1,
786
+ currentColumnOffset,
787
+ -1,
788
+ -1,
789
+ -1,
790
+ -1,
791
+ );
792
+ needToCloseMapping = false;
793
+ }
794
+ if (/** @type {number} */ (generatedLine) > 1) {
795
+ currentColumnOffset = /** @type {number} */ (generatedColumn);
796
+ } else {
797
+ currentColumnOffset += /** @type {number} */ (generatedColumn);
798
+ }
799
+ needToCloseMapping =
800
+ needToCloseMapping ||
801
+ (finalSource && lastMappingLine === generatedLine);
802
+ currentLineOffset += /** @type {number} */ (generatedLine) - 1;
803
+ }
804
+ return {
805
+ generatedLine: currentLineOffset + 1,
806
+ generatedColumn: currentColumnOffset,
807
+ source: finalSource ? code : undefined,
808
+ };
809
+ }
810
+
811
+ /**
812
+ * @param {HashLike} hash hash
813
+ * @returns {void}
814
+ */
815
+ updateHash(hash) {
816
+ if (!this._isOptimized) this._optimize();
817
+ hash.update("ConcatSource");
818
+ for (const item of this._children) {
819
+ /** @type {Source} */
820
+ (item).updateHash(hash);
821
+ }
822
+ }
823
+
824
+ _optimize() {
825
+ const newChildren = [];
826
+ let currentString;
827
+ /** @type {undefined | string | [string, string] | SourceLike} */
828
+ let currentRawSources;
829
+ /**
830
+ * @param {string} string string
831
+ * @returns {void}
832
+ */
833
+ const addStringToRawSources = (string) => {
834
+ if (currentRawSources === undefined) {
835
+ currentRawSources = string;
836
+ } else if (Array.isArray(currentRawSources)) {
837
+ currentRawSources.push(string);
838
+ } else {
839
+ currentRawSources = [
840
+ typeof currentRawSources === "string"
841
+ ? currentRawSources
842
+ : /** @type {string} */ (currentRawSources.source()),
843
+ string,
844
+ ];
845
+ }
846
+ };
847
+ /**
848
+ * @param {SourceLike} source source
849
+ * @returns {void}
850
+ */
851
+ const addSourceToRawSources = (source) => {
852
+ if (currentRawSources === undefined) {
853
+ currentRawSources = source;
854
+ } else if (Array.isArray(currentRawSources)) {
855
+ currentRawSources.push(
856
+ /** @type {string} */
857
+ (source.source()),
858
+ );
859
+ } else {
860
+ currentRawSources = [
861
+ typeof currentRawSources === "string"
862
+ ? currentRawSources
863
+ : /** @type {string} */ (currentRawSources.source()),
864
+ /** @type {string} */
865
+ (source.source()),
866
+ ];
867
+ }
868
+ };
869
+ const mergeRawSources = () => {
870
+ if (Array.isArray(currentRawSources)) {
871
+ const rawSource = new RawSource(currentRawSources.join(""));
872
+ stringsAsRawSources.add(rawSource);
873
+ newChildren.push(rawSource);
874
+ } else if (typeof currentRawSources === "string") {
875
+ const rawSource = new RawSource(currentRawSources);
876
+ stringsAsRawSources.add(rawSource);
877
+ newChildren.push(rawSource);
878
+ } else {
879
+ newChildren.push(currentRawSources);
880
+ }
881
+ };
882
+ for (const child of this._children) {
883
+ if (typeof child === "string") {
884
+ if (currentString === undefined) {
885
+ currentString = child;
886
+ } else {
887
+ currentString += child;
888
+ }
889
+ } else {
890
+ if (currentString !== undefined) {
891
+ addStringToRawSources(currentString);
892
+ currentString = undefined;
893
+ }
894
+ if (stringsAsRawSources.has(child)) {
895
+ addSourceToRawSources(
896
+ /** @type {SourceLike} */
897
+ (child),
898
+ );
899
+ } else {
900
+ if (currentRawSources !== undefined) {
901
+ mergeRawSources();
902
+ currentRawSources = undefined;
903
+ }
904
+ newChildren.push(child);
905
+ }
906
+ }
907
+ }
908
+ if (currentString !== undefined) {
909
+ addStringToRawSources(currentString);
910
+ }
911
+ if (currentRawSources !== undefined) {
912
+ mergeRawSources();
913
+ }
914
+ this._children = newChildren;
915
+ this._isOptimized = true;
916
+ }
917
+ }
918
+
919
+ module.exports = ConcatSource;
920
+
921
+
922
+ /***/ }),
923
+
924
+ /***/ 837:
925
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
926
+
927
+ /*
928
+ MIT License http://www.opensource.org/licenses/mit-license.php
929
+ Author Tobias Koppers @sokra
930
+ */
931
+
932
+
933
+
934
+ const Source = __nccwpck_require__(422);
935
+ const { getMap, getSourceAndMap } = __nccwpck_require__(875);
936
+ const getGeneratedSourceInfo = __nccwpck_require__(517);
937
+ const splitIntoLines = __nccwpck_require__(492);
938
+ const splitIntoPotentialTokens = __nccwpck_require__(403);
939
+ const {
940
+ isDualStringBufferCachingEnabled,
941
+ } = __nccwpck_require__(357);
942
+
943
+ /** @typedef {import("./Source").HashLike} HashLike */
944
+ /** @typedef {import("./Source").MapOptions} MapOptions */
945
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
946
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
947
+ /** @typedef {import("./Source").SourceValue} SourceValue */
948
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
949
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
950
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
951
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
952
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
953
+
954
+ class OriginalSource extends Source {
955
+ /**
956
+ * @param {string | Buffer} value value
957
+ * @param {string} name name
958
+ */
959
+ constructor(value, name) {
960
+ super();
961
+
962
+ const isBuffer = Buffer.isBuffer(value);
963
+
964
+ /**
965
+ * @private
966
+ * @type {undefined | string}
967
+ */
968
+ this._value = isBuffer ? undefined : value;
969
+ /**
970
+ * @private
971
+ * @type {undefined | Buffer}
972
+ */
973
+ this._valueAsBuffer = isBuffer ? value : undefined;
974
+ this._name = name;
975
+ }
976
+
977
+ getName() {
978
+ return this._name;
979
+ }
980
+
981
+ /**
982
+ * @returns {SourceValue} source
983
+ */
984
+ source() {
985
+ if (this._value === undefined) {
986
+ const value =
987
+ /** @type {Buffer} */
988
+ (this._valueAsBuffer).toString("utf8");
989
+ if (isDualStringBufferCachingEnabled()) {
990
+ this._value = value;
991
+ }
992
+ return value;
993
+ }
994
+ return this._value;
995
+ }
996
+
997
+ buffer() {
998
+ if (this._valueAsBuffer === undefined) {
999
+ const value = Buffer.from(/** @type {string} */ (this._value), "utf8");
1000
+ if (isDualStringBufferCachingEnabled()) {
1001
+ this._valueAsBuffer = value;
1002
+ }
1003
+ return value;
1004
+ }
1005
+ return this._valueAsBuffer;
1006
+ }
1007
+
1008
+ /**
1009
+ * @param {MapOptions=} options map options
1010
+ * @returns {RawSourceMap | null} map
1011
+ */
1012
+ map(options) {
1013
+ return getMap(this, options);
1014
+ }
1015
+
1016
+ /**
1017
+ * @param {MapOptions=} options map options
1018
+ * @returns {SourceAndMap} source and map
1019
+ */
1020
+ sourceAndMap(options) {
1021
+ return getSourceAndMap(this, options);
1022
+ }
1023
+
1024
+ /**
1025
+ * @param {Options} options options
1026
+ * @param {OnChunk} onChunk called for each chunk of code
1027
+ * @param {OnSource} onSource called for each source
1028
+ * @param {OnName} _onName called for each name
1029
+ * @returns {GeneratedSourceInfo} generated source info
1030
+ */
1031
+ streamChunks(options, onChunk, onSource, _onName) {
1032
+ if (this._value === undefined) {
1033
+ this._value =
1034
+ /** @type {Buffer} */
1035
+ (this._valueAsBuffer).toString("utf8");
1036
+ }
1037
+ onSource(0, this._name, this._value);
1038
+ const finalSource = Boolean(options && options.finalSource);
1039
+ if (!options || options.columns !== false) {
1040
+ // With column info we need to read all lines and split them
1041
+ const matches = splitIntoPotentialTokens(this._value);
1042
+ let line = 1;
1043
+ let column = 0;
1044
+ if (matches !== null) {
1045
+ for (const match of matches) {
1046
+ const isEndOfLine = match.endsWith("\n");
1047
+ if (isEndOfLine && match.length === 1) {
1048
+ if (!finalSource) onChunk(match, line, column, -1, -1, -1, -1);
1049
+ } else {
1050
+ const chunk = finalSource ? undefined : match;
1051
+ onChunk(chunk, line, column, 0, line, column, -1);
1052
+ }
1053
+ if (isEndOfLine) {
1054
+ line++;
1055
+ column = 0;
1056
+ } else {
1057
+ column += match.length;
1058
+ }
1059
+ }
1060
+ }
1061
+ return {
1062
+ generatedLine: line,
1063
+ generatedColumn: column,
1064
+ source: finalSource ? this._value : undefined,
1065
+ };
1066
+ } else if (finalSource) {
1067
+ // Without column info and with final source we only
1068
+ // need meta info to generate mapping
1069
+ const result = getGeneratedSourceInfo(this._value);
1070
+ const { generatedLine, generatedColumn } = result;
1071
+ if (generatedColumn === 0) {
1072
+ for (
1073
+ let line = 1;
1074
+ line < /** @type {number} */ (generatedLine);
1075
+ line++
1076
+ ) {
1077
+ onChunk(undefined, line, 0, 0, line, 0, -1);
1078
+ }
1079
+ } else {
1080
+ for (
1081
+ let line = 1;
1082
+ line <= /** @type {number} */ (generatedLine);
1083
+ line++
1084
+ ) {
1085
+ onChunk(undefined, line, 0, 0, line, 0, -1);
1086
+ }
1087
+ }
1088
+ return result;
1089
+ }
1090
+ // Without column info, but also without final source
1091
+ // we need to split source by lines
1092
+ let line = 1;
1093
+ const matches = splitIntoLines(this._value);
1094
+ /** @type {string | undefined} */
1095
+ let match;
1096
+ for (match of matches) {
1097
+ onChunk(finalSource ? undefined : match, line, 0, 0, line, 0, -1);
1098
+ line++;
1099
+ }
1100
+ return matches.length === 0 || /** @type {string} */ (match).endsWith("\n")
1101
+ ? {
1102
+ generatedLine: matches.length + 1,
1103
+ generatedColumn: 0,
1104
+ source: finalSource ? this._value : undefined,
1105
+ }
1106
+ : {
1107
+ generatedLine: matches.length,
1108
+ generatedColumn: /** @type {string} */ (match).length,
1109
+ source: finalSource ? this._value : undefined,
1110
+ };
1111
+ }
1112
+
1113
+ /**
1114
+ * @param {HashLike} hash hash
1115
+ * @returns {void}
1116
+ */
1117
+ updateHash(hash) {
1118
+ hash.update("OriginalSource");
1119
+ hash.update(this.buffer());
1120
+ hash.update(this._name || "");
1121
+ }
1122
+ }
1123
+
1124
+ module.exports = OriginalSource;
1125
+
1126
+
1127
+ /***/ }),
1128
+
1129
+ /***/ 850:
1130
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1131
+
1132
+ /*
1133
+ MIT License http://www.opensource.org/licenses/mit-license.php
1134
+ Author Tobias Koppers @sokra
1135
+ */
1136
+
1137
+
1138
+
1139
+ const RawSource = __nccwpck_require__(136);
1140
+ const Source = __nccwpck_require__(422);
1141
+ const { getMap, getSourceAndMap } = __nccwpck_require__(875);
1142
+ const streamChunks = __nccwpck_require__(779);
1143
+
1144
+ /** @typedef {import("./Source").HashLike} HashLike */
1145
+ /** @typedef {import("./Source").MapOptions} MapOptions */
1146
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
1147
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
1148
+ /** @typedef {import("./Source").SourceValue} SourceValue */
1149
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
1150
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
1151
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
1152
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
1153
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
1154
+
1155
+ const REPLACE_REGEX = /\n(?=.|\s)/g;
1156
+
1157
+ class PrefixSource extends Source {
1158
+ /**
1159
+ * @param {string} prefix prefix
1160
+ * @param {string | Buffer | Source} source source
1161
+ */
1162
+ constructor(prefix, source) {
1163
+ super();
1164
+ /**
1165
+ * @private
1166
+ * @type {Source}
1167
+ */
1168
+ this._source =
1169
+ typeof source === "string" || Buffer.isBuffer(source)
1170
+ ? new RawSource(source, true)
1171
+ : source;
1172
+ this._prefix = prefix;
1173
+ }
1174
+
1175
+ getPrefix() {
1176
+ return this._prefix;
1177
+ }
1178
+
1179
+ original() {
1180
+ return this._source;
1181
+ }
1182
+
1183
+ /**
1184
+ * @returns {SourceValue} source
1185
+ */
1186
+ source() {
1187
+ const node = /** @type {string} */ (this._source.source());
1188
+ const prefix = this._prefix;
1189
+ return prefix + node.replace(REPLACE_REGEX, `\n${prefix}`);
1190
+ }
1191
+
1192
+ // TODO efficient buffer() implementation
1193
+
1194
+ /**
1195
+ * @param {MapOptions=} options map options
1196
+ * @returns {RawSourceMap | null} map
1197
+ */
1198
+ map(options) {
1199
+ return getMap(this, options);
1200
+ }
1201
+
1202
+ /**
1203
+ * @param {MapOptions=} options map options
1204
+ * @returns {SourceAndMap} source and map
1205
+ */
1206
+ sourceAndMap(options) {
1207
+ return getSourceAndMap(this, options);
1208
+ }
1209
+
1210
+ /**
1211
+ * @param {Options} options options
1212
+ * @param {OnChunk} onChunk called for each chunk of code
1213
+ * @param {OnSource} onSource called for each source
1214
+ * @param {OnName} onName called for each name
1215
+ * @returns {GeneratedSourceInfo} generated source info
1216
+ */
1217
+ streamChunks(options, onChunk, onSource, onName) {
1218
+ const prefix = this._prefix;
1219
+ const prefixOffset = prefix.length;
1220
+ const linesOnly = Boolean(options && options.columns === false);
1221
+ const { generatedLine, generatedColumn, source } = streamChunks(
1222
+ this._source,
1223
+ options,
1224
+ (
1225
+ chunk,
1226
+ generatedLine,
1227
+ generatedColumn,
1228
+ sourceIndex,
1229
+ originalLine,
1230
+ originalColumn,
1231
+ nameIndex,
1232
+ ) => {
1233
+ if (generatedColumn !== 0) {
1234
+ // In the middle of the line, we just adject the column
1235
+ generatedColumn += prefixOffset;
1236
+ } else if (chunk !== undefined) {
1237
+ // At the start of the line, when we have source content
1238
+ // add the prefix as generated mapping
1239
+ // (in lines only mode we just add it to the original mapping
1240
+ // for performance reasons)
1241
+ if (linesOnly || sourceIndex < 0) {
1242
+ chunk = prefix + chunk;
1243
+ } else if (prefixOffset > 0) {
1244
+ onChunk(prefix, generatedLine, generatedColumn, -1, -1, -1, -1);
1245
+ generatedColumn += prefixOffset;
1246
+ }
1247
+ } else if (!linesOnly) {
1248
+ // Without source content, we only need to adject the column info
1249
+ // expect in lines only mode where prefix is added to original mapping
1250
+ generatedColumn += prefixOffset;
1251
+ }
1252
+ onChunk(
1253
+ chunk,
1254
+ generatedLine,
1255
+ generatedColumn,
1256
+ sourceIndex,
1257
+ originalLine,
1258
+ originalColumn,
1259
+ nameIndex,
1260
+ );
1261
+ },
1262
+ onSource,
1263
+ onName,
1264
+ );
1265
+ return {
1266
+ generatedLine,
1267
+ generatedColumn:
1268
+ generatedColumn === 0
1269
+ ? 0
1270
+ : prefixOffset + /** @type {number} */ (generatedColumn),
1271
+ source:
1272
+ source !== undefined
1273
+ ? prefix + source.replace(REPLACE_REGEX, `\n${prefix}`)
1274
+ : undefined,
1275
+ };
1276
+ }
1277
+
1278
+ /**
1279
+ * @param {HashLike} hash hash
1280
+ * @returns {void}
1281
+ */
1282
+ updateHash(hash) {
1283
+ hash.update("PrefixSource");
1284
+ this._source.updateHash(hash);
1285
+ hash.update(this._prefix);
1286
+ }
1287
+ }
1288
+
1289
+ module.exports = PrefixSource;
1290
+
1291
+
1292
+ /***/ }),
1293
+
1294
+ /***/ 136:
1295
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1296
+
1297
+ /*
1298
+ MIT License http://www.opensource.org/licenses/mit-license.php
1299
+ Author Tobias Koppers @sokra
1300
+ */
1301
+
1302
+
1303
+
1304
+ const Source = __nccwpck_require__(422);
1305
+ const streamChunksOfRawSource = __nccwpck_require__(771);
1306
+ const {
1307
+ internString,
1308
+ isDualStringBufferCachingEnabled,
1309
+ } = __nccwpck_require__(357);
1310
+
1311
+ /** @typedef {import("./Source").HashLike} HashLike */
1312
+ /** @typedef {import("./Source").MapOptions} MapOptions */
1313
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
1314
+ /** @typedef {import("./Source").SourceValue} SourceValue */
1315
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
1316
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
1317
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
1318
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
1319
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
1320
+
1321
+ class RawSource extends Source {
1322
+ /**
1323
+ * @param {string | Buffer} value value
1324
+ * @param {boolean=} convertToString convert to string
1325
+ */
1326
+ constructor(value, convertToString = false) {
1327
+ super();
1328
+ const isBuffer = Buffer.isBuffer(value);
1329
+ if (!isBuffer && typeof value !== "string") {
1330
+ throw new TypeError("argument 'value' must be either string or Buffer");
1331
+ }
1332
+ this._valueIsBuffer = !convertToString && isBuffer;
1333
+ const internedString =
1334
+ typeof value === "string" ? internString(value) : undefined;
1335
+ /**
1336
+ * @private
1337
+ * @type {undefined | string | Buffer}
1338
+ */
1339
+ this._value =
1340
+ convertToString && isBuffer
1341
+ ? undefined
1342
+ : typeof value === "string"
1343
+ ? internedString
1344
+ : value;
1345
+ /**
1346
+ * @private
1347
+ * @type {undefined | Buffer}
1348
+ */
1349
+ this._valueAsBuffer = isBuffer ? value : undefined;
1350
+ /**
1351
+ * @private
1352
+ * @type {undefined | string}
1353
+ */
1354
+ this._valueAsString = isBuffer ? undefined : internedString;
1355
+ }
1356
+
1357
+ isBuffer() {
1358
+ return this._valueIsBuffer;
1359
+ }
1360
+
1361
+ /**
1362
+ * @returns {SourceValue} source
1363
+ */
1364
+ source() {
1365
+ if (this._value === undefined) {
1366
+ const value =
1367
+ /** @type {Buffer} */
1368
+ (this._valueAsBuffer).toString("utf8");
1369
+ if (isDualStringBufferCachingEnabled()) {
1370
+ this._value = internString(value);
1371
+ }
1372
+ return value;
1373
+ }
1374
+ return this._value;
1375
+ }
1376
+
1377
+ buffer() {
1378
+ if (this._valueAsBuffer === undefined) {
1379
+ const value = Buffer.from(/** @type {string} */ (this._value), "utf8");
1380
+ if (isDualStringBufferCachingEnabled()) {
1381
+ this._valueAsBuffer = value;
1382
+ }
1383
+ return value;
1384
+ }
1385
+ return this._valueAsBuffer;
1386
+ }
1387
+
1388
+ /**
1389
+ * @param {MapOptions=} options map options
1390
+ * @returns {RawSourceMap | null} map
1391
+ */
1392
+ // eslint-disable-next-line no-unused-vars
1393
+ map(options) {
1394
+ return null;
1395
+ }
1396
+
1397
+ /**
1398
+ * @param {Options} options options
1399
+ * @param {OnChunk} onChunk called for each chunk of code
1400
+ * @param {OnSource} onSource called for each source
1401
+ * @param {OnName} onName called for each name
1402
+ * @returns {GeneratedSourceInfo} generated source info
1403
+ */
1404
+ streamChunks(options, onChunk, onSource, onName) {
1405
+ let strValue = this._valueAsString;
1406
+ if (strValue === undefined) {
1407
+ const value = this.source();
1408
+ strValue = typeof value === "string" ? value : value.toString("utf8");
1409
+ if (isDualStringBufferCachingEnabled()) {
1410
+ this._valueAsString = internString(strValue);
1411
+ }
1412
+ }
1413
+ return streamChunksOfRawSource(
1414
+ strValue,
1415
+ onChunk,
1416
+ onSource,
1417
+ onName,
1418
+ Boolean(options && options.finalSource),
1419
+ );
1420
+ }
1421
+
1422
+ /**
1423
+ * @param {HashLike} hash hash
1424
+ * @returns {void}
1425
+ */
1426
+ updateHash(hash) {
1427
+ hash.update("RawSource");
1428
+ hash.update(this.buffer());
1429
+ }
1430
+ }
1431
+
1432
+ module.exports = RawSource;
1433
+
1434
+
1435
+ /***/ }),
1436
+
1437
+ /***/ 902:
1438
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1439
+
1440
+ /*
1441
+ MIT License http://www.opensource.org/licenses/mit-license.php
1442
+ Author Tobias Koppers @sokra
1443
+ */
1444
+
1445
+
1446
+
1447
+ const Source = __nccwpck_require__(422);
1448
+ const { getMap, getSourceAndMap } = __nccwpck_require__(875);
1449
+ const splitIntoLines = __nccwpck_require__(492);
1450
+ const streamChunks = __nccwpck_require__(779);
1451
+
1452
+ /** @typedef {import("./Source").HashLike} HashLike */
1453
+ /** @typedef {import("./Source").MapOptions} MapOptions */
1454
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
1455
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
1456
+ /** @typedef {import("./Source").SourceValue} SourceValue */
1457
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
1458
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
1459
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
1460
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
1461
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
1462
+
1463
+ // since v8 7.0, Array.prototype.sort is stable
1464
+ const hasStableSort =
1465
+ typeof process === "object" &&
1466
+ process.versions &&
1467
+ typeof process.versions.v8 === "string" &&
1468
+ !/^[0-6]\./.test(process.versions.v8);
1469
+
1470
+ // This is larger than max string length
1471
+ const MAX_SOURCE_POSITION = 0x20000000;
1472
+
1473
+ class Replacement {
1474
+ /**
1475
+ * @param {number} start start
1476
+ * @param {number} end end
1477
+ * @param {string} content content
1478
+ * @param {string=} name name
1479
+ */
1480
+ constructor(start, end, content, name) {
1481
+ this.start = start;
1482
+ this.end = end;
1483
+ this.content = content;
1484
+ this.name = name;
1485
+ if (!hasStableSort) {
1486
+ this.index = -1;
1487
+ }
1488
+ }
1489
+ }
1490
+
1491
+ class ReplaceSource extends Source {
1492
+ /**
1493
+ * @param {Source} source source
1494
+ * @param {string=} name name
1495
+ */
1496
+ constructor(source, name) {
1497
+ super();
1498
+ this._source = source;
1499
+ this._name = name;
1500
+ /** @type {Replacement[]} */
1501
+ this._replacements = [];
1502
+ this._isSorted = true;
1503
+ }
1504
+
1505
+ getName() {
1506
+ return this._name;
1507
+ }
1508
+
1509
+ getReplacements() {
1510
+ this._sortReplacements();
1511
+ return this._replacements;
1512
+ }
1513
+
1514
+ /**
1515
+ * @param {number} start start
1516
+ * @param {number} end end
1517
+ * @param {string} newValue new value
1518
+ * @param {string=} name name
1519
+ * @returns {void}
1520
+ */
1521
+ replace(start, end, newValue, name) {
1522
+ if (typeof newValue !== "string") {
1523
+ throw new Error(
1524
+ `insertion must be a string, but is a ${typeof newValue}`,
1525
+ );
1526
+ }
1527
+ this._replacements.push(new Replacement(start, end, newValue, name));
1528
+ this._isSorted = false;
1529
+ }
1530
+
1531
+ /**
1532
+ * @param {number} pos pos
1533
+ * @param {string} newValue new value
1534
+ * @param {string=} name name
1535
+ * @returns {void}
1536
+ */
1537
+ insert(pos, newValue, name) {
1538
+ if (typeof newValue !== "string") {
1539
+ throw new Error(
1540
+ `insertion must be a string, but is a ${typeof newValue}: ${newValue}`,
1541
+ );
1542
+ }
1543
+ this._replacements.push(new Replacement(pos, pos - 1, newValue, name));
1544
+ this._isSorted = false;
1545
+ }
1546
+
1547
+ /**
1548
+ * @returns {SourceValue} source
1549
+ */
1550
+ source() {
1551
+ if (this._replacements.length === 0) {
1552
+ return this._source.source();
1553
+ }
1554
+ let current = this._source.source();
1555
+ let pos = 0;
1556
+ const result = [];
1557
+
1558
+ this._sortReplacements();
1559
+ for (const replacement of this._replacements) {
1560
+ const start = Math.floor(replacement.start);
1561
+ const end = Math.floor(replacement.end + 1);
1562
+ if (pos < start) {
1563
+ const offset = start - pos;
1564
+ result.push(current.slice(0, offset));
1565
+ current = current.slice(offset);
1566
+ pos = start;
1567
+ }
1568
+ result.push(replacement.content);
1569
+ if (pos < end) {
1570
+ const offset = end - pos;
1571
+ current = current.slice(offset);
1572
+ pos = end;
1573
+ }
1574
+ }
1575
+ result.push(current);
1576
+ return result.join("");
1577
+ }
1578
+
1579
+ /**
1580
+ * @param {MapOptions=} options map options
1581
+ * @returns {RawSourceMap | null} map
1582
+ */
1583
+ map(options) {
1584
+ if (this._replacements.length === 0) {
1585
+ return this._source.map(options);
1586
+ }
1587
+ return getMap(this, options);
1588
+ }
1589
+
1590
+ /**
1591
+ * @param {MapOptions=} options map options
1592
+ * @returns {SourceAndMap} source and map
1593
+ */
1594
+ sourceAndMap(options) {
1595
+ if (this._replacements.length === 0) {
1596
+ return this._source.sourceAndMap(options);
1597
+ }
1598
+ return getSourceAndMap(this, options);
1599
+ }
1600
+
1601
+ original() {
1602
+ return this._source;
1603
+ }
1604
+
1605
+ _sortReplacements() {
1606
+ if (this._isSorted) return;
1607
+ if (hasStableSort) {
1608
+ this._replacements.sort((a, b) => {
1609
+ const diff1 = a.start - b.start;
1610
+ if (diff1 !== 0) return diff1;
1611
+ const diff2 = a.end - b.end;
1612
+ if (diff2 !== 0) return diff2;
1613
+ return 0;
1614
+ });
1615
+ } else {
1616
+ for (const [i, repl] of this._replacements.entries()) repl.index = i;
1617
+ this._replacements.sort((a, b) => {
1618
+ const diff1 = a.start - b.start;
1619
+ if (diff1 !== 0) return diff1;
1620
+ const diff2 = a.end - b.end;
1621
+ if (diff2 !== 0) return diff2;
1622
+ return (
1623
+ /** @type {number} */ (a.index) - /** @type {number} */ (b.index)
1624
+ );
1625
+ });
1626
+ }
1627
+ this._isSorted = true;
1628
+ }
1629
+
1630
+ /**
1631
+ * @param {Options} options options
1632
+ * @param {OnChunk} onChunk called for each chunk of code
1633
+ * @param {OnSource} onSource called for each source
1634
+ * @param {OnName} onName called for each name
1635
+ * @returns {GeneratedSourceInfo} generated source info
1636
+ */
1637
+ streamChunks(options, onChunk, onSource, onName) {
1638
+ this._sortReplacements();
1639
+ const replacements = this._replacements;
1640
+ let pos = 0;
1641
+ let i = 0;
1642
+ let replacementEnd = -1;
1643
+ let nextReplacement =
1644
+ i < replacements.length
1645
+ ? Math.floor(replacements[i].start)
1646
+ : MAX_SOURCE_POSITION;
1647
+ let generatedLineOffset = 0;
1648
+ let generatedColumnOffset = 0;
1649
+ let generatedColumnOffsetLine = 0;
1650
+ /** @type {(string | string[] | undefined)[]} */
1651
+ const sourceContents = [];
1652
+ /** @type {Map<string, number>} */
1653
+ const nameMapping = new Map();
1654
+ /** @type {number[]} */
1655
+ const nameIndexMapping = [];
1656
+ /**
1657
+ * @param {number} sourceIndex source index
1658
+ * @param {number} line line
1659
+ * @param {number} column column
1660
+ * @param {string} expectedChunk expected chunk
1661
+ * @returns {boolean} result
1662
+ */
1663
+ const checkOriginalContent = (sourceIndex, line, column, expectedChunk) => {
1664
+ /** @type {undefined | string | string[]} */
1665
+ let content =
1666
+ sourceIndex < sourceContents.length
1667
+ ? sourceContents[sourceIndex]
1668
+ : undefined;
1669
+ if (content === undefined) return false;
1670
+ if (typeof content === "string") {
1671
+ content = splitIntoLines(content);
1672
+ sourceContents[sourceIndex] = content;
1673
+ }
1674
+ const contentLine = line <= content.length ? content[line - 1] : null;
1675
+ if (contentLine === null) return false;
1676
+ return (
1677
+ contentLine.slice(column, column + expectedChunk.length) ===
1678
+ expectedChunk
1679
+ );
1680
+ };
1681
+ const { generatedLine, generatedColumn } = streamChunks(
1682
+ this._source,
1683
+ { ...options, finalSource: false },
1684
+ (
1685
+ _chunk,
1686
+ generatedLine,
1687
+ generatedColumn,
1688
+ sourceIndex,
1689
+ originalLine,
1690
+ originalColumn,
1691
+ nameIndex,
1692
+ ) => {
1693
+ let chunkPos = 0;
1694
+ const chunk = /** @type {string} */ (_chunk);
1695
+ const endPos = pos + chunk.length;
1696
+
1697
+ // Skip over when it has been replaced
1698
+ if (replacementEnd > pos) {
1699
+ // Skip over the whole chunk
1700
+ if (replacementEnd >= endPos) {
1701
+ const line = generatedLine + generatedLineOffset;
1702
+ if (chunk.endsWith("\n")) {
1703
+ generatedLineOffset--;
1704
+ if (generatedColumnOffsetLine === line) {
1705
+ // undo exiting corrections form the current line
1706
+ generatedColumnOffset += generatedColumn;
1707
+ }
1708
+ } else if (generatedColumnOffsetLine === line) {
1709
+ generatedColumnOffset -= chunk.length;
1710
+ } else {
1711
+ generatedColumnOffset = -chunk.length;
1712
+ generatedColumnOffsetLine = line;
1713
+ }
1714
+ pos = endPos;
1715
+ return;
1716
+ }
1717
+
1718
+ // Partially skip over chunk
1719
+ chunkPos = replacementEnd - pos;
1720
+ if (
1721
+ checkOriginalContent(
1722
+ sourceIndex,
1723
+ originalLine,
1724
+ originalColumn,
1725
+ chunk.slice(0, chunkPos),
1726
+ )
1727
+ ) {
1728
+ originalColumn += chunkPos;
1729
+ }
1730
+ pos += chunkPos;
1731
+ const line = generatedLine + generatedLineOffset;
1732
+ if (generatedColumnOffsetLine === line) {
1733
+ generatedColumnOffset -= chunkPos;
1734
+ } else {
1735
+ generatedColumnOffset = -chunkPos;
1736
+ generatedColumnOffsetLine = line;
1737
+ }
1738
+ generatedColumn += chunkPos;
1739
+ }
1740
+
1741
+ // Is a replacement in the chunk?
1742
+ if (nextReplacement < endPos) {
1743
+ do {
1744
+ let line = generatedLine + generatedLineOffset;
1745
+ if (nextReplacement > pos) {
1746
+ // Emit chunk until replacement
1747
+ const offset = nextReplacement - pos;
1748
+ const chunkSlice = chunk.slice(chunkPos, chunkPos + offset);
1749
+ onChunk(
1750
+ chunkSlice,
1751
+ line,
1752
+ generatedColumn +
1753
+ (line === generatedColumnOffsetLine
1754
+ ? generatedColumnOffset
1755
+ : 0),
1756
+ sourceIndex,
1757
+ originalLine,
1758
+ originalColumn,
1759
+ nameIndex < 0 || nameIndex >= nameIndexMapping.length
1760
+ ? -1
1761
+ : nameIndexMapping[nameIndex],
1762
+ );
1763
+ generatedColumn += offset;
1764
+ chunkPos += offset;
1765
+ pos = nextReplacement;
1766
+ if (
1767
+ checkOriginalContent(
1768
+ sourceIndex,
1769
+ originalLine,
1770
+ originalColumn,
1771
+ chunkSlice,
1772
+ )
1773
+ ) {
1774
+ originalColumn += chunkSlice.length;
1775
+ }
1776
+ }
1777
+
1778
+ // Insert replacement content splitted into chunks by lines
1779
+ const { content, name } = replacements[i];
1780
+ const matches = splitIntoLines(content);
1781
+ let replacementNameIndex = nameIndex;
1782
+ if (sourceIndex >= 0 && name) {
1783
+ let globalIndex = nameMapping.get(name);
1784
+ if (globalIndex === undefined) {
1785
+ globalIndex = nameMapping.size;
1786
+ nameMapping.set(name, globalIndex);
1787
+ onName(globalIndex, name);
1788
+ }
1789
+ replacementNameIndex = globalIndex;
1790
+ }
1791
+ for (let m = 0; m < matches.length; m++) {
1792
+ const contentLine = matches[m];
1793
+ onChunk(
1794
+ contentLine,
1795
+ line,
1796
+ generatedColumn +
1797
+ (line === generatedColumnOffsetLine
1798
+ ? generatedColumnOffset
1799
+ : 0),
1800
+ sourceIndex,
1801
+ originalLine,
1802
+ originalColumn,
1803
+ replacementNameIndex,
1804
+ );
1805
+
1806
+ // Only the first chunk has name assigned
1807
+ replacementNameIndex = -1;
1808
+
1809
+ if (m === matches.length - 1 && !contentLine.endsWith("\n")) {
1810
+ if (generatedColumnOffsetLine === line) {
1811
+ generatedColumnOffset += contentLine.length;
1812
+ } else {
1813
+ generatedColumnOffset = contentLine.length;
1814
+ generatedColumnOffsetLine = line;
1815
+ }
1816
+ } else {
1817
+ generatedLineOffset++;
1818
+ line++;
1819
+ generatedColumnOffset = -generatedColumn;
1820
+ generatedColumnOffsetLine = line;
1821
+ }
1822
+ }
1823
+
1824
+ // Remove replaced content by settings this variable
1825
+ replacementEnd = Math.max(
1826
+ replacementEnd,
1827
+ Math.floor(replacements[i].end + 1),
1828
+ );
1829
+
1830
+ // Move to next replacement
1831
+ i++;
1832
+ nextReplacement =
1833
+ i < replacements.length
1834
+ ? Math.floor(replacements[i].start)
1835
+ : MAX_SOURCE_POSITION;
1836
+
1837
+ // Skip over when it has been replaced
1838
+ const offset = chunk.length - endPos + replacementEnd - chunkPos;
1839
+ if (offset > 0) {
1840
+ // Skip over whole chunk
1841
+ if (replacementEnd >= endPos) {
1842
+ const line = generatedLine + generatedLineOffset;
1843
+ if (chunk.endsWith("\n")) {
1844
+ generatedLineOffset--;
1845
+ if (generatedColumnOffsetLine === line) {
1846
+ // undo exiting corrections form the current line
1847
+ generatedColumnOffset += generatedColumn;
1848
+ }
1849
+ } else if (generatedColumnOffsetLine === line) {
1850
+ generatedColumnOffset -= chunk.length - chunkPos;
1851
+ } else {
1852
+ generatedColumnOffset = chunkPos - chunk.length;
1853
+ generatedColumnOffsetLine = line;
1854
+ }
1855
+ pos = endPos;
1856
+ return;
1857
+ }
1858
+
1859
+ // Partially skip over chunk
1860
+ const line = generatedLine + generatedLineOffset;
1861
+ if (
1862
+ checkOriginalContent(
1863
+ sourceIndex,
1864
+ originalLine,
1865
+ originalColumn,
1866
+ chunk.slice(chunkPos, chunkPos + offset),
1867
+ )
1868
+ ) {
1869
+ originalColumn += offset;
1870
+ }
1871
+ chunkPos += offset;
1872
+ pos += offset;
1873
+ if (generatedColumnOffsetLine === line) {
1874
+ generatedColumnOffset -= offset;
1875
+ } else {
1876
+ generatedColumnOffset = -offset;
1877
+ generatedColumnOffsetLine = line;
1878
+ }
1879
+ generatedColumn += offset;
1880
+ }
1881
+ } while (nextReplacement < endPos);
1882
+ }
1883
+
1884
+ // Emit remaining chunk
1885
+ if (chunkPos < chunk.length) {
1886
+ const chunkSlice = chunkPos === 0 ? chunk : chunk.slice(chunkPos);
1887
+ const line = generatedLine + generatedLineOffset;
1888
+ onChunk(
1889
+ chunkSlice,
1890
+ line,
1891
+ generatedColumn +
1892
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
1893
+ sourceIndex,
1894
+ originalLine,
1895
+ originalColumn,
1896
+ nameIndex < 0 ? -1 : nameIndexMapping[nameIndex],
1897
+ );
1898
+ }
1899
+ pos = endPos;
1900
+ },
1901
+ (sourceIndex, source, sourceContent) => {
1902
+ while (sourceContents.length < sourceIndex) {
1903
+ sourceContents.push(undefined);
1904
+ }
1905
+ sourceContents[sourceIndex] = sourceContent;
1906
+ onSource(sourceIndex, source, sourceContent);
1907
+ },
1908
+ (nameIndex, name) => {
1909
+ let globalIndex = nameMapping.get(name);
1910
+ if (globalIndex === undefined) {
1911
+ globalIndex = nameMapping.size;
1912
+ nameMapping.set(name, globalIndex);
1913
+ onName(globalIndex, name);
1914
+ }
1915
+ nameIndexMapping[nameIndex] = globalIndex;
1916
+ },
1917
+ );
1918
+
1919
+ // Handle remaining replacements
1920
+ let remainer = "";
1921
+ for (; i < replacements.length; i++) {
1922
+ remainer += replacements[i].content;
1923
+ }
1924
+
1925
+ // Insert remaining replacements content splitted into chunks by lines
1926
+ let line = /** @type {number} */ (generatedLine) + generatedLineOffset;
1927
+ const matches = splitIntoLines(remainer);
1928
+ for (let m = 0; m < matches.length; m++) {
1929
+ const contentLine = matches[m];
1930
+ onChunk(
1931
+ contentLine,
1932
+ line,
1933
+ /** @type {number} */
1934
+ (generatedColumn) +
1935
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
1936
+ -1,
1937
+ -1,
1938
+ -1,
1939
+ -1,
1940
+ );
1941
+
1942
+ if (m === matches.length - 1 && !contentLine.endsWith("\n")) {
1943
+ if (generatedColumnOffsetLine === line) {
1944
+ generatedColumnOffset += contentLine.length;
1945
+ } else {
1946
+ generatedColumnOffset = contentLine.length;
1947
+ generatedColumnOffsetLine = line;
1948
+ }
1949
+ } else {
1950
+ generatedLineOffset++;
1951
+ line++;
1952
+ generatedColumnOffset = -(/** @type {number} */ (generatedColumn));
1953
+ generatedColumnOffsetLine = line;
1954
+ }
1955
+ }
1956
+
1957
+ return {
1958
+ generatedLine: line,
1959
+ generatedColumn:
1960
+ /** @type {number} */
1961
+ (generatedColumn) +
1962
+ (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
1963
+ };
1964
+ }
1965
+
1966
+ /**
1967
+ * @param {HashLike} hash hash
1968
+ * @returns {void}
1969
+ */
1970
+ updateHash(hash) {
1971
+ this._sortReplacements();
1972
+ hash.update("ReplaceSource");
1973
+ this._source.updateHash(hash);
1974
+ hash.update(this._name || "");
1975
+ for (const repl of this._replacements) {
1976
+ hash.update(
1977
+ `${repl.start}${repl.end}${repl.content}${repl.name ? repl.name : ""}`,
1978
+ );
1979
+ }
1980
+ }
1981
+ }
1982
+
1983
+ module.exports = ReplaceSource;
1984
+ module.exports.Replacement = Replacement;
1985
+
1986
+
1987
+ /***/ }),
1988
+
1989
+ /***/ 865:
1990
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1991
+
1992
+ /*
1993
+ MIT License http://www.opensource.org/licenses/mit-license.php
1994
+ Author Tobias Koppers @sokra
1995
+ */
1996
+
1997
+
1998
+
1999
+ const Source = __nccwpck_require__(422);
2000
+
2001
+ /** @typedef {import("./Source").HashLike} HashLike */
2002
+ /** @typedef {import("./Source").MapOptions} MapOptions */
2003
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
2004
+ /** @typedef {import("./Source").SourceValue} SourceValue */
2005
+
2006
+ class SizeOnlySource extends Source {
2007
+ /**
2008
+ * @param {number} size size
2009
+ */
2010
+ constructor(size) {
2011
+ super();
2012
+ this._size = size;
2013
+ }
2014
+
2015
+ _error() {
2016
+ return new Error(
2017
+ "Content and Map of this Source is not available (only size() is supported)",
2018
+ );
2019
+ }
2020
+
2021
+ size() {
2022
+ return this._size;
2023
+ }
2024
+
2025
+ /**
2026
+ * @returns {SourceValue} source
2027
+ */
2028
+ source() {
2029
+ throw this._error();
2030
+ }
2031
+
2032
+ /**
2033
+ * @returns {Buffer} buffer
2034
+ */
2035
+ buffer() {
2036
+ throw this._error();
2037
+ }
2038
+
2039
+ /**
2040
+ * @param {MapOptions=} options map options
2041
+ * @returns {RawSourceMap | null} map
2042
+ */
2043
+ // eslint-disable-next-line no-unused-vars
2044
+ map(options) {
2045
+ throw this._error();
2046
+ }
2047
+
2048
+ /**
2049
+ * @param {HashLike} hash hash
2050
+ * @returns {void}
2051
+ */
2052
+ // eslint-disable-next-line no-unused-vars
2053
+ updateHash(hash) {
2054
+ throw this._error();
2055
+ }
2056
+ }
2057
+
2058
+ module.exports = SizeOnlySource;
2059
+
2060
+
2061
+ /***/ }),
2062
+
2063
+ /***/ 422:
2064
+ /***/ ((module) => {
2065
+
2066
+ /*
2067
+ MIT License http://www.opensource.org/licenses/mit-license.php
2068
+ Author Tobias Koppers @sokra
2069
+ */
2070
+
2071
+
2072
+
2073
+ /**
2074
+ * @typedef {object} MapOptions
2075
+ * @property {boolean=} columns need columns?
2076
+ * @property {boolean=} module is module
2077
+ */
2078
+
2079
+ /**
2080
+ * @typedef {object} RawSourceMap
2081
+ * @property {number} version version
2082
+ * @property {string[]} sources sources
2083
+ * @property {string[]} names names
2084
+ * @property {string=} sourceRoot source root
2085
+ * @property {string[]=} sourcesContent sources content
2086
+ * @property {string} mappings mappings
2087
+ * @property {string} file file
2088
+ * @property {string=} debugId debug id
2089
+ * @property {number[]=} ignoreList ignore list
2090
+ */
2091
+
2092
+ /** @typedef {string | Buffer} SourceValue */
2093
+
2094
+ /**
2095
+ * @typedef {object} SourceAndMap
2096
+ * @property {SourceValue} source source
2097
+ * @property {RawSourceMap | null} map map
2098
+ */
2099
+
2100
+ /**
2101
+ * @typedef {object} HashLike
2102
+ * @property {(data: string | Buffer, inputEncoding?: string) => HashLike} update make hash update
2103
+ * @property {(encoding?: string) => string | Buffer} digest get hash digest
2104
+ */
2105
+
2106
+ class Source {
2107
+ /**
2108
+ * @returns {SourceValue} source
2109
+ */
2110
+ source() {
2111
+ throw new Error("Abstract");
2112
+ }
2113
+
2114
+ buffer() {
2115
+ const source = this.source();
2116
+ if (Buffer.isBuffer(source)) return source;
2117
+ return Buffer.from(source, "utf8");
2118
+ }
2119
+
2120
+ size() {
2121
+ return this.buffer().length;
2122
+ }
2123
+
2124
+ /**
2125
+ * @param {MapOptions=} options map options
2126
+ * @returns {RawSourceMap | null} map
2127
+ */
2128
+ // eslint-disable-next-line no-unused-vars
2129
+ map(options) {
2130
+ return null;
2131
+ }
2132
+
2133
+ /**
2134
+ * @param {MapOptions=} options map options
2135
+ * @returns {SourceAndMap} source and map
2136
+ */
2137
+ sourceAndMap(options) {
2138
+ return {
2139
+ source: this.source(),
2140
+ map: this.map(options),
2141
+ };
2142
+ }
2143
+
2144
+ /**
2145
+ * @param {HashLike} hash hash
2146
+ * @returns {void}
2147
+ */
2148
+ // eslint-disable-next-line no-unused-vars
2149
+ updateHash(hash) {
2150
+ throw new Error("Abstract");
2151
+ }
2152
+ }
2153
+
2154
+ module.exports = Source;
2155
+
2156
+
2157
+ /***/ }),
2158
+
2159
+ /***/ 147:
2160
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
2161
+
2162
+ /*
2163
+ MIT License http://www.opensource.org/licenses/mit-license.php
2164
+ Author Tobias Koppers @sokra
2165
+ */
2166
+
2167
+
2168
+
2169
+ const Source = __nccwpck_require__(422);
2170
+ const { getMap, getSourceAndMap } = __nccwpck_require__(875);
2171
+ const streamChunksOfCombinedSourceMap = __nccwpck_require__(132);
2172
+ const streamChunksOfSourceMap = __nccwpck_require__(105);
2173
+ const {
2174
+ isDualStringBufferCachingEnabled,
2175
+ } = __nccwpck_require__(357);
2176
+
2177
+ /** @typedef {import("./Source").HashLike} HashLike */
2178
+ /** @typedef {import("./Source").MapOptions} MapOptions */
2179
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
2180
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
2181
+ /** @typedef {import("./Source").SourceValue} SourceValue */
2182
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
2183
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
2184
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
2185
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
2186
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
2187
+
2188
+ class SourceMapSource extends Source {
2189
+ /**
2190
+ * @param {string | Buffer} value value
2191
+ * @param {string} name name
2192
+ * @param {string | Buffer | RawSourceMap=} sourceMap source map
2193
+ * @param {SourceValue=} originalSource original source
2194
+ * @param {(string | Buffer | RawSourceMap)=} innerSourceMap inner source map
2195
+ * @param {boolean=} removeOriginalSource do remove original source
2196
+ */
2197
+ constructor(
2198
+ value,
2199
+ name,
2200
+ sourceMap,
2201
+ originalSource,
2202
+ innerSourceMap,
2203
+ removeOriginalSource,
2204
+ ) {
2205
+ super();
2206
+ const valueIsBuffer = Buffer.isBuffer(value);
2207
+ /**
2208
+ * @private
2209
+ * @type {undefined | string}
2210
+ */
2211
+ this._valueAsString = valueIsBuffer ? undefined : value;
2212
+ /**
2213
+ * @private
2214
+ * @type {undefined | Buffer}
2215
+ */
2216
+ this._valueAsBuffer = valueIsBuffer ? value : undefined;
2217
+
2218
+ this._name = name;
2219
+
2220
+ this._hasSourceMap = Boolean(sourceMap);
2221
+ const sourceMapIsBuffer = Buffer.isBuffer(sourceMap);
2222
+ const sourceMapIsString = typeof sourceMap === "string";
2223
+ /**
2224
+ * @private
2225
+ * @type {undefined | RawSourceMap}
2226
+ */
2227
+ this._sourceMapAsObject =
2228
+ sourceMapIsBuffer || sourceMapIsString ? undefined : sourceMap;
2229
+ /**
2230
+ * @private
2231
+ * @type {undefined | string}
2232
+ */
2233
+ this._sourceMapAsString = sourceMapIsString ? sourceMap : undefined;
2234
+ /**
2235
+ * @private
2236
+ * @type {undefined | Buffer}
2237
+ */
2238
+ this._sourceMapAsBuffer = sourceMapIsBuffer ? sourceMap : undefined;
2239
+
2240
+ this._hasOriginalSource = Boolean(originalSource);
2241
+ const originalSourceIsBuffer = Buffer.isBuffer(originalSource);
2242
+ this._originalSourceAsString = originalSourceIsBuffer
2243
+ ? undefined
2244
+ : originalSource;
2245
+ this._originalSourceAsBuffer = originalSourceIsBuffer
2246
+ ? originalSource
2247
+ : undefined;
2248
+
2249
+ this._hasInnerSourceMap = Boolean(innerSourceMap);
2250
+ const innerSourceMapIsBuffer = Buffer.isBuffer(innerSourceMap);
2251
+ const innerSourceMapIsString = typeof innerSourceMap === "string";
2252
+ /**
2253
+ * @private
2254
+ * @type {undefined | RawSourceMap}
2255
+ */
2256
+ this._innerSourceMapAsObject =
2257
+ innerSourceMapIsBuffer || innerSourceMapIsString
2258
+ ? undefined
2259
+ : innerSourceMap;
2260
+ /**
2261
+ * @private
2262
+ * @type {undefined | string}
2263
+ */
2264
+ this._innerSourceMapAsString = innerSourceMapIsString
2265
+ ? innerSourceMap
2266
+ : undefined;
2267
+ /**
2268
+ * @private
2269
+ * @type {undefined | Buffer}
2270
+ */
2271
+ this._innerSourceMapAsBuffer = innerSourceMapIsBuffer
2272
+ ? innerSourceMap
2273
+ : undefined;
2274
+
2275
+ this._removeOriginalSource = removeOriginalSource;
2276
+ }
2277
+
2278
+ /**
2279
+ * @returns {[Buffer, string, Buffer, Buffer | undefined, Buffer | undefined, boolean | undefined]} args
2280
+ */
2281
+ getArgsAsBuffers() {
2282
+ return [
2283
+ this.buffer(),
2284
+ this._name,
2285
+ this._sourceMapBuffer(),
2286
+ this._originalSourceBuffer(),
2287
+ this._innerSourceMapBuffer(),
2288
+ this._removeOriginalSource,
2289
+ ];
2290
+ }
2291
+
2292
+ buffer() {
2293
+ if (this._valueAsBuffer === undefined) {
2294
+ const value = Buffer.from(
2295
+ /** @type {string} */ (this._valueAsString),
2296
+ "utf8",
2297
+ );
2298
+ if (isDualStringBufferCachingEnabled()) {
2299
+ this._valueAsBuffer = value;
2300
+ }
2301
+ return value;
2302
+ }
2303
+ return this._valueAsBuffer;
2304
+ }
2305
+
2306
+ /**
2307
+ * @returns {SourceValue} source
2308
+ */
2309
+ source() {
2310
+ if (this._valueAsString === undefined) {
2311
+ const value =
2312
+ /** @type {Buffer} */
2313
+ (this._valueAsBuffer).toString("utf8");
2314
+ if (isDualStringBufferCachingEnabled()) {
2315
+ this._valueAsString = value;
2316
+ }
2317
+ return value;
2318
+ }
2319
+ return this._valueAsString;
2320
+ }
2321
+
2322
+ /**
2323
+ * @private
2324
+ * @returns {undefined | Buffer} buffer
2325
+ */
2326
+ _originalSourceBuffer() {
2327
+ if (this._originalSourceAsBuffer === undefined && this._hasOriginalSource) {
2328
+ const value = Buffer.from(
2329
+ /** @type {string} */
2330
+ (this._originalSourceAsString),
2331
+ "utf8",
2332
+ );
2333
+ if (isDualStringBufferCachingEnabled()) {
2334
+ this._originalSourceAsBuffer = value;
2335
+ }
2336
+ return value;
2337
+ }
2338
+ return this._originalSourceAsBuffer;
2339
+ }
2340
+
2341
+ _originalSourceString() {
2342
+ if (this._originalSourceAsString === undefined && this._hasOriginalSource) {
2343
+ const value =
2344
+ /** @type {Buffer} */
2345
+ (this._originalSourceAsBuffer).toString("utf8");
2346
+ if (isDualStringBufferCachingEnabled()) {
2347
+ this._originalSourceAsString = value;
2348
+ }
2349
+ return value;
2350
+ }
2351
+ return this._originalSourceAsString;
2352
+ }
2353
+
2354
+ _innerSourceMapObject() {
2355
+ if (this._innerSourceMapAsObject === undefined && this._hasInnerSourceMap) {
2356
+ const value = JSON.parse(this._innerSourceMapString());
2357
+ if (isDualStringBufferCachingEnabled()) {
2358
+ this._innerSourceMapAsObject = value;
2359
+ }
2360
+ return value;
2361
+ }
2362
+ return this._innerSourceMapAsObject;
2363
+ }
2364
+
2365
+ _innerSourceMapBuffer() {
2366
+ if (this._innerSourceMapAsBuffer === undefined && this._hasInnerSourceMap) {
2367
+ const value = Buffer.from(this._innerSourceMapString(), "utf8");
2368
+ if (isDualStringBufferCachingEnabled()) {
2369
+ this._innerSourceMapAsBuffer = value;
2370
+ }
2371
+ return value;
2372
+ }
2373
+ return this._innerSourceMapAsBuffer;
2374
+ }
2375
+
2376
+ /**
2377
+ * @private
2378
+ * @returns {string} result
2379
+ */
2380
+ _innerSourceMapString() {
2381
+ if (this._innerSourceMapAsString === undefined && this._hasInnerSourceMap) {
2382
+ if (this._innerSourceMapAsBuffer !== undefined) {
2383
+ const value = this._innerSourceMapAsBuffer.toString("utf8");
2384
+ if (isDualStringBufferCachingEnabled()) {
2385
+ this._innerSourceMapAsString = value;
2386
+ }
2387
+ return value;
2388
+ }
2389
+ const value = JSON.stringify(this._innerSourceMapAsObject);
2390
+ if (isDualStringBufferCachingEnabled()) {
2391
+ this._innerSourceMapAsString = value;
2392
+ }
2393
+ return value;
2394
+ }
2395
+ return /** @type {string} */ (this._innerSourceMapAsString);
2396
+ }
2397
+
2398
+ _sourceMapObject() {
2399
+ if (this._sourceMapAsObject === undefined) {
2400
+ const value = JSON.parse(this._sourceMapString());
2401
+ if (isDualStringBufferCachingEnabled()) {
2402
+ this._sourceMapAsObject = value;
2403
+ }
2404
+ return value;
2405
+ }
2406
+ return this._sourceMapAsObject;
2407
+ }
2408
+
2409
+ _sourceMapBuffer() {
2410
+ if (this._sourceMapAsBuffer === undefined) {
2411
+ const value = Buffer.from(this._sourceMapString(), "utf8");
2412
+ if (isDualStringBufferCachingEnabled()) {
2413
+ this._sourceMapAsBuffer = value;
2414
+ }
2415
+ return value;
2416
+ }
2417
+ return this._sourceMapAsBuffer;
2418
+ }
2419
+
2420
+ _sourceMapString() {
2421
+ if (this._sourceMapAsString === undefined) {
2422
+ if (this._sourceMapAsBuffer !== undefined) {
2423
+ const value = this._sourceMapAsBuffer.toString("utf8");
2424
+ if (isDualStringBufferCachingEnabled()) {
2425
+ this._sourceMapAsString = value;
2426
+ }
2427
+ return value;
2428
+ }
2429
+ const value = JSON.stringify(this._sourceMapAsObject);
2430
+ if (isDualStringBufferCachingEnabled()) {
2431
+ this._sourceMapAsString = value;
2432
+ }
2433
+ return value;
2434
+ }
2435
+ return this._sourceMapAsString;
2436
+ }
2437
+
2438
+ /**
2439
+ * @param {MapOptions=} options map options
2440
+ * @returns {RawSourceMap | null} map
2441
+ */
2442
+ map(options) {
2443
+ if (!this._hasInnerSourceMap) {
2444
+ return this._sourceMapObject();
2445
+ }
2446
+ return getMap(this, options);
2447
+ }
2448
+
2449
+ /**
2450
+ * @param {MapOptions=} options map options
2451
+ * @returns {SourceAndMap} source and map
2452
+ */
2453
+ sourceAndMap(options) {
2454
+ if (!this._hasInnerSourceMap) {
2455
+ return {
2456
+ source: this.source(),
2457
+ map: this._sourceMapObject(),
2458
+ };
2459
+ }
2460
+ return getSourceAndMap(this, options);
2461
+ }
2462
+
2463
+ /**
2464
+ * @param {Options} options options
2465
+ * @param {OnChunk} onChunk called for each chunk of code
2466
+ * @param {OnSource} onSource called for each source
2467
+ * @param {OnName} onName called for each name
2468
+ * @returns {GeneratedSourceInfo} generated source info
2469
+ */
2470
+ streamChunks(options, onChunk, onSource, onName) {
2471
+ if (this._hasInnerSourceMap) {
2472
+ return streamChunksOfCombinedSourceMap(
2473
+ /** @type {string} */
2474
+ (this.source()),
2475
+ this._sourceMapObject(),
2476
+ this._name,
2477
+ /** @type {string} */
2478
+ (this._originalSourceString()),
2479
+ this._innerSourceMapObject(),
2480
+ this._removeOriginalSource,
2481
+ onChunk,
2482
+ onSource,
2483
+ onName,
2484
+ Boolean(options && options.finalSource),
2485
+ Boolean(options && options.columns !== false),
2486
+ );
2487
+ }
2488
+ return streamChunksOfSourceMap(
2489
+ /** @type {string} */
2490
+ (this.source()),
2491
+ this._sourceMapObject(),
2492
+ onChunk,
2493
+ onSource,
2494
+ onName,
2495
+ Boolean(options && options.finalSource),
2496
+ Boolean(options && options.columns !== false),
2497
+ );
2498
+ }
2499
+
2500
+ /**
2501
+ * @param {HashLike} hash hash
2502
+ * @returns {void}
2503
+ */
2504
+ updateHash(hash) {
2505
+ hash.update("SourceMapSource");
2506
+ hash.update(this.buffer());
2507
+ hash.update(this._sourceMapBuffer());
2508
+
2509
+ if (this._hasOriginalSource) {
2510
+ hash.update(
2511
+ /** @type {Buffer} */
2512
+ (this._originalSourceBuffer()),
2513
+ );
2514
+ }
2515
+
2516
+ if (this._hasInnerSourceMap) {
2517
+ hash.update(
2518
+ /** @type {Buffer} */
2519
+ (this._innerSourceMapBuffer()),
2520
+ );
2521
+ }
2522
+
2523
+ hash.update(this._removeOriginalSource ? "true" : "false");
2524
+ }
2525
+ }
2526
+
2527
+ module.exports = SourceMapSource;
2528
+
2529
+
2530
+ /***/ }),
2531
+
2532
+ /***/ 294:
2533
+ /***/ ((module) => {
2534
+
2535
+ /*
2536
+ MIT License http://www.opensource.org/licenses/mit-license.php
2537
+ Author Tobias Koppers @sokra
2538
+ */
2539
+
2540
+
2541
+
2542
+ /**
2543
+ * @callback MappingsSerializer
2544
+ * @param {number} generatedLine generated line
2545
+ * @param {number} generatedColumn generated column
2546
+ * @param {number} sourceIndex source index
2547
+ * @param {number} originalLine original line
2548
+ * @param {number} originalColumn generated line
2549
+ * @param {number} nameIndex generated line
2550
+ * @returns {string} result
2551
+ */
2552
+
2553
+ const ALPHABET = [
2554
+ ..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
2555
+ ];
2556
+
2557
+ const CONTINUATION_BIT = 0x20;
2558
+
2559
+ const createFullMappingsSerializer = () => {
2560
+ let currentLine = 1;
2561
+ let currentColumn = 0;
2562
+ let currentSourceIndex = 0;
2563
+ let currentOriginalLine = 1;
2564
+ let currentOriginalColumn = 0;
2565
+ let currentNameIndex = 0;
2566
+ let activeMapping = false;
2567
+ let activeName = false;
2568
+ let initial = true;
2569
+ /** @type {MappingsSerializer} */
2570
+ return (
2571
+ generatedLine,
2572
+ generatedColumn,
2573
+ sourceIndex,
2574
+ originalLine,
2575
+ originalColumn,
2576
+ nameIndex,
2577
+ ) => {
2578
+ if (activeMapping && currentLine === generatedLine) {
2579
+ // A mapping is still active
2580
+ if (
2581
+ sourceIndex === currentSourceIndex &&
2582
+ originalLine === currentOriginalLine &&
2583
+ originalColumn === currentOriginalColumn &&
2584
+ !activeName &&
2585
+ nameIndex < 0
2586
+ ) {
2587
+ // avoid repeating the same original mapping
2588
+ return "";
2589
+ }
2590
+ }
2591
+ // No mapping is active
2592
+ else if (sourceIndex < 0) {
2593
+ // avoid writing unneccessary generated mappings
2594
+ return "";
2595
+ }
2596
+
2597
+ /** @type {undefined | string} */
2598
+ let str;
2599
+ if (currentLine < generatedLine) {
2600
+ str = ";".repeat(generatedLine - currentLine);
2601
+ currentLine = generatedLine;
2602
+ currentColumn = 0;
2603
+ initial = false;
2604
+ } else if (initial) {
2605
+ str = "";
2606
+ initial = false;
2607
+ } else {
2608
+ str = ",";
2609
+ }
2610
+
2611
+ /**
2612
+ * @param {number} value value
2613
+ * @returns {void}
2614
+ */
2615
+ const writeValue = (value) => {
2616
+ const sign = (value >>> 31) & 1;
2617
+ const mask = value >> 31;
2618
+ const absValue = (value + mask) ^ mask;
2619
+ let data = (absValue << 1) | sign;
2620
+ for (;;) {
2621
+ const sextet = data & 0x1f;
2622
+ data >>= 5;
2623
+ if (data === 0) {
2624
+ str += ALPHABET[sextet];
2625
+ break;
2626
+ } else {
2627
+ str += ALPHABET[sextet | CONTINUATION_BIT];
2628
+ }
2629
+ }
2630
+ };
2631
+ writeValue(generatedColumn - currentColumn);
2632
+ currentColumn = generatedColumn;
2633
+ if (sourceIndex >= 0) {
2634
+ activeMapping = true;
2635
+ if (sourceIndex === currentSourceIndex) {
2636
+ str += "A";
2637
+ } else {
2638
+ writeValue(sourceIndex - currentSourceIndex);
2639
+ currentSourceIndex = sourceIndex;
2640
+ }
2641
+ writeValue(originalLine - currentOriginalLine);
2642
+ currentOriginalLine = originalLine;
2643
+ if (originalColumn === currentOriginalColumn) {
2644
+ str += "A";
2645
+ } else {
2646
+ writeValue(originalColumn - currentOriginalColumn);
2647
+ currentOriginalColumn = originalColumn;
2648
+ }
2649
+ if (nameIndex >= 0) {
2650
+ writeValue(nameIndex - currentNameIndex);
2651
+ currentNameIndex = nameIndex;
2652
+ activeName = true;
2653
+ } else {
2654
+ activeName = false;
2655
+ }
2656
+ } else {
2657
+ activeMapping = false;
2658
+ }
2659
+ return str;
2660
+ };
2661
+ };
2662
+
2663
+ const createLinesOnlyMappingsSerializer = () => {
2664
+ let lastWrittenLine = 0;
2665
+ let currentLine = 1;
2666
+ let currentSourceIndex = 0;
2667
+ let currentOriginalLine = 1;
2668
+ /** @type {MappingsSerializer} */
2669
+ return (
2670
+ generatedLine,
2671
+ _generatedColumn,
2672
+ sourceIndex,
2673
+ originalLine,
2674
+ _originalColumn,
2675
+ _nameIndex,
2676
+ ) => {
2677
+ if (sourceIndex < 0) {
2678
+ // avoid writing generated mappings at all
2679
+ return "";
2680
+ }
2681
+ if (lastWrittenLine === generatedLine) {
2682
+ // avoid writing multiple original mappings per line
2683
+ return "";
2684
+ }
2685
+ /** @type {undefined | string} */
2686
+ let str;
2687
+ /**
2688
+ * @param {number} value value
2689
+ * @returns {void}
2690
+ */
2691
+ const writeValue = (value) => {
2692
+ const sign = (value >>> 31) & 1;
2693
+ const mask = value >> 31;
2694
+ const absValue = (value + mask) ^ mask;
2695
+ let data = (absValue << 1) | sign;
2696
+ for (;;) {
2697
+ const sextet = data & 0x1f;
2698
+ data >>= 5;
2699
+ if (data === 0) {
2700
+ str += ALPHABET[sextet];
2701
+ break;
2702
+ } else {
2703
+ str += ALPHABET[sextet | CONTINUATION_BIT];
2704
+ }
2705
+ }
2706
+ };
2707
+ lastWrittenLine = generatedLine;
2708
+ if (generatedLine === currentLine + 1) {
2709
+ currentLine = generatedLine;
2710
+ if (sourceIndex === currentSourceIndex) {
2711
+ if (originalLine === currentOriginalLine + 1) {
2712
+ currentOriginalLine = originalLine;
2713
+ return ";AACA";
2714
+ }
2715
+ str = ";AA";
2716
+ writeValue(originalLine - currentOriginalLine);
2717
+ currentOriginalLine = originalLine;
2718
+ return `${str}A`;
2719
+ }
2720
+ str = ";A";
2721
+ writeValue(sourceIndex - currentSourceIndex);
2722
+ currentSourceIndex = sourceIndex;
2723
+ writeValue(originalLine - currentOriginalLine);
2724
+ currentOriginalLine = originalLine;
2725
+ return `${str}A`;
2726
+ }
2727
+ str = ";".repeat(generatedLine - currentLine);
2728
+ currentLine = generatedLine;
2729
+ if (sourceIndex === currentSourceIndex) {
2730
+ if (originalLine === currentOriginalLine + 1) {
2731
+ currentOriginalLine = originalLine;
2732
+ return `${str}AACA`;
2733
+ }
2734
+ str += "AA";
2735
+ writeValue(originalLine - currentOriginalLine);
2736
+ currentOriginalLine = originalLine;
2737
+ return `${str}A`;
2738
+ }
2739
+ str += "A";
2740
+ writeValue(sourceIndex - currentSourceIndex);
2741
+ currentSourceIndex = sourceIndex;
2742
+ writeValue(originalLine - currentOriginalLine);
2743
+ currentOriginalLine = originalLine;
2744
+ return `${str}A`;
2745
+ };
2746
+ };
2747
+
2748
+ /**
2749
+ * @param {{ columns?: boolean }=} options options
2750
+ * @returns {MappingsSerializer} mappings serializer
2751
+ */
2752
+ const createMappingsSerializer = (options) => {
2753
+ const linesOnly = options && options.columns === false;
2754
+ return linesOnly
2755
+ ? createLinesOnlyMappingsSerializer()
2756
+ : createFullMappingsSerializer();
2757
+ };
2758
+
2759
+ module.exports = createMappingsSerializer;
2760
+
2761
+
2762
+ /***/ }),
2763
+
2764
+ /***/ 875:
2765
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
2766
+
2767
+ /*
2768
+ MIT License http://www.opensource.org/licenses/mit-license.php
2769
+ Author Tobias Koppers @sokra
2770
+ */
2771
+
2772
+
2773
+
2774
+ const createMappingsSerializer = __nccwpck_require__(294);
2775
+
2776
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
2777
+ /** @typedef {import("../Source").SourceAndMap} SourceAndMap */
2778
+ /** @typedef {import("./streamChunks").Options} Options */
2779
+ /** @typedef {import("./streamChunks").StreamChunksFunction} StreamChunksFunction */
2780
+
2781
+ /** @typedef {{ streamChunks: StreamChunksFunction }} SourceLikeWithStreamChunks */
2782
+
2783
+ /**
2784
+ * @param {SourceLikeWithStreamChunks} inputSource input source
2785
+ * @param {Options=} options options
2786
+ * @returns {SourceAndMap} map
2787
+ */
2788
+ module.exports.getSourceAndMap = (inputSource, options) => {
2789
+ let code = "";
2790
+ let mappings = "";
2791
+ /** @type {(string | null)[]} */
2792
+ const potentialSources = [];
2793
+ /** @type {(string | null)[]} */
2794
+ const potentialSourcesContent = [];
2795
+ /** @type {(string | null)[]} */
2796
+ const potentialNames = [];
2797
+ const addMapping = createMappingsSerializer(options);
2798
+ const { source } = inputSource.streamChunks(
2799
+ { ...options, finalSource: true },
2800
+ (
2801
+ chunk,
2802
+ generatedLine,
2803
+ generatedColumn,
2804
+ sourceIndex,
2805
+ originalLine,
2806
+ originalColumn,
2807
+ nameIndex,
2808
+ ) => {
2809
+ if (chunk !== undefined) code += chunk;
2810
+ mappings += addMapping(
2811
+ generatedLine,
2812
+ generatedColumn,
2813
+ sourceIndex,
2814
+ originalLine,
2815
+ originalColumn,
2816
+ nameIndex,
2817
+ );
2818
+ },
2819
+ (sourceIndex, source, sourceContent) => {
2820
+ while (potentialSources.length < sourceIndex) {
2821
+ potentialSources.push(null);
2822
+ }
2823
+ potentialSources[sourceIndex] = source;
2824
+ if (sourceContent !== undefined) {
2825
+ while (potentialSourcesContent.length < sourceIndex) {
2826
+ potentialSourcesContent.push(null);
2827
+ }
2828
+ potentialSourcesContent[sourceIndex] = sourceContent;
2829
+ }
2830
+ },
2831
+ (nameIndex, name) => {
2832
+ while (potentialNames.length < nameIndex) {
2833
+ potentialNames.push(null);
2834
+ }
2835
+ potentialNames[nameIndex] = name;
2836
+ },
2837
+ );
2838
+ return {
2839
+ source: source !== undefined ? source : code,
2840
+ map:
2841
+ mappings.length > 0
2842
+ ? {
2843
+ version: 3,
2844
+ file: "x",
2845
+ mappings,
2846
+ // We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change
2847
+ sources: /** @type {string[]} */ (potentialSources),
2848
+ sourcesContent:
2849
+ potentialSourcesContent.length > 0
2850
+ ? /** @type {string[]} */ (potentialSourcesContent)
2851
+ : undefined,
2852
+ names: /** @type {string[]} */ (potentialNames),
2853
+ }
2854
+ : null,
2855
+ };
2856
+ };
2857
+
2858
+ /**
2859
+ * @param {SourceLikeWithStreamChunks} source source
2860
+ * @param {Options=} options options
2861
+ * @returns {RawSourceMap | null} map
2862
+ */
2863
+ module.exports.getMap = (source, options) => {
2864
+ let mappings = "";
2865
+ /** @type {(string | null)[]} */
2866
+ const potentialSources = [];
2867
+ /** @type {(string | null)[]} */
2868
+ const potentialSourcesContent = [];
2869
+ /** @type {(string | null)[]} */
2870
+ const potentialNames = [];
2871
+ const addMapping = createMappingsSerializer(options);
2872
+ source.streamChunks(
2873
+ { ...options, source: false, finalSource: true },
2874
+ (
2875
+ chunk,
2876
+ generatedLine,
2877
+ generatedColumn,
2878
+ sourceIndex,
2879
+ originalLine,
2880
+ originalColumn,
2881
+ nameIndex,
2882
+ ) => {
2883
+ mappings += addMapping(
2884
+ generatedLine,
2885
+ generatedColumn,
2886
+ sourceIndex,
2887
+ originalLine,
2888
+ originalColumn,
2889
+ nameIndex,
2890
+ );
2891
+ },
2892
+ (sourceIndex, source, sourceContent) => {
2893
+ while (potentialSources.length < sourceIndex) {
2894
+ potentialSources.push(null);
2895
+ }
2896
+ potentialSources[sourceIndex] = source;
2897
+ if (sourceContent !== undefined) {
2898
+ while (potentialSourcesContent.length < sourceIndex) {
2899
+ potentialSourcesContent.push(null);
2900
+ }
2901
+ potentialSourcesContent[sourceIndex] = sourceContent;
2902
+ }
2903
+ },
2904
+ (nameIndex, name) => {
2905
+ while (potentialNames.length < nameIndex) {
2906
+ potentialNames.push(null);
2907
+ }
2908
+ potentialNames[nameIndex] = name;
2909
+ },
2910
+ );
2911
+ return mappings.length > 0
2912
+ ? {
2913
+ version: 3,
2914
+ file: "x",
2915
+ mappings,
2916
+ // We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change
2917
+ sources: /** @type {string[]} */ (potentialSources),
2918
+ sourcesContent:
2919
+ potentialSourcesContent.length > 0
2920
+ ? /** @type {string[]} */ (potentialSourcesContent)
2921
+ : undefined,
2922
+ names: /** @type {string[]} */ (potentialNames),
2923
+ }
2924
+ : null;
2925
+ };
2926
+
2927
+
2928
+ /***/ }),
2929
+
2930
+ /***/ 517:
2931
+ /***/ ((module) => {
2932
+
2933
+ /*
2934
+ MIT License http://www.opensource.org/licenses/mit-license.php
2935
+ Author Tobias Koppers @sokra
2936
+ */
2937
+
2938
+
2939
+
2940
+ const CHAR_CODE_NEW_LINE = "\n".charCodeAt(0);
2941
+
2942
+ /**
2943
+ * @typedef {object} GeneratedSourceInfo
2944
+ * @property {number=} generatedLine generated line
2945
+ * @property {number=} generatedColumn generated column
2946
+ * @property {string=} source source
2947
+ */
2948
+
2949
+ /**
2950
+ * @param {string | undefined} source source
2951
+ * @returns {GeneratedSourceInfo} source info
2952
+ */
2953
+ const getGeneratedSourceInfo = (source) => {
2954
+ if (source === undefined) {
2955
+ return {};
2956
+ }
2957
+ const lastLineStart = source.lastIndexOf("\n");
2958
+ if (lastLineStart === -1) {
2959
+ return {
2960
+ generatedLine: 1,
2961
+ generatedColumn: source.length,
2962
+ source,
2963
+ };
2964
+ }
2965
+ let generatedLine = 2;
2966
+ for (let i = 0; i < lastLineStart; i++) {
2967
+ if (source.charCodeAt(i) === CHAR_CODE_NEW_LINE) generatedLine++;
2968
+ }
2969
+ return {
2970
+ generatedLine,
2971
+ generatedColumn: source.length - lastLineStart - 1,
2972
+ source,
2973
+ };
2974
+ };
2975
+
2976
+ module.exports = getGeneratedSourceInfo;
2977
+
2978
+
2979
+ /***/ }),
2980
+
2981
+ /***/ 432:
2982
+ /***/ ((module) => {
2983
+
2984
+ /*
2985
+ MIT License http://www.opensource.org/licenses/mit-license.php
2986
+ Author Tobias Koppers @sokra
2987
+ */
2988
+
2989
+
2990
+
2991
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
2992
+
2993
+ /**
2994
+ * @param {RawSourceMap} sourceMap source map
2995
+ * @param {number} index index
2996
+ * @returns {string | null} name
2997
+ */
2998
+ const getSource = (sourceMap, index) => {
2999
+ if (index < 0) return null;
3000
+ const { sourceRoot, sources } = sourceMap;
3001
+ const source = sources[index];
3002
+ if (!sourceRoot) return source;
3003
+ if (sourceRoot.endsWith("/")) return sourceRoot + source;
3004
+ return `${sourceRoot}/${source}`;
3005
+ };
3006
+
3007
+ module.exports = getSource;
3008
+
3009
+
3010
+ /***/ }),
3011
+
3012
+ /***/ 950:
3013
+ /***/ ((module) => {
3014
+
3015
+ /*
3016
+ MIT License http://www.opensource.org/licenses/mit-license.php
3017
+ Author Tobias Koppers @sokra
3018
+ */
3019
+
3020
+
3021
+
3022
+ const ALPHABET =
3023
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
3024
+
3025
+ const CONTINUATION_BIT = 0x20;
3026
+ const END_SEGMENT_BIT = 0x40;
3027
+ const NEXT_LINE = END_SEGMENT_BIT | 0x01;
3028
+ const INVALID = END_SEGMENT_BIT | 0x02;
3029
+ const DATA_MASK = 0x1f;
3030
+
3031
+ const ccToValue = new Uint8Array("z".charCodeAt(0) + 1);
3032
+
3033
+ ccToValue.fill(INVALID);
3034
+
3035
+ for (let i = 0; i < ALPHABET.length; i++) {
3036
+ ccToValue[ALPHABET.charCodeAt(i)] = i;
3037
+ }
3038
+
3039
+ ccToValue[",".charCodeAt(0)] = END_SEGMENT_BIT;
3040
+ ccToValue[";".charCodeAt(0)] = NEXT_LINE;
3041
+
3042
+ const ccMax = ccToValue.length - 1;
3043
+
3044
+ /** @typedef {(generatedLine: number, generatedColumn: number, sourceIndex: number, originalLine: number, originalColumn: number, nameIndex: number) => void} OnMapping */
3045
+
3046
+ /**
3047
+ * @param {string} mappings the mappings string
3048
+ * @param {OnMapping} onMapping called for each mapping
3049
+ * @returns {void}
3050
+ */
3051
+ const readMappings = (mappings, onMapping) => {
3052
+ // generatedColumn, [sourceIndex, originalLine, orignalColumn, [nameIndex]]
3053
+ const currentData = new Uint32Array([0, 0, 1, 0, 0]);
3054
+ let currentDataPos = 0;
3055
+ // currentValue will include a sign bit at bit 0
3056
+ let currentValue = 0;
3057
+ let currentValuePos = 0;
3058
+ let generatedLine = 1;
3059
+ let generatedColumn = -1;
3060
+ for (let i = 0; i < mappings.length; i++) {
3061
+ const cc = mappings.charCodeAt(i);
3062
+ if (cc > ccMax) continue;
3063
+ const value = ccToValue[cc];
3064
+ if ((value & END_SEGMENT_BIT) !== 0) {
3065
+ // End current segment
3066
+ if (currentData[0] > generatedColumn) {
3067
+ if (currentDataPos === 1) {
3068
+ onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
3069
+ } else if (currentDataPos === 4) {
3070
+ onMapping(
3071
+ generatedLine,
3072
+ currentData[0],
3073
+ currentData[1],
3074
+ currentData[2],
3075
+ currentData[3],
3076
+ -1,
3077
+ );
3078
+ } else if (currentDataPos === 5) {
3079
+ onMapping(
3080
+ generatedLine,
3081
+ currentData[0],
3082
+ currentData[1],
3083
+ currentData[2],
3084
+ currentData[3],
3085
+ currentData[4],
3086
+ );
3087
+ }
3088
+ [generatedColumn] = currentData;
3089
+ }
3090
+ currentDataPos = 0;
3091
+ if (value === NEXT_LINE) {
3092
+ // Start new line
3093
+ generatedLine++;
3094
+ currentData[0] = 0;
3095
+ generatedColumn = -1;
3096
+ }
3097
+ } else if ((value & CONTINUATION_BIT) === 0) {
3098
+ // last sextet
3099
+ currentValue |= value << currentValuePos;
3100
+ const finalValue =
3101
+ currentValue & 1 ? -(currentValue >> 1) : currentValue >> 1;
3102
+ currentData[currentDataPos++] += finalValue;
3103
+ currentValuePos = 0;
3104
+ currentValue = 0;
3105
+ } else {
3106
+ currentValue |= (value & DATA_MASK) << currentValuePos;
3107
+ currentValuePos += 5;
3108
+ }
3109
+ }
3110
+ // End current segment
3111
+ if (currentDataPos === 1) {
3112
+ onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
3113
+ } else if (currentDataPos === 4) {
3114
+ onMapping(
3115
+ generatedLine,
3116
+ currentData[0],
3117
+ currentData[1],
3118
+ currentData[2],
3119
+ currentData[3],
3120
+ -1,
3121
+ );
3122
+ } else if (currentDataPos === 5) {
3123
+ onMapping(
3124
+ generatedLine,
3125
+ currentData[0],
3126
+ currentData[1],
3127
+ currentData[2],
3128
+ currentData[3],
3129
+ currentData[4],
3130
+ );
3131
+ }
3132
+ };
3133
+
3134
+ module.exports = readMappings;
3135
+
3136
+
3137
+ /***/ }),
3138
+
3139
+ /***/ 492:
3140
+ /***/ ((module) => {
3141
+
3142
+ /*
3143
+ MIT License http://www.opensource.org/licenses/mit-license.php
3144
+ Author Tobias Koppers @sokra
3145
+ */
3146
+
3147
+
3148
+
3149
+ /**
3150
+ * @param {string} str string
3151
+ * @returns {string[]} array of string separated by lines
3152
+ */
3153
+ const splitIntoLines = (str) => {
3154
+ const results = [];
3155
+ const len = str.length;
3156
+ let i = 0;
3157
+ while (i < len) {
3158
+ const cc = str.charCodeAt(i);
3159
+ // 10 is "\n".charCodeAt(0)
3160
+ if (cc === 10) {
3161
+ results.push("\n");
3162
+ i++;
3163
+ } else {
3164
+ let j = i + 1;
3165
+ // 10 is "\n".charCodeAt(0)
3166
+ while (j < len && str.charCodeAt(j) !== 10) j++;
3167
+ results.push(str.slice(i, j + 1));
3168
+ i = j + 1;
3169
+ }
3170
+ }
3171
+ return results;
3172
+ };
3173
+
3174
+ module.exports = splitIntoLines;
3175
+
3176
+
3177
+ /***/ }),
3178
+
3179
+ /***/ 403:
3180
+ /***/ ((module) => {
3181
+
3182
+ /*
3183
+ MIT License http://www.opensource.org/licenses/mit-license.php
3184
+ Author Tobias Koppers @sokra
3185
+ */
3186
+
3187
+
3188
+
3189
+ // \n = 10
3190
+ // ; = 59
3191
+ // { = 123
3192
+ // } = 125
3193
+ // <space> = 32
3194
+ // \r = 13
3195
+ // \t = 9
3196
+
3197
+ /**
3198
+ * @param {string} str string
3199
+ * @returns {string[] | null} array of string separated by potential tokens
3200
+ */
3201
+ const splitIntoPotentialTokens = (str) => {
3202
+ const len = str.length;
3203
+ if (len === 0) return null;
3204
+ const results = [];
3205
+ let i = 0;
3206
+ while (i < len) {
3207
+ const start = i;
3208
+ block: {
3209
+ let cc = str.charCodeAt(i);
3210
+ while (cc !== 10 && cc !== 59 && cc !== 123 && cc !== 125) {
3211
+ if (++i >= len) break block;
3212
+ cc = str.charCodeAt(i);
3213
+ }
3214
+ while (
3215
+ cc === 59 ||
3216
+ cc === 32 ||
3217
+ cc === 123 ||
3218
+ cc === 125 ||
3219
+ cc === 13 ||
3220
+ cc === 9
3221
+ ) {
3222
+ if (++i >= len) break block;
3223
+ cc = str.charCodeAt(i);
3224
+ }
3225
+ if (cc === 10) {
3226
+ i++;
3227
+ }
3228
+ }
3229
+ results.push(str.slice(start, i));
3230
+ }
3231
+ return results;
3232
+ };
3233
+
3234
+ module.exports = splitIntoPotentialTokens;
3235
+
3236
+
3237
+ /***/ }),
3238
+
3239
+ /***/ 334:
3240
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
3241
+
3242
+ /*
3243
+ MIT License http://www.opensource.org/licenses/mit-license.php
3244
+ Author Tobias Koppers @sokra
3245
+ */
3246
+
3247
+
3248
+
3249
+ const createMappingsSerializer = __nccwpck_require__(294);
3250
+ const streamChunks = __nccwpck_require__(779);
3251
+
3252
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
3253
+ /** @typedef {import("./streamChunks").GeneratedSourceInfo} GeneratedSourceInfo */
3254
+ /** @typedef {import("./streamChunks").OnChunk} OnChunk */
3255
+ /** @typedef {import("./streamChunks").OnName} OnName */
3256
+ /** @typedef {import("./streamChunks").OnSource} OnSource */
3257
+ /** @typedef {import("./streamChunks").Options} Options */
3258
+ /** @typedef {import("./streamChunks").SourceMaybeWithStreamChunksFunction} SourceMaybeWithStreamChunksFunction */
3259
+
3260
+ /**
3261
+ * @param {SourceMaybeWithStreamChunksFunction} inputSource input source
3262
+ * @param {Options} options options
3263
+ * @param {OnChunk} onChunk on chunk
3264
+ * @param {OnSource} onSource on source
3265
+ * @param {OnName} onName on name
3266
+ * @returns {{ result: GeneratedSourceInfo, source: string, map: RawSourceMap | null }} result
3267
+ */
3268
+ const streamAndGetSourceAndMap = (
3269
+ inputSource,
3270
+ options,
3271
+ onChunk,
3272
+ onSource,
3273
+ onName,
3274
+ ) => {
3275
+ let code = "";
3276
+ let mappings = "";
3277
+ /** @type {(string | null)[]} */
3278
+ const potentialSources = [];
3279
+ /** @type {(string | null)[]} */
3280
+ const potentialSourcesContent = [];
3281
+ /** @type {(string | null)[]} */
3282
+ const potentialNames = [];
3283
+ const addMapping = createMappingsSerializer({ ...options, columns: true });
3284
+ const finalSource = Boolean(options && options.finalSource);
3285
+ const { generatedLine, generatedColumn, source } = streamChunks(
3286
+ inputSource,
3287
+ options,
3288
+ (
3289
+ chunk,
3290
+ generatedLine,
3291
+ generatedColumn,
3292
+ sourceIndex,
3293
+ originalLine,
3294
+ originalColumn,
3295
+ nameIndex,
3296
+ ) => {
3297
+ if (chunk !== undefined) code += chunk;
3298
+ mappings += addMapping(
3299
+ generatedLine,
3300
+ generatedColumn,
3301
+ sourceIndex,
3302
+ originalLine,
3303
+ originalColumn,
3304
+ nameIndex,
3305
+ );
3306
+ return onChunk(
3307
+ finalSource ? undefined : chunk,
3308
+ generatedLine,
3309
+ generatedColumn,
3310
+ sourceIndex,
3311
+ originalLine,
3312
+ originalColumn,
3313
+ nameIndex,
3314
+ );
3315
+ },
3316
+ (sourceIndex, source, sourceContent) => {
3317
+ while (potentialSources.length < sourceIndex) {
3318
+ potentialSources.push(null);
3319
+ }
3320
+ potentialSources[sourceIndex] = source;
3321
+ if (sourceContent !== undefined) {
3322
+ while (potentialSourcesContent.length < sourceIndex) {
3323
+ potentialSourcesContent.push(null);
3324
+ }
3325
+ potentialSourcesContent[sourceIndex] = sourceContent;
3326
+ }
3327
+ return onSource(sourceIndex, source, sourceContent);
3328
+ },
3329
+ (nameIndex, name) => {
3330
+ while (potentialNames.length < nameIndex) {
3331
+ potentialNames.push(null);
3332
+ }
3333
+ potentialNames[nameIndex] = name;
3334
+ return onName(nameIndex, name);
3335
+ },
3336
+ );
3337
+ const resultSource = source !== undefined ? source : code;
3338
+
3339
+ return {
3340
+ result: {
3341
+ generatedLine,
3342
+ generatedColumn,
3343
+ source: finalSource ? resultSource : undefined,
3344
+ },
3345
+ source: resultSource,
3346
+ map:
3347
+ mappings.length > 0
3348
+ ? {
3349
+ version: 3,
3350
+ file: "x",
3351
+ mappings,
3352
+ // We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change
3353
+ sources: /** @type {string[]} */ (potentialSources),
3354
+ sourcesContent:
3355
+ potentialSourcesContent.length > 0
3356
+ ? /** @type {string[]} */ (potentialSourcesContent)
3357
+ : undefined,
3358
+ names: /** @type {string[]} */ (potentialNames),
3359
+ }
3360
+ : null,
3361
+ };
3362
+ };
3363
+
3364
+ module.exports = streamAndGetSourceAndMap;
3365
+
3366
+
3367
+ /***/ }),
3368
+
3369
+ /***/ 779:
3370
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
3371
+
3372
+ /*
3373
+ MIT License http://www.opensource.org/licenses/mit-license.php
3374
+ Author Tobias Koppers @sokra
3375
+ */
3376
+
3377
+
3378
+
3379
+ const streamChunksOfRawSource = __nccwpck_require__(771);
3380
+ const streamChunksOfSourceMap = __nccwpck_require__(105);
3381
+
3382
+ /** @typedef {import("../Source")} Source */
3383
+ /** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
3384
+ /** @typedef {(chunk: string | undefined, generatedLine: number, generatedColumn: number, sourceIndex: number, originalLine: number, originalColumn: number, nameIndex: number) => void} OnChunk */
3385
+ /** @typedef {(sourceIndex: number, source: string | null, sourceContent: string | undefined) => void} OnSource */
3386
+ /** @typedef {(nameIndex: number, name: string) => void} OnName */
3387
+
3388
+ /** @typedef {{ source?: boolean, finalSource?: boolean, columns?: boolean }} Options */
3389
+
3390
+ /**
3391
+ * @callback StreamChunksFunction
3392
+ * @param {Options} options options
3393
+ * @param {OnChunk} onChunk on chunk
3394
+ * @param {OnSource} onSource on source
3395
+ * @param {OnName} onName on name
3396
+ */
3397
+
3398
+ /** @typedef {Source & { streamChunks?: StreamChunksFunction }} SourceMaybeWithStreamChunksFunction */
3399
+
3400
+ /**
3401
+ * @param {SourceMaybeWithStreamChunksFunction} source source
3402
+ * @param {Options} options options
3403
+ * @param {OnChunk} onChunk on chunk
3404
+ * @param {OnSource} onSource on source
3405
+ * @param {OnName} onName on name
3406
+ * @returns {GeneratedSourceInfo} generated source info
3407
+ */
3408
+ module.exports = (source, options, onChunk, onSource, onName) => {
3409
+ if (typeof source.streamChunks === "function") {
3410
+ return source.streamChunks(options, onChunk, onSource, onName);
3411
+ }
3412
+ const sourceAndMap = source.sourceAndMap(options);
3413
+ if (sourceAndMap.map) {
3414
+ return streamChunksOfSourceMap(
3415
+ /** @type {string} */
3416
+ (sourceAndMap.source),
3417
+ sourceAndMap.map,
3418
+ onChunk,
3419
+ onSource,
3420
+ onName,
3421
+ Boolean(options && options.finalSource),
3422
+ Boolean(options && options.columns !== false),
3423
+ );
3424
+ }
3425
+ return streamChunksOfRawSource(
3426
+ /** @type {string} */
3427
+ (sourceAndMap.source),
3428
+ onChunk,
3429
+ onSource,
3430
+ onName,
3431
+ Boolean(options && options.finalSource),
3432
+ );
3433
+ };
3434
+
3435
+
3436
+ /***/ }),
3437
+
3438
+ /***/ 132:
3439
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
3440
+
3441
+ /*
3442
+ MIT License http://www.opensource.org/licenses/mit-license.php
3443
+ Author Tobias Koppers @sokra
3444
+ */
3445
+
3446
+
3447
+
3448
+ const splitIntoLines = __nccwpck_require__(492);
3449
+ const streamChunksOfSourceMap = __nccwpck_require__(105);
3450
+
3451
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
3452
+ /** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
3453
+ /** @typedef {import("./streamChunks").OnChunk} onChunk */
3454
+ /** @typedef {import("./streamChunks").OnName} OnName */
3455
+ /** @typedef {import("./streamChunks").OnSource} OnSource */
3456
+
3457
+ /**
3458
+ * @param {string} source source
3459
+ * @param {RawSourceMap} sourceMap source map
3460
+ * @param {string} innerSourceName inner source name
3461
+ * @param {string} innerSource inner source
3462
+ * @param {RawSourceMap} innerSourceMap inner source map
3463
+ * @param {boolean | undefined} removeInnerSource do remove inner source
3464
+ * @param {onChunk} onChunk on chunk
3465
+ * @param {OnSource} onSource on source
3466
+ * @param {OnName} onName on name
3467
+ * @param {boolean} finalSource finalSource
3468
+ * @param {boolean} columns columns
3469
+ * @returns {GeneratedSourceInfo} generated source info
3470
+ */
3471
+ const streamChunksOfCombinedSourceMap = (
3472
+ source,
3473
+ sourceMap,
3474
+ innerSourceName,
3475
+ innerSource,
3476
+ innerSourceMap,
3477
+ removeInnerSource,
3478
+ onChunk,
3479
+ onSource,
3480
+ onName,
3481
+ finalSource,
3482
+ columns,
3483
+ ) => {
3484
+ /** @type {Map<string | null, number>} */
3485
+ const sourceMapping = new Map();
3486
+ /** @type {Map<string, number>} */
3487
+ const nameMapping = new Map();
3488
+ /** @type {number[]} */
3489
+ const sourceIndexMapping = [];
3490
+ /** @type {number[]} */
3491
+ const nameIndexMapping = [];
3492
+ /** @type {string[]} */
3493
+ const nameIndexValueMapping = [];
3494
+ let outerSourceIndex = -2;
3495
+ /** @type {number[]} */
3496
+ const innerSourceIndexMapping = [];
3497
+ /** @type {[string | null, string | undefined][]} */
3498
+ const innerSourceIndexValueMapping = [];
3499
+ /** @type {(string | undefined)[]} */
3500
+ const innerSourceContents = [];
3501
+ /** @type {(null | undefined | string[])[]} */
3502
+ const innerSourceContentLines = [];
3503
+ /** @type {number[]} */
3504
+ const innerNameIndexMapping = [];
3505
+ /** @type {string[]} */
3506
+ const innerNameIndexValueMapping = [];
3507
+ /** @typedef {[number, number, number, number, number] | number[]} MappingsData */
3508
+ /** @type {{ chunks: string[], mappingsData: MappingsData }[]} */
3509
+ const innerSourceMapLineData = [];
3510
+ /**
3511
+ * @param {number} line line
3512
+ * @param {number} column column
3513
+ * @returns {number} result
3514
+ */
3515
+ const findInnerMapping = (line, column) => {
3516
+ if (line > innerSourceMapLineData.length) return -1;
3517
+ const { mappingsData } = innerSourceMapLineData[line - 1];
3518
+ let l = 0;
3519
+ let r = mappingsData.length / 5;
3520
+ while (l < r) {
3521
+ const m = (l + r) >> 1;
3522
+ if (mappingsData[m * 5] <= column) {
3523
+ l = m + 1;
3524
+ } else {
3525
+ r = m;
3526
+ }
3527
+ }
3528
+ if (l === 0) return -1;
3529
+ return l - 1;
3530
+ };
3531
+ return streamChunksOfSourceMap(
3532
+ source,
3533
+ sourceMap,
3534
+ (
3535
+ chunk,
3536
+ generatedLine,
3537
+ generatedColumn,
3538
+ sourceIndex,
3539
+ originalLine,
3540
+ originalColumn,
3541
+ nameIndex,
3542
+ ) => {
3543
+ // Check if this is a mapping to the inner source
3544
+ if (sourceIndex === outerSourceIndex) {
3545
+ // Check if there is a mapping in the inner source
3546
+ const idx = findInnerMapping(originalLine, originalColumn);
3547
+ if (idx !== -1) {
3548
+ const { chunks, mappingsData } =
3549
+ innerSourceMapLineData[originalLine - 1];
3550
+ const mi = idx * 5;
3551
+ const innerSourceIndex = mappingsData[mi + 1];
3552
+ const innerOriginalLine = mappingsData[mi + 2];
3553
+ let innerOriginalColumn = mappingsData[mi + 3];
3554
+ let innerNameIndex = mappingsData[mi + 4];
3555
+ if (innerSourceIndex >= 0) {
3556
+ // Check for an identity mapping
3557
+ // where we are allowed to adjust the original column
3558
+ const innerChunk = chunks[idx];
3559
+ const innerGeneratedColumn = mappingsData[mi];
3560
+ const locationInChunk = originalColumn - innerGeneratedColumn;
3561
+ if (locationInChunk > 0) {
3562
+ let originalSourceLines =
3563
+ innerSourceIndex < innerSourceContentLines.length
3564
+ ? innerSourceContentLines[innerSourceIndex]
3565
+ : null;
3566
+ if (originalSourceLines === undefined) {
3567
+ const originalSource = innerSourceContents[innerSourceIndex];
3568
+ originalSourceLines = originalSource
3569
+ ? splitIntoLines(originalSource)
3570
+ : null;
3571
+ innerSourceContentLines[innerSourceIndex] = originalSourceLines;
3572
+ }
3573
+ if (originalSourceLines !== null) {
3574
+ const originalChunk =
3575
+ innerOriginalLine <= originalSourceLines.length
3576
+ ? originalSourceLines[innerOriginalLine - 1].slice(
3577
+ innerOriginalColumn,
3578
+ innerOriginalColumn + locationInChunk,
3579
+ )
3580
+ : "";
3581
+ if (innerChunk.slice(0, locationInChunk) === originalChunk) {
3582
+ innerOriginalColumn += locationInChunk;
3583
+ innerNameIndex = -1;
3584
+ }
3585
+ }
3586
+ }
3587
+
3588
+ // We have a inner mapping to original source
3589
+
3590
+ // emit source when needed and compute global source index
3591
+ let sourceIndex =
3592
+ innerSourceIndex < innerSourceIndexMapping.length
3593
+ ? innerSourceIndexMapping[innerSourceIndex]
3594
+ : -2;
3595
+ if (sourceIndex === -2) {
3596
+ const [source, sourceContent] =
3597
+ innerSourceIndex < innerSourceIndexValueMapping.length
3598
+ ? innerSourceIndexValueMapping[innerSourceIndex]
3599
+ : [null, undefined];
3600
+ let globalIndex = sourceMapping.get(source);
3601
+ if (globalIndex === undefined) {
3602
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
3603
+ onSource(globalIndex, source, sourceContent);
3604
+ }
3605
+ sourceIndex = globalIndex;
3606
+ innerSourceIndexMapping[innerSourceIndex] = sourceIndex;
3607
+ }
3608
+
3609
+ // emit name when needed and compute global name index
3610
+ let finalNameIndex = -1;
3611
+ if (innerNameIndex >= 0) {
3612
+ // when we have a inner name
3613
+ finalNameIndex =
3614
+ innerNameIndex < innerNameIndexMapping.length
3615
+ ? innerNameIndexMapping[innerNameIndex]
3616
+ : -2;
3617
+ if (finalNameIndex === -2) {
3618
+ const name =
3619
+ innerNameIndex < innerNameIndexValueMapping.length
3620
+ ? innerNameIndexValueMapping[innerNameIndex]
3621
+ : undefined;
3622
+ if (name) {
3623
+ let globalIndex = nameMapping.get(name);
3624
+ if (globalIndex === undefined) {
3625
+ nameMapping.set(name, (globalIndex = nameMapping.size));
3626
+ onName(globalIndex, name);
3627
+ }
3628
+ finalNameIndex = globalIndex;
3629
+ } else {
3630
+ finalNameIndex = -1;
3631
+ }
3632
+ innerNameIndexMapping[innerNameIndex] = finalNameIndex;
3633
+ }
3634
+ } else if (nameIndex >= 0) {
3635
+ // when we don't have an inner name,
3636
+ // but we have an outer name
3637
+ // it can be used when inner original code equals to the name
3638
+ let originalSourceLines =
3639
+ innerSourceContentLines[innerSourceIndex];
3640
+ if (originalSourceLines === undefined) {
3641
+ const originalSource = innerSourceContents[innerSourceIndex];
3642
+ originalSourceLines = originalSource
3643
+ ? splitIntoLines(originalSource)
3644
+ : null;
3645
+ innerSourceContentLines[innerSourceIndex] = originalSourceLines;
3646
+ }
3647
+ if (originalSourceLines !== null) {
3648
+ const name = nameIndexValueMapping[nameIndex];
3649
+ const originalName =
3650
+ innerOriginalLine <= originalSourceLines.length
3651
+ ? originalSourceLines[innerOriginalLine - 1].slice(
3652
+ innerOriginalColumn,
3653
+ innerOriginalColumn + name.length,
3654
+ )
3655
+ : "";
3656
+ if (name === originalName) {
3657
+ finalNameIndex =
3658
+ nameIndex < nameIndexMapping.length
3659
+ ? nameIndexMapping[nameIndex]
3660
+ : -2;
3661
+ if (finalNameIndex === -2) {
3662
+ const name = nameIndexValueMapping[nameIndex];
3663
+ if (name) {
3664
+ let globalIndex = nameMapping.get(name);
3665
+ if (globalIndex === undefined) {
3666
+ nameMapping.set(name, (globalIndex = nameMapping.size));
3667
+ onName(globalIndex, name);
3668
+ }
3669
+ finalNameIndex = globalIndex;
3670
+ } else {
3671
+ finalNameIndex = -1;
3672
+ }
3673
+ nameIndexMapping[nameIndex] = finalNameIndex;
3674
+ }
3675
+ }
3676
+ }
3677
+ }
3678
+ onChunk(
3679
+ chunk,
3680
+ generatedLine,
3681
+ generatedColumn,
3682
+ sourceIndex,
3683
+ innerOriginalLine,
3684
+ innerOriginalColumn,
3685
+ finalNameIndex,
3686
+ );
3687
+ return;
3688
+ }
3689
+ }
3690
+
3691
+ // We have a mapping to the inner source, but no inner mapping
3692
+ if (removeInnerSource) {
3693
+ onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
3694
+ return;
3695
+ }
3696
+ if (sourceIndexMapping[sourceIndex] === -2) {
3697
+ let globalIndex = sourceMapping.get(innerSourceName);
3698
+ if (globalIndex === undefined) {
3699
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
3700
+ onSource(globalIndex, innerSourceName, innerSource);
3701
+ }
3702
+ sourceIndexMapping[sourceIndex] = globalIndex;
3703
+ }
3704
+ }
3705
+
3706
+ const finalSourceIndex =
3707
+ sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length
3708
+ ? -1
3709
+ : sourceIndexMapping[sourceIndex];
3710
+ if (finalSourceIndex < 0) {
3711
+ // no source, so we make it a generated chunk
3712
+ onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
3713
+ } else {
3714
+ // Pass through the chunk with mapping
3715
+ let finalNameIndex = -1;
3716
+ if (nameIndex >= 0 && nameIndex < nameIndexMapping.length) {
3717
+ finalNameIndex = nameIndexMapping[nameIndex];
3718
+ if (finalNameIndex === -2) {
3719
+ const name = nameIndexValueMapping[nameIndex];
3720
+ let globalIndex = nameMapping.get(name);
3721
+ if (globalIndex === undefined) {
3722
+ nameMapping.set(name, (globalIndex = nameMapping.size));
3723
+ onName(globalIndex, name);
3724
+ }
3725
+ finalNameIndex = globalIndex;
3726
+ nameIndexMapping[nameIndex] = finalNameIndex;
3727
+ }
3728
+ }
3729
+ onChunk(
3730
+ chunk,
3731
+ generatedLine,
3732
+ generatedColumn,
3733
+ finalSourceIndex,
3734
+ originalLine,
3735
+ originalColumn,
3736
+ finalNameIndex,
3737
+ );
3738
+ }
3739
+ },
3740
+ (i, source, sourceContent) => {
3741
+ if (source === innerSourceName) {
3742
+ outerSourceIndex = i;
3743
+ if (innerSource !== undefined) sourceContent = innerSource;
3744
+ else innerSource = /** @type {string} */ (sourceContent);
3745
+ sourceIndexMapping[i] = -2;
3746
+ streamChunksOfSourceMap(
3747
+ /** @type {string} */
3748
+ (sourceContent),
3749
+ innerSourceMap,
3750
+ (
3751
+ chunk,
3752
+ generatedLine,
3753
+ generatedColumn,
3754
+ sourceIndex,
3755
+ originalLine,
3756
+ originalColumn,
3757
+ nameIndex,
3758
+ ) => {
3759
+ while (innerSourceMapLineData.length < generatedLine) {
3760
+ innerSourceMapLineData.push({
3761
+ mappingsData: [],
3762
+ chunks: [],
3763
+ });
3764
+ }
3765
+ const data = innerSourceMapLineData[generatedLine - 1];
3766
+ data.mappingsData.push(
3767
+ generatedColumn,
3768
+ sourceIndex,
3769
+ originalLine,
3770
+ originalColumn,
3771
+ nameIndex,
3772
+ );
3773
+ data.chunks.push(/** @type {string} */ (chunk));
3774
+ },
3775
+ (i, source, sourceContent) => {
3776
+ innerSourceContents[i] = sourceContent;
3777
+ innerSourceContentLines[i] = undefined;
3778
+ innerSourceIndexMapping[i] = -2;
3779
+ innerSourceIndexValueMapping[i] = [source, sourceContent];
3780
+ },
3781
+ (i, name) => {
3782
+ innerNameIndexMapping[i] = -2;
3783
+ innerNameIndexValueMapping[i] = name;
3784
+ },
3785
+ false,
3786
+ columns,
3787
+ );
3788
+ } else {
3789
+ let globalIndex = sourceMapping.get(source);
3790
+ if (globalIndex === undefined) {
3791
+ sourceMapping.set(source, (globalIndex = sourceMapping.size));
3792
+ onSource(globalIndex, source, sourceContent);
3793
+ }
3794
+ sourceIndexMapping[i] = globalIndex;
3795
+ }
3796
+ },
3797
+ (i, name) => {
3798
+ nameIndexMapping[i] = -2;
3799
+ nameIndexValueMapping[i] = name;
3800
+ },
3801
+ finalSource,
3802
+ columns,
3803
+ );
3804
+ };
3805
+
3806
+ module.exports = streamChunksOfCombinedSourceMap;
3807
+
3808
+
3809
+ /***/ }),
3810
+
3811
+ /***/ 771:
3812
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
3813
+
3814
+ /*
3815
+ MIT License http://www.opensource.org/licenses/mit-license.php
3816
+ Author Tobias Koppers @sokra
3817
+ */
3818
+
3819
+
3820
+
3821
+ const getGeneratedSourceInfo = __nccwpck_require__(517);
3822
+ const splitIntoLines = __nccwpck_require__(492);
3823
+
3824
+ /** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
3825
+ /** @typedef {import("./streamChunks").OnChunk} OnChunk */
3826
+ /** @typedef {import("./streamChunks").OnName} OnName */
3827
+ /** @typedef {import("./streamChunks").OnSource} OnSource */
3828
+
3829
+ /**
3830
+ * @param {string} source source
3831
+ * @param {OnChunk} onChunk on chunk
3832
+ * @param {OnSource} _onSource on source
3833
+ * @param {OnName} _onName on name
3834
+ * @returns {GeneratedSourceInfo} source info
3835
+ */
3836
+ const streamChunksOfRawSource = (source, onChunk, _onSource, _onName) => {
3837
+ let line = 1;
3838
+ const matches = splitIntoLines(source);
3839
+ /** @type {undefined | string} */
3840
+ let match;
3841
+ for (match of matches) {
3842
+ onChunk(match, line, 0, -1, -1, -1, -1);
3843
+ line++;
3844
+ }
3845
+ return matches.length === 0 || /** @type {string} */ (match).endsWith("\n")
3846
+ ? {
3847
+ generatedLine: matches.length + 1,
3848
+ generatedColumn: 0,
3849
+ }
3850
+ : {
3851
+ generatedLine: matches.length,
3852
+ generatedColumn: /** @type {string} */ (match).length,
3853
+ };
3854
+ };
3855
+
3856
+ /**
3857
+ * @param {string} source source
3858
+ * @param {OnChunk} onChunk on chunk
3859
+ * @param {OnSource} onSource on source
3860
+ * @param {OnName} onName on name
3861
+ * @param {boolean} finalSource is final source
3862
+ * @returns {GeneratedSourceInfo} source info
3863
+ */
3864
+ module.exports = (source, onChunk, onSource, onName, finalSource) =>
3865
+ finalSource
3866
+ ? getGeneratedSourceInfo(source)
3867
+ : streamChunksOfRawSource(source, onChunk, onSource, onName);
3868
+
3869
+
3870
+ /***/ }),
3871
+
3872
+ /***/ 105:
3873
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
3874
+
3875
+ /*
3876
+ MIT License http://www.opensource.org/licenses/mit-license.php
3877
+ Author Tobias Koppers @sokra
3878
+ */
3879
+
3880
+
3881
+
3882
+ const getGeneratedSourceInfo = __nccwpck_require__(517);
3883
+ const getSource = __nccwpck_require__(432);
3884
+ const readMappings = __nccwpck_require__(950);
3885
+ const splitIntoLines = __nccwpck_require__(492);
3886
+
3887
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
3888
+ /** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
3889
+ /** @typedef {import("./streamChunks").OnChunk} OnChunk */
3890
+ /** @typedef {import("./streamChunks").OnName} OnName */
3891
+ /** @typedef {import("./streamChunks").OnSource} OnSource */
3892
+
3893
+ /**
3894
+ * @param {string} source source
3895
+ * @param {RawSourceMap} sourceMap source map
3896
+ * @param {OnChunk} onChunk on chunk
3897
+ * @param {OnSource} onSource on source
3898
+ * @param {OnName} onName on name
3899
+ * @returns {GeneratedSourceInfo} generated source info
3900
+ */
3901
+ const streamChunksOfSourceMapFull = (
3902
+ source,
3903
+ sourceMap,
3904
+ onChunk,
3905
+ onSource,
3906
+ onName,
3907
+ ) => {
3908
+ const lines = splitIntoLines(source);
3909
+ if (lines.length === 0) {
3910
+ return {
3911
+ generatedLine: 1,
3912
+ generatedColumn: 0,
3913
+ };
3914
+ }
3915
+ const { sources, sourcesContent, names, mappings } = sourceMap;
3916
+ for (let i = 0; i < sources.length; i++) {
3917
+ onSource(
3918
+ i,
3919
+ getSource(sourceMap, i),
3920
+ (sourcesContent && sourcesContent[i]) || undefined,
3921
+ );
3922
+ }
3923
+ if (names) {
3924
+ for (let i = 0; i < names.length; i++) {
3925
+ onName(i, names[i]);
3926
+ }
3927
+ }
3928
+
3929
+ const lastLine = lines[lines.length - 1];
3930
+ const lastNewLine = lastLine.endsWith("\n");
3931
+ const finalLine = lastNewLine ? lines.length + 1 : lines.length;
3932
+ const finalColumn = lastNewLine ? 0 : lastLine.length;
3933
+
3934
+ let currentGeneratedLine = 1;
3935
+ let currentGeneratedColumn = 0;
3936
+
3937
+ let mappingActive = false;
3938
+ let activeMappingSourceIndex = -1;
3939
+ let activeMappingOriginalLine = -1;
3940
+ let activeMappingOriginalColumn = -1;
3941
+ let activeMappingNameIndex = -1;
3942
+
3943
+ /**
3944
+ * @param {number} generatedLine generated line
3945
+ * @param {number} generatedColumn generated column
3946
+ * @param {number} sourceIndex source index
3947
+ * @param {number} originalLine original line
3948
+ * @param {number} originalColumn original column
3949
+ * @param {number} nameIndex name index
3950
+ * @returns {void}
3951
+ */
3952
+ const onMapping = (
3953
+ generatedLine,
3954
+ generatedColumn,
3955
+ sourceIndex,
3956
+ originalLine,
3957
+ originalColumn,
3958
+ nameIndex,
3959
+ ) => {
3960
+ if (mappingActive && currentGeneratedLine <= lines.length) {
3961
+ let chunk;
3962
+ const mappingLine = currentGeneratedLine;
3963
+ const mappingColumn = currentGeneratedColumn;
3964
+ const line = lines[currentGeneratedLine - 1];
3965
+ if (generatedLine !== currentGeneratedLine) {
3966
+ chunk = line.slice(currentGeneratedColumn);
3967
+ currentGeneratedLine++;
3968
+ currentGeneratedColumn = 0;
3969
+ } else {
3970
+ chunk = line.slice(currentGeneratedColumn, generatedColumn);
3971
+ currentGeneratedColumn = generatedColumn;
3972
+ }
3973
+ if (chunk) {
3974
+ onChunk(
3975
+ chunk,
3976
+ mappingLine,
3977
+ mappingColumn,
3978
+ activeMappingSourceIndex,
3979
+ activeMappingOriginalLine,
3980
+ activeMappingOriginalColumn,
3981
+ activeMappingNameIndex,
3982
+ );
3983
+ }
3984
+ mappingActive = false;
3985
+ }
3986
+ if (generatedLine > currentGeneratedLine && currentGeneratedColumn > 0) {
3987
+ if (currentGeneratedLine <= lines.length) {
3988
+ const chunk = lines[currentGeneratedLine - 1].slice(
3989
+ currentGeneratedColumn,
3990
+ );
3991
+ onChunk(
3992
+ chunk,
3993
+ currentGeneratedLine,
3994
+ currentGeneratedColumn,
3995
+ -1,
3996
+ -1,
3997
+ -1,
3998
+ -1,
3999
+ );
4000
+ }
4001
+ currentGeneratedLine++;
4002
+ currentGeneratedColumn = 0;
4003
+ }
4004
+ while (generatedLine > currentGeneratedLine) {
4005
+ if (currentGeneratedLine <= lines.length) {
4006
+ onChunk(
4007
+ lines[currentGeneratedLine - 1],
4008
+ currentGeneratedLine,
4009
+ 0,
4010
+ -1,
4011
+ -1,
4012
+ -1,
4013
+ -1,
4014
+ );
4015
+ }
4016
+ currentGeneratedLine++;
4017
+ }
4018
+ if (generatedColumn > currentGeneratedColumn) {
4019
+ if (currentGeneratedLine <= lines.length) {
4020
+ const chunk = lines[currentGeneratedLine - 1].slice(
4021
+ currentGeneratedColumn,
4022
+ generatedColumn,
4023
+ );
4024
+ onChunk(
4025
+ chunk,
4026
+ currentGeneratedLine,
4027
+ currentGeneratedColumn,
4028
+ -1,
4029
+ -1,
4030
+ -1,
4031
+ -1,
4032
+ );
4033
+ }
4034
+ currentGeneratedColumn = generatedColumn;
4035
+ }
4036
+ if (
4037
+ sourceIndex >= 0 &&
4038
+ (generatedLine < finalLine ||
4039
+ (generatedLine === finalLine && generatedColumn < finalColumn))
4040
+ ) {
4041
+ mappingActive = true;
4042
+ activeMappingSourceIndex = sourceIndex;
4043
+ activeMappingOriginalLine = originalLine;
4044
+ activeMappingOriginalColumn = originalColumn;
4045
+ activeMappingNameIndex = nameIndex;
4046
+ }
4047
+ };
4048
+ readMappings(mappings, onMapping);
4049
+ onMapping(finalLine, finalColumn, -1, -1, -1, -1);
4050
+ return {
4051
+ generatedLine: finalLine,
4052
+ generatedColumn: finalColumn,
4053
+ };
4054
+ };
4055
+
4056
+ /**
4057
+ * @param {string} source source
4058
+ * @param {RawSourceMap} sourceMap source map
4059
+ * @param {OnChunk} onChunk on chunk
4060
+ * @param {OnSource} onSource on source
4061
+ * @param {OnName} _onName on name
4062
+ * @returns {GeneratedSourceInfo} generated source info
4063
+ */
4064
+ const streamChunksOfSourceMapLinesFull = (
4065
+ source,
4066
+ sourceMap,
4067
+ onChunk,
4068
+ onSource,
4069
+ _onName,
4070
+ ) => {
4071
+ const lines = splitIntoLines(source);
4072
+ if (lines.length === 0) {
4073
+ return {
4074
+ generatedLine: 1,
4075
+ generatedColumn: 0,
4076
+ };
4077
+ }
4078
+ const { sources, sourcesContent, mappings } = sourceMap;
4079
+ for (let i = 0; i < sources.length; i++) {
4080
+ onSource(
4081
+ i,
4082
+ getSource(sourceMap, i),
4083
+ (sourcesContent && sourcesContent[i]) || undefined,
4084
+ );
4085
+ }
4086
+
4087
+ let currentGeneratedLine = 1;
4088
+
4089
+ /**
4090
+ * @param {number} generatedLine generated line
4091
+ * @param {number} _generatedColumn generated column
4092
+ * @param {number} sourceIndex source index
4093
+ * @param {number} originalLine original line
4094
+ * @param {number} originalColumn original column
4095
+ * @param {number} _nameIndex name index
4096
+ * @returns {void}
4097
+ */
4098
+ const onMapping = (
4099
+ generatedLine,
4100
+ _generatedColumn,
4101
+ sourceIndex,
4102
+ originalLine,
4103
+ originalColumn,
4104
+ _nameIndex,
4105
+ ) => {
4106
+ if (
4107
+ sourceIndex < 0 ||
4108
+ generatedLine < currentGeneratedLine ||
4109
+ generatedLine > lines.length
4110
+ ) {
4111
+ return;
4112
+ }
4113
+ while (generatedLine > currentGeneratedLine) {
4114
+ if (currentGeneratedLine <= lines.length) {
4115
+ onChunk(
4116
+ lines[currentGeneratedLine - 1],
4117
+ currentGeneratedLine,
4118
+ 0,
4119
+ -1,
4120
+ -1,
4121
+ -1,
4122
+ -1,
4123
+ );
4124
+ }
4125
+ currentGeneratedLine++;
4126
+ }
4127
+ if (generatedLine <= lines.length) {
4128
+ onChunk(
4129
+ lines[generatedLine - 1],
4130
+ generatedLine,
4131
+ 0,
4132
+ sourceIndex,
4133
+ originalLine,
4134
+ originalColumn,
4135
+ -1,
4136
+ );
4137
+ currentGeneratedLine++;
4138
+ }
4139
+ };
4140
+ readMappings(mappings, onMapping);
4141
+ for (; currentGeneratedLine <= lines.length; currentGeneratedLine++) {
4142
+ onChunk(
4143
+ lines[currentGeneratedLine - 1],
4144
+ currentGeneratedLine,
4145
+ 0,
4146
+ -1,
4147
+ -1,
4148
+ -1,
4149
+ -1,
4150
+ );
4151
+ }
4152
+
4153
+ const lastLine = lines[lines.length - 1];
4154
+ const lastNewLine = lastLine.endsWith("\n");
4155
+
4156
+ const finalLine = lastNewLine ? lines.length + 1 : lines.length;
4157
+ const finalColumn = lastNewLine ? 0 : lastLine.length;
4158
+
4159
+ return {
4160
+ generatedLine: finalLine,
4161
+ generatedColumn: finalColumn,
4162
+ };
4163
+ };
4164
+
4165
+ /**
4166
+ * @param {string} source source
4167
+ * @param {RawSourceMap} sourceMap source map
4168
+ * @param {OnChunk} onChunk on chunk
4169
+ * @param {OnSource} onSource on source
4170
+ * @param {OnName} onName on name
4171
+ * @returns {GeneratedSourceInfo} generated source info
4172
+ */
4173
+ const streamChunksOfSourceMapFinal = (
4174
+ source,
4175
+ sourceMap,
4176
+ onChunk,
4177
+ onSource,
4178
+ onName,
4179
+ ) => {
4180
+ const result = getGeneratedSourceInfo(source);
4181
+ const { generatedLine: finalLine, generatedColumn: finalColumn } = result;
4182
+
4183
+ if (finalLine === 1 && finalColumn === 0) return result;
4184
+ const { sources, sourcesContent, names, mappings } = sourceMap;
4185
+ for (let i = 0; i < sources.length; i++) {
4186
+ onSource(
4187
+ i,
4188
+ getSource(sourceMap, i),
4189
+ (sourcesContent && sourcesContent[i]) || undefined,
4190
+ );
4191
+ }
4192
+ if (names) {
4193
+ for (let i = 0; i < names.length; i++) {
4194
+ onName(i, names[i]);
4195
+ }
4196
+ }
4197
+
4198
+ let mappingActiveLine = 0;
4199
+
4200
+ /**
4201
+ * @param {number} generatedLine generated line
4202
+ * @param {number} generatedColumn generated column
4203
+ * @param {number} sourceIndex source index
4204
+ * @param {number} originalLine original line
4205
+ * @param {number} originalColumn original column
4206
+ * @param {number} nameIndex name index
4207
+ * @returns {void}
4208
+ */
4209
+ const onMapping = (
4210
+ generatedLine,
4211
+ generatedColumn,
4212
+ sourceIndex,
4213
+ originalLine,
4214
+ originalColumn,
4215
+ nameIndex,
4216
+ ) => {
4217
+ if (
4218
+ generatedLine >= /** @type {number} */ (finalLine) &&
4219
+ (generatedColumn >= /** @type {number} */ (finalColumn) ||
4220
+ generatedLine > /** @type {number} */ (finalLine))
4221
+ ) {
4222
+ return;
4223
+ }
4224
+ if (sourceIndex >= 0) {
4225
+ onChunk(
4226
+ undefined,
4227
+ generatedLine,
4228
+ generatedColumn,
4229
+ sourceIndex,
4230
+ originalLine,
4231
+ originalColumn,
4232
+ nameIndex,
4233
+ );
4234
+ mappingActiveLine = generatedLine;
4235
+ } else if (mappingActiveLine === generatedLine) {
4236
+ onChunk(undefined, generatedLine, generatedColumn, -1, -1, -1, -1);
4237
+ mappingActiveLine = 0;
4238
+ }
4239
+ };
4240
+ readMappings(mappings, onMapping);
4241
+ return result;
4242
+ };
4243
+
4244
+ /**
4245
+ * @param {string} source source
4246
+ * @param {RawSourceMap} sourceMap source map
4247
+ * @param {OnChunk} onChunk on chunk
4248
+ * @param {OnSource} onSource on source
4249
+ * @param {OnName} _onName on name
4250
+ * @returns {GeneratedSourceInfo} generated source info
4251
+ */
4252
+ const streamChunksOfSourceMapLinesFinal = (
4253
+ source,
4254
+ sourceMap,
4255
+ onChunk,
4256
+ onSource,
4257
+ _onName,
4258
+ ) => {
4259
+ const result = getGeneratedSourceInfo(source);
4260
+ const { generatedLine, generatedColumn } = result;
4261
+ if (generatedLine === 1 && generatedColumn === 0) {
4262
+ return {
4263
+ generatedLine: 1,
4264
+ generatedColumn: 0,
4265
+ };
4266
+ }
4267
+
4268
+ const { sources, sourcesContent, mappings } = sourceMap;
4269
+ for (let i = 0; i < sources.length; i++) {
4270
+ onSource(
4271
+ i,
4272
+ getSource(sourceMap, i),
4273
+ (sourcesContent && sourcesContent[i]) || undefined,
4274
+ );
4275
+ }
4276
+
4277
+ const finalLine =
4278
+ generatedColumn === 0
4279
+ ? /** @type {number} */ (generatedLine) - 1
4280
+ : /** @type {number} */ (generatedLine);
4281
+
4282
+ let currentGeneratedLine = 1;
4283
+
4284
+ /**
4285
+ * @param {number} generatedLine generated line
4286
+ * @param {number} _generatedColumn generated column
4287
+ * @param {number} sourceIndex source index
4288
+ * @param {number} originalLine original line
4289
+ * @param {number} originalColumn original column
4290
+ * @param {number} _nameIndex name index
4291
+ * @returns {void}
4292
+ */
4293
+ const onMapping = (
4294
+ generatedLine,
4295
+ _generatedColumn,
4296
+ sourceIndex,
4297
+ originalLine,
4298
+ originalColumn,
4299
+ _nameIndex,
4300
+ ) => {
4301
+ if (
4302
+ sourceIndex >= 0 &&
4303
+ currentGeneratedLine <= generatedLine &&
4304
+ generatedLine <= finalLine
4305
+ ) {
4306
+ onChunk(
4307
+ undefined,
4308
+ generatedLine,
4309
+ 0,
4310
+ sourceIndex,
4311
+ originalLine,
4312
+ originalColumn,
4313
+ -1,
4314
+ );
4315
+ currentGeneratedLine = generatedLine + 1;
4316
+ }
4317
+ };
4318
+ readMappings(mappings, onMapping);
4319
+ return result;
4320
+ };
4321
+
4322
+ /**
4323
+ * @param {string} source source
4324
+ * @param {RawSourceMap} sourceMap source map
4325
+ * @param {OnChunk} onChunk on chunk
4326
+ * @param {OnSource} onSource on source
4327
+ * @param {OnName} onName on name
4328
+ * @param {boolean} finalSource final source
4329
+ * @param {boolean} columns columns
4330
+ * @returns {GeneratedSourceInfo} generated source info
4331
+ */
4332
+ module.exports = (
4333
+ source,
4334
+ sourceMap,
4335
+ onChunk,
4336
+ onSource,
4337
+ onName,
4338
+ finalSource,
4339
+ columns,
4340
+ ) => {
4341
+ if (columns) {
4342
+ return finalSource
4343
+ ? streamChunksOfSourceMapFinal(
4344
+ source,
4345
+ sourceMap,
4346
+ onChunk,
4347
+ onSource,
4348
+ onName,
4349
+ )
4350
+ : streamChunksOfSourceMapFull(
4351
+ source,
4352
+ sourceMap,
4353
+ onChunk,
4354
+ onSource,
4355
+ onName,
4356
+ );
4357
+ }
4358
+ return finalSource
4359
+ ? streamChunksOfSourceMapLinesFinal(
4360
+ source,
4361
+ sourceMap,
4362
+ onChunk,
4363
+ onSource,
4364
+ onName,
4365
+ )
4366
+ : streamChunksOfSourceMapLinesFull(
4367
+ source,
4368
+ sourceMap,
4369
+ onChunk,
4370
+ onSource,
4371
+ onName,
4372
+ );
4373
+ };
4374
+
4375
+
4376
+ /***/ }),
4377
+
4378
+ /***/ 357:
4379
+ /***/ ((module) => {
4380
+
4381
+ /*
4382
+ MIT License http://www.opensource.org/licenses/mit-license.php
4383
+ Author Mark Knichel @mknichel
4384
+ */
4385
+
4386
+
4387
+
4388
+ let dualStringBufferCaching = true;
4389
+
4390
+ /**
4391
+ * @returns {boolean} Whether the optimization to cache copies of both the
4392
+ * string and buffer version of source content is enabled. This is enabled by
4393
+ * default to improve performance but can consume more memory since values are
4394
+ * stored twice.
4395
+ */
4396
+ function isDualStringBufferCachingEnabled() {
4397
+ return dualStringBufferCaching;
4398
+ }
4399
+
4400
+ /**
4401
+ * Enables an optimization to save both string and buffer in memory to avoid
4402
+ * repeat conversions between the two formats when they are requested. This
4403
+ * is enabled by default. This option can improve performance but can consume
4404
+ * additional memory since values are stored twice.
4405
+ * @returns {void}
4406
+ */
4407
+ function enableDualStringBufferCaching() {
4408
+ dualStringBufferCaching = true;
4409
+ }
4410
+
4411
+ /**
4412
+ * Disables the optimization to save both string and buffer in memory. This
4413
+ * may increase performance but should reduce memory usage in the Webpack
4414
+ * compiler.
4415
+ * @returns {void}
4416
+ */
4417
+ function disableDualStringBufferCaching() {
4418
+ dualStringBufferCaching = false;
4419
+ }
4420
+
4421
+ const interningStringMap = new Map();
4422
+
4423
+ let enableStringInterningRefCount = 0;
4424
+
4425
+ /**
4426
+ * @returns {boolean} value
4427
+ */
4428
+ function isStringInterningEnabled() {
4429
+ return enableStringInterningRefCount > 0;
4430
+ }
4431
+
4432
+ /**
4433
+ * Starts a memory optimization to avoid repeat copies of the same string in
4434
+ * memory by caching a single reference to the string. This can reduce memory
4435
+ * usage if the same string is repeated many times in the compiler, such as
4436
+ * when Webpack layers are used with the same files.
4437
+ *
4438
+ * {@link exitStringInterningRange} should be called when string interning is
4439
+ * no longer necessary to free up the memory used by the interned strings. If
4440
+ * {@link enterStringInterningRange} has been called multiple times, then
4441
+ * this method may not immediately free all the memory until
4442
+ * {@link exitStringInterningRange} has been called to end all string
4443
+ * interning ranges.
4444
+ * @returns {void}
4445
+ */
4446
+ function enterStringInterningRange() {
4447
+ enableStringInterningRefCount++;
4448
+ }
4449
+
4450
+ /**
4451
+ * Stops the current string interning range. Once all string interning ranges
4452
+ * have been exited, this method will free all the memory used by the interned
4453
+ * strings. This method should be called once for each time that
4454
+ * {@link enterStringInterningRange} was called.
4455
+ * @returns {void}
4456
+ */
4457
+ function exitStringInterningRange() {
4458
+ if (--enableStringInterningRefCount <= 0) {
4459
+ interningStringMap.clear();
4460
+ enableStringInterningRefCount = 0;
4461
+ }
4462
+ }
4463
+
4464
+ /**
4465
+ * Saves the string in a map to ensure that only one copy of the string exists
4466
+ * in memory at a given time. This is controlled by {@link enableStringInterning}
4467
+ * and {@link disableStringInterning}. Callers are expect to manage the memory
4468
+ * of the interned strings by calling {@link disableStringInterning} after the
4469
+ * compiler no longer needs to save the interned memory.
4470
+ * @param {string} str A string to be interned.
4471
+ * @returns {string} The original string or a reference to an existing string of the same value if it has already been interned.
4472
+ */
4473
+ function internString(str) {
4474
+ if (
4475
+ !isStringInterningEnabled() ||
4476
+ !str ||
4477
+ str.length < 128 ||
4478
+ typeof str !== "string"
4479
+ ) {
4480
+ return str;
4481
+ }
4482
+ let internedString = interningStringMap.get(str);
4483
+ if (internedString === undefined) {
4484
+ internedString = str;
4485
+ interningStringMap.set(str, internedString);
4486
+ }
4487
+ return internedString;
4488
+ }
4489
+
4490
+ module.exports = {
4491
+ disableDualStringBufferCaching,
4492
+ enableDualStringBufferCaching,
4493
+ internString,
4494
+ isDualStringBufferCachingEnabled,
4495
+ enterStringInterningRange,
4496
+ exitStringInterningRange,
4497
+ };
4498
+
4499
+
4500
+ /***/ }),
4501
+
4502
+ /***/ 339:
4503
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
4504
+
4505
+ /*
4506
+ MIT License http://www.opensource.org/licenses/mit-license.php
4507
+ Author Tobias Koppers @sokra
4508
+ */
4509
+
4510
+
4511
+
4512
+ /** @typedef {import("./CachedSource").CachedData} CachedData */
4513
+ /** @typedef {import("./CompatSource").SourceLike} SourceLike */
4514
+ /** @typedef {import("./ConcatSource").Child} ConcatSourceChild */
4515
+ /** @typedef {import("./ReplaceSource").Replacement} Replacement */
4516
+ /** @typedef {import("./Source").HashLike} HashLike */
4517
+ /** @typedef {import("./Source").MapOptions} MapOptions */
4518
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
4519
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
4520
+ /** @typedef {import("./Source").SourceValue} SourceValue */
4521
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
4522
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
4523
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
4524
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
4525
+ /** @typedef {import("./helpers/streamChunks").Options} StreamChunksOptions */
4526
+
4527
+ /**
4528
+ * @template T
4529
+ * @param {() => T} fn memorized function
4530
+ * @returns {() => T} new function
4531
+ */
4532
+ const memoize = (fn) => {
4533
+ let cache = false;
4534
+ /** @type {T | undefined} */
4535
+ let result;
4536
+ return () => {
4537
+ if (cache) {
4538
+ return /** @type {T} */ (result);
4539
+ }
4540
+
4541
+ result = fn();
4542
+ cache = true;
4543
+ // Allow to clean up memory for fn
4544
+ // and all dependent resources
4545
+ /** @type {(() => T) | undefined} */
4546
+ (fn) = undefined;
4547
+ return /** @type {T} */ (result);
4548
+ };
4549
+ };
4550
+
4551
+ /**
4552
+ * @template A
4553
+ * @template B
4554
+ * @param {A} obj input a
4555
+ * @param {B} exports input b
4556
+ * @returns {A & B} merged
4557
+ */
4558
+ const mergeExports = (obj, exports) => {
4559
+ const descriptors = Object.getOwnPropertyDescriptors(exports);
4560
+ for (const name of Object.keys(descriptors)) {
4561
+ const descriptor = descriptors[name];
4562
+ if (descriptor.get) {
4563
+ const fn = descriptor.get;
4564
+ Object.defineProperty(obj, name, {
4565
+ configurable: false,
4566
+ enumerable: true,
4567
+ get: memoize(fn),
4568
+ });
4569
+ } else if (typeof descriptor.value === "object") {
4570
+ Object.defineProperty(obj, name, {
4571
+ configurable: false,
4572
+ enumerable: true,
4573
+ writable: false,
4574
+ value: mergeExports({}, descriptor.value),
4575
+ });
4576
+ } else {
4577
+ throw new Error(
4578
+ "Exposed values must be either a getter or an nested object",
4579
+ );
4580
+ }
4581
+ }
4582
+ return /** @type {A & B} */ (Object.freeze(obj));
4583
+ };
4584
+
4585
+ module.exports = mergeExports(
4586
+ {},
4587
+ {
4588
+ get Source() {
4589
+ return __nccwpck_require__(422);
4590
+ },
4591
+ get RawSource() {
4592
+ return __nccwpck_require__(136);
4593
+ },
4594
+ get OriginalSource() {
4595
+ return __nccwpck_require__(837);
4596
+ },
4597
+ get SourceMapSource() {
4598
+ return __nccwpck_require__(147);
4599
+ },
4600
+ get CachedSource() {
4601
+ return __nccwpck_require__(780);
4602
+ },
4603
+ get ConcatSource() {
4604
+ return __nccwpck_require__(974);
4605
+ },
4606
+ get ReplaceSource() {
4607
+ return __nccwpck_require__(902);
4608
+ },
4609
+ get PrefixSource() {
4610
+ return __nccwpck_require__(850);
4611
+ },
4612
+ get SizeOnlySource() {
4613
+ return __nccwpck_require__(865);
4614
+ },
4615
+ get CompatSource() {
4616
+ return __nccwpck_require__(844);
4617
+ },
4618
+ util: {
4619
+ get stringBufferUtils() {
4620
+ return __nccwpck_require__(357);
4621
+ },
4622
+ },
4623
+ },
4624
+ );
4625
+
4626
+
4627
+ /***/ })
4628
+
4629
+ /******/ });
4630
+ /************************************************************************/
4631
+ /******/ // The module cache
4632
+ /******/ var __webpack_module_cache__ = {};
4633
+ /******/
4634
+ /******/ // The require function
4635
+ /******/ function __nccwpck_require__(moduleId) {
4636
+ /******/ // Check if module is in cache
4637
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
4638
+ /******/ if (cachedModule !== undefined) {
4639
+ /******/ return cachedModule.exports;
4640
+ /******/ }
4641
+ /******/ // Create a new module (and put it into the cache)
4642
+ /******/ var module = __webpack_module_cache__[moduleId] = {
4643
+ /******/ // no module.id needed
4644
+ /******/ // no module.loaded needed
4645
+ /******/ exports: {}
4646
+ /******/ };
4647
+ /******/
4648
+ /******/ // Execute the module function
4649
+ /******/ var threw = true;
4650
+ /******/ try {
4651
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
4652
+ /******/ threw = false;
4653
+ /******/ } finally {
4654
+ /******/ if(threw) delete __webpack_module_cache__[moduleId];
4655
+ /******/ }
4656
+ /******/
4657
+ /******/ // Return the exports of the module
4658
+ /******/ return module.exports;
4659
+ /******/ }
4660
+ /******/
4661
+ /************************************************************************/
4662
+ /******/ /* webpack/runtime/compat */
4663
+ /******/
4664
+ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
4665
+ /******/
4666
+ /************************************************************************/
4667
+ /******/
4668
+ /******/ // startup
4669
+ /******/ // Load entry module and return exports
4670
+ /******/ // This entry module is referenced by other modules so it can't be inlined
4671
+ /******/ var __webpack_exports__ = __nccwpck_require__(339);
4672
+ /******/ module.exports = __webpack_exports__;
4673
+ /******/
4674
+ /******/ })()
4675
+ ;