@rsbuild/core 2.2.2 → 2.2.4
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/lib/container.d.ts +16 -20
- package/compiled/postcss/lib/declaration.d.ts +2 -2
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +120 -36
- package/dist/626.js +120 -103
- package/dist/client/hmr.js +2 -2
- package/dist/cors.js +5 -5
- package/dist/http-proxy-middleware.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/manifest-plugin.js +1 -1
- package/dist/memfs.js +1 -1
- package/dist/range-parser.js +3 -3
- package/dist/rslib-runtime.js +19 -17
- package/dist/server/assets-middleware/middleware.d.ts +5 -0
- package/dist/server/helper.d.ts +1 -1
- package/dist/server/open.d.ts +2 -2
- package/dist/tinyglobby.js +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/hooks.d.ts +3 -2
- package/dist/ws.js +2 -2
- package/package.json +5 -5
package/dist/626.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*! LICENSE: 626.js.LICENSE.txt */
|
|
2
2
|
let runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
|
|
3
|
+
import { rspackRequire, moduleFactories, compatGetDefaultExport, createFakeNamespaceObject } from "./rslib-runtime.js";
|
|
3
4
|
import { rspack as core_rspack } from "@rspack/core";
|
|
4
5
|
import node_util, { stripVTControlCharacters } from "node:util";
|
|
5
6
|
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";
|
|
@@ -12,10 +13,9 @@ import { isPromise, isRegExp } from "node:util/types";
|
|
|
12
13
|
import { readFile } from "node:fs/promises";
|
|
13
14
|
import node_zlib from "node:zlib";
|
|
14
15
|
import { once } from "node:events";
|
|
15
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
16
16
|
var superClass, superClass1, __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
|
|
17
17
|
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
18
|
-
|
|
18
|
+
moduleFactories.add({
|
|
19
19
|
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/deepmerge/4.3.1/56471899410038644780b3527c5076e78d3f57091a0da3ac0daf6d994929353d/node_modules/deepmerge/dist/cjs.js" (module) {
|
|
20
20
|
var isMergeableObject = function isMergeableObject(value) {
|
|
21
21
|
return isNonNullObject(value) && !isSpecial(value);
|
|
@@ -151,8 +151,8 @@ __webpack_require__.add({
|
|
|
151
151
|
return thunk.cancel = cleanup, thunk;
|
|
152
152
|
};
|
|
153
153
|
},
|
|
154
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js" (module
|
|
155
|
-
let path =
|
|
154
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js" (module) {
|
|
155
|
+
let path = rspackRequire("path?37f5"), fs = rspackRequire("fs?cdbd"), os = rspackRequire("os"), url = rspackRequire("url?5f07"), fsReadFileAsync = fs.promises.readFile;
|
|
156
156
|
function getDefaultSearchPlaces(name, sync) {
|
|
157
157
|
return [
|
|
158
158
|
'package.json',
|
|
@@ -321,9 +321,9 @@ __webpack_require__.add({
|
|
|
321
321
|
};
|
|
322
322
|
};
|
|
323
323
|
},
|
|
324
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js" (module
|
|
324
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js" (module) {
|
|
325
325
|
module.exports = onFinished, module.exports.isFinished = isFinished;
|
|
326
|
-
var asyncHooks = tryRequireAsyncHooks(), first =
|
|
326
|
+
var asyncHooks = tryRequireAsyncHooks(), first = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ee-first/1.1.1/7d7aff2abffb03f454b885edc2f03bd078376c8cde75af0c324753fee26268de/node_modules/ee-first/index.js"), defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
|
|
327
327
|
process.nextTick(fn.bind.apply(fn, arguments));
|
|
328
328
|
};
|
|
329
329
|
function onFinished(msg, listener) {
|
|
@@ -377,7 +377,7 @@ __webpack_require__.add({
|
|
|
377
377
|
}
|
|
378
378
|
function tryRequireAsyncHooks() {
|
|
379
379
|
try {
|
|
380
|
-
return
|
|
380
|
+
return rspackRequire("async_hooks");
|
|
381
381
|
} catch (e) {
|
|
382
382
|
return {};
|
|
383
383
|
}
|
|
@@ -387,8 +387,8 @@ __webpack_require__.add({
|
|
|
387
387
|
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
388
388
|
}
|
|
389
389
|
},
|
|
390
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
391
|
-
let yaml, { resolve } =
|
|
390
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/index.js" (module) {
|
|
391
|
+
let yaml, { resolve } = rspackRequire("node:path?815c"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/options.js"), loadPlugins = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/plugins.js"), req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js");
|
|
392
392
|
async function processResult(ctx, result) {
|
|
393
393
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
394
394
|
default: obj
|
|
@@ -461,8 +461,8 @@ __webpack_require__.add({
|
|
|
461
461
|
});
|
|
462
462
|
};
|
|
463
463
|
},
|
|
464
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
465
|
-
let req =
|
|
464
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/options.js" (module) {
|
|
465
|
+
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js");
|
|
466
466
|
module.exports = async function options(config, file) {
|
|
467
467
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
468
468
|
config.parser = await req(config.parser, file);
|
|
@@ -482,8 +482,8 @@ __webpack_require__.add({
|
|
|
482
482
|
return config;
|
|
483
483
|
};
|
|
484
484
|
},
|
|
485
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
486
|
-
let req =
|
|
485
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/plugins.js" (module) {
|
|
486
|
+
let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js");
|
|
487
487
|
async function load(plugin, options, file) {
|
|
488
488
|
try {
|
|
489
489
|
if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
|
|
@@ -499,8 +499,8 @@ __webpack_require__.add({
|
|
|
499
499
|
}), list;
|
|
500
500
|
};
|
|
501
501
|
},
|
|
502
|
-
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/
|
|
503
|
-
let tsx, jiti, { createRequire } =
|
|
502
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js" (module) {
|
|
503
|
+
let tsx, jiti, { createRequire } = rspackRequire("node:module?f56b"), { pathToFileURL } = rspackRequire("node:url?5295"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
504
504
|
module.exports = async function req(name, rootFile = __rspack_import_meta_filename__) {
|
|
505
505
|
let url = createRequire(rootFile).resolve(name);
|
|
506
506
|
try {
|
|
@@ -707,8 +707,8 @@ function applyDebugOverride(targetLogger) {
|
|
|
707
707
|
targetLogger.override({
|
|
708
708
|
debug: (message, ...args)=>{
|
|
709
709
|
if ('verbose' !== targetLogger.level) return;
|
|
710
|
-
let time = color.gray(getTime())
|
|
711
|
-
|
|
710
|
+
let time = color.gray(getTime()), loggerConsole = targetLogger.options.console ?? console, prefix = ` ${color.magenta('rsbuild')} ${time}`;
|
|
711
|
+
'string' == typeof message ? loggerConsole.log(`${prefix} ${message}`, ...args) : loggerConsole.log(prefix, message, ...args);
|
|
712
712
|
}
|
|
713
713
|
});
|
|
714
714
|
}
|
|
@@ -1154,17 +1154,17 @@ let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirnam
|
|
|
1154
1154
|
'vtt'
|
|
1155
1155
|
], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
|
|
1156
1156
|
var __webpack_modules__ = {}, __webpack_module_cache__ = {};
|
|
1157
|
-
function
|
|
1157
|
+
function dist_webpack_require_(moduleId) {
|
|
1158
1158
|
var cachedModule = __webpack_module_cache__[moduleId];
|
|
1159
1159
|
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
1160
1160
|
var module = __webpack_module_cache__[moduleId] = {
|
|
1161
1161
|
exports: {}
|
|
1162
1162
|
};
|
|
1163
|
-
return __webpack_modules__[moduleId](module, module.exports,
|
|
1163
|
+
return __webpack_modules__[moduleId](module, module.exports, dist_webpack_require_), module.exports;
|
|
1164
1164
|
}
|
|
1165
|
-
|
|
1166
|
-
Object.assign(
|
|
1167
|
-
},
|
|
1165
|
+
dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = function(modules) {
|
|
1166
|
+
Object.assign(dist_webpack_require_.m, modules);
|
|
1167
|
+
}, dist_webpack_require_.add({
|
|
1168
1168
|
"./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js" (module) {
|
|
1169
1169
|
var isMergeableObject = function(value) {
|
|
1170
1170
|
return isNonNullObject(value) && !isSpecial(value);
|
|
@@ -1234,8 +1234,8 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1234
1234
|
}, {});
|
|
1235
1235
|
}, module.exports = deepmerge;
|
|
1236
1236
|
},
|
|
1237
|
-
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module,
|
|
1238
|
-
|
|
1237
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module, __nested_rspack_exports__) {
|
|
1238
|
+
__nested_rspack_exports__.arrayToString = void 0, __nested_rspack_exports__.arrayToString = (array, space, next)=>{
|
|
1239
1239
|
let values = array.map(function(value, index) {
|
|
1240
1240
|
let result = next(value, index);
|
|
1241
1241
|
return void 0 === result ? String(result) : space + result.split("\n").join(`\n${space}`);
|
|
@@ -1243,9 +1243,9 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1243
1243
|
return `[${eol}${values}${eol}]`;
|
|
1244
1244
|
};
|
|
1245
1245
|
},
|
|
1246
|
-
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module,
|
|
1247
|
-
|
|
1248
|
-
let quote_1 =
|
|
1246
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
|
|
1247
|
+
__nested_rspack_exports__.functionToString = __nested_rspack_exports__.USED_METHOD_KEY = void 0;
|
|
1248
|
+
let quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), METHOD_NAMES_ARE_QUOTED = '"' === ({
|
|
1249
1249
|
" " () {}
|
|
1250
1250
|
})[" "].toString().charAt(0), FUNCTION_PREFIXES = {
|
|
1251
1251
|
Function: "function ",
|
|
@@ -1268,9 +1268,9 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1268
1268
|
}
|
|
1269
1269
|
return found ? fnString.split(`\n${found}`).join("\n") : fnString;
|
|
1270
1270
|
}
|
|
1271
|
-
|
|
1271
|
+
__nested_rspack_exports__.USED_METHOD_KEY = new WeakSet(), __nested_rspack_exports__.functionToString = (fn, space, next, key)=>{
|
|
1272
1272
|
let name = "string" == typeof key ? key : void 0;
|
|
1273
|
-
return void 0 !== name &&
|
|
1273
|
+
return void 0 !== name && __nested_rspack_exports__.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
|
|
1274
1274
|
};
|
|
1275
1275
|
class FunctionParser {
|
|
1276
1276
|
constructor(fn, indent, next, key){
|
|
@@ -1378,13 +1378,13 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
1380
|
},
|
|
1381
|
-
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module,
|
|
1382
|
-
|
|
1383
|
-
let stringify_1 =
|
|
1381
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
|
|
1382
|
+
__nested_rspack_exports__.A = void 0;
|
|
1383
|
+
let stringify_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"), quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), ROOT_SENTINEL = Symbol("root");
|
|
1384
1384
|
function replacerToString(replacer) {
|
|
1385
1385
|
return replacer ? (value, space, next, key)=>replacer(value, space, (value)=>stringify_1.toString(value, space, next, key), key) : stringify_1.toString;
|
|
1386
1386
|
}
|
|
1387
|
-
|
|
1387
|
+
__nested_rspack_exports__.A = function stringify(value, replacer, indent, options = {}) {
|
|
1388
1388
|
let space = "string" == typeof indent ? indent : " ".repeat(indent || 0), path = [], stack = new Set(), tracking = new Map(), unpack = new Map(), valueCount = 0, { maxDepth = 100, references = !1, skipUndefinedProperties = !1, maxValues = 100000 } = options, valueToString = replacerToString(replacer), onNext = (value, key)=>{
|
|
1389
1389
|
if (++valueCount > maxValues || skipUndefinedProperties && void 0 === value || path.length > maxDepth) return;
|
|
1390
1390
|
if (void 0 === key) return valueToString(value, space, onNext, key);
|
|
@@ -1414,10 +1414,10 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1414
1414
|
return result;
|
|
1415
1415
|
};
|
|
1416
1416
|
},
|
|
1417
|
-
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module,
|
|
1418
|
-
|
|
1419
|
-
let quote_1 =
|
|
1420
|
-
|
|
1417
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
|
|
1418
|
+
__nested_rspack_exports__.objectToString = void 0;
|
|
1419
|
+
let quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), function_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), array_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js");
|
|
1420
|
+
__nested_rspack_exports__.objectToString = (value, space, next, key)=>{
|
|
1421
1421
|
if ("function" == typeof Buffer && Buffer.isBuffer(value)) return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
|
|
1422
1422
|
if ("object" == typeof global && value === global) return globalToString(value, space, next);
|
|
1423
1423
|
let toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
|
|
@@ -1446,8 +1446,8 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1446
1446
|
"[object Window]": globalToString
|
|
1447
1447
|
};
|
|
1448
1448
|
},
|
|
1449
|
-
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module,
|
|
1450
|
-
|
|
1449
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module, __nested_rspack_exports__) {
|
|
1450
|
+
__nested_rspack_exports__.stringifyPath = __nested_rspack_exports__.quoteKey = __nested_rspack_exports__.isValidVariableName = __nested_rspack_exports__.W = __nested_rspack_exports__.quoteString = void 0;
|
|
1451
1451
|
let ESCAPABLE = /[\\\'\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, META_CHARS = new Map([
|
|
1452
1452
|
[
|
|
1453
1453
|
"\b",
|
|
@@ -1485,24 +1485,24 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1485
1485
|
function escapeChar(char) {
|
|
1486
1486
|
return META_CHARS.get(char) || `\\u${`0000${char.charCodeAt(0).toString(16)}`.slice(-4)}`;
|
|
1487
1487
|
}
|
|
1488
|
-
|
|
1488
|
+
__nested_rspack_exports__.quoteString = function quoteString(str) {
|
|
1489
1489
|
return `'${str.replace(ESCAPABLE, escapeChar)}'`;
|
|
1490
1490
|
};
|
|
1491
1491
|
let RESERVED_WORDS = new Set("break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "));
|
|
1492
1492
|
function isValidVariableName(name) {
|
|
1493
|
-
return "string" == typeof name && !RESERVED_WORDS.has(name) &&
|
|
1493
|
+
return "string" == typeof name && !RESERVED_WORDS.has(name) && __nested_rspack_exports__.W.test(name);
|
|
1494
1494
|
}
|
|
1495
|
-
|
|
1495
|
+
__nested_rspack_exports__.W = /^[A-Za-z_$][A-Za-z0-9_$]*$/, __nested_rspack_exports__.isValidVariableName = isValidVariableName, __nested_rspack_exports__.quoteKey = function quoteKey(key, next) {
|
|
1496
1496
|
return isValidVariableName(key) ? key : next(key);
|
|
1497
|
-
},
|
|
1497
|
+
}, __nested_rspack_exports__.stringifyPath = function stringifyPath(path, next) {
|
|
1498
1498
|
let result = "";
|
|
1499
1499
|
for (let key of path)isValidVariableName(key) ? result += `.${key}` : result += `[${next(key)}]`;
|
|
1500
1500
|
return result;
|
|
1501
1501
|
};
|
|
1502
1502
|
},
|
|
1503
|
-
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module,
|
|
1504
|
-
|
|
1505
|
-
let quote_1 =
|
|
1503
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
|
|
1504
|
+
__nested_rspack_exports__.toString = void 0;
|
|
1505
|
+
let quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), object_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"), function_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), PRIMITIVE_TYPES = {
|
|
1506
1506
|
string: quote_1.quoteString,
|
|
1507
1507
|
number: (value)=>Object.is(value, -0) ? "-0" : String(value),
|
|
1508
1508
|
boolean: String,
|
|
@@ -1515,10 +1515,10 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
|
|
|
1515
1515
|
object: object_1.objectToString,
|
|
1516
1516
|
function: function_1.functionToString
|
|
1517
1517
|
};
|
|
1518
|
-
|
|
1518
|
+
__nested_rspack_exports__.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
|
|
1519
1519
|
}
|
|
1520
1520
|
});
|
|
1521
|
-
let cjs =
|
|
1521
|
+
let cjs = dist_webpack_require_("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
1522
1522
|
function createMap(superClass) {
|
|
1523
1523
|
return class extends superClass {
|
|
1524
1524
|
constructor(...args){
|
|
@@ -2088,7 +2088,7 @@ let Rule = Orderable(class extends ChainedMap {
|
|
|
2088
2088
|
'maxEntrypointSize'
|
|
2089
2089
|
]);
|
|
2090
2090
|
}
|
|
2091
|
-
}, dist =
|
|
2091
|
+
}, dist = dist_webpack_require_("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js"), castArray = (value)=>Array.isArray(value) ? value : [
|
|
2092
2092
|
value
|
|
2093
2093
|
];
|
|
2094
2094
|
class RspackChain extends ChainedMap {
|
|
@@ -2205,11 +2205,11 @@ class RspackChain extends ChainedMap {
|
|
|
2205
2205
|
]);
|
|
2206
2206
|
}
|
|
2207
2207
|
}
|
|
2208
|
-
let vendors_require = createRequire(import.meta.url)
|
|
2209
|
-
var cjs_0_default =
|
|
2208
|
+
let vendors_require = createRequire(import.meta.url);
|
|
2209
|
+
var cjs_0_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/deepmerge/4.3.1/56471899410038644780b3527c5076e78d3f57091a0da3ac0daf6d994929353d/node_modules/deepmerge/dist/cjs.js"));
|
|
2210
2210
|
let setNodeEnv = (env)=>{
|
|
2211
2211
|
process.env.NODE_ENV = env;
|
|
2212
|
-
}, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj), objectPrototype = Object.prototype,
|
|
2212
|
+
}, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj), objectPrototype = Object.prototype, helpers_getProto = Object.getPrototypeOf, isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && helpers_getProto(obj) === objectPrototype, helpers_castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
|
|
2213
2213
|
arr
|
|
2214
2214
|
], cloneDeep = (value)=>null == value ? value : cjs_0_default()({}, value, {
|
|
2215
2215
|
isMergeableObject: isPlainObject
|
|
@@ -2704,7 +2704,7 @@ let ensureAbsolutePath = (base, filePath)=>external_node_path_isAbsolute(filePat
|
|
|
2704
2704
|
} catch {
|
|
2705
2705
|
return url;
|
|
2706
2706
|
}
|
|
2707
|
-
}, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.
|
|
2707
|
+
}, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.some((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === sep ? filepath : filepath.replace(/\\/g, '/'), normalizeRuleConditionPath = (filepath)=>isWindows && 'string' == typeof filepath && filepath.includes('/') && win32.isAbsolute(filepath) ? filepath.replace(/\//g, '\\') : filepath, isFileSync = (filePath)=>{
|
|
2708
2708
|
try {
|
|
2709
2709
|
return node_fs.statSync(filePath, {
|
|
2710
2710
|
throwIfNoEntry: !1
|
|
@@ -3181,7 +3181,7 @@ let mapProcessAssetsStage = (stage)=>{
|
|
|
3181
3181
|
case 'report':
|
|
3182
3182
|
return Compilation.PROCESS_ASSETS_STAGE_REPORT;
|
|
3183
3183
|
default:
|
|
3184
|
-
throw Error(`${color.dim('[rsbuild]')} Invalid process assets stage: ${stage}`);
|
|
3184
|
+
throw Error(`${color.dim('[rsbuild]')} Invalid process assets stage: ${String(stage)}`);
|
|
3185
3185
|
}
|
|
3186
3186
|
};
|
|
3187
3187
|
function initPluginAPI({ context, pluginManager }) {
|
|
@@ -3425,7 +3425,7 @@ function createPublicContext(context) {
|
|
|
3425
3425
|
async function createContext(options, userConfig, logger, loadConfigResult) {
|
|
3426
3426
|
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, hooks = initHooks();
|
|
3427
3427
|
return {
|
|
3428
|
-
version: "2.2.
|
|
3428
|
+
version: "2.2.4",
|
|
3429
3429
|
rootPath,
|
|
3430
3430
|
configFile: loadConfigResult?.filePath ?? userConfig._privateMeta?.configFilePath,
|
|
3431
3431
|
configFileDependencies: loadConfigResult?.dependencies ?? userConfig._privateMeta?.configFileDependencies ?? [],
|
|
@@ -4099,8 +4099,8 @@ async function createCompiler_createCompiler(options) {
|
|
|
4099
4099
|
'true' === process.env.RSPACK_UNSAFE_FAST_DROP && (compiler.unsafeFastDrop = !0);
|
|
4100
4100
|
let isVersionLogged = !1, isCompiling = !1, hasFatalError = !1, compilers = isMultiCompiler ? compiler.compilers : [
|
|
4101
4101
|
compiler
|
|
4102
|
-
], finishFatalBuild = ()=>{
|
|
4103
|
-
!hasFatalError || compilers.some((item)=>item.watching ? item.watching.running : item.running) || (context.buildState.status = 'failed', context.buildState.hasErrors = !0, isCompiling = !1);
|
|
4102
|
+
], deferBuildLogs = isMultiCompiler && context.environmentList.some(({ config })=>config.dev.progressBar), pendingBuildLogs = [], finishFatalBuild = ()=>{
|
|
4103
|
+
!hasFatalError || compilers.some((item)=>item.watching ? item.watching.running : item.running) || (context.buildState.status = 'failed', context.buildState.hasErrors = !0, isCompiling = !1, pendingBuildLogs.length = 0);
|
|
4104
4104
|
}, logRspackVersion = ()=>{
|
|
4105
4105
|
isVersionLogged || (logger.debug(`using Rspack v${core_rspack.rspackVersion}`), isVersionLogged = !0);
|
|
4106
4106
|
}, lazyModules = new Set();
|
|
@@ -4126,7 +4126,9 @@ async function createCompiler_createCompiler(options) {
|
|
|
4126
4126
|
}), compilers))item.hooks.failed.tap(HOOK_NAME, ()=>{
|
|
4127
4127
|
hasFatalError = !0, context.buildState.hasErrors = !0, finishFatalBuild();
|
|
4128
4128
|
}), item.hooks.afterDone.tap(HOOK_NAME, finishFatalBuild), item.hooks.watchClose.tap(HOOK_NAME, finishFatalBuild);
|
|
4129
|
-
|
|
4129
|
+
compiler.hooks.shutdown.tap(HOOK_NAME, ()=>{
|
|
4130
|
+
pendingBuildLogs.length = 0;
|
|
4131
|
+
}), 'build' === context.action && (isMultiCompiler ? compiler.compilers[0] : compiler).hooks.run.tap(HOOK_NAME, ()=>{
|
|
4130
4132
|
logger.info('build started...'), logRspackVersion();
|
|
4131
4133
|
});
|
|
4132
4134
|
let printTime = (index, hasErrors)=>{
|
|
@@ -4144,15 +4146,20 @@ async function createCompiler_createCompiler(options) {
|
|
|
4144
4146
|
if (0 === remainingSeconds) return minutesLabel;
|
|
4145
4147
|
let secondsLabel = format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)), 's');
|
|
4146
4148
|
return `${minutesLabel} ${secondsLabel}`;
|
|
4147
|
-
})(time / 1000)}${suffix}
|
|
4148
|
-
|
|
4149
|
+
})(time / 1000)}${suffix}`, log = ()=>{
|
|
4150
|
+
hasErrors ? logger.error(`build failed in ${timeStr}`) : logger.ready(`built in ${timeStr}`);
|
|
4151
|
+
};
|
|
4152
|
+
deferBuildLogs ? pendingBuildLogs.push(log) : log();
|
|
4149
4153
|
};
|
|
4150
4154
|
return isMultiCompiler && compiler.compilers.forEach((item, index)=>{
|
|
4151
|
-
item.hooks.done.tap(
|
|
4155
|
+
item.hooks.done.tap({
|
|
4156
|
+
name: HOOK_NAME,
|
|
4157
|
+
stage: -1
|
|
4158
|
+
}, (stats)=>{
|
|
4152
4159
|
printTime(index, stats.hasErrors());
|
|
4153
4160
|
});
|
|
4154
4161
|
}), compiler.hooks.done.tap(HOOK_NAME, (statsInstance)=>{
|
|
4155
|
-
hasFatalError = !1;
|
|
4162
|
+
for (let log of (hasFatalError = !1, pendingBuildLogs.splice(0)))log();
|
|
4156
4163
|
let stats = getRsbuildStats(statsInstance, compiler, logger, context.action), hasErrors = statsInstance.hasErrors();
|
|
4157
4164
|
context.buildState.stats = stats, context.buildState.status = 'done', context.buildState.hasErrors = hasErrors, context.socketServer?.onBuildDone();
|
|
4158
4165
|
let { message, level } = formatStats(stats, hasErrors, options.context.rootPath, logger);
|
|
@@ -4363,13 +4370,13 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
|
|
|
4363
4370
|
let stats, closeCompiler, closingPromise, unregisterRestart, restartWatcher, { watch } = buildOptions, { context } = initOptions, { logger } = context, { compiler, rspackConfigs } = await createCompiler_createCompiler(initOptions);
|
|
4364
4371
|
if ((({ context, isWatch, compiler, rspackConfigs, MultiStatsCtor })=>{
|
|
4365
4372
|
let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
|
|
4366
|
-
let promise = context.hooks.onAfterBuild.callBatch({
|
|
4373
|
+
let shouldLogWatching = isWatch && isFirstCompile, promise = context.hooks.onAfterBuild.callBatch({
|
|
4367
4374
|
isFirstCompile,
|
|
4368
4375
|
stats,
|
|
4369
4376
|
environments: context.environments,
|
|
4370
4377
|
isWatch
|
|
4371
4378
|
});
|
|
4372
|
-
isFirstCompile = !1, await promise;
|
|
4379
|
+
isFirstCompile = !1, await promise, shouldLogWatching && context.logger.info('watching for changes...');
|
|
4373
4380
|
}, onEnvironmentDone = async (index, stats)=>{
|
|
4374
4381
|
let environment = environmentList[index], time = context.buildState.time[environment.name] ?? 0;
|
|
4375
4382
|
await context.hooks.onAfterEnvironmentCompile.callBatch({
|
|
@@ -4452,7 +4459,7 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
|
|
|
4452
4459
|
await restartWatcher?.close(), await closeBuild();
|
|
4453
4460
|
}
|
|
4454
4461
|
};
|
|
4455
|
-
}, main =
|
|
4462
|
+
}, main = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/dotenv-expand/13.0.0/1d3d360f4c41ed89366b79ec2c361d16e6aee7ab6c47163ea4f3718f7f78cc4c/node_modules/dotenv-expand/lib/main.js"), DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
4456
4463
|
function loadEnv_parse(src) {
|
|
4457
4464
|
let match, obj = {}, lines = src.toString();
|
|
4458
4465
|
for(lines = lines.replace(/\r\n?/gm, '\n'); null != (match = DOTENV_LINE.exec(lines));){
|
|
@@ -5067,8 +5074,7 @@ function parseMinifyOptions(config) {
|
|
|
5067
5074
|
cssOptions: minify.cssOptions
|
|
5068
5075
|
};
|
|
5069
5076
|
}
|
|
5070
|
-
|
|
5071
|
-
var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
|
|
5077
|
+
var postcss_load_config_src_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/index.js"));
|
|
5072
5078
|
async function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
5073
5079
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
5074
5080
|
targets,
|
|
@@ -5514,7 +5520,7 @@ class RsbuildHtmlPlugin {
|
|
|
5514
5520
|
try {
|
|
5515
5521
|
fileContent = await readFileAsync(inputFs, inputFilename);
|
|
5516
5522
|
} catch (error) {
|
|
5517
|
-
return logger.debug(
|
|
5523
|
+
return logger.debug('read favicon error:', error), addCompilationError(compilation, `${color.dim('[rsbuild:html]')} Failed to read the favicon file at ${color.yellow(inputFilename)}.`), null;
|
|
5518
5524
|
}
|
|
5519
5525
|
let source = new core_rspack.sources.RawSource(fileContent, !1);
|
|
5520
5526
|
return compilation.emitAsset(outputFilename, source), outputFilename;
|
|
@@ -6312,7 +6318,7 @@ async function ensureFileDir(outputFilePath) {
|
|
|
6312
6318
|
});
|
|
6313
6319
|
}
|
|
6314
6320
|
async function applyProfile(root, filterValue, traceLayer, traceOutput) {
|
|
6315
|
-
if ('perfetto' !== traceLayer && 'logger' !== traceLayer) throw Error(`unsupported trace layer: ${traceLayer}`);
|
|
6321
|
+
if ('perfetto' !== traceLayer && 'logger' !== traceLayer) throw Error(`unsupported trace layer: ${String(traceLayer)}`);
|
|
6316
6322
|
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.');
|
|
6317
6323
|
let timestamp = Date.now(), defaultOutputDir = node_path.join(root, `.rspack-profile-${timestamp}-${process.pid}`);
|
|
6318
6324
|
traceOutput ? isTerminalTraceOutput(traceOutput) || (traceOutput = node_path.resolve(defaultOutputDir, traceOutput)) : traceOutput = node_path.resolve(defaultOutputDir, 'perfetto' === traceLayer ? 'rspack.pftrace' : 'rspack.log');
|
|
@@ -6476,7 +6482,7 @@ function getSplitChunksByPreset(config, preset) {
|
|
|
6476
6482
|
case 'none':
|
|
6477
6483
|
return {};
|
|
6478
6484
|
default:
|
|
6479
|
-
throw Error(`[rsbuild] Unknown splitChunks preset: ${preset}`);
|
|
6485
|
+
throw Error(`[rsbuild] Unknown splitChunks preset: ${String(preset)}`);
|
|
6480
6486
|
}
|
|
6481
6487
|
}
|
|
6482
6488
|
let builtinSwcLoaderName = 'builtin:swc-loader';
|
|
@@ -6593,13 +6599,23 @@ async function getFileFromUrl(url, outputFileSystem, context) {
|
|
|
6593
6599
|
if (pathname.includes('\0')) return {
|
|
6594
6600
|
errorCode: 400
|
|
6595
6601
|
};
|
|
6596
|
-
|
|
6602
|
+
let hasUpPath = UP_PATH_REGEXP.test(pathname);
|
|
6603
|
+
if (hasUpPath && UP_PATH_REGEXP.test(node_path.normalize(`./${pathname}`))) return {
|
|
6597
6604
|
errorCode: 403
|
|
6598
6605
|
};
|
|
6599
6606
|
let { environmentList, publicPathnames } = context, distPaths = environmentList.map((env)=>env.distPath), possibleFilenames = new Set();
|
|
6600
6607
|
for (let [index, distPath] of distPaths.entries()){
|
|
6601
6608
|
let prefix = publicPathnames[index];
|
|
6602
|
-
prefix && '/' !== prefix && isUrlPathUnderBase(pathname, prefix)
|
|
6609
|
+
if (prefix && '/' !== prefix && isUrlPathUnderBase(pathname, prefix)) {
|
|
6610
|
+
let candidatePath = node_path.join(distPath, pathname.slice(prefix.length));
|
|
6611
|
+
if (hasUpPath) {
|
|
6612
|
+
let relativePath = node_path.relative(distPath, candidatePath);
|
|
6613
|
+
if (UP_PATH_REGEXP.test(relativePath)) return {
|
|
6614
|
+
errorCode: 403
|
|
6615
|
+
};
|
|
6616
|
+
}
|
|
6617
|
+
possibleFilenames.add(candidatePath);
|
|
6618
|
+
}
|
|
6603
6619
|
}
|
|
6604
6620
|
for (let distPath of distPaths)possibleFilenames.add(node_path.join(distPath, pathname));
|
|
6605
6621
|
for (let filename of possibleFilenames){
|
|
@@ -6644,8 +6660,7 @@ function parseTokenList(str) {
|
|
|
6644
6660
|
}
|
|
6645
6661
|
return start !== end && list.push(str.substring(start, end)), list;
|
|
6646
6662
|
}
|
|
6647
|
-
|
|
6648
|
-
var on_finished_default = __webpack_require__.n(on_finished);
|
|
6663
|
+
var on_finished_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js"));
|
|
6649
6664
|
function getEtag(stat) {
|
|
6650
6665
|
let mtime = stat.mtime.getTime().toString(16), size = stat.size.toString(16);
|
|
6651
6666
|
return `W/"${size}-${mtime}"`;
|
|
@@ -6681,7 +6696,7 @@ function isPreconditionFailure(headers, res) {
|
|
|
6681
6696
|
let ifMatch = getRequestHeader(headers, 'if-match');
|
|
6682
6697
|
if (ifMatch) {
|
|
6683
6698
|
let etag = res.getHeader('ETag');
|
|
6684
|
-
return !etag || '*' !== ifMatch && parseTokenList(ifMatch).every((match)=>match !== etag && match !== `W/${etag}` && `W/${match}` !== etag);
|
|
6699
|
+
return !etag || '*' !== ifMatch && parseTokenList(ifMatch).every((match)=>match !== etag && match !== `W/${String(etag)}` && `W/${match}` !== etag);
|
|
6685
6700
|
}
|
|
6686
6701
|
let ifUnmodifiedSince = getRequestHeader(headers, 'if-unmodified-since');
|
|
6687
6702
|
if (ifUnmodifiedSince) {
|
|
@@ -6754,7 +6769,7 @@ function destroyStream(stream, suppress) {
|
|
|
6754
6769
|
}), 'function' == typeof stream.addListener && suppress && (stream.removeAllListeners('error'), stream.addListener('error', ()=>{}));
|
|
6755
6770
|
}
|
|
6756
6771
|
let parseRangeHeaders = async (value)=>{
|
|
6757
|
-
let { default: rangeParser } = await import("./range-parser.js").then(
|
|
6772
|
+
let { default: rangeParser } = await import("./range-parser.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/range-parser/1.3.0/d49e5dcb9d0e39475844e240fad8cd1db6a58f4144f7ede43d9755e2fce5babc/node_modules/range-parser/index.js", 23)), [len, rangeHeader] = value.split('|');
|
|
6758
6773
|
return rangeParser(Number(len), rangeHeader, {
|
|
6759
6774
|
combine: !0
|
|
6760
6775
|
});
|
|
@@ -6783,8 +6798,13 @@ function sendError(res, code) {
|
|
|
6783
6798
|
let byteLength = Buffer.byteLength(document);
|
|
6784
6799
|
res.setHeader('Content-Length', byteLength), res.end(document);
|
|
6785
6800
|
}
|
|
6801
|
+
let filterWebEnvironments = (environmentList)=>environmentList.filter((environment)=>isWebTarget(environment.config.output.target));
|
|
6786
6802
|
function createAssetsMiddleware(context, ready, outputFileSystem) {
|
|
6787
|
-
let { logger } = context
|
|
6803
|
+
let { logger } = context, webEnvironments = filterWebEnvironments(context.environmentList), assetContext = {
|
|
6804
|
+
...context,
|
|
6805
|
+
environmentList: webEnvironments,
|
|
6806
|
+
publicPathnames: webEnvironments.map((environment)=>context.publicPathnames[environment.index])
|
|
6807
|
+
};
|
|
6788
6808
|
return async function assetsMiddleware(req, res, next) {
|
|
6789
6809
|
async function goNext() {
|
|
6790
6810
|
return new Promise((resolve)=>{
|
|
@@ -6796,7 +6816,7 @@ function createAssetsMiddleware(context, ready, outputFileSystem) {
|
|
|
6796
6816
|
req.method && 'GET' !== req.method && 'HEAD' !== req.method ? await goNext() : ready(async function processRequest() {
|
|
6797
6817
|
let readStream;
|
|
6798
6818
|
if (!req.url) return void await goNext();
|
|
6799
|
-
let resolved = await getFileFromUrl(req.url, outputFileSystem,
|
|
6819
|
+
let resolved = await getFileFromUrl(req.url, outputFileSystem, assetContext);
|
|
6800
6820
|
if (!resolved) return void await goNext();
|
|
6801
6821
|
if ('errorCode' in resolved) {
|
|
6802
6822
|
403 === resolved.errorCode ? logger.error(`[rsbuild:middleware] Malicious path "${req.url}".`) : 400 === resolved.errorCode && logger.error(`[rsbuild:middleware] Invalid pathname "${req.url}".`), sendError(res, resolved.errorCode);
|
|
@@ -6861,7 +6881,7 @@ function createAssetsMiddleware(context, ready, outputFileSystem) {
|
|
|
6861
6881
|
}
|
|
6862
6882
|
async function setupOutputFileSystem(writeToDisk, compilers) {
|
|
6863
6883
|
if (!0 !== writeToDisk) {
|
|
6864
|
-
let { createFsFromVolume, Volume } = await import("./memfs.js").then(
|
|
6884
|
+
let { createFsFromVolume, Volume } = await import("./memfs.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/memfs/4.71.0/717d01ef4d84cedabdf3b728d1862a444e82bbbcc379d834c8006e341a87f7d9/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
|
|
6865
6885
|
for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
|
|
6866
6886
|
}
|
|
6867
6887
|
let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
|
|
@@ -7100,7 +7120,7 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
|
|
|
7100
7120
|
originalPosition
|
|
7101
7121
|
};
|
|
7102
7122
|
} catch (error) {
|
|
7103
|
-
error instanceof Error && context.logger.debug(
|
|
7123
|
+
error instanceof Error && context.logger.debug('failed to map source map position:', error);
|
|
7104
7124
|
}
|
|
7105
7125
|
}, resolveOriginalLocation = async (stackFrames, fs, context, cachedTraceMap)=>{
|
|
7106
7126
|
let frame = stackFrames.find((frame)=>null !== frame.file && null !== frame.column && null !== frame.lineNumber && SCRIPT_REGEX.test(frame.file));
|
|
@@ -7120,7 +7140,7 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
|
|
|
7120
7140
|
let absoluteSourcePath = node_path.isAbsolute(source) ? source : node_path.join(node_path.dirname(sourceMapPath), source);
|
|
7121
7141
|
return node_path.relative(context.rootPath, absoluteSourcePath);
|
|
7122
7142
|
})(source, sourceMapPath, context);
|
|
7123
|
-
return
|
|
7143
|
+
return `${result}:${line}:${column}`;
|
|
7124
7144
|
}, formatFrameLocation = (frame)=>{
|
|
7125
7145
|
let { file, lineNumber, column } = frame;
|
|
7126
7146
|
if (file) return null !== lineNumber ? null !== column ? `${file}:${lineNumber}:${column}` : `${file}:${lineNumber}` : file;
|
|
@@ -7638,7 +7658,7 @@ function historyApiFallback_historyApiFallbackMiddleware(logger, options = {}) {
|
|
|
7638
7658
|
function parseReqUrl(req) {
|
|
7639
7659
|
let proto = req.headers['x-forwarded-proto'] || 'http', host = req.headers['x-forwarded-host'] || req.headers.host || LOCALHOST;
|
|
7640
7660
|
try {
|
|
7641
|
-
return new external_node_url_URL(req.url || '/', `${proto}://${host}`);
|
|
7661
|
+
return new external_node_url_URL(req.url || '/', `${String(proto)}://${String(host)}`);
|
|
7642
7662
|
} catch {
|
|
7643
7663
|
return null;
|
|
7644
7664
|
}
|
|
@@ -7763,7 +7783,7 @@ async function createProxyMiddleware(proxyOptions, logger) {
|
|
|
7763
7783
|
let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer, middlewares, postCallbacks })=>{
|
|
7764
7784
|
let launchEditorHandlerPromise, upgradeEvents = [], { server } = config, { logger } = context;
|
|
7765
7785
|
if (server.cors) {
|
|
7766
|
-
let { default: corsMiddleware } = await import("./cors.js").then(
|
|
7786
|
+
let { default: corsMiddleware } = await import("./cors.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/cors/2.8.6/abeeebb4dd5e2293f01aa9f4c01ff28ab19103cfa7a845442d515e16cf051f35/node_modules/cors/lib/index.js", 23));
|
|
7767
7787
|
middlewares.use(corsMiddleware('boolean' == typeof server.cors ? {} : server.cors));
|
|
7768
7788
|
}
|
|
7769
7789
|
let { headers } = server;
|
|
@@ -7784,7 +7804,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
7784
7804
|
})), middlewares.use('/__open-in-editor', async (req, res, next)=>{
|
|
7785
7805
|
try {
|
|
7786
7806
|
(await (launchEditorHandlerPromise ??= (async ()=>{
|
|
7787
|
-
let { default: launchEditorMiddleware } = await import("./launch-editor-middleware.js").then(
|
|
7807
|
+
let { default: launchEditorMiddleware } = await import("./launch-editor-middleware.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/launch-editor-middleware/2.14.1/6d555a60526ad6844dc2673e73b564ffd44ca896ac31b809c7cc243f8e135c00/node_modules/launch-editor-middleware/index.js", 23));
|
|
7788
7808
|
return launchEditorMiddleware();
|
|
7789
7809
|
})()))(req, res, next);
|
|
7790
7810
|
} catch (err) {
|
|
@@ -7920,13 +7940,13 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
7920
7940
|
if (moduleExports instanceof Module) return moduleExports;
|
|
7921
7941
|
let normalizedModuleExports = null !== moduleExports && ('object' == typeof moduleExports || 'function' == typeof moduleExports) ? moduleExports : {
|
|
7922
7942
|
default: moduleExports
|
|
7923
|
-
},
|
|
7943
|
+
}, __nested_rspack_exports__ = [
|
|
7924
7944
|
...new Set([
|
|
7925
7945
|
'default',
|
|
7926
7946
|
...Object.keys(normalizedModuleExports)
|
|
7927
7947
|
])
|
|
7928
|
-
], syntheticModule = new SyntheticModule(
|
|
7929
|
-
for (let name of
|
|
7948
|
+
], syntheticModule = new SyntheticModule(__nested_rspack_exports__, ()=>{
|
|
7949
|
+
for (let name of __nested_rspack_exports__)if ('default' === name) {
|
|
7930
7950
|
let defaultExport = isModuleNamespaceObject(normalizedModuleExports) && 'default' in normalizedModuleExports ? normalizedModuleExports.default : moduleExports;
|
|
7931
7951
|
syntheticModule.setExport(name, defaultExport);
|
|
7932
7952
|
} else syntheticModule.setExport(name, normalizedModuleExports[name]);
|
|
@@ -8423,7 +8443,7 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
|
|
|
8423
8443
|
}), logger.debug('create dev server done'), devServer;
|
|
8424
8444
|
}
|
|
8425
8445
|
async function startPreviewServer(context, config, { getPortSilently } = {}) {
|
|
8426
|
-
let
|
|
8446
|
+
let { logger } = context, { connect } = await import("./connect-next.js"), middlewares = connect(), { port, portTip } = await resolvePort(config), serverConfig = config.server, { host, headers, proxy, historyApiFallback, compress, base, cors } = serverConfig, assetPrefixes = context.environmentList.map((environment)=>environment.config.output.assetPrefix);
|
|
8427
8447
|
context.publicPathnames = getPublicPathnames(assetPrefixes, base);
|
|
8428
8448
|
let protocol = serverConfig.https ? 'https' : 'http', routes = getRoutes(context), urls = await getAddressUrls({
|
|
8429
8449
|
protocol,
|
|
@@ -8467,17 +8487,13 @@ async function startPreviewServer(context, config, { getPortSilently } = {}) {
|
|
|
8467
8487
|
server: previewServer,
|
|
8468
8488
|
environments: context.environments
|
|
8469
8489
|
});
|
|
8470
|
-
let
|
|
8471
|
-
...context,
|
|
8472
|
-
environmentList,
|
|
8473
|
-
publicPathnames: environmentList.map((environment)=>context.publicPathnames[environment.index])
|
|
8474
|
-
}), assetsMiddleware = createAssetsMiddleware(assetContext, (callback)=>callback(), node_fs), htmlMiddlewareOptions = {
|
|
8490
|
+
let webEnvironments = filterWebEnvironments(context.environmentList), assetsMiddleware = createAssetsMiddleware(context, (callback)=>callback(), node_fs), htmlMiddlewareOptions = {
|
|
8475
8491
|
assetsMiddleware,
|
|
8476
|
-
distPaths:
|
|
8492
|
+
distPaths: webEnvironments.map((environment)=>environment.distPath),
|
|
8477
8493
|
outputFileSystem: node_fs
|
|
8478
8494
|
};
|
|
8479
8495
|
if (isVerbose(logger) && middlewares.use(getRequestLoggerMiddleware(logger)), cors) {
|
|
8480
|
-
let { default: corsMiddleware } = await import("./cors.js").then(
|
|
8496
|
+
let { default: corsMiddleware } = await import("./cors.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/cors/2.8.6/abeeebb4dd5e2293f01aa9f4c01ff28ab19103cfa7a845442d515e16cf051f35/node_modules/cors/lib/index.js", 23));
|
|
8481
8497
|
middlewares.use(corsMiddleware('boolean' == typeof cors ? {} : cors));
|
|
8482
8498
|
}
|
|
8483
8499
|
if (headers && middlewares.use((_req, res, next)=>{
|
|
@@ -8719,9 +8735,10 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8719
8735
|
}
|
|
8720
8736
|
});
|
|
8721
8737
|
let isESM = config.output.module;
|
|
8722
|
-
if (isServer && chain.output.
|
|
8723
|
-
|
|
8724
|
-
|
|
8738
|
+
if (isServer && chain.output.merge({
|
|
8739
|
+
library: {
|
|
8740
|
+
type: isESM ? 'module' : 'commonjs2'
|
|
8741
|
+
}
|
|
8725
8742
|
}), isESM) {
|
|
8726
8743
|
if ('web-worker' === target) throw Error('[rsbuild:config] `output.module: true` is not supported for web-worker target.');
|
|
8727
8744
|
chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
|
|
@@ -8809,7 +8826,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8809
8826
|
setup (api) {
|
|
8810
8827
|
let cleanAll = async (params)=>{
|
|
8811
8828
|
for (let pathInfo of [
|
|
8812
|
-
...Object.values(params.environments).reduce((result, curr)=>(result.
|
|
8829
|
+
...Object.values(params.environments).reduce((result, curr)=>(result.some((item)=>item.distPath === curr.distPath) || result.push(curr), result), []).map((environment)=>((environment, isDev)=>{
|
|
8813
8830
|
let { rootPath } = api.context, { config, distPath } = environment, { enable, keep } = normalizeCleanDistPath(config.output.cleanDistPath);
|
|
8814
8831
|
return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
|
|
8815
8832
|
path: distPath,
|
|
@@ -9666,7 +9683,7 @@ try {
|
|
|
9666
9683
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
9667
9684
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
9668
9685
|
if (!1 === manifest) return;
|
|
9669
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(
|
|
9686
|
+
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(rspackRequire.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/0e24beaf1b234a114f5305075e91a7e73b51041985d9a6da39afa17869758a5c/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
9670
9687
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
9671
9688
|
let pluginOptions = {
|
|
9672
9689
|
fileName: manifestOptions.filename,
|
|
@@ -10209,7 +10226,7 @@ let applyServerOptions = (command)=>{
|
|
|
10209
10226
|
};
|
|
10210
10227
|
function setupCommands(argv) {
|
|
10211
10228
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
10212
|
-
cli.version("2.2.
|
|
10229
|
+
cli.version("2.2.4"), 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)', {
|
|
10213
10230
|
default: 'auto'
|
|
10214
10231
|
}).option('--dist-path <dir>', 'Set the root directory of output files').option('--source-map', 'Enable source map').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', {
|
|
10215
10232
|
type: [
|
|
@@ -10274,7 +10291,7 @@ function setupCommands(argv) {
|
|
|
10274
10291
|
}
|
|
10275
10292
|
function showGreeting() {
|
|
10276
10293
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10277
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.
|
|
10294
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.4\n`);
|
|
10278
10295
|
}
|
|
10279
10296
|
function setupLogLevel(argv) {
|
|
10280
10297
|
if (argv.length <= 3) return;
|
|
@@ -10296,5 +10313,5 @@ function runCLI({ argv = process.argv } = {}) {
|
|
|
10296
10313
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10297
10314
|
}
|
|
10298
10315
|
}
|
|
10299
|
-
let src_version = "2.2.
|
|
10316
|
+
let src_version = "2.2.4";
|
|
10300
10317
|
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, mrmime_lookup, runCLI, src_logger as logger, src_version as version };
|