@rsbuild/core 1.1.11 → 1.1.13

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/dist/index.cjs CHANGED
@@ -1483,11 +1483,11 @@ var __webpack_exports__ = {};
1483
1483
  }, getHTMLPlugin = ()=>(!pluginHelper_htmlPlugin && (pluginHelper_htmlPlugin = pluginHelper_require('../compiled/html-rspack-plugin/index.js')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
1484
1484
  cssExtractPlugin = plugin;
1485
1485
  }, getCssExtractPlugin = ()=>cssExtractPlugin ? cssExtractPlugin : core_default().CssExtractRspackPlugin;
1486
- var external_node_fs_ = __webpack_require__("node:fs"), external_node_fs_default = __webpack_require__.n(external_node_fs_), external_node_path_ = __webpack_require__("node:path"), external_node_path_default = __webpack_require__.n(external_node_path_), main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@11.0.7/node_modules/dotenv-expand/lib/main.js"), cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"), cjs_default = __webpack_require__.n(cjs);
1486
+ var external_node_fs_ = __webpack_require__("node:fs"), external_node_fs_default = __webpack_require__.n(external_node_fs_), external_node_path_ = __webpack_require__("node:path"), external_node_path_default = __webpack_require__.n(external_node_path_), main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@11.0.7/node_modules/dotenv-expand/lib/main.js");
1487
+ let external_node_url_namespaceObject = require("node:url");
1488
+ var cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"), cjs_default = __webpack_require__.n(cjs);
1487
1489
  let index_js_namespaceObject = require("../compiled/picocolors/index.js");
1488
1490
  var index_js_default = __webpack_require__.n(index_js_namespaceObject);
