Skip to content

Commit 3c2ab03

Browse files
authored
fix: correct lazy compilation backend options schema (#9138)
1 parent e091d1c commit 3c2ab03

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

packages/rspack/etc/core.api.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6360,7 +6360,7 @@ export const rspackOptions: z.ZodObject<{
63606360
lazyCompilation: z.ZodUnion<[z.ZodOptional<z.ZodBoolean>, z.ZodObject<{
63616361
backend: z.ZodOptional<z.ZodObject<{
63626362
client: z.ZodOptional<z.ZodString>;
6363-
listen: z.ZodUnion<[z.ZodOptional<z.ZodNumber>, z.ZodObject<{
6363+
listen: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodObject<{
63646364
port: z.ZodOptional<z.ZodNumber>;
63656365
host: z.ZodOptional<z.ZodString>;
63666366
backlog: z.ZodOptional<z.ZodNumber>;
@@ -6387,8 +6387,9 @@ export const rspackOptions: z.ZodObject<{
63876387
readableAll?: boolean | undefined;
63886388
writableAll?: boolean | undefined;
63896389
ipv6Only?: boolean | undefined;
6390-
}>]>;
6390+
}>]>, z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>]>>;
63916391
protocol: z.ZodOptional<z.ZodEnum<["http", "https"]>>;
6392+
server: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodAny>]>>;
63926393
}, "strip", z.ZodTypeAny, {
63936394
client?: string | undefined;
63946395
listen?: number | {
@@ -6400,8 +6401,9 @@ export const rspackOptions: z.ZodObject<{
64006401
readableAll?: boolean | undefined;
64016402
writableAll?: boolean | undefined;
64026403
ipv6Only?: boolean | undefined;
6403-
} | undefined;
6404+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
64046405
protocol?: "http" | "https" | undefined;
6406+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
64056407
}, {
64066408
client?: string | undefined;
64076409
listen?: number | {
@@ -6413,8 +6415,9 @@ export const rspackOptions: z.ZodObject<{
64136415
readableAll?: boolean | undefined;
64146416
writableAll?: boolean | undefined;
64156417
ipv6Only?: boolean | undefined;
6416-
} | undefined;
6418+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
64176419
protocol?: "http" | "https" | undefined;
6420+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
64186421
}>>;
64196422
imports: z.ZodOptional<z.ZodBoolean>;
64206423
entries: z.ZodOptional<z.ZodBoolean>;
@@ -6434,8 +6437,9 @@ export const rspackOptions: z.ZodObject<{
64346437
readableAll?: boolean | undefined;
64356438
writableAll?: boolean | undefined;
64366439
ipv6Only?: boolean | undefined;
6437-
} | undefined;
6440+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
64386441
protocol?: "http" | "https" | undefined;
6442+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
64396443
} | undefined;
64406444
}, {
64416445
entries?: boolean | undefined;
@@ -6452,8 +6456,9 @@ export const rspackOptions: z.ZodObject<{
64526456
readableAll?: boolean | undefined;
64536457
writableAll?: boolean | undefined;
64546458
ipv6Only?: boolean | undefined;
6455-
} | undefined;
6459+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
64566460
protocol?: "http" | "https" | undefined;
6461+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
64576462
} | undefined;
64586463
}>]>;
64596464
asyncWebAssembly: z.ZodOptional<z.ZodBoolean>;
@@ -6572,8 +6577,9 @@ export const rspackOptions: z.ZodObject<{
65726577
readableAll?: boolean | undefined;
65736578
writableAll?: boolean | undefined;
65746579
ipv6Only?: boolean | undefined;
6575-
} | undefined;
6580+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
65766581
protocol?: "http" | "https" | undefined;
6582+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
65776583
} | undefined;
65786584
} | undefined;
65796585
asyncWebAssembly?: boolean | undefined;
@@ -6639,8 +6645,9 @@ export const rspackOptions: z.ZodObject<{
66396645
readableAll?: boolean | undefined;
66406646
writableAll?: boolean | undefined;
66416647
ipv6Only?: boolean | undefined;
6642-
} | undefined;
6648+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
66436649
protocol?: "http" | "https" | undefined;
6650+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
66446651
} | undefined;
66456652
} | undefined;
66466653
asyncWebAssembly?: boolean | undefined;
@@ -8585,8 +8592,9 @@ export const rspackOptions: z.ZodObject<{
85858592
readableAll?: boolean | undefined;
85868593
writableAll?: boolean | undefined;
85878594
ipv6Only?: boolean | undefined;
8588-
} | undefined;
8595+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
85898596
protocol?: "http" | "https" | undefined;
8597+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
85908598
} | undefined;
85918599
} | undefined;
85928600
asyncWebAssembly?: boolean | undefined;
@@ -9190,8 +9198,9 @@ export const rspackOptions: z.ZodObject<{
91909198
readableAll?: boolean | undefined;
91919199
writableAll?: boolean | undefined;
91929200
ipv6Only?: boolean | undefined;
9193-
} | undefined;
9201+
} | ((args_0: any, ...args: unknown[]) => void) | undefined;
91949202
protocol?: "http" | "https" | undefined;
9203+
server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
91959204
} | undefined;
91969205
} | undefined;
91979206
asyncWebAssembly?: boolean | undefined;

packages/rspack/src/config/zod.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,8 +1338,13 @@ const lazyCompilationOptions = z.object({
13381338
backend: z
13391339
.object({
13401340
client: z.string().optional(),
1341-
listen: z.number().optional().or(listenOptions),
1342-
protocol: z.enum(["http", "https"]).optional()
1341+
listen: z
1342+
.number()
1343+
.or(listenOptions)
1344+
.or(z.function().args(z.any()).returns(z.void()))
1345+
.optional(),
1346+
protocol: z.enum(["http", "https"]).optional(),
1347+
server: z.record(z.any()).or(z.function().returns(z.any())).optional()
13431348
})
13441349
.optional(),
13451350
imports: z.boolean().optional(),

0 commit comments

Comments
 (0)