@yamada-ui/cli 2.0.4 → 2.0.5-dev-20251027025837

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +308 -267
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -801,13 +801,19 @@ const xdgConfigDirectories = (env$2.XDG_CONFIG_DIRS || "/etc/xdg").split(":");
801
801
  if (xdgConfig) xdgConfigDirectories.unshift(xdgConfig);
802
802
 
803
803
  //#endregion
804
- //#region ../../node_modules/.pnpm/stubborn-fs@1.2.5/node_modules/stubborn-fs/dist/attemptify.js
805
- const attemptifyAsync = (fn, onError) => {
804
+ //#region ../../node_modules/.pnpm/stubborn-utils@1.0.1/node_modules/stubborn-utils/dist/attemptify_async.js
805
+ const attemptifyAsync = (fn, options) => {
806
+ const { onError } = options;
806
807
  return function attemptified(...args) {
807
808
  return fn.apply(void 0, args).catch(onError);
808
809
  };
809
810
  };
810
- const attemptifySync = (fn, onError) => {
811
+ var attemptify_async_default = attemptifyAsync;
812
+
813
+ //#endregion
814
+ //#region ../../node_modules/.pnpm/stubborn-utils@1.0.1/node_modules/stubborn-utils/dist/attemptify_sync.js
815
+ const attemptifySync = (fn, options) => {
816
+ const { onError } = options;
811
817
  return function attemptified(...args) {
812
818
  try {
813
819
  return fn.apply(void 0, args);
@@ -816,15 +822,55 @@ const attemptifySync = (fn, onError) => {
816
822
  }
817
823
  };
818
824
  };
825
+ var attemptify_sync_default = attemptifySync;
819
826
 
820
827
  //#endregion
821
- //#region ../../node_modules/.pnpm/stubborn-fs@1.2.5/node_modules/stubborn-fs/dist/constants.js
822
- const IS_USER_ROOT$1 = process$1.getuid ? !process$1.getuid() : false;
823
- const LIMIT_FILES_DESCRIPTORS = 1e4;
824
- const NOOP = () => void 0;
828
+ //#region ../../node_modules/.pnpm/stubborn-utils@1.0.1/node_modules/stubborn-utils/dist/constants.js
829
+ const RETRY_INTERVAL = 250;
825
830
 
826
831
  //#endregion
827
- //#region ../../node_modules/.pnpm/stubborn-fs@1.2.5/node_modules/stubborn-fs/dist/handlers.js
832
+ //#region ../../node_modules/.pnpm/stubborn-utils@1.0.1/node_modules/stubborn-utils/dist/retryify_async.js
833
+ const retryifyAsync = (fn, options) => {
834
+ const { isRetriable } = options;
835
+ return function retryified(options$1) {
836
+ const { timeout: timeout$1 } = options$1;
837
+ const interval = options$1.interval ?? RETRY_INTERVAL;
838
+ const timestamp = Date.now() + timeout$1;
839
+ return function attempt(...args) {
840
+ return fn.apply(void 0, args).catch((error) => {
841
+ if (!isRetriable(error)) throw error;
842
+ if (Date.now() >= timestamp) throw error;
843
+ const delay$1 = Math.round(interval * Math.random());
844
+ if (delay$1 > 0) return new Promise((resolve) => setTimeout(resolve, delay$1)).then(() => attempt.apply(void 0, args));
845
+ else return attempt.apply(void 0, args);
846
+ });
847
+ };
848
+ };
849
+ };
850
+ var retryify_async_default = retryifyAsync;
851
+
852
+ //#endregion
853
+ //#region ../../node_modules/.pnpm/stubborn-utils@1.0.1/node_modules/stubborn-utils/dist/retryify_sync.js
854
+ const retryifySync = (fn, options) => {
855
+ const { isRetriable } = options;
856
+ return function retryified(options$1) {
857
+ const { timeout: timeout$1 } = options$1;
858
+ const timestamp = Date.now() + timeout$1;
859
+ return function attempt(...args) {
860
+ while (true) try {
861
+ return fn.apply(void 0, args);
862
+ } catch (error) {
863
+ if (!isRetriable(error)) throw error;
864
+ if (Date.now() >= timestamp) throw error;
865
+ continue;
866
+ }
867
+ };
868
+ };
869
+ };
870
+ var retryify_sync_default = retryifySync;
871
+
872
+ //#endregion
873
+ //#region ../../node_modules/.pnpm/stubborn-fs@2.0.0/node_modules/stubborn-fs/dist/handlers.js
828
874
  const Handlers = {
829
875
  isChangeErrorOk: (error) => {
830
876
  if (!Handlers.isNodeError(error)) return false;
@@ -851,149 +897,70 @@ const Handlers = {
851
897
  var handlers_default = Handlers;
852
898
 
853
899
  //#endregion
854
- //#region ../../node_modules/.pnpm/stubborn-fs@1.2.5/node_modules/stubborn-fs/dist/retryify_queue.js
855
- var RetryfyQueue = class {
856
- constructor() {
857
- this.interval = 25;
858
- this.intervalId = void 0;
859
- this.limit = LIMIT_FILES_DESCRIPTORS;
860
- this.queueActive = /* @__PURE__ */ new Set();
861
- this.queueWaiting = /* @__PURE__ */ new Set();
862
- this.init = () => {
863
- if (this.intervalId) return;
864
- this.intervalId = setInterval(this.tick, this.interval);
865
- };
866
- this.reset = () => {
867
- if (!this.intervalId) return;
868
- clearInterval(this.intervalId);
869
- delete this.intervalId;
870
- };
871
- this.add = (fn) => {
872
- this.queueWaiting.add(fn);
873
- if (this.queueActive.size < this.limit / 2) this.tick();
874
- else this.init();
875
- };
876
- this.remove = (fn) => {
877
- this.queueWaiting.delete(fn);
878
- this.queueActive.delete(fn);
879
- };
880
- this.schedule = () => {
881
- return new Promise((resolve) => {
882
- const cleanup = () => this.remove(resolver);
883
- const resolver = () => resolve(cleanup);
884
- this.add(resolver);
885
- });
886
- };
887
- this.tick = () => {
888
- if (this.queueActive.size >= this.limit) return;
889
- if (!this.queueWaiting.size) return this.reset();
890
- for (const fn of this.queueWaiting) {
891
- if (this.queueActive.size >= this.limit) break;
892
- this.queueWaiting.delete(fn);
893
- this.queueActive.add(fn);
894
- fn();
895
- }
896
- };
897
- }
898
- };
899
- var retryify_queue_default = new RetryfyQueue();
900
-
901
- //#endregion
902
- //#region ../../node_modules/.pnpm/stubborn-fs@1.2.5/node_modules/stubborn-fs/dist/retryify.js
903
- const retryifyAsync = (fn, isRetriableError) => {
904
- return function retrified(timestamp) {
905
- return function attempt(...args) {
906
- return retryify_queue_default.schedule().then((cleanup) => {
907
- const onResolve = (result) => {
908
- cleanup();
909
- return result;
910
- };
911
- const onReject = (error) => {
912
- cleanup();
913
- if (Date.now() >= timestamp) throw error;
914
- if (isRetriableError(error)) {
915
- const delay$1 = Math.round(100 * Math.random());
916
- return new Promise((resolve) => setTimeout(resolve, delay$1)).then(() => attempt.apply(void 0, args));
917
- }
918
- throw error;
919
- };
920
- return fn.apply(void 0, args).then(onResolve, onReject);
921
- });
922
- };
923
- };
924
- };
925
- const retryifySync = (fn, isRetriableError) => {
926
- return function retrified(timestamp) {
927
- return function attempt(...args) {
928
- try {
929
- return fn.apply(void 0, args);
930
- } catch (error) {
931
- if (Date.now() > timestamp) throw error;
932
- if (isRetriableError(error)) return attempt.apply(void 0, args);
933
- throw error;
934
- }
935
- };
936
- };
937
- };
900
+ //#region ../../node_modules/.pnpm/stubborn-fs@2.0.0/node_modules/stubborn-fs/dist/constants.js
901
+ const ATTEMPTIFY_CHANGE_ERROR_OPTIONS = { onError: handlers_default.onChangeError };
902
+ const ATTEMPTIFY_NOOP_OPTIONS = { onError: () => void 0 };
903
+ const IS_USER_ROOT$1 = process$1.getuid ? !process$1.getuid() : false;
904
+ const RETRYIFY_OPTIONS = { isRetriable: handlers_default.isRetriableError };
938
905
 
939
906
  //#endregion
940
- //#region ../../node_modules/.pnpm/stubborn-fs@1.2.5/node_modules/stubborn-fs/dist/index.js
907
+ //#region ../../node_modules/.pnpm/stubborn-fs@2.0.0/node_modules/stubborn-fs/dist/index.js
941
908
  const FS = {
942
909
  attempt: {
943
- chmod: attemptifyAsync(promisify(fs$1.chmod), handlers_default.onChangeError),
944
- chown: attemptifyAsync(promisify(fs$1.chown), handlers_default.onChangeError),
945
- close: attemptifyAsync(promisify(fs$1.close), NOOP),
946
- fsync: attemptifyAsync(promisify(fs$1.fsync), NOOP),
947
- mkdir: attemptifyAsync(promisify(fs$1.mkdir), NOOP),
948
- realpath: attemptifyAsync(promisify(fs$1.realpath), NOOP),
949
- stat: attemptifyAsync(promisify(fs$1.stat), NOOP),
950
- unlink: attemptifyAsync(promisify(fs$1.unlink), NOOP),
951
- chmodSync: attemptifySync(fs$1.chmodSync, handlers_default.onChangeError),
952
- chownSync: attemptifySync(fs$1.chownSync, handlers_default.onChangeError),
953
- closeSync: attemptifySync(fs$1.closeSync, NOOP),
954
- existsSync: attemptifySync(fs$1.existsSync, NOOP),
955
- fsyncSync: attemptifySync(fs$1.fsync, NOOP),
956
- mkdirSync: attemptifySync(fs$1.mkdirSync, NOOP),
957
- realpathSync: attemptifySync(fs$1.realpathSync, NOOP),
958
- statSync: attemptifySync(fs$1.statSync, NOOP),
959
- unlinkSync: attemptifySync(fs$1.unlinkSync, NOOP)
910
+ chmod: attemptify_async_default(promisify(fs$1.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
911
+ chown: attemptify_async_default(promisify(fs$1.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
912
+ close: attemptify_async_default(promisify(fs$1.close), ATTEMPTIFY_NOOP_OPTIONS),
913
+ fsync: attemptify_async_default(promisify(fs$1.fsync), ATTEMPTIFY_NOOP_OPTIONS),
914
+ mkdir: attemptify_async_default(promisify(fs$1.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
915
+ realpath: attemptify_async_default(promisify(fs$1.realpath), ATTEMPTIFY_NOOP_OPTIONS),
916
+ stat: attemptify_async_default(promisify(fs$1.stat), ATTEMPTIFY_NOOP_OPTIONS),
917
+ unlink: attemptify_async_default(promisify(fs$1.unlink), ATTEMPTIFY_NOOP_OPTIONS),
918
+ chmodSync: attemptify_sync_default(fs$1.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
919
+ chownSync: attemptify_sync_default(fs$1.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
920
+ closeSync: attemptify_sync_default(fs$1.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
921
+ existsSync: attemptify_sync_default(fs$1.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
922
+ fsyncSync: attemptify_sync_default(fs$1.fsync, ATTEMPTIFY_NOOP_OPTIONS),
923
+ mkdirSync: attemptify_sync_default(fs$1.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
924
+ realpathSync: attemptify_sync_default(fs$1.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
925
+ statSync: attemptify_sync_default(fs$1.statSync, ATTEMPTIFY_NOOP_OPTIONS),
926
+ unlinkSync: attemptify_sync_default(fs$1.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
960
927
  },
961
928
  retry: {
962
- close: retryifyAsync(promisify(fs$1.close), handlers_default.isRetriableError),
963
- fsync: retryifyAsync(promisify(fs$1.fsync), handlers_default.isRetriableError),
964
- open: retryifyAsync(promisify(fs$1.open), handlers_default.isRetriableError),
965
- readFile: retryifyAsync(promisify(fs$1.readFile), handlers_default.isRetriableError),
966
- rename: retryifyAsync(promisify(fs$1.rename), handlers_default.isRetriableError),
967
- stat: retryifyAsync(promisify(fs$1.stat), handlers_default.isRetriableError),
968
- write: retryifyAsync(promisify(fs$1.write), handlers_default.isRetriableError),
969
- writeFile: retryifyAsync(promisify(fs$1.writeFile), handlers_default.isRetriableError),
970
- closeSync: retryifySync(fs$1.closeSync, handlers_default.isRetriableError),
971
- fsyncSync: retryifySync(fs$1.fsyncSync, handlers_default.isRetriableError),
972
- openSync: retryifySync(fs$1.openSync, handlers_default.isRetriableError),
973
- readFileSync: retryifySync(fs$1.readFileSync, handlers_default.isRetriableError),
974
- renameSync: retryifySync(fs$1.renameSync, handlers_default.isRetriableError),
975
- statSync: retryifySync(fs$1.statSync, handlers_default.isRetriableError),
976
- writeSync: retryifySync(fs$1.writeSync, handlers_default.isRetriableError),
977
- writeFileSync: retryifySync(fs$1.writeFileSync, handlers_default.isRetriableError)
929
+ close: retryify_async_default(promisify(fs$1.close), RETRYIFY_OPTIONS),
930
+ fsync: retryify_async_default(promisify(fs$1.fsync), RETRYIFY_OPTIONS),
931
+ open: retryify_async_default(promisify(fs$1.open), RETRYIFY_OPTIONS),
932
+ readFile: retryify_async_default(promisify(fs$1.readFile), RETRYIFY_OPTIONS),
933
+ rename: retryify_async_default(promisify(fs$1.rename), RETRYIFY_OPTIONS),
934
+ stat: retryify_async_default(promisify(fs$1.stat), RETRYIFY_OPTIONS),
935
+ write: retryify_async_default(promisify(fs$1.write), RETRYIFY_OPTIONS),
936
+ writeFile: retryify_async_default(promisify(fs$1.writeFile), RETRYIFY_OPTIONS),
937
+ closeSync: retryify_sync_default(fs$1.closeSync, RETRYIFY_OPTIONS),
938
+ fsyncSync: retryify_sync_default(fs$1.fsyncSync, RETRYIFY_OPTIONS),
939
+ openSync: retryify_sync_default(fs$1.openSync, RETRYIFY_OPTIONS),
940
+ readFileSync: retryify_sync_default(fs$1.readFileSync, RETRYIFY_OPTIONS),
941
+ renameSync: retryify_sync_default(fs$1.renameSync, RETRYIFY_OPTIONS),
942
+ statSync: retryify_sync_default(fs$1.statSync, RETRYIFY_OPTIONS),
943
+ writeSync: retryify_sync_default(fs$1.writeSync, RETRYIFY_OPTIONS),
944
+ writeFileSync: retryify_sync_default(fs$1.writeFileSync, RETRYIFY_OPTIONS)
978
945
  }
979
946
  };
980
947
  var dist_default = FS;
981
948
 
982
949
  //#endregion
983
- //#region ../../node_modules/.pnpm/atomically@2.0.3/node_modules/atomically/dist/constants.js
950
+ //#region ../../node_modules/.pnpm/atomically@2.1.0/node_modules/atomically/dist/constants.js
984
951
  const DEFAULT_ENCODING = "utf8";
985
952
  const DEFAULT_FILE_MODE = 438;
986
953
  const DEFAULT_FOLDER_MODE = 511;
987
954
  const DEFAULT_WRITE_OPTIONS = {};
988
- const DEFAULT_USER_UID = os.userInfo().uid;
989
- const DEFAULT_USER_GID = os.userInfo().gid;
955
+ const DEFAULT_USER_UID = process$1.geteuid ? process$1.geteuid() : -1;
956
+ const DEFAULT_USER_GID = process$1.getegid ? process$1.getegid() : -1;
990
957
  const DEFAULT_TIMEOUT_SYNC = 1e3;
991
958
  const IS_POSIX = !!process$1.getuid;
992
959
  const IS_USER_ROOT = process$1.getuid ? !process$1.getuid() : false;
993
960
  const LIMIT_BASENAME_LENGTH = 128;
994
961
 
995
962
  //#endregion
996
- //#region ../../node_modules/.pnpm/atomically@2.0.3/node_modules/atomically/dist/utils/lang.js
963
+ //#region ../../node_modules/.pnpm/atomically@2.1.0/node_modules/atomically/dist/utils/lang.js
997
964
  const isException = (value) => {
998
965
  return value instanceof Error && "code" in value;
999
966
  };
@@ -1058,7 +1025,7 @@ const whenExit = interceptor_default.register;
1058
1025
  var node_default = whenExit;
1059
1026
 
1060
1027
  //#endregion
1061
- //#region ../../node_modules/.pnpm/atomically@2.0.3/node_modules/atomically/dist/utils/temp.js
1028
+ //#region ../../node_modules/.pnpm/atomically@2.1.0/node_modules/atomically/dist/utils/temp.js
1062
1029
  const Temp = {
1063
1030
  store: {},
1064
1031
  create: (filePath) => {
@@ -1098,10 +1065,10 @@ node_default(Temp.purgeSyncAll);
1098
1065
  var temp_default = Temp;
1099
1066
 
1100
1067
  //#endregion
1101
- //#region ../../node_modules/.pnpm/atomically@2.0.3/node_modules/atomically/dist/index.js
1068
+ //#region ../../node_modules/.pnpm/atomically@2.1.0/node_modules/atomically/dist/index.js
1102
1069
  function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
1103
1070
  if (isString$1(options)) return writeFileSync(filePath, data, { encoding: options });
1104
- const timeout$1 = Date.now() + ((options.timeout ?? DEFAULT_TIMEOUT_SYNC) || -1);
1071
+ const retryOptions = { timeout: options.timeout ?? DEFAULT_TIMEOUT_SYNC };
1105
1072
  let tempDisposer = null;
1106
1073
  let tempPath = null;
1107
1074
  let fd = null;
@@ -1130,22 +1097,22 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
1130
1097
  recursive: true
1131
1098
  });
1132
1099
  }
1133
- fd = dist_default.retry.openSync(timeout$1)(tempPath, "w", options.mode || DEFAULT_FILE_MODE);
1100
+ fd = dist_default.retry.openSync(retryOptions)(tempPath, "w", options.mode || DEFAULT_FILE_MODE);
1134
1101
  if (options.tmpCreated) options.tmpCreated(tempPath);
1135
- if (isString$1(data)) dist_default.retry.writeSync(timeout$1)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
1136
- else if (!isUndefined$1(data)) dist_default.retry.writeSync(timeout$1)(fd, data, 0, data.length, 0);
1137
- if (options.fsync !== false) if (options.fsyncWait !== false) dist_default.retry.fsyncSync(timeout$1)(fd);
1102
+ if (isString$1(data)) dist_default.retry.writeSync(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
1103
+ else if (!isUndefined$1(data)) dist_default.retry.writeSync(retryOptions)(fd, data, 0, data.length, 0);
1104
+ if (options.fsync !== false) if (options.fsyncWait !== false) dist_default.retry.fsyncSync(retryOptions)(fd);
1138
1105
  else dist_default.attempt.fsync(fd);
1139
- dist_default.retry.closeSync(timeout$1)(fd);
1106
+ dist_default.retry.closeSync(retryOptions)(fd);
1140
1107
  fd = null;
1141
1108
  if (options.chown && (options.chown.uid !== DEFAULT_USER_UID || options.chown.gid !== DEFAULT_USER_GID)) dist_default.attempt.chownSync(tempPath, options.chown.uid, options.chown.gid);
1142
1109
  if (options.mode && options.mode !== DEFAULT_FILE_MODE) dist_default.attempt.chmodSync(tempPath, options.mode);
1143
1110
  try {
1144
- dist_default.retry.renameSync(timeout$1)(tempPath, filePath);
1111
+ dist_default.retry.renameSync(retryOptions)(tempPath, filePath);
1145
1112
  } catch (error) {
1146
1113
  if (!isException(error)) throw error;
1147
1114
  if (error.code !== "ENAMETOOLONG") throw error;
1148
- dist_default.retry.renameSync(timeout$1)(tempPath, temp_default.truncate(filePath));
1115
+ dist_default.retry.renameSync(retryOptions)(tempPath, temp_default.truncate(filePath));
1149
1116
  }
1150
1117
  tempDisposer();
1151
1118
  tempPath = null;
@@ -1797,7 +1764,7 @@ const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1797
1764
  var source_default = chalk;
1798
1765
 
1799
1766
  //#endregion
1800
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/errors/HTTPError.js
1767
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/errors/HTTPError.js
1801
1768
  var HTTPError = class extends Error {
1802
1769
  response;
1803
1770
  request;
@@ -1814,7 +1781,28 @@ var HTTPError = class extends Error {
1814
1781
  };
1815
1782
 
1816
1783
  //#endregion
1817
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/core/constants.js
1784
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/errors/NonError.js
1785
+ /**
1786
+ Wrapper for non-Error values that were thrown.
1787
+
1788
+ In JavaScript, any value can be thrown (not just Error instances). This class wraps such values to ensure consistent error handling.
1789
+ */
1790
+ var NonError = class extends Error {
1791
+ name = "NonError";
1792
+ value;
1793
+ constructor(value) {
1794
+ let message = "Non-error value was thrown";
1795
+ try {
1796
+ if (typeof value === "string") message = value;
1797
+ else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") message = value.message;
1798
+ } catch {}
1799
+ super(message);
1800
+ this.value = value;
1801
+ }
1802
+ };
1803
+
1804
+ //#endregion
1805
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/core/constants.js
1818
1806
  const supportsRequestStreams = (() => {
1819
1807
  let duplexAccessed = false;
1820
1808
  let hasContentType = false;
@@ -1872,8 +1860,10 @@ const kyOptionKeys = {
1872
1860
  throwHttpErrors: true,
1873
1861
  onDownloadProgress: true,
1874
1862
  onUploadProgress: true,
1875
- fetch: true
1863
+ fetch: true,
1864
+ context: true
1876
1865
  };
1866
+ const vendorSpecificOptions = { next: true };
1877
1867
  const requestOptionsRegistry = {
1878
1868
  method: true,
1879
1869
  headers: true,
@@ -1892,7 +1882,7 @@ const requestOptionsRegistry = {
1892
1882
  };
1893
1883
 
1894
1884
  //#endregion
1895
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/body.js
1885
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/body.js
1896
1886
  const getBodySize = (body) => {
1897
1887
  if (!body) return 0;
1898
1888
  if (body instanceof FormData) {
@@ -1954,7 +1944,7 @@ const streamResponse = (response, onDownloadProgress) => {
1954
1944
  statusText: response.statusText,
1955
1945
  headers: response.headers
1956
1946
  });
1957
- const totalBytes = Number(response.headers.get("content-length")) || 0;
1947
+ const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
1958
1948
  return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
1959
1949
  status: response.status,
1960
1950
  statusText: response.statusText,
@@ -1971,11 +1961,11 @@ const streamRequest = (request, onUploadProgress, originalBody) => {
1971
1961
  };
1972
1962
 
1973
1963
  //#endregion
1974
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/is.js
1964
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/is.js
1975
1965
  const isObject$1 = (value) => value !== null && typeof value === "object";
1976
1966
 
1977
1967
  //#endregion
1978
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/merge.js
1968
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/merge.js
1979
1969
  const validateAndMerge = (...sources) => {
1980
1970
  for (const source of sources) if ((!isObject$1(source) || Array.isArray(source)) && source !== void 0) throw new TypeError("The `options` argument must be an object");
1981
1971
  return deepMerge({}, ...sources);
@@ -2030,6 +2020,17 @@ const deepMerge = (...sources) => {
2030
2020
  signals.push(value);
2031
2021
  continue;
2032
2022
  }
2023
+ if (key === "context") {
2024
+ if (value !== void 0 && value !== null && (!isObject$1(value) || Array.isArray(value))) throw new TypeError("The `context` option must be an object");
2025
+ returnValue = {
2026
+ ...returnValue,
2027
+ context: value === void 0 || value === null ? {} : {
2028
+ ...returnValue.context,
2029
+ ...value
2030
+ }
2031
+ };
2032
+ continue;
2033
+ }
2033
2034
  if (key === "searchParams") {
2034
2035
  if (value === void 0 || value === null) searchParameters = void 0;
2035
2036
  else searchParameters = searchParameters === void 0 ? value : appendSearchParameters(searchParameters, value);
@@ -2054,11 +2055,12 @@ const deepMerge = (...sources) => {
2054
2055
  if (signals.length > 0) if (signals.length === 1) returnValue.signal = signals[0];
2055
2056
  else if (supportsAbortSignal) returnValue.signal = AbortSignal.any(signals);
2056
2057
  else returnValue.signal = signals.at(-1);
2058
+ if (returnValue.context === void 0) returnValue.context = {};
2057
2059
  return returnValue;
2058
2060
  };
2059
2061
 
2060
2062
  //#endregion
2061
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/normalize.js
2063
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/normalize.js
2062
2064
  const normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
2063
2065
  const defaultRetryOptions = {
2064
2066
  limit: 2,
@@ -2086,7 +2088,9 @@ const defaultRetryOptions = {
2086
2088
  ],
2087
2089
  maxRetryAfter: Number.POSITIVE_INFINITY,
2088
2090
  backoffLimit: Number.POSITIVE_INFINITY,
2089
- delay: (attemptCount) => .3 * 2 ** (attemptCount - 1) * 1e3
2091
+ delay: (attemptCount) => .3 * 2 ** (attemptCount - 1) * 1e3,
2092
+ jitter: void 0,
2093
+ retryOnTimeout: false
2090
2094
  };
2091
2095
  const normalizeRetryOptions = (retry$2 = {}) => {
2092
2096
  if (typeof retry$2 === "number") return {
@@ -2102,7 +2106,7 @@ const normalizeRetryOptions = (retry$2 = {}) => {
2102
2106
  };
2103
2107
 
2104
2108
  //#endregion
2105
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/errors/TimeoutError.js
2109
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/errors/TimeoutError.js
2106
2110
  var TimeoutError = class extends Error {
2107
2111
  request;
2108
2112
  constructor(request) {
@@ -2113,7 +2117,7 @@ var TimeoutError = class extends Error {
2113
2117
  };
2114
2118
 
2115
2119
  //#endregion
2116
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/timeout.js
2120
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/timeout.js
2117
2121
  async function timeout(request, init$1, abortController, options) {
2118
2122
  return new Promise((resolve, reject) => {
2119
2123
  const timeoutId = setTimeout(() => {
@@ -2127,7 +2131,7 @@ async function timeout(request, init$1, abortController, options) {
2127
2131
  }
2128
2132
 
2129
2133
  //#endregion
2130
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/delay.js
2134
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/delay.js
2131
2135
  async function delay(ms, { signal }) {
2132
2136
  return new Promise((resolve, reject) => {
2133
2137
  if (signal) {
@@ -2146,10 +2150,13 @@ async function delay(ms, { signal }) {
2146
2150
  }
2147
2151
 
2148
2152
  //#endregion
2149
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/options.js
2153
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/options.js
2150
2154
  const findUnknownOptions = (request, options) => {
2151
2155
  const unknownOptions = {};
2152
- for (const key in options) if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) unknownOptions[key] = options[key];
2156
+ for (const key in options) {
2157
+ if (!Object.hasOwn(options, key)) continue;
2158
+ if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || key in vendorSpecificOptions)) unknownOptions[key] = options[key];
2159
+ }
2153
2160
  return unknownOptions;
2154
2161
  };
2155
2162
  const hasSearchParameters = (search) => {
@@ -2162,78 +2169,78 @@ const hasSearchParameters = (search) => {
2162
2169
  };
2163
2170
 
2164
2171
  //#endregion
2165
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/utils/type-guards.js
2172
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/type-guards.js
2166
2173
  /**
2167
- * Type guard to check if an error is an HTTPError.
2168
- *
2169
- * @param error - The error to check
2170
- * @returns `true` if the error is an HTTPError, `false` otherwise
2171
- *
2172
- * @example
2173
- * ```
2174
- * import ky, {isHTTPError} from 'ky';
2175
- * try {
2176
- * const response = await ky.get('/api/data');
2177
- * } catch (error) {
2178
- * if (isHTTPError(error)) {
2179
- * console.log('HTTP error status:', error.response.status);
2180
- * }
2181
- * }
2182
- * ```
2174
+ Type guard to check if an error is an HTTPError.
2175
+
2176
+ @param error - The error to check
2177
+ @returns `true` if the error is an HTTPError, `false` otherwise
2178
+
2179
+ @example
2180
+ ```
2181
+ import ky, {isHTTPError} from 'ky';
2182
+ try {
2183
+ const response = await ky.get('/api/data');
2184
+ } catch (error) {
2185
+ if (isHTTPError(error)) {
2186
+ console.log('HTTP error status:', error.response.status);
2187
+ }
2188
+ }
2189
+ ```
2183
2190
  */
2184
2191
  function isHTTPError(error) {
2185
2192
  return error instanceof HTTPError || error?.name === HTTPError.name;
2186
2193
  }
2187
2194
  /**
2188
- * Type guard to check if an error is a TimeoutError.
2189
- *
2190
- * @param error - The error to check
2191
- * @returns `true` if the error is a TimeoutError, `false` otherwise
2192
- *
2193
- * @example
2194
- * ```
2195
- * import ky, {isTimeoutError} from 'ky';
2196
- * try {
2197
- * const response = await ky.get('/api/data', { timeout: 1000 });
2198
- * } catch (error) {
2199
- * if (isTimeoutError(error)) {
2200
- * console.log('Request timed out:', error.request.url);
2201
- * }
2202
- * }
2203
- * ```
2195
+ Type guard to check if an error is a TimeoutError.
2196
+
2197
+ @param error - The error to check
2198
+ @returns `true` if the error is a TimeoutError, `false` otherwise
2199
+
2200
+ @example
2201
+ ```
2202
+ import ky, {isTimeoutError} from 'ky';
2203
+ try {
2204
+ const response = await ky.get('/api/data', { timeout: 1000 });
2205
+ } catch (error) {
2206
+ if (isTimeoutError(error)) {
2207
+ console.log('Request timed out:', error.request.url);
2208
+ }
2209
+ }
2210
+ ```
2204
2211
  */
2205
2212
  function isTimeoutError(error) {
2206
2213
  return error instanceof TimeoutError || error?.name === TimeoutError.name;
2207
2214
  }
2208
2215
 
2209
2216
  //#endregion
2210
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/core/Ky.js
2217
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/core/Ky.js
2211
2218
  var Ky = class Ky {
2212
2219
  static create(input, options) {
2213
2220
  const ky$1 = new Ky(input, options);
2214
2221
  const function_ = async () => {
2215
- if (typeof ky$1._options.timeout === "number" && ky$1._options.timeout > maxSafeTimeout) throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
2222
+ if (typeof ky$1.#options.timeout === "number" && ky$1.#options.timeout > maxSafeTimeout) throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
2216
2223
  await Promise.resolve();
2217
- let response = await ky$1._fetch();
2218
- for (const hook of ky$1._options.hooks.afterResponse) {
2219
- const modifiedResponse = await hook(ky$1.request, ky$1.#getNormalizedOptions(), ky$1._decorateResponse(response.clone()), { retryCount: ky$1._retryCount });
2224
+ let response = await ky$1.#fetch();
2225
+ for (const hook of ky$1.#options.hooks.afterResponse) {
2226
+ const modifiedResponse = await hook(ky$1.request, ky$1.#getNormalizedOptions(), ky$1.#decorateResponse(response.clone()), { retryCount: ky$1.#retryCount });
2220
2227
  if (modifiedResponse instanceof globalThis.Response) response = modifiedResponse;
2221
2228
  }
2222
- ky$1._decorateResponse(response);
2223
- if (!response.ok && ky$1._options.throwHttpErrors) {
2229
+ ky$1.#decorateResponse(response);
2230
+ if (!response.ok && ky$1.#options.throwHttpErrors) {
2224
2231
  let error = new HTTPError(response, ky$1.request, ky$1.#getNormalizedOptions());
2225
- for (const hook of ky$1._options.hooks.beforeError) error = await hook(error, { retryCount: ky$1._retryCount });
2232
+ for (const hook of ky$1.#options.hooks.beforeError) error = await hook(error, { retryCount: ky$1.#retryCount });
2226
2233
  throw error;
2227
2234
  }
2228
- if (ky$1._options.onDownloadProgress) {
2229
- if (typeof ky$1._options.onDownloadProgress !== "function") throw new TypeError("The `onDownloadProgress` option must be a function");
2235
+ if (ky$1.#options.onDownloadProgress) {
2236
+ if (typeof ky$1.#options.onDownloadProgress !== "function") throw new TypeError("The `onDownloadProgress` option must be a function");
2230
2237
  if (!supportsResponseStreams) throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
2231
- return streamResponse(response.clone(), ky$1._options.onDownloadProgress);
2238
+ return streamResponse(response.clone(), ky$1.#options.onDownloadProgress);
2232
2239
  }
2233
2240
  return response;
2234
2241
  };
2235
- const result = (ky$1._options.retry.methods.includes(ky$1.request.method.toLowerCase()) ? ky$1._retry(function_) : function_()).finally(async () => {
2236
- const originalRequest = ky$1._originalRequest;
2242
+ const result = (ky$1.#options.retry.methods.includes(ky$1.request.method.toLowerCase()) ? ky$1.#retry(function_) : function_()).finally(async () => {
2243
+ const originalRequest = ky$1.#originalRequest;
2237
2244
  const cleanupPromises = [];
2238
2245
  if (originalRequest && !originalRequest.bodyUsed) cleanupPromises.push(originalRequest.body?.cancel());
2239
2246
  if (!ky$1.request.bodyUsed) cleanupPromises.push(ky$1.request.body?.cancel());
@@ -2261,116 +2268,150 @@ var Ky = class Ky {
2261
2268
  return searchParams;
2262
2269
  }
2263
2270
  request;
2264
- abortController;
2265
- _retryCount = 0;
2266
- _input;
2267
- _options;
2268
- _originalRequest;
2271
+ #abortController;
2272
+ #retryCount = 0;
2273
+ #input;
2274
+ #options;
2275
+ #originalRequest;
2276
+ #userProvidedAbortSignal;
2269
2277
  #cachedNormalizedOptions;
2270
2278
  constructor(input, options = {}) {
2271
- this._input = input;
2272
- this._options = {
2279
+ this.#input = input;
2280
+ this.#options = {
2273
2281
  ...options,
2274
- headers: mergeHeaders(this._input.headers, options.headers),
2282
+ headers: mergeHeaders(this.#input.headers, options.headers),
2275
2283
  hooks: mergeHooks({
2276
2284
  beforeRequest: [],
2277
2285
  beforeRetry: [],
2278
2286
  beforeError: [],
2279
2287
  afterResponse: []
2280
2288
  }, options.hooks),
2281
- method: normalizeRequestMethod(options.method ?? this._input.method ?? "GET"),
2289
+ method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
2282
2290
  prefixUrl: String(options.prefixUrl || ""),
2283
2291
  retry: normalizeRetryOptions(options.retry),
2284
2292
  throwHttpErrors: options.throwHttpErrors !== false,
2285
2293
  timeout: options.timeout ?? 1e4,
2286
- fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
2294
+ fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
2295
+ context: options.context ?? {}
2287
2296
  };
2288
- if (typeof this._input !== "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request)) throw new TypeError("`input` must be a string, URL, or Request");
2289
- if (this._options.prefixUrl && typeof this._input === "string") {
2290
- if (this._input.startsWith("/")) throw new Error("`input` must not begin with a slash when using `prefixUrl`");
2291
- if (!this._options.prefixUrl.endsWith("/")) this._options.prefixUrl += "/";
2292
- this._input = this._options.prefixUrl + this._input;
2297
+ if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) throw new TypeError("`input` must be a string, URL, or Request");
2298
+ if (this.#options.prefixUrl && typeof this.#input === "string") {
2299
+ if (this.#input.startsWith("/")) throw new Error("`input` must not begin with a slash when using `prefixUrl`");
2300
+ if (!this.#options.prefixUrl.endsWith("/")) this.#options.prefixUrl += "/";
2301
+ this.#input = this.#options.prefixUrl + this.#input;
2293
2302
  }
2294
2303
  if (supportsAbortController && supportsAbortSignal) {
2295
- const originalSignal = this._options.signal ?? this._input.signal;
2296
- this.abortController = new globalThis.AbortController();
2297
- this._options.signal = originalSignal ? AbortSignal.any([originalSignal, this.abortController.signal]) : this.abortController.signal;
2304
+ this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
2305
+ this.#abortController = new globalThis.AbortController();
2306
+ this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
2298
2307
  }
2299
- if (supportsRequestStreams) this._options.duplex = "half";
2300
- if (this._options.json !== void 0) {
2301
- this._options.body = this._options.stringifyJson?.(this._options.json) ?? JSON.stringify(this._options.json);
2302
- this._options.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json");
2308
+ if (supportsRequestStreams) this.#options.duplex = "half";
2309
+ if (this.#options.json !== void 0) {
2310
+ this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
2311
+ this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
2303
2312
  }
2304
2313
  const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
2305
- if (this._input instanceof globalThis.Request && (supportsFormData && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !userProvidedContentType) this._options.headers.delete("content-type");
2306
- this.request = new globalThis.Request(this._input, this._options);
2307
- if (hasSearchParameters(this._options.searchParams)) {
2308
- const searchParams = "?" + (typeof this._options.searchParams === "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this._options.searchParams)).toString());
2314
+ if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) this.#options.headers.delete("content-type");
2315
+ this.request = new globalThis.Request(this.#input, this.#options);
2316
+ if (hasSearchParameters(this.#options.searchParams)) {
2317
+ const searchParams = "?" + (typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString());
2309
2318
  const url$2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
2310
- this.request = new globalThis.Request(new globalThis.Request(url$2, { ...this.request }), this._options);
2319
+ this.request = new globalThis.Request(new globalThis.Request(url$2, { ...this.request }), this.#options);
2311
2320
  }
2312
- if (this._options.onUploadProgress) {
2313
- if (typeof this._options.onUploadProgress !== "function") throw new TypeError("The `onUploadProgress` option must be a function");
2321
+ if (this.#options.onUploadProgress) {
2322
+ if (typeof this.#options.onUploadProgress !== "function") throw new TypeError("The `onUploadProgress` option must be a function");
2314
2323
  if (!supportsRequestStreams) throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
2315
- if (this.request.body) this.request = streamRequest(this.request, this._options.onUploadProgress, this._options.body);
2324
+ if (this.request.body) this.request = streamRequest(this.request, this.#options.onUploadProgress, this.#options.body);
2325
+ }
2326
+ }
2327
+ #calculateDelay() {
2328
+ const retryDelay = this.#options.retry.delay(this.#retryCount);
2329
+ let jitteredDelay = retryDelay;
2330
+ if (this.#options.retry.jitter === true) jitteredDelay = Math.random() * retryDelay;
2331
+ else if (typeof this.#options.retry.jitter === "function") {
2332
+ jitteredDelay = this.#options.retry.jitter(retryDelay);
2333
+ if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) jitteredDelay = retryDelay;
2334
+ }
2335
+ return Math.min(this.#options.retry.backoffLimit, jitteredDelay);
2336
+ }
2337
+ async #calculateRetryDelay(error) {
2338
+ this.#retryCount++;
2339
+ if (this.#retryCount > this.#options.retry.limit) throw error;
2340
+ const errorObject = error instanceof Error ? error : new NonError(error);
2341
+ if (this.#options.retry.shouldRetry !== void 0) {
2342
+ const result = await this.#options.retry.shouldRetry({
2343
+ error: errorObject,
2344
+ retryCount: this.#retryCount
2345
+ });
2346
+ if (result === false) throw error;
2347
+ if (result === true) return this.#calculateDelay();
2316
2348
  }
2317
- }
2318
- _calculateRetryDelay(error) {
2319
- this._retryCount++;
2320
- if (this._retryCount > this._options.retry.limit || isTimeoutError(error)) throw error;
2349
+ if (isTimeoutError(error) && !this.#options.retry.retryOnTimeout) throw error;
2321
2350
  if (isHTTPError(error)) {
2322
- if (!this._options.retry.statusCodes.includes(error.response.status)) throw error;
2323
- const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
2324
- if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
2351
+ if (!this.#options.retry.statusCodes.includes(error.response.status)) throw error;
2352
+ const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Retry-After") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
2353
+ if (retryAfter && this.#options.retry.afterStatusCodes.includes(error.response.status)) {
2325
2354
  let after = Number(retryAfter) * 1e3;
2326
2355
  if (Number.isNaN(after)) after = Date.parse(retryAfter) - Date.now();
2327
2356
  else if (after >= Date.parse("2024-01-01")) after -= Date.now();
2328
- const max = this._options.retry.maxRetryAfter ?? after;
2357
+ const max = this.#options.retry.maxRetryAfter ?? after;
2329
2358
  return after < max ? after : max;
2330
2359
  }
2331
2360
  if (error.response.status === 413) throw error;
2332
2361
  }
2333
- const retryDelay = this._options.retry.delay(this._retryCount);
2334
- return Math.min(this._options.retry.backoffLimit, retryDelay);
2362
+ return this.#calculateDelay();
2335
2363
  }
2336
- _decorateResponse(response) {
2337
- if (this._options.parseJson) response.json = async () => this._options.parseJson(await response.text());
2364
+ #decorateResponse(response) {
2365
+ if (this.#options.parseJson) response.json = async () => this.#options.parseJson(await response.text());
2338
2366
  return response;
2339
2367
  }
2340
- async _retry(function_) {
2368
+ async #retry(function_) {
2341
2369
  try {
2342
2370
  return await function_();
2343
2371
  } catch (error) {
2344
- const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);
2345
- if (this._retryCount < 1) throw error;
2346
- await delay(ms, { signal: this._options.signal });
2347
- for (const hook of this._options.hooks.beforeRetry) if (await hook({
2348
- request: this.request,
2349
- options: this.#getNormalizedOptions(),
2350
- error,
2351
- retryCount: this._retryCount
2352
- }) === stop) return;
2353
- return this._retry(function_);
2354
- }
2355
- }
2356
- async _fetch() {
2357
- for (const hook of this._options.hooks.beforeRequest) {
2358
- const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this._retryCount });
2372
+ const ms = Math.min(await this.#calculateRetryDelay(error), maxSafeTimeout);
2373
+ if (this.#retryCount < 1) throw error;
2374
+ await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
2375
+ for (const hook of this.#options.hooks.beforeRetry) {
2376
+ const hookResult = await hook({
2377
+ request: this.request,
2378
+ options: this.#getNormalizedOptions(),
2379
+ error,
2380
+ retryCount: this.#retryCount
2381
+ });
2382
+ if (hookResult instanceof globalThis.Request) {
2383
+ this.request = hookResult;
2384
+ break;
2385
+ }
2386
+ if (hookResult instanceof globalThis.Response) return hookResult;
2387
+ if (hookResult === stop) return;
2388
+ }
2389
+ return this.#retry(function_);
2390
+ }
2391
+ }
2392
+ async #fetch() {
2393
+ if (this.#abortController?.signal.aborted) {
2394
+ this.#abortController = new globalThis.AbortController();
2395
+ this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
2396
+ this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
2397
+ }
2398
+ for (const hook of this.#options.hooks.beforeRequest) {
2399
+ const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
2359
2400
  if (result instanceof Request) {
2360
2401
  this.request = result;
2361
2402
  break;
2362
2403
  }
2363
2404
  if (result instanceof Response) return result;
2364
2405
  }
2365
- const nonRequestOptions = findUnknownOptions(this.request, this._options);
2366
- this._originalRequest = this.request;
2367
- this.request = this._originalRequest.clone();
2368
- if (this._options.timeout === false) return this._options.fetch(this._originalRequest, nonRequestOptions);
2369
- return timeout(this._originalRequest, nonRequestOptions, this.abortController, this._options);
2406
+ const nonRequestOptions = findUnknownOptions(this.request, this.#options);
2407
+ this.#originalRequest = this.request;
2408
+ this.request = this.#originalRequest.clone();
2409
+ if (this.#options.timeout === false) return this.#options.fetch(this.#originalRequest, nonRequestOptions);
2410
+ return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
2370
2411
  }
2371
2412
  #getNormalizedOptions() {
2372
2413
  if (!this.#cachedNormalizedOptions) {
2373
- const { hooks,...normalizedOptions } = this._options;
2414
+ const { hooks,...normalizedOptions } = this.#options;
2374
2415
  this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
2375
2416
  }
2376
2417
  return this.#cachedNormalizedOptions;
@@ -2378,7 +2419,7 @@ var Ky = class Ky {
2378
2419
  };
2379
2420
 
2380
2421
  //#endregion
2381
- //#region ../../node_modules/.pnpm/ky@1.12.0/node_modules/ky/distribution/index.js
2422
+ //#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/index.js
2382
2423
  const createInstance = (defaults$1) => {
2383
2424
  const ky$1 = (input, options) => Ky.create(input, validateAndMerge(defaults$1, options));
2384
2425
  for (const method of requestMethods) ky$1[method] = (input, options) => Ky.create(input, validateAndMerge(defaults$1, options, { method }));
@@ -3709,9 +3750,9 @@ var require_dist$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@pnp
3709
3750
  }) });
3710
3751
 
3711
3752
  //#endregion
3712
- //#region ../../node_modules/.pnpm/tsdown@0.15.9_typescript@5.9.3/node_modules/tsdown/esm-shims.js
3753
+ //#region ../../node_modules/.pnpm/tsdown@0.15.10_typescript@5.9.3/node_modules/tsdown/esm-shims.js
3713
3754
  var getFilename, getDirname, __dirname$2;
3714
- var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.9_typescript@5.9.3/node_modules/tsdown/esm-shims.js": (() => {
3755
+ var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.10_typescript@5.9.3/node_modules/tsdown/esm-shims.js": (() => {
3715
3756
  getFilename = () => fileURLToPath(import.meta.url);
3716
3757
  getDirname = () => path.dirname(getFilename());
3717
3758
  __dirname$2 = /* @__PURE__ */ getDirname();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yamada-ui/cli",
3
3
  "type": "module",
4
- "version": "2.0.4",
4
+ "version": "2.0.5-dev-20251027025837",
5
5
  "description": "The official CLI for Yamada UI projects",
6
6
  "keywords": [
7
7
  "theme",
@@ -57,7 +57,7 @@
57
57
  "sucrase": "^3.35.0",
58
58
  "validate-npm-package-name": "^6.0.2",
59
59
  "yamljs": "^0.3.0",
60
- "@yamada-ui/utils": "2.0.3"
60
+ "@yamada-ui/utils": "2.0.4-dev-20251027025837"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/prompts": "^2.4.9",