@rsbuild/core 2.0.8 → 2.0.9
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/1~rslib-runtime.js +8 -5
- package/dist/756.js +13 -7
- package/dist/memfs.js +4 -4
- package/dist-types/build.d.ts +1 -1
- package/dist-types/cli/init.d.ts +1 -1
- package/dist-types/configChain.d.ts +59 -118
- package/dist-types/constants.d.ts +35 -31
- package/dist-types/createContext.d.ts +1 -2
- package/dist-types/createRsbuild.d.ts +1 -2
- package/dist-types/defaultConfig.d.ts +2 -4
- package/dist-types/helpers/exitHook.d.ts +1 -1
- package/dist-types/helpers/format.d.ts +2 -1
- package/dist-types/helpers/fs.d.ts +2 -4
- package/dist-types/helpers/index.d.ts +1 -2
- package/dist-types/helpers/path.d.ts +4 -8
- package/dist-types/helpers/stats.d.ts +3 -5
- package/dist-types/helpers/url.d.ts +1 -0
- package/dist-types/helpers/vendors.d.ts +2 -3
- package/dist-types/helpers/version.d.ts +2 -3
- package/dist-types/hooks.d.ts +6 -8
- package/dist-types/index.d.ts +10 -5
- package/dist-types/initConfigs.d.ts +2 -3
- package/dist-types/initPlugins.d.ts +1 -1
- package/dist-types/inspectConfig.d.ts +1 -1
- package/dist-types/loadConfig.d.ts +24 -32
- package/dist-types/loadEnv.d.ts +48 -57
- package/dist-types/loader/transformRawLoader.d.ts +1 -0
- package/dist-types/logger.d.ts +1 -2
- package/dist-types/mergeConfig.d.ts +1 -2
- package/dist-types/pluginHelper.d.ts +1 -2
- package/dist-types/pluginManager.d.ts +4 -7
- package/dist-types/plugins/basic.d.ts +1 -2
- package/dist-types/plugins/css.d.ts +4 -0
- package/dist-types/plugins/fileSize.d.ts +6 -5
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +1 -0
- package/dist-types/plugins/swc.d.ts +1 -2
- package/dist-types/restart.d.ts +4 -5
- package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +2 -3
- package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +2 -3
- package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +3 -4
- package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +1 -2
- package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +2 -3
- package/dist-types/rspackConfig.d.ts +1 -1
- package/dist-types/server/ansiHTML.d.ts +1 -2
- package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +1 -2
- package/dist-types/server/assets-middleware/index.d.ts +3 -5
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +1 -2
- package/dist-types/server/browserLogs.d.ts +1 -2
- package/dist-types/server/buildManager.d.ts +4 -6
- package/dist-types/server/cliShortcuts.d.ts +3 -1
- package/dist-types/server/devMiddlewares.d.ts +2 -3
- package/dist-types/server/devServer.d.ts +18 -23
- package/dist-types/server/gracefulShutdown.d.ts +2 -4
- package/dist-types/server/gzipMiddleware.d.ts +1 -1
- package/dist-types/server/helper.d.ts +36 -45
- package/dist-types/server/historyApiFallback.d.ts +8 -1
- package/dist-types/server/httpServer.d.ts +1 -1
- package/dist-types/server/middlewares.d.ts +4 -8
- package/dist-types/server/open.d.ts +1 -1
- package/dist-types/server/runner/basic.d.ts +4 -5
- package/dist-types/server/runner/index.d.ts +3 -1
- package/dist-types/server/socketServer.d.ts +24 -18
- package/dist-types/server/watchFiles.d.ts +1 -1
- package/dist-types/types/config.d.ts +1192 -1465
- package/dist-types/types/context.d.ts +63 -92
- package/dist-types/types/hooks.d.ts +106 -150
- package/dist-types/types/plugin.d.ts +359 -444
- package/dist-types/types/rsbuild.d.ts +156 -191
- package/dist-types/types/thirdParty.d.ts +101 -132
- package/dist-types/types/utils.d.ts +2 -5
- package/package.json +3 -3
- package/dist-types/client/hmr.d.ts +0 -3
- package/dist-types/client/log.d.ts +0 -13
- package/dist-types/client/overlay.d.ts +0 -1
package/dist/1~rslib-runtime.js
CHANGED
|
@@ -27,11 +27,14 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
|
|
|
27
27
|
def[key] = ()=>value[key];
|
|
28
28
|
});
|
|
29
29
|
return def.default = ()=>value, __webpack_require__.d(ns, def), ns;
|
|
30
|
-
}, __webpack_require__.d = (exports,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
}, __webpack_require__.d = (exports, getters, values)=>{
|
|
31
|
+
var define = (defs, kind)=>{
|
|
32
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: !0,
|
|
34
|
+
[kind]: defs[key]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
define(getters, "get"), define(values, "value");
|
|
35
38
|
}, __webpack_require__.add = function registerModules(modules) {
|
|
36
39
|
Object.assign(__webpack_require__.m, modules);
|
|
37
40
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
|
package/dist/756.js
CHANGED
|
@@ -3485,7 +3485,7 @@ function createPublicContext(context) {
|
|
|
3485
3485
|
async function createContext(options, userConfig, logger) {
|
|
3486
3486
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
3487
3487
|
return {
|
|
3488
|
-
version: "2.0.
|
|
3488
|
+
version: "2.0.9",
|
|
3489
3489
|
rootPath,
|
|
3490
3490
|
distPath: '',
|
|
3491
3491
|
cachePath,
|
|
@@ -5356,13 +5356,19 @@ let supportedChromiumBrowsers = [
|
|
|
5356
5356
|
async function openBrowser(url, logger) {
|
|
5357
5357
|
let browser = process.env.BROWSER, browserArgs = process.env.BROWSER_ARGS;
|
|
5358
5358
|
if ('darwin' === process.platform && (!browser || !browserArgs) && (!browser || supportedChromiumBrowsers.includes(mapChromiumBrowserName(browser)))) {
|
|
5359
|
-
let {
|
|
5360
|
-
let { stdout: ps } = await
|
|
5359
|
+
let { execFile } = await import("node:child_process"), { promisify } = await import("node:util"), execFileAsync = promisify(execFile), getDefaultBrowserForAppleScript = async ()=>{
|
|
5360
|
+
let { stdout: ps } = await execFileAsync('ps', [
|
|
5361
|
+
'cax'
|
|
5362
|
+
]);
|
|
5361
5363
|
return supportedChromiumBrowsers.find((b)=>ps.includes(b));
|
|
5362
5364
|
};
|
|
5363
5365
|
try {
|
|
5364
5366
|
let chromiumBrowser = browser ? mapChromiumBrowserName(browser) : await getDefaultBrowserForAppleScript();
|
|
5365
|
-
if (chromiumBrowser) return await
|
|
5367
|
+
if (chromiumBrowser) return await execFileAsync("osascript", [
|
|
5368
|
+
"openChrome.applescript",
|
|
5369
|
+
encodeURI(url),
|
|
5370
|
+
chromiumBrowser
|
|
5371
|
+
], {
|
|
5366
5372
|
cwd: STATIC_PATH
|
|
5367
5373
|
}), !0;
|
|
5368
5374
|
logger.debug('failed to find the target browser.');
|
|
@@ -9457,7 +9463,7 @@ let applyServerOptions = (command)=>{
|
|
|
9457
9463
|
};
|
|
9458
9464
|
function setupCommands() {
|
|
9459
9465
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9460
|
-
cli.version("2.0.
|
|
9466
|
+
cli.version("2.0.9"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
|
|
9461
9467
|
default: 'auto'
|
|
9462
9468
|
}).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
|
|
9463
9469
|
type: [
|
|
@@ -9528,7 +9534,7 @@ function initNodeEnv(command) {
|
|
|
9528
9534
|
}
|
|
9529
9535
|
function showGreeting() {
|
|
9530
9536
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9531
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.
|
|
9537
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.9\n`);
|
|
9532
9538
|
}
|
|
9533
9539
|
function setupLogLevel() {
|
|
9534
9540
|
if (cli_argv.length <= 3) return;
|
|
@@ -9550,5 +9556,5 @@ function runCLI() {
|
|
|
9550
9556
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
9551
9557
|
}
|
|
9552
9558
|
}
|
|
9553
|
-
let src_version = "2.0.
|
|
9559
|
+
let src_version = "2.0.9";
|
|
9554
9560
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, runCLI, src_logger as logger, src_version as version };
|
package/dist/memfs.js
CHANGED
|
@@ -5490,10 +5490,6 @@ __webpack_require__.add({
|
|
|
5490
5490
|
};
|
|
5491
5491
|
},
|
|
5492
5492
|
"../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5493
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
5494
|
-
__exportStar: ()=>__exportStar,
|
|
5495
|
-
__importDefault: ()=>__importDefault
|
|
5496
|
-
});
|
|
5497
5493
|
var __createBinding = Object.create ? function(o, m, k, k2) {
|
|
5498
5494
|
void 0 === k2 && (k2 = k);
|
|
5499
5495
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -5514,6 +5510,10 @@ __webpack_require__.add({
|
|
|
5514
5510
|
default: mod
|
|
5515
5511
|
};
|
|
5516
5512
|
}
|
|
5513
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5514
|
+
__exportStar: ()=>__exportStar,
|
|
5515
|
+
__importDefault: ()=>__importDefault
|
|
5516
|
+
});
|
|
5517
5517
|
}
|
|
5518
5518
|
});
|
|
5519
5519
|
let memfs_lib = __webpack_require__("../../node_modules/.pnpm/memfs@4.57.2/node_modules/memfs/lib/index.js");
|
package/dist-types/build.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { InitConfigsOptions } from './initConfigs';
|
|
2
2
|
import type { Build, BuildOptions } from './types';
|
|
3
|
-
export declare const RSPACK_BUILD_ERROR =
|
|
3
|
+
export declare const RSPACK_BUILD_ERROR = 'Rspack build failed.';
|
|
4
4
|
export declare const build: (initOptions: InitConfigsOptions, { watch }?: BuildOptions) => Promise<ReturnType<Build>>;
|
package/dist-types/cli/init.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RsbuildInstance } from '../types';
|
|
2
2
|
import type { CommonOptions } from './commands';
|
|
3
|
-
export declare function init({ cliOptions, isRestart, isBuildWatch
|
|
3
|
+
export declare function init({ cliOptions, isRestart, isBuildWatch }: {
|
|
4
4
|
cliOptions?: CommonOptions;
|
|
5
5
|
isRestart?: boolean;
|
|
6
6
|
isBuildWatch?: boolean;
|
|
@@ -2,138 +2,79 @@ import { RspackChain } from './helpers';
|
|
|
2
2
|
import type { InternalContext, ModifyBundlerChainUtils } from './types';
|
|
3
3
|
export declare function modifyBundlerChain(context: InternalContext, utils: ModifyBundlerChainUtils): Promise<RspackChain>;
|
|
4
4
|
export declare const CHAIN_ID: {
|
|
5
|
-
/** Predefined rules */
|
|
6
|
-
|
|
7
|
-
/** Rule for
|
|
8
|
-
readonly
|
|
9
|
-
/** Rule for
|
|
10
|
-
readonly
|
|
11
|
-
/** Rule for
|
|
12
|
-
readonly
|
|
13
|
-
/** Rule for
|
|
14
|
-
readonly
|
|
15
|
-
/** Rule for
|
|
16
|
-
readonly
|
|
17
|
-
/** Rule for
|
|
18
|
-
readonly
|
|
19
|
-
/** Rule for
|
|
20
|
-
readonly
|
|
21
|
-
/** Rule for
|
|
22
|
-
readonly JS_DATA_URI: 'js-data-uri';
|
|
23
|
-
/** Rule for CSS */
|
|
24
|
-
readonly CSS: 'css';
|
|
25
|
-
/** Rule for Less */
|
|
26
|
-
readonly LESS: 'less';
|
|
27
|
-
/** Rule for Sass */
|
|
28
|
-
readonly SASS: 'sass';
|
|
29
|
-
/** Rule for stylus */
|
|
30
|
-
readonly STYLUS: 'stylus';
|
|
31
|
-
/** Rule for svg */
|
|
32
|
-
readonly SVG: 'svg';
|
|
33
|
-
/** Rule for Vue */
|
|
34
|
-
readonly VUE: 'vue';
|
|
35
|
-
/** Rule for wasm */
|
|
36
|
-
readonly WASM: 'wasm';
|
|
37
|
-
/** Rule for svelte */
|
|
38
|
-
readonly SVELTE: 'svelte';
|
|
5
|
+
/** Predefined rules */ readonly RULE: {
|
|
6
|
+
/** Rule for .mjs */ readonly MJS: 'mjs';
|
|
7
|
+
/** Rule for fonts */ readonly FONT: 'font';
|
|
8
|
+
/** Rule for JSON */ readonly JSON: 'json';
|
|
9
|
+
/** Rule for images */ readonly IMAGE: 'image';
|
|
10
|
+
/** Rule for media */ readonly MEDIA: 'media';
|
|
11
|
+
/** Rule for additional assets */ readonly ADDITIONAL_ASSETS: 'additional-assets';
|
|
12
|
+
/** Rule for JS */ readonly JS: 'js';
|
|
13
|
+
/** Rule for data uri encoded javascript */ readonly JS_DATA_URI: 'js-data-uri';
|
|
14
|
+
/** Rule for CSS */ readonly CSS: 'css';
|
|
15
|
+
/** Rule for Less */ readonly LESS: 'less';
|
|
16
|
+
/** Rule for Sass */ readonly SASS: 'sass';
|
|
17
|
+
/** Rule for stylus */ readonly STYLUS: 'stylus';
|
|
18
|
+
/** Rule for svg */ readonly SVG: 'svg';
|
|
19
|
+
/** Rule for Vue */ readonly VUE: 'vue';
|
|
20
|
+
/** Rule for wasm */ readonly WASM: 'wasm';
|
|
21
|
+
/** Rule for svelte */ readonly SVELTE: 'svelte';
|
|
39
22
|
};
|
|
40
|
-
/** Predefined rule groups */
|
|
41
|
-
|
|
42
|
-
/** JS oneOf rules */
|
|
43
|
-
readonly JS_MAIN: 'js';
|
|
23
|
+
/** Predefined rule groups */ readonly ONE_OF: {
|
|
24
|
+
/** JS oneOf rules */ readonly JS_MAIN: 'js';
|
|
44
25
|
readonly JS_WORKER: 'js-worker';
|
|
45
26
|
readonly JS_RAW: 'js-raw';
|
|
46
|
-
/** CSS oneOf rules */
|
|
47
|
-
readonly CSS_MAIN: 'css';
|
|
27
|
+
/** CSS oneOf rules */ readonly CSS_MAIN: 'css';
|
|
48
28
|
readonly CSS_RAW: 'css-raw';
|
|
49
29
|
readonly CSS_URL: 'css-url';
|
|
50
30
|
readonly CSS_INLINE: 'css-inline';
|
|
51
|
-
/** SVG oneOf rules */
|
|
52
|
-
readonly SVG: 'svg';
|
|
31
|
+
/** SVG oneOf rules */ readonly SVG: 'svg';
|
|
53
32
|
readonly SVG_RAW: 'svg-asset-raw';
|
|
54
33
|
readonly SVG_URL: 'svg-asset-url';
|
|
55
34
|
readonly SVG_ASSET: 'svg-asset';
|
|
56
35
|
readonly SVG_REACT: 'svg-react';
|
|
57
36
|
readonly SVG_INLINE: 'svg-asset-inline';
|
|
58
37
|
};
|
|
59
|
-
/** Predefined loaders */
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
readonly
|
|
63
|
-
/**
|
|
64
|
-
readonly
|
|
65
|
-
/**
|
|
66
|
-
readonly
|
|
67
|
-
/**
|
|
68
|
-
readonly
|
|
69
|
-
/**
|
|
70
|
-
readonly
|
|
71
|
-
/**
|
|
72
|
-
readonly
|
|
73
|
-
/**
|
|
74
|
-
readonly
|
|
75
|
-
/**
|
|
76
|
-
readonly
|
|
77
|
-
/**
|
|
78
|
-
readonly
|
|
79
|
-
/** worker query loader */
|
|
80
|
-
readonly WORKER_QUERY: 'worker-query';
|
|
81
|
-
/** svgr */
|
|
82
|
-
readonly SVGR: 'svgr';
|
|
83
|
-
/** babel-loader */
|
|
84
|
-
readonly BABEL: 'babel';
|
|
85
|
-
/** style-loader */
|
|
86
|
-
readonly STYLE: 'style-loader';
|
|
87
|
-
/** svelte-loader */
|
|
88
|
-
readonly SVELTE: 'svelte';
|
|
89
|
-
/** postcss-loader */
|
|
90
|
-
readonly POSTCSS: 'postcss';
|
|
91
|
-
/** lightningcss-loader */
|
|
92
|
-
readonly LIGHTNINGCSS: 'lightningcss';
|
|
93
|
-
/** ignore-css-loader */
|
|
94
|
-
readonly IGNORE_CSS: 'ignore-css';
|
|
95
|
-
/** CssExtractRspackPlugin.loader */
|
|
96
|
-
readonly MINI_CSS_EXTRACT: 'mini-css-extract';
|
|
97
|
-
/** resolve-url-loader */
|
|
98
|
-
readonly RESOLVE_URL: 'resolve-url-loader';
|
|
38
|
+
/** Predefined loaders */ readonly USE: {
|
|
39
|
+
/** ts-loader */ readonly TS: 'ts';
|
|
40
|
+
/** css-loader */ readonly CSS: 'css';
|
|
41
|
+
/** CSS URL loader */ readonly CSS_URL: 'css-url';
|
|
42
|
+
/** sass-loader */ readonly SASS: 'sass';
|
|
43
|
+
/** less-loader */ readonly LESS: 'less';
|
|
44
|
+
/** stylus-loader */ readonly STYLUS: 'stylus';
|
|
45
|
+
/** url-loader */ readonly URL: 'url';
|
|
46
|
+
/** vue-loader */ readonly VUE: 'vue';
|
|
47
|
+
/** swc-loader */ readonly SWC: 'swc';
|
|
48
|
+
/** worker query loader */ readonly WORKER_QUERY: 'worker-query';
|
|
49
|
+
/** svgr */ readonly SVGR: 'svgr';
|
|
50
|
+
/** babel-loader */ readonly BABEL: 'babel';
|
|
51
|
+
/** style-loader */ readonly STYLE: 'style-loader';
|
|
52
|
+
/** svelte-loader */ readonly SVELTE: 'svelte';
|
|
53
|
+
/** postcss-loader */ readonly POSTCSS: 'postcss';
|
|
54
|
+
/** lightningcss-loader */ readonly LIGHTNINGCSS: 'lightningcss';
|
|
55
|
+
/** ignore-css-loader */ readonly IGNORE_CSS: 'ignore-css';
|
|
56
|
+
/** CssExtractRspackPlugin.loader */ readonly MINI_CSS_EXTRACT: 'mini-css-extract';
|
|
57
|
+
/** resolve-url-loader */ readonly RESOLVE_URL: 'resolve-url-loader';
|
|
99
58
|
};
|
|
100
|
-
/** Predefined plugins */
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
readonly
|
|
104
|
-
/**
|
|
105
|
-
readonly
|
|
106
|
-
/**
|
|
107
|
-
readonly
|
|
108
|
-
/**
|
|
109
|
-
readonly
|
|
110
|
-
/**
|
|
111
|
-
readonly
|
|
112
|
-
/**
|
|
113
|
-
readonly
|
|
114
|
-
/**
|
|
115
|
-
readonly TS_CHECKER: 'ts-checker';
|
|
116
|
-
/** ModuleFederationPlugin */
|
|
117
|
-
readonly MODULE_FEDERATION: 'module-federation';
|
|
118
|
-
/** HtmlResourceHintsPlugin (prefetch) */
|
|
119
|
-
readonly HTML_PREFETCH: 'html-prefetch-plugin';
|
|
120
|
-
/** HtmlResourceHintsPlugin (preload) */
|
|
121
|
-
readonly HTML_PRELOAD: 'html-preload-plugin';
|
|
122
|
-
/** CssExtractRspackPlugin */
|
|
123
|
-
readonly MINI_CSS_EXTRACT: 'mini-css-extract';
|
|
124
|
-
/** VueLoaderPlugin */
|
|
125
|
-
readonly VUE_LOADER_PLUGIN: 'vue-loader-plugin';
|
|
126
|
-
/** ReactFastRefreshPlugin */
|
|
127
|
-
readonly REACT_FAST_REFRESH: 'react-fast-refresh';
|
|
128
|
-
/** SubresourceIntegrityPlugin */
|
|
129
|
-
readonly SUBRESOURCE_INTEGRITY: 'subresource-integrity';
|
|
59
|
+
/** Predefined plugins */ readonly PLUGIN: {
|
|
60
|
+
/** HotModuleReplacementPlugin */ readonly HMR: 'hmr';
|
|
61
|
+
/** CopyRspackPlugin */ readonly COPY: 'copy';
|
|
62
|
+
/** HtmlRspackPlugin */ readonly HTML: 'html';
|
|
63
|
+
/** DefinePlugin */ readonly DEFINE: 'define';
|
|
64
|
+
/** ProgressPlugin */ readonly PROGRESS: 'progress';
|
|
65
|
+
/** RspackManifestPlugin */ readonly MANIFEST: 'rspack-manifest';
|
|
66
|
+
/** ForkTsCheckerWebpackPlugin */ readonly TS_CHECKER: 'ts-checker';
|
|
67
|
+
/** ModuleFederationPlugin */ readonly MODULE_FEDERATION: 'module-federation';
|
|
68
|
+
/** HtmlResourceHintsPlugin (prefetch) */ readonly HTML_PREFETCH: 'html-prefetch-plugin';
|
|
69
|
+
/** HtmlResourceHintsPlugin (preload) */ readonly HTML_PRELOAD: 'html-preload-plugin';
|
|
70
|
+
/** CssExtractRspackPlugin */ readonly MINI_CSS_EXTRACT: 'mini-css-extract';
|
|
71
|
+
/** VueLoaderPlugin */ readonly VUE_LOADER_PLUGIN: 'vue-loader-plugin';
|
|
72
|
+
/** ReactFastRefreshPlugin */ readonly REACT_FAST_REFRESH: 'react-fast-refresh';
|
|
73
|
+
/** SubresourceIntegrityPlugin */ readonly SUBRESOURCE_INTEGRITY: 'subresource-integrity';
|
|
130
74
|
};
|
|
131
|
-
/** Predefined minimizers */
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
readonly JS: 'js';
|
|
135
|
-
/** LightningCssMinimizerRspackPlugin */
|
|
136
|
-
readonly CSS: 'css';
|
|
75
|
+
/** Predefined minimizers */ readonly MINIMIZER: {
|
|
76
|
+
/** SwcJsMinimizerRspackPlugin */ readonly JS: 'js';
|
|
77
|
+
/** LightningCssMinimizerRspackPlugin */ readonly CSS: 'css';
|
|
137
78
|
};
|
|
138
79
|
};
|
|
139
80
|
export type ChainIdentifier = typeof CHAIN_ID;
|
|
@@ -1,61 +1,65 @@
|
|
|
1
1
|
export declare const isDeno: boolean;
|
|
2
2
|
export declare const isWindows: boolean;
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
3
|
+
// Paths
|
|
4
|
+
export declare const ROOT_DIST_DIR = 'dist';
|
|
5
|
+
export declare const HTML_DIST_DIR = './';
|
|
6
|
+
export declare const FAVICON_DIST_DIR = './';
|
|
7
|
+
export declare const JS_DIST_DIR = 'static/js';
|
|
8
|
+
export declare const CSS_DIST_DIR = 'static/css';
|
|
9
|
+
export declare const SVG_DIST_DIR = 'static/svg';
|
|
10
|
+
export declare const FONT_DIST_DIR = 'static/font';
|
|
11
|
+
export declare const WASM_DIST_DIR = 'static/wasm';
|
|
12
|
+
export declare const IMAGE_DIST_DIR = 'static/image';
|
|
13
|
+
export declare const MEDIA_DIST_DIR = 'static/media';
|
|
14
|
+
export declare const ASSETS_DIST_DIR = 'static/assets';
|
|
15
|
+
// loaders will be emitted to the same folder of the main bundle
|
|
14
16
|
export declare const LOADER_PATH: string;
|
|
15
17
|
export declare const STATIC_PATH: string;
|
|
16
18
|
export declare const CLIENT_PATH: string;
|
|
17
19
|
export declare const COMPILED_PATH: string;
|
|
18
|
-
export declare const TS_CONFIG_FILE =
|
|
19
|
-
export declare const HMR_SOCKET_PATH =
|
|
20
|
-
export declare const RSBUILD_OUTPUTS_PATH =
|
|
21
|
-
export declare const LOCALHOST =
|
|
22
|
-
export declare const ALL_INTERFACES_IPV4 =
|
|
20
|
+
export declare const TS_CONFIG_FILE = 'tsconfig.json';
|
|
21
|
+
export declare const HMR_SOCKET_PATH = '/rsbuild-hmr';
|
|
22
|
+
export declare const RSBUILD_OUTPUTS_PATH = '.rsbuild';
|
|
23
|
+
export declare const LOCALHOST = 'localhost';
|
|
24
|
+
export declare const ALL_INTERFACES_IPV4 = '0.0.0.0';
|
|
25
|
+
// Defaults
|
|
23
26
|
export declare const DEFAULT_PORT = 3000;
|
|
24
27
|
export declare const DEFAULT_DATA_URL_SIZE = 4096;
|
|
25
|
-
export declare const DEFAULT_MOUNT_ID =
|
|
26
|
-
export declare const DEFAULT_ASSET_PREFIX =
|
|
27
|
-
export declare const DEFAULT_STACK_TRACE =
|
|
28
|
+
export declare const DEFAULT_MOUNT_ID = 'root';
|
|
29
|
+
export declare const DEFAULT_ASSET_PREFIX = '/';
|
|
30
|
+
export declare const DEFAULT_STACK_TRACE = 'summary';
|
|
31
|
+
// Defaults to "baseline widely available on 2025-05-01"
|
|
32
|
+
// https://browsersl.ist/#q=baseline+widely+available+on+2025-05-01
|
|
28
33
|
export declare const DEFAULT_WEB_BROWSERSLIST: string[];
|
|
29
34
|
export declare const DEFAULT_BROWSERSLIST: Record<string, string[]>;
|
|
35
|
+
// RegExp
|
|
30
36
|
export declare const JS_REGEX: RegExp;
|
|
31
37
|
export declare const SCRIPT_REGEX: RegExp;
|
|
32
38
|
export declare const CSS_REGEX: RegExp;
|
|
33
39
|
/**
|
|
34
40
|
* Regular expression to match the 'raw' query parameter.
|
|
35
41
|
* Matches patterns like: `?raw`, `?raw&other=value`, `?other=value&raw`, `?raw=value`
|
|
36
|
-
*/
|
|
37
|
-
export declare const RAW_QUERY_REGEX: RegExp;
|
|
42
|
+
*/ export declare const RAW_QUERY_REGEX: RegExp;
|
|
38
43
|
/**
|
|
39
44
|
* Regular expression to match the 'inline' query parameter.
|
|
40
45
|
* Matches patterns like: `?inline`, `?inline&other=value`, `?other=value&inline`, `?inline=value`
|
|
41
|
-
*/
|
|
42
|
-
export declare const INLINE_QUERY_REGEX: RegExp;
|
|
46
|
+
*/ export declare const INLINE_QUERY_REGEX: RegExp;
|
|
43
47
|
/**
|
|
44
48
|
* Regular expression to match the 'url' query parameter.
|
|
45
49
|
* Matches patterns like: `?url`, `?url&other=value`, `?other=value&url`, `?url=value`
|
|
46
|
-
*/
|
|
47
|
-
export declare const URL_QUERY_REGEX: RegExp;
|
|
50
|
+
*/ export declare const URL_QUERY_REGEX: RegExp;
|
|
48
51
|
/**
|
|
49
52
|
* Regular expression to match the 'worker' query parameter.
|
|
50
53
|
* Matches patterns like: `?worker`, `?worker&inline`, `?inline&worker`, `?worker=value`
|
|
51
|
-
*/
|
|
52
|
-
export declare const WORKER_QUERY_REGEX: RegExp;
|
|
54
|
+
*/ export declare const WORKER_QUERY_REGEX: RegExp;
|
|
53
55
|
export declare const NODE_MODULES_REGEX: RegExp;
|
|
54
|
-
|
|
55
|
-
export declare const
|
|
56
|
+
// Plugins
|
|
57
|
+
export declare const PLUGIN_SWC_NAME = 'rsbuild:swc';
|
|
58
|
+
export declare const PLUGIN_CSS_NAME = 'rsbuild:css';
|
|
59
|
+
// Extensions
|
|
56
60
|
export declare const FONT_EXTENSIONS: string[];
|
|
57
61
|
export declare const IMAGE_EXTENSIONS: string[];
|
|
58
62
|
export declare const VIDEO_EXTENSIONS: string[];
|
|
59
63
|
export declare const AUDIO_EXTENSIONS: string[];
|
|
60
|
-
export declare const LAZY_COMPILATION_IDENTIFIER =
|
|
61
|
-
export declare const BROWSER_LOG_PREFIX =
|
|
64
|
+
export declare const LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
|
|
65
|
+
export declare const BROWSER_LOG_PREFIX = '[browser]';
|
|
@@ -8,5 +8,4 @@ export declare function createPublicContext(context: InternalContext): Readonly<
|
|
|
8
8
|
/**
|
|
9
9
|
* Generate the actual context used in the build,
|
|
10
10
|
* which can have a lot of overhead and take some side effects.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createContext(options: ResolvedCreateRsbuildOptions, userConfig: RsbuildConfig, logger: Logger): Promise<InternalContext>;
|
|
11
|
+
*/ export declare function createContext(options: ResolvedCreateRsbuildOptions, userConfig: RsbuildConfig, logger: Logger): Promise<InternalContext>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CreateRsbuildOptions, RsbuildInstance } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Create an Rsbuild instance.
|
|
4
|
-
*/
|
|
5
|
-
export declare function createRsbuild(options?: CreateRsbuildOptions): Promise<RsbuildInstance>;
|
|
4
|
+
*/ export declare function createRsbuild(options?: CreateRsbuildOptions): Promise<RsbuildInstance>;
|
|
@@ -14,12 +14,10 @@ import type { NormalizedConfig, RsbuildConfig, RsbuildEntry } from './types';
|
|
|
14
14
|
* },
|
|
15
15
|
* }
|
|
16
16
|
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const defaultAllowedOrigins: RegExp;
|
|
17
|
+
*/ export declare const defaultAllowedOrigins: RegExp;
|
|
19
18
|
export declare function getDefaultEntry(root: string): RsbuildEntry;
|
|
20
19
|
export declare const withDefaultConfig: (rootPath: string, userConfig: RsbuildConfig) => Promise<RsbuildConfig>;
|
|
21
20
|
/**
|
|
22
21
|
* Normalizes the user configuration by merging it with defaults and ensuring
|
|
23
22
|
* consistent structure.
|
|
24
|
-
*/
|
|
25
|
-
export declare const normalizeConfig: (config: RsbuildConfig, rootPath: string) => NormalizedConfig;
|
|
23
|
+
*/ export declare const normalizeConfig: (config: RsbuildConfig, rootPath: string) => NormalizedConfig;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { StatsError } from '@rspack/core';
|
|
2
2
|
import { type Logger } from '../logger';
|
|
3
|
-
|
|
3
|
+
// Formats Rspack stats error to readable message
|
|
4
|
+
export declare function formatStatsError(stats: StatsError, root: string, level: 'error' | 'warning' | undefined, logger: Logger): string;
|
|
@@ -6,13 +6,11 @@ export declare function isEmptyDir(path: string): boolean;
|
|
|
6
6
|
* Find first already exists file.
|
|
7
7
|
* @param files - Absolute file paths with extension.
|
|
8
8
|
* @returns The file path if exists, or false if no file exists.
|
|
9
|
-
*/
|
|
10
|
-
export declare const findExists: (files: string[]) => string | false;
|
|
9
|
+
*/ export declare const findExists: (files: string[]) => string | false;
|
|
11
10
|
export declare function pathExists(path: string): Promise<boolean>;
|
|
12
11
|
export declare function isFileExists(file: string): Promise<boolean>;
|
|
13
12
|
export declare function fileExistsByCompilation({ inputFileSystem }: Rspack.Compilation, filePath: string): Promise<boolean>;
|
|
14
13
|
/**
|
|
15
14
|
* Read file asynchronously using Rspack compiler's filesystem.
|
|
16
|
-
*/
|
|
17
|
-
export declare function readFileAsync(fs: NonNullable<Rspack.Compilation['inputFileSystem'] | Rspack.OutputFileSystem>, filename: string): Promise<Buffer | string>;
|
|
15
|
+
*/ export declare function readFileAsync(fs: NonNullable<Rspack.Compilation['inputFileSystem'] | Rspack.OutputFileSystem>, filename: string): Promise<Buffer | string>;
|
|
18
16
|
export declare function emptyDir(dir: string, logger: Logger, keep?: RegExp[], checkExists?: boolean): Promise<void>;
|
|
@@ -24,7 +24,6 @@ export declare const camelCase: (input: string) => string;
|
|
|
24
24
|
export declare const prettyTime: (seconds: number) => string;
|
|
25
25
|
/**
|
|
26
26
|
* Check if running in a TTY context
|
|
27
|
-
*/
|
|
28
|
-
export declare const isTTY: (type?: 'stdin' | 'stdout') => boolean;
|
|
27
|
+
*/ export declare const isTTY: (type?: 'stdin' | 'stdout') => boolean;
|
|
29
28
|
export declare function hash(data: string): Promise<string>;
|
|
30
29
|
export declare const isRspackRuntimeModule: (identifier: string) => boolean;
|
|
@@ -7,20 +7,16 @@ export declare const getCompiledPath: (packageName: string) => string;
|
|
|
7
7
|
* @param base - Base path to resolve relative from.
|
|
8
8
|
* @param filePath - Absolute or relative file path.
|
|
9
9
|
* @returns Resolved absolute file path.
|
|
10
|
-
*/
|
|
11
|
-
export declare const ensureAbsolutePath: (base: string, filePath: string) => string;
|
|
10
|
+
*/ export declare const ensureAbsolutePath: (base: string, filePath: string) => string;
|
|
12
11
|
export declare const getPathnameFromUrl: (url: string) => string;
|
|
13
|
-
/** dedupe and remove nested paths */
|
|
14
|
-
export declare const dedupeNestedPaths: (paths: string[]) => string[];
|
|
12
|
+
/** dedupe and remove nested paths */ export declare const dedupeNestedPaths: (paths: string[]) => string[];
|
|
15
13
|
/**
|
|
16
14
|
* Convert Windows backslash paths to posix forward slashes
|
|
17
15
|
* @example
|
|
18
16
|
* toPosixPath('foo\\bar') // returns 'foo/bar'
|
|
19
|
-
*/
|
|
20
|
-
export declare const toPosixPath: (filepath: string) => string;
|
|
17
|
+
*/ export declare const toPosixPath: (filepath: string) => string;
|
|
21
18
|
/**
|
|
22
19
|
* Normalize filepaths for `source.include` and `source.exclude` configuration.
|
|
23
20
|
* On Windows, `require.resolve` returns paths with posix forward slashes,
|
|
24
21
|
* This function normalizes the path to use backslashes.
|
|
25
|
-
*/
|
|
26
|
-
export declare const normalizeRuleConditionPath: (filepath: Rspack.RuleSetCondition) => Rspack.RuleSetCondition;
|
|
22
|
+
*/ export declare const normalizeRuleConditionPath: (filepath: Rspack.RuleSetCondition) => Rspack.RuleSetCondition;
|
|
@@ -4,9 +4,8 @@ import type { ActionType, RsbuildStats, Rspack } from '../types';
|
|
|
4
4
|
* If stats has errors, return stats errors directly
|
|
5
5
|
* If stats has no errors, return child errors, as some errors exist in both
|
|
6
6
|
* stats and childCompiler
|
|
7
|
-
*/
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const getStatsWarnings: ({ warnings, children, }: RsbuildStats) => Rspack.StatsError[];
|
|
7
|
+
*/ export declare const getStatsErrors: ({ errors, children }: RsbuildStats) => Rspack.StatsError[];
|
|
8
|
+
export declare const getStatsWarnings: ({ warnings, children }: RsbuildStats) => Rspack.StatsError[];
|
|
10
9
|
export declare function getRsbuildStats(statsInstance: Rspack.Stats | Rspack.MultiStats, compiler: Rspack.Compiler | Rspack.MultiCompiler, logger: Logger, action?: ActionType): RsbuildStats;
|
|
11
10
|
export declare function formatStats(stats: RsbuildStats, hasErrors: boolean, root: string, logger: Logger): {
|
|
12
11
|
message?: string;
|
|
@@ -15,5 +14,4 @@ export declare function formatStats(stats: RsbuildStats, hasErrors: boolean, roo
|
|
|
15
14
|
/**
|
|
16
15
|
* Remove the loader chain delimiter from the module identifier.
|
|
17
16
|
* @example ./src/index.js!=!/node_modules/my-loader/index.js -> ./src/index.js
|
|
18
|
-
*/
|
|
19
|
-
export declare const removeLoaderChainDelimiter: (moduleId: string, logger: Logger) => string;
|
|
17
|
+
*/ export declare const removeLoaderChainDelimiter: (moduleId: string, logger: Logger) => string;
|
|
@@ -3,6 +3,7 @@ import type { Rspack } from '../types';
|
|
|
3
3
|
export declare const removeLeadingSlash: (s: string) => string;
|
|
4
4
|
export declare const removeTailingSlash: (s: string) => string;
|
|
5
5
|
export declare const addTrailingSlash: (s: string) => string;
|
|
6
|
+
// Determine if the string is a URL
|
|
6
7
|
export declare const isURL: (str: string) => boolean;
|
|
7
8
|
export declare const urlJoin: (base: string, path: string) => string;
|
|
8
9
|
export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
|
|
@@ -8,6 +8,5 @@ export declare const require: NodeJS.Require;
|
|
|
8
8
|
* https://github.com/nodejs/node/issues/59913
|
|
9
9
|
* @param name
|
|
10
10
|
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export
|
|
13
|
-
export {};
|
|
11
|
+
*/ export declare const requireCompiledPackage: <T extends keyof CompiledPackages>(name: T) => CompiledPackages[T];
|
|
12
|
+
export { };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export declare const rspackMinVersion =
|
|
1
|
+
export declare const rspackMinVersion = '2.0.0';
|
|
2
2
|
/**
|
|
3
3
|
* If the application overrides the Rspack version to a lower one,
|
|
4
4
|
* we should check that the Rspack version is greater than the minimum
|
|
5
5
|
* supported version.
|
|
6
|
-
*/
|
|
7
|
-
export declare const isSatisfyRspackVersion: (originalVersion: string) => boolean;
|
|
6
|
+
*/ export declare const isSatisfyRspackVersion: (originalVersion: string) => boolean;
|
package/dist-types/hooks.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import type { AsyncHook, EnvironmentAsyncHook, InternalContext, ModifyBundlerCha
|
|
|
2
2
|
export declare function createEnvironmentAsyncHook<Callback extends (...args: any[]) => any>(): EnvironmentAsyncHook<Callback>;
|
|
3
3
|
export declare function createAsyncHook<Callback extends (...args: any[]) => any>(): AsyncHook<Callback>;
|
|
4
4
|
export declare function initHooks(): {
|
|
5
|
-
/** The following hooks are global hooks */
|
|
6
|
-
onExit: AsyncHook<OnExitFn>;
|
|
5
|
+
/** The following hooks are global hooks */ onExit: AsyncHook<OnExitFn>;
|
|
7
6
|
onAfterBuild: AsyncHook<OnAfterBuildFn>;
|
|
8
7
|
onCloseBuild: AsyncHook<OnCloseBuildFn>;
|
|
9
8
|
onBeforeBuild: AsyncHook<OnBeforeBuildFn>;
|
|
@@ -16,8 +15,7 @@ export declare function initHooks(): {
|
|
|
16
15
|
onBeforeStartPreviewServer: AsyncHook<OnBeforeStartPreviewServerFn>;
|
|
17
16
|
onAfterCreateCompiler: AsyncHook<OnAfterCreateCompilerFn>;
|
|
18
17
|
onBeforeCreateCompiler: AsyncHook<OnBeforeCreateCompilerFn>;
|
|
19
|
-
/** The following hooks are related to the environment */
|
|
20
|
-
modifyHTML: EnvironmentAsyncHook<ModifyHTMLFn>;
|
|
18
|
+
/** The following hooks are related to the environment */ modifyHTML: EnvironmentAsyncHook<ModifyHTMLFn>;
|
|
21
19
|
modifyHTMLTags: EnvironmentAsyncHook<ModifyHTMLTagsFn>;
|
|
22
20
|
modifyRspackConfig: EnvironmentAsyncHook<ModifyRspackConfigFn>;
|
|
23
21
|
modifyBundlerChain: EnvironmentAsyncHook<ModifyBundlerChainFn>;
|
|
@@ -27,16 +25,16 @@ export declare function initHooks(): {
|
|
|
27
25
|
onAfterEnvironmentCompile: EnvironmentAsyncHook<OnAfterEnvironmentCompileFn>;
|
|
28
26
|
};
|
|
29
27
|
export type Hooks = ReturnType<typeof initHooks>;
|
|
30
|
-
export declare const registerBuildHook: ({ context, isWatch, compiler, rspackConfigs, MultiStatsCtor
|
|
28
|
+
export declare const registerBuildHook: ({ context, isWatch, compiler, rspackConfigs, MultiStatsCtor }: {
|
|
31
29
|
rspackConfigs: Rspack.Configuration[];
|
|
32
30
|
context: InternalContext;
|
|
33
31
|
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
34
32
|
isWatch: boolean;
|
|
35
|
-
MultiStatsCtor: new
|
|
33
|
+
MultiStatsCtor: new(stats: Rspack.Stats[]) => Rspack.MultiStats;
|
|
36
34
|
}) => void;
|
|
37
|
-
export declare const registerDevHook: ({ context, compiler, bundlerConfigs, MultiStatsCtor
|
|
35
|
+
export declare const registerDevHook: ({ context, compiler, bundlerConfigs, MultiStatsCtor }: {
|
|
38
36
|
bundlerConfigs: Rspack.Configuration[];
|
|
39
37
|
context: InternalContext;
|
|
40
38
|
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
41
|
-
MultiStatsCtor: new
|
|
39
|
+
MultiStatsCtor: new(stats: Rspack.Stats[]) => Rspack.MultiStats;
|
|
42
40
|
}) => void;
|