Skip to content

Commit 4b50686

Browse files
authored
fix(types): missing lazyCompilation.backend.server option (#9009)
* fix(types): missing `lazyCompilation.backend.server` option * docs: fix more
1 parent 737e028 commit 4b50686

File tree

5 files changed

+75
-92
lines changed

5 files changed

+75
-92
lines changed

packages/rspack/etc/core.api.md

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { ExternalObject } from '@rspack/binding';
2323
import fs from 'graceful-fs';
2424
import { fs as fs_2 } from 'fs';
2525
import { HookMap } from '@rspack/lite-tapable';
26+
import type { IncomingMessage } from 'node:http';
2627
import { inspect } from 'node:util';
2728
import type { JsAddingRuntimeModule } from '@rspack/binding';
2829
import { JsAfterEmitData } from '@rspack/binding';
@@ -55,6 +56,7 @@ import type { JsStats } from '@rspack/binding';
5556
import type { JsStatsCompilation } from '@rspack/binding';
5657
import type { JsStatsError } from '@rspack/binding';
5758
import type { JsStatsWarning } from '@rspack/binding';
59+
import type { ListenOptions } from 'node:net';
5860
import * as liteTapable from '@rspack/lite-tapable';
5961
import { Logger as Logger_2 } from './logging/Logger';
6062
import { RawCopyPattern } from '@rspack/binding';
@@ -66,11 +68,16 @@ import { RawProgressPluginOptions } from '@rspack/binding';
6668
import { RawProvideOptions } from '@rspack/binding';
6769
import { RawRuntimeChunkOptions } from '@rspack/binding';
6870
import { RspackOptionsNormalized as RspackOptionsNormalized_2 } from '.';
71+
import type { SecureContextOptions } from 'node:tls';
72+
import type { Server } from 'node:net';
73+
import type { ServerOptions } from 'node:http';
74+
import type { ServerResponse } from 'node:http';
6975
import { RawSourceMapDevToolPluginOptions as SourceMapDevToolPluginOptions } from '@rspack/binding';
7076
import sources = require('../compiled/webpack-sources');
7177
import { SyncBailHook } from '@rspack/lite-tapable';
7278
import { SyncHook } from '@rspack/lite-tapable';
7379
import { SyncWaterfallHook } from '@rspack/lite-tapable';
80+
import type { TlsOptions } from 'node:tls';
7481
import type * as webpackDevServer from 'webpack-dev-server';
7582

7683
// @public (undocumented)
@@ -3147,13 +3154,17 @@ type KnownStatsProfile = {
31473154
// @public
31483155
export type Layer = string | null;
31493156

3157+
// @public (undocumented)
3158+
interface LazyCompilationDefaultBackendOptions {
3159+
client?: string;
3160+
listen?: number | ListenOptions | ((server: Server) => void);
3161+
protocol?: "http" | "https";
3162+
server?: ServerOptions<typeof IncomingMessage> | ServerOptionsHttps<typeof IncomingMessage, typeof ServerResponse> | (() => Server);
3163+
}
3164+
31503165
// @public
31513166
export type LazyCompilationOptions = {
3152-
backend?: {
3153-
client?: string;
3154-
listen?: number | ListenOptions;
3155-
protocol?: "http" | "https";
3156-
};
3167+
backend?: LazyCompilationDefaultBackendOptions;
31573168
imports?: boolean;
31583169
entries?: boolean;
31593170
test?: RegExp | ((module: any) => boolean);
@@ -3294,18 +3305,6 @@ const LimitChunkCountPlugin: {
32943305
};
32953306
};
32963307

3297-
// @public
3298-
type ListenOptions = {
3299-
port?: number;
3300-
host?: string;
3301-
backlog?: number;
3302-
path?: string;
3303-
exclusive?: boolean;
3304-
readableAll?: boolean;
3305-
writableAll?: boolean;
3306-
ipv6Only?: boolean;
3307-
};
3308-
33093308
// @public (undocumented)
33103309
export type Loader = Record<string, any>;
33113310

@@ -6071,6 +6070,7 @@ export const rspackOptions: z.ZodObject<{
60716070
compareBeforeEmit: z.ZodOptional<z.ZodBoolean>;
60726071
}, "strict", z.ZodTypeAny, {
60736072
module?: boolean | undefined;
6073+
path?: string | undefined;
60746074
chunkLoading?: string | false | undefined;
60756075
asyncChunks?: boolean | undefined;
60766076
publicPath?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -6105,7 +6105,6 @@ export const rspackOptions: z.ZodObject<{
61056105
root?: string | undefined;
61066106
} | undefined;
61076107
umdNamedDefine?: boolean | undefined;
6108-
path?: string | undefined;
61096108
pathinfo?: boolean | "verbose" | undefined;
61106109
clean?: boolean | {
61116110
keep?: string | undefined;
@@ -6170,6 +6169,7 @@ export const rspackOptions: z.ZodObject<{
61706169
strictModuleExceptionHandling?: boolean | undefined;
61716170
}, {
61726171
module?: boolean | undefined;
6172+
path?: string | undefined;
61736173
chunkLoading?: string | false | undefined;
61746174
asyncChunks?: boolean | undefined;
61756175
publicPath?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -6204,7 +6204,6 @@ export const rspackOptions: z.ZodObject<{
62046204
root?: string | undefined;
62056205
} | undefined;
62066206
umdNamedDefine?: boolean | undefined;
6207-
path?: string | undefined;
62086207
pathinfo?: boolean | "verbose" | undefined;
62096208
clean?: boolean | {
62106209
keep?: string | undefined;
@@ -6344,19 +6343,19 @@ export const rspackOptions: z.ZodObject<{
63446343
writableAll: z.ZodOptional<z.ZodBoolean>;
63456344
ipv6Only: z.ZodOptional<z.ZodBoolean>;
63466345
}, "strip", z.ZodTypeAny, {
6347-
path?: string | undefined;
63486346
port?: number | undefined;
63496347
host?: string | undefined;
63506348
backlog?: number | undefined;
6349+
path?: string | undefined;
63516350
exclusive?: boolean | undefined;
63526351
readableAll?: boolean | undefined;
63536352
writableAll?: boolean | undefined;
63546353
ipv6Only?: boolean | undefined;
63556354
}, {
6356-
path?: string | undefined;
63576355
port?: number | undefined;
63586356
host?: string | undefined;
63596357
backlog?: number | undefined;
6358+
path?: string | undefined;
63606359
exclusive?: boolean | undefined;
63616360
readableAll?: boolean | undefined;
63626361
writableAll?: boolean | undefined;
@@ -6366,10 +6365,10 @@ export const rspackOptions: z.ZodObject<{
63666365
}, "strip", z.ZodTypeAny, {
63676366
client?: string | undefined;
63686367
listen?: number | {
6369-
path?: string | undefined;
63706368
port?: number | undefined;
63716369
host?: string | undefined;
63726370
backlog?: number | undefined;
6371+
path?: string | undefined;
63736372
exclusive?: boolean | undefined;
63746373
readableAll?: boolean | undefined;
63756374
writableAll?: boolean | undefined;
@@ -6379,10 +6378,10 @@ export const rspackOptions: z.ZodObject<{
63796378
}, {
63806379
client?: string | undefined;
63816380
listen?: number | {
6382-
path?: string | undefined;
63836381
port?: number | undefined;
63846382
host?: string | undefined;
63856383
backlog?: number | undefined;
6384+
path?: string | undefined;
63866385
exclusive?: boolean | undefined;
63876386
readableAll?: boolean | undefined;
63886387
writableAll?: boolean | undefined;
@@ -6400,10 +6399,10 @@ export const rspackOptions: z.ZodObject<{
64006399
backend?: {
64016400
client?: string | undefined;
64026401
listen?: number | {
6403-
path?: string | undefined;
64046402
port?: number | undefined;
64056403
host?: string | undefined;
64066404
backlog?: number | undefined;
6405+
path?: string | undefined;
64076406
exclusive?: boolean | undefined;
64086407
readableAll?: boolean | undefined;
64096408
writableAll?: boolean | undefined;
@@ -6418,10 +6417,10 @@ export const rspackOptions: z.ZodObject<{
64186417
backend?: {
64196418
client?: string | undefined;
64206419
listen?: number | {
6421-
path?: string | undefined;
64226420
port?: number | undefined;
64236421
host?: string | undefined;
64246422
backlog?: number | undefined;
6423+
path?: string | undefined;
64256424
exclusive?: boolean | undefined;
64266425
readableAll?: boolean | undefined;
64276426
writableAll?: boolean | undefined;
@@ -6537,10 +6536,10 @@ export const rspackOptions: z.ZodObject<{
65376536
backend?: {
65386537
client?: string | undefined;
65396538
listen?: number | {
6540-
path?: string | undefined;
65416539
port?: number | undefined;
65426540
host?: string | undefined;
65436541
backlog?: number | undefined;
6542+
path?: string | undefined;
65446543
exclusive?: boolean | undefined;
65456544
readableAll?: boolean | undefined;
65466545
writableAll?: boolean | undefined;
@@ -6603,10 +6602,10 @@ export const rspackOptions: z.ZodObject<{
66036602
backend?: {
66046603
client?: string | undefined;
66056604
listen?: number | {
6606-
path?: string | undefined;
66076605
port?: number | undefined;
66086606
host?: string | undefined;
66096607
backlog?: number | undefined;
6608+
path?: string | undefined;
66106609
exclusive?: boolean | undefined;
66116610
readableAll?: boolean | undefined;
66126611
writableAll?: boolean | undefined;
@@ -8548,10 +8547,10 @@ export const rspackOptions: z.ZodObject<{
85488547
backend?: {
85498548
client?: string | undefined;
85508549
listen?: number | {
8551-
path?: string | undefined;
85528550
port?: number | undefined;
85538551
host?: string | undefined;
85548552
backlog?: number | undefined;
8553+
path?: string | undefined;
85558554
exclusive?: boolean | undefined;
85568555
readableAll?: boolean | undefined;
85578556
writableAll?: boolean | undefined;
@@ -8760,6 +8759,7 @@ export const rspackOptions: z.ZodObject<{
87608759
}>>) | undefined;
87618760
output?: {
87628761
module?: boolean | undefined;
8762+
path?: string | undefined;
87638763
chunkLoading?: string | false | undefined;
87648764
asyncChunks?: boolean | undefined;
87658765
publicPath?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -8794,7 +8794,6 @@ export const rspackOptions: z.ZodObject<{
87948794
root?: string | undefined;
87958795
} | undefined;
87968796
umdNamedDefine?: boolean | undefined;
8797-
path?: string | undefined;
87988797
pathinfo?: boolean | "verbose" | undefined;
87998798
clean?: boolean | {
88008799
keep?: string | undefined;
@@ -9152,10 +9151,10 @@ export const rspackOptions: z.ZodObject<{
91529151
backend?: {
91539152
client?: string | undefined;
91549153
listen?: number | {
9155-
path?: string | undefined;
91569154
port?: number | undefined;
91579155
host?: string | undefined;
91589156
backlog?: number | undefined;
9157+
path?: string | undefined;
91599158
exclusive?: boolean | undefined;
91609159
readableAll?: boolean | undefined;
91619160
writableAll?: boolean | undefined;
@@ -9364,6 +9363,7 @@ export const rspackOptions: z.ZodObject<{
93649363
}>>) | undefined;
93659364
output?: {
93669365
module?: boolean | undefined;
9366+
path?: string | undefined;
93679367
chunkLoading?: string | false | undefined;
93689368
asyncChunks?: boolean | undefined;
93699369
publicPath?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -9398,7 +9398,6 @@ export const rspackOptions: z.ZodObject<{
93989398
root?: string | undefined;
93999399
} | undefined;
94009400
umdNamedDefine?: boolean | undefined;
9401-
path?: string | undefined;
94029401
pathinfo?: boolean | "verbose" | undefined;
94039402
clean?: boolean | {
94049403
keep?: string | undefined;
@@ -9893,6 +9892,9 @@ type SafeParseSuccess<Output> = {
98939892
// @public (undocumented)
98949893
export type ScriptType = false | "text/javascript" | "module";
98959894

9895+
// @public (undocumented)
9896+
type ServerOptionsHttps<Request extends typeof IncomingMessage = typeof IncomingMessage, Response extends typeof ServerResponse = typeof ServerResponse> = SecureContextOptions & TlsOptions & ServerOptions<Request, Response>;
9897+
98969898
// @public (undocumented)
98979899
export type Shared = (SharedItem | SharedObject)[] | SharedObject;
98989900

packages/rspack/src/builtin-plugin/lazy-compilation/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type { Compiler } from "../..";
1515

1616
export interface LazyCompilationDefaultBackendOptions {
1717
/**
18-
* A custom client.
18+
* A custom client script path.
1919
*/
2020
client?: string;
2121

packages/rspack/src/config/types.ts

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type * as webpackDevServer from "webpack-dev-server";
33
import type { Compilation, PathData } from "../Compilation";
44
import type { Compiler } from "../Compiler";
55
import type { Module } from "../Module";
6+
import type { LazyCompilationDefaultBackendOptions } from "../builtin-plugin/lazy-compilation/backend";
67
import type { Chunk } from "../exports";
78

89
export type FilenameTemplate = string;
@@ -2414,65 +2415,14 @@ export type RspackFutureOptions = {
24142415
};
24152416
};
24162417

2417-
/**
2418-
* Options for server listening.
2419-
*/
2420-
type ListenOptions = {
2421-
/**
2422-
* The port to listen on.
2423-
*/
2424-
port?: number;
2425-
/**
2426-
* The host to listen on.
2427-
*/
2428-
host?: string;
2429-
/**
2430-
* The backlog of connections.
2431-
*/
2432-
backlog?: number;
2433-
/**
2434-
* The path for Unix socket.
2435-
*/
2436-
path?: string;
2437-
/**
2438-
* Whether the server is exclusive.
2439-
*/
2440-
exclusive?: boolean;
2441-
/**
2442-
* Whether the socket is readable by all users.
2443-
*/
2444-
readableAll?: boolean;
2445-
/**
2446-
* Whether the socket is writable by all users.
2447-
*/
2448-
writableAll?: boolean;
2449-
/**
2450-
* Whether to use IPv6 only.
2451-
*/
2452-
ipv6Only?: boolean;
2453-
};
2454-
24552418
/**
24562419
* Options for lazy compilation.
24572420
*/
24582421
export type LazyCompilationOptions = {
24592422
/**
24602423
* Backend configuration for lazy compilation.
24612424
*/
2462-
backend?: {
2463-
/**
2464-
* Client script path.
2465-
*/
2466-
client?: string;
2467-
/**
2468-
* Listening options.
2469-
*/
2470-
listen?: number | ListenOptions;
2471-
/**
2472-
* Protocol to use.
2473-
*/
2474-
protocol?: "http" | "https";
2475-
};
2425+
backend?: LazyCompilationDefaultBackendOptions;
24762426
/**
24772427
* Enable lazy compilation for imports.
24782428
*/
@@ -2577,19 +2527,23 @@ export type Experiments = {
25772527
cache?: ExperimentCacheOptions;
25782528
/**
25792529
* Enable lazy compilation.
2530+
* @default false
25802531
*/
25812532
lazyCompilation?: boolean | LazyCompilationOptions;
25822533
/**
25832534
* Enable async WebAssembly.
25842535
* Support the new WebAssembly according to the [updated specification](https://github.com/WebAssembly/esm-integration), it makes a WebAssembly module an async module.
2536+
* @default false
25852537
*/
25862538
asyncWebAssembly?: boolean;
25872539
/**
25882540
* Enable output as ES module.
2541+
* @default false
25892542
*/
25902543
outputModule?: boolean;
25912544
/**
25922545
* Enable top-level await.
2546+
* @default true
25932547
*/
25942548
topLevelAwait?: boolean;
25952549
/**
@@ -2616,6 +2570,7 @@ export type Experiments = {
26162570
incremental?: boolean | Incremental;
26172571
/**
26182572
* Enable future default options.
2573+
* @default false
26192574
*/
26202575
futureDefaults?: boolean;
26212576
/**

0 commit comments

Comments
 (0)