@rsbuild/core 2.0.5 → 2.0.7
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/http-proxy-middleware/index.d.ts +4 -4
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/style-loader/index.js +10 -10
- package/dist/753.js +129 -66
- package/dist/chokidar.js +2 -2
- package/dist/http-proxy-middleware.js +14 -113
- package/dist/manifest-plugin.js +6 -6
- package/dist/memfs.js +6 -8
- package/dist/workerLoader.mjs +94 -0
- package/dist/ws.js +41 -40
- package/dist-types/cli/init.d.ts +1 -1
- 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/initConfigs.d.ts +2 -2
- package/dist-types/initPlugins.d.ts +1 -1
- package/dist-types/inspectConfig.d.ts +1 -1
- package/dist-types/loadConfig.d.ts +1 -1
- package/dist-types/loadEnv.d.ts +1 -1
- package/dist-types/loader/workerLoader.d.ts +6 -0
- package/dist-types/mergeConfig.d.ts +6 -0
- package/dist-types/pluginManager.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/restart.d.ts +1 -1
- package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +1 -1
- package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +1 -1
- package/dist-types/rspackConfig.d.ts +1 -1
- package/dist-types/server/cliShortcuts.d.ts +1 -1
- package/dist-types/server/gzipMiddleware.d.ts +1 -1
- package/dist-types/server/helper.d.ts +1 -1
- package/dist-types/server/open.d.ts +1 -1
- package/dist-types/types/config.d.ts +28 -0
- package/dist-types/types/plugin.d.ts +3 -3
- package/dist-types/types/rsbuild.d.ts +1 -1
- package/package.json +8 -8
- package/types.d.ts +42 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
4
|
+
186: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
const loader = __nccwpck_require__(280);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
},
|
|
8
|
-
|
|
8
|
+
280: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
var _path = _interopRequireDefault(__nccwpck_require__(928));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
13
|
-
var _options = _interopRequireDefault(__nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(497);
|
|
13
|
+
var _options = _interopRequireDefault(__nccwpck_require__(198));
|
|
14
14
|
function _interopRequireDefault(obj) {
|
|
15
15
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
16
16
|
}
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
};
|
|
96
96
|
var _default = (exports["default"] = loader);
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
835: (module) => {
|
|
99
99
|
function isEqualLocals(a, b, isNamedExport) {
|
|
100
100
|
if ((!a && b) || (a && !b)) {
|
|
101
101
|
return false;
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
module.exports = isEqualLocals;
|
|
123
123
|
},
|
|
124
|
-
|
|
124
|
+
497: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
125
125
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
126
126
|
exports.getExportLazyStyleCode = getExportLazyStyleCode;
|
|
127
127
|
exports.getExportStyleCode = getExportStyleCode;
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
exports.getdomAPI = getdomAPI;
|
|
143
143
|
exports.stringifyRequest = stringifyRequest;
|
|
144
144
|
var _path = _interopRequireDefault(__nccwpck_require__(928));
|
|
145
|
-
var _isEqualLocals = _interopRequireDefault(__nccwpck_require__(
|
|
145
|
+
var _isEqualLocals = _interopRequireDefault(__nccwpck_require__(835));
|
|
146
146
|
function _interopRequireDefault(obj) {
|
|
147
147
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
148
148
|
}
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
928: (module) => {
|
|
338
338
|
module.exports = require("path");
|
|
339
339
|
},
|
|
340
|
-
|
|
340
|
+
198: (module) => {
|
|
341
341
|
module.exports = JSON.parse(
|
|
342
342
|
'{"title":"Style Loader options","type":"object","properties":{"injectType":{"description":"Allows to setup how styles will be injected into DOM.","link":"https://github.com/webpack-contrib/style-loader#injecttype","enum":["styleTag","singletonStyleTag","autoStyleTag","lazyStyleTag","lazySingletonStyleTag","lazyAutoStyleTag","linkTag"]},"attributes":{"description":"Adds custom attributes to tag.","link":"https://github.com/webpack-contrib/style-loader#attributes","type":"object"},"insert":{"description":"Inserts `<style>`/`<link>` at the given position.","link":"https://github.com/webpack-contrib/style-loader#insert","type":"string"},"base":{"description":"Sets module ID base for DLLPlugin.","link":"https://github.com/webpack-contrib/style-loader#base","type":"number"},"esModule":{"description":"Use the ES modules syntax.","link":"https://github.com/webpack-contrib/css-loader#esmodule","type":"boolean"},"styleTagTransform":{"description":"Transform tag and css when insert \'style\' tag into the DOM","link":"https://github.com/webpack-contrib/style-loader#styleTagTransform","type":"string"}},"additionalProperties":false}',
|
|
343
343
|
);
|
|
@@ -365,6 +365,6 @@
|
|
|
365
365
|
}
|
|
366
366
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
367
367
|
__nccwpck_require__.ab = __dirname + "/";
|
|
368
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
368
|
+
var __webpack_exports__ = __nccwpck_require__(186);
|
|
369
369
|
module.exports = __webpack_exports__;
|
|
370
370
|
})();
|
package/dist/753.js
CHANGED
|
@@ -10,6 +10,7 @@ import { builtinModules, createRequire, createRequire as __rspack_createRequire
|
|
|
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.14/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.14/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.14/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.14/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.14/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.14/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.14/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.14/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.14/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 = [];
|
|
@@ -836,7 +837,7 @@ function lib_default(args, opts) {
|
|
|
836
837
|
_: []
|
|
837
838
|
}, i = 0, j = 0, idx = 0, len = (args = args || []).length;
|
|
838
839
|
let alibi = void 0 !== opts.alias, strict = void 0 !== opts.unknown, defaults = void 0 !== opts.default;
|
|
839
|
-
if (opts.alias = opts.alias || {}, opts.string = toArr(opts.string), opts.boolean = toArr(opts.boolean), alibi) for(k in opts.alias)for(
|
|
840
|
+
if (opts.alias = opts.alias || {}, opts.string = toArr(opts.string), opts.boolean = toArr(opts.boolean), alibi) for(k in opts.alias)for(arr = opts.alias[k] = toArr(opts.alias[k]), i = 0; i < arr.length; i++)(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
|
840
841
|
for(i = opts.boolean.length; i-- > 0;)for(j = (arr = opts.alias[opts.boolean[i]] || []).length; j-- > 0;)opts.boolean.push(arr[j]);
|
|
841
842
|
for(i = opts.string.length; i-- > 0;)for(j = (arr = opts.alias[opts.string[i]] || []).length; j-- > 0;)opts.string.push(arr[j]);
|
|
842
843
|
if (defaults) {
|
|
@@ -1200,7 +1201,7 @@ var Command = class {
|
|
|
1200
1201
|
}), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
|
|
1201
1202
|
}
|
|
1202
1203
|
};
|
|
1203
|
-
let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform,
|
|
1204
|
+
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
1205
|
'chrome >= 107',
|
|
1205
1206
|
'edge >= 107',
|
|
1206
1207
|
'firefox >= 104',
|
|
@@ -1211,7 +1212,7 @@ let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, ROOT_D
|
|
|
1211
1212
|
node: [
|
|
1212
1213
|
'node >= 20'
|
|
1213
1214
|
]
|
|
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 = [
|
|
1215
|
+
}, 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
1216
|
'woff',
|
|
1216
1217
|
'woff2',
|
|
1217
1218
|
'eot',
|
|
@@ -2340,7 +2341,7 @@ async function helpers_hash(data) {
|
|
|
2340
2341
|
}
|
|
2341
2342
|
let compiler_isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers), getPublicPathFromCompiler = (compiler)=>{
|
|
2342
2343
|
let { publicPath } = compiler.options.output;
|
|
2343
|
-
return 'string' == typeof publicPath ? 'auto' === publicPath || '' === publicPath ? '' : publicPath.endsWith('/') ? publicPath : `${publicPath}/` :
|
|
2344
|
+
return 'string' == typeof publicPath ? 'auto' === publicPath || '' === publicPath ? '' : publicPath.endsWith('/') ? publicPath : `${publicPath}/` : "/";
|
|
2344
2345
|
}, applyToCompiler = (compiler, apply)=>{
|
|
2345
2346
|
compiler_isMultiCompiler(compiler) ? compiler.compilers.forEach(apply) : apply(compiler, 0);
|
|
2346
2347
|
}, addCompilationError = (compilation, message)=>{
|
|
@@ -2898,7 +2899,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2898
2899
|
]), normalizedConfig.dev = dev), normalizedConfig;
|
|
2899
2900
|
}, mergeRsbuildConfig = (...originalConfigs)=>{
|
|
2900
2901
|
let configs = originalConfigs.filter((config)=>void 0 !== config).map(normalizeConfigStructure);
|
|
2901
|
-
return 2 === configs.length ? merge(configs[0], configs[1]) :
|
|
2902
|
+
return 2 === configs.length ? merge(configs[0], configs[1]) : 0 === configs.length ? {} : configs.reduce((result, config)=>merge(result, config), {});
|
|
2902
2903
|
}, defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, createDefaultConfig = ()=>({
|
|
2903
2904
|
dev: {
|
|
2904
2905
|
hmr: !0,
|
|
@@ -2907,7 +2908,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2907
2908
|
stackTrace: DEFAULT_STACK_TRACE
|
|
2908
2909
|
},
|
|
2909
2910
|
watchFiles: [],
|
|
2910
|
-
assetPrefix:
|
|
2911
|
+
assetPrefix: "/",
|
|
2911
2912
|
writeToDisk: !1,
|
|
2912
2913
|
cliShortcuts: !1,
|
|
2913
2914
|
client: {
|
|
@@ -2942,7 +2943,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2942
2943
|
},
|
|
2943
2944
|
title: 'Rsbuild App',
|
|
2944
2945
|
inject: 'head',
|
|
2945
|
-
mountId:
|
|
2946
|
+
mountId: "root",
|
|
2946
2947
|
crossorigin: !1,
|
|
2947
2948
|
outputStructure: 'flat',
|
|
2948
2949
|
scriptLoading: 'defer',
|
|
@@ -2973,18 +2974,18 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2973
2974
|
target: 'web',
|
|
2974
2975
|
cleanDistPath: 'auto',
|
|
2975
2976
|
distPath: {
|
|
2976
|
-
root:
|
|
2977
|
+
root: "dist",
|
|
2977
2978
|
css: 'static/css',
|
|
2978
2979
|
svg: 'static/svg',
|
|
2979
2980
|
font: 'static/font',
|
|
2980
|
-
html:
|
|
2981
|
+
html: "./",
|
|
2981
2982
|
wasm: 'static/wasm',
|
|
2982
2983
|
image: 'static/image',
|
|
2983
2984
|
media: 'static/media',
|
|
2984
2985
|
assets: 'static/assets',
|
|
2985
|
-
favicon:
|
|
2986
|
+
favicon: "./"
|
|
2986
2987
|
},
|
|
2987
|
-
assetPrefix:
|
|
2988
|
+
assetPrefix: "/",
|
|
2988
2989
|
filename: {},
|
|
2989
2990
|
charset: 'utf8',
|
|
2990
2991
|
polyfill: 'off',
|
|
@@ -3085,9 +3086,9 @@ function exitHook(onExit) {
|
|
|
3085
3086
|
let addTrailingSlash = (s)=>s.endsWith('/') ? s : `${s}/`, isURL = (str)=>str.startsWith('http') || str.startsWith('//'), urlJoin = (base, path)=>{
|
|
3086
3087
|
let [urlProtocol, baseUrl] = base.split('://');
|
|
3087
3088
|
return `${urlProtocol}://${posix.join(baseUrl, path)}`;
|
|
3088
|
-
}, ensureAssetPrefix = (url, assetPrefix =
|
|
3089
|
+
}, 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
3090
|
let publicPath = chain.output.get('publicPath');
|
|
3090
|
-
return 'string' == typeof publicPath ? formatPublicPath(publicPath, withSlash) : formatPublicPath(
|
|
3091
|
+
return 'string' == typeof publicPath ? formatPublicPath(publicPath, withSlash) : formatPublicPath("/", withSlash);
|
|
3091
3092
|
};
|
|
3092
3093
|
function validatePlugin(plugin) {
|
|
3093
3094
|
let type = typeof plugin;
|
|
@@ -3412,7 +3413,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
3412
3413
|
});
|
|
3413
3414
|
}
|
|
3414
3415
|
function getAbsoluteDistPath(cwd, config) {
|
|
3415
|
-
return ensureAbsolutePath(cwd, config.output?.distPath?.root ??
|
|
3416
|
+
return ensureAbsolutePath(cwd, config.output?.distPath?.root ?? "dist");
|
|
3416
3417
|
}
|
|
3417
3418
|
let browsersListCache = new Map();
|
|
3418
3419
|
function getBrowserslist(path) {
|
|
@@ -3481,7 +3482,7 @@ function createPublicContext(context) {
|
|
|
3481
3482
|
async function createContext(options, userConfig, logger) {
|
|
3482
3483
|
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
3484
|
return {
|
|
3484
|
-
version: "2.0.
|
|
3485
|
+
version: "2.0.7",
|
|
3485
3486
|
rootPath,
|
|
3486
3487
|
distPath: '',
|
|
3487
3488
|
cachePath,
|
|
@@ -3749,6 +3750,7 @@ let configChain_CHAIN_ID = {
|
|
|
3749
3750
|
},
|
|
3750
3751
|
ONE_OF: {
|
|
3751
3752
|
JS_MAIN: 'js',
|
|
3753
|
+
JS_WORKER: 'js-worker',
|
|
3752
3754
|
JS_RAW: 'js-raw',
|
|
3753
3755
|
CSS_MAIN: 'css',
|
|
3754
3756
|
CSS_RAW: 'css-raw',
|
|
@@ -3771,6 +3773,7 @@ let configChain_CHAIN_ID = {
|
|
|
3771
3773
|
URL: 'url',
|
|
3772
3774
|
VUE: 'vue',
|
|
3773
3775
|
SWC: 'swc',
|
|
3776
|
+
WORKER_QUERY: 'worker-query',
|
|
3774
3777
|
SVGR: 'svgr',
|
|
3775
3778
|
BABEL: 'babel',
|
|
3776
3779
|
STYLE: 'style-loader',
|
|
@@ -3955,7 +3958,10 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3955
3958
|
let nodeEnv = process.env.NODE_ENV || '';
|
|
3956
3959
|
return 'production' === nodeEnv || 'development' === nodeEnv ? nodeEnv : 'none';
|
|
3957
3960
|
})(), mergeRsbuildConfig(defaultConfig, config)), environments = {}, mergedEnvironments = ((normalizedConfig, rootPath, specifiedEnvironments)=>{
|
|
3958
|
-
let defaultEntry, { environments, dev, server: _server, ...baseConfig } = normalizedConfig, isEnvironmentEnabled = (name)=>!specifiedEnvironments || specifiedEnvironments.includes(name),
|
|
3961
|
+
let defaultEntry, { environments, dev, server: _server, ...baseConfig } = normalizedConfig, isEnvironmentEnabled = (name)=>!specifiedEnvironments || specifiedEnvironments.includes(name), baseEnvironmentConfig = {
|
|
3962
|
+
...baseConfig,
|
|
3963
|
+
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
3964
|
+
}, applyEnvironmentDefaultConfig = (config)=>{
|
|
3959
3965
|
config.source.entry && 0 !== Object.keys(config.source.entry).length || (config.source.entry = (defaultEntry || (defaultEntry = getDefaultEntry(rootPath)), defaultEntry));
|
|
3960
3966
|
let isServer = 'node' === config.output.target;
|
|
3961
3967
|
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 +3969,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3963
3969
|
if (environments && Object.keys(environments).length > 0) {
|
|
3964
3970
|
let resolvedEnvironments = Object.fromEntries(Object.entries(environments).filter(([name])=>isEnvironmentEnabled(name)).map(([name, config])=>[
|
|
3965
3971
|
name,
|
|
3966
|
-
applyEnvironmentDefaultConfig(
|
|
3967
|
-
...mergeRsbuildConfig({
|
|
3968
|
-
...baseConfig,
|
|
3969
|
-
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
3970
|
-
}, config)
|
|
3971
|
-
})
|
|
3972
|
+
applyEnvironmentDefaultConfig(mergeRsbuildConfig(baseEnvironmentConfig, config))
|
|
3972
3973
|
]));
|
|
3973
3974
|
if (0 === Object.keys(resolvedEnvironments).length) throw createEnvironmentNotFoundError(specifiedEnvironments);
|
|
3974
3975
|
return resolvedEnvironments;
|
|
@@ -3976,10 +3977,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3976
3977
|
let defaultEnvironmentName = baseConfig.output.target.replace(/[-_](\w)/g, (_, c)=>c.toUpperCase());
|
|
3977
3978
|
if (!isEnvironmentEnabled(defaultEnvironmentName)) throw createEnvironmentNotFoundError(specifiedEnvironments);
|
|
3978
3979
|
return {
|
|
3979
|
-
[defaultEnvironmentName]: applyEnvironmentDefaultConfig(
|
|
3980
|
-
...baseConfig,
|
|
3981
|
-
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
3982
|
-
})
|
|
3980
|
+
[defaultEnvironmentName]: applyEnvironmentDefaultConfig(baseEnvironmentConfig)
|
|
3983
3981
|
};
|
|
3984
3982
|
})(normalizedBaseConfig, context.rootPath, context.specifiedEnvironments), tsconfigPaths = new Set();
|
|
3985
3983
|
for (let [name, config] of Object.entries(mergedEnvironments)){
|
|
@@ -4467,7 +4465,7 @@ function parseMinifyOptions(config) {
|
|
|
4467
4465
|
cssOptions: minify.cssOptions
|
|
4468
4466
|
};
|
|
4469
4467
|
}
|
|
4470
|
-
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
4468
|
+
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/index.js");
|
|
4471
4469
|
var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
|
|
4472
4470
|
function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
4473
4471
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
@@ -4548,13 +4546,65 @@ function checkProcessEnvSecurity(define, logger) {
|
|
|
4548
4546
|
check(JSON.parse(value));
|
|
4549
4547
|
} catch {}
|
|
4550
4548
|
}
|
|
4549
|
+
let readPackageJson = async (rootPath)=>{
|
|
4550
|
+
let pkgJsonPath = join(rootPath, 'package.json');
|
|
4551
|
+
if (await isFileExists(pkgJsonPath)) try {
|
|
4552
|
+
return JSON.parse(await readFile(pkgJsonPath, 'utf8'));
|
|
4553
|
+
} catch {
|
|
4554
|
+
return;
|
|
4555
|
+
}
|
|
4556
|
+
}, dependencyTypes = [
|
|
4557
|
+
'dependencies',
|
|
4558
|
+
'peerDependencies',
|
|
4559
|
+
'devDependencies',
|
|
4560
|
+
'optionalDependencies'
|
|
4561
|
+
], defaultAutoExternalOptions = {
|
|
4562
|
+
dependencies: !0,
|
|
4563
|
+
optionalDependencies: !0,
|
|
4564
|
+
peerDependencies: !0,
|
|
4565
|
+
devDependencies: !1
|
|
4566
|
+
}, resolveAutoExternalOptions = (autoExternal)=>{
|
|
4567
|
+
if (void 0 === autoExternal || !1 === autoExternal) return;
|
|
4568
|
+
let externalOptions = {
|
|
4569
|
+
...defaultAutoExternalOptions,
|
|
4570
|
+
...!0 === autoExternal ? {} : autoExternal
|
|
4571
|
+
};
|
|
4572
|
+
return dependencyTypes.some((type)=>externalOptions[type]) ? externalOptions : void 0;
|
|
4573
|
+
};
|
|
4551
4574
|
function pluginExternals() {
|
|
4552
4575
|
return {
|
|
4553
4576
|
name: 'rsbuild:externals',
|
|
4554
4577
|
setup (api) {
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
externals
|
|
4578
|
+
let pkgJson, hasReadPackageJson = !1, hasWarnedReadPackageJsonFailed = !1;
|
|
4579
|
+
api.modifyBundlerChain(async (chain, { environment })=>{
|
|
4580
|
+
let { autoExternal, externals } = environment.config.output, externalOptions = resolveAutoExternalOptions(autoExternal);
|
|
4581
|
+
externalOptions && !hasReadPackageJson && (pkgJson = await readPackageJson(api.context.rootPath), hasReadPackageJson = !0), !externalOptions || pkgJson || hasWarnedReadPackageJsonFailed || (api.logger.warn('The `output.autoExternal` configuration will not be applied because reading package.json failed.'), hasWarnedReadPackageJsonFailed = !0);
|
|
4582
|
+
let autoExternalRules = ((options)=>{
|
|
4583
|
+
let { autoExternal, pkgJson, userExternals } = options, externalOptions = resolveAutoExternalOptions(autoExternal);
|
|
4584
|
+
if (!externalOptions || !pkgJson) return;
|
|
4585
|
+
let userExternalKeys = isPlainObject(userExternals) ? Object.keys(userExternals) : [], uniqueExternals = Array.from(new Set(dependencyTypes.reduce((prev, type)=>{
|
|
4586
|
+
if (externalOptions[type]) {
|
|
4587
|
+
let deps = pkgJson[type];
|
|
4588
|
+
return isPlainObject(deps) ? prev.concat(Object.keys(deps)) : prev;
|
|
4589
|
+
}
|
|
4590
|
+
return prev;
|
|
4591
|
+
}, []).filter((name)=>!userExternalKeys.includes(name))));
|
|
4592
|
+
return uniqueExternals.length ? [
|
|
4593
|
+
...uniqueExternals.map((dep)=>RegExp(`^${dep.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')}($|\/|\\\\)`)),
|
|
4594
|
+
...uniqueExternals
|
|
4595
|
+
] : void 0;
|
|
4596
|
+
})({
|
|
4597
|
+
autoExternal,
|
|
4598
|
+
pkgJson,
|
|
4599
|
+
userExternals: externals
|
|
4600
|
+
}), mergedExternals = autoExternalRules?.length ? externals ? Array.isArray(externals) ? [
|
|
4601
|
+
...externals,
|
|
4602
|
+
...autoExternalRules
|
|
4603
|
+
] : [
|
|
4604
|
+
externals,
|
|
4605
|
+
...autoExternalRules
|
|
4606
|
+
] : autoExternalRules : externals;
|
|
4607
|
+
mergedExternals && chain.externals(mergedExternals);
|
|
4558
4608
|
}), api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
|
|
4559
4609
|
for (let config of bundlerConfigs)(Array.isArray(config.target) ? config.target.includes('webworker') : 'webworker' === config.target) && config.externals && delete config.externals;
|
|
4560
4610
|
});
|
|
@@ -5375,7 +5425,7 @@ function pluginModuleFederation() {
|
|
|
5375
5425
|
};
|
|
5376
5426
|
}
|
|
5377
5427
|
function getPublicPath({ isDev, config, context }) {
|
|
5378
|
-
let { dev, output, server } = config, publicPath =
|
|
5428
|
+
let { dev, output, server } = config, publicPath = "/";
|
|
5379
5429
|
if (isDev) {
|
|
5380
5430
|
if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
5381
5431
|
else if (dev.assetPrefix) {
|
|
@@ -5528,6 +5578,9 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
5528
5578
|
...option
|
|
5529
5579
|
}
|
|
5530
5580
|
}));
|
|
5581
|
+
function isTerminalTraceOutput(output) {
|
|
5582
|
+
return 'stdout' === output || 'stderr' === output;
|
|
5583
|
+
}
|
|
5531
5584
|
function resolveLayer(value) {
|
|
5532
5585
|
return "OVERVIEW" === value ? 'info' : "ALL" === value ? 'trace' : value;
|
|
5533
5586
|
}
|
|
@@ -5537,14 +5590,13 @@ async function ensureFileDir(outputFilePath) {
|
|
|
5537
5590
|
recursive: !0
|
|
5538
5591
|
});
|
|
5539
5592
|
}
|
|
5540
|
-
async function applyProfile(root, filterValue, traceLayer
|
|
5593
|
+
async function applyProfile(root, filterValue, traceLayer, traceOutput) {
|
|
5541
5594
|
if ('perfetto' !== traceLayer && 'logger' !== traceLayer) throw Error(`unsupported trace layer: ${traceLayer}`);
|
|
5542
|
-
if (
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
}
|
|
5595
|
+
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.');
|
|
5596
|
+
let timestamp = Date.now(), defaultOutputDir = node_path.join(root, `.rspack-profile-${timestamp}-${process.pid}`);
|
|
5597
|
+
traceOutput ? isTerminalTraceOutput(traceOutput) || (traceOutput = node_path.resolve(defaultOutputDir, traceOutput)) : traceOutput = node_path.resolve(defaultOutputDir, 'perfetto' === traceLayer ? 'rspack.pftrace' : 'rspack.log');
|
|
5546
5598
|
let filter = resolveLayer(filterValue);
|
|
5547
|
-
return await ensureFileDir(traceOutput), await core_rspack.experiments.globalTrace.register(filter, traceLayer, traceOutput), traceOutput;
|
|
5599
|
+
return isTerminalTraceOutput(traceOutput) || await ensureFileDir(traceOutput), await core_rspack.experiments.globalTrace.register(filter, traceLayer, traceOutput), traceOutput;
|
|
5548
5600
|
}
|
|
5549
5601
|
function getForceSplittingGroups(forceSplitting, strategy) {
|
|
5550
5602
|
let cacheGroups = {};
|
|
@@ -6094,7 +6146,7 @@ function createMiddleware(context, ready, outputFileSystem) {
|
|
|
6094
6146
|
}
|
|
6095
6147
|
async function setupOutputFileSystem(writeToDisk, compilers) {
|
|
6096
6148
|
if (!0 !== writeToDisk) {
|
|
6097
|
-
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.57.
|
|
6149
|
+
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
6150
|
for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
|
|
6099
6151
|
}
|
|
6100
6152
|
let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
|
|
@@ -6767,8 +6819,10 @@ function gzipMiddleware_gzipMiddleware({ filter, level = node_zlib.constants.Z_B
|
|
|
6767
6819
|
if (started) return;
|
|
6768
6820
|
if (started = !0, ((res)=>{
|
|
6769
6821
|
if (res.getHeader('Content-Encoding')) return !1;
|
|
6770
|
-
let contentType =
|
|
6771
|
-
if (
|
|
6822
|
+
let contentType = res.getHeader('Content-Type');
|
|
6823
|
+
if (!contentType) return !1;
|
|
6824
|
+
let contentTypeValue = String(contentType);
|
|
6825
|
+
if (!CONTENT_TYPE_REGEX.test(contentTypeValue) || 'text/event-stream' === contentTypeValue.split(';', 1)[0].trim().toLowerCase()) return !1;
|
|
6772
6826
|
let size = res.getHeader('Content-Length');
|
|
6773
6827
|
return void 0 === size || Number(size) > 1024;
|
|
6774
6828
|
})(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = node_zlib.createGzip({
|
|
@@ -8345,6 +8399,7 @@ try {
|
|
|
8345
8399
|
MODE: JSON.stringify(config.mode),
|
|
8346
8400
|
DEV: 'development' === config.mode,
|
|
8347
8401
|
PROD: 'production' === config.mode,
|
|
8402
|
+
SSR: 'node' === config.output.target,
|
|
8348
8403
|
BASE_URL: baseUrl,
|
|
8349
8404
|
ASSET_PREFIX: assetPrefix
|
|
8350
8405
|
},
|
|
@@ -8537,6 +8592,17 @@ try {
|
|
|
8537
8592
|
});
|
|
8538
8593
|
}
|
|
8539
8594
|
},
|
|
8595
|
+
{
|
|
8596
|
+
name: 'rsbuild:worker',
|
|
8597
|
+
setup (api) {
|
|
8598
|
+
api.modifyBundlerChain({
|
|
8599
|
+
order: 'pre',
|
|
8600
|
+
handler: (chain, { CHAIN_ID })=>{
|
|
8601
|
+
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'));
|
|
8602
|
+
}
|
|
8603
|
+
});
|
|
8604
|
+
}
|
|
8605
|
+
},
|
|
8540
8606
|
{
|
|
8541
8607
|
name: PLUGIN_SWC_NAME,
|
|
8542
8608
|
setup (api) {
|
|
@@ -8755,7 +8821,9 @@ try {
|
|
|
8755
8821
|
}), api.modifyBundlerChain((chain, { CHAIN_ID, environment, isDev })=>{
|
|
8756
8822
|
let { config, htmlPaths } = environment;
|
|
8757
8823
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
8758
|
-
let { performance: { preload, prefetch } } = config
|
|
8824
|
+
let { performance: { preload, prefetch } } = config;
|
|
8825
|
+
if (!preload && !prefetch) return;
|
|
8826
|
+
let HTMLCount = chain.entryPoints.values().length, excludes = ((config)=>{
|
|
8759
8827
|
let { scriptTests, styleTests } = getInlineTests(config);
|
|
8760
8828
|
return [
|
|
8761
8829
|
...scriptTests,
|
|
@@ -8852,7 +8920,7 @@ try {
|
|
|
8852
8920
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
8853
8921
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
8854
8922
|
if (!1 === manifest) return;
|
|
8855
|
-
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.
|
|
8923
|
+
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.4/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
8856
8924
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
8857
8925
|
let pluginOptions = {
|
|
8858
8926
|
fileName: manifestOptions.filename,
|
|
@@ -8928,15 +8996,15 @@ try {
|
|
|
8928
8996
|
{
|
|
8929
8997
|
name: 'rsbuild:rspack-profile',
|
|
8930
8998
|
setup (api) {
|
|
8931
|
-
let traceOutput, { RSPACK_PROFILE } = process.env;
|
|
8999
|
+
let traceOutput, { RSPACK_PROFILE, RSPACK_TRACE_LAYER = 'logger' } = process.env;
|
|
8932
9000
|
if (!RSPACK_PROFILE) return;
|
|
8933
9001
|
let onStart = async ()=>{
|
|
8934
|
-
traceOutput = await applyProfile(api.context.rootPath, RSPACK_PROFILE,
|
|
9002
|
+
traceOutput = await applyProfile(api.context.rootPath, RSPACK_PROFILE, RSPACK_TRACE_LAYER, process.env.RSPACK_TRACE_OUTPUT);
|
|
8935
9003
|
};
|
|
8936
9004
|
api.onBeforeBuild(async ({ isFirstCompile })=>{
|
|
8937
9005
|
isFirstCompile && await onStart();
|
|
8938
9006
|
}), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
|
|
8939
|
-
traceOutput && (core_rspack.experiments.globalTrace.cleanup(), api.logger.info(`profile file saved to ${color.cyan(traceOutput)}`));
|
|
9007
|
+
traceOutput && (core_rspack.experiments.globalTrace.cleanup(), isTerminalTraceOutput(traceOutput) || api.logger.info(`profile file saved to ${color.cyan(traceOutput)}`));
|
|
8940
9008
|
});
|
|
8941
9009
|
}
|
|
8942
9010
|
},
|
|
@@ -9272,7 +9340,7 @@ let commonOpts = {}, init_loadConfig = async (root)=>{
|
|
|
9272
9340
|
]), config;
|
|
9273
9341
|
};
|
|
9274
9342
|
async function init_init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
9275
|
-
cliOptions && (commonOpts = cliOptions), commonOpts.environment = commonOpts.environment
|
|
9343
|
+
cliOptions && (commonOpts = cliOptions), commonOpts.environment?.some((env)=>env.includes(',')) && (commonOpts.environment = commonOpts.environment.flatMap((env)=>env.split(',')));
|
|
9276
9344
|
let logger = src_logger;
|
|
9277
9345
|
try {
|
|
9278
9346
|
var envDir;
|
|
@@ -9366,7 +9434,7 @@ let applyServerOptions = (command)=>{
|
|
|
9366
9434
|
};
|
|
9367
9435
|
function setupCommands() {
|
|
9368
9436
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9369
|
-
cli.version("2.0.
|
|
9437
|
+
cli.version("2.0.7"), 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)', {
|
|
9370
9438
|
default: 'auto'
|
|
9371
9439
|
}).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', {
|
|
9372
9440
|
type: [
|
|
@@ -9432,21 +9500,16 @@ function setupCommands() {
|
|
|
9432
9500
|
}), cli.parse();
|
|
9433
9501
|
}
|
|
9434
9502
|
let { argv: cli_argv } = process;
|
|
9435
|
-
function initNodeEnv() {
|
|
9436
|
-
|
|
9437
|
-
let command = cli_argv[2];
|
|
9438
|
-
process.env.NODE_ENV = [
|
|
9439
|
-
'build',
|
|
9440
|
-
'preview'
|
|
9441
|
-
].includes(command) ? 'production' : 'development';
|
|
9442
|
-
}
|
|
9503
|
+
function initNodeEnv(command) {
|
|
9504
|
+
process.env.NODE_ENV || (process.env.NODE_ENV = 'build' === command || 'preview' === command ? 'production' : 'development');
|
|
9443
9505
|
}
|
|
9444
9506
|
function showGreeting() {
|
|
9445
9507
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9446
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.
|
|
9508
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.7\n`);
|
|
9447
9509
|
}
|
|
9448
9510
|
function setupLogLevel() {
|
|
9449
|
-
|
|
9511
|
+
if (cli_argv.length <= 3) return;
|
|
9512
|
+
let logLevelIndex = cli_argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
9450
9513
|
if (-1 !== logLevelIndex) {
|
|
9451
9514
|
let level = process.argv[logLevelIndex + 1];
|
|
9452
9515
|
level && [
|
|
@@ -9457,12 +9520,12 @@ function setupLogLevel() {
|
|
|
9457
9520
|
}
|
|
9458
9521
|
}
|
|
9459
9522
|
function runCLI() {
|
|
9460
|
-
|
|
9523
|
+
initNodeEnv(cli_argv[2]), setupLogLevel(), showGreeting();
|
|
9461
9524
|
try {
|
|
9462
9525
|
setupCommands();
|
|
9463
9526
|
} catch (err) {
|
|
9464
9527
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
9465
9528
|
}
|
|
9466
9529
|
}
|
|
9467
|
-
let src_version = "2.0.
|
|
9530
|
+
let src_version = "2.0.7";
|
|
9468
9531
|
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/chokidar.js
CHANGED
|
@@ -1030,9 +1030,9 @@ class FSWatcher extends EventEmitter {
|
|
|
1030
1030
|
...opts,
|
|
1031
1031
|
depth: 0
|
|
1032
1032
|
});
|
|
1033
|
-
return this._streams.add(stream), stream.once(
|
|
1033
|
+
return this._streams.add(stream), stream.once("close", ()=>{
|
|
1034
1034
|
stream = void 0;
|
|
1035
|
-
}), stream.once(
|
|
1035
|
+
}), stream.once("end", ()=>{
|
|
1036
1036
|
stream && (this._streams.delete(stream), stream = void 0);
|
|
1037
1037
|
}), stream;
|
|
1038
1038
|
}
|