routesync 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -10,9 +10,16 @@ var __typeError = (msg) => {
10
10
  throw TypeError(msg);
11
11
  };
12
12
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
13
16
  var __commonJS = (cb, mod) => function __require() {
14
17
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
18
  };
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
16
23
  var __copyProps = (to, from, except, desc) => {
17
24
  if (from && typeof from === "object" || typeof from === "function") {
18
25
  for (let key of __getOwnPropNames(from))
@@ -29,6 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
36
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
37
  mod
31
38
  ));
39
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
40
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
33
41
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
34
42
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
@@ -983,8 +991,8 @@ var require_command = __commonJS({
983
991
  "use strict";
984
992
  var EventEmitter = require("events").EventEmitter;
985
993
  var childProcess = require("child_process");
986
- var path5 = require("path");
987
- var fs9 = require("fs");
994
+ var path10 = require("path");
995
+ var fs14 = require("fs");
988
996
  var process10 = require("process");
989
997
  var { Argument: Argument2, humanReadableArgName } = require_argument();
990
998
  var { CommanderError: CommanderError2 } = require_error();
@@ -1916,11 +1924,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1916
1924
  let launchWithNode = false;
1917
1925
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1918
1926
  function findFile(baseDir, baseName) {
1919
- const localBin = path5.resolve(baseDir, baseName);
1920
- if (fs9.existsSync(localBin)) return localBin;
1921
- if (sourceExt.includes(path5.extname(baseName))) return void 0;
1927
+ const localBin = path10.resolve(baseDir, baseName);
1928
+ if (fs14.existsSync(localBin)) return localBin;
1929
+ if (sourceExt.includes(path10.extname(baseName))) return void 0;
1922
1930
  const foundExt = sourceExt.find(
1923
- (ext) => fs9.existsSync(`${localBin}${ext}`)
1931
+ (ext) => fs14.existsSync(`${localBin}${ext}`)
1924
1932
  );
1925
1933
  if (foundExt) return `${localBin}${foundExt}`;
1926
1934
  return void 0;
@@ -1932,21 +1940,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
1932
1940
  if (this._scriptPath) {
1933
1941
  let resolvedScriptPath;
1934
1942
  try {
1935
- resolvedScriptPath = fs9.realpathSync(this._scriptPath);
1943
+ resolvedScriptPath = fs14.realpathSync(this._scriptPath);
1936
1944
  } catch (err) {
1937
1945
  resolvedScriptPath = this._scriptPath;
1938
1946
  }
1939
- executableDir = path5.resolve(
1940
- path5.dirname(resolvedScriptPath),
1947
+ executableDir = path10.resolve(
1948
+ path10.dirname(resolvedScriptPath),
1941
1949
  executableDir
1942
1950
  );
1943
1951
  }
1944
1952
  if (executableDir) {
1945
1953
  let localFile = findFile(executableDir, executableFile);
1946
1954
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1947
- const legacyName = path5.basename(
1955
+ const legacyName = path10.basename(
1948
1956
  this._scriptPath,
1949
- path5.extname(this._scriptPath)
1957
+ path10.extname(this._scriptPath)
1950
1958
  );
1951
1959
  if (legacyName !== this._name) {
1952
1960
  localFile = findFile(
@@ -1957,7 +1965,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1957
1965
  }
1958
1966
  executableFile = localFile || executableFile;
1959
1967
  }
1960
- launchWithNode = sourceExt.includes(path5.extname(executableFile));
1968
+ launchWithNode = sourceExt.includes(path10.extname(executableFile));
1961
1969
  let proc;
1962
1970
  if (process10.platform !== "win32") {
1963
1971
  if (launchWithNode) {
@@ -2797,7 +2805,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2797
2805
  * @return {Command}
2798
2806
  */
2799
2807
  nameFromFilename(filename) {
2800
- this._name = path5.basename(filename, path5.extname(filename));
2808
+ this._name = path10.basename(filename, path10.extname(filename));
2801
2809
  return this;
2802
2810
  }
2803
2811
  /**
@@ -2811,9 +2819,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2811
2819
  * @param {string} [path]
2812
2820
  * @return {(string|null|Command)}
2813
2821
  */
2814
- executableDir(path6) {
2815
- if (path6 === void 0) return this._executableDir;
2816
- this._executableDir = path6;
2822
+ executableDir(path11) {
2823
+ if (path11 === void 0) return this._executableDir;
2824
+ this._executableDir = path11;
2817
2825
  return this;
2818
2826
  }
2819
2827
  /**
@@ -4744,54 +4752,54 @@ var require_polyfills = __commonJS({
4744
4752
  }
4745
4753
  var chdir;
4746
4754
  module2.exports = patch;
4747
- function patch(fs9) {
4755
+ function patch(fs14) {
4748
4756
  if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
4749
- patchLchmod(fs9);
4750
- }
4751
- if (!fs9.lutimes) {
4752
- patchLutimes(fs9);
4753
- }
4754
- fs9.chown = chownFix(fs9.chown);
4755
- fs9.fchown = chownFix(fs9.fchown);
4756
- fs9.lchown = chownFix(fs9.lchown);
4757
- fs9.chmod = chmodFix(fs9.chmod);
4758
- fs9.fchmod = chmodFix(fs9.fchmod);
4759
- fs9.lchmod = chmodFix(fs9.lchmod);
4760
- fs9.chownSync = chownFixSync(fs9.chownSync);
4761
- fs9.fchownSync = chownFixSync(fs9.fchownSync);
4762
- fs9.lchownSync = chownFixSync(fs9.lchownSync);
4763
- fs9.chmodSync = chmodFixSync(fs9.chmodSync);
4764
- fs9.fchmodSync = chmodFixSync(fs9.fchmodSync);
4765
- fs9.lchmodSync = chmodFixSync(fs9.lchmodSync);
4766
- fs9.stat = statFix(fs9.stat);
4767
- fs9.fstat = statFix(fs9.fstat);
4768
- fs9.lstat = statFix(fs9.lstat);
4769
- fs9.statSync = statFixSync(fs9.statSync);
4770
- fs9.fstatSync = statFixSync(fs9.fstatSync);
4771
- fs9.lstatSync = statFixSync(fs9.lstatSync);
4772
- if (fs9.chmod && !fs9.lchmod) {
4773
- fs9.lchmod = function(path5, mode, cb) {
4757
+ patchLchmod(fs14);
4758
+ }
4759
+ if (!fs14.lutimes) {
4760
+ patchLutimes(fs14);
4761
+ }
4762
+ fs14.chown = chownFix(fs14.chown);
4763
+ fs14.fchown = chownFix(fs14.fchown);
4764
+ fs14.lchown = chownFix(fs14.lchown);
4765
+ fs14.chmod = chmodFix(fs14.chmod);
4766
+ fs14.fchmod = chmodFix(fs14.fchmod);
4767
+ fs14.lchmod = chmodFix(fs14.lchmod);
4768
+ fs14.chownSync = chownFixSync(fs14.chownSync);
4769
+ fs14.fchownSync = chownFixSync(fs14.fchownSync);
4770
+ fs14.lchownSync = chownFixSync(fs14.lchownSync);
4771
+ fs14.chmodSync = chmodFixSync(fs14.chmodSync);
4772
+ fs14.fchmodSync = chmodFixSync(fs14.fchmodSync);
4773
+ fs14.lchmodSync = chmodFixSync(fs14.lchmodSync);
4774
+ fs14.stat = statFix(fs14.stat);
4775
+ fs14.fstat = statFix(fs14.fstat);
4776
+ fs14.lstat = statFix(fs14.lstat);
4777
+ fs14.statSync = statFixSync(fs14.statSync);
4778
+ fs14.fstatSync = statFixSync(fs14.fstatSync);
4779
+ fs14.lstatSync = statFixSync(fs14.lstatSync);
4780
+ if (fs14.chmod && !fs14.lchmod) {
4781
+ fs14.lchmod = function(path10, mode, cb) {
4774
4782
  if (cb) process.nextTick(cb);
4775
4783
  };
4776
- fs9.lchmodSync = function() {
4784
+ fs14.lchmodSync = function() {
4777
4785
  };
4778
4786
  }
4779
- if (fs9.chown && !fs9.lchown) {
4780
- fs9.lchown = function(path5, uid, gid, cb) {
4787
+ if (fs14.chown && !fs14.lchown) {
4788
+ fs14.lchown = function(path10, uid, gid, cb) {
4781
4789
  if (cb) process.nextTick(cb);
4782
4790
  };
4783
- fs9.lchownSync = function() {
4791
+ fs14.lchownSync = function() {
4784
4792
  };
4785
4793
  }
4786
4794
  if (platform === "win32") {
4787
- fs9.rename = typeof fs9.rename !== "function" ? fs9.rename : (function(fs$rename) {
4795
+ fs14.rename = typeof fs14.rename !== "function" ? fs14.rename : (function(fs$rename) {
4788
4796
  function rename(from, to, cb) {
4789
4797
  var start = Date.now();
4790
4798
  var backoff = 0;
4791
4799
  fs$rename(from, to, function CB(er) {
4792
4800
  if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
4793
4801
  setTimeout(function() {
4794
- fs9.stat(to, function(stater, st) {
4802
+ fs14.stat(to, function(stater, st) {
4795
4803
  if (stater && stater.code === "ENOENT")
4796
4804
  fs$rename(from, to, CB);
4797
4805
  else
@@ -4807,9 +4815,9 @@ var require_polyfills = __commonJS({
4807
4815
  }
4808
4816
  if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
4809
4817
  return rename;
4810
- })(fs9.rename);
4818
+ })(fs14.rename);
4811
4819
  }
4812
- fs9.read = typeof fs9.read !== "function" ? fs9.read : (function(fs$read) {
4820
+ fs14.read = typeof fs14.read !== "function" ? fs14.read : (function(fs$read) {
4813
4821
  function read(fd, buffer, offset, length, position, callback_) {
4814
4822
  var callback;
4815
4823
  if (callback_ && typeof callback_ === "function") {
@@ -4817,22 +4825,22 @@ var require_polyfills = __commonJS({
4817
4825
  callback = function(er, _, __) {
4818
4826
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
4819
4827
  eagCounter++;
4820
- return fs$read.call(fs9, fd, buffer, offset, length, position, callback);
4828
+ return fs$read.call(fs14, fd, buffer, offset, length, position, callback);
4821
4829
  }
4822
4830
  callback_.apply(this, arguments);
4823
4831
  };
4824
4832
  }
4825
- return fs$read.call(fs9, fd, buffer, offset, length, position, callback);
4833
+ return fs$read.call(fs14, fd, buffer, offset, length, position, callback);
4826
4834
  }
4827
4835
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
4828
4836
  return read;
4829
- })(fs9.read);
4830
- fs9.readSync = typeof fs9.readSync !== "function" ? fs9.readSync : /* @__PURE__ */ (function(fs$readSync) {
4837
+ })(fs14.read);
4838
+ fs14.readSync = typeof fs14.readSync !== "function" ? fs14.readSync : /* @__PURE__ */ (function(fs$readSync) {
4831
4839
  return function(fd, buffer, offset, length, position) {
4832
4840
  var eagCounter = 0;
4833
4841
  while (true) {
4834
4842
  try {
4835
- return fs$readSync.call(fs9, fd, buffer, offset, length, position);
4843
+ return fs$readSync.call(fs14, fd, buffer, offset, length, position);
4836
4844
  } catch (er) {
4837
4845
  if (er.code === "EAGAIN" && eagCounter < 10) {
4838
4846
  eagCounter++;
@@ -4842,11 +4850,11 @@ var require_polyfills = __commonJS({
4842
4850
  }
4843
4851
  }
4844
4852
  };
4845
- })(fs9.readSync);
4846
- function patchLchmod(fs10) {
4847
- fs10.lchmod = function(path5, mode, callback) {
4848
- fs10.open(
4849
- path5,
4853
+ })(fs14.readSync);
4854
+ function patchLchmod(fs15) {
4855
+ fs15.lchmod = function(path10, mode, callback) {
4856
+ fs15.open(
4857
+ path10,
4850
4858
  constants.O_WRONLY | constants.O_SYMLINK,
4851
4859
  mode,
4852
4860
  function(err, fd) {
@@ -4854,80 +4862,80 @@ var require_polyfills = __commonJS({
4854
4862
  if (callback) callback(err);
4855
4863
  return;
4856
4864
  }
4857
- fs10.fchmod(fd, mode, function(err2) {
4858
- fs10.close(fd, function(err22) {
4865
+ fs15.fchmod(fd, mode, function(err2) {
4866
+ fs15.close(fd, function(err22) {
4859
4867
  if (callback) callback(err2 || err22);
4860
4868
  });
4861
4869
  });
4862
4870
  }
4863
4871
  );
4864
4872
  };
4865
- fs10.lchmodSync = function(path5, mode) {
4866
- var fd = fs10.openSync(path5, constants.O_WRONLY | constants.O_SYMLINK, mode);
4873
+ fs15.lchmodSync = function(path10, mode) {
4874
+ var fd = fs15.openSync(path10, constants.O_WRONLY | constants.O_SYMLINK, mode);
4867
4875
  var threw = true;
4868
4876
  var ret;
4869
4877
  try {
4870
- ret = fs10.fchmodSync(fd, mode);
4878
+ ret = fs15.fchmodSync(fd, mode);
4871
4879
  threw = false;
4872
4880
  } finally {
4873
4881
  if (threw) {
4874
4882
  try {
4875
- fs10.closeSync(fd);
4883
+ fs15.closeSync(fd);
4876
4884
  } catch (er) {
4877
4885
  }
4878
4886
  } else {
4879
- fs10.closeSync(fd);
4887
+ fs15.closeSync(fd);
4880
4888
  }
4881
4889
  }
4882
4890
  return ret;
4883
4891
  };
4884
4892
  }
4885
- function patchLutimes(fs10) {
4886
- if (constants.hasOwnProperty("O_SYMLINK") && fs10.futimes) {
4887
- fs10.lutimes = function(path5, at, mt, cb) {
4888
- fs10.open(path5, constants.O_SYMLINK, function(er, fd) {
4893
+ function patchLutimes(fs15) {
4894
+ if (constants.hasOwnProperty("O_SYMLINK") && fs15.futimes) {
4895
+ fs15.lutimes = function(path10, at, mt, cb) {
4896
+ fs15.open(path10, constants.O_SYMLINK, function(er, fd) {
4889
4897
  if (er) {
4890
4898
  if (cb) cb(er);
4891
4899
  return;
4892
4900
  }
4893
- fs10.futimes(fd, at, mt, function(er2) {
4894
- fs10.close(fd, function(er22) {
4901
+ fs15.futimes(fd, at, mt, function(er2) {
4902
+ fs15.close(fd, function(er22) {
4895
4903
  if (cb) cb(er2 || er22);
4896
4904
  });
4897
4905
  });
4898
4906
  });
4899
4907
  };
4900
- fs10.lutimesSync = function(path5, at, mt) {
4901
- var fd = fs10.openSync(path5, constants.O_SYMLINK);
4908
+ fs15.lutimesSync = function(path10, at, mt) {
4909
+ var fd = fs15.openSync(path10, constants.O_SYMLINK);
4902
4910
  var ret;
4903
4911
  var threw = true;
4904
4912
  try {
4905
- ret = fs10.futimesSync(fd, at, mt);
4913
+ ret = fs15.futimesSync(fd, at, mt);
4906
4914
  threw = false;
4907
4915
  } finally {
4908
4916
  if (threw) {
4909
4917
  try {
4910
- fs10.closeSync(fd);
4918
+ fs15.closeSync(fd);
4911
4919
  } catch (er) {
4912
4920
  }
4913
4921
  } else {
4914
- fs10.closeSync(fd);
4922
+ fs15.closeSync(fd);
4915
4923
  }
4916
4924
  }
4917
4925
  return ret;
4918
4926
  };
4919
- } else if (fs10.futimes) {
4920
- fs10.lutimes = function(_a, _b, _c, cb) {
4927
+ } else if (fs15.futimes) {
4928
+ fs15.lutimes = function(_a, _b, _c, cb) {
4921
4929
  if (cb) process.nextTick(cb);
4922
4930
  };
4923
- fs10.lutimesSync = function() {
4931
+ fs15.lutimesSync = function() {
4924
4932
  };
4925
4933
  }
4926
4934
  }
4927
4935
  function chmodFix(orig) {
4928
4936
  if (!orig) return orig;
4929
4937
  return function(target, mode, cb) {
4930
- return orig.call(fs9, target, mode, function(er) {
4938
+ return orig.call(fs14, target, mode, function(er) {
4931
4939
  if (chownErOk(er)) er = null;
4932
4940
  if (cb) cb.apply(this, arguments);
4933
4941
  });
@@ -4937,7 +4945,7 @@ var require_polyfills = __commonJS({
4937
4945
  if (!orig) return orig;
4938
4946
  return function(target, mode) {
4939
4947
  try {
4940
- return orig.call(fs9, target, mode);
4948
+ return orig.call(fs14, target, mode);
4941
4949
  } catch (er) {
4942
4950
  if (!chownErOk(er)) throw er;
4943
4951
  }
@@ -4946,7 +4954,7 @@ var require_polyfills = __commonJS({
4946
4954
  function chownFix(orig) {
4947
4955
  if (!orig) return orig;
4948
4956
  return function(target, uid, gid, cb) {
4949
- return orig.call(fs9, target, uid, gid, function(er) {
4957
+ return orig.call(fs14, target, uid, gid, function(er) {
4950
4958
  if (chownErOk(er)) er = null;
4951
4959
  if (cb) cb.apply(this, arguments);
4952
4960
  });
@@ -4956,7 +4964,7 @@ var require_polyfills = __commonJS({
4956
4964
  if (!orig) return orig;
4957
4965
  return function(target, uid, gid) {
4958
4966
  try {
4959
- return orig.call(fs9, target, uid, gid);
4967
+ return orig.call(fs14, target, uid, gid);
4960
4968
  } catch (er) {
4961
4969
  if (!chownErOk(er)) throw er;
4962
4970
  }
@@ -4976,13 +4984,13 @@ var require_polyfills = __commonJS({
4976
4984
  }
4977
4985
  if (cb) cb.apply(this, arguments);
4978
4986
  }
4979
- return options ? orig.call(fs9, target, options, callback) : orig.call(fs9, target, callback);
4987
+ return options ? orig.call(fs14, target, options, callback) : orig.call(fs14, target, callback);
4980
4988
  };
4981
4989
  }
4982
4990
  function statFixSync(orig) {
4983
4991
  if (!orig) return orig;
4984
4992
  return function(target, options) {
4985
- var stats = options ? orig.call(fs9, target, options) : orig.call(fs9, target);
4993
+ var stats = options ? orig.call(fs14, target, options) : orig.call(fs14, target);
4986
4994
  if (stats) {
4987
4995
  if (stats.uid < 0) stats.uid += 4294967296;
4988
4996
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -5012,16 +5020,16 @@ var require_legacy_streams = __commonJS({
5012
5020
  "use strict";
5013
5021
  var Stream = require("stream").Stream;
5014
5022
  module2.exports = legacy;
5015
- function legacy(fs9) {
5023
+ function legacy(fs14) {
5016
5024
  return {
5017
5025
  ReadStream,
5018
5026
  WriteStream
5019
5027
  };
5020
- function ReadStream(path5, options) {
5021
- if (!(this instanceof ReadStream)) return new ReadStream(path5, options);
5028
+ function ReadStream(path10, options) {
5029
+ if (!(this instanceof ReadStream)) return new ReadStream(path10, options);
5022
5030
  Stream.call(this);
5023
5031
  var self = this;
5024
- this.path = path5;
5032
+ this.path = path10;
5025
5033
  this.fd = null;
5026
5034
  this.readable = true;
5027
5035
  this.paused = false;
@@ -5055,7 +5063,7 @@ var require_legacy_streams = __commonJS({
5055
5063
  });
5056
5064
  return;
5057
5065
  }
5058
- fs9.open(this.path, this.flags, this.mode, function(err, fd) {
5066
+ fs14.open(this.path, this.flags, this.mode, function(err, fd) {
5059
5067
  if (err) {
5060
5068
  self.emit("error", err);
5061
5069
  self.readable = false;
@@ -5066,10 +5074,10 @@ var require_legacy_streams = __commonJS({
5066
5074
  self._read();
5067
5075
  });
5068
5076
  }
5069
- function WriteStream(path5, options) {
5070
- if (!(this instanceof WriteStream)) return new WriteStream(path5, options);
5077
+ function WriteStream(path10, options) {
5078
+ if (!(this instanceof WriteStream)) return new WriteStream(path10, options);
5071
5079
  Stream.call(this);
5072
- this.path = path5;
5080
+ this.path = path10;
5073
5081
  this.fd = null;
5074
5082
  this.writable = true;
5075
5083
  this.flags = "w";
@@ -5094,7 +5102,7 @@ var require_legacy_streams = __commonJS({
5094
5102
  this.busy = false;
5095
5103
  this._queue = [];
5096
5104
  if (this.fd === null) {
5097
- this._open = fs9.open;
5105
+ this._open = fs14.open;
5098
5106
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
5099
5107
  this.flush();
5100
5108
  }
@@ -5130,7 +5138,7 @@ var require_clone = __commonJS({
5130
5138
  var require_graceful_fs = __commonJS({
5131
5139
  "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
5132
5140
  "use strict";
5133
- var fs9 = require("fs");
5141
+ var fs14 = require("fs");
5134
5142
  var polyfills = require_polyfills();
5135
5143
  var legacy = require_legacy_streams();
5136
5144
  var clone = require_clone();
@@ -5162,12 +5170,12 @@ var require_graceful_fs = __commonJS({
5162
5170
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
5163
5171
  console.error(m);
5164
5172
  };
5165
- if (!fs9[gracefulQueue]) {
5173
+ if (!fs14[gracefulQueue]) {
5166
5174
  queue = global[gracefulQueue] || [];
5167
- publishQueue(fs9, queue);
5168
- fs9.close = (function(fs$close) {
5175
+ publishQueue(fs14, queue);
5176
+ fs14.close = (function(fs$close) {
5169
5177
  function close(fd, cb) {
5170
- return fs$close.call(fs9, fd, function(err) {
5178
+ return fs$close.call(fs14, fd, function(err) {
5171
5179
  if (!err) {
5172
5180
  resetQueue();
5173
5181
  }
@@ -5179,48 +5187,48 @@ var require_graceful_fs = __commonJS({
5179
5187
  value: fs$close
5180
5188
  });
5181
5189
  return close;
5182
- })(fs9.close);
5183
- fs9.closeSync = (function(fs$closeSync) {
5190
+ })(fs14.close);
5191
+ fs14.closeSync = (function(fs$closeSync) {
5184
5192
  function closeSync(fd) {
5185
- fs$closeSync.apply(fs9, arguments);
5193
+ fs$closeSync.apply(fs14, arguments);
5186
5194
  resetQueue();
5187
5195
  }
5188
5196
  Object.defineProperty(closeSync, previousSymbol, {
5189
5197
  value: fs$closeSync
5190
5198
  });
5191
5199
  return closeSync;
5192
- })(fs9.closeSync);
5200
+ })(fs14.closeSync);
5193
5201
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
5194
5202
  process.on("exit", function() {
5195
- debug(fs9[gracefulQueue]);
5196
- require("assert").equal(fs9[gracefulQueue].length, 0);
5203
+ debug(fs14[gracefulQueue]);
5204
+ require("assert").equal(fs14[gracefulQueue].length, 0);
5197
5205
  });
5198
5206
  }
5199
5207
  }
5200
5208
  var queue;
5201
5209
  if (!global[gracefulQueue]) {
5202
- publishQueue(global, fs9[gracefulQueue]);
5203
- }
5204
- module2.exports = patch(clone(fs9));
5205
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs9.__patched) {
5206
- module2.exports = patch(fs9);
5207
- fs9.__patched = true;
5208
- }
5209
- function patch(fs10) {
5210
- polyfills(fs10);
5211
- fs10.gracefulify = patch;
5212
- fs10.createReadStream = createReadStream;
5213
- fs10.createWriteStream = createWriteStream;
5214
- var fs$readFile = fs10.readFile;
5215
- fs10.readFile = readFile;
5216
- function readFile(path5, options, cb) {
5210
+ publishQueue(global, fs14[gracefulQueue]);
5211
+ }
5212
+ module2.exports = patch(clone(fs14));
5213
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs14.__patched) {
5214
+ module2.exports = patch(fs14);
5215
+ fs14.__patched = true;
5216
+ }
5217
+ function patch(fs15) {
5218
+ polyfills(fs15);
5219
+ fs15.gracefulify = patch;
5220
+ fs15.createReadStream = createReadStream;
5221
+ fs15.createWriteStream = createWriteStream;
5222
+ var fs$readFile = fs15.readFile;
5223
+ fs15.readFile = readFile;
5224
+ function readFile(path10, options, cb) {
5217
5225
  if (typeof options === "function")
5218
5226
  cb = options, options = null;
5219
- return go$readFile(path5, options, cb);
5220
- function go$readFile(path6, options2, cb2, startTime) {
5221
- return fs$readFile(path6, options2, function(err) {
5227
+ return go$readFile(path10, options, cb);
5228
+ function go$readFile(path11, options2, cb2, startTime) {
5229
+ return fs$readFile(path11, options2, function(err) {
5222
5230
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5223
- enqueue([go$readFile, [path6, options2, cb2], err, startTime || Date.now(), Date.now()]);
5231
+ enqueue([go$readFile, [path11, options2, cb2], err, startTime || Date.now(), Date.now()]);
5224
5232
  else {
5225
5233
  if (typeof cb2 === "function")
5226
5234
  cb2.apply(this, arguments);
@@ -5228,16 +5236,16 @@ var require_graceful_fs = __commonJS({
5228
5236
  });
5229
5237
  }
5230
5238
  }
5231
- var fs$writeFile = fs10.writeFile;
5232
- fs10.writeFile = writeFile;
5233
- function writeFile(path5, data, options, cb) {
5239
+ var fs$writeFile = fs15.writeFile;
5240
+ fs15.writeFile = writeFile;
5241
+ function writeFile(path10, data, options, cb) {
5234
5242
  if (typeof options === "function")
5235
5243
  cb = options, options = null;
5236
- return go$writeFile(path5, data, options, cb);
5237
- function go$writeFile(path6, data2, options2, cb2, startTime) {
5238
- return fs$writeFile(path6, data2, options2, function(err) {
5244
+ return go$writeFile(path10, data, options, cb);
5245
+ function go$writeFile(path11, data2, options2, cb2, startTime) {
5246
+ return fs$writeFile(path11, data2, options2, function(err) {
5239
5247
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5240
- enqueue([go$writeFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5248
+ enqueue([go$writeFile, [path11, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5241
5249
  else {
5242
5250
  if (typeof cb2 === "function")
5243
5251
  cb2.apply(this, arguments);
@@ -5245,17 +5253,17 @@ var require_graceful_fs = __commonJS({
5245
5253
  });
5246
5254
  }
5247
5255
  }
5248
- var fs$appendFile = fs10.appendFile;
5256
+ var fs$appendFile = fs15.appendFile;
5249
5257
  if (fs$appendFile)
5250
- fs10.appendFile = appendFile;
5251
- function appendFile(path5, data, options, cb) {
5258
+ fs15.appendFile = appendFile;
5259
+ function appendFile(path10, data, options, cb) {
5252
5260
  if (typeof options === "function")
5253
5261
  cb = options, options = null;
5254
- return go$appendFile(path5, data, options, cb);
5255
- function go$appendFile(path6, data2, options2, cb2, startTime) {
5256
- return fs$appendFile(path6, data2, options2, function(err) {
5262
+ return go$appendFile(path10, data, options, cb);
5263
+ function go$appendFile(path11, data2, options2, cb2, startTime) {
5264
+ return fs$appendFile(path11, data2, options2, function(err) {
5257
5265
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5258
- enqueue([go$appendFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5266
+ enqueue([go$appendFile, [path11, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
5259
5267
  else {
5260
5268
  if (typeof cb2 === "function")
5261
5269
  cb2.apply(this, arguments);
@@ -5263,9 +5271,9 @@ var require_graceful_fs = __commonJS({
5263
5271
  });
5264
5272
  }
5265
5273
  }
5266
- var fs$copyFile = fs10.copyFile;
5274
+ var fs$copyFile = fs15.copyFile;
5267
5275
  if (fs$copyFile)
5268
- fs10.copyFile = copyFile;
5276
+ fs15.copyFile = copyFile;
5269
5277
  function copyFile(src, dest, flags, cb) {
5270
5278
  if (typeof flags === "function") {
5271
5279
  cb = flags;
@@ -5283,34 +5291,34 @@ var require_graceful_fs = __commonJS({
5283
5291
  });
5284
5292
  }
5285
5293
  }
5286
- var fs$readdir = fs10.readdir;
5287
- fs10.readdir = readdir;
5294
+ var fs$readdir = fs15.readdir;
5295
+ fs15.readdir = readdir;
5288
5296
  var noReaddirOptionVersions = /^v[0-5]\./;
5289
- function readdir(path5, options, cb) {
5297
+ function readdir(path10, options, cb) {
5290
5298
  if (typeof options === "function")
5291
5299
  cb = options, options = null;
5292
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path6, options2, cb2, startTime) {
5293
- return fs$readdir(path6, fs$readdirCallback(
5294
- path6,
5300
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path11, options2, cb2, startTime) {
5301
+ return fs$readdir(path11, fs$readdirCallback(
5302
+ path11,
5295
5303
  options2,
5296
5304
  cb2,
5297
5305
  startTime
5298
5306
  ));
5299
- } : function go$readdir2(path6, options2, cb2, startTime) {
5300
- return fs$readdir(path6, options2, fs$readdirCallback(
5301
- path6,
5307
+ } : function go$readdir2(path11, options2, cb2, startTime) {
5308
+ return fs$readdir(path11, options2, fs$readdirCallback(
5309
+ path11,
5302
5310
  options2,
5303
5311
  cb2,
5304
5312
  startTime
5305
5313
  ));
5306
5314
  };
5307
- return go$readdir(path5, options, cb);
5308
- function fs$readdirCallback(path6, options2, cb2, startTime) {
5315
+ return go$readdir(path10, options, cb);
5316
+ function fs$readdirCallback(path11, options2, cb2, startTime) {
5309
5317
  return function(err, files) {
5310
5318
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5311
5319
  enqueue([
5312
5320
  go$readdir,
5313
- [path6, options2, cb2],
5321
+ [path11, options2, cb2],
5314
5322
  err,
5315
5323
  startTime || Date.now(),
5316
5324
  Date.now()
@@ -5325,21 +5333,21 @@ var require_graceful_fs = __commonJS({
5325
5333
  }
5326
5334
  }
5327
5335
  if (process.version.substr(0, 4) === "v0.8") {
5328
- var legStreams = legacy(fs10);
5336
+ var legStreams = legacy(fs15);
5329
5337
  ReadStream = legStreams.ReadStream;
5330
5338
  WriteStream = legStreams.WriteStream;
5331
5339
  }
5332
- var fs$ReadStream = fs10.ReadStream;
5340
+ var fs$ReadStream = fs15.ReadStream;
5333
5341
  if (fs$ReadStream) {
5334
5342
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
5335
5343
  ReadStream.prototype.open = ReadStream$open;
5336
5344
  }
5337
- var fs$WriteStream = fs10.WriteStream;
5345
+ var fs$WriteStream = fs15.WriteStream;
5338
5346
  if (fs$WriteStream) {
5339
5347
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
5340
5348
  WriteStream.prototype.open = WriteStream$open;
5341
5349
  }
5342
- Object.defineProperty(fs10, "ReadStream", {
5350
+ Object.defineProperty(fs15, "ReadStream", {
5343
5351
  get: function() {
5344
5352
  return ReadStream;
5345
5353
  },
@@ -5349,7 +5357,7 @@ var require_graceful_fs = __commonJS({
5349
5357
  enumerable: true,
5350
5358
  configurable: true
5351
5359
  });
5352
- Object.defineProperty(fs10, "WriteStream", {
5360
+ Object.defineProperty(fs15, "WriteStream", {
5353
5361
  get: function() {
5354
5362
  return WriteStream;
5355
5363
  },
@@ -5360,7 +5368,7 @@ var require_graceful_fs = __commonJS({
5360
5368
  configurable: true
5361
5369
  });
5362
5370
  var FileReadStream = ReadStream;
5363
- Object.defineProperty(fs10, "FileReadStream", {
5371
+ Object.defineProperty(fs15, "FileReadStream", {
5364
5372
  get: function() {
5365
5373
  return FileReadStream;
5366
5374
  },
@@ -5371,7 +5379,7 @@ var require_graceful_fs = __commonJS({
5371
5379
  configurable: true
5372
5380
  });
5373
5381
  var FileWriteStream = WriteStream;
5374
- Object.defineProperty(fs10, "FileWriteStream", {
5382
+ Object.defineProperty(fs15, "FileWriteStream", {
5375
5383
  get: function() {
5376
5384
  return FileWriteStream;
5377
5385
  },
@@ -5381,7 +5389,7 @@ var require_graceful_fs = __commonJS({
5381
5389
  enumerable: true,
5382
5390
  configurable: true
5383
5391
  });
5384
- function ReadStream(path5, options) {
5392
+ function ReadStream(path10, options) {
5385
5393
  if (this instanceof ReadStream)
5386
5394
  return fs$ReadStream.apply(this, arguments), this;
5387
5395
  else
@@ -5401,7 +5409,7 @@ var require_graceful_fs = __commonJS({
5401
5409
  }
5402
5410
  });
5403
5411
  }
5404
- function WriteStream(path5, options) {
5412
+ function WriteStream(path10, options) {
5405
5413
  if (this instanceof WriteStream)
5406
5414
  return fs$WriteStream.apply(this, arguments), this;
5407
5415
  else
@@ -5419,22 +5427,22 @@ var require_graceful_fs = __commonJS({
5419
5427
  }
5420
5428
  });
5421
5429
  }
5422
- function createReadStream(path5, options) {
5423
- return new fs10.ReadStream(path5, options);
5430
+ function createReadStream(path10, options) {
5431
+ return new fs15.ReadStream(path10, options);
5424
5432
  }
5425
- function createWriteStream(path5, options) {
5426
- return new fs10.WriteStream(path5, options);
5433
+ function createWriteStream(path10, options) {
5434
+ return new fs15.WriteStream(path10, options);
5427
5435
  }
5428
- var fs$open = fs10.open;
5429
- fs10.open = open;
5430
- function open(path5, flags, mode, cb) {
5436
+ var fs$open = fs15.open;
5437
+ fs15.open = open;
5438
+ function open(path10, flags, mode, cb) {
5431
5439
  if (typeof mode === "function")
5432
5440
  cb = mode, mode = null;
5433
- return go$open(path5, flags, mode, cb);
5434
- function go$open(path6, flags2, mode2, cb2, startTime) {
5435
- return fs$open(path6, flags2, mode2, function(err, fd) {
5441
+ return go$open(path10, flags, mode, cb);
5442
+ function go$open(path11, flags2, mode2, cb2, startTime) {
5443
+ return fs$open(path11, flags2, mode2, function(err, fd) {
5436
5444
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
5437
- enqueue([go$open, [path6, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
5445
+ enqueue([go$open, [path11, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
5438
5446
  else {
5439
5447
  if (typeof cb2 === "function")
5440
5448
  cb2.apply(this, arguments);
@@ -5442,20 +5450,20 @@ var require_graceful_fs = __commonJS({
5442
5450
  });
5443
5451
  }
5444
5452
  }
5445
- return fs10;
5453
+ return fs15;
5446
5454
  }
5447
5455
  function enqueue(elem) {
5448
5456
  debug("ENQUEUE", elem[0].name, elem[1]);
5449
- fs9[gracefulQueue].push(elem);
5457
+ fs14[gracefulQueue].push(elem);
5450
5458
  retry();
5451
5459
  }
5452
5460
  var retryTimer;
5453
5461
  function resetQueue() {
5454
5462
  var now = Date.now();
5455
- for (var i = 0; i < fs9[gracefulQueue].length; ++i) {
5456
- if (fs9[gracefulQueue][i].length > 2) {
5457
- fs9[gracefulQueue][i][3] = now;
5458
- fs9[gracefulQueue][i][4] = now;
5463
+ for (var i = 0; i < fs14[gracefulQueue].length; ++i) {
5464
+ if (fs14[gracefulQueue][i].length > 2) {
5465
+ fs14[gracefulQueue][i][3] = now;
5466
+ fs14[gracefulQueue][i][4] = now;
5459
5467
  }
5460
5468
  }
5461
5469
  retry();
@@ -5463,9 +5471,9 @@ var require_graceful_fs = __commonJS({
5463
5471
  function retry() {
5464
5472
  clearTimeout(retryTimer);
5465
5473
  retryTimer = void 0;
5466
- if (fs9[gracefulQueue].length === 0)
5474
+ if (fs14[gracefulQueue].length === 0)
5467
5475
  return;
5468
- var elem = fs9[gracefulQueue].shift();
5476
+ var elem = fs14[gracefulQueue].shift();
5469
5477
  var fn = elem[0];
5470
5478
  var args = elem[1];
5471
5479
  var err = elem[2];
@@ -5487,7 +5495,7 @@ var require_graceful_fs = __commonJS({
5487
5495
  debug("RETRY", fn.name, args);
5488
5496
  fn.apply(null, args.concat([startTime]));
5489
5497
  } else {
5490
- fs9[gracefulQueue].push(elem);
5498
+ fs14[gracefulQueue].push(elem);
5491
5499
  }
5492
5500
  }
5493
5501
  if (retryTimer === void 0) {
@@ -5502,7 +5510,7 @@ var require_fs = __commonJS({
5502
5510
  "node_modules/fs-extra/lib/fs/index.js"(exports2) {
5503
5511
  "use strict";
5504
5512
  var u = require_universalify().fromCallback;
5505
- var fs9 = require_graceful_fs();
5513
+ var fs14 = require_graceful_fs();
5506
5514
  var api = [
5507
5515
  "access",
5508
5516
  "appendFile",
@@ -5543,26 +5551,26 @@ var require_fs = __commonJS({
5543
5551
  "utimes",
5544
5552
  "writeFile"
5545
5553
  ].filter((key) => {
5546
- return typeof fs9[key] === "function";
5554
+ return typeof fs14[key] === "function";
5547
5555
  });
5548
- Object.assign(exports2, fs9);
5556
+ Object.assign(exports2, fs14);
5549
5557
  api.forEach((method) => {
5550
- exports2[method] = u(fs9[method]);
5558
+ exports2[method] = u(fs14[method]);
5551
5559
  });
5552
5560
  exports2.exists = function(filename, callback) {
5553
5561
  if (typeof callback === "function") {
5554
- return fs9.exists(filename, callback);
5562
+ return fs14.exists(filename, callback);
5555
5563
  }
5556
5564
  return new Promise((resolve) => {
5557
- return fs9.exists(filename, resolve);
5565
+ return fs14.exists(filename, resolve);
5558
5566
  });
5559
5567
  };
5560
5568
  exports2.read = function(fd, buffer, offset, length, position, callback) {
5561
5569
  if (typeof callback === "function") {
5562
- return fs9.read(fd, buffer, offset, length, position, callback);
5570
+ return fs14.read(fd, buffer, offset, length, position, callback);
5563
5571
  }
5564
5572
  return new Promise((resolve, reject) => {
5565
- fs9.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
5573
+ fs14.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
5566
5574
  if (err) return reject(err);
5567
5575
  resolve({ bytesRead, buffer: buffer2 });
5568
5576
  });
@@ -5570,10 +5578,10 @@ var require_fs = __commonJS({
5570
5578
  };
5571
5579
  exports2.write = function(fd, buffer, ...args) {
5572
5580
  if (typeof args[args.length - 1] === "function") {
5573
- return fs9.write(fd, buffer, ...args);
5581
+ return fs14.write(fd, buffer, ...args);
5574
5582
  }
5575
5583
  return new Promise((resolve, reject) => {
5576
- fs9.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
5584
+ fs14.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
5577
5585
  if (err) return reject(err);
5578
5586
  resolve({ bytesWritten, buffer: buffer2 });
5579
5587
  });
@@ -5581,10 +5589,10 @@ var require_fs = __commonJS({
5581
5589
  };
5582
5590
  exports2.readv = function(fd, buffers, ...args) {
5583
5591
  if (typeof args[args.length - 1] === "function") {
5584
- return fs9.readv(fd, buffers, ...args);
5592
+ return fs14.readv(fd, buffers, ...args);
5585
5593
  }
5586
5594
  return new Promise((resolve, reject) => {
5587
- fs9.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
5595
+ fs14.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
5588
5596
  if (err) return reject(err);
5589
5597
  resolve({ bytesRead, buffers: buffers2 });
5590
5598
  });
@@ -5592,17 +5600,17 @@ var require_fs = __commonJS({
5592
5600
  };
5593
5601
  exports2.writev = function(fd, buffers, ...args) {
5594
5602
  if (typeof args[args.length - 1] === "function") {
5595
- return fs9.writev(fd, buffers, ...args);
5603
+ return fs14.writev(fd, buffers, ...args);
5596
5604
  }
5597
5605
  return new Promise((resolve, reject) => {
5598
- fs9.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
5606
+ fs14.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
5599
5607
  if (err) return reject(err);
5600
5608
  resolve({ bytesWritten, buffers: buffers2 });
5601
5609
  });
5602
5610
  });
5603
5611
  };
5604
- if (typeof fs9.realpath.native === "function") {
5605
- exports2.realpath.native = u(fs9.realpath.native);
5612
+ if (typeof fs14.realpath.native === "function") {
5613
+ exports2.realpath.native = u(fs14.realpath.native);
5606
5614
  } else {
5607
5615
  process.emitWarning(
5608
5616
  "fs.realpath.native is not a function. Is fs being monkey-patched?",
@@ -5617,10 +5625,10 @@ var require_fs = __commonJS({
5617
5625
  var require_utils = __commonJS({
5618
5626
  "node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
5619
5627
  "use strict";
5620
- var path5 = require("path");
5628
+ var path10 = require("path");
5621
5629
  module2.exports.checkPath = function checkPath(pth) {
5622
5630
  if (process.platform === "win32") {
5623
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path5.parse(pth).root, ""));
5631
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path10.parse(pth).root, ""));
5624
5632
  if (pathHasInvalidWinCharacters) {
5625
5633
  const error = new Error(`Path contains invalid characters: ${pth}`);
5626
5634
  error.code = "EINVAL";
@@ -5635,7 +5643,7 @@ var require_utils = __commonJS({
5635
5643
  var require_make_dir = __commonJS({
5636
5644
  "node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
5637
5645
  "use strict";
5638
- var fs9 = require_fs();
5646
+ var fs14 = require_fs();
5639
5647
  var { checkPath } = require_utils();
5640
5648
  var getMode = (options) => {
5641
5649
  const defaults = { mode: 511 };
@@ -5644,14 +5652,14 @@ var require_make_dir = __commonJS({
5644
5652
  };
5645
5653
  module2.exports.makeDir = async (dir, options) => {
5646
5654
  checkPath(dir);
5647
- return fs9.mkdir(dir, {
5655
+ return fs14.mkdir(dir, {
5648
5656
  mode: getMode(options),
5649
5657
  recursive: true
5650
5658
  });
5651
5659
  };
5652
5660
  module2.exports.makeDirSync = (dir, options) => {
5653
5661
  checkPath(dir);
5654
- return fs9.mkdirSync(dir, {
5662
+ return fs14.mkdirSync(dir, {
5655
5663
  mode: getMode(options),
5656
5664
  recursive: true
5657
5665
  });
@@ -5683,13 +5691,13 @@ var require_path_exists = __commonJS({
5683
5691
  "node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
5684
5692
  "use strict";
5685
5693
  var u = require_universalify().fromPromise;
5686
- var fs9 = require_fs();
5687
- function pathExists(path5) {
5688
- return fs9.access(path5).then(() => true).catch(() => false);
5694
+ var fs14 = require_fs();
5695
+ function pathExists(path10) {
5696
+ return fs14.access(path10).then(() => true).catch(() => false);
5689
5697
  }
5690
5698
  module2.exports = {
5691
5699
  pathExists: u(pathExists),
5692
- pathExistsSync: fs9.existsSync
5700
+ pathExistsSync: fs14.existsSync
5693
5701
  };
5694
5702
  }
5695
5703
  });
@@ -5698,18 +5706,18 @@ var require_path_exists = __commonJS({
5698
5706
  var require_utimes = __commonJS({
5699
5707
  "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
5700
5708
  "use strict";
5701
- var fs9 = require_fs();
5709
+ var fs14 = require_fs();
5702
5710
  var u = require_universalify().fromPromise;
5703
- async function utimesMillis(path5, atime, mtime) {
5704
- const fd = await fs9.open(path5, "r+");
5711
+ async function utimesMillis(path10, atime, mtime) {
5712
+ const fd = await fs14.open(path10, "r+");
5705
5713
  let error = null;
5706
5714
  try {
5707
- await fs9.futimes(fd, atime, mtime);
5715
+ await fs14.futimes(fd, atime, mtime);
5708
5716
  } catch (futimesErr) {
5709
5717
  error = futimesErr;
5710
5718
  } finally {
5711
5719
  try {
5712
- await fs9.close(fd);
5720
+ await fs14.close(fd);
5713
5721
  } catch (closeErr) {
5714
5722
  if (!error) error = closeErr;
5715
5723
  }
@@ -5718,16 +5726,16 @@ var require_utimes = __commonJS({
5718
5726
  throw error;
5719
5727
  }
5720
5728
  }
5721
- function utimesMillisSync(path5, atime, mtime) {
5722
- const fd = fs9.openSync(path5, "r+");
5729
+ function utimesMillisSync(path10, atime, mtime) {
5730
+ const fd = fs14.openSync(path10, "r+");
5723
5731
  let error = null;
5724
5732
  try {
5725
- fs9.futimesSync(fd, atime, mtime);
5733
+ fs14.futimesSync(fd, atime, mtime);
5726
5734
  } catch (futimesErr) {
5727
5735
  error = futimesErr;
5728
5736
  } finally {
5729
5737
  try {
5730
- fs9.closeSync(fd);
5738
+ fs14.closeSync(fd);
5731
5739
  } catch (closeErr) {
5732
5740
  if (!error) error = closeErr;
5733
5741
  }
@@ -5747,11 +5755,11 @@ var require_utimes = __commonJS({
5747
5755
  var require_stat = __commonJS({
5748
5756
  "node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
5749
5757
  "use strict";
5750
- var fs9 = require_fs();
5751
- var path5 = require("path");
5758
+ var fs14 = require_fs();
5759
+ var path10 = require("path");
5752
5760
  var u = require_universalify().fromPromise;
5753
5761
  function getStats(src, dest, opts) {
5754
- const statFunc = opts.dereference ? (file) => fs9.stat(file, { bigint: true }) : (file) => fs9.lstat(file, { bigint: true });
5762
+ const statFunc = opts.dereference ? (file) => fs14.stat(file, { bigint: true }) : (file) => fs14.lstat(file, { bigint: true });
5755
5763
  return Promise.all([
5756
5764
  statFunc(src),
5757
5765
  statFunc(dest).catch((err) => {
@@ -5762,7 +5770,7 @@ var require_stat = __commonJS({
5762
5770
  }
5763
5771
  function getStatsSync(src, dest, opts) {
5764
5772
  let destStat;
5765
- const statFunc = opts.dereference ? (file) => fs9.statSync(file, { bigint: true }) : (file) => fs9.lstatSync(file, { bigint: true });
5773
+ const statFunc = opts.dereference ? (file) => fs14.statSync(file, { bigint: true }) : (file) => fs14.lstatSync(file, { bigint: true });
5766
5774
  const srcStat = statFunc(src);
5767
5775
  try {
5768
5776
  destStat = statFunc(dest);
@@ -5776,8 +5784,8 @@ var require_stat = __commonJS({
5776
5784
  const { srcStat, destStat } = await getStats(src, dest, opts);
5777
5785
  if (destStat) {
5778
5786
  if (areIdentical(srcStat, destStat)) {
5779
- const srcBaseName = path5.basename(src);
5780
- const destBaseName = path5.basename(dest);
5787
+ const srcBaseName = path10.basename(src);
5788
+ const destBaseName = path10.basename(dest);
5781
5789
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
5782
5790
  return { srcStat, destStat, isChangingCase: true };
5783
5791
  }
@@ -5799,8 +5807,8 @@ var require_stat = __commonJS({
5799
5807
  const { srcStat, destStat } = getStatsSync(src, dest, opts);
5800
5808
  if (destStat) {
5801
5809
  if (areIdentical(srcStat, destStat)) {
5802
- const srcBaseName = path5.basename(src);
5803
- const destBaseName = path5.basename(dest);
5810
+ const srcBaseName = path10.basename(src);
5811
+ const destBaseName = path10.basename(dest);
5804
5812
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
5805
5813
  return { srcStat, destStat, isChangingCase: true };
5806
5814
  }
@@ -5819,12 +5827,12 @@ var require_stat = __commonJS({
5819
5827
  return { srcStat, destStat };
5820
5828
  }
5821
5829
  async function checkParentPaths(src, srcStat, dest, funcName) {
5822
- const srcParent = path5.resolve(path5.dirname(src));
5823
- const destParent = path5.resolve(path5.dirname(dest));
5824
- if (destParent === srcParent || destParent === path5.parse(destParent).root) return;
5830
+ const srcParent = path10.resolve(path10.dirname(src));
5831
+ const destParent = path10.resolve(path10.dirname(dest));
5832
+ if (destParent === srcParent || destParent === path10.parse(destParent).root) return;
5825
5833
  let destStat;
5826
5834
  try {
5827
- destStat = await fs9.stat(destParent, { bigint: true });
5835
+ destStat = await fs14.stat(destParent, { bigint: true });
5828
5836
  } catch (err) {
5829
5837
  if (err.code === "ENOENT") return;
5830
5838
  throw err;
@@ -5835,12 +5843,12 @@ var require_stat = __commonJS({
5835
5843
  return checkParentPaths(src, srcStat, destParent, funcName);
5836
5844
  }
5837
5845
  function checkParentPathsSync(src, srcStat, dest, funcName) {
5838
- const srcParent = path5.resolve(path5.dirname(src));
5839
- const destParent = path5.resolve(path5.dirname(dest));
5840
- if (destParent === srcParent || destParent === path5.parse(destParent).root) return;
5846
+ const srcParent = path10.resolve(path10.dirname(src));
5847
+ const destParent = path10.resolve(path10.dirname(dest));
5848
+ if (destParent === srcParent || destParent === path10.parse(destParent).root) return;
5841
5849
  let destStat;
5842
5850
  try {
5843
- destStat = fs9.statSync(destParent, { bigint: true });
5851
+ destStat = fs14.statSync(destParent, { bigint: true });
5844
5852
  } catch (err) {
5845
5853
  if (err.code === "ENOENT") return;
5846
5854
  throw err;
@@ -5854,8 +5862,8 @@ var require_stat = __commonJS({
5854
5862
  return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
5855
5863
  }
5856
5864
  function isSrcSubdir(src, dest) {
5857
- const srcArr = path5.resolve(src).split(path5.sep).filter((i) => i);
5858
- const destArr = path5.resolve(dest).split(path5.sep).filter((i) => i);
5865
+ const srcArr = path10.resolve(src).split(path10.sep).filter((i) => i);
5866
+ const destArr = path10.resolve(dest).split(path10.sep).filter((i) => i);
5859
5867
  return srcArr.every((cur, i) => destArr[i] === cur);
5860
5868
  }
5861
5869
  function errMsg(src, dest, funcName) {
@@ -5907,8 +5915,8 @@ var require_async = __commonJS({
5907
5915
  var require_copy = __commonJS({
5908
5916
  "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
5909
5917
  "use strict";
5910
- var fs9 = require_fs();
5911
- var path5 = require("path");
5918
+ var fs14 = require_fs();
5919
+ var path10 = require("path");
5912
5920
  var { mkdirs } = require_mkdirs();
5913
5921
  var { pathExists } = require_path_exists();
5914
5922
  var { utimesMillis } = require_utimes();
@@ -5931,7 +5939,7 @@ var require_copy = __commonJS({
5931
5939
  await stat.checkParentPaths(src, srcStat, dest, "copy");
5932
5940
  const include = await runFilter(src, dest, opts);
5933
5941
  if (!include) return;
5934
- const destParent = path5.dirname(dest);
5942
+ const destParent = path10.dirname(dest);
5935
5943
  const dirExists = await pathExists(destParent);
5936
5944
  if (!dirExists) {
5937
5945
  await mkdirs(destParent);
@@ -5943,7 +5951,7 @@ var require_copy = __commonJS({
5943
5951
  return opts.filter(src, dest);
5944
5952
  }
5945
5953
  async function getStatsAndPerformCopy(destStat, src, dest, opts) {
5946
- const statFn = opts.dereference ? fs9.stat : fs9.lstat;
5954
+ const statFn = opts.dereference ? fs14.stat : fs14.lstat;
5947
5955
  const srcStat = await statFn(src);
5948
5956
  if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
5949
5957
  if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
@@ -5955,7 +5963,7 @@ var require_copy = __commonJS({
5955
5963
  async function onFile(srcStat, destStat, src, dest, opts) {
5956
5964
  if (!destStat) return copyFile(srcStat, src, dest, opts);
5957
5965
  if (opts.overwrite) {
5958
- await fs9.unlink(dest);
5966
+ await fs14.unlink(dest);
5959
5967
  return copyFile(srcStat, src, dest, opts);
5960
5968
  }
5961
5969
  if (opts.errorOnExist) {
@@ -5963,29 +5971,29 @@ var require_copy = __commonJS({
5963
5971
  }
5964
5972
  }
5965
5973
  async function copyFile(srcStat, src, dest, opts) {
5966
- await fs9.copyFile(src, dest);
5974
+ await fs14.copyFile(src, dest);
5967
5975
  if (opts.preserveTimestamps) {
5968
5976
  if (fileIsNotWritable(srcStat.mode)) {
5969
5977
  await makeFileWritable(dest, srcStat.mode);
5970
5978
  }
5971
- const updatedSrcStat = await fs9.stat(src);
5979
+ const updatedSrcStat = await fs14.stat(src);
5972
5980
  await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
5973
5981
  }
5974
- return fs9.chmod(dest, srcStat.mode);
5982
+ return fs14.chmod(dest, srcStat.mode);
5975
5983
  }
5976
5984
  function fileIsNotWritable(srcMode) {
5977
5985
  return (srcMode & 128) === 0;
5978
5986
  }
5979
5987
  function makeFileWritable(dest, srcMode) {
5980
- return fs9.chmod(dest, srcMode | 128);
5988
+ return fs14.chmod(dest, srcMode | 128);
5981
5989
  }
5982
5990
  async function onDir(srcStat, destStat, src, dest, opts) {
5983
5991
  if (!destStat) {
5984
- await fs9.mkdir(dest);
5992
+ await fs14.mkdir(dest);
5985
5993
  }
5986
- await asyncIteratorConcurrentProcess(await fs9.opendir(src), async (item) => {
5987
- const srcItem = path5.join(src, item.name);
5988
- const destItem = path5.join(dest, item.name);
5994
+ await asyncIteratorConcurrentProcess(await fs14.opendir(src), async (item) => {
5995
+ const srcItem = path10.join(src, item.name);
5996
+ const destItem = path10.join(dest, item.name);
5989
5997
  const include = await runFilter(srcItem, destItem, opts);
5990
5998
  if (include) {
5991
5999
  const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
@@ -5993,26 +6001,26 @@ var require_copy = __commonJS({
5993
6001
  }
5994
6002
  });
5995
6003
  if (!destStat) {
5996
- await fs9.chmod(dest, srcStat.mode);
6004
+ await fs14.chmod(dest, srcStat.mode);
5997
6005
  }
5998
6006
  }
5999
6007
  async function onLink(destStat, src, dest, opts) {
6000
- let resolvedSrc = await fs9.readlink(src);
6008
+ let resolvedSrc = await fs14.readlink(src);
6001
6009
  if (opts.dereference) {
6002
- resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
6010
+ resolvedSrc = path10.resolve(process.cwd(), resolvedSrc);
6003
6011
  }
6004
6012
  if (!destStat) {
6005
- return fs9.symlink(resolvedSrc, dest);
6013
+ return fs14.symlink(resolvedSrc, dest);
6006
6014
  }
6007
6015
  let resolvedDest = null;
6008
6016
  try {
6009
- resolvedDest = await fs9.readlink(dest);
6017
+ resolvedDest = await fs14.readlink(dest);
6010
6018
  } catch (e) {
6011
- if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs9.symlink(resolvedSrc, dest);
6019
+ if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs14.symlink(resolvedSrc, dest);
6012
6020
  throw e;
6013
6021
  }
6014
6022
  if (opts.dereference) {
6015
- resolvedDest = path5.resolve(process.cwd(), resolvedDest);
6023
+ resolvedDest = path10.resolve(process.cwd(), resolvedDest);
6016
6024
  }
6017
6025
  if (resolvedSrc !== resolvedDest) {
6018
6026
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
@@ -6022,8 +6030,8 @@ var require_copy = __commonJS({
6022
6030
  throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
6023
6031
  }
6024
6032
  }
6025
- await fs9.unlink(dest);
6026
- return fs9.symlink(resolvedSrc, dest);
6033
+ await fs14.unlink(dest);
6034
+ return fs14.symlink(resolvedSrc, dest);
6027
6035
  }
6028
6036
  module2.exports = copy;
6029
6037
  }
@@ -6033,8 +6041,8 @@ var require_copy = __commonJS({
6033
6041
  var require_copy_sync = __commonJS({
6034
6042
  "node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
6035
6043
  "use strict";
6036
- var fs9 = require_graceful_fs();
6037
- var path5 = require("path");
6044
+ var fs14 = require_graceful_fs();
6045
+ var path10 = require("path");
6038
6046
  var mkdirsSync = require_mkdirs().mkdirsSync;
6039
6047
  var utimesMillisSync = require_utimes().utimesMillisSync;
6040
6048
  var stat = require_stat();
@@ -6055,12 +6063,12 @@ var require_copy_sync = __commonJS({
6055
6063
  const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
6056
6064
  stat.checkParentPathsSync(src, srcStat, dest, "copy");
6057
6065
  if (opts.filter && !opts.filter(src, dest)) return;
6058
- const destParent = path5.dirname(dest);
6059
- if (!fs9.existsSync(destParent)) mkdirsSync(destParent);
6066
+ const destParent = path10.dirname(dest);
6067
+ if (!fs14.existsSync(destParent)) mkdirsSync(destParent);
6060
6068
  return getStats(destStat, src, dest, opts);
6061
6069
  }
6062
6070
  function getStats(destStat, src, dest, opts) {
6063
- const statSync = opts.dereference ? fs9.statSync : fs9.lstatSync;
6071
+ const statSync = opts.dereference ? fs14.statSync : fs14.lstatSync;
6064
6072
  const srcStat = statSync(src);
6065
6073
  if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
6066
6074
  else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
@@ -6075,14 +6083,14 @@ var require_copy_sync = __commonJS({
6075
6083
  }
6076
6084
  function mayCopyFile(srcStat, src, dest, opts) {
6077
6085
  if (opts.overwrite) {
6078
- fs9.unlinkSync(dest);
6086
+ fs14.unlinkSync(dest);
6079
6087
  return copyFile(srcStat, src, dest, opts);
6080
6088
  } else if (opts.errorOnExist) {
6081
6089
  throw new Error(`'${dest}' already exists`);
6082
6090
  }
6083
6091
  }
6084
6092
  function copyFile(srcStat, src, dest, opts) {
6085
- fs9.copyFileSync(src, dest);
6093
+ fs14.copyFileSync(src, dest);
6086
6094
  if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
6087
6095
  return setDestMode(dest, srcStat.mode);
6088
6096
  }
@@ -6097,10 +6105,10 @@ var require_copy_sync = __commonJS({
6097
6105
  return setDestMode(dest, srcMode | 128);
6098
6106
  }
6099
6107
  function setDestMode(dest, srcMode) {
6100
- return fs9.chmodSync(dest, srcMode);
6108
+ return fs14.chmodSync(dest, srcMode);
6101
6109
  }
6102
6110
  function setDestTimestamps(src, dest) {
6103
- const updatedSrcStat = fs9.statSync(src);
6111
+ const updatedSrcStat = fs14.statSync(src);
6104
6112
  return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
6105
6113
  }
6106
6114
  function onDir(srcStat, destStat, src, dest, opts) {
@@ -6108,12 +6116,12 @@ var require_copy_sync = __commonJS({
6108
6116
  return copyDir(src, dest, opts);
6109
6117
  }
6110
6118
  function mkDirAndCopy(srcMode, src, dest, opts) {
6111
- fs9.mkdirSync(dest);
6119
+ fs14.mkdirSync(dest);
6112
6120
  copyDir(src, dest, opts);
6113
6121
  return setDestMode(dest, srcMode);
6114
6122
  }
6115
6123
  function copyDir(src, dest, opts) {
6116
- const dir = fs9.opendirSync(src);
6124
+ const dir = fs14.opendirSync(src);
6117
6125
  try {
6118
6126
  let dirent;
6119
6127
  while ((dirent = dir.readSync()) !== null) {
@@ -6124,29 +6132,29 @@ var require_copy_sync = __commonJS({
6124
6132
  }
6125
6133
  }
6126
6134
  function copyDirItem(item, src, dest, opts) {
6127
- const srcItem = path5.join(src, item);
6128
- const destItem = path5.join(dest, item);
6135
+ const srcItem = path10.join(src, item);
6136
+ const destItem = path10.join(dest, item);
6129
6137
  if (opts.filter && !opts.filter(srcItem, destItem)) return;
6130
6138
  const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
6131
6139
  return getStats(destStat, srcItem, destItem, opts);
6132
6140
  }
6133
6141
  function onLink(destStat, src, dest, opts) {
6134
- let resolvedSrc = fs9.readlinkSync(src);
6142
+ let resolvedSrc = fs14.readlinkSync(src);
6135
6143
  if (opts.dereference) {
6136
- resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
6144
+ resolvedSrc = path10.resolve(process.cwd(), resolvedSrc);
6137
6145
  }
6138
6146
  if (!destStat) {
6139
- return fs9.symlinkSync(resolvedSrc, dest);
6147
+ return fs14.symlinkSync(resolvedSrc, dest);
6140
6148
  } else {
6141
6149
  let resolvedDest;
6142
6150
  try {
6143
- resolvedDest = fs9.readlinkSync(dest);
6151
+ resolvedDest = fs14.readlinkSync(dest);
6144
6152
  } catch (err) {
6145
- if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs9.symlinkSync(resolvedSrc, dest);
6153
+ if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs14.symlinkSync(resolvedSrc, dest);
6146
6154
  throw err;
6147
6155
  }
6148
6156
  if (opts.dereference) {
6149
- resolvedDest = path5.resolve(process.cwd(), resolvedDest);
6157
+ resolvedDest = path10.resolve(process.cwd(), resolvedDest);
6150
6158
  }
6151
6159
  if (resolvedSrc !== resolvedDest) {
6152
6160
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
@@ -6160,8 +6168,8 @@ var require_copy_sync = __commonJS({
6160
6168
  }
6161
6169
  }
6162
6170
  function copyLink(resolvedSrc, dest) {
6163
- fs9.unlinkSync(dest);
6164
- return fs9.symlinkSync(resolvedSrc, dest);
6171
+ fs14.unlinkSync(dest);
6172
+ return fs14.symlinkSync(resolvedSrc, dest);
6165
6173
  }
6166
6174
  module2.exports = copySync;
6167
6175
  }
@@ -6183,13 +6191,13 @@ var require_copy2 = __commonJS({
6183
6191
  var require_remove = __commonJS({
6184
6192
  "node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
6185
6193
  "use strict";
6186
- var fs9 = require_graceful_fs();
6194
+ var fs14 = require_graceful_fs();
6187
6195
  var u = require_universalify().fromCallback;
6188
- function remove(path5, callback) {
6189
- fs9.rm(path5, { recursive: true, force: true }, callback);
6196
+ function remove(path10, callback) {
6197
+ fs14.rm(path10, { recursive: true, force: true }, callback);
6190
6198
  }
6191
- function removeSync(path5) {
6192
- fs9.rmSync(path5, { recursive: true, force: true });
6199
+ function removeSync(path10) {
6200
+ fs14.rmSync(path10, { recursive: true, force: true });
6193
6201
  }
6194
6202
  module2.exports = {
6195
6203
  remove: u(remove),
@@ -6203,28 +6211,28 @@ var require_empty = __commonJS({
6203
6211
  "node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
6204
6212
  "use strict";
6205
6213
  var u = require_universalify().fromPromise;
6206
- var fs9 = require_fs();
6207
- var path5 = require("path");
6214
+ var fs14 = require_fs();
6215
+ var path10 = require("path");
6208
6216
  var mkdir = require_mkdirs();
6209
6217
  var remove = require_remove();
6210
6218
  var emptyDir = u(async function emptyDir2(dir) {
6211
6219
  let items;
6212
6220
  try {
6213
- items = await fs9.readdir(dir);
6221
+ items = await fs14.readdir(dir);
6214
6222
  } catch {
6215
6223
  return mkdir.mkdirs(dir);
6216
6224
  }
6217
- return Promise.all(items.map((item) => remove.remove(path5.join(dir, item))));
6225
+ return Promise.all(items.map((item) => remove.remove(path10.join(dir, item))));
6218
6226
  });
6219
6227
  function emptyDirSync(dir) {
6220
6228
  let items;
6221
6229
  try {
6222
- items = fs9.readdirSync(dir);
6230
+ items = fs14.readdirSync(dir);
6223
6231
  } catch {
6224
6232
  return mkdir.mkdirsSync(dir);
6225
6233
  }
6226
6234
  items.forEach((item) => {
6227
- item = path5.join(dir, item);
6235
+ item = path10.join(dir, item);
6228
6236
  remove.removeSync(item);
6229
6237
  });
6230
6238
  }
@@ -6242,52 +6250,52 @@ var require_file = __commonJS({
6242
6250
  "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
6243
6251
  "use strict";
6244
6252
  var u = require_universalify().fromPromise;
6245
- var path5 = require("path");
6246
- var fs9 = require_fs();
6253
+ var path10 = require("path");
6254
+ var fs14 = require_fs();
6247
6255
  var mkdir = require_mkdirs();
6248
6256
  async function createFile(file) {
6249
6257
  let stats;
6250
6258
  try {
6251
- stats = await fs9.stat(file);
6259
+ stats = await fs14.stat(file);
6252
6260
  } catch {
6253
6261
  }
6254
6262
  if (stats && stats.isFile()) return;
6255
- const dir = path5.dirname(file);
6263
+ const dir = path10.dirname(file);
6256
6264
  let dirStats = null;
6257
6265
  try {
6258
- dirStats = await fs9.stat(dir);
6266
+ dirStats = await fs14.stat(dir);
6259
6267
  } catch (err) {
6260
6268
  if (err.code === "ENOENT") {
6261
6269
  await mkdir.mkdirs(dir);
6262
- await fs9.writeFile(file, "");
6270
+ await fs14.writeFile(file, "");
6263
6271
  return;
6264
6272
  } else {
6265
6273
  throw err;
6266
6274
  }
6267
6275
  }
6268
6276
  if (dirStats.isDirectory()) {
6269
- await fs9.writeFile(file, "");
6277
+ await fs14.writeFile(file, "");
6270
6278
  } else {
6271
- await fs9.readdir(dir);
6279
+ await fs14.readdir(dir);
6272
6280
  }
6273
6281
  }
6274
6282
  function createFileSync(file) {
6275
6283
  let stats;
6276
6284
  try {
6277
- stats = fs9.statSync(file);
6285
+ stats = fs14.statSync(file);
6278
6286
  } catch {
6279
6287
  }
6280
6288
  if (stats && stats.isFile()) return;
6281
- const dir = path5.dirname(file);
6289
+ const dir = path10.dirname(file);
6282
6290
  try {
6283
- if (!fs9.statSync(dir).isDirectory()) {
6284
- fs9.readdirSync(dir);
6291
+ if (!fs14.statSync(dir).isDirectory()) {
6292
+ fs14.readdirSync(dir);
6285
6293
  }
6286
6294
  } catch (err) {
6287
6295
  if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
6288
6296
  else throw err;
6289
6297
  }
6290
- fs9.writeFileSync(file, "");
6298
+ fs14.writeFileSync(file, "");
6291
6299
  }
6292
6300
  module2.exports = {
6293
6301
  createFile: u(createFile),
@@ -6301,50 +6309,50 @@ var require_link = __commonJS({
6301
6309
  "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
6302
6310
  "use strict";
6303
6311
  var u = require_universalify().fromPromise;
6304
- var path5 = require("path");
6305
- var fs9 = require_fs();
6312
+ var path10 = require("path");
6313
+ var fs14 = require_fs();
6306
6314
  var mkdir = require_mkdirs();
6307
6315
  var { pathExists } = require_path_exists();
6308
6316
  var { areIdentical } = require_stat();
6309
6317
  async function createLink(srcpath, dstpath) {
6310
6318
  let dstStat;
6311
6319
  try {
6312
- dstStat = await fs9.lstat(dstpath, { bigint: true });
6320
+ dstStat = await fs14.lstat(dstpath, { bigint: true });
6313
6321
  } catch {
6314
6322
  }
6315
6323
  let srcStat;
6316
6324
  try {
6317
- srcStat = await fs9.lstat(srcpath, { bigint: true });
6325
+ srcStat = await fs14.lstat(srcpath, { bigint: true });
6318
6326
  } catch (err) {
6319
6327
  err.message = err.message.replace("lstat", "ensureLink");
6320
6328
  throw err;
6321
6329
  }
6322
6330
  if (dstStat && areIdentical(srcStat, dstStat)) return;
6323
- const dir = path5.dirname(dstpath);
6331
+ const dir = path10.dirname(dstpath);
6324
6332
  const dirExists = await pathExists(dir);
6325
6333
  if (!dirExists) {
6326
6334
  await mkdir.mkdirs(dir);
6327
6335
  }
6328
- await fs9.link(srcpath, dstpath);
6336
+ await fs14.link(srcpath, dstpath);
6329
6337
  }
6330
6338
  function createLinkSync(srcpath, dstpath) {
6331
6339
  let dstStat;
6332
6340
  try {
6333
- dstStat = fs9.lstatSync(dstpath, { bigint: true });
6341
+ dstStat = fs14.lstatSync(dstpath, { bigint: true });
6334
6342
  } catch {
6335
6343
  }
6336
6344
  try {
6337
- const srcStat = fs9.lstatSync(srcpath, { bigint: true });
6345
+ const srcStat = fs14.lstatSync(srcpath, { bigint: true });
6338
6346
  if (dstStat && areIdentical(srcStat, dstStat)) return;
6339
6347
  } catch (err) {
6340
6348
  err.message = err.message.replace("lstat", "ensureLink");
6341
6349
  throw err;
6342
6350
  }
6343
- const dir = path5.dirname(dstpath);
6344
- const dirExists = fs9.existsSync(dir);
6345
- if (dirExists) return fs9.linkSync(srcpath, dstpath);
6351
+ const dir = path10.dirname(dstpath);
6352
+ const dirExists = fs14.existsSync(dir);
6353
+ if (dirExists) return fs14.linkSync(srcpath, dstpath);
6346
6354
  mkdir.mkdirsSync(dir);
6347
- return fs9.linkSync(srcpath, dstpath);
6355
+ return fs14.linkSync(srcpath, dstpath);
6348
6356
  }
6349
6357
  module2.exports = {
6350
6358
  createLink: u(createLink),
@@ -6357,14 +6365,14 @@ var require_link = __commonJS({
6357
6365
  var require_symlink_paths = __commonJS({
6358
6366
  "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
6359
6367
  "use strict";
6360
- var path5 = require("path");
6361
- var fs9 = require_fs();
6368
+ var path10 = require("path");
6369
+ var fs14 = require_fs();
6362
6370
  var { pathExists } = require_path_exists();
6363
6371
  var u = require_universalify().fromPromise;
6364
6372
  async function symlinkPaths(srcpath, dstpath) {
6365
- if (path5.isAbsolute(srcpath)) {
6373
+ if (path10.isAbsolute(srcpath)) {
6366
6374
  try {
6367
- await fs9.lstat(srcpath);
6375
+ await fs14.lstat(srcpath);
6368
6376
  } catch (err) {
6369
6377
  err.message = err.message.replace("lstat", "ensureSymlink");
6370
6378
  throw err;
@@ -6374,8 +6382,8 @@ var require_symlink_paths = __commonJS({
6374
6382
  toDst: srcpath
6375
6383
  };
6376
6384
  }
6377
- const dstdir = path5.dirname(dstpath);
6378
- const relativeToDst = path5.join(dstdir, srcpath);
6385
+ const dstdir = path10.dirname(dstpath);
6386
+ const relativeToDst = path10.join(dstdir, srcpath);
6379
6387
  const exists = await pathExists(relativeToDst);
6380
6388
  if (exists) {
6381
6389
  return {
@@ -6384,39 +6392,39 @@ var require_symlink_paths = __commonJS({
6384
6392
  };
6385
6393
  }
6386
6394
  try {
6387
- await fs9.lstat(srcpath);
6395
+ await fs14.lstat(srcpath);
6388
6396
  } catch (err) {
6389
6397
  err.message = err.message.replace("lstat", "ensureSymlink");
6390
6398
  throw err;
6391
6399
  }
6392
6400
  return {
6393
6401
  toCwd: srcpath,
6394
- toDst: path5.relative(dstdir, srcpath)
6402
+ toDst: path10.relative(dstdir, srcpath)
6395
6403
  };
6396
6404
  }
6397
6405
  function symlinkPathsSync(srcpath, dstpath) {
6398
- if (path5.isAbsolute(srcpath)) {
6399
- const exists2 = fs9.existsSync(srcpath);
6406
+ if (path10.isAbsolute(srcpath)) {
6407
+ const exists2 = fs14.existsSync(srcpath);
6400
6408
  if (!exists2) throw new Error("absolute srcpath does not exist");
6401
6409
  return {
6402
6410
  toCwd: srcpath,
6403
6411
  toDst: srcpath
6404
6412
  };
6405
6413
  }
6406
- const dstdir = path5.dirname(dstpath);
6407
- const relativeToDst = path5.join(dstdir, srcpath);
6408
- const exists = fs9.existsSync(relativeToDst);
6414
+ const dstdir = path10.dirname(dstpath);
6415
+ const relativeToDst = path10.join(dstdir, srcpath);
6416
+ const exists = fs14.existsSync(relativeToDst);
6409
6417
  if (exists) {
6410
6418
  return {
6411
6419
  toCwd: relativeToDst,
6412
6420
  toDst: srcpath
6413
6421
  };
6414
6422
  }
6415
- const srcExists = fs9.existsSync(srcpath);
6423
+ const srcExists = fs14.existsSync(srcpath);
6416
6424
  if (!srcExists) throw new Error("relative srcpath does not exist");
6417
6425
  return {
6418
6426
  toCwd: srcpath,
6419
- toDst: path5.relative(dstdir, srcpath)
6427
+ toDst: path10.relative(dstdir, srcpath)
6420
6428
  };
6421
6429
  }
6422
6430
  module2.exports = {
@@ -6430,13 +6438,13 @@ var require_symlink_paths = __commonJS({
6430
6438
  var require_symlink_type = __commonJS({
6431
6439
  "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
6432
6440
  "use strict";
6433
- var fs9 = require_fs();
6441
+ var fs14 = require_fs();
6434
6442
  var u = require_universalify().fromPromise;
6435
6443
  async function symlinkType(srcpath, type) {
6436
6444
  if (type) return type;
6437
6445
  let stats;
6438
6446
  try {
6439
- stats = await fs9.lstat(srcpath);
6447
+ stats = await fs14.lstat(srcpath);
6440
6448
  } catch {
6441
6449
  return "file";
6442
6450
  }
@@ -6446,7 +6454,7 @@ var require_symlink_type = __commonJS({
6446
6454
  if (type) return type;
6447
6455
  let stats;
6448
6456
  try {
6449
- stats = fs9.lstatSync(srcpath);
6457
+ stats = fs14.lstatSync(srcpath);
6450
6458
  } catch {
6451
6459
  return "file";
6452
6460
  }
@@ -6464,8 +6472,8 @@ var require_symlink = __commonJS({
6464
6472
  "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
6465
6473
  "use strict";
6466
6474
  var u = require_universalify().fromPromise;
6467
- var path5 = require("path");
6468
- var fs9 = require_fs();
6475
+ var path10 = require("path");
6476
+ var fs14 = require_fs();
6469
6477
  var { mkdirs, mkdirsSync } = require_mkdirs();
6470
6478
  var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
6471
6479
  var { symlinkType, symlinkTypeSync } = require_symlink_type();
@@ -6474,64 +6482,64 @@ var require_symlink = __commonJS({
6474
6482
  async function createSymlink(srcpath, dstpath, type) {
6475
6483
  let stats;
6476
6484
  try {
6477
- stats = await fs9.lstat(dstpath);
6485
+ stats = await fs14.lstat(dstpath);
6478
6486
  } catch {
6479
6487
  }
6480
6488
  if (stats && stats.isSymbolicLink()) {
6481
6489
  let srcStat;
6482
- if (path5.isAbsolute(srcpath)) {
6483
- srcStat = await fs9.stat(srcpath, { bigint: true });
6490
+ if (path10.isAbsolute(srcpath)) {
6491
+ srcStat = await fs14.stat(srcpath, { bigint: true });
6484
6492
  } else {
6485
- const dstdir = path5.dirname(dstpath);
6486
- const relativeToDst = path5.join(dstdir, srcpath);
6493
+ const dstdir = path10.dirname(dstpath);
6494
+ const relativeToDst = path10.join(dstdir, srcpath);
6487
6495
  try {
6488
- srcStat = await fs9.stat(relativeToDst, { bigint: true });
6496
+ srcStat = await fs14.stat(relativeToDst, { bigint: true });
6489
6497
  } catch {
6490
- srcStat = await fs9.stat(srcpath, { bigint: true });
6498
+ srcStat = await fs14.stat(srcpath, { bigint: true });
6491
6499
  }
6492
6500
  }
6493
- const dstStat = await fs9.stat(dstpath, { bigint: true });
6501
+ const dstStat = await fs14.stat(dstpath, { bigint: true });
6494
6502
  if (areIdentical(srcStat, dstStat)) return;
6495
6503
  }
6496
6504
  const relative = await symlinkPaths(srcpath, dstpath);
6497
6505
  srcpath = relative.toDst;
6498
6506
  const toType = await symlinkType(relative.toCwd, type);
6499
- const dir = path5.dirname(dstpath);
6507
+ const dir = path10.dirname(dstpath);
6500
6508
  if (!await pathExists(dir)) {
6501
6509
  await mkdirs(dir);
6502
6510
  }
6503
- return fs9.symlink(srcpath, dstpath, toType);
6511
+ return fs14.symlink(srcpath, dstpath, toType);
6504
6512
  }
6505
6513
  function createSymlinkSync(srcpath, dstpath, type) {
6506
6514
  let stats;
6507
6515
  try {
6508
- stats = fs9.lstatSync(dstpath);
6516
+ stats = fs14.lstatSync(dstpath);
6509
6517
  } catch {
6510
6518
  }
6511
6519
  if (stats && stats.isSymbolicLink()) {
6512
6520
  let srcStat;
6513
- if (path5.isAbsolute(srcpath)) {
6514
- srcStat = fs9.statSync(srcpath, { bigint: true });
6521
+ if (path10.isAbsolute(srcpath)) {
6522
+ srcStat = fs14.statSync(srcpath, { bigint: true });
6515
6523
  } else {
6516
- const dstdir = path5.dirname(dstpath);
6517
- const relativeToDst = path5.join(dstdir, srcpath);
6524
+ const dstdir = path10.dirname(dstpath);
6525
+ const relativeToDst = path10.join(dstdir, srcpath);
6518
6526
  try {
6519
- srcStat = fs9.statSync(relativeToDst, { bigint: true });
6527
+ srcStat = fs14.statSync(relativeToDst, { bigint: true });
6520
6528
  } catch {
6521
- srcStat = fs9.statSync(srcpath, { bigint: true });
6529
+ srcStat = fs14.statSync(srcpath, { bigint: true });
6522
6530
  }
6523
6531
  }
6524
- const dstStat = fs9.statSync(dstpath, { bigint: true });
6532
+ const dstStat = fs14.statSync(dstpath, { bigint: true });
6525
6533
  if (areIdentical(srcStat, dstStat)) return;
6526
6534
  }
6527
6535
  const relative = symlinkPathsSync(srcpath, dstpath);
6528
6536
  srcpath = relative.toDst;
6529
6537
  type = symlinkTypeSync(relative.toCwd, type);
6530
- const dir = path5.dirname(dstpath);
6531
- const exists = fs9.existsSync(dir);
6532
- if (exists) return fs9.symlinkSync(srcpath, dstpath, type);
6538
+ const dir = path10.dirname(dstpath);
6539
+ const exists = fs14.existsSync(dir);
6540
+ if (exists) return fs14.symlinkSync(srcpath, dstpath, type);
6533
6541
  mkdirsSync(dir);
6534
- return fs9.symlinkSync(srcpath, dstpath, type);
6542
+ return fs14.symlinkSync(srcpath, dstpath, type);
6535
6543
  }
6536
6544
  module2.exports = {
6537
6545
  createSymlink: u(createSymlink),
@@ -6603,9 +6611,9 @@ var require_jsonfile = __commonJS({
6603
6611
  if (typeof options === "string") {
6604
6612
  options = { encoding: options };
6605
6613
  }
6606
- const fs9 = options.fs || _fs;
6614
+ const fs14 = options.fs || _fs;
6607
6615
  const shouldThrow = "throws" in options ? options.throws : true;
6608
- let data = await universalify.fromCallback(fs9.readFile)(file, options);
6616
+ let data = await universalify.fromCallback(fs14.readFile)(file, options);
6609
6617
  data = stripBom(data);
6610
6618
  let obj;
6611
6619
  try {
@@ -6625,10 +6633,10 @@ var require_jsonfile = __commonJS({
6625
6633
  if (typeof options === "string") {
6626
6634
  options = { encoding: options };
6627
6635
  }
6628
- const fs9 = options.fs || _fs;
6636
+ const fs14 = options.fs || _fs;
6629
6637
  const shouldThrow = "throws" in options ? options.throws : true;
6630
6638
  try {
6631
- let content = fs9.readFileSync(file, options);
6639
+ let content = fs14.readFileSync(file, options);
6632
6640
  content = stripBom(content);
6633
6641
  return JSON.parse(content, options.reviver);
6634
6642
  } catch (err) {
@@ -6641,15 +6649,15 @@ var require_jsonfile = __commonJS({
6641
6649
  }
6642
6650
  }
6643
6651
  async function _writeFile(file, obj, options = {}) {
6644
- const fs9 = options.fs || _fs;
6652
+ const fs14 = options.fs || _fs;
6645
6653
  const str = stringify(obj, options);
6646
- await universalify.fromCallback(fs9.writeFile)(file, str, options);
6654
+ await universalify.fromCallback(fs14.writeFile)(file, str, options);
6647
6655
  }
6648
6656
  var writeFile = universalify.fromPromise(_writeFile);
6649
6657
  function writeFileSync(file, obj, options = {}) {
6650
- const fs9 = options.fs || _fs;
6658
+ const fs14 = options.fs || _fs;
6651
6659
  const str = stringify(obj, options);
6652
- return fs9.writeFileSync(file, str, options);
6660
+ return fs14.writeFileSync(file, str, options);
6653
6661
  }
6654
6662
  module2.exports = {
6655
6663
  readFile,
@@ -6680,23 +6688,23 @@ var require_output_file = __commonJS({
6680
6688
  "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
6681
6689
  "use strict";
6682
6690
  var u = require_universalify().fromPromise;
6683
- var fs9 = require_fs();
6684
- var path5 = require("path");
6691
+ var fs14 = require_fs();
6692
+ var path10 = require("path");
6685
6693
  var mkdir = require_mkdirs();
6686
6694
  var pathExists = require_path_exists().pathExists;
6687
6695
  async function outputFile(file, data, encoding = "utf-8") {
6688
- const dir = path5.dirname(file);
6696
+ const dir = path10.dirname(file);
6689
6697
  if (!await pathExists(dir)) {
6690
6698
  await mkdir.mkdirs(dir);
6691
6699
  }
6692
- return fs9.writeFile(file, data, encoding);
6700
+ return fs14.writeFile(file, data, encoding);
6693
6701
  }
6694
6702
  function outputFileSync(file, ...args) {
6695
- const dir = path5.dirname(file);
6696
- if (!fs9.existsSync(dir)) {
6703
+ const dir = path10.dirname(file);
6704
+ if (!fs14.existsSync(dir)) {
6697
6705
  mkdir.mkdirsSync(dir);
6698
6706
  }
6699
- fs9.writeFileSync(file, ...args);
6707
+ fs14.writeFileSync(file, ...args);
6700
6708
  }
6701
6709
  module2.exports = {
6702
6710
  outputFile: u(outputFile),
@@ -6755,8 +6763,8 @@ var require_json = __commonJS({
6755
6763
  var require_move = __commonJS({
6756
6764
  "node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
6757
6765
  "use strict";
6758
- var fs9 = require_fs();
6759
- var path5 = require("path");
6766
+ var fs14 = require_fs();
6767
+ var path10 = require("path");
6760
6768
  var { copy } = require_copy2();
6761
6769
  var { remove } = require_remove();
6762
6770
  var { mkdirp } = require_mkdirs();
@@ -6766,8 +6774,8 @@ var require_move = __commonJS({
6766
6774
  const overwrite = opts.overwrite || opts.clobber || false;
6767
6775
  const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
6768
6776
  await stat.checkParentPaths(src, srcStat, dest, "move");
6769
- const destParent = path5.dirname(dest);
6770
- const parsedParentPath = path5.parse(destParent);
6777
+ const destParent = path10.dirname(dest);
6778
+ const parsedParentPath = path10.parse(destParent);
6771
6779
  if (parsedParentPath.root !== destParent) {
6772
6780
  await mkdirp(destParent);
6773
6781
  }
@@ -6782,7 +6790,7 @@ var require_move = __commonJS({
6782
6790
  }
6783
6791
  }
6784
6792
  try {
6785
- await fs9.rename(src, dest);
6793
+ await fs14.rename(src, dest);
6786
6794
  } catch (err) {
6787
6795
  if (err.code !== "EXDEV") {
6788
6796
  throw err;
@@ -6807,8 +6815,8 @@ var require_move = __commonJS({
6807
6815
  var require_move_sync = __commonJS({
6808
6816
  "node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
6809
6817
  "use strict";
6810
- var fs9 = require_graceful_fs();
6811
- var path5 = require("path");
6818
+ var fs14 = require_graceful_fs();
6819
+ var path10 = require("path");
6812
6820
  var copySync = require_copy2().copySync;
6813
6821
  var removeSync = require_remove().removeSync;
6814
6822
  var mkdirpSync = require_mkdirs().mkdirpSync;
@@ -6818,12 +6826,12 @@ var require_move_sync = __commonJS({
6818
6826
  const overwrite = opts.overwrite || opts.clobber || false;
6819
6827
  const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
6820
6828
  stat.checkParentPathsSync(src, srcStat, dest, "move");
6821
- if (!isParentRoot(dest)) mkdirpSync(path5.dirname(dest));
6829
+ if (!isParentRoot(dest)) mkdirpSync(path10.dirname(dest));
6822
6830
  return doRename(src, dest, overwrite, isChangingCase);
6823
6831
  }
6824
6832
  function isParentRoot(dest) {
6825
- const parent = path5.dirname(dest);
6826
- const parsedPath = path5.parse(parent);
6833
+ const parent = path10.dirname(dest);
6834
+ const parsedPath = path10.parse(parent);
6827
6835
  return parsedPath.root === parent;
6828
6836
  }
6829
6837
  function doRename(src, dest, overwrite, isChangingCase) {
@@ -6832,12 +6840,12 @@ var require_move_sync = __commonJS({
6832
6840
  removeSync(dest);
6833
6841
  return rename(src, dest, overwrite);
6834
6842
  }
6835
- if (fs9.existsSync(dest)) throw new Error("dest already exists.");
6843
+ if (fs14.existsSync(dest)) throw new Error("dest already exists.");
6836
6844
  return rename(src, dest, overwrite);
6837
6845
  }
6838
6846
  function rename(src, dest, overwrite) {
6839
6847
  try {
6840
- fs9.renameSync(src, dest);
6848
+ fs14.renameSync(src, dest);
6841
6849
  } catch (err) {
6842
6850
  if (err.code !== "EXDEV") throw err;
6843
6851
  return moveAcrossDevice(src, dest, overwrite);
@@ -6889,6 +6897,89 @@ var require_lib = __commonJS({
6889
6897
  }
6890
6898
  });
6891
6899
 
6900
+ // packages/cli/src/generators/names.ts
6901
+ var names_exports = {};
6902
+ __export(names_exports, {
6903
+ buildGeneratedRoutes: () => buildGeneratedRoutes,
6904
+ toIdentifier: () => toIdentifier,
6905
+ toMethodName: () => toMethodName,
6906
+ toRuntimePath: () => toRuntimePath,
6907
+ toTypeName: () => toTypeName
6908
+ });
6909
+ function buildGeneratedRoutes(routes) {
6910
+ const grouped = {};
6911
+ const usedActions = {};
6912
+ for (const route of routes) {
6913
+ const segments = getPathSegments(route.path);
6914
+ const groupName = toIdentifier(segments[0] ?? "root");
6915
+ const baseActionName = toActionName(route, segments.slice(1));
6916
+ usedActions[groupName] ?? (usedActions[groupName] = /* @__PURE__ */ new Set());
6917
+ const actionName = uniquify(baseActionName, usedActions[groupName]);
6918
+ grouped[groupName] ?? (grouped[groupName] = []);
6919
+ grouped[groupName].push({
6920
+ ...route,
6921
+ groupName,
6922
+ actionName,
6923
+ runtimePath: toRuntimePath(route.path)
6924
+ });
6925
+ }
6926
+ return grouped;
6927
+ }
6928
+ function toTypeName(value) {
6929
+ return splitWords(value).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("") || "Root";
6930
+ }
6931
+ function toIdentifier(value) {
6932
+ const [first = "root", ...rest] = splitWords(value);
6933
+ const identifier = [
6934
+ first.toLowerCase(),
6935
+ ...rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
6936
+ ].join("");
6937
+ return /^[A-Za-z_$]/.test(identifier) ? identifier : `route${toTypeName(identifier)}`;
6938
+ }
6939
+ function toRuntimePath(path10) {
6940
+ return path10.replace(/{([^}/]+)}/g, ":$1");
6941
+ }
6942
+ function toActionName(route, restSegments) {
6943
+ const method = route.method.toLowerCase();
6944
+ const suffix = restSegments.map(normalizeSegment).filter(Boolean).map(toTypeName).join("");
6945
+ return toIdentifier(suffix ? `${method}-${suffix}` : method);
6946
+ }
6947
+ function normalizeSegment(segment) {
6948
+ return segment.replace(/^{([^}/]+)}$/, "$1");
6949
+ }
6950
+ function getPathSegments(path10) {
6951
+ return path10.replace(/^\//, "").split("/").filter(Boolean);
6952
+ }
6953
+ function splitWords(value) {
6954
+ return value.replace(/^{([^}/]+)}$/, "$1").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word.toLowerCase());
6955
+ }
6956
+ function uniquify(baseName, used) {
6957
+ if (!used.has(baseName)) {
6958
+ used.add(baseName);
6959
+ return baseName;
6960
+ }
6961
+ let index = 2;
6962
+ let name = `${baseName}${index}`;
6963
+ while (used.has(name)) {
6964
+ index += 1;
6965
+ name = `${baseName}${index}`;
6966
+ }
6967
+ used.add(name);
6968
+ return name;
6969
+ }
6970
+ function toMethodName(route) {
6971
+ if (route.name) {
6972
+ const parts = route.name.split(".");
6973
+ return toIdentifier(parts.join(" "));
6974
+ }
6975
+ return toIdentifier(route.method + " " + route.path);
6976
+ }
6977
+ var init_names = __esm({
6978
+ "packages/cli/src/generators/names.ts"() {
6979
+ "use strict";
6980
+ }
6981
+ });
6982
+
6892
6983
  // packages/cli/node_modules/commander/esm.mjs
6893
6984
  var import_index = __toESM(require_commander(), 1);
6894
6985
  var {
@@ -8356,82 +8447,108 @@ function ora(options) {
8356
8447
 
8357
8448
  // packages/cli/src/parsers/LaravelRouteParser.ts
8358
8449
  var import_fs_extra = __toESM(require_lib());
8450
+ var import_child_process = require("child_process");
8451
+ var import_path = __toESM(require("path"));
8452
+ var import_os = __toESM(require("os"));
8359
8453
  var LaravelRouteParser = class {
8360
8454
  async parse(filePath) {
8361
- const content = await import_fs_extra.default.readFile(filePath, "utf-8");
8362
- return this.parseContent(content);
8363
- }
8364
- parseContent(content) {
8365
- const routes = [];
8366
- const lines = content.split("\n");
8367
- let currentAuth = false;
8368
- let currentMiddleware = [];
8369
- let insideAuthGroup = false;
8370
- let insideAdminGroup = false;
8371
- let braceDepth = 0;
8372
- let groupBraceDepth = 0;
8373
- for (const line of lines) {
8374
- const trimmed = line.trim();
8375
- if (trimmed.includes("middleware('auth:sanctum')")) {
8376
- insideAuthGroup = true;
8377
- currentAuth = true;
8378
- groupBraceDepth = braceDepth;
8379
- }
8380
- if (trimmed.includes("middleware(['auth:sanctum', 'admin'])")) {
8381
- insideAdminGroup = true;
8382
- currentMiddleware = ["auth:sanctum", "admin"];
8383
- groupBraceDepth = braceDepth;
8384
- }
8385
- braceDepth += (trimmed.match(/{/g) ?? []).length;
8386
- braceDepth -= (trimmed.match(/}/g) ?? []).length;
8387
- if (braceDepth <= groupBraceDepth && insideAuthGroup) {
8388
- insideAuthGroup = false;
8389
- currentAuth = false;
8390
- }
8391
- if (braceDepth <= groupBraceDepth && insideAdminGroup) {
8392
- insideAdminGroup = false;
8393
- currentMiddleware = [];
8394
- }
8395
- const routeMatch = trimmed.match(
8396
- /Route::(get|post|put|patch|delete|match)\(['"]([^'"]+)['"]/i
8397
- );
8398
- if (routeMatch) {
8399
- const method = routeMatch[1].toUpperCase();
8400
- const path5 = routeMatch[2];
8401
- routes.push({
8402
- name: this.inferName(method, path5),
8403
- method,
8404
- path: path5,
8405
- auth: insideAuthGroup || insideAdminGroup,
8406
- middleware: insideAdminGroup ? ["admin"] : []
8407
- });
8408
- }
8455
+ const projectRoot = import_path.default.resolve(import_path.default.dirname(filePath), "..");
8456
+ const phpScript = `<?php
8457
+ require __DIR__.'/vendor/autoload.php';
8458
+ $app = require_once __DIR__.'/bootstrap/app.php';
8459
+ $kernel = $app->make(Illuminate\\Contracts\\Console\\Kernel::class);
8460
+ $kernel->bootstrap();
8461
+
8462
+ $routes = app('router')->getRoutes();
8463
+ $output = [];
8464
+
8465
+ foreach ($routes as $route) {
8466
+ if (!str_starts_with($route->uri(), 'api/')) continue;
8467
+
8468
+ $methods = array_diff($route->methods(), ['HEAD']);
8469
+ $middlewares = $route->gatherMiddleware();
8470
+
8471
+ $auth = false;
8472
+ foreach ($middlewares as $mw) {
8473
+ if (is_string($mw) && (str_contains($mw, 'auth') || str_contains($mw, 'sanctum'))) {
8474
+ $auth = true;
8475
+ }
8476
+ }
8477
+
8478
+ $schema = [];
8479
+ $action = $route->getAction();
8480
+ if (isset($action['uses']) && is_string($action['uses']) && str_contains($action['uses'], '@')) {
8481
+ list($controller, $method) = explode('@', $action['uses']);
8482
+ if (class_exists($controller)) {
8483
+ try {
8484
+ $reflector = new ReflectionMethod($controller, $method);
8485
+ foreach ($reflector->getParameters() as $param) {
8486
+ $type = $param->getType();
8487
+ if ($type && !$type->isBuiltin()) {
8488
+ $className = $type->getName();
8489
+ if (is_subclass_of($className, 'Illuminate\\Foundation\\Http\\FormRequest')) {
8490
+ // Instantiate the request and get rules
8491
+ $request = new $className();
8492
+ if (method_exists($request, 'rules')) {
8493
+ $schema = $request->rules();
8494
+ }
8495
+ }
8496
+ }
8497
+ }
8498
+ } catch (\\Exception $e) {
8499
+ // Ignore reflection errors
8500
+ }
8501
+ }
8502
+ }
8503
+
8504
+ foreach ($methods as $method) {
8505
+ $nameParts = explode('/', preg_replace('/^api\\//', '', $route->uri()));
8506
+ $resource = preg_replace('/\\{.*\\}/', '', $nameParts[0]);
8507
+ if (empty($resource)) $resource = 'api';
8508
+
8509
+ $name = $resource . '.' . strtolower($method);
8510
+
8511
+ $output[] = [
8512
+ 'name' => $route->getName() ?: $name,
8513
+ 'method' => $method,
8514
+ 'path' => '/' . preg_replace('/^api\\//', '', $route->uri()),
8515
+ 'auth' => $auth,
8516
+ 'middleware' => $middlewares,
8517
+ 'schema' => $schema
8518
+ ];
8519
+ }
8520
+ }
8521
+
8522
+ echo json_encode($output);
8523
+ `;
8524
+ const tempPhpFile = import_path.default.join(import_os.default.tmpdir(), `routesync_extractor_${Date.now()}.php`);
8525
+ try {
8526
+ const scriptPath = import_path.default.join(projectRoot, "routesync-extractor-temp.php");
8527
+ await import_fs_extra.default.writeFile(scriptPath, phpScript);
8528
+ const stdout = (0, import_child_process.execSync)(`php routesync-extractor-temp.php`, {
8529
+ cwd: projectRoot,
8530
+ encoding: "utf-8",
8531
+ maxBuffer: 1024 * 1024 * 10
8532
+ });
8533
+ await import_fs_extra.default.remove(scriptPath);
8534
+ const parsed = JSON.parse(stdout);
8535
+ return parsed;
8536
+ } catch (err) {
8537
+ console.error("Failed to parse Laravel routes via PHP script:", err);
8538
+ return [];
8409
8539
  }
8410
- return routes;
8411
- }
8412
- inferName(method, path5) {
8413
- const parts = path5.replace(/^\//, "").split("/");
8414
- const resource = parts[0] ?? "resource";
8415
- const hasId = parts.some((p) => p.startsWith("{"));
8416
- const map = {
8417
- GET: hasId ? `${resource}.show` : `${resource}.index`,
8418
- POST: `${resource}.store`,
8419
- PUT: `${resource}.update`,
8420
- PATCH: `${resource}.update`,
8421
- DELETE: `${resource}.destroy`
8422
- };
8423
- return map[method] ?? `${resource}.action`;
8424
8540
  }
8425
8541
  };
8426
8542
 
8427
8543
  // packages/cli/src/generators/ManifestGenerator.ts
8428
8544
  var import_fs_extra2 = __toESM(require_lib());
8429
8545
  var ManifestGenerator = class {
8430
- static generate(routes, baseURL) {
8546
+ static generate(routes, baseURL, channels) {
8431
8547
  return {
8432
8548
  version: "1.0.0",
8433
8549
  baseURL,
8434
8550
  routes,
8551
+ channels: channels || [],
8435
8552
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
8436
8553
  };
8437
8554
  }
@@ -8463,205 +8580,419 @@ var scanCommand = new Command("scan").description("Scan Laravel/PHP routes and o
8463
8580
  });
8464
8581
 
8465
8582
  // packages/cli/src/generators/SDKGenerator.ts
8466
- var import_path = __toESM(require("path"));
8583
+ var import_path2 = __toESM(require("path"));
8467
8584
  var import_fs_extra3 = __toESM(require_lib());
8468
-
8469
- // packages/cli/src/generators/names.ts
8470
- function buildGeneratedRoutes(routes) {
8471
- const grouped = {};
8472
- const usedActions = {};
8473
- for (const route of routes) {
8474
- const segments = getPathSegments(route.path);
8475
- const groupName = toIdentifier(segments[0] ?? "root");
8476
- const baseActionName = toActionName(route, segments.slice(1));
8477
- usedActions[groupName] ?? (usedActions[groupName] = /* @__PURE__ */ new Set());
8478
- const actionName = uniquify(baseActionName, usedActions[groupName]);
8479
- grouped[groupName] ?? (grouped[groupName] = []);
8480
- grouped[groupName].push({
8481
- ...route,
8482
- groupName,
8483
- actionName,
8484
- runtimePath: toRuntimePath(route.path)
8485
- });
8486
- }
8487
- return grouped;
8488
- }
8489
- function toTypeName(value) {
8490
- return splitWords(value).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("") || "Root";
8491
- }
8492
- function toIdentifier(value) {
8493
- const [first = "root", ...rest] = splitWords(value);
8494
- const identifier = [
8495
- first.toLowerCase(),
8496
- ...rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
8497
- ].join("");
8498
- return /^[A-Za-z_$]/.test(identifier) ? identifier : `route${toTypeName(identifier)}`;
8499
- }
8500
- function toRuntimePath(path5) {
8501
- return path5.replace(/{([^}/]+)}/g, ":$1");
8502
- }
8503
- function toActionName(route, restSegments) {
8504
- const method = route.method.toLowerCase();
8505
- const suffix = restSegments.map(normalizeSegment).filter(Boolean).map(toTypeName).join("");
8506
- return toIdentifier(suffix ? `${method}-${suffix}` : method);
8507
- }
8508
- function normalizeSegment(segment) {
8509
- return segment.replace(/^{([^}/]+)}$/, "$1");
8510
- }
8511
- function getPathSegments(path5) {
8512
- return path5.replace(/^\//, "").split("/").filter(Boolean);
8513
- }
8514
- function splitWords(value) {
8515
- return value.replace(/^{([^}/]+)}$/, "$1").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map((word) => word.toLowerCase());
8516
- }
8517
- function uniquify(baseName, used) {
8518
- if (!used.has(baseName)) {
8519
- used.add(baseName);
8520
- return baseName;
8521
- }
8522
- let index = 2;
8523
- let name = `${baseName}${index}`;
8524
- while (used.has(name)) {
8525
- index += 1;
8526
- name = `${baseName}${index}`;
8527
- }
8528
- used.add(name);
8529
- return name;
8530
- }
8531
-
8532
- // packages/cli/src/generators/SDKGenerator.ts
8585
+ init_names();
8533
8586
  var SDKGenerator = class {
8534
8587
  static async generate(manifest, outputDir) {
8535
8588
  const grouped = buildGeneratedRoutes(manifest.routes);
8536
- const lines = [];
8537
- lines.push(`// Auto-generated by routesync. Do not edit manually.`);
8538
- lines.push(`// Generated at: ${manifest.generatedAt}`);
8539
- lines.push(``);
8540
- lines.push(`import { defineApi } from 'routesync'`);
8541
- lines.push(``);
8542
- lines.push(`export const api = defineApi({`);
8589
+ const rootLines = [];
8590
+ rootLines.push(`// Auto-generated by routesync. Do not edit manually.`);
8591
+ rootLines.push(`// Generated at: ${manifest.generatedAt}`);
8592
+ rootLines.push(``);
8593
+ rootLines.push(`import { defineApi } from 'routesync'`);
8594
+ const groupNames = Object.keys(grouped);
8595
+ for (const group of groupNames) {
8596
+ rootLines.push(`import { ${group}Def } from './${group}/services/api.generated'`);
8597
+ }
8598
+ rootLines.push(``);
8599
+ rootLines.push(`export const api = defineApi({`);
8600
+ for (const group of groupNames) {
8601
+ rootLines.push(` ${group}: ${group}Def,`);
8602
+ }
8603
+ rootLines.push(`})`);
8604
+ rootLines.push(``);
8605
+ rootLines.push(`export default api`);
8606
+ await import_fs_extra3.default.writeFile(import_path2.default.join(outputDir, "api.ts"), rootLines.join("\n"));
8543
8607
  for (const [group, routes] of Object.entries(grouped)) {
8544
- lines.push(` ${group}: {`);
8608
+ const resourceDir = import_path2.default.join(outputDir, group, "services");
8609
+ await import_fs_extra3.default.ensureDir(resourceDir);
8610
+ const lines = [];
8611
+ lines.push(`// Auto-generated. Do not edit.`);
8612
+ lines.push(`export const ${group}Def = {`);
8545
8613
  for (const route of routes) {
8546
- lines.push(` ${route.actionName}: {`);
8547
- lines.push(` method: '${route.method}',`);
8548
- lines.push(` path: '${route.runtimePath}',`);
8549
- if (route.auth) lines.push(` auth: true,`);
8550
- lines.push(` },`);
8614
+ lines.push(` ${route.actionName}: {`);
8615
+ lines.push(` method: '${route.method}',`);
8616
+ lines.push(` path: '${route.runtimePath}',`);
8617
+ if (route.auth) lines.push(` auth: true,`);
8618
+ lines.push(` },`);
8551
8619
  }
8552
- lines.push(` },`);
8620
+ lines.push(`} as const`);
8621
+ await import_fs_extra3.default.writeFile(import_path2.default.join(resourceDir, "api.generated.ts"), lines.join("\n"));
8553
8622
  }
8554
- lines.push(`})`);
8555
- lines.push(``);
8556
- lines.push(`export default api`);
8557
- await import_fs_extra3.default.writeFile(import_path.default.join(outputDir, "api.ts"), lines.join("\n"));
8558
8623
  }
8559
8624
  };
8560
8625
 
8561
8626
  // packages/cli/src/generators/TypeGenerator.ts
8562
- var import_path2 = __toESM(require("path"));
8627
+ var import_path3 = __toESM(require("path"));
8563
8628
  var import_fs_extra4 = __toESM(require_lib());
8629
+ init_names();
8564
8630
  var TypeGenerator = class {
8565
8631
  static async generate(manifest, outputDir) {
8566
- const lines = [];
8567
- lines.push(`// Auto-generated by routesync. Do not edit manually.`);
8568
- lines.push(``);
8569
- lines.push(`export interface ApiResponse<T = any> {`);
8570
- lines.push(` success: boolean`);
8571
- lines.push(` message?: string`);
8572
- lines.push(` data: T`);
8573
- lines.push(` meta?: PaginationMeta`);
8574
- lines.push(`}`);
8575
- lines.push(``);
8576
- lines.push(`export interface PaginationMeta {`);
8577
- lines.push(` current_page: number`);
8578
- lines.push(` last_page: number`);
8579
- lines.push(` per_page: number`);
8580
- lines.push(` total: number`);
8581
- lines.push(`}`);
8582
- lines.push(``);
8583
- lines.push(`export interface ApiError {`);
8584
- lines.push(` success: false`);
8585
- lines.push(` message: string`);
8586
- lines.push(` errors?: Record<string, string[]>`);
8587
- lines.push(` status?: number`);
8588
- lines.push(`}`);
8589
- lines.push(``);
8590
- const resources = new Set(
8591
- manifest.routes.map((r) => r.path.replace(/^\//, "").split("/")[0])
8592
- );
8593
- for (const resource of resources) {
8594
- const typeName = toTypeName(resource ?? "");
8632
+ const coreDir = import_path3.default.join(outputDir, "core", "contracts");
8633
+ await import_fs_extra4.default.ensureDir(coreDir);
8634
+ const coreLines = [];
8635
+ coreLines.push(`// Auto-generated by routesync. Do not edit manually.`);
8636
+ coreLines.push(``);
8637
+ coreLines.push(`export interface ApiResponse<T = any> {`);
8638
+ coreLines.push(` success: boolean`);
8639
+ coreLines.push(` message?: string`);
8640
+ coreLines.push(` data: T`);
8641
+ coreLines.push(` meta?: PaginationMeta`);
8642
+ coreLines.push(`}`);
8643
+ coreLines.push(``);
8644
+ coreLines.push(`export interface PaginationMeta {`);
8645
+ coreLines.push(` current_page: number`);
8646
+ coreLines.push(` last_page: number`);
8647
+ coreLines.push(` per_page: number`);
8648
+ coreLines.push(` total: number`);
8649
+ coreLines.push(`}`);
8650
+ coreLines.push(``);
8651
+ coreLines.push(`export interface ApiError {`);
8652
+ coreLines.push(` success: false`);
8653
+ coreLines.push(` message: string`);
8654
+ coreLines.push(` errors?: Record<string, string[]>`);
8655
+ coreLines.push(` status?: number`);
8656
+ coreLines.push(`}`);
8657
+ coreLines.push(``);
8658
+ await import_fs_extra4.default.writeFile(import_path3.default.join(coreDir, "types.ts"), coreLines.join("\n"));
8659
+ const { buildGeneratedRoutes: buildGeneratedRoutes3 } = (init_names(), __toCommonJS(names_exports));
8660
+ const grouped = buildGeneratedRoutes3(manifest.routes);
8661
+ for (const [group, routes] of Object.entries(grouped)) {
8662
+ const resourceDir = import_path3.default.join(outputDir, group, "contracts");
8663
+ await import_fs_extra4.default.ensureDir(resourceDir);
8664
+ const lines = [];
8665
+ lines.push(`// Auto-generated. Do not edit.`);
8666
+ lines.push(`import { ApiResponse, PaginationMeta, ApiError } from '../../core/contracts/types'`);
8667
+ const hasSchemas = routes.some((r) => r.schema && Object.keys(r.schema).length > 0);
8668
+ if (hasSchemas) {
8669
+ lines.push(`import { z } from 'zod'`);
8670
+ }
8671
+ lines.push(``);
8672
+ const typeName = toTypeName(group);
8595
8673
  lines.push(`export interface ${typeName} {`);
8596
8674
  lines.push(` id: number`);
8597
- lines.push(` // TODO: Add ${resource} fields`);
8675
+ lines.push(` // TODO: Add ${group} fields`);
8598
8676
  lines.push(` created_at?: string`);
8599
8677
  lines.push(` updated_at?: string`);
8600
8678
  lines.push(`}`);
8601
8679
  lines.push(``);
8680
+ for (const route of routes) {
8681
+ if (route.schema && Object.keys(route.schema).length > 0) {
8682
+ const actionName = toMethodName(route);
8683
+ const schemaName = actionName + "Schema";
8684
+ lines.push(`export const ${schemaName} = z.object({`);
8685
+ for (const [field, rules] of Object.entries(route.schema)) {
8686
+ const ruleStr = Array.isArray(rules) ? rules.join("|") : String(rules);
8687
+ let zodRule = "z.string()";
8688
+ if (ruleStr.includes("numeric") || ruleStr.includes("integer")) {
8689
+ zodRule = "z.number()";
8690
+ } else if (ruleStr.includes("boolean")) {
8691
+ zodRule = "z.boolean()";
8692
+ } else if (ruleStr.includes("array")) {
8693
+ zodRule = "z.array(z.any())";
8694
+ }
8695
+ if (ruleStr.includes("email")) zodRule += ".email()";
8696
+ if (ruleStr.includes("url")) zodRule += ".url()";
8697
+ const matchMin = ruleStr.match(/min:(\\d+)/);
8698
+ if (matchMin) zodRule += ".min(" + matchMin[1] + ")";
8699
+ const matchMax = ruleStr.match(/max:(\\d+)/);
8700
+ if (matchMax) zodRule += ".max(" + matchMax[1] + ")";
8701
+ if (!ruleStr.includes("required")) {
8702
+ zodRule += ".optional()";
8703
+ }
8704
+ if (ruleStr.includes("nullable")) {
8705
+ zodRule += ".nullable()";
8706
+ }
8707
+ lines.push(` ${field}: ${zodRule},`);
8708
+ }
8709
+ lines.push(`})`);
8710
+ lines.push(`export type ${toTypeName(actionName + "Payload")} = z.infer<typeof ${schemaName}>`);
8711
+ lines.push(``);
8712
+ }
8713
+ }
8714
+ await import_fs_extra4.default.writeFile(import_path3.default.join(resourceDir, "api.generated.ts"), lines.join("\n"));
8715
+ }
8716
+ const rootTypes = [];
8717
+ rootTypes.push(`// Auto-generated. Do not edit.`);
8718
+ rootTypes.push(`export * from './core/contracts/types'`);
8719
+ for (const group of Object.keys(grouped)) {
8720
+ rootTypes.push(`export * from './${group}/contracts/api.generated'`);
8602
8721
  }
8603
- await import_fs_extra4.default.writeFile(import_path2.default.join(outputDir, "types.ts"), lines.join("\n"));
8722
+ await import_fs_extra4.default.writeFile(import_path3.default.join(outputDir, "types.ts"), rootTypes.join("\n"));
8604
8723
  }
8605
8724
  };
8606
8725
 
8607
8726
  // packages/cli/src/generators/HookGenerator.ts
8608
- var import_path3 = __toESM(require("path"));
8727
+ var import_path4 = __toESM(require("path"));
8609
8728
  var import_fs_extra5 = __toESM(require_lib());
8610
- var HookGenerator = class _HookGenerator {
8729
+ init_names();
8730
+ var HookGenerator = class {
8611
8731
  static async generate(manifest, outputDir) {
8612
- const lines = [];
8613
- lines.push(`// Auto-generated by routesync. Do not edit manually.`);
8614
- lines.push(``);
8615
- lines.push(`import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'`);
8616
- lines.push(`import { api } from './api'`);
8617
- lines.push(``);
8618
8732
  const grouped = buildGeneratedRoutes(manifest.routes);
8619
8733
  for (const [group, routes] of Object.entries(grouped)) {
8734
+ const resourceDir = import_path4.default.join(outputDir, group, "hooks");
8735
+ await import_fs_extra5.default.ensureDir(resourceDir);
8736
+ const lines = [];
8737
+ lines.push(`// Auto-generated. Do not edit.`);
8738
+ lines.push(`import { useQuery, useMutation } from '@tanstack/react-query'`);
8739
+ lines.push(`import { api } from '../../api'`);
8740
+ lines.push(`import type { ${toTypeName(group)} } from '../contracts/api.generated'`);
8741
+ const imports = [];
8620
8742
  for (const route of routes) {
8621
- const method = route.method.toUpperCase();
8622
- const hookName = _HookGenerator.toHookName(group, route.actionName);
8623
- const queryKey = `['${group}', '${route.actionName}']`;
8624
- if (method === "GET") {
8625
- lines.push(`export function ${hookName}(params?: Record<string, any>) {`);
8743
+ if (route.schema && Object.keys(route.schema).length > 0) {
8744
+ imports.push(toTypeName(toMethodName(route) + "Payload"));
8745
+ }
8746
+ }
8747
+ if (imports.length > 0) {
8748
+ lines.push(`import type { ${imports.join(", ")} } from '../contracts/api.generated'`);
8749
+ }
8750
+ lines.push(``);
8751
+ for (const route of routes) {
8752
+ const actionName = toMethodName(route);
8753
+ const hookName = this.toHookName(group, actionName);
8754
+ const payloadType = route.schema && Object.keys(route.schema).length > 0 ? toTypeName(actionName + "Payload") : "any";
8755
+ if (route.method === "GET") {
8756
+ lines.push(`export function ${hookName}() {`);
8626
8757
  lines.push(` return useQuery({`);
8627
- lines.push(` queryKey: ${queryKey},`);
8628
- lines.push(` queryFn: () => api.${group}.${route.actionName}({ query: params })`);
8758
+ lines.push(` queryKey: ['${group}', '${actionName}'],`);
8759
+ lines.push(` queryFn: () => api.${group}.${actionName}()`);
8629
8760
  lines.push(` })`);
8630
8761
  lines.push(`}`);
8631
- lines.push(``);
8632
8762
  } else {
8633
8763
  lines.push(`export function ${hookName}() {`);
8634
- lines.push(` const queryClient = useQueryClient()`);
8635
8764
  lines.push(` return useMutation({`);
8636
- lines.push(` mutationFn: (data: any) => api.${group}.${route.actionName}({ body: data }),`);
8637
- lines.push(` onSuccess: () => {`);
8638
- lines.push(` queryClient.invalidateQueries({ queryKey: ['${group}'] })`);
8639
- lines.push(` }`);
8765
+ lines.push(` mutationFn: (data: ${payloadType}) => api.${group}.${actionName}(data)`);
8640
8766
  lines.push(` })`);
8641
8767
  lines.push(`}`);
8642
- lines.push(``);
8643
8768
  }
8769
+ lines.push(``);
8644
8770
  }
8771
+ await import_fs_extra5.default.writeFile(import_path4.default.join(resourceDir, "api.generated.ts"), lines.join("\n"));
8645
8772
  }
8646
- await import_fs_extra5.default.writeFile(import_path3.default.join(outputDir, "hooks.ts"), lines.join("\n"));
8773
+ const rootHooks = [];
8774
+ rootHooks.push(`// Auto-generated. Do not edit.`);
8775
+ for (const group of Object.keys(grouped)) {
8776
+ rootHooks.push(`export * from './${group}/hooks/api.generated'`);
8777
+ }
8778
+ await import_fs_extra5.default.writeFile(import_path4.default.join(outputDir, "hooks.ts"), rootHooks.join("\n"));
8647
8779
  }
8648
8780
  static toHookName(group, actionName) {
8649
8781
  return `use${toTypeName(group)}${toTypeName(actionName)}`;
8650
8782
  }
8651
8783
  };
8652
8784
 
8653
- // packages/cli/src/commands/generate.ts
8785
+ // packages/cli/src/generators/NextActionGenerator.ts
8786
+ var import_path5 = __toESM(require("path"));
8654
8787
  var import_fs_extra6 = __toESM(require_lib());
8655
- var generateCommand = new Command("generate").description("Generate typed SDK, types, and hooks from route manifest").option("-m, --manifest <path>", "Path to route manifest", "routesync.manifest.json").option("-o, --output <path>", "Output directory", "src/api").option("--no-hooks", "Skip generating React hooks").action(async (options) => {
8788
+ init_names();
8789
+ var NextActionGenerator = class {
8790
+ static async generate(manifest, outputDir) {
8791
+ const coreDir = import_path5.default.join(outputDir, "core");
8792
+ await import_fs_extra6.default.ensureDir(coreDir);
8793
+ const coreLines = [];
8794
+ coreLines.push(`// Auto-generated Next.js Server Actions helpers.`);
8795
+ coreLines.push(`"use server";`);
8796
+ coreLines.push(``);
8797
+ coreLines.push(`import { cookies } from 'next/headers'`);
8798
+ coreLines.push(``);
8799
+ coreLines.push(`export async function getAuthHeaders() {`);
8800
+ coreLines.push(` const cookieStore = await cookies()`);
8801
+ coreLines.push(` const token = cookieStore.get('token')?.value`);
8802
+ coreLines.push(` return token ? { Authorization: \`Bearer \${token}\` } : {}`);
8803
+ coreLines.push(`}`);
8804
+ coreLines.push(``);
8805
+ await import_fs_extra6.default.writeFile(import_path5.default.join(coreDir, "actions.ts"), coreLines.join("\n"));
8806
+ const { buildGeneratedRoutes: buildGeneratedRoutes3 } = (init_names(), __toCommonJS(names_exports));
8807
+ const grouped = buildGeneratedRoutes3(manifest.routes);
8808
+ for (const [group, routes] of Object.entries(grouped)) {
8809
+ const resourceDir = import_path5.default.join(outputDir, group, "services");
8810
+ await import_fs_extra6.default.ensureDir(resourceDir);
8811
+ const lines = [];
8812
+ lines.push(`// Auto-generated. Do not edit.`);
8813
+ lines.push(`'use server'`);
8814
+ lines.push(``);
8815
+ lines.push(`import { api } from '../../api'`);
8816
+ lines.push(`import { getAuthHeaders } from '../../core/contracts/actions'`);
8817
+ const imports = [];
8818
+ for (const route of routes) {
8819
+ if (route.schema && Object.keys(route.schema).length > 0) {
8820
+ imports.push(toTypeName(toMethodName(route) + "Payload"));
8821
+ }
8822
+ }
8823
+ if (imports.length > 0) {
8824
+ lines.push(`import type { ${imports.join(", ")} } from '../contracts/api.generated'`);
8825
+ }
8826
+ lines.push(``);
8827
+ for (const route of routes) {
8828
+ if (route.method === "GET") continue;
8829
+ const actionName = toMethodName(route);
8830
+ const payloadType = route.schema && Object.keys(route.schema).length > 0 ? toTypeName(actionName + "Payload") : "any";
8831
+ lines.push(`export async function ${actionName}Action(data: ${payloadType}) {`);
8832
+ if (route.auth) {
8833
+ lines.push(` const headers = await getAuthHeaders()`);
8834
+ lines.push(` // Note: SDK must support passing headers if used server-side`);
8835
+ lines.push(` // e.g. api.${group}.${actionName}(data, { headers })`);
8836
+ }
8837
+ lines.push(` return api.${group}.${actionName}(data)`);
8838
+ lines.push(`}`);
8839
+ lines.push(``);
8840
+ }
8841
+ await import_fs_extra6.default.writeFile(import_path5.default.join(resourceDir, "actions.generated.ts"), lines.join("\n"));
8842
+ }
8843
+ const rootActions = [];
8844
+ rootActions.push(`// Auto-generated. Do not edit.`);
8845
+ for (const group of Object.keys(grouped)) {
8846
+ rootActions.push(`export * from './${group}/services/actions.generated'`);
8847
+ }
8848
+ await import_fs_extra6.default.writeFile(import_path5.default.join(outputDir, "actions.ts"), rootActions.join("\n"));
8849
+ }
8850
+ };
8851
+
8852
+ // packages/cli/src/generators/MswGenerator.ts
8853
+ var import_path6 = __toESM(require("path"));
8854
+ var import_fs_extra7 = __toESM(require_lib());
8855
+ var MswGenerator = class {
8856
+ static async generate(manifest, outputDir) {
8857
+ const { buildGeneratedRoutes: buildGeneratedRoutes3 } = (init_names(), __toCommonJS(names_exports));
8858
+ const grouped = buildGeneratedRoutes3(manifest.routes);
8859
+ const rootLines = [];
8860
+ rootLines.push(`// Auto-generated MSW Mocks. Do not edit manually.`);
8861
+ const groupNames = Object.keys(grouped);
8862
+ for (const group of groupNames) {
8863
+ rootLines.push(`import { handlers as ${group}Handlers } from './resources/${group}/mocks'`);
8864
+ }
8865
+ rootLines.push(``);
8866
+ rootLines.push(`export const handlers = [`);
8867
+ for (const group of groupNames) {
8868
+ rootLines.push(` ...${group}Handlers,`);
8869
+ }
8870
+ rootLines.push(`]`);
8871
+ await import_fs_extra7.default.writeFile(import_path6.default.join(outputDir, "mocks.ts"), rootLines.join("\n"));
8872
+ for (const [group, routes] of Object.entries(grouped)) {
8873
+ const resourceDir = import_path6.default.join(outputDir, group, "services");
8874
+ await import_fs_extra7.default.ensureDir(resourceDir);
8875
+ const lines = [];
8876
+ lines.push(`// Auto-generated. Do not edit.`);
8877
+ lines.push(`import { http, HttpResponse } from 'msw'`);
8878
+ lines.push(``);
8879
+ lines.push(`export const ${group}Mocks = [`);
8880
+ for (const route of routes) {
8881
+ const method = route.method.toLowerCase();
8882
+ const path10 = route.runtimePath.replace(/\{([^}]+)\}/g, ":$1");
8883
+ lines.push(` http.${method}('http://localhost:8000/api${path10}', () => {`);
8884
+ lines.push(` return HttpResponse.json({`);
8885
+ lines.push(` message: 'Mocked response for ${route.actionName}',`);
8886
+ lines.push(` data: {}`);
8887
+ lines.push(` })`);
8888
+ lines.push(` }),`);
8889
+ }
8890
+ lines.push(`]`);
8891
+ await import_fs_extra7.default.writeFile(import_path6.default.join(resourceDir, "mocks.generated.ts"), lines.join("\n"));
8892
+ }
8893
+ const rootMocks = [];
8894
+ rootMocks.push(`// Auto-generated. Do not edit.`);
8895
+ for (const group of Object.keys(grouped)) {
8896
+ rootMocks.push(`export * from './${group}/services/mocks.generated'`);
8897
+ }
8898
+ await import_fs_extra7.default.writeFile(import_path6.default.join(outputDir, "mocks.ts"), rootMocks.join("\n"));
8899
+ }
8900
+ };
8901
+
8902
+ // packages/cli/src/generators/EchoGenerator.ts
8903
+ var import_fs_extra8 = __toESM(require_lib());
8904
+ var import_path7 = __toESM(require("path"));
8905
+ init_names();
8906
+ var EchoGenerator = class {
8907
+ static async generate(channels, outputDir) {
8908
+ if (channels.length === 0) return;
8909
+ const lines = [];
8910
+ lines.push(`// Auto-generated Laravel Echo Hooks. Do not edit manually.`);
8911
+ lines.push(`import { useEffect } from 'react'`);
8912
+ lines.push(`import Echo from 'laravel-echo'`);
8913
+ lines.push(``);
8914
+ lines.push(`// Ensure you have configured window.Echo somewhere in your app`);
8915
+ lines.push(``);
8916
+ const grouped = {};
8917
+ for (const channel of channels) {
8918
+ const parts = channel.name.replace(/\\{[^}]+\\}/g, "").split(".").filter(Boolean);
8919
+ const group = parts[0] || "general";
8920
+ if (!grouped[group]) grouped[group] = [];
8921
+ grouped[group].push(channel);
8922
+ }
8923
+ const rootLines = [];
8924
+ rootLines.push(`// Auto-generated Laravel Echo Hooks. Do not edit manually.`);
8925
+ const groupNames = Object.keys(grouped);
8926
+ for (const group of groupNames) {
8927
+ rootLines.push(`export * from './${group}/hooks/echo.generated'`);
8928
+ }
8929
+ await import_fs_extra8.default.writeFile(import_path7.default.join(outputDir, "echo.ts"), rootLines.join("\n"));
8930
+ for (const [group, groupChannels] of Object.entries(grouped)) {
8931
+ const resourceDir = import_path7.default.join(outputDir, group, "hooks");
8932
+ await import_fs_extra8.default.ensureDir(resourceDir);
8933
+ const lines2 = [];
8934
+ lines2.push(`// Auto-generated. Do not edit.`);
8935
+ lines2.push(`import { useEffect } from 'react'`);
8936
+ lines2.push(`import Echo from 'laravel-echo'`);
8937
+ lines2.push(``);
8938
+ for (const channel of groupChannels) {
8939
+ const nameParts = channel.name.replace(/\\{[^}]+\\}/g, "").split(".").filter(Boolean);
8940
+ const hookName = "useListen" + toTypeName(nameParts.join(" ")) + "Channel";
8941
+ const params = [...channel.name.matchAll(/\\{([^}]+)\\}/g)].map((m) => m[1]);
8942
+ const paramArgs = params.length > 0 ? params.map((p) => p + ": string | number").join(", ") + ", " : "";
8943
+ const runtimeChannelName = channel.name.replace(/\\{([^}]+)\\}/g, "${$1}");
8944
+ lines2.push("export function " + hookName + "(" + paramArgs + "eventName: string, callback: (event: any) => void) {");
8945
+ lines2.push(` useEffect(() => {`);
8946
+ lines2.push(` if (typeof window === 'undefined' || !(window as any).Echo) return`);
8947
+ lines2.push(` `);
8948
+ lines2.push(` const echo: Echo = (window as any).Echo`);
8949
+ const channelMethod = channel.isPrivate ? "private" : "channel";
8950
+ lines2.push(" const channelInstance = echo." + channelMethod + "(`" + runtimeChannelName + "`)");
8951
+ lines2.push(` channelInstance.listen(eventName, callback)`);
8952
+ lines2.push(` `);
8953
+ lines2.push(` return () => {`);
8954
+ lines2.push(` channelInstance.stopListening(eventName, callback)`);
8955
+ lines2.push(` }`);
8956
+ const deps = params.join(", ");
8957
+ const allDeps = deps ? "[" + deps + ", eventName, callback]" : "[eventName, callback]";
8958
+ lines2.push(" }, " + allDeps + ")");
8959
+ lines2.push(`}`);
8960
+ lines2.push(``);
8961
+ }
8962
+ await import_fs_extra8.default.writeFile(import_path7.default.join(resourceDir, "echo.generated.ts"), lines2.join("\n"));
8963
+ }
8964
+ }
8965
+ };
8966
+
8967
+ // packages/cli/src/generators/IndexGenerator.ts
8968
+ var import_path8 = __toESM(require("path"));
8969
+ var import_fs_extra9 = __toESM(require_lib());
8970
+ init_names();
8971
+ var IndexGenerator = class {
8972
+ static async generate(manifest, outputDir, options) {
8973
+ const grouped = buildGeneratedRoutes(manifest.routes);
8974
+ const rootLines = [];
8975
+ rootLines.push(`// Auto-generated. Do not edit.`);
8976
+ rootLines.push(`export { api } from './api'`);
8977
+ rootLines.push(`export * from './types'`);
8978
+ if (options.hooks !== false) rootLines.push(`export * from './hooks'`);
8979
+ if (options.nextActions) rootLines.push(`export * from './actions'`);
8980
+ await import_fs_extra9.default.writeFile(import_path8.default.join(outputDir, "index.ts"), rootLines.join("\n"));
8981
+ }
8982
+ };
8983
+
8984
+ // packages/cli/src/commands/generate.ts
8985
+ var import_fs_extra10 = __toESM(require_lib());
8986
+ var generateCommand = new Command("generate").description("Generate typed SDK, types, and hooks from route manifest").option("-m, --manifest <path>", "Path to route manifest", "routesync.manifest.json").option("-o, --output <path>", "Output directory", "src/api").option("--no-hooks", "Skip generating React hooks").option("--next-actions", "Generate Next.js Server Actions").option("--msw", "Generate MSW Mock Handlers").option("--echo", "Generate Laravel Echo Hooks").action(async (options) => {
8656
8987
  const spinner = ora("Generating SDK...").start();
8657
8988
  try {
8658
- if (!import_fs_extra6.default.existsSync(options.manifest)) {
8989
+ if (!import_fs_extra10.default.existsSync(options.manifest)) {
8659
8990
  throw new Error(
8660
8991
  `Manifest not found: ${options.manifest}. Run 'routesync scan' first.`
8661
8992
  );
8662
8993
  }
8663
- const manifest = await import_fs_extra6.default.readJson(options.manifest);
8664
- await import_fs_extra6.default.ensureDir(options.output);
8994
+ const manifest = await import_fs_extra10.default.readJson(options.manifest);
8995
+ await import_fs_extra10.default.ensureDir(options.output);
8665
8996
  spinner.text = "Generating types...";
8666
8997
  await TypeGenerator.generate(manifest, options.output);
8667
8998
  spinner.text = "Generating SDK...";
@@ -8670,35 +9001,85 @@ var generateCommand = new Command("generate").description("Generate typed SDK, t
8670
9001
  spinner.text = "Generating hooks...";
8671
9002
  await HookGenerator.generate(manifest, options.output);
8672
9003
  }
9004
+ if (options.nextActions) {
9005
+ spinner.text = "Generating Server Actions...";
9006
+ await NextActionGenerator.generate(manifest, options.output);
9007
+ }
9008
+ if (options.msw) {
9009
+ spinner.text = "Generating MSW Mocks...";
9010
+ await MswGenerator.generate(manifest, options.output);
9011
+ }
9012
+ if (options.echo && manifest.channels) {
9013
+ spinner.text = "Generating Echo Hooks...";
9014
+ await EchoGenerator.generate(manifest.channels, options.output);
9015
+ }
9016
+ spinner.text = "Generating Index Files...";
9017
+ await IndexGenerator.generate(manifest, options.output, options);
8673
9018
  spinner.succeed(source_default.green(`SDK generated \u2192 ${options.output}`));
8674
9019
  console.log(` ${source_default.cyan("api.ts")} Typed API client`);
8675
9020
  console.log(` ${source_default.cyan("types.ts")} Response/request types`);
8676
9021
  if (options.hooks !== false) {
8677
9022
  console.log(` ${source_default.cyan("hooks.ts")} React Query hooks`);
8678
9023
  }
9024
+ if (options.nextActions) {
9025
+ console.log(` ${source_default.cyan("actions.ts")} Next.js Server Actions`);
9026
+ }
9027
+ if (options.msw) {
9028
+ console.log(` ${source_default.cyan("mocks.ts")} MSW Mock Handlers`);
9029
+ }
9030
+ if (options.echo && manifest.channels) {
9031
+ console.log(` ${source_default.cyan("echo.ts")} Laravel Echo Hooks`);
9032
+ }
8679
9033
  } catch (err) {
8680
9034
  spinner.fail(source_default.red(`Generate failed: ${err.message}`));
8681
9035
  process.exit(1);
8682
9036
  }
8683
9037
  });
8684
9038
 
9039
+ // packages/cli/src/parsers/LaravelChannelParser.ts
9040
+ var import_fs_extra11 = __toESM(require_lib());
9041
+ var LaravelChannelParser = class {
9042
+ async parse(channelFilePath = "routes/channels.php") {
9043
+ if (!import_fs_extra11.default.existsSync(channelFilePath)) {
9044
+ return [];
9045
+ }
9046
+ const content = await import_fs_extra11.default.readFile(channelFilePath, "utf-8");
9047
+ const channels = [];
9048
+ const regex2 = new RegExp(`Broadcast::channel\\(\\s*['"]([^'"]+)['"]`, "g");
9049
+ let match;
9050
+ while ((match = regex2.exec(content)) !== null) {
9051
+ const name = match[1];
9052
+ channels.push({
9053
+ name,
9054
+ isPrivate: true,
9055
+ // we default to private for now as most channels are authenticated
9056
+ isPresence: false
9057
+ });
9058
+ }
9059
+ return channels;
9060
+ }
9061
+ };
9062
+
8685
9063
  // packages/cli/src/commands/sync.ts
8686
- var import_fs_extra7 = __toESM(require_lib());
8687
- var syncCommand = new Command("sync").description("Scan routes and generate SDK in one step").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output directory", "src/api").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").option("--no-hooks", "Skip generating React hooks").action(async (options) => {
9064
+ var import_fs_extra12 = __toESM(require_lib());
9065
+ var syncCommand = new Command("sync").description("Scan routes and generate SDK in one step").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output directory", "src/api").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").option("--no-hooks", "Skip generating React hooks").option("--next-actions", "Generate Next.js Server Actions").option("--msw", "Generate MSW Mock Handlers").option("--echo", "Generate Laravel Echo Hooks").action(async (options) => {
8688
9066
  console.log(source_default.bold.blue("\n routesync sync\n"));
8689
9067
  const steps = [
8690
9068
  { text: "Scanning Laravel routes" },
8691
9069
  { text: "Generating types" },
8692
9070
  { text: "Generating SDK" },
8693
- { text: "Generating hooks" }
9071
+ { text: "Generating hooks" },
9072
+ { text: "Generating Server Actions" }
8694
9073
  ];
8695
9074
  const spinner = ora(steps[0].text).start();
8696
9075
  try {
8697
9076
  const parser = new LaravelRouteParser();
8698
9077
  const routes = await parser.parse(options.input);
8699
- const manifest = ManifestGenerator.generate(routes, options.baseURL);
8700
- spinner.succeed(source_default.green(`\u2714 ${steps[0].text} (${routes.length} routes)`));
8701
- await import_fs_extra7.default.ensureDir(options.output);
9078
+ const channelParser = new LaravelChannelParser();
9079
+ const channels = options.echo ? await channelParser.parse("routes/channels.php") : [];
9080
+ const manifest = ManifestGenerator.generate(routes, options.baseURL, channels);
9081
+ spinner.succeed(source_default.green(`\u2714 ${steps[0].text} (${routes.length} routes, ${channels.length} channels)`));
9082
+ await import_fs_extra12.default.ensureDir(options.output);
8702
9083
  spinner.start(steps[1].text);
8703
9084
  await TypeGenerator.generate(manifest, options.output);
8704
9085
  spinner.succeed(source_default.green(`\u2714 ${steps[1].text}`));
@@ -8710,6 +9091,24 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
8710
9091
  await HookGenerator.generate(manifest, options.output);
8711
9092
  spinner.succeed(source_default.green(`\u2714 ${steps[3].text}`));
8712
9093
  }
9094
+ if (options.nextActions) {
9095
+ spinner.start(steps[4].text);
9096
+ await NextActionGenerator.generate(manifest, options.output);
9097
+ spinner.succeed(source_default.green(`\u2714 ${steps[4].text}`));
9098
+ }
9099
+ if (options.msw) {
9100
+ spinner.start("Generating MSW Mocks");
9101
+ await MswGenerator.generate(manifest, options.output);
9102
+ spinner.succeed(source_default.green(`\u2714 Generating MSW Mocks`));
9103
+ }
9104
+ if (options.echo && manifest.channels) {
9105
+ spinner.start("Generating Echo Hooks");
9106
+ await EchoGenerator.generate(manifest.channels, options.output);
9107
+ spinner.succeed(source_default.green(`\u2714 Generating Echo Hooks`));
9108
+ }
9109
+ spinner.start("Generating Index Files");
9110
+ await IndexGenerator.generate(manifest, options.output, options);
9111
+ spinner.succeed(source_default.green(`\u2714 Generating Index Files`));
8713
9112
  console.log(source_default.bold.green("\n Sync complete!\n"));
8714
9113
  console.log(` Output: ${source_default.cyan(options.output)}`);
8715
9114
  } catch (err) {
@@ -8719,8 +9118,8 @@ var syncCommand = new Command("sync").description("Scan routes and generate SDK
8719
9118
  });
8720
9119
 
8721
9120
  // packages/cli/src/commands/watch.ts
8722
- var import_fs_extra8 = __toESM(require_lib());
8723
- var import_path4 = __toESM(require("path"));
9121
+ var import_fs_extra13 = __toESM(require_lib());
9122
+ var import_path9 = __toESM(require("path"));
8724
9123
  var watchCommand = new Command("watch").description("Watch routes file and re-sync on changes").option("-i, --input <path>", "Path to routes/api.php", "routes/api.php").option("-o, --output <path>", "Output directory", "src/api").option("-b, --baseURL <url>", "API base URL", "http://localhost/api").action(async (options) => {
8725
9124
  console.log(source_default.bold.blue("\n routesync watch\n"));
8726
9125
  console.log(` Watching: ${source_default.cyan(options.input)}`);
@@ -8731,8 +9130,8 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
8731
9130
  debounceTimer = setTimeout(async () => {
8732
9131
  console.log(source_default.yellow(` [${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] Routes changed, syncing...`));
8733
9132
  try {
8734
- const { execSync } = await import("child_process");
8735
- execSync(
9133
+ const { execSync: execSync2 } = await import("child_process");
9134
+ execSync2(
8736
9135
  `routesync sync --input ${options.input} --output ${options.output} --baseURL ${options.baseURL}`,
8737
9136
  { stdio: "inherit" }
8738
9137
  );
@@ -8741,11 +9140,11 @@ var watchCommand = new Command("watch").description("Watch routes file and re-sy
8741
9140
  }
8742
9141
  }, 300);
8743
9142
  };
8744
- if (!import_fs_extra8.default.existsSync(options.input)) {
9143
+ if (!import_fs_extra13.default.existsSync(options.input)) {
8745
9144
  console.error(source_default.red(` File not found: ${options.input}`));
8746
9145
  process.exit(1);
8747
9146
  }
8748
- import_fs_extra8.default.watch(import_path4.default.resolve(options.input), onChange);
9147
+ import_fs_extra13.default.watch(import_path9.default.resolve(options.input), onChange);
8749
9148
  });
8750
9149
 
8751
9150
  // packages/cli/src/index.ts