@lynx-js/rspeedy 0.14.5 → 0.15.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/dist/{0~src_plugins_api_plugin_ts.js → 0~api.plugin.js} +3 -4
  3. package/dist/{0~src_plugins_dev_plugin_ts.js → 0~dev.plugin.js} +19 -13
  4. package/dist/{0~src_cli_exit_ts.js → 0~exit.js} +4 -3
  5. package/dist/0~getESVersionTarget.js +33 -0
  6. package/dist/{0~src_plugins_inspect_plugin_ts.js → 0~inspect.plugin.js} +13 -28
  7. package/dist/{0~node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 0~ipaddr.js} +2 -1
  8. package/dist/0~is-lynx.js +5 -0
  9. package/dist/{1~src_plugins_optimization_plugin_ts.js → 0~optimization.plugin.js} +3 -2
  10. package/dist/{0~src_plugins_output_plugin_ts.js → 0~output.plugin.js} +14 -3
  11. package/dist/0~plugins.js +40 -0
  12. package/dist/{0~src_plugins_rsdoctor_plugin_ts.js → 0~rsdoctor.plugin.js} +1 -1
  13. package/dist/{1~src_plugins_sourcemap_plugin_ts.js → 0~sourcemap.plugin.js} +19 -2
  14. package/dist/0~statsJson.plugin.js +26 -0
  15. package/dist/0~swc.plugin.js +25 -0
  16. package/dist/{0~src_plugins_target_plugin_ts.js → 0~target.plugin.js} +4 -4
  17. package/dist/{1~src_config_validate_ts.js → 0~validate.js} +17963 -28527
  18. package/dist/{1~src_plugins_api_plugin_ts.js → 1~api.plugin.js} +3 -4
  19. package/dist/{1~src_cli_build_ts.js → 1~build.js} +7 -7
  20. package/dist/{1~node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js → 1~chokidar.js} +47 -47
  21. package/dist/{1~src_cli_commands_ts.js → 1~commands.js} +7 -17
  22. package/dist/{1~src_cli_dev_ts.js → 1~dev.js} +6 -6
  23. package/dist/{1~src_plugins_dev_plugin_ts.js → 1~dev.plugin.js} +20 -16
  24. package/dist/{1~node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js → 1~esm.js} +33 -29
  25. package/dist/1~getESVersionTarget.js +33 -0
  26. package/dist/{1~src_cli_inspect_ts.js → 1~inspect.js} +2 -1
  27. package/dist/{1~src_plugins_inspect_plugin_ts.js → 1~inspect.plugin.js} +15 -32
  28. package/dist/{1~node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 1~ipaddr.js} +2 -1
  29. package/dist/1~is-lynx.js +5 -0
  30. package/dist/{1~src_plugins_minify_plugin_ts.js → 1~minify.plugin.js} +2 -1
  31. package/dist/{0~src_plugins_optimization_plugin_ts.js → 1~optimization.plugin.js} +3 -2
  32. package/dist/{1~src_plugins_output_plugin_ts.js → 1~output.plugin.js} +14 -3
  33. package/dist/1~plugins.js +40 -0
  34. package/dist/{1~src_cli_preview_ts.js → 1~preview.js} +5 -5
  35. package/dist/{1~src_plugins_rsdoctor_plugin_ts.js → 1~rsdoctor.plugin.js} +2 -2
  36. package/dist/{0~src_plugins_sourcemap_plugin_ts.js → 1~sourcemap.plugin.js} +19 -2
  37. package/dist/1~src_cli_init_ts-src_create-rspeedy_ts.js +43 -29
  38. package/dist/1~statsJson.plugin.js +26 -0
  39. package/dist/1~swc.plugin.js +25 -0
  40. package/dist/{1~src_plugins_target_plugin_ts.js → 1~target.plugin.js} +4 -4
  41. package/dist/{0~src_config_validate_ts.js → 1~validate.js} +17963 -28527
  42. package/dist/{1~src_cli_watch_ts.js → 1~watch.js} +1 -3
  43. package/dist/cli/main.js +1 -1
  44. package/dist/index.d.ts +94 -17
  45. package/dist/{src_cli_main_ts.js → src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js} +127 -30
  46. package/dist/src_index_ts.js +132 -19
  47. package/package.json +18 -17
  48. package/dist/0~src_plugins_index_ts.js +0 -64
  49. package/dist/0~src_plugins_swc_plugin_ts.js +0 -21
  50. package/dist/0~src_utils_getESVersionTarget_ts.js +0 -4
  51. package/dist/1~node_fs.js +0 -7
  52. package/dist/1~node_path.js +0 -7
  53. package/dist/1~src_plugins_index_ts.js +0 -64
  54. package/dist/1~src_plugins_swc_plugin_ts.js +0 -21
  55. package/dist/1~src_utils_getESVersionTarget_ts.js +0 -4
  56. package/dist/rslib-runtime.js +0 -75
  57. /package/dist/{0~src_plugins_chunkLoading_plugin_ts.js → 0~chunkLoading.plugin.js} +0 -0
  58. /package/dist/{0~src_config_output_dist-path_ts.js → 0~dist-path.js} +0 -0
  59. /package/dist/{0~src_plugins_emitOnErrors_plugin_ts.js → 0~emitOnErrors.plugin.js} +0 -0
  60. /package/dist/{0~src_plugins_minify_plugin_ts.js → 0~minify.plugin.js} +0 -0
  61. /package/dist/{0~src_plugins_resolve_plugin_ts.js → 0~resolve.plugin.js} +0 -0
  62. /package/dist/{1~node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt → 1~chokidar.js.LICENSE.txt} +0 -0
  63. /package/dist/{1~src_plugins_chunkLoading_plugin_ts.js → 1~chunkLoading.plugin.js} +0 -0
  64. /package/dist/{1~src_config_output_dist-path_ts.js → 1~dist-path.js} +0 -0
  65. /package/dist/{1~src_plugins_emitOnErrors_plugin_ts.js → 1~emitOnErrors.plugin.js} +0 -0
  66. /package/dist/{1~src_utils_is-ci_ts.js → 1~is-ci.js} +0 -0
  67. /package/dist/{1~src_plugins_resolve_plugin_ts.js → 1~resolve.plugin.js} +0 -0
