@rsbuild/core 1.3.6 → 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 +77 -104
- package/dist/index.js +76 -103
- package/dist/transformLoader.mjs +3 -3
- package/dist/transformRawLoader.mjs +3 -3
- package/dist-types/types/plugin.d.ts +2 -0
- package/dist-types/types/thirdParty.d.ts +1 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -854,7 +854,7 @@ var EsmMode, __webpack_modules__ = {
|
|
|
854
854
|
return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
|
|
855
855
|
}
|
|
856
856
|
if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
|
|
857
|
-
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;
|
|
858
858
|
return !0;
|
|
859
859
|
};
|
|
860
860
|
},
|
|
@@ -1020,9 +1020,9 @@ let getCompiledPath = (packageName)=>(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b
|
|
|
1020
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)=>{
|
|
1021
1021
|
try {
|
|
1022
1022
|
var _fs_statSync;
|
|
1023
|
-
return null
|
|
1023
|
+
return null == (_fs_statSync = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.statSync(filePath, {
|
|
1024
1024
|
throwIfNoEntry: !1
|
|
1025
|
-
}))
|
|
1025
|
+
})) ? void 0 : _fs_statSync.isFile();
|
|
1026
1026
|
} catch (_) {
|
|
1027
1027
|
return !1;
|
|
1028
1028
|
}
|
|
@@ -1038,10 +1038,7 @@ async function isFileExists(file) {
|
|
|
1038
1038
|
}
|
|
1039
1039
|
async function fileExistsByCompilation({ inputFileSystem }, filePath) {
|
|
1040
1040
|
return new Promise((resolve)=>{
|
|
1041
|
-
if (!inputFileSystem)
|
|
1042
|
-
resolve(!1);
|
|
1043
|
-
return;
|
|
1044
|
-
}
|
|
1041
|
+
if (!inputFileSystem) return void resolve(!1);
|
|
1045
1042
|
inputFileSystem.stat(filePath, (err, stats)=>{
|
|
1046
1043
|
err ? resolve(!1) : resolve(!!(null == stats ? void 0 : stats.isFile()));
|
|
1047
1044
|
});
|
|
@@ -1179,16 +1176,16 @@ function formatMessage(stats, verbose) {
|
|
|
1179
1176
|
function formatStatsMessages(stats, verbose) {
|
|
1180
1177
|
var _stats_errors, _stats_warnings;
|
|
1181
1178
|
return {
|
|
1182
|
-
errors: (null
|
|
1183
|
-
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))) || []
|
|
1184
1181
|
};
|
|
1185
1182
|
}
|
|
1186
1183
|
let getAllStatsErrors = (statsData)=>{
|
|
1187
1184
|
var _statsData_errors, _statsData_children;
|
|
1188
|
-
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;
|
|
1189
1186
|
}, getAllStatsWarnings = (statsData)=>{
|
|
1190
1187
|
var _statsData_warnings, _statsData_children;
|
|
1191
|
-
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;
|
|
1192
1189
|
};
|
|
1193
1190
|
function getStatsOptions(compiler) {
|
|
1194
1191
|
if (helpers_isMultiCompiler(compiler)) return {
|
|
@@ -1580,7 +1577,7 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
1580
1577
|
}), withDefaultConfig = async (rootPath, config)=>{
|
|
1581
1578
|
var _merged_server, _config_dev, _config_output;
|
|
1582
1579
|
let merged = mergeRsbuildConfig(createDefaultConfig(), config);
|
|
1583
|
-
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) {
|
|
1584
1581
|
let tsconfigPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'tsconfig.json');
|
|
1585
1582
|
await isFileExists(tsconfigPath) && (merged.source.tsconfigPath = tsconfigPath);
|
|
1586
1583
|
}
|
|
@@ -1785,7 +1782,7 @@ async function initPlugins({ getPluginAPI, pluginManager }) {
|
|
|
1785
1782
|
for (let plugin of plugins){
|
|
1786
1783
|
var _removedPlugins_plugin_environment, _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL;
|
|
1787
1784
|
let isGlobalPlugin = 'RSBUILD_ALL_ENVIRONMENT_SYMBOL' === plugin.environment;
|
|
1788
|
-
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;
|
|
1789
1786
|
let { instance, environment } = plugin;
|
|
1790
1787
|
await instance.setup(getPluginAPI(environment));
|
|
1791
1788
|
}
|
|
@@ -2101,7 +2098,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2101
2098
|
name,
|
|
2102
2099
|
distPath: function(cwd, config) {
|
|
2103
2100
|
var _config_output_distPath, _config_output;
|
|
2104
|
-
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);
|
|
2105
2102
|
}(context.rootPath, config),
|
|
2106
2103
|
entry,
|
|
2107
2104
|
browserslist,
|
|
@@ -2118,7 +2115,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2118
2115
|
async function createContext(options, userConfig) {
|
|
2119
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;
|
|
2120
2117
|
return {
|
|
2121
|
-
version: "1.3.
|
|
2118
|
+
version: "1.3.7",
|
|
2122
2119
|
rootPath,
|
|
2123
2120
|
distPath: '',
|
|
2124
2121
|
cachePath,
|
|
@@ -2264,7 +2261,7 @@ async function modifyBundlerChain(context, utils) {
|
|
|
2264
2261
|
utils
|
|
2265
2262
|
]
|
|
2266
2263
|
});
|
|
2267
|
-
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);
|
|
2268
2265
|
return __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('modify bundler chain done'), modifiedBundlerChain;
|
|
2269
2266
|
}
|
|
2270
2267
|
let configChain_CHAIN_ID = {
|
|
@@ -2439,7 +2436,7 @@ let configChain_CHAIN_ID = {
|
|
|
2439
2436
|
}
|
|
2440
2437
|
}), isUseAnalyzer = (config)=>{
|
|
2441
2438
|
var _config_performance;
|
|
2442
|
-
return process.env.BUNDLE_ANALYZE || (null
|
|
2439
|
+
return process.env.BUNDLE_ANALYZE || (null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze);
|
|
2443
2440
|
};
|
|
2444
2441
|
async function validateWebpackCache(cacheDirectory, buildDependencies) {
|
|
2445
2442
|
let configFile = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cacheDirectory, 'buildDependencies.json');
|
|
@@ -2469,7 +2466,7 @@ async function getBuildDependencies(context, config, environmentContext, userBui
|
|
|
2469
2466
|
let { tsconfigPath } = environmentContext;
|
|
2470
2467
|
tsconfigPath && (buildDependencies.tsconfig = [
|
|
2471
2468
|
tsconfigPath
|
|
2472
|
-
]), (null
|
|
2469
|
+
]), (null == (_config__privateMeta = config._privateMeta) ? void 0 : _config__privateMeta.configFilePath) && (buildDependencies.rsbuildConfig = [
|
|
2473
2470
|
config._privateMeta.configFilePath
|
|
2474
2471
|
]), await isFileExists(browserslistConfig) && (buildDependencies.browserslistrc = [
|
|
2475
2472
|
browserslistConfig
|
|
@@ -2551,7 +2548,7 @@ let pluginCache = ()=>({
|
|
|
2551
2548
|
return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
|
|
2552
2549
|
path: distPath,
|
|
2553
2550
|
keep
|
|
2554
|
-
} :
|
|
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 ? {
|
|
2555
2552
|
path: distPath,
|
|
2556
2553
|
keep
|
|
2557
2554
|
} : void 0;
|
|
@@ -2717,7 +2714,7 @@ async function loadUserPostcssrc(root, postcssrcCache) {
|
|
|
2717
2714
|
if (cached) return clonePostCSSConfig(await cached);
|
|
2718
2715
|
let { default: postcssrc } = await import("../compiled/postcss-load-config/index.js"), promise = postcssrc({}, root).catch((err)=>{
|
|
2719
2716
|
var _err_message;
|
|
2720
|
-
if (null
|
|
2717
|
+
if (null == (_err_message = err.message) ? void 0 : _err_message.includes('No PostCSS Config found')) return {};
|
|
2721
2718
|
throw err;
|
|
2722
2719
|
});
|
|
2723
2720
|
return postcssrcCache.set(root, promise), promise.then((config)=>(postcssrcCache.set(root, config), clonePostCSSConfig(config)));
|
|
@@ -2815,7 +2812,7 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2815
2812
|
root: api.context.rootPath,
|
|
2816
2813
|
postcssrcCache
|
|
2817
2814
|
});
|
|
2818
|
-
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)) {
|
|
2819
2816
|
importLoaders++;
|
|
2820
2817
|
let postcssLoaderPath = getCompiledPath('postcss-loader');
|
|
2821
2818
|
updateRules((rule)=>{
|
|
@@ -2879,10 +2876,7 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2879
2876
|
let pathKey = Object.keys(value).find((key)=>'path' === key.toLowerCase() && value[key] === process.env[key]);
|
|
2880
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.`));
|
|
2881
2878
|
};
|
|
2882
|
-
if ('object' == typeof value)
|
|
2883
|
-
check(value);
|
|
2884
|
-
return;
|
|
2885
|
-
}
|
|
2879
|
+
if ('object' == typeof value) return check(value);
|
|
2886
2880
|
if ('string' == typeof value) try {
|
|
2887
2881
|
check(JSON.parse(value));
|
|
2888
2882
|
} catch (error) {}
|
|
@@ -3071,7 +3065,7 @@ let VOID_TAGS = [
|
|
|
3071
3065
|
...override
|
|
3072
3066
|
})), applyTagConfig = (data, tagConfig, compilationHash, entryName)=>{
|
|
3073
3067
|
var _tagConfig_tags;
|
|
3074
|
-
if (!(null
|
|
3068
|
+
if (!(null == (_tagConfig_tags = tagConfig.tags) ? void 0 : _tagConfig_tags.length)) return data;
|
|
3075
3069
|
let fromInjectTags = (tags)=>{
|
|
3076
3070
|
let ret = [];
|
|
3077
3071
|
for (let tag of tags){
|
|
@@ -3154,10 +3148,10 @@ class RsbuildHtmlPlugin {
|
|
|
3154
3148
|
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
3155
3149
|
getHTMLPlugin().getCompilationHooks(compilation).alterAssetTagGroups.tapPromise(this.name, async (data)=>{
|
|
3156
3150
|
var _data_plugin_options, _data_plugin_options1;
|
|
3157
|
-
let entryName = null
|
|
3151
|
+
let entryName = null == (_data_plugin_options = data.plugin.options) ? void 0 : _data_plugin_options.entryName;
|
|
3158
3152
|
if (!entryName) return data;
|
|
3159
3153
|
let { headTags, bodyTags } = data, { favicon, tagConfig, templateContent } = this.options[entryName];
|
|
3160
|
-
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);
|
|
3161
3155
|
let tags = {
|
|
3162
3156
|
headTags: headTags.map(formatBasicTag),
|
|
3163
3157
|
bodyTags: bodyTags.map(formatBasicTag)
|
|
@@ -3326,7 +3320,7 @@ let getTagConfig = (config)=>{
|
|
|
3326
3320
|
let formattedCrossorigin = !0 === crossorigin ? 'anonymous' : crossorigin;
|
|
3327
3321
|
for (let tag of allTags){
|
|
3328
3322
|
var _tag_attrs, _tag_attrs1;
|
|
3329
|
-
("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);
|
|
3330
3324
|
}
|
|
3331
3325
|
}
|
|
3332
3326
|
return {
|
|
@@ -3357,7 +3351,7 @@ let pluginInlineChunk = ()=>({
|
|
|
3357
3351
|
let inlinedAssets = new Set(), getInlinedScriptTag = (publicPath, tag, compilation, scriptTests, config)=>{
|
|
3358
3352
|
var _tag_attrs;
|
|
3359
3353
|
let { assets } = compilation;
|
|
3360
|
-
if (!((null
|
|
3354
|
+
if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) && 'string' == typeof tag.attrs.src)) return tag;
|
|
3361
3355
|
let { src, ...otherAttrs } = tag.attrs, scriptName = publicPath ? src.replace(publicPath, '') : src, asset = assets[scriptName];
|
|
3362
3356
|
if (null == asset) return tag;
|
|
3363
3357
|
let source = asset.source().toString();
|
|
@@ -3379,7 +3373,7 @@ let pluginInlineChunk = ()=>({
|
|
|
3379
3373
|
}, getInlinedCSSTag = (publicPath, tag, compilation, styleTests, config)=>{
|
|
3380
3374
|
var _tag_attrs;
|
|
3381
3375
|
let { assets } = compilation;
|
|
3382
|
-
if (!((null
|
|
3376
|
+
if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.href) && 'string' == typeof tag.attrs.href)) return tag;
|
|
3383
3377
|
let linkName = publicPath ? tag.attrs.href.replace(publicPath, '') : tag.attrs.href, asset = assets[linkName];
|
|
3384
3378
|
if (null == asset) return tag;
|
|
3385
3379
|
let source = asset.source().toString();
|
|
@@ -3458,7 +3452,7 @@ let generateManifest = (htmlPaths, manifestOptions)=>(_seed, files)=>{
|
|
|
3458
3452
|
}
|
|
3459
3453
|
let entryManifest = {};
|
|
3460
3454
|
assets.size && (entryManifest.assets = Array.from(assets));
|
|
3461
|
-
let htmlPath = null
|
|
3455
|
+
let htmlPath = null == (_files_find = files.find((f)=>f.name === htmlPaths[name])) ? void 0 : _files_find.path;
|
|
3462
3456
|
htmlPath && (entryManifest.html = [
|
|
3463
3457
|
htmlPath
|
|
3464
3458
|
]), initialJS.length && (entryManifest.initial = {
|
|
@@ -3620,7 +3614,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3620
3614
|
];
|
|
3621
3615
|
if (nonce) for (let tag of allTags){
|
|
3622
3616
|
var _tag_attrs, _tag_attrs1;
|
|
3623
|
-
("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);
|
|
3624
3618
|
}
|
|
3625
3619
|
return {
|
|
3626
3620
|
headTags,
|
|
@@ -3856,11 +3850,11 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
|
|
|
3856
3850
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
|
|
3857
3851
|
let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
|
|
3858
3852
|
var _context_devServer, _context_devServer1, _context_devServer2;
|
|
3859
|
-
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;
|
|
3860
3854
|
if (isProd) 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
|
|
3861
3855
|
else if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
3862
3856
|
else if (!0 === dev.assetPrefix) {
|
|
3863
|
-
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;
|
|
3864
3858
|
publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
|
|
3865
3859
|
}
|
|
3866
3860
|
return formatPublicPath(replacePortPlaceholder(publicPath, port));
|
|
@@ -3897,7 +3891,7 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
|
|
|
3897
3891
|
var _rsbuildConfig_performance, _config_performance;
|
|
3898
3892
|
let applyBundleAnalyzeConfig = (config)=>{
|
|
3899
3893
|
var _config_performance;
|
|
3900
|
-
(null
|
|
3894
|
+
(null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze) ? config.performance.bundleAnalyze = {
|
|
3901
3895
|
generateStatsFile: !0,
|
|
3902
3896
|
...config.performance.bundleAnalyze || {}
|
|
3903
3897
|
} : (config.performance ??= {}, config.performance.bundleAnalyze = {
|
|
@@ -3905,8 +3899,8 @@ let getJsAsyncPath = (jsPath, isServer, jsAsync)=>void 0 !== jsAsync ? jsAsync :
|
|
|
3905
3899
|
generateStatsFile: !0
|
|
3906
3900
|
});
|
|
3907
3901
|
};
|
|
3908
|
-
if (null
|
|
3909
|
-
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);
|
|
3910
3904
|
}
|
|
3911
3905
|
}), api.modifyBundlerChain((chain, { environment })=>{
|
|
3912
3906
|
let { config } = environment, { profile } = config.performance;
|
|
@@ -4026,10 +4020,10 @@ class HtmlPreloadOrPrefetchPlugin {
|
|
|
4026
4020
|
if ('all-assets' === includeType) {
|
|
4027
4021
|
var _compilation_assetsInfo;
|
|
4028
4022
|
let licenseAssets = [
|
|
4029
|
-
...(null
|
|
4023
|
+
...(null == (_compilation_assetsInfo = compilation.assetsInfo) ? void 0 : _compilation_assetsInfo.values()) || []
|
|
4030
4024
|
].map((info)=>{
|
|
4031
4025
|
var _info_related;
|
|
4032
|
-
return null
|
|
4026
|
+
return null != (_info_related = info.related) && !!_info_related.license && info.related.license;
|
|
4033
4027
|
}).filter(Boolean);
|
|
4034
4028
|
return [
|
|
4035
4029
|
{
|
|
@@ -4084,14 +4078,11 @@ class HtmlPreloadOrPrefetchPlugin {
|
|
|
4084
4078
|
}
|
|
4085
4079
|
return links;
|
|
4086
4080
|
}(this.options, this.type, compilation, htmlPluginData, this.HTMLCount), htmlPluginData)), getHTMLPlugin().getHooks(compilation).alterAssetTags.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>{
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
htmlPluginData.assetTags.
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
];
|
|
4093
|
-
}
|
|
4094
|
-
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;
|
|
4095
4086
|
});
|
|
4096
4087
|
});
|
|
4097
4088
|
}
|
|
@@ -4152,11 +4143,11 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4152
4143
|
if ('true' !== process.env.RSDOCTOR) return;
|
|
4153
4144
|
let isRspack = 'rspack' === api.context.bundlerType, pluginName = isRspack ? 'RsdoctorRspackPlugin' : 'RsdoctorWebpackPlugin', isRsdoctorPlugin = (plugin)=>{
|
|
4154
4145
|
var _plugin_constructor;
|
|
4155
|
-
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;
|
|
4156
4147
|
};
|
|
4157
4148
|
for (let config of bundlerConfigs){
|
|
4158
4149
|
var _config_plugins;
|
|
4159
|
-
if (null
|
|
4150
|
+
if (null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.some((plugin)=>isRsdoctorPlugin(plugin))) return;
|
|
4160
4151
|
}
|
|
4161
4152
|
let packageName = isRspack ? '@rsdoctor/rspack-plugin' : '@rsdoctor/webpack-plugin';
|
|
4162
4153
|
try {
|
|
@@ -4184,10 +4175,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4184
4175
|
}
|
|
4185
4176
|
}), stopProfiler = (output, profileSession)=>{
|
|
4186
4177
|
profileSession && profileSession.post('Profiler.stop', (error, param)=>{
|
|
4187
|
-
if (error)
|
|
4188
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to generate JavaScript CPU profile:', error);
|
|
4189
|
-
return;
|
|
4190
|
-
}
|
|
4178
|
+
if (error) return void __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to generate JavaScript CPU profile:', error);
|
|
4191
4179
|
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.writeFileSync(output, JSON.stringify(param.profile));
|
|
4192
4180
|
});
|
|
4193
4181
|
}, pluginRspackProfile = ()=>({
|
|
@@ -4196,7 +4184,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4196
4184
|
var _process_env_RSPACK_PROFILE;
|
|
4197
4185
|
let profileSession;
|
|
4198
4186
|
if ('webpack' === api.context.bundlerType) return;
|
|
4199
|
-
let RSPACK_PROFILE = null
|
|
4187
|
+
let RSPACK_PROFILE = null == (_process_env_RSPACK_PROFILE = process.env.RSPACK_PROFILE) ? void 0 : _process_env_RSPACK_PROFILE.toUpperCase();
|
|
4200
4188
|
if (!RSPACK_PROFILE) return;
|
|
4201
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 ()=>{
|
|
4202
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');
|
|
@@ -4230,7 +4218,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4230
4218
|
if (config.server.open) {
|
|
4231
4219
|
var _api_context_devServer;
|
|
4232
4220
|
open_open({
|
|
4233
|
-
https: null
|
|
4221
|
+
https: null == (_api_context_devServer = api.context.devServer) ? void 0 : _api_context_devServer.https,
|
|
4234
4222
|
port,
|
|
4235
4223
|
routes,
|
|
4236
4224
|
config
|
|
@@ -4369,7 +4357,7 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4369
4357
|
return;
|
|
4370
4358
|
}
|
|
4371
4359
|
let { config } = environment, defaultConfig = {
|
|
4372
|
-
chunks: (null
|
|
4360
|
+
chunks: (null == (_config_moduleFederation = config.moduleFederation) || null == (_config_moduleFederation_options = _config_moduleFederation.options) ? void 0 : _config_moduleFederation_options.exposes) ? 'async' : 'all',
|
|
4373
4361
|
cacheGroups: {}
|
|
4374
4362
|
};
|
|
4375
4363
|
'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
|
|
@@ -4531,21 +4519,15 @@ let reduceTransformImportConfig = (options)=>{
|
|
|
4531
4519
|
api.modifyBundlerChain({
|
|
4532
4520
|
order: 'pre',
|
|
4533
4521
|
handler: async (chain, { target, environment })=>{
|
|
4534
|
-
if ('node' === target)
|
|
4535
|
-
chain.target('node');
|
|
4536
|
-
return;
|
|
4537
|
-
}
|
|
4522
|
+
if ('node' === target) return void chain.target('node');
|
|
4538
4523
|
let { browserslist } = environment, isDefaultBrowserslist = browserslist.join(',') === DEFAULT_WEB_BROWSERSLIST.join(',');
|
|
4539
|
-
if ('web-worker' === target)
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
]);
|
|
4547
|
-
return;
|
|
4548
|
-
}
|
|
4524
|
+
if ('web-worker' === target) return void chain.target(isDefaultBrowserslist ? [
|
|
4525
|
+
'webworker',
|
|
4526
|
+
'es2017'
|
|
4527
|
+
] : [
|
|
4528
|
+
'webworker',
|
|
4529
|
+
'es5'
|
|
4530
|
+
]);
|
|
4549
4531
|
let esQuery = isDefaultBrowserslist ? 'es2017' : `browserslist:${browserslist.join(',')}`;
|
|
4550
4532
|
chain.target([
|
|
4551
4533
|
'web',
|
|
@@ -4617,7 +4599,7 @@ async function modifyRspackConfig(context, rspackConfig, chainUtils) {
|
|
|
4617
4599
|
rspackConfig,
|
|
4618
4600
|
utils
|
|
4619
4601
|
]
|
|
4620
|
-
}), (null
|
|
4602
|
+
}), (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.rspack) && (currentConfig = await reduceConfigsAsyncWithContext({
|
|
4621
4603
|
initial: currentConfig,
|
|
4622
4604
|
config: utils.environment.config.tools.rspack,
|
|
4623
4605
|
ctx: utils,
|
|
@@ -4837,7 +4819,7 @@ let commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? __WEBPACK_EXTERNAL_MODU
|
|
|
4837
4819
|
envMode: commonOpts.envMode,
|
|
4838
4820
|
loader: commonOpts.configLoader
|
|
4839
4821
|
});
|
|
4840
|
-
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 = [
|
|
4841
4823
|
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
4842
4824
|
{
|
|
4843
4825
|
paths: filePath,
|
|
@@ -4861,7 +4843,7 @@ async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
|
4861
4843
|
var _config_dev;
|
|
4862
4844
|
if ('dev' !== rsbuild.context.action && !isBuildWatch) return;
|
|
4863
4845
|
let files = [], config = rsbuild.getNormalizedConfig();
|
|
4864
|
-
if (null
|
|
4846
|
+
if (null == (_config_dev = config.dev) ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
4865
4847
|
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
4866
4848
|
let paths = castArray(watchFilesConfig.paths);
|
|
4867
4849
|
watchFilesConfig.options ? watchFilesForRestart({
|
|
@@ -5040,10 +5022,7 @@ function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restar
|
|
|
5040
5022
|
for (let shortcut of shortcuts)message += ` ${shortcut.description}\n`;
|
|
5041
5023
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.log(message);
|
|
5042
5024
|
}
|
|
5043
|
-
for (let shortcut of shortcuts)if (input === shortcut.key)
|
|
5044
|
-
shortcut.action();
|
|
5045
|
-
return;
|
|
5046
|
-
}
|
|
5025
|
+
for (let shortcut of shortcuts)if (input === shortcut.key) return void shortcut.action();
|
|
5047
5026
|
}), ()=>{
|
|
5048
5027
|
rl.close();
|
|
5049
5028
|
};
|
|
@@ -5166,7 +5145,7 @@ class SocketServer {
|
|
|
5166
5145
|
let { default: ws } = await import("../compiled/ws/index.js");
|
|
5167
5146
|
this.wsServer = new ws.Server({
|
|
5168
5147
|
noServer: !0,
|
|
5169
|
-
path: null
|
|
5148
|
+
path: null == (_this_options_client = this.options.client) ? void 0 : _this_options_client.path
|
|
5170
5149
|
}), this.wsServer.on('error', (err)=>{
|
|
5171
5150
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
5172
5151
|
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
|
|
@@ -5491,17 +5470,14 @@ class CompilationManager {
|
|
|
5491
5470
|
let { devConfig, serverConfig, publicPaths } = this, clientPaths = function(devConfig) {
|
|
5492
5471
|
var _devConfig_client;
|
|
5493
5472
|
let clientPaths = [];
|
|
5494
|
-
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;
|
|
5495
5474
|
}(devConfig), middleware = await getCompilationMiddleware(this.compiler, {
|
|
5496
5475
|
callbacks: {
|
|
5497
5476
|
onInvalid: (compilationId, fileName)=>{
|
|
5498
|
-
if ('string' == typeof fileName && HTML_REGEX.test(fileName)) {
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
});
|
|
5503
|
-
return;
|
|
5504
|
-
}
|
|
5477
|
+
if ('string' == typeof fileName && HTML_REGEX.test(fileName)) return void this.socketServer.sockWrite({
|
|
5478
|
+
type: 'static-changed',
|
|
5479
|
+
compilationId
|
|
5480
|
+
});
|
|
5505
5481
|
this.socketServer.sockWrite({
|
|
5506
5482
|
type: 'invalid',
|
|
5507
5483
|
compilationId
|
|
@@ -5534,10 +5510,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
5534
5510
|
return void 0 === size || Number(size) > 1024;
|
|
5535
5511
|
}, gzipMiddleware = ({ level = __WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__.default.constants.Z_BEST_SPEED } = {})=>(req, res, next)=>{
|
|
5536
5512
|
let gzip, writeHeadStatus, accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
|
|
5537
|
-
if ('HEAD' === req.method || !encoding)
|
|
5538
|
-
next();
|
|
5539
|
-
return;
|
|
5540
|
-
}
|
|
5513
|
+
if ('HEAD' === req.method || !encoding) return void next();
|
|
5541
5514
|
let started = !1, { end, write, on, writeHead } = res, listeners = [], start = ()=>{
|
|
5542
5515
|
if (!started) {
|
|
5543
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({
|
|
@@ -5609,7 +5582,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
5609
5582
|
}), res.end();
|
|
5610
5583
|
return;
|
|
5611
5584
|
}
|
|
5612
|
-
if (null
|
|
5585
|
+
if (null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('text/html')) {
|
|
5613
5586
|
res.writeHead(404, {
|
|
5614
5587
|
'Content-Type': 'text/html'
|
|
5615
5588
|
}), res.end(`The server is configured with a base URL of ${base} - did you mean to visit <a href="${redirectPath}">${redirectPath}</a> instead?`);
|
|
@@ -5760,7 +5733,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
|
|
|
5760
5733
|
environments
|
|
5761
5734
|
})), compilationManager && (middlewares.push(compilationManager.middleware), upgradeEvents.push(compilationManager.socketServer.upgrade), middlewares.push((req, res, next)=>{
|
|
5762
5735
|
var _req_url;
|
|
5763
|
-
(null
|
|
5736
|
+
(null == (_req_url = req.url) ? void 0 : _req_url.endsWith('.hot-update.json')) && 'OPTIONS' !== req.method ? (res.statusCode = 404, res.end()) : next();
|
|
5764
5737
|
})), compilationManager && middlewares.push(getHtmlCompletionMiddleware({
|
|
5765
5738
|
compilationManager,
|
|
5766
5739
|
distPath: context.distPath
|
|
@@ -5945,7 +5918,7 @@ class EsmRunner extends CommonJsRunner {
|
|
|
5945
5918
|
createRunner() {
|
|
5946
5919
|
var _this__options_compilerOptions_experiments;
|
|
5947
5920
|
super.createRunner(), this.requirers.set('cjs', this.getRequire()), this.requirers.set('esm', this.createEsmRequirer());
|
|
5948
|
-
let outputModule = null
|
|
5921
|
+
let outputModule = null == (_this__options_compilerOptions_experiments = this._options.compilerOptions.experiments) ? void 0 : _this__options_compilerOptions_experiments.outputModule;
|
|
5949
5922
|
this.requirers.set('entry', (currentDirectory, modulePath, context)=>{
|
|
5950
5923
|
let file = this.getFile(modulePath, currentDirectory);
|
|
5951
5924
|
return file ? outputModule && !file.path.endsWith('.cjs') ? this.requirers.get('esm')(currentDirectory, modulePath, {
|
|
@@ -6019,7 +5992,7 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunne
|
|
|
6019
5992
|
let { chunks: entryChunks = [] } = entrypoints[entryName], files = entryChunks.reduce((prev, entryChunkName)=>{
|
|
6020
5993
|
let chunk = null == chunks ? void 0 : chunks.find((chunk)=>{
|
|
6021
5994
|
var _chunk_names;
|
|
6022
|
-
return chunk.entry && (null
|
|
5995
|
+
return chunk.entry && (null == (_chunk_names = chunk.names) ? void 0 : _chunk_names.includes(String(entryChunkName)));
|
|
6023
5996
|
});
|
|
6024
5997
|
return (null == chunk ? void 0 : chunk.files) ? prev.concat(chunk.files.filter((file)=>!file.endsWith('.css'))) : prev;
|
|
6025
5998
|
}, []);
|
|
@@ -6303,7 +6276,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
6303
6276
|
}, hasErrors = stats.hasErrors();
|
|
6304
6277
|
if (!hasErrors) {
|
|
6305
6278
|
var _statsJson_children;
|
|
6306
|
-
isMultiCompiler && (null
|
|
6279
|
+
isMultiCompiler && (null == (_statsJson_children = statsJson.children) ? void 0 : _statsJson_children.length) ? statsJson.children.forEach((c, index)=>{
|
|
6307
6280
|
printTime(c, index);
|
|
6308
6281
|
}) : printTime(statsJson, 0);
|
|
6309
6282
|
}
|
|
@@ -6613,11 +6586,11 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
6613
6586
|
let { moduleFederation } = config;
|
|
6614
6587
|
if (api.isPluginExists('rsbuild:module-federation-enhanced') && (config.server ||= {}, config.server.cors = !0), (null == moduleFederation ? void 0 : moduleFederation.options) && moduleFederation.options.exposes) {
|
|
6615
6588
|
var _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
|
|
6616
|
-
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);
|
|
6617
6590
|
}
|
|
6618
6591
|
}), api.modifyEnvironmentConfig((config)=>{
|
|
6619
6592
|
var _config_moduleFederation, _config_performance_chunkSplit, _config_performance;
|
|
6620
|
-
(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 = {
|
|
6621
6594
|
...config.performance.chunkSplit,
|
|
6622
6595
|
strategy: 'custom'
|
|
6623
6596
|
}), config.source.include = [
|
|
@@ -6627,7 +6600,7 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
6627
6600
|
}), api.modifyBundlerChain(async (chain, { CHAIN_ID, target, environment })=>{
|
|
6628
6601
|
var _config_moduleFederation;
|
|
6629
6602
|
let { config } = environment;
|
|
6630
|
-
if (!(null
|
|
6603
|
+
if (!(null == (_config_moduleFederation = config.moduleFederation) ? void 0 : _config_moduleFederation.options) || 'web' !== target) return;
|
|
6631
6604
|
let { options } = config.moduleFederation;
|
|
6632
6605
|
chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(__WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack.container.ModuleFederationPlugin, [
|
|
6633
6606
|
options
|
|
@@ -6657,7 +6630,7 @@ async function createRsbuild(options = {}) {
|
|
|
6657
6630
|
paths: envs1.filePaths,
|
|
6658
6631
|
type: 'reload-server'
|
|
6659
6632
|
}
|
|
6660
|
-
], null
|
|
6633
|
+
], null == (_config_performance = config1.performance) ? void 0 : _config_performance.buildCache))) {
|
|
6661
6634
|
let { buildCache } = config1.performance;
|
|
6662
6635
|
!0 === buildCache ? config1.performance.buildCache = {
|
|
6663
6636
|
buildDependencies: envs1.filePaths
|
|
@@ -7316,11 +7289,11 @@ async function runCLI() {
|
|
|
7316
7289
|
}
|
|
7317
7290
|
process.title = 'rsbuild-node';
|
|
7318
7291
|
let { npm_execpath } = process.env;
|
|
7319
|
-
(!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`);
|
|
7320
7293
|
try {
|
|
7321
7294
|
!function() {
|
|
7322
7295
|
let cli = cac_dist('rsbuild');
|
|
7323
|
-
cli.help(), cli.version("1.3.
|
|
7296
|
+
cli.help(), cli.version("1.3.7"), applyCommonOptions(cli);
|
|
7324
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');
|
|
7325
7298
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7326
7299
|
try {
|
|
@@ -7371,6 +7344,6 @@ async function runCLI() {
|
|
|
7371
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);
|
|
7372
7345
|
}
|
|
7373
7346
|
}
|
|
7374
|
-
let src_version = "1.3.
|
|
7347
|
+
let src_version = "1.3.7";
|
|
7375
7348
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
7376
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 };
|
package/dist/transformLoader.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
async function
|
|
1
|
+
async function transformLoader_transform(source, map) {
|
|
2
2
|
var _this__compiler___rsbuildTransformer, _this__compiler;
|
|
3
3
|
let callback = this.async(), bypass = ()=>callback(null, source, map), { id: transformId, getEnvironment } = this.getOptions();
|
|
4
4
|
if (!transformId) return bypass();
|
|
5
|
-
let transform = null
|
|
5
|
+
let transform = null == (_this__compiler = this._compiler) || null == (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
6
6
|
if (!transform) return bypass();
|
|
7
7
|
try {
|
|
8
8
|
let result = await transform({
|
|
@@ -27,4 +27,4 @@ async function transformLoader_rslib_entry_transform(source, map) {
|
|
|
27
27
|
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
export {
|
|
30
|
+
export { transformLoader_transform as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
let
|
|
1
|
+
let transformRawLoader = async function(source, map) {
|
|
2
2
|
var _this__compiler___rsbuildTransformer, _this__compiler;
|
|
3
3
|
let callback = this.async(), bypass = ()=>callback(null, source, map), { id: transformId, getEnvironment } = this.getOptions();
|
|
4
4
|
if (!transformId) return bypass();
|
|
5
|
-
let transform = null
|
|
5
|
+
let transform = null == (_this__compiler = this._compiler) || null == (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
6
6
|
if (!transform) return bypass();
|
|
7
7
|
try {
|
|
8
8
|
let result = await transform({
|
|
@@ -27,4 +27,4 @@ let transformRawLoader_rslib_entry_ = async function(source, map) {
|
|
|
27
27
|
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
28
28
|
}
|
|
29
29
|
}, raw = !0;
|
|
30
|
-
export {
|
|
30
|
+
export { transformRawLoader as default, raw };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @ts-ignore `webpack` type only exists when `@rsbuild/webpack` is installed */
|
|
1
2
|
import type { RuleSetRule, Configuration as WebpackConfig, WebpackPluginInstance } from 'webpack';
|
|
2
3
|
import type RspackChain from '../../compiled/rspack-chain';
|
|
3
4
|
import type { ChainIdentifier } from '../configChain';
|
|
@@ -93,6 +94,7 @@ export type AsyncHook<Callback extends (...args: any[]) => T, T = any> = {
|
|
|
93
94
|
};
|
|
94
95
|
export type ModifyRspackConfigFn = (config: Rspack.Configuration, utils: ModifyRspackConfigUtils) => MaybePromise<Rspack.Configuration | void>;
|
|
95
96
|
export type ModifyWebpackChainUtils = ModifyChainUtils & {
|
|
97
|
+
/** @ts-ignore `webpack` type only exists when `@rsbuild/webpack` is installed */
|
|
96
98
|
webpack: typeof import('webpack');
|
|
97
99
|
CHAIN_ID: ChainIdentifier;
|
|
98
100
|
/**
|