@rsbuild/core 1.3.6 → 1.3.8
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 +84 -110
- package/dist/index.js +83 -109
- package/dist/transformLoader.mjs +3 -3
- package/dist/transformRawLoader.mjs +3 -3
- package/dist-types/config.d.ts +3 -4
- 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.cjs
CHANGED
|
@@ -838,7 +838,7 @@ var __webpack_modules__ = {
|
|
|
838
838
|
return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
|
|
839
839
|
}
|
|
840
840
|
if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
|
|
841
|
-
for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null
|
|
841
|
+
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;
|
|
842
842
|
return !0;
|
|
843
843
|
};
|
|
844
844
|
},
|
|
@@ -1000,7 +1000,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1000
1000
|
defineConfig: ()=>defineConfig,
|
|
1001
1001
|
mergeRsbuildConfig: ()=>mergeRsbuildConfig,
|
|
1002
1002
|
runCLI: ()=>runCLI,
|
|
1003
|
-
version: ()=>
|
|
1003
|
+
version: ()=>src_version,
|
|
1004
1004
|
PLUGIN_SWC_NAME: ()=>PLUGIN_SWC_NAME,
|
|
1005
1005
|
PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
|
|
1006
1006
|
loadConfig: ()=>config_loadConfig,
|
|
@@ -1113,9 +1113,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1113
1113
|
}, 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)=>'/' === external_node_path_namespaceObject.sep ? filepath : filepath.replace(/\\/g, '/'), isFileSync = (filePath)=>{
|
|
1114
1114
|
try {
|
|
1115
1115
|
var _fs_statSync;
|
|
1116
|
-
return null
|
|
1116
|
+
return null == (_fs_statSync = external_node_fs_default().statSync(filePath, {
|
|
1117
1117
|
throwIfNoEntry: !1
|
|
1118
|
-
}))
|
|
1118
|
+
})) ? void 0 : _fs_statSync.isFile();
|
|
1119
1119
|
} catch (_) {
|
|
1120
1120
|
return !1;
|
|
1121
1121
|
}
|
|
@@ -1131,10 +1131,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1131
1131
|
}
|
|
1132
1132
|
async function fileExistsByCompilation({ inputFileSystem }, filePath) {
|
|
1133
1133
|
return new Promise((resolve)=>{
|
|
1134
|
-
if (!inputFileSystem)
|
|
1135
|
-
resolve(!1);
|
|
1136
|
-
return;
|
|
1137
|
-
}
|
|
1134
|
+
if (!inputFileSystem) return void resolve(!1);
|
|
1138
1135
|
inputFileSystem.stat(filePath, (err, stats)=>{
|
|
1139
1136
|
err ? resolve(!1) : resolve(!!(null == stats ? void 0 : stats.isFile()));
|
|
1140
1137
|
});
|
|
@@ -1271,18 +1268,18 @@ for(var __webpack_i__ in (()=>{
|
|
|
1271
1268
|
}
|
|
1272
1269
|
function formatStatsMessages(stats, verbose) {
|
|
1273
1270
|
var _stats_errors, _stats_warnings;
|
|
1274
|
-
let formattedErrors = (null
|
|
1271
|
+
let formattedErrors = (null == (_stats_errors = stats.errors) ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [];
|
|
1275
1272
|
return {
|
|
1276
1273
|
errors: formattedErrors,
|
|
1277
|
-
warnings: (null
|
|
1274
|
+
warnings: (null == (_stats_warnings = stats.warnings) ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || []
|
|
1278
1275
|
};
|
|
1279
1276
|
}
|
|
1280
1277
|
let getAllStatsErrors = (statsData)=>{
|
|
1281
1278
|
var _statsData_errors, _statsData_children;
|
|
1282
|
-
return statsData.errorsCount && (null
|
|
1279
|
+
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;
|
|
1283
1280
|
}, getAllStatsWarnings = (statsData)=>{
|
|
1284
1281
|
var _statsData_warnings, _statsData_children;
|
|
1285
|
-
return statsData.warningsCount && (null
|
|
1282
|
+
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;
|
|
1286
1283
|
};
|
|
1287
1284
|
function getStatsOptions(compiler) {
|
|
1288
1285
|
if (helpers_isMultiCompiler(compiler)) return {
|
|
@@ -1679,7 +1676,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1679
1676
|
}), withDefaultConfig = async (rootPath, config)=>{
|
|
1680
1677
|
var _merged_server, _config_dev, _config_output;
|
|
1681
1678
|
let merged = mergeRsbuildConfig(createDefaultConfig(), config);
|
|
1682
|
-
if (merged.root ||= rootPath, merged.source ||= {}, (null
|
|
1679
|
+
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) {
|
|
1683
1680
|
let tsconfigPath = (0, external_node_path_namespaceObject.join)(rootPath, 'tsconfig.json');
|
|
1684
1681
|
await isFileExists(tsconfigPath) && (merged.source.tsconfigPath = tsconfigPath);
|
|
1685
1682
|
}
|
|
@@ -1884,7 +1881,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1884
1881
|
for (let plugin of plugins){
|
|
1885
1882
|
var _removedPlugins_plugin_environment, _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL;
|
|
1886
1883
|
let isGlobalPlugin = 'RSBUILD_ALL_ENVIRONMENT_SYMBOL' === plugin.environment;
|
|
1887
|
-
if ((null
|
|
1884
|
+
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;
|
|
1888
1885
|
let { instance, environment } = plugin;
|
|
1889
1886
|
await instance.setup(getPluginAPI(environment));
|
|
1890
1887
|
}
|
|
@@ -2204,7 +2201,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2204
2201
|
name,
|
|
2205
2202
|
distPath: function(cwd, config) {
|
|
2206
2203
|
var _config_output_distPath, _config_output;
|
|
2207
|
-
return getAbsolutePath(cwd, (null
|
|
2204
|
+
return getAbsolutePath(cwd, (null == (_config_output = config.output) || null == (_config_output_distPath = _config_output.distPath) ? void 0 : _config_output_distPath.root) ?? ROOT_DIST_DIR);
|
|
2208
2205
|
}(context.rootPath, config),
|
|
2209
2206
|
entry,
|
|
2210
2207
|
browserslist,
|
|
@@ -2221,7 +2218,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2221
2218
|
async function createContext(options, userConfig) {
|
|
2222
2219
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
2223
2220
|
return {
|
|
2224
|
-
version: "1.3.
|
|
2221
|
+
version: "1.3.8",
|
|
2225
2222
|
rootPath,
|
|
2226
2223
|
distPath: '',
|
|
2227
2224
|
cachePath,
|
|
@@ -2367,7 +2364,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2367
2364
|
utils
|
|
2368
2365
|
]
|
|
2369
2366
|
});
|
|
2370
|
-
if (null
|
|
2367
|
+
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);
|
|
2371
2368
|
return rslog_index_js_namespaceObject.logger.debug('modify bundler chain done'), modifiedBundlerChain;
|
|
2372
2369
|
}
|
|
2373
2370
|
let configChain_CHAIN_ID = {
|
|
@@ -2542,7 +2539,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2542
2539
|
}
|
|
2543
2540
|
}), isUseAnalyzer = (config)=>{
|
|
2544
2541
|
var _config_performance;
|
|
2545
|
-
return process.env.BUNDLE_ANALYZE || (null
|
|
2542
|
+
return process.env.BUNDLE_ANALYZE || (null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze);
|
|
2546
2543
|
}, external_node_crypto_namespaceObject = require("node:crypto");
|
|
2547
2544
|
var external_node_crypto_default = __webpack_require__.n(external_node_crypto_namespaceObject);
|
|
2548
2545
|
async function validateWebpackCache(cacheDirectory, buildDependencies) {
|
|
@@ -2573,7 +2570,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2573
2570
|
let { tsconfigPath } = environmentContext;
|
|
2574
2571
|
tsconfigPath && (buildDependencies.tsconfig = [
|
|
2575
2572
|
tsconfigPath
|
|
2576
|
-
]), (null
|
|
2573
|
+
]), (null == (_config__privateMeta = config._privateMeta) ? void 0 : _config__privateMeta.configFilePath) && (buildDependencies.rsbuildConfig = [
|
|
2577
2574
|
config._privateMeta.configFilePath
|
|
2578
2575
|
]), await isFileExists(browserslistConfig) && (buildDependencies.browserslistrc = [
|
|
2579
2576
|
browserslistConfig
|
|
@@ -2655,7 +2652,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2655
2652
|
return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
|
|
2656
2653
|
path: distPath,
|
|
2657
2654
|
keep
|
|
2658
|
-
} :
|
|
2655
|
+
} : (rslog_index_js_namespaceObject.logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), rslog_index_js_namespaceObject.logger.warn(`Please set ${index_js_default().yellow('`output.cleanDistPath`')} config manually.`), rslog_index_js_namespaceObject.logger.warn(`Current root path: ${index_js_default().dim(rootPath)}`), void rslog_index_js_namespaceObject.logger.warn(`Current dist path: ${index_js_default().dim(distPath)}`)) : !0 === enable ? {
|
|
2659
2656
|
path: distPath,
|
|
2660
2657
|
keep
|
|
2661
2658
|
} : void 0;
|
|
@@ -2821,7 +2818,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2821
2818
|
if (cached) return clonePostCSSConfig(await cached);
|
|
2822
2819
|
let { default: postcssrc } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/postcss-load-config/index.js")), promise = postcssrc({}, root).catch((err)=>{
|
|
2823
2820
|
var _err_message;
|
|
2824
|
-
if (null
|
|
2821
|
+
if (null == (_err_message = err.message) ? void 0 : _err_message.includes('No PostCSS Config found')) return {};
|
|
2825
2822
|
throw err;
|
|
2826
2823
|
});
|
|
2827
2824
|
return postcssrcCache.set(root, promise), promise.then((config)=>(postcssrcCache.set(root, config), clonePostCSSConfig(config)));
|
|
@@ -2919,7 +2916,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2919
2916
|
root: api.context.rootPath,
|
|
2920
2917
|
postcssrcCache
|
|
2921
2918
|
});
|
|
2922
|
-
if ('function' == typeof postcssLoaderOptions.postcssOptions || (null
|
|
2919
|
+
if ('function' == typeof postcssLoaderOptions.postcssOptions || (null == (_postcssLoaderOptions_postcssOptions = postcssLoaderOptions.postcssOptions) || null == (_postcssLoaderOptions_postcssOptions_plugins = _postcssLoaderOptions_postcssOptions.plugins) ? void 0 : _postcssLoaderOptions_postcssOptions_plugins.length)) {
|
|
2923
2920
|
importLoaders++;
|
|
2924
2921
|
let postcssLoaderPath = getCompiledPath('postcss-loader');
|
|
2925
2922
|
updateRules((rule)=>{
|
|
@@ -2983,10 +2980,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2983
2980
|
let pathKey = Object.keys(value).find((key)=>'path' === key.toLowerCase() && value[key] === process.env[key]);
|
|
2984
2981
|
pathKey && rslog_index_js_namespaceObject.logger.warn(index_js_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.`));
|
|
2985
2982
|
};
|
|
2986
|
-
if ('object' == typeof value)
|
|
2987
|
-
check(value);
|
|
2988
|
-
return;
|
|
2989
|
-
}
|
|
2983
|
+
if ('object' == typeof value) return check(value);
|
|
2990
2984
|
if ('string' == typeof value) try {
|
|
2991
2985
|
check(JSON.parse(value));
|
|
2992
2986
|
} catch (error) {}
|
|
@@ -3177,7 +3171,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
3177
3171
|
...override
|
|
3178
3172
|
})), applyTagConfig = (data, tagConfig, compilationHash, entryName)=>{
|
|
3179
3173
|
var _tagConfig_tags;
|
|
3180
|
-
if (!(null
|
|
3174
|
+
if (!(null == (_tagConfig_tags = tagConfig.tags) ? void 0 : _tagConfig_tags.length)) return data;
|
|
3181
3175
|
let fromInjectTags = (tags)=>{
|
|
3182
3176
|
let ret = [];
|
|
3183
3177
|
for (let tag of tags){
|
|
@@ -3260,10 +3254,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
3260
3254
|
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
3261
3255
|
getHTMLPlugin().getCompilationHooks(compilation).alterAssetTagGroups.tapPromise(this.name, async (data)=>{
|
|
3262
3256
|
var _data_plugin_options, _data_plugin_options1;
|
|
3263
|
-
let entryName = null
|
|
3257
|
+
let entryName = null == (_data_plugin_options = data.plugin.options) ? void 0 : _data_plugin_options.entryName;
|
|
3264
3258
|
if (!entryName) return data;
|
|
3265
3259
|
let { headTags, bodyTags } = data, { favicon, tagConfig, templateContent } = this.options[entryName];
|
|
3266
|
-
hasTitle(templateContent) || addTitleTag(headTags, null
|
|
3260
|
+
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);
|
|
3267
3261
|
let tags = {
|
|
3268
3262
|
headTags: headTags.map(formatBasicTag),
|
|
3269
3263
|
bodyTags: bodyTags.map(formatBasicTag)
|
|
@@ -3433,7 +3427,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
3433
3427
|
let formattedCrossorigin = !0 === crossorigin ? 'anonymous' : crossorigin;
|
|
3434
3428
|
for (let tag of allTags){
|
|
3435
3429
|
var _tag_attrs, _tag_attrs1;
|
|
3436
|
-
("script" === tag.tag && (null
|
|
3430
|
+
("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);
|
|
3437
3431
|
}
|
|
3438
3432
|
}
|
|
3439
3433
|
return {
|
|
@@ -3464,7 +3458,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
3464
3458
|
let inlinedAssets = new Set(), getInlinedScriptTag = (publicPath, tag, compilation, scriptTests, config)=>{
|
|
3465
3459
|
var _tag_attrs;
|
|
3466
3460
|
let { assets } = compilation;
|
|
3467
|
-
if (!((null
|
|
3461
|
+
if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) && 'string' == typeof tag.attrs.src)) return tag;
|
|
3468
3462
|
let { src, ...otherAttrs } = tag.attrs, scriptName = publicPath ? src.replace(publicPath, '') : src, asset = assets[scriptName];
|
|
3469
3463
|
if (null == asset) return tag;
|
|
3470
3464
|
let source = asset.source().toString();
|
|
@@ -3486,7 +3480,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
3486
3480
|
}, getInlinedCSSTag = (publicPath, tag, compilation, styleTests, config)=>{
|
|
3487
3481
|
var _tag_attrs;
|
|
3488
3482
|
let { assets } = compilation;
|
|
3489
|
-
if (!((null
|
|
3483
|
+
if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.href) && 'string' == typeof tag.attrs.href)) return tag;
|
|
3490
3484
|
let linkName = publicPath ? tag.attrs.href.replace(publicPath, '') : tag.attrs.href, asset = assets[linkName];
|
|
3491
3485
|
if (null == asset) return tag;
|
|
3492
3486
|
let source = asset.source().toString();
|
|
@@ -3565,7 +3559,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
3565
3559
|
}
|
|
3566
3560
|
let entryManifest = {};
|
|
3567
3561
|
assets.size && (entryManifest.assets = Array.from(assets));
|
|
3568
|
-
let htmlPath = null
|
|
3562
|
+
let htmlPath = null == (_files_find = files.find((f)=>f.name === htmlPaths[name])) ? void 0 : _files_find.path;
|
|
3569
3563
|
htmlPath && (entryManifest.html = [
|
|
3570
3564
|
htmlPath
|
|
3571
3565
|
]), initialJS.length && (entryManifest.initial = {
|
|
@@ -3728,7 +3722,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3728
3722
|
];
|
|
3729
3723
|
if (nonce) for (let tag of allTags){
|
|
3730
3724
|
var _tag_attrs, _tag_attrs1;
|
|
3731
|
-
("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null
|
|
3725
|
+
("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);
|
|
3732
3726
|
}
|
|
3733
3727
|
return {
|
|
3734
3728
|
headTags,
|
|
@@ -3811,10 +3805,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3811
3805
|
if (port !== original && strictPort) throw Error(`[rsbuild:server] Port "${original}" is occupied, please choose another one.`);
|
|
3812
3806
|
return port;
|
|
3813
3807
|
}, getServerConfig = async ({ config })=>{
|
|
3814
|
-
let
|
|
3808
|
+
let { host, port: originalPort, strictPort } = config.server, port = await getPort({
|
|
3815
3809
|
host,
|
|
3816
3810
|
port: originalPort,
|
|
3817
|
-
strictPort
|
|
3811
|
+
strictPort
|
|
3818
3812
|
}), https = !!config.server.https, portTip = port !== originalPort ? `port ${originalPort} is in use, ${index_js_default().yellow(`using port ${port}.`)}` : void 0;
|
|
3819
3813
|
return {
|
|
3820
3814
|
port,
|
|
@@ -3966,14 +3960,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3966
3960
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
|
|
3967
3961
|
let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
|
|
3968
3962
|
var _context_devServer, _context_devServer1, _context_devServer2;
|
|
3969
|
-
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX
|
|
3963
|
+
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX;
|
|
3970
3964
|
if (isProd) 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
|
|
3971
3965
|
else if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
3972
3966
|
else if (!0 === dev.assetPrefix) {
|
|
3973
|
-
let protocol = (null
|
|
3967
|
+
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;
|
|
3974
3968
|
publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
|
|
3975
3969
|
}
|
|
3976
|
-
|
|
3970
|
+
let defaultPort = server.port ?? 3000;
|
|
3971
|
+
return formatPublicPath(replacePortPlaceholder(publicPath, isProd ? defaultPort : (null == (_context_devServer = context.devServer) ? void 0 : _context_devServer.port) ?? defaultPort));
|
|
3977
3972
|
}({
|
|
3978
3973
|
config,
|
|
3979
3974
|
isProd,
|
|
@@ -4007,7 +4002,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4007
4002
|
var _rsbuildConfig_performance, _config_performance;
|
|
4008
4003
|
let applyBundleAnalyzeConfig = (config)=>{
|
|
4009
4004
|
var _config_performance;
|
|
4010
|
-
(null
|
|
4005
|
+
(null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze) ? config.performance.bundleAnalyze = {
|
|
4011
4006
|
generateStatsFile: !0,
|
|
4012
4007
|
...config.performance.bundleAnalyze || {}
|
|
4013
4008
|
} : (config.performance ??= {}, config.performance.bundleAnalyze = {
|
|
@@ -4015,8 +4010,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4015
4010
|
generateStatsFile: !0
|
|
4016
4011
|
});
|
|
4017
4012
|
};
|
|
4018
|
-
if (null
|
|
4019
|
-
else if (rsbuildConfig.environments) for (let config of Object.values(rsbuildConfig.environments))(null
|
|
4013
|
+
if (null == (_rsbuildConfig_performance = rsbuildConfig.performance) ? void 0 : _rsbuildConfig_performance.profile) applyBundleAnalyzeConfig(rsbuildConfig);
|
|
4014
|
+
else if (rsbuildConfig.environments) for (let config of Object.values(rsbuildConfig.environments))(null == (_config_performance = config.performance) ? void 0 : _config_performance.profile) && applyBundleAnalyzeConfig(config);
|
|
4020
4015
|
}
|
|
4021
4016
|
}), api.modifyBundlerChain((chain, { environment })=>{
|
|
4022
4017
|
let { config } = environment, { profile } = config.performance;
|
|
@@ -4136,10 +4131,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4136
4131
|
if ('all-assets' === includeType) {
|
|
4137
4132
|
var _compilation_assetsInfo;
|
|
4138
4133
|
let licenseAssets = [
|
|
4139
|
-
...(null
|
|
4134
|
+
...(null == (_compilation_assetsInfo = compilation.assetsInfo) ? void 0 : _compilation_assetsInfo.values()) || []
|
|
4140
4135
|
].map((info)=>{
|
|
4141
4136
|
var _info_related;
|
|
4142
|
-
return null
|
|
4137
|
+
return null != (_info_related = info.related) && !!_info_related.license && info.related.license;
|
|
4143
4138
|
}).filter(Boolean);
|
|
4144
4139
|
return [
|
|
4145
4140
|
{
|
|
@@ -4194,14 +4189,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4194
4189
|
}
|
|
4195
4190
|
return links;
|
|
4196
4191
|
}(this.options, this.type, compilation, htmlPluginData, this.HTMLCount), htmlPluginData)), getHTMLPlugin().getHooks(compilation).alterAssetTags.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>{
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
htmlPluginData.assetTags.
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
];
|
|
4203
|
-
}
|
|
4204
|
-
return htmlPluginData;
|
|
4192
|
+
var resourceHints, scripts;
|
|
4193
|
+
return this.resourceHints && (htmlPluginData.assetTags.styles = [
|
|
4194
|
+
...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
|
|
4195
|
+
...htmlPluginData.assetTags.styles
|
|
4196
|
+
]), htmlPluginData;
|
|
4205
4197
|
});
|
|
4206
4198
|
});
|
|
4207
4199
|
}
|
|
@@ -4262,11 +4254,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4262
4254
|
if ('true' !== process.env.RSDOCTOR) return;
|
|
4263
4255
|
let isRspack = 'rspack' === api.context.bundlerType, pluginName = isRspack ? 'RsdoctorRspackPlugin' : 'RsdoctorWebpackPlugin', isRsdoctorPlugin = (plugin)=>{
|
|
4264
4256
|
var _plugin_constructor;
|
|
4265
|
-
return (null == plugin ? void 0 : plugin.isRsdoctorPlugin) === !0 || (null == plugin || null
|
|
4257
|
+
return (null == plugin ? void 0 : plugin.isRsdoctorPlugin) === !0 || (null == plugin || null == (_plugin_constructor = plugin.constructor) ? void 0 : _plugin_constructor.name) === pluginName;
|
|
4266
4258
|
};
|
|
4267
4259
|
for (let config of bundlerConfigs){
|
|
4268
4260
|
var _config_plugins;
|
|
4269
|
-
if (null
|
|
4261
|
+
if (null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.some((plugin)=>isRsdoctorPlugin(plugin))) return;
|
|
4270
4262
|
}
|
|
4271
4263
|
let packageName = isRspack ? '@rsdoctor/rspack-plugin' : '@rsdoctor/webpack-plugin';
|
|
4272
4264
|
try {
|
|
@@ -4296,10 +4288,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4296
4288
|
var external_node_inspector_default = __webpack_require__.n(external_node_inspector_namespaceObject);
|
|
4297
4289
|
let stopProfiler = (output, profileSession)=>{
|
|
4298
4290
|
profileSession && profileSession.post('Profiler.stop', (error, param)=>{
|
|
4299
|
-
if (error)
|
|
4300
|
-
rslog_index_js_namespaceObject.logger.error('Failed to generate JavaScript CPU profile:', error);
|
|
4301
|
-
return;
|
|
4302
|
-
}
|
|
4291
|
+
if (error) return void rslog_index_js_namespaceObject.logger.error('Failed to generate JavaScript CPU profile:', error);
|
|
4303
4292
|
external_node_fs_default().writeFileSync(output, JSON.stringify(param.profile));
|
|
4304
4293
|
});
|
|
4305
4294
|
}, pluginRspackProfile = ()=>({
|
|
@@ -4308,7 +4297,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4308
4297
|
var _process_env_RSPACK_PROFILE;
|
|
4309
4298
|
let profileSession;
|
|
4310
4299
|
if ('webpack' === api.context.bundlerType) return;
|
|
4311
|
-
let RSPACK_PROFILE = null
|
|
4300
|
+
let RSPACK_PROFILE = null == (_process_env_RSPACK_PROFILE = process.env.RSPACK_PROFILE) ? void 0 : _process_env_RSPACK_PROFILE.toUpperCase();
|
|
4312
4301
|
if (!RSPACK_PROFILE) return;
|
|
4313
4302
|
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 ()=>{
|
|
4314
4303
|
let profileDir = external_node_path_default().join(api.context.distPath, profileDirName), traceFilePath = external_node_path_default().join(profileDir, 'trace.json');
|
|
@@ -4342,7 +4331,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4342
4331
|
if (config.server.open) {
|
|
4343
4332
|
var _api_context_devServer;
|
|
4344
4333
|
open_open({
|
|
4345
|
-
https: null
|
|
4334
|
+
https: null == (_api_context_devServer = api.context.devServer) ? void 0 : _api_context_devServer.https,
|
|
4346
4335
|
port,
|
|
4347
4336
|
routes,
|
|
4348
4337
|
config
|
|
@@ -4483,7 +4472,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4483
4472
|
return;
|
|
4484
4473
|
}
|
|
4485
4474
|
let { config } = environment, defaultConfig = {
|
|
4486
|
-
chunks: (null
|
|
4475
|
+
chunks: (null == (_config_moduleFederation = config.moduleFederation) || null == (_config_moduleFederation_options = _config_moduleFederation.options) ? void 0 : _config_moduleFederation_options.exposes) ? 'async' : 'all',
|
|
4487
4476
|
cacheGroups: {}
|
|
4488
4477
|
};
|
|
4489
4478
|
'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
|
|
@@ -4646,21 +4635,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4646
4635
|
api.modifyBundlerChain({
|
|
4647
4636
|
order: 'pre',
|
|
4648
4637
|
handler: async (chain, { target, environment })=>{
|
|
4649
|
-
if ('node' === target)
|
|
4650
|
-
chain.target('node');
|
|
4651
|
-
return;
|
|
4652
|
-
}
|
|
4638
|
+
if ('node' === target) return void chain.target('node');
|
|
4653
4639
|
let { browserslist } = environment, isDefaultBrowserslist = browserslist.join(',') === DEFAULT_WEB_BROWSERSLIST.join(',');
|
|
4654
|
-
if ('web-worker' === target)
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
]);
|
|
4662
|
-
return;
|
|
4663
|
-
}
|
|
4640
|
+
if ('web-worker' === target) return void chain.target(isDefaultBrowserslist ? [
|
|
4641
|
+
'webworker',
|
|
4642
|
+
'es2017'
|
|
4643
|
+
] : [
|
|
4644
|
+
'webworker',
|
|
4645
|
+
'es5'
|
|
4646
|
+
]);
|
|
4664
4647
|
let esQuery = isDefaultBrowserslist ? 'es2017' : `browserslist:${browserslist.join(',')}`;
|
|
4665
4648
|
chain.target([
|
|
4666
4649
|
'web',
|
|
@@ -4732,7 +4715,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4732
4715
|
rspackConfig,
|
|
4733
4716
|
utils
|
|
4734
4717
|
]
|
|
4735
|
-
}), (null
|
|
4718
|
+
}), (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.rspack) && (currentConfig = await reduceConfigsAsyncWithContext({
|
|
4736
4719
|
initial: currentConfig,
|
|
4737
4720
|
config: utils.environment.config.tools.rspack,
|
|
4738
4721
|
ctx: utils,
|
|
@@ -4883,7 +4866,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4883
4866
|
getPluginAPI: context.getPluginAPI,
|
|
4884
4867
|
pluginManager
|
|
4885
4868
|
}), await modifyRsbuildConfig(context);
|
|
4886
|
-
let
|
|
4869
|
+
let normalizedBaseConfig = normalizeConfig(context.config), environments = {}, mergedEnvironments = initEnvironmentConfigs(normalizedBaseConfig, context.rootPath, context.specifiedEnvironments), { dev: { hmr, assetPrefix, progressBar, lazyCompilation, writeToDisk, ...rsbuildSharedDev }, server } = normalizedBaseConfig;
|
|
4887
4870
|
for (let [name, config] of Object.entries(mergedEnvironments)){
|
|
4888
4871
|
let environmentConfig = await modifyEnvironmentConfig(context, config, name);
|
|
4889
4872
|
environments[name] = {
|
|
@@ -4896,7 +4879,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4896
4879
|
};
|
|
4897
4880
|
}
|
|
4898
4881
|
context.normalizedConfig = {
|
|
4899
|
-
...
|
|
4882
|
+
...normalizedBaseConfig,
|
|
4900
4883
|
environments
|
|
4901
4884
|
}, await updateEnvironmentContext(context, environments);
|
|
4902
4885
|
var context1 = context;
|
|
@@ -4953,7 +4936,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4953
4936
|
envMode: commonOpts.envMode,
|
|
4954
4937
|
loader: commonOpts.configLoader
|
|
4955
4938
|
});
|
|
4956
|
-
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
|
|
4939
|
+
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 = [
|
|
4957
4940
|
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
4958
4941
|
{
|
|
4959
4942
|
paths: filePath,
|
|
@@ -4977,7 +4960,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4977
4960
|
var _config_dev;
|
|
4978
4961
|
if ('dev' !== rsbuild.context.action && !isBuildWatch) return;
|
|
4979
4962
|
let files = [], config = rsbuild.getNormalizedConfig();
|
|
4980
|
-
if (null
|
|
4963
|
+
if (null == (_config_dev = config.dev) ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
4981
4964
|
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
4982
4965
|
let paths = castArray(watchFilesConfig.paths);
|
|
4983
4966
|
watchFilesConfig.options ? watchFilesForRestart({
|
|
@@ -5158,10 +5141,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5158
5141
|
for (let shortcut of shortcuts)message += ` ${shortcut.description}\n`;
|
|
5159
5142
|
rslog_index_js_namespaceObject.logger.log(message);
|
|
5160
5143
|
}
|
|
5161
|
-
for (let shortcut of shortcuts)if (input === shortcut.key)
|
|
5162
|
-
shortcut.action();
|
|
5163
|
-
return;
|
|
5164
|
-
}
|
|
5144
|
+
for (let shortcut of shortcuts)if (input === shortcut.key) return void shortcut.action();
|
|
5165
5145
|
}), ()=>{
|
|
5166
5146
|
rl.close();
|
|
5167
5147
|
};
|
|
@@ -5285,7 +5265,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5285
5265
|
let { default: ws } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/ws/index.js"));
|
|
5286
5266
|
this.wsServer = new ws.Server({
|
|
5287
5267
|
noServer: !0,
|
|
5288
|
-
path: null
|
|
5268
|
+
path: null == (_this_options_client = this.options.client) ? void 0 : _this_options_client.path
|
|
5289
5269
|
}), this.wsServer.on('error', (err)=>{
|
|
5290
5270
|
rslog_index_js_namespaceObject.logger.error(err);
|
|
5291
5271
|
}), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
|
|
@@ -5611,17 +5591,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5611
5591
|
let { devConfig, serverConfig, publicPaths } = this, clientPaths = function(devConfig) {
|
|
5612
5592
|
var _devConfig_client;
|
|
5613
5593
|
let clientPaths = [];
|
|
5614
|
-
return (devConfig.hmr || devConfig.liveReload) && (clientPaths.push(compilationManager_require.resolve('@rsbuild/core/client/hmr')), (null
|
|
5594
|
+
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;
|
|
5615
5595
|
}(devConfig), middleware = await getCompilationMiddleware(this.compiler, {
|
|
5616
5596
|
callbacks: {
|
|
5617
5597
|
onInvalid: (compilationId, fileName)=>{
|
|
5618
|
-
if ('string' == typeof fileName && HTML_REGEX.test(fileName)) {
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
});
|
|
5623
|
-
return;
|
|
5624
|
-
}
|
|
5598
|
+
if ('string' == typeof fileName && HTML_REGEX.test(fileName)) return void this.socketServer.sockWrite({
|
|
5599
|
+
type: 'static-changed',
|
|
5600
|
+
compilationId
|
|
5601
|
+
});
|
|
5625
5602
|
this.socketServer.sockWrite({
|
|
5626
5603
|
type: 'invalid',
|
|
5627
5604
|
compilationId
|
|
@@ -5654,10 +5631,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5654
5631
|
return void 0 === size || Number(size) > 1024;
|
|
5655
5632
|
}, gzipMiddleware = ({ level = external_node_zlib_default().constants.Z_BEST_SPEED } = {})=>(req, res, next)=>{
|
|
5656
5633
|
let gzip, writeHeadStatus, accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
|
|
5657
|
-
if ('HEAD' === req.method || !encoding)
|
|
5658
|
-
next();
|
|
5659
|
-
return;
|
|
5660
|
-
}
|
|
5634
|
+
if ('HEAD' === req.method || !encoding) return void next();
|
|
5661
5635
|
let started = !1, { end, write, on, writeHead } = res, listeners = [], start = ()=>{
|
|
5662
5636
|
if (!started) {
|
|
5663
5637
|
if (started = !0, shouldCompress(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = external_node_zlib_default().createGzip({
|
|
@@ -5729,7 +5703,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5729
5703
|
}), res.end();
|
|
5730
5704
|
return;
|
|
5731
5705
|
}
|
|
5732
|
-
if (null
|
|
5706
|
+
if (null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('text/html')) {
|
|
5733
5707
|
res.writeHead(404, {
|
|
5734
5708
|
'Content-Type': 'text/html'
|
|
5735
5709
|
}), res.end(`The server is configured with a base URL of ${base} - did you mean to visit <a href="${redirectPath}">${redirectPath}</a> instead?`);
|
|
@@ -5863,7 +5837,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5863
5837
|
next();
|
|
5864
5838
|
}), 'dev' === context.action && 'rspack' === context.bundlerType && dev.lazyCompilation && compilationManager) {
|
|
5865
5839
|
let { compiler } = compilationManager;
|
|
5866
|
-
middlewares.push(core_default().experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler, dev.lazyCompilation));
|
|
5840
|
+
'object' == typeof dev.lazyCompilation && 'string' == typeof dev.lazyCompilation.serverUrl && context.devServer && (dev.lazyCompilation.serverUrl = replacePortPlaceholder(dev.lazyCompilation.serverUrl, context.devServer.port)), middlewares.push(core_default().experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler, dev.lazyCompilation));
|
|
5867
5841
|
}
|
|
5868
5842
|
if (server.proxy) {
|
|
5869
5843
|
let { middlewares: proxyMiddlewares, upgrade } = await createProxyMiddleware(server.proxy);
|
|
@@ -5880,7 +5854,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5880
5854
|
environments
|
|
5881
5855
|
})), compilationManager && (middlewares.push(compilationManager.middleware), upgradeEvents.push(compilationManager.socketServer.upgrade), middlewares.push((req, res, next)=>{
|
|
5882
5856
|
var _req_url;
|
|
5883
|
-
(null
|
|
5857
|
+
(null == (_req_url = req.url) ? void 0 : _req_url.endsWith('.hot-update.json')) && 'OPTIONS' !== req.method ? (res.statusCode = 404, res.end()) : next();
|
|
5884
5858
|
})), compilationManager && middlewares.push(getHtmlCompletionMiddleware({
|
|
5885
5859
|
compilationManager,
|
|
5886
5860
|
distPath: context.distPath
|
|
@@ -6069,7 +6043,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6069
6043
|
createRunner() {
|
|
6070
6044
|
var _this__options_compilerOptions_experiments;
|
|
6071
6045
|
super.createRunner(), this.requirers.set('cjs', this.getRequire()), this.requirers.set('esm', this.createEsmRequirer());
|
|
6072
|
-
let outputModule = null
|
|
6046
|
+
let outputModule = null == (_this__options_compilerOptions_experiments = this._options.compilerOptions.experiments) ? void 0 : _this__options_compilerOptions_experiments.outputModule;
|
|
6073
6047
|
this.requirers.set('entry', (currentDirectory, modulePath, context)=>{
|
|
6074
6048
|
let file = this.getFile(modulePath, currentDirectory);
|
|
6075
6049
|
return file ? outputModule && !file.path.endsWith('.cjs') ? this.requirers.get('esm')(currentDirectory, modulePath, {
|
|
@@ -6144,7 +6118,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6144
6118
|
let { chunks: entryChunks = [] } = entrypoints[entryName], files = entryChunks.reduce((prev, entryChunkName)=>{
|
|
6145
6119
|
let chunk = null == chunks ? void 0 : chunks.find((chunk)=>{
|
|
6146
6120
|
var _chunk_names;
|
|
6147
|
-
return chunk.entry && (null
|
|
6121
|
+
return chunk.entry && (null == (_chunk_names = chunk.names) ? void 0 : _chunk_names.includes(String(entryChunkName)));
|
|
6148
6122
|
});
|
|
6149
6123
|
return (null == chunk ? void 0 : chunk.files) ? prev.concat(chunk.files.filter((file)=>!file.endsWith('.css'))) : prev;
|
|
6150
6124
|
}, []);
|
|
@@ -6428,7 +6402,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6428
6402
|
}, hasErrors = stats.hasErrors();
|
|
6429
6403
|
if (!hasErrors) {
|
|
6430
6404
|
var _statsJson_children;
|
|
6431
|
-
isMultiCompiler && (null
|
|
6405
|
+
isMultiCompiler && (null == (_statsJson_children = statsJson.children) ? void 0 : _statsJson_children.length) ? statsJson.children.forEach((c, index)=>{
|
|
6432
6406
|
printTime(c, index);
|
|
6433
6407
|
}) : printTime(statsJson, 0);
|
|
6434
6408
|
}
|
|
@@ -6738,11 +6712,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6738
6712
|
let { moduleFederation } = config;
|
|
6739
6713
|
if (api.isPluginExists('rsbuild:module-federation-enhanced') && (config.server ||= {}, config.server.cors = !0), (null == moduleFederation ? void 0 : moduleFederation.options) && moduleFederation.options.exposes) {
|
|
6740
6714
|
var _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
|
|
6741
|
-
config.dev ||= {}, config.server ||= {}, config.server.cors = !0, (null
|
|
6715
|
+
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);
|
|
6742
6716
|
}
|
|
6743
6717
|
}), api.modifyEnvironmentConfig((config)=>{
|
|
6744
6718
|
var _config_moduleFederation, _config_performance_chunkSplit, _config_performance;
|
|
6745
|
-
(null
|
|
6719
|
+
(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 = {
|
|
6746
6720
|
...config.performance.chunkSplit,
|
|
6747
6721
|
strategy: 'custom'
|
|
6748
6722
|
}), config.source.include = [
|
|
@@ -6752,7 +6726,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6752
6726
|
}), api.modifyBundlerChain(async (chain, { CHAIN_ID, target, environment })=>{
|
|
6753
6727
|
var _config_moduleFederation;
|
|
6754
6728
|
let { config } = environment;
|
|
6755
|
-
if (!(null
|
|
6729
|
+
if (!(null == (_config_moduleFederation = config.moduleFederation) ? void 0 : _config_moduleFederation.options) || 'web' !== target) return;
|
|
6756
6730
|
let { options } = config.moduleFederation;
|
|
6757
6731
|
chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(core_namespaceObject.rspack.container.ModuleFederationPlugin, [
|
|
6758
6732
|
options
|
|
@@ -6782,7 +6756,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6782
6756
|
paths: envs1.filePaths,
|
|
6783
6757
|
type: 'reload-server'
|
|
6784
6758
|
}
|
|
6785
|
-
], null
|
|
6759
|
+
], null == (_config_performance = config1.performance) ? void 0 : _config_performance.buildCache))) {
|
|
6786
6760
|
let { buildCache } = config1.performance;
|
|
6787
6761
|
!0 === buildCache ? config1.performance.buildCache = {
|
|
6788
6762
|
buildDependencies: envs1.filePaths
|
|
@@ -7443,11 +7417,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
7443
7417
|
}
|
|
7444
7418
|
process.title = 'rsbuild-node';
|
|
7445
7419
|
let { npm_execpath } = process.env;
|
|
7446
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.
|
|
7420
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.8\n`);
|
|
7447
7421
|
try {
|
|
7448
7422
|
!function() {
|
|
7449
7423
|
let cli = cac_dist('rsbuild');
|
|
7450
|
-
cli.help(), cli.version("1.3.
|
|
7424
|
+
cli.help(), cli.version("1.3.8"), applyCommonOptions(cli);
|
|
7451
7425
|
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');
|
|
7452
7426
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7453
7427
|
try {
|
|
@@ -7498,7 +7472,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
7498
7472
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
7499
7473
|
}
|
|
7500
7474
|
}
|
|
7501
|
-
let
|
|
7475
|
+
let src_version = "1.3.8";
|
|
7502
7476
|
})(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
|
|
7503
7477
|
"PLUGIN_CSS_NAME",
|
|
7504
7478
|
"PLUGIN_SWC_NAME",
|