@rspack/core 1.3.4 → 1.3.6
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/README.md +1 -2
- package/compiled/@swc/types/index.d.ts +11 -2
- package/compiled/@swc/types/package.json +1 -1
- package/compiled/enhanced-resolve/CachedInputFileSystem.d.ts +0 -0
- package/compiled/enhanced-resolve/index.d.ts +3 -2
- package/compiled/zod/index.d.ts +10 -8
- package/compiled/zod/index.js +30 -30
- package/compiled/zod/package.json +1 -1
- package/dist/ChunkGraph.d.ts +1 -0
- package/dist/Chunks.d.ts +13 -0
- package/dist/Compilation.d.ts +4 -7
- package/dist/Module.d.ts +1 -0
- package/dist/NormalModule.d.ts +2 -2
- package/dist/builtin-loader/swc/pluginImport.d.ts +35 -0
- package/dist/builtin-loader/swc/types.d.ts +4434 -2
- package/dist/builtin-plugin/html-plugin/options.d.ts +1 -1
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +1 -1
- package/dist/config/devServer.d.ts +207 -0
- package/dist/config/types.d.ts +12 -5
- package/dist/config/utils.d.ts +3 -3
- package/dist/config/zod.d.ts +711 -695
- package/dist/cssExtractHmr.js +112 -211
- package/dist/cssExtractLoader.js +129 -246
- package/dist/exports.d.ts +1 -1
- package/dist/index.js +13061 -21111
- package/dist/loader-runner/service.d.ts +1 -1
- package/dist/loader-runner/utils.d.ts +1 -0
- package/dist/loader-runner/worker.d.ts +1 -1
- package/dist/trace/index.d.ts +35 -0
- package/dist/util/hash/BatchedHash.d.ts +2 -6
- package/dist/util/hash/index.d.ts +15 -6
- package/dist/util/validate.d.ts +4 -1
- package/dist/worker.js +909 -1874
- package/package.json +12 -24
@@ -73,7 +73,7 @@ export type HtmlRspackPluginOptions = {
|
|
73
73
|
*/
|
74
74
|
hash?: boolean;
|
75
75
|
};
|
76
|
-
export declare function validateHtmlPluginOptions(options: HtmlRspackPluginOptions):
|
76
|
+
export declare function validateHtmlPluginOptions(options: HtmlRspackPluginOptions): string | null;
|
77
77
|
export declare const getPluginOptions: (compilation: Compilation) => HtmlRspackPluginOptions | undefined;
|
78
78
|
export declare const setPluginOptions: (compilation: Compilation, options: HtmlRspackPluginOptions) => void;
|
79
79
|
export declare const cleanPluginOptions: (compilation: Compilation) => void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Middleware } from "webpack-dev-server";
|
2
1
|
import type { Compiler, LazyCompilationOptions } from "../..";
|
2
|
+
import type { Middleware } from "../../config/devServer";
|
3
3
|
export declare const LAZY_COMPILATION_PREFIX = "/lazy-compilation-using-";
|
4
4
|
export declare const lazyCompilationMiddleware: (compiler: Compiler, userOptions?: LazyCompilationOptions | boolean) => Middleware;
|
@@ -0,0 +1,207 @@
|
|
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 { Compiler, MultiCompiler, MultiStats, Stats, Watching } from "..";
|
11
|
+
type Logger = ReturnType<Compiler["getInfrastructureLogger"]>;
|
12
|
+
type MultiWatching = MultiCompiler["watch"];
|
13
|
+
type BasicServer = import("net").Server | import("tls").Server;
|
14
|
+
type ReadStream = typeof import("fs").ReadStream;
|
15
|
+
type IncomingMessage = typeof import("http").IncomingMessage;
|
16
|
+
type ServerResponse = typeof import("http").ServerResponse;
|
17
|
+
type ServerOptions = import("https").ServerOptions & {
|
18
|
+
spdy?: {
|
19
|
+
plain?: boolean | undefined;
|
20
|
+
ssl?: boolean | undefined;
|
21
|
+
"x-forwarded-for"?: string | undefined;
|
22
|
+
protocol?: string | undefined;
|
23
|
+
protocols?: string[] | undefined;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
type ResponseData = {
|
27
|
+
data: Buffer | ReadStream;
|
28
|
+
byteLength: number;
|
29
|
+
};
|
30
|
+
type ModifyResponseData<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = (req: RequestInternal, res: ResponseInternal, data: Buffer | ReadStream, byteLength: number) => ResponseData;
|
31
|
+
type Headers = Array<{
|
32
|
+
key: string;
|
33
|
+
value: string;
|
34
|
+
}> | Record<string, string | string[]>;
|
35
|
+
type OutputFileSystem = import("..").OutputFileSystem & {
|
36
|
+
createReadStream?: typeof import("fs").createReadStream;
|
37
|
+
statSync: import("fs").StatSyncFn;
|
38
|
+
readFileSync: typeof import("fs").readFileSync;
|
39
|
+
};
|
40
|
+
type RspackConfiguration = import("..").Configuration;
|
41
|
+
type Port = number | string | "auto";
|
42
|
+
type HistoryContext = {
|
43
|
+
readonly match: RegExpMatchArray;
|
44
|
+
readonly parsedUrl: import("url").Url;
|
45
|
+
readonly request: any;
|
46
|
+
};
|
47
|
+
type RewriteTo = (context: HistoryContext) => string;
|
48
|
+
type Rewrite = {
|
49
|
+
readonly from: RegExp;
|
50
|
+
readonly to: string | RegExp | RewriteTo;
|
51
|
+
};
|
52
|
+
type HistoryApiFallbackOptions = {
|
53
|
+
readonly disableDotRule?: true | undefined;
|
54
|
+
readonly htmlAcceptHeaders?: readonly string[] | undefined;
|
55
|
+
readonly index?: string | undefined;
|
56
|
+
readonly logger?: typeof console.log | undefined;
|
57
|
+
readonly rewrites?: readonly Rewrite[] | undefined;
|
58
|
+
readonly verbose?: boolean | undefined;
|
59
|
+
};
|
60
|
+
type DevMiddlewareOptions<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = {
|
61
|
+
mimeTypes?: {
|
62
|
+
[key: string]: string;
|
63
|
+
} | undefined;
|
64
|
+
mimeTypeDefault?: string | undefined;
|
65
|
+
writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined;
|
66
|
+
methods?: string[] | undefined;
|
67
|
+
headers?: any;
|
68
|
+
publicPath?: NonNullable<RspackConfiguration["output"]>["publicPath"];
|
69
|
+
stats?: RspackConfiguration["stats"];
|
70
|
+
serverSideRender?: boolean | undefined;
|
71
|
+
outputFileSystem?: OutputFileSystem | undefined;
|
72
|
+
index?: string | boolean | undefined;
|
73
|
+
modifyResponseData?: ModifyResponseData<RequestInternal, ResponseInternal> | undefined;
|
74
|
+
etag?: "strong" | "weak" | undefined;
|
75
|
+
lastModified?: boolean | undefined;
|
76
|
+
cacheControl?: string | number | boolean | {
|
77
|
+
maxAge?: number;
|
78
|
+
immutable?: boolean;
|
79
|
+
} | undefined;
|
80
|
+
cacheImmutable?: boolean | undefined;
|
81
|
+
};
|
82
|
+
type BasicApplication = any;
|
83
|
+
type BonjourServer = any;
|
84
|
+
type ChokidarWatchOptions = {
|
85
|
+
[key: string]: any;
|
86
|
+
};
|
87
|
+
type ServeIndexOptions = {
|
88
|
+
[key: string]: any;
|
89
|
+
};
|
90
|
+
type ServeStaticOptions = {
|
91
|
+
[key: string]: any;
|
92
|
+
};
|
93
|
+
type HttpProxyMiddlewareOptionsFilter = any;
|
94
|
+
type Request = IncomingMessage;
|
95
|
+
type Response = ServerResponse;
|
96
|
+
type WatchFiles = {
|
97
|
+
paths: string | string[];
|
98
|
+
options?: (ChokidarWatchOptions & {
|
99
|
+
aggregateTimeout?: number;
|
100
|
+
ignored?: ChokidarWatchOptions["ignored"];
|
101
|
+
poll?: number | boolean;
|
102
|
+
}) | undefined;
|
103
|
+
};
|
104
|
+
type Static = {
|
105
|
+
directory?: string | undefined;
|
106
|
+
publicPath?: string | string[] | undefined;
|
107
|
+
serveIndex?: boolean | ServeIndexOptions | undefined;
|
108
|
+
staticOptions?: ServeStaticOptions | undefined;
|
109
|
+
watch?: boolean | (ChokidarWatchOptions & {
|
110
|
+
aggregateTimeout?: number;
|
111
|
+
ignored?: ChokidarWatchOptions["ignored"];
|
112
|
+
poll?: number | boolean;
|
113
|
+
}) | undefined;
|
114
|
+
};
|
115
|
+
type ServerType<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<IncomingMessage, ServerResponse>> = "http" | "https" | "spdy" | "http2" | string | ((arg0: ServerOptions, arg1: A) => S);
|
116
|
+
type ServerConfiguration<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<IncomingMessage, ServerResponse>> = {
|
117
|
+
type?: ServerType<A, S> | undefined;
|
118
|
+
options?: ServerOptions | undefined;
|
119
|
+
};
|
120
|
+
type WebSocketServerConfiguration = {
|
121
|
+
type?: string | Function | undefined;
|
122
|
+
options?: Record<string, any> | undefined;
|
123
|
+
};
|
124
|
+
type NextFunction = (err?: any) => void;
|
125
|
+
type ProxyConfigArrayItem = {
|
126
|
+
path?: HttpProxyMiddlewareOptionsFilter | undefined;
|
127
|
+
context?: HttpProxyMiddlewareOptionsFilter | undefined;
|
128
|
+
} & {
|
129
|
+
bypass?: ByPass;
|
130
|
+
} & {
|
131
|
+
[key: string]: any;
|
132
|
+
};
|
133
|
+
type ByPass = (req: Request, res: Response, proxyConfig: ProxyConfigArrayItem) => any;
|
134
|
+
type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[];
|
135
|
+
type Callback = (stats?: Stats | MultiStats | undefined) => any;
|
136
|
+
type DevMiddlewareContext<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = {
|
137
|
+
state: boolean;
|
138
|
+
stats: Stats | MultiStats | undefined;
|
139
|
+
callbacks: Callback[];
|
140
|
+
options: any;
|
141
|
+
compiler: Compiler | MultiCompiler;
|
142
|
+
watching: Watching | MultiWatching | undefined;
|
143
|
+
logger: Logger;
|
144
|
+
outputFileSystem: OutputFileSystem;
|
145
|
+
};
|
146
|
+
type Server = any;
|
147
|
+
type MiddlewareHandler = any;
|
148
|
+
type MiddlewareObject = {
|
149
|
+
name?: string;
|
150
|
+
path?: string;
|
151
|
+
middleware: MiddlewareHandler;
|
152
|
+
};
|
153
|
+
export type Middleware = MiddlewareObject | MiddlewareHandler;
|
154
|
+
type OpenApp = {
|
155
|
+
name?: string | undefined;
|
156
|
+
arguments?: string[] | undefined;
|
157
|
+
};
|
158
|
+
type Open = {
|
159
|
+
app?: string | string[] | OpenApp | undefined;
|
160
|
+
target?: string | string[] | undefined;
|
161
|
+
};
|
162
|
+
type OverlayMessageOptions = boolean | ((error: Error) => void);
|
163
|
+
type WebSocketURL = {
|
164
|
+
hostname?: string | undefined;
|
165
|
+
password?: string | undefined;
|
166
|
+
pathname?: string | undefined;
|
167
|
+
port?: string | number | undefined;
|
168
|
+
protocol?: string | undefined;
|
169
|
+
username?: string | undefined;
|
170
|
+
};
|
171
|
+
type ClientConfiguration = {
|
172
|
+
logging?: "none" | "error" | "warn" | "info" | "log" | "verbose" | undefined;
|
173
|
+
overlay?: boolean | {
|
174
|
+
warnings?: OverlayMessageOptions;
|
175
|
+
errors?: OverlayMessageOptions;
|
176
|
+
runtimeErrors?: OverlayMessageOptions;
|
177
|
+
} | undefined;
|
178
|
+
progress?: boolean | undefined;
|
179
|
+
reconnect?: number | boolean | undefined;
|
180
|
+
webSocketTransport?: string | undefined;
|
181
|
+
webSocketURL?: string | WebSocketURL | undefined;
|
182
|
+
};
|
183
|
+
export type DevServerOptions<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<IncomingMessage, ServerResponse>> = {
|
184
|
+
ipc?: string | boolean | undefined;
|
185
|
+
host?: string | undefined;
|
186
|
+
port?: Port | undefined;
|
187
|
+
hot?: boolean | "only" | undefined;
|
188
|
+
liveReload?: boolean | undefined;
|
189
|
+
devMiddleware?: DevMiddlewareOptions | undefined;
|
190
|
+
compress?: boolean | undefined;
|
191
|
+
allowedHosts?: string | string[] | undefined;
|
192
|
+
historyApiFallback?: boolean | HistoryApiFallbackOptions | undefined;
|
193
|
+
bonjour?: boolean | Record<string, never> | BonjourServer | undefined;
|
194
|
+
watchFiles?: string | string[] | WatchFiles | (string | WatchFiles)[] | undefined;
|
195
|
+
static?: string | boolean | Static | (string | Static)[] | undefined;
|
196
|
+
server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
|
197
|
+
app?: (() => Promise<A>) | undefined;
|
198
|
+
webSocketServer?: string | boolean | WebSocketServerConfiguration | undefined;
|
199
|
+
proxy?: ProxyConfigArray | undefined;
|
200
|
+
open?: string | boolean | Open | (string | Open)[] | undefined;
|
201
|
+
setupExitSignals?: boolean | undefined;
|
202
|
+
client?: boolean | ClientConfiguration | undefined;
|
203
|
+
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response> | undefined) => Headers) | undefined;
|
204
|
+
onListening?: ((devServer: Server) => void) | undefined;
|
205
|
+
setupMiddlewares?: ((middlewares: Middleware[], devServer: Server) => Middleware[]) | undefined;
|
206
|
+
};
|
207
|
+
export {};
|
package/dist/config/types.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { AssetInfo, RawFuncUseCtx } from "@rspack/binding";
|
2
|
-
import type * as webpackDevServer from "webpack-dev-server";
|
3
2
|
import type { ChunkGraph } from "../ChunkGraph";
|
4
3
|
import type { Compilation, PathData } from "../Compilation";
|
5
4
|
import type { Compiler } from "../Compiler";
|
@@ -8,6 +7,7 @@ import type ModuleGraph from "../ModuleGraph";
|
|
8
7
|
import type { HttpUriPluginOptions } from "../builtin-plugin/HttpUriPlugin";
|
9
8
|
import type { Chunk } from "../exports";
|
10
9
|
import type { ResolveCallback } from "./adapterRuleUse";
|
10
|
+
import type { DevServerOptions } from "./devServer";
|
11
11
|
export type FilenameTemplate = string;
|
12
12
|
export type Filename = FilenameTemplate | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
13
13
|
/** Name of the configuration. Used when loading multiple configurations. */
|
@@ -1812,11 +1812,13 @@ export type RspackFutureOptions = {
|
|
1812
1812
|
*/
|
1813
1813
|
export type LazyCompilationOptions = {
|
1814
1814
|
/**
|
1815
|
-
* Enable lazy compilation for imports.
|
1815
|
+
* Enable lazy compilation for dynamic imports.
|
1816
|
+
* @default true
|
1816
1817
|
*/
|
1817
1818
|
imports?: boolean;
|
1818
1819
|
/**
|
1819
1820
|
* Enable lazy compilation for entries.
|
1821
|
+
* @default true
|
1820
1822
|
*/
|
1821
1823
|
entries?: boolean;
|
1822
1824
|
/**
|
@@ -1824,11 +1826,16 @@ export type LazyCompilationOptions = {
|
|
1824
1826
|
*/
|
1825
1827
|
test?: RegExp | ((module: Module) => boolean);
|
1826
1828
|
/**
|
1827
|
-
* The runtime code
|
1829
|
+
* The path to a custom runtime code that overrides the default lazy
|
1830
|
+
* compilation client. If you want to customize the logic of the client
|
1831
|
+
* runtime, you can specify it through this option.
|
1828
1832
|
*/
|
1829
1833
|
client?: string;
|
1830
1834
|
/**
|
1831
|
-
*
|
1835
|
+
* Tells the client the server URL that needs to be requested.
|
1836
|
+
* By default it is empty, in a browser environment it will find
|
1837
|
+
* the server path where the page is located, but in a node
|
1838
|
+
* environment you need to explicitly specify a specific path.
|
1832
1839
|
*/
|
1833
1840
|
serverUrl?: string;
|
1834
1841
|
};
|
@@ -2007,7 +2014,7 @@ export type WatchOptions = {
|
|
2007
2014
|
/**
|
2008
2015
|
* Options for devServer, it based on `webpack-dev-server@5`
|
2009
2016
|
* */
|
2010
|
-
export interface DevServer extends
|
2017
|
+
export interface DevServer extends DevServerOptions {
|
2011
2018
|
}
|
2012
2019
|
/**
|
2013
2020
|
* An array of either regular expressions or functions that determine if a warning should be ignored.
|
package/dist/config/utils.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import { type IssueData, type ParseReturnType, ZodType, type ZodTypeDef
|
1
|
+
import z, { type IssueData, type ParseReturnType, ZodType, type ZodTypeDef } from "../../compiled/zod";
|
2
2
|
import type { RspackOptions } from "./types";
|
3
3
|
export type ZodCrossFieldsOptions = ZodTypeDef & {
|
4
4
|
patterns: Array<{
|
5
|
-
test: (root: RspackOptions) => boolean;
|
5
|
+
test: (root: RspackOptions, input: z.ParseInput) => boolean;
|
6
6
|
type: ZodType;
|
7
|
-
issue?: (res: ParseReturnType<any
|
7
|
+
issue?: (res: ParseReturnType<any>, root: RspackOptions, input: z.ParseInput) => Array<IssueData>;
|
8
8
|
}>;
|
9
9
|
default: ZodType;
|
10
10
|
};
|