@yamada-ui/cli 2.0.5-next-20251101131248 → 2.0.6-dev-20251225223828
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/index.js +324 -280
- package/package.json +7 -5
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-
|
|
805
|
-
const attemptifyAsync = (fn,
|
|
804
|
+
//#region ../../node_modules/.pnpm/stubborn-utils@1.0.2/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
|
-
|
|
811
|
+
var attemptify_async_default = attemptifyAsync;
|
|
812
|
+
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region ../../node_modules/.pnpm/stubborn-utils@1.0.2/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-
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
828
|
+
//#region ../../node_modules/.pnpm/stubborn-utils@1.0.2/node_modules/stubborn-utils/dist/constants.js
|
|
829
|
+
const RETRY_INTERVAL = 250;
|
|
830
|
+
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region ../../node_modules/.pnpm/stubborn-utils@1.0.2/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.2/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;
|
|
825
871
|
|
|
826
872
|
//#endregion
|
|
827
|
-
//#region ../../node_modules/.pnpm/stubborn-fs@
|
|
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@
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
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@
|
|
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:
|
|
944
|
-
chown:
|
|
945
|
-
close:
|
|
946
|
-
fsync:
|
|
947
|
-
mkdir:
|
|
948
|
-
realpath:
|
|
949
|
-
stat:
|
|
950
|
-
unlink:
|
|
951
|
-
chmodSync:
|
|
952
|
-
chownSync:
|
|
953
|
-
closeSync:
|
|
954
|
-
existsSync:
|
|
955
|
-
fsyncSync:
|
|
956
|
-
mkdirSync:
|
|
957
|
-
realpathSync:
|
|
958
|
-
statSync:
|
|
959
|
-
unlinkSync:
|
|
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:
|
|
963
|
-
fsync:
|
|
964
|
-
open:
|
|
965
|
-
readFile:
|
|
966
|
-
rename:
|
|
967
|
-
stat:
|
|
968
|
-
write:
|
|
969
|
-
writeFile:
|
|
970
|
-
closeSync:
|
|
971
|
-
fsyncSync:
|
|
972
|
-
openSync:
|
|
973
|
-
readFileSync:
|
|
974
|
-
renameSync:
|
|
975
|
-
statSync:
|
|
976
|
-
writeSync:
|
|
977
|
-
writeFileSync:
|
|
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
|
|
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 =
|
|
989
|
-
const DEFAULT_USER_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
|
|
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
|
};
|
|
@@ -1005,25 +972,23 @@ const isUndefined$1 = (value) => {
|
|
|
1005
972
|
};
|
|
1006
973
|
|
|
1007
974
|
//#endregion
|
|
1008
|
-
//#region ../../node_modules/.pnpm/when-exit@2.1.
|
|
975
|
+
//#region ../../node_modules/.pnpm/when-exit@2.1.5/node_modules/when-exit/dist/node/constants.js
|
|
1009
976
|
const IS_LINUX = process$1.platform === "linux";
|
|
1010
977
|
const IS_WINDOWS = process$1.platform === "win32";
|
|
1011
978
|
|
|
1012
979
|
//#endregion
|
|
1013
|
-
//#region ../../node_modules/.pnpm/when-exit@2.1.
|
|
980
|
+
//#region ../../node_modules/.pnpm/when-exit@2.1.5/node_modules/when-exit/dist/node/signals.js
|
|
1014
981
|
const Signals = [
|
|
1015
|
-
"SIGABRT",
|
|
1016
|
-
"SIGALRM",
|
|
1017
982
|
"SIGHUP",
|
|
1018
983
|
"SIGINT",
|
|
1019
984
|
"SIGTERM"
|
|
1020
985
|
];
|
|
1021
|
-
if (!IS_WINDOWS) Signals.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1022
|
-
if (IS_LINUX) Signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT"
|
|
986
|
+
if (!IS_WINDOWS) Signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
987
|
+
if (IS_LINUX) Signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1023
988
|
var signals_default = Signals;
|
|
1024
989
|
|
|
1025
990
|
//#endregion
|
|
1026
|
-
//#region ../../node_modules/.pnpm/when-exit@2.1.
|
|
991
|
+
//#region ../../node_modules/.pnpm/when-exit@2.1.5/node_modules/when-exit/dist/node/interceptor.js
|
|
1027
992
|
var Interceptor = class {
|
|
1028
993
|
constructor() {
|
|
1029
994
|
this.callbacks = /* @__PURE__ */ new Set();
|
|
@@ -1053,12 +1018,12 @@ var Interceptor = class {
|
|
|
1053
1018
|
var interceptor_default = new Interceptor();
|
|
1054
1019
|
|
|
1055
1020
|
//#endregion
|
|
1056
|
-
//#region ../../node_modules/.pnpm/when-exit@2.1.
|
|
1021
|
+
//#region ../../node_modules/.pnpm/when-exit@2.1.5/node_modules/when-exit/dist/node/index.js
|
|
1057
1022
|
const whenExit = interceptor_default.register;
|
|
1058
1023
|
var node_default = whenExit;
|
|
1059
1024
|
|
|
1060
1025
|
//#endregion
|
|
1061
|
-
//#region ../../node_modules/.pnpm/atomically@2.0
|
|
1026
|
+
//#region ../../node_modules/.pnpm/atomically@2.1.0/node_modules/atomically/dist/utils/temp.js
|
|
1062
1027
|
const Temp = {
|
|
1063
1028
|
store: {},
|
|
1064
1029
|
create: (filePath) => {
|
|
@@ -1098,10 +1063,10 @@ node_default(Temp.purgeSyncAll);
|
|
|
1098
1063
|
var temp_default = Temp;
|
|
1099
1064
|
|
|
1100
1065
|
//#endregion
|
|
1101
|
-
//#region ../../node_modules/.pnpm/atomically@2.0
|
|
1066
|
+
//#region ../../node_modules/.pnpm/atomically@2.1.0/node_modules/atomically/dist/index.js
|
|
1102
1067
|
function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
1103
1068
|
if (isString$1(options)) return writeFileSync(filePath, data, { encoding: options });
|
|
1104
|
-
const
|
|
1069
|
+
const retryOptions = { timeout: options.timeout ?? DEFAULT_TIMEOUT_SYNC };
|
|
1105
1070
|
let tempDisposer = null;
|
|
1106
1071
|
let tempPath = null;
|
|
1107
1072
|
let fd = null;
|
|
@@ -1130,22 +1095,22 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
1130
1095
|
recursive: true
|
|
1131
1096
|
});
|
|
1132
1097
|
}
|
|
1133
|
-
fd = dist_default.retry.openSync(
|
|
1098
|
+
fd = dist_default.retry.openSync(retryOptions)(tempPath, "w", options.mode || DEFAULT_FILE_MODE);
|
|
1134
1099
|
if (options.tmpCreated) options.tmpCreated(tempPath);
|
|
1135
|
-
if (isString$1(data)) dist_default.retry.writeSync(
|
|
1136
|
-
else if (!isUndefined$1(data)) dist_default.retry.writeSync(
|
|
1137
|
-
if (options.fsync !== false) if (options.fsyncWait !== false) dist_default.retry.fsyncSync(
|
|
1100
|
+
if (isString$1(data)) dist_default.retry.writeSync(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
|
|
1101
|
+
else if (!isUndefined$1(data)) dist_default.retry.writeSync(retryOptions)(fd, data, 0, data.length, 0);
|
|
1102
|
+
if (options.fsync !== false) if (options.fsyncWait !== false) dist_default.retry.fsyncSync(retryOptions)(fd);
|
|
1138
1103
|
else dist_default.attempt.fsync(fd);
|
|
1139
|
-
dist_default.retry.closeSync(
|
|
1104
|
+
dist_default.retry.closeSync(retryOptions)(fd);
|
|
1140
1105
|
fd = null;
|
|
1141
1106
|
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
1107
|
if (options.mode && options.mode !== DEFAULT_FILE_MODE) dist_default.attempt.chmodSync(tempPath, options.mode);
|
|
1143
1108
|
try {
|
|
1144
|
-
dist_default.retry.renameSync(
|
|
1109
|
+
dist_default.retry.renameSync(retryOptions)(tempPath, filePath);
|
|
1145
1110
|
} catch (error) {
|
|
1146
1111
|
if (!isException(error)) throw error;
|
|
1147
1112
|
if (error.code !== "ENAMETOOLONG") throw error;
|
|
1148
|
-
dist_default.retry.renameSync(
|
|
1113
|
+
dist_default.retry.renameSync(retryOptions)(tempPath, temp_default.truncate(filePath));
|
|
1149
1114
|
}
|
|
1150
1115
|
tempDisposer();
|
|
1151
1116
|
tempPath = null;
|
|
@@ -1797,7 +1762,7 @@ const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
|
1797
1762
|
var source_default = chalk;
|
|
1798
1763
|
|
|
1799
1764
|
//#endregion
|
|
1800
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
1765
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/errors/HTTPError.js
|
|
1801
1766
|
var HTTPError = class extends Error {
|
|
1802
1767
|
response;
|
|
1803
1768
|
request;
|
|
@@ -1814,7 +1779,28 @@ var HTTPError = class extends Error {
|
|
|
1814
1779
|
};
|
|
1815
1780
|
|
|
1816
1781
|
//#endregion
|
|
1817
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
1782
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/errors/NonError.js
|
|
1783
|
+
/**
|
|
1784
|
+
Wrapper for non-Error values that were thrown.
|
|
1785
|
+
|
|
1786
|
+
In JavaScript, any value can be thrown (not just Error instances). This class wraps such values to ensure consistent error handling.
|
|
1787
|
+
*/
|
|
1788
|
+
var NonError = class extends Error {
|
|
1789
|
+
name = "NonError";
|
|
1790
|
+
value;
|
|
1791
|
+
constructor(value) {
|
|
1792
|
+
let message = "Non-error value was thrown";
|
|
1793
|
+
try {
|
|
1794
|
+
if (typeof value === "string") message = value;
|
|
1795
|
+
else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") message = value.message;
|
|
1796
|
+
} catch {}
|
|
1797
|
+
super(message);
|
|
1798
|
+
this.value = value;
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1802
|
+
//#endregion
|
|
1803
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/core/constants.js
|
|
1818
1804
|
const supportsRequestStreams = (() => {
|
|
1819
1805
|
let duplexAccessed = false;
|
|
1820
1806
|
let hasContentType = false;
|
|
@@ -1872,8 +1858,10 @@ const kyOptionKeys = {
|
|
|
1872
1858
|
throwHttpErrors: true,
|
|
1873
1859
|
onDownloadProgress: true,
|
|
1874
1860
|
onUploadProgress: true,
|
|
1875
|
-
fetch: true
|
|
1861
|
+
fetch: true,
|
|
1862
|
+
context: true
|
|
1876
1863
|
};
|
|
1864
|
+
const vendorSpecificOptions = { next: true };
|
|
1877
1865
|
const requestOptionsRegistry = {
|
|
1878
1866
|
method: true,
|
|
1879
1867
|
headers: true,
|
|
@@ -1892,7 +1880,7 @@ const requestOptionsRegistry = {
|
|
|
1892
1880
|
};
|
|
1893
1881
|
|
|
1894
1882
|
//#endregion
|
|
1895
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
1883
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/body.js
|
|
1896
1884
|
const getBodySize = (body) => {
|
|
1897
1885
|
if (!body) return 0;
|
|
1898
1886
|
if (body instanceof FormData) {
|
|
@@ -1954,7 +1942,7 @@ const streamResponse = (response, onDownloadProgress) => {
|
|
|
1954
1942
|
statusText: response.statusText,
|
|
1955
1943
|
headers: response.headers
|
|
1956
1944
|
});
|
|
1957
|
-
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
1945
|
+
const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
|
|
1958
1946
|
return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
|
|
1959
1947
|
status: response.status,
|
|
1960
1948
|
statusText: response.statusText,
|
|
@@ -1971,11 +1959,11 @@ const streamRequest = (request, onUploadProgress, originalBody) => {
|
|
|
1971
1959
|
};
|
|
1972
1960
|
|
|
1973
1961
|
//#endregion
|
|
1974
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
1962
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/is.js
|
|
1975
1963
|
const isObject$1 = (value) => value !== null && typeof value === "object";
|
|
1976
1964
|
|
|
1977
1965
|
//#endregion
|
|
1978
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
1966
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/merge.js
|
|
1979
1967
|
const validateAndMerge = (...sources) => {
|
|
1980
1968
|
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
1969
|
return deepMerge({}, ...sources);
|
|
@@ -2030,6 +2018,17 @@ const deepMerge = (...sources) => {
|
|
|
2030
2018
|
signals.push(value);
|
|
2031
2019
|
continue;
|
|
2032
2020
|
}
|
|
2021
|
+
if (key === "context") {
|
|
2022
|
+
if (value !== void 0 && value !== null && (!isObject$1(value) || Array.isArray(value))) throw new TypeError("The `context` option must be an object");
|
|
2023
|
+
returnValue = {
|
|
2024
|
+
...returnValue,
|
|
2025
|
+
context: value === void 0 || value === null ? {} : {
|
|
2026
|
+
...returnValue.context,
|
|
2027
|
+
...value
|
|
2028
|
+
}
|
|
2029
|
+
};
|
|
2030
|
+
continue;
|
|
2031
|
+
}
|
|
2033
2032
|
if (key === "searchParams") {
|
|
2034
2033
|
if (value === void 0 || value === null) searchParameters = void 0;
|
|
2035
2034
|
else searchParameters = searchParameters === void 0 ? value : appendSearchParameters(searchParameters, value);
|
|
@@ -2054,11 +2053,12 @@ const deepMerge = (...sources) => {
|
|
|
2054
2053
|
if (signals.length > 0) if (signals.length === 1) returnValue.signal = signals[0];
|
|
2055
2054
|
else if (supportsAbortSignal) returnValue.signal = AbortSignal.any(signals);
|
|
2056
2055
|
else returnValue.signal = signals.at(-1);
|
|
2056
|
+
if (returnValue.context === void 0) returnValue.context = {};
|
|
2057
2057
|
return returnValue;
|
|
2058
2058
|
};
|
|
2059
2059
|
|
|
2060
2060
|
//#endregion
|
|
2061
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2061
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/normalize.js
|
|
2062
2062
|
const normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
2063
2063
|
const defaultRetryOptions = {
|
|
2064
2064
|
limit: 2,
|
|
@@ -2086,7 +2086,9 @@ const defaultRetryOptions = {
|
|
|
2086
2086
|
],
|
|
2087
2087
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
2088
2088
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
2089
|
-
delay: (attemptCount) => .3 * 2 ** (attemptCount - 1) * 1e3
|
|
2089
|
+
delay: (attemptCount) => .3 * 2 ** (attemptCount - 1) * 1e3,
|
|
2090
|
+
jitter: void 0,
|
|
2091
|
+
retryOnTimeout: false
|
|
2090
2092
|
};
|
|
2091
2093
|
const normalizeRetryOptions = (retry$2 = {}) => {
|
|
2092
2094
|
if (typeof retry$2 === "number") return {
|
|
@@ -2102,7 +2104,7 @@ const normalizeRetryOptions = (retry$2 = {}) => {
|
|
|
2102
2104
|
};
|
|
2103
2105
|
|
|
2104
2106
|
//#endregion
|
|
2105
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2107
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/errors/TimeoutError.js
|
|
2106
2108
|
var TimeoutError = class extends Error {
|
|
2107
2109
|
request;
|
|
2108
2110
|
constructor(request) {
|
|
@@ -2113,7 +2115,7 @@ var TimeoutError = class extends Error {
|
|
|
2113
2115
|
};
|
|
2114
2116
|
|
|
2115
2117
|
//#endregion
|
|
2116
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2118
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/timeout.js
|
|
2117
2119
|
async function timeout(request, init$1, abortController, options) {
|
|
2118
2120
|
return new Promise((resolve, reject) => {
|
|
2119
2121
|
const timeoutId = setTimeout(() => {
|
|
@@ -2127,7 +2129,7 @@ async function timeout(request, init$1, abortController, options) {
|
|
|
2127
2129
|
}
|
|
2128
2130
|
|
|
2129
2131
|
//#endregion
|
|
2130
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2132
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/delay.js
|
|
2131
2133
|
async function delay(ms, { signal }) {
|
|
2132
2134
|
return new Promise((resolve, reject) => {
|
|
2133
2135
|
if (signal) {
|
|
@@ -2146,10 +2148,13 @@ async function delay(ms, { signal }) {
|
|
|
2146
2148
|
}
|
|
2147
2149
|
|
|
2148
2150
|
//#endregion
|
|
2149
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2151
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/options.js
|
|
2150
2152
|
const findUnknownOptions = (request, options) => {
|
|
2151
2153
|
const unknownOptions = {};
|
|
2152
|
-
for (const key in options)
|
|
2154
|
+
for (const key in options) {
|
|
2155
|
+
if (!Object.hasOwn(options, key)) continue;
|
|
2156
|
+
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || key in vendorSpecificOptions)) unknownOptions[key] = options[key];
|
|
2157
|
+
}
|
|
2153
2158
|
return unknownOptions;
|
|
2154
2159
|
};
|
|
2155
2160
|
const hasSearchParameters = (search) => {
|
|
@@ -2162,78 +2167,78 @@ const hasSearchParameters = (search) => {
|
|
|
2162
2167
|
};
|
|
2163
2168
|
|
|
2164
2169
|
//#endregion
|
|
2165
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2170
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/utils/type-guards.js
|
|
2166
2171
|
/**
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2172
|
+
Type guard to check if an error is an HTTPError.
|
|
2173
|
+
|
|
2174
|
+
@param error - The error to check
|
|
2175
|
+
@returns `true` if the error is an HTTPError, `false` otherwise
|
|
2176
|
+
|
|
2177
|
+
@example
|
|
2178
|
+
```
|
|
2179
|
+
import ky, {isHTTPError} from 'ky';
|
|
2180
|
+
try {
|
|
2181
|
+
const response = await ky.get('/api/data');
|
|
2182
|
+
} catch (error) {
|
|
2183
|
+
if (isHTTPError(error)) {
|
|
2184
|
+
console.log('HTTP error status:', error.response.status);
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
```
|
|
2183
2188
|
*/
|
|
2184
2189
|
function isHTTPError(error) {
|
|
2185
2190
|
return error instanceof HTTPError || error?.name === HTTPError.name;
|
|
2186
2191
|
}
|
|
2187
2192
|
/**
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2193
|
+
Type guard to check if an error is a TimeoutError.
|
|
2194
|
+
|
|
2195
|
+
@param error - The error to check
|
|
2196
|
+
@returns `true` if the error is a TimeoutError, `false` otherwise
|
|
2197
|
+
|
|
2198
|
+
@example
|
|
2199
|
+
```
|
|
2200
|
+
import ky, {isTimeoutError} from 'ky';
|
|
2201
|
+
try {
|
|
2202
|
+
const response = await ky.get('/api/data', { timeout: 1000 });
|
|
2203
|
+
} catch (error) {
|
|
2204
|
+
if (isTimeoutError(error)) {
|
|
2205
|
+
console.log('Request timed out:', error.request.url);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
```
|
|
2204
2209
|
*/
|
|
2205
2210
|
function isTimeoutError(error) {
|
|
2206
2211
|
return error instanceof TimeoutError || error?.name === TimeoutError.name;
|
|
2207
2212
|
}
|
|
2208
2213
|
|
|
2209
2214
|
//#endregion
|
|
2210
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2215
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/core/Ky.js
|
|
2211
2216
|
var Ky = class Ky {
|
|
2212
2217
|
static create(input, options) {
|
|
2213
2218
|
const ky$1 = new Ky(input, options);
|
|
2214
2219
|
const function_ = async () => {
|
|
2215
|
-
if (typeof ky$1.
|
|
2220
|
+
if (typeof ky$1.#options.timeout === "number" && ky$1.#options.timeout > maxSafeTimeout) throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
2216
2221
|
await Promise.resolve();
|
|
2217
|
-
let response = await ky$1
|
|
2218
|
-
for (const hook of ky$1.
|
|
2219
|
-
const modifiedResponse = await hook(ky$1.request, ky$1.#getNormalizedOptions(), ky$1
|
|
2222
|
+
let response = await ky$1.#fetch();
|
|
2223
|
+
for (const hook of ky$1.#options.hooks.afterResponse) {
|
|
2224
|
+
const modifiedResponse = await hook(ky$1.request, ky$1.#getNormalizedOptions(), ky$1.#decorateResponse(response.clone()), { retryCount: ky$1.#retryCount });
|
|
2220
2225
|
if (modifiedResponse instanceof globalThis.Response) response = modifiedResponse;
|
|
2221
2226
|
}
|
|
2222
|
-
ky$1
|
|
2223
|
-
if (!response.ok && ky$1.
|
|
2227
|
+
ky$1.#decorateResponse(response);
|
|
2228
|
+
if (!response.ok && ky$1.#options.throwHttpErrors) {
|
|
2224
2229
|
let error = new HTTPError(response, ky$1.request, ky$1.#getNormalizedOptions());
|
|
2225
|
-
for (const hook of ky$1.
|
|
2230
|
+
for (const hook of ky$1.#options.hooks.beforeError) error = await hook(error, { retryCount: ky$1.#retryCount });
|
|
2226
2231
|
throw error;
|
|
2227
2232
|
}
|
|
2228
|
-
if (ky$1.
|
|
2229
|
-
if (typeof ky$1.
|
|
2233
|
+
if (ky$1.#options.onDownloadProgress) {
|
|
2234
|
+
if (typeof ky$1.#options.onDownloadProgress !== "function") throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
2230
2235
|
if (!supportsResponseStreams) throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
2231
|
-
return streamResponse(response.clone(), ky$1.
|
|
2236
|
+
return streamResponse(response.clone(), ky$1.#options.onDownloadProgress);
|
|
2232
2237
|
}
|
|
2233
2238
|
return response;
|
|
2234
2239
|
};
|
|
2235
|
-
const result = (ky$1.
|
|
2236
|
-
const originalRequest = ky$1
|
|
2240
|
+
const result = (ky$1.#options.retry.methods.includes(ky$1.request.method.toLowerCase()) ? ky$1.#retry(function_) : function_()).finally(async () => {
|
|
2241
|
+
const originalRequest = ky$1.#originalRequest;
|
|
2237
2242
|
const cleanupPromises = [];
|
|
2238
2243
|
if (originalRequest && !originalRequest.bodyUsed) cleanupPromises.push(originalRequest.body?.cancel());
|
|
2239
2244
|
if (!ky$1.request.bodyUsed) cleanupPromises.push(ky$1.request.body?.cancel());
|
|
@@ -2261,116 +2266,150 @@ var Ky = class Ky {
|
|
|
2261
2266
|
return searchParams;
|
|
2262
2267
|
}
|
|
2263
2268
|
request;
|
|
2264
|
-
abortController;
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
+
#abortController;
|
|
2270
|
+
#retryCount = 0;
|
|
2271
|
+
#input;
|
|
2272
|
+
#options;
|
|
2273
|
+
#originalRequest;
|
|
2274
|
+
#userProvidedAbortSignal;
|
|
2269
2275
|
#cachedNormalizedOptions;
|
|
2270
2276
|
constructor(input, options = {}) {
|
|
2271
|
-
this
|
|
2272
|
-
this
|
|
2277
|
+
this.#input = input;
|
|
2278
|
+
this.#options = {
|
|
2273
2279
|
...options,
|
|
2274
|
-
headers: mergeHeaders(this.
|
|
2280
|
+
headers: mergeHeaders(this.#input.headers, options.headers),
|
|
2275
2281
|
hooks: mergeHooks({
|
|
2276
2282
|
beforeRequest: [],
|
|
2277
2283
|
beforeRetry: [],
|
|
2278
2284
|
beforeError: [],
|
|
2279
2285
|
afterResponse: []
|
|
2280
2286
|
}, options.hooks),
|
|
2281
|
-
method: normalizeRequestMethod(options.method ?? this.
|
|
2287
|
+
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
2282
2288
|
prefixUrl: String(options.prefixUrl || ""),
|
|
2283
2289
|
retry: normalizeRetryOptions(options.retry),
|
|
2284
2290
|
throwHttpErrors: options.throwHttpErrors !== false,
|
|
2285
2291
|
timeout: options.timeout ?? 1e4,
|
|
2286
|
-
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
2292
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
2293
|
+
context: options.context ?? {}
|
|
2287
2294
|
};
|
|
2288
|
-
if (typeof this
|
|
2289
|
-
if (this.
|
|
2290
|
-
if (this.
|
|
2291
|
-
if (!this.
|
|
2292
|
-
this
|
|
2295
|
+
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");
|
|
2296
|
+
if (this.#options.prefixUrl && typeof this.#input === "string") {
|
|
2297
|
+
if (this.#input.startsWith("/")) throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
2298
|
+
if (!this.#options.prefixUrl.endsWith("/")) this.#options.prefixUrl += "/";
|
|
2299
|
+
this.#input = this.#options.prefixUrl + this.#input;
|
|
2293
2300
|
}
|
|
2294
2301
|
if (supportsAbortController && supportsAbortSignal) {
|
|
2295
|
-
|
|
2296
|
-
this
|
|
2297
|
-
this.
|
|
2302
|
+
this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
|
|
2303
|
+
this.#abortController = new globalThis.AbortController();
|
|
2304
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
2298
2305
|
}
|
|
2299
|
-
if (supportsRequestStreams) this.
|
|
2300
|
-
if (this.
|
|
2301
|
-
this.
|
|
2302
|
-
this.
|
|
2306
|
+
if (supportsRequestStreams) this.#options.duplex = "half";
|
|
2307
|
+
if (this.#options.json !== void 0) {
|
|
2308
|
+
this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
|
|
2309
|
+
this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
|
|
2303
2310
|
}
|
|
2304
2311
|
const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
|
|
2305
|
-
if (this
|
|
2306
|
-
this.request = new globalThis.Request(this
|
|
2307
|
-
if (hasSearchParameters(this.
|
|
2308
|
-
const searchParams = "?" + (typeof this.
|
|
2312
|
+
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");
|
|
2313
|
+
this.request = new globalThis.Request(this.#input, this.#options);
|
|
2314
|
+
if (hasSearchParameters(this.#options.searchParams)) {
|
|
2315
|
+
const searchParams = "?" + (typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString());
|
|
2309
2316
|
const url$2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
2310
|
-
this.request = new globalThis.Request(new globalThis.Request(url$2, { ...this.request }), this
|
|
2317
|
+
this.request = new globalThis.Request(new globalThis.Request(url$2, { ...this.request }), this.#options);
|
|
2311
2318
|
}
|
|
2312
|
-
if (this.
|
|
2313
|
-
if (typeof this.
|
|
2319
|
+
if (this.#options.onUploadProgress) {
|
|
2320
|
+
if (typeof this.#options.onUploadProgress !== "function") throw new TypeError("The `onUploadProgress` option must be a function");
|
|
2314
2321
|
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.
|
|
2322
|
+
if (this.request.body) this.request = streamRequest(this.request, this.#options.onUploadProgress, this.#options.body);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
#calculateDelay() {
|
|
2326
|
+
const retryDelay = this.#options.retry.delay(this.#retryCount);
|
|
2327
|
+
let jitteredDelay = retryDelay;
|
|
2328
|
+
if (this.#options.retry.jitter === true) jitteredDelay = Math.random() * retryDelay;
|
|
2329
|
+
else if (typeof this.#options.retry.jitter === "function") {
|
|
2330
|
+
jitteredDelay = this.#options.retry.jitter(retryDelay);
|
|
2331
|
+
if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) jitteredDelay = retryDelay;
|
|
2332
|
+
}
|
|
2333
|
+
return Math.min(this.#options.retry.backoffLimit, jitteredDelay);
|
|
2334
|
+
}
|
|
2335
|
+
async #calculateRetryDelay(error) {
|
|
2336
|
+
this.#retryCount++;
|
|
2337
|
+
if (this.#retryCount > this.#options.retry.limit) throw error;
|
|
2338
|
+
const errorObject = error instanceof Error ? error : new NonError(error);
|
|
2339
|
+
if (this.#options.retry.shouldRetry !== void 0) {
|
|
2340
|
+
const result = await this.#options.retry.shouldRetry({
|
|
2341
|
+
error: errorObject,
|
|
2342
|
+
retryCount: this.#retryCount
|
|
2343
|
+
});
|
|
2344
|
+
if (result === false) throw error;
|
|
2345
|
+
if (result === true) return this.#calculateDelay();
|
|
2316
2346
|
}
|
|
2317
|
-
|
|
2318
|
-
_calculateRetryDelay(error) {
|
|
2319
|
-
this._retryCount++;
|
|
2320
|
-
if (this._retryCount > this._options.retry.limit || isTimeoutError(error)) throw error;
|
|
2347
|
+
if (isTimeoutError(error) && !this.#options.retry.retryOnTimeout) throw error;
|
|
2321
2348
|
if (isHTTPError(error)) {
|
|
2322
|
-
if (!this.
|
|
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.
|
|
2349
|
+
if (!this.#options.retry.statusCodes.includes(error.response.status)) throw error;
|
|
2350
|
+
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");
|
|
2351
|
+
if (retryAfter && this.#options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
2325
2352
|
let after = Number(retryAfter) * 1e3;
|
|
2326
2353
|
if (Number.isNaN(after)) after = Date.parse(retryAfter) - Date.now();
|
|
2327
2354
|
else if (after >= Date.parse("2024-01-01")) after -= Date.now();
|
|
2328
|
-
const max = this.
|
|
2355
|
+
const max = this.#options.retry.maxRetryAfter ?? after;
|
|
2329
2356
|
return after < max ? after : max;
|
|
2330
2357
|
}
|
|
2331
2358
|
if (error.response.status === 413) throw error;
|
|
2332
2359
|
}
|
|
2333
|
-
|
|
2334
|
-
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
|
2360
|
+
return this.#calculateDelay();
|
|
2335
2361
|
}
|
|
2336
|
-
|
|
2337
|
-
if (this.
|
|
2362
|
+
#decorateResponse(response) {
|
|
2363
|
+
if (this.#options.parseJson) response.json = async () => this.#options.parseJson(await response.text());
|
|
2338
2364
|
return response;
|
|
2339
2365
|
}
|
|
2340
|
-
async
|
|
2366
|
+
async #retry(function_) {
|
|
2341
2367
|
try {
|
|
2342
2368
|
return await function_();
|
|
2343
2369
|
} catch (error) {
|
|
2344
|
-
const ms = Math.min(this
|
|
2345
|
-
if (this
|
|
2346
|
-
await delay(ms, { signal: this
|
|
2347
|
-
for (const hook of this.
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2370
|
+
const ms = Math.min(await this.#calculateRetryDelay(error), maxSafeTimeout);
|
|
2371
|
+
if (this.#retryCount < 1) throw error;
|
|
2372
|
+
await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
2373
|
+
for (const hook of this.#options.hooks.beforeRetry) {
|
|
2374
|
+
const hookResult = await hook({
|
|
2375
|
+
request: this.request,
|
|
2376
|
+
options: this.#getNormalizedOptions(),
|
|
2377
|
+
error,
|
|
2378
|
+
retryCount: this.#retryCount
|
|
2379
|
+
});
|
|
2380
|
+
if (hookResult instanceof globalThis.Request) {
|
|
2381
|
+
this.request = hookResult;
|
|
2382
|
+
break;
|
|
2383
|
+
}
|
|
2384
|
+
if (hookResult instanceof globalThis.Response) return hookResult;
|
|
2385
|
+
if (hookResult === stop) return;
|
|
2386
|
+
}
|
|
2387
|
+
return this.#retry(function_);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
async #fetch() {
|
|
2391
|
+
if (this.#abortController?.signal.aborted) {
|
|
2392
|
+
this.#abortController = new globalThis.AbortController();
|
|
2393
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
2394
|
+
this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
|
|
2395
|
+
}
|
|
2396
|
+
for (const hook of this.#options.hooks.beforeRequest) {
|
|
2397
|
+
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
2359
2398
|
if (result instanceof Request) {
|
|
2360
2399
|
this.request = result;
|
|
2361
2400
|
break;
|
|
2362
2401
|
}
|
|
2363
2402
|
if (result instanceof Response) return result;
|
|
2364
2403
|
}
|
|
2365
|
-
const nonRequestOptions = findUnknownOptions(this.request, this
|
|
2366
|
-
this
|
|
2367
|
-
this.request = this.
|
|
2368
|
-
if (this.
|
|
2369
|
-
return timeout(this
|
|
2404
|
+
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
2405
|
+
this.#originalRequest = this.request;
|
|
2406
|
+
this.request = this.#originalRequest.clone();
|
|
2407
|
+
if (this.#options.timeout === false) return this.#options.fetch(this.#originalRequest, nonRequestOptions);
|
|
2408
|
+
return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
|
|
2370
2409
|
}
|
|
2371
2410
|
#getNormalizedOptions() {
|
|
2372
2411
|
if (!this.#cachedNormalizedOptions) {
|
|
2373
|
-
const { hooks,...normalizedOptions } = this
|
|
2412
|
+
const { hooks,...normalizedOptions } = this.#options;
|
|
2374
2413
|
this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
|
|
2375
2414
|
}
|
|
2376
2415
|
return this.#cachedNormalizedOptions;
|
|
@@ -2378,7 +2417,7 @@ var Ky = class Ky {
|
|
|
2378
2417
|
};
|
|
2379
2418
|
|
|
2380
2419
|
//#endregion
|
|
2381
|
-
//#region ../../node_modules/.pnpm/ky@1.
|
|
2420
|
+
//#region ../../node_modules/.pnpm/ky@1.13.0/node_modules/ky/distribution/index.js
|
|
2382
2421
|
const createInstance = (defaults$1) => {
|
|
2383
2422
|
const ky$1 = (input, options) => Ky.create(input, validateAndMerge(defaults$1, options));
|
|
2384
2423
|
for (const method of requestMethods) ky$1[method] = (input, options) => Ky.create(input, validateAndMerge(defaults$1, options, { method }));
|
|
@@ -3670,6 +3709,7 @@ var require_ca_file = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@pn
|
|
|
3670
3709
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3671
3710
|
};
|
|
3672
3711
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3712
|
+
exports.readCAFileSync = void 0;
|
|
3673
3713
|
const graceful_fs_1 = __importDefault(require_graceful_fs());
|
|
3674
3714
|
function readCAFileSync$1(filePath) {
|
|
3675
3715
|
try {
|
|
@@ -3709,9 +3749,9 @@ var require_dist$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@pnp
|
|
|
3709
3749
|
}) });
|
|
3710
3750
|
|
|
3711
3751
|
//#endregion
|
|
3712
|
-
//#region ../../node_modules/.pnpm/tsdown@0.15.
|
|
3752
|
+
//#region ../../node_modules/.pnpm/tsdown@0.15.12_typescript@5.9.3/node_modules/tsdown/esm-shims.js
|
|
3713
3753
|
var getFilename, getDirname, __dirname$2;
|
|
3714
|
-
var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.
|
|
3754
|
+
var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.12_typescript@5.9.3/node_modules/tsdown/esm-shims.js": (() => {
|
|
3715
3755
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
3716
3756
|
getDirname = () => path.dirname(getFilename());
|
|
3717
3757
|
__dirname$2 = /* @__PURE__ */ getDirname();
|
|
@@ -4037,6 +4077,7 @@ var require_envKeyToSetting = /* @__PURE__ */ __commonJS({ "../../node_modules/.
|
|
|
4037
4077
|
//#region ../../node_modules/.pnpm/@pnpm+config.env-replace@1.1.0/node_modules/@pnpm/config.env-replace/dist/env-replace.js
|
|
4038
4078
|
var require_env_replace = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@pnpm+config.env-replace@1.1.0/node_modules/@pnpm/config.env-replace/dist/env-replace.js": ((exports) => {
|
|
4039
4079
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4080
|
+
exports.envReplace = void 0;
|
|
4040
4081
|
const ENV_EXPR = /(?<!\\)(\\*)\$\{([^${}]+)\}/g;
|
|
4041
4082
|
function envReplace$1(settingValue, env$3) {
|
|
4042
4083
|
return settingValue.replace(ENV_EXPR, replaceEnvMatch.bind(null, env$3));
|
|
@@ -5273,7 +5314,7 @@ function updateNotifier(options) {
|
|
|
5273
5314
|
//#endregion
|
|
5274
5315
|
//#region package.json
|
|
5275
5316
|
var name = "@yamada-ui/cli";
|
|
5276
|
-
var version = "2.0.
|
|
5317
|
+
var version = "2.0.5";
|
|
5277
5318
|
var description = "The official CLI for Yamada UI projects";
|
|
5278
5319
|
var package_default = {
|
|
5279
5320
|
name,
|
|
@@ -5292,7 +5333,7 @@ var package_default = {
|
|
|
5292
5333
|
],
|
|
5293
5334
|
author: "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",
|
|
5294
5335
|
license: "MIT",
|
|
5295
|
-
main: "
|
|
5336
|
+
main: "src/index.ts",
|
|
5296
5337
|
files: ["dist"],
|
|
5297
5338
|
sideEffects: false,
|
|
5298
5339
|
publishConfig: { "access": "public" },
|
|
@@ -5303,7 +5344,6 @@ var package_default = {
|
|
|
5303
5344
|
"directory": "packages/cli"
|
|
5304
5345
|
},
|
|
5305
5346
|
bugs: { "url": "https://github.com/yamada-ui/yamada-ui/issues" },
|
|
5306
|
-
bin: { "yamada-cli": "dist/index.js" },
|
|
5307
5347
|
scripts: {
|
|
5308
5348
|
"clean": "rimraf node_modules dist trace coverage .turbo .eslintcache",
|
|
5309
5349
|
"dev": "tsx src/index.ts",
|
|
@@ -5312,7 +5352,9 @@ var package_default = {
|
|
|
5312
5352
|
"typetrace": "tsc --noEmit --generateTrace ./trace --incremental false",
|
|
5313
5353
|
"typeanalyze": "npx analyze-trace ./trace --expandTypes=false",
|
|
5314
5354
|
"lint": "eslint . --max-warnings=0 --cache",
|
|
5315
|
-
"format": "prettier . --ignore-path ../../.prettierignore --check --cache"
|
|
5355
|
+
"format": "prettier . --ignore-path ../../.prettierignore --check --cache",
|
|
5356
|
+
"prepack": "clean-package",
|
|
5357
|
+
"postpack": "clean-package restore"
|
|
5316
5358
|
},
|
|
5317
5359
|
dependencies: {
|
|
5318
5360
|
"@yamada-ui/utils": "workspace:*",
|
|
@@ -5344,10 +5386,12 @@ var package_default = {
|
|
|
5344
5386
|
"@types/update-notifier": "6.0.8",
|
|
5345
5387
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
5346
5388
|
"@types/yamljs": "^0.2.34",
|
|
5389
|
+
"clean-package": "2.2.0",
|
|
5347
5390
|
"tsx": "^4.20.6",
|
|
5348
5391
|
"typescript": "^5.9.3",
|
|
5349
5392
|
"update-notifier": "^7.3.1"
|
|
5350
|
-
}
|
|
5393
|
+
},
|
|
5394
|
+
"clean-package": "./clean-package.config.json"
|
|
5351
5395
|
};
|
|
5352
5396
|
|
|
5353
5397
|
//#endregion
|
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
|
+
"version": "2.0.6-dev-20251225223828",
|
|
5
5
|
"description": "The official CLI for Yamada UI projects",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"theme",
|
|
@@ -32,9 +32,6 @@
|
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/yamada-ui/yamada-ui/issues"
|
|
34
34
|
},
|
|
35
|
-
"bin": {
|
|
36
|
-
"yamada-cli": "dist/index.js"
|
|
37
|
-
},
|
|
38
35
|
"dependencies": {
|
|
39
36
|
"boxen": "^8.0.1",
|
|
40
37
|
"cli-check-node": "^1.3.4",
|
|
@@ -57,7 +54,7 @@
|
|
|
57
54
|
"sucrase": "^3.35.0",
|
|
58
55
|
"validate-npm-package-name": "^6.0.2",
|
|
59
56
|
"yamljs": "^0.3.0",
|
|
60
|
-
"@yamada-ui/utils": "2.
|
|
57
|
+
"@yamada-ui/utils": "2.0.5-dev-20251225223828"
|
|
61
58
|
},
|
|
62
59
|
"devDependencies": {
|
|
63
60
|
"@types/prompts": "^2.4.9",
|
|
@@ -65,10 +62,15 @@
|
|
|
65
62
|
"@types/update-notifier": "6.0.8",
|
|
66
63
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
67
64
|
"@types/yamljs": "^0.2.34",
|
|
65
|
+
"clean-package": "2.2.0",
|
|
68
66
|
"tsx": "^4.20.6",
|
|
69
67
|
"typescript": "^5.9.3",
|
|
70
68
|
"update-notifier": "^7.3.1"
|
|
71
69
|
},
|
|
70
|
+
"clean-package": "./clean-package.config.json",
|
|
71
|
+
"bin": {
|
|
72
|
+
"yamada-cli": "dist/index.js"
|
|
73
|
+
},
|
|
72
74
|
"scripts": {
|
|
73
75
|
"clean": "rimraf node_modules dist trace coverage .turbo .eslintcache",
|
|
74
76
|
"dev": "tsx src/index.ts",
|