@rsbuild/core 2.0.6 → 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/postcss-loader/index.js +6 -6
- package/compiled/style-loader/index.js +10 -10
- package/dist/753.js +113 -52
- package/dist/chokidar.js +2 -2
- package/dist/http-proxy-middleware.js +12 -111
- package/dist/manifest-plugin.js +6 -6
- package/dist/memfs.js +2 -2
- package/dist/workerLoader.mjs +94 -0
- package/dist/ws.js +29 -27
- 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/externals.d.ts +8 -1
- package/dist-types/plugins/worker.d.ts +2 -0
- 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 +6 -6
- package/types.d.ts +42 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
840: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(701);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
}
|
|
312
312
|
module.exports = { CachedChildCompilation };
|
|
313
313
|
},
|
|
314
|
-
|
|
314
|
+
701: (module) => {
|
|
315
315
|
"use strict";
|
|
316
316
|
class HtmlWebpackChildCompiler {
|
|
317
317
|
constructor(templates) {
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
}
|
|
481
481
|
module.exports = { HtmlWebpackChildCompiler };
|
|
482
482
|
},
|
|
483
|
-
|
|
483
|
+
339: (module) => {
|
|
484
484
|
"use strict";
|
|
485
485
|
module.exports = {};
|
|
486
486
|
module.exports.none = (chunks) => chunks;
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
};
|
|
500
500
|
module.exports.auto = module.exports.none;
|
|
501
501
|
},
|
|
502
|
-
|
|
502
|
+
118: (module) => {
|
|
503
503
|
"use strict";
|
|
504
504
|
module.exports = function (err) {
|
|
505
505
|
return {
|
|
@@ -523,7 +523,7 @@
|
|
|
523
523
|
};
|
|
524
524
|
};
|
|
525
525
|
},
|
|
526
|
-
|
|
526
|
+
53: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
527
527
|
"use strict";
|
|
528
528
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(159);
|
|
529
529
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -549,7 +549,7 @@
|
|
|
549
549
|
}
|
|
550
550
|
module.exports = { getHtmlRspackPluginHooks };
|
|
551
551
|
},
|
|
552
|
-
|
|
552
|
+
884: (module) => {
|
|
553
553
|
const voidTags = [
|
|
554
554
|
"area",
|
|
555
555
|
"base",
|
|
@@ -617,19 +617,19 @@
|
|
|
617
617
|
htmlTagObjectToString,
|
|
618
618
|
};
|
|
619
619
|
},
|
|
620
|
-
|
|
620
|
+
721: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
621
621
|
"use strict";
|
|
622
622
|
const promisify = __nccwpck_require__(23).promisify;
|
|
623
623
|
const vm = __nccwpck_require__(154);
|
|
624
624
|
const fs = __nccwpck_require__(896);
|
|
625
625
|
const path = __nccwpck_require__(928);
|
|
626
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
626
|
+
const { CachedChildCompilation } = __nccwpck_require__(840);
|
|
627
627
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
628
|
-
__nccwpck_require__(
|
|
629
|
-
const prettyError = __nccwpck_require__(
|
|
630
|
-
const chunkSorter = __nccwpck_require__(
|
|
628
|
+
__nccwpck_require__(884);
|
|
629
|
+
const prettyError = __nccwpck_require__(118);
|
|
630
|
+
const chunkSorter = __nccwpck_require__(339);
|
|
631
631
|
const getHtmlRspackPluginHooks =
|
|
632
|
-
__nccwpck_require__(
|
|
632
|
+
__nccwpck_require__(53).getHtmlRspackPluginHooks;
|
|
633
633
|
const WITH_PLACEHOLDER = "function __with_placeholder__";
|
|
634
634
|
class HtmlRspackPlugin {
|
|
635
635
|
constructor(userOptions = {}) {
|
|
@@ -2398,6 +2398,6 @@
|
|
|
2398
2398
|
}
|
|
2399
2399
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
2400
2400
|
__nccwpck_require__.ab = __dirname + "/";
|
|
2401
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
2401
|
+
var __webpack_exports__ = __nccwpck_require__(721);
|
|
2402
2402
|
module.exports = __webpack_exports__;
|
|
2403
2403
|
})();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
470: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(828)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
828: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
8
8
|
var __webpack_unused_export__;
|
|
9
9
|
__webpack_unused_export__ = { value: true };
|
|
10
10
|
exports["default"] = loader;
|
|
11
11
|
var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(773);
|
|
13
13
|
function _interopRequireDefault(e) {
|
|
14
14
|
return e && e.__esModule ? e : { default: e };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
773: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -716,6 +716,6 @@
|
|
|
716
716
|
})();
|
|
717
717
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
718
718
|
__nccwpck_require__.ab = __dirname + "/";
|
|
719
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
719
|
+
var __webpack_exports__ = __nccwpck_require__(470);
|
|
720
720
|
module.exports = __webpack_exports__;
|
|
721
721
|
})();
|
|
@@ -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);
|
|
@@ -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)){
|
|
@@ -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
|
}
|
|
@@ -5539,12 +5592,11 @@ async function ensureFileDir(outputFilePath) {
|
|
|
5539
5592
|
}
|
|
5540
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
|
|
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);
|
|
@@ -8347,6 +8399,7 @@ try {
|
|
|
8347
8399
|
MODE: JSON.stringify(config.mode),
|
|
8348
8400
|
DEV: 'development' === config.mode,
|
|
8349
8401
|
PROD: 'production' === config.mode,
|
|
8402
|
+
SSR: 'node' === config.output.target,
|
|
8350
8403
|
BASE_URL: baseUrl,
|
|
8351
8404
|
ASSET_PREFIX: assetPrefix
|
|
8352
8405
|
},
|
|
@@ -8539,6 +8592,17 @@ try {
|
|
|
8539
8592
|
});
|
|
8540
8593
|
}
|
|
8541
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
|
+
},
|
|
8542
8606
|
{
|
|
8543
8607
|
name: PLUGIN_SWC_NAME,
|
|
8544
8608
|
setup (api) {
|
|
@@ -8757,7 +8821,9 @@ try {
|
|
|
8757
8821
|
}), api.modifyBundlerChain((chain, { CHAIN_ID, environment, isDev })=>{
|
|
8758
8822
|
let { config, htmlPaths } = environment;
|
|
8759
8823
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
8760
|
-
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)=>{
|
|
8761
8827
|
let { scriptTests, styleTests } = getInlineTests(config);
|
|
8762
8828
|
return [
|
|
8763
8829
|
...scriptTests,
|
|
@@ -8854,7 +8920,7 @@ try {
|
|
|
8854
8920
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
8855
8921
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
8856
8922
|
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.
|
|
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'));
|
|
8858
8924
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
8859
8925
|
let pluginOptions = {
|
|
8860
8926
|
fileName: manifestOptions.filename,
|
|
@@ -8938,7 +9004,7 @@ try {
|
|
|
8938
9004
|
api.onBeforeBuild(async ({ isFirstCompile })=>{
|
|
8939
9005
|
isFirstCompile && await onStart();
|
|
8940
9006
|
}), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
|
|
8941
|
-
traceOutput && (core_rspack.experiments.globalTrace.cleanup(),
|
|
9007
|
+
traceOutput && (core_rspack.experiments.globalTrace.cleanup(), isTerminalTraceOutput(traceOutput) || api.logger.info(`profile file saved to ${color.cyan(traceOutput)}`));
|
|
8942
9008
|
});
|
|
8943
9009
|
}
|
|
8944
9010
|
},
|
|
@@ -9274,7 +9340,7 @@ let commonOpts = {}, init_loadConfig = async (root)=>{
|
|
|
9274
9340
|
]), config;
|
|
9275
9341
|
};
|
|
9276
9342
|
async function init_init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
9277
|
-
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(',')));
|
|
9278
9344
|
let logger = src_logger;
|
|
9279
9345
|
try {
|
|
9280
9346
|
var envDir;
|
|
@@ -9368,7 +9434,7 @@ let applyServerOptions = (command)=>{
|
|
|
9368
9434
|
};
|
|
9369
9435
|
function setupCommands() {
|
|
9370
9436
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9371
|
-
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)', {
|
|
9372
9438
|
default: 'auto'
|
|
9373
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', {
|
|
9374
9440
|
type: [
|
|
@@ -9434,21 +9500,16 @@ function setupCommands() {
|
|
|
9434
9500
|
}), cli.parse();
|
|
9435
9501
|
}
|
|
9436
9502
|
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
|
-
}
|
|
9503
|
+
function initNodeEnv(command) {
|
|
9504
|
+
process.env.NODE_ENV || (process.env.NODE_ENV = 'build' === command || 'preview' === command ? 'production' : 'development');
|
|
9445
9505
|
}
|
|
9446
9506
|
function showGreeting() {
|
|
9447
9507
|
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.
|
|
9508
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.7\n`);
|
|
9449
9509
|
}
|
|
9450
9510
|
function setupLogLevel() {
|
|
9451
|
-
|
|
9511
|
+
if (cli_argv.length <= 3) return;
|
|
9512
|
+
let logLevelIndex = cli_argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
9452
9513
|
if (-1 !== logLevelIndex) {
|
|
9453
9514
|
let level = process.argv[logLevelIndex + 1];
|
|
9454
9515
|
level && [
|
|
@@ -9459,12 +9520,12 @@ function setupLogLevel() {
|
|
|
9459
9520
|
}
|
|
9460
9521
|
}
|
|
9461
9522
|
function runCLI() {
|
|
9462
|
-
|
|
9523
|
+
initNodeEnv(cli_argv[2]), setupLogLevel(), showGreeting();
|
|
9463
9524
|
try {
|
|
9464
9525
|
setupCommands();
|
|
9465
9526
|
} catch (err) {
|
|
9466
9527
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
9467
9528
|
}
|
|
9468
9529
|
}
|
|
9469
|
-
let src_version = "2.0.
|
|
9530
|
+
let src_version = "2.0.7";
|
|
9470
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
|
}
|