@rsbuild/core 1.2.7 → 1.2.9
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/README.md +10 -2
- package/compiled/css-loader/index.js +41 -41
- package/compiled/postcss/index.js +107 -105
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rsbuild-dev-middleware/index.js +25 -25
- package/compiled/style-loader/index.js +10 -10
- package/dist/index.cjs +149 -106
- package/dist/index.js +149 -106
- package/dist-types/createRsbuild.d.ts +3 -0
- package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +3 -3
- package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +2 -2
- package/dist-types/server/devServer.d.ts +11 -6
- package/dist-types/server/getDevMiddlewares.d.ts +7 -2
- package/dist-types/server/runner/basic.d.ts +6 -0
- package/dist-types/server/runner/index.d.ts +6 -4
- package/dist-types/server/runner/type.d.ts +7 -1
- package/dist-types/server/watchFiles.d.ts +3 -2
- package/dist-types/types/config.d.ts +11 -3
- package/dist-types/types/hooks.d.ts +9 -1
- package/dist-types/types/plugin.d.ts +201 -74
- package/dist-types/types/rsbuild.d.ts +96 -29
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -606,38 +606,39 @@ var __webpack_exports__ = {};
|
|
|
606
606
|
return !verbose && message.includes(innerError) && (message = message.split(innerError)[0]), (message = (message = hintNodePolyfill(message = function(message) {
|
|
607
607
|
let hint = 'You may need an appropriate loader to handle this file type.';
|
|
608
608
|
if (-1 === message.indexOf(hint)) return message;
|
|
609
|
+
let createPluginHint = (packageName, keyword)=>`To enable support for ${keyword}, use "${index_js_default().yellow(`@rsbuild/plugin-${packageName}`)}" ${index_js_default().dim(`(https://www.npmjs.com/package/@rsbuild/plugin-${packageName})`)}.`;
|
|
609
610
|
for (let plugin of [
|
|
610
611
|
{
|
|
611
612
|
test: /File: .+\.s(c|a)ss/,
|
|
612
|
-
hint:
|
|
613
|
+
hint: createPluginHint('sass', 'Sass')
|
|
613
614
|
},
|
|
614
615
|
{
|
|
615
616
|
test: /File: .+\.less/,
|
|
616
|
-
hint:
|
|
617
|
+
hint: createPluginHint('less', 'Less')
|
|
617
618
|
},
|
|
618
619
|
{
|
|
619
620
|
test: /File: .+\.styl(us)?/,
|
|
620
|
-
hint:
|
|
621
|
+
hint: createPluginHint('stylus', 'Stylus')
|
|
621
622
|
},
|
|
622
623
|
{
|
|
623
624
|
test: /File: .+\.vue?/,
|
|
624
|
-
hint:
|
|
625
|
+
hint: createPluginHint('vue', 'Vue')
|
|
625
626
|
},
|
|
626
627
|
{
|
|
627
628
|
test: /File: .+\.svelte?/,
|
|
628
|
-
hint:
|
|
629
|
+
hint: createPluginHint('svelte', 'Svelte')
|
|
629
630
|
},
|
|
630
631
|
{
|
|
631
632
|
test: /File: .+\.mdx/,
|
|
632
|
-
hint:
|
|
633
|
+
hint: createPluginHint('mdx', 'MDX')
|
|
633
634
|
},
|
|
634
635
|
{
|
|
635
636
|
test: /File: .+\.toml/,
|
|
636
|
-
hint:
|
|
637
|
+
hint: createPluginHint('toml', 'TOML')
|
|
637
638
|
},
|
|
638
639
|
{
|
|
639
640
|
test: /File: .+\.yaml/,
|
|
640
|
-
hint:
|
|
641
|
+
hint: createPluginHint('yaml', 'YAML')
|
|
641
642
|
}
|
|
642
643
|
])if (plugin.test.test(message)) return message.replace(hint, plugin.hint);
|
|
643
644
|
return message;
|
|
@@ -1434,7 +1435,7 @@ var __webpack_exports__ = {};
|
|
|
1434
1435
|
tap: (handler)=>tapEnvironment({
|
|
1435
1436
|
handler
|
|
1436
1437
|
}),
|
|
1437
|
-
|
|
1438
|
+
callChain: async ({ environment, args: params })=>{
|
|
1438
1439
|
for (let callback of [
|
|
1439
1440
|
...preGroup,
|
|
1440
1441
|
...defaultGroup,
|
|
@@ -1445,6 +1446,19 @@ var __webpack_exports__ = {};
|
|
|
1445
1446
|
void 0 !== result && (params[0] = result);
|
|
1446
1447
|
}
|
|
1447
1448
|
return params;
|
|
1449
|
+
},
|
|
1450
|
+
callBatch: async ({ environment, args: params })=>{
|
|
1451
|
+
let results = [];
|
|
1452
|
+
for (let callback of [
|
|
1453
|
+
...preGroup,
|
|
1454
|
+
...defaultGroup,
|
|
1455
|
+
...postGroup
|
|
1456
|
+
]){
|
|
1457
|
+
if (callback.environment && environment && !isPluginMatchEnvironment(callback.environment, environment)) continue;
|
|
1458
|
+
let result = await callback.handler(...params);
|
|
1459
|
+
results.push(result);
|
|
1460
|
+
}
|
|
1461
|
+
return results;
|
|
1448
1462
|
}
|
|
1449
1463
|
};
|
|
1450
1464
|
}
|
|
@@ -1454,7 +1468,7 @@ var __webpack_exports__ = {};
|
|
|
1454
1468
|
tap: (cb)=>{
|
|
1455
1469
|
isFunction(cb) ? defaultGroup.push(cb) : 'pre' === cb.order ? preGroup.push(cb.handler) : 'post' === cb.order ? postGroup.push(cb.handler) : defaultGroup.push(cb.handler);
|
|
1456
1470
|
},
|
|
1457
|
-
|
|
1471
|
+
callChain: async (...params)=>{
|
|
1458
1472
|
for (let callback of [
|
|
1459
1473
|
...preGroup,
|
|
1460
1474
|
...defaultGroup,
|
|
@@ -1464,6 +1478,18 @@ var __webpack_exports__ = {};
|
|
|
1464
1478
|
void 0 !== result && (params[0] = result);
|
|
1465
1479
|
}
|
|
1466
1480
|
return params;
|
|
1481
|
+
},
|
|
1482
|
+
callBatch: async (...params)=>{
|
|
1483
|
+
let results = [];
|
|
1484
|
+
for (let callback of [
|
|
1485
|
+
...preGroup,
|
|
1486
|
+
...defaultGroup,
|
|
1487
|
+
...postGroup
|
|
1488
|
+
]){
|
|
1489
|
+
let result = await callback(...params);
|
|
1490
|
+
results.push(result);
|
|
1491
|
+
}
|
|
1492
|
+
return results;
|
|
1467
1493
|
}
|
|
1468
1494
|
};
|
|
1469
1495
|
}
|
|
@@ -1501,7 +1527,7 @@ var __webpack_exports__ = {};
|
|
|
1501
1527
|
});
|
|
1502
1528
|
}, registerBuildHook = ({ context, isWatch, compiler, bundlerConfigs, MultiStatsCtor })=>{
|
|
1503
1529
|
let isFirstCompile = !0, environmentList = Object.values(context.environments).reduce((prev, curr)=>(prev[curr.index] = curr, prev), []), onDone = async (stats)=>{
|
|
1504
|
-
let p = context.hooks.onAfterBuild.
|
|
1530
|
+
let p = context.hooks.onAfterBuild.callBatch({
|
|
1505
1531
|
isFirstCompile,
|
|
1506
1532
|
stats,
|
|
1507
1533
|
environments: context.environments,
|
|
@@ -1509,7 +1535,7 @@ var __webpack_exports__ = {};
|
|
|
1509
1535
|
});
|
|
1510
1536
|
isFirstCompile = !1, await p;
|
|
1511
1537
|
}, onEnvironmentDone = async (buildIndex, stats)=>{
|
|
1512
|
-
await context.hooks.onAfterEnvironmentCompile.
|
|
1538
|
+
await context.hooks.onAfterEnvironmentCompile.callBatch({
|
|
1513
1539
|
environment: environmentList[buildIndex].name,
|
|
1514
1540
|
args: [
|
|
1515
1541
|
{
|
|
@@ -1523,13 +1549,13 @@ var __webpack_exports__ = {};
|
|
|
1523
1549
|
};
|
|
1524
1550
|
onBeforeCompile({
|
|
1525
1551
|
compiler,
|
|
1526
|
-
beforeCompile: async ()=>await context.hooks.onBeforeBuild.
|
|
1552
|
+
beforeCompile: async ()=>await context.hooks.onBeforeBuild.callBatch({
|
|
1527
1553
|
bundlerConfigs,
|
|
1528
1554
|
environments: context.environments,
|
|
1529
1555
|
isWatch,
|
|
1530
1556
|
isFirstCompile
|
|
1531
1557
|
}),
|
|
1532
|
-
beforeEnvironmentCompiler: async (buildIndex)=>await context.hooks.onBeforeEnvironmentCompile.
|
|
1558
|
+
beforeEnvironmentCompiler: async (buildIndex)=>await context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
1533
1559
|
environment: environmentList[buildIndex].name,
|
|
1534
1560
|
args: [
|
|
1535
1561
|
{
|
|
@@ -1549,14 +1575,14 @@ var __webpack_exports__ = {};
|
|
|
1549
1575
|
});
|
|
1550
1576
|
}, registerDevHook = ({ context, compiler, bundlerConfigs, MultiStatsCtor })=>{
|
|
1551
1577
|
let isFirstCompile = !0, environmentList = Object.values(context.environments).reduce((prev, curr)=>(prev[curr.index] = curr, prev), []), onDone = async (stats)=>{
|
|
1552
|
-
let p = context.hooks.onDevCompileDone.
|
|
1578
|
+
let p = context.hooks.onDevCompileDone.callBatch({
|
|
1553
1579
|
isFirstCompile,
|
|
1554
1580
|
stats,
|
|
1555
1581
|
environments: context.environments
|
|
1556
1582
|
});
|
|
1557
1583
|
isFirstCompile = !1, await p;
|
|
1558
1584
|
}, onEnvironmentDone = async (buildIndex, stats)=>{
|
|
1559
|
-
await context.hooks.onAfterEnvironmentCompile.
|
|
1585
|
+
await context.hooks.onAfterEnvironmentCompile.callBatch({
|
|
1560
1586
|
environment: environmentList[buildIndex].name,
|
|
1561
1587
|
args: [
|
|
1562
1588
|
{
|
|
@@ -1570,7 +1596,7 @@ var __webpack_exports__ = {};
|
|
|
1570
1596
|
};
|
|
1571
1597
|
onBeforeCompile({
|
|
1572
1598
|
compiler,
|
|
1573
|
-
beforeEnvironmentCompiler: async (buildIndex)=>await context.hooks.onBeforeEnvironmentCompile.
|
|
1599
|
+
beforeEnvironmentCompiler: async (buildIndex)=>await context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
1574
1600
|
environment: environmentList[buildIndex].name,
|
|
1575
1601
|
args: [
|
|
1576
1602
|
{
|
|
@@ -1708,7 +1734,7 @@ var __webpack_exports__ = {};
|
|
|
1708
1734
|
async function createContext(options, userConfig, bundlerType) {
|
|
1709
1735
|
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;
|
|
1710
1736
|
return {
|
|
1711
|
-
version: "1.2.
|
|
1737
|
+
version: "1.2.9",
|
|
1712
1738
|
rootPath,
|
|
1713
1739
|
distPath: '',
|
|
1714
1740
|
cachePath,
|
|
@@ -1841,7 +1867,7 @@ var __webpack_exports__ = {};
|
|
|
1841
1867
|
async function modifyBundlerChain(context, utils) {
|
|
1842
1868
|
var _utils_environment_config_tools;
|
|
1843
1869
|
rslog_index_js_namespaceObject.logger.debug('modify bundler chain');
|
|
1844
|
-
let bundlerChain = new (rspack_chain_index_js_default())(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.
|
|
1870
|
+
let bundlerChain = new (rspack_chain_index_js_default())(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callChain({
|
|
1845
1871
|
environment: utils.environment.name,
|
|
1846
1872
|
args: [
|
|
1847
1873
|
bundlerChain,
|
|
@@ -2036,7 +2062,7 @@ var __webpack_exports__ = {};
|
|
|
2036
2062
|
recursive: !0
|
|
2037
2063
|
}), await external_node_fs_default().promises.writeFile(configFile, JSON.stringify(buildDependencies));
|
|
2038
2064
|
}
|
|
2039
|
-
async function getBuildDependencies(context, config, environmentContext) {
|
|
2065
|
+
async function getBuildDependencies(context, config, environmentContext, userBuildDependencies) {
|
|
2040
2066
|
var _config__privateMeta;
|
|
2041
2067
|
let rootPackageJson = (0, external_node_path_namespaceObject.join)(context.rootPath, 'package.json'), browserslistConfig = (0, external_node_path_namespaceObject.join)(context.rootPath, '.browserslistrc'), buildDependencies = {};
|
|
2042
2068
|
await isFileExists(rootPackageJson) && (buildDependencies.packageJson = [
|
|
@@ -2058,7 +2084,10 @@ var __webpack_exports__ = {};
|
|
|
2058
2084
|
].map((ext)=>(0, external_node_path_namespaceObject.join)(context.rootPath, `tailwind.config.${ext}`)));
|
|
2059
2085
|
return tailwindConfig && (buildDependencies.tailwindcss = [
|
|
2060
2086
|
tailwindConfig
|
|
2061
|
-
]),
|
|
2087
|
+
]), {
|
|
2088
|
+
...buildDependencies,
|
|
2089
|
+
...userBuildDependencies
|
|
2090
|
+
};
|
|
2062
2091
|
}
|
|
2063
2092
|
let pluginCache = ()=>({
|
|
2064
2093
|
name: 'rsbuild:cache',
|
|
@@ -2071,7 +2100,9 @@ var __webpack_exports__ = {};
|
|
|
2071
2100
|
cacheEnabled = !0;
|
|
2072
2101
|
let { context } = api, cacheConfig = 'boolean' == typeof buildCache ? {} : buildCache, cacheDirectory = function({ cacheDirectory }, context) {
|
|
2073
2102
|
return cacheDirectory ? (0, external_node_path_namespaceObject.isAbsolute)(cacheDirectory) ? cacheDirectory : (0, external_node_path_namespaceObject.join)(context.rootPath, cacheDirectory) : (0, external_node_path_namespaceObject.join)(context.cachePath, context.bundlerType);
|
|
2074
|
-
}(cacheConfig, context), buildDependencies = await getBuildDependencies(context, config, environment
|
|
2103
|
+
}(cacheConfig, context), buildDependencies = await getBuildDependencies(context, config, environment, cacheConfig.buildDependencies ? {
|
|
2104
|
+
userBuildDependencies: cacheConfig.buildDependencies
|
|
2105
|
+
} : {});
|
|
2075
2106
|
'webpack' === bundlerType && await validateWebpackCache(cacheDirectory, buildDependencies);
|
|
2076
2107
|
let cacheVersion = Array.isArray(cacheConfig.cacheDigest) && cacheConfig.cacheDigest.length ? `${environment.name}-${env}-${digest = cacheConfig.cacheDigest, external_node_crypto_default().createHash('md5').update(JSON.stringify(digest)).digest('hex').slice(0, 8)}` : `${environment.name}-${env}`;
|
|
2077
2108
|
'rspack' === bundlerType ? (chain.cache(!0), chain.experiments({
|
|
@@ -2365,7 +2396,7 @@ var __webpack_exports__ = {};
|
|
|
2365
2396
|
async function gzipSize(input) {
|
|
2366
2397
|
return (await fileSize_gzip(input)).length;
|
|
2367
2398
|
}
|
|
2368
|
-
let
|
|
2399
|
+
let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), getAssetColor = (size)=>size > 300000 ? index_js_default().red : size > 100000 ? index_js_default().yellow : index_js_default().green, calcFileSize = (len)=>{
|
|
2369
2400
|
let val = len / 1000;
|
|
2370
2401
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
2371
2402
|
}, coloringAssetName = (assetName)=>JS_REGEX.test(assetName) ? index_js_default().cyan(assetName) : CSS_REGEX.test(assetName) ? index_js_default().yellow(assetName) : HTML_REGEX.test(assetName) ? index_js_default().green(assetName) : index_js_default().magenta(assetName), COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest)$/i, isCompressible = (assetName)=>COMPRESSIBLE_REGEX.test(assetName);
|
|
@@ -2424,7 +2455,7 @@ var __webpack_exports__ = {};
|
|
|
2424
2455
|
let totalSize = 0, totalGzipSize = 0;
|
|
2425
2456
|
for (let asset of assets){
|
|
2426
2457
|
let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + external_node_path_default().sep + name).length, sizeLength = sizeLabel.length;
|
|
2427
|
-
if (totalSize += asset.size,
|
|
2458
|
+
if (totalSize += asset.size, options.compressed && (totalGzipSize += asset.gzippedSize ?? asset.size), !1 !== options.detail) {
|
|
2428
2459
|
sizeLength < longestLabelLength && (sizeLabel += ' '.repeat(longestLabelLength - sizeLength));
|
|
2429
2460
|
let fileNameLabel = index_js_default().dim(asset.folder + external_node_path_default().sep) + coloringAssetName(asset.name);
|
|
2430
2461
|
fileNameLength < longestFileLength && (fileNameLabel += ' '.repeat(longestFileLength - fileNameLength));
|
|
@@ -3376,7 +3407,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3376
3407
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, target, isProd, isServer, environment })=>{
|
|
3377
3408
|
let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
|
|
3378
3409
|
var _context_devServer, _context_devServer1, _context_devServer2;
|
|
3379
|
-
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null === (_context_devServer = context.devServer) || void 0 === _context_devServer ? void 0 : _context_devServer.port) || 3000;
|
|
3410
|
+
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null === (_context_devServer = context.devServer) || void 0 === _context_devServer ? void 0 : _context_devServer.port) || server.port || 3000;
|
|
3380
3411
|
if (isProd) 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
|
|
3381
3412
|
else if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
3382
3413
|
else if (!0 === dev.assetPrefix) {
|
|
@@ -3549,7 +3580,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3549
3580
|
}) : obj[key] = value, obj;
|
|
3550
3581
|
}
|
|
3551
3582
|
let HtmlPreloadOrPrefetchPlugin_defaultOptions = {
|
|
3552
|
-
type: 'async-chunks'
|
|
3583
|
+
type: 'async-chunks',
|
|
3584
|
+
dedupe: !0
|
|
3553
3585
|
};
|
|
3554
3586
|
class HtmlPreloadOrPrefetchPlugin {
|
|
3555
3587
|
apply(compiler) {
|
|
@@ -3626,7 +3658,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
3626
3658
|
if (this.resourceHints) {
|
|
3627
3659
|
var resourceHints, scripts;
|
|
3628
3660
|
htmlPluginData.assetTags.styles = [
|
|
3629
|
-
...(resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))),
|
|
3661
|
+
...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
|
|
3630
3662
|
...htmlPluginData.assetTags.styles
|
|
3631
3663
|
];
|
|
3632
3664
|
}
|
|
@@ -4191,7 +4223,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4191
4223
|
async function modifyRspackConfig(context, rspackConfig, utils) {
|
|
4192
4224
|
var _utils_environment_config_tools;
|
|
4193
4225
|
rslog_index_js_namespaceObject.logger.debug('modify Rspack config');
|
|
4194
|
-
let [modifiedConfig] = await context.hooks.modifyRspackConfig.
|
|
4226
|
+
let [modifiedConfig] = await context.hooks.modifyRspackConfig.callChain({
|
|
4195
4227
|
environment: utils.environment.name,
|
|
4196
4228
|
args: [
|
|
4197
4229
|
rspackConfig,
|
|
@@ -4269,14 +4301,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4269
4301
|
}
|
|
4270
4302
|
async function modifyRsbuildConfig(context) {
|
|
4271
4303
|
rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config');
|
|
4272
|
-
let [modified] = await context.hooks.modifyRsbuildConfig.
|
|
4304
|
+
let [modified] = await context.hooks.modifyRsbuildConfig.callChain(context.config, {
|
|
4273
4305
|
mergeRsbuildConfig: mergeRsbuildConfig
|
|
4274
4306
|
});
|
|
4275
4307
|
context.config = modified, rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config done');
|
|
4276
4308
|
}
|
|
4277
4309
|
async function modifyEnvironmentConfig(context, config, name) {
|
|
4278
4310
|
rslog_index_js_namespaceObject.logger.debug(`modify Rsbuild environment(${name}) config`);
|
|
4279
|
-
let [modified] = await context.hooks.modifyEnvironmentConfig.
|
|
4311
|
+
let [modified] = await context.hooks.modifyEnvironmentConfig.callChain({
|
|
4280
4312
|
environment: name,
|
|
4281
4313
|
args: [
|
|
4282
4314
|
config,
|
|
@@ -4987,15 +5019,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4987
5019
|
content: `module.exports = (${modulePath.map((arg)=>`require(${JSON.stringify(`./${arg}`)})`).join(', ')});`,
|
|
4988
5020
|
subPath: ''
|
|
4989
5021
|
};
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
};
|
|
4997
|
-
}
|
|
4998
|
-
return null;
|
|
5022
|
+
let joinedPath = isRelativePath(modulePath) ? external_node_path_default().join(currentDirectory, modulePath) : modulePath;
|
|
5023
|
+
return this._options.isBundleOutput(joinedPath) ? {
|
|
5024
|
+
path: joinedPath,
|
|
5025
|
+
content: this._options.readFileSync(joinedPath),
|
|
5026
|
+
subPath: getSubPath(modulePath)
|
|
5027
|
+
} : null;
|
|
4999
5028
|
}
|
|
5000
5029
|
preExecute(_code, _file) {}
|
|
5001
5030
|
postExecute(_m, _file) {}
|
|
@@ -5049,7 +5078,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5049
5078
|
this.requirers.set('miss', this.createMissRequirer()), this.requirers.set('entry', this.createCjsRequirer());
|
|
5050
5079
|
}
|
|
5051
5080
|
createMissRequirer() {
|
|
5052
|
-
return (_currentDirectory, modulePath, _context = {})=>
|
|
5081
|
+
return (_currentDirectory, modulePath, _context = {})=>{
|
|
5082
|
+
let resolvedPath = cjs_require.resolve(modulePath, {
|
|
5083
|
+
paths: [
|
|
5084
|
+
_currentDirectory
|
|
5085
|
+
]
|
|
5086
|
+
});
|
|
5087
|
+
return cjs_require(resolvedPath.startsWith('node:') ? resolvedPath.slice(5) : resolvedPath);
|
|
5088
|
+
};
|
|
5053
5089
|
}
|
|
5054
5090
|
createCjsRequirer() {
|
|
5055
5091
|
let requireCache = Object.create(null);
|
|
@@ -5073,10 +5109,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5073
5109
|
}({});
|
|
5074
5110
|
class EsmRunner extends CommonJsRunner {
|
|
5075
5111
|
createRunner() {
|
|
5076
|
-
|
|
5077
|
-
|
|
5112
|
+
var _this__options_compilerOptions_experiments;
|
|
5113
|
+
super.createRunner(), this.requirers.set('cjs', this.getRequire()), this.requirers.set('esm', this.createEsmRequirer());
|
|
5114
|
+
let outputModule = null === (_this__options_compilerOptions_experiments = this._options.compilerOptions.experiments) || void 0 === _this__options_compilerOptions_experiments ? void 0 : _this__options_compilerOptions_experiments.outputModule;
|
|
5115
|
+
this.requirers.set('entry', (currentDirectory, modulePath, context)=>{
|
|
5078
5116
|
let file = this.getFile(modulePath, currentDirectory);
|
|
5079
|
-
return file ? file.path.endsWith('.
|
|
5117
|
+
return file ? outputModule && !file.path.endsWith('.cjs') ? this.requirers.get('esm')(currentDirectory, modulePath, {
|
|
5080
5118
|
...context,
|
|
5081
5119
|
file
|
|
5082
5120
|
}) : this.requirers.get('cjs')(currentDirectory, modulePath, {
|
|
@@ -5118,16 +5156,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5118
5156
|
}
|
|
5119
5157
|
}
|
|
5120
5158
|
class BasicRunnerFactory {
|
|
5121
|
-
create(
|
|
5122
|
-
return this.createRunner(
|
|
5159
|
+
create(options) {
|
|
5160
|
+
return this.createRunner(options);
|
|
5123
5161
|
}
|
|
5124
|
-
createRunner(
|
|
5162
|
+
createRunner(options) {
|
|
5125
5163
|
let runnerOptions = {
|
|
5126
5164
|
name: this.name,
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
readFileSync
|
|
5130
|
-
};
|
|
5165
|
+
...options
|
|
5166
|
+
}, { compilerOptions } = options;
|
|
5131
5167
|
if ('web' === compilerOptions.target || 'webworker' === compilerOptions.target) throw Error(`[rsbuild:runner] Not support run "${compilerOptions.target}" resource in Rsbuild server`);
|
|
5132
5168
|
return new EsmRunner(runnerOptions);
|
|
5133
5169
|
}
|
|
@@ -5142,7 +5178,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5142
5178
|
}(this, "name", void 0), this.name = name;
|
|
5143
5179
|
}
|
|
5144
5180
|
}
|
|
5145
|
-
let runner_run = async (bundlePath,
|
|
5181
|
+
let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunnerFactory(bundlePath).create(runnerFactoryOptions).run(bundlePath), loadBundle = async (stats, entryName, utils)=>{
|
|
5146
5182
|
let { chunks, entrypoints, outputPath } = stats.toJson({
|
|
5147
5183
|
all: !1,
|
|
5148
5184
|
chunks: !0,
|
|
@@ -5159,7 +5195,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5159
5195
|
}, []);
|
|
5160
5196
|
if (0 === files.length) throw Error(`[rsbuild:loadBundle] Failed to get bundle by entryName: "${entryName}"`);
|
|
5161
5197
|
if (files.length > 1) throw Error(`[rsbuild:loadBundle] Only support load single entry chunk, but got ${files.length}: ${files.join(',')}`);
|
|
5162
|
-
|
|
5198
|
+
let allChunkFiles = (null == chunks ? void 0 : chunks.flatMap((c)=>c.files).map((file)=>(0, external_node_path_namespaceObject.join)(outputPath, file))) || [];
|
|
5199
|
+
return await runner_run({
|
|
5200
|
+
bundlePath: files[0],
|
|
5201
|
+
dist: outputPath,
|
|
5202
|
+
compilerOptions: stats.compilation.options,
|
|
5203
|
+
readFileSync: utils.readFileSync,
|
|
5204
|
+
isBundleOutput: (modulePath)=>allChunkFiles.includes(modulePath)
|
|
5205
|
+
});
|
|
5163
5206
|
}, getTransformedHtml = async (entryName, utils)=>{
|
|
5164
5207
|
let { htmlPaths, distPath } = utils.environment, htmlPath = htmlPaths[entryName];
|
|
5165
5208
|
if (!htmlPath) throw Error(`[rsbuild:getTransformedHtml] Failed to get HTML file by entryName: "${entryName}"`);
|
|
@@ -5340,12 +5383,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5340
5383
|
let opts = {
|
|
5341
5384
|
context,
|
|
5342
5385
|
changeOrigin: !0,
|
|
5343
|
-
logLevel: 'warn'
|
|
5386
|
+
logLevel: 'warn',
|
|
5387
|
+
logProvider: ()=>rslog_index_js_namespaceObject.logger
|
|
5344
5388
|
};
|
|
5345
5389
|
'string' == typeof options ? opts.target = options : Object.assign(opts, options), ret.push(opts);
|
|
5346
5390
|
}
|
|
5347
|
-
let handleError = (err)=>rslog_index_js_namespaceObject.logger.error(err);
|
|
5348
|
-
for (let opts of ret)opts.onError ??= handleError;
|
|
5349
5391
|
return ret;
|
|
5350
5392
|
}(proxyOptions), proxyMiddlewares = [], middlewares = [], { createProxyMiddleware: baseMiddleware } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/http-proxy-middleware/index.js"));
|
|
5351
5393
|
for (let opts of formattedOptions){
|
|
@@ -5374,7 +5416,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5374
5416
|
before,
|
|
5375
5417
|
after
|
|
5376
5418
|
};
|
|
5377
|
-
}, applyDefaultMiddlewares = async ({ middlewares, server, compileMiddlewareAPI, output, pwd, outputFileSystem, environments })=>{
|
|
5419
|
+
}, applyDefaultMiddlewares = async ({ middlewares, server, compileMiddlewareAPI, output, pwd, outputFileSystem, environments, postCallbacks })=>{
|
|
5378
5420
|
let upgradeEvents = [];
|
|
5379
5421
|
if (server.compress && middlewares.push(gzipMiddleware()), middlewares.push((req, res, next)=>{
|
|
5380
5422
|
var _parseUrl;
|
|
@@ -5417,6 +5459,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5417
5459
|
});
|
|
5418
5460
|
middlewares.push(assetMiddleware);
|
|
5419
5461
|
}
|
|
5462
|
+
for (let callback of postCallbacks)callback();
|
|
5420
5463
|
if (compileMiddlewareAPI && middlewares.push(getHtmlFallbackMiddleware({
|
|
5421
5464
|
distPath,
|
|
5422
5465
|
callback: compileMiddlewareAPI.middleware,
|
|
@@ -5470,11 +5513,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5470
5513
|
return createServer(middlewares);
|
|
5471
5514
|
}, devServer_formatDevConfig = (config, port)=>('<port>' === config.client.port && (config.client.port = String(port)), config);
|
|
5472
5515
|
async function devServer_createDevServer(options, createCompiler, config, { compiler: customCompiler, getPortSilently, runCompile = !0 } = {}) {
|
|
5473
|
-
let lastStats;
|
|
5516
|
+
let lastStats, fileWatcher, devMiddlewares;
|
|
5474
5517
|
rslog_index_js_namespaceObject.logger.debug('create dev server');
|
|
5475
5518
|
let { port, host, https, portTip } = await getServerConfig({
|
|
5476
5519
|
config
|
|
5477
|
-
}), devConfig = devServer_formatDevConfig(config.dev, port), routes = getRoutes(options.context);
|
|
5520
|
+
}), devConfig = devServer_formatDevConfig(config.dev, port), routes = getRoutes(options.context), root = options.context.rootPath;
|
|
5478
5521
|
options.context.devServer = {
|
|
5479
5522
|
hostname: host,
|
|
5480
5523
|
port,
|
|
@@ -5508,11 +5551,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5508
5551
|
protocol,
|
|
5509
5552
|
port,
|
|
5510
5553
|
host
|
|
5511
|
-
})
|
|
5512
|
-
await options.context.hooks.onBeforeStartDevServer.call({
|
|
5513
|
-
environments: options.context.environments
|
|
5514
|
-
});
|
|
5515
|
-
let cliShortcutsEnabled = isCliShortcutsEnabled(devConfig), printUrls = ()=>printServerURLs({
|
|
5554
|
+
}), cliShortcutsEnabled = isCliShortcutsEnabled(devConfig), printUrls = ()=>printServerURLs({
|
|
5516
5555
|
urls,
|
|
5517
5556
|
port,
|
|
5518
5557
|
routes,
|
|
@@ -5526,8 +5565,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5526
5565
|
config,
|
|
5527
5566
|
clearCache: !0
|
|
5528
5567
|
}), closeServer = async ()=>{
|
|
5529
|
-
await options.context.hooks.onCloseDevServer.
|
|
5530
|
-
devMiddlewares.close(),
|
|
5568
|
+
await options.context.hooks.onCloseDevServer.callBatch(), await Promise.all([
|
|
5569
|
+
null == devMiddlewares ? void 0 : devMiddlewares.close(),
|
|
5531
5570
|
null == fileWatcher ? void 0 : fileWatcher.close()
|
|
5532
5571
|
]);
|
|
5533
5572
|
}, beforeCreateCompiler = ()=>{
|
|
@@ -5545,14 +5584,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5545
5584
|
options.context.hooks.onCloseDevServer.tap(cleanup);
|
|
5546
5585
|
}
|
|
5547
5586
|
!getPortSilently && portTip && rslog_index_js_namespaceObject.logger.info(portTip);
|
|
5548
|
-
}
|
|
5549
|
-
runCompile ? options.context.hooks.onBeforeCreateCompiler.tap(beforeCreateCompiler) : beforeCreateCompiler();
|
|
5550
|
-
let compileMiddlewareAPI = runCompile ? await startCompile() : void 0, root = options.context.rootPath, fileWatcher = await setupWatchFiles({
|
|
5551
|
-
dev: devConfig,
|
|
5552
|
-
server: config.server,
|
|
5553
|
-
compileMiddlewareAPI,
|
|
5554
|
-
root
|
|
5555
|
-
}), readFileSync = (fileName)=>'readFileSync' in outputFileSystem ? outputFileSystem.readFileSync(fileName, 'utf-8') : external_node_fs_default().readFileSync(fileName, 'utf-8'), cacheableLoadBundle = createCacheableFunction(loadBundle), cacheableTransformedHtml = createCacheableFunction((_stats, entryName, utils)=>getTransformedHtml(entryName, utils)), environmentAPI = Object.fromEntries(Object.entries(options.context.environments).map(([name, environment])=>[
|
|
5587
|
+
}, readFileSync = (fileName)=>'readFileSync' in outputFileSystem ? outputFileSystem.readFileSync(fileName, 'utf-8') : external_node_fs_default().readFileSync(fileName, 'utf-8'), cacheableLoadBundle = createCacheableFunction(loadBundle), cacheableTransformedHtml = createCacheableFunction((_stats, entryName, utils)=>getTransformedHtml(entryName, utils)), environmentAPI = Object.fromEntries(Object.entries(options.context.environments).map(([name, environment])=>[
|
|
5556
5588
|
name,
|
|
5557
5589
|
{
|
|
5558
5590
|
getStats: async ()=>{
|
|
@@ -5568,34 +5600,23 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5568
5600
|
environment
|
|
5569
5601
|
}))
|
|
5570
5602
|
}
|
|
5571
|
-
])),
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
server: config.server,
|
|
5576
|
-
environments: environmentAPI,
|
|
5577
|
-
output: {
|
|
5578
|
-
distPath: options.context.distPath || ROOT_DIST_DIR
|
|
5579
|
-
},
|
|
5580
|
-
outputFileSystem
|
|
5581
|
-
}), { default: connect } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect/index.js")), middlewares = connect();
|
|
5582
|
-
for (let item of devMiddlewares.middlewares)Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5583
|
-
let devServerAPI = {
|
|
5603
|
+
])), { default: connect } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect/index.js")), middlewares = connect(), httpServer = await createHttpServer({
|
|
5604
|
+
serverConfig: config.server,
|
|
5605
|
+
middlewares
|
|
5606
|
+
}), devServerAPI = {
|
|
5584
5607
|
port,
|
|
5585
5608
|
middlewares,
|
|
5586
5609
|
environments: environmentAPI,
|
|
5610
|
+
httpServer,
|
|
5587
5611
|
listen: async ()=>{
|
|
5588
|
-
let
|
|
5589
|
-
serverConfig: config.server,
|
|
5590
|
-
middlewares
|
|
5591
|
-
}), serverTerminator = getServerTerminator(httpServer);
|
|
5612
|
+
let serverTerminator = getServerTerminator(httpServer);
|
|
5592
5613
|
return rslog_index_js_namespaceObject.logger.debug('listen dev server'), options.context.hooks.onCloseDevServer.tap(serverTerminator), new Promise((resolve)=>{
|
|
5593
5614
|
httpServer.listen({
|
|
5594
5615
|
host,
|
|
5595
5616
|
port
|
|
5596
5617
|
}, async (err)=>{
|
|
5597
5618
|
if (err) throw err;
|
|
5598
|
-
middlewares.use(notFoundMiddleware), httpServer.on('upgrade', devMiddlewares.onUpgrade), rslog_index_js_namespaceObject.logger.debug('listen dev server done'), await devServerAPI.afterListen(), onBeforeRestartServer(devServerAPI.close), resolve({
|
|
5619
|
+
middlewares.use(notFoundMiddleware), devMiddlewares && httpServer.on('upgrade', devMiddlewares.onUpgrade), rslog_index_js_namespaceObject.logger.debug('listen dev server done'), await devServerAPI.afterListen(), onBeforeRestartServer(devServerAPI.close), resolve({
|
|
5599
5620
|
port,
|
|
5600
5621
|
urls: urls.map((item)=>item.url),
|
|
5601
5622
|
server: {
|
|
@@ -5606,25 +5627,47 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5606
5627
|
});
|
|
5607
5628
|
},
|
|
5608
5629
|
afterListen: async ()=>{
|
|
5609
|
-
await options.context.hooks.onAfterStartDevServer.
|
|
5630
|
+
await options.context.hooks.onAfterStartDevServer.callBatch({
|
|
5610
5631
|
port,
|
|
5611
5632
|
routes,
|
|
5612
5633
|
environments: options.context.environments
|
|
5613
5634
|
});
|
|
5614
5635
|
},
|
|
5615
5636
|
connectWebSocket: ({ server })=>{
|
|
5616
|
-
server.on('upgrade', devMiddlewares.onUpgrade);
|
|
5637
|
+
devMiddlewares && server.on('upgrade', devMiddlewares.onUpgrade);
|
|
5617
5638
|
},
|
|
5618
5639
|
close: closeServer,
|
|
5619
5640
|
printUrls,
|
|
5620
5641
|
open: openPage
|
|
5621
|
-
}
|
|
5642
|
+
}, postCallbacks = (await options.context.hooks.onBeforeStartDevServer.callBatch({
|
|
5643
|
+
server: devServerAPI,
|
|
5644
|
+
environments: options.context.environments
|
|
5645
|
+
})).filter((item)=>'function' == typeof item);
|
|
5646
|
+
runCompile ? options.context.hooks.onBeforeCreateCompiler.tap(beforeCreateCompiler) : beforeCreateCompiler();
|
|
5647
|
+
let compileMiddlewareAPI = runCompile ? await startCompile() : void 0;
|
|
5648
|
+
for (let item of (fileWatcher = await setupWatchFiles({
|
|
5649
|
+
dev: devConfig,
|
|
5650
|
+
server: config.server,
|
|
5651
|
+
compileMiddlewareAPI,
|
|
5652
|
+
root
|
|
5653
|
+
}), (devMiddlewares = await getMiddlewares({
|
|
5654
|
+
pwd: root,
|
|
5655
|
+
compileMiddlewareAPI,
|
|
5656
|
+
dev: devConfig,
|
|
5657
|
+
server: config.server,
|
|
5658
|
+
environments: environmentAPI,
|
|
5659
|
+
output: {
|
|
5660
|
+
distPath: options.context.distPath || ROOT_DIST_DIR
|
|
5661
|
+
},
|
|
5662
|
+
outputFileSystem,
|
|
5663
|
+
postCallbacks
|
|
5664
|
+
})).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
|
|
5622
5665
|
return rslog_index_js_namespaceObject.logger.debug('create dev server done'), devServerAPI;
|
|
5623
5666
|
}
|
|
5624
5667
|
async function createCompiler_createCompiler(options) {
|
|
5625
5668
|
rslog_index_js_namespaceObject.logger.debug('create compiler');
|
|
5626
5669
|
let { context } = options, { rspackConfigs } = await initConfigs(options);
|
|
5627
|
-
if (await context.hooks.onBeforeCreateCompiler.
|
|
5670
|
+
if (await context.hooks.onBeforeCreateCompiler.callBatch({
|
|
5628
5671
|
bundlerConfigs: rspackConfigs,
|
|
5629
5672
|
environments: context.environments
|
|
5630
5673
|
}), !await isSatisfyRspackVersion(core_namespaceObject.rspack.rspackVersion)) throw Error(`[rsbuild] The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${index_js_default().green(rspackMinVersion)}`);
|
|
@@ -5663,7 +5706,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5663
5706
|
compiler,
|
|
5664
5707
|
bundlerConfigs: rspackConfigs,
|
|
5665
5708
|
MultiStatsCtor: core_namespaceObject.rspack.MultiStats
|
|
5666
|
-
}), await context.hooks.onAfterCreateCompiler.
|
|
5709
|
+
}), await context.hooks.onAfterCreateCompiler.callBatch({
|
|
5667
5710
|
compiler,
|
|
5668
5711
|
environments: context.environments
|
|
5669
5712
|
}), rslog_index_js_namespaceObject.logger.debug('create compiler done'), {
|
|
@@ -5827,7 +5870,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5827
5870
|
},
|
|
5828
5871
|
serverConfig
|
|
5829
5872
|
}, middlewares);
|
|
5830
|
-
await context.hooks.onBeforeStartProdServer.
|
|
5873
|
+
await context.hooks.onBeforeStartProdServer.callBatch();
|
|
5831
5874
|
let httpServer = await createHttpServer({
|
|
5832
5875
|
serverConfig,
|
|
5833
5876
|
middlewares: server.middlewares
|
|
@@ -5838,7 +5881,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5838
5881
|
port
|
|
5839
5882
|
}, async ()=>{
|
|
5840
5883
|
let routes = getRoutes(context);
|
|
5841
|
-
await context.hooks.onAfterStartProdServer.
|
|
5884
|
+
await context.hooks.onAfterStartProdServer.callBatch({
|
|
5842
5885
|
port,
|
|
5843
5886
|
routes,
|
|
5844
5887
|
environments: context.environments
|
|
@@ -5897,7 +5940,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5897
5940
|
pluginFileSize(),
|
|
5898
5941
|
pluginCleanOutput(),
|
|
5899
5942
|
pluginAsset(),
|
|
5900
|
-
pluginHtml((environment)=>async (...args)=>(await context.hooks.modifyHTMLTags.
|
|
5943
|
+
pluginHtml((environment)=>async (...args)=>(await context.hooks.modifyHTMLTags.callChain({
|
|
5901
5944
|
environment,
|
|
5902
5945
|
args
|
|
5903
5946
|
}))[0]),
|
|
@@ -6167,7 +6210,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6167
6210
|
});
|
|
6168
6211
|
}, onExitListened = !1, onExit = (cb)=>{
|
|
6169
6212
|
onExitListened || (process.on('exit', ()=>{
|
|
6170
|
-
hooks.onExit.
|
|
6213
|
+
hooks.onExit.callBatch();
|
|
6171
6214
|
}), onExitListened = !0), hooks.onExit.tap(cb);
|
|
6172
6215
|
};
|
|
6173
6216
|
return (environment)=>({
|
|
@@ -6245,7 +6288,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6245
6288
|
return {
|
|
6246
6289
|
...buildInstance,
|
|
6247
6290
|
close: async ()=>{
|
|
6248
|
-
await context.hooks.onCloseBuild.
|
|
6291
|
+
await context.hooks.onCloseBuild.callBatch(), await buildInstance.close();
|
|
6249
6292
|
}
|
|
6250
6293
|
};
|
|
6251
6294
|
},
|
|
@@ -6616,7 +6659,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6616
6659
|
}), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
|
|
6617
6660
|
}
|
|
6618
6661
|
}
|
|
6619
|
-
let
|
|
6662
|
+
let dist = (name = "")=>new CAC(name), applyCommonOptions = (cli)=>{
|
|
6620
6663
|
cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
|
|
6621
6664
|
default: 'jiti'
|
|
6622
6665
|
}).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
|
|
@@ -6640,12 +6683,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6640
6683
|
}
|
|
6641
6684
|
}(), process.title = 'rsbuild-node';
|
|
6642
6685
|
let { npm_execpath } = process.env;
|
|
6643
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.
|
|
6686
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.9\n`);
|
|
6644
6687
|
}();
|
|
6645
6688
|
try {
|
|
6646
6689
|
!function() {
|
|
6647
|
-
let cli =
|
|
6648
|
-
cli.help(), cli.version("1.2.
|
|
6690
|
+
let cli = dist('rsbuild');
|
|
6691
|
+
cli.help(), cli.version("1.2.9"), applyCommonOptions(cli);
|
|
6649
6692
|
let devCommand = cli.command('dev', 'starting the dev server'), 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');
|
|
6650
6693
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
6651
6694
|
try {
|
|
@@ -6696,7 +6739,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6696
6739
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
6697
6740
|
}
|
|
6698
6741
|
}
|
|
6699
|
-
let src_rslib_entry_version = "1.2.
|
|
6742
|
+
let src_rslib_entry_version = "1.2.9";
|
|
6700
6743
|
})();
|
|
6701
6744
|
var __webpack_export_target__ = exports;
|
|
6702
6745
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|