1489
- let external_node_url_namespaceObject = require("node:url");
1490
- var external_node_url_default = __webpack_require__.n(external_node_url_namespaceObject);
1491
1491
  let constants_filename = (0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__), constants_dirname = (0, external_node_path_.dirname)(constants_filename), ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, external_node_path_.join)(constants_dirname), STATIC_PATH = (0, external_node_path_.join)(constants_dirname, '../static'), COMPILED_PATH = (0, external_node_path_.join)(constants_dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_WEB_BROWSERSLIST = [
1492
1492
  'chrome >= 87',
1493
1493
  'edge >= 88',
@@ -1602,47 +1602,11 @@ var __webpack_exports__ = {};
1602
1602
  } catch (err) {
1603
1603
  return publicPath;
1604
1604
  }
1605
- };
1606
- function formatMessage(stats, verbose) {
1607
- let message, lines = [];
1608
- if ('object' == typeof stats) {
1609
- let fileName = function(stats) {
1610
- if (stats.moduleIdentifier) {
1611
- let matched = stats.moduleIdentifier.match(/(?:\!|^)([^!]+)$/);
1612
- if (matched) {
1613
- let fileName = matched.pop();
1614
- if (fileName) return `File: ${fileName}:1:1\n`;
1615
- }
1616
- }
1617
- let file = stats.file || stats.moduleName;
1618
- return file ? `File: ${file}\n` : '';
1619
- }(stats), mainMessage = stats.message, details = verbose && stats.details ? `\nDetails: ${stats.details}\n` : '', stack = verbose && stats.stack ? `\n${stats.stack}` : '', moduleTrace = function(stats) {
1620
- let traceStr = '';
1621
- if (stats.moduleTrace) for (let trace of stats.moduleTrace)trace.originName && (traceStr += `\n @ ${trace.originName}`);
1622
- return traceStr;
1623
- }(stats);
1624
- message = `${fileName}${mainMessage}${details}${stack}${moduleTrace}`;
1625
- } else message = stats;
1626
- message = (lines = (lines = (message = function(message) {
1627
- let hint = 'You may need an appropriate loader to handle this file type.';
1628
- return -1 === message.indexOf(hint) ? message : /File: .+\.s(c|a)ss/.test(message) ? message.replace(hint, 'To enable support for Sass, use "@rsbuild/plugin-sass".') : /File: .+\.less/.test(message) ? message.replace(hint, 'To enable support for Less, use "@rsbuild/plugin-less".') : /File: .+\.styl(us)?/.test(message) ? message.replace(hint, 'To enable support for Stylus, use "@rsbuild/plugin-stylus".') : message;
1629
- }(message)).split('\n')).filter((line, index, arr)=>0 === index || '' !== line.trim() || line.trim() !== arr[index - 1].trim())).join('\n');
1630
- let innerError = '-- inner error --';
1631
- return !verbose && message.includes(innerError) && (message = message.split(innerError)[0]), message.trim();
1632
- }
1633
- function formatStatsMessages(stats, verbose) {
1634
- var _stats_errors, _stats_warnings;
1635
- let formattedErrors = (null === (_stats_errors = stats.errors) || void 0 === _stats_errors ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [];
1636
- return {
1637
- errors: formattedErrors,
1638
- warnings: (null === (_stats_warnings = stats.warnings) || void 0 === _stats_warnings ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || []
1639
- };
1640
- }
1641
- let hintNodePolyfill = (message)=>{
1605
+ }, hintNodePolyfill = (message)=>{
1642
1606
  let getTips = (moduleName)=>{
1643
1607
  let tips = [
1644
1608
  `Tip: "${moduleName}" is a built-in Node.js module. It cannot be imported in client-side code.`,
1645
- `Check if you need to import Node.js module. If needed, you can use ${index_js_default().cyan('@rsbuild/plugin-node-polyfill')}.`
1609
+ `Check if you need to import Node.js module. If needed, you can use "${index_js_default().cyan('@rsbuild/plugin-node-polyfill')}" to polyfill it.`
1646
1610
  ];
1647
1611
  return `${message}\n\n${index_js_default().yellow(tips.join('\n'))}`;
1648
1612
  };
@@ -1691,7 +1655,42 @@ var __webpack_exports__ = {};
1691
1655
  'vm',
1692
1656
  'zlib'
1693
1657
  ].includes(moduleName) ? getTips(moduleName) : message;
1694
- }, getAllStatsErrors = (statsData)=>{
1658
+ };
1659
+ function formatMessage(stats, verbose) {
1660
+ let message, lines = [];
1661
+ if ('object' == typeof stats) {
1662
+ let fileName = function(stats) {
1663
+ if (stats.moduleIdentifier) {
1664
+ let matched = stats.moduleIdentifier.match(/(?:\!|^)([^!]+)$/);
1665
+ if (matched) {
1666
+ let fileName = matched.pop();
1667
+ if (fileName) return `File: ${fileName}:1:1\n`;
1668
+ }
1669
+ }
1670
+ let file = stats.file || stats.moduleName;
1671
+ return file ? `File: ${file}\n` : '';
1672
+ }(stats), mainMessage = stats.message, details = verbose && stats.details ? `\nDetails: ${stats.details}\n` : '', stack = verbose && stats.stack ? `\n${stats.stack}` : '', moduleTrace = function(stats) {
1673
+ let traceStr = '';
1674
+ if (stats.moduleTrace) for (let trace of stats.moduleTrace)trace.originName && (traceStr += `\n @ ${trace.originName}`);
1675
+ return traceStr;
1676
+ }(stats);
1677
+ message = `${fileName}${mainMessage}${details}${stack}${moduleTrace}`;
1678
+ } else message = stats;
1679
+ let innerError = '-- inner error --';
1680
+ return !verbose && message.includes(innerError) && (message = message.split(innerError)[0]), (message = (lines = (lines = (message = hintNodePolyfill(message = function(message) {
1681
+ let hint = 'You may need an appropriate loader to handle this file type.';
1682
+ return -1 === message.indexOf(hint) ? message : /File: .+\.s(c|a)ss/.test(message) ? message.replace(hint, `To enable support for Sass, use "${index_js_default().yellow('@rsbuild/plugin-sass')}".`) : /File: .+\.less/.test(message) ? message.replace(hint, `To enable support for Less, use "${index_js_default().yellow('@rsbuild/plugin-less')}".`) : /File: .+\.styl(us)?/.test(message) ? message.replace(hint, `To enable support for Stylus, use "${index_js_default().yellow('@rsbuild/plugin-stylus')}".`) : message;
1683
+ }(message))).split('\n')).filter((line, index, arr)=>0 === index || '' !== line.trim() || line.trim() !== arr[index - 1].trim())).join('\n')).trim();
1684
+ }
1685
+ function formatStatsMessages(stats, verbose) {
1686
+ var _stats_errors, _stats_warnings;
1687
+ let formattedErrors = (null === (_stats_errors = stats.errors) || void 0 === _stats_errors ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [];
1688
+ return {
1689
+ errors: formattedErrors,
1690
+ warnings: (null === (_stats_warnings = stats.warnings) || void 0 === _stats_warnings ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || []
1691
+ };
1692
+ }
1693
+ let getAllStatsErrors = (statsData)=>{
1695
1694
  var _statsData_errors, _statsData_children;
1696
1695
  return statsData.errorsCount && (null === (_statsData_errors = statsData.errors) || void 0 === _statsData_errors ? void 0 : _statsData_errors.length) === 0 ? null === (_statsData_children = statsData.children) || void 0 === _statsData_children ? void 0 : _statsData_children.reduce((errors, curr)=>errors.concat(curr.errors || []), []) : statsData.errors;
1697
1696
  }, getAllStatsWarnings = (statsData)=>{
@@ -1716,9 +1715,9 @@ var __webpack_exports__ = {};
1716
1715
  }, verbose);
1717
1716
  return {
1718
1717
  message: function(errors) {
1719
- let messages = errors.map((error)=>hintNodePolyfill(error)), text = `${messages.join('\n\n')}\n`, title = index_js_default().bold(index_js_default().red('Compile error: '));
1718
+ let title = index_js_default().bold(index_js_default().red('Compile error: '));
1720
1719
  if (!errors.length) return `${title}\n${index_js_default().yellow("For more details, please setting 'stats.errors: true' ")}`;
1721
- let tip = index_js_default().yellow('Failed to compile, check the errors for troubleshooting.');
1720
+ let tip = index_js_default().yellow('Failed to compile, check the errors for troubleshooting.'), text = `${errors.join('\n\n')}\n`;
1722
1721
  return `${title}\n${tip}\n${text}`;
1723
1722
  }(errors),
1724
1723
  level: 'error'
@@ -1766,10 +1765,16 @@ var __webpack_exports__ = {};
1766
1765
  return `${urlProtocol}://${external_node_path_.posix.join(baseUrl, path)}`;
1767
1766
  }, canParse = (url)=>{
1768
1767
  try {
1769
- return new URL(url), !0;
1768
+ return new external_node_url_namespaceObject.URL(url), !0;
1770
1769
  } catch {
1771
1770
  return !1;
1772
1771
  }
1772
+ }, parseUrl = (url)=>{
1773
+ try {
1774
+ return new external_node_url_namespaceObject.URL(url);
1775
+ } catch {
1776
+ return null;
1777
+ }
1773
1778
  }, ensureAssetPrefix = (url, assetPrefix = DEFAULT_ASSET_PREFIX)=>url.startsWith('//') || canParse(url) || 'auto' === assetPrefix || 'function' == typeof assetPrefix ? url : assetPrefix.startsWith('http') ? urlJoin(assetPrefix, url) : assetPrefix.startsWith('//') ? urlJoin(`https:${assetPrefix}`, url).replace('https:', '') : external_node_path_.posix.join(assetPrefix, url);
1774
1779
  function getFilename(config, type, isProd, isServer) {
1775
1780
  let { filename, filenameHash } = config.output, hash = 'string' == typeof filenameHash ? filenameHash ? `.[${filenameHash}]` : '' : filenameHash ? '.[contenthash:8]' : '';
@@ -2741,7 +2746,7 @@ var __webpack_exports__ = {};
2741
2746
  async function createContext(options, userConfig, bundlerType) {
2742
2747
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache');
2743
2748
  return {
2744
- version: "1.1.11",
2749
+ version: "1.1.13",
2745
2750
  rootPath,
2746
2751
  distPath: '',
2747
2752
  cachePath,
@@ -4639,20 +4644,16 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4639
4644
  });
4640
4645
  }
4641
4646
  };
4642
- api.onAfterStartDevServer(onStartServer), api.onAfterStartProdServer(onStartServer), api.onBeforeBuild(async ({ isFirstCompile, environments })=>{
4647
+ api.onAfterStartDevServer(onStartServer), api.onAfterStartProdServer(onStartServer), api.onBeforeBuild(async ({ isFirstCompile })=>{
4643
4648
  if (!!isFirstCompile) for (let publicDir of normalizePublicDirs(api.getNormalizedConfig().server.publicDir)){
4644
4649
  let { name, copyOnBuild } = publicDir;
4645
4650
  if (!copyOnBuild || !name) continue;
4646
4651
  let normalizedPath = (0, external_node_path_.isAbsolute)(name) ? name : (0, external_node_path_.join)(api.context.rootPath, name);
4647
- if (!external_node_fs_default().existsSync(normalizedPath)) continue;
4648
- let distPaths = [
4649
- ...new Set(Object.values(environments).map((e)=>e.distPath))
4650
- ];
4651
- try {
4652
- await Promise.all(distPaths.map((distPath)=>external_node_fs_default().promises.cp(normalizedPath, distPath, {
4653
- recursive: !0,
4654
- dereference: !0
4655
- })));
4652
+ if (!!external_node_fs_default().existsSync(normalizedPath)) try {
4653
+ await external_node_fs_default().promises.cp(normalizedPath, api.context.distPath, {
4654
+ recursive: !0,
4655
+ dereference: !0
4656
+ });
4656
4657
  } catch (err) {
4657
4658
  throw err instanceof Error && (err.message = `Copy public dir (${normalizedPath}) to dist failed:\n${err.message}`), err;
4658
4659
  }
@@ -5358,8 +5359,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5358
5359
  environment
5359
5360
  })));
5360
5361
  if (isDebug()) {
5361
- let inspect = ()=>{
5362
- inspectConfig({
5362
+ let inspect = async ()=>{
5363
+ await inspectConfig({
5363
5364
  context,
5364
5365
  pluginManager,
5365
5366
  inspectOptions: {
@@ -5370,8 +5371,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5370
5371
  bundlerConfigs: rspackConfigs
5371
5372
  });
5372
5373
  };
5373
- context.hooks.onBeforeBuild.tap(({ isFirstCompile })=>{
5374
- isFirstCompile && inspect();
5374
+ context.hooks.onBeforeBuild.tap(async ({ isFirstCompile })=>{
5375
+ isFirstCompile && await inspect();
5375
5376
  }), context.hooks.onAfterStartDevServer.tap(inspect);
5376
5377
  }
5377
5378
  return {
@@ -5471,7 +5472,62 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5471
5472
  }), setupServerHooks(compiler, callbacks);
5472
5473
  }), rsbuildDevMiddleware(multiCompiler, restOptions);
5473
5474
  };
5474
- }, external_node_querystring_namespaceObject = require("node:querystring");
5475
+ }, external_node_querystring_namespaceObject = require("node:querystring"), colors = {
5476
+ black: '#000',
5477
+ red: '#fb6a6a',
5478
+ green: '#6ef790',
5479
+ yellow: '#eff986',
5480
+ cyan: '#6eecf7',
5481
+ blue: '#6eb2f7',
5482
+ magenta: '#f76ebe',
5483
+ lightgrey: '#f0f0f0',
5484
+ darkgrey: '#888'
5485
+ }, styles = {
5486
+ 30: 'black',
5487
+ 31: 'red',
5488
+ 32: 'green',
5489
+ 33: 'yellow',
5490
+ 34: 'blue',
5491
+ 35: 'magenta',
5492
+ 36: 'cyan',
5493
+ 37: 'lightgrey'
5494
+ }, openTags = {
5495
+ 1: 'font-weight:bold',
5496
+ 2: 'opacity:0.5',
5497
+ 3: '<i>',
5498
+ 4: '<u>',
5499
+ 8: 'display:none',
5500
+ 9: '<del>'
5501
+ }, closeTags = {
5502
+ 23: '</i>',
5503
+ 24: '</u>',
5504
+ 29: '</del>'
5505
+ };
5506
+ for (let n of [
5507
+ 0,
5508
+ 21,
5509
+ 22,
5510
+ 27,
5511
+ 28,
5512
+ 39,
5513
+ 49
5514
+ ])closeTags[n.toString()] = '</span>';
5515
+ !function() {
5516
+ for(let code in openTags['90'] = `color:${colors.darkgrey}`, styles){
5517
+ let oriColor = colors[styles[code]] || colors.black;
5518
+ openTags[code] = `color:${oriColor}`;
5519
+ }
5520
+ }();
5521
+ let server_ansiHTML = function(text) {
5522
+ if (!RegExp(`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`, 'g').test(text)) return text;
5523
+ let ansiCodes = [], ret = text.replace(/\x1B\[(\d+)m/g, (_match, seq)=>{
5524
+ let ot = openTags[seq];
5525
+ if (ot) return -1 !== ansiCodes.indexOf(seq) ? (ansiCodes.pop(), '</span>') : (ansiCodes.push(seq), '<' === ot[0] ? ot : `<span style="${ot}">`);
5526
+ let ct = closeTags[seq];
5527
+ return ct ? (ansiCodes.pop(), ct) : '';
5528
+ }), l = ansiCodes.length;
5529
+ return l > 0 && (ret += Array(l + 1).join('</span>')), ret;
5530
+ };
5475
5531
  function socketServer_define_property(obj, key, value) {
5476
5532
  return key in obj ? Object.defineProperty(obj, key, {
5477
5533
  value: value,
@@ -5573,25 +5629,49 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5573
5629
  for (let v of a.values())if (!b.has(v)) return !1;
5574
5630
  return !0;
5575
5631
  }(initialChunks, newInitialChunks);
5576
- return (this.initialChunks[compilationId] = newInitialChunks, shouldReload) ? this.sockWrite({
5632
+ if (this.initialChunks[compilationId] = newInitialChunks, shouldReload) return this.sockWrite({
5577
5633
  type: 'content-changed',
5578
5634
  compilationId
5579
- }) : !force && stats && !stats.errorsCount && stats.assets && stats.assets.every((asset)=>!asset.emitted) ? this.sockWrite({
5635
+ });
5636
+ if (!force && stats && !stats.errorsCount && stats.assets && stats.assets.every((asset)=>!asset.emitted)) return this.sockWrite({
5580
5637
  type: 'still-ok',
5581
5638
  compilationId
5582
- }) : (this.sockWrite({
5639
+ });
5640
+ if (this.sockWrite({
5583
5641
  type: 'hash',
5584
5642
  compilationId,
5585
5643
  data: stats.hash
5586
- }), stats.errorsCount) ? this.sockWrite({
5587
- type: 'errors',
5588
- compilationId,
5589
- data: getAllStatsErrors(stats)
5590
- }) : stats.warningsCount ? this.sockWrite({
5591
- type: 'warnings',
5592
- compilationId,
5593
- data: getAllStatsWarnings(stats)
5594
- }) : this.sockWrite({
5644
+ }), stats.errorsCount) {
5645
+ let { errors: formattedErrors } = formatStatsMessages({
5646
+ errors: getAllStatsErrors(stats),
5647
+ warnings: []
5648
+ });
5649
+ return this.sockWrite({
5650
+ type: 'errors',
5651
+ compilationId,
5652
+ data: {
5653
+ text: formattedErrors,
5654
+ html: formattedErrors.map((item)=>{
5655
+ var text;
5656
+ return server_ansiHTML((text = item) ? text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;') : '');
5657
+ })
5658
+ }
5659
+ });
5660
+ }
5661
+ if (stats.warningsCount) {
5662
+ let { warnings: formattedWarnings } = formatStatsMessages({
5663
+ warnings: getAllStatsWarnings(stats),
5664
+ errors: []
5665
+ });
5666
+ return this.sockWrite({
5667
+ type: 'warnings',
5668
+ compilationId,
5669
+ data: {
5670
+ text: formattedWarnings
5671
+ }
5672
+ });
5673
+ }
5674
+ return this.sockWrite({
5595
5675
  type: 'ok',
5596
5676
  compilationId
5597
5677
  });
@@ -5611,13 +5691,19 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5611
5691
  writable: !0
5612
5692
  }) : obj[key] = value, obj;
5613
5693
  }
5614
- let compilerDevMiddleware_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), formatDevConfig = (config, environments)=>1 === new Set(Object.values(environments).map((env)=>env.config.dev.writeToDisk)).size ? config : {
5694
+ let compilerDevMiddleware_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), formatDevConfig = (config, environments)=>{
5695
+ let writeToDiskValues = Object.values(environments).map((env)=>env.config.dev.writeToDisk);
5696
+ return 1 === new Set(writeToDiskValues).size ? {
5697
+ ...config,
5698
+ writeToDisk: writeToDiskValues[0]
5699
+ } : {
5615
5700
  ...config,
5616
5701
  writeToDisk (filePath, compilationName) {
5617
5702
  let { writeToDisk } = config;
5618
5703
  return compilationName && environments[compilationName] && (writeToDisk = environments[compilationName].config.dev.writeToDisk ?? writeToDisk), 'function' == typeof writeToDisk ? writeToDisk(filePath) : writeToDisk;
5619
5704
  }
5620
5705
  };
5706
+ };
5621
5707
  class CompilerDevMiddleware {
5622
5708
  async init() {
5623
5709
  let devMiddleware = await getDevMiddleware(this.compiler);
@@ -6130,8 +6216,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6130
6216
  }, applyDefaultMiddlewares = async ({ middlewares, server, compileMiddlewareAPI, output, pwd, outputFileSystem, environments })=>{
6131
6217
  let upgradeEvents = [];
6132
6218
  if (server.compress && middlewares.push(gzipMiddleware()), middlewares.push((req, res, next)=>{
6219
+ var _parseUrl;
6133
6220
  res.setHeader('Access-Control-Allow-Origin', '*');
6134
- let path = req.url ? external_node_url_default().parse(req.url).pathname : '';
6221
+ let path = req.url ? null === (_parseUrl = parseUrl(req.url)) || void 0 === _parseUrl ? void 0 : _parseUrl.pathname : '';
6135
6222
  (null == path ? void 0 : path.includes('hot-update')) && res.setHeader('Access-Control-Allow-Credentials', 'false');
6136
6223
  let confHeaders = server.headers;
6137
6224
  if (confHeaders) for (let [key, value] of Object.entries(confHeaders))res.setHeader(key, value);
@@ -7010,6 +7097,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7010
7097
  build,
7011
7098
  preview,
7012
7099
  startDevServer: (...args)=>(context.command = 'dev', !getNodeEnv() && setNodeEnv('development'), providerInstance.startDevServer(...args)),
7100
+ createCompiler: (...args)=>(!context.command && (context.command = 'development' === getNodeEnv() ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
7013
7101
  createDevServer: (...args)=>(context.command = 'dev', !getNodeEnv() && setNodeEnv('development'), providerInstance.createDevServer(...args)),
7014
7102
  ...pick(pluginManager, [
7015
7103
  'addPlugins',
@@ -7036,8 +7124,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7036
7124
  ]),
7037
7125
  ...pick(providerInstance, [
7038
7126
  'initConfigs',
7039
- 'inspectConfig',
7040
- 'createCompiler'
7127
+ 'inspectConfig'
7041
7128
  ])
7042
7129
  }, getFlattenedPlugins = async (pluginOptions)=>{
7043
7130
  let plugins = pluginOptions;
@@ -7076,11 +7163,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7076
7163
  }
7077
7164
  }(), process.title = 'rsbuild-node';
7078
7165
  let { npm_execpath } = process.env;
7079
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.1.11\n`);
7166
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.1.13\n`);
7080
7167
  }();
7081
7168
  try {
7082
7169
  !function() {
7083
- program.name('rsbuild').usage('<command> [options]').version("1.1.11");
7170
+ program.name('rsbuild').usage('<command> [options]').version("1.1.13");
7084
7171
  let devCommand = program.command('dev'), buildCommand = program.command('build'), previewCommand = program.command('preview'), inspectCommand = program.command('inspect');
7085
7172
  [
7086
7173
  devCommand,
@@ -7139,7 +7226,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7139
7226
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7140
7227
  }
7141
7228
  }
7142
- let src_rslib_entry_version = "1.1.11";
7229
+ let src_rslib_entry_version = "1.1.13";
7143
7230
  })();
7144
7231
  var __webpack_export_target__ = exports;
7145
7232
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];