@rsbuild/core 1.3.0-beta.1 → 1.3.0-beta.3
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/cors/index.d.ts +56 -1
- package/compiled/css-loader/index.js +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-chain/index.d.ts +4 -0
- package/compiled/rspack-chain/index.js +67 -66
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +528 -551
- package/dist/index.js +523 -546
- package/dist-types/configChain.d.ts +8 -0
- package/dist-types/helpers/index.d.ts +0 -2
- package/dist-types/plugins/css.d.ts +1 -1
- package/dist-types/provider/createCompiler.d.ts +1 -23
- package/dist-types/server/{compilerDevMiddleware.d.ts → compilationManager.d.ts} +9 -10
- package/dist-types/server/compilationMiddleware.d.ts +37 -0
- package/dist-types/server/devMiddlewares.d.ts +22 -0
- package/dist-types/server/middlewares.d.ts +4 -5
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/server/watchFiles.d.ts +2 -2
- package/package.json +6 -5
- package/types.d.ts +71 -26
- package/dist-types/plugins/lazyCompilation.d.ts +0 -2
- package/dist-types/server/devMiddleware.d.ts +0 -27
- package/dist-types/server/getDevMiddlewares.d.ts +0 -30
|
@@ -24,18 +24,26 @@ export declare const CHAIN_ID: {
|
|
|
24
24
|
readonly CSS: "css";
|
|
25
25
|
/** Rule for raw CSS */
|
|
26
26
|
readonly CSS_RAW: "css-raw";
|
|
27
|
+
/** Rule for inline CSS */
|
|
28
|
+
readonly CSS_INLINE: "css-inline";
|
|
27
29
|
/** Rule for Less */
|
|
28
30
|
readonly LESS: "less";
|
|
29
31
|
/** Rule for raw Less */
|
|
30
32
|
readonly LESS_RAW: "less-raw";
|
|
33
|
+
/** Rule for inline Less */
|
|
34
|
+
readonly LESS_INLINE: "less-inline";
|
|
31
35
|
/** Rule for Sass */
|
|
32
36
|
readonly SASS: "sass";
|
|
33
37
|
/** Rule for raw Sass */
|
|
34
38
|
readonly SASS_RAW: "sass-raw";
|
|
39
|
+
/** Rule for inline Sass */
|
|
40
|
+
readonly SASS_INLINE: "sass-inline";
|
|
35
41
|
/** Rule for stylus */
|
|
36
42
|
readonly STYLUS: "stylus";
|
|
37
43
|
/** Rule for raw stylus */
|
|
38
44
|
readonly STYLUS_RAW: "stylus-raw";
|
|
45
|
+
/** Rule for inline stylus */
|
|
46
|
+
readonly STYLUS_INLINE: "stylus-inline";
|
|
39
47
|
/** Rule for svg */
|
|
40
48
|
readonly SVG: "svg";
|
|
41
49
|
/** Rule for pug */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { URL } from 'node:url';
|
|
2
1
|
import type { Compiler as WebpackCompiler, MultiCompiler as WebpackMultiCompiler } from 'webpack';
|
|
3
2
|
import color from '../../compiled/picocolors/index.js';
|
|
4
3
|
import type RspackChain from '../../compiled/rspack-chain/index.js';
|
|
@@ -25,7 +24,6 @@ export declare const getPublicPathFromChain: (chain: RspackChain, withSlash?: bo
|
|
|
25
24
|
export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler | Rspack.Compilation) => string;
|
|
26
25
|
export declare const urlJoin: (base: string, path: string) => string;
|
|
27
26
|
export declare const canParse: (url: string) => boolean;
|
|
28
|
-
export declare const parseUrl: (url: string) => URL | null;
|
|
29
27
|
export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
|
|
30
28
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): Rspack.Filename;
|
|
31
29
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'css', isProd: boolean): Rspack.CssFilename;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types';
|
|
2
|
-
export declare const getLightningCSSLoaderOptions: (config: NormalizedEnvironmentConfig, targets: string[]) => Rspack.LightningcssLoaderOptions;
|
|
2
|
+
export declare const getLightningCSSLoaderOptions: (config: NormalizedEnvironmentConfig, targets: string[], minify: boolean) => Rspack.LightningcssLoaderOptions;
|
|
3
3
|
export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
|
|
4
4
|
export declare const pluginCss: () => RsbuildPlugin;
|
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Rspack } from '../types';
|
|
2
2
|
import { type InitConfigsOptions } from './initConfigs';
|
|
3
3
|
export declare function createCompiler(options: InitConfigsOptions): Promise<{
|
|
4
4
|
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
5
5
|
rspackConfigs: Rspack.Configuration[];
|
|
6
6
|
}>;
|
|
7
|
-
export type MiddlewareCallbacks = {
|
|
8
|
-
onInvalid: () => void;
|
|
9
|
-
onDone: (stats: any) => void;
|
|
10
|
-
};
|
|
11
|
-
export type DevMiddlewareOptions = {
|
|
12
|
-
/** To ensure HMR works, the devMiddleware need inject the HMR client path into page when HMR enable. */
|
|
13
|
-
clientPaths?: string[];
|
|
14
|
-
clientConfig: DevConfig['client'];
|
|
15
|
-
publicPath?: string;
|
|
16
|
-
/** When liveReload is disabled, the page does not reload. */
|
|
17
|
-
liveReload?: boolean;
|
|
18
|
-
etag?: 'weak' | 'strong';
|
|
19
|
-
/** The options need by compiler middleware (like webpackMiddleware) */
|
|
20
|
-
headers?: Record<string, string | string[]>;
|
|
21
|
-
writeToDisk?: boolean | ((filename: string, compilationName?: string) => boolean);
|
|
22
|
-
stats?: boolean;
|
|
23
|
-
/** should trigger when compiler hook called */
|
|
24
|
-
callbacks: MiddlewareCallbacks;
|
|
25
|
-
/** whether use Server Side Render */
|
|
26
|
-
serverSideRender?: boolean;
|
|
27
|
-
serverConfig: ServerConfig;
|
|
28
|
-
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { IncomingMessage } from 'node:http';
|
|
2
|
-
import type { Socket } from 'node:net';
|
|
3
1
|
import type { EnvironmentContext, DevConfig as OriginDevConfig, Rspack, ServerConfig } from '../types';
|
|
4
|
-
import { type
|
|
2
|
+
import { type CompilationMiddleware } from './compilationMiddleware';
|
|
3
|
+
import { SocketServer } from './socketServer';
|
|
5
4
|
type Options = {
|
|
6
5
|
publicPaths: string[];
|
|
7
6
|
environments: Record<string, EnvironmentContext>;
|
|
@@ -14,18 +13,18 @@ type Options = {
|
|
|
14
13
|
* 1. setup rsbuild-dev-middleware
|
|
15
14
|
* 2. establish webSocket connect
|
|
16
15
|
*/
|
|
17
|
-
export declare class
|
|
18
|
-
middleware:
|
|
16
|
+
export declare class CompilationManager {
|
|
17
|
+
middleware: CompilationMiddleware;
|
|
18
|
+
outputFileSystem: Rspack.OutputFileSystem;
|
|
19
19
|
private devConfig;
|
|
20
20
|
private serverConfig;
|
|
21
|
-
|
|
21
|
+
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
22
22
|
private publicPaths;
|
|
23
|
-
|
|
23
|
+
socketServer: SocketServer;
|
|
24
24
|
constructor({ dev, server, compiler, publicPaths, environments }: Options);
|
|
25
25
|
init(): Promise<void>;
|
|
26
|
-
upgrade(req: IncomingMessage, sock: Socket, head: any): void;
|
|
27
26
|
close(): Promise<void>;
|
|
28
|
-
|
|
29
|
-
private
|
|
27
|
+
readFileSync: (fileName: string) => string;
|
|
28
|
+
private setupCompilationMiddleware;
|
|
30
29
|
}
|
|
31
30
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { Compiler, MultiCompiler } from '@rspack/core';
|
|
3
|
+
import type { DevConfig, NextFunction, ServerConfig } from '../types';
|
|
4
|
+
export declare const isClientCompiler: (compiler: {
|
|
5
|
+
options: {
|
|
6
|
+
target?: Compiler["options"]["target"];
|
|
7
|
+
};
|
|
8
|
+
}) => boolean;
|
|
9
|
+
type ServerCallbacks = {
|
|
10
|
+
onInvalid: (compilationId?: string, fileName?: string | null) => void;
|
|
11
|
+
onDone: (stats: any) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const setupServerHooks: (compiler: Compiler, { onDone, onInvalid }: ServerCallbacks) => void;
|
|
14
|
+
type Middleware = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => Promise<void>;
|
|
15
|
+
export type CompilationMiddlewareOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* To ensure HMR works, the devMiddleware need inject the HMR client path into page when HMR enable.
|
|
18
|
+
*/
|
|
19
|
+
clientPaths?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Should trigger when compiler hook called
|
|
22
|
+
*/
|
|
23
|
+
callbacks: ServerCallbacks;
|
|
24
|
+
devConfig: DevConfig;
|
|
25
|
+
serverConfig: ServerConfig;
|
|
26
|
+
};
|
|
27
|
+
export type CompilationMiddleware = Middleware & {
|
|
28
|
+
close: (callback: (err: Error | null | undefined) => void) => any;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The CompilationMiddleware handles compiler setup for development:
|
|
32
|
+
* - Call `compiler.watch` (handled by rsbuild-dev-middleware)
|
|
33
|
+
* - Inject the HMR client path into page
|
|
34
|
+
* - Notify server when compiler hooks are triggered
|
|
35
|
+
*/
|
|
36
|
+
export declare const getCompilationMiddleware: (compiler: Compiler | MultiCompiler, options: CompilationMiddlewareOptions) => Promise<CompilationMiddleware>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DevConfig, EnvironmentAPI, InternalContext, RequestHandler, ServerConfig } from '../types';
|
|
2
|
+
import type { CompilationManager } from './compilationManager';
|
|
3
|
+
import type { UpgradeEvent } from './helper';
|
|
4
|
+
export type RsbuildDevMiddlewareOptions = {
|
|
5
|
+
pwd: string;
|
|
6
|
+
dev: DevConfig;
|
|
7
|
+
server: ServerConfig;
|
|
8
|
+
context: InternalContext;
|
|
9
|
+
environments: EnvironmentAPI;
|
|
10
|
+
compilationManager?: CompilationManager;
|
|
11
|
+
/**
|
|
12
|
+
* Callbacks returned by the `onBeforeStartDevServer` hook.
|
|
13
|
+
*/
|
|
14
|
+
postCallbacks: (() => void)[];
|
|
15
|
+
};
|
|
16
|
+
export type Middlewares = Array<RequestHandler | [string, RequestHandler]>;
|
|
17
|
+
export type GetDevMiddlewaresResult = {
|
|
18
|
+
close: () => Promise<void>;
|
|
19
|
+
onUpgrade: UpgradeEvent;
|
|
20
|
+
middlewares: Middlewares;
|
|
21
|
+
};
|
|
22
|
+
export declare const getDevMiddlewares: (options: RsbuildDevMiddlewareOptions) => Promise<GetDevMiddlewaresResult>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type Connect from '../../compiled/connect/index.js';
|
|
2
|
-
import type { EnvironmentAPI, HtmlFallback, RequestHandler as Middleware
|
|
2
|
+
import type { EnvironmentAPI, HtmlFallback, RequestHandler as Middleware } from '../types';
|
|
3
|
+
import type { CompilationManager } from './compilationManager';
|
|
3
4
|
export declare const faviconFallbackMiddleware: Middleware;
|
|
4
5
|
export declare const getRequestLoggerMiddleware: () => Promise<Connect.NextHandleFunction>;
|
|
5
6
|
export declare const notFoundMiddleware: Middleware;
|
|
@@ -9,8 +10,7 @@ export declare const optionsFallbackMiddleware: Middleware;
|
|
|
9
10
|
*/
|
|
10
11
|
export declare const getHtmlCompletionMiddleware: (params: {
|
|
11
12
|
distPath: string;
|
|
12
|
-
|
|
13
|
-
outputFileSystem: Rspack.OutputFileSystem;
|
|
13
|
+
compilationManager: CompilationManager;
|
|
14
14
|
}) => Middleware;
|
|
15
15
|
/**
|
|
16
16
|
* handle `server.base`
|
|
@@ -23,9 +23,8 @@ export declare const getBaseMiddleware: (params: {
|
|
|
23
23
|
*/
|
|
24
24
|
export declare const getHtmlFallbackMiddleware: (params: {
|
|
25
25
|
distPath: string;
|
|
26
|
-
|
|
26
|
+
compilationManager: CompilationManager;
|
|
27
27
|
htmlFallback?: HtmlFallback;
|
|
28
|
-
outputFileSystem: Rspack.OutputFileSystem;
|
|
29
28
|
}) => Middleware;
|
|
30
29
|
/**
|
|
31
30
|
* Support viewing served files via `/rsbuild-dev-server` route
|
|
@@ -14,7 +14,7 @@ export declare class SocketServer {
|
|
|
14
14
|
private initialChunks;
|
|
15
15
|
private heartbeatTimer;
|
|
16
16
|
constructor(options: DevConfig);
|
|
17
|
-
upgrade(req: IncomingMessage, sock: Socket, head: any)
|
|
17
|
+
upgrade: (req: IncomingMessage, sock: Socket, head: any) => void;
|
|
18
18
|
private checkSockets;
|
|
19
19
|
private clearHeartbeatTimer;
|
|
20
20
|
prepare(): Promise<void>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { FSWatcher } from '../../compiled/chokidar/index.js';
|
|
2
2
|
import type { ChokidarOptions, DevConfig, ServerConfig } from '../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CompilationManager } from './compilationManager';
|
|
4
4
|
type WatchFilesOptions = {
|
|
5
5
|
dev: DevConfig;
|
|
6
6
|
server: ServerConfig;
|
|
7
|
-
compileMiddlewareAPI?: CompileMiddlewareAPI;
|
|
8
7
|
root: string;
|
|
8
|
+
compilationManager?: CompilationManager;
|
|
9
9
|
};
|
|
10
10
|
export type WatchFilesResult = {
|
|
11
11
|
close(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.3",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,16 +46,17 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.3.0-beta.
|
|
49
|
+
"@rspack/core": "1.3.0-beta.1",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.15",
|
|
52
52
|
"core-js": "~3.41.0",
|
|
53
53
|
"jiti": "^2.4.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@rslib/core": "0.5.
|
|
56
|
+
"@rslib/core": "0.5.5",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
|
-
"@types/
|
|
58
|
+
"@types/cors": "^2.8.17",
|
|
59
|
+
"@types/node": "^22.13.11",
|
|
59
60
|
"@types/on-finished": "2.3.4",
|
|
60
61
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
61
62
|
"@types/ws": "^8.18.0",
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
"reduce-configs": "^1.1.0",
|
|
84
85
|
"rsbuild-dev-middleware": "0.2.0",
|
|
85
86
|
"rslog": "^1.2.3",
|
|
86
|
-
"rspack-chain": "^1.2.
|
|
87
|
+
"rspack-chain": "^1.2.3",
|
|
87
88
|
"rspack-manifest-plugin": "5.0.3",
|
|
88
89
|
"sirv": "^3.0.1",
|
|
89
90
|
"style-loader": "3.3.4",
|
package/types.d.ts
CHANGED
|
@@ -5,6 +5,49 @@
|
|
|
5
5
|
*/
|
|
6
6
|
interface ImportMetaEnv {
|
|
7
7
|
[key: string]: any;
|
|
8
|
+
/**
|
|
9
|
+
* The value of the `mode` configuration.
|
|
10
|
+
* @example
|
|
11
|
+
* if (import.meta.env.MODE === 'development') {
|
|
12
|
+
* console.log('development mode');
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
MODE: 'development' | 'production' | 'none';
|
|
16
|
+
/**
|
|
17
|
+
* If `mode` is `'development'`, the value is `true`; otherwise, it is `false`.
|
|
18
|
+
* @example
|
|
19
|
+
* if (import.meta.env.DEV) {
|
|
20
|
+
* console.log('development mode');
|
|
21
|
+
* }
|
|
22
|
+
*/
|
|
23
|
+
DEV: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If `mode` is `'production'`, the value is `true`; otherwise, it is `false`.
|
|
26
|
+
* @example
|
|
27
|
+
* if (import.meta.env.PROD) {
|
|
28
|
+
* console.log('production mode');
|
|
29
|
+
* }
|
|
30
|
+
*/
|
|
31
|
+
PROD: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The value of the `server.base` configuration.
|
|
34
|
+
* @example
|
|
35
|
+
* const image = new Image();
|
|
36
|
+
* // Equivalent to "/foo/favicon.ico"
|
|
37
|
+
* image.src = `${import.meta.env.BASE_URL}/favicon.ico`;
|
|
38
|
+
*/
|
|
39
|
+
BASE_URL: string;
|
|
40
|
+
/**
|
|
41
|
+
* The URL prefix of static assets
|
|
42
|
+
* - In development, it is equivalent to the value set by `dev.assetPrefix`.
|
|
43
|
+
* - In production, it is equivalent to the value set by `output.assetPrefix`.
|
|
44
|
+
* - Rsbuild will automatically remove the trailing slash from `assetPrefix`
|
|
45
|
+
* to make string concatenation easier.
|
|
46
|
+
* @example
|
|
47
|
+
* const image = new Image();
|
|
48
|
+
* image.src = `${import.meta.env.ASSET_PREFIX}/favicon.ico`;
|
|
49
|
+
*/
|
|
50
|
+
ASSET_PREFIX: string;
|
|
8
51
|
}
|
|
9
52
|
interface ImportMeta {
|
|
10
53
|
readonly env: ImportMetaEnv;
|
|
@@ -150,9 +193,6 @@ declare module '*.opus' {
|
|
|
150
193
|
export default src;
|
|
151
194
|
}
|
|
152
195
|
|
|
153
|
-
/**
|
|
154
|
-
* Configuration files
|
|
155
|
-
*/
|
|
156
196
|
/**
|
|
157
197
|
* @requires [@rsbuild/plugin-yaml](https://www.npmjs.com/package/@rsbuild/plugin-yaml)
|
|
158
198
|
*/
|
|
@@ -160,6 +200,9 @@ declare module '*.yaml' {
|
|
|
160
200
|
const content: Record<string, any>;
|
|
161
201
|
export default content;
|
|
162
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* @requires [@rsbuild/plugin-yaml](https://www.npmjs.com/package/@rsbuild/plugin-yaml)
|
|
205
|
+
*/
|
|
163
206
|
declare module '*.yml' {
|
|
164
207
|
const content: Record<string, any>;
|
|
165
208
|
export default content;
|
|
@@ -173,41 +216,37 @@ declare module '*.toml' {
|
|
|
173
216
|
}
|
|
174
217
|
|
|
175
218
|
/**
|
|
176
|
-
*
|
|
219
|
+
* Imports the file as a URL string.
|
|
220
|
+
* @note Only works for static assets by default.
|
|
221
|
+
* @example
|
|
222
|
+
* import logoUrl from './logo.png?url'
|
|
223
|
+
* console.log(logoUrl) // 'http://example.com/logo.123456.png'
|
|
177
224
|
*/
|
|
178
225
|
declare module '*?url' {
|
|
179
226
|
const content: string;
|
|
180
227
|
export default content;
|
|
181
228
|
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Imports the file content as a base64 encoded string.
|
|
232
|
+
* @note Only works for static assets and CSS files by default.
|
|
233
|
+
* @example
|
|
234
|
+
* import logo from './logo.svg?inline'
|
|
235
|
+
* console.log(logo) // 'data:image/svg+xml;base64,...'
|
|
236
|
+
*/
|
|
182
237
|
declare module '*?inline' {
|
|
183
238
|
const content: string;
|
|
184
239
|
export default content;
|
|
185
240
|
}
|
|
186
241
|
|
|
187
242
|
/**
|
|
188
|
-
*
|
|
243
|
+
* Imports the raw content of the file as a string.
|
|
244
|
+
* @note Only works for static assets and CSS files by default.
|
|
245
|
+
* @example
|
|
246
|
+
* import raw from './logo.svg?raw'
|
|
247
|
+
* console.log(raw) // '<svg viewBox="0 0 24 24">...</svg>'
|
|
189
248
|
*/
|
|
190
|
-
declare module '
|
|
191
|
-
const content: string;
|
|
192
|
-
export default content;
|
|
193
|
-
}
|
|
194
|
-
declare module '*.scss?raw' {
|
|
195
|
-
const content: string;
|
|
196
|
-
export default content;
|
|
197
|
-
}
|
|
198
|
-
declare module '*.sass?raw' {
|
|
199
|
-
const content: string;
|
|
200
|
-
export default content;
|
|
201
|
-
}
|
|
202
|
-
declare module '*.less?raw' {
|
|
203
|
-
const content: string;
|
|
204
|
-
export default content;
|
|
205
|
-
}
|
|
206
|
-
declare module '*.styl?raw' {
|
|
207
|
-
const content: string;
|
|
208
|
-
export default content;
|
|
209
|
-
}
|
|
210
|
-
declare module '*.stylus?raw' {
|
|
249
|
+
declare module '*?raw' {
|
|
211
250
|
const content: string;
|
|
212
251
|
export default content;
|
|
213
252
|
}
|
|
@@ -229,6 +268,9 @@ declare module '*.module.scss' {
|
|
|
229
268
|
const classes: CSSModuleClasses;
|
|
230
269
|
export default classes;
|
|
231
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* @requires [@rsbuild/plugin-sass](https://www.npmjs.com/package/@rsbuild/plugin-sass)
|
|
273
|
+
*/
|
|
232
274
|
declare module '*.module.sass' {
|
|
233
275
|
const classes: CSSModuleClasses;
|
|
234
276
|
export default classes;
|
|
@@ -247,6 +289,9 @@ declare module '*.module.styl' {
|
|
|
247
289
|
const classes: CSSModuleClasses;
|
|
248
290
|
export default classes;
|
|
249
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* @requires [@rsbuild/plugin-stylus](https://www.npmjs.com/package/@rsbuild/plugin-stylus)
|
|
294
|
+
*/
|
|
250
295
|
declare module '*.module.stylus' {
|
|
251
296
|
const classes: CSSModuleClasses;
|
|
252
297
|
export default classes;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import type { Compiler, MultiCompiler } from '@rspack/core';
|
|
3
|
-
import type { DevMiddlewareOptions } from '../provider/createCompiler';
|
|
4
|
-
import type { NextFunction } from '../types';
|
|
5
|
-
type ServerCallbacks = {
|
|
6
|
-
onInvalid: (compilationId?: string, fileName?: string | null) => void;
|
|
7
|
-
onDone: (stats: any) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const isClientCompiler: (compiler: {
|
|
10
|
-
options: {
|
|
11
|
-
target?: Compiler["options"]["target"];
|
|
12
|
-
};
|
|
13
|
-
}) => boolean;
|
|
14
|
-
export declare const setupServerHooks: (compiler: Compiler, hookCallbacks: ServerCallbacks) => void;
|
|
15
|
-
export type Middleware = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => Promise<void>;
|
|
16
|
-
export type DevMiddlewareAPI = Middleware & {
|
|
17
|
-
close: (callback: (err: Error | null | undefined) => void) => any;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* The rsbuild/server do nothing about compiler, the devMiddleware need do such things to ensure dev works well:
|
|
21
|
-
* - Call compiler.watch (normally did by rsbuild-dev-middleware).
|
|
22
|
-
* - Inject the HMR client path into page (the HMR client rsbuild/server already provide).
|
|
23
|
-
* - Notify server when compiler hooks are triggered.
|
|
24
|
-
*/
|
|
25
|
-
export type DevMiddleware = (options: DevMiddlewareOptions) => Promise<DevMiddlewareAPI>;
|
|
26
|
-
export declare const getDevMiddleware: (multiCompiler: Compiler | MultiCompiler) => Promise<NonNullable<DevMiddleware>>;
|
|
27
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { DevConfig, EnvironmentAPI, RequestHandler, Rspack, ServerConfig, SetupMiddlewaresServer } from '../types';
|
|
2
|
-
import type { UpgradeEvent } from './helper';
|
|
3
|
-
export type CompileMiddlewareAPI = {
|
|
4
|
-
middleware: RequestHandler;
|
|
5
|
-
sockWrite: SetupMiddlewaresServer['sockWrite'];
|
|
6
|
-
onUpgrade: UpgradeEvent;
|
|
7
|
-
close: () => Promise<void>;
|
|
8
|
-
};
|
|
9
|
-
export type RsbuildDevMiddlewareOptions = {
|
|
10
|
-
pwd: string;
|
|
11
|
-
dev: DevConfig;
|
|
12
|
-
server: ServerConfig;
|
|
13
|
-
environments: EnvironmentAPI;
|
|
14
|
-
compileMiddlewareAPI?: CompileMiddlewareAPI;
|
|
15
|
-
outputFileSystem: Rspack.OutputFileSystem;
|
|
16
|
-
output: {
|
|
17
|
-
distPath: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Callbacks returned by the `onBeforeStartDevServer` hook.
|
|
21
|
-
*/
|
|
22
|
-
postCallbacks: (() => void)[];
|
|
23
|
-
};
|
|
24
|
-
export type Middlewares = Array<RequestHandler | [string, RequestHandler]>;
|
|
25
|
-
export type GetMiddlewaresResult = {
|
|
26
|
-
close: () => Promise<void>;
|
|
27
|
-
onUpgrade: UpgradeEvent;
|
|
28
|
-
middlewares: Middlewares;
|
|
29
|
-
};
|
|
30
|
-
export declare const getMiddlewares: (options: RsbuildDevMiddlewareOptions) => Promise<GetMiddlewaresResult>;
|