@rspack/core 1.0.0-alpha.4 → 1.0.0-beta.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/zod/index.d.ts +138 -52
- package/compiled/zod/index.js +300 -103
- package/compiled/zod/package.json +1 -1
- package/compiled/zod-validation-error/index.js +6 -6
- package/dist/Compilation.d.ts +21 -3
- package/dist/Compilation.js +64 -49
- package/dist/Compiler.js +28 -28
- package/dist/ErrorHelpers.js +2 -4
- package/dist/FileSystem.js +6 -6
- package/dist/Module.js +2 -6
- package/dist/ModuleTypeConstants.d.ts +45 -69
- package/dist/ModuleTypeConstants.js +24 -77
- package/dist/NormalModule.js +6 -6
- package/dist/Stats.js +4 -6
- package/dist/Template.d.ts +31 -147
- package/dist/Template.js +40 -236
- package/dist/Watching.js +2 -2
- package/dist/builtin-loader/lightningcss/index.d.ts +89 -0
- package/dist/builtin-loader/lightningcss/index.js +175 -0
- package/dist/builtin-plugin/BannerPlugin.d.ts +24 -48
- package/dist/builtin-plugin/DefinePlugin.js +9 -13
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +24 -0
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +8 -8
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +10 -3
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +4 -1
- package/dist/builtin-plugin/SplitChunksPlugin.js +7 -17
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +15 -23
- package/dist/builtin-plugin/base.js +1 -3
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts +3 -3
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +17 -66
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +2 -0
- package/dist/builtin-plugin/css-extract/hmr/{normalize-url.js → normalizeUrl.js} +15 -24
- package/dist/builtin-plugin/css-extract/loader.js +6 -6
- package/dist/builtin-plugin/css-extract/utils.js +3 -3
- package/dist/builtin-plugin/lazy-compilation/backend.d.ts +3 -3
- package/dist/builtin-plugin/lazy-compilation/backend.js +1 -1
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapter.js +31 -30
- package/dist/config/adapterRuleUse.d.ts +5 -5
- package/dist/config/adapterRuleUse.js +23 -1
- package/dist/config/browserslistTargetHandler.d.ts +17 -15
- package/dist/config/browserslistTargetHandler.js +27 -33
- package/dist/config/defaults.js +27 -28
- package/dist/config/normalization.d.ts +2 -0
- package/dist/config/normalization.js +5 -5
- package/dist/config/target.d.ts +48 -109
- package/dist/config/target.js +50 -86
- package/dist/config/zod.d.ts +2398 -2212
- package/dist/config/zod.js +29 -19
- package/dist/container/ContainerPlugin.d.ts +7 -7
- package/dist/container/options.js +1 -1
- package/dist/exports.d.ts +4 -4
- package/dist/exports.js +2 -2
- package/dist/lib/CacheFacade.js +1 -0
- package/dist/lib/EntryOptionPlugin.js +2 -2
- package/dist/lib/ModuleFilenameHelpers.js +1 -3
- package/dist/lib/WebpackError.js +1 -1
- package/dist/lib/cache/mergeEtags.js +5 -11
- package/dist/lib/formatLocation.js +3 -5
- package/dist/loader-runner/LoaderLoadingError.d.ts +11 -1
- package/dist/loader-runner/LoaderLoadingError.js +3 -5
- package/dist/loader-runner/index.js +23 -25
- package/dist/loader-runner/loadLoader.d.ts +11 -2
- package/dist/loader-runner/loadLoader.js +18 -20
- package/dist/logging/createConsoleLogger.js +2 -6
- package/dist/logging/truncateArgs.js +5 -9
- package/dist/node/NodeWatchFileSystem.js +5 -5
- package/dist/node/nodeConsole.js +2 -4
- package/dist/rspack.js +6 -6
- package/dist/rspackOptionsApply.js +3 -3
- package/dist/stats/DefaultStatsFactoryPlugin.js +65 -20
- package/dist/stats/DefaultStatsPresetPlugin.js +4 -4
- package/dist/stats/DefaultStatsPrinterPlugin.js +12 -17
- package/dist/stats/StatsFactory.js +13 -17
- package/dist/stats/StatsPrinter.js +7 -9
- package/dist/stats/statsFactoryUtils.d.ts +9 -10
- package/dist/util/AssetInfo.js +11 -7
- package/dist/util/SplitChunkSize.js +1 -1
- package/dist/util/bindingVersionCheck.js +6 -6
- package/dist/util/cleverMerge.d.ts +33 -57
- package/dist/util/cleverMerge.js +89 -145
- package/dist/util/comparators.js +3 -5
- package/dist/util/createHash.d.ts +4 -3
- package/dist/util/createHash.js +31 -45
- package/dist/util/fs.js +16 -20
- package/dist/util/hash/BatchedHash.d.ts +24 -9
- package/dist/util/hash/BatchedHash.js +16 -13
- package/dist/util/hash/index.d.ts +9 -9
- package/dist/util/hash/index.js +14 -11
- package/dist/util/hash/md4.d.ts +29 -2
- package/dist/util/hash/md4.js +7 -3
- package/dist/util/hash/wasm-hash.d.ts +52 -5
- package/dist/util/hash/wasm-hash.js +19 -22
- package/dist/util/hash/xxhash64.d.ts +29 -2
- package/dist/util/hash/xxhash64.js +7 -3
- package/dist/util/identifier.js +13 -19
- package/dist/util/index.js +1 -1
- package/dist/util/memoize.js +7 -9
- package/package.json +9 -8
- package/dist/builtin-plugin/css-extract/hmr/normalize-url.d.ts +0 -2
|
@@ -54,39 +54,31 @@ declare const bannerPluginOptions: z.ZodObject<{
|
|
|
54
54
|
stage: z.ZodOptional<z.ZodNumber>;
|
|
55
55
|
test: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
|
|
56
56
|
}, "strict", z.ZodTypeAny, {
|
|
57
|
-
banner:
|
|
57
|
+
banner: string | ((args_0: {
|
|
58
58
|
hash: string;
|
|
59
59
|
chunk: JsChunk;
|
|
60
60
|
filename: string;
|
|
61
|
-
}, ...args_1: unknown[]) => string)
|
|
62
|
-
|
|
63
|
-
chunk: JsChunk;
|
|
64
|
-
filename: string;
|
|
65
|
-
}, ...args_1: unknown[]) => string) | undefined);
|
|
66
|
-
entryOnly?: boolean | undefined;
|
|
61
|
+
}, ...args_1: unknown[]) => string);
|
|
62
|
+
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
67
63
|
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
68
64
|
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
65
|
+
entryOnly?: boolean | undefined;
|
|
69
66
|
raw?: boolean | undefined;
|
|
70
67
|
footer?: boolean | undefined;
|
|
71
68
|
stage?: number | undefined;
|
|
72
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
73
69
|
}, {
|
|
74
|
-
banner:
|
|
70
|
+
banner: string | ((args_0: {
|
|
75
71
|
hash: string;
|
|
76
72
|
chunk: JsChunk;
|
|
77
73
|
filename: string;
|
|
78
|
-
}, ...args_1: unknown[]) => string)
|
|
79
|
-
|
|
80
|
-
chunk: JsChunk;
|
|
81
|
-
filename: string;
|
|
82
|
-
}, ...args_1: unknown[]) => string) | undefined);
|
|
83
|
-
entryOnly?: boolean | undefined;
|
|
74
|
+
}, ...args_1: unknown[]) => string);
|
|
75
|
+
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
84
76
|
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
85
77
|
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
78
|
+
entryOnly?: boolean | undefined;
|
|
86
79
|
raw?: boolean | undefined;
|
|
87
80
|
footer?: boolean | undefined;
|
|
88
81
|
stage?: number | undefined;
|
|
89
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
90
82
|
}>;
|
|
91
83
|
export type BannerPluginOptions = z.infer<typeof bannerPluginOptions>;
|
|
92
84
|
declare const bannerPluginArgument: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
@@ -123,39 +115,31 @@ declare const bannerPluginArgument: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodFu
|
|
|
123
115
|
stage: z.ZodOptional<z.ZodNumber>;
|
|
124
116
|
test: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
|
|
125
117
|
}, "strict", z.ZodTypeAny, {
|
|
126
|
-
banner:
|
|
127
|
-
hash: string;
|
|
128
|
-
chunk: JsChunk;
|
|
129
|
-
filename: string;
|
|
130
|
-
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
|
|
118
|
+
banner: string | ((args_0: {
|
|
131
119
|
hash: string;
|
|
132
120
|
chunk: JsChunk;
|
|
133
121
|
filename: string;
|
|
134
|
-
}, ...args_1: unknown[]) => string)
|
|
135
|
-
|
|
122
|
+
}, ...args_1: unknown[]) => string);
|
|
123
|
+
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
136
124
|
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
137
125
|
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
126
|
+
entryOnly?: boolean | undefined;
|
|
138
127
|
raw?: boolean | undefined;
|
|
139
128
|
footer?: boolean | undefined;
|
|
140
129
|
stage?: number | undefined;
|
|
141
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
142
130
|
}, {
|
|
143
|
-
banner:
|
|
131
|
+
banner: string | ((args_0: {
|
|
144
132
|
hash: string;
|
|
145
133
|
chunk: JsChunk;
|
|
146
134
|
filename: string;
|
|
147
|
-
}, ...args_1: unknown[]) => string)
|
|
148
|
-
|
|
149
|
-
chunk: JsChunk;
|
|
150
|
-
filename: string;
|
|
151
|
-
}, ...args_1: unknown[]) => string) | undefined);
|
|
152
|
-
entryOnly?: boolean | undefined;
|
|
135
|
+
}, ...args_1: unknown[]) => string);
|
|
136
|
+
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
153
137
|
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
154
138
|
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
139
|
+
entryOnly?: boolean | undefined;
|
|
155
140
|
raw?: boolean | undefined;
|
|
156
141
|
footer?: boolean | undefined;
|
|
157
142
|
stage?: number | undefined;
|
|
158
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
159
143
|
}>]>;
|
|
160
144
|
export type BannerPluginArgument = z.infer<typeof bannerPluginArgument>;
|
|
161
145
|
export declare const BannerPlugin: {
|
|
@@ -164,22 +148,18 @@ export declare const BannerPlugin: {
|
|
|
164
148
|
chunk: JsChunk;
|
|
165
149
|
filename: string;
|
|
166
150
|
}, ...args_1: unknown[]) => string) | {
|
|
167
|
-
banner:
|
|
151
|
+
banner: string | ((args_0: {
|
|
168
152
|
hash: string;
|
|
169
153
|
chunk: JsChunk;
|
|
170
154
|
filename: string;
|
|
171
|
-
}, ...args_1: unknown[]) => string)
|
|
172
|
-
|
|
173
|
-
chunk: JsChunk;
|
|
174
|
-
filename: string;
|
|
175
|
-
}, ...args_1: unknown[]) => string) | undefined);
|
|
176
|
-
entryOnly?: boolean | undefined;
|
|
155
|
+
}, ...args_1: unknown[]) => string);
|
|
156
|
+
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
177
157
|
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
178
158
|
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
159
|
+
entryOnly?: boolean | undefined;
|
|
179
160
|
raw?: boolean | undefined;
|
|
180
161
|
footer?: boolean | undefined;
|
|
181
162
|
stage?: number | undefined;
|
|
182
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
183
163
|
}): {
|
|
184
164
|
name: BuiltinPluginName;
|
|
185
165
|
_args: [args: string | ((args_0: {
|
|
@@ -187,22 +167,18 @@ export declare const BannerPlugin: {
|
|
|
187
167
|
chunk: JsChunk;
|
|
188
168
|
filename: string;
|
|
189
169
|
}, ...args_1: unknown[]) => string) | {
|
|
190
|
-
banner:
|
|
191
|
-
hash: string;
|
|
192
|
-
chunk: JsChunk;
|
|
193
|
-
filename: string;
|
|
194
|
-
}, ...args_1: unknown[]) => string)) & (string | ((args_0: {
|
|
170
|
+
banner: string | ((args_0: {
|
|
195
171
|
hash: string;
|
|
196
172
|
chunk: JsChunk;
|
|
197
173
|
filename: string;
|
|
198
|
-
}, ...args_1: unknown[]) => string)
|
|
199
|
-
|
|
174
|
+
}, ...args_1: unknown[]) => string);
|
|
175
|
+
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
200
176
|
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
201
177
|
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
178
|
+
entryOnly?: boolean | undefined;
|
|
202
179
|
raw?: boolean | undefined;
|
|
203
180
|
footer?: boolean | undefined;
|
|
204
181
|
stage?: number | undefined;
|
|
205
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
206
182
|
}];
|
|
207
183
|
affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
208
184
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
@@ -12,37 +12,33 @@ const normalizeValue = (define, supportsBigIntLiteral) => {
|
|
|
12
12
|
if (p === undefined) {
|
|
13
13
|
return "undefined";
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
if (Object.is(p, -0)) {
|
|
16
16
|
return "-0";
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
if (p instanceof RegExp) {
|
|
19
19
|
return p.toString();
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
if (typeof p === "function") {
|
|
22
22
|
return "(" + p.toString() + ")";
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
if (typeof p === "bigint") {
|
|
25
25
|
return supportsBigIntLiteral ? `${p}n` : `BigInt("${p}")`;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return p;
|
|
30
|
-
}
|
|
27
|
+
// assume `p` is a valid JSON value
|
|
28
|
+
return p;
|
|
31
29
|
};
|
|
32
30
|
const normalizeObject = (define) => {
|
|
33
31
|
if (Array.isArray(define)) {
|
|
34
32
|
return define.map(normalizeObject);
|
|
35
33
|
}
|
|
36
|
-
|
|
34
|
+
if (define instanceof RegExp) {
|
|
37
35
|
return normalizePrimitive(define);
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
if (define && typeof define === "object") {
|
|
40
38
|
const keys = Object.keys(define);
|
|
41
39
|
return Object.fromEntries(keys.map(k => [k, normalizeObject(define[k])]));
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
return normalizePrimitive(define);
|
|
45
|
-
}
|
|
41
|
+
return normalizePrimitive(define);
|
|
46
42
|
};
|
|
47
43
|
return normalizeObject(define);
|
|
48
44
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuiltinPluginName, type RawEntryOptions } from "@rspack/binding";
|
|
2
|
-
import { type ChunkLoading, type EntryRuntime, type
|
|
2
|
+
import { type ChunkLoading, type EntryRuntime, type Filename, type LibraryOptions, type PublicPath } from "../config";
|
|
3
3
|
export type EntryOptions = {
|
|
4
4
|
name?: string;
|
|
5
5
|
runtime?: EntryRuntime;
|
|
@@ -7,7 +7,7 @@ export type EntryOptions = {
|
|
|
7
7
|
asyncChunks?: boolean;
|
|
8
8
|
publicPath?: PublicPath;
|
|
9
9
|
baseUri?: string;
|
|
10
|
-
filename?:
|
|
10
|
+
filename?: Filename;
|
|
11
11
|
library?: LibraryOptions;
|
|
12
12
|
dependOn?: string[];
|
|
13
13
|
};
|
|
@@ -4,36 +4,60 @@ export declare const ExternalsPlugin: {
|
|
|
4
4
|
context?: string | undefined;
|
|
5
5
|
dependencyType?: string | undefined;
|
|
6
6
|
request?: string | undefined;
|
|
7
|
+
contextInfo?: {
|
|
8
|
+
issuer: string;
|
|
9
|
+
} | undefined;
|
|
7
10
|
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
8
11
|
context?: string | undefined;
|
|
9
12
|
dependencyType?: string | undefined;
|
|
10
13
|
request?: string | undefined;
|
|
14
|
+
contextInfo?: {
|
|
15
|
+
issuer: string;
|
|
16
|
+
} | undefined;
|
|
11
17
|
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
12
18
|
context?: string | undefined;
|
|
13
19
|
dependencyType?: string | undefined;
|
|
14
20
|
request?: string | undefined;
|
|
21
|
+
contextInfo?: {
|
|
22
|
+
issuer: string;
|
|
23
|
+
} | undefined;
|
|
15
24
|
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
16
25
|
context?: string | undefined;
|
|
17
26
|
dependencyType?: string | undefined;
|
|
18
27
|
request?: string | undefined;
|
|
28
|
+
contextInfo?: {
|
|
29
|
+
issuer: string;
|
|
30
|
+
} | undefined;
|
|
19
31
|
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]): {
|
|
20
32
|
name: BuiltinPluginName;
|
|
21
33
|
_args: [type: string, externals: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
22
34
|
context?: string | undefined;
|
|
23
35
|
dependencyType?: string | undefined;
|
|
24
36
|
request?: string | undefined;
|
|
37
|
+
contextInfo?: {
|
|
38
|
+
issuer: string;
|
|
39
|
+
} | undefined;
|
|
25
40
|
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
26
41
|
context?: string | undefined;
|
|
27
42
|
dependencyType?: string | undefined;
|
|
28
43
|
request?: string | undefined;
|
|
44
|
+
contextInfo?: {
|
|
45
|
+
issuer: string;
|
|
46
|
+
} | undefined;
|
|
29
47
|
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
30
48
|
context?: string | undefined;
|
|
31
49
|
dependencyType?: string | undefined;
|
|
32
50
|
request?: string | undefined;
|
|
51
|
+
contextInfo?: {
|
|
52
|
+
issuer: string;
|
|
53
|
+
} | undefined;
|
|
33
54
|
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
34
55
|
context?: string | undefined;
|
|
35
56
|
dependencyType?: string | undefined;
|
|
36
57
|
request?: string | undefined;
|
|
58
|
+
contextInfo?: {
|
|
59
|
+
issuer: string;
|
|
60
|
+
} | undefined;
|
|
37
61
|
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]];
|
|
38
62
|
affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
39
63
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
@@ -16,14 +16,14 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
16
16
|
favicon: z.ZodOptional<z.ZodString>;
|
|
17
17
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
|
|
18
18
|
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
chunks?: string[] | undefined;
|
|
20
|
+
publicPath?: string | undefined;
|
|
19
21
|
filename?: string | undefined;
|
|
20
22
|
template?: string | undefined;
|
|
21
23
|
templateContent?: string | undefined;
|
|
22
24
|
templateParameters?: Record<string, string> | undefined;
|
|
23
25
|
inject?: boolean | "head" | "body" | undefined;
|
|
24
|
-
publicPath?: string | undefined;
|
|
25
26
|
scriptLoading?: "module" | "blocking" | "defer" | undefined;
|
|
26
|
-
chunks?: string[] | undefined;
|
|
27
27
|
excludedChunks?: string[] | undefined;
|
|
28
28
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
29
29
|
minify?: boolean | undefined;
|
|
@@ -31,14 +31,14 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
31
31
|
favicon?: string | undefined;
|
|
32
32
|
meta?: Record<string, string | Record<string, string>> | undefined;
|
|
33
33
|
}, {
|
|
34
|
+
chunks?: string[] | undefined;
|
|
35
|
+
publicPath?: string | undefined;
|
|
34
36
|
filename?: string | undefined;
|
|
35
37
|
template?: string | undefined;
|
|
36
38
|
templateContent?: string | undefined;
|
|
37
39
|
templateParameters?: Record<string, string> | undefined;
|
|
38
40
|
inject?: boolean | "head" | "body" | undefined;
|
|
39
|
-
publicPath?: string | undefined;
|
|
40
41
|
scriptLoading?: "module" | "blocking" | "defer" | undefined;
|
|
41
|
-
chunks?: string[] | undefined;
|
|
42
42
|
excludedChunks?: string[] | undefined;
|
|
43
43
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
44
44
|
minify?: boolean | undefined;
|
|
@@ -49,14 +49,14 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
49
49
|
export type HtmlRspackPluginOptions = z.infer<typeof htmlRspackPluginOptions>;
|
|
50
50
|
export declare const HtmlRspackPlugin: {
|
|
51
51
|
new (c?: {
|
|
52
|
+
chunks?: string[] | undefined;
|
|
53
|
+
publicPath?: string | undefined;
|
|
52
54
|
filename?: string | undefined;
|
|
53
55
|
template?: string | undefined;
|
|
54
56
|
templateContent?: string | undefined;
|
|
55
57
|
templateParameters?: Record<string, string> | undefined;
|
|
56
58
|
inject?: boolean | "head" | "body" | undefined;
|
|
57
|
-
publicPath?: string | undefined;
|
|
58
59
|
scriptLoading?: "module" | "blocking" | "defer" | undefined;
|
|
59
|
-
chunks?: string[] | undefined;
|
|
60
60
|
excludedChunks?: string[] | undefined;
|
|
61
61
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
62
62
|
minify?: boolean | undefined;
|
|
@@ -66,14 +66,14 @@ export declare const HtmlRspackPlugin: {
|
|
|
66
66
|
} | undefined): {
|
|
67
67
|
name: BuiltinPluginName;
|
|
68
68
|
_args: [c?: {
|
|
69
|
+
chunks?: string[] | undefined;
|
|
70
|
+
publicPath?: string | undefined;
|
|
69
71
|
filename?: string | undefined;
|
|
70
72
|
template?: string | undefined;
|
|
71
73
|
templateContent?: string | undefined;
|
|
72
74
|
templateParameters?: Record<string, string> | undefined;
|
|
73
75
|
inject?: boolean | "head" | "body" | undefined;
|
|
74
|
-
publicPath?: string | undefined;
|
|
75
76
|
scriptLoading?: "module" | "blocking" | "defer" | undefined;
|
|
76
|
-
chunks?: string[] | undefined;
|
|
77
77
|
excludedChunks?: string[] | undefined;
|
|
78
78
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
79
79
|
minify?: boolean | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
2
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
3
|
+
import type { Chunk } from "../Chunk";
|
|
3
4
|
import { Compilation } from "../Compilation";
|
|
5
|
+
import type Hash from "../util/hash";
|
|
4
6
|
import { RspackBuiltinPlugin } from "./base";
|
|
5
|
-
import Hash = require("../util/hash");
|
|
6
|
-
import type { Chunk } from "../Chunk";
|
|
7
7
|
export type CompilationHooks = {
|
|
8
8
|
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
|
|
9
9
|
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { BuiltinPluginName, type RawLightningCssMinimizerRspackPluginOptions } from "@rspack/binding";
|
|
2
|
-
|
|
2
|
+
type MinifyCondition = string | RegExp;
|
|
3
|
+
type MinifyConditions = MinifyCondition | MinifyCondition[];
|
|
4
|
+
export type LightningCssMinimizerRspackPluginOptions = Partial<RawLightningCssMinimizerRspackPluginOptions> & {
|
|
5
|
+
test?: MinifyConditions;
|
|
6
|
+
exclude?: MinifyConditions;
|
|
7
|
+
include?: MinifyConditions;
|
|
8
|
+
};
|
|
3
9
|
export declare const LightningCssMinimizerRspackPlugin: {
|
|
4
|
-
new (options?:
|
|
10
|
+
new (options?: LightningCssMinimizerRspackPluginOptions | undefined): {
|
|
5
11
|
name: BuiltinPluginName;
|
|
6
|
-
_args: [options?:
|
|
12
|
+
_args: [options?: LightningCssMinimizerRspackPluginOptions | undefined];
|
|
7
13
|
affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
8
14
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
9
15
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
10
16
|
};
|
|
11
17
|
};
|
|
18
|
+
export {};
|
|
@@ -8,6 +8,9 @@ exports.LightningCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.Builtin
|
|
|
8
8
|
errorRecovery: options?.errorRecovery ?? true,
|
|
9
9
|
unusedSymbols: options?.unusedSymbols ?? [],
|
|
10
10
|
removeUnusedLocalIdents: options?.removeUnusedLocalIdents ?? true,
|
|
11
|
-
browserslist: options?.browserslist ?? ["defaults"]
|
|
11
|
+
browserslist: options?.browserslist ?? ["defaults"],
|
|
12
|
+
test: options?.test,
|
|
13
|
+
include: options?.include,
|
|
14
|
+
exclude: options?.exclude
|
|
12
15
|
};
|
|
13
16
|
});
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SplitChunksPlugin = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
8
|
const binding_1 = require("@rspack/binding");
|
|
9
9
|
const Chunk_1 = require("../Chunk");
|
|
10
10
|
const Module_1 = require("../Module");
|
|
@@ -19,7 +19,7 @@ class SplitChunksPlugin extends base_1.RspackBuiltinPlugin {
|
|
|
19
19
|
}
|
|
20
20
|
raw(compiler) {
|
|
21
21
|
const rawOptions = toRawSplitChunksOptions(this.options, compiler);
|
|
22
|
-
(0,
|
|
22
|
+
(0, node_assert_1.default)(typeof rawOptions !== "undefined");
|
|
23
23
|
return (0, base_1.createBuiltinPlugin)(this.name, rawOptions);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -34,14 +34,10 @@ function toRawSplitChunksOptions(sc, compiler) {
|
|
|
34
34
|
if (typeof ctx.module === "undefined") {
|
|
35
35
|
return name(undefined);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation), getChunks(ctx.chunks), ctx.cacheGroupKey);
|
|
39
|
-
}
|
|
37
|
+
return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation), getChunks(ctx.chunks), ctx.cacheGroupKey);
|
|
40
38
|
};
|
|
41
39
|
}
|
|
42
|
-
|
|
43
|
-
return name;
|
|
44
|
-
}
|
|
40
|
+
return name;
|
|
45
41
|
}
|
|
46
42
|
function getTest(test) {
|
|
47
43
|
if (typeof test === "function") {
|
|
@@ -49,22 +45,16 @@ function toRawSplitChunksOptions(sc, compiler) {
|
|
|
49
45
|
if (typeof ctx.module === "undefined") {
|
|
50
46
|
return test(undefined);
|
|
51
47
|
}
|
|
52
|
-
|
|
53
|
-
return test(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
|
|
54
|
-
}
|
|
48
|
+
return test(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
|
|
55
49
|
};
|
|
56
50
|
}
|
|
57
|
-
|
|
58
|
-
return test;
|
|
59
|
-
}
|
|
51
|
+
return test;
|
|
60
52
|
}
|
|
61
53
|
function getChunks(chunks) {
|
|
62
54
|
if (typeof chunks === "function") {
|
|
63
55
|
return (chunk) => chunks(Chunk_1.Chunk.__from_binding(chunk, compiler._lastCompilation.__internal_getInner()));
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
return chunks;
|
|
67
|
-
}
|
|
57
|
+
return chunks;
|
|
68
58
|
}
|
|
69
59
|
const { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
|
|
70
60
|
return {
|
|
@@ -13,46 +13,38 @@ function getRawExtractCommentsOptions(extractComments) {
|
|
|
13
13
|
// copied from terser-webpack-plugin
|
|
14
14
|
return "@preserve|@lic|@cc_on|^\\**!";
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
if (condition === false) {
|
|
17
17
|
throw Error("unreachable");
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return condition.source;
|
|
22
|
-
}
|
|
19
|
+
// FIXME: flags
|
|
20
|
+
return condition.source;
|
|
23
21
|
};
|
|
24
22
|
if (typeof extractComments === "boolean") {
|
|
25
23
|
if (!extractComments) {
|
|
26
24
|
return undefined;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return res;
|
|
33
|
-
}
|
|
26
|
+
const res = {
|
|
27
|
+
condition: conditionStr(extractComments)
|
|
28
|
+
};
|
|
29
|
+
return res;
|
|
34
30
|
}
|
|
35
|
-
|
|
31
|
+
if (extractComments instanceof RegExp) {
|
|
36
32
|
const res = {
|
|
37
33
|
condition: extractComments.source
|
|
38
34
|
};
|
|
39
35
|
return res;
|
|
40
36
|
}
|
|
41
|
-
|
|
37
|
+
if (isObject(extractComments)) {
|
|
42
38
|
if (extractComments.condition === false) {
|
|
43
39
|
return undefined;
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return res;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return undefined;
|
|
41
|
+
const res = {
|
|
42
|
+
condition: conditionStr(extractComments.condition),
|
|
43
|
+
banner: extractComments.banner
|
|
44
|
+
};
|
|
45
|
+
return res;
|
|
55
46
|
}
|
|
47
|
+
return undefined;
|
|
56
48
|
}
|
|
57
49
|
exports.SwcJsMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcJsMinimizerRspackPlugin, (options) => {
|
|
58
50
|
let compress = options?.compress ?? true;
|
|
@@ -15,9 +15,7 @@ function canInherentFromParent(affectedHooks) {
|
|
|
15
15
|
// this arm should be removed
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return !exports.HOOKS_CAN_NOT_INHERENT_FROM_PARENT.includes(affectedHooks);
|
|
20
|
-
}
|
|
18
|
+
return !exports.HOOKS_CAN_NOT_INHERENT_FROM_PARENT.includes(affectedHooks);
|
|
21
19
|
}
|
|
22
20
|
exports.canInherentFromParent = canInherentFromParent;
|
|
23
21
|
class RspackBuiltinPlugin {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
declare function noop(): void;
|
|
2
|
+
declare function cssReload(moduleId: string, options: Record<string, any>): typeof noop;
|
|
3
|
+
export { cssReload };
|