@rsbuild/core 1.0.14 → 1.0.15

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,22 +1,22 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 3137: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 2358: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(4965);
5
+ const loader = __nccwpck_require__(536);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(3579).defaultGetLocalIdent;
8
+ __nccwpck_require__(9166).defaultGetLocalIdent;
9
9
  },
10
- 4965: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 536: (__unused_webpack_module, exports, __nccwpck_require__) => {
11
11
  "use strict";
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports["default"] = loader;
14
14
  var _postcss = _interopRequireDefault(__nccwpck_require__(9961));
15
15
  var _package = _interopRequireDefault(__nccwpck_require__(3360));
16
16
  var _semver = { satisfies: () => true };
17
- var _options = _interopRequireDefault(__nccwpck_require__(641));
18
- var _plugins = __nccwpck_require__(1442);
19
- var _utils = __nccwpck_require__(3579);
17
+ var _options = _interopRequireDefault(__nccwpck_require__(2438));
18
+ var _plugins = __nccwpck_require__(9490);
19
+ var _utils = __nccwpck_require__(9166);
20
20
  function _interopRequireDefault(obj) {
21
21
  return obj && obj.__esModule ? obj : { default: obj };
22
22
  }
@@ -243,7 +243,7 @@
243
243
  callback(null, `${importCode}${moduleCode}${exportCode}`);
244
244
  }
245
245
  },
246
- 1442: (__unused_webpack_module, exports, __nccwpck_require__) => {
246
+ 9490: (__unused_webpack_module, exports, __nccwpck_require__) => {
247
247
  "use strict";
248
248
  Object.defineProperty(exports, "__esModule", { value: true });
249
249
  Object.defineProperty(exports, "icssParser", {
@@ -265,22 +265,22 @@
265
265
  },
266
266
  });
267
267
  var _postcssImportParser = _interopRequireDefault(
268
- __nccwpck_require__(7400),
268
+ __nccwpck_require__(2782),
269
269
  );
270
270
  var _postcssIcssParser = _interopRequireDefault(
271
- __nccwpck_require__(7785),
271
+ __nccwpck_require__(1885),
272
272
  );
273
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(7710));
273
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(4908));
274
274
  function _interopRequireDefault(obj) {
275
275
  return obj && obj.__esModule ? obj : { default: obj };
276
276
  }
277
277
  },
