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