@rspack-debug/core 1.4.11 → 1.6.4
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/compiled/@swc/types/index.d.ts +15 -5
- package/compiled/@swc/types/package.json +1 -1
- package/compiled/browserslist-load-config/index.d.ts +11 -0
- package/compiled/browserslist-load-config/index.js +26 -40
- package/compiled/browserslist-load-config/package.json +1 -1
- package/compiled/watchpack/index.js +1015 -18
- package/compiled/webpack-sources/index.js +82 -82
- package/dist/Compilation.d.ts +17 -20
- package/dist/Compiler.d.ts +63 -32
- package/dist/Module.d.ts +3 -14
- package/dist/MultiCompiler.d.ts +7 -3
- package/dist/MultiStats.d.ts +3 -2
- package/dist/MultiWatching.d.ts +1 -1
- package/dist/NativeWatchFileSystem.d.ts +8 -2
- package/dist/NormalModuleFactory.d.ts +2 -2
- package/dist/Resolver.d.ts +13 -7
- package/dist/ResolverFactory.d.ts +8 -5
- package/dist/RspackError.d.ts +3 -0
- package/dist/RuntimeGlobals.d.ts +3 -0
- package/dist/RuntimeModule.d.ts +1 -1
- package/dist/VirtualModulesPlugin.d.ts +12 -0
- package/dist/Watching.d.ts +9 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +2 -2
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +2 -2
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +11 -0
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -2
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -2
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RslibPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RstestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -2
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -2
- package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +2 -2
- package/dist/builtin-plugin/css-extract/index.d.ts +2 -2
- package/dist/builtin-plugin/html-plugin/options.d.ts +0 -1
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
- package/dist/builtin-plugin/index.d.ts +4 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -17
- package/dist/config/adapterRuleUse.d.ts +65 -7
- package/dist/config/defaults.d.ts +0 -9
- package/dist/config/devServer.d.ts +123 -16
- package/dist/config/index.d.ts +1 -0
- package/dist/config/normalization.d.ts +18 -3
- package/dist/config/types.d.ts +119 -18
- package/dist/container/ModuleFederationManifestPlugin.d.ts +37 -0
- package/dist/container/ModuleFederationPlugin.d.ts +3 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/cssExtractHmr.js +12 -13
- package/dist/cssExtractLoader.js +9 -10
- package/dist/exports.d.ts +16 -9
- package/dist/index.js +1556 -5443
- package/dist/lib/Cache.d.ts +1 -1
- package/dist/loader-runner/ModuleError.d.ts +7 -1
- package/dist/loader-runner/loadLoader.d.ts +2 -1
- package/dist/loader-runner/service.d.ts +1 -1
- package/dist/loader-runner/utils.d.ts +2 -1
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +16 -0
- package/dist/stats/statsFactoryUtils.d.ts +17 -1
- package/dist/util/ArrayQueue.d.ts +2 -2
- package/dist/util/bindingVersionCheck.d.ts +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fs.d.ts +25 -2
- package/dist/util/index.d.ts +0 -3
- package/dist/util/source.d.ts +5 -6
- package/dist/util/validateConfig.d.ts +5 -0
- package/dist/worker.js +152 -118
- package/hot/lazy-compilation-node.js +1 -3
- package/hot/lazy-compilation-web.js +4 -3
- package/module.d.ts +11 -14
- package/package.json +20 -20
- package/compiled/graceful-fs/index.d.ts +0 -13
- package/compiled/graceful-fs/index.js +0 -1063
- package/compiled/graceful-fs/license +0 -15
- package/compiled/graceful-fs/package.json +0 -1
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +0 -29
- package/dist/loader-runner/ModuleWarning.d.ts +0 -7
- package/dist/schema/config.d.ts +0 -996
- package/dist/schema/loaders.d.ts +0 -400
- package/dist/schema/plugins.d.ts +0 -167
- package/dist/schema/utils.d.ts +0 -4
- package/dist/schema/validate.d.ts +0 -10
|
@@ -26,6 +26,7 @@ export * from "./EnableLibraryPlugin";
|
|
|
26
26
|
export * from "./EnableWasmLoadingPlugin";
|
|
27
27
|
export * from "./EnsureChunkConditionsPlugin";
|
|
28
28
|
export * from "./EntryPlugin";
|
|
29
|
+
export * from "./EsmLibraryPlugin";
|
|
29
30
|
export * from "./EvalDevToolModulePlugin";
|
|
30
31
|
export * from "./EvalSourceMapDevToolPlugin";
|
|
31
32
|
export * from "./ExternalsPlugin";
|
|
@@ -39,6 +40,7 @@ export * from "./HttpUriPlugin";
|
|
|
39
40
|
export * from "./html-plugin/index";
|
|
40
41
|
export * from "./IgnorePlugin";
|
|
41
42
|
export * from "./InferAsyncModulesPlugin";
|
|
43
|
+
export * from "./InlineExportsPlugin";
|
|
42
44
|
export * from "./JavascriptModulesPlugin";
|
|
43
45
|
export * from "./JsLoaderRspackPlugin";
|
|
44
46
|
export * from "./JsonModulesPlugin";
|
|
@@ -58,6 +60,7 @@ export * from "./NaturalChunkIdsPlugin";
|
|
|
58
60
|
export * from "./NaturalModuleIdsPlugin";
|
|
59
61
|
export * from "./NodeTargetPlugin";
|
|
60
62
|
export * from "./NoEmitOnErrorsPlugin";
|
|
63
|
+
export * from "./NormalModuleReplacementPlugin";
|
|
61
64
|
export * from "./OccurrenceChunkIdsPlugin";
|
|
62
65
|
export * from "./ProgressPlugin";
|
|
63
66
|
export * from "./ProvidePlugin";
|
|
@@ -75,6 +78,7 @@ export * from "./SourceMapDevToolPlugin";
|
|
|
75
78
|
export * from "./SplitChunksPlugin";
|
|
76
79
|
export * from "./SubresourceIntegrityPlugin";
|
|
77
80
|
export * from "./SwcJsMinimizerPlugin";
|
|
81
|
+
export * from "./URLPlugin";
|
|
78
82
|
export * from "./WarnCaseSensitiveModulesPlugin";
|
|
79
83
|
export * from "./WebWorkerTemplatePlugin";
|
|
80
84
|
export * from "./WorkerPlugin";
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import type { Module } from "../../Module";
|
|
2
2
|
export declare const BuiltinLazyCompilationPlugin: {
|
|
3
|
-
new (
|
|
4
|
-
module: string;
|
|
5
|
-
path: string;
|
|
6
|
-
}) => {
|
|
7
|
-
active: boolean;
|
|
8
|
-
data: string;
|
|
9
|
-
client: string;
|
|
10
|
-
}, cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((module: Module) => boolean) | undefined): {
|
|
3
|
+
new (currentActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, test?: RegExp | ((module: Module) => boolean) | undefined): {
|
|
11
4
|
name: string;
|
|
12
|
-
_args: [
|
|
13
|
-
|
|
14
|
-
path: string;
|
|
15
|
-
}) => {
|
|
16
|
-
active: boolean;
|
|
17
|
-
data: string;
|
|
18
|
-
client: string;
|
|
19
|
-
}, cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((module: Module) => boolean) | undefined];
|
|
20
|
-
affectedHooks: "done" | "compilation" | "afterDone" | "thisCompilation" | "invalid" | "compile" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "emit" | "assetEmitted" | "afterEmit" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "make" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
|
|
5
|
+
_args: [currentActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, test?: RegExp | ((module: Module) => boolean) | undefined];
|
|
6
|
+
affectedHooks: keyof import("../..").CompilerHooks | undefined;
|
|
21
7
|
raw(compiler: import("../..").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
22
8
|
apply(compiler: import("../..").Compiler): void;
|
|
23
9
|
};
|
|
@@ -15,19 +15,50 @@ export interface ComposeJsUseOptions {
|
|
|
15
15
|
experiments: RawOptions["experiments"];
|
|
16
16
|
compiler: Compiler;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface RawSourceMap {
|
|
19
|
+
/**
|
|
20
|
+
* The version of the source map format, always 3
|
|
21
|
+
*/
|
|
19
22
|
version: number;
|
|
23
|
+
/**
|
|
24
|
+
* A list of original sources used by the mappings field
|
|
25
|
+
*/
|
|
20
26
|
sources: string[];
|
|
27
|
+
/**
|
|
28
|
+
* A string with the encoded mapping data
|
|
29
|
+
*/
|
|
21
30
|
mappings: string;
|
|
22
|
-
|
|
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
|
+
*/
|
|
23
39
|
sourceRoot?: string;
|
|
40
|
+
/**
|
|
41
|
+
* An array containing the actual content of the original source files
|
|
42
|
+
*/
|
|
24
43
|
sourcesContent?: string[];
|
|
25
|
-
|
|
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[];
|
|
26
57
|
}
|
|
27
58
|
export interface AdditionalData {
|
|
28
59
|
[index: string]: any;
|
|
29
60
|
}
|
|
30
|
-
export type LoaderContextCallback = (err?: Error | null, content?: string | Buffer, sourceMap?: string |
|
|
61
|
+
export type LoaderContextCallback = (err?: Error | null, content?: string | Buffer, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => void;
|
|
31
62
|
export type ErrorWithDetails = Error & {
|
|
32
63
|
details?: string;
|
|
33
64
|
};
|
|
@@ -48,10 +79,13 @@ export interface Diagnostic {
|
|
|
48
79
|
sourceCode?: string;
|
|
49
80
|
/**
|
|
50
81
|
* Location to the source code.
|
|
51
|
-
*
|
|
52
82
|
* If `sourceCode` is not provided, location will be omitted.
|
|
53
83
|
*/
|
|
54
84
|
location?: DiagnosticLocation;
|
|
85
|
+
/**
|
|
86
|
+
* Optional filename to show.
|
|
87
|
+
* If provided, it becomes the `StatsError.file` value in stats.
|
|
88
|
+
*/
|
|
55
89
|
file?: string;
|
|
56
90
|
severity: "error" | "warning";
|
|
57
91
|
}
|
|
@@ -322,8 +356,32 @@ export interface LoaderContext<OptionsType = {}> {
|
|
|
322
356
|
*/
|
|
323
357
|
__internal__setParseMeta: (key: string, value: string) => void;
|
|
324
358
|
}
|
|
325
|
-
export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string |
|
|
326
|
-
export type PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object) => string | void | Buffer | Promise<string | Buffer>;
|
|
359
|
+
export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
360
|
+
export type PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
361
|
+
/**
|
|
362
|
+
* Defines a loader for Rspack.
|
|
363
|
+
* A loader is a transformer that converts various types of modules into Rspack
|
|
364
|
+
* supported types. By using different kinds of loaders, you can extend Rspack to
|
|
365
|
+
* process additional module types, including JSX, Markdown, Sass, Less, and more.
|
|
366
|
+
*
|
|
367
|
+
* @template OptionsType - The type of options that the loader accepts
|
|
368
|
+
* @template ContextAdditions - Additional properties to add to the loader context
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* import type { LoaderDefinition } from '@rspack/core';
|
|
373
|
+
*
|
|
374
|
+
* type MyLoaderOptions = {
|
|
375
|
+
* foo: string;
|
|
376
|
+
* };
|
|
377
|
+
*
|
|
378
|
+
* const myLoader: LoaderDefinition<MyLoaderOptions> = function(source) {
|
|
379
|
+
* return someOperation(source);
|
|
380
|
+
* };
|
|
381
|
+
*
|
|
382
|
+
* export default myLoader;
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
327
385
|
export type LoaderDefinition<OptionsType = {}, ContextAdditions = {}> = LoaderDefinitionFunction<OptionsType, ContextAdditions> & {
|
|
328
386
|
raw?: false;
|
|
329
387
|
pitch?: PitchLoaderDefinitionFunction;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The following code is modified based on
|
|
3
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/defaults.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
1
|
import type { RspackOptionsNormalized } from "./normalization";
|
|
11
2
|
export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void;
|
|
12
3
|
export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import type
|
|
10
|
+
import type * as http from "node:http";
|
|
11
|
+
import type * as net from "node:net";
|
|
12
|
+
import type * as stream from "node:stream";
|
|
13
|
+
import type * as url from "node:url";
|
|
14
|
+
import type { Compiler, LiteralUnion, MultiCompiler, MultiStats, Stats, Watching } from "..";
|
|
11
15
|
type Logger = ReturnType<Compiler["getInfrastructureLogger"]>;
|
|
12
16
|
type MultiWatching = MultiCompiler["watch"];
|
|
13
17
|
type BasicServer = import("net").Server | import("tls").Server;
|
|
@@ -28,17 +32,16 @@ type ResponseData = {
|
|
|
28
32
|
byteLength: number;
|
|
29
33
|
};
|
|
30
34
|
type ModifyResponseData<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = (req: RequestInternal, res: ResponseInternal, data: Buffer | ReadStream, byteLength: number) => ResponseData;
|
|
31
|
-
type Headers =
|
|
35
|
+
type Headers = {
|
|
32
36
|
key: string;
|
|
33
37
|
value: string;
|
|
34
|
-
}
|
|
38
|
+
}[] | Record<string, string | string[]>;
|
|
35
39
|
type OutputFileSystem = import("..").OutputFileSystem & {
|
|
36
|
-
createReadStream?: typeof import("fs").createReadStream;
|
|
37
40
|
statSync: import("fs").StatSyncFn;
|
|
38
41
|
readFileSync: typeof import("fs").readFileSync;
|
|
39
42
|
};
|
|
40
43
|
type RspackConfiguration = import("..").Configuration;
|
|
41
|
-
type Port = number |
|
|
44
|
+
type Port = number | LiteralUnion<"auto", string>;
|
|
42
45
|
type HistoryContext = {
|
|
43
46
|
readonly match: RegExpMatchArray;
|
|
44
47
|
readonly parsedUrl: import("url").Url;
|
|
@@ -80,7 +83,7 @@ type DevMiddlewareOptions<RequestInternal extends IncomingMessage = IncomingMess
|
|
|
80
83
|
cacheImmutable?: boolean | undefined;
|
|
81
84
|
};
|
|
82
85
|
type BasicApplication = any;
|
|
83
|
-
type BonjourServer = any
|
|
86
|
+
type BonjourServer = Record<string, any>;
|
|
84
87
|
type ChokidarWatchOptions = {
|
|
85
88
|
[key: string]: any;
|
|
86
89
|
};
|
|
@@ -112,7 +115,7 @@ type Static = {
|
|
|
112
115
|
poll?: number | boolean;
|
|
113
116
|
}) | undefined;
|
|
114
117
|
};
|
|
115
|
-
type ServerType<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = "http" | "https" | "spdy" | "http2"
|
|
118
|
+
type ServerType<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = LiteralUnion<"http" | "https" | "spdy" | "http2", string> | ((arg0: ServerOptions, arg1: A) => S);
|
|
116
119
|
type ServerConfiguration<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = {
|
|
117
120
|
type?: ServerType<A, S> | undefined;
|
|
118
121
|
options?: ServerOptions | undefined;
|
|
@@ -123,16 +126,14 @@ type WebSocketServerConfiguration = {
|
|
|
123
126
|
};
|
|
124
127
|
type NextFunction = (err?: any) => void;
|
|
125
128
|
type ProxyConfigArrayItem = {
|
|
126
|
-
path?: HttpProxyMiddlewareOptionsFilter
|
|
127
|
-
context?: HttpProxyMiddlewareOptionsFilter
|
|
129
|
+
path?: HttpProxyMiddlewareOptionsFilter;
|
|
130
|
+
context?: HttpProxyMiddlewareOptionsFilter;
|
|
128
131
|
} & {
|
|
129
132
|
bypass?: ByPass;
|
|
130
|
-
} &
|
|
131
|
-
[key: string]: any;
|
|
132
|
-
};
|
|
133
|
+
} & HttpProxyMiddlewareOptions;
|
|
133
134
|
type ByPass = (req: Request, res: Response, proxyConfig: ProxyConfigArrayItem) => any;
|
|
134
|
-
type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request
|
|
135
|
-
type Callback = (stats?: Stats | MultiStats
|
|
135
|
+
type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request, res?: Response, next?: NextFunction) => ProxyConfigArrayItem))[];
|
|
136
|
+
type Callback = (stats?: Stats | MultiStats) => any;
|
|
136
137
|
type DevMiddlewareContext<_RequestInternal extends IncomingMessage = IncomingMessage, _ResponseInternal extends ServerResponse = ServerResponse> = {
|
|
137
138
|
state: boolean;
|
|
138
139
|
stats: Stats | MultiStats | undefined;
|
|
@@ -190,7 +191,7 @@ export type DevServerOptions<A extends BasicApplication = BasicApplication, S ex
|
|
|
190
191
|
compress?: boolean | undefined;
|
|
191
192
|
allowedHosts?: string | string[] | undefined;
|
|
192
193
|
historyApiFallback?: boolean | HistoryApiFallbackOptions | undefined;
|
|
193
|
-
bonjour?: boolean |
|
|
194
|
+
bonjour?: boolean | BonjourServer | undefined;
|
|
194
195
|
watchFiles?: string | string[] | WatchFiles | (string | WatchFiles)[] | undefined;
|
|
195
196
|
static?: string | boolean | Static | (string | Static)[] | undefined;
|
|
196
197
|
server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
|
|
@@ -200,8 +201,114 @@ export type DevServerOptions<A extends BasicApplication = BasicApplication, S ex
|
|
|
200
201
|
open?: string | boolean | Open | (string | Open)[] | undefined;
|
|
201
202
|
setupExitSignals?: boolean | undefined;
|
|
202
203
|
client?: boolean | ClientConfiguration | undefined;
|
|
203
|
-
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext
|
|
204
|
+
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext | undefined) => Headers) | undefined;
|
|
204
205
|
onListening?: ((devServer: Server) => void) | undefined;
|
|
205
206
|
setupMiddlewares?: ((middlewares: Middleware[], devServer: Server) => Middleware[]) | undefined;
|
|
206
207
|
};
|
|
208
|
+
interface HttpProxyMiddlewareOptions extends HttpProxyServerOptions {
|
|
209
|
+
pathRewrite?: {
|
|
210
|
+
[regexp: string]: string;
|
|
211
|
+
} | ((path: string, req: Request) => string) | ((path: string, req: Request) => Promise<string>);
|
|
212
|
+
router?: {
|
|
213
|
+
[hostOrPath: string]: HttpProxyServerOptions["target"];
|
|
214
|
+
} | ((req: Request) => HttpProxyServerOptions["target"]) | ((req: Request) => Promise<HttpProxyServerOptions["target"]>);
|
|
215
|
+
logLevel?: "debug" | "info" | "warn" | "error" | "silent";
|
|
216
|
+
logProvider?: LogProviderCallback;
|
|
217
|
+
onError?: OnErrorCallback;
|
|
218
|
+
onProxyRes?: OnProxyResCallback;
|
|
219
|
+
onProxyReq?: OnProxyReqCallback;
|
|
220
|
+
onProxyReqWs?: OnProxyReqWsCallback;
|
|
221
|
+
onOpen?: OnOpenCallback;
|
|
222
|
+
onClose?: OnCloseCallback;
|
|
223
|
+
}
|
|
224
|
+
interface LogProvider {
|
|
225
|
+
log: Logger;
|
|
226
|
+
debug?: Logger;
|
|
227
|
+
info?: Logger;
|
|
228
|
+
warn?: Logger;
|
|
229
|
+
error?: Logger;
|
|
230
|
+
}
|
|
231
|
+
type LogProviderCallback = (provider: LogProvider) => LogProvider;
|
|
232
|
+
type OnErrorCallback = (err: Error, req: Request, res: Response, target?: string | Partial<url.Url>) => void;
|
|
233
|
+
type OnProxyResCallback = (proxyRes: http.IncomingMessage, req: Request, res: Response) => void;
|
|
234
|
+
type OnProxyReqCallback = (proxyReq: http.ClientRequest, req: Request, res: Response, options: HttpProxyServerOptions) => void;
|
|
235
|
+
type OnProxyReqWsCallback = (proxyReq: http.ClientRequest, req: Request, socket: net.Socket, options: HttpProxyServerOptions, head: any) => void;
|
|
236
|
+
type OnCloseCallback = (proxyRes: Response, proxySocket: net.Socket, proxyHead: any) => void;
|
|
237
|
+
type OnOpenCallback = (proxySocket: net.Socket) => void;
|
|
238
|
+
interface HttpProxyServerOptions {
|
|
239
|
+
/** URL string to be parsed with the url module. */
|
|
240
|
+
target?: HttpProxyTarget | undefined;
|
|
241
|
+
/** URL string to be parsed with the url module. */
|
|
242
|
+
forward?: HttpProxyTargetUrl | undefined;
|
|
243
|
+
/** Object to be passed to http(s).request. */
|
|
244
|
+
agent?: any;
|
|
245
|
+
/** Object to be passed to https.createServer(). */
|
|
246
|
+
ssl?: any;
|
|
247
|
+
/** If you want to proxy websockets. */
|
|
248
|
+
ws?: boolean | undefined;
|
|
249
|
+
/** Adds x- forward headers. */
|
|
250
|
+
xfwd?: boolean | undefined;
|
|
251
|
+
/** Verify SSL certificate. */
|
|
252
|
+
secure?: boolean | undefined;
|
|
253
|
+
/** Explicitly specify if we are proxying to another proxy. */
|
|
254
|
+
toProxy?: boolean | undefined;
|
|
255
|
+
/** Specify whether you want to prepend the target's path to the proxy path. */
|
|
256
|
+
prependPath?: boolean | undefined;
|
|
257
|
+
/** Specify whether you want to ignore the proxy path of the incoming request. */
|
|
258
|
+
ignorePath?: boolean | undefined;
|
|
259
|
+
/** Local interface string to bind for outgoing connections. */
|
|
260
|
+
localAddress?: string | undefined;
|
|
261
|
+
/** Changes the origin of the host header to the target URL. */
|
|
262
|
+
changeOrigin?: boolean | undefined;
|
|
263
|
+
/** specify whether you want to keep letter case of response header key */
|
|
264
|
+
preserveHeaderKeyCase?: boolean | undefined;
|
|
265
|
+
/** Basic authentication i.e. 'user:password' to compute an Authorization header. */
|
|
266
|
+
auth?: string | undefined;
|
|
267
|
+
/** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
|
|
268
|
+
hostRewrite?: string | undefined;
|
|
269
|
+
/** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
|
|
270
|
+
autoRewrite?: boolean | undefined;
|
|
271
|
+
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
|
|
272
|
+
protocolRewrite?: string | undefined;
|
|
273
|
+
/** rewrites domain of set-cookie headers. */
|
|
274
|
+
cookieDomainRewrite?: false | string | {
|
|
275
|
+
[oldDomain: string]: string;
|
|
276
|
+
} | undefined;
|
|
277
|
+
/** rewrites path of set-cookie headers. Default: false */
|
|
278
|
+
cookiePathRewrite?: false | string | {
|
|
279
|
+
[oldPath: string]: string;
|
|
280
|
+
} | undefined;
|
|
281
|
+
/** object with extra headers to be added to target requests. */
|
|
282
|
+
headers?: {
|
|
283
|
+
[header: string]: string;
|
|
284
|
+
} | undefined;
|
|
285
|
+
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
|
|
286
|
+
proxyTimeout?: number | undefined;
|
|
287
|
+
/** Timeout (in milliseconds) for incoming requests */
|
|
288
|
+
timeout?: number | undefined;
|
|
289
|
+
/** Specify whether you want to follow redirects. Default: false */
|
|
290
|
+
followRedirects?: boolean | undefined;
|
|
291
|
+
/** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
|
|
292
|
+
selfHandleResponse?: boolean | undefined;
|
|
293
|
+
/** Buffer */
|
|
294
|
+
buffer?: stream.Stream | undefined;
|
|
295
|
+
/** Explicitly set the method type of the ProxyReq */
|
|
296
|
+
method?: string | undefined;
|
|
297
|
+
}
|
|
298
|
+
interface HttpProxyTargetDetailed {
|
|
299
|
+
host: string;
|
|
300
|
+
port: number;
|
|
301
|
+
protocol?: string | undefined;
|
|
302
|
+
hostname?: string | undefined;
|
|
303
|
+
socketPath?: string | undefined;
|
|
304
|
+
key?: string | undefined;
|
|
305
|
+
passphrase?: string | undefined;
|
|
306
|
+
pfx?: Buffer | string | undefined;
|
|
307
|
+
cert?: string | undefined;
|
|
308
|
+
ca?: string | undefined;
|
|
309
|
+
ciphers?: string | undefined;
|
|
310
|
+
secureProtocol?: string | undefined;
|
|
311
|
+
}
|
|
312
|
+
type HttpProxyTarget = HttpProxyTargetUrl | HttpProxyTargetDetailed;
|
|
313
|
+
type HttpProxyTargetUrl = string | Partial<url.Url>;
|
|
207
314
|
export {};
|
package/dist/config/index.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export interface ModuleOptionsNormalized {
|
|
|
76
76
|
parser: ParserOptionsByModuleType;
|
|
77
77
|
generator: GeneratorOptionsByModuleType;
|
|
78
78
|
noParse?: NoParseOption;
|
|
79
|
+
unsafeCache?: boolean | RegExp;
|
|
79
80
|
}
|
|
80
81
|
export type ExperimentCacheNormalized = boolean | {
|
|
81
82
|
type: "memory";
|
|
@@ -84,9 +85,9 @@ export type ExperimentCacheNormalized = boolean | {
|
|
|
84
85
|
buildDependencies: string[];
|
|
85
86
|
version: string;
|
|
86
87
|
snapshot: {
|
|
87
|
-
immutablePaths:
|
|
88
|
-
unmanagedPaths:
|
|
89
|
-
managedPaths:
|
|
88
|
+
immutablePaths: (string | RegExp)[];
|
|
89
|
+
unmanagedPaths: (string | RegExp)[];
|
|
90
|
+
managedPaths: (string | RegExp)[];
|
|
90
91
|
};
|
|
91
92
|
storage: {
|
|
92
93
|
type: "filesystem";
|
|
@@ -95,13 +96,24 @@ export type ExperimentCacheNormalized = boolean | {
|
|
|
95
96
|
};
|
|
96
97
|
export interface ExperimentsNormalized {
|
|
97
98
|
cache?: ExperimentCacheNormalized;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated This option is deprecated and will be removed in future versions.
|
|
101
|
+
*
|
|
102
|
+
* Please use the Configuration top-level `lazyCompilation` option instead.
|
|
103
|
+
*/
|
|
98
104
|
lazyCompilation?: false | LazyCompilationOptions;
|
|
99
105
|
asyncWebAssembly?: boolean;
|
|
100
106
|
outputModule?: boolean;
|
|
101
107
|
topLevelAwait?: boolean;
|
|
102
108
|
css?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated This option is deprecated, layers is enabled since v1.6.0
|
|
111
|
+
*/
|
|
103
112
|
layers?: boolean;
|
|
104
113
|
incremental?: false | Incremental;
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated This option is deprecated, as it has a huge regression in some edge cases where the chunk graph has lots of cycles. We will improve performance of build_chunk_graph.
|
|
116
|
+
*/
|
|
105
117
|
parallelCodeSplitting?: boolean;
|
|
106
118
|
futureDefaults?: boolean;
|
|
107
119
|
rspackFuture?: RspackFutureOptions;
|
|
@@ -111,7 +123,9 @@ export interface ExperimentsNormalized {
|
|
|
111
123
|
inlineConst?: boolean;
|
|
112
124
|
inlineEnum?: boolean;
|
|
113
125
|
typeReexportsPresence?: boolean;
|
|
126
|
+
lazyBarrel?: boolean;
|
|
114
127
|
nativeWatcher?: boolean;
|
|
128
|
+
deferImport?: boolean;
|
|
115
129
|
}
|
|
116
130
|
export type IgnoreWarningsNormalized = ((warning: WebpackError, compilation: Compilation) => boolean)[];
|
|
117
131
|
export type OptimizationRuntimeChunkNormalized = false | {
|
|
@@ -143,6 +157,7 @@ export interface RspackOptionsNormalized {
|
|
|
143
157
|
optimization: Optimization;
|
|
144
158
|
plugins: Plugins;
|
|
145
159
|
experiments: ExperimentsNormalized;
|
|
160
|
+
lazyCompilation?: false | LazyCompilationOptions;
|
|
146
161
|
watch?: Watch;
|
|
147
162
|
watchOptions: WatchOptions;
|
|
148
163
|
devServer?: DevServer;
|