@rspack/core 1.1.4 → 1.1.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/dist/Compilation.d.ts +2 -0
- package/dist/Compiler.d.ts +2 -2
- package/dist/FileSystem.d.ts +16 -4
- package/dist/Module.d.ts +1 -0
- package/dist/MultiCompiler.d.ts +3 -3
- package/dist/Stats.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +8 -10
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +10 -11
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +2 -0
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +8 -10
- package/dist/config/normalization.d.ts +1 -1
- package/dist/config/types.d.ts +33 -1
- package/dist/config/zod.d.ts +54 -172
- package/dist/cssExtractLoader.js +1 -0
- package/dist/index.js +381 -197
- package/dist/util/MergeCaller.d.ts +1 -3
- package/dist/util/fs.d.ts +36 -1
- package/dist/util/source.d.ts +3 -3
- package/package.json +2 -2
package/dist/Compilation.d.ts
CHANGED
|
@@ -375,6 +375,8 @@ export declare class Compilation {
|
|
|
375
375
|
* @internal
|
|
376
376
|
*/
|
|
377
377
|
__internal_getInner(): binding.JsCompilation;
|
|
378
|
+
get __internal__shutdown(): boolean;
|
|
379
|
+
set __internal__shutdown(shutdown: boolean);
|
|
378
380
|
seal(): void;
|
|
379
381
|
unseal(): void;
|
|
380
382
|
static PROCESS_ASSETS_STAGE_ADDITIONAL: number;
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ import type { Source } from "../compiled/webpack-sources";
|
|
|
26
26
|
import type { CompilationParams } from "./Compilation";
|
|
27
27
|
import type { FileSystemInfoEntry } from "./FileSystemInfo";
|
|
28
28
|
import type { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from "./config";
|
|
29
|
-
import type { InputFileSystem, OutputFileSystem, WatchFileSystem } from "./util/fs";
|
|
29
|
+
import type { InputFileSystem, IntermediateFileSystem, OutputFileSystem, WatchFileSystem } from "./util/fs";
|
|
30
30
|
export interface AssetEmittedInfo {
|
|
31
31
|
content: Buffer;
|
|
32
32
|
source: Source;
|
|
@@ -79,7 +79,7 @@ declare class Compiler {
|
|
|
79
79
|
infrastructureLogger: any;
|
|
80
80
|
watching?: Watching;
|
|
81
81
|
inputFileSystem: InputFileSystem | null;
|
|
82
|
-
intermediateFileSystem:
|
|
82
|
+
intermediateFileSystem: IntermediateFileSystem | null;
|
|
83
83
|
outputFileSystem: OutputFileSystem | null;
|
|
84
84
|
watchFileSystem: WatchFileSystem | null;
|
|
85
85
|
records: Record<string, any[]>;
|
package/dist/FileSystem.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NodeFsStats, ThreadsafeNodeFS } from "@rspack/binding";
|
|
2
|
-
import { type IStats, type OutputFileSystem } from "./util/fs";
|
|
3
|
-
declare class
|
|
2
|
+
import { type IStats, type IntermediateFileSystem, type OutputFileSystem } from "./util/fs";
|
|
3
|
+
declare class ThreadsafeOutputNodeFS implements ThreadsafeNodeFS {
|
|
4
4
|
writeFile: (name: string, content: Buffer) => Promise<void> | void;
|
|
5
5
|
removeFile: (name: string) => Promise<void> | void;
|
|
6
6
|
mkdir: (name: string) => Promise<void> | void;
|
|
@@ -10,8 +10,20 @@ declare class ThreadsafeWritableNodeFS implements ThreadsafeNodeFS {
|
|
|
10
10
|
readFile: (name: string) => Promise<Buffer | string | void> | Buffer | string | void;
|
|
11
11
|
stat: (name: string) => Promise<NodeFsStats | void> | NodeFsStats | void;
|
|
12
12
|
lstat: (name: string) => Promise<NodeFsStats | void> | NodeFsStats | void;
|
|
13
|
+
open: (name: string, flags: string) => Promise<number | void> | number | void;
|
|
14
|
+
rename: (from: string, to: string) => Promise<void> | void;
|
|
15
|
+
close: (fd: number) => Promise<void> | void;
|
|
16
|
+
write: (fd: number, content: Buffer, position: number) => Promise<number | void> | number | void;
|
|
17
|
+
writeAll: (fd: number, content: Buffer) => Promise<number | void> | number | void;
|
|
18
|
+
read: (fd: number, length: number, position: number) => Promise<Buffer | void> | Buffer | void;
|
|
19
|
+
readUntil: (fd: number, code: number, position: number) => Promise<Buffer | void> | Buffer | void;
|
|
20
|
+
readToEnd: (fd: number, position: number) => Promise<Buffer | void> | Buffer | void;
|
|
13
21
|
constructor(fs?: OutputFileSystem);
|
|
14
|
-
static __to_binding(fs?: OutputFileSystem):
|
|
22
|
+
static __to_binding(fs?: OutputFileSystem): ThreadsafeOutputNodeFS;
|
|
15
23
|
static __to_binding_stat(stat: IStats): NodeFsStats;
|
|
16
24
|
}
|
|
17
|
-
|
|
25
|
+
declare class ThreadsafeIntermediateNodeFS extends ThreadsafeOutputNodeFS {
|
|
26
|
+
constructor(fs?: IntermediateFileSystem);
|
|
27
|
+
static __to_binding(fs?: IntermediateFileSystem): ThreadsafeIntermediateNodeFS;
|
|
28
|
+
}
|
|
29
|
+
export { ThreadsafeOutputNodeFS, ThreadsafeIntermediateNodeFS };
|
package/dist/Module.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export declare class Module {
|
|
|
74
74
|
readonly buildMeta: Record<string, any>;
|
|
75
75
|
readonly modules: Module[] | undefined;
|
|
76
76
|
readonly blocks: DependenciesBlock[];
|
|
77
|
+
readonly dependencies: Dependency[];
|
|
77
78
|
readonly useSourceMap: boolean;
|
|
78
79
|
static __from_binding(binding: JsModule, compilation?: Compilation): Module;
|
|
79
80
|
static __to_binding(module: Module): JsModule;
|
package/dist/MultiCompiler.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { Compiler, RspackOptions } from ".";
|
|
|
12
12
|
import MultiStats from "./MultiStats";
|
|
13
13
|
import MultiWatching from "./MultiWatching";
|
|
14
14
|
import type { WatchOptions } from "./config";
|
|
15
|
-
import type { InputFileSystem, WatchFileSystem } from "./util/fs";
|
|
15
|
+
import type { InputFileSystem, IntermediateFileSystem, WatchFileSystem } from "./util/fs";
|
|
16
16
|
export interface MultiCompilerOptions {
|
|
17
17
|
/**
|
|
18
18
|
* how many Compilers are allows to run at the same time in parallel
|
|
@@ -40,11 +40,11 @@ export declare class MultiCompiler {
|
|
|
40
40
|
get inputFileSystem(): InputFileSystem;
|
|
41
41
|
get outputFileSystem(): typeof import("fs");
|
|
42
42
|
get watchFileSystem(): WatchFileSystem;
|
|
43
|
-
get intermediateFileSystem():
|
|
43
|
+
get intermediateFileSystem(): IntermediateFileSystem;
|
|
44
44
|
set inputFileSystem(value: InputFileSystem);
|
|
45
45
|
set outputFileSystem(value: typeof import("fs"));
|
|
46
46
|
set watchFileSystem(value: WatchFileSystem);
|
|
47
|
-
set intermediateFileSystem(value:
|
|
47
|
+
set intermediateFileSystem(value: IntermediateFileSystem);
|
|
48
48
|
getInfrastructureLogger(name: string): import("./logging/Logger").Logger;
|
|
49
49
|
/**
|
|
50
50
|
* @param compiler - the child compiler
|
package/dist/Stats.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type { StatsCompilation } from "./stats/statsFactoryUtils";
|
|
|
4
4
|
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule } from "./stats/statsFactoryUtils";
|
|
5
5
|
export declare class Stats {
|
|
6
6
|
#private;
|
|
7
|
-
compilation: Compilation;
|
|
8
7
|
constructor(compilation: Compilation);
|
|
8
|
+
get compilation(): Compilation;
|
|
9
9
|
get hash(): Readonly<string | null>;
|
|
10
10
|
get startTime(): number | undefined;
|
|
11
11
|
get endTime(): number | undefined;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
};
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
4
|
+
export declare class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
|
|
5
|
+
name: BuiltinPluginName;
|
|
6
|
+
affectedHooks: "compilation";
|
|
7
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
8
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import type { Externals } from "..";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler, Externals } from "..";
|
|
3
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
4
|
+
export declare class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
5
|
+
private type;
|
|
6
|
+
private externals;
|
|
7
|
+
name: BuiltinPluginName;
|
|
8
|
+
constructor(type: string, externals: Externals);
|
|
9
|
+
raw(compiler: Compiler): BuiltinPlugin | undefined;
|
|
10
|
+
}
|
|
@@ -47,6 +47,8 @@ export type HtmlRspackPluginOptions = {
|
|
|
47
47
|
chunks?: string[];
|
|
48
48
|
/** Allows you to skip some chunks. */
|
|
49
49
|
excludeChunks?: string[];
|
|
50
|
+
/** Allows to control how chunks should be sorted before they are included to the HTML. */
|
|
51
|
+
chunksSortMode?: "auto" | "manual";
|
|
50
52
|
/** The sri hash algorithm, disabled by default. */
|
|
51
53
|
sri?: "sha256" | "sha384" | "sha512";
|
|
52
54
|
/**
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
};
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
4
|
+
export declare class NaturalModuleIdsPlugin extends RspackBuiltinPlugin {
|
|
5
|
+
name: BuiltinPluginName;
|
|
6
|
+
affectedHooks: "compilation";
|
|
7
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
8
|
+
}
|
|
@@ -66,7 +66,6 @@ export interface OutputNormalized {
|
|
|
66
66
|
environment?: Environment;
|
|
67
67
|
charset?: boolean;
|
|
68
68
|
chunkLoadTimeout?: number;
|
|
69
|
-
cssHeadDataCompression?: boolean;
|
|
70
69
|
compareBeforeEmit?: boolean;
|
|
71
70
|
}
|
|
72
71
|
export interface ModuleOptionsNormalized {
|
|
@@ -124,5 +123,6 @@ export interface RspackOptionsNormalized {
|
|
|
124
123
|
ignoreWarnings?: IgnoreWarningsNormalized;
|
|
125
124
|
performance?: Performance;
|
|
126
125
|
profile?: Profile;
|
|
126
|
+
amd?: string;
|
|
127
127
|
bail?: Bail;
|
|
128
128
|
}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -171,7 +171,9 @@ export type ChunkLoadingGlobal = string;
|
|
|
171
171
|
/** List of library types enabled for use by entry points. */
|
|
172
172
|
export type EnabledLibraryTypes = string[];
|
|
173
173
|
/** Whether delete all files in the output directory. */
|
|
174
|
-
export type Clean = boolean
|
|
174
|
+
export type Clean = boolean | {
|
|
175
|
+
keep?: string;
|
|
176
|
+
};
|
|
175
177
|
/** Output JavaScript files as module type. */
|
|
176
178
|
export type OutputModule = boolean;
|
|
177
179
|
/** Tell Rspack to remove a module from the module instance cache (require.cache) if it throws an exception when it is required. */
|
|
@@ -196,7 +198,14 @@ export type ChunkFormat = string | false;
|
|
|
196
198
|
export type WorkerPublicPath = string;
|
|
197
199
|
/** Controls [Trusted Types](https://web.dev/articles/trusted-types) compatibility. */
|
|
198
200
|
export type TrustedTypes = {
|
|
201
|
+
/**
|
|
202
|
+
* The name of the Trusted Types policy created by webpack to serve bundle chunks.
|
|
203
|
+
*/
|
|
199
204
|
policyName?: string;
|
|
205
|
+
/**
|
|
206
|
+
* If the call to `trustedTypes.createPolicy(...)` fails -- e.g., due to the policy name missing from the CSP `trusted-types` list, or it being a duplicate name, etc. -- controls whether to continue with loading in the hope that `require-trusted-types-for 'script'` isn't enforced yet, versus fail immediately. Default behavior is 'stop'.
|
|
207
|
+
*/
|
|
208
|
+
onPolicyCreationFailure?: "continue" | "stop";
|
|
200
209
|
};
|
|
201
210
|
/** The encoding to use when generating the hash. */
|
|
202
211
|
export type HashDigest = string;
|
|
@@ -275,6 +284,7 @@ export type Output = {
|
|
|
275
284
|
/** This option determines the name of CSS output files on disk. */
|
|
276
285
|
cssFilename?: CssFilename;
|
|
277
286
|
/**
|
|
287
|
+
* @deprecated this config is unused, and will be removed in the future.
|
|
278
288
|
* Rspack adds some metadata in CSS to parse CSS modules, and this configuration determines whether to compress these metadata.
|
|
279
289
|
*
|
|
280
290
|
* The value is `true` in production mode.
|
|
@@ -924,7 +934,12 @@ export type ExternalItemFunctionData = {
|
|
|
924
934
|
request?: string;
|
|
925
935
|
contextInfo?: {
|
|
926
936
|
issuer: string;
|
|
937
|
+
issuerLayer?: string | null;
|
|
927
938
|
};
|
|
939
|
+
/**
|
|
940
|
+
* Get a resolve function with the current resolver options.
|
|
941
|
+
*/
|
|
942
|
+
getResolve?: (options?: ResolveOptions) => ((context: string, request: string, callback: (err?: Error, result?: string) => void) => void) | ((context: string, request: string) => Promise<string>);
|
|
928
943
|
};
|
|
929
944
|
/**
|
|
930
945
|
* Prevent bundling of certain imported package and instead retrieve these external dependencies at runtime.
|
|
@@ -1825,6 +1840,14 @@ export type Incremental = {
|
|
|
1825
1840
|
* Enable incremental build chunk graph.
|
|
1826
1841
|
*/
|
|
1827
1842
|
buildChunkGraph?: boolean;
|
|
1843
|
+
/**
|
|
1844
|
+
* Enable incremental module ids.
|
|
1845
|
+
*/
|
|
1846
|
+
moduleIds?: boolean;
|
|
1847
|
+
/**
|
|
1848
|
+
* Enable incremental chunk ids.
|
|
1849
|
+
*/
|
|
1850
|
+
chunkIds?: boolean;
|
|
1828
1851
|
/**
|
|
1829
1852
|
* Enable incremental module hashes.
|
|
1830
1853
|
*/
|
|
@@ -1951,6 +1974,10 @@ export type IgnoreWarnings = (RegExp | ((error: Error, compilation: Compilation)
|
|
|
1951
1974
|
* Capture a "profile" of the application, including statistics and hints, which can then be dissected using the Analyze tool.
|
|
1952
1975
|
* */
|
|
1953
1976
|
export type Profile = boolean;
|
|
1977
|
+
/**
|
|
1978
|
+
* Set the value of `require.amd` and `define.amd`. Or disable AMD support.
|
|
1979
|
+
*/
|
|
1980
|
+
export type Amd = false | Record<string, any>;
|
|
1954
1981
|
/**
|
|
1955
1982
|
* Fail out on the first error instead of tolerating it.
|
|
1956
1983
|
* @default false
|
|
@@ -2090,6 +2117,11 @@ export type RspackOptions = {
|
|
|
2090
2117
|
* Whether to capture a profile of the application.
|
|
2091
2118
|
*/
|
|
2092
2119
|
profile?: Profile;
|
|
2120
|
+
/**
|
|
2121
|
+
* Set the value of `require.amd` or `define.amd`.
|
|
2122
|
+
* Setting `amd` to false will disable rspack's AMD support.
|
|
2123
|
+
*/
|
|
2124
|
+
amd?: Amd;
|
|
2093
2125
|
/**
|
|
2094
2126
|
* Whether to fail on the first error.
|
|
2095
2127
|
*/
|