@rspack/core 1.6.0-beta.0 → 1.6.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/compiled/watchpack/index.js +1000 -3
- package/dist/Compilation.d.ts +13 -16
- package/dist/Compiler.d.ts +8 -0
- package/dist/MultiCompiler.d.ts +1 -0
- package/dist/MultiStats.d.ts +3 -2
- package/dist/RspackError.d.ts +3 -0
- package/dist/RuntimeGlobals.d.ts +3 -0
- package/dist/Watching.d.ts +9 -0
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +6 -0
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +0 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +2 -1
- 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/index.d.ts +1 -0
- package/dist/config/defaults.d.ts +0 -9
- package/dist/config/devServer.d.ts +8 -8
- package/dist/config/normalization.d.ts +2 -0
- package/dist/config/types.d.ts +47 -8
- package/dist/cssExtractHmr.js +1 -2
- package/dist/exports.d.ts +1 -3
- package/dist/index.js +739 -4826
- package/dist/lib/Cache.d.ts +1 -1
- package/dist/loader-runner/ModuleError.d.ts +7 -1
- package/dist/loader-runner/service.d.ts +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +16 -0
- 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 +21 -8
- package/package.json +8 -10
- 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/loader-runner/ModuleWarning.d.ts +0 -7
- package/dist/schema/config.d.ts +0 -1030
- package/dist/schema/loaders.d.ts +0 -402
- package/dist/schema/plugins.d.ts +0 -167
- package/dist/schema/utils.d.ts +0 -5
- package/dist/schema/validate.d.ts +0 -10
package/dist/Compilation.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ export declare class Compilation {
|
|
|
153
153
|
log: liteTapable.SyncBailHook<[string, LogEntry], true>;
|
|
154
154
|
additionalAssets: any;
|
|
155
155
|
optimizeModules: liteTapable.SyncBailHook<Iterable<Module>, void>;
|
|
156
|
-
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module
|
|
156
|
+
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module>>;
|
|
157
157
|
optimizeTree: liteTapable.AsyncSeriesHook<[
|
|
158
158
|
Iterable<Chunk>,
|
|
159
159
|
Iterable<Module>
|
|
@@ -163,21 +163,18 @@ export declare class Compilation {
|
|
|
163
163
|
Iterable<Module>
|
|
164
164
|
], void>;
|
|
165
165
|
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
|
|
166
|
-
chunkHash: liteTapable.SyncHook<[Chunk, Hash]
|
|
167
|
-
chunkAsset: liteTapable.SyncHook<[Chunk, string]
|
|
166
|
+
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
|
|
167
|
+
chunkAsset: liteTapable.SyncHook<[Chunk, string]>;
|
|
168
168
|
processWarnings: liteTapable.SyncWaterfallHook<[WebpackError[]]>;
|
|
169
|
-
succeedModule: liteTapable.SyncHook<[Module]
|
|
170
|
-
stillValidModule: liteTapable.SyncHook<[Module]
|
|
171
|
-
statsPreset: liteTapable.HookMap<liteTapable.SyncHook<[
|
|
172
|
-
Partial<StatsOptions>,
|
|
173
|
-
CreateStatsOptionsContext
|
|
174
|
-
], void>>;
|
|
169
|
+
succeedModule: liteTapable.SyncHook<[Module]>;
|
|
170
|
+
stillValidModule: liteTapable.SyncHook<[Module]>;
|
|
171
|
+
statsPreset: liteTapable.HookMap<liteTapable.SyncHook<[Partial<StatsOptions>, CreateStatsOptionsContext]>>;
|
|
175
172
|
statsNormalize: liteTapable.SyncHook<[
|
|
176
173
|
Partial<StatsOptions>,
|
|
177
174
|
CreateStatsOptionsContext
|
|
178
|
-
]
|
|
179
|
-
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions]
|
|
180
|
-
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions]
|
|
175
|
+
]>;
|
|
176
|
+
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions]>;
|
|
177
|
+
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions]>;
|
|
181
178
|
buildModule: liteTapable.SyncHook<[Module]>;
|
|
182
179
|
executeModule: liteTapable.SyncHook<[
|
|
183
180
|
ExecuteModuleArgument,
|
|
@@ -186,10 +183,10 @@ export declare class Compilation {
|
|
|
186
183
|
additionalTreeRuntimeRequirements: liteTapable.SyncHook<[
|
|
187
184
|
Chunk,
|
|
188
185
|
Set<string>
|
|
189
|
-
]
|
|
186
|
+
]>;
|
|
190
187
|
runtimeRequirementInTree: liteTapable.HookMap<liteTapable.SyncBailHook<[Chunk, Set<string>], void>>;
|
|
191
|
-
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk]
|
|
192
|
-
seal: liteTapable.SyncHook<[]
|
|
188
|
+
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk]>;
|
|
189
|
+
seal: liteTapable.SyncHook<[]>;
|
|
193
190
|
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
194
191
|
needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
|
|
195
192
|
}>;
|
|
@@ -411,7 +408,7 @@ export declare class Entries implements Map<string, EntryData> {
|
|
|
411
408
|
entries(): ReturnType<Map<string, EntryData>["entries"]>;
|
|
412
409
|
values(): ReturnType<Map<string, EntryData>["values"]>;
|
|
413
410
|
[Symbol.iterator](): ReturnType<Map<string, EntryData>["entries"]>;
|
|
414
|
-
|
|
411
|
+
readonly [Symbol.toStringTag] = "Map";
|
|
415
412
|
has(key: string): boolean;
|
|
416
413
|
set(key: string, value: EntryData): this;
|
|
417
414
|
delete(key: string): boolean;
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -107,6 +107,14 @@ declare class Compiler {
|
|
|
107
107
|
cache: Cache;
|
|
108
108
|
compilerPath: string;
|
|
109
109
|
options: RspackOptionsNormalized;
|
|
110
|
+
/**
|
|
111
|
+
* Whether to skip dropping Rust compiler instance to improve performance.
|
|
112
|
+
* This is an internal option api and could be removed or changed at any time.
|
|
113
|
+
* @internal
|
|
114
|
+
* true: Skip dropping Rust compiler instance.
|
|
115
|
+
* false: Drop Rust compiler instance when Compiler is garbage collected.
|
|
116
|
+
*/
|
|
117
|
+
unsafeFastDrop: boolean;
|
|
110
118
|
/**
|
|
111
119
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
112
120
|
* @internal
|
package/dist/MultiCompiler.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare class MultiCompiler {
|
|
|
41
41
|
running: boolean;
|
|
42
42
|
watching?: MultiWatching;
|
|
43
43
|
constructor(compilers: Compiler[] | Record<string, Compiler>, options?: MultiCompilerOptions);
|
|
44
|
+
set unsafeFastDrop(value: boolean);
|
|
44
45
|
get options(): import(".").RspackOptionsNormalized[] & MultiCompilerOptions;
|
|
45
46
|
get outputPath(): string;
|
|
46
47
|
get inputFileSystem(): InputFileSystem;
|
package/dist/MultiStats.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
+
import type { MultiStatsOptions, StatsPresets } from "./config";
|
|
10
11
|
import type { Stats } from "./Stats";
|
|
11
12
|
import type { StatsCompilation } from "./stats/statsFactoryUtils";
|
|
12
13
|
export default class MultiStats {
|
|
@@ -16,7 +17,7 @@ export default class MultiStats {
|
|
|
16
17
|
get hash(): string;
|
|
17
18
|
hasErrors(): boolean;
|
|
18
19
|
hasWarnings(): boolean;
|
|
19
|
-
toJson(options:
|
|
20
|
-
toString(options:
|
|
20
|
+
toJson(options: boolean | StatsPresets | MultiStatsOptions): StatsCompilation;
|
|
21
|
+
toString(options: boolean | StatsPresets | MultiStatsOptions): string;
|
|
21
22
|
}
|
|
22
23
|
export { MultiStats };
|
package/dist/RspackError.d.ts
CHANGED
package/dist/RuntimeGlobals.d.ts
CHANGED
|
@@ -321,5 +321,8 @@ export declare const RuntimeGlobals: {
|
|
|
321
321
|
* ) =\> void
|
|
322
322
|
*/
|
|
323
323
|
readonly asyncModule: "__webpack_require__.a";
|
|
324
|
+
readonly asyncModuleExportSymbol: "__webpack_require__.aE";
|
|
325
|
+
readonly makeDeferredNamespaceObject: "__webpack_require__.z";
|
|
326
|
+
readonly makeDeferredNamespaceObjectSymbol: "__webpack_require__.zS";
|
|
324
327
|
};
|
|
325
328
|
export declare const isReservedRuntimeGlobal: (r: string) => boolean;
|
package/dist/Watching.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Watching.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
|
+
*/
|
|
1
10
|
import type { Callback } from "@rspack/lite-tapable";
|
|
2
11
|
import type { Compiler } from ".";
|
|
3
12
|
import { Stats } from ".";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Compiler } from "../Compiler";
|
|
2
2
|
export declare class EsmLibraryPlugin {
|
|
3
3
|
static PLUGIN_NAME: string;
|
|
4
|
+
options?: {
|
|
5
|
+
preserveModules?: string;
|
|
6
|
+
};
|
|
7
|
+
constructor(options?: {
|
|
8
|
+
preserveModules?: string;
|
|
9
|
+
});
|
|
4
10
|
apply(compiler: Compiler): void;
|
|
5
11
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const InlineExportsPlugin: {
|
|
2
|
+
new (): {
|
|
3
|
+
name: string;
|
|
4
|
+
_args: [];
|
|
5
|
+
affectedHooks: keyof import("..").CompilerHooks | undefined;
|
|
6
|
+
raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
7
|
+
apply(compiler: import("..").Compiler): void;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -28,7 +28,6 @@ declare const NativeSubresourceIntegrityPlugin: {
|
|
|
28
28
|
export declare class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
|
|
29
29
|
private integrities;
|
|
30
30
|
private options;
|
|
31
|
-
private validateError;
|
|
32
31
|
constructor(options?: SubresourceIntegrityPluginOptions);
|
|
33
32
|
private isEnabled;
|
|
34
33
|
private getIntegrityChecksumForAsset;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LiteralUnion } from "../config";
|
|
1
2
|
import type { AssetConditions } from "../util/assetCondition";
|
|
2
3
|
type ExtractCommentsCondition = boolean | RegExp;
|
|
3
4
|
type ExtractCommentsBanner = string | boolean;
|
|
@@ -132,7 +133,7 @@ export interface JsFormatOptions {
|
|
|
132
133
|
*/
|
|
133
134
|
wrapFuncArgs?: boolean;
|
|
134
135
|
}
|
|
135
|
-
export type TerserEcmaVersion = 5 | 2015 | 2016 | string
|
|
136
|
+
export type TerserEcmaVersion = LiteralUnion<5 | 2015 | 2016, number> | string;
|
|
136
137
|
export interface TerserCompressOptions {
|
|
137
138
|
arguments?: boolean;
|
|
138
139
|
arrows?: boolean;
|
|
@@ -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;
|
|
@@ -40,6 +40,7 @@ export * from "./HttpUriPlugin";
|
|
|
40
40
|
export * from "./html-plugin/index";
|
|
41
41
|
export * from "./IgnorePlugin";
|
|
42
42
|
export * from "./InferAsyncModulesPlugin";
|
|
43
|
+
export * from "./InlineExportsPlugin";
|
|
43
44
|
export * from "./JavascriptModulesPlugin";
|
|
44
45
|
export * from "./JsLoaderRspackPlugin";
|
|
45
46
|
export * from "./JsonModulesPlugin";
|
|
@@ -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;
|
|
@@ -38,7 +38,7 @@ type OutputFileSystem = import("..").OutputFileSystem & {
|
|
|
38
38
|
readFileSync: typeof import("fs").readFileSync;
|
|
39
39
|
};
|
|
40
40
|
type RspackConfiguration = import("..").Configuration;
|
|
41
|
-
type Port = number |
|
|
41
|
+
type Port = number | LiteralUnion<"auto", string>;
|
|
42
42
|
type HistoryContext = {
|
|
43
43
|
readonly match: RegExpMatchArray;
|
|
44
44
|
readonly parsedUrl: import("url").Url;
|
|
@@ -80,7 +80,7 @@ type DevMiddlewareOptions<RequestInternal extends IncomingMessage = IncomingMess
|
|
|
80
80
|
cacheImmutable?: boolean | undefined;
|
|
81
81
|
};
|
|
82
82
|
type BasicApplication = any;
|
|
83
|
-
type BonjourServer = any
|
|
83
|
+
type BonjourServer = Record<string, any>;
|
|
84
84
|
type ChokidarWatchOptions = {
|
|
85
85
|
[key: string]: any;
|
|
86
86
|
};
|
|
@@ -112,7 +112,7 @@ type Static = {
|
|
|
112
112
|
poll?: number | boolean;
|
|
113
113
|
}) | undefined;
|
|
114
114
|
};
|
|
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"
|
|
115
|
+
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
116
|
type ServerConfiguration<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = {
|
|
117
117
|
type?: ServerType<A, S> | undefined;
|
|
118
118
|
options?: ServerOptions | undefined;
|
|
@@ -123,8 +123,8 @@ type WebSocketServerConfiguration = {
|
|
|
123
123
|
};
|
|
124
124
|
type NextFunction = (err?: any) => void;
|
|
125
125
|
type ProxyConfigArrayItem = {
|
|
126
|
-
path?: HttpProxyMiddlewareOptionsFilter
|
|
127
|
-
context?: HttpProxyMiddlewareOptionsFilter
|
|
126
|
+
path?: HttpProxyMiddlewareOptionsFilter;
|
|
127
|
+
context?: HttpProxyMiddlewareOptionsFilter;
|
|
128
128
|
} & {
|
|
129
129
|
bypass?: ByPass;
|
|
130
130
|
} & {
|
|
@@ -190,7 +190,7 @@ export type DevServerOptions<A extends BasicApplication = BasicApplication, S ex
|
|
|
190
190
|
compress?: boolean | undefined;
|
|
191
191
|
allowedHosts?: string | string[] | undefined;
|
|
192
192
|
historyApiFallback?: boolean | HistoryApiFallbackOptions | undefined;
|
|
193
|
-
bonjour?: boolean |
|
|
193
|
+
bonjour?: boolean | BonjourServer | undefined;
|
|
194
194
|
watchFiles?: string | string[] | WatchFiles | (string | WatchFiles)[] | undefined;
|
|
195
195
|
static?: string | boolean | Static | (string | Static)[] | undefined;
|
|
196
196
|
server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
|
|
@@ -200,7 +200,7 @@ export type DevServerOptions<A extends BasicApplication = BasicApplication, S ex
|
|
|
200
200
|
open?: string | boolean | Open | (string | Open)[] | undefined;
|
|
201
201
|
setupExitSignals?: boolean | undefined;
|
|
202
202
|
client?: boolean | ClientConfiguration | undefined;
|
|
203
|
-
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext
|
|
203
|
+
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext | undefined) => Headers) | undefined;
|
|
204
204
|
onListening?: ((devServer: Server) => void) | undefined;
|
|
205
205
|
setupMiddlewares?: ((middlewares: Middleware[], devServer: Server) => Middleware[]) | undefined;
|
|
206
206
|
};
|
|
@@ -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";
|
|
@@ -121,6 +122,7 @@ export interface ExperimentsNormalized {
|
|
|
121
122
|
typeReexportsPresence?: boolean;
|
|
122
123
|
lazyBarrel?: boolean;
|
|
123
124
|
nativeWatcher?: boolean;
|
|
125
|
+
deferImport?: boolean;
|
|
124
126
|
}
|
|
125
127
|
export type IgnoreWarningsNormalized = ((warning: WebpackError, compilation: Compilation) => boolean)[];
|
|
126
128
|
export type OptimizationRuntimeChunkNormalized = false | {
|
package/dist/config/types.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type { Module } from "../Module";
|
|
|
9
9
|
import type ModuleGraph from "../ModuleGraph";
|
|
10
10
|
import type { ResolveCallback } from "./adapterRuleUse";
|
|
11
11
|
import type { DevServerOptions } from "./devServer";
|
|
12
|
+
/** https://github.com/microsoft/TypeScript/issues/29729 */
|
|
13
|
+
export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);
|
|
12
14
|
export type FilenameTemplate = string;
|
|
13
15
|
export type Filename = FilenameTemplate | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
|
14
16
|
/** Name of the configuration. Used when loading multiple configurations. */
|
|
@@ -27,17 +29,17 @@ export type Context = string;
|
|
|
27
29
|
export type Mode = "development" | "production" | "none";
|
|
28
30
|
export type Falsy = false | "" | 0 | null | undefined;
|
|
29
31
|
/** The publicPath of the resource referenced by this entry. */
|
|
30
|
-
export type PublicPath = "auto" | Filename
|
|
32
|
+
export type PublicPath = LiteralUnion<"auto", string> | Exclude<Filename, string>;
|
|
31
33
|
/** The baseURI of the resource referenced by this entry. */
|
|
32
34
|
export type BaseUri = string;
|
|
33
35
|
/** How this entry load other chunks. */
|
|
34
|
-
export type ChunkLoadingType =
|
|
36
|
+
export type ChunkLoadingType = LiteralUnion<"jsonp" | "import-scripts" | "require" | "async-node" | "import", string>;
|
|
35
37
|
/** How this entry load other chunks. */
|
|
36
38
|
export type ChunkLoading = false | ChunkLoadingType;
|
|
37
39
|
/** Whether to create a load-on-demand asynchronous chunk for entry. */
|
|
38
40
|
export type AsyncChunks = boolean;
|
|
39
41
|
/** Option to set the method of loading WebAssembly Modules. */
|
|
40
|
-
export type WasmLoadingType =
|
|
42
|
+
export type WasmLoadingType = LiteralUnion<"fetch-streaming" | "fetch" | "async-node", string>;
|
|
41
43
|
/** Option to set the method of loading WebAssembly Modules. */
|
|
42
44
|
export type WasmLoading = false | WasmLoadingType;
|
|
43
45
|
export type ScriptType = false | "text/javascript" | "module";
|
|
@@ -61,7 +63,7 @@ export type AuxiliaryComment = string | LibraryCustomUmdCommentObject;
|
|
|
61
63
|
/** Specify which export should be exposed as a library. */
|
|
62
64
|
export type LibraryExport = string | string[];
|
|
63
65
|
/** Configure how the library will be exposed. */
|
|
64
|
-
export type LibraryType =
|
|
66
|
+
export type LibraryType = LiteralUnion<"var" | "module" | "assign" | "assign-properties" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system", string>;
|
|
65
67
|
/** When using output.library.type: "umd", setting output.library.umdNamedDefine to true will name the AMD module of the UMD build. */
|
|
66
68
|
export type UmdNamedDefine = boolean;
|
|
67
69
|
/** Options for library. */
|
|
@@ -224,8 +226,32 @@ export type HashSalt = string;
|
|
|
224
226
|
export type SourceMapFilename = string;
|
|
225
227
|
/** This option determines the module's namespace */
|
|
226
228
|
export type DevtoolNamespace = string;
|
|
229
|
+
export interface ModuleFilenameTemplateContext {
|
|
230
|
+
/** The identifier of the module */
|
|
231
|
+
identifier: string;
|
|
232
|
+
/** The shortened identifier of the module */
|
|
233
|
+
shortIdentifier: string;
|
|
234
|
+
/** The resource of the module request */
|
|
235
|
+
resource: string;
|
|
236
|
+
/** The resource path of the module request */
|
|
237
|
+
resourcePath: string;
|
|
238
|
+
/** The absolute resource path of the module request */
|
|
239
|
+
absoluteResourcePath: string;
|
|
240
|
+
/** The loaders of the module request */
|
|
241
|
+
loaders: string;
|
|
242
|
+
/** All loaders of the module request */
|
|
243
|
+
allLoaders: string;
|
|
244
|
+
/** The query of the module identifier */
|
|
245
|
+
query: string;
|
|
246
|
+
/** The module id of the module */
|
|
247
|
+
moduleId: string;
|
|
248
|
+
/** The hash of the module identifier */
|
|
249
|
+
hash: string;
|
|
250
|
+
/** The module namespace */
|
|
251
|
+
namespace: string;
|
|
252
|
+
}
|
|
227
253
|
/** This option is only used when devtool uses an option that requires module names. */
|
|
228
|
-
export type DevtoolModuleFilenameTemplate = string | ((
|
|
254
|
+
export type DevtoolModuleFilenameTemplate = string | ((context: ModuleFilenameTemplateContext) => string);
|
|
229
255
|
/** A fallback is used when the template string or function above yields duplicates. */
|
|
230
256
|
export type DevtoolFallbackModuleFilenameTemplate = DevtoolModuleFilenameTemplate;
|
|
231
257
|
/** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
|
|
@@ -818,6 +844,8 @@ export type JavascriptParserOptions = {
|
|
|
818
844
|
typeReexportsPresence?: "no-tolerant" | "tolerant" | "tolerant-no-check";
|
|
819
845
|
/** Whether to enable JSX parsing */
|
|
820
846
|
jsx?: boolean;
|
|
847
|
+
/** Whether to enable defer import */
|
|
848
|
+
deferImport?: boolean;
|
|
821
849
|
};
|
|
822
850
|
export type JsonParserOptions = {
|
|
823
851
|
/**
|
|
@@ -990,6 +1018,10 @@ export type ModuleOptions = {
|
|
|
990
1018
|
generator?: GeneratorOptionsByModuleType;
|
|
991
1019
|
/** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
|
|
992
1020
|
noParse?: NoParseOption;
|
|
1021
|
+
/**
|
|
1022
|
+
* Cache the resolving of module requests.
|
|
1023
|
+
*/
|
|
1024
|
+
unsafeCache?: boolean | RegExp;
|
|
993
1025
|
};
|
|
994
1026
|
type AllowTarget = "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "es2023" | "es2024" | "es2025" | "node" | "async-node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | "nwjs" | `nwjs${number}` | `nwjs${number}.${number}` | "node-webkit" | `node-webkit${number}` | `node-webkit${number}.${number}` | "browserslist" | `browserslist:${string}`;
|
|
995
1027
|
/** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
|
|
@@ -1193,7 +1225,7 @@ export type SnapshotOptions = {};
|
|
|
1193
1225
|
* cache: false
|
|
1194
1226
|
*/
|
|
1195
1227
|
export type CacheOptions = boolean;
|
|
1196
|
-
type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
|
|
1228
|
+
export type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
|
|
1197
1229
|
type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
|
|
1198
1230
|
type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
|
|
1199
1231
|
export type StatsColorOptions = {
|
|
@@ -1594,6 +1626,9 @@ export type StatsOptions = {
|
|
|
1594
1626
|
*/
|
|
1595
1627
|
warningsSpace?: number;
|
|
1596
1628
|
};
|
|
1629
|
+
export type MultiStatsOptions = Omit<StatsOptions, "children"> & {
|
|
1630
|
+
children?: StatsValue | (StatsValue | undefined)[];
|
|
1631
|
+
};
|
|
1597
1632
|
/**
|
|
1598
1633
|
* Represents the value for stats configuration.
|
|
1599
1634
|
*/
|
|
@@ -2116,6 +2151,11 @@ export type Experiments = {
|
|
|
2116
2151
|
* @default false
|
|
2117
2152
|
*/
|
|
2118
2153
|
lazyBarrel?: boolean;
|
|
2154
|
+
/**
|
|
2155
|
+
* Enable defer import feature
|
|
2156
|
+
* @default false
|
|
2157
|
+
*/
|
|
2158
|
+
deferImport?: boolean;
|
|
2119
2159
|
};
|
|
2120
2160
|
export type Watch = boolean;
|
|
2121
2161
|
/** Options for watch mode. */
|
|
@@ -2148,8 +2188,7 @@ export type WatchOptions = {
|
|
|
2148
2188
|
/**
|
|
2149
2189
|
* Options for devServer, it based on `webpack-dev-server@5`
|
|
2150
2190
|
* */
|
|
2151
|
-
export
|
|
2152
|
-
}
|
|
2191
|
+
export type DevServer = DevServerOptions;
|
|
2153
2192
|
export type { Middleware as DevServerMiddleware } from "./devServer";
|
|
2154
2193
|
/**
|
|
2155
2194
|
* Ignore specific warnings.
|
package/dist/cssExtractHmr.js
CHANGED
|
@@ -108,8 +108,7 @@ function cssReload(moduleId, options) {
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
reloaded ? console.log("[HMR] CSS reload %s", src && src.join(" ")) : (console.log("[HMR] Reload all CSS"), reloadAll());
|
|
111
|
-
}, timeout = 0, function() {
|
|
112
|
-
for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
|
|
111
|
+
}, timeout = 0, function(...args) {
|
|
113
112
|
let self = this;
|
|
114
113
|
clearTimeout(timeout), timeout = setTimeout(function() {
|
|
115
114
|
return fn.apply(self, args);
|
package/dist/exports.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type { default as ModuleGraph } from "./ModuleGraph";
|
|
|
20
20
|
export { MultiStats } from "./MultiStats";
|
|
21
21
|
export { NormalModule } from "./NormalModule";
|
|
22
22
|
export type { NormalModuleFactory } from "./NormalModuleFactory";
|
|
23
|
-
export type
|
|
23
|
+
export { type RspackError, type RspackSeverity, ValidationError } from "./RspackError";
|
|
24
24
|
export { RuntimeGlobals } from "./RuntimeGlobals";
|
|
25
25
|
export { RuntimeModule } from "./RuntimeModule";
|
|
26
26
|
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule } from "./Stats";
|
|
@@ -42,8 +42,6 @@ type Config = {
|
|
|
42
42
|
};
|
|
43
43
|
export declare const config: Config;
|
|
44
44
|
export type * from "./config";
|
|
45
|
-
import { ValidationError } from "./schema/validate";
|
|
46
|
-
export { ValidationError };
|
|
47
45
|
export declare const util: {
|
|
48
46
|
createHash: (algorithm: "debug" | "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash").default)) => import("./util/hash").default;
|
|
49
47
|
cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
|