@rspack/core 1.5.8 → 1.6.0-beta.1
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 +15 -18
- package/dist/Compiler.d.ts +8 -0
- package/dist/MultiCompiler.d.ts +2 -1
- package/dist/RspackError.d.ts +3 -0
- package/dist/RuntimeGlobals.d.ts +3 -0
- package/dist/Watching.d.ts +9 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +2 -2
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +6 -0
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +0 -1
- package/dist/builtin-plugin/html-plugin/options.d.ts +0 -1
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +1 -1
- package/dist/config/adapterRuleUse.d.ts +4 -1
- package/dist/config/defaults.d.ts +0 -9
- package/dist/config/devServer.d.ts +5 -5
- package/dist/config/normalization.d.ts +8 -3
- package/dist/config/types.d.ts +46 -7
- package/dist/container/ModuleFederationPlugin.d.ts +1 -1
- package/dist/cssExtractHmr.js +7 -8
- package/dist/cssExtractLoader.js +4 -5
- package/dist/exports.d.ts +2 -4
- package/dist/index.js +1112 -5246
- package/dist/loader-runner/ModuleError.d.ts +7 -1
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +16 -0
- package/dist/stats/statsFactoryUtils.d.ts +17 -0
- package/dist/util/ArrayQueue.d.ts +2 -2
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fs.d.ts +2 -2
- package/dist/util/index.d.ts +0 -3
- package/dist/util/validateConfig.d.ts +5 -0
- package/dist/worker.js +63 -51
- package/module.d.ts +0 -2
- package/package.json +11 -14
- 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
|
}>;
|
|
@@ -222,7 +219,7 @@ export declare class Compilation {
|
|
|
222
219
|
* Get a map of all entrypoints.
|
|
223
220
|
*/
|
|
224
221
|
get entrypoints(): ReadonlyMap<string, Entrypoint>;
|
|
225
|
-
get chunkGroups():
|
|
222
|
+
get chunkGroups(): readonly ChunkGroup[];
|
|
226
223
|
/**
|
|
227
224
|
* Get the named chunk groups.
|
|
228
225
|
*
|
|
@@ -261,7 +258,7 @@ export declare class Compilation {
|
|
|
261
258
|
/**
|
|
262
259
|
* Get an array of Asset
|
|
263
260
|
*/
|
|
264
|
-
getAssets():
|
|
261
|
+
getAssets(): readonly Asset[];
|
|
265
262
|
getAsset(name: string): Readonly<Asset> | void;
|
|
266
263
|
/**
|
|
267
264
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
@@ -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
|
@@ -19,7 +19,7 @@ export interface MultiCompilerOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
parallelism?: number;
|
|
21
21
|
}
|
|
22
|
-
export type MultiRspackOptions =
|
|
22
|
+
export type MultiRspackOptions = readonly RspackOptions[] & MultiCompilerOptions;
|
|
23
23
|
export declare class MultiCompiler {
|
|
24
24
|
#private;
|
|
25
25
|
compilers: Compiler[];
|
|
@@ -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/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 ".";
|
|
@@ -12,8 +12,8 @@ type RawPluginImportConfig = {
|
|
|
12
12
|
style?: RawStyleConfig;
|
|
13
13
|
camelToDashComponentName?: boolean;
|
|
14
14
|
transformToDefaultImport?: boolean;
|
|
15
|
-
ignoreEsComponent?:
|
|
16
|
-
ignoreStyleComponent?:
|
|
15
|
+
ignoreEsComponent?: string[];
|
|
16
|
+
ignoreStyleComponent?: string[];
|
|
17
17
|
};
|
|
18
18
|
type PluginImportConfig = {
|
|
19
19
|
libraryName: string;
|
|
@@ -31,7 +31,7 @@ export type CircularDependencyRspackPluginOptions = {
|
|
|
31
31
|
* module "app/design/components/Button.tsx". When the entry is a RegExp,
|
|
32
32
|
* it is tested against the entire identifier.
|
|
33
33
|
*/
|
|
34
|
-
ignoredConnections?:
|
|
34
|
+
ignoredConnections?: [string | RegExp, string | RegExp][];
|
|
35
35
|
/**
|
|
36
36
|
* Called once for every detected cycle. Providing this handler overrides the
|
|
37
37
|
* default behavior of adding diagnostics to the compilation.
|
|
@@ -12,5 +12,5 @@ type CodeValue = RecursiveArrayOrRecord<CodeValuePrimitive>;
|
|
|
12
12
|
type CodeValuePrimitive = null | undefined | RegExp | Function | string | number | boolean | bigint;
|
|
13
13
|
type RecursiveArrayOrRecord<T> = {
|
|
14
14
|
[index: string]: RecursiveArrayOrRecord<T>;
|
|
15
|
-
} |
|
|
15
|
+
} | RecursiveArrayOrRecord<T>[] | T;
|
|
16
16
|
export {};
|
|
@@ -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
|
}
|
|
@@ -7,8 +7,8 @@ export declare namespace RsdoctorPluginData {
|
|
|
7
7
|
export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch };
|
|
8
8
|
}
|
|
9
9
|
export type RsdoctorPluginOptions = {
|
|
10
|
-
moduleGraphFeatures?: boolean |
|
|
11
|
-
chunkGraphFeatures?: boolean |
|
|
10
|
+
moduleGraphFeatures?: boolean | ("graph" | "ids" | "sources")[];
|
|
11
|
+
chunkGraphFeatures?: boolean | ("graph" | "assets")[];
|
|
12
12
|
sourceMapFeatures?: {
|
|
13
13
|
module?: boolean;
|
|
14
14
|
cheap?: boolean;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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 };
|
|
@@ -79,10 +79,13 @@ export interface Diagnostic {
|
|
|
79
79
|
sourceCode?: string;
|
|
80
80
|
/**
|
|
81
81
|
* Location to the source code.
|
|
82
|
-
*
|
|
83
82
|
* If `sourceCode` is not provided, location will be omitted.
|
|
84
83
|
*/
|
|
85
84
|
location?: DiagnosticLocation;
|
|
85
|
+
/**
|
|
86
|
+
* Optional filename to show.
|
|
87
|
+
* If provided, it becomes the `StatsError.file` value in stats.
|
|
88
|
+
*/
|
|
86
89
|
file?: string;
|
|
87
90
|
severity: "error" | "warning";
|
|
88
91
|
}
|
|
@@ -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;
|
|
@@ -28,10 +28,10 @@ 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
36
|
createReadStream?: typeof import("fs").createReadStream;
|
|
37
37
|
statSync: import("fs").StatSyncFn;
|
|
@@ -131,8 +131,8 @@ type ProxyConfigArrayItem = {
|
|
|
131
131
|
[key: string]: any;
|
|
132
132
|
};
|
|
133
133
|
type ByPass = (req: Request, res: Response, proxyConfig: ProxyConfigArrayItem) => any;
|
|
134
|
-
type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request
|
|
135
|
-
type Callback = (stats?: Stats | MultiStats
|
|
134
|
+
type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request, res?: Response, next?: NextFunction) => ProxyConfigArrayItem))[];
|
|
135
|
+
type Callback = (stats?: Stats | MultiStats) => any;
|
|
136
136
|
type DevMiddlewareContext<_RequestInternal extends IncomingMessage = IncomingMessage, _ResponseInternal extends ServerResponse = ServerResponse> = {
|
|
137
137
|
state: boolean;
|
|
138
138
|
stats: Stats | MultiStats | 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";
|
|
@@ -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";
|
|
@@ -105,6 +106,9 @@ export interface ExperimentsNormalized {
|
|
|
105
106
|
outputModule?: boolean;
|
|
106
107
|
topLevelAwait?: boolean;
|
|
107
108
|
css?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated This option is deprecated, layers is enabled since v1.6.0
|
|
111
|
+
*/
|
|
108
112
|
layers?: boolean;
|
|
109
113
|
incremental?: false | Incremental;
|
|
110
114
|
parallelCodeSplitting?: boolean;
|
|
@@ -118,6 +122,7 @@ export interface ExperimentsNormalized {
|
|
|
118
122
|
typeReexportsPresence?: boolean;
|
|
119
123
|
lazyBarrel?: boolean;
|
|
120
124
|
nativeWatcher?: boolean;
|
|
125
|
+
deferImport?: boolean;
|
|
121
126
|
}
|
|
122
127
|
export type IgnoreWarningsNormalized = ((warning: WebpackError, compilation: Compilation) => boolean)[];
|
|
123
128
|
export type OptimizationRuntimeChunkNormalized = false | {
|
package/dist/config/types.d.ts
CHANGED
|
@@ -664,6 +664,8 @@ export type RuleSetRule = {
|
|
|
664
664
|
oneOf?: (RuleSetRule | Falsy)[];
|
|
665
665
|
/** A kind of Nested Rule, an array of Rules that is also used when the parent Rule matches. */
|
|
666
666
|
rules?: (RuleSetRule | Falsy)[];
|
|
667
|
+
/** Whether to extract source maps from the module. */
|
|
668
|
+
extractSourceMap?: boolean;
|
|
667
669
|
};
|
|
668
670
|
/** A list of rules. */
|
|
669
671
|
export type RuleSetRules = ("..." | RuleSetRule | Falsy)[];
|
|
@@ -816,6 +818,8 @@ export type JavascriptParserOptions = {
|
|
|
816
818
|
typeReexportsPresence?: "no-tolerant" | "tolerant" | "tolerant-no-check";
|
|
817
819
|
/** Whether to enable JSX parsing */
|
|
818
820
|
jsx?: boolean;
|
|
821
|
+
/** Whether to enable defer import */
|
|
822
|
+
deferImport?: boolean;
|
|
819
823
|
};
|
|
820
824
|
export type JsonParserOptions = {
|
|
821
825
|
/**
|
|
@@ -988,6 +992,10 @@ export type ModuleOptions = {
|
|
|
988
992
|
generator?: GeneratorOptionsByModuleType;
|
|
989
993
|
/** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
|
|
990
994
|
noParse?: NoParseOption;
|
|
995
|
+
/**
|
|
996
|
+
* Cache the resolving of module requests.
|
|
997
|
+
*/
|
|
998
|
+
unsafeCache?: boolean | RegExp;
|
|
991
999
|
};
|
|
992
1000
|
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}`;
|
|
993
1001
|
/** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
|
|
@@ -1194,6 +1202,32 @@ export type CacheOptions = boolean;
|
|
|
1194
1202
|
type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
|
|
1195
1203
|
type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
|
|
1196
1204
|
type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
|
|
1205
|
+
export type StatsColorOptions = {
|
|
1206
|
+
/**
|
|
1207
|
+
* Custom color for bold text.
|
|
1208
|
+
*/
|
|
1209
|
+
bold?: string;
|
|
1210
|
+
/**
|
|
1211
|
+
* Custom color for cyan text.
|
|
1212
|
+
*/
|
|
1213
|
+
cyan?: string;
|
|
1214
|
+
/**
|
|
1215
|
+
* Custom color for green text.
|
|
1216
|
+
*/
|
|
1217
|
+
green?: string;
|
|
1218
|
+
/**
|
|
1219
|
+
* Custom color for magenta text.
|
|
1220
|
+
*/
|
|
1221
|
+
magenta?: string;
|
|
1222
|
+
/**
|
|
1223
|
+
* Custom color for red text.
|
|
1224
|
+
*/
|
|
1225
|
+
red?: string;
|
|
1226
|
+
/**
|
|
1227
|
+
* Custom color for yellow text.
|
|
1228
|
+
*/
|
|
1229
|
+
yellow?: string;
|
|
1230
|
+
};
|
|
1197
1231
|
/** Options for stats */
|
|
1198
1232
|
export type StatsOptions = {
|
|
1199
1233
|
/**
|
|
@@ -1253,7 +1287,7 @@ export type StatsOptions = {
|
|
|
1253
1287
|
* Enables or disables the use of colors in the output.
|
|
1254
1288
|
* @default false
|
|
1255
1289
|
*/
|
|
1256
|
-
colors?: boolean;
|
|
1290
|
+
colors?: boolean | StatsColorOptions;
|
|
1257
1291
|
/**
|
|
1258
1292
|
* Enables or disables the display of the hash.
|
|
1259
1293
|
* @default true
|
|
@@ -1724,7 +1758,7 @@ export type Optimization = {
|
|
|
1724
1758
|
* Customize the minimizer.
|
|
1725
1759
|
* By default, `rspack.SwcJsMinimizerRspackPlugin` and `rspack.LightningCssMinimizerRspackPlugin` are used.
|
|
1726
1760
|
*/
|
|
1727
|
-
minimizer?:
|
|
1761
|
+
minimizer?: ("..." | Plugin)[];
|
|
1728
1762
|
/**
|
|
1729
1763
|
* Whether to merge chunks which contain the same modules.
|
|
1730
1764
|
* Setting optimization.mergeDuplicateChunks to false will disable this optimization.
|
|
@@ -1833,9 +1867,9 @@ export type ExperimentCacheOptions = boolean | {
|
|
|
1833
1867
|
buildDependencies?: string[];
|
|
1834
1868
|
version?: string;
|
|
1835
1869
|
snapshot?: {
|
|
1836
|
-
immutablePaths?:
|
|
1837
|
-
unmanagedPaths?:
|
|
1838
|
-
managedPaths?:
|
|
1870
|
+
immutablePaths?: (string | RegExp)[];
|
|
1871
|
+
unmanagedPaths?: (string | RegExp)[];
|
|
1872
|
+
managedPaths?: (string | RegExp)[];
|
|
1839
1873
|
};
|
|
1840
1874
|
storage?: {
|
|
1841
1875
|
type: "filesystem";
|
|
@@ -2027,6 +2061,7 @@ export type Experiments = {
|
|
|
2027
2061
|
css?: boolean;
|
|
2028
2062
|
/**
|
|
2029
2063
|
* Enable module layers feature.
|
|
2064
|
+
* @deprecated This option is deprecated, layers is enabled since v1.6.0
|
|
2030
2065
|
* @default false
|
|
2031
2066
|
*/
|
|
2032
2067
|
layers?: boolean;
|
|
@@ -2087,6 +2122,11 @@ export type Experiments = {
|
|
|
2087
2122
|
* @default false
|
|
2088
2123
|
*/
|
|
2089
2124
|
lazyBarrel?: boolean;
|
|
2125
|
+
/**
|
|
2126
|
+
* Enable defer import feature
|
|
2127
|
+
* @default false
|
|
2128
|
+
*/
|
|
2129
|
+
deferImport?: boolean;
|
|
2090
2130
|
};
|
|
2091
2131
|
export type Watch = boolean;
|
|
2092
2132
|
/** Options for watch mode. */
|
|
@@ -2119,8 +2159,7 @@ export type WatchOptions = {
|
|
|
2119
2159
|
/**
|
|
2120
2160
|
* Options for devServer, it based on `webpack-dev-server@5`
|
|
2121
2161
|
* */
|
|
2122
|
-
export
|
|
2123
|
-
}
|
|
2162
|
+
export type DevServer = DevServerOptions;
|
|
2124
2163
|
export type { Middleware as DevServerMiddleware } from "./devServer";
|
|
2125
2164
|
/**
|
|
2126
2165
|
* Ignore specific warnings.
|
|
@@ -5,7 +5,7 @@ export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPlug
|
|
|
5
5
|
implementation?: string;
|
|
6
6
|
shareStrategy?: "version-first" | "loaded-first";
|
|
7
7
|
}
|
|
8
|
-
export type RuntimePlugins = string[];
|
|
8
|
+
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
9
9
|
export declare class ModuleFederationPlugin {
|
|
10
10
|
private _options;
|
|
11
11
|
constructor(_options: ModuleFederationPluginOptions);
|
package/dist/cssExtractHmr.js
CHANGED
|
@@ -34,7 +34,7 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
34
34
|
cssReload: ()=>cssReload,
|
|
35
35
|
normalizeUrl: ()=>normalizeUrl
|
|
36
36
|
});
|
|
37
|
-
|
|
37
|
+
const srcByModuleId = Object.create(null), noDocument = "undefined" == typeof document, { forEach } = Array.prototype;
|
|
38
38
|
function noop() {}
|
|
39
39
|
function updateCss(el, url) {
|
|
40
40
|
let normalizedUrl;
|
|
@@ -94,14 +94,13 @@ function cssReload(moduleId, options) {
|
|
|
94
94
|
if (!src) return !1;
|
|
95
95
|
let elements = document.querySelectorAll("link"), loaded = !1;
|
|
96
96
|
return forEach.call(elements, (el)=>{
|
|
97
|
+
var href;
|
|
98
|
+
let ret, normalizedHref;
|
|
97
99
|
if (!el.href) return;
|
|
98
|
-
let url =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}), ret;
|
|
103
|
-
}(el.href, src);
|
|
104
|
-
isUrlRequest(url) && !0 !== el.visited && url && (updateCss(el, url), loaded = !0);
|
|
100
|
+
let url = (href = el.href, ret = "", normalizedHref = normalizeUrl(href), src.some((url)=>{
|
|
101
|
+
normalizedHref.indexOf(src) > -1 && (ret = url);
|
|
102
|
+
}), ret);
|
|
103
|
+
!isUrlRequest(url) || !0 !== el.visited && url && (updateCss(el, url), loaded = !0);
|
|
105
104
|
}), loaded;
|
|
106
105
|
}(src);
|
|
107
106
|
if (options.locals) {
|
package/dist/cssExtractLoader.js
CHANGED
|
@@ -28,12 +28,12 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
28
28
|
AUTO_PUBLIC_PATH: ()=>AUTO_PUBLIC_PATH,
|
|
29
29
|
pitch: ()=>pitch
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
32
32
|
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
33
33
|
function isAbsolutePath(str) {
|
|
34
34
|
return external_node_path_default().posix.isAbsolute(str) || external_node_path_default().win32.isAbsolute(str);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
const PLUGIN_NAME = "css-extract-rspack-plugin", RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/, BASE_URI = "webpack://", MODULE_TYPE = "css/mini-extract", AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__", ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`, SINGLE_DOT_PATH_SEGMENT = "__mini_css_extract_plugin_single_dot_path_segment__";
|
|
37
37
|
function hotLoader(content, context) {
|
|
38
38
|
let localsJsonString = JSON.stringify(JSON.stringify(context.locals));
|
|
39
39
|
return `${content}
|
|
@@ -72,7 +72,7 @@ function hotLoader(content, context) {
|
|
|
72
72
|
}
|
|
73
73
|
`;
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
const pitch = function(request, _, data) {
|
|
76
76
|
let publicPathForExtract;
|
|
77
77
|
if (this._compiler?.options?.experiments?.css && this._module && ("css" === this._module.type || "css/auto" === this._module.type || "css/global" === this._module.type || "css/module" === this._module.type)) {
|
|
78
78
|
let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `experiments.css` to `false` or set `{ type: \"javascript/auto\" }` for rules with `CssExtractRspackPlugin` in your rspack config (now `CssExtractRspackPlugin` does nothing).");
|
|
@@ -140,8 +140,7 @@ let pitch = function(request, _, data) {
|
|
|
140
140
|
publicPath: publicPathForExtract,
|
|
141
141
|
baseUri: `${BASE_URI}/`
|
|
142
142
|
}, (error, exports1)=>{
|
|
143
|
-
|
|
144
|
-
handleExports(exports1);
|
|
143
|
+
error ? callback(error) : handleExports(exports1);
|
|
145
144
|
});
|
|
146
145
|
}, css_extract_loader = function(content) {
|
|
147
146
|
if (this._compiler?.options?.experiments?.css && this._module && ("css" === this._module.type || "css/auto" === this._module.type || "css/global" === this._module.type || "css/module" === this._module.type)) return content;
|
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);
|
|
@@ -56,7 +54,7 @@ export { default as EntryOptionPlugin } from "./lib/EntryOptionPlugin";
|
|
|
56
54
|
export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
|
|
57
55
|
export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
|
|
58
56
|
export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
|
|
59
|
-
export type { OutputFileSystem } from "./util/fs";
|
|
57
|
+
export type { OutputFileSystem, WatchFileSystem } from "./util/fs";
|
|
60
58
|
import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from "./builtin-plugin";
|
|
61
59
|
interface Web {
|
|
62
60
|
FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
|