@rspack/core 0.7.0-beta.0-canary-ed8ec0c-20240518004231 → 0.7.0-beta.0-canary-5ddb34f-20240520023643
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/config/adapter.js +2 -1
- package/dist/config/browserslistTargetHandler.d.ts +3 -3
- package/dist/config/browserslistTargetHandler.js +46 -20
- package/dist/config/defaults.js +17 -0
- package/dist/config/normalization.d.ts +2 -1
- package/dist/config/normalization.js +2 -1
- package/dist/config/target.d.ts +15 -7
- package/dist/config/target.js +55 -33
- package/dist/config/zod.d.ts +235 -0
- package/dist/config/zod.js +18 -1
- package/package.json +4 -4
package/dist/config/adapter.js
CHANGED
|
@@ -154,7 +154,8 @@ function getRawOutput(output) {
|
|
|
154
154
|
workerChunkLoading: workerChunkLoading === false ? "false" : workerChunkLoading,
|
|
155
155
|
workerWasmLoading: workerWasmLoading === false ? "false" : workerWasmLoading,
|
|
156
156
|
workerPublicPath: output.workerPublicPath,
|
|
157
|
-
scriptType: output.scriptType === false ? "false" : output.scriptType
|
|
157
|
+
scriptType: output.scriptType === false ? "false" : output.scriptType,
|
|
158
|
+
environment: output.environment
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
function getRawLibrary(library) {
|
|
@@ -12,8 +12,8 @@ export type BrowserslistHandlerConfig = {
|
|
|
12
12
|
*/
|
|
13
13
|
export function resolve(browsers: string[]): EcmaTargetProperties & PlatformTargetProperties & ApiTargetProperties;
|
|
14
14
|
/**
|
|
15
|
-
* @param {string} input input string
|
|
15
|
+
* @param {string | null | undefined} input input string
|
|
16
16
|
* @param {string} context the context directory
|
|
17
|
-
* @returns {string[] | undefined
|
|
17
|
+
* @returns {string[] | undefined} selected browsers
|
|
18
18
|
*/
|
|
19
|
-
export function load(input: string, context: string): string[] | undefined
|
|
19
|
+
export function load(input: string | null | undefined, context: string): string[] | undefined;
|
|
@@ -22,7 +22,7 @@ const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
|
|
|
22
22
|
* @property {string=} query
|
|
23
23
|
*/
|
|
24
24
|
/**
|
|
25
|
-
* @param {string} input input string
|
|
25
|
+
* @param {string | null | undefined} input input string
|
|
26
26
|
* @param {string} context the context directory
|
|
27
27
|
* @returns {BrowserslistHandlerConfig} config
|
|
28
28
|
*/
|
|
@@ -41,9 +41,9 @@ const parse = (input, context) => {
|
|
|
41
41
|
return { query: input };
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
|
-
* @param {string} input input string
|
|
44
|
+
* @param {string | null | undefined} input input string
|
|
45
45
|
* @param {string} context the context directory
|
|
46
|
-
* @returns {string[] | undefined
|
|
46
|
+
* @returns {string[] | undefined} selected browsers
|
|
47
47
|
*/
|
|
48
48
|
const load = (input, context) => {
|
|
49
49
|
const { configPath, env, query } = parse(input, context);
|
|
@@ -59,7 +59,7 @@ const load = (input, context) => {
|
|
|
59
59
|
})
|
|
60
60
|
: browserslist.loadConfig({ path: context, env });
|
|
61
61
|
if (!config)
|
|
62
|
-
return
|
|
62
|
+
return;
|
|
63
63
|
return browserslist(config);
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
@@ -84,7 +84,9 @@ const resolve = browsers => {
|
|
|
84
84
|
// safari TP supports all features for normal safari
|
|
85
85
|
parsedVersion === "TP"
|
|
86
86
|
? [Infinity, Infinity]
|
|
87
|
-
: parsedVersion.
|
|
87
|
+
: parsedVersion.includes("-")
|
|
88
|
+
? parsedVersion.split("-")[0].split(".")
|
|
89
|
+
: parsedVersion.split(".");
|
|
88
90
|
if (typeof requiredVersion === "number") {
|
|
89
91
|
return +parsedMajor >= requiredVersion;
|
|
90
92
|
}
|
|
@@ -112,9 +114,9 @@ const resolve = browsers => {
|
|
|
112
114
|
samsung: [8, 2],
|
|
113
115
|
android: 63,
|
|
114
116
|
and_qq: [10, 4],
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
baidu: [13, 18],
|
|
118
|
+
and_uc: [15, 5],
|
|
119
|
+
kaios: [3, 0],
|
|
118
120
|
node: [12, 17]
|
|
119
121
|
});
|
|
120
122
|
return {
|
|
@@ -137,7 +139,7 @@ const resolve = browsers => {
|
|
|
137
139
|
android: 37,
|
|
138
140
|
and_qq: [10, 4],
|
|
139
141
|
// Supported correctly in strict mode, otherwise supported without block scope
|
|
140
|
-
|
|
142
|
+
baidu: [13, 18],
|
|
141
143
|
and_uc: [12, 12],
|
|
142
144
|
kaios: [2, 5],
|
|
143
145
|
node: [6, 0]
|
|
@@ -180,7 +182,7 @@ const resolve = browsers => {
|
|
|
180
182
|
// and_qq: Unknown support
|
|
181
183
|
// baidu: Unknown support
|
|
182
184
|
// and_uc: Unknown support
|
|
183
|
-
|
|
185
|
+
kaios: [3, 0],
|
|
184
186
|
node: [0, 12]
|
|
185
187
|
}),
|
|
186
188
|
destructuring: rawChecker({
|
|
@@ -199,7 +201,7 @@ const resolve = browsers => {
|
|
|
199
201
|
// and_qq: Unknown support
|
|
200
202
|
// baidu: Unknown support
|
|
201
203
|
// and_uc: Unknown support
|
|
202
|
-
|
|
204
|
+
kaios: [2, 5],
|
|
203
205
|
node: [6, 0]
|
|
204
206
|
}),
|
|
205
207
|
bigIntLiteral: rawChecker({
|
|
@@ -215,10 +217,10 @@ const resolve = browsers => {
|
|
|
215
217
|
ios_saf: 14,
|
|
216
218
|
samsung: [9, 2],
|
|
217
219
|
android: 67,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
and_qq: [13, 1],
|
|
221
|
+
baidu: [13, 18],
|
|
222
|
+
and_uc: [15, 5],
|
|
223
|
+
kaios: [3, 0],
|
|
222
224
|
node: [10, 4]
|
|
223
225
|
}),
|
|
224
226
|
// Support syntax `import` and `export` and no limitations and bugs on Node.js
|
|
@@ -237,9 +239,9 @@ const resolve = browsers => {
|
|
|
237
239
|
samsung: [8, 0],
|
|
238
240
|
android: 61,
|
|
239
241
|
and_qq: [10, 4],
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
baidu: [13, 18],
|
|
243
|
+
and_uc: [15, 5],
|
|
244
|
+
kaios: [3, 0],
|
|
243
245
|
node: [12, 17]
|
|
244
246
|
}),
|
|
245
247
|
dynamicImport: es6DynamicImport,
|
|
@@ -262,7 +264,7 @@ const resolve = browsers => {
|
|
|
262
264
|
// and_qq: Unknown support
|
|
263
265
|
// baidu: Unknown support
|
|
264
266
|
// and_uc: Unknown support
|
|
265
|
-
|
|
267
|
+
kaios: [3, 0],
|
|
266
268
|
node: 12
|
|
267
269
|
}),
|
|
268
270
|
optionalChaining: rawChecker({
|
|
@@ -281,7 +283,7 @@ const resolve = browsers => {
|
|
|
281
283
|
// and_qq: Not supported
|
|
282
284
|
// baidu: Not supported
|
|
283
285
|
// and_uc: Not supported
|
|
284
|
-
|
|
286
|
+
kaios: [3, 0],
|
|
285
287
|
node: 14
|
|
286
288
|
}),
|
|
287
289
|
templateLiteral: rawChecker({
|
|
@@ -303,6 +305,25 @@ const resolve = browsers => {
|
|
|
303
305
|
kaios: [2, 5],
|
|
304
306
|
node: 4
|
|
305
307
|
}),
|
|
308
|
+
asyncFunction: rawChecker({
|
|
309
|
+
chrome: 55,
|
|
310
|
+
and_chr: 55,
|
|
311
|
+
edge: 15,
|
|
312
|
+
firefox: 52,
|
|
313
|
+
and_ff: 52,
|
|
314
|
+
// ie: Not supported,
|
|
315
|
+
opera: 42,
|
|
316
|
+
op_mob: 42,
|
|
317
|
+
safari: 11,
|
|
318
|
+
ios_saf: 11,
|
|
319
|
+
samsung: [6, 2],
|
|
320
|
+
android: 55,
|
|
321
|
+
and_qq: [13, 1],
|
|
322
|
+
baidu: [13, 18],
|
|
323
|
+
and_uc: [15, 5],
|
|
324
|
+
kaios: 3,
|
|
325
|
+
node: [7, 6]
|
|
326
|
+
}),
|
|
306
327
|
browser: browserProperty,
|
|
307
328
|
electron: false,
|
|
308
329
|
node: nodeProperty,
|
|
@@ -315,6 +336,11 @@ const resolve = browsers => {
|
|
|
315
336
|
importScripts: false,
|
|
316
337
|
importScriptsInWorker: true,
|
|
317
338
|
nodeBuiltins: nodeProperty,
|
|
339
|
+
nodePrefixForCoreModules: nodeProperty &&
|
|
340
|
+
!browsers.some(b => b.startsWith("node 15")) &&
|
|
341
|
+
rawChecker({
|
|
342
|
+
node: [14, 18]
|
|
343
|
+
}),
|
|
318
344
|
require: nodeProperty
|
|
319
345
|
};
|
|
320
346
|
};
|
package/dist/config/defaults.js
CHANGED
|
@@ -590,6 +590,23 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
590
590
|
// });
|
|
591
591
|
return Array.from(enabledWasmLoadingTypes);
|
|
592
592
|
});
|
|
593
|
+
const environment = output.environment;
|
|
594
|
+
const optimistic = (v) => v || v === undefined;
|
|
595
|
+
const conditionallyOptimistic = (v, c) => (v === undefined && c) || v;
|
|
596
|
+
F(environment, "globalThis", () => tp && tp.globalThis);
|
|
597
|
+
F(environment, "bigIntLiteral", () => tp && tp.bigIntLiteral);
|
|
598
|
+
F(environment, "const", () => tp && optimistic(tp.const));
|
|
599
|
+
F(environment, "arrowFunction", () => tp && optimistic(tp.arrowFunction));
|
|
600
|
+
F(environment, "asyncFunction", () => tp && optimistic(tp.asyncFunction));
|
|
601
|
+
F(environment, "forOf", () => tp && optimistic(tp.forOf));
|
|
602
|
+
F(environment, "destructuring", () => tp && optimistic(tp.destructuring));
|
|
603
|
+
F(environment, "optionalChaining", () => tp && optimistic(tp.optionalChaining));
|
|
604
|
+
F(environment, "nodePrefixForCoreModules", () => tp && optimistic(tp.nodePrefixForCoreModules));
|
|
605
|
+
F(environment, "templateLiteral", () => tp && optimistic(tp.templateLiteral));
|
|
606
|
+
F(environment, "dynamicImport", () => conditionallyOptimistic(tp && tp.dynamicImport, output.module));
|
|
607
|
+
F(environment, "dynamicImportInWorker", () => conditionallyOptimistic(tp && tp.dynamicImportInWorker, output.module));
|
|
608
|
+
F(environment, "module", () => conditionallyOptimistic(tp && tp.module, output.module));
|
|
609
|
+
F(environment, "document", () => tp && optimistic(tp.document));
|
|
593
610
|
};
|
|
594
611
|
const applyExternalsPresetsDefaults = (externalsPresets, { targetProperties }) => {
|
|
595
612
|
D(externalsPresets, "web", targetProperties && targetProperties.web);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import type { Compilation } from "../Compilation";
|
|
11
|
-
import type { AssetModuleFilename, Bail, Builtins, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryFilename, EntryRuntime, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, InfrastructureLogging, LibraryOptions, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./zod";
|
|
11
|
+
import type { AssetModuleFilename, Bail, Builtins, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryFilename, EntryRuntime, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, InfrastructureLogging, LibraryOptions, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./zod";
|
|
12
12
|
export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
|
|
13
13
|
export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
|
|
14
14
|
export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
|
|
@@ -69,6 +69,7 @@ export interface OutputNormalized {
|
|
|
69
69
|
devtoolNamespace?: DevtoolNamespace;
|
|
70
70
|
devtoolModuleFilenameTemplate?: DevtoolModuleFilenameTemplate;
|
|
71
71
|
devtoolFallbackModuleFilenameTemplate?: DevtoolFallbackModuleFilenameTemplate;
|
|
72
|
+
environment?: Environment;
|
|
72
73
|
}
|
|
73
74
|
export interface ModuleOptionsNormalized {
|
|
74
75
|
defaultRules?: RuleSetRules;
|
|
@@ -118,7 +118,8 @@ const getNormalizedRspackOptions = (config) => {
|
|
|
118
118
|
scriptType: output.scriptType,
|
|
119
119
|
devtoolNamespace: output.devtoolNamespace,
|
|
120
120
|
devtoolModuleFilenameTemplate: output.devtoolModuleFilenameTemplate,
|
|
121
|
-
devtoolFallbackModuleFilenameTemplate: output.devtoolFallbackModuleFilenameTemplate
|
|
121
|
+
devtoolFallbackModuleFilenameTemplate: output.devtoolFallbackModuleFilenameTemplate,
|
|
122
|
+
environment: cloneObject(output.environment)
|
|
122
123
|
};
|
|
123
124
|
}),
|
|
124
125
|
resolve: nestedConfig(config.resolve, resolve => ({
|
package/dist/config/target.d.ts
CHANGED
|
@@ -47,6 +47,10 @@ export type ApiTargetProperties = {
|
|
|
47
47
|
* has node.js built-in modules available
|
|
48
48
|
*/
|
|
49
49
|
nodeBuiltins: boolean | null;
|
|
50
|
+
/**
|
|
51
|
+
* node.js allows to use `node:` prefix for core modules
|
|
52
|
+
*/
|
|
53
|
+
nodePrefixForCoreModules: boolean | null;
|
|
50
54
|
/**
|
|
51
55
|
* has document available (allows script tags)
|
|
52
56
|
*/
|
|
@@ -113,30 +117,34 @@ export type EcmaTargetProperties = {
|
|
|
113
117
|
* template literal is available
|
|
114
118
|
*/
|
|
115
119
|
templateLiteral: boolean | null;
|
|
120
|
+
/**
|
|
121
|
+
* async functions and await are available
|
|
122
|
+
*/
|
|
123
|
+
asyncFunction: boolean | null;
|
|
116
124
|
};
|
|
117
125
|
/**
|
|
118
126
|
* <T>
|
|
119
127
|
*/
|
|
120
128
|
export type Never<T> = { [P in keyof T]?: undefined; };
|
|
121
129
|
/**
|
|
122
|
-
* <A,B>
|
|
130
|
+
* <A, B>
|
|
123
131
|
*/
|
|
124
132
|
export type Mix<A, B> = (A & Never<B>) | (Never<A> & B) | (A & B);
|
|
125
133
|
export type TargetProperties = Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>>;
|
|
126
134
|
/**
|
|
127
135
|
* @param {string} context the context directory
|
|
128
|
-
* @returns {
|
|
136
|
+
* @returns {"browserslist" | "web"} default target
|
|
129
137
|
*/
|
|
130
|
-
export function getDefaultTarget(context: string):
|
|
138
|
+
export function getDefaultTarget(context: string): "browserslist" | "web";
|
|
131
139
|
/**
|
|
132
|
-
* @param {string
|
|
140
|
+
* @param {string} target the target
|
|
133
141
|
* @param {string} context the context directory
|
|
134
142
|
* @returns {TargetProperties} target properties
|
|
135
143
|
*/
|
|
136
|
-
export function
|
|
144
|
+
export function getTargetProperties(target: string, context: string): TargetProperties;
|
|
137
145
|
/**
|
|
138
|
-
* @param {string}
|
|
146
|
+
* @param {string[]} targets the targets
|
|
139
147
|
* @param {string} context the context directory
|
|
140
148
|
* @returns {TargetProperties} target properties
|
|
141
149
|
*/
|
|
142
|
-
export function
|
|
150
|
+
export function getTargetsProperties(targets: string[], context: string): TargetProperties;
|
package/dist/config/target.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* The following code is modified based on
|
|
4
3
|
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/target.js
|
|
@@ -8,17 +7,16 @@
|
|
|
8
7
|
* Copyright (c) JS Foundation and other contributors
|
|
9
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
9
|
*/
|
|
10
|
+
"use strict";
|
|
11
11
|
const { memoize } = require("../util/memoize");
|
|
12
12
|
const getBrowserslistTargetHandler = memoize(() => require("./browserslistTargetHandler"));
|
|
13
13
|
/**
|
|
14
14
|
* @param {string} context the context directory
|
|
15
|
-
* @returns {
|
|
15
|
+
* @returns {"browserslist" | "web"} default target
|
|
16
16
|
*/
|
|
17
17
|
const getDefaultTarget = context => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// return browsers ? "browserslist" : "web";
|
|
21
|
-
return "web";
|
|
18
|
+
const browsers = getBrowserslistTargetHandler().load(null, context);
|
|
19
|
+
return browsers ? "browserslist" : "web";
|
|
22
20
|
};
|
|
23
21
|
/**
|
|
24
22
|
* @typedef {Object} PlatformTargetProperties
|
|
@@ -39,6 +37,7 @@ const getDefaultTarget = context => {
|
|
|
39
37
|
* @typedef {Object} ApiTargetProperties
|
|
40
38
|
* @property {boolean | null} require has require function available
|
|
41
39
|
* @property {boolean | null} nodeBuiltins has node.js built-in modules available
|
|
40
|
+
* @property {boolean | null} nodePrefixForCoreModules node.js allows to use `node:` prefix for core modules
|
|
42
41
|
* @property {boolean | null} document has document available (allows script tags)
|
|
43
42
|
* @property {boolean | null} importScripts has importScripts available
|
|
44
43
|
* @property {boolean | null} importScriptsInWorker has importScripts available when creating a worker
|
|
@@ -58,23 +57,37 @@ const getDefaultTarget = context => {
|
|
|
58
57
|
* @property {boolean | null} module ESM syntax is available (when in module)
|
|
59
58
|
* @property {boolean | null} optionalChaining optional chaining is available
|
|
60
59
|
* @property {boolean | null} templateLiteral template literal is available
|
|
60
|
+
* @property {boolean | null} asyncFunction async functions and await are available
|
|
61
61
|
*/
|
|
62
62
|
///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */
|
|
63
|
-
/**
|
|
64
|
-
|
|
63
|
+
/**
|
|
64
|
+
* @template T
|
|
65
|
+
* @typedef {{ [P in keyof T]?: never }} Never<T>
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* @template A
|
|
69
|
+
* @template B
|
|
70
|
+
* @typedef {(A & Never<B>) | (Never<A> & B) | (A & B)} Mix<A, B>
|
|
71
|
+
*/
|
|
65
72
|
/** @typedef {Mix<Mix<PlatformTargetProperties, ElectronContextTargetProperties>, Mix<ApiTargetProperties, EcmaTargetProperties>>} TargetProperties */
|
|
66
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @param {string} major major version
|
|
75
|
+
* @param {string | undefined} minor minor version
|
|
76
|
+
* @returns {(vMajor: number, vMinor?: number) => boolean | undefined} check if version is greater or equal
|
|
77
|
+
*/
|
|
67
78
|
const versionDependent = (major, minor) => {
|
|
68
|
-
if (!major)
|
|
79
|
+
if (!major) {
|
|
69
80
|
return () => /** @type {undefined} */ (undefined);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
}
|
|
82
|
+
/** @type {number} */
|
|
83
|
+
const nMajor = +major;
|
|
84
|
+
/** @type {number} */
|
|
85
|
+
const nMinor = minor ? +minor : 0;
|
|
73
86
|
return (vMajor, vMinor = 0) => {
|
|
74
|
-
return
|
|
87
|
+
return nMajor > vMajor || (nMajor === vMajor && nMinor >= vMinor);
|
|
75
88
|
};
|
|
76
89
|
};
|
|
77
|
-
/** @type {[string, string, RegExp, (...args: string[]) => TargetProperties
|
|
90
|
+
/** @type {[string, string, RegExp, (...args: string[]) => Partial<TargetProperties>][]} */
|
|
78
91
|
const TARGETS = [
|
|
79
92
|
[
|
|
80
93
|
"browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env",
|
|
@@ -82,9 +95,7 @@ const TARGETS = [
|
|
|
82
95
|
/^browserslist(?::(.+))?$/,
|
|
83
96
|
(rest, context) => {
|
|
84
97
|
const browserslistTargetHandler = getBrowserslistTargetHandler();
|
|
85
|
-
const browsers = browserslistTargetHandler.load(
|
|
86
|
-
// @ts-expect-error
|
|
87
|
-
rest ? rest.trim() : null, context);
|
|
98
|
+
const browsers = browserslistTargetHandler.load(rest ? rest.trim() : null, context);
|
|
88
99
|
if (!browsers) {
|
|
89
100
|
throw new Error(`No browserslist config found to handle the 'browserslist' target.
|
|
90
101
|
See https://github.com/browserslist/browserslist#queries for possible ways to provide a config.
|
|
@@ -141,9 +152,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
141
152
|
[
|
|
142
153
|
"[async-]node[X[.Y]]",
|
|
143
154
|
"Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.",
|
|
144
|
-
/^(async-)?node(\d+(?:\.(\d+))?)?$/,
|
|
145
|
-
|
|
146
|
-
(asyncFlag, major, minor) => {
|
|
155
|
+
/^(async-)?node((\d+)(?:\.(\d+))?)?$/,
|
|
156
|
+
(asyncFlag, _, major, minor) => {
|
|
147
157
|
const v = versionDependent(major, minor);
|
|
148
158
|
// see https://node.green/
|
|
149
159
|
return {
|
|
@@ -155,6 +165,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
155
165
|
browser: false,
|
|
156
166
|
require: !asyncFlag,
|
|
157
167
|
nodeBuiltins: true,
|
|
168
|
+
// v16.0.0, v14.18.0
|
|
169
|
+
nodePrefixForCoreModules: +major < 15 ? v(14, 18) : v(16),
|
|
158
170
|
global: true,
|
|
159
171
|
document: false,
|
|
160
172
|
fetchWasm: false,
|
|
@@ -165,6 +177,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
165
177
|
templateLiteral: v(4),
|
|
166
178
|
optionalChaining: v(14),
|
|
167
179
|
arrowFunction: v(6),
|
|
180
|
+
asyncFunction: v(7, 6),
|
|
168
181
|
forOf: v(5),
|
|
169
182
|
destructuring: v(6),
|
|
170
183
|
bigIntLiteral: v(10, 4),
|
|
@@ -177,9 +190,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
177
190
|
[
|
|
178
191
|
"electron[X[.Y]]-main/preload/renderer",
|
|
179
192
|
"Electron in version X.Y. Script is running in main, preload resp. renderer context.",
|
|
180
|
-
/^electron(\d+(?:\.(\d+))?)?-(main|preload|renderer)$/,
|
|
181
|
-
|
|
182
|
-
(major, minor, context) => {
|
|
193
|
+
/^electron((\d+)(?:\.(\d+))?)?-(main|preload|renderer)$/,
|
|
194
|
+
(_, major, minor, context) => {
|
|
183
195
|
const v = versionDependent(major, minor);
|
|
184
196
|
// see https://node.green/ + https://github.com/electron/releases
|
|
185
197
|
return {
|
|
@@ -194,6 +206,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
194
206
|
electronRenderer: context === "renderer",
|
|
195
207
|
global: true,
|
|
196
208
|
nodeBuiltins: true,
|
|
209
|
+
// 15.0.0 - Node.js v16.5
|
|
210
|
+
// 14.0.0 - Mode.js v14.17, but prefixes only since v14.18
|
|
211
|
+
nodePrefixForCoreModules: v(15),
|
|
197
212
|
require: true,
|
|
198
213
|
document: context === "renderer",
|
|
199
214
|
fetchWasm: context === "renderer",
|
|
@@ -204,6 +219,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
204
219
|
templateLiteral: v(1, 1),
|
|
205
220
|
optionalChaining: v(8),
|
|
206
221
|
arrowFunction: v(1, 1),
|
|
222
|
+
asyncFunction: v(1, 7),
|
|
207
223
|
forOf: v(0, 36),
|
|
208
224
|
destructuring: v(1, 1),
|
|
209
225
|
bigIntLiteral: v(4),
|
|
@@ -216,9 +232,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
216
232
|
[
|
|
217
233
|
"nwjs[X[.Y]] / node-webkit[X[.Y]]",
|
|
218
234
|
"NW.js in version X.Y.",
|
|
219
|
-
/^(?:nwjs|node-webkit)(\d+(?:\.(\d+))?)?$/,
|
|
220
|
-
|
|
221
|
-
(major, minor) => {
|
|
235
|
+
/^(?:nwjs|node-webkit)((\d+)(?:\.(\d+))?)?$/,
|
|
236
|
+
(_, major, minor) => {
|
|
222
237
|
const v = versionDependent(major, minor);
|
|
223
238
|
// see https://node.green/ + https://github.com/nwjs/nw.js/blob/nw48/CHANGELOG.md
|
|
224
239
|
return {
|
|
@@ -240,6 +255,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
240
255
|
templateLiteral: v(0, 13),
|
|
241
256
|
optionalChaining: v(0, 44),
|
|
242
257
|
arrowFunction: v(0, 15),
|
|
258
|
+
asyncFunction: v(0, 21),
|
|
243
259
|
forOf: v(0, 13),
|
|
244
260
|
destructuring: v(0, 15),
|
|
245
261
|
bigIntLiteral: v(0, 32),
|
|
@@ -265,6 +281,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
265
281
|
forOf: v >= 2015,
|
|
266
282
|
destructuring: v >= 2015,
|
|
267
283
|
module: v >= 2015,
|
|
284
|
+
asyncFunction: v >= 2017,
|
|
268
285
|
globalThis: v >= 2020,
|
|
269
286
|
bigIntLiteral: v >= 2020,
|
|
270
287
|
dynamicImport: v >= 2020,
|
|
@@ -285,19 +302,24 @@ const getTargetProperties = (target, context) => {
|
|
|
285
302
|
const [, ...args] = match;
|
|
286
303
|
const result = handler(...args, context);
|
|
287
304
|
if (result)
|
|
288
|
-
return result;
|
|
305
|
+
return /** @type {TargetProperties} */ (result);
|
|
289
306
|
}
|
|
290
307
|
}
|
|
291
308
|
throw new Error(`Unknown target '${target}'. The following targets are supported:\n${TARGETS.map(([name, description]) => `* ${name}: ${description}`).join("\n")}`);
|
|
292
309
|
};
|
|
293
|
-
|
|
310
|
+
/**
|
|
311
|
+
* @param {TargetProperties[]} targetProperties array of target properties
|
|
312
|
+
* @returns {TargetProperties} merged target properties
|
|
313
|
+
*/
|
|
294
314
|
const mergeTargetProperties = targetProperties => {
|
|
315
|
+
/** @type {Set<keyof TargetProperties>} */
|
|
295
316
|
const keys = new Set();
|
|
296
317
|
for (const tp of targetProperties) {
|
|
297
318
|
for (const key of Object.keys(tp)) {
|
|
298
|
-
keys.add(key);
|
|
319
|
+
keys.add(/** @type {keyof TargetProperties} */ (key));
|
|
299
320
|
}
|
|
300
321
|
}
|
|
322
|
+
/** @type {Object} */
|
|
301
323
|
const result = {};
|
|
302
324
|
for (const key of keys) {
|
|
303
325
|
let hasTrue = false;
|
|
@@ -314,8 +336,8 @@ const mergeTargetProperties = targetProperties => {
|
|
|
314
336
|
}
|
|
315
337
|
}
|
|
316
338
|
if (hasTrue || hasFalse)
|
|
317
|
-
|
|
318
|
-
result[key] = hasFalse && hasTrue ? null : hasTrue ? true : false;
|
|
339
|
+
/** @type {TargetProperties} */
|
|
340
|
+
(result)[key] = hasFalse && hasTrue ? null : hasTrue ? true : false;
|
|
319
341
|
}
|
|
320
342
|
return /** @type {TargetProperties} */ (result);
|
|
321
343
|
};
|
|
@@ -328,5 +350,5 @@ const getTargetsProperties = (targets, context) => {
|
|
|
328
350
|
return mergeTargetProperties(targets.map(t => getTargetProperties(t, context)));
|
|
329
351
|
};
|
|
330
352
|
exports.getDefaultTarget = getDefaultTarget;
|
|
331
|
-
exports.getTargetsProperties = getTargetsProperties;
|
|
332
353
|
exports.getTargetProperties = getTargetProperties;
|
|
354
|
+
exports.getTargetsProperties = getTargetsProperties;
|
package/dist/config/zod.d.ts
CHANGED
|
@@ -1003,6 +1003,53 @@ declare const devtoolModuleFilenameTemplate: z.ZodUnion<[z.ZodString, z.ZodFunct
|
|
|
1003
1003
|
export type DevtoolModuleFilenameTemplate = z.infer<typeof devtoolModuleFilenameTemplate>;
|
|
1004
1004
|
declare const devtoolFallbackModuleFilenameTemplate: z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodAny>]>;
|
|
1005
1005
|
export type DevtoolFallbackModuleFilenameTemplate = z.infer<typeof devtoolFallbackModuleFilenameTemplate>;
|
|
1006
|
+
declare const environment: z.ZodObject<{
|
|
1007
|
+
arrowFunction: z.ZodOptional<z.ZodBoolean>;
|
|
1008
|
+
asyncFunction: z.ZodOptional<z.ZodBoolean>;
|
|
1009
|
+
bigIntLiteral: z.ZodOptional<z.ZodBoolean>;
|
|
1010
|
+
const: z.ZodOptional<z.ZodBoolean>;
|
|
1011
|
+
destructuring: z.ZodOptional<z.ZodBoolean>;
|
|
1012
|
+
document: z.ZodOptional<z.ZodBoolean>;
|
|
1013
|
+
dynamicImport: z.ZodOptional<z.ZodBoolean>;
|
|
1014
|
+
dynamicImportInWorker: z.ZodOptional<z.ZodBoolean>;
|
|
1015
|
+
forOf: z.ZodOptional<z.ZodBoolean>;
|
|
1016
|
+
globalThis: z.ZodOptional<z.ZodBoolean>;
|
|
1017
|
+
module: z.ZodOptional<z.ZodBoolean>;
|
|
1018
|
+
nodePrefixForCoreModules: z.ZodOptional<z.ZodBoolean>;
|
|
1019
|
+
optionalChaining: z.ZodOptional<z.ZodBoolean>;
|
|
1020
|
+
templateLiteral: z.ZodOptional<z.ZodBoolean>;
|
|
1021
|
+
}, "strict", z.ZodTypeAny, {
|
|
1022
|
+
arrowFunction?: boolean | undefined;
|
|
1023
|
+
asyncFunction?: boolean | undefined;
|
|
1024
|
+
bigIntLiteral?: boolean | undefined;
|
|
1025
|
+
const?: boolean | undefined;
|
|
1026
|
+
destructuring?: boolean | undefined;
|
|
1027
|
+
document?: boolean | undefined;
|
|
1028
|
+
dynamicImport?: boolean | undefined;
|
|
1029
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
1030
|
+
forOf?: boolean | undefined;
|
|
1031
|
+
globalThis?: boolean | undefined;
|
|
1032
|
+
module?: boolean | undefined;
|
|
1033
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
1034
|
+
optionalChaining?: boolean | undefined;
|
|
1035
|
+
templateLiteral?: boolean | undefined;
|
|
1036
|
+
}, {
|
|
1037
|
+
arrowFunction?: boolean | undefined;
|
|
1038
|
+
asyncFunction?: boolean | undefined;
|
|
1039
|
+
bigIntLiteral?: boolean | undefined;
|
|
1040
|
+
const?: boolean | undefined;
|
|
1041
|
+
destructuring?: boolean | undefined;
|
|
1042
|
+
document?: boolean | undefined;
|
|
1043
|
+
dynamicImport?: boolean | undefined;
|
|
1044
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
1045
|
+
forOf?: boolean | undefined;
|
|
1046
|
+
globalThis?: boolean | undefined;
|
|
1047
|
+
module?: boolean | undefined;
|
|
1048
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
1049
|
+
optionalChaining?: boolean | undefined;
|
|
1050
|
+
templateLiteral?: boolean | undefined;
|
|
1051
|
+
}>;
|
|
1052
|
+
export type Environment = z.infer<typeof environment>;
|
|
1006
1053
|
declare const output: z.ZodObject<{
|
|
1007
1054
|
path: z.ZodOptional<z.ZodString>;
|
|
1008
1055
|
pathinfo: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"verbose">]>>;
|
|
@@ -1151,6 +1198,52 @@ declare const output: z.ZodObject<{
|
|
|
1151
1198
|
devtoolNamespace: z.ZodOptional<z.ZodString>;
|
|
1152
1199
|
devtoolModuleFilenameTemplate: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodAny>]>>;
|
|
1153
1200
|
devtoolFallbackModuleFilenameTemplate: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodAny>]>>;
|
|
1201
|
+
environment: z.ZodOptional<z.ZodObject<{
|
|
1202
|
+
arrowFunction: z.ZodOptional<z.ZodBoolean>;
|
|
1203
|
+
asyncFunction: z.ZodOptional<z.ZodBoolean>;
|
|
1204
|
+
bigIntLiteral: z.ZodOptional<z.ZodBoolean>;
|
|
1205
|
+
const: z.ZodOptional<z.ZodBoolean>;
|
|
1206
|
+
destructuring: z.ZodOptional<z.ZodBoolean>;
|
|
1207
|
+
document: z.ZodOptional<z.ZodBoolean>;
|
|
1208
|
+
dynamicImport: z.ZodOptional<z.ZodBoolean>;
|
|
1209
|
+
dynamicImportInWorker: z.ZodOptional<z.ZodBoolean>;
|
|
1210
|
+
forOf: z.ZodOptional<z.ZodBoolean>;
|
|
1211
|
+
globalThis: z.ZodOptional<z.ZodBoolean>;
|
|
1212
|
+
module: z.ZodOptional<z.ZodBoolean>;
|
|
1213
|
+
nodePrefixForCoreModules: z.ZodOptional<z.ZodBoolean>;
|
|
1214
|
+
optionalChaining: z.ZodOptional<z.ZodBoolean>;
|
|
1215
|
+
templateLiteral: z.ZodOptional<z.ZodBoolean>;
|
|
1216
|
+
}, "strict", z.ZodTypeAny, {
|
|
1217
|
+
arrowFunction?: boolean | undefined;
|
|
1218
|
+
asyncFunction?: boolean | undefined;
|
|
1219
|
+
bigIntLiteral?: boolean | undefined;
|
|
1220
|
+
const?: boolean | undefined;
|
|
1221
|
+
destructuring?: boolean | undefined;
|
|
1222
|
+
document?: boolean | undefined;
|
|
1223
|
+
dynamicImport?: boolean | undefined;
|
|
1224
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
1225
|
+
forOf?: boolean | undefined;
|
|
1226
|
+
globalThis?: boolean | undefined;
|
|
1227
|
+
module?: boolean | undefined;
|
|
1228
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
1229
|
+
optionalChaining?: boolean | undefined;
|
|
1230
|
+
templateLiteral?: boolean | undefined;
|
|
1231
|
+
}, {
|
|
1232
|
+
arrowFunction?: boolean | undefined;
|
|
1233
|
+
asyncFunction?: boolean | undefined;
|
|
1234
|
+
bigIntLiteral?: boolean | undefined;
|
|
1235
|
+
const?: boolean | undefined;
|
|
1236
|
+
destructuring?: boolean | undefined;
|
|
1237
|
+
document?: boolean | undefined;
|
|
1238
|
+
dynamicImport?: boolean | undefined;
|
|
1239
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
1240
|
+
forOf?: boolean | undefined;
|
|
1241
|
+
globalThis?: boolean | undefined;
|
|
1242
|
+
module?: boolean | undefined;
|
|
1243
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
1244
|
+
optionalChaining?: boolean | undefined;
|
|
1245
|
+
templateLiteral?: boolean | undefined;
|
|
1246
|
+
}>>;
|
|
1154
1247
|
}, "strict", z.ZodTypeAny, {
|
|
1155
1248
|
path?: string | undefined;
|
|
1156
1249
|
pathinfo?: boolean | "verbose" | undefined;
|
|
@@ -1227,6 +1320,22 @@ declare const output: z.ZodObject<{
|
|
|
1227
1320
|
devtoolNamespace?: string | undefined;
|
|
1228
1321
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
1229
1322
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
1323
|
+
environment?: {
|
|
1324
|
+
arrowFunction?: boolean | undefined;
|
|
1325
|
+
asyncFunction?: boolean | undefined;
|
|
1326
|
+
bigIntLiteral?: boolean | undefined;
|
|
1327
|
+
const?: boolean | undefined;
|
|
1328
|
+
destructuring?: boolean | undefined;
|
|
1329
|
+
document?: boolean | undefined;
|
|
1330
|
+
dynamicImport?: boolean | undefined;
|
|
1331
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
1332
|
+
forOf?: boolean | undefined;
|
|
1333
|
+
globalThis?: boolean | undefined;
|
|
1334
|
+
module?: boolean | undefined;
|
|
1335
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
1336
|
+
optionalChaining?: boolean | undefined;
|
|
1337
|
+
templateLiteral?: boolean | undefined;
|
|
1338
|
+
} | undefined;
|
|
1230
1339
|
}, {
|
|
1231
1340
|
path?: string | undefined;
|
|
1232
1341
|
pathinfo?: boolean | "verbose" | undefined;
|
|
@@ -1303,6 +1412,22 @@ declare const output: z.ZodObject<{
|
|
|
1303
1412
|
devtoolNamespace?: string | undefined;
|
|
1304
1413
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
1305
1414
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
1415
|
+
environment?: {
|
|
1416
|
+
arrowFunction?: boolean | undefined;
|
|
1417
|
+
asyncFunction?: boolean | undefined;
|
|
1418
|
+
bigIntLiteral?: boolean | undefined;
|
|
1419
|
+
const?: boolean | undefined;
|
|
1420
|
+
destructuring?: boolean | undefined;
|
|
1421
|
+
document?: boolean | undefined;
|
|
1422
|
+
dynamicImport?: boolean | undefined;
|
|
1423
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
1424
|
+
forOf?: boolean | undefined;
|
|
1425
|
+
globalThis?: boolean | undefined;
|
|
1426
|
+
module?: boolean | undefined;
|
|
1427
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
1428
|
+
optionalChaining?: boolean | undefined;
|
|
1429
|
+
templateLiteral?: boolean | undefined;
|
|
1430
|
+
} | undefined;
|
|
1306
1431
|
}>;
|
|
1307
1432
|
export type Output = z.infer<typeof output>;
|
|
1308
1433
|
declare const resolveAlias: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<false>, z.ZodString]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>, "many">]>>;
|
|
@@ -5007,6 +5132,52 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
5007
5132
|
devtoolNamespace: z.ZodOptional<z.ZodString>;
|
|
5008
5133
|
devtoolModuleFilenameTemplate: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodAny>]>>;
|
|
5009
5134
|
devtoolFallbackModuleFilenameTemplate: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodAny>]>>;
|
|
5135
|
+
environment: z.ZodOptional<z.ZodObject<{
|
|
5136
|
+
arrowFunction: z.ZodOptional<z.ZodBoolean>;
|
|
5137
|
+
asyncFunction: z.ZodOptional<z.ZodBoolean>;
|
|
5138
|
+
bigIntLiteral: z.ZodOptional<z.ZodBoolean>;
|
|
5139
|
+
const: z.ZodOptional<z.ZodBoolean>;
|
|
5140
|
+
destructuring: z.ZodOptional<z.ZodBoolean>;
|
|
5141
|
+
document: z.ZodOptional<z.ZodBoolean>;
|
|
5142
|
+
dynamicImport: z.ZodOptional<z.ZodBoolean>;
|
|
5143
|
+
dynamicImportInWorker: z.ZodOptional<z.ZodBoolean>;
|
|
5144
|
+
forOf: z.ZodOptional<z.ZodBoolean>;
|
|
5145
|
+
globalThis: z.ZodOptional<z.ZodBoolean>;
|
|
5146
|
+
module: z.ZodOptional<z.ZodBoolean>;
|
|
5147
|
+
nodePrefixForCoreModules: z.ZodOptional<z.ZodBoolean>;
|
|
5148
|
+
optionalChaining: z.ZodOptional<z.ZodBoolean>;
|
|
5149
|
+
templateLiteral: z.ZodOptional<z.ZodBoolean>;
|
|
5150
|
+
}, "strict", z.ZodTypeAny, {
|
|
5151
|
+
arrowFunction?: boolean | undefined;
|
|
5152
|
+
asyncFunction?: boolean | undefined;
|
|
5153
|
+
bigIntLiteral?: boolean | undefined;
|
|
5154
|
+
const?: boolean | undefined;
|
|
5155
|
+
destructuring?: boolean | undefined;
|
|
5156
|
+
document?: boolean | undefined;
|
|
5157
|
+
dynamicImport?: boolean | undefined;
|
|
5158
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
5159
|
+
forOf?: boolean | undefined;
|
|
5160
|
+
globalThis?: boolean | undefined;
|
|
5161
|
+
module?: boolean | undefined;
|
|
5162
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
5163
|
+
optionalChaining?: boolean | undefined;
|
|
5164
|
+
templateLiteral?: boolean | undefined;
|
|
5165
|
+
}, {
|
|
5166
|
+
arrowFunction?: boolean | undefined;
|
|
5167
|
+
asyncFunction?: boolean | undefined;
|
|
5168
|
+
bigIntLiteral?: boolean | undefined;
|
|
5169
|
+
const?: boolean | undefined;
|
|
5170
|
+
destructuring?: boolean | undefined;
|
|
5171
|
+
document?: boolean | undefined;
|
|
5172
|
+
dynamicImport?: boolean | undefined;
|
|
5173
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
5174
|
+
forOf?: boolean | undefined;
|
|
5175
|
+
globalThis?: boolean | undefined;
|
|
5176
|
+
module?: boolean | undefined;
|
|
5177
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
5178
|
+
optionalChaining?: boolean | undefined;
|
|
5179
|
+
templateLiteral?: boolean | undefined;
|
|
5180
|
+
}>>;
|
|
5010
5181
|
}, "strict", z.ZodTypeAny, {
|
|
5011
5182
|
path?: string | undefined;
|
|
5012
5183
|
pathinfo?: boolean | "verbose" | undefined;
|
|
@@ -5083,6 +5254,22 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
5083
5254
|
devtoolNamespace?: string | undefined;
|
|
5084
5255
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5085
5256
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5257
|
+
environment?: {
|
|
5258
|
+
arrowFunction?: boolean | undefined;
|
|
5259
|
+
asyncFunction?: boolean | undefined;
|
|
5260
|
+
bigIntLiteral?: boolean | undefined;
|
|
5261
|
+
const?: boolean | undefined;
|
|
5262
|
+
destructuring?: boolean | undefined;
|
|
5263
|
+
document?: boolean | undefined;
|
|
5264
|
+
dynamicImport?: boolean | undefined;
|
|
5265
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
5266
|
+
forOf?: boolean | undefined;
|
|
5267
|
+
globalThis?: boolean | undefined;
|
|
5268
|
+
module?: boolean | undefined;
|
|
5269
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
5270
|
+
optionalChaining?: boolean | undefined;
|
|
5271
|
+
templateLiteral?: boolean | undefined;
|
|
5272
|
+
} | undefined;
|
|
5086
5273
|
}, {
|
|
5087
5274
|
path?: string | undefined;
|
|
5088
5275
|
pathinfo?: boolean | "verbose" | undefined;
|
|
@@ -5159,6 +5346,22 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
5159
5346
|
devtoolNamespace?: string | undefined;
|
|
5160
5347
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5161
5348
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
5349
|
+
environment?: {
|
|
5350
|
+
arrowFunction?: boolean | undefined;
|
|
5351
|
+
asyncFunction?: boolean | undefined;
|
|
5352
|
+
bigIntLiteral?: boolean | undefined;
|
|
5353
|
+
const?: boolean | undefined;
|
|
5354
|
+
destructuring?: boolean | undefined;
|
|
5355
|
+
document?: boolean | undefined;
|
|
5356
|
+
dynamicImport?: boolean | undefined;
|
|
5357
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
5358
|
+
forOf?: boolean | undefined;
|
|
5359
|
+
globalThis?: boolean | undefined;
|
|
5360
|
+
module?: boolean | undefined;
|
|
5361
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
5362
|
+
optionalChaining?: boolean | undefined;
|
|
5363
|
+
templateLiteral?: boolean | undefined;
|
|
5364
|
+
} | undefined;
|
|
5162
5365
|
}>>;
|
|
5163
5366
|
target: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<false>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodEnum<["web", "webworker", "es3", "es5", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "browserslist"]>, z.ZodLiteral<"node">]>, z.ZodLiteral<"async-node">]>, z.ZodType<`node${number}`, z.ZodTypeDef, `node${number}`>]>, z.ZodType<`async-node${number}`, z.ZodTypeDef, `async-node${number}`>]>, z.ZodType<`node${number}.${number}`, z.ZodTypeDef, `node${number}.${number}`>]>, z.ZodType<`async-node${number}.${number}`, z.ZodTypeDef, `async-node${number}.${number}`>]>, z.ZodLiteral<"electron-main">]>, z.ZodType<`electron${number}-main`, z.ZodTypeDef, `electron${number}-main`>]>, z.ZodType<`electron${number}.${number}-main`, z.ZodTypeDef, `electron${number}.${number}-main`>]>, z.ZodLiteral<"electron-renderer">]>, z.ZodType<`electron${number}-renderer`, z.ZodTypeDef, `electron${number}-renderer`>]>, z.ZodType<`electron${number}.${number}-renderer`, z.ZodTypeDef, `electron${number}.${number}-renderer`>]>, z.ZodLiteral<"electron-preload">]>, z.ZodType<`electron${number}-preload`, z.ZodTypeDef, `electron${number}-preload`>]>, z.ZodType<`electron${number}.${number}-preload`, z.ZodTypeDef, `electron${number}.${number}-preload`>]>]>, z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodEnum<["web", "webworker", "es3", "es5", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "browserslist"]>, z.ZodLiteral<"node">]>, z.ZodLiteral<"async-node">]>, z.ZodType<`node${number}`, z.ZodTypeDef, `node${number}`>]>, z.ZodType<`async-node${number}`, z.ZodTypeDef, `async-node${number}`>]>, z.ZodType<`node${number}.${number}`, z.ZodTypeDef, `node${number}.${number}`>]>, z.ZodType<`async-node${number}.${number}`, z.ZodTypeDef, `async-node${number}.${number}`>]>, z.ZodLiteral<"electron-main">]>, z.ZodType<`electron${number}-main`, z.ZodTypeDef, `electron${number}-main`>]>, z.ZodType<`electron${number}.${number}-main`, z.ZodTypeDef, `electron${number}.${number}-main`>]>, z.ZodLiteral<"electron-renderer">]>, z.ZodType<`electron${number}-renderer`, z.ZodTypeDef, `electron${number}-renderer`>]>, z.ZodType<`electron${number}.${number}-renderer`, z.ZodTypeDef, `electron${number}.${number}-renderer`>]>, z.ZodLiteral<"electron-preload">]>, z.ZodType<`electron${number}-preload`, z.ZodTypeDef, `electron${number}-preload`>]>, z.ZodType<`electron${number}.${number}-preload`, z.ZodTypeDef, `electron${number}.${number}-preload`>]>, "many">]>>;
|
|
5164
5367
|
mode: z.ZodOptional<z.ZodEnum<["development", "production", "none"]>>;
|
|
@@ -6630,6 +6833,22 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
6630
6833
|
devtoolNamespace?: string | undefined;
|
|
6631
6834
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
6632
6835
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
6836
|
+
environment?: {
|
|
6837
|
+
arrowFunction?: boolean | undefined;
|
|
6838
|
+
asyncFunction?: boolean | undefined;
|
|
6839
|
+
bigIntLiteral?: boolean | undefined;
|
|
6840
|
+
const?: boolean | undefined;
|
|
6841
|
+
destructuring?: boolean | undefined;
|
|
6842
|
+
document?: boolean | undefined;
|
|
6843
|
+
dynamicImport?: boolean | undefined;
|
|
6844
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
6845
|
+
forOf?: boolean | undefined;
|
|
6846
|
+
globalThis?: boolean | undefined;
|
|
6847
|
+
module?: boolean | undefined;
|
|
6848
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
6849
|
+
optionalChaining?: boolean | undefined;
|
|
6850
|
+
templateLiteral?: boolean | undefined;
|
|
6851
|
+
} | undefined;
|
|
6633
6852
|
} | undefined;
|
|
6634
6853
|
target?: false | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "node" | "async-node" | "web" | "webworker" | "browserslist" | `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` | ("es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "node" | "async-node" | "web" | "webworker" | "browserslist" | `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`)[] | undefined;
|
|
6635
6854
|
mode?: "none" | "development" | "production" | undefined;
|
|
@@ -7053,6 +7272,22 @@ export declare const rspackOptions: z.ZodObject<{
|
|
|
7053
7272
|
devtoolNamespace?: string | undefined;
|
|
7054
7273
|
devtoolModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
7055
7274
|
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
|
|
7275
|
+
environment?: {
|
|
7276
|
+
arrowFunction?: boolean | undefined;
|
|
7277
|
+
asyncFunction?: boolean | undefined;
|
|
7278
|
+
bigIntLiteral?: boolean | undefined;
|
|
7279
|
+
const?: boolean | undefined;
|
|
7280
|
+
destructuring?: boolean | undefined;
|
|
7281
|
+
document?: boolean | undefined;
|
|
7282
|
+
dynamicImport?: boolean | undefined;
|
|
7283
|
+
dynamicImportInWorker?: boolean | undefined;
|
|
7284
|
+
forOf?: boolean | undefined;
|
|
7285
|
+
globalThis?: boolean | undefined;
|
|
7286
|
+
module?: boolean | undefined;
|
|
7287
|
+
nodePrefixForCoreModules?: boolean | undefined;
|
|
7288
|
+
optionalChaining?: boolean | undefined;
|
|
7289
|
+
templateLiteral?: boolean | undefined;
|
|
7290
|
+
} | undefined;
|
|
7056
7291
|
} | undefined;
|
|
7057
7292
|
target?: false | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "node" | "async-node" | "web" | "webworker" | "browserslist" | `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` | ("es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "node" | "async-node" | "web" | "webworker" | "browserslist" | `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`)[] | undefined;
|
|
7058
7293
|
mode?: "none" | "development" | "production" | undefined;
|
package/dist/config/zod.js
CHANGED
|
@@ -157,6 +157,22 @@ const devtoolModuleFilenameTemplate = zod_1.z.union([
|
|
|
157
157
|
zod_1.z.function(zod_1.z.tuple([zod_1.z.any()]), zod_1.z.any())
|
|
158
158
|
]);
|
|
159
159
|
const devtoolFallbackModuleFilenameTemplate = devtoolModuleFilenameTemplate;
|
|
160
|
+
const environment = zod_1.z.strictObject({
|
|
161
|
+
arrowFunction: zod_1.z.boolean().optional(),
|
|
162
|
+
asyncFunction: zod_1.z.boolean().optional(),
|
|
163
|
+
bigIntLiteral: zod_1.z.boolean().optional(),
|
|
164
|
+
const: zod_1.z.boolean().optional(),
|
|
165
|
+
destructuring: zod_1.z.boolean().optional(),
|
|
166
|
+
document: zod_1.z.boolean().optional(),
|
|
167
|
+
dynamicImport: zod_1.z.boolean().optional(),
|
|
168
|
+
dynamicImportInWorker: zod_1.z.boolean().optional(),
|
|
169
|
+
forOf: zod_1.z.boolean().optional(),
|
|
170
|
+
globalThis: zod_1.z.boolean().optional(),
|
|
171
|
+
module: zod_1.z.boolean().optional(),
|
|
172
|
+
nodePrefixForCoreModules: zod_1.z.boolean().optional(),
|
|
173
|
+
optionalChaining: zod_1.z.boolean().optional(),
|
|
174
|
+
templateLiteral: zod_1.z.boolean().optional()
|
|
175
|
+
});
|
|
160
176
|
const output = zod_1.z.strictObject({
|
|
161
177
|
path: path.optional(),
|
|
162
178
|
pathinfo: pathinfo.optional(),
|
|
@@ -205,7 +221,8 @@ const output = zod_1.z.strictObject({
|
|
|
205
221
|
scriptType: scriptType.optional(),
|
|
206
222
|
devtoolNamespace: devtoolNamespace.optional(),
|
|
207
223
|
devtoolModuleFilenameTemplate: devtoolModuleFilenameTemplate.optional(),
|
|
208
|
-
devtoolFallbackModuleFilenameTemplate: devtoolFallbackModuleFilenameTemplate.optional()
|
|
224
|
+
devtoolFallbackModuleFilenameTemplate: devtoolFallbackModuleFilenameTemplate.optional(),
|
|
225
|
+
environment: environment.optional()
|
|
209
226
|
});
|
|
210
227
|
//#endregion
|
|
211
228
|
//#region Resolve
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.0-beta.0-canary-
|
|
3
|
+
"version": "0.7.0-beta.0-canary-5ddb34f-20240520023643",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A Fast Rust-based Web Bundler",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"watchpack": "^2.4.0",
|
|
72
72
|
"zod": "^3.21.4",
|
|
73
73
|
"zod-validation-error": "1.3.1",
|
|
74
|
-
"@rspack/core": "0.7.0-beta.0-canary-
|
|
75
|
-
"@rspack/plugin-minify": "^0.7.0-beta.0-canary-
|
|
74
|
+
"@rspack/core": "0.7.0-beta.0-canary-5ddb34f-20240520023643",
|
|
75
|
+
"@rspack/plugin-minify": "^0.7.0-beta.0-canary-5ddb34f-20240520023643"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@module-federation/runtime-tools": "0.1.6",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"enhanced-resolve": "5.12.0",
|
|
81
81
|
"tapable": "2.2.1",
|
|
82
82
|
"webpack-sources": "3.2.3",
|
|
83
|
-
"@rspack/binding": "0.7.0-beta.0-canary-
|
|
83
|
+
"@rspack/binding": "0.7.0-beta.0-canary-5ddb34f-20240520023643"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@swc/helpers": ">=0.5.1"
|