@rsbuild/core 2.0.15 → 2.1.0-beta.0

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.
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 737: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 755: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(370);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(104);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -311,7 +311,7 @@
311
311
  }
312
312
  module.exports = { CachedChildCompilation };
313
313
  },
314
- 370: (module) => {
314
+ 104: (module) => {
315
315
  "use strict";
316
316
  class HtmlWebpackChildCompiler {
317
317
  constructor(templates) {
@@ -480,7 +480,7 @@
480
480
  }
481
481
  module.exports = { HtmlWebpackChildCompiler };
482
482
  },
483
- 18: (module) => {
483
+ 128: (module) => {
484
484
  "use strict";
485
485
  module.exports = {};
486
486
  module.exports.none = (chunks) => chunks;
@@ -499,7 +499,7 @@
499
499
  };
500
500
  module.exports.auto = module.exports.none;
501
501
  },
502
- 21: (module) => {
502
+ 775: (module) => {
503
503
  "use strict";
504
504
  module.exports = function (err) {
505
505
  return {
@@ -523,7 +523,7 @@
523
523
  };
524
524
  };
525
525
  },
526
- 212: (module, __unused_webpack_exports, __nccwpck_require__) => {
526
+ 726: (module, __unused_webpack_exports, __nccwpck_require__) => {
527
527
  "use strict";
528
528
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(159);
529
529
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -549,7 +549,7 @@
549
549
  }
550
550
  module.exports = { getHtmlRspackPluginHooks };
551
551
  },
552
- 1: (module) => {
552
+ 259: (module) => {
553
553
  const voidTags = [
554
554
  "area",
555
555
  "base",
@@ -617,19 +617,19 @@
617
617
  htmlTagObjectToString,
618
618
  };
619
619
  },
620
- 108: (module, __unused_webpack_exports, __nccwpck_require__) => {
620
+ 194: (module, __unused_webpack_exports, __nccwpck_require__) => {
621
621
  "use strict";
622
622
  const promisify = __nccwpck_require__(23).promisify;
623
623
  const vm = __nccwpck_require__(154);
624
624
  const fs = __nccwpck_require__(896);
625
625
  const path = __nccwpck_require__(928);
626
- const { CachedChildCompilation } = __nccwpck_require__(737);
626
+ const { CachedChildCompilation } = __nccwpck_require__(755);
627
627
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
628
- __nccwpck_require__(1);
629
- const prettyError = __nccwpck_require__(21);
630
- const chunkSorter = __nccwpck_require__(18);
628
+ __nccwpck_require__(259);
629
+ const prettyError = __nccwpck_require__(775);
630
+ const chunkSorter = __nccwpck_require__(128);
631
631
  const getHtmlRspackPluginHooks =
632
- __nccwpck_require__(212).getHtmlRspackPluginHooks;
632
+ __nccwpck_require__(726).getHtmlRspackPluginHooks;
633
633
  const WITH_PLACEHOLDER = "function __with_placeholder__";
634
634
  class HtmlRspackPlugin {
635
635
  constructor(userOptions = {}) {
@@ -2398,6 +2398,6 @@
2398
2398
  }
2399
2399
  if (typeof __nccwpck_require__ !== "undefined")
2400
2400
  __nccwpck_require__.ab = __dirname + "/";
2401
- var __webpack_exports__ = __nccwpck_require__(108);
2401
+ var __webpack_exports__ = __nccwpck_require__(194);
2402
2402
  module.exports = __webpack_exports__;
2403
2403
  })();
@@ -1 +1 @@
1
- {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.1.0","license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.1.1","license":"MIT","types":"index.d.ts","type":"module"}
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 339: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(821)["default"];
4
+ 93: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(879)["default"];
6
6
  },
7
- 821: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 879: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
12
- var _utils = __nccwpck_require__(520);
12
+ var _utils = __nccwpck_require__(434);
13
13
  function _interopRequireDefault(e) {
14
14
  return e && e.__esModule ? e : { default: e };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 520: (module, exports, __nccwpck_require__) => {
182
+ 434: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -716,6 +716,6 @@
716
716
  })();
717
717
  if (typeof __nccwpck_require__ !== "undefined")
718
718
  __nccwpck_require__.ab = __dirname + "/";
719
- var __webpack_exports__ = __nccwpck_require__(339);
719
+ var __webpack_exports__ = __nccwpck_require__(93);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1 +1 @@
1
- {"name":"rspack-chain","version":"2.1.0","license":"MIT","types":"types/index.d.ts","type":"module"}
1
+ {"name":"rspack-chain","version":"2.1.1","license":"MIT","types":"types/index.d.ts","type":"module"}
@@ -91,7 +91,6 @@ export declare class RspackChain extends __Config.ChainedMap<void> {
91
91
  loader(value: RspackConfig['loader']): this;
92
92
  name(value: RspackConfig['name']): this;
93
93
  infrastructureLogging(value: RspackConfig['infrastructureLogging']): this;
94
- snapshot(value: RspackConfig['snapshot']): this;
95
94
  lazyCompilation(value: RspackConfig['lazyCompilation']): this;
96
95
  incremental(value: RspackConfig['incremental']): this;
97
96
 
package/dist/756.js CHANGED
@@ -84,23 +84,24 @@ __webpack_require__.add({
84
84
  }, {});
85
85
  }, module.exports = deepmerge;
86
86
  },
87
- "../../node_modules/.pnpm/dotenv-expand@13.0.0/node_modules/dotenv-expand/lib/main.js" (module) {
87
+ "../../node_modules/.pnpm/dotenv-expand@13.0.0_patch_hash=5ff37847fa487be2db4e4f14c2b21937f4e51cc7a43deea4506d4aaf3fa6149c/node_modules/dotenv-expand/lib/main.js" (module) {
88
88
  function _resolveEscapeSequences(value) {
89
89
  return value.replace(/\\\$/g, '$');
90
90
  }
91
+ let propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
92
+ function getEnvValue(key, processEnv, runningParsed) {
93
+ return propertyIsEnumerable.call(processEnv, key) ? processEnv[key] : runningParsed[key];
94
+ }
91
95
  function expandValue(value, processEnv, runningParsed) {
92
- let match, env = {
93
- ...runningParsed,
94
- ...processEnv
95
- }, regex = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g, result = value, seen = new Set();
96
+ let match, regex = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g, result = value, seen = new Set();
96
97
  for(; null !== (match = regex.exec(result));){
97
98
  let defaultValue, value;
98
99
  seen.add(result);
99
- let [template, bracedExpression, unbracedExpression] = match, expression = bracedExpression || unbracedExpression, opRegex = /(:\+|\+|:-|-)/, opMatch = expression.match(opRegex), splitter = opMatch ? opMatch[0] : null, r = expression.split(splitter), key = r.shift();
100
+ let [template, bracedExpression, unbracedExpression] = match, expression = bracedExpression || unbracedExpression, opRegex = /(:\+|\+|:-|-)/, opMatch = expression.match(opRegex), splitter = opMatch ? opMatch[0] : null, r = expression.split(splitter), key = r.shift(), envValue = getEnvValue(key, processEnv, runningParsed);
100
101
  if ([
101
102
  ':+',
102
103
  '+'
103
- ].includes(splitter) ? (defaultValue = env[key] ? r.join(splitter) : '', value = null) : (defaultValue = r.join(splitter), value = env[key]), (result = value ? seen.has(value) ? result.replace(template, defaultValue) : result.replace(template, value) : result.replace(template, defaultValue)) === runningParsed[key]) break;
104
+ ].includes(splitter) ? (defaultValue = envValue ? r.join(splitter) : '', value = null) : (defaultValue = r.join(splitter), value = envValue), (result = value ? seen.has(value) ? result.replace(template, defaultValue) : result.replace(template, value) : result.replace(template, defaultValue)) === runningParsed[key]) break;
104
105
  regex.lastIndex = 0;
105
106
  }
106
107
  return result;
@@ -2199,7 +2200,6 @@ class RspackChain extends ChainedMap {
2199
2200
  'loader',
2200
2201
  'name',
2201
2202
  'infrastructureLogging',
2202
- 'snapshot',
2203
2203
  'lazyCompilation',
2204
2204
  'incremental'
2205
2205
  ]);
@@ -3497,7 +3497,7 @@ function createPublicContext(context) {
3497
3497
  async function createContext(options, userConfig, logger) {
3498
3498
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
3499
3499
  return {
3500
- version: "2.0.15",
3500
+ version: "2.1.0-beta.0",
3501
3501
  rootPath,
3502
3502
  distPath: '',
3503
3503
  cachePath,
@@ -4150,18 +4150,15 @@ async function createCompiler_createCompiler(options) {
4150
4150
  let { name } = context.environmentList[index], time = Date.now() - startTime;
4151
4151
  context.buildState.time[name] = time;
4152
4152
  let suffix = isMultiCompiler ? color.dim(` (${name})`) : '', timeStr = `${((seconds)=>{
4153
- let time, time1;
4153
+ let format = (time, unit)=>color.bold(`${time}${unit}`);
4154
4154
  if (seconds < 10) {
4155
- let time, digits = seconds >= 0.01 ? 2 : 3;
4156
- return `${time = seconds.toFixed(digits), color.bold(time)} s`;
4157
- }
4158
- if (seconds < 60) {
4159
- let time;
4160
- return `${time = seconds.toFixed(1), color.bold(time)} s`;
4155
+ let digits = seconds >= 0.01 ? 2 : 3;
4156
+ return format(seconds.toFixed(digits), 's');
4161
4157
  }
4162
- let minutes = Math.floor(seconds / 60), minutesLabel = `${(time = minutes.toFixed(0), color.bold(time))} m`, remainingSeconds = seconds % 60;
4158
+ if (seconds < 60) return format(seconds.toFixed(1), 's');
4159
+ let minutesLabel = format(Math.floor(seconds / 60).toFixed(0), 'm'), remainingSeconds = seconds % 60;
4163
4160
  if (0 === remainingSeconds) return minutesLabel;
4164
- let secondsLabel = `${(time1 = remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)), color.bold(time1))} s`;
4161
+ let secondsLabel = format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)), 's');
4165
4162
  return `${minutesLabel} ${secondsLabel}`;
4166
4163
  })(time / 1000)}${suffix}`;
4167
4164
  hasErrors ? logger.error(`build failed in ${timeStr}`) : logger.ready(`built in ${timeStr}`);
@@ -4326,7 +4323,7 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
4326
4323
  stats,
4327
4324
  close: async ()=>{}
4328
4325
  };
4329
- }, main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@13.0.0/node_modules/dotenv-expand/lib/main.js"), DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
4326
+ }, main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@13.0.0_patch_hash=5ff37847fa487be2db4e4f14c2b21937f4e51cc7a43deea4506d4aaf3fa6149c/node_modules/dotenv-expand/lib/main.js"), DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
4330
4327
  function loadEnv_parse(src) {
4331
4328
  let match, obj = {}, lines = src.toString();
4332
4329
  for(lines = lines.replace(/\r\n?/gm, '\n'); null != (match = DOTENV_LINE.exec(lines));){
@@ -5460,9 +5457,12 @@ class RsbuildHtmlPlugin {
5460
5457
  let optPublicPath = tag.publicPath ?? tagConfig.publicPath;
5461
5458
  'function' == typeof optPublicPath ? filename = optPublicPath(filename, data.publicPath) : 'string' == typeof optPublicPath ? filename = ensureAssetPrefix(filename, optPublicPath) : !1 !== optPublicPath && (filename = ensureAssetPrefix(filename, data.publicPath));
5462
5459
  let optHash = tag.hash ?? tagConfig.hash;
5463
- 'function' == typeof optHash ? compilationHash.length && (filename = optHash(filename, compilationHash)) : 'string' == typeof optHash ? optHash.length && (filename = `${filename}?${optHash}`) : !0 === optHash && compilationHash.length && (filename = `${filename}?${compilationHash}`), attrs[filenameTag] = filename, tag.attrs = attrs;
5460
+ 'function' == typeof optHash ? compilationHash.length && (filename = optHash(filename, compilationHash)) : 'string' == typeof optHash ? optHash.length && (filename = `${filename}?${optHash}`) : !0 === optHash && compilationHash.length && (filename = `${filename}?${compilationHash}`), attrs[filenameTag] = filename;
5464
5461
  }
5465
- ret.push(fromBasicTag(tag));
5462
+ ret.push(fromBasicTag({
5463
+ ...tag,
5464
+ attrs
5465
+ }));
5466
5466
  }
5467
5467
  return ret;
5468
5468
  }, tags = [
@@ -5629,7 +5629,7 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
5629
5629
  if (prefix?.startsWith('./') && (prefix = prefix.replace('./', '')), !prefix) return '/';
5630
5630
  let hasLeadingSlash = prefix.startsWith('/'), hasTailSlash = prefix.endsWith('/');
5631
5631
  return `${hasLeadingSlash ? '' : '/'}${prefix}${hasTailSlash ? '' : '/'}`;
5632
- }, joinUrlPath = (basePath, pathname)=>'' === basePath ? pathname : '' === pathname ? basePath : addTrailingSlash(basePath) + pathname.replace(/^\/+/, ''), isUrlPathUnderBase = (pathname, base)=>{
5632
+ }, joinUrlPath = (basePath, pathname)=>'' === basePath ? pathname : '' === pathname ? basePath : addTrailingSlash(basePath) + pathname.replace(/^\/+/, ''), getMoreEntriesMessage = (moreEntries, cliShortcutsEnabled)=>cliShortcutsEnabled ? ` ${color.dim(`... ${moreEntries} more entries, press `)}${color.bold('u + enter')}${color.dim(' to show all')}\n` : ` ${color.dim(`... ${moreEntries} more entries, set `)}${color.bold('server.printUrls.maxRoutes')}${color.dim(' to show more')}\n`, isUrlPathUnderBase = (pathname, base)=>{
5633
5633
  let basePath = removeTailingSlash(base);
5634
5634
  return '' === basePath || pathname === basePath || pathname.startsWith(`${basePath}/`);
5635
5635
  }, removeBasePath = (url, base)=>{
@@ -5652,20 +5652,21 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
5652
5652
  pathname: prefix + ('index' === entryName && 'nested' !== outputStructure ? '' : entryName)
5653
5653
  })).sort((a)=>'index' === a.entryName ? -1 : 1);
5654
5654
  };
