@rsbuild/core 1.5.13 → 1.5.15
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/css-loader/index.js +20 -18
- package/compiled/memfs/index.js +121 -121
- package/compiled/memfs/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/style-loader/index.js +10 -10
- package/dist/index.cjs +1917 -1989
- package/dist/index.js +1821 -1814
- package/dist/transformLoader.mjs +13 -9
- package/dist/transformRawLoader.mjs +13 -9
- package/dist-types/helpers/compiler.d.ts +5 -0
- package/dist-types/helpers/format.d.ts +2 -5
- package/dist-types/helpers/index.d.ts +1 -24
- package/dist-types/helpers/stats.d.ts +10 -6
- package/dist-types/helpers/url.d.ts +11 -0
- package/dist-types/helpers/vendors.d.ts +29 -0
- package/dist-types/helpers/version.d.ts +7 -0
- package/dist-types/index.d.ts +1 -1
- package/dist-types/logger.d.ts +2 -1
- package/dist-types/pluginHelper.d.ts +3 -0
- package/dist-types/plugins/fileSize.d.ts +2 -2
- package/dist-types/provider/helpers.d.ts +2 -1
- package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +2 -2
- package/dist-types/server/assets-middleware/index.d.ts +5 -9
- package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +1 -1
- package/dist-types/server/devMiddlewares.d.ts +1 -1
- package/dist-types/server/proxy.d.ts +2 -2
- package/dist-types/server/socketServer.d.ts +8 -4
- package/dist-types/types/config.d.ts +1 -1
- package/dist-types/types/context.d.ts +8 -1
- package/dist-types/types/rsbuild.d.ts +7 -0
- package/package.json +7 -7
package/dist/transformLoader.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
let constants_dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
join(constants_dirname), join(constants_dirname, '../static');
|
|
6
|
+
let COMPILED_PATH = join(constants_dirname, '../compiled'), vendors_require = createRequire(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`);
|
|
7
|
+
requireCompiledPackage('picocolors');
|
|
8
|
+
let transformLoader = async function(source, map) {
|
|
9
9
|
let callback = this.async(), bypass = ()=>{
|
|
10
10
|
callback(null, source, map);
|
|
11
11
|
}, { id: transformId, getEnvironment } = this.getOptions();
|
|
@@ -13,6 +13,7 @@ let mergeSourceMap = async (originalSourceMap, generatedSourceMap)=>{
|
|
|
13
13
|
let transform = this._compiler?.__rsbuildTransformer?.[transformId];
|
|
14
14
|
if (!transform) return void bypass();
|
|
15
15
|
try {
|
|
16
|
+
var generatedSourceMap;
|
|
16
17
|
let result = await transform({
|
|
17
18
|
code: source,
|
|
18
19
|
context: this.context,
|
|
@@ -29,7 +30,10 @@ let mergeSourceMap = async (originalSourceMap, generatedSourceMap)=>{
|
|
|
29
30
|
});
|
|
30
31
|
if (null == result) return void bypass();
|
|
31
32
|
if ('string' == typeof result) return void callback(null, result, map);
|
|
32
|
-
let mergedMap =
|
|
33
|
+
let mergedMap = (generatedSourceMap = result.map, map && generatedSourceMap ? requireCompiledPackage('@jridgewell/remapping')([
|
|
34
|
+
generatedSourceMap,
|
|
35
|
+
map
|
|
36
|
+
], ()=>null) : generatedSourceMap ?? map);
|
|
33
37
|
callback(null, result.code, mergedMap);
|
|
34
38
|
} catch (error) {
|
|
35
39
|
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
let constants_dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
join(constants_dirname), join(constants_dirname, '../static');
|
|
6
|
+
let COMPILED_PATH = join(constants_dirname, '../compiled'), vendors_require = createRequire(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`);
|
|
7
|
+
requireCompiledPackage('picocolors');
|
|
8
|
+
let transformRawLoader = async function(source, map) {
|
|
9
9
|
let callback = this.async(), bypass = ()=>{
|
|
10
10
|
callback(null, source, map);
|
|
11
11
|
}, { id: transformId, getEnvironment } = this.getOptions();
|
|
@@ -13,6 +13,7 @@ let mergeSourceMap = async (originalSourceMap, generatedSourceMap)=>{
|
|
|
13
13
|
let transform = this._compiler?.__rsbuildTransformer?.[transformId];
|
|
14
14
|
if (!transform) return void bypass();
|
|
15
15
|
try {
|
|
16
|
+
var generatedSourceMap;
|
|
16
17
|
let result = await transform({
|
|
17
18
|
code: source,
|
|
18
19
|
context: this.context,
|
|
@@ -29,7 +30,10 @@ let mergeSourceMap = async (originalSourceMap, generatedSourceMap)=>{
|
|
|
29
30
|
});
|
|
30
31
|
if (null == result) return void bypass();
|
|
31
32
|
if ('string' == typeof result) return void callback(null, result, map);
|
|
32
|
-
let mergedMap =
|
|
33
|
+
let mergedMap = (generatedSourceMap = result.map, map && generatedSourceMap ? requireCompiledPackage('@jridgewell/remapping')([
|
|
34
|
+
generatedSourceMap,
|
|
35
|
+
map
|
|
36
|
+
], ()=>null) : generatedSourceMap ?? map);
|
|
33
37
|
callback(null, result.code, mergedMap);
|
|
34
38
|
} catch (error) {
|
|
35
39
|
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Rspack } from '../types';
|
|
2
|
+
export declare const isMultiCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler) => compiler is Rspack.MultiCompiler;
|
|
3
|
+
export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler | Rspack.Compilation) => string;
|
|
4
|
+
export declare const applyToCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler, apply: (c: Rspack.Compiler, index: number) => void) => void;
|
|
5
|
+
export declare const addCompilationError: (compilation: Rspack.Compilation, message: string) => void;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function
|
|
3
|
-
errors: string[];
|
|
4
|
-
warnings: string[];
|
|
5
|
-
};
|
|
1
|
+
import type { StatsError } from '@rspack/core';
|
|
2
|
+
export declare function formatStatsError(stats: StatsError, verbose?: boolean): string;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import color from '../../compiled/picocolors/index.js';
|
|
2
1
|
import RspackChain from '../../compiled/rspack-chain';
|
|
3
2
|
import type { FilenameConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildTarget, Rspack } from '../types';
|
|
4
|
-
|
|
5
|
-
export * from './path';
|
|
6
|
-
export * from './stats';
|
|
3
|
+
import { color } from './vendors';
|
|
7
4
|
export { color, RspackChain };
|
|
8
|
-
export declare const rspackMinVersion = "1.5.0";
|
|
9
5
|
export declare const getNodeEnv: () => string;
|
|
10
6
|
export declare const setNodeEnv: (env: string) => void;
|
|
11
7
|
export declare const isFunction: (func: unknown) => func is (...args: any[]) => any;
|
|
@@ -13,33 +9,15 @@ export declare const isObject: (obj: unknown) => obj is Record<string, any>;
|
|
|
13
9
|
export declare const isPlainObject: (obj: unknown) => obj is Record<string, any>;
|
|
14
10
|
export declare const castArray: <T>(arr?: T | T[]) => T[];
|
|
15
11
|
export declare const cloneDeep: <T>(value: T) => T;
|
|
16
|
-
/**
|
|
17
|
-
* If the application overrides the Rspack version to a lower one,
|
|
18
|
-
* we should check that the Rspack version is greater than the minimum
|
|
19
|
-
* supported version.
|
|
20
|
-
*/
|
|
21
|
-
export declare const isSatisfyRspackVersion: (originalVersion: string) => boolean;
|
|
22
|
-
export declare const removeLeadingSlash: (s: string) => string;
|
|
23
|
-
export declare const removeTailingSlash: (s: string) => string;
|
|
24
|
-
export declare const addTrailingSlash: (s: string) => string;
|
|
25
|
-
export declare const formatPublicPath: (publicPath: string, withSlash?: boolean) => string;
|
|
26
|
-
export declare const getPublicPathFromChain: (chain: RspackChain, withSlash?: boolean) => string;
|
|
27
|
-
export declare const getPublicPathFromCompiler: (compiler: Rspack.Compiler | Rspack.Compilation) => string;
|
|
28
|
-
export declare const urlJoin: (base: string, path: string) => string;
|
|
29
|
-
export declare const canParse: (url: string) => boolean;
|
|
30
|
-
export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
|
|
31
12
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): Rspack.Filename;
|
|
32
13
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'css', isProd: boolean): Rspack.CssFilename;
|
|
33
14
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'html', isProd?: boolean): string;
|
|
34
15
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'wasm', isProd: boolean): Rspack.WebassemblyModuleFilename;
|
|
35
16
|
export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js' | 'css'>, isProd: boolean, isServer?: boolean): Rspack.AssetModuleFilename;
|
|
36
17
|
export declare function partition<T>(array: T[], predicate: (value: T) => boolean): [T[], T[]];
|
|
37
|
-
export declare const applyToCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler, apply: (c: Rspack.Compiler, index: number) => void) => void;
|
|
38
18
|
export declare const upperFirst: (str: string) => string;
|
|
39
|
-
export declare const isURL: (str: string) => boolean;
|
|
40
19
|
export declare const createVirtualModule: (content: string) => string;
|
|
41
20
|
export declare function isWebTarget(target: RsbuildTarget | RsbuildTarget[]): boolean;
|
|
42
|
-
export declare const isMultiCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler) => compiler is Rspack.MultiCompiler;
|
|
43
21
|
export declare function pick<T, U extends keyof T>(obj: T, keys: readonly U[]): Pick<T, U>;
|
|
44
22
|
export declare const camelCase: (input: string) => string;
|
|
45
23
|
export declare const prettyTime: (seconds: number) => string;
|
|
@@ -47,5 +25,4 @@ export declare const prettyTime: (seconds: number) => string;
|
|
|
47
25
|
* Check if running in a TTY context
|
|
48
26
|
*/
|
|
49
27
|
export declare const isTTY: (type?: "stdin" | "stdout") => boolean;
|
|
50
|
-
export declare const addCompilationError: (compilation: Rspack.Compilation, message: string) => void;
|
|
51
28
|
export declare function hash(data: string): Promise<string>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ActionType, RsbuildStats, Rspack } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* If stats has errors, return stats errors directly
|
|
4
|
+
* If stats has no errors, return child errors, as some errors exist in both
|
|
5
|
+
* stats and childCompiler
|
|
6
|
+
*/
|
|
7
|
+
export declare const getStatsErrors: ({ errors, children, }: RsbuildStats) => Rspack.StatsError[];
|
|
8
|
+
export declare const getStatsWarnings: ({ warnings, children, }: RsbuildStats) => Rspack.StatsError[];
|
|
4
9
|
export declare const getAssetsFromStats: (stats: Rspack.Stats) => Rspack.StatsAsset[];
|
|
5
|
-
export declare
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function formatStats(statsData: Rspack.StatsCompilation, hasErrors: boolean): {
|
|
10
|
+
export declare function getRsbuildStats(statsInstance: Rspack.Stats | Rspack.MultiStats, compiler: Rspack.Compiler | Rspack.MultiCompiler, action?: ActionType): RsbuildStats;
|
|
11
|
+
export declare function formatStats(stats: RsbuildStats, hasErrors: boolean): {
|
|
8
12
|
message?: string;
|
|
9
13
|
level?: string;
|
|
10
14
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type RspackChain from '../../compiled/rspack-chain';
|
|
2
|
+
import type { Rspack } from '../types';
|
|
3
|
+
export declare const removeLeadingSlash: (s: string) => string;
|
|
4
|
+
export declare const removeTailingSlash: (s: string) => string;
|
|
5
|
+
export declare const addTrailingSlash: (s: string) => string;
|
|
6
|
+
export declare const isURL: (str: string) => boolean;
|
|
7
|
+
export declare const urlJoin: (base: string, path: string) => string;
|
|
8
|
+
export declare const canParse: (url: string) => boolean;
|
|
9
|
+
export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
|
|
10
|
+
export declare const formatPublicPath: (publicPath: string, withSlash?: boolean) => string;
|
|
11
|
+
export declare const getPublicPathFromChain: (chain: RspackChain, withSlash?: boolean) => string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type CompiledPackages = {
|
|
2
|
+
ws: typeof import('../../compiled/ws').default;
|
|
3
|
+
cors: typeof import('../../compiled/cors').default;
|
|
4
|
+
sirv: typeof import('../../compiled/sirv');
|
|
5
|
+
rslog: typeof import('../../compiled/rslog');
|
|
6
|
+
memfs: typeof import('../../compiled/memfs');
|
|
7
|
+
mrmime: typeof import('../../compiled/mrmime');
|
|
8
|
+
connect: typeof import('../../compiled/connect').default;
|
|
9
|
+
chokidar: typeof import('../../compiled/chokidar').default;
|
|
10
|
+
tinyglobby: typeof import('../../compiled/tinyglobby');
|
|
11
|
+
picocolors: typeof import('../../compiled/picocolors').default;
|
|
12
|
+
'html-rspack-plugin': typeof import('../../compiled/html-rspack-plugin').default;
|
|
13
|
+
'http-proxy-middleware': typeof import('../../compiled/http-proxy-middleware');
|
|
14
|
+
'webpack-bundle-analyzer': typeof import('../../compiled/webpack-bundle-analyzer');
|
|
15
|
+
'rspack-manifest-plugin': typeof import('../../compiled/rspack-manifest-plugin');
|
|
16
|
+
'launch-editor-middleware': typeof import('../../compiled/launch-editor-middleware');
|
|
17
|
+
'@jridgewell/remapping': typeof import('../../compiled/@jridgewell/remapping');
|
|
18
|
+
'@jridgewell/trace-mapping': typeof import('../../compiled/@jridgewell/trace-mapping');
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Load compiled package from `compiled` folder.
|
|
22
|
+
* use `require()` as compiled packages are CommonJS modules.
|
|
23
|
+
* https://github.com/nodejs/node/issues/59913
|
|
24
|
+
* @param name
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare const requireCompiledPackage: <T extends keyof CompiledPackages>(name: T) => CompiledPackages[T];
|
|
28
|
+
export declare const color: typeof import('../../compiled/picocolors').default;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const rspackMinVersion = "1.5.0";
|
|
2
|
+
/**
|
|
3
|
+
* If the application overrides the Rspack version to a lower one,
|
|
4
|
+
* we should check that the Rspack version is greater than the minimum
|
|
5
|
+
* supported version.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isSatisfyRspackVersion: (originalVersion: string) => boolean;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type { Rspack };
|
|
|
14
14
|
export type { ChainIdentifier } from './configChain';
|
|
15
15
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME } from './constants';
|
|
16
16
|
export { defaultAllowedOrigins } from './defaultConfig';
|
|
17
|
-
export { ensureAssetPrefix } from './helpers';
|
|
17
|
+
export { ensureAssetPrefix } from './helpers/url';
|
|
18
18
|
export { type Logger, logger } from './logger';
|
|
19
19
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
20
20
|
export type { RsbuildDevServer } from './server/devServer';
|
package/dist-types/logger.d.ts
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* This convention helps distinguish between normal operations
|
|
13
13
|
* and important alerts that require attention.
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
15
|
+
import type { Logger } from '../compiled/rslog/index.js';
|
|
16
|
+
declare const logger: Logger;
|
|
16
17
|
export declare const isDebug: () => boolean;
|
|
17
18
|
export { logger };
|
|
18
19
|
export type { Logger };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PrintFileSizeAsset, RsbuildPlugin } from '../types';
|
|
1
|
+
import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types';
|
|
2
2
|
/** Exclude source map and license files by default */
|
|
3
3
|
export declare const excludeAsset: (asset: PrintFileSizeAsset) => boolean;
|
|
4
|
-
export declare const pluginFileSize: () => RsbuildPlugin;
|
|
4
|
+
export declare const pluginFileSize: (context: InternalContext) => RsbuildPlugin;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Helpers for `@rsbuild/webpack`.
|
|
3
3
|
*/
|
|
4
4
|
export { modifyBundlerChain } from '../configChain';
|
|
5
|
-
export {
|
|
5
|
+
export { prettyTime } from '../helpers';
|
|
6
|
+
export { formatStats, getRsbuildStats } from '../helpers/stats';
|
|
6
7
|
export { registerBuildHook, registerDevHook } from '../hooks';
|
|
7
8
|
export { inspectConfig } from '../inspectConfig';
|
|
8
9
|
export { getHTMLPlugin, setCssExtractPlugin, setHTMLPlugin, } from '../pluginHelper';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Stats as FSStats } from 'node:fs';
|
|
2
2
|
import type { EnvironmentContext } from '../../types';
|
|
3
3
|
import type { OutputFileSystem } from './index';
|
|
4
|
-
export declare function getFileFromUrl(url: string, outputFileSystem: OutputFileSystem, environments: Record<string, EnvironmentContext>): {
|
|
4
|
+
export declare function getFileFromUrl(url: string, outputFileSystem: OutputFileSystem, environments: Record<string, EnvironmentContext>): Promise<{
|
|
5
5
|
filename: string;
|
|
6
6
|
fsStats: FSStats;
|
|
7
7
|
} | {
|
|
8
8
|
errorCode: number;
|
|
9
|
-
} | undefined
|
|
9
|
+
} | undefined>;
|
|
@@ -6,21 +6,16 @@
|
|
|
6
6
|
* Copyright JS Foundation and other contributors
|
|
7
7
|
* https://github.com/webpack/webpack-dev-middleware/blob/master/LICENSE
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { ReadStream } from 'node:fs';
|
|
10
10
|
import type { Compiler, MultiCompiler } from '@rspack/core';
|
|
11
|
-
import type { InternalContext, NormalizedConfig, RequestHandler } from '../../types';
|
|
11
|
+
import type { InternalContext, NormalizedConfig, RequestHandler, Rspack } from '../../types';
|
|
12
12
|
import type { SocketServer } from '../socketServer';
|
|
13
13
|
export type MultiWatching = ReturnType<MultiCompiler['watch']>;
|
|
14
|
-
export type OutputFileSystem = {
|
|
14
|
+
export type OutputFileSystem = Rspack.OutputFileSystem & {
|
|
15
15
|
createReadStream?: (p: string, opts: {
|
|
16
16
|
start: number;
|
|
17
17
|
end: number;
|
|
18
18
|
}) => ReadStream;
|
|
19
|
-
statSync?: (p: string) => FSStats;
|
|
20
|
-
readFileSync?: (p: string) => Buffer;
|
|
21
|
-
};
|
|
22
|
-
export type Options = {
|
|
23
|
-
writeToDisk?: boolean | ((targetPath: string, compilationName?: string) => boolean);
|
|
24
19
|
};
|
|
25
20
|
export type AssetsMiddlewareClose = (callback: (err?: Error | null) => void) => void;
|
|
26
21
|
export type AssetsMiddleware = RequestHandler & {
|
|
@@ -28,7 +23,8 @@ export type AssetsMiddleware = RequestHandler & {
|
|
|
28
23
|
close: AssetsMiddlewareClose;
|
|
29
24
|
};
|
|
30
25
|
export declare const isClientCompiler: (compiler: Compiler) => boolean;
|
|
31
|
-
export declare const setupServerHooks: ({ compiler, token, socketServer, }: {
|
|
26
|
+
export declare const setupServerHooks: ({ context, compiler, token, socketServer, }: {
|
|
27
|
+
context: InternalContext;
|
|
32
28
|
compiler: Compiler;
|
|
33
29
|
token: string;
|
|
34
30
|
socketServer: SocketServer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { OutputFileSystem } from './index';
|
|
3
3
|
import type { ResolvedWriteToDisk } from './setupWriteToDisk';
|
|
4
|
-
export declare function setupOutputFileSystem(writeToDisk: ResolvedWriteToDisk, compilers: Compiler[]):
|
|
4
|
+
export declare function setupOutputFileSystem(writeToDisk: ResolvedWriteToDisk, compilers: Compiler[]): OutputFileSystem;
|
|
@@ -19,4 +19,4 @@ export type GetDevMiddlewaresResult = {
|
|
|
19
19
|
onUpgrade: UpgradeEvent;
|
|
20
20
|
middlewares: Middlewares;
|
|
21
21
|
};
|
|
22
|
-
export declare const getDevMiddlewares: (options: RsbuildDevMiddlewareOptions) =>
|
|
22
|
+
export declare const getDevMiddlewares: (options: RsbuildDevMiddlewareOptions) => GetDevMiddlewaresResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RequestHandler as Middleware, ProxyConfig } from '../types';
|
|
2
2
|
import type { UpgradeEvent } from './helper';
|
|
3
|
-
export declare const createProxyMiddleware: (proxyOptions: ProxyConfig) =>
|
|
3
|
+
export declare const createProxyMiddleware: (proxyOptions: ProxyConfig) => {
|
|
4
4
|
middlewares: Middleware[];
|
|
5
5
|
upgrade: UpgradeEvent;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
@@ -39,17 +39,21 @@ export declare class SocketServer {
|
|
|
39
39
|
private readonly socketsMap;
|
|
40
40
|
private readonly options;
|
|
41
41
|
private readonly context;
|
|
42
|
-
private
|
|
43
|
-
private initialChunks;
|
|
42
|
+
private initialChunksMap;
|
|
44
43
|
private heartbeatTimer;
|
|
45
44
|
private getOutputFileSystem;
|
|
46
45
|
private reportedBrowserLogs;
|
|
46
|
+
private currentHash;
|
|
47
47
|
constructor(context: InternalContext, options: DevConfig, getOutputFileSystem: () => Rspack.OutputFileSystem);
|
|
48
48
|
upgrade: (req: IncomingMessage, socket: Socket, head: Buffer) => void;
|
|
49
49
|
private checkSockets;
|
|
50
50
|
private clearHeartbeatTimer;
|
|
51
|
-
prepare():
|
|
52
|
-
onBuildDone(
|
|
51
|
+
prepare(): void;
|
|
52
|
+
onBuildDone(token: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Send error messages to the client and render error overlay
|
|
55
|
+
*/
|
|
56
|
+
sendError(errors: Rspack.StatsError[], token: string): void;
|
|
53
57
|
/**
|
|
54
58
|
* Write message to each socket
|
|
55
59
|
* @param message - The message to send
|
|
@@ -1461,7 +1461,7 @@ export type CliShortcut = {
|
|
|
1461
1461
|
export type WriteToDisk = boolean | ((filename: string) => boolean);
|
|
1462
1462
|
export interface DevConfig {
|
|
1463
1463
|
/**
|
|
1464
|
-
*
|
|
1464
|
+
* Controls whether to forward browser runtime errors to the terminal. When `true`, the dev
|
|
1465
1465
|
* client listens for window `error` events in the browser and send them to the dev server,
|
|
1466
1466
|
* where they are printed in the terminal (prefixed with `[browser]`).
|
|
1467
1467
|
* @default true
|
|
@@ -2,7 +2,9 @@ import type { Hooks } from '../hooks';
|
|
|
2
2
|
import type { NormalizedConfig, RsbuildConfig } from './config';
|
|
3
3
|
import type { EnvironmentContext } from './hooks';
|
|
4
4
|
import type { RsbuildPluginAPI } from './plugin';
|
|
5
|
+
import type { RsbuildStats } from './rsbuild';
|
|
5
6
|
export type BundlerType = 'rspack' | 'webpack';
|
|
7
|
+
export type ActionType = 'dev' | 'build' | 'preview';
|
|
6
8
|
/** The public context */
|
|
7
9
|
export type RsbuildContext = {
|
|
8
10
|
/** The Rsbuild core version. */
|
|
@@ -45,7 +47,7 @@ export type RsbuildContext = {
|
|
|
45
47
|
* - build: will be set when running `rsbuild build` or `rsbuild.build()`
|
|
46
48
|
* - preview: will be set when running `rsbuild preview` or `rsbuild.preview()`
|
|
47
49
|
*/
|
|
48
|
-
action?:
|
|
50
|
+
action?: ActionType;
|
|
49
51
|
/**
|
|
50
52
|
* The bundler type, can be `rspack` or `webpack`.
|
|
51
53
|
*/
|
|
@@ -61,6 +63,11 @@ export type RsbuildContext = {
|
|
|
61
63
|
};
|
|
62
64
|
export type BuildStatus = 'idle' | 'building' | 'done';
|
|
63
65
|
export type BuildState = {
|
|
66
|
+
/**
|
|
67
|
+
* The stats object of the last build.
|
|
68
|
+
* Available after the build has been done.
|
|
69
|
+
*/
|
|
70
|
+
stats: RsbuildStats | null;
|
|
64
71
|
/** Current build status */
|
|
65
72
|
status: BuildStatus;
|
|
66
73
|
/** Whether there are build errors */
|
|
@@ -277,3 +277,10 @@ export type RsbuildEntryDescription = Rspack.EntryDescription & {
|
|
|
277
277
|
};
|
|
278
278
|
export type RsbuildEntry = Record<string, string | string[] | RsbuildEntryDescription>;
|
|
279
279
|
export type RsbuildMode = 'development' | 'production' | 'none';
|
|
280
|
+
export type RsbuildStatsItem = Pick<Rspack.StatsCompilation, 'errors' | 'warnings' | 'time' | 'entrypoints' | 'hash'>;
|
|
281
|
+
/**
|
|
282
|
+
* A subset of Rspack's StatsCompilation with only the fields we need
|
|
283
|
+
*/
|
|
284
|
+
export type RsbuildStats = RsbuildStatsItem & {
|
|
285
|
+
children: RsbuildStatsItem[];
|
|
286
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.15",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
52
|
"core-js": "~3.45.1",
|
|
53
|
-
"jiti": "^2.6.
|
|
53
|
+
"jiti": "^2.6.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@jridgewell/remapping": "^2.3.5",
|
|
57
57
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
58
|
-
"@rslib/core": "0.
|
|
58
|
+
"@rslib/core": "0.15.0",
|
|
59
59
|
"@types/connect": "3.4.38",
|
|
60
60
|
"@types/cors": "^2.8.19",
|
|
61
|
-
"@types/node": "^22.18.
|
|
61
|
+
"@types/node": "^22.18.8",
|
|
62
62
|
"@types/on-finished": "2.3.5",
|
|
63
63
|
"@types/range-parser": "^1.2.7",
|
|
64
64
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"html-rspack-plugin": "6.1.3",
|
|
75
75
|
"http-proxy-middleware": "^2.0.9",
|
|
76
76
|
"launch-editor-middleware": "^2.11.1",
|
|
77
|
-
"memfs": "^4.
|
|
77
|
+
"memfs": "^4.49.0",
|
|
78
78
|
"mrmime": "^2.0.1",
|
|
79
79
|
"on-finished": "2.4.1",
|
|
80
80
|
"open": "^10.2.0",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"stacktrace-parser": "^0.1.11",
|
|
93
93
|
"style-loader": "3.3.4",
|
|
94
94
|
"tinyglobby": "0.2.14",
|
|
95
|
-
"typescript": "^5.9.
|
|
96
|
-
"webpack": "^5.
|
|
95
|
+
"typescript": "^5.9.3",
|
|
96
|
+
"webpack": "^5.102.1",
|
|
97
97
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
98
98
|
"webpack-merge": "6.0.1",
|
|
99
99
|
"ws": "^8.18.3"
|