@rsbuild/core 1.2.9 → 1.2.10

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,19 +1,19 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 7875: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 1955: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(749);
5
+ const loader = __nccwpck_require__(989);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(5336).defaultGetLocalIdent;
8
+ __nccwpck_require__(4808).defaultGetLocalIdent;
9
9
  },
10
- 749: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 989: (__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__(9409));
15
- var _plugins = __nccwpck_require__(9842);
16
- var _utils = __nccwpck_require__(5336);
15
+ var _plugins = __nccwpck_require__(642);
16
+ var _utils = __nccwpck_require__(4808);
17
17
  function _interopRequireDefault(obj) {
18
18
  return obj && obj.__esModule ? obj : { default: obj };
19
19
  }
@@ -236,7 +236,7 @@
236
236
  callback(null, `${importCode}${moduleCode}${exportCode}`);
237
237
  }
238
238
  },
239
- 9842: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 642: (__unused_webpack_module, exports, __nccwpck_require__) => {
240
240
  "use strict";
241
241
  Object.defineProperty(exports, "__esModule", { value: true });
242
242
  Object.defineProperty(exports, "icssParser", {
@@ -258,22 +258,22 @@
258
258
  },
259
259
  });
260
260
  var _postcssImportParser = _interopRequireDefault(
261
- __nccwpck_require__(9137),
261
+ __nccwpck_require__(3265),
262
262
  );
263
263
  var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(4952),
264
+ __nccwpck_require__(2328),
265
265
  );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(7935));
266
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(4607));
267
267
  function _interopRequireDefault(obj) {
268
268
  return obj && obj.__esModule ? obj : { default: obj };
269
269
  }
270
270
  },