@@ -1,4 +1,5 @@
1
- import { debug, logger, version_version } from "./src_cli_main_ts.js";
1
+ import { logger } from "@rsbuild/core";
2
+ import { debug, version_version } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
2
3
  const sAPI = Symbol.for('rspeedy.api');
3
4
  function pluginAPI(config) {
4
5
  return {
@@ -8,9 +9,7 @@ function pluginAPI(config) {
8
9
  config,
9
10
  debug: debug,
10
11
  async exit (code) {
11
- const { exit } = await import("./src_cli_main_ts.js").then((mod)=>({
12
- exit: mod.exit_exit
13
- }));
12
+ const { exit } = await import("./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js");
14
13
  return exit(code);
15
14
  },
16
15
  logger: logger,
@@ -1,10 +1,10 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
2
- import "./1~node_path.js";
3
- import { logger, exit_exit } from "./src_cli_main_ts.js";
1
+ import { __webpack_require__ } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
2
+ import node_path from "node:path";
3
+ import { logger } from "@rsbuild/core";
4
+ import { exit as exit_exit } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
4
5
  import { createRspeedy, init } from "./1~src_cli_init_ts-src_create-rspeedy_ts.js";
5
- import { isCI } from "./1~src_utils_is-ci_ts.js";
6
- import { watchFiles, getWatchedFiles } from "./1~src_cli_watch_ts.js";
7
- const external_node_path_ = __webpack_require__("node:path");
6
+ import { isCI } from "./1~is-ci.js";
7
+ import { watchFiles, getWatchedFiles } from "./1~watch.js";
8
8
  const picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
9
9
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
10
10
  async function build(cwd, buildOptions) {
@@ -15,7 +15,7 @@ async function build(cwd, buildOptions) {
15
15
  const { rspeedyConfig, configPath, createRspeedyOptions } = await init(cwd, buildOptions);
16
16
  if (isWatch) {
17
17
  const watchedFiles = getWatchedFiles(configPath, rspeedyConfig);
18
- await watchFiles(watchedFiles.map((filePath)=>external_node_path_["default"].isAbsolute(filePath) ? filePath : external_node_path_["default"].join(cwd, filePath)), async (filename)=>{
18
+ await watchFiles(watchedFiles.map((filePath)=>node_path.isAbsolute(filePath) ? filePath : node_path.join(cwd, filePath)), async (filename)=>{
19
19
  logger.info(`Restart because ${picocolors_default().yellow(filename)} is changed.\n`);
20
20
  const cleanup = onBeforeRestart.map((f)=>f());
21
21
  onBeforeRestart = [];
@@ -1,10 +1,11 @@
1
- /*! For license information please see 1~node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt */
1
+ /*! LICENSE: 1~chokidar.js.LICENSE.txt */
2
2
  import { stat as external_fs_stat, unwatchFile, watch, watchFile } from "fs";
3
3
  import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "fs/promises";
4
4
  import { EventEmitter } from "events";
5
- import { basename as external_path_basename, dirname as external_path_dirname, extname, isAbsolute, join, normalize, relative as external_path_relative, resolve as external_path_resolve, sep } from "path";
6
5
  import { Readable } from "stream";
6
+ import { join, relative as external_path_relative, resolve as external_path_resolve, sep } from "path";
7
7
  import { type as external_os_type } from "os";
8
+ import * as __rspack_external_path from "path";
8
9
  function defaultOptions() {
9
10
  return {
10
11
  root: '.',
@@ -219,7 +220,6 @@ const readdirp = (root, options = {})=>{
219
220
  };
220
221
  const STR_DATA = 'data';
221
222
  const STR_END = 'end';
222
- const STR_CLOSE = 'close';
223
223
  const EMPTY_FN = ()=>{};
224
224
  const pl = process.platform;
225
225
  const isWindows = 'win32' === pl;
@@ -515,7 +515,7 @@ const binaryExtensions = new Set([
515
515
  'zip',
516
516
  'zipx'
517
517
  ]);
518
- const isBinaryPath = (filePath)=>binaryExtensions.has(extname(filePath).slice(1).toLowerCase());
518
+ const isBinaryPath = (filePath)=>binaryExtensions.has(__rspack_external_path.extname(filePath).slice(1).toLowerCase());
519
519
  const foreach = (val, fn)=>{
520
520
  if (val instanceof Set) val.forEach(fn);
521
521
  else fn(val);
@@ -545,7 +545,7 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
545
545
  emitRaw(rawEvent, evPath, {
546
546
  watchedPath: path
547
547
  });
548
- if (evPath && path !== evPath) fsWatchBroadcast(external_path_resolve(path, evPath), KEY_LISTENERS, join(path, evPath));
548
+ if (evPath && path !== evPath) fsWatchBroadcast(__rspack_external_path.resolve(path, evPath), KEY_LISTENERS, __rspack_external_path.join(path, evPath));
549
549
  };
550
550
  try {
551
551
  return watch(path, {
@@ -658,11 +658,11 @@ class NodeFsHandler {
658
658
  }
659
659
  _watchWithNodeFs(path, listener) {
660
660
  const opts = this.fsw.options;
661
- const directory = external_path_dirname(path);
662
- const basename = external_path_basename(path);
661
+ const directory = __rspack_external_path.dirname(path);
662
+ const basename = __rspack_external_path.basename(path);
663
663
  const parent = this.fsw._getWatchedDir(directory);
664
664
  parent.add(basename);
665
- const absolutePath = external_path_resolve(path);
665
+ const absolutePath = __rspack_external_path.resolve(path);
666
666
  const options = {
667
667
  persistent: opts.persistent
668
668
  };
@@ -684,8 +684,8 @@ class NodeFsHandler {
684
684
  }
685
685
  _handleFile(file, stats, initialAdd) {
686
686
  if (this.fsw.closed) return;
687
- const dirname = external_path_dirname(file);
688
- const basename = external_path_basename(file);
687
+ const dirname = __rspack_external_path.dirname(file);
688
+ const basename = __rspack_external_path.basename(file);
689
689
  const parent = this.fsw._getWatchedDir(dirname);
690
690
  let prevStats = stats;
691
691
  if (parent.has(basename)) return;
@@ -752,7 +752,7 @@ class NodeFsHandler {
752
752
  this.fsw._symlinkPaths.set(full, true);
753
753
  }
754
754
  _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
755
- directory = join(directory, '');
755
+ directory = __rspack_external_path.join(directory, '');
756
756
  throttler = this.fsw._throttle('readdir', directory, 1000);
757
757
  if (!throttler) return;
758
758
  const previous = this.fsw._getWatchedDir(wh.path);
@@ -768,7 +768,7 @@ class NodeFsHandler {
768
768
  return;
769
769
  }
770
770
  const item = entry.path;
771
- let path = join(directory, item);
771
+ let path = __rspack_external_path.join(directory, item);
772
772
  current.add(item);
773
773
  if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) return;
774
774
  if (this.fsw.closed) {
@@ -777,7 +777,7 @@ class NodeFsHandler {
777
777
  }
778
778
  if (item === target || !target && !previous.has(item)) {
779
779
  this.fsw._incrReadyCount();
780
- path = join(dir, external_path_relative(dir, path));
780
+ path = __rspack_external_path.join(dir, __rspack_external_path.relative(dir, path));
781
781
  this._addToNodeFs(path, initialAdd, wh, depth + 1);
782
782
  }
783
783
  }).on(EV.ERROR, this._boundHandleError);
@@ -799,10 +799,10 @@ class NodeFsHandler {
799
799
  });
800
800
  }
801
801
  async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
802
- const parentDir = this.fsw._getWatchedDir(external_path_dirname(dir));
803
- const tracked = parentDir.has(external_path_basename(dir));
802
+ const parentDir = this.fsw._getWatchedDir(__rspack_external_path.dirname(dir));
803
+ const tracked = parentDir.has(__rspack_external_path.basename(dir));
804
804
  if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
805
- parentDir.add(external_path_basename(dir));
805
+ parentDir.add(__rspack_external_path.basename(dir));
806
806
  this.fsw._getWatchedDir(dir);
807
807
  let throttler;
808
808
  let closer;
@@ -840,7 +840,7 @@ class NodeFsHandler {
840
840
  const follow = this.fsw.options.followSymlinks;
841
841
  let closer;
842
842
  if (stats.isDirectory()) {
843
- const absPath = external_path_resolve(path);
843
+ const absPath = __rspack_external_path.resolve(path);
844
844
  const targetPath = follow ? await promises_realpath(path) : path;
845
845
  if (this.fsw.closed) return;
846
846
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -849,12 +849,12 @@ class NodeFsHandler {
849
849
  } else if (stats.isSymbolicLink()) {
850
850
  const targetPath = follow ? await promises_realpath(path) : path;
851
851
  if (this.fsw.closed) return;
852
- const parent = external_path_dirname(wh.watchPath);
852
+ const parent = __rspack_external_path.dirname(wh.watchPath);
853
853
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
854
854
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
855
855
  closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
856
856
  if (this.fsw.closed) return;
857
- if (void 0 !== targetPath) this.fsw._symlinkPaths.set(external_path_resolve(path), targetPath);
857
+ if (void 0 !== targetPath) this.fsw._symlinkPaths.set(__rspack_external_path.resolve(path), targetPath);
858
858
  } else closer = this._handleFile(wh.watchPath, stats, initialAdd);
859
859
  ready();
860
860
  if (closer) this.fsw._addPathCloser(path, closer);
@@ -889,9 +889,9 @@ function createPattern(matcher) {
889
889
  if ('object' == typeof matcher && null !== matcher) return (string)=>{
890
890
  if (matcher.path === string) return true;
891
891
  if (matcher.recursive) {
892
- const relative = external_path_relative(matcher.path, string);
892
+ const relative = __rspack_external_path.relative(matcher.path, string);
893
893
  if (!relative) return false;
894
- return !relative.startsWith('..') && !isAbsolute(relative);
894
+ return !relative.startsWith('..') && !__rspack_external_path.isAbsolute(relative);
895
895
  }
896
896
  return false;
897
897
  };
@@ -899,7 +899,7 @@ function createPattern(matcher) {
899
899
  }
900
900
  function normalizePath(path) {
901
901
  if ('string' != typeof path) throw new Error('string expected');
902
- path = normalize(path);
902
+ path = __rspack_external_path.normalize(path);
903
903
  path = path.replace(/\\/g, '/');
904
904
  let prepend = false;
905
905
  if (path.startsWith('//')) prepend = true;
@@ -936,14 +936,14 @@ const toUnix = (string)=>{
936
936
  if (prepend) str = SLASH + str;
937
937
  return str;
938
938
  };
939
- const normalizePathToUnix = (path)=>toUnix(normalize(toUnix(path)));
939
+ const normalizePathToUnix = (path)=>toUnix(__rspack_external_path.normalize(toUnix(path)));
940
940
  const normalizeIgnored = (cwd = '')=>(path)=>{
941
- if ('string' == typeof path) return normalizePathToUnix(isAbsolute(path) ? path : join(cwd, path));
941
+ if ('string' == typeof path) return normalizePathToUnix(__rspack_external_path.isAbsolute(path) ? path : __rspack_external_path.join(cwd, path));
942
942
  return path;
943
943
  };
944
944
  const getAbsolutePath = (path, cwd)=>{
945
- if (isAbsolute(path)) return path;
946
- return join(cwd, path);
945
+ if (__rspack_external_path.isAbsolute(path)) return path;
946
+ return __rspack_external_path.join(cwd, path);
947
947
  };
948
948
  const EMPTY_SET = Object.freeze(new Set());
949
949
  class DirEntry {
@@ -966,7 +966,7 @@ class DirEntry {
966
966
  try {
967
967
  await readdir(dir);
968
968
  } catch (err) {
969
- if (this._removeWatcher) this._removeWatcher(external_path_dirname(dir), external_path_basename(dir));
969
+ if (this._removeWatcher) this._removeWatcher(__rspack_external_path.dirname(dir), __rspack_external_path.basename(dir));
970
970
  }
971
971
  }
972
972
  has(item) {
@@ -997,7 +997,7 @@ class WatchHelper {
997
997
  const watchPath = path;
998
998
  this.path = path = path.replace(REPLACER_RE, '');
999
999
  this.watchPath = watchPath;
1000
- this.fullWatchPath = external_path_resolve(watchPath);
1000
+ this.fullWatchPath = __rspack_external_path.resolve(watchPath);
1001
1001
  this.dirParts = [];
1002
1002
  this.dirParts.forEach((parts)=>{
1003
1003
  if (parts.length > 1) parts.pop();
@@ -1006,7 +1006,7 @@ class WatchHelper {
1006
1006
  this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
1007
1007
  }
1008
1008
  entryPath(entry) {
1009
- return join(this.watchPath, external_path_relative(this.watchPath, entry.fullPath));
1009
+ return __rspack_external_path.join(this.watchPath, __rspack_external_path.relative(this.watchPath, entry.fullPath));
1010
1010
  }
1011
1011
  filterPath(entry) {
1012
1012
  const { stats } = entry;
@@ -1113,7 +1113,7 @@ class FSWatcher extends EventEmitter {
1113
1113
  })).then((results)=>{
1114
1114
  if (this.closed) return;
1115
1115
  results.forEach((item)=>{
1116
- if (item) this.add(external_path_dirname(item), external_path_basename(_origAdd || item));
1116
+ if (item) this.add(__rspack_external_path.dirname(item), __rspack_external_path.basename(_origAdd || item));
1117
1117
  });
1118
1118
  });
1119
1119
  return this;
@@ -1123,9 +1123,9 @@ class FSWatcher extends EventEmitter {
1123
1123
  const paths = unifyPaths(paths_);
1124
1124
  const { cwd } = this.options;
1125
1125
  paths.forEach((path)=>{
1126
- if (!isAbsolute(path) && !this._closers.has(path)) {
1127
- if (cwd) path = join(cwd, path);
1128
- path = external_path_resolve(path);
1126
+ if (!__rspack_external_path.isAbsolute(path) && !this._closers.has(path)) {
1127
+ if (cwd) path = __rspack_external_path.join(cwd, path);
1128
+ path = __rspack_external_path.resolve(path);
1129
1129
  }
1130
1130
  this._closePath(path);
1131
1131
  this._addIgnoredPath(path);
@@ -1162,7 +1162,7 @@ class FSWatcher extends EventEmitter {
1162
1162
  getWatched() {
1163
1163
  const watchList = {};
1164
1164
  this._watched.forEach((entry, dir)=>{
1165
- const key = this.options.cwd ? external_path_relative(this.options.cwd, dir) : dir;
1165
+ const key = this.options.cwd ? __rspack_external_path.relative(this.options.cwd, dir) : dir;
1166
1166
  const index = key || ONE_DOT;
1167
1167
  watchList[index] = entry.getChildren().sort();
1168
1168
  });
@@ -1175,8 +1175,8 @@ class FSWatcher extends EventEmitter {
1175
1175
  async _emit(event, path, stats) {
1176
1176
  if (this.closed) return;
1177
1177
  const opts = this.options;
1178
- if (isWindows) path = normalize(path);
1179
- if (opts.cwd) path = external_path_relative(opts.cwd, path);
1178
+ if (isWindows) path = __rspack_external_path.normalize(path);
1179
+ if (opts.cwd) path = __rspack_external_path.relative(opts.cwd, path);
1180
1180
  const args = [
1181
1181
  path
1182
1182
  ];
@@ -1227,7 +1227,7 @@ class FSWatcher extends EventEmitter {
1227
1227
  if (isThrottled) return this;
1228
1228
  }
1229
1229
  if (opts.alwaysStat && void 0 === stats && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
1230
- const fullPath = opts.cwd ? join(opts.cwd, path) : path;
1230
+ const fullPath = opts.cwd ? __rspack_external_path.join(opts.cwd, path) : path;
1231
1231
  let stats;
1232
1232
  try {
1233
1233
  stats = await promises_stat(fullPath);
@@ -1279,7 +1279,7 @@ class FSWatcher extends EventEmitter {
1279
1279
  const pollInterval = awf.pollInterval;
1280
1280
  let timeoutHandler;
1281
1281
  let fullPath = path;
1282
- if (this.options.cwd && !isAbsolute(path)) fullPath = join(this.options.cwd, path);
1282
+ if (this.options.cwd && !__rspack_external_path.isAbsolute(path)) fullPath = __rspack_external_path.join(this.options.cwd, path);
1283
1283
  const now = new Date();
1284
1284
  const writes = this._pendingWrites;
1285
1285
  function awaitWriteFinishFn(prevStat) {
@@ -1334,7 +1334,7 @@ class FSWatcher extends EventEmitter {
1334
1334
  return new WatchHelper(path, this.options.followSymlinks, this);
1335
1335
  }
1336
1336
  _getWatchedDir(directory) {
1337
- const dir = external_path_resolve(directory);
1337
+ const dir = __rspack_external_path.resolve(directory);
1338
1338
  if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
1339
1339
  return this._watched.get(dir);
1340
1340
  }
@@ -1343,8 +1343,8 @@ class FSWatcher extends EventEmitter {
1343
1343
  return Boolean(256 & Number(stats.mode));
1344
1344
  }
1345
1345
  _remove(directory, item, isDirectory) {
1346
- const path = join(directory, item);
1347
- const fullPath = external_path_resolve(path);
1346
+ const path = __rspack_external_path.join(directory, item);
1347
+ const fullPath = __rspack_external_path.resolve(path);
1348
1348
  isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
1349
1349
  if (!this._throttle('remove', path, 100)) return;
1350
1350
  if (!isDirectory && 1 === this._watched.size) this.add(directory, item, true);
@@ -1356,7 +1356,7 @@ class FSWatcher extends EventEmitter {
1356
1356
  parent.remove(item);
1357
1357
  if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
1358
1358
  let relPath = path;
1359
- if (this.options.cwd) relPath = external_path_relative(this.options.cwd, path);
1359
+ if (this.options.cwd) relPath = __rspack_external_path.relative(this.options.cwd, path);
1360
1360
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
1361
1361
  const event = this._pendingWrites.get(relPath).cancelWait();
1362
1362
  if (event === EVENTS.ADD) return;
@@ -1369,8 +1369,8 @@ class FSWatcher extends EventEmitter {
1369
1369
  }
1370
1370
  _closePath(path) {
1371
1371
  this._closeFile(path);
1372
- const dir = external_path_dirname(path);
1373
- this._getWatchedDir(dir).remove(external_path_basename(path));
1372
+ const dir = __rspack_external_path.dirname(path);
1373
+ this._getWatchedDir(dir).remove(__rspack_external_path.basename(path));
1374
1374
  }
1375
1375
  _closeFile(path) {
1376
1376
  const closers = this._closers.get(path);
@@ -1398,10 +1398,10 @@ class FSWatcher extends EventEmitter {
1398
1398
  };
1399
1399
  let stream = readdirp(root, options);
1400
1400
  this._streams.add(stream);
1401
- stream.once(STR_CLOSE, ()=>{
1401
+ stream.once("close", ()=>{
1402
1402
  stream = void 0;
1403
1403
  });
1404
- stream.once(STR_END, ()=>{
1404
+ stream.once("end", ()=>{
1405
1405
  if (stream) {
1406
1406
  this._streams.delete(stream);
1407
1407
  stream = void 0;
@@ -1419,4 +1419,4 @@ const chokidar_esm = {
1419
1419
  watch: esm_watch,
1420
1420
  FSWatcher: FSWatcher
1421
1421
  };
1422
- export { chokidar_esm };
1422
+ export default chokidar_esm;
@@ -1,13 +1,11 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
2
- import "./1~node_path.js";
3
- import { version_version } from "./src_cli_main_ts.js";
4
- const external_node_path_ = __webpack_require__("node:path");
1
+ import node_path from "node:path";
2
+ import { version_version } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
5
3
  function applyCommonOptions(command) {
6
4
  command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--env-mode <mode>', 'specify the env mode to load the .env.[mode] file').option('--no-env', 'disable loading `.env` files"').option('-m --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('-r --root <root>', 'set the project root directory (absolute path or relative to cwd)');
7
5
  }
8
6
  function resolveRoot(cwd, root) {
9
7
  if (!root) return cwd;
10
- return external_node_path_["default"].isAbsolute(root) ? root : external_node_path_["default"].resolve(cwd, root);
8
+ return node_path.isAbsolute(root) ? root : node_path.resolve(cwd, root);
11
9
  }
12
10
  function apply(program) {
13
11
  const cwd = process.cwd();
@@ -15,33 +13,25 @@ function apply(program) {
15
13
  const buildCommand = program.command('build');
16
14
  buildCommand.description('Build the project in production mode').option('--environment <name...>', 'specify the name of environment to build').option('--watch', 'Enable watch mode to automatically rebuild on file changes').action(async (buildOptions)=>{
17
15
  const actualRoot = resolveRoot(cwd, buildOptions.root);
18
- const { build } = await import("./1~src_cli_build_ts.js").then((mod)=>({
19
- build: mod.build
20
- }));
16
+ const { build } = await import("./1~build.js");
21
17
  return await build.call(buildCommand, actualRoot, buildOptions);
22
18
  });
23
19
  const devCommand = program.command('dev');
24
20
  devCommand.description('Run the dev server and watch for source file changes while serving.').option('--base <base>', 'specify the base path of the server').option('--environment <name...>', 'specify the name of environment to build').action(async (devOptions)=>{
25
21
  const actualRoot = resolveRoot(cwd, devOptions.root);
26
- const { dev } = await import("./1~src_cli_dev_ts.js").then((mod)=>({
27
- dev: mod.dev
28
- }));
22
+ const { dev } = await import("./1~dev.js");
29
23
  return await dev.call(devCommand, actualRoot, devOptions);
30
24
  });
31
25
  const inspectCommand = program.command('inspect');
32
26
  inspectCommand.description('View the Rsbuild config and Rspack config of the project.').option('--output <output>', 'specify inspect content output path').option('--verbose', 'show full function definitions in output').action(async (inspectOptions)=>{
33
27
  const actualRoot = resolveRoot(cwd, inspectOptions.root);
34
- const { inspect } = await import("./1~src_cli_inspect_ts.js").then((mod)=>({
35
- inspect: mod.inspect
36
- }));
28
+ const { inspect } = await import("./1~inspect.js");
37
29
  return await inspect.call(inspectCommand, actualRoot, inspectOptions);
38
30
  });
39
31
  const previewCommand = program.command('preview');
40
32
  previewCommand.description('Preview the production build outputs locally.').option('--base <base>', 'specify the base path of the server').action(async (previewOptions)=>{
41
33
  const actualRoot = resolveRoot(cwd, previewOptions.root);
42
- const { preview } = await import("./1~src_cli_preview_ts.js").then((mod)=>({
43
- preview: mod.preview
44
- }));
34
+ const { preview } = await import("./1~preview.js");
45
35
  return await preview.call(previewCommand, actualRoot, previewOptions);
46
36
  });
47
37
  const commonCommands = [
@@ -1,9 +1,9 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
2
- import "./1~node_path.js";
3
- import { logger, exit_exit } from "./src_cli_main_ts.js";
1
+ import { __webpack_require__ } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
2
+ import node_path from "node:path";
3
+ import { logger } from "@rsbuild/core";
4
+ import { exit as exit_exit } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
4
5
  import { createRspeedy, init } from "./1~src_cli_init_ts-src_create-rspeedy_ts.js";
5
- import { watchFiles, getWatchedFiles } from "./1~src_cli_watch_ts.js";
6
- const external_node_path_ = __webpack_require__("node:path");
6
+ import { watchFiles, getWatchedFiles } from "./1~watch.js";
7
7
  const picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
8
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
9
9
  async function dev(cwd, devOptions) {
@@ -11,7 +11,7 @@ async function dev(cwd, devOptions) {
11
11
  try {
12
12
  const { rspeedyConfig, configPath, createRspeedyOptions } = await init(cwd, devOptions);
13
13
  const watchedFiles = getWatchedFiles(configPath, rspeedyConfig);
14
- await watchFiles(watchedFiles.map((filePath)=>external_node_path_["default"].isAbsolute(filePath) ? filePath : external_node_path_["default"].join(cwd, filePath)), async (filename)=>{
14
+ await watchFiles(watchedFiles.map((filePath)=>node_path.isAbsolute(filePath) ? filePath : node_path.join(cwd, filePath)), async (filename)=>{
15
15
  logger.info(`Restart because ${picocolors_default().yellow(filename)} is changed.\n`);
16
16
  const cleanup = onBeforeRestart.map((f)=>f());
17
17
  onBeforeRestart = [];
@@ -1,11 +1,9 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
2
1
  import { createRequire } from "node:module";
3
- import "./1~node_path.js";
4
- import { debug, logger } from "./src_cli_main_ts.js";
5
- function isLynx(environment) {
6
- const environmentName = 'string' == typeof environment ? environment : environment.name;
7
- return 'lynx' === environmentName || environmentName.startsWith('lynx-');
8
- }
2
+ import node_path from "node:path";
3
+ import { logger } from "@rsbuild/core";
4
+ import { __webpack_require__ } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
5
+ import { debug } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
6
+ import { isLynx } from "./1~is-lynx.js";
9
7
  class ProvidePlugin_ProvidePlugin {
10
8
  definitions;
11
9
  constructor(definitions){
@@ -16,7 +14,6 @@ class ProvidePlugin_ProvidePlugin {
16
14
  new ProvidePlugin(this.definitions).apply(compiler);
17
15
  }
18
16
  }
19
- const external_node_path_ = __webpack_require__("node:path");
20
17
  const picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
21
18
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
22
19
  function pluginDev(options, server) {
@@ -74,8 +71,15 @@ function pluginDev(options, server) {
74
71
  const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
75
72
  const defaultFilename = '[name].[platform].bundle';
76
73
  const { filename } = rspeedyAPIs.config.output ?? {};
77
- let name;
78
- name = filename ? 'object' == typeof filename ? filename.bundle ?? filename.template ?? defaultFilename : filename : defaultFilename;
74
+ const bundle = 'object' == typeof filename ? filename.bundle ?? filename.template : filename;
75
+ const resolveName = (entry, platform)=>{
76
+ const resolved = 'function' == typeof bundle ? bundle({
77
+ lazyBundle: false,
78
+ entryName: entry,
79
+ platform
80
+ }) : bundle ?? defaultFilename;
81
+ return resolved.replaceAll('[name]', entry).replaceAll('[platform]', platform);
82
+ };
79
83
  if (config.server?.printUrls === void 0 || config.server?.printUrls === true) {
80
84
  const environmentNames = Object.keys(config.environments ?? {});
81
85
  return mergeRsbuildConfig(config, {
@@ -84,7 +88,7 @@ function pluginDev(options, server) {
84
88
  const finalUrls = [];
85
89
  const baseForUrls = ('string' == typeof assetPrefix ? assetPrefix : `http://${hostname}:<port>/`).replaceAll('<port>', String(param.port));
86
90
  for (const entry of Object.keys(config.source?.entry ?? {}))for (const environmentName of environmentNames){
87
- const pathname = name.replaceAll('[name]', entry).replaceAll('[platform]', environmentName);
91
+ const pathname = resolveName(entry, environmentName);
88
92
  finalUrls.push({
89
93
  label: environmentName,
90
94
  url: new URL(pathname, baseForUrls).toString()
@@ -110,7 +114,7 @@ function pluginDev(options, server) {
110
114
  const { action } = api.context;
111
115
  if ('dev' !== action && !isDev) return;
112
116
  const rsbuildPath = require.resolve('@rsbuild/core');
113
- const rspeedyDir = external_node_path_["default"].dirname(require.resolve('@lynx-js/rspeedy/package.json'));
117
+ const rspeedyDir = node_path.dirname(require.resolve('@lynx-js/rspeedy/package.json'));
114
118
  const searchParams = new URLSearchParams({
115
119
  hostname,
116
120
  port: api.context.devServer?.port?.toString() ?? '',
@@ -124,11 +128,11 @@ function pluginDev(options, server) {
124
128
  paths: [
125
129
  rsbuildPath
126
130
  ]
127
- })).set('webpack/hot/emitter.js', require.resolve('@rspack/core/hot/emitter', {
131
+ })).set('@lynx-js/webpack-dev-transport/client', `${require.resolve('@lynx-js/webpack-dev-transport/client')}?${searchParams.toString()}`).set('@rspack/core/hot/emitter.js', require.resolve('@rspack/core/hot/emitter.js', {
128
132
  paths: [
129
133
  rsbuildPath
130
134
  ]
131
- })).set('@lynx-js/webpack-dev-transport/client', `${require.resolve('@lynx-js/webpack-dev-transport/client')}?${searchParams.toString()}`).set('@rspack/core/hot/dev-server', require.resolve('@rspack/core/hot/dev-server', {
135
+ })).set('@rspack/core/hot/dev-server', require.resolve('@rspack/core/hot/dev-server', {
132
136
  paths: [
133
137
  rsbuildPath
134
138
  ]
@@ -157,8 +161,8 @@ function pluginDev(options, server) {
157
161
  };
158
162
  }
159
163
  async function findIp(family, isInternal = false) {
160
- const [{ default: ipaddr }, os] = await Promise.all([
161
- import("./1~node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js").then(__webpack_require__.t.bind(__webpack_require__, "../../../node_modules/.pnpm/ipaddr.js@2.3.0/node_modules/ipaddr.js/lib/ipaddr.js", 23)),
164
+ const [{ default: ipaddr }, { default: os }] = await Promise.all([
165
+ import("./1~ipaddr.js").then(__webpack_require__.t.bind(__webpack_require__, "../../../node_modules/.pnpm/ipaddr.js@2.3.0/node_modules/ipaddr.js/lib/ipaddr.js", 23)),
162
166
  import("node:os")
163
167
  ]);
164
168
  let host;
@@ -1,33 +1,23 @@
1
- import * as __rspack_external_node_child_process_27f17141 from "node:child_process";
2
- import * as __rspack_external_node_events_0a6aefe7 from "node:events";
3
- import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./1~node_path.js";
5
- import "./1~node_fs.js";
6
- import "./src_cli_main_ts.js";
1
+ import { __webpack_require__ } from "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
2
+ import "./src_cli_main_ts-node_child_process-node_events-node_fs-node_path-node_process.js";
7
3
  __webpack_require__.add({
8
- "node:child_process" (module) {
9
- module.exports = __rspack_external_node_child_process_27f17141;
10
- },
11
- "node:events" (module) {
12
- module.exports = __rspack_external_node_events_0a6aefe7;
13
- },
14
4
  "../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/index.js" (__unused_rspack_module, exports, __webpack_require__) {
15
5
  const { Argument } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/argument.js");
16
6
  const { Command } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/command.js");
17
7
  const { CommanderError, InvalidArgumentError } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js");
18
8
  const { Help } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/help.js");
19
9
  const { Option } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/option.js");
20
- exports.program = new Command();
21
- exports.createCommand = (name)=>new Command(name);
22
- exports.createOption = (flags, description)=>new Option(flags, description);
23
- exports.createArgument = (name, description)=>new Argument(name, description);
24
- exports.Command = Command;
25
- exports.Option = Option;
26
- exports.Argument = Argument;
27
- exports.Help = Help;
28
- exports.CommanderError = CommanderError;
29
- exports.InvalidArgumentError = InvalidArgumentError;
30
- exports.InvalidOptionArgumentError = InvalidArgumentError;
10
+ exports.DM = new Command();
11
+ exports.gu = (name)=>new Command(name);
12
+ exports.Ww = (flags, description)=>new Option(flags, description);
13
+ exports.er = (name, description)=>new Argument(name, description);
14
+ exports.uB = Command;
15
+ exports.c$ = Option;
16
+ exports.ef = Argument;
17
+ exports._V = Help;
18
+ exports.b7 = CommanderError;
19
+ exports.Di = InvalidArgumentError;
20
+ exports.a2 = InvalidArgumentError;
31
21
  },
32
22
  "../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/argument.js" (__unused_rspack_module, exports, __webpack_require__) {
33
23
  const { InvalidArgumentError } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js");
@@ -104,9 +94,9 @@ __webpack_require__.add({
104
94
  "../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/command.js" (__unused_rspack_module, exports, __webpack_require__) {
105
95
  const EventEmitter = __webpack_require__("node:events").EventEmitter;
106
96
  const childProcess = __webpack_require__("node:child_process");
107
- const path = __webpack_require__("node:path");
108
- const fs = __webpack_require__("node:fs");
109
- const process = __webpack_require__("node:process");
97
+ const path = __webpack_require__("node:path?435f");
98
+ const fs = __webpack_require__("node:fs?9592");
99
+ const process = __webpack_require__("node:process?ecf8");
110
100
  const { Argument, humanReadableArgName } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/argument.js");
111
101
  const { CommanderError } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js");
112
102
  const { Help, stripColor } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/help.js");
@@ -1254,7 +1244,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
1254
1244
  if (process.env.FORCE_COLOR || void 0 !== process.env.CLICOLOR_FORCE) return true;
1255
1245
  }
1256
1246
  exports.Command = Command;
1257
- exports.useColor = useColor;
1258
1247
  },
1259
1248
  "../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js" (__unused_rspack_module, exports) {
1260
1249
  class CommanderError extends Error {
@@ -1750,6 +1739,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
1750
1739
  exports.suggestSimilar = suggestSimilar;
1751
1740
  }
1752
1741
  });
1742
+ var esm_namespaceObject = {};
1743
+ __webpack_require__.r(esm_namespaceObject);
1744
+ __webpack_require__.d(esm_namespaceObject, {
1745
+ Argument: ()=>Argument,
1746
+ Command: ()=>Command,
1747
+ CommanderError: ()=>CommanderError,
1748
+ Help: ()=>Help,
1749
+ InvalidArgumentError: ()=>InvalidArgumentError,
1750
+ InvalidOptionArgumentError: ()=>InvalidOptionArgumentError,
1751
+ Option: ()=>Option,
1752
+ createArgument: ()=>createArgument,
1753
+ createCommand: ()=>createCommand,
1754
+ createOption: ()=>createOption,
1755
+ program: ()=>program
1756
+ });
1753
1757
  const commander = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/index.js");
1754
- const { program: program, createCommand: createCommand, createArgument: createArgument, createOption: createOption, CommanderError: CommanderError, InvalidArgumentError: InvalidArgumentError, InvalidOptionArgumentError: InvalidOptionArgumentError, Command: Command, Argument: Argument, Option: Option, Help: Help } = commander;
1755
- export { Argument, Command, CommanderError, Help, InvalidArgumentError, InvalidOptionArgumentError, Option, createArgument, createCommand, createOption, program };
1758
+ const { DM: program, gu: createCommand, er: createArgument, Ww: createOption, b7: CommanderError, Di: InvalidArgumentError, a2: InvalidOptionArgumentError, uB: Command, ef: Argument, c$: Option, _V: Help } = commander;
1759
+ export { esm_namespaceObject };