278
- 7785: (__unused_webpack_module, exports, __nccwpck_require__) => {
278
+ 1885: (__unused_webpack_module, exports, __nccwpck_require__) => {
279
279
  "use strict";
280
280
  Object.defineProperty(exports, "__esModule", { value: true });
281
281
  exports["default"] = void 0;
282
282
  var _icssUtils = __nccwpck_require__(8406);
283
- var _utils = __nccwpck_require__(3579);
283
+ var _utils = __nccwpck_require__(9166);
284
284
  const plugin = (options = {}) => ({
285
285
  postcssPlugin: "postcss-icss-parser",
286
286
  async OnceExit(root) {
@@ -379,14 +379,14 @@
379
379
  plugin.postcss = true;
380
380
  var _default = (exports["default"] = plugin);
381
381
  },
382
- 7400: (__unused_webpack_module, exports, __nccwpck_require__) => {
382
+ 2782: (__unused_webpack_module, exports, __nccwpck_require__) => {
383
383
  "use strict";
384
384
  Object.defineProperty(exports, "__esModule", { value: true });
385
385
  exports["default"] = void 0;
386
386
  var _postcssValueParser = _interopRequireDefault(
387
387
  __nccwpck_require__(7555),
388
388
  );
389
- var _utils = __nccwpck_require__(3579);
389
+ var _utils = __nccwpck_require__(9166);
390
390
  function _interopRequireDefault(obj) {
391
391
  return obj && obj.__esModule ? obj : { default: obj };
392
392
  }
@@ -691,14 +691,14 @@
691
691
  plugin.postcss = true;
692
692
  var _default = (exports["default"] = plugin);
693
693
  },
694
- 7710: (__unused_webpack_module, exports, __nccwpck_require__) => {
694
+ 4908: (__unused_webpack_module, exports, __nccwpck_require__) => {
695
695
  "use strict";
696
696
  Object.defineProperty(exports, "__esModule", { value: true });
697
697
  exports["default"] = void 0;
698
698
  var _postcssValueParser = _interopRequireDefault(
699
699
  __nccwpck_require__(7555),
700
700
  );
701
- var _utils = __nccwpck_require__(3579);
701
+ var _utils = __nccwpck_require__(9166);
702
702
  function _interopRequireDefault(obj) {
703
703
  return obj && obj.__esModule ? obj : { default: obj };
704
704
  }
@@ -1041,7 +1041,7 @@
1041
1041
  plugin.postcss = true;
1042
1042
  var _default = (exports["default"] = plugin);
1043
1043
  },
1044
- 3579: (__unused_webpack_module, exports, __nccwpck_require__) => {
1044
+ 9166: (__unused_webpack_module, exports, __nccwpck_require__) => {
1045
1045
  "use strict";
1046
1046
  Object.defineProperty(exports, "__esModule", { value: true });
1047
1047
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -7960,7 +7960,7 @@
7960
7960
  "use strict";
7961
7961
  module.exports = require("util");
7962
7962
  },
7963
- 641: (module) => {
7963
+ 2438: (module) => {
7964
7964
  "use strict";
7965
7965
  module.exports = JSON.parse(
7966
7966
  '{"title":"CSS Loader options","additionalProperties":false,"properties":{"url":{"description":"Allows to enables/disables `url()`/`image-set()` functions handling.","link":"https://github.com/webpack-contrib/css-loader#url","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"import":{"description":"Allows to enables/disables `@import` at-rules handling.","link":"https://github.com/webpack-contrib/css-loader#import","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"modules":{"description":"Allows to enable/disable CSS Modules or ICSS and setup configuration.","link":"https://github.com/webpack-contrib/css-loader#modules","anyOf":[{"type":"boolean"},{"enum":["local","global","pure","icss"]},{"type":"object","additionalProperties":false,"properties":{"auto":{"description":"Allows auto enable CSS modules based on filename.","link":"https://github.com/webpack-contrib/css-loader#auto","anyOf":[{"instanceof":"RegExp"},{"instanceof":"Function"},{"type":"boolean"}]},"mode":{"description":"Setup `mode` option.","link":"https://github.com/webpack-contrib/css-loader#mode","anyOf":[{"enum":["local","global","pure","icss"]},{"instanceof":"Function"}]},"localIdentName":{"description":"Allows to configure the generated local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentname","type":"string","minLength":1},"localIdentContext":{"description":"Allows to redefine basic loader context for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentcontext","type":"string","minLength":1},"localIdentHashSalt":{"description":"Allows to add custom hash to generate more unique classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashsalt","type":"string","minLength":1},"localIdentHashFunction":{"description":"Allows to specify hash function to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashfunction","type":"string","minLength":1},"localIdentHashDigest":{"description":"Allows to specify hash digest to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigest","type":"string","minLength":1},"localIdentHashDigestLength":{"description":"Allows to specify hash digest length to generate classes.","link":"https://github.com/webpack-contrib/css-loader#localidenthashdigestlength","type":"number"},"hashStrategy":{"description":"Allows to specify should localName be used when computing the hash.","link":"https://github.com/webpack-contrib/css-loader#hashstrategy","enum":["resource-path-and-local-name","minimal-subset"]},"localIdentRegExp":{"description":"Allows to specify custom RegExp for local ident name.","link":"https://github.com/webpack-contrib/css-loader#localidentregexp","anyOf":[{"type":"string","minLength":1},{"instanceof":"RegExp"}]},"getLocalIdent":{"description":"Allows to specify a function to generate the classname.","link":"https://github.com/webpack-contrib/css-loader#getlocalident","instanceof":"Function"},"namedExport":{"description":"Enables/disables ES modules named export for locals.","link":"https://github.com/webpack-contrib/css-loader#namedexport","type":"boolean"},"exportGlobals":{"description":"Allows to export names from global class or id, so you can use that as local name.","link":"https://github.com/webpack-contrib/css-loader#exportglobals","type":"boolean"},"exportLocalsConvention":{"description":"Style of exported classnames.","link":"https://github.com/webpack-contrib/css-loader#localsconvention","anyOf":[{"enum":["asIs","as-is","camelCase","camel-case","camelCaseOnly","camel-case-only","dashes","dashesOnly","dashes-only"]},{"instanceof":"Function"}]},"exportOnlyLocals":{"description":"Export only locals.","link":"https://github.com/webpack-contrib/css-loader#exportonlylocals","type":"boolean"},"getJSON":{"description":"Allows outputting of CSS modules mapping through a callback.","link":"https://github.com/webpack-contrib/css-loader#getJSON","instanceof":"Function"}}}]},"sourceMap":{"description":"Allows to enable/disable source maps.","link":"https://github.com/webpack-contrib/css-loader#sourcemap","type":"boolean"},"importLoaders":{"description":"Allows enables/disables or setups number of loaders applied before CSS loader for `@import`/CSS Modules and ICSS imports.","link":"https://github.com/webpack-contrib/css-loader#importloaders","anyOf":[{"type":"boolean"},{"type":"string"},{"type":"integer"}]},"esModule":{"description":"Use the ES modules syntax.","link":"https://github.com/webpack-contrib/css-loader#esmodule","type":"boolean"},"exportType":{"description":"Allows exporting styles as array with modules, string or constructable stylesheet (i.e. `CSSStyleSheet`).","link":"https://github.com/webpack-contrib/css-loader#exporttype","enum":["array","string","css-style-sheet"]}},"type":"object"}',
@@ -7995,6 +7995,6 @@
7995
7995
  }
7996
7996
  if (typeof __nccwpck_require__ !== "undefined")
7997
7997
  __nccwpck_require__.ab = __dirname + "/";
7998
- var __webpack_exports__ = __nccwpck_require__(3137);
7998
+ var __webpack_exports__ = __nccwpck_require__(2358);
7999
7999
  module.exports = __webpack_exports__;
8000
8000
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 440: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 241: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(303);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(361);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -304,7 +304,7 @@
304
304
  }
305
305
  module.exports = { CachedChildCompilation };
306
306
  },
307
- 303: (module) => {
307
+ 361: (module) => {
308
308
  "use strict";
309
309
  class HtmlWebpackChildCompiler {
310
310
  constructor(templates) {
@@ -473,7 +473,7 @@
473
473
  }
474
474
  module.exports = { HtmlWebpackChildCompiler };
475
475
  },
476
- 368: (module) => {
476
+ 479: (module) => {
477
477
  "use strict";
478
478
  module.exports = {};
479
479
  module.exports.none = (chunks) => chunks;
@@ -492,7 +492,7 @@
492
492
  };
493
493
  module.exports.auto = module.exports.none;
494
494
  },
495
- 419: (module) => {
495
+ 135: (module) => {
496
496
  "use strict";
497
497
  module.exports = function (err) {
498
498
  return {
@@ -513,7 +513,7 @@
513
513
  };
514
514
  };
515
515
  },
516
- 556: (module, __unused_webpack_exports, __nccwpck_require__) => {
516
+ 935: (module, __unused_webpack_exports, __nccwpck_require__) => {
517
517
  "use strict";
518
518
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(348);
519
519
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -539,7 +539,7 @@
539
539
  }
540
540
  module.exports = { getHtmlRspackPluginHooks };
541
541
  },
542
- 972: (module) => {
542
+ 697: (module) => {
543
543
  const voidTags = [
544
544
  "area",
545
545
  "base",
@@ -607,19 +607,19 @@
607
607
  htmlTagObjectToString,
608
608
  };
609
609
  },
610
- 160: (module, __unused_webpack_exports, __nccwpck_require__) => {
610
+ 922: (module, __unused_webpack_exports, __nccwpck_require__) => {
611
611
  "use strict";
612
612
  const promisify = __nccwpck_require__(837).promisify;
613
613
  const vm = __nccwpck_require__(144);
614
614
  const fs = __nccwpck_require__(147);
615
615
  const path = __nccwpck_require__(17);
616
- const { CachedChildCompilation } = __nccwpck_require__(440);
616
+ const { CachedChildCompilation } = __nccwpck_require__(241);
617
617
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
618
- __nccwpck_require__(972);
619
- const prettyError = __nccwpck_require__(419);
620
- const chunkSorter = __nccwpck_require__(368);
618
+ __nccwpck_require__(697);
619
+ const prettyError = __nccwpck_require__(135);
620
+ const chunkSorter = __nccwpck_require__(479);
621
621
  const getHtmlRspackPluginHooks =
622
- __nccwpck_require__(556).getHtmlRspackPluginHooks;
622
+ __nccwpck_require__(935).getHtmlRspackPluginHooks;
623
623
  class HtmlRspackPlugin {
624
624
  constructor(userOptions = {}) {
625
625
  this.version = HtmlRspackPlugin.version;
@@ -1577,6 +1577,6 @@
1577
1577
  }
1578
1578
  if (typeof __nccwpck_require__ !== "undefined")
1579
1579
  __nccwpck_require__.ab = __dirname + "/";
1580
- var __webpack_exports__ = __nccwpck_require__(160);
1580
+ var __webpack_exports__ = __nccwpck_require__(922);
1581
1581
  module.exports = __webpack_exports__;
1582
1582
  })();
@@ -1,17 +1,17 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 429: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(171)["default"];
4
+ 533: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(646)["default"];
6
6
  },
7
- 171: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 646: (__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 _path = _interopRequireDefault(__nccwpck_require__(17));
12
12
  var _package = _interopRequireDefault(__nccwpck_require__(360));
13
- var _options = _interopRequireDefault(__nccwpck_require__(244));
14
- var _utils = __nccwpck_require__(990);
13
+ var _options = _interopRequireDefault(__nccwpck_require__(839));
14
+ var _utils = __nccwpck_require__(107);
15
15
  function _interopRequireDefault(obj) {
16
16
  return obj && obj.__esModule ? obj : { default: obj };
17
17
  }
@@ -189,7 +189,7 @@
189
189
  callback(null, result.css, map, { ast });
190
190
  }
191
191
  },
192
- 990: (module, exports, __nccwpck_require__) => {
192
+ 107: (module, exports, __nccwpck_require__) => {
193
193
  module = __nccwpck_require__.nmd(module);
194
194
  Object.defineProperty(exports, "__esModule", { value: true });
195
195
  exports.exec = exec;
@@ -691,7 +691,7 @@
691
691
  310: (module) => {
692
692
  module.exports = require("url");
693
693
  },
694
- 244: (module) => {
694
+ 839: (module) => {
695
695
  module.exports = JSON.parse(
696
696
  '{"title":"PostCSS Loader options","type":"object","properties":{"postcssOptions":{"description":"Options to pass through to `Postcss`.","link":"https://github.com/webpack-contrib/postcss-loader#postcssOptions","anyOf":[{"type":"object","additionalProperties":true,"properties":{"config":{"description":"Allows to specify PostCSS config path.","link":"https://github.com/webpack-contrib/postcss-loader#config","anyOf":[{"description":"Allows to specify the path to the configuration file","type":"string"},{"description":"Enables/Disables autoloading config","type":"boolean"}]}}},{"instanceof":"Function"}]},"execute":{"description":"Enables/Disables PostCSS parser support in \'CSS-in-JS\'.","link":"https://github.com/webpack-contrib/postcss-loader#execute","type":"boolean"},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/postcss-loader#sourcemap","type":"boolean"},"implementation":{"description":"The implementation of postcss to use, instead of the locally installed version","link":"https://github.com/webpack-contrib/postcss-loader#implementation","anyOf":[{"type":"string"},{"instanceof":"Function"}]}},"additionalProperties":false}',
697
697
  );
@@ -736,6 +736,6 @@
736
736
  })();
737
737
  if (typeof __nccwpck_require__ !== "undefined")
738
738
  __nccwpck_require__.ab = __dirname + "/";
739
- var __webpack_exports__ = __nccwpck_require__(429);
739
+ var __webpack_exports__ = __nccwpck_require__(533);
740
740
  module.exports = __webpack_exports__;
741
741
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 213: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 376: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.transformFiles =
7
7
  exports.reduceChunk =
@@ -120,7 +120,7 @@
120
120
  .map(standardizeFilePaths);
121
121
  exports.transformFiles = transformFiles;
122
122
  },
123
- 673: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 317: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
124
  Object.defineProperty(exports, "__esModule", { value: true });
125
125
  exports.normalModuleLoaderHook =
126
126
  exports.getCompilerHooks =
@@ -130,7 +130,7 @@
130
130
  const fs_1 = __nccwpck_require__(147);
131
131
  const path_1 = __nccwpck_require__(17);
132
132
  const lite_tapable_1 = __nccwpck_require__(348);
133
- const helpers_1 = __nccwpck_require__(213);
133
+ const helpers_1 = __nccwpck_require__(376);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -312,7 +312,7 @@
312
312
  exports.getCompilerHooks =
313
313
  void 0;
314
314
  const path_1 = __nccwpck_require__(17);
315
- const hooks_1 = __nccwpck_require__(673);
315
+ const hooks_1 = __nccwpck_require__(317);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
package/dist/index.cjs CHANGED
@@ -4894,11 +4894,13 @@ function loadEnv({
4894
4894
  }
4895
4895
  (0, import_dotenv_expand.expand)({ parsed });
4896
4896
  const publicVars = {};
4897
+ const rawPublicVars = {};
4897
4898
  for (const key of Object.keys(process.env)) {
4898
4899
  if (prefixes.some((prefix) => key.startsWith(prefix))) {
4899
4900
  const val = process.env[key];
4900
4901
  publicVars[`import.meta.env.${key}`] = JSON.stringify(val);
4901
4902
  publicVars[`process.env.${key}`] = JSON.stringify(val);
4903
+ rawPublicVars[key] = val;
4902
4904
  }
4903
4905
  }
4904
4906
  let cleaned = false;
@@ -4920,7 +4922,8 @@ function loadEnv({
4920
4922
  parsed,
4921
4923
  cleanup,
4922
4924
  filePaths,
4923
- publicVars
4925
+ publicVars,
4926
+ rawPublicVars
4924
4927
  };
4925
4928
  }
4926
4929
  var import_node_fs3, import_node_path7, import_dotenv, import_dotenv_expand;
@@ -6015,7 +6018,7 @@ async function createContext(options, userConfig, bundlerType) {
6015
6018
  const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
6016
6019
  const cachePath = (0, import_node_path10.join)(rootPath, "node_modules", ".cache");
6017
6020
  return {
6018
- version: "1.0.14",
6021
+ version: "1.0.15",
6019
6022
  rootPath,
6020
6023
  distPath: "",
6021
6024
  cachePath,
@@ -7415,11 +7418,12 @@ var init_environment = __esm({
7415
7418
 
7416
7419
  // src/server/helper.ts
7417
7420
  function getURLMessages(urls, routes) {
7418
- if (routes.length === 1) {
7421
+ if (routes.length <= 1) {
7422
+ const pathname = routes.length ? routes[0].pathname : "";
7419
7423
  return urls.map(({ label, url: url2 }) => {
7420
- const pathname = normalizeUrl(`${url2}${routes[0].pathname}`);
7424
+ const normalizedPathname = normalizeUrl(`${url2}${pathname}`);
7421
7425
  const prefix = `➜ ${import_picocolors11.default.dim(label.padEnd(10))}`;
7422
- return ` ${prefix}${import_picocolors11.default.cyan(pathname)}
7426
+ return ` ${prefix}${import_picocolors11.default.cyan(normalizedPathname)}
7423
7427
  `;
7424
7428
  }).join("");
7425
7429
  }
@@ -7452,7 +7456,8 @@ function printServerURLs({
7452
7456
  return null;
7453
7457
  }
7454
7458
  let urls = originalUrls;
7455
- if (isFunction(printUrls)) {
7459
+ const useCustomUrl = isFunction(printUrls);
7460
+ if (useCustomUrl) {
7456
7461
  const newUrls = printUrls({
7457
7462
  urls: urls.map((item) => item.url),
7458
7463
  port,
@@ -7472,7 +7477,10 @@ function printServerURLs({
7472
7477
  label: getUrlLabel(url2)
7473
7478
  }));
7474
7479
  }
7475
- if (urls.length === 0 || routes.length === 0) {
7480
+ if (urls.length === 0) {
7481
+ return null;
7482
+ }
7483
+ if (routes.length === 0 && !useCustomUrl) {
7476
7484
  return null;
7477
7485
  }
7478
7486
  let message = getURLMessages(urls, routes);
@@ -13556,7 +13564,7 @@ var init_init = __esm({
13556
13564
 
13557
13565
  // src/cli/commands.ts
13558
13566
  function runCli() {
13559
- program.name("rsbuild").usage("<command> [options]").version("1.0.14");
13567
+ program.name("rsbuild").usage("<command> [options]").version("1.0.15");
13560
13568
  const devCommand = program.command("dev");
13561
13569
  const buildCommand = program.command("build");
13562
13570
  const previewCommand = program.command("preview");
@@ -13665,7 +13673,7 @@ function prepareCli() {
13665
13673
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
13666
13674
  console.log();
13667
13675
  }
13668
- import_rslog.logger.greet(` ${`Rsbuild v${"1.0.14"}`}
13676
+ import_rslog.logger.greet(` ${`Rsbuild v${"1.0.15"}`}
13669
13677
  `);
13670
13678
  }
13671
13679
  var import_node_module;
@@ -13751,7 +13759,7 @@ init_logger();
13751
13759
  init_mergeConfig();
13752
13760
  init_helpers();
13753
13761
  init_constants();
13754
- var version = "1.0.14";
13762
+ var version = "1.0.15";
13755
13763
  // Annotate the CommonJS export names for ESM import in node:
13756
13764
  0 && (module.exports = {
13757
13765
  PLUGIN_CSS_NAME,
package/dist/index.js CHANGED
@@ -4939,11 +4939,13 @@ function loadEnv({
4939
4939
  }
4940
4940
  (0, import_dotenv_expand.expand)({ parsed });
4941
4941
  const publicVars = {};
4942
+ const rawPublicVars = {};
4942
4943
  for (const key of Object.keys(process.env)) {
4943
4944
  if (prefixes.some((prefix) => key.startsWith(prefix))) {
4944
4945
  const val = process.env[key];
4945
4946
  publicVars[`import.meta.env.${key}`] = JSON.stringify(val);
4946
4947
  publicVars[`process.env.${key}`] = JSON.stringify(val);
4948
+ rawPublicVars[key] = val;
4947
4949
  }
4948
4950
  }
4949
4951
  let cleaned = false;
@@ -4965,7 +4967,8 @@ function loadEnv({
4965
4967
  parsed,
4966
4968
  cleanup,
4967
4969
  filePaths,
4968
- publicVars
4970
+ publicVars,
4971
+ rawPublicVars
4969
4972
  };
4970
4973
  }
4971
4974
  var import_dotenv, import_dotenv_expand;
@@ -6064,7 +6067,7 @@ async function createContext(options, userConfig, bundlerType) {
6064
6067
  const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
6065
6068
  const cachePath = join6(rootPath, "node_modules", ".cache");
6066
6069
  return {
6067
- version: "1.0.14",
6070
+ version: "1.0.15",
6068
6071
  rootPath,
6069
6072
  distPath: "",
6070
6073
  cachePath,
@@ -7481,11 +7484,12 @@ import os from "os";
7481
7484
  import { posix as posix3 } from "path";
7482
7485
  import color11 from "../compiled/picocolors/index.js";
7483
7486
  function getURLMessages(urls, routes) {
7484
- if (routes.length === 1) {
7487
+ if (routes.length <= 1) {
7488
+ const pathname = routes.length ? routes[0].pathname : "";
7485
7489
  return urls.map(({ label, url: url2 }) => {
7486
- const pathname = normalizeUrl(`${url2}${routes[0].pathname}`);
7490
+ const normalizedPathname = normalizeUrl(`${url2}${pathname}`);
7487
7491
  const prefix = `➜ ${color11.dim(label.padEnd(10))}`;
7488
- return ` ${prefix}${color11.cyan(pathname)}
7492
+ return ` ${prefix}${color11.cyan(normalizedPathname)}
7489
7493
  `;
7490
7494
  }).join("");
7491
7495
  }
@@ -7518,7 +7522,8 @@ function printServerURLs({
7518
7522
  return null;
7519
7523
  }
7520
7524
  let urls = originalUrls;
7521
- if (isFunction(printUrls)) {
7525
+ const useCustomUrl = isFunction(printUrls);
7526
+ if (useCustomUrl) {
7522
7527
  const newUrls = printUrls({
7523
7528
  urls: urls.map((item) => item.url),
7524
7529
  port,
@@ -7538,7 +7543,10 @@ function printServerURLs({
7538
7543
  label: getUrlLabel(url2)
7539
7544
  }));
7540
7545
  }
7541
- if (urls.length === 0 || routes.length === 0) {
7546
+ if (urls.length === 0) {
7547
+ return null;
7548
+ }
7549
+ if (routes.length === 0 && !useCustomUrl) {
7542
7550
  return null;
7543
7551
  }
7544
7552
  let message = getURLMessages(urls, routes);
@@ -13674,7 +13682,7 @@ var init_init = __esm({
13674
13682
 
13675
13683
  // src/cli/commands.ts
13676
13684
  function runCli() {
13677
- program.name("rsbuild").usage("<command> [options]").version("1.0.14");
13685
+ program.name("rsbuild").usage("<command> [options]").version("1.0.15");
13678
13686
  const devCommand = program.command("dev");
13679
13687
  const buildCommand = program.command("build");
13680
13688
  const previewCommand = program.command("preview");
@@ -13785,7 +13793,7 @@ function prepareCli() {
13785
13793
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
13786
13794
  console.log();
13787
13795
  }
13788
- logger.greet(` ${`Rsbuild v${"1.0.14"}`}
13796
+ logger.greet(` ${`Rsbuild v${"1.0.15"}`}
13789
13797
  `);
13790
13798
  }
13791
13799
  var init_prepare = __esm({
@@ -13856,7 +13864,7 @@ init_mergeConfig();
13856
13864
  init_helpers();
13857
13865
  init_constants();
13858
13866
  import { rspack as rspack10 } from "@rspack/core";
13859
- var version = "1.0.14";
13867
+ var version = "1.0.15";
13860
13868
  export {
13861
13869
  PLUGIN_CSS_NAME,
13862
13870
  PLUGIN_SWC_NAME,
@@ -16,12 +16,35 @@ export type LoadEnvOptions = {
16
16
  prefixes?: string[];
17
17
  };
18
18
  export declare function loadEnv({ cwd, mode, prefixes, }?: LoadEnvOptions): {
19
- /** All environment variables in the .env file */
19
+ /** All env variables in the .env file */
20
20
  parsed: Record<string, string>;
21
21
  /** The absolute paths to all env files */
22
22
  filePaths: string[];
23
- /** Environment variables that start with prefixes */
23
+ /**
24
+ * Env variables that start with prefixes.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * {
29
+ * PUBLIC_FOO: 'bar',
30
+ * }
31
+ * ```
32
+ **/
33
+ rawPublicVars: Record<string, string | undefined>;
34
+ /**
35
+ * Formatted env variables that start with prefixes.
36
+ * The keys contain the prefixes `process.env.*` and `import.meta.env.*`.
37
+ * The values are processed by `JSON.stringify`.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * {
42
+ * 'process.env.PUBLIC_FOO': '"bar"',
43
+ * 'import.meta.env.PUBLIC_FOO': '"bar"',
44
+ * }
45
+ * ```
46
+ **/
24
47
  publicVars: Record<string, string>;
25
- /** Clear the environment variables mounted on `process.env` */
48
+ /** Clear the env variables mounted on `process.env` */
26
49
  cleanup: () => void;
27
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,7 +46,7 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "~1.0.10",
49
+ "@rspack/core": "~1.0.13",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.13",
52
52
  "core-js": "~3.38.1"