@rspack-debug/core 1.4.9 → 1.6.2
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 +1157 -20
- 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 +8 -4
- 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/collectTypeScriptInfo.d.ts +13 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +2 -2
- package/dist/builtin-loader/swc/types.d.ts +4 -0
- 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 +5 -3
- 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 +7 -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 +12 -13
- package/dist/config/index.d.ts +1 -0
- package/dist/config/normalization.d.ts +18 -3
- package/dist/config/types.d.ts +123 -19
- 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 +63 -62
- package/dist/exports.d.ts +16 -9
- package/dist/index.js +1723 -5626
- 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 +2 -2
- 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 -21
- package/compiled/glob-to-regexp/index.d.ts +0 -11
- package/compiled/glob-to-regexp/index.js +0 -187
- package/compiled/glob-to-regexp/package.json +0 -1
- 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 -163
- package/dist/schema/utils.d.ts +0 -4
- package/dist/schema/validate.d.ts +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RawCssExtractPluginOption } from "@rspack/binding";
|
|
2
|
-
import type { Compiler } from "../..";
|
|
2
|
+
import type { Compiler, LiteralUnion } from "../..";
|
|
3
3
|
export * from "./loader";
|
|
4
4
|
export type { CssExtractRspackLoaderOptions } from "./loader";
|
|
5
5
|
export interface CssExtractRspackPluginOptions {
|
|
@@ -8,7 +8,7 @@ export interface CssExtractRspackPluginOptions {
|
|
|
8
8
|
ignoreOrder?: boolean;
|
|
9
9
|
insert?: string | ((linkTag: HTMLLinkElement) => void);
|
|
10
10
|
attributes?: Record<string, string>;
|
|
11
|
-
linkType?:
|
|
11
|
+
linkType?: LiteralUnion<"text/css", string> | false;
|
|
12
12
|
runtime?: boolean;
|
|
13
13
|
pathinfo?: boolean;
|
|
14
14
|
enforceRelative?: boolean;
|
|
@@ -77,7 +77,6 @@ export type HtmlRspackPluginOptions = {
|
|
|
77
77
|
*/
|
|
78
78
|
[key: string]: any;
|
|
79
79
|
};
|
|
80
|
-
export declare function validateHtmlPluginOptions(options: HtmlRspackPluginOptions): string | null;
|
|
81
80
|
export declare const getPluginOptions: (compilation: Compilation, uid: number) => any;
|
|
82
81
|
export declare const setPluginOptions: (compilation: Compilation, uid: number, options: HtmlRspackPluginOptions) => void;
|
|
83
82
|
export declare const cleanPluginOptions: (compilation: Compilation, uid: number) => void;
|
|
@@ -7,7 +7,7 @@ declare const HtmlRspackPluginImpl: {
|
|
|
7
7
|
new (c?: HtmlRspackPluginOptions | undefined): {
|
|
8
8
|
name: string;
|
|
9
9
|
_args: [c?: HtmlRspackPluginOptions | undefined];
|
|
10
|
-
affectedHooks:
|
|
10
|
+
affectedHooks: keyof import("../../Compiler").CompilerHooks | undefined;
|
|
11
11
|
raw(compiler: Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
12
12
|
apply(compiler: Compiler): void;
|
|
13
13
|
};
|
|
@@ -18,7 +18,7 @@ declare const HtmlRspackPlugin: typeof HtmlRspackPluginImpl & {
|
|
|
18
18
|
*/
|
|
19
19
|
getHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
|
|
20
20
|
getCompilationHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
|
|
21
|
-
createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string
|
|
21
|
+
createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string) => JsHtmlPluginTag;
|
|
22
22
|
version: number;
|
|
23
23
|
};
|
|
24
24
|
export { HtmlRspackPlugin };
|
|
@@ -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,7 @@
|
|
|
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 { Compiler, MultiCompiler, MultiStats, Stats, Watching } from "..";
|
|
10
|
+
import type { Compiler, LiteralUnion, MultiCompiler, MultiStats, Stats, Watching } from "..";
|
|
11
11
|
type Logger = ReturnType<Compiler["getInfrastructureLogger"]>;
|
|
12
12
|
type MultiWatching = MultiCompiler["watch"];
|
|
13
13
|
type BasicServer = import("net").Server | import("tls").Server;
|
|
@@ -28,17 +28,16 @@ type ResponseData = {
|
|
|
28
28
|
byteLength: number;
|
|
29
29
|
};
|
|
30
30
|
type ModifyResponseData<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = (req: RequestInternal, res: ResponseInternal, data: Buffer | ReadStream, byteLength: number) => ResponseData;
|
|
31
|
-
type Headers =
|
|
31
|
+
type Headers = {
|
|
32
32
|
key: string;
|
|
33
33
|
value: string;
|
|
34
|
-
}
|
|
34
|
+
}[] | Record<string, string | string[]>;
|
|
35
35
|
type OutputFileSystem = import("..").OutputFileSystem & {
|
|
36
|
-
createReadStream?: typeof import("fs").createReadStream;
|
|
37
36
|
statSync: import("fs").StatSyncFn;
|
|
38
37
|
readFileSync: typeof import("fs").readFileSync;
|
|
39
38
|
};
|
|
40
39
|
type RspackConfiguration = import("..").Configuration;
|
|
41
|
-
type Port = number |
|
|
40
|
+
type Port = number | LiteralUnion<"auto", string>;
|
|
42
41
|
type HistoryContext = {
|
|
43
42
|
readonly match: RegExpMatchArray;
|
|
44
43
|
readonly parsedUrl: import("url").Url;
|
|
@@ -80,7 +79,7 @@ type DevMiddlewareOptions<RequestInternal extends IncomingMessage = IncomingMess
|
|
|
80
79
|
cacheImmutable?: boolean | undefined;
|
|
81
80
|
};
|
|
82
81
|
type BasicApplication = any;
|
|
83
|
-
type BonjourServer = any
|
|
82
|
+
type BonjourServer = Record<string, any>;
|
|
84
83
|
type ChokidarWatchOptions = {
|
|
85
84
|
[key: string]: any;
|
|
86
85
|
};
|
|
@@ -112,7 +111,7 @@ type Static = {
|
|
|
112
111
|
poll?: number | boolean;
|
|
113
112
|
}) | undefined;
|
|
114
113
|
};
|
|
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"
|
|
114
|
+
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
115
|
type ServerConfiguration<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = {
|
|
117
116
|
type?: ServerType<A, S> | undefined;
|
|
118
117
|
options?: ServerOptions | undefined;
|
|
@@ -123,16 +122,16 @@ type WebSocketServerConfiguration = {
|
|
|
123
122
|
};
|
|
124
123
|
type NextFunction = (err?: any) => void;
|
|
125
124
|
type ProxyConfigArrayItem = {
|
|
126
|
-
path?: HttpProxyMiddlewareOptionsFilter
|
|
127
|
-
context?: HttpProxyMiddlewareOptionsFilter
|
|
125
|
+
path?: HttpProxyMiddlewareOptionsFilter;
|
|
126
|
+
context?: HttpProxyMiddlewareOptionsFilter;
|
|
128
127
|
} & {
|
|
129
128
|
bypass?: ByPass;
|
|
130
129
|
} & {
|
|
131
130
|
[key: string]: any;
|
|
132
131
|
};
|
|
133
132
|
type ByPass = (req: Request, res: Response, proxyConfig: ProxyConfigArrayItem) => any;
|
|
134
|
-
type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request
|
|
135
|
-
type Callback = (stats?: Stats | MultiStats
|
|
133
|
+
type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request, res?: Response, next?: NextFunction) => ProxyConfigArrayItem))[];
|
|
134
|
+
type Callback = (stats?: Stats | MultiStats) => any;
|
|
136
135
|
type DevMiddlewareContext<_RequestInternal extends IncomingMessage = IncomingMessage, _ResponseInternal extends ServerResponse = ServerResponse> = {
|
|
137
136
|
state: boolean;
|
|
138
137
|
stats: Stats | MultiStats | undefined;
|
|
@@ -190,7 +189,7 @@ export type DevServerOptions<A extends BasicApplication = BasicApplication, S ex
|
|
|
190
189
|
compress?: boolean | undefined;
|
|
191
190
|
allowedHosts?: string | string[] | undefined;
|
|
192
191
|
historyApiFallback?: boolean | HistoryApiFallbackOptions | undefined;
|
|
193
|
-
bonjour?: boolean |
|
|
192
|
+
bonjour?: boolean | BonjourServer | undefined;
|
|
194
193
|
watchFiles?: string | string[] | WatchFiles | (string | WatchFiles)[] | undefined;
|
|
195
194
|
static?: string | boolean | Static | (string | Static)[] | undefined;
|
|
196
195
|
server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
|
|
@@ -200,7 +199,7 @@ export type DevServerOptions<A extends BasicApplication = BasicApplication, S ex
|
|
|
200
199
|
open?: string | boolean | Open | (string | Open)[] | undefined;
|
|
201
200
|
setupExitSignals?: boolean | undefined;
|
|
202
201
|
client?: boolean | ClientConfiguration | undefined;
|
|
203
|
-
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext
|
|
202
|
+
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext | undefined) => Headers) | undefined;
|
|
204
203
|
onListening?: ((devServer: Server) => void) | undefined;
|
|
205
204
|
setupMiddlewares?: ((middlewares: Middleware[], devServer: Server) => Middleware[]) | undefined;
|
|
206
205
|
};
|
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;
|