271
- 4952: (__unused_webpack_module, exports, __nccwpck_require__) => {
271
+ 2328: (__unused_webpack_module, exports, __nccwpck_require__) => {
272
272
  "use strict";
273
273
  Object.defineProperty(exports, "__esModule", { value: true });
274
274
  exports["default"] = void 0;
275
275
  var _icssUtils = __nccwpck_require__(5032);
276
- var _utils = __nccwpck_require__(5336);
276
+ var _utils = __nccwpck_require__(4808);
277
277
  const plugin = (options = {}) => ({
278
278
  postcssPlugin: "postcss-icss-parser",
279
279
  async OnceExit(root) {
@@ -372,14 +372,14 @@
372
372
  plugin.postcss = true;
373
373
  var _default = (exports["default"] = plugin);
374
374
  },
375
- 9137: (__unused_webpack_module, exports, __nccwpck_require__) => {
375
+ 3265: (__unused_webpack_module, exports, __nccwpck_require__) => {
376
376
  "use strict";
377
377
  Object.defineProperty(exports, "__esModule", { value: true });
378
378
  exports["default"] = void 0;
379
379
  var _postcssValueParser = _interopRequireDefault(
380
380
  __nccwpck_require__(2948),
381
381
  );
382
- var _utils = __nccwpck_require__(5336);
382
+ var _utils = __nccwpck_require__(4808);
383
383
  function _interopRequireDefault(obj) {
384
384
  return obj && obj.__esModule ? obj : { default: obj };
385
385
  }
@@ -684,14 +684,14 @@
684
684
  plugin.postcss = true;
685
685
  var _default = (exports["default"] = plugin);
686
686
  },
687
- 7935: (__unused_webpack_module, exports, __nccwpck_require__) => {
687
+ 4607: (__unused_webpack_module, exports, __nccwpck_require__) => {
688
688
  "use strict";
689
689
  Object.defineProperty(exports, "__esModule", { value: true });
690
690
  exports["default"] = void 0;
691
691
  var _postcssValueParser = _interopRequireDefault(
692
692
  __nccwpck_require__(2948),
693
693
  );
694
- var _utils = __nccwpck_require__(5336);
694
+ var _utils = __nccwpck_require__(4808);
695
695
  function _interopRequireDefault(obj) {
696
696
  return obj && obj.__esModule ? obj : { default: obj };
697
697
  }
@@ -1034,7 +1034,7 @@
1034
1034
  plugin.postcss = true;
1035
1035
  var _default = (exports["default"] = plugin);
1036
1036
  },
1037
- 5336: (__unused_webpack_module, exports, __nccwpck_require__) => {
1037
+ 4808: (__unused_webpack_module, exports, __nccwpck_require__) => {
1038
1038
  "use strict";
1039
1039
  Object.defineProperty(exports, "__esModule", { value: true });
1040
1040
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -7984,6 +7984,6 @@
7984
7984
  }
7985
7985
  if (typeof __nccwpck_require__ !== "undefined")
7986
7986
  __nccwpck_require__.ab = __dirname + "/";
7987
- var __webpack_exports__ = __nccwpck_require__(7875);
7987
+ var __webpack_exports__ = __nccwpck_require__(1955);
7988
7988
  module.exports = __webpack_exports__;
7989
7989
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 516: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 986: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(481);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(955);
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
- 481: (module) => {
307
+ 955: (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
- 327: (module) => {
476
+ 913: (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
- 130: (module) => {
495
+ 672: (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
- 641: (module, __unused_webpack_exports, __nccwpck_require__) => {
516
+ 871: (module, __unused_webpack_exports, __nccwpck_require__) => {
517
517
  "use strict";
518
518
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
519
519
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -539,7 +539,7 @@
539
539
  }
540
540
  module.exports = { getHtmlRspackPluginHooks };
541
541
  },
542
- 248: (module) => {
542
+ 638: (module) => {
543
543
  const voidTags = [
544
544
  "area",
545
545
  "base",
@@ -607,19 +607,19 @@
607
607
  htmlTagObjectToString,
608
608
  };
609
609
  },
610
- 181: (module, __unused_webpack_exports, __nccwpck_require__) => {
610
+ 791: (module, __unused_webpack_exports, __nccwpck_require__) => {
611
611
  "use strict";
612
612
  const promisify = __nccwpck_require__(23).promisify;
613
613
  const vm = __nccwpck_require__(154);
614
614
  const fs = __nccwpck_require__(896);
615
615
  const path = __nccwpck_require__(928);
616
- const { CachedChildCompilation } = __nccwpck_require__(516);
616
+ const { CachedChildCompilation } = __nccwpck_require__(986);
617
617
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
618
- __nccwpck_require__(248);
619
- const prettyError = __nccwpck_require__(130);
620
- const chunkSorter = __nccwpck_require__(327);
618
+ __nccwpck_require__(638);
619
+ const prettyError = __nccwpck_require__(672);
620
+ const chunkSorter = __nccwpck_require__(913);
621
621
  const getHtmlRspackPluginHooks =
622
- __nccwpck_require__(641).getHtmlRspackPluginHooks;
622
+ __nccwpck_require__(871).getHtmlRspackPluginHooks;
623
623
  class HtmlRspackPlugin {
624
624
  constructor(userOptions = {}) {
625
625
  this.version = HtmlRspackPlugin.version;
@@ -1578,6 +1578,6 @@
1578
1578
  }
1579
1579
  if (typeof __nccwpck_require__ !== "undefined")
1580
1580
  __nccwpck_require__.ab = __dirname + "/";
1581
- var __webpack_exports__ = __nccwpck_require__(181);
1581
+ var __webpack_exports__ = __nccwpck_require__(791);
1582
1582
  module.exports = __webpack_exports__;
1583
1583
  })();
@@ -1,9 +1,9 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 680: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 285: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  const url = __nccwpck_require__(16);
5
5
  const path = __nccwpck_require__(928);
6
- const launch = __nccwpck_require__(506);
6
+ const launch = __nccwpck_require__(83);
7
7
  module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
8
8
  if (typeof specifiedEditor === "function") {
9
9
  onErrorCallback = specifiedEditor;
@@ -32,7 +32,7 @@
32
32
  };
33
33
  };
34
34
  },
35
- 991: (module) => {
35
+ 406: (module) => {
36
36
  module.exports = {
37
37
  atom: "atom",
38
38
  Brackets: "brackets",
@@ -60,7 +60,7 @@
60
60
  "rider.sh": "rider",
61
61
  };
62
62
  },
63
- 748: (module) => {
63
+ 461: (module) => {
64
64
  module.exports = {
65
65
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
66
66
  "/Applications/Atom Beta.app/Contents/MacOS/Atom Beta":
@@ -107,12 +107,13 @@
107
107
  "/Applications/Zed.app/Contents/MacOS/zed": "zed",
108
108
  };
109
109
  },
110
- 444: (module) => {
110
+ 773: (module) => {
111
111
  module.exports = [
112
112
  "Brackets.exe",
113
113
  "Code.exe",
114
114
  "Code - Insiders.exe",
115
115
  "VSCodium.exe",
116
+ "Cursor.exe",
116
117
  "atom.exe",
117
118
  "sublime_text.exe",
118
119
  "notepad++.exe",
@@ -134,7 +135,7 @@
134
135
  "rider64.exe",
135
136
  ];
136
137
  },
137
- 302: (module, __unused_webpack_exports, __nccwpck_require__) => {
138
+ 673: (module, __unused_webpack_exports, __nccwpck_require__) => {
138
139
  const path = __nccwpck_require__(928);
139
140
  module.exports = function getArgumentsForPosition(
140
141
  editor,
@@ -205,13 +206,13 @@
205
206
  return [fileName];
206
207
  };
207
208
  },
208
- 215: (module, __unused_webpack_exports, __nccwpck_require__) => {
209
+ 758: (module, __unused_webpack_exports, __nccwpck_require__) => {
209
210
  const path = __nccwpck_require__(928);
210
211
  const shellQuote = __nccwpck_require__(32);
211
212
  const childProcess = __nccwpck_require__(317);
212
- const COMMON_EDITORS_MACOS = __nccwpck_require__(748);
213
- const COMMON_EDITORS_LINUX = __nccwpck_require__(991);
214
- const COMMON_EDITORS_WIN = __nccwpck_require__(444);
213
+ const COMMON_EDITORS_MACOS = __nccwpck_require__(461);
214
+ const COMMON_EDITORS_LINUX = __nccwpck_require__(406);
215
+ const COMMON_EDITORS_WIN = __nccwpck_require__(773);
215
216
  module.exports = function guessEditor(specifiedEditor) {
216
217
  if (specifiedEditor) {
217
218
  return shellQuote.parse(specifiedEditor);
@@ -253,7 +254,10 @@
253
254
  } else if (process.platform === "win32") {
254
255
  const output = childProcess
255
256
  .execSync(
256
- 'powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"',
257
+ 'powershell -NoProfile -Command "' +
258
+ "[Console]::OutputEncoding=[Text.Encoding]::UTF8;" +
259
+ 'Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }' +
260
+ '"',
257
261
  { stdio: ["pipe", "pipe", "ignore"] },
258
262
  )
259
263
  .toString();
@@ -288,14 +292,14 @@
288
292
  return [null];
289
293
  };
290
294
  },
291
- 506: (module, __unused_webpack_exports, __nccwpck_require__) => {
295
+ 83: (module, __unused_webpack_exports, __nccwpck_require__) => {
292
296
  const fs = __nccwpck_require__(896);
293
297
  const os = __nccwpck_require__(857);
294
298
  const path = __nccwpck_require__(928);
295
299
  const colors = __nccwpck_require__(717);
296
300
  const childProcess = __nccwpck_require__(317);
297
- const guessEditor = __nccwpck_require__(215);
298
- const getArgumentsForPosition = __nccwpck_require__(302);
301
+ const guessEditor = __nccwpck_require__(758);
302
+ const getArgumentsForPosition = __nccwpck_require__(673);
299
303
  function wrapErrorCallback(cb) {
300
304
  return (fileName, errorMessage) => {
301
305
  console.log();
@@ -329,6 +333,9 @@
329
333
  }
330
334
  const positionRE = /:(\d+)(:(\d+))?$/;
331
335
  function parseFile(file) {
336
+ if (file.startsWith("file://")) {
337
+ file = __nccwpck_require__(16).fileURLToPath(file);
338
+ }
332
339
  const fileName = file.replace(positionRE, "");
333
340
  const match = file.match(positionRE);
334
341
  const lineNumber = match && match[1];
@@ -689,6 +696,6 @@
689
696
  }
690
697
  if (typeof __nccwpck_require__ !== "undefined")
691
698
  __nccwpck_require__.ab = __dirname + "/";
692
- var __webpack_exports__ = __nccwpck_require__(680);
699
+ var __webpack_exports__ = __nccwpck_require__(285);
693
700
  module.exports = __webpack_exports__;
694
701
  })();
@@ -1 +1 @@
1
- {"name":"launch-editor-middleware","author":"Evan You","version":"2.9.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"launch-editor-middleware","author":"Evan You","version":"2.10.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 639: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(185)["default"];
4
+ 292: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(194)["default"];
6
6
  },
7
- 185: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 194: (__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__(928));
12
- var _utils = __nccwpck_require__(716);
12
+ var _utils = __nccwpck_require__(131);
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : { default: obj };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 716: (module, exports, __nccwpck_require__) => {
182
+ 131: (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__(639);
719
+ var __webpack_exports__ = __nccwpck_require__(292);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 613: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 427: (__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
- 600: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 262: (__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__(896);
131
131
  const path_1 = __nccwpck_require__(928);
132
132
  const lite_tapable_1 = __nccwpck_require__(408);
133
- const helpers_1 = __nccwpck_require__(613);
133
+ const helpers_1 = __nccwpck_require__(427);
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__(928);
315
- const hooks_1 = __nccwpck_require__(600);
315
+ const hooks_1 = __nccwpck_require__(262);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
package/dist/index.cjs CHANGED
@@ -919,7 +919,7 @@ var __webpack_exports__ = {};
919
919
  async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
920
920
  cliOptions && (commonOpts = cliOptions);
921
921
  try {
922
- var _config_server, _config_dev;
922
+ var _config_server, _config_dev, _config_performance;
923
923
  let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, envs = loadEnv({
924
924
  cwd: getEnvDir(root, commonOpts.envDir),
925
925
  mode: commonOpts.envMode
@@ -929,10 +929,15 @@ var __webpack_exports__ = {};
929
929
  envMode: commonOpts.envMode,
930
930
  loader: commonOpts.configLoader
931
931
  });
932
- config.source ||= {}, config.source.define = {
932
+ if (config.source ||= {}, config.source.define = {
933
933
  ...envs.publicVars,
934
934
  ...config.source.define
935
- }, commonOpts.base && (config.server ||= {}, config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0);
935
+ }, commonOpts.base && (config.server ||= {}, config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0), (null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.buildCache) && envs.filePaths.length > 0) {
936
+ let { buildCache } = config.performance;
937
+ !0 === buildCache ? config.performance.buildCache = {
938
+ buildDependencies: envs.filePaths
939
+ } : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
940
+ }
936
941
  let rsbuild = await createRsbuild({
937
942
  cwd: root,
938
943
  rsbuildConfig: config,
@@ -1734,7 +1739,7 @@ var __webpack_exports__ = {};
1734
1739
  async function createContext(options, userConfig, bundlerType) {
1735
1740
  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;
1736
1741
  return {
1737
- version: "1.2.9",
1742
+ version: "1.2.10",
1738
1743
  rootPath,
1739
1744
  distPath: '',
1740
1745
  cachePath,
@@ -5265,6 +5270,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5265
5270
  };
5266
5271
  }, notFoundMiddleware = (_req, res, _next)=>{
5267
5272
  res.statusCode = 404, res.end();
5273
+ }, optionsFallbackMiddleware = (req, res, next)=>{
5274
+ if ('OPTIONS' === req.method) {
5275
+ res.statusCode = 204, res.setHeader('Content-Length', '0'), res.end();
5276
+ return;
5277
+ }
5278
+ next();
5268
5279
  }, middlewares_isFileExists = async (filePath, outputFileSystem)=>new Promise((resolve)=>{
5269
5280
  outputFileSystem.stat(filePath, (_error, stats)=>{
5270
5281
  resolve(null == stats ? void 0 : stats.isFile());
@@ -5469,13 +5480,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5469
5480
  let { default: connectHistoryApiFallback } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect-history-api-fallback/index.js")), historyApiFallbackMiddleware = connectHistoryApiFallback(!0 === server.historyApiFallback ? {} : server.historyApiFallback);
5470
5481
  middlewares.push(historyApiFallbackMiddleware), (null == compileMiddlewareAPI ? void 0 : compileMiddlewareAPI.middleware) && middlewares.push(compileMiddlewareAPI.middleware);
5471
5482
  }
5472
- return middlewares.push(faviconFallbackMiddleware), middlewares.push((req, res, next)=>{
5473
- if ('OPTIONS' === req.method) {
5474
- res.statusCode = 204, res.setHeader('Content-Length', '0'), res.end();
5475
- return;
5476
- }
5477
- next();
5478
- }), {
5483
+ return middlewares.push(faviconFallbackMiddleware), {
5479
5484
  onUpgrade: (...args)=>{
5480
5485
  for (let cb of upgradeEvents)cb(...args);
5481
5486
  }
@@ -5616,7 +5621,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5616
5621
  port
5617
5622
  }, async (err)=>{
5618
5623
  if (err) throw err;
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({
5624
+ middlewares.use(optionsFallbackMiddleware), 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({
5620
5625
  port,
5621
5626
  urls: urls.map((item)=>item.url),
5622
5627
  server: {
@@ -5836,7 +5841,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5836
5841
  let { default: connectHistoryApiFallback } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect-history-api-fallback/index.js")), historyApiFallbackMiddleware = connectHistoryApiFallback(!0 === historyApiFallback ? {} : historyApiFallback);
5837
5842
  this.middlewares.use(historyApiFallbackMiddleware), await this.applyStaticAssetMiddleware();
5838
5843
  }
5839
- this.middlewares.use(faviconFallbackMiddleware);
5844
+ this.middlewares.use(faviconFallbackMiddleware), this.middlewares.use(optionsFallbackMiddleware), this.middlewares.use(notFoundMiddleware);
5840
5845
  }
5841
5846
  async applyStaticAssetMiddleware() {
5842
5847
  let { output: { path, assetPrefixes }, serverConfig: { htmlFallback } } = this.options, { default: sirv } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/sirv/index.js")), assetMiddleware = sirv(path, {
@@ -6683,12 +6688,12 @@ ${section.body}` : section.body).join("\n\n"));
6683
6688
  }
6684
6689
  }(), process.title = 'rsbuild-node';
6685
6690
  let { npm_execpath } = process.env;
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`);
6691
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.10\n`);
6687
6692
  }();
6688
6693
  try {
6689
6694
  !function() {
6690
6695
  let cli = dist('rsbuild');
6691
- cli.help(), cli.version("1.2.9"), applyCommonOptions(cli);
6696
+ cli.help(), cli.version("1.2.10"), applyCommonOptions(cli);
6692
6697
  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');
6693
6698
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
6694
6699
  try {
@@ -6739,7 +6744,7 @@ ${section.body}` : section.body).join("\n\n"));
6739
6744
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
6740
6745
  }
6741
6746
  }
6742
- let src_rslib_entry_version = "1.2.9";
6747
+ let src_rslib_entry_version = "1.2.10";
6743
6748
  })();
6744
6749
  var __webpack_export_target__ = exports;
6745
6750
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
package/dist/index.js CHANGED
@@ -828,7 +828,7 @@ let configCache = {}, OVERRIDE_PATHS = [
828
828
  async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
829
829
  cliOptions && (commonOpts = cliOptions);
830
830
  try {
831
- var _config_server, _config_dev;
831
+ var _config_server, _config_dev, _config_performance;
832
832
  let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, envs = loadEnv({
833
833
  cwd: getEnvDir(root, commonOpts.envDir),
834
834
  mode: commonOpts.envMode
@@ -838,10 +838,15 @@ async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
838
838
  envMode: commonOpts.envMode,
839
839
  loader: commonOpts.configLoader
840
840
  });
841
- config.source ||= {}, config.source.define = {
841
+ if (config.source ||= {}, config.source.define = {
842
842
  ...envs.publicVars,
843
843
  ...config.source.define
844
- }, commonOpts.base && (config.server ||= {}, config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0);
844
+ }, commonOpts.base && (config.server ||= {}, config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0), (null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.buildCache) && envs.filePaths.length > 0) {
845
+ let { buildCache } = config.performance;
846
+ !0 === buildCache ? config.performance.buildCache = {
847
+ buildDependencies: envs.filePaths
848
+ } : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
849
+ }
845
850
  let rsbuild = await createRsbuild({
846
851
  cwd: root,
847
852
  rsbuildConfig: config,
@@ -1643,7 +1648,7 @@ async function updateEnvironmentContext(context, configs) {
1643
1648
  async function createContext(options, userConfig, bundlerType) {
1644
1649
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
1645
1650
  return {
1646
- version: "1.2.9",
1651
+ version: "1.2.10",
1647
1652
  rootPath,
1648
1653
  distPath: '',
1649
1654
  cachePath,
@@ -5154,6 +5159,12 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunne
5154
5159
  };
5155
5160
  }, notFoundMiddleware = (_req, res, _next)=>{
5156
5161
  res.statusCode = 404, res.end();
5162
+ }, optionsFallbackMiddleware = (req, res, next)=>{
5163
+ if ('OPTIONS' === req.method) {
5164
+ res.statusCode = 204, res.setHeader('Content-Length', '0'), res.end();
5165
+ return;
5166
+ }
5167
+ next();
5157
5168
  }, middlewares_isFileExists = async (filePath, outputFileSystem)=>new Promise((resolve)=>{
5158
5169
  outputFileSystem.stat(filePath, (_error, stats)=>{
5159
5170
  resolve(null == stats ? void 0 : stats.isFile());
@@ -5358,13 +5369,7 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunne
5358
5369
  let { default: connectHistoryApiFallback } = await import("../compiled/connect-history-api-fallback/index.js"), historyApiFallbackMiddleware = connectHistoryApiFallback(!0 === server.historyApiFallback ? {} : server.historyApiFallback);
5359
5370
  middlewares.push(historyApiFallbackMiddleware), (null == compileMiddlewareAPI ? void 0 : compileMiddlewareAPI.middleware) && middlewares.push(compileMiddlewareAPI.middleware);
5360
5371
  }
5361
- return middlewares.push(faviconFallbackMiddleware), middlewares.push((req, res, next)=>{
5362
- if ('OPTIONS' === req.method) {
5363
- res.statusCode = 204, res.setHeader('Content-Length', '0'), res.end();
5364
- return;
5365
- }
5366
- next();
5367
- }), {
5372
+ return middlewares.push(faviconFallbackMiddleware), {
5368
5373
  onUpgrade: (...args)=>{
5369
5374
  for (let cb of upgradeEvents)cb(...args);
5370
5375
  }
@@ -5505,7 +5510,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
5505
5510
  port
5506
5511
  }, async (err)=>{
5507
5512
  if (err) throw err;
5508
- middlewares.use(notFoundMiddleware), devMiddlewares && httpServer.on('upgrade', devMiddlewares.onUpgrade), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('listen dev server done'), await devServerAPI.afterListen(), onBeforeRestartServer(devServerAPI.close), resolve({
5513
+ middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), devMiddlewares && httpServer.on('upgrade', devMiddlewares.onUpgrade), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('listen dev server done'), await devServerAPI.afterListen(), onBeforeRestartServer(devServerAPI.close), resolve({
5509
5514
  port,
5510
5515
  urls: urls.map((item)=>item.url),
5511
5516
  server: {
@@ -5725,7 +5730,7 @@ class RsbuildProdServer {
5725
5730
  let { default: connectHistoryApiFallback } = await import("../compiled/connect-history-api-fallback/index.js"), historyApiFallbackMiddleware = connectHistoryApiFallback(!0 === historyApiFallback ? {} : historyApiFallback);
5726
5731
  this.middlewares.use(historyApiFallbackMiddleware), await this.applyStaticAssetMiddleware();
5727
5732
  }
5728
- this.middlewares.use(faviconFallbackMiddleware);
5733
+ this.middlewares.use(faviconFallbackMiddleware), this.middlewares.use(optionsFallbackMiddleware), this.middlewares.use(notFoundMiddleware);
5729
5734
  }
5730
5735
  async applyStaticAssetMiddleware() {
5731
5736
  let { output: { path, assetPrefixes }, serverConfig: { htmlFallback } } = this.options, { default: sirv } = await import("../compiled/sirv/index.js"), assetMiddleware = sirv(path, {
@@ -6571,12 +6576,12 @@ async function runCLI() {
6571
6576
  }
6572
6577
  }(), process.title = 'rsbuild-node';
6573
6578
  let { npm_execpath } = process.env;
6574
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.9\n`);
6579
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.10\n`);
6575
6580
  }();
6576
6581
  try {
6577
6582
  !function() {
6578
6583
  let cli = dist('rsbuild');
6579
- cli.help(), cli.version("1.2.9"), applyCommonOptions(cli);
6584
+ cli.help(), cli.version("1.2.10"), applyCommonOptions(cli);
6580
6585
  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');
6581
6586
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
6582
6587
  try {
@@ -6627,6 +6632,6 @@ async function runCLI() {
6627
6632
  __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
6628
6633
  }
6629
6634
  }
6630
- let src_version = "1.2.9";
6635
+ let src_version = "1.2.10";
6631
6636
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
6632
6637
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
@@ -3,6 +3,7 @@ import type { EnvironmentAPI, HtmlFallback, RequestHandler as Middleware, Rspack
3
3
  export declare const faviconFallbackMiddleware: Middleware;
4
4
  export declare const getRequestLoggerMiddleware: () => Promise<Connect.NextHandleFunction>;
5
5
  export declare const notFoundMiddleware: Middleware;
6
+ export declare const optionsFallbackMiddleware: Middleware;
6
7
  /**
7
8
  * Support access HTML without suffix
8
9
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
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.2.3",
49
+ "@rspack/core": "1.2.5",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.15",
52
52
  "core-js": "~3.40.0"
@@ -71,7 +71,7 @@
71
71
  "html-rspack-plugin": "6.0.2",
72
72
  "http-proxy-middleware": "^2.0.6",
73
73
  "jiti": "^1.21.7",
74
- "launch-editor-middleware": "^2.9.1",
74
+ "launch-editor-middleware": "^2.10.0",
75
75
  "mrmime": "^2.0.0",
76
76
  "on-finished": "2.4.1",
77
77
  "open": "^8.4.0",