@rsbuild/core 2.0.6 → 2.0.8
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 +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/style-loader/index.js +10 -10
- package/dist/{753.js → 756.js} +245 -161
- package/dist/chokidar.js +2 -2
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/http-proxy-middleware.js +10 -112
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/manifest-plugin.js +7 -7
- package/dist/memfs.js +3 -3
- package/dist/workerLoader.mjs +94 -0
- package/dist/ws.js +48 -32
- package/dist-types/configChain.d.ts +3 -0
- package/dist-types/constants.d.ts +5 -0
- package/dist-types/helpers/packageJson.d.ts +9 -0
- package/dist-types/index.d.ts +1 -1
- package/dist-types/loader/workerLoader.d.ts +6 -0
- package/dist-types/mergeConfig.d.ts +6 -0
- package/dist-types/plugins/css.d.ts +1 -1
- package/dist-types/plugins/externals.d.ts +8 -1
- package/dist-types/plugins/worker.d.ts +2 -0
- package/dist-types/server/helper.d.ts +3 -2
- package/dist-types/types/config.d.ts +48 -7
- package/dist-types/types/plugin.d.ts +3 -3
- package/dist-types/types/rsbuild.d.ts +1 -1
- package/package.json +11 -11
- package/types.d.ts +42 -0
- /package/dist/{753.js.LICENSE.txt → 756.js.LICENSE.txt} +0 -0
- /package/dist/client/{797.js → 60.js} +0 -0
package/dist/{753.js → 756.js}
RENAMED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
/*! LICENSE:
|
|
1
|
+
/*! LICENSE: 756.js.LICENSE.txt */
|
|
2
2
|
let flagForceColor, runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
|
|
3
3
|
import { rspack as core_rspack } from "@rspack/core";
|
|
4
4
|
import node_util, { stripVTControlCharacters } from "node:util";
|
|
5
5
|
import node_process from "node:process";
|
|
6
6
|
import node_os, { constants as external_node_os_constants } from "node:os";
|
|
7
7
|
import node_tty from "node:tty";
|
|
8
|
-
import node_path, { dirname as external_node_path_dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, sep, win32 } from "node:path";
|
|
8
|
+
import node_path, { dirname as external_node_path_dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, resolve as external_node_path_resolve, sep, win32 } from "node:path";
|
|
9
9
|
import { builtinModules, createRequire, createRequire as __rspack_createRequire } from "node:module";
|
|
10
10
|
import node_fs, { existsSync } from "node:fs";
|
|
11
11
|
import { URL as external_node_url_URL, pathToFileURL, fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
12
12
|
import { isPromise, isRegExp } from "node:util/types";
|
|
13
|
+
import { readFile } from "node:fs/promises";
|
|
13
14
|
import node_zlib from "node:zlib";
|
|
14
15
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
15
16
|
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
@@ -384,8 +385,8 @@ __webpack_require__.add({
|
|
|
384
385
|
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
385
386
|
}
|
|
386
387
|
},
|
|
387
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
388
|
-
let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
388
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
389
|
+
let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js");
|
|
389
390
|
async function processResult(ctx, result) {
|
|
390
391
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
391
392
|
default: obj
|
|
@@ -458,8 +459,8 @@ __webpack_require__.add({
|
|
|
458
459
|
});
|
|
459
460
|
};
|
|
460
461
|
},
|
|
461
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
462
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
462
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
463
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js");
|
|
463
464
|
module.exports = async function options(config, file) {
|
|
464
465
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
465
466
|
config.parser = await req(config.parser, file);
|
|
@@ -479,8 +480,8 @@ __webpack_require__.add({
|
|
|
479
480
|
return config;
|
|
480
481
|
};
|
|
481
482
|
},
|
|
482
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
483
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
483
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
484
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js");
|
|
484
485
|
async function load(plugin, options, file) {
|
|
485
486
|
try {
|
|
486
487
|
if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
|
|
@@ -496,7 +497,7 @@ __webpack_require__.add({
|
|
|
496
497
|
}), list;
|
|
497
498
|
};
|
|
498
499
|
},
|
|
499
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
500
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
500
501
|
let tsx, jiti;
|
|
501
502
|
var __filename = __rspack_fileURLToPath(import.meta.url);
|
|
502
503
|
let { createRequire } = __webpack_require__("node:module?1bcb"), { pathToFileURL } = __webpack_require__("node:url?b4ec"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
@@ -601,6 +602,9 @@ __webpack_require__.add({
|
|
|
601
602
|
},
|
|
602
603
|
events (module) {
|
|
603
604
|
module.exports = __rspack_createRequire_require("node:events");
|
|
605
|
+
},
|
|
606
|
+
"supports-color" (module) {
|
|
607
|
+
module.exports = __rspack_createRequire_require("supports-color");
|
|
604
608
|
}
|
|
605
609
|
}), function checkNodeVersion() {
|
|
606
610
|
let { versions } = process;
|
|
@@ -1200,7 +1204,7 @@ var Command = class {
|
|
|
1200
1204
|
}), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
|
|
1201
1205
|
}
|
|
1202
1206
|
};
|
|
1203
|
-
let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform,
|
|
1207
|
+
let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirname = import.meta.dirname, STATIC_PATH = join(dirname, '../static'), CLIENT_PATH = join(dirname, 'client'), COMPILED_PATH = join(dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', LOCALHOST = 'localhost', ALL_INTERFACES_IPV4 = '0.0.0.0', DEFAULT_STACK_TRACE = 'summary', DEFAULT_WEB_BROWSERSLIST = [
|
|
1204
1208
|
'chrome >= 107',
|
|
1205
1209
|
'edge >= 107',
|
|
1206
1210
|
'firefox >= 104',
|
|
@@ -1211,7 +1215,7 @@ let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, ROOT_D
|
|
|
1211
1215
|
node: [
|
|
1212
1216
|
'node >= 20'
|
|
1213
1217
|
]
|
|
1214
|
-
}, JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/, SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, CSS_REGEX = /\.css$/, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, INLINE_QUERY_REGEX = /[?&]inline(?:&|=|$)/, URL_QUERY_REGEX = /[?&]url(?:&|=|$)/, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, PLUGIN_SWC_NAME = 'rsbuild:swc', PLUGIN_CSS_NAME = 'rsbuild:css', FONT_EXTENSIONS = [
|
|
1218
|
+
}, JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/, SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, CSS_REGEX = /\.css$/, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, INLINE_QUERY_REGEX = /[?&]inline(?:&|=|$)/, URL_QUERY_REGEX = /[?&]url(?:&|=|$)/, WORKER_QUERY_REGEX = /[?&]worker(?:&|=|$)/, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, PLUGIN_SWC_NAME = 'rsbuild:swc', PLUGIN_CSS_NAME = 'rsbuild:css', FONT_EXTENSIONS = [
|
|
1215
1219
|
'woff',
|
|
1216
1220
|
'woff2',
|
|
1217
1221
|
'eot',
|
|
@@ -2340,7 +2344,7 @@ async function helpers_hash(data) {
|
|
|
2340
2344
|
}
|
|
2341
2345
|
let compiler_isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers), getPublicPathFromCompiler = (compiler)=>{
|
|
2342
2346
|
let { publicPath } = compiler.options.output;
|
|
2343
|
-
return 'string' == typeof publicPath ? 'auto' === publicPath || '' === publicPath ? '' : publicPath.endsWith('/') ? publicPath : `${publicPath}/` :
|
|
2347
|
+
return 'string' == typeof publicPath ? 'auto' === publicPath || '' === publicPath ? '' : publicPath.endsWith('/') ? publicPath : `${publicPath}/` : "/";
|
|
2344
2348
|
}, applyToCompiler = (compiler, apply)=>{
|
|
2345
2349
|
compiler_isMultiCompiler(compiler) ? compiler.compilers.forEach(apply) : apply(compiler, 0);
|
|
2346
2350
|
}, addCompilationError = (compilation, message)=>{
|
|
@@ -2898,7 +2902,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2898
2902
|
]), normalizedConfig.dev = dev), normalizedConfig;
|
|
2899
2903
|
}, mergeRsbuildConfig = (...originalConfigs)=>{
|
|
2900
2904
|
let configs = originalConfigs.filter((config)=>void 0 !== config).map(normalizeConfigStructure);
|
|
2901
|
-
return 2 === configs.length ? merge(configs[0], configs[1]) :
|
|
2905
|
+
return 2 === configs.length ? merge(configs[0], configs[1]) : 0 === configs.length ? {} : configs.reduce((result, config)=>merge(result, config), {});
|
|
2902
2906
|
}, defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, createDefaultConfig = ()=>({
|
|
2903
2907
|
dev: {
|
|
2904
2908
|
hmr: !0,
|
|
@@ -2907,7 +2911,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2907
2911
|
stackTrace: DEFAULT_STACK_TRACE
|
|
2908
2912
|
},
|
|
2909
2913
|
watchFiles: [],
|
|
2910
|
-
assetPrefix:
|
|
2914
|
+
assetPrefix: "/",
|
|
2911
2915
|
writeToDisk: !1,
|
|
2912
2916
|
cliShortcuts: !1,
|
|
2913
2917
|
client: {
|
|
@@ -2942,7 +2946,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2942
2946
|
},
|
|
2943
2947
|
title: 'Rsbuild App',
|
|
2944
2948
|
inject: 'head',
|
|
2945
|
-
mountId:
|
|
2949
|
+
mountId: "root",
|
|
2946
2950
|
crossorigin: !1,
|
|
2947
2951
|
outputStructure: 'flat',
|
|
2948
2952
|
scriptLoading: 'defer',
|
|
@@ -2973,18 +2977,18 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2973
2977
|
target: 'web',
|
|
2974
2978
|
cleanDistPath: 'auto',
|
|
2975
2979
|
distPath: {
|
|
2976
|
-
root:
|
|
2980
|
+
root: "dist",
|
|
2977
2981
|
css: 'static/css',
|
|
2978
2982
|
svg: 'static/svg',
|
|
2979
2983
|
font: 'static/font',
|
|
2980
|
-
html:
|
|
2984
|
+
html: "./",
|
|
2981
2985
|
wasm: 'static/wasm',
|
|
2982
2986
|
image: 'static/image',
|
|
2983
2987
|
media: 'static/media',
|
|
2984
2988
|
assets: 'static/assets',
|
|
2985
|
-
favicon:
|
|
2989
|
+
favicon: "./"
|
|
2986
2990
|
},
|
|
2987
|
-
assetPrefix:
|
|
2991
|
+
assetPrefix: "/",
|
|
2988
2992
|
filename: {},
|
|
2989
2993
|
charset: 'utf8',
|
|
2990
2994
|
polyfill: 'off',
|
|
@@ -3085,9 +3089,9 @@ function exitHook(onExit) {
|
|
|
3085
3089
|
let addTrailingSlash = (s)=>s.endsWith('/') ? s : `${s}/`, isURL = (str)=>str.startsWith('http') || str.startsWith('//'), urlJoin = (base, path)=>{
|
|
3086
3090
|
let [urlProtocol, baseUrl] = base.split('://');
|
|
3087
3091
|
return `${urlProtocol}://${posix.join(baseUrl, path)}`;
|
|
3088
|
-
}, ensureAssetPrefix = (url, assetPrefix =
|
|
3092
|
+
}, ensureAssetPrefix = (url, assetPrefix = "/")=>url.startsWith('//') || external_node_url_URL.canParse(url) || 'auto' === assetPrefix || 'function' == typeof assetPrefix ? url : assetPrefix.startsWith('http') ? urlJoin(assetPrefix, url) : assetPrefix.startsWith('//') ? urlJoin(`https:${assetPrefix}`, url).replace('https:', '') : posix.join(assetPrefix, url), formatPublicPath = (publicPath, withSlash = !0)=>'auto' === publicPath || '' === publicPath ? publicPath : withSlash ? addTrailingSlash(publicPath) : publicPath.replace(/\/+$/, ''), getPublicPathFromChain = (chain, withSlash = !0)=>{
|
|
3089
3093
|
let publicPath = chain.output.get('publicPath');
|
|
3090
|
-
return 'string' == typeof publicPath ? formatPublicPath(publicPath, withSlash) : formatPublicPath(
|
|
3094
|
+
return 'string' == typeof publicPath ? formatPublicPath(publicPath, withSlash) : formatPublicPath("/", withSlash);
|
|
3091
3095
|
};
|
|
3092
3096
|
function validatePlugin(plugin) {
|
|
3093
3097
|
let type = typeof plugin;
|
|
@@ -3412,7 +3416,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
3412
3416
|
});
|
|
3413
3417
|
}
|
|
3414
3418
|
function getAbsoluteDistPath(cwd, config) {
|
|
3415
|
-
return ensureAbsolutePath(cwd, config.output?.distPath?.root ??
|
|
3419
|
+
return ensureAbsolutePath(cwd, config.output?.distPath?.root ?? "dist");
|
|
3416
3420
|
}
|
|
3417
3421
|
let browsersListCache = new Map();
|
|
3418
3422
|
function getBrowserslist(path) {
|
|
@@ -3481,7 +3485,7 @@ function createPublicContext(context) {
|
|
|
3481
3485
|
async function createContext(options, userConfig, logger) {
|
|
3482
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;
|
|
3483
3487
|
return {
|
|
3484
|
-
version: "2.0.
|
|
3488
|
+
version: "2.0.8",
|
|
3485
3489
|
rootPath,
|
|
3486
3490
|
distPath: '',
|
|
3487
3491
|
cachePath,
|
|
@@ -3596,28 +3600,28 @@ async function inspectConfig_inspectConfig({ context, pluginManager, bundlerConf
|
|
|
3596
3600
|
};
|
|
3597
3601
|
}
|
|
3598
3602
|
let dist_isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
3599
|
-
function reduceConfigs({ initial, config, mergeFn = Object.assign }) {
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
initial,
|
|
3609
|
-
config,
|
|
3610
|
-
ctx,
|
|
3603
|
+
async function reduceConfigs({ initial, config, mergeFn = Object.assign }) {
|
|
3604
|
+
if (null == config) return initial;
|
|
3605
|
+
if (dist_isPlainObject(config)) return dist_isPlainObject(initial) ? mergeFn(initial, config) : config;
|
|
3606
|
+
if ('function' == typeof config) return await config(initial) ?? initial;
|
|
3607
|
+
if (Array.isArray(config)) {
|
|
3608
|
+
let result = initial;
|
|
3609
|
+
for (let item of config)result = await reduceConfigs({
|
|
3610
|
+
initial: result,
|
|
3611
|
+
config: item,
|
|
3611
3612
|
mergeFn
|
|
3612
|
-
})
|
|
3613
|
+
});
|
|
3614
|
+
return result;
|
|
3615
|
+
}
|
|
3616
|
+
return config ?? initial;
|
|
3613
3617
|
}
|
|
3614
|
-
async function
|
|
3618
|
+
async function reduceConfigsWithContext({ initial, config, ctx, mergeFn = Object.assign }) {
|
|
3615
3619
|
if (null == config) return initial;
|
|
3616
3620
|
if (dist_isPlainObject(config)) return dist_isPlainObject(initial) ? mergeFn(initial, config) : config;
|
|
3617
3621
|
if ('function' == typeof config) return await config(initial, ctx) ?? initial;
|
|
3618
3622
|
if (Array.isArray(config)) {
|
|
3619
3623
|
let result = initial;
|
|
3620
|
-
for (let item of config)result = await
|
|
3624
|
+
for (let item of config)result = await reduceConfigsWithContext({
|
|
3621
3625
|
initial: result,
|
|
3622
3626
|
config: item,
|
|
3623
3627
|
ctx,
|
|
@@ -3627,16 +3631,24 @@ async function reduceConfigsAsyncWithContext({ initial, config, ctx, mergeFn = O
|
|
|
3627
3631
|
}
|
|
3628
3632
|
return config ?? initial;
|
|
3629
3633
|
}
|
|
3630
|
-
function
|
|
3631
|
-
|
|
3634
|
+
async function reduceConfigsWithMergedContext({ initial, config, ctx, mergeFn = Object.assign }) {
|
|
3635
|
+
if (null == config) return initial;
|
|
3636
|
+
if (dist_isPlainObject(config)) return dist_isPlainObject(initial) ? mergeFn(initial, config) : config;
|
|
3637
|
+
if ('function' == typeof config) return await config({
|
|
3632
3638
|
value: initial,
|
|
3633
3639
|
...ctx
|
|
3634
|
-
}) ?? initial
|
|
3635
|
-
|
|
3636
|
-
|
|
3640
|
+
}) ?? initial;
|
|
3641
|
+
if (Array.isArray(config)) {
|
|
3642
|
+
let result = initial;
|
|
3643
|
+
for (let item of config)result = await reduceConfigsWithMergedContext({
|
|
3644
|
+
initial: result,
|
|
3645
|
+
config: item,
|
|
3637
3646
|
ctx,
|
|
3638
3647
|
mergeFn
|
|
3639
|
-
})
|
|
3648
|
+
});
|
|
3649
|
+
return result;
|
|
3650
|
+
}
|
|
3651
|
+
return config ?? initial;
|
|
3640
3652
|
}
|
|
3641
3653
|
function mergeTo(a, b, customizer) {
|
|
3642
3654
|
let ret = {};
|
|
@@ -3749,6 +3761,7 @@ let configChain_CHAIN_ID = {
|
|
|
3749
3761
|
},
|
|
3750
3762
|
ONE_OF: {
|
|
3751
3763
|
JS_MAIN: 'js',
|
|
3764
|
+
JS_WORKER: 'js-worker',
|
|
3752
3765
|
JS_RAW: 'js-raw',
|
|
3753
3766
|
CSS_MAIN: 'css',
|
|
3754
3767
|
CSS_RAW: 'css-raw',
|
|
@@ -3771,6 +3784,7 @@ let configChain_CHAIN_ID = {
|
|
|
3771
3784
|
URL: 'url',
|
|
3772
3785
|
VUE: 'vue',
|
|
3773
3786
|
SWC: 'swc',
|
|
3787
|
+
WORKER_QUERY: 'worker-query',
|
|
3774
3788
|
SVGR: 'svgr',
|
|
3775
3789
|
BABEL: 'babel',
|
|
3776
3790
|
STYLE: 'style-loader',
|
|
@@ -3819,7 +3833,7 @@ async function modifyRspackConfig(context, rspackConfig, chainUtils) {
|
|
|
3819
3833
|
}
|
|
3820
3834
|
}), utils.environment.config.tools?.rspack) {
|
|
3821
3835
|
let toolsRspackConfig = utils.environment.config.tools.rspack;
|
|
3822
|
-
currentConfig = await
|
|
3836
|
+
currentConfig = await reduceConfigsWithContext({
|
|
3823
3837
|
initial: currentConfig,
|
|
3824
3838
|
config: toolsRspackConfig,
|
|
3825
3839
|
ctx: utils,
|
|
@@ -3955,7 +3969,10 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3955
3969
|
let nodeEnv = process.env.NODE_ENV || '';
|
|
3956
3970
|
return 'production' === nodeEnv || 'development' === nodeEnv ? nodeEnv : 'none';
|
|
3957
3971
|
})(), mergeRsbuildConfig(defaultConfig, config)), environments = {}, mergedEnvironments = ((normalizedConfig, rootPath, specifiedEnvironments)=>{
|
|
3958
|
-
let defaultEntry, { environments, dev, server: _server, ...baseConfig } = normalizedConfig, isEnvironmentEnabled = (name)=>!specifiedEnvironments || specifiedEnvironments.includes(name),
|
|
3972
|
+
let defaultEntry, { environments, dev, server: _server, ...baseConfig } = normalizedConfig, isEnvironmentEnabled = (name)=>!specifiedEnvironments || specifiedEnvironments.includes(name), baseEnvironmentConfig = {
|
|
3973
|
+
...baseConfig,
|
|
3974
|
+
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
3975
|
+
}, applyEnvironmentDefaultConfig = (config)=>{
|
|
3959
3976
|
config.source.entry && 0 !== Object.keys(config.source.entry).length || (config.source.entry = (defaultEntry || (defaultEntry = getDefaultEntry(rootPath)), defaultEntry));
|
|
3960
3977
|
let isServer = 'node' === config.output.target;
|
|
3961
3978
|
return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' : 'static/js'), void 0 === config.output.module && (config.output.module = isServer), void 0 === config.output.minify && (config.output.minify = !isServer), config;
|
|
@@ -3963,12 +3980,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3963
3980
|
if (environments && Object.keys(environments).length > 0) {
|
|
3964
3981
|
let resolvedEnvironments = Object.fromEntries(Object.entries(environments).filter(([name])=>isEnvironmentEnabled(name)).map(([name, config])=>[
|
|
3965
3982
|
name,
|
|
3966
|
-
applyEnvironmentDefaultConfig(
|
|
3967
|
-
...mergeRsbuildConfig({
|
|
3968
|
-
...baseConfig,
|
|
3969
|
-
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
3970
|
-
}, config)
|
|
3971
|
-
})
|
|
3983
|
+
applyEnvironmentDefaultConfig(mergeRsbuildConfig(baseEnvironmentConfig, config))
|
|
3972
3984
|
]));
|
|
3973
3985
|
if (0 === Object.keys(resolvedEnvironments).length) throw createEnvironmentNotFoundError(specifiedEnvironments);
|
|
3974
3986
|
return resolvedEnvironments;
|
|
@@ -3976,10 +3988,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3976
3988
|
let defaultEnvironmentName = baseConfig.output.target.replace(/[-_](\w)/g, (_, c)=>c.toUpperCase());
|
|
3977
3989
|
if (!isEnvironmentEnabled(defaultEnvironmentName)) throw createEnvironmentNotFoundError(specifiedEnvironments);
|
|
3978
3990
|
return {
|
|
3979
|
-
[defaultEnvironmentName]: applyEnvironmentDefaultConfig(
|
|
3980
|
-
...baseConfig,
|
|
3981
|
-
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
3982
|
-
})
|
|
3991
|
+
[defaultEnvironmentName]: applyEnvironmentDefaultConfig(baseEnvironmentConfig)
|
|
3983
3992
|
};
|
|
3984
3993
|
})(normalizedBaseConfig, context.rootPath, context.specifiedEnvironments), tsconfigPaths = new Set();
|
|
3985
3994
|
for (let [name, config] of Object.entries(mergedEnvironments)){
|
|
@@ -4467,9 +4476,9 @@ function parseMinifyOptions(config) {
|
|
|
4467
4476
|
cssOptions: minify.cssOptions
|
|
4468
4477
|
};
|
|
4469
4478
|
}
|
|
4470
|
-
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
4479
|
+
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/index.js");
|
|
4471
4480
|
var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
|
|
4472
|
-
function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
4481
|
+
async function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
4473
4482
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
4474
4483
|
targets,
|
|
4475
4484
|
errorRecovery: !0
|
|
@@ -4500,12 +4509,12 @@ async function loadUserPostcssrc(root, postcssrcCache) {
|
|
|
4500
4509
|
let getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
|
|
4501
4510
|
let extraPlugins = [], userOptions = await loadUserPostcssrc(root, postcssrcCache);
|
|
4502
4511
|
userOptions.plugins ||= [];
|
|
4503
|
-
let
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4512
|
+
let defaultOptions = {
|
|
4513
|
+
implementation: join(COMPILED_PATH, 'postcss', 'index.js'),
|
|
4514
|
+
postcssOptions: userOptions,
|
|
4515
|
+
sourceMap: getCSSSourceMap(config)
|
|
4516
|
+
}, finalOptions = await reduceConfigsWithContext({
|
|
4517
|
+
initial: defaultOptions,
|
|
4509
4518
|
config: config.tools.postcss,
|
|
4510
4519
|
ctx: {
|
|
4511
4520
|
addPlugins (plugins, options = {}) {
|
|
@@ -4535,6 +4544,36 @@ let getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
|
|
|
4535
4544
|
};
|
|
4536
4545
|
}
|
|
4537
4546
|
return finalOptions.postcssOptions = updatePostcssOptions(postcssOptions), finalOptions;
|
|
4547
|
+
}, getCSSLoaderOptions = async ({ config, localIdentName, emitCss })=>{
|
|
4548
|
+
let { cssModules } = config.output, defaultOptions = {
|
|
4549
|
+
modules: {
|
|
4550
|
+
...cssModules,
|
|
4551
|
+
localIdentName
|
|
4552
|
+
},
|
|
4553
|
+
sourceMap: getCSSSourceMap(config)
|
|
4554
|
+
};
|
|
4555
|
+
return ((options, exportOnlyLocals)=>{
|
|
4556
|
+
if (options.modules && exportOnlyLocals) {
|
|
4557
|
+
let { modules } = options;
|
|
4558
|
+
return modules = !0 === modules ? {
|
|
4559
|
+
exportOnlyLocals: !0
|
|
4560
|
+
} : 'string' == typeof modules ? {
|
|
4561
|
+
mode: modules,
|
|
4562
|
+
exportOnlyLocals: !0
|
|
4563
|
+
} : {
|
|
4564
|
+
...modules,
|
|
4565
|
+
exportOnlyLocals: !0
|
|
4566
|
+
}, {
|
|
4567
|
+
...options,
|
|
4568
|
+
modules
|
|
4569
|
+
};
|
|
4570
|
+
}
|
|
4571
|
+
return options;
|
|
4572
|
+
})(await reduceConfigs({
|
|
4573
|
+
initial: defaultOptions,
|
|
4574
|
+
config: config.tools.cssLoader,
|
|
4575
|
+
mergeFn: cjs_0_default()
|
|
4576
|
+
}), !emitCss);
|
|
4538
4577
|
};
|
|
4539
4578
|
function checkProcessEnvSecurity(define, logger) {
|
|
4540
4579
|
let value = define['process.env'];
|
|
@@ -4548,13 +4587,77 @@ function checkProcessEnvSecurity(define, logger) {
|
|
|
4548
4587
|
check(JSON.parse(value));
|
|
4549
4588
|
} catch {}
|
|
4550
4589
|
}
|
|
4590
|
+
let readPackageJsonByPath = async (pkgJsonPath)=>{
|
|
4591
|
+
if (await isFileExists(pkgJsonPath)) try {
|
|
4592
|
+
return JSON.parse(await readFile(pkgJsonPath, 'utf8'));
|
|
4593
|
+
} catch {
|
|
4594
|
+
return;
|
|
4595
|
+
}
|
|
4596
|
+
}, dependencyTypes = [
|
|
4597
|
+
'dependencies',
|
|
4598
|
+
'peerDependencies',
|
|
4599
|
+
'devDependencies',
|
|
4600
|
+
'optionalDependencies'
|
|
4601
|
+
], defaultAutoExternalOptions = {
|
|
4602
|
+
dependencies: !0,
|
|
4603
|
+
optionalDependencies: !0,
|
|
4604
|
+
peerDependencies: !0,
|
|
4605
|
+
devDependencies: !1
|
|
4606
|
+
}, resolveAutoExternalOptions = (autoExternal)=>{
|
|
4607
|
+
if (void 0 === autoExternal || !1 === autoExternal) return;
|
|
4608
|
+
let externalOptions = {
|
|
4609
|
+
...defaultAutoExternalOptions,
|
|
4610
|
+
...!0 === autoExternal ? {} : autoExternal
|
|
4611
|
+
};
|
|
4612
|
+
return dependencyTypes.some((type)=>externalOptions[type]) ? externalOptions : void 0;
|
|
4613
|
+
}, readPackageJsonList = async (paths, cache)=>{
|
|
4614
|
+
var packageJsonList = (await Promise.all(paths.map(async (path)=>(cache.has(path) || cache.set(path, await readPackageJsonByPath(path)), cache.get(path))))).filter((pkgJson)=>!!pkgJson);
|
|
4615
|
+
return packageJsonList.length ? dependencyTypes.reduce((merged, type)=>{
|
|
4616
|
+
for (let pkgJson of packageJsonList){
|
|
4617
|
+
let deps = pkgJson[type];
|
|
4618
|
+
isPlainObject(deps) && (merged[type] = {
|
|
4619
|
+
...merged[type],
|
|
4620
|
+
...deps
|
|
4621
|
+
});
|
|
4622
|
+
}
|
|
4623
|
+
return merged;
|
|
4624
|
+
}, {}) : void 0;
|
|
4625
|
+
};
|
|
4551
4626
|
function pluginExternals() {
|
|
4552
4627
|
return {
|
|
4553
4628
|
name: 'rsbuild:externals',
|
|
4554
4629
|
setup (api) {
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
externals
|
|
4630
|
+
let packageJsonCache = new Map(), hasWarnedReadPackageJsonFailed = !1;
|
|
4631
|
+
api.modifyBundlerChain(async (chain, { environment })=>{
|
|
4632
|
+
let pkgJson, { autoExternal, externals } = environment.config.output, externalOptions = resolveAutoExternalOptions(autoExternal);
|
|
4633
|
+
if (externalOptions) {
|
|
4634
|
+
let rootPath, packageJsonPaths = (rootPath = api.context.rootPath, helpers_castArray(externalOptions.packageJson ?? 'package.json').map((path)=>external_node_path_resolve(rootPath, path)));
|
|
4635
|
+
pkgJson = await readPackageJsonList(packageJsonPaths, packageJsonCache);
|
|
4636
|
+
}
|
|
4637
|
+
!externalOptions || pkgJson || hasWarnedReadPackageJsonFailed || (api.logger.warn('The `output.autoExternal` configuration will not be applied because reading package.json failed.'), hasWarnedReadPackageJsonFailed = !0);
|
|
4638
|
+
let autoExternalRules = ((options)=>{
|
|
4639
|
+
let { autoExternal, pkgJson, userExternals } = options, externalOptions = resolveAutoExternalOptions(autoExternal);
|
|
4640
|
+
if (!externalOptions || !pkgJson) return;
|
|
4641
|
+
let userExternalKeys = isPlainObject(userExternals) ? Object.keys(userExternals) : [], excludeConditions = externalOptions.exclude ? helpers_castArray(externalOptions.exclude) : void 0, uniqueExternals = Array.from(new Set(dependencyTypes.reduce((prev, type)=>{
|
|
4642
|
+
if (externalOptions[type]) {
|
|
4643
|
+
let deps = pkgJson[type];
|
|
4644
|
+
return isPlainObject(deps) ? prev.concat(Object.keys(deps)) : prev;
|
|
4645
|
+
}
|
|
4646
|
+
return prev;
|
|
4647
|
+
}, []).filter((name)=>!userExternalKeys.includes(name) && (!excludeConditions || !excludeConditions.some((condition)=>'string' == typeof condition ? condition === name : condition instanceof RegExp && (condition.global || condition.sticky ? new RegExp(condition) : condition).test(name))))));
|
|
4648
|
+
if (uniqueExternals.length) return uniqueExternals.map((dep)=>RegExp(`^${dep.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')}(?:$|[/\\\\])`));
|
|
4649
|
+
})({
|
|
4650
|
+
autoExternal,
|
|
4651
|
+
pkgJson,
|
|
4652
|
+
userExternals: externals
|
|
4653
|
+
}), mergedExternals = autoExternalRules?.length ? externals ? Array.isArray(externals) ? [
|
|
4654
|
+
...externals,
|
|
4655
|
+
...autoExternalRules
|
|
4656
|
+
] : [
|
|
4657
|
+
externals,
|
|
4658
|
+
...autoExternalRules
|
|
4659
|
+
] : autoExternalRules : externals;
|
|
4660
|
+
mergedExternals && chain.externals(mergedExternals);
|
|
4558
4661
|
}), api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
|
|
4559
4662
|
for (let config of bundlerConfigs)(Array.isArray(config.target) ? config.target.includes('webworker') : 'webworker' === config.target) && config.externals && delete config.externals;
|
|
4560
4663
|
});
|
|
@@ -4947,7 +5050,7 @@ class RsbuildHtmlPlugin {
|
|
|
4947
5050
|
}
|
|
4948
5051
|
}
|
|
4949
5052
|
function getTitle(entryName, config) {
|
|
4950
|
-
return
|
|
5053
|
+
return reduceConfigsWithMergedContext({
|
|
4951
5054
|
initial: '',
|
|
4952
5055
|
config: config.html.title,
|
|
4953
5056
|
ctx: {
|
|
@@ -4956,7 +5059,7 @@ function getTitle(entryName, config) {
|
|
|
4956
5059
|
});
|
|
4957
5060
|
}
|
|
4958
5061
|
function getInject(entryName, config) {
|
|
4959
|
-
return
|
|
5062
|
+
return reduceConfigsWithMergedContext({
|
|
4960
5063
|
initial: 'head',
|
|
4961
5064
|
config: config.html.inject,
|
|
4962
5065
|
ctx: {
|
|
@@ -4966,7 +5069,7 @@ function getInject(entryName, config) {
|
|
|
4966
5069
|
}
|
|
4967
5070
|
let existTemplatePath = new Set();
|
|
4968
5071
|
async function getTemplate(entryName, config, rootPath) {
|
|
4969
|
-
let templatePath =
|
|
5072
|
+
let templatePath = await reduceConfigsWithMergedContext({
|
|
4970
5073
|
initial: '',
|
|
4971
5074
|
config: config.html.template,
|
|
4972
5075
|
ctx: {
|
|
@@ -4992,7 +5095,7 @@ async function getTemplate(entryName, config, rootPath) {
|
|
|
4992
5095
|
};
|
|
4993
5096
|
}
|
|
4994
5097
|
function getFavicon(entryName, config) {
|
|
4995
|
-
return
|
|
5098
|
+
return reduceConfigsWithMergedContext({
|
|
4996
5099
|
initial: '',
|
|
4997
5100
|
config: config.html.favicon,
|
|
4998
5101
|
ctx: {
|
|
@@ -5000,8 +5103,8 @@ function getFavicon(entryName, config) {
|
|
|
5000
5103
|
}
|
|
5001
5104
|
});
|
|
5002
5105
|
}
|
|
5003
|
-
function getMetaTags(entryName, config, templateContent) {
|
|
5004
|
-
let metaTags =
|
|
5106
|
+
async function getMetaTags(entryName, config, templateContent) {
|
|
5107
|
+
let metaTags = await reduceConfigsWithMergedContext({
|
|
5005
5108
|
initial: {},
|
|
5006
5109
|
config: config.html.meta,
|
|
5007
5110
|
ctx: {
|
|
@@ -5011,7 +5114,7 @@ function getMetaTags(entryName, config, templateContent) {
|
|
|
5011
5114
|
return templateContent && metaTags.charset && /<meta[^>]+charset=["'][^>]*>/i.test(templateContent) && delete metaTags.charset, metaTags;
|
|
5012
5115
|
}
|
|
5013
5116
|
function getTemplateParameters(entryName, config, assetPrefix) {
|
|
5014
|
-
return (compilation, assets, assetTags, pluginOptions)=>{
|
|
5117
|
+
return async (compilation, assets, assetTags, pluginOptions)=>{
|
|
5015
5118
|
let { mountId, templateParameters } = config.html, rspackConfig = compilation.options;
|
|
5016
5119
|
return reduceConfigsWithContext({
|
|
5017
5120
|
initial: {
|
|
@@ -5070,10 +5173,9 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
|
|
|
5070
5173
|
if (prefix?.startsWith('./') && (prefix = prefix.replace('./', '')), !prefix) return '/';
|
|
5071
5174
|
let hasLeadingSlash = prefix.startsWith('/'), hasTailSlash = prefix.endsWith('/');
|
|
5072
5175
|
return `${hasLeadingSlash ? '' : '/'}${prefix}${hasTailSlash ? '' : '/'}`;
|
|
5073
|
-
},
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
return path.startsWith(trailingSlashBase) ? path.slice(trailingSlashBase.length - 1) : path;
|
|
5176
|
+
}, joinUrlPath = (basePath, pathname)=>'' === basePath ? pathname : '' === pathname ? basePath : addTrailingSlash(basePath) + pathname.replace(/^\/+/, ''), removeBasePath = (url, base)=>{
|
|
5177
|
+
let basePath = base.replace(/\/+$/, '');
|
|
5178
|
+
return '' === basePath ? url : url === basePath ? '/' : url.startsWith(`${basePath}/`) ? url.slice(basePath.length) : url;
|
|
5077
5179
|
}, getRoutes = (context)=>{
|
|
5078
5180
|
let environmentWithHtml = context.environmentList.filter((item)=>Object.keys(item.htmlPaths).length > 0);
|
|
5079
5181
|
if (0 === environmentWithHtml.length) return [];
|
|
@@ -5083,7 +5185,7 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
|
|
|
5083
5185
|
return prev.concat(...routes);
|
|
5084
5186
|
}, []);
|
|
5085
5187
|
}, formatRoutes = (entry, base, distPathPrefix, outputStructure)=>{
|
|
5086
|
-
let prefix =
|
|
5188
|
+
let prefix = joinUrlPath(base, formatPrefix(distPathPrefix));
|
|
5087
5189
|
return Object.keys(entry).map((entryName)=>({
|
|
5088
5190
|
entryName,
|
|
5089
5191
|
pathname: prefix + ('index' === entryName && 'nested' !== outputStructure ? '' : entryName)
|
|
@@ -5375,7 +5477,7 @@ function pluginModuleFederation() {
|
|
|
5375
5477
|
};
|
|
5376
5478
|
}
|
|
5377
5479
|
function getPublicPath({ isDev, config, context }) {
|
|
5378
|
-
let { dev, output, server } = config, publicPath =
|
|
5480
|
+
let { dev, output, server } = config, publicPath = "/";
|
|
5379
5481
|
if (isDev) {
|
|
5380
5482
|
if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
5381
5483
|
else if (dev.assetPrefix) {
|
|
@@ -5386,8 +5488,8 @@ function getPublicPath({ isDev, config, context }) {
|
|
|
5386
5488
|
let defaultPort = server.port ?? 3000;
|
|
5387
5489
|
return formatPublicPath(replacePortPlaceholder(publicPath, isDev ? context.devServer?.port ?? defaultPort : defaultPort));
|
|
5388
5490
|
}
|
|
5389
|
-
function applyAlias({ chain, config, rootPath, logger }) {
|
|
5390
|
-
let mergedAlias = reduceConfigs({
|
|
5491
|
+
async function applyAlias({ chain, config, rootPath, logger }) {
|
|
5492
|
+
let mergedAlias = await reduceConfigs({
|
|
5391
5493
|
initial: {},
|
|
5392
5494
|
config: config.resolve.alias
|
|
5393
5495
|
});
|
|
@@ -5528,6 +5630,9 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
5528
5630
|
...option
|
|
5529
5631
|
}
|
|
5530
5632
|
}));
|
|
5633
|
+
function isTerminalTraceOutput(output) {
|
|
5634
|
+
return 'stdout' === output || 'stderr' === output;
|
|
5635
|
+
}
|
|
5531
5636
|
function resolveLayer(value) {
|
|
5532
5637
|
return "OVERVIEW" === value ? 'info' : "ALL" === value ? 'trace' : value;
|
|
5533
5638
|
}
|
|
@@ -5539,12 +5644,11 @@ async function ensureFileDir(outputFilePath) {
|
|
|
5539
5644
|
}
|
|
5540
5645
|
async function applyProfile(root, filterValue, traceLayer, traceOutput) {
|
|
5541
5646
|
if ('perfetto' !== traceLayer && 'logger' !== traceLayer) throw Error(`unsupported trace layer: ${traceLayer}`);
|
|
5542
|
-
if (
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
}
|
|
5647
|
+
if (traceOutput && 'perfetto' === traceLayer && isTerminalTraceOutput(traceOutput)) throw Error('RSPACK_TRACE_OUTPUT=stdout|stderr is only supported for the logger trace layer. The perfetto trace layer requires a file path.');
|
|
5648
|
+
let timestamp = Date.now(), defaultOutputDir = node_path.join(root, `.rspack-profile-${timestamp}-${process.pid}`);
|
|
5649
|
+
traceOutput ? isTerminalTraceOutput(traceOutput) || (traceOutput = node_path.resolve(defaultOutputDir, traceOutput)) : traceOutput = node_path.resolve(defaultOutputDir, 'perfetto' === traceLayer ? 'rspack.pftrace' : 'rspack.log');
|
|
5546
5650
|
let filter = resolveLayer(filterValue);
|
|
5547
|
-
return
|
|
5651
|
+
return isTerminalTraceOutput(traceOutput) || await ensureFileDir(traceOutput), await core_rspack.experiments.globalTrace.register(filter, traceLayer, traceOutput), traceOutput;
|
|
5548
5652
|
}
|
|
5549
5653
|
function getForceSplittingGroups(forceSplitting, strategy) {
|
|
5550
5654
|
let cacheGroups = {};
|
|
@@ -6094,7 +6198,7 @@ function createMiddleware(context, ready, outputFileSystem) {
|
|
|
6094
6198
|
}
|
|
6095
6199
|
async function setupOutputFileSystem(writeToDisk, compilers) {
|
|
6096
6200
|
if (!0 !== writeToDisk) {
|
|
6097
|
-
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.57.
|
|
6201
|
+
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.57.2/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
|
|
6098
6202
|
for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
|
|
6099
6203
|
}
|
|
6100
6204
|
let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
|
|
@@ -6889,13 +6993,14 @@ let faviconFallbackMiddleware = (req, res, next)=>{
|
|
|
6889
6993
|
let { accept } = req.headers;
|
|
6890
6994
|
return 'string' == typeof accept && (accept.includes('text/html') || accept.includes('*/*'));
|
|
6891
6995
|
}, postfixRE = /[?#].*$/, getBaseUrlMiddleware = ({ base })=>function baseUrlMiddleware(req, res, next) {
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6996
|
+
var pathname;
|
|
6997
|
+
let basePath, url = req.url, pathname1 = url.replace(postfixRE, '');
|
|
6998
|
+
if (pathname = pathname1, '' === (basePath = base.replace(/\/+$/, '')) || pathname === basePath || pathname.startsWith(`${basePath}/`)) {
|
|
6999
|
+
req.url = removeBasePath(url, base), next();
|
|
6895
7000
|
return;
|
|
6896
7001
|
}
|
|
6897
|
-
let redirectPath = addTrailingSlash(url) !== base ?
|
|
6898
|
-
if ('/' ===
|
|
7002
|
+
let redirectPath = addTrailingSlash(url) !== base ? joinUrlPath(base, url) : base;
|
|
7003
|
+
if ('/' === pathname1 || '/index.html' === pathname1) {
|
|
6899
7004
|
res.writeHead(302, {
|
|
6900
7005
|
Location: redirectPath
|
|
6901
7006
|
}), res.end();
|
|
@@ -7484,7 +7589,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
|
|
|
7484
7589
|
let publicPaths = compiler_isMultiCompiler(compiler) ? compiler.compilers.map(getPublicPathFromCompiler) : [
|
|
7485
7590
|
getPublicPathFromCompiler(compiler)
|
|
7486
7591
|
], { base } = config.server;
|
|
7487
|
-
context.publicPathnames = publicPaths.map(getPathnameFromUrl).map((prefix)=>base && '/' !== base ?
|
|
7592
|
+
context.publicPathnames = publicPaths.map(getPathnameFromUrl).map((prefix)=>base && '/' !== base ? removeBasePath(prefix, base) : prefix), compiler?.hooks.watchRun.tap('rsbuild:watchRun', ()=>{
|
|
7488
7593
|
lastStats && (waitLastCompileDoneResolve && (waitLastCompileDoneResolve(), waitLastCompileDoneResolve = null), waitLastCompileDone = new Promise((resolve)=>{
|
|
7489
7594
|
waitLastCompileDoneResolve = resolve;
|
|
7490
7595
|
}));
|
|
@@ -7946,7 +8051,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7946
8051
|
setup (api) {
|
|
7947
8052
|
api.modifyBundlerChain({
|
|
7948
8053
|
order: 'pre',
|
|
7949
|
-
handler: (chain, { environment, CHAIN_ID })=>{
|
|
8054
|
+
handler: async (chain, { environment, CHAIN_ID })=>{
|
|
7950
8055
|
let { config, tsconfigPath } = environment, { extensions, conditionNames, mainFields } = config.resolve;
|
|
7951
8056
|
chain.resolve.extensions.merge([
|
|
7952
8057
|
...extensions
|
|
@@ -7961,7 +8066,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7961
8066
|
]).set('.jsx', [
|
|
7962
8067
|
'.jsx',
|
|
7963
8068
|
'.tsx'
|
|
7964
|
-
]), applyAlias({
|
|
8069
|
+
]), await applyAlias({
|
|
7965
8070
|
chain,
|
|
7966
8071
|
config,
|
|
7967
8072
|
rootPath: api.context.rootPath,
|
|
@@ -8103,8 +8208,8 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8103
8208
|
let { config, htmlPaths } = environment;
|
|
8104
8209
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
8105
8210
|
let assetPrefix = getPublicPathFromChain(chain, !1), entries = chain.entryPoints.entries() || {}, entryNames = Object.keys(entries).filter((entryName)=>!!htmlPaths[entryName]), extraDataMap = new Map(), finalOptions = await Promise.all(entryNames.map(async (entryName)=>{
|
|
8106
|
-
let entryValue = entries[entryName].values(), chunks = getChunks(entryName, entryValue), inject = getInject(entryName, config), filename = htmlPaths[entryName], { templatePath, templateContent } = await getTemplate(entryName, config, api.context.rootPath), templateParameters = getTemplateParameters(entryName, config, assetPrefix), pluginOptions = {
|
|
8107
|
-
meta: getMetaTags(entryName, config, templateContent),
|
|
8211
|
+
let entryValue = entries[entryName].values(), chunks = getChunks(entryName, entryValue), inject = await getInject(entryName, config), filename = htmlPaths[entryName], { templatePath, templateContent } = await getTemplate(entryName, config, api.context.rootPath), templateParameters = getTemplateParameters(entryName, config, assetPrefix), pluginOptions = {
|
|
8212
|
+
meta: await getMetaTags(entryName, config, templateContent),
|
|
8108
8213
|
chunks,
|
|
8109
8214
|
inject,
|
|
8110
8215
|
filename,
|
|
@@ -8129,8 +8234,8 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8129
8234
|
tags
|
|
8130
8235
|
};
|
|
8131
8236
|
})(environment.config);
|
|
8132
|
-
tagConfig && (extraData.tagConfig = tagConfig), pluginOptions.title = getTitle(entryName, config);
|
|
8133
|
-
let favicon = getFavicon(entryName, config) || (()=>{
|
|
8237
|
+
tagConfig && (extraData.tagConfig = tagConfig), pluginOptions.title = await getTitle(entryName, config);
|
|
8238
|
+
let favicon = await getFavicon(entryName, config) || (()=>{
|
|
8134
8239
|
if (defaultFavicon) return defaultFavicon;
|
|
8135
8240
|
let { publicDir } = api.getNormalizedConfig().server, extensions = [
|
|
8136
8241
|
'ico',
|
|
@@ -8142,7 +8247,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8142
8247
|
return faviconPath && (defaultFavicon = faviconPath), defaultFavicon;
|
|
8143
8248
|
})();
|
|
8144
8249
|
favicon && (extraData.favicon = favicon);
|
|
8145
|
-
let finalOptions = reduceConfigsWithContext({
|
|
8250
|
+
let finalOptions = await reduceConfigsWithContext({
|
|
8146
8251
|
initial: pluginOptions,
|
|
8147
8252
|
config: 'boolean' == typeof config.tools.htmlPlugin ? {} : config.tools.htmlPlugin,
|
|
8148
8253
|
ctx: {
|
|
@@ -8347,6 +8452,7 @@ try {
|
|
|
8347
8452
|
MODE: JSON.stringify(config.mode),
|
|
8348
8453
|
DEV: 'development' === config.mode,
|
|
8349
8454
|
PROD: 'production' === config.mode,
|
|
8455
|
+
SSR: 'node' === config.output.target,
|
|
8350
8456
|
BASE_URL: baseUrl,
|
|
8351
8457
|
ASSET_PREFIX: assetPrefix
|
|
8352
8458
|
},
|
|
@@ -8378,7 +8484,7 @@ try {
|
|
|
8378
8484
|
cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_RAW).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
|
|
8379
8485
|
let mainRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_MAIN), emitCss = config.output.emitCss ?? 'web' === target;
|
|
8380
8486
|
if (emitCss) if (config.output.injectStyles) {
|
|
8381
|
-
let styleLoaderOptions = reduceConfigs({
|
|
8487
|
+
let styleLoaderOptions = await reduceConfigs({
|
|
8382
8488
|
initial: {},
|
|
8383
8489
|
config: config.tools.styleLoader
|
|
8384
8490
|
});
|
|
@@ -8388,10 +8494,10 @@ try {
|
|
|
8388
8494
|
let importLoaders = {
|
|
8389
8495
|
normal: 0,
|
|
8390
8496
|
inline: 0
|
|
8391
|
-
}, updateRules = (callback, options = {})=>{
|
|
8392
|
-
options.skipMain || callback(mainRule, 'main'), callback(inlineRule, 'inline'), callback(urlRule, 'url');
|
|
8497
|
+
}, updateRules = async (callback, options = {})=>{
|
|
8498
|
+
options.skipMain || await callback(mainRule, 'main'), await callback(inlineRule, 'inline'), await callback(urlRule, 'url');
|
|
8393
8499
|
}, cssLoaderPath = join(COMPILED_PATH, 'css-loader', 'index.js');
|
|
8394
|
-
if (updateRules((rule)=>{
|
|
8500
|
+
if (await updateRules((rule)=>{
|
|
8395
8501
|
rule.use(CHAIN_ID.USE.CSS).loader(cssLoaderPath);
|
|
8396
8502
|
}), !1 !== config.tools.lightningcssLoader) {
|
|
8397
8503
|
emitCss && importLoaders.normal++, importLoaders.inline++;
|
|
@@ -8400,8 +8506,8 @@ try {
|
|
|
8400
8506
|
let webEnvironment = Object.values(environments).find((env)=>'web' === env.config.output.target);
|
|
8401
8507
|
webEnvironment && (browserslist = webEnvironment.browserslist, minifyCss = parseMinifyOptions(webEnvironment.config).minifyCss);
|
|
8402
8508
|
}
|
|
8403
|
-
updateRules((rule, type)=>{
|
|
8404
|
-
let minify = ('inline' === type || 'url' === type || config.output.injectStyles) && minifyCss, lightningcssOptions = getLightningCSSLoaderOptions(config, browserslist, minify);
|
|
8509
|
+
await updateRules(async (rule, type)=>{
|
|
8510
|
+
let minify = ('inline' === type || 'url' === type || config.output.injectStyles) && minifyCss, lightningcssOptions = await getLightningCSSLoaderOptions(config, browserslist, minify);
|
|
8405
8511
|
rule.use(CHAIN_ID.USE.LIGHTNINGCSS).loader('builtin:lightningcss-loader').options(lightningcssOptions);
|
|
8406
8512
|
}, {
|
|
8407
8513
|
skipMain: !emitCss
|
|
@@ -8415,48 +8521,18 @@ try {
|
|
|
8415
8521
|
if ('function' == typeof postcssLoaderOptions.postcssOptions || postcssLoaderOptions.postcssOptions?.plugins?.length) {
|
|
8416
8522
|
emitCss && importLoaders.normal++, importLoaders.inline++;
|
|
8417
8523
|
let postcssLoaderPath = join(COMPILED_PATH, 'postcss-loader', 'index.js');
|
|
8418
|
-
updateRules((rule)=>{
|
|
8524
|
+
await updateRules((rule)=>{
|
|
8419
8525
|
rule.use(CHAIN_ID.USE.POSTCSS).loader(postcssLoaderPath).options(postcssLoaderOptions);
|
|
8420
8526
|
}, {
|
|
8421
8527
|
skipMain: !emitCss
|
|
8422
8528
|
});
|
|
8423
8529
|
}
|
|
8424
|
-
let localIdentName = config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), cssLoaderOptions = (
|
|
8425
|
-
let { cssModules } = config.output;
|
|
8426
|
-
return ((options, exportOnlyLocals)=>{
|
|
8427
|
-
if (options.modules && exportOnlyLocals) {
|
|
8428
|
-
let { modules } = options;
|
|
8429
|
-
return modules = !0 === modules ? {
|
|
8430
|
-
exportOnlyLocals: !0
|
|
8431
|
-
} : 'string' == typeof modules ? {
|
|
8432
|
-
mode: modules,
|
|
8433
|
-
exportOnlyLocals: !0
|
|
8434
|
-
} : {
|
|
8435
|
-
...modules,
|
|
8436
|
-
exportOnlyLocals: !0
|
|
8437
|
-
}, {
|
|
8438
|
-
...options,
|
|
8439
|
-
modules
|
|
8440
|
-
};
|
|
8441
|
-
}
|
|
8442
|
-
return options;
|
|
8443
|
-
})(reduceConfigs({
|
|
8444
|
-
initial: {
|
|
8445
|
-
modules: {
|
|
8446
|
-
...cssModules,
|
|
8447
|
-
localIdentName
|
|
8448
|
-
},
|
|
8449
|
-
sourceMap: getCSSSourceMap(config)
|
|
8450
|
-
},
|
|
8451
|
-
config: config.tools.cssLoader,
|
|
8452
|
-
mergeFn: cjs_0_default()
|
|
8453
|
-
}), !emitCss);
|
|
8454
|
-
})({
|
|
8530
|
+
let localIdentName = config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), cssLoaderOptions = await getCSSLoaderOptions({
|
|
8455
8531
|
config,
|
|
8456
8532
|
localIdentName,
|
|
8457
8533
|
emitCss
|
|
8458
8534
|
});
|
|
8459
|
-
updateRules((rule, type)=>{
|
|
8535
|
+
await updateRules((rule, type)=>{
|
|
8460
8536
|
let finalOptions = cssLoaderOptions;
|
|
8461
8537
|
finalOptions = 'inline' === type || 'url' === type ? {
|
|
8462
8538
|
...cssLoaderOptions,
|
|
@@ -8497,12 +8573,12 @@ try {
|
|
|
8497
8573
|
{
|
|
8498
8574
|
name: 'rsbuild:minimize',
|
|
8499
8575
|
setup (api) {
|
|
8500
|
-
api.modifyBundlerChain((chain, { environment, CHAIN_ID, rspack })=>{
|
|
8576
|
+
api.modifyBundlerChain(async (chain, { environment, CHAIN_ID, rspack })=>{
|
|
8501
8577
|
let { config } = environment, { minifyJs, minifyCss, jsOptions, cssOptions } = parseMinifyOptions(config);
|
|
8502
8578
|
if (chain.optimization.minimize(minifyJs || minifyCss), minifyJs && chain.optimization.minimizer(CHAIN_ID.MINIMIZER.JS).use(rspack.SwcJsMinimizerRspackPlugin, [
|
|
8503
8579
|
getSwcMinimizerOptions(config, jsOptions)
|
|
8504
8580
|
]).end(), minifyCss) {
|
|
8505
|
-
let loaderOptions = getLightningCSSLoaderOptions(config, environment.browserslist, !0), defaultOptions = {
|
|
8581
|
+
let loaderOptions = await getLightningCSSLoaderOptions(config, environment.browserslist, !0), defaultOptions = {
|
|
8506
8582
|
minimizerOptions: {
|
|
8507
8583
|
targets: isPlainObject(loaderOptions.targets) ? environment.browserslist : loaderOptions.targets,
|
|
8508
8584
|
...pick(loaderOptions, [
|
|
@@ -8539,12 +8615,23 @@ try {
|
|
|
8539
8615
|
});
|
|
8540
8616
|
}
|
|
8541
8617
|
},
|
|
8618
|
+
{
|
|
8619
|
+
name: 'rsbuild:worker',
|
|
8620
|
+
setup (api) {
|
|
8621
|
+
api.modifyBundlerChain({
|
|
8622
|
+
order: 'pre',
|
|
8623
|
+
handler: (chain, { CHAIN_ID })=>{
|
|
8624
|
+
chain.module.rule(CHAIN_ID.RULE.JS).oneOf(CHAIN_ID.ONE_OF.JS_WORKER).resourceQuery(WORKER_QUERY_REGEX).type("javascript/auto").use(CHAIN_ID.USE.WORKER_QUERY).loader(node_path.join(dirname, 'workerLoader.mjs'));
|
|
8625
|
+
}
|
|
8626
|
+
});
|
|
8627
|
+
}
|
|
8628
|
+
},
|
|
8542
8629
|
{
|
|
8543
8630
|
name: PLUGIN_SWC_NAME,
|
|
8544
8631
|
setup (api) {
|
|
8545
8632
|
api.modifyBundlerChain({
|
|
8546
8633
|
order: 'pre',
|
|
8547
|
-
handler: (chain, { CHAIN_ID, isDev, isProd, target, environment })=>{
|
|
8634
|
+
handler: async (chain, { CHAIN_ID, isDev, isProd, target, environment })=>{
|
|
8548
8635
|
let { config, browserslist } = environment, cacheRoot = node_path.join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).dependency({
|
|
8549
8636
|
not: 'url'
|
|
8550
8637
|
});
|
|
@@ -8578,7 +8665,7 @@ try {
|
|
|
8578
8665
|
])item.resolve.alias.set('core-js', coreJsDir);
|
|
8579
8666
|
}
|
|
8580
8667
|
}
|
|
8581
|
-
let mergedConfig = reduceConfigs({
|
|
8668
|
+
let mergedConfig = await reduceConfigs({
|
|
8582
8669
|
initial: swcConfig,
|
|
8583
8670
|
config: config.tools.swc,
|
|
8584
8671
|
mergeFn: cjs_0_default()
|
|
@@ -8757,7 +8844,9 @@ try {
|
|
|
8757
8844
|
}), api.modifyBundlerChain((chain, { CHAIN_ID, environment, isDev })=>{
|
|
8758
8845
|
let { config, htmlPaths } = environment;
|
|
8759
8846
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
8760
|
-
let { performance: { preload, prefetch } } = config
|
|
8847
|
+
let { performance: { preload, prefetch } } = config;
|
|
8848
|
+
if (!preload && !prefetch) return;
|
|
8849
|
+
let HTMLCount = chain.entryPoints.values().length, excludes = ((config)=>{
|
|
8761
8850
|
let { scriptTests, styleTests } = getInlineTests(config);
|
|
8762
8851
|
return [
|
|
8763
8852
|
...scriptTests,
|
|
@@ -8854,7 +8943,7 @@ try {
|
|
|
8854
8943
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
8855
8944
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
8856
8945
|
if (!1 === manifest) return;
|
|
8857
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
8946
|
+
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
8858
8947
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
8859
8948
|
let pluginOptions = {
|
|
8860
8949
|
fileName: manifestOptions.filename,
|
|
@@ -8938,7 +9027,7 @@ try {
|
|
|
8938
9027
|
api.onBeforeBuild(async ({ isFirstCompile })=>{
|
|
8939
9028
|
isFirstCompile && await onStart();
|
|
8940
9029
|
}), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
|
|
8941
|
-
traceOutput && (core_rspack.experiments.globalTrace.cleanup(),
|
|
9030
|
+
traceOutput && (core_rspack.experiments.globalTrace.cleanup(), isTerminalTraceOutput(traceOutput) || api.logger.info(`profile file saved to ${color.cyan(traceOutput)}`));
|
|
8942
9031
|
});
|
|
8943
9032
|
}
|
|
8944
9033
|
},
|
|
@@ -9274,7 +9363,7 @@ let commonOpts = {}, init_loadConfig = async (root)=>{
|
|
|
9274
9363
|
]), config;
|
|
9275
9364
|
};
|
|
9276
9365
|
async function init_init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
9277
|
-
cliOptions && (commonOpts = cliOptions), commonOpts.environment = commonOpts.environment
|
|
9366
|
+
cliOptions && (commonOpts = cliOptions), commonOpts.environment?.some((env)=>env.includes(',')) && (commonOpts.environment = commonOpts.environment.flatMap((env)=>env.split(',')));
|
|
9278
9367
|
let logger = src_logger;
|
|
9279
9368
|
try {
|
|
9280
9369
|
var envDir;
|
|
@@ -9368,7 +9457,7 @@ let applyServerOptions = (command)=>{
|
|
|
9368
9457
|
};
|
|
9369
9458
|
function setupCommands() {
|
|
9370
9459
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9371
|
-
cli.version("2.0.
|
|
9460
|
+
cli.version("2.0.8"), 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)', {
|
|
9372
9461
|
default: 'auto'
|
|
9373
9462
|
}).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', {
|
|
9374
9463
|
type: [
|
|
@@ -9434,21 +9523,16 @@ function setupCommands() {
|
|
|
9434
9523
|
}), cli.parse();
|
|
9435
9524
|
}
|
|
9436
9525
|
let { argv: cli_argv } = process;
|
|
9437
|
-
function initNodeEnv() {
|
|
9438
|
-
|
|
9439
|
-
let command = cli_argv[2];
|
|
9440
|
-
process.env.NODE_ENV = [
|
|
9441
|
-
'build',
|
|
9442
|
-
'preview'
|
|
9443
|
-
].includes(command) ? 'production' : 'development';
|
|
9444
|
-
}
|
|
9526
|
+
function initNodeEnv(command) {
|
|
9527
|
+
process.env.NODE_ENV || (process.env.NODE_ENV = 'build' === command || 'preview' === command ? 'production' : 'development');
|
|
9445
9528
|
}
|
|
9446
9529
|
function showGreeting() {
|
|
9447
9530
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9448
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.
|
|
9531
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.8\n`);
|
|
9449
9532
|
}
|
|
9450
9533
|
function setupLogLevel() {
|
|
9451
|
-
|
|
9534
|
+
if (cli_argv.length <= 3) return;
|
|
9535
|
+
let logLevelIndex = cli_argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
9452
9536
|
if (-1 !== logLevelIndex) {
|
|
9453
9537
|
let level = process.argv[logLevelIndex + 1];
|
|
9454
9538
|
level && [
|
|
@@ -9459,12 +9543,12 @@ function setupLogLevel() {
|
|
|
9459
9543
|
}
|
|
9460
9544
|
}
|
|
9461
9545
|
function runCLI() {
|
|
9462
|
-
|
|
9546
|
+
initNodeEnv(cli_argv[2]), setupLogLevel(), showGreeting();
|
|
9463
9547
|
try {
|
|
9464
9548
|
setupCommands();
|
|
9465
9549
|
} catch (err) {
|
|
9466
9550
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
9467
9551
|
}
|
|
9468
9552
|
}
|
|
9469
|
-
let src_version = "2.0.
|
|
9553
|
+
let src_version = "2.0.8";
|
|
9470
9554
|
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 };
|