5655
- function getURLMessages(urls, routes) {
5656
- if (routes.length <= 1) {
5657
- let pathname = routes.length ? routes[0].pathname : '', padWidth = Math.max(Math.max(...urls.map((u)=>u.label.trimEnd().length)) + 2, 10);
5658
- return urls.map(({ label, url })=>{
5655
+ function getURLMessages(urls, routes, { maxRoutes = 10, showAllRoutes, cliShortcutsEnabled }) {
5656
+ let routeLimit = showAllRoutes ? 1 / 0 : void 0 === maxRoutes ? 10 : maxRoutes === 1 / 0 ? maxRoutes : Math.max(0, Math.floor(maxRoutes)), printableRoutes = 0 === routeLimit ? [] : routes.slice(0, routeLimit), moreEntries = routeLimit > 0 ? routes.length - printableRoutes.length : 0;
5657
+ if (routes.length <= 1 || 0 === printableRoutes.length) {
5658
+ let pathname = printableRoutes.length ? printableRoutes[0].pathname : '', padWidth = Math.max(Math.max(...urls.map((u)=>u.label.trimEnd().length)) + 2, 10), message = urls.map(({ label, url })=>{
5659
5659
  let normalizedPathname = normalizeUrl(`${url}${pathname}`), prefix = `➜ ${color.dim(label.trimEnd().padEnd(padWidth))}`;
5660
5660
  return ` ${prefix}${color.cyan(normalizedPathname)}\n`;
5661
5661
  }).join('');
5662
+ return moreEntries > 0 && (message += getMoreEntriesMessage(moreEntries, cliShortcutsEnabled)), message;
5662
5663
  }
5663
- let message = '', prevLabel = '', maxNameLength = Math.max(...routes.map((r)=>r.entryName.length));
5664
+ let message = '', prevLabel = '', maxNameLength = Math.max(...printableRoutes.map((r)=>r.entryName.length));
5664
5665
  return urls.forEach(({ label, url }, index)=>{
5665
- for (let { entryName, pathname } of (prevLabel !== label && (index > 0 && (message += '\n'), message += ` ➜ ${label}\n`, prevLabel = label), routes))message += ` ${color.dim('-')} ${color.dim(entryName.padEnd(maxNameLength + 4))}${color.cyan(normalizeUrl(`${url}${pathname}`))}\n`;
5666
- }), message;
5666
+ for (let { entryName, pathname } of (prevLabel !== label && (index > 0 && (message += '\n'), message += ` ➜ ${label}\n`, prevLabel = label), printableRoutes))message += ` ${color.dim('-')} ${color.dim(entryName.padEnd(maxNameLength + 4))}${color.cyan(normalizeUrl(`${url}${pathname}`))}\n`;
5667
+ }), moreEntries > 0 && (message += getMoreEntriesMessage(moreEntries, cliShortcutsEnabled)), message;
5667
5668
  }
5668
- function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, fallbackPathname, trailingLineBreak = !0, originalConfig, logger }) {
5669
+ function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, fallbackPathname, showAllRoutes, cliShortcutsEnabled, originalConfig, logger }) {
5669
5670
  if (!1 === printUrls) return null;
5670
5671
  let urls = originalUrls, useCustomUrl = isFunction(printUrls);
5671
5672
  if (useCustomUrl) {
@@ -5695,8 +5696,12 @@ function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls
5695
5696
  }
5696
5697
  ];
