@rsbuild/core 1.3.5 → 1.3.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 +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/lib/postcss.d.ts +1 -1
- package/compiled/postcss/lib/previous-map.d.ts +1 -1
- package/compiled/postcss/lib/source-map-js.d.ts +4 -0
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/webpack-bundle-analyzer/index.d.ts +1 -1
- package/dist/client/hmr.js +6 -9
- package/dist/client/overlay.js +4 -7
- package/dist/ignoreCssLoader.mjs +2 -2
- package/dist/index.cjs +157 -144
- package/dist/index.js +154 -142
- package/dist/transformLoader.mjs +3 -3
- package/dist/transformRawLoader.mjs +3 -3
- package/dist-types/helpers/exitHook.d.ts +3 -0
- package/dist-types/types/config.d.ts +1 -2
- package/dist-types/types/hooks.d.ts +5 -1
- package/dist-types/types/plugin.d.ts +2 -0
- package/dist-types/types/thirdParty.d.ts +1 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -13,13 +13,14 @@ import * as __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__ from "
|
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE_node_util_types_ce11fc49__ from "node:util/types";
|
|
14
14
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
15
15
|
import * as __WEBPACK_EXTERNAL_MODULE__compiled_rspack_chain_index_js_b67fefbd__ from "../compiled/rspack-chain/index.js";
|
|
16
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
17
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
|
|
16
18
|
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
17
19
|
import * as __WEBPACK_EXTERNAL_MODULE__compiled_mrmime_index_js_86f064ca__ from "../compiled/mrmime/index.js";
|
|
18
20
|
import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
|
|
19
21
|
import * as __WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__ from "node:zlib";
|
|
20
22
|
import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
|
|
21
23
|
import * as __WEBPACK_EXTERNAL_MODULE_node_net_0373943e__ from "node:net";
|
|
22
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
23
24
|
import * as __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__ from "node:inspector";
|
|
24
25
|
import * as __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__ from "node:assert";
|
|
25
26
|
import * as __WEBPACK_EXTERNAL_MODULE_node_readline_91c31510__ from "node:readline";
|
|
@@ -126,8 +127,8 @@ var EsmMode, __webpack_modules__ = {
|
|
|
126
127
|
return options;
|
|
127
128
|
};
|
|
128
129
|
},
|
|
129
|
-
"../../node_modules/.pnpm/dotenv@16.
|
|
130
|
-
let fs = __webpack_require__("fs"), path = __webpack_require__("path"), os = __webpack_require__("os"), crypto = __webpack_require__("crypto"), version = __webpack_require__("../../node_modules/.pnpm/dotenv@16.
|
|
130
|
+
"../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
131
|
+
let fs = __webpack_require__("fs"), path = __webpack_require__("path"), os = __webpack_require__("os"), crypto = __webpack_require__("crypto"), version = __webpack_require__("../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json").version, LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
131
132
|
function _debug(message) {
|
|
132
133
|
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
133
134
|
}
|
|
@@ -173,7 +174,7 @@ var EsmMode, __webpack_modules__ = {
|
|
|
173
174
|
};
|
|
174
175
|
},
|
|
175
176
|
_configVault: function(options) {
|
|
176
|
-
|
|
177
|
+
options && options.debug && _debug('Loading env from encrypted .env.vault');
|
|
177
178
|
let parsed = DotenvModule._parseVault(options), processEnv = process.env;
|
|
178
179
|
return options && null != options.processEnv && (processEnv = options.processEnv), DotenvModule.populate(processEnv, parsed, options), {
|
|
179
180
|
parsed
|
|
@@ -853,7 +854,7 @@ var EsmMode, __webpack_modules__ = {
|
|
|
853
854
|
return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
|
|
854
855
|
}
|
|
855
856
|
if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
|
|
856
|
-
for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null
|
|
857
|
+
for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null == (_a = entriesA[i][1]) ? void 0 : _a.toString()) !== (null == (_b = entriesB[i][1]) ? void 0 : _b.toString())) return !1;
|
|
857
858
|
return !0;
|
|
858
859
|
};
|
|
859
860
|
},
|
|
@@ -893,8 +894,8 @@ var EsmMode, __webpack_modules__ = {
|
|
|
893
894
|
path: function(module) {
|
|
894
895
|
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
895
896
|
},
|
|
896
|
-
"../../node_modules/.pnpm/dotenv@16.
|
|
897
|
-
module.exports = JSON.parse('{"name":"dotenv","version":"16.
|
|
897
|
+
"../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json": function(module) {
|
|
898
|
+
module.exports = JSON.parse('{"name":"dotenv","version":"16.5.0","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}');
|
|
898
899
|
}
|
|
899
900
|
}, __webpack_module_cache__ = {};
|
|
900
901
|
function __webpack_require__(moduleId) {
|
|
@@ -941,7 +942,7 @@ __webpack_require__.r(provider_helpers_namespaceObject), __webpack_require__.d(p
|
|
|
941
942
|
setHTMLPlugin: ()=>setHTMLPlugin,
|
|
942
943
|
stringifyConfig: ()=>stringifyConfig
|
|
943
944
|
});
|
|
944
|
-
var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.
|
|
945
|
+
var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@12.0.1/node_modules/dotenv-expand/lib/main.js"), cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"), cjs_default = __webpack_require__.n(cjs);
|
|
945
946
|
let constants_filename = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url), constants_dirname = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(constants_filename), ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(constants_dirname), STATIC_PATH = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(constants_dirname, '../static'), COMPILED_PATH = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(constants_dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_WEB_BROWSERSLIST = [
|
|
946
947
|
'chrome >= 87',
|
|
947
948
|
'edge >= 88',
|
|
@@ -1019,9 +1020,9 @@ let getCompiledPath = (packageName)=>(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b
|
|
|
1019
1020
|
}, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.find((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep ? filepath : filepath.replace(/\\/g, '/'), isFileSync = (filePath)=>{
|
|
1020
1021
|
try {
|
|
1021
1022
|
var _fs_statSync;
|
|
1022
|
-
return null
|
|
1023
|
+
return null == (_fs_statSync = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.statSync(filePath, {
|
|
1023
1024
|
throwIfNoEntry: !1
|
|
1024
|
-
}))
|
|
1025
|
+
})) ? void 0 : _fs_statSync.isFile();
|
|
1025
1026
|
} catch (_) {
|
|
1026
1027
|
return !1;
|
|
1027
1028
|
}
|
|
@@ -1037,10 +1038,7 @@ async function isFileExists(file) {
|
|
|
1037
1038
|
}
|
|
1038
1039
|
async function fileExistsByCompilation({ inputFileSystem }, filePath) {
|
|
1039
1040
|
return new Promise((resolve)=>{
|
|
1040
|
-
if (!inputFileSystem)
|
|
1041
|
-
resolve(!1);
|
|
1042
|
-
return;
|
|
1043
|
-
}
|
|
1041
|
+
if (!inputFileSystem) return void resolve(!1);
|
|
1044
1042
|
inputFileSystem.stat(filePath, (err, stats)=>{
|
|
1045
1043
|
err ? resolve(!1) : resolve(!!(null == stats ? void 0 : stats.isFile()));
|
|
1046
1044
|
});
|
|
@@ -1178,16 +1176,16 @@ function formatMessage(stats, verbose) {
|
|
|
1178
1176
|
function formatStatsMessages(stats, verbose) {
|
|
1179
1177
|
var _stats_errors, _stats_warnings;
|
|
1180
1178
|
return {
|
|
1181
|
-
errors: (null
|
|
1182
|
-
warnings: (null
|
|
1179
|
+
errors: (null == (_stats_errors = stats.errors) ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [],
|
|
1180
|
+
warnings: (null == (_stats_warnings = stats.warnings) ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || []
|
|
1183
1181
|
};
|
|
1184
1182
|
}
|
|
1185
1183
|
let getAllStatsErrors = (statsData)=>{
|
|
1186
1184
|
var _statsData_errors, _statsData_children;
|
|
1187
|
-
return statsData.errorsCount && (null
|
|
1185
|
+
return statsData.errorsCount && (null == (_statsData_errors = statsData.errors) ? void 0 : _statsData_errors.length) === 0 ? null == (_statsData_children = statsData.children) ? void 0 : _statsData_children.reduce((errors, curr)=>errors.concat(curr.errors || []), []) : statsData.errors;
|
|
1188
1186
|
}, getAllStatsWarnings = (statsData)=>{
|
|
1189
1187
|
var _statsData_warnings, _statsData_children;
|
|
1190
|
-
return statsData.warningsCount && (null
|
|
1188
|
+
return statsData.warningsCount && (null == (_statsData_warnings = statsData.warnings) ? void 0 : _statsData_warnings.length) === 0 ? null == (_statsData_children = statsData.children) ? void 0 : _statsData_children.reduce((warnings, curr)=>warnings.concat(curr.warnings || []), []) : statsData.warnings;
|
|
1191
1189
|
};
|
|
1192
1190
|
function getStatsOptions(compiler) {
|
|
1193
1191
|
if (helpers_isMultiCompiler(compiler)) return {
|
|
@@ -1414,7 +1412,7 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
1414
1412
|
let realKey = key.split('.').slice(2).join('.');
|
|
1415
1413
|
return OVERRIDE_PATHS.includes(realKey);
|
|
1416
1414
|
}
|
|
1417
|
-
return OVERRIDE_PATHS.includes(key);
|
|
1415
|
+
return OVERRIDE_PATHS.includes(key) || key.startsWith('output.filename.');
|
|
1418
1416
|
}, merge = (x, y, path = '')=>{
|
|
1419
1417
|
if (isOverridePath(path)) return y ?? x;
|
|
1420
1418
|
if (void 0 === x) return isPlainObject(y) ? cloneDeep(y) : y;
|
|
@@ -1579,7 +1577,7 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
1579
1577
|
}), withDefaultConfig = async (rootPath, config)=>{
|
|
1580
1578
|
var _merged_server, _config_dev, _config_output;
|
|
1581
1579
|
let merged = mergeRsbuildConfig(createDefaultConfig(), config);
|
|
1582
|
-
if (merged.root ||= rootPath, merged.source ||= {}, (null
|
|
1580
|
+
if (merged.root ||= rootPath, merged.source ||= {}, (null == (_merged_server = merged.server) ? void 0 : _merged_server.base) && ((null == (_config_dev = config.dev) ? void 0 : _config_dev.assetPrefix) === void 0 && (merged.dev ||= {}, merged.dev.assetPrefix = merged.server.base), (null == (_config_output = config.output) ? void 0 : _config_output.assetPrefix) === void 0 && (merged.output ||= {}, merged.output.assetPrefix = merged.server.base)), !merged.source.tsconfigPath) {
|
|
1583
1581
|
let tsconfigPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'tsconfig.json');
|
|
1584
1582
|
await isFileExists(tsconfigPath) && (merged.source.tsconfigPath = tsconfigPath);
|
|
1585
1583
|
}
|
|
@@ -1784,7 +1782,7 @@ async function initPlugins({ getPluginAPI, pluginManager }) {
|
|
|
1784
1782
|
for (let plugin of plugins){
|
|
1785
1783
|
var _removedPlugins_plugin_environment, _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL;
|
|
1786
1784
|
let isGlobalPlugin = 'RSBUILD_ALL_ENVIRONMENT_SYMBOL' === plugin.environment;
|
|
1787
|
-
if ((null
|
|
1785
|
+
if ((null == (_removedPlugins_plugin_environment = removedPlugins[plugin.environment]) ? void 0 : _removedPlugins_plugin_environment.includes(plugin.instance.name)) || !isGlobalPlugin && (null == (_removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL = removedPlugins[RSBUILD_ALL_ENVIRONMENT_SYMBOL]) ? void 0 : _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL.includes(plugin.instance.name))) continue;
|
|
1788
1786
|
let { instance, environment } = plugin;
|
|
1789
1787
|
await instance.setup(getPluginAPI(environment));
|
|
1790
1788
|
}
|
|
@@ -1989,7 +1987,17 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isW
|
|
|
1989
1987
|
onEnvironmentDone,
|
|
1990
1988
|
MultiStatsCtor
|
|
1991
1989
|
});
|
|
1992
|
-
},
|
|
1990
|
+
}, exitHook_callbacks = new Set(), isCalled = !1, isRegistered = !1;
|
|
1991
|
+
function exit(exitCode, type) {
|
|
1992
|
+
if (!isCalled) {
|
|
1993
|
+
for (let callback of (isCalled = !0, exitHook_callbacks))callback(exitCode);
|
|
1994
|
+
if ('SIGINT' === type) {
|
|
1995
|
+
let listeners = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__.default.listeners('SIGINT');
|
|
1996
|
+
Array.isArray(listeners) && listeners.length <= 1 && __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__.default.exit(exitCode);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
let mapProcessAssetsStage = (compiler, stage)=>{
|
|
1993
2001
|
let { Compilation } = compiler.webpack;
|
|
1994
2002
|
switch(stage){
|
|
1995
2003
|
case 'additional':
|
|
@@ -2090,7 +2098,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2090
2098
|
name,
|
|
2091
2099
|
distPath: function(cwd, config) {
|
|
2092
2100
|
var _config_output_distPath, _config_output;
|
|
2093
|
-
return getAbsolutePath(cwd, (null
|
|
2101
|
+
return getAbsolutePath(cwd, (null == (_config_output = config.output) || null == (_config_output_distPath = _config_output.distPath) ? void 0 : _config_output_distPath.root) ?? ROOT_DIST_DIR);
|
|
2094
2102
|
}(context.rootPath, config),
|
|
2095
2103
|
entry,
|
|
2096
2104
|
browserslist,
|
|
@@ -2107,7 +2115,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2107
2115
|
async function createContext(options, userConfig) {
|
|
2108
2116
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
2109
2117
|
return {
|
|
2110
|
-
version: "1.3.
|
|
2118
|
+
version: "1.3.7",
|
|
2111
2119
|
rootPath,
|
|
2112
2120
|
distPath: '',
|
|
2113
2121
|
cachePath,
|
|
@@ -2253,7 +2261,7 @@ async function modifyBundlerChain(context, utils) {
|
|
|
2253
2261
|
utils
|
|
2254
2262
|
]
|
|
2255
2263
|
});
|
|
2256
|
-
if (null
|
|
2264
|
+
if (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
|
|
2257
2265
|
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify bundler chain done'), modifiedBundlerChain;
|
|
2258
2266
|
}
|
|
2259
2267
|
let configChain_CHAIN_ID = {
|
|
@@ -2428,7 +2436,7 @@ let configChain_CHAIN_ID = {
|
|
|
2428
2436
|
}
|
|
2429
2437
|
}), isUseAnalyzer = (config)=>{
|
|
2430
2438
|
var _config_performance;
|
|
2431
|
-
return process.env.BUNDLE_ANALYZE || (null
|
|
2439
|
+
return process.env.BUNDLE_ANALYZE || (null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze);
|
|
2432
2440
|
};
|
|
2433
2441
|
async function validateWebpackCache(cacheDirectory, buildDependencies) {
|
|
2434
2442
|
let configFile = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cacheDirectory, 'buildDependencies.json');
|
|
@@ -2458,7 +2466,7 @@ async function getBuildDependencies(context, config, environmentContext, userBui
|
|
|
2458
2466
|
let { tsconfigPath } = environmentContext;
|
|
2459
2467
|
tsconfigPath && (buildDependencies.tsconfig = [
|
|
2460
2468
|
tsconfigPath
|
|
2461
|
-
]), (null
|
|
2469
|
+
]), (null == (_config__privateMeta = config._privateMeta) ? void 0 : _config__privateMeta.configFilePath) && (buildDependencies.rsbuildConfig = [
|
|
2462
2470
|
config._privateMeta.configFilePath
|
|
2463
2471
|
]), await isFileExists(browserslistConfig) && (buildDependencies.browserslistrc = [
|
|
2464
2472
|
browserslistConfig
|
|
@@ -2540,7 +2548,7 @@ let pluginCache = ()=>({
|
|
|
2540
2548
|
return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
|
|
2541
2549
|
path: distPath,
|
|
2542
2550
|
keep
|
|
2543
|
-
} :
|
|
2551
|
+
} : (__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Please set ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow('`output.cleanDistPath`')} config manually.`), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Current root path: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(rootPath)}`), void __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Current dist path: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(distPath)}`)) : !0 === enable ? {
|
|
2544
2552
|
path: distPath,
|
|
2545
2553
|
keep
|
|
2546
2554
|
} : void 0;
|
|
@@ -2706,7 +2714,7 @@ async function loadUserPostcssrc(root, postcssrcCache) {
|
|
|
2706
2714
|
if (cached) return clonePostCSSConfig(await cached);
|
|
2707
2715
|
let { default: postcssrc } = await import("../compiled/postcss-load-config/index.js"), promise = postcssrc({}, root).catch((err)=>{
|
|
2708
2716
|
var _err_message;
|
|
2709
|
-
if (null
|
|
2717
|
+
if (null == (_err_message = err.message) ? void 0 : _err_message.includes('No PostCSS Config found')) return {};
|
|
2710
2718
|
throw err;
|
|
2711
2719
|
});
|
|
2712
2720
|
return postcssrcCache.set(root, promise), promise.then((config)=>(postcssrcCache.set(root, config), clonePostCSSConfig(config)));
|
|
@@ -2804,7 +2812,7 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2804
2812
|
root: api.context.rootPath,
|
|
2805
2813
|
postcssrcCache
|
|
2806
2814
|
});
|
|
2807
|
-
if ('function' == typeof postcssLoaderOptions.postcssOptions || (null
|
|
2815
|
+
if ('function' == typeof postcssLoaderOptions.postcssOptions || (null == (_postcssLoaderOptions_postcssOptions = postcssLoaderOptions.postcssOptions) || null == (_postcssLoaderOptions_postcssOptions_plugins = _postcssLoaderOptions_postcssOptions.plugins) ? void 0 : _postcssLoaderOptions_postcssOptions_plugins.length)) {
|
|
2808
2816
|
importLoaders++;
|
|
2809
2817
|
let postcssLoaderPath = getCompiledPath('postcss-loader');
|
|
2810
2818
|
updateRules((rule)=>{
|
|
@@ -2868,10 +2876,7 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2868
2876
|
let pathKey = Object.keys(value).find((key)=>'path' === key.toLowerCase() && value[key] === process.env[key]);
|
|
2869
2877
|
pathKey && __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(`[rsbuild:config] The "source.define" option includes an object with the key ${JSON.stringify(pathKey)} under "process.env", indicating potential exposure of all environment variables. This can lead to security risks and should be avoided.`));
|
|
2870
2878
|
};
|
|
2871
|
-
if ('object' == typeof value)
|
|
2872
|
-
check(value);
|
|
2873
|
-
return;
|
|
2874
|
-
}
|
|
2879
|
+
if ('object' == typeof value) return check(value);
|
|
2875
2880
|
if ('string' == typeof value) try {
|
|
2876
2881
|
check(JSON.parse(value));
|
|
2877
2882
|
} catch (error) {}
|
|
@@ -2943,32 +2948,32 @@ async function printFileSizes(options, stats, rootPath, environmentName) {
|
|
|
2943
2948
|
}, assets = await getAssets();
|
|
2944
2949
|
if (0 === assets.length) return logs;
|
|
2945
2950
|
logs.push(''), assets.sort((a, b)=>a.size - b.size);
|
|
2946
|
-
let
|
|
2951
|
+
let fileHeader = `File (${environmentName})`, maxFileLength = Math.max(...assets.map((a)=>(a.folder + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.sep + a.name).length), fileHeader.length), maxSizeLength = Math.max(...assets.map((a)=>a.sizeLabel.length));
|
|
2947
2952
|
if (!1 !== options.detail) {
|
|
2948
2953
|
let showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
|
|
2949
|
-
logs.push(function(
|
|
2950
|
-
let
|
|
2951
|
-
|
|
2952
|
-
|
|
2954
|
+
logs.push(function(maxFileLength, maxSizeLength, fileHeader, showGzipHeader) {
|
|
2955
|
+
let lengths = [
|
|
2956
|
+
maxFileLength,
|
|
2957
|
+
maxSizeLength
|
|
2953
2958
|
], rowTypes = [
|
|
2954
|
-
|
|
2959
|
+
fileHeader,
|
|
2955
2960
|
'Size'
|
|
2956
2961
|
];
|
|
2957
2962
|
showGzipHeader && rowTypes.push('Gzip');
|
|
2958
2963
|
let headerRow = rowTypes.reduce((prev, cur, index)=>{
|
|
2959
|
-
let length =
|
|
2964
|
+
let length = lengths[index], curLabel = cur;
|
|
2960
2965
|
return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
|
|
2961
2966
|
}, ' ');
|
|
2962
2967
|
return __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.blue(headerRow);
|
|
2963
|
-
}(
|
|
2968
|
+
}(maxFileLength, maxSizeLength, fileHeader, showGzipHeader));
|
|
2964
2969
|
}
|
|
2965
2970
|
let totalSize = 0, totalGzipSize = 0;
|
|
2966
2971
|
for (let asset of assets){
|
|
2967
2972
|
let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.sep + name).length, sizeLength = sizeLabel.length;
|
|
2968
2973
|
if (totalSize += asset.size, options.compressed && (totalGzipSize += asset.gzippedSize ?? asset.size), !1 !== options.detail) {
|
|
2969
|
-
sizeLength <
|
|
2974
|
+
sizeLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLength));
|
|
2970
2975
|
let fileNameLabel = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.dim(asset.folder + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.sep) + coloringAssetName(asset.name);
|
|
2971
|
-
fileNameLength <
|
|
2976
|
+
fileNameLength < maxFileLength && (fileNameLabel += ' '.repeat(maxFileLength - fileNameLength));
|
|
2972
2977
|
let log = ` ${fileNameLabel} ${sizeLabel}`;
|
|
2973
2978
|
gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
|
|
2974
2979
|
}
|
|
@@ -3060,7 +3065,7 @@ let VOID_TAGS = [
|
|
|
3060
3065
|
...override
|
|
3061
3066
|
})), applyTagConfig = (data, tagConfig, compilationHash, entryName)=>{
|
|
3062
3067
|
var _tagConfig_tags;
|
|
3063
|
-
if (!(null
|
|
3068
|
+
if (!(null == (_tagConfig_tags = tagConfig.tags) ? void 0 : _tagConfig_tags.length)) return data;
|
|
3064
3069
|
let fromInjectTags = (tags)=>{
|
|
3065
3070
|
let ret = [];
|
|
3066
3071
|
for (let tag of tags){
|
|
@@ -3143,10 +3148,10 @@ class RsbuildHtmlPlugin {
|
|
|
3143
3148
|
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
3144
3149
|
getHTMLPlugin().getCompilationHooks(compilation).alterAssetTagGroups.tapPromise(this.name, async (data)=>{
|
|
3145
3150
|
var _data_plugin_options, _data_plugin_options1;
|
|
3146
|
-
let entryName = null
|
|
3151
|
+
let entryName = null == (_data_plugin_options = data.plugin.options) ? void 0 : _data_plugin_options.entryName;
|
|
3147
3152
|
if (!entryName) return data;
|
|
3148
3153
|
let { headTags, bodyTags } = data, { favicon, tagConfig, templateContent } = this.options[entryName];
|
|
3149
|
-
hasTitle(templateContent) || addTitleTag(headTags, null
|
|
3154
|
+
hasTitle(templateContent) || addTitleTag(headTags, null == (_data_plugin_options1 = data.plugin.options) ? void 0 : _data_plugin_options1.title), favicon && await addFavicon(headTags, favicon, compilation, data.publicPath);
|
|
3150
3155
|
let tags = {
|
|
3151
3156
|
headTags: headTags.map(formatBasicTag),
|
|
3152
3157
|
bodyTags: bodyTags.map(formatBasicTag)
|
|
@@ -3315,7 +3320,7 @@ let getTagConfig = (config)=>{
|
|
|
3315
3320
|
let formattedCrossorigin = !0 === crossorigin ? 'anonymous' : crossorigin;
|
|
3316
3321
|
for (let tag of allTags){
|
|
3317
3322
|
var _tag_attrs, _tag_attrs1;
|
|
3318
|
-
("script" === tag.tag && (null
|
|
3323
|
+
("script" === tag.tag && (null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) || 'link' === tag.tag && (null == (_tag_attrs1 = tag.attrs) ? void 0 : _tag_attrs1.rel) === 'stylesheet') && (tag.attrs.crossorigin ??= formattedCrossorigin);
|
|
3319
3324
|
}
|
|
3320
3325
|
}
|
|
3321
3326
|
return {
|
|
@@ -3346,7 +3351,7 @@ let pluginInlineChunk = ()=>({
|
|
|
3346
3351
|
let inlinedAssets = new Set(), getInlinedScriptTag = (publicPath, tag, compilation, scriptTests, config)=>{
|
|
3347
3352
|
var _tag_attrs;
|
|
3348
3353
|
let { assets } = compilation;
|
|
3349
|
-
if (!((null
|
|
3354
|
+
if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) && 'string' == typeof tag.attrs.src)) return tag;
|
|
3350
3355
|
let { src, ...otherAttrs } = tag.attrs, scriptName = publicPath ? src.replace(publicPath, '') : src, asset = assets[scriptName];
|
|
3351
3356
|
if (null == asset) return tag;
|
|
3352
3357
|
let source = asset.source().toString();
|
|
@@ -3368,7 +3373,7 @@ let pluginInlineChunk = ()=>({
|
|
|
3368
3373
|
}, getInlinedCSSTag = (publicPath, tag, compilation, styleTests, config)=>{
|
|
3369
3374
|
var _tag_attrs;
|
|
3370
3375
|
let { assets } = compilation;
|
|
3371
|
-
if (!((null
|
|
3376
|
+
if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.href) && 'string' == typeof tag.attrs.href)) return tag;
|
|
3372
3377
|
let linkName = publicPath ? tag.attrs.href.replace(publicPath, '') : tag.attrs.href, asset = assets[linkName];
|
|
3373
3378
|
if (null == asset) return tag;
|
|
3374
3379
|
let source = asset.source().toString();
|
|
@@ -3447,7 +3452,7 @@ let generateManifest = (htmlPaths, manifestOptions)=>(_seed, files)=>{
|
|
|
3447
3452
|
}
|
|
3448
3453
|
let entryManifest = {};
|
|
3449
3454
|
assets.size && (entryManifest.assets = Array.from(assets));
|
|
3450
|
-
let htmlPath = null
|
|
3455
|
+
let htmlPath = null == (_files_find = files.find((f)=>f.name === htmlPaths[name])) ? void 0 : _files_find.path;
|
|
3451
3456
|
htmlPath && (entryManifest.html = [
|
|
3452
3457
|
htmlPath
|
|
3453
3458
|
]), initialJS.length && (entryManifest.initial = {
|
|
@@ -3609,7 +3614,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3609
3614
|
];
|
|
3610
3615
|
if (nonce) for (let tag of allTags){
|
|
3611
3616
|
var _tag_attrs, _tag_attrs1;
|
|
3612
|
-
("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null
|
|
3617
|
+
("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.rel) === 'preload' && (null == (_tag_attrs1 = tag.attrs) ? void 0 : _tag_attrs1.as) === "script") && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
|
|
3613
3618
|
}
|
|
3614
3619
|
return {
|
|
3615
3620
|
headTags,
|
|
@@ -3845,11 +3850,11 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
|
|
|
3845
3850
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
|
|
3846
3851
|
let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
|
|
3847
3852
|
var _context_devServer, _context_devServer1, _context_devServer2;
|
|
3848
|
-
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null
|
|
3853
|
+
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null == (_context_devServer = context.devServer) ? void 0 : _context_devServer.port) || server.port || 3000;
|
|
3849
3854
|
if (isProd) 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
|
|
3850
3855
|
else if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
3851
3856
|
else if (!0 === dev.assetPrefix) {
|
|
3852
|
-
let protocol = (null
|
|
3857
|
+
let protocol = (null == (_context_devServer1 = context.devServer) ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null == (_context_devServer2 = context.devServer) ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
|
|
3853
3858
|
publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
|
|
3854
3859
|
}
|
|
3855
3860
|
return formatPublicPath(replacePortPlaceholder(publicPath, port));
|
|
@@ -3886,7 +3891,7 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
|
|
|
3886
3891
|
var _rsbuildConfig_performance, _config_performance;
|
|
3887
3892
|
let applyBundleAnalyzeConfig = (config)=>{
|
|
3888
3893
|
var _config_performance;
|
|
3889
|
-
(null
|
|
3894
|
+
(null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze) ? config.performance.bundleAnalyze = {
|
|
3890
3895
|
generateStatsFile: !0,
|
|
3891
3896
|
...config.performance.bundleAnalyze || {}
|
|
3892
3897
|
} : (config.performance ??= {}, config.performance.bundleAnalyze = {
|
|
@@ -3894,8 +3899,8 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
|
|
|
3894
3899
|
generateStatsFile: !0
|
|
3895
3900
|
});
|
|
3896
3901
|
};
|
|
3897
|
-
if (null
|
|
3898
|
-
else if (rsbuildConfig.environments) for (let config of Object.values(rsbuildConfig.environments))(null
|
|
3902
|
+
if (null == (_rsbuildConfig_performance = rsbuildConfig.performance) ? void 0 : _rsbuildConfig_performance.profile) applyBundleAnalyzeConfig(rsbuildConfig);
|
|
3903
|
+
else if (rsbuildConfig.environments) for (let config of Object.values(rsbuildConfig.environments))(null == (_config_performance = config.performance) ? void 0 : _config_performance.profile) && applyBundleAnalyzeConfig(config);
|
|
3899
3904
|
}
|
|
3900
3905
|
}), api.modifyBundlerChain((chain, { environment })=>{
|
|
3901
3906
|
let { config } = environment, { profile } = config.performance;
|
|
@@ -4015,10 +4020,10 @@ class HtmlPreloadOrPrefetchPlugin {
|
|
|
4015
4020
|
if ('all-assets' === includeType) {
|
|
4016
4021
|
var _compilation_assetsInfo;
|
|
4017
4022
|
let licenseAssets = [
|
|
4018
|
-
...(null
|
|
4023
|
+
...(null == (_compilation_assetsInfo = compilation.assetsInfo) ? void 0 : _compilation_assetsInfo.values()) || []
|
|
4019
4024
|
].map((info)=>{
|
|
4020
4025
|
var _info_related;
|
|
4021
|
-
return null
|
|
4026
|
+
return null != (_info_related = info.related) && !!_info_related.license && info.related.license;
|
|
4022
4027
|
}).filter(Boolean);
|
|
4023
4028
|
return [
|
|
4024
4029
|
{
|
|
@@ -4073,14 +4078,11 @@ class HtmlPreloadOrPrefetchPlugin {
|
|
|
4073
4078
|
}
|
|
4074
4079
|
return links;
|
|
4075
4080
|
}(this.options, this.type, compilation, htmlPluginData, this.HTMLCount), htmlPluginData)), getHTMLPlugin().getHooks(compilation).alterAssetTags.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>{
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
htmlPluginData.assetTags.
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
];
|
|
4082
|
-
}
|
|
4083
|
-
return htmlPluginData;
|
|
4081
|
+
var resourceHints, scripts;
|
|
4082
|
+
return this.resourceHints && (htmlPluginData.assetTags.styles = [
|
|
4083
|
+
...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
|
|
4084
|
+
...htmlPluginData.assetTags.styles
|
|
4085
|
+
]), htmlPluginData;
|
|
4084
4086
|
});
|
|
4085
4087
|
});
|
|
4086
4088
|
}
|
|
@@ -4141,11 +4143,11 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4141
4143
|
if ('true' !== process.env.RSDOCTOR) return;
|
|
4142
4144
|
let isRspack = 'rspack' === api.context.bundlerType, pluginName = isRspack ? 'RsdoctorRspackPlugin' : 'RsdoctorWebpackPlugin', isRsdoctorPlugin = (plugin)=>{
|
|
4143
4145
|
var _plugin_constructor;
|
|
4144
|
-
return (null == plugin ? void 0 : plugin.isRsdoctorPlugin) === !0 || (null == plugin || null
|
|
4146
|
+
return (null == plugin ? void 0 : plugin.isRsdoctorPlugin) === !0 || (null == plugin || null == (_plugin_constructor = plugin.constructor) ? void 0 : _plugin_constructor.name) === pluginName;
|
|
4145
4147
|
};
|
|
4146
4148
|
for (let config of bundlerConfigs){
|
|
4147
4149
|
var _config_plugins;
|
|
4148
|
-
if (null
|
|
4150
|
+
if (null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.some((plugin)=>isRsdoctorPlugin(plugin))) return;
|
|
4149
4151
|
}
|
|
4150
4152
|
let packageName = isRspack ? '@rsdoctor/rspack-plugin' : '@rsdoctor/webpack-plugin';
|
|
4151
4153
|
try {
|
|
@@ -4173,10 +4175,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4173
4175
|
}
|
|
4174
4176
|
}), stopProfiler = (output, profileSession)=>{
|
|
4175
4177
|
profileSession && profileSession.post('Profiler.stop', (error, param)=>{
|
|
4176
|
-
if (error)
|
|
4177
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to generate JS CPU profile:', error);
|
|
4178
|
-
return;
|
|
4179
|
-
}
|
|
4178
|
+
if (error) return void __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to generate JavaScript CPU profile:', error);
|
|
4180
4179
|
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.writeFileSync(output, JSON.stringify(param.profile));
|
|
4181
4180
|
});
|
|
4182
4181
|
}, pluginRspackProfile = ()=>({
|
|
@@ -4185,11 +4184,11 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4185
4184
|
var _process_env_RSPACK_PROFILE;
|
|
4186
4185
|
let profileSession;
|
|
4187
4186
|
if ('webpack' === api.context.bundlerType) return;
|
|
4188
|
-
let RSPACK_PROFILE = null
|
|
4187
|
+
let RSPACK_PROFILE = null == (_process_env_RSPACK_PROFILE = process.env.RSPACK_PROFILE) ? void 0 : _process_env_RSPACK_PROFILE.toUpperCase();
|
|
4189
4188
|
if (!RSPACK_PROFILE) return;
|
|
4190
|
-
let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'), enableCPUProfile = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('CPU'), enableLogging = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('LOGGING'), onStart = ()=>{
|
|
4189
|
+
let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'), enableCPUProfile = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('CPU'), enableLogging = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('LOGGING'), onStart = async ()=>{
|
|
4191
4190
|
let profileDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.distPath, profileDirName), traceFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(profileDir, 'trace.json');
|
|
4192
|
-
|
|
4191
|
+
await isFileExists(profileDir) || await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.mkdir(profileDir, {
|
|
4193
4192
|
recursive: !0
|
|
4194
4193
|
}), enableProfileTrace && __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.experiments.globalTrace.register('trace', 'chrome', traceFilePath), enableCPUProfile && ((profileSession = new __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__.default.Session()).connect(), profileSession.post('Profiler.enable'), profileSession.post('Profiler.start'));
|
|
4195
4194
|
};
|
|
@@ -4203,12 +4202,12 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4203
4202
|
logging: 'verbose',
|
|
4204
4203
|
loggingTrace: !0
|
|
4205
4204
|
});
|
|
4206
|
-
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.
|
|
4205
|
+
await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.writeFile(loggingFilePath, JSON.stringify(logging));
|
|
4207
4206
|
}
|
|
4208
4207
|
}), api.onExit(()=>{
|
|
4209
4208
|
enableProfileTrace && __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.experiments.globalTrace.cleanup();
|
|
4210
4209
|
let profileDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.distPath, profileDirName);
|
|
4211
|
-
stopProfiler(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(profileDir, 'jscpuprofile.json'), profileSession), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`
|
|
4210
|
+
stopProfiler(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(profileDir, 'jscpuprofile.json'), profileSession), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`profile files saved to ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(profileDir)}`);
|
|
4212
4211
|
});
|
|
4213
4212
|
}
|
|
4214
4213
|
}), pluginServer = ()=>({
|
|
@@ -4219,7 +4218,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4219
4218
|
if (config.server.open) {
|
|
4220
4219
|
var _api_context_devServer;
|
|
4221
4220
|
open_open({
|
|
4222
|
-
https: null
|
|
4221
|
+
https: null == (_api_context_devServer = api.context.devServer) ? void 0 : _api_context_devServer.https,
|
|
4223
4222
|
port,
|
|
4224
4223
|
routes,
|
|
4225
4224
|
config
|
|
@@ -4358,7 +4357,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4358
4357
|
return;
|
|
4359
4358
|
}
|
|
4360
4359
|
let { config } = environment, defaultConfig = {
|
|
4361
|
-
chunks: (null
|
|
4360
|
+
chunks: (null == (_config_moduleFederation = config.moduleFederation) || null == (_config_moduleFederation_options = _config_moduleFederation.options) ? void 0 : _config_moduleFederation_options.exposes) ? 'async' : 'all',
|
|
4362
4361
|
cacheGroups: {}
|
|
4363
4362
|
};
|
|
4364
4363
|
'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
|
|
@@ -4520,21 +4519,15 @@ let reduceTransformImportConfig = (options)=>{
|
|
|
4520
4519
|
api.modifyBundlerChain({
|
|
4521
4520
|
order: 'pre',
|
|
4522
4521
|
handler: async (chain, { target, environment })=>{
|
|
4523
|
-
if ('node' === target)
|
|
4524
|
-
chain.target('node');
|
|
4525
|
-
return;
|
|
4526
|
-
}
|
|
4522
|
+
if ('node' === target) return void chain.target('node');
|
|
4527
4523
|
let { browserslist } = environment, isDefaultBrowserslist = browserslist.join(',') === DEFAULT_WEB_BROWSERSLIST.join(',');
|
|
4528
|
-
if ('web-worker' === target)
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
]);
|
|
4536
|
-
return;
|
|
4537
|
-
}
|
|
4524
|
+
if ('web-worker' === target) return void chain.target(isDefaultBrowserslist ? [
|
|
4525
|
+
'webworker',
|
|
4526
|
+
'es2017'
|
|
4527
|
+
] : [
|
|
4528
|
+
'webworker',
|
|
4529
|
+
'es5'
|
|
4530
|
+
]);
|
|
4538
4531
|
let esQuery = isDefaultBrowserslist ? 'es2017' : `browserslist:${browserslist.join(',')}`;
|
|
4539
4532
|
chain.target([
|
|
4540
4533
|
'web',
|
|
@@ -4606,7 +4599,7 @@ async function modifyRspackConfig(context, rspackConfig, chainUtils) {
|
|
|
4606
4599
|
rspackConfig,
|
|
4607
4600
|
utils
|
|
4608
4601
|
]
|
|
4609
|
-
}), (null
|
|
4602
|
+
}), (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.rspack) && (currentConfig = await reduceConfigsAsyncWithContext({
|
|
4610
4603
|
initial: currentConfig,
|
|
4611
4604
|
config: utils.environment.config.tools.rspack,
|
|
4612
4605
|
ctx: utils,
|
|
@@ -4616,7 +4609,6 @@ async function modifyRspackConfig(context, rspackConfig, chainUtils) {
|
|
|
4616
4609
|
async function getConfigUtils(config, chainUtils) {
|
|
4617
4610
|
return {
|
|
4618
4611
|
...chainUtils,
|
|
4619
|
-
rspack: __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack,
|
|
4620
4612
|
mergeConfig: dist.merge,
|
|
4621
4613
|
addRules (rules) {
|
|
4622
4614
|
let ruleArr = castArray(rules);
|
|
@@ -4640,9 +4632,11 @@ async function getConfigUtils(config, chainUtils) {
|
|
|
4640
4632
|
};
|
|
4641
4633
|
}
|
|
4642
4634
|
function getChainUtils(target, environment) {
|
|
4635
|
+
let nodeEnv = getNodeEnv();
|
|
4643
4636
|
return {
|
|
4637
|
+
rspack: __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack,
|
|
4644
4638
|
environment,
|
|
4645
|
-
env:
|
|
4639
|
+
env: nodeEnv,
|
|
4646
4640
|
target,
|
|
4647
4641
|
isDev: 'development' === environment.config.mode,
|
|
4648
4642
|
isProd: 'production' === environment.config.mode,
|
|
@@ -4825,7 +4819,7 @@ let commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? __WEBPACK_EXTERNAL_MODU
|
|
|
4825
4819
|
envMode: commonOpts.envMode,
|
|
4826
4820
|
loader: commonOpts.configLoader
|
|
4827
4821
|
});
|
|
4828
|
-
return config.dev ||= {}, config.source ||= {}, config.server ||= {}, commonOpts.base && (config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null
|
|
4822
|
+
return config.dev ||= {}, config.source ||= {}, config.server ||= {}, commonOpts.base && (config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null == (_config_server = config.server) ? void 0 : _config_server.open) || (config.server.open = commonOpts.open), commonOpts.host && (config.server.host = commonOpts.host), commonOpts.port && (config.server.port = commonOpts.port), void 0 === config.dev.cliShortcuts && (config.dev.cliShortcuts = !0), filePath && (config.dev.watchFiles = [
|
|
4829
4823
|
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
4830
4824
|
{
|
|
4831
4825
|
paths: filePath,
|
|
@@ -4849,7 +4843,7 @@ async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
|
4849
4843
|
var _config_dev;
|
|
4850
4844
|
if ('dev' !== rsbuild.context.action && !isBuildWatch) return;
|
|
4851
4845
|
let files = [], config = rsbuild.getNormalizedConfig();
|
|
4852
|
-
if (null
|
|
4846
|
+
if (null == (_config_dev = config.dev) ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
4853
4847
|
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
4854
4848
|
let paths = castArray(watchFilesConfig.paths);
|
|
4855
4849
|
watchFilesConfig.options ? watchFilesForRestart({
|
|
@@ -5028,10 +5022,7 @@ function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restar
|
|
|
5028
5022
|
for (let shortcut of shortcuts)message += ` ${shortcut.description}\n`;
|
|
5029
5023
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.log(message);
|
|
5030
5024
|
}
|
|
5031
|
-
for (let shortcut of shortcuts)if (input === shortcut.key)
|
|
5032
|
-
shortcut.action();
|
|
5033
|
-
return;
|
|
5034
|
-
}
|
|
5025
|
+
for (let shortcut of shortcuts)if (input === shortcut.key) return void shortcut.action();
|
|
5035
5026
|
}), ()=>{
|
|
5036
5027
|
rl.close();
|
|
5037
5028
|
};
|
|
@@ -5154,7 +5145,7 @@ class SocketServer {
|
|
|
5154
5145
|
let { default: ws } = await import("../compiled/ws/index.js");
|
|
5155
5146
|
this.wsServer = new ws.Server({
|
|
5156
5147
|
noServer: !0,
|
|
5157
|
-
path: null
|
|
5148
|
+
path: null == (_this_options_client = this.options.client) ? void 0 : _this_options_client.path
|
|
5158
5149
|
}), this.wsServer.on('error', (err)=>{
|
|
5159
5150
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
5160
5151
|
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
|
|
@@ -5263,14 +5254,17 @@ class SocketServer {
|
|
|
5263
5254
|
html: function(errors, root) {
|
|
5264
5255
|
let htmlItems = errors.map((item)=>{
|
|
5265
5256
|
var text = server_ansiHTML(item ? item.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''') : ''), root1 = root;
|
|
5266
|
-
let pathRegex = /(?:\.\.?[\/\\]|[a-zA-Z]:\\|\/)[^:]*:\d+:\d+/g;
|
|
5267
|
-
return text.split('\n').map((line)=>
|
|
5257
|
+
let pathRegex = /(?:\.\.?[\/\\]|[a-zA-Z]:\\|\/)[^:]*:\d+:\d+/g, urlRegex = /(https?:\/\/(?:[\w-]+\.)+[a-z0-9](?:[\w-.~:/?#[\]@!$&'*+,;=])*)/gi;
|
|
5258
|
+
return text.split('\n').map((line)=>{
|
|
5259
|
+
let replacedLine = line.replace(pathRegex, (file)=>{
|
|
5268
5260
|
let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(filePath), absolutePath = root1 && !isAbsolute ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(root1, filePath) : filePath, relativePath = root1 && isAbsolute ? function(base, filepath) {
|
|
5269
5261
|
let relativePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.relative)(base, filepath);
|
|
5270
5262
|
return '' === relativePath ? `.${__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep}` : relativePath.startsWith('.') ? relativePath : `.${__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.sep}${relativePath}`;
|
|
5271
5263
|
}(root1, filePath) : filePath;
|
|
5272
5264
|
return `<a class="file-link" data-file="${absolutePath}">${relativePath}</a>${hasClosingSpan ? '</span>' : ''}`;
|
|
5273
|
-
})
|
|
5265
|
+
});
|
|
5266
|
+
return replacedLine.replace(urlRegex, (url)=>`<a class="url-link" href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
|
|
5267
|
+
}).join('\n');
|
|
5274
5268
|
});
|
|
5275
5269
|
return `
|
|
5276
5270
|
<style>
|
|
@@ -5322,9 +5316,9 @@ class SocketServer {
|
|
|
5322
5316
|
.content::-webkit-scrollbar {
|
|
5323
5317
|
display: none;
|
|
5324
5318
|
}
|
|
5325
|
-
.file-link
|
|
5319
|
+
.file-link,
|
|
5320
|
+
.url-link {
|
|
5326
5321
|
cursor: pointer;
|
|
5327
|
-
color: #6eecf7;
|
|
5328
5322
|
text-decoration: underline;
|
|
5329
5323
|
text-underline-offset: 3px;
|
|
5330
5324
|
&:hover {
|
|
@@ -5334,6 +5328,12 @@ class SocketServer {
|
|
|
5334
5328
|
opacity: 0.6;
|
|
5335
5329
|
}
|
|
5336
5330
|
}
|
|
5331
|
+
.file-link {
|
|
5332
|
+
color: #6eecf7;
|
|
5333
|
+
}
|
|
5334
|
+
.url-link {
|
|
5335
|
+
color: #eff986;
|
|
5336
|
+
}
|
|
5337
5337
|
.close {
|
|
5338
5338
|
position: absolute;
|
|
5339
5339
|
top: 27px;
|
|
@@ -5470,17 +5470,14 @@ class CompilationManager {
|
|
|
5470
5470
|
let { devConfig, serverConfig, publicPaths } = this, clientPaths = function(devConfig) {
|
|
5471
5471
|
var _devConfig_client;
|
|
5472
5472
|
let clientPaths = [];
|
|
5473
|
-
return (devConfig.hmr || devConfig.liveReload) && (clientPaths.push(compilationManager_require.resolve('@rsbuild/core/client/hmr')), (null
|
|
5473
|
+
return (devConfig.hmr || devConfig.liveReload) && (clientPaths.push(compilationManager_require.resolve('@rsbuild/core/client/hmr')), (null == (_devConfig_client = devConfig.client) ? void 0 : _devConfig_client.overlay) && clientPaths.push(`${compilationManager_require.resolve('@rsbuild/core/client/overlay')}`)), clientPaths;
|
|
5474
5474
|
}(devConfig), middleware = await getCompilationMiddleware(this.compiler, {
|
|
5475
5475
|
callbacks: {
|
|
5476
5476
|
onInvalid: (compilationId, fileName)=>{
|
|
5477
|
-
if ('string' == typeof fileName && HTML_REGEX.test(fileName)) {
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
});
|
|
5482
|
-
return;
|
|
5483
|
-
}
|
|
5477
|
+
if ('string' == typeof fileName && HTML_REGEX.test(fileName)) return void this.socketServer.sockWrite({
|
|
5478
|
+
type: 'static-changed',
|
|
5479
|
+
compilationId
|
|
5480
|
+
});
|
|
5484
5481
|
this.socketServer.sockWrite({
|
|
5485
5482
|
type: 'invalid',
|
|
5486
5483
|
compilationId
|
|
@@ -5513,10 +5510,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
5513
5510
|
return void 0 === size || Number(size) > 1024;
|
|
5514
5511
|
}, gzipMiddleware = ({ level = __WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__.default.constants.Z_BEST_SPEED } = {})=>(req, res, next)=>{
|
|
5515
5512
|
let gzip, writeHeadStatus, accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
|
|
5516
|
-
if ('HEAD' === req.method || !encoding)
|
|
5517
|
-
next();
|
|
5518
|
-
return;
|
|
5519
|
-
}
|
|
5513
|
+
if ('HEAD' === req.method || !encoding) return void next();
|
|
5520
5514
|
let started = !1, { end, write, on, writeHead } = res, listeners = [], start = ()=>{
|
|
5521
5515
|
if (!started) {
|
|
5522
5516
|
if (started = !0, shouldCompress(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = __WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__.default.createGzip({
|
|
@@ -5588,7 +5582,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
5588
5582
|
}), res.end();
|
|
5589
5583
|
return;
|
|
5590
5584
|
}
|
|
5591
|
-
if (null
|
|
5585
|
+
if (null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('text/html')) {
|
|
5592
5586
|
res.writeHead(404, {
|
|
5593
5587
|
'Content-Type': 'text/html'
|
|
5594
5588
|
}), res.end(`The server is configured with a base URL of ${base} - did you mean to visit <a href="${redirectPath}">${redirectPath}</a> instead?`);
|
|
@@ -5739,7 +5733,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
5739
5733
|
environments
|
|
5740
5734
|
})), compilationManager && (middlewares.push(compilationManager.middleware), upgradeEvents.push(compilationManager.socketServer.upgrade), middlewares.push((req, res, next)=>{
|
|
5741
5735
|
var _req_url;
|
|
5742
|
-
(null
|
|
5736
|
+
(null == (_req_url = req.url) ? void 0 : _req_url.endsWith('.hot-update.json')) && 'OPTIONS' !== req.method ? (res.statusCode = 404, res.end()) : next();
|
|
5743
5737
|
})), compilationManager && middlewares.push(getHtmlCompletionMiddleware({
|
|
5744
5738
|
compilationManager,
|
|
5745
5739
|
distPath: context.distPath
|
|
@@ -5924,7 +5918,7 @@ class EsmRunner extends CommonJsRunner {
|
|
|
5924
5918
|
createRunner() {
|
|
5925
5919
|
var _this__options_compilerOptions_experiments;
|
|
5926
5920
|
super.createRunner(), this.requirers.set('cjs', this.getRequire()), this.requirers.set('esm', this.createEsmRequirer());
|
|
5927
|
-
let outputModule = null
|
|
5921
|
+
let outputModule = null == (_this__options_compilerOptions_experiments = this._options.compilerOptions.experiments) ? void 0 : _this__options_compilerOptions_experiments.outputModule;
|
|
5928
5922
|
this.requirers.set('entry', (currentDirectory, modulePath, context)=>{
|
|
5929
5923
|
let file = this.getFile(modulePath, currentDirectory);
|
|
5930
5924
|
return file ? outputModule && !file.path.endsWith('.cjs') ? this.requirers.get('esm')(currentDirectory, modulePath, {
|
|
@@ -5998,7 +5992,7 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunne
|
|
|
5998
5992
|
let { chunks: entryChunks = [] } = entrypoints[entryName], files = entryChunks.reduce((prev, entryChunkName)=>{
|
|
5999
5993
|
let chunk = null == chunks ? void 0 : chunks.find((chunk)=>{
|
|
6000
5994
|
var _chunk_names;
|
|
6001
|
-
return chunk.entry && (null
|
|
5995
|
+
return chunk.entry && (null == (_chunk_names = chunk.names) ? void 0 : _chunk_names.includes(String(entryChunkName)));
|
|
6002
5996
|
});
|
|
6003
5997
|
return (null == chunk ? void 0 : chunk.files) ? prev.concat(chunk.files.filter((file)=>!file.endsWith('.css'))) : prev;
|
|
6004
5998
|
}, []);
|
|
@@ -6028,23 +6022,29 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunne
|
|
|
6028
6022
|
[entryName]: res
|
|
6029
6023
|
}), res;
|
|
6030
6024
|
};
|
|
6031
|
-
}, cleanupCallbacks = new Set(), handleTermination = async (
|
|
6025
|
+
}, cleanupCallbacks = new Set(), handleTermination = async (exitCode)=>{
|
|
6032
6026
|
try {
|
|
6033
6027
|
await Promise.all([
|
|
6034
6028
|
...cleanupCallbacks
|
|
6035
6029
|
].map((cb)=>cb()));
|
|
6036
6030
|
} finally{
|
|
6037
|
-
process.exitCode ??= exitCode
|
|
6031
|
+
process.exitCode ??= exitCode, process.exit();
|
|
6038
6032
|
}
|
|
6039
6033
|
}, registerCleanup = (callback)=>{
|
|
6040
6034
|
cleanupCallbacks.add(callback);
|
|
6041
6035
|
}, removeCleanup = (callback)=>{
|
|
6042
6036
|
cleanupCallbacks.delete(callback);
|
|
6043
6037
|
}, shutdownRefCount = 0, setupGracefulShutdown = ()=>{
|
|
6044
|
-
shutdownRefCount
|
|
6045
|
-
let
|
|
6046
|
-
|
|
6047
|
-
|
|
6038
|
+
shutdownRefCount++;
|
|
6039
|
+
let onSigterm = ()=>{
|
|
6040
|
+
handleTermination(__WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__.constants.signals.SIGTERM + 128);
|
|
6041
|
+
};
|
|
6042
|
+
process.once('SIGTERM', onSigterm);
|
|
6043
|
+
let isCI = 'true' === process.env.CI, onStdinEnd = ()=>{
|
|
6044
|
+
handleTermination(0);
|
|
6045
|
+
};
|
|
6046
|
+
return isCI || process.stdin.on('end', onStdinEnd), ()=>{
|
|
6047
|
+
!(--shutdownRefCount > 0) && (process.removeListener('SIGTERM', onSigterm), isCI || process.stdin.removeListener('end', onStdinEnd));
|
|
6048
6048
|
};
|
|
6049
6049
|
}, createHttpServer = async ({ serverConfig, middlewares })=>{
|
|
6050
6050
|
if (serverConfig.https) {
|
|
@@ -6276,7 +6276,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
6276
6276
|
}, hasErrors = stats.hasErrors();
|
|
6277
6277
|
if (!hasErrors) {
|
|
6278
6278
|
var _statsJson_children;
|
|
6279
|
-
isMultiCompiler && (null
|
|
6279
|
+
isMultiCompiler && (null == (_statsJson_children = statsJson.children) ? void 0 : _statsJson_children.length) ? statsJson.children.forEach((c, index)=>{
|
|
6280
6280
|
printTime(c, index);
|
|
6281
6281
|
}) : printTime(statsJson, 0);
|
|
6282
6282
|
}
|
|
@@ -6586,11 +6586,11 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
6586
6586
|
let { moduleFederation } = config;
|
|
6587
6587
|
if (api.isPluginExists('rsbuild:module-federation-enhanced') && (config.server ||= {}, config.server.cors = !0), (null == moduleFederation ? void 0 : moduleFederation.options) && moduleFederation.options.exposes) {
|
|
6588
6588
|
var _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
|
|
6589
|
-
config.dev ||= {}, config.server ||= {}, config.server.cors = !0, (null
|
|
6589
|
+
config.dev ||= {}, config.server ||= {}, config.server.cors = !0, (null == (_config_server = config.server) ? void 0 : _config_server.port) && !(null == (_config_dev_client = config.dev.client) ? void 0 : _config_dev_client.port) && (config.dev.client ||= {}, config.dev.client.port = config.server.port), (null == (_originalConfig_dev = api.getRsbuildConfig('original').dev) ? void 0 : _originalConfig_dev.assetPrefix) === void 0 && config.dev.assetPrefix === (null == (_config_server1 = config.server) ? void 0 : _config_server1.base) && (config.dev.assetPrefix = !0);
|
|
6590
6590
|
}
|
|
6591
6591
|
}), api.modifyEnvironmentConfig((config)=>{
|
|
6592
6592
|
var _config_moduleFederation, _config_performance_chunkSplit, _config_performance;
|
|
6593
|
-
(null
|
|
6593
|
+
(null == (_config_moduleFederation = config.moduleFederation) ? void 0 : _config_moduleFederation.options) && ((null == (_config_performance = config.performance) || null == (_config_performance_chunkSplit = _config_performance.chunkSplit) ? void 0 : _config_performance_chunkSplit.strategy) === 'split-by-experience' && (config.performance.chunkSplit = {
|
|
6594
6594
|
...config.performance.chunkSplit,
|
|
6595
6595
|
strategy: 'custom'
|
|
6596
6596
|
}), config.source.include = [
|
|
@@ -6600,7 +6600,7 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
6600
6600
|
}), api.modifyBundlerChain(async (chain, { CHAIN_ID, target, environment })=>{
|
|
6601
6601
|
var _config_moduleFederation;
|
|
6602
6602
|
let { config } = environment;
|
|
6603
|
-
if (!(null
|
|
6603
|
+
if (!(null == (_config_moduleFederation = config.moduleFederation) ? void 0 : _config_moduleFederation.options) || 'web' !== target) return;
|
|
6604
6604
|
let { options } = config.moduleFederation;
|
|
6605
6605
|
chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.container.ModuleFederationPlugin, [
|
|
6606
6606
|
options
|
|
@@ -6630,7 +6630,7 @@ async function createRsbuild(options = {}) {
|
|
|
6630
6630
|
paths: envs1.filePaths,
|
|
6631
6631
|
type: 'reload-server'
|
|
6632
6632
|
}
|
|
6633
|
-
], null
|
|
6633
|
+
], null == (_config_performance = config1.performance) ? void 0 : _config_performance.buildCache))) {
|
|
6634
6634
|
let { buildCache } = config1.performance;
|
|
6635
6635
|
!0 === buildCache ? config1.performance.buildCache = {
|
|
6636
6636
|
buildDependencies: envs1.filePaths
|
|
@@ -6805,9 +6805,21 @@ async function createRsbuild(options = {}) {
|
|
|
6805
6805
|
handler
|
|
6806
6806
|
});
|
|
6807
6807
|
}, onExitListened = !1, onExit = (cb)=>{
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6808
|
+
if (!onExitListened) {
|
|
6809
|
+
var onExit;
|
|
6810
|
+
onExit = (exitCode)=>{
|
|
6811
|
+
hooks.onExit.callBatch({
|
|
6812
|
+
exitCode
|
|
6813
|
+
});
|
|
6814
|
+
}, exitHook_callbacks.add(onExit), isRegistered || (isRegistered = !0, __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__.default.on('SIGINT', ()=>{
|
|
6815
|
+
exit(__WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__.constants.signals.SIGINT + 128, 'SIGINT');
|
|
6816
|
+
}), __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__.default.once('SIGTERM', ()=>{
|
|
6817
|
+
exit(__WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__.constants.signals.SIGTERM + 128, 'SIGTERM');
|
|
6818
|
+
}), __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__.default.once('exit', (exitCode)=>{
|
|
6819
|
+
exit(exitCode, 'exit');
|
|
6820
|
+
})), onExitListened = !0;
|
|
6821
|
+
}
|
|
6822
|
+
hooks.onExit.tap(cb);
|
|
6811
6823
|
};
|
|
6812
6824
|
return (environment)=>({
|
|
6813
6825
|
context: publicContext,
|
|
@@ -7277,11 +7289,11 @@ async function runCLI() {
|
|
|
7277
7289
|
}
|
|
7278
7290
|
process.title = 'rsbuild-node';
|
|
7279
7291
|
let { npm_execpath } = process.env;
|
|
7280
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.3.
|
|
7292
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.3.7\n`);
|
|
7281
7293
|
try {
|
|
7282
7294
|
!function() {
|
|
7283
7295
|
let cli = cac_dist('rsbuild');
|
|
7284
|
-
cli.help(), cli.version("1.3.
|
|
7296
|
+
cli.help(), cli.version("1.3.7"), applyCommonOptions(cli);
|
|
7285
7297
|
let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
7286
7298
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7287
7299
|
try {
|
|
@@ -7332,6 +7344,6 @@ async function runCLI() {
|
|
|
7332
7344
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
7333
7345
|
}
|
|
7334
7346
|
}
|
|
7335
|
-
let src_version = "1.3.
|
|
7347
|
+
let src_version = "1.3.7";
|
|
7336
7348
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
7337
7349
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|