@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,424 @@
|
|
|
1
|
+
import type { AssetInfo, RawModuleRuleUse, RawOptions } from '@ohos-ports/rspack-binding';
|
|
2
|
+
import type { Compilation } from '../Compilation.js';
|
|
3
|
+
import type { Compiler } from '../Compiler.js';
|
|
4
|
+
import type { LoaderObject } from '../loader-runner/index.js';
|
|
5
|
+
import type { Logger } from '../logging/Logger.js';
|
|
6
|
+
import type { Module } from '../Module.js';
|
|
7
|
+
import type { ResolveRequest } from '../Resolver.js';
|
|
8
|
+
import type Hash from '../util/hash/index.js';
|
|
9
|
+
import type { RspackOptionsNormalized } from './normalization.js';
|
|
10
|
+
import type { Environment, Mode, PublicPath, Resolve, RuleSetLoaderWithOptions, RuleSetUseItem, Target } from './types.js';
|
|
11
|
+
export declare const BUILTIN_LOADER_PREFIX = "builtin:";
|
|
12
|
+
export interface ComposeJsUseOptions {
|
|
13
|
+
context: RawOptions['context'];
|
|
14
|
+
mode: RawOptions['mode'];
|
|
15
|
+
experiments: RawOptions['experiments'];
|
|
16
|
+
compiler: Compiler;
|
|
17
|
+
}
|
|
18
|
+
export interface RawSourceMap {
|
|
19
|
+
/**
|
|
20
|
+
* The version of the source map format, always 3
|
|
21
|
+
*/
|
|
22
|
+
version: number;
|
|
23
|
+
/**
|
|
24
|
+
* A list of original sources used by the mappings field
|
|
25
|
+
*/
|
|
26
|
+
sources: string[];
|
|
27
|
+
/**
|
|
28
|
+
* A string with the encoded mapping data
|
|
29
|
+
*/
|
|
30
|
+
mappings: string;
|
|
31
|
+
/**
|
|
32
|
+
* The filename of the generated code that this source map is associated with
|
|
33
|
+
*/
|
|
34
|
+
file: string;
|
|
35
|
+
/**
|
|
36
|
+
* An optional source root string, used for relocating source files on a server
|
|
37
|
+
* or removing repeated values in the sources entry.
|
|
38
|
+
*/
|
|
39
|
+
sourceRoot?: string;
|
|
40
|
+
/**
|
|
41
|
+
* An array containing the actual content of the original source files
|
|
42
|
+
*/
|
|
43
|
+
sourcesContent?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* A list of symbol names which may be used by the mappings field.
|
|
46
|
+
*/
|
|
47
|
+
names: string[];
|
|
48
|
+
/**
|
|
49
|
+
* A unique identifier for debugging purposes
|
|
50
|
+
*/
|
|
51
|
+
debugId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* An array of indices into the sources array, indicating which sources
|
|
54
|
+
* should be ignored by debuggers
|
|
55
|
+
*/
|
|
56
|
+
ignoreList?: number[];
|
|
57
|
+
}
|
|
58
|
+
export interface AdditionalData {
|
|
59
|
+
[index: string]: any;
|
|
60
|
+
}
|
|
61
|
+
export type LoaderContextCallback = (err?: Error | null, content?: string | Buffer, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => void;
|
|
62
|
+
export type ErrorWithDetails = Error & {
|
|
63
|
+
details?: string;
|
|
64
|
+
};
|
|
65
|
+
export type ResolveCallback = (err: null | ErrorWithDetails, res?: string | false, req?: ResolveRequest) => void;
|
|
66
|
+
export interface DiagnosticLocation {
|
|
67
|
+
/** Text for highlighting the location */
|
|
68
|
+
text?: string;
|
|
69
|
+
/** 1-based line */
|
|
70
|
+
line: number;
|
|
71
|
+
/** 0-based column in bytes */
|
|
72
|
+
column: number;
|
|
73
|
+
/** Length in bytes */
|
|
74
|
+
length: number;
|
|
75
|
+
}
|
|
76
|
+
export interface Diagnostic {
|
|
77
|
+
message: string;
|
|
78
|
+
help?: string;
|
|
79
|
+
sourceCode?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Location to the source code.
|
|
82
|
+
* If `sourceCode` is not provided, location will be omitted.
|
|
83
|
+
*/
|
|
84
|
+
location?: DiagnosticLocation;
|
|
85
|
+
/**
|
|
86
|
+
* Optional filename to show.
|
|
87
|
+
* If provided, it becomes the `StatsError.file` value in stats.
|
|
88
|
+
*/
|
|
89
|
+
file?: string;
|
|
90
|
+
severity: 'error' | 'warning';
|
|
91
|
+
}
|
|
92
|
+
export interface LoaderExperiments {
|
|
93
|
+
/**
|
|
94
|
+
* Emit an error or warning diagnostic without marking the current module as a compilation
|
|
95
|
+
* failure.
|
|
96
|
+
*/
|
|
97
|
+
emitDiagnostic(diagnostic: Diagnostic): void;
|
|
98
|
+
}
|
|
99
|
+
export interface ImportModuleOptions {
|
|
100
|
+
/**
|
|
101
|
+
* Specify a layer in which this module is placed/compiled
|
|
102
|
+
*/
|
|
103
|
+
layer?: string;
|
|
104
|
+
/**
|
|
105
|
+
* The public path used for the built modules
|
|
106
|
+
*/
|
|
107
|
+
publicPath?: PublicPath;
|
|
108
|
+
/**
|
|
109
|
+
* Target base uri
|
|
110
|
+
*/
|
|
111
|
+
baseUri?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface LoaderContext<OptionsType = {}> {
|
|
114
|
+
/**
|
|
115
|
+
* The version number of the loader API. Currently 2.
|
|
116
|
+
* This is useful for providing backwards compatibility. Using the version you can specify
|
|
117
|
+
* custom logic or fallbacks for breaking changes.
|
|
118
|
+
*/
|
|
119
|
+
version: 2;
|
|
120
|
+
/**
|
|
121
|
+
* The path string of the current module.
|
|
122
|
+
* @example `'/abc/resource.js?query#hash'`.
|
|
123
|
+
*/
|
|
124
|
+
resource: string;
|
|
125
|
+
/**
|
|
126
|
+
* The path string of the current module, excluding the query and fragment parameters.
|
|
127
|
+
* @example `'/abc/resource.js'` in `'/abc/resource.js?query#hash'`.
|
|
128
|
+
*/
|
|
129
|
+
resourcePath: string;
|
|
130
|
+
/**
|
|
131
|
+
* The query parameter for the path string of the current module.
|
|
132
|
+
* @example `'?query'` in `'/abc/resource.js?query#hash'`.
|
|
133
|
+
*/
|
|
134
|
+
resourceQuery: string;
|
|
135
|
+
/**
|
|
136
|
+
* The fragment parameter of the current module's path string.
|
|
137
|
+
* @example `'#hash'` in `'/abc/resource.js?query#hash'`.
|
|
138
|
+
*/
|
|
139
|
+
resourceFragment: string;
|
|
140
|
+
/**
|
|
141
|
+
* Tells Rspack that this loader will be called asynchronously. Returns `this.callback`.
|
|
142
|
+
*/
|
|
143
|
+
async(): LoaderContextCallback;
|
|
144
|
+
/**
|
|
145
|
+
* A function that can be called synchronously or asynchronously to return multiple results.
|
|
146
|
+
* The expected arguments are:
|
|
147
|
+
*
|
|
148
|
+
* 1. The first parameter is an `Error` when the loader fails, or `null` or `undefined` when it
|
|
149
|
+
* succeeds.
|
|
150
|
+
* 2. The second parameter is the transformed content as a `string` or `Buffer`. It can be
|
|
151
|
+
* omitted when reporting an error.
|
|
152
|
+
* 3. The third parameter is an optional source map as a `string` or `RawSourceMap`.
|
|
153
|
+
* 4. The fourth parameter is optional additional data. Rspack passes it as the third argument
|
|
154
|
+
* to the next loader in the chain.
|
|
155
|
+
*/
|
|
156
|
+
callback: LoaderContextCallback;
|
|
157
|
+
/**
|
|
158
|
+
* By default, the final build result produced for the current module by the entire loader chain
|
|
159
|
+
* is cacheable. Passing `false` marks that result as non-cacheable. Calls from subsequent loaders
|
|
160
|
+
* with `true` or no argument do not make it cacheable again; only `this.clearDependencies()`
|
|
161
|
+
* resets this state.
|
|
162
|
+
*/
|
|
163
|
+
cacheable(cacheable?: boolean): void;
|
|
164
|
+
/**
|
|
165
|
+
* Tells if source map should be generated. Since generating source maps can be an expensive task,
|
|
166
|
+
* you should check if source maps are actually requested.
|
|
167
|
+
*/
|
|
168
|
+
sourceMap: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* The base path configured in Rspack config via `context`.
|
|
171
|
+
*/
|
|
172
|
+
rootContext: string;
|
|
173
|
+
/**
|
|
174
|
+
* The directory path of the currently processed module, which changes with the
|
|
175
|
+
* location of each processed module.
|
|
176
|
+
* For example, if the loader is processing `/project/src/components/Button.js`,
|
|
177
|
+
* then the value of `this.context` would be `/project/src/components`.
|
|
178
|
+
* The value is `null` when the current module has no resource path.
|
|
179
|
+
*/
|
|
180
|
+
context: string | null;
|
|
181
|
+
/**
|
|
182
|
+
* The index in the loaders array of the current loader.
|
|
183
|
+
*/
|
|
184
|
+
loaderIndex: number;
|
|
185
|
+
/**
|
|
186
|
+
* A request string consisting of the loaders that follow the current loader
|
|
187
|
+
* in the chain and the current resource, joined with `!`.
|
|
188
|
+
*/
|
|
189
|
+
remainingRequest: string;
|
|
190
|
+
/**
|
|
191
|
+
* A request string consisting of the current loader, the loaders that follow it, and the current
|
|
192
|
+
* resource, joined with `!`.
|
|
193
|
+
*/
|
|
194
|
+
currentRequest: string;
|
|
195
|
+
/**
|
|
196
|
+
* A request string consisting of the loaders that precede the current loader, joined with `!`.
|
|
197
|
+
* It does not include the current resource.
|
|
198
|
+
*/
|
|
199
|
+
previousRequest: string;
|
|
200
|
+
/**
|
|
201
|
+
* The complete request string, consisting of all loaders and the current resource joined with
|
|
202
|
+
* `!`. For example, if a `resource.js` is processed by `loader1.js` and `loader2.js`, the value
|
|
203
|
+
* is `/path/to/loader1.js!/path/to/loader2.js!/path/to/resource.js`.
|
|
204
|
+
*/
|
|
205
|
+
request: string;
|
|
206
|
+
/**
|
|
207
|
+
* An array containing all loaders applied to the current module. Each item
|
|
208
|
+
* provides information such as the resolved request, path, query, and
|
|
209
|
+
* options. The array can be modified during the pitch phase to adjust the
|
|
210
|
+
* loader chain.
|
|
211
|
+
*/
|
|
212
|
+
loaders: LoaderObject[];
|
|
213
|
+
/**
|
|
214
|
+
* The value of the `mode` configuration. It is `undefined` when `mode` is not configured, even
|
|
215
|
+
* though Rspack applies production-oriented defaults in that case.
|
|
216
|
+
*/
|
|
217
|
+
mode?: Mode;
|
|
218
|
+
/**
|
|
219
|
+
* A loader-facing target derived from the `target` configuration.
|
|
220
|
+
*/
|
|
221
|
+
target?: Target;
|
|
222
|
+
/**
|
|
223
|
+
* Describes the capabilities supported by the target environment. By default, this is the
|
|
224
|
+
* effective value of `output.environment`: Rspack infers capabilities from `target`, then
|
|
225
|
+
* applies the explicit settings from `output.environment`.
|
|
226
|
+
*/
|
|
227
|
+
environment: Environment;
|
|
228
|
+
/**
|
|
229
|
+
* Whether HMR is enabled.
|
|
230
|
+
*/
|
|
231
|
+
hot?: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Get the options passed in by the loader's user.
|
|
234
|
+
* @param schema To provide the best performance, Rspack does not perform the schema
|
|
235
|
+
* validation. If your loader requires schema validation, please call schema-utils or
|
|
236
|
+
* zod on your own.
|
|
237
|
+
*/
|
|
238
|
+
getOptions(schema?: any): OptionsType;
|
|
239
|
+
/**
|
|
240
|
+
* Resolve a module specifier.
|
|
241
|
+
* @param context The absolute path to a directory. This directory is used as the starting
|
|
242
|
+
* location for resolving.
|
|
243
|
+
* @param request The module specifier to be resolved.
|
|
244
|
+
* @param callback Receives an error, the resolved path or `false`, and optional resolution
|
|
245
|
+
* details.
|
|
246
|
+
*/
|
|
247
|
+
resolve(context: string, request: string, callback: ResolveCallback): void;
|
|
248
|
+
/**
|
|
249
|
+
* Create a resolver like `this.resolve`. When the returned resolver is called without a
|
|
250
|
+
* callback, it returns a Promise.
|
|
251
|
+
* @param options Optional options used to customize the resolver.
|
|
252
|
+
*/
|
|
253
|
+
getResolve(options?: Resolve): ((context: string, request: string, callback: ResolveCallback) => void) & ((context: string, request: string) => Promise<string | false | undefined>);
|
|
254
|
+
/**
|
|
255
|
+
* Get the logger of this compilation, through which messages can be logged.
|
|
256
|
+
* @param name An optional name for the logger.
|
|
257
|
+
*/
|
|
258
|
+
getLogger(name?: string): Logger;
|
|
259
|
+
/**
|
|
260
|
+
* Emit an error. Unlike `throw` and `this.callback(err)` in the loader, it does not mark the
|
|
261
|
+
* current module as a compilation failure. It adds an error to Rspack's Compilation and displays
|
|
262
|
+
* it on the command line at the end of this compilation.
|
|
263
|
+
*/
|
|
264
|
+
emitError(error: Error): void;
|
|
265
|
+
/**
|
|
266
|
+
* Emit a warning.
|
|
267
|
+
*/
|
|
268
|
+
emitWarning(warning: Error): void;
|
|
269
|
+
/**
|
|
270
|
+
* Emit a new file. This method allows you to create new files during the loader execution.
|
|
271
|
+
*/
|
|
272
|
+
emitFile(name: string, content: string | Buffer, sourceMap?: string, assetInfo?: AssetInfo): void;
|
|
273
|
+
/**
|
|
274
|
+
* Add a file as a dependency on the loader results so that any changes to them can be listened to.
|
|
275
|
+
* For example, `sass-loader`, `less-loader` use this trick to recompile when the imported style
|
|
276
|
+
* files change.
|
|
277
|
+
*/
|
|
278
|
+
addDependency(file: string): void;
|
|
279
|
+
/**
|
|
280
|
+
* Alias of `this.addDependency()`.
|
|
281
|
+
*/
|
|
282
|
+
dependency(file: string): void;
|
|
283
|
+
/**
|
|
284
|
+
* Add the directory as a dependency for the loader results so that any changes to the
|
|
285
|
+
* files in the directory can be listened to.
|
|
286
|
+
*/
|
|
287
|
+
addContextDependency(context: string): void;
|
|
288
|
+
/**
|
|
289
|
+
* Add a currently non-existent file as a dependency of the loader result, so that its
|
|
290
|
+
* creation and any changes can be listened. For example, when a new file is created at
|
|
291
|
+
* that path, it will trigger a rebuild.
|
|
292
|
+
*/
|
|
293
|
+
addMissingDependency(missing: string): void;
|
|
294
|
+
/**
|
|
295
|
+
* Clears all file, context, and missing dependencies collected by the loader chain. Build
|
|
296
|
+
* dependencies are not cleared. This also resets `cacheable` to `true`, overriding any earlier
|
|
297
|
+
* call to `this.cacheable(false)`. Only use this method when the current loader will register
|
|
298
|
+
* every dependency required by the final result.
|
|
299
|
+
*/
|
|
300
|
+
clearDependencies(): void;
|
|
301
|
+
/**
|
|
302
|
+
* Get a copy of all files the loader currently watches as dependencies.
|
|
303
|
+
*/
|
|
304
|
+
getDependencies(): string[];
|
|
305
|
+
/**
|
|
306
|
+
* Get a copy of all directories the loader currently watches as context dependencies.
|
|
307
|
+
*/
|
|
308
|
+
getContextDependencies(): string[];
|
|
309
|
+
/**
|
|
310
|
+
* Get a copy of all paths to files that the loader is watching but that do not exist yet.
|
|
311
|
+
*/
|
|
312
|
+
getMissingDependencies(): string[];
|
|
313
|
+
/**
|
|
314
|
+
* Add a file as a build dependency of the loader result.
|
|
315
|
+
* Build dependencies invalidate the persistent cache when they change.
|
|
316
|
+
*/
|
|
317
|
+
addBuildDependency(file: string): void;
|
|
318
|
+
/**
|
|
319
|
+
* Compile and execute a module at the build time.
|
|
320
|
+
* This is an alternative lightweight solution for the child compiler.
|
|
321
|
+
* `importModule` will return a Promise if no callback is provided.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```ts
|
|
325
|
+
* const modulePath = path.resolve(__dirname, 'some-module.ts');
|
|
326
|
+
* const moduleExports = await this.importModule(modulePath, {
|
|
327
|
+
* // optional options
|
|
328
|
+
* });
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
importModule<T = any>(request: string, options: ImportModuleOptions | undefined, callback: (err?: null | Error, exports?: T) => any): void;
|
|
332
|
+
importModule<T = any>(request: string, options?: ImportModuleOptions): Promise<T>;
|
|
333
|
+
/**
|
|
334
|
+
* Access to the `compilation` object's `inputFileSystem` property.
|
|
335
|
+
*/
|
|
336
|
+
fs: any;
|
|
337
|
+
/**
|
|
338
|
+
* This is an experimental API and maybe subject to change.
|
|
339
|
+
* @experimental
|
|
340
|
+
*/
|
|
341
|
+
experiments: LoaderExperiments;
|
|
342
|
+
/**
|
|
343
|
+
* Access to some utilities.
|
|
344
|
+
*/
|
|
345
|
+
utils: {
|
|
346
|
+
/**
|
|
347
|
+
* Return a new request string using absolute paths when possible.
|
|
348
|
+
*/
|
|
349
|
+
absolutify: (context: string, request: string) => string;
|
|
350
|
+
/**
|
|
351
|
+
* Return a new request string avoiding absolute paths when possible.
|
|
352
|
+
*/
|
|
353
|
+
contextify: (context: string, request: string) => string;
|
|
354
|
+
/**
|
|
355
|
+
* Return a new Hash object from provided hash function.
|
|
356
|
+
*/
|
|
357
|
+
createHash: (algorithm?: string) => Hash;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* The value depends on the loader configuration:
|
|
361
|
+
* - If the current loader was configured with an options object, `this.query` will
|
|
362
|
+
* point to that object.
|
|
363
|
+
* - If the current loader has no options, but was invoked with a query string, this
|
|
364
|
+
* will be a string starting with `?`.
|
|
365
|
+
*/
|
|
366
|
+
query: string | OptionsType;
|
|
367
|
+
/**
|
|
368
|
+
* A data object shared between the pitch and the normal phase.
|
|
369
|
+
*/
|
|
370
|
+
data: unknown;
|
|
371
|
+
/**
|
|
372
|
+
* Access to the current Compiler object of Rspack.
|
|
373
|
+
*/
|
|
374
|
+
_compiler: Compiler;
|
|
375
|
+
/**
|
|
376
|
+
* Access to the current Compilation object of Rspack.
|
|
377
|
+
*/
|
|
378
|
+
_compilation: Compilation;
|
|
379
|
+
/**
|
|
380
|
+
* @deprecated Hacky access to the Module object being loaded.
|
|
381
|
+
*/
|
|
382
|
+
_module: Module;
|
|
383
|
+
/**
|
|
384
|
+
* Note: This is not a Rspack public API, maybe removed in future.
|
|
385
|
+
* Store some data from loader, and consume it from parser, it may be removed in the future
|
|
386
|
+
*
|
|
387
|
+
* @internal
|
|
388
|
+
*/
|
|
389
|
+
__internal__setParseMeta: (key: string, value: string) => void;
|
|
390
|
+
}
|
|
391
|
+
export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
392
|
+
export type PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
393
|
+
/**
|
|
394
|
+
* Defines a loader for Rspack.
|
|
395
|
+
* A loader is a transformer that converts various types of modules into Rspack
|
|
396
|
+
* supported types. By using different kinds of loaders, you can extend Rspack to
|
|
397
|
+
* process additional module types, including JSX, Markdown, Sass, Less, and more.
|
|
398
|
+
*
|
|
399
|
+
* @template OptionsType - The type of options that the loader accepts
|
|
400
|
+
* @template ContextAdditions - Additional properties to add to the loader context
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```ts
|
|
404
|
+
* import type { LoaderDefinition } from '@rspack/core';
|
|
405
|
+
*
|
|
406
|
+
* type MyLoaderOptions = {
|
|
407
|
+
* foo: string;
|
|
408
|
+
* };
|
|
409
|
+
*
|
|
410
|
+
* const myLoader: LoaderDefinition<MyLoaderOptions> = function(source) {
|
|
411
|
+
* return someOperation(source);
|
|
412
|
+
* };
|
|
413
|
+
*
|
|
414
|
+
* export default myLoader;
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
export type LoaderDefinition<OptionsType = {}, ContextAdditions = {}> = LoaderDefinitionFunction<OptionsType, ContextAdditions> & {
|
|
418
|
+
raw?: false;
|
|
419
|
+
pitch?: PitchLoaderDefinitionFunction;
|
|
420
|
+
};
|
|
421
|
+
export declare function createRawModuleRuleUses(uses: RuleSetUseItem | RuleSetUseItem[], path: string, options: ComposeJsUseOptions): RawModuleRuleUse[];
|
|
422
|
+
export type GetLoaderOptions = (o: RuleSetLoaderWithOptions['options'], options: ComposeJsUseOptions) => RuleSetLoaderWithOptions['options'];
|
|
423
|
+
export declare function isUseSourceMap(devtool: RspackOptionsNormalized['devtool']): boolean;
|
|
424
|
+
export declare function isUseSimpleSourceMap(devtool: RspackOptionsNormalized['devtool']): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/browserslistTargetHandler.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Sergey Melyukov @smelukov
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
import type { ApiTargetProperties, EcmaTargetProperties, PlatformTargetProperties } from './target.js';
|
|
11
|
+
/**
|
|
12
|
+
* @param browsers supported browsers list
|
|
13
|
+
* @returns target properties
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolve: (browsers: string[]) => EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RspackOptionsNormalized } from './normalization.js';
|
|
2
|
+
export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized, compilerIndex?: number) => false | {
|
|
3
|
+
platform: {
|
|
4
|
+
web: boolean | null | undefined;
|
|
5
|
+
browser: boolean | null | undefined;
|
|
6
|
+
webworker: boolean | null | undefined;
|
|
7
|
+
node: boolean | null | undefined;
|
|
8
|
+
nwjs: boolean | null | undefined;
|
|
9
|
+
electron: boolean | null | undefined;
|
|
10
|
+
};
|
|
11
|
+
esVersion: number | null | undefined;
|
|
12
|
+
targets: Record<string, string> | null | undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
|
|
15
|
+
export declare const getPnpDefault: () => boolean;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack-dev-server/blob/6045b1e9d63078fb24cac52eb361b7356944cddd/types/lib/Server.d.ts
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers @sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
import type { ReadStream } from 'node:fs';
|
|
11
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
12
|
+
import type { ServerOptions } from 'node:https';
|
|
13
|
+
import type { NextFunction } from '../../compiled/connect-next/index.js';
|
|
14
|
+
import type { Filter as ProxyFilter, Options as ProxyOptions } from '../../compiled/http-proxy-middleware/index.js';
|
|
15
|
+
import type { Options as OpenOptions } from '../../compiled/open/index.js';
|
|
16
|
+
import type { Compiler, Configuration, LiteralUnion, MultiCompiler, MultiStats, Stats, Watching } from '../index.js';
|
|
17
|
+
type Logger = ReturnType<Compiler['getInfrastructureLogger']>;
|
|
18
|
+
type MultiWatching = MultiCompiler['watch'];
|
|
19
|
+
export type DevServerHost = LiteralUnion<'local-ip' | 'local-ipv4' | 'local-ipv6', string>;
|
|
20
|
+
type BasicServer = import('node:net').Server | import('node:tls').Server;
|
|
21
|
+
export type DevServerOpenOptions = OpenOptions & {
|
|
22
|
+
target?: string | string[];
|
|
23
|
+
};
|
|
24
|
+
type ResponseData = {
|
|
25
|
+
data: Buffer | ReadStream;
|
|
26
|
+
byteLength: number;
|
|
27
|
+
};
|
|
28
|
+
type ModifyResponseData<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = (req: Req, res: Res, data: Buffer | ReadStream, byteLength: number) => ResponseData;
|
|
29
|
+
export type DevServerHeaders = {
|
|
30
|
+
key: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}[] | Record<string, string | string[]>;
|
|
33
|
+
type OutputFileSystem = import('../index.js').OutputFileSystem & {
|
|
34
|
+
statSync: import('fs').StatSyncFn;
|
|
35
|
+
readFileSync: typeof import('fs').readFileSync;
|
|
36
|
+
};
|
|
37
|
+
type Port = number | LiteralUnion<'auto', string>;
|
|
38
|
+
type HistoryContext = {
|
|
39
|
+
readonly match: RegExpMatchArray;
|
|
40
|
+
readonly parsedUrl: import('url').Url;
|
|
41
|
+
readonly request: any;
|
|
42
|
+
};
|
|
43
|
+
type RewriteTo = (context: HistoryContext) => string;
|
|
44
|
+
type Rewrite = {
|
|
45
|
+
readonly from: RegExp;
|
|
46
|
+
readonly to: string | RegExp | RewriteTo;
|
|
47
|
+
};
|
|
48
|
+
type HistoryApiFallbackOptions = {
|
|
49
|
+
readonly disableDotRule?: true;
|
|
50
|
+
readonly htmlAcceptHeaders?: readonly string[];
|
|
51
|
+
readonly index?: string;
|
|
52
|
+
readonly logger?: typeof console.log;
|
|
53
|
+
readonly rewrites?: readonly Rewrite[];
|
|
54
|
+
readonly verbose?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type DevMiddlewareOptions<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = {
|
|
57
|
+
mimeTypes?: {
|
|
58
|
+
[key: string]: string;
|
|
59
|
+
};
|
|
60
|
+
mimeTypeDefault?: string;
|
|
61
|
+
writeToDisk?: boolean | ((targetPath: string) => boolean);
|
|
62
|
+
methods?: string[];
|
|
63
|
+
headers?: any;
|
|
64
|
+
publicPath?: NonNullable<Configuration['output']>['publicPath'];
|
|
65
|
+
stats?: Configuration['stats'];
|
|
66
|
+
serverSideRender?: boolean;
|
|
67
|
+
outputFileSystem?: OutputFileSystem;
|
|
68
|
+
index?: string | boolean;
|
|
69
|
+
modifyResponseData?: ModifyResponseData<Req, Res>;
|
|
70
|
+
etag?: 'strong' | 'weak';
|
|
71
|
+
lastModified?: boolean;
|
|
72
|
+
cacheControl?: string | number | boolean | {
|
|
73
|
+
maxAge?: number;
|
|
74
|
+
immutable?: boolean;
|
|
75
|
+
};
|
|
76
|
+
cacheImmutable?: boolean;
|
|
77
|
+
};
|
|
78
|
+
type BasicApplication = any;
|
|
79
|
+
type ChokidarWatchOptions = {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
};
|
|
82
|
+
type ServeStaticOptions = {
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
};
|
|
85
|
+
type WatchFiles = {
|
|
86
|
+
paths: string | string[];
|
|
87
|
+
options?: ChokidarWatchOptions & {
|
|
88
|
+
aggregateTimeout?: number;
|
|
89
|
+
poll?: number | boolean;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export type DevServerStaticItem = {
|
|
93
|
+
directory?: string;
|
|
94
|
+
publicPath?: string | string[];
|
|
95
|
+
staticOptions?: ServeStaticOptions;
|
|
96
|
+
watch?: boolean | NonNullable<WatchFiles['options']>;
|
|
97
|
+
};
|
|
98
|
+
export type DevServerStatic = string | boolean | DevServerStaticItem | (string | DevServerStaticItem)[];
|
|
99
|
+
type ServerType<A extends BasicApplication, S extends BasicServer> = LiteralUnion<'http' | 'https' | 'http2', string> | ((arg0: ServerOptions, arg1: A) => S);
|
|
100
|
+
type ServerConfiguration<A extends BasicApplication, S extends BasicServer> = {
|
|
101
|
+
type?: ServerType<A, S>;
|
|
102
|
+
options?: ServerOptions;
|
|
103
|
+
};
|
|
104
|
+
type WebSocketServerConfiguration = {
|
|
105
|
+
type?: string | Function;
|
|
106
|
+
options?: Record<string, any>;
|
|
107
|
+
};
|
|
108
|
+
export type DevServerProxyConfigArrayItem = {
|
|
109
|
+
/**
|
|
110
|
+
* Alias for `pathFilter` in `http-proxy-middleware` options.
|
|
111
|
+
* When both `context` and `pathFilter` are provided, `pathFilter` takes precedence.
|
|
112
|
+
*/
|
|
113
|
+
context?: ProxyFilter;
|
|
114
|
+
} & ProxyOptions;
|
|
115
|
+
export type DevServerProxyConfigArray = (DevServerProxyConfigArrayItem | ((req?: IncomingMessage, res?: ServerResponse, next?: NextFunction) => DevServerProxyConfigArrayItem))[];
|
|
116
|
+
type Callback = (stats?: Stats | MultiStats) => any;
|
|
117
|
+
type DevMiddlewareContext = {
|
|
118
|
+
state: boolean;
|
|
119
|
+
stats: Stats | MultiStats | undefined;
|
|
120
|
+
callbacks: Callback[];
|
|
121
|
+
options: any;
|
|
122
|
+
compiler: Compiler | MultiCompiler;
|
|
123
|
+
watching: Watching | MultiWatching | undefined;
|
|
124
|
+
logger: Logger;
|
|
125
|
+
outputFileSystem: OutputFileSystem;
|
|
126
|
+
};
|
|
127
|
+
export type DevServerMiddlewareHandler<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = (req: Req, res: Res, next: NextFunction) => void | Promise<void>;
|
|
128
|
+
export type DevServerMiddlewareErrorHandler<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = (error: any, req: Req, res: Res, next: NextFunction) => void | Promise<void>;
|
|
129
|
+
export type DevServerMiddlewareObject<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = {
|
|
130
|
+
name?: string;
|
|
131
|
+
path?: string;
|
|
132
|
+
middleware: DevServerMiddlewareHandler<Req, Res> | DevServerMiddlewareErrorHandler<Req, Res>;
|
|
133
|
+
};
|
|
134
|
+
export type DevServerMiddleware = DevServerMiddlewareObject | DevServerMiddlewareHandler | DevServerMiddlewareErrorHandler;
|
|
135
|
+
type OverlayMessageOptions = boolean | ((error: Error) => void);
|
|
136
|
+
export type DevServerWebSocketURL = {
|
|
137
|
+
hostname?: string;
|
|
138
|
+
password?: string;
|
|
139
|
+
pathname?: string;
|
|
140
|
+
port?: string | number;
|
|
141
|
+
protocol?: string;
|
|
142
|
+
username?: string;
|
|
143
|
+
};
|
|
144
|
+
export type DevServerClient = {
|
|
145
|
+
logging?: 'none' | 'error' | 'warn' | 'info' | 'log' | 'verbose';
|
|
146
|
+
overlay?: boolean | {
|
|
147
|
+
warnings?: OverlayMessageOptions;
|
|
148
|
+
errors?: OverlayMessageOptions;
|
|
149
|
+
runtimeErrors?: OverlayMessageOptions;
|
|
150
|
+
};
|
|
151
|
+
progress?: boolean;
|
|
152
|
+
reconnect?: number | boolean;
|
|
153
|
+
webSocketTransport?: LiteralUnion<'ws', string>;
|
|
154
|
+
webSocketURL?: string | DevServerWebSocketURL;
|
|
155
|
+
};
|
|
156
|
+
export type DevServerOptions<A extends BasicApplication = BasicApplication, S extends BasicServer = BasicServer> = {
|
|
157
|
+
ipc?: string | boolean;
|
|
158
|
+
host?: DevServerHost;
|
|
159
|
+
port?: Port;
|
|
160
|
+
hot?: boolean | 'only';
|
|
161
|
+
liveReload?: boolean;
|
|
162
|
+
devMiddleware?: DevMiddlewareOptions;
|
|
163
|
+
compress?: boolean;
|
|
164
|
+
allowedHosts?: LiteralUnion<'auto' | 'all', string> | string[];
|
|
165
|
+
historyApiFallback?: boolean | HistoryApiFallbackOptions;
|
|
166
|
+
watchFiles?: string | string[] | WatchFiles | (string | WatchFiles)[];
|
|
167
|
+
static?: DevServerStatic;
|
|
168
|
+
server?: ServerType<A, S> | ServerConfiguration<A, S>;
|
|
169
|
+
app?: () => Promise<A>;
|
|
170
|
+
webSocketServer?: boolean | LiteralUnion<'ws', string> | WebSocketServerConfiguration;
|
|
171
|
+
proxy?: DevServerProxyConfigArray;
|
|
172
|
+
open?: string | boolean | DevServerOpenOptions | (string | DevServerOpenOptions)[];
|
|
173
|
+
setupExitSignals?: boolean;
|
|
174
|
+
client?: boolean | DevServerClient;
|
|
175
|
+
headers?: DevServerHeaders | ((req: IncomingMessage, res: ServerResponse, context: DevMiddlewareContext | undefined) => DevServerHeaders);
|
|
176
|
+
onListening?: (devServer: any) => void;
|
|
177
|
+
setupMiddlewares?: (middlewares: DevServerMiddleware[], devServer: any) => DevServerMiddleware[];
|
|
178
|
+
};
|
|
179
|
+
export {};
|