5697
5698
  if (0 === printableRoutes.length && !useCustomUrl) return null;
5698
- let message = getURLMessages(urls, printableRoutes);
5699
- return originalConfig && originalConfig.server?.host === void 0 && (message += ` ➜ ${color.dim('Network:')} ${color.dim('use')} ${color.bold('--host')} ${color.dim('to expose')}\n`), !trailingLineBreak && message.endsWith('\n') && (message = message.slice(0, -1)), logger.log(message), message;
5699
+ let printUrlsOptions = printUrls && 'object' == typeof printUrls ? printUrls : {}, message = getURLMessages(urls, printableRoutes, {
5700
+ maxRoutes: useCustomUrl ? 1 / 0 : printUrlsOptions.maxRoutes,
5701
+ showAllRoutes,
5702
+ cliShortcutsEnabled
5703
+ });
5704
+ return originalConfig && originalConfig.server?.host === void 0 && (message += ` ➜ ${color.dim('Network:')} ${color.dim('use')} ${color.bold('--host')} ${color.dim('to expose')}\n`), !0 === cliShortcutsEnabled && message.endsWith('\n') && (message = message.slice(0, -1)), logger.log(message), message;
5700
5705
  }
5701
5706
  let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
5702
5707
  'string' == typeof port && (port = Number.parseInt(port, 10)), strictPort && (tryLimits = 1);
