@ohos-ports/rspack-core 2.2.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +15 -0
- package/compiled/@rspack/lite-tapable/dist/index.d.ts +176 -0
- package/compiled/@rspack/lite-tapable/license +22 -0
- package/compiled/@rspack/lite-tapable/package.json +1 -0
- package/compiled/@swc/types/index.d.ts +2284 -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/connect-next/index.d.ts +57 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +455 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/open/index.d.ts +161 -0
- package/compiled/open/package.json +1 -0
- package/compiled/tinypool/LICENSE +24 -0
- package/compiled/tinypool/README.md +214 -0
- package/compiled/tinypool/dist/common-Bo3KCGim.js +31 -0
- package/compiled/tinypool/dist/entry/process.d.ts +1 -0
- package/compiled/tinypool/dist/entry/process.js +72 -0
- package/compiled/tinypool/dist/entry/utils.d.ts +7 -0
- package/compiled/tinypool/dist/entry/utils.js +3 -0
- package/compiled/tinypool/dist/entry/worker.d.ts +1 -0
- package/compiled/tinypool/dist/entry/worker.js +76 -0
- package/compiled/tinypool/dist/index.d.ts +199 -0
- package/compiled/tinypool/dist/index.js +784 -0
- package/compiled/tinypool/dist/utils-B--2TaWv.js +38 -0
- package/compiled/tinypool/dist/utils-De75vAgL.js +10 -0
- package/compiled/tinypool/package.json +55 -0
- package/compiled/watchpack/index.d.ts +3 -0
- package/compiled/watchpack/index.js +3811 -0
- package/compiled/watchpack/license +20 -0
- package/compiled/watchpack/package.json +8 -0
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +335 -0
- package/compiled/watchpack/types/LinkResolver.d.ts +10 -0
- package/compiled/watchpack/types/getWatcherManager.d.ts +62 -0
- package/compiled/watchpack/types/index.d.ts +269 -0
- package/compiled/watchpack/types/reducePlan.d.ts +34 -0
- package/compiled/watchpack/types/util/globToRegExp.d.ts +2 -0
- package/compiled/watchpack/types/watchEventSource.d.ts +53 -0
- package/compiled/watchpack/types/watchpack.d.ts +2 -0
- package/compiled/webpack-sources/index.js +5835 -0
- package/compiled/webpack-sources/license +21 -0
- package/compiled/webpack-sources/package.json +1 -0
- package/compiled/webpack-sources/types.d.ts +500 -0
- package/dist/612~0.js +32 -0
- package/dist/612~3.js +32 -0
- package/dist/BuildInfo.d.ts +17 -0
- package/dist/Chunk.d.ts +16 -0
- package/dist/ChunkGraph.d.ts +9 -0
- package/dist/Chunks.d.ts +12 -0
- package/dist/CodeGenerationResults.d.ts +1 -0
- package/dist/Compilation.d.ts +448 -0
- package/dist/Compiler.d.ts +229 -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 +2 -0
- package/dist/ErrorHelpers.d.ts +3 -0
- package/dist/ExecuteModulePlugin.d.ts +4 -0
- package/dist/ExportsInfo.d.ts +20 -0
- package/dist/ExternalModule.d.ts +15 -0
- package/dist/FileSystem.d.ts +54 -0
- package/dist/FileSystemInfo.d.ts +5 -0
- package/dist/Module.d.ts +41 -0
- package/dist/ModuleGraph.d.ts +22 -0
- package/dist/ModuleGraphConnection.d.ts +10 -0
- package/dist/ModuleTypeConstants.d.ts +8 -0
- package/dist/MultiCompiler.d.ts +82 -0
- package/dist/MultiStats.d.ts +23 -0
- package/dist/MultiWatching.d.ts +27 -0
- package/dist/NativeWatchFileSystem.d.ts +52 -0
- package/dist/NormalModule.d.ts +14 -0
- package/dist/NormalModuleFactory.d.ts +23 -0
- package/dist/Resolver.d.ts +30 -0
- package/dist/ResolverFactory.d.ts +17 -0
- package/dist/RspackError.d.ts +12 -0
- package/dist/RuleSetCompiler.d.ts +9 -0
- package/dist/RuntimeGlobals.d.ts +360 -0
- package/dist/RuntimeModule.d.ts +34 -0
- package/dist/RuntimeTemplate.d.ts +151 -0
- package/dist/Stats.d.ts +17 -0
- package/dist/Template.d.ts +77 -0
- package/dist/VirtualModulesPlugin.d.ts +12 -0
- package/dist/Watching.d.ts +56 -0
- package/dist/builtin-loader/lightningcss/index.d.ts +114 -0
- package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
- package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +21 -0
- package/dist/builtin-loader/swc/index.d.ts +3 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +33 -0
- package/dist/builtin-loader/swc/types.d.ts +60 -0
- package/dist/builtin-plugin/APIPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +14 -0
- package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +9 -0
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +33 -0
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +60 -0
- package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +7 -0
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +12 -0
- package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +12 -0
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +14 -0
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +21 -0
- package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +9 -0
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/DataUriPlugin.d.ts +9 -0
- package/dist/builtin-plugin/DefinePlugin.d.ts +16 -0
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +18 -0
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +12 -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 +9 -0
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +25 -0
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/EntryPlugin.d.ts +32 -0
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +16 -0
- package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +9 -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 +13 -0
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FileUriPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +9 -0
- package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +10 -0
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +9 -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 +9 -0
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +30 -0
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +10 -0
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +17 -0
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +28 -0
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +14 -0
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +9 -0
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +7 -0
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +7 -0
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +9 -0
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +10 -0
- package/dist/builtin-plugin/ProgressPlugin.d.ts +12 -0
- package/dist/builtin-plugin/ProvidePlugin.d.ts +10 -0
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +20 -0
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +9 -0
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +46 -0
- package/dist/builtin-plugin/RslibPlugin.d.ts +10 -0
- package/dist/builtin-plugin/RstestPlugin.d.ts +10 -0
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
- package/dist/builtin-plugin/RuntimePlugin.d.ts +25 -0
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +9 -0
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +19 -0
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +12 -0
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +39 -0
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +216 -0
- package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +16 -0
- package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
- package/dist/builtin-plugin/WorkerPlugin.d.ts +14 -0
- package/dist/builtin-plugin/base.d.ts +45 -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 +10 -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 +77 -0
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +20 -0
- package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
- package/dist/builtin-plugin/index.d.ts +92 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +10 -0
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +12 -0
- package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +13 -0
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +47 -0
- package/dist/builtin-plugin/rsc/index.d.ts +24 -0
- package/dist/checkNodeVersion.d.ts +1 -0
- package/dist/config/adapter.d.ts +8 -0
- package/dist/config/adapterRuleUse.d.ts +424 -0
- package/dist/config/browserslistTargetHandler.d.ts +15 -0
- package/dist/config/defaults.d.ts +15 -0
- package/dist/config/devServer.d.ts +179 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/normalization.d.ts +156 -0
- package/dist/config/target.d.ts +100 -0
- package/dist/config/types.d.ts +2728 -0
- package/dist/container/ContainerPlugin.d.ts +41 -0
- package/dist/container/ContainerReferencePlugin.d.ts +34 -0
- package/dist/container/ModuleFederationManifestPlugin.d.ts +44 -0
- package/dist/container/ModuleFederationPlugin.d.ts +34 -0
- package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +16 -0
- package/dist/container/options.d.ts +3 -0
- package/dist/cssExtractHmr.js +99 -0
- package/dist/cssExtractLoader.js +117 -0
- package/dist/error/ConcurrentCompilationError.d.ts +14 -0
- package/dist/exports.d.ts +192 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +14552 -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 +39 -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/WebpackError.d.ts +21 -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 +16 -0
- package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
- package/dist/loader-runner/ModuleError.d.ts +13 -0
- package/dist/loader-runner/cache.d.ts +18 -0
- package/dist/loader-runner/dependencies.d.ts +22 -0
- package/dist/loader-runner/index.d.ts +35 -0
- package/dist/loader-runner/loadLoader.d.ts +12 -0
- package/dist/loader-runner/service.d.ts +77 -0
- package/dist/loader-runner/utils.d.ts +7 -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 +30 -0
- package/dist/node/nodeConsole.d.ts +15 -0
- package/dist/rspack.d.ts +24 -0
- package/dist/rspackOptionsApply.d.ts +4 -0
- package/dist/runtime/cssExtractHmr.d.ts +4 -0
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -0
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +54 -0
- package/dist/sharing/IndependentSharedPlugin.d.ts +37 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +54 -0
- package/dist/sharing/SharePlugin.d.ts +89 -0
- package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
- package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
- package/dist/sharing/TreeShakingSharedPlugin.d.ts +19 -0
- package/dist/sharing/utils.d.ts +2 -0
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +20 -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 +338 -0
- package/dist/swc.d.ts +7 -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/externalModule.d.ts +2 -0
- package/dist/taps/index.d.ts +7 -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 +47 -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 +11 -0
- package/dist/util/fs.d.ts +376 -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 +57 -0
- package/dist/util/index.d.ts +9 -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 +6 -0
- package/dist/util/supportsColor.d.ts +6 -0
- package/dist/util/targetsVersion.d.ts +2 -0
- package/dist/util/validateConfig.d.ts +5 -0
- package/dist/web/JsonpTemplatePlugin.d.ts +13 -0
- package/dist/webworker/WebWorkerTemplatePlugin.d.ts +13 -0
- package/dist/worker.js +971 -0
- package/hot/dev-server.js +76 -0
- package/hot/emitter.js +23 -0
- package/hot/lazy-compilation-node.js +109 -0
- package/hot/lazy-compilation-web.js +97 -0
- package/hot/log-apply-result.js +52 -0
- package/hot/log.js +87 -0
- package/hot/only-dev-server.js +104 -0
- package/hot/poll.js +41 -0
- package/hot/signal.js +68 -0
- package/module.d.ts +310 -0
- package/package.json +79 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/Compilation.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers @sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@ohos-ports/rspack-binding';
|
|
11
|
+
import binding from '@ohos-ports/rspack-binding';
|
|
12
|
+
export type { AssetInfo } from '@ohos-ports/rspack-binding';
|
|
13
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
|
|
14
|
+
import type { Source } from '../compiled/webpack-sources/types.js';
|
|
15
|
+
import type { EntryOptions, EntryPlugin } from './builtin-plugin/index.js';
|
|
16
|
+
import './Chunk.js';
|
|
17
|
+
import type { Chunk } from './Chunk.js';
|
|
18
|
+
import type { ChunkGraph } from './ChunkGraph.js';
|
|
19
|
+
import type { Compiler } from './Compiler.js';
|
|
20
|
+
import type { ContextModuleFactory } from './ContextModuleFactory.js';
|
|
21
|
+
import type { Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from './config/index.js';
|
|
22
|
+
import type { Entrypoint } from './Entrypoint.js';
|
|
23
|
+
import WebpackError from './lib/WebpackError.js';
|
|
24
|
+
import { Logger } from './logging/Logger.js';
|
|
25
|
+
import type { Module } from './Module.js';
|
|
26
|
+
import ModuleGraph from './ModuleGraph.js';
|
|
27
|
+
import type { NormalModuleFactory } from './NormalModuleFactory.js';
|
|
28
|
+
import type { ResolverFactory } from './ResolverFactory.js';
|
|
29
|
+
import type { RspackError } from './RspackError.js';
|
|
30
|
+
import { RuntimeModule } from './RuntimeModule.js';
|
|
31
|
+
import { RuntimeTemplate } from './RuntimeTemplate.js';
|
|
32
|
+
import { Stats, type StatsAsset, type StatsError, type StatsModule } from './Stats.js';
|
|
33
|
+
import { StatsFactory } from './stats/StatsFactory.js';
|
|
34
|
+
import { StatsPrinter } from './stats/StatsPrinter.js';
|
|
35
|
+
import type { InputFileSystem } from './util/fs.js';
|
|
36
|
+
import type Hash from './util/hash/index.js';
|
|
37
|
+
import './Chunks.js';
|
|
38
|
+
import './ChunkGraph.js';
|
|
39
|
+
import './CodeGenerationResults.js';
|
|
40
|
+
import type { CodeGenerationResult } from './taps/compilation.js';
|
|
41
|
+
export type Assets = Record<string, Source>;
|
|
42
|
+
export interface Asset {
|
|
43
|
+
name: string;
|
|
44
|
+
source: Source;
|
|
45
|
+
info: AssetInfo;
|
|
46
|
+
}
|
|
47
|
+
export type PathData = {
|
|
48
|
+
filename?: string;
|
|
49
|
+
hash?: string;
|
|
50
|
+
contentHash?: string;
|
|
51
|
+
runtime?: string;
|
|
52
|
+
url?: string;
|
|
53
|
+
id?: string | number;
|
|
54
|
+
chunk?: Chunk | ChunkPathData;
|
|
55
|
+
contentHashType?: string;
|
|
56
|
+
};
|
|
57
|
+
export type ChunkPathData = {
|
|
58
|
+
id?: string | number;
|
|
59
|
+
name?: string;
|
|
60
|
+
hash?: string;
|
|
61
|
+
contentHash?: Record<string, string> | string;
|
|
62
|
+
};
|
|
63
|
+
export interface LogEntry {
|
|
64
|
+
type: string;
|
|
65
|
+
args: any[];
|
|
66
|
+
time?: number;
|
|
67
|
+
trace?: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface CompilationParams {
|
|
70
|
+
normalModuleFactory: NormalModuleFactory;
|
|
71
|
+
contextModuleFactory: ContextModuleFactory;
|
|
72
|
+
}
|
|
73
|
+
export interface KnownCreateStatsOptionsContext {
|
|
74
|
+
forToString?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface ExecuteModuleArgument {
|
|
77
|
+
codeGenerationResult: CodeGenerationResult;
|
|
78
|
+
moduleObject: {
|
|
79
|
+
id: string;
|
|
80
|
+
exports: any;
|
|
81
|
+
loaded: boolean;
|
|
82
|
+
error?: Error;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export interface ExecuteModuleContext {
|
|
86
|
+
[key: string]: (id: string) => any;
|
|
87
|
+
}
|
|
88
|
+
export interface KnownNormalizedStatsOptions {
|
|
89
|
+
context: string;
|
|
90
|
+
chunksSort: string;
|
|
91
|
+
modulesSort: string;
|
|
92
|
+
chunkModulesSort: string;
|
|
93
|
+
nestedModulesSort: string;
|
|
94
|
+
assetsSort: string;
|
|
95
|
+
ids: boolean;
|
|
96
|
+
cachedAssets: boolean;
|
|
97
|
+
groupAssetsByEmitStatus: boolean;
|
|
98
|
+
groupAssetsByPath: boolean;
|
|
99
|
+
groupAssetsByExtension: boolean;
|
|
100
|
+
assetsSpace: number;
|
|
101
|
+
excludeAssets: ((value: string, asset: StatsAsset) => boolean)[];
|
|
102
|
+
excludeModules: ((name: string, module: StatsModule, type: 'module' | 'chunk' | 'root-of-chunk' | 'nested') => boolean)[];
|
|
103
|
+
warningsFilter: ((warning: StatsError, textValue: string) => boolean)[];
|
|
104
|
+
cachedModules: boolean;
|
|
105
|
+
orphanModules: boolean;
|
|
106
|
+
dependentModules: boolean;
|
|
107
|
+
runtimeModules: boolean;
|
|
108
|
+
groupModulesByCacheStatus: boolean;
|
|
109
|
+
groupModulesByLayer: boolean;
|
|
110
|
+
groupModulesByAttributes: boolean;
|
|
111
|
+
groupModulesByPath: boolean;
|
|
112
|
+
groupModulesByExtension: boolean;
|
|
113
|
+
groupModulesByType: boolean;
|
|
114
|
+
entrypoints: boolean | 'auto';
|
|
115
|
+
chunkGroups: boolean;
|
|
116
|
+
chunkGroupAuxiliary: boolean;
|
|
117
|
+
chunkGroupChildren: boolean;
|
|
118
|
+
chunkGroupMaxAssets: number;
|
|
119
|
+
modulesSpace: number;
|
|
120
|
+
chunkModulesSpace: number;
|
|
121
|
+
nestedModulesSpace: number;
|
|
122
|
+
logging: false | 'none' | 'error' | 'warn' | 'info' | 'log' | 'verbose';
|
|
123
|
+
loggingDebug: ((value: string) => boolean)[];
|
|
124
|
+
loggingTrace: boolean;
|
|
125
|
+
chunkModules: boolean;
|
|
126
|
+
chunkRelations: boolean;
|
|
127
|
+
reasons: boolean;
|
|
128
|
+
moduleAssets: boolean;
|
|
129
|
+
nestedModules: boolean;
|
|
130
|
+
source: boolean;
|
|
131
|
+
usedExports: boolean;
|
|
132
|
+
providedExports: boolean;
|
|
133
|
+
optimizationBailout: boolean;
|
|
134
|
+
depth: boolean;
|
|
135
|
+
assets: boolean;
|
|
136
|
+
chunks: boolean;
|
|
137
|
+
errors: boolean;
|
|
138
|
+
errorsCount: boolean;
|
|
139
|
+
hash: boolean;
|
|
140
|
+
modules: boolean;
|
|
141
|
+
warnings: boolean;
|
|
142
|
+
warningsCount: boolean;
|
|
143
|
+
}
|
|
144
|
+
export type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<string, any>;
|
|
145
|
+
export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>;
|
|
146
|
+
export declare const checkCompilation: (compilation: Compilation) => void;
|
|
147
|
+
export declare const getOrCreateCompilationHooks: <T>(compilation: Compilation, key: object, createHooks: () => T) => T;
|
|
148
|
+
export declare class Compilation {
|
|
149
|
+
#private;
|
|
150
|
+
hooks: Readonly<{
|
|
151
|
+
processAssets: liteTapable.AsyncSeriesHook<Assets>;
|
|
152
|
+
afterProcessAssets: liteTapable.SyncHook<Assets>;
|
|
153
|
+
childCompiler: liteTapable.SyncHook<[Compiler, string, number]>;
|
|
154
|
+
log: liteTapable.SyncBailHook<[string, LogEntry], true>;
|
|
155
|
+
additionalAssets: any;
|
|
156
|
+
optimizeModules: liteTapable.SyncBailHook<Iterable<Module>, void>;
|
|
157
|
+
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module>>;
|
|
158
|
+
optimizeTree: liteTapable.AsyncSeriesHook<[
|
|
159
|
+
Iterable<Chunk>,
|
|
160
|
+
Iterable<Module>
|
|
161
|
+
]>;
|
|
162
|
+
optimizeChunkModules: liteTapable.AsyncSeriesBailHook<[
|
|
163
|
+
Iterable<Chunk>,
|
|
164
|
+
Iterable<Module>
|
|
165
|
+
], void>;
|
|
166
|
+
beforeModuleIds: liteTapable.SyncHook<[Iterable<Module>]>;
|
|
167
|
+
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
|
|
168
|
+
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
|
|
169
|
+
chunkAsset: liteTapable.SyncHook<[Chunk, string]>;
|
|
170
|
+
processWarnings: liteTapable.SyncWaterfallHook<[WebpackError[]]>;
|
|
171
|
+
succeedModule: liteTapable.SyncHook<[Module]>;
|
|
172
|
+
stillValidModule: liteTapable.SyncHook<[Module]>;
|
|
173
|
+
statsPreset: liteTapable.HookMap<liteTapable.SyncHook<[Partial<StatsOptions>, CreateStatsOptionsContext]>>;
|
|
174
|
+
statsNormalize: liteTapable.SyncHook<[
|
|
175
|
+
Partial<StatsOptions>,
|
|
176
|
+
CreateStatsOptionsContext
|
|
177
|
+
]>;
|
|
178
|
+
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions]>;
|
|
179
|
+
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions]>;
|
|
180
|
+
buildModule: liteTapable.SyncHook<[Module]>;
|
|
181
|
+
executeModule: liteTapable.SyncHook<[
|
|
182
|
+
ExecuteModuleArgument,
|
|
183
|
+
ExecuteModuleContext
|
|
184
|
+
]>;
|
|
185
|
+
additionalTreeRuntimeRequirements: liteTapable.SyncHook<[
|
|
186
|
+
Chunk,
|
|
187
|
+
Set<string>
|
|
188
|
+
]>;
|
|
189
|
+
runtimeRequirementInTree: liteTapable.HookMap<liteTapable.SyncBailHook<[Chunk, Set<string>], void>>;
|
|
190
|
+
runtimeModule: liteTapable.SyncHook<[RuntimeModule, Chunk]>;
|
|
191
|
+
seal: liteTapable.SyncHook<[]>;
|
|
192
|
+
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
193
|
+
needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
|
|
194
|
+
}>;
|
|
195
|
+
name?: string;
|
|
196
|
+
startTime?: number;
|
|
197
|
+
endTime?: number;
|
|
198
|
+
compiler: Compiler;
|
|
199
|
+
resolverFactory: ResolverFactory;
|
|
200
|
+
inputFileSystem: InputFileSystem | null;
|
|
201
|
+
options: RspackOptionsNormalized;
|
|
202
|
+
outputOptions: OutputNormalized;
|
|
203
|
+
runtimeTemplate: RuntimeTemplate;
|
|
204
|
+
logging: Map<string, LogEntry[]>;
|
|
205
|
+
childrenCounters: Record<string, number>;
|
|
206
|
+
children: Compilation[];
|
|
207
|
+
chunkGraph: ChunkGraph;
|
|
208
|
+
moduleGraph: ModuleGraph;
|
|
209
|
+
fileSystemInfo: {
|
|
210
|
+
createSnapshot(): null;
|
|
211
|
+
};
|
|
212
|
+
needAdditionalPass: boolean;
|
|
213
|
+
[binding.COMPILATION_HOOKS_MAP_SYMBOL]: WeakMap<object, unknown>;
|
|
214
|
+
constructor(compiler: Compiler, inner: JsCompilation);
|
|
215
|
+
get hash(): Readonly<string | null>;
|
|
216
|
+
get fullHash(): Readonly<string | null>;
|
|
217
|
+
/**
|
|
218
|
+
* Get a map of all assets.
|
|
219
|
+
*/
|
|
220
|
+
get assets(): Record<string, Source>;
|
|
221
|
+
/**
|
|
222
|
+
* Get a map of all entrypoints.
|
|
223
|
+
*/
|
|
224
|
+
get entrypoints(): ReadonlyMap<string, Entrypoint>;
|
|
225
|
+
get chunkGroups(): readonly ChunkGroup[];
|
|
226
|
+
/**
|
|
227
|
+
* Get the named chunk groups.
|
|
228
|
+
*
|
|
229
|
+
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
230
|
+
*/
|
|
231
|
+
get namedChunkGroups(): ReadonlyMap<string, Readonly<ChunkGroup>>;
|
|
232
|
+
get modules(): ReadonlySet<Module>;
|
|
233
|
+
get builtModules(): ReadonlySet<Module>;
|
|
234
|
+
get chunks(): ReadonlySet<Chunk>;
|
|
235
|
+
/**
|
|
236
|
+
* Get the named chunks.
|
|
237
|
+
*
|
|
238
|
+
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
239
|
+
*/
|
|
240
|
+
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
|
|
241
|
+
get entries(): Map<string, EntryData>;
|
|
242
|
+
get codeGenerationResults(): binding.CodeGenerationResults;
|
|
243
|
+
getCache(name: string): import("./lib/CacheFacade.js").CacheFacade;
|
|
244
|
+
createStatsOptions(statsValue: StatsValue | undefined, context?: CreateStatsOptionsContext): NormalizedStatsOptions;
|
|
245
|
+
createStatsFactory(options: StatsOptions): StatsFactory;
|
|
246
|
+
createStatsPrinter(options: StatsOptions): StatsPrinter;
|
|
247
|
+
/**
|
|
248
|
+
* Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
|
|
249
|
+
*/
|
|
250
|
+
updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void;
|
|
251
|
+
/**
|
|
252
|
+
* Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
|
|
253
|
+
*
|
|
254
|
+
* @param file - file name
|
|
255
|
+
* @param source - asset source
|
|
256
|
+
* @param assetInfo - extra asset information
|
|
257
|
+
*/
|
|
258
|
+
emitAsset(filename: string, source: Source, assetInfo?: AssetInfo): void;
|
|
259
|
+
deleteAsset(filename: string): void;
|
|
260
|
+
renameAsset(filename: string, newFilename: string): void;
|
|
261
|
+
/**
|
|
262
|
+
* Get an array of Asset
|
|
263
|
+
*/
|
|
264
|
+
getAssets(): readonly Asset[];
|
|
265
|
+
getAsset(name: string): Readonly<Asset> | void;
|
|
266
|
+
/**
|
|
267
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
268
|
+
*
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
__internal__pushRspackDiagnostic(diagnostic: binding.JsRspackDiagnostic): void;
|
|
272
|
+
/**
|
|
273
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
274
|
+
*
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
__internal__pushDiagnostic(diagnostic: ExternalObject<'Diagnostic'>): void;
|
|
278
|
+
/**
|
|
279
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
280
|
+
*
|
|
281
|
+
* @internal
|
|
282
|
+
*/
|
|
283
|
+
__internal__pushDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void;
|
|
284
|
+
get errors(): RspackError[];
|
|
285
|
+
set errors(errors: RspackError[]);
|
|
286
|
+
get warnings(): RspackError[];
|
|
287
|
+
set warnings(warnings: RspackError[]);
|
|
288
|
+
getPath(filename: Filename, data?: PathData): string;
|
|
289
|
+
getPathWithInfo(filename: Filename, data?: PathData): {
|
|
290
|
+
path: string;
|
|
291
|
+
info: AssetInfo;
|
|
292
|
+
};
|
|
293
|
+
getAssetPath(filename: Filename, data?: PathData): string;
|
|
294
|
+
getAssetPathWithInfo(filename: Filename, data?: PathData): {
|
|
295
|
+
path: string;
|
|
296
|
+
info: AssetInfo;
|
|
297
|
+
};
|
|
298
|
+
getLogger(name: string | (() => string)): Logger;
|
|
299
|
+
fileDependencies: {
|
|
300
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
301
|
+
has: (dep: string) => boolean;
|
|
302
|
+
add: (dep: string) => void;
|
|
303
|
+
addAll: (deps: Iterable<string>) => void;
|
|
304
|
+
delete: (dep: string) => boolean;
|
|
305
|
+
keys(): SetIterator<string>;
|
|
306
|
+
values(): SetIterator<string>;
|
|
307
|
+
entries(): SetIterator<[string, string]>;
|
|
308
|
+
readonly size: number;
|
|
309
|
+
};
|
|
310
|
+
get __internal__addedFileDependencies(): string[];
|
|
311
|
+
get __internal__removedFileDependencies(): string[];
|
|
312
|
+
get __internal__addedContextDependencies(): string[];
|
|
313
|
+
get __internal__removedContextDependencies(): string[];
|
|
314
|
+
get __internal__addedMissingDependencies(): string[];
|
|
315
|
+
get __internal__removedMissingDependencies(): string[];
|
|
316
|
+
contextDependencies: {
|
|
317
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
318
|
+
has: (dep: string) => boolean;
|
|
319
|
+
add: (dep: string) => void;
|
|
320
|
+
addAll: (deps: Iterable<string>) => void;
|
|
321
|
+
delete: (dep: string) => boolean;
|
|
322
|
+
keys(): SetIterator<string>;
|
|
323
|
+
values(): SetIterator<string>;
|
|
324
|
+
entries(): SetIterator<[string, string]>;
|
|
325
|
+
readonly size: number;
|
|
326
|
+
};
|
|
327
|
+
missingDependencies: {
|
|
328
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
329
|
+
has: (dep: string) => boolean;
|
|
330
|
+
add: (dep: string) => void;
|
|
331
|
+
addAll: (deps: Iterable<string>) => void;
|
|
332
|
+
delete: (dep: string) => boolean;
|
|
333
|
+
keys(): SetIterator<string>;
|
|
334
|
+
values(): SetIterator<string>;
|
|
335
|
+
entries(): SetIterator<[string, string]>;
|
|
336
|
+
readonly size: number;
|
|
337
|
+
};
|
|
338
|
+
buildDependencies: {
|
|
339
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
340
|
+
has: (dep: string) => boolean;
|
|
341
|
+
add: (dep: string) => void;
|
|
342
|
+
addAll: (deps: Iterable<string>) => void;
|
|
343
|
+
delete: (dep: string) => boolean;
|
|
344
|
+
keys(): SetIterator<string>;
|
|
345
|
+
values(): SetIterator<string>;
|
|
346
|
+
entries(): SetIterator<[string, string]>;
|
|
347
|
+
readonly size: number;
|
|
348
|
+
};
|
|
349
|
+
getStats(): Stats;
|
|
350
|
+
createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
|
|
351
|
+
rebuildModule(module: Module, f: (err: Error | null, module: Module | null) => void): void;
|
|
352
|
+
addRuntimeModule(chunk: Chunk, runtimeModule: RuntimeModule): void;
|
|
353
|
+
addInclude(context: string, dependency: ReturnType<typeof EntryPlugin.createDependency>, options: EntryOptions, callback: (err?: null | WebpackError, module?: Module) => void): void;
|
|
354
|
+
addEntry(context: string, dependency: ReturnType<typeof EntryPlugin.createDependency>, optionsOrName: EntryOptions | string, callback: (err?: null | WebpackError, module?: Module) => void): void;
|
|
355
|
+
getWarnings(): WebpackError[];
|
|
356
|
+
getErrors(): WebpackError[];
|
|
357
|
+
/**
|
|
358
|
+
* Get the `Source` of a given asset filename.
|
|
359
|
+
*
|
|
360
|
+
* Note: This is not a webpack public API, maybe removed in the future.
|
|
361
|
+
*
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
__internal__getAssetSource(filename: string): Source | void;
|
|
365
|
+
/**
|
|
366
|
+
* Set the `Source` of an given asset filename.
|
|
367
|
+
*
|
|
368
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
369
|
+
*
|
|
370
|
+
* @internal
|
|
371
|
+
*/
|
|
372
|
+
__internal__setAssetSource(filename: string, source: Source): void;
|
|
373
|
+
/**
|
|
374
|
+
* Delete the `Source` of an given asset filename.
|
|
375
|
+
*
|
|
376
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
377
|
+
*
|
|
378
|
+
* @internal
|
|
379
|
+
*/
|
|
380
|
+
__internal__deleteAssetSource(filename: string): void;
|
|
381
|
+
/**
|
|
382
|
+
* Get a list of asset filenames.
|
|
383
|
+
*
|
|
384
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
385
|
+
*
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
__internal__getAssetFilenames(): string[];
|
|
389
|
+
/**
|
|
390
|
+
* Test if an asset exists.
|
|
391
|
+
*
|
|
392
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
393
|
+
*
|
|
394
|
+
* @internal
|
|
395
|
+
*/
|
|
396
|
+
__internal__hasAsset(name: string): boolean;
|
|
397
|
+
/**
|
|
398
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
399
|
+
*
|
|
400
|
+
* @internal
|
|
401
|
+
*/
|
|
402
|
+
__internal_getInner(): JsCompilation;
|
|
403
|
+
get __internal__shutdown(): boolean;
|
|
404
|
+
set __internal__shutdown(shutdown: boolean);
|
|
405
|
+
seal(): void;
|
|
406
|
+
unseal(): void;
|
|
407
|
+
static PROCESS_ASSETS_STAGE_ADDITIONAL: number;
|
|
408
|
+
static PROCESS_ASSETS_STAGE_PRE_PROCESS: number;
|
|
409
|
+
static PROCESS_ASSETS_STAGE_DERIVED: number;
|
|
410
|
+
static PROCESS_ASSETS_STAGE_ADDITIONS: number;
|
|
411
|
+
static PROCESS_ASSETS_STAGE_NONE: number;
|
|
412
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE: number;
|
|
413
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT: number;
|
|
414
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY: number;
|
|
415
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE: number;
|
|
416
|
+
static PROCESS_ASSETS_STAGE_DEV_TOOLING: number;
|
|
417
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE: number;
|
|
418
|
+
static PROCESS_ASSETS_STAGE_SUMMARIZE: number;
|
|
419
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_HASH: number;
|
|
420
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER: number;
|
|
421
|
+
static PROCESS_ASSETS_STAGE_ANALYSE: number;
|
|
422
|
+
static PROCESS_ASSETS_STAGE_REPORT: number;
|
|
423
|
+
}
|
|
424
|
+
export declare class EntryData {
|
|
425
|
+
dependencies: Dependency[];
|
|
426
|
+
includeDependencies: Dependency[];
|
|
427
|
+
options: binding.JsEntryOptions;
|
|
428
|
+
static __from_binding(binding: binding.JsEntryData): EntryData;
|
|
429
|
+
private constructor();
|
|
430
|
+
}
|
|
431
|
+
export declare class Entries implements Map<string, EntryData> {
|
|
432
|
+
#private;
|
|
433
|
+
constructor(data: binding.JsEntries);
|
|
434
|
+
clear(): void;
|
|
435
|
+
forEach(callback: (value: EntryData, key: string, map: Map<string, EntryData>) => void, thisArg?: any): void;
|
|
436
|
+
get size(): number;
|
|
437
|
+
entries(): ReturnType<Map<string, EntryData>['entries']>;
|
|
438
|
+
values(): ReturnType<Map<string, EntryData>['values']>;
|
|
439
|
+
[Symbol.iterator](): ReturnType<Map<string, EntryData>['entries']>;
|
|
440
|
+
readonly [Symbol.toStringTag] = "Map";
|
|
441
|
+
has(key: string): boolean;
|
|
442
|
+
set(key: string, value: EntryData): this;
|
|
443
|
+
delete(key: string): boolean;
|
|
444
|
+
getOrInsert(key: string, defaultValue: EntryData): EntryData;
|
|
445
|
+
getOrInsertComputed(key: string, callback: (key: string) => EntryData): EntryData;
|
|
446
|
+
get(key: string): EntryData | undefined;
|
|
447
|
+
keys(): ReturnType<Map<string, EntryData>['keys']>;
|
|
448
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/Compiler.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers @sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
import type binding from '@ohos-ports/rspack-binding';
|
|
11
|
+
import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
|
|
12
|
+
import type Watchpack from '../compiled/watchpack/index.js';
|
|
13
|
+
import type { Source } from '../compiled/webpack-sources/types.js';
|
|
14
|
+
import type { Chunk } from './Chunk.js';
|
|
15
|
+
import type { CompilationParams } from './Compilation.js';
|
|
16
|
+
import { Compilation } from './Compilation.js';
|
|
17
|
+
import { ContextModuleFactory } from './ContextModuleFactory.js';
|
|
18
|
+
import type { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from './config/index.js';
|
|
19
|
+
import type { ExtractedTargetProperties, PlatformTargetProperties } from './config/target.js';
|
|
20
|
+
import type { FileSystemInfoEntry } from './FileSystemInfo.js';
|
|
21
|
+
import type { rspack } from './index.js';
|
|
22
|
+
import Cache from './lib/Cache.js';
|
|
23
|
+
import CacheFacade from './lib/CacheFacade.js';
|
|
24
|
+
import { Logger } from './logging/Logger.js';
|
|
25
|
+
import { NormalModuleFactory } from './NormalModuleFactory.js';
|
|
26
|
+
import { ResolverFactory } from './ResolverFactory.js';
|
|
27
|
+
import { RuleSetCompiler } from './RuleSetCompiler.js';
|
|
28
|
+
import { Stats } from './Stats.js';
|
|
29
|
+
import type { InputFileSystem, IntermediateFileSystem, OutputFileSystem, WatchFileSystem } from './util/fs.js';
|
|
30
|
+
import { Watching } from './Watching.js';
|
|
31
|
+
export interface AssetEmittedInfo {
|
|
32
|
+
content: Buffer;
|
|
33
|
+
source: Source;
|
|
34
|
+
outputPath: string;
|
|
35
|
+
targetPath: string;
|
|
36
|
+
compilation: Compilation;
|
|
37
|
+
}
|
|
38
|
+
export type CompilerHooks = {
|
|
39
|
+
done: liteTapable.AsyncSeriesHook<Stats>;
|
|
40
|
+
afterDone: liteTapable.SyncHook<Stats>;
|
|
41
|
+
thisCompilation: liteTapable.SyncHook<[Compilation, CompilationParams]>;
|
|
42
|
+
compilation: liteTapable.SyncHook<[Compilation, CompilationParams]>;
|
|
43
|
+
invalid: liteTapable.SyncHook<[string | null, number]>;
|
|
44
|
+
compile: liteTapable.SyncHook<[CompilationParams]>;
|
|
45
|
+
normalModuleFactory: liteTapable.SyncHook<NormalModuleFactory>;
|
|
46
|
+
contextModuleFactory: liteTapable.SyncHook<ContextModuleFactory>;
|
|
47
|
+
initialize: liteTapable.SyncHook<[]>;
|
|
48
|
+
shouldEmit: liteTapable.SyncBailHook<[Compilation], boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Called when infrastructure logging is triggered, allowing plugins to intercept, modify, or handle log messages.
|
|
51
|
+
* If the hook returns `true`, the default infrastructure logging will be prevented.
|
|
52
|
+
* If it returns `undefined`, the default logging will proceed.
|
|
53
|
+
* @param name - The name of the logger
|
|
54
|
+
* @param type - The log type (e.g., 'log', 'warn', 'error', ...)
|
|
55
|
+
* @param args - An array of arguments passed to the logging method
|
|
56
|
+
*/
|
|
57
|
+
infrastructureLog: liteTapable.SyncBailHook<[
|
|
58
|
+
string,
|
|
59
|
+
string,
|
|
60
|
+
any[]
|
|
61
|
+
], true | void>;
|
|
62
|
+
beforeRun: liteTapable.AsyncSeriesHook<[Compiler]>;
|
|
63
|
+
run: liteTapable.AsyncSeriesHook<[Compiler]>;
|
|
64
|
+
emit: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
65
|
+
assetEmitted: liteTapable.AsyncSeriesHook<[string, AssetEmittedInfo]>;
|
|
66
|
+
afterEmit: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
67
|
+
failed: liteTapable.SyncHook<[Error]>;
|
|
68
|
+
shutdown: liteTapable.AsyncSeriesHook<[]>;
|
|
69
|
+
watchRun: liteTapable.AsyncSeriesHook<[Compiler]>;
|
|
70
|
+
watchClose: liteTapable.SyncHook<[]>;
|
|
71
|
+
environment: liteTapable.SyncHook<[]>;
|
|
72
|
+
afterEnvironment: liteTapable.SyncHook<[]>;
|
|
73
|
+
afterPlugins: liteTapable.SyncHook<[Compiler]>;
|
|
74
|
+
afterResolvers: liteTapable.SyncHook<[Compiler]>;
|
|
75
|
+
make: liteTapable.AsyncParallelHook<[Compilation]>;
|
|
76
|
+
beforeCompile: liteTapable.AsyncSeriesHook<[CompilationParams]>;
|
|
77
|
+
afterCompile: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
78
|
+
finishMake: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
79
|
+
entryOption: liteTapable.SyncBailHook<[string, EntryNormalized], any>;
|
|
80
|
+
additionalPass: liteTapable.AsyncSeriesHook<[]>;
|
|
81
|
+
};
|
|
82
|
+
export declare const GET_COMPILER_ID: unique symbol;
|
|
83
|
+
declare class Compiler {
|
|
84
|
+
#private;
|
|
85
|
+
hooks: CompilerHooks;
|
|
86
|
+
webpack: typeof rspack;
|
|
87
|
+
rspack: typeof rspack;
|
|
88
|
+
name?: string;
|
|
89
|
+
parentCompilation?: Compilation;
|
|
90
|
+
root: Compiler;
|
|
91
|
+
outputPath: string;
|
|
92
|
+
running: boolean;
|
|
93
|
+
idle: boolean;
|
|
94
|
+
resolverFactory: ResolverFactory;
|
|
95
|
+
infrastructureLogger: any;
|
|
96
|
+
watching?: Watching;
|
|
97
|
+
inputFileSystem: InputFileSystem | null;
|
|
98
|
+
intermediateFileSystem: IntermediateFileSystem | null;
|
|
99
|
+
outputFileSystem: OutputFileSystem | null;
|
|
100
|
+
watchFileSystem: WatchFileSystem | null;
|
|
101
|
+
records: Record<string, any[]>;
|
|
102
|
+
modifiedFiles?: ReadonlySet<string>;
|
|
103
|
+
removedFiles?: ReadonlySet<string>;
|
|
104
|
+
fileTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | 'ignore' | null>;
|
|
105
|
+
contextTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | 'ignore' | null>;
|
|
106
|
+
fsStartTime?: number;
|
|
107
|
+
watchMode: boolean;
|
|
108
|
+
context: string;
|
|
109
|
+
cache: Cache;
|
|
110
|
+
compilerPath: string;
|
|
111
|
+
options: RspackOptionsNormalized;
|
|
112
|
+
/**
|
|
113
|
+
* Whether to skip dropping Rust compiler instance to improve performance.
|
|
114
|
+
* This is an internal option api and could be removed or changed at any time.
|
|
115
|
+
* @internal
|
|
116
|
+
* true: Skip dropping Rust compiler instance.
|
|
117
|
+
* false: Drop Rust compiler instance when Compiler is garbage collected.
|
|
118
|
+
*/
|
|
119
|
+
unsafeFastDrop: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
__internal_browser_require: (id: string) => unknown;
|
|
125
|
+
constructor(context: string, options: RspackOptionsNormalized);
|
|
126
|
+
get recordsInputPath(): never;
|
|
127
|
+
get recordsOutputPath(): never;
|
|
128
|
+
get managedPaths(): never;
|
|
129
|
+
get immutablePaths(): never;
|
|
130
|
+
get _lastCompilation(): Compilation | undefined;
|
|
131
|
+
get platform(): PlatformTargetProperties;
|
|
132
|
+
set platform(platform: PlatformTargetProperties);
|
|
133
|
+
get target(): ExtractedTargetProperties;
|
|
134
|
+
set target(target: ExtractedTargetProperties);
|
|
135
|
+
/**
|
|
136
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
get __internal__builtinPlugins(): binding.BuiltinPlugin[];
|
|
140
|
+
/**
|
|
141
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
get __internal__ruleSet(): RuleSetCompiler;
|
|
145
|
+
/**
|
|
146
|
+
* @param name - cache name
|
|
147
|
+
* @returns the cache facade instance
|
|
148
|
+
*/
|
|
149
|
+
getCache(name: string): CacheFacade;
|
|
150
|
+
/**
|
|
151
|
+
* @param name - name of the logger, or function called once to get the logger name
|
|
152
|
+
* @returns a logger with that name
|
|
153
|
+
*/
|
|
154
|
+
getInfrastructureLogger(name: string | (() => string)): Logger;
|
|
155
|
+
/**
|
|
156
|
+
* @param watchOptions - the watcher's options
|
|
157
|
+
* @param handler - signals when the call finishes
|
|
158
|
+
* @returns a compiler watcher
|
|
159
|
+
*/
|
|
160
|
+
watch(watchOptions: Watchpack.WatchOptions, handler: liteTapable.Callback<Error, Stats>): Watching;
|
|
161
|
+
/**
|
|
162
|
+
* @param callback - signals when the call finishes
|
|
163
|
+
* @param options - additional data like modifiedFiles, removedFiles
|
|
164
|
+
*/
|
|
165
|
+
run(callback: liteTapable.Callback<Error, Stats>, options?: {
|
|
166
|
+
modifiedFiles?: ReadonlySet<string>;
|
|
167
|
+
removedFiles?: ReadonlySet<string>;
|
|
168
|
+
}): void;
|
|
169
|
+
runAsChild(callback: (err?: null | Error, entries?: Chunk[], compilation?: Compilation) => any): void;
|
|
170
|
+
purgeInputFileSystem(): void;
|
|
171
|
+
/**
|
|
172
|
+
* @param compilation - the compilation
|
|
173
|
+
* @param compilerName - the compiler's name
|
|
174
|
+
* @param compilerIndex - the compiler's index
|
|
175
|
+
* @param outputOptions - the output options
|
|
176
|
+
* @param plugins - the plugins to apply
|
|
177
|
+
* @returns a child compiler
|
|
178
|
+
*/
|
|
179
|
+
createChildCompiler(compilation: Compilation, compilerName: string, compilerIndex: number, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
|
|
180
|
+
isChild(): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Create a compilation and run it, which is the basic method that `compiler.run` and `compiler.watch` depend on.
|
|
183
|
+
* TODO: make this method private in the next major release
|
|
184
|
+
* @private this method is only used in Rspack core
|
|
185
|
+
*/
|
|
186
|
+
compile(callback: liteTapable.Callback<Error, Compilation>): void;
|
|
187
|
+
close(callback: (error?: Error | null) => void): void;
|
|
188
|
+
/**
|
|
189
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
190
|
+
* @internal
|
|
191
|
+
*/
|
|
192
|
+
__internal__rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
|
|
193
|
+
/**
|
|
194
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
__internal__create_compilation(native: binding.JsCompilation): Compilation;
|
|
198
|
+
/**
|
|
199
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
__internal__get_virtual_file_store(): binding.VirtualFileStore | null | undefined;
|
|
203
|
+
/**
|
|
204
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
205
|
+
* @internal
|
|
206
|
+
*/
|
|
207
|
+
__internal__registerBuiltinPlugin(plugin: binding.BuiltinPlugin): void;
|
|
208
|
+
/**
|
|
209
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
__internal__takeModuleExecutionResult(id: number): any;
|
|
213
|
+
/**
|
|
214
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
__internal__get_compilation(): Compilation | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
__internal__get_compilation_params(): CompilationParams | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
__internal__get_module_execution_results_map(): Map<number, any>;
|
|
228
|
+
}
|
|
229
|
+
export { Compiler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConcatenatedModule } from '@ohos-ports/rspack-binding';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContextModule } from '@ohos-ports/rspack-binding';
|