@@ -7066,9 +7071,9 @@ function convertLinksInHtml(text, root) {
7066
7071
  }).join('\n');
7067
7072
  }
7068
7073
  function isEqualSet(a, b) {
7069
- return a.size === b.size && [
7070
- ...a
7071
- ].every((value)=>b.has(value));
7074
+ if (a.size !== b.size) return !1;
7075
+ for (let value of a)if (!b.has(value)) return !1;
7076
+ return !0;
7072
7077
  }
7073
7078
  let parseQueryString = (req)=>{
7074
7079
  let queryStr = req.url ? req.url.split('?')[1] : '';
@@ -7103,7 +7108,7 @@ class SocketServer {
7103
7108
  }
7104
7109
  async prepare() {
7105
7110
  this.clearHeartbeatTimer();
7106
- let { WebSocketServer } = await import("./ws.js");
7111
+ let { WebSocketServer } = await import("./wrapper.js");
7107
7112
  this.wsServer = new WebSocketServer({
7108
7113
  noServer: !0,
7109
7114
  path: this.options.client?.path
@@ -7208,11 +7213,15 @@ class SocketServer {
7208
7213
  return this.context.environmentList.find(({ webSocketToken })=>webSocketToken === token);
7209
7214
  }
7210
7215
  getInitialChunks(stats) {
7211
- let initialChunks = new Set();
7212
- if (!stats.entrypoints) return initialChunks;
7213
- for (let entrypoint of Object.values(stats.entrypoints)){
7214
- let { chunks } = entrypoint;
7215
- if (Array.isArray(chunks)) for (let chunkName of chunks)chunkName && initialChunks.add(String(chunkName));
7216
+ let initialChunks = new Set(), { entrypoints } = stats;
7217
+ if (!entrypoints) return initialChunks;
7218
+ let entryNames = Object.keys(entrypoints);
7219
+ for(let entryIndex = 0; entryIndex < entryNames.length; entryIndex++){
7220
+ let chunks = entrypoints[entryNames[entryIndex]]?.chunks;
7221
+ if (Array.isArray(chunks)) for(let index = 0; index < chunks.length; index++){
7222
+ let chunkName = chunks[index];
7223
+ void 0 !== chunkName && initialChunks.add('string' == typeof chunkName ? chunkName : String(chunkName));
7224
+ }
7216
7225
  }
7217
7226
  return initialChunks;
7218
7227
  }
@@ -7338,7 +7347,9 @@ async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls,
7338
7347
  {
7339
7348
  key: 'u',
7340
7349
  description: `${color.bold('u + enter')} ${color.dim('show urls')}`,
7341
- action: printUrls
7350
+ action: ()=>printUrls({
7351
+ showAllRoutes: !0
7352
+ })
7342
7353
  }
7343
7354
  ].filter(Boolean);
7344
7355
  if (customShortcuts && !Array.isArray(shortcuts = customShortcuts(shortcuts))) throw Error(`${color.dim('[rsbuild:config]')} ${color.yellow('dev.cliShortcuts')} option must return an array of shortcuts.`);
@@ -7687,7 +7698,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
7687
7698
  ],
7688
7699
  outputFileSystem: buildManager.outputFileSystem
7689
7700
  })), server.publicDir.length) {
7690
- let { default: sirv } = await import("./sirv.js");
7701
+ let { default: sirv } = await import("./build.js");
7691
7702
  for (let { name } of server.publicDir){
7692
7703
  let sirvMiddleware = sirv(name, {
7693
7704
  etag: !0,
@@ -8138,14 +8149,15 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
8138
8149
  protocol,
8139
8150
  port,
8140
8151
  host
8141
- }), cliShortcutsEnabled = isCliShortcutsEnabled(config), printUrls = ()=>printServerURLs({
8152
+ }), cliShortcutsEnabled = isCliShortcutsEnabled(config), printUrls = (options)=>printServerURLs({
8142
8153
  urls,
8143
8154
  port,
8144
8155
  routes,
8145
8156
  protocol,
8146
8157
  printUrls: config.server.printUrls,
8147
8158
  fallbackPathname,
8148
- trailingLineBreak: !cliShortcutsEnabled,
8159
+ showAllRoutes: options?.showAllRoutes,
8160
+ cliShortcutsEnabled,
8149
8161
  originalConfig: context.originalConfig,
8150
8162
  logger
8151
8163
  }), openPage = async ()=>open_open({
@@ -8288,13 +8300,14 @@ async function startPreviewServer(context, config, { getPortSilently } = {}) {
8288
8300
  middlewares
8289
8301
  }), cleanupGracefulShutdown = setupGracefulShutdown(), serverTerminator = getServerTerminator(httpServer), closingPromise = null, closeServer = async ()=>(closingPromise || (closingPromise = (async ()=>{
8290
8302
  removeCleanup(closeServer), cleanupGracefulShutdown(), await serverTerminator();
8291
- })()), closingPromise), printUrls = ()=>printServerURLs({
8303
+ })()), closingPromise), printUrls = (options)=>printServerURLs({
8292
8304
  urls,
8293
8305
  port,
8294
8306
  routes,
8295
8307
  protocol,
8296
8308
  printUrls: serverConfig.printUrls,
8297
- trailingLineBreak: !cliShortcutsEnabled,
8309
+ showAllRoutes: options?.showAllRoutes,
8310
+ cliShortcutsEnabled,
8298
8311
  originalConfig: context.originalConfig,
8299
8312
  logger
8300
8313
  }), openPage = async ()=>open_open({
@@ -8393,7 +8406,10 @@ function applyDefaultPlugins(pluginManager, context) {
8393
8406
  level: 'error'
8394
8407
  }), chain.watchOptions({
8395
8408
  aggregateTimeout: 0
8396
- }), chain.performance.hints(!1), chain.module.parser.merge({
8409
+ }), chain.performance.hints(!1), chain.experiments({
8410
+ ...chain.get('experiments'),
8411
+ sourceImport: !0
8412
+ }), chain.module.parser.merge({
8397
8413
  javascript: {
8398
8414
  typeReexportsPresence: 'tolerant'
8399
8415
  }
@@ -9470,7 +9486,7 @@ try {
9470
9486
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
9471
9487
  let { output: { manifest }, dev: { writeToDisk } } = environment.config;
9472
9488
  if (!1 === manifest) return;
9473
- let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.8/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
9489
+ let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./rspack-manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
9474
9490
  manifestFilenames.set(environment.name, manifestOptions.filename);
9475
9491
  let pluginOptions = {
9476
9492
  fileName: manifestOptions.filename,
@@ -10005,7 +10021,7 @@ let applyServerOptions = (command)=>{
10005
10021
  };
10006
10022
  function setupCommands() {
10007
10023
  let cli = ((name = "")=>new CAC(name))('rsbuild');
10008
- cli.version("2.0.15"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
10024
+ cli.version("2.1.0-beta.0"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
10009
10025
  default: 'auto'
10010
10026
  }).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
10011
10027
  type: [
@@ -10076,7 +10092,7 @@ function initNodeEnv(command) {
10076
10092
  }
10077
10093
  function showGreeting() {
10078
10094
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
10079
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.15\n`);
10095
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.1.0-beta.0\n`);
10080
10096
  }
10081
10097
  function setupLogLevel() {
10082
10098
  if (cli_argv.length <= 3) return;
@@ -10098,5 +10114,5 @@ function runCLI() {
10098
10114
  src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
10099
10115
  }
10100
10116
  }
10101
- let src_version = "2.0.15";
10117
+ let src_version = "2.1.0-beta.0";
10102
10118
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, mrmime_lookup, runCLI, src_logger as logger, src_version as version };
@@ -2673,8 +2673,9 @@ let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modul
2673
2673
  };
2674
2674
  function getStatusCode(errorCode) {
2675
2675
  let statusCode;
2676
- if (/HPE_INVALID/.test(errorCode)) statusCode = 502;
2677
- else switch(errorCode){
2676
+ if (/HPE_INVALID/.test(errorCode)) return 502;
2677
+ if (/HPM_ERR_INVALID_MULTIPART_/.test(errorCode)) return 400;
2678
+ switch(errorCode){
2678
2679
  case 'ECONNRESET':
2679
2680
  case 'ENOTFOUND':
2680
2681
  case 'ECONNREFUSED':
@@ -1,7 +1,7 @@
1
1
  import { __webpack_require__ } from "./1~rslib-runtime.js";
2
2
  import "./756.js";
3
3
  __webpack_require__.add({
4
- "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.8/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
4
+ "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
5
5
  exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
6
6
  let node_path_1 = __webpack_require__("node:path?435f");
7
7
  exports.generateManifest = (compilation, files, { generate, seed = {} })=>generate ? generate(seed, files, Array.from(compilation.entrypoints.entries()).reduce((e, [name, entrypoint])=>Object.assign(e, {
@@ -61,9 +61,9 @@ __webpack_require__.add({
61
61
  'sort'
62
62
  ].filter((fname)=>!!options[fname]).reduce((prev, fname)=>prev[fname](options[fname]), files).map(standardizeFilePaths);
63
63
  },
64
- "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.8/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
64
+ "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
65
65
  exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
66
- let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.8/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
66
+ let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
67
67
  let hooks = compilerHookMap.get(compiler);
68
68
  return void 0 === hooks && (hooks = {
69
69
  afterEmit: new lite_tapable_1.SyncWaterfallHook([
@@ -112,9 +112,9 @@ __webpack_require__.add({
112
112
  getCompilerHooks(compiler).afterEmit.call(manifest);
113
113
  };
114
114
  },
115
- "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.8/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
115
+ "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
116
116
  exports.RspackManifestPlugin = void 0;
117
- let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.8/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
117
+ let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
118
118
  assetHookStage: 1 / 0,
119
119
  basePath: '',
120
120
  fileName: 'manifest.json',
@@ -684,5 +684,5 @@ __webpack_require__.add({
684
684
  });
685
685
  }
686
686
  });
687
- var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.8/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
687
+ var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
688
688
  export { RspackManifestPlugin };
@@ -1,5 +1,8 @@
1
1
  import type { Logger } from '../logger';
2
2
  import type { CliShortcut, NormalizedConfig } from '../types/config';
3
+ type PrintUrlsHandler = (options?: {
4
+ showAllRoutes?: boolean;
5
+ }) => void;
3
6
  export declare const isCliShortcutsEnabled: (config: NormalizedConfig) => boolean;
4
7
  // Normalize user input so shortcuts are case-insensitive
5
8
  // and still work with accidental surrounding whitespace.
@@ -8,8 +11,9 @@ export declare function setupCliShortcuts({ help, openPage, closeServer, printUr
8
11
  help?: boolean | string;
9
12
  openPage: () => Promise<void>;
10
13
  closeServer: () => Promise<void>;
11
- printUrls: () => void;
14
+ printUrls: PrintUrlsHandler;
12
15
  restartServer?: () => Promise<boolean>;
13
16
  customShortcuts?: (shortcuts: CliShortcut[]) => CliShortcut[];
14
17
  logger: Logger;
15
18
  }): Promise<() => void>;
19
+ export { };
@@ -31,7 +31,7 @@ export declare const getRoutes: (context: InternalContext) => Routes;
31
31
  /*
32
32
  * format route by entry and adjust the index route to be the first
33
33
  */ export declare const formatRoutes: (entry: RsbuildEntry, base: string, distPathPrefix: string | undefined, outputStructure: OutputStructure | undefined) => Routes;
34
- export declare function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, fallbackPathname, trailingLineBreak, originalConfig, logger }: {
34
+ export declare function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, fallbackPathname, showAllRoutes, cliShortcutsEnabled, originalConfig, logger }: {
35
35
  urls: {
36
36
  url: string;
37
37
  label: string;
@@ -41,7 +41,8 @@ export declare function printServerURLs({ urls: originalUrls, port, routes, prot
41
41
  protocol: string;
42
42
  printUrls?: PrintUrls;
43
43
  fallbackPathname?: string;
44
- trailingLineBreak?: boolean;
44
+ showAllRoutes?: boolean;
45
+ cliShortcutsEnabled: boolean;
45
46
  originalConfig?: Readonly<RsbuildConfig>;
46
47
  logger: Logger;
47
48
  }): string | null;
@@ -255,12 +255,20 @@ export type HistoryApiFallbackOptions = {
255
255
  to: HistoryApiFallbackTo;
256
256
  }[];
257
257
  };
258
- export type PrintUrls = boolean | ((params: {
258
+ export type PrintUrlsParams = {
259
259
  urls: string[];
260
260
  port: number;
261
261
  routes: Routes;
262
262
  protocol: string;
263
- }) => (string | {
263
+ };
264
+ export type PrintUrlsOptions = {
265
+ /**
266
+ * The maximum number of entry URLs to print.
267
+ * Set to `0` to print only the server URL without entry routes.
268
+ * @default 10
269
+ */ maxRoutes?: number;
270
+ };
271
+ export type PrintUrls = boolean | PrintUrlsOptions | ((params: PrintUrlsParams) => (string | {
264
272
  url: string;
265
273
  label?: string;
266
274
  })[] | void);
@@ -563,7 +571,6 @@ export interface PerformanceConfig {
563
571
  */ removeConsole?: boolean | ConsoleType[];
564
572
  /**
565
573
  * To enable or configure persistent build cache.
566
- * @experimental This feature is experimental and may be changed in the future.
567
574
  * @default false
568
575
  */ buildCache?: BuildCacheOptions | boolean;
569
576
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.0.15",
3
+ "version": "2.1.0-beta.0",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -40,13 +40,13 @@
40
40
  "registry": "https://registry.npmjs.org/"
41
41
  },
42
42
  "dependencies": {
43
- "@rspack/core": "~2.0.8",
43
+ "@rspack/core": "~2.1.0-beta.0",
44
44
  "@swc/helpers": "^0.5.23"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jridgewell/remapping": "^2.3.5",
48
48
  "@jridgewell/trace-mapping": "^0.3.31",
49
- "@rslib/core": "0.22.1",
49
+ "@rslib/core": "0.23.0",
50
50
  "@types/cors": "^2.8.19",
51
51
  "@types/node": "^24.13.2",
52
52
  "@types/on-finished": "2.3.5",
@@ -62,7 +62,7 @@
62
62
  "deepmerge": "^4.3.1",
63
63
  "dotenv-expand": "^13.0.0",
64
64
  "html-rspack-plugin": "6.1.9",
65
- "http-proxy-middleware": "4.1.0",
65
+ "http-proxy-middleware": "4.1.1",
66
66
  "jiti": "^2.7.0",
67
67
  "launch-editor-middleware": "^2.14.1",
68
68
  "memfs": "^4.57.7",
@@ -76,7 +76,7 @@
76
76
  "range-parser": "^1.2.1",
77
77
  "reduce-configs": "^2.0.1",
78
78
  "rslog": "^2.1.3",
79
- "rspack-chain": "^2.1.0",
79
+ "rspack-chain": "^2.1.1",
80
80
  "rspack-manifest-plugin": "5.2.2",
81
81
  "rspack-merge": "1.0.1",
82
82
  "sirv": "^3.0.2",
File without changes
File without changes