@yamada-ui/cli 1.2.4 → 1.2.5-dev-20250724153719
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/command/index.js +3 -3
- package/dist/command/theme/index.js +3 -3
- package/dist/command/tokens/create-theme-typings.js +2 -2
- package/dist/command/tokens/index.js +2 -2
- package/dist/index.js +221 -135
- package/dist/utils/cli.js +220 -134
- package/dist/utils/index.js +220 -134
- package/package.json +1 -1
package/dist/utils/cli.js
CHANGED
|
@@ -33,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.24_jiti@2.4.2_tsx@4.19.4_typescript@5.8.3/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var getImportMetaUrl, importMetaUrl;
|
|
38
38
|
var init_cjs_shims = __esm({
|
|
39
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
39
|
+
"../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.24_jiti@2.4.2_tsx@4.19.4_typescript@5.8.3/node_modules/tsup/assets/cjs_shims.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
42
42
|
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
@@ -7235,13 +7235,13 @@ init_cjs_shims();
|
|
|
7235
7235
|
// ../../node_modules/.pnpm/package-json@10.0.1/node_modules/package-json/index.js
|
|
7236
7236
|
init_cjs_shims();
|
|
7237
7237
|
|
|
7238
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7238
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/index.js
|
|
7239
7239
|
init_cjs_shims();
|
|
7240
7240
|
|
|
7241
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7241
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/core/Ky.js
|
|
7242
7242
|
init_cjs_shims();
|
|
7243
7243
|
|
|
7244
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7244
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/errors/HTTPError.js
|
|
7245
7245
|
init_cjs_shims();
|
|
7246
7246
|
var HTTPError = class extends Error {
|
|
7247
7247
|
response;
|
|
@@ -7260,7 +7260,7 @@ var HTTPError = class extends Error {
|
|
|
7260
7260
|
}
|
|
7261
7261
|
};
|
|
7262
7262
|
|
|
7263
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7263
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/errors/TimeoutError.js
|
|
7264
7264
|
init_cjs_shims();
|
|
7265
7265
|
var TimeoutError = class extends Error {
|
|
7266
7266
|
request;
|
|
@@ -7271,78 +7271,10 @@ var TimeoutError = class extends Error {
|
|
|
7271
7271
|
}
|
|
7272
7272
|
};
|
|
7273
7273
|
|
|
7274
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7274
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/body.js
|
|
7275
7275
|
init_cjs_shims();
|
|
7276
7276
|
|
|
7277
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7278
|
-
init_cjs_shims();
|
|
7279
|
-
var isObject2 = (value) => value !== null && typeof value === "object";
|
|
7280
|
-
|
|
7281
|
-
// ../../node_modules/.pnpm/ky@1.7.5/node_modules/ky/distribution/utils/merge.js
|
|
7282
|
-
var validateAndMerge = (...sources) => {
|
|
7283
|
-
for (const source of sources) {
|
|
7284
|
-
if ((!isObject2(source) || Array.isArray(source)) && source !== void 0) {
|
|
7285
|
-
throw new TypeError("The `options` argument must be an object");
|
|
7286
|
-
}
|
|
7287
|
-
}
|
|
7288
|
-
return deepMerge({}, ...sources);
|
|
7289
|
-
};
|
|
7290
|
-
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
7291
|
-
const result = new globalThis.Headers(source1);
|
|
7292
|
-
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
7293
|
-
const source = new globalThis.Headers(source2);
|
|
7294
|
-
for (const [key, value] of source.entries()) {
|
|
7295
|
-
if (isHeadersInstance && value === "undefined" || value === void 0) {
|
|
7296
|
-
result.delete(key);
|
|
7297
|
-
} else {
|
|
7298
|
-
result.set(key, value);
|
|
7299
|
-
}
|
|
7300
|
-
}
|
|
7301
|
-
return result;
|
|
7302
|
-
};
|
|
7303
|
-
function newHookValue(original, incoming, property) {
|
|
7304
|
-
return Object.hasOwn(incoming, property) && incoming[property] === void 0 ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
7305
|
-
}
|
|
7306
|
-
var mergeHooks = (original = {}, incoming = {}) => ({
|
|
7307
|
-
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
7308
|
-
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
7309
|
-
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
7310
|
-
beforeError: newHookValue(original, incoming, "beforeError")
|
|
7311
|
-
});
|
|
7312
|
-
var deepMerge = (...sources) => {
|
|
7313
|
-
let returnValue = {};
|
|
7314
|
-
let headers = {};
|
|
7315
|
-
let hooks = {};
|
|
7316
|
-
for (const source of sources) {
|
|
7317
|
-
if (Array.isArray(source)) {
|
|
7318
|
-
if (!Array.isArray(returnValue)) {
|
|
7319
|
-
returnValue = [];
|
|
7320
|
-
}
|
|
7321
|
-
returnValue = [...returnValue, ...source];
|
|
7322
|
-
} else if (isObject2(source)) {
|
|
7323
|
-
for (let [key, value] of Object.entries(source)) {
|
|
7324
|
-
if (isObject2(value) && key in returnValue) {
|
|
7325
|
-
value = deepMerge(returnValue[key], value);
|
|
7326
|
-
}
|
|
7327
|
-
returnValue = { ...returnValue, [key]: value };
|
|
7328
|
-
}
|
|
7329
|
-
if (isObject2(source.hooks)) {
|
|
7330
|
-
hooks = mergeHooks(hooks, source.hooks);
|
|
7331
|
-
returnValue.hooks = hooks;
|
|
7332
|
-
}
|
|
7333
|
-
if (isObject2(source.headers)) {
|
|
7334
|
-
headers = mergeHeaders(headers, source.headers);
|
|
7335
|
-
returnValue.headers = headers;
|
|
7336
|
-
}
|
|
7337
|
-
}
|
|
7338
|
-
}
|
|
7339
|
-
return returnValue;
|
|
7340
|
-
};
|
|
7341
|
-
|
|
7342
|
-
// ../../node_modules/.pnpm/ky@1.7.5/node_modules/ky/distribution/utils/normalize.js
|
|
7343
|
-
init_cjs_shims();
|
|
7344
|
-
|
|
7345
|
-
// ../../node_modules/.pnpm/ky@1.7.5/node_modules/ky/distribution/core/constants.js
|
|
7277
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/core/constants.js
|
|
7346
7278
|
init_cjs_shims();
|
|
7347
7279
|
var supportsRequestStreams = (() => {
|
|
7348
7280
|
let duplexAccessed = false;
|
|
@@ -7383,6 +7315,7 @@ var responseTypes = {
|
|
|
7383
7315
|
blob: "*/*"
|
|
7384
7316
|
};
|
|
7385
7317
|
var maxSafeTimeout = 2147483647;
|
|
7318
|
+
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
7386
7319
|
var stop = Symbol("stop");
|
|
7387
7320
|
var kyOptionKeys = {
|
|
7388
7321
|
json: true,
|
|
@@ -7395,6 +7328,7 @@ var kyOptionKeys = {
|
|
|
7395
7328
|
hooks: true,
|
|
7396
7329
|
throwHttpErrors: true,
|
|
7397
7330
|
onDownloadProgress: true,
|
|
7331
|
+
onUploadProgress: true,
|
|
7398
7332
|
fetch: true
|
|
7399
7333
|
};
|
|
7400
7334
|
var requestOptionsRegistry = {
|
|
@@ -7416,7 +7350,191 @@ var requestOptionsRegistry = {
|
|
|
7416
7350
|
priority: true
|
|
7417
7351
|
};
|
|
7418
7352
|
|
|
7419
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7353
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/body.js
|
|
7354
|
+
var getBodySize = (body) => {
|
|
7355
|
+
if (!body) {
|
|
7356
|
+
return 0;
|
|
7357
|
+
}
|
|
7358
|
+
if (body instanceof FormData) {
|
|
7359
|
+
let size = 0;
|
|
7360
|
+
for (const [key, value] of body) {
|
|
7361
|
+
size += usualFormBoundarySize;
|
|
7362
|
+
size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
7363
|
+
size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
|
|
7364
|
+
}
|
|
7365
|
+
return size;
|
|
7366
|
+
}
|
|
7367
|
+
if (body instanceof Blob) {
|
|
7368
|
+
return body.size;
|
|
7369
|
+
}
|
|
7370
|
+
if (body instanceof ArrayBuffer) {
|
|
7371
|
+
return body.byteLength;
|
|
7372
|
+
}
|
|
7373
|
+
if (typeof body === "string") {
|
|
7374
|
+
return new TextEncoder().encode(body).length;
|
|
7375
|
+
}
|
|
7376
|
+
if (body instanceof URLSearchParams) {
|
|
7377
|
+
return new TextEncoder().encode(body.toString()).length;
|
|
7378
|
+
}
|
|
7379
|
+
if ("byteLength" in body) {
|
|
7380
|
+
return body.byteLength;
|
|
7381
|
+
}
|
|
7382
|
+
if (typeof body === "object" && body !== null) {
|
|
7383
|
+
try {
|
|
7384
|
+
const jsonString = JSON.stringify(body);
|
|
7385
|
+
return new TextEncoder().encode(jsonString).length;
|
|
7386
|
+
} catch {
|
|
7387
|
+
return 0;
|
|
7388
|
+
}
|
|
7389
|
+
}
|
|
7390
|
+
return 0;
|
|
7391
|
+
};
|
|
7392
|
+
var streamResponse = (response, onDownloadProgress) => {
|
|
7393
|
+
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
7394
|
+
let transferredBytes = 0;
|
|
7395
|
+
if (response.status === 204) {
|
|
7396
|
+
if (onDownloadProgress) {
|
|
7397
|
+
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
7398
|
+
}
|
|
7399
|
+
return new Response(null, {
|
|
7400
|
+
status: response.status,
|
|
7401
|
+
statusText: response.statusText,
|
|
7402
|
+
headers: response.headers
|
|
7403
|
+
});
|
|
7404
|
+
}
|
|
7405
|
+
return new Response(new ReadableStream({
|
|
7406
|
+
async start(controller) {
|
|
7407
|
+
const reader = response.body.getReader();
|
|
7408
|
+
if (onDownloadProgress) {
|
|
7409
|
+
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
7410
|
+
}
|
|
7411
|
+
async function read() {
|
|
7412
|
+
const { done, value } = await reader.read();
|
|
7413
|
+
if (done) {
|
|
7414
|
+
controller.close();
|
|
7415
|
+
return;
|
|
7416
|
+
}
|
|
7417
|
+
if (onDownloadProgress) {
|
|
7418
|
+
transferredBytes += value.byteLength;
|
|
7419
|
+
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
7420
|
+
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
7421
|
+
}
|
|
7422
|
+
controller.enqueue(value);
|
|
7423
|
+
await read();
|
|
7424
|
+
}
|
|
7425
|
+
await read();
|
|
7426
|
+
}
|
|
7427
|
+
}), {
|
|
7428
|
+
status: response.status,
|
|
7429
|
+
statusText: response.statusText,
|
|
7430
|
+
headers: response.headers
|
|
7431
|
+
});
|
|
7432
|
+
};
|
|
7433
|
+
var streamRequest = (request, onUploadProgress) => {
|
|
7434
|
+
const totalBytes = getBodySize(request.body);
|
|
7435
|
+
let transferredBytes = 0;
|
|
7436
|
+
return new Request(request, {
|
|
7437
|
+
// @ts-expect-error - Types are outdated.
|
|
7438
|
+
duplex: "half",
|
|
7439
|
+
body: new ReadableStream({
|
|
7440
|
+
async start(controller) {
|
|
7441
|
+
const reader = request.body instanceof ReadableStream ? request.body.getReader() : new Response("").body.getReader();
|
|
7442
|
+
async function read() {
|
|
7443
|
+
const { done, value } = await reader.read();
|
|
7444
|
+
if (done) {
|
|
7445
|
+
if (onUploadProgress) {
|
|
7446
|
+
onUploadProgress({ percent: 1, transferredBytes, totalBytes: Math.max(totalBytes, transferredBytes) }, new Uint8Array());
|
|
7447
|
+
}
|
|
7448
|
+
controller.close();
|
|
7449
|
+
return;
|
|
7450
|
+
}
|
|
7451
|
+
transferredBytes += value.byteLength;
|
|
7452
|
+
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
7453
|
+
if (totalBytes < transferredBytes || percent === 1) {
|
|
7454
|
+
percent = 0.99;
|
|
7455
|
+
}
|
|
7456
|
+
if (onUploadProgress) {
|
|
7457
|
+
onUploadProgress({ percent: Number(percent.toFixed(2)), transferredBytes, totalBytes }, value);
|
|
7458
|
+
}
|
|
7459
|
+
controller.enqueue(value);
|
|
7460
|
+
await read();
|
|
7461
|
+
}
|
|
7462
|
+
await read();
|
|
7463
|
+
}
|
|
7464
|
+
})
|
|
7465
|
+
});
|
|
7466
|
+
};
|
|
7467
|
+
|
|
7468
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/merge.js
|
|
7469
|
+
init_cjs_shims();
|
|
7470
|
+
|
|
7471
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/is.js
|
|
7472
|
+
init_cjs_shims();
|
|
7473
|
+
var isObject2 = (value) => value !== null && typeof value === "object";
|
|
7474
|
+
|
|
7475
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/merge.js
|
|
7476
|
+
var validateAndMerge = (...sources) => {
|
|
7477
|
+
for (const source of sources) {
|
|
7478
|
+
if ((!isObject2(source) || Array.isArray(source)) && source !== void 0) {
|
|
7479
|
+
throw new TypeError("The `options` argument must be an object");
|
|
7480
|
+
}
|
|
7481
|
+
}
|
|
7482
|
+
return deepMerge({}, ...sources);
|
|
7483
|
+
};
|
|
7484
|
+
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
7485
|
+
const result = new globalThis.Headers(source1);
|
|
7486
|
+
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
7487
|
+
const source = new globalThis.Headers(source2);
|
|
7488
|
+
for (const [key, value] of source.entries()) {
|
|
7489
|
+
if (isHeadersInstance && value === "undefined" || value === void 0) {
|
|
7490
|
+
result.delete(key);
|
|
7491
|
+
} else {
|
|
7492
|
+
result.set(key, value);
|
|
7493
|
+
}
|
|
7494
|
+
}
|
|
7495
|
+
return result;
|
|
7496
|
+
};
|
|
7497
|
+
function newHookValue(original, incoming, property) {
|
|
7498
|
+
return Object.hasOwn(incoming, property) && incoming[property] === void 0 ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
7499
|
+
}
|
|
7500
|
+
var mergeHooks = (original = {}, incoming = {}) => ({
|
|
7501
|
+
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
7502
|
+
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
7503
|
+
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
7504
|
+
beforeError: newHookValue(original, incoming, "beforeError")
|
|
7505
|
+
});
|
|
7506
|
+
var deepMerge = (...sources) => {
|
|
7507
|
+
let returnValue = {};
|
|
7508
|
+
let headers = {};
|
|
7509
|
+
let hooks = {};
|
|
7510
|
+
for (const source of sources) {
|
|
7511
|
+
if (Array.isArray(source)) {
|
|
7512
|
+
if (!Array.isArray(returnValue)) {
|
|
7513
|
+
returnValue = [];
|
|
7514
|
+
}
|
|
7515
|
+
returnValue = [...returnValue, ...source];
|
|
7516
|
+
} else if (isObject2(source)) {
|
|
7517
|
+
for (let [key, value] of Object.entries(source)) {
|
|
7518
|
+
if (isObject2(value) && key in returnValue) {
|
|
7519
|
+
value = deepMerge(returnValue[key], value);
|
|
7520
|
+
}
|
|
7521
|
+
returnValue = { ...returnValue, [key]: value };
|
|
7522
|
+
}
|
|
7523
|
+
if (isObject2(source.hooks)) {
|
|
7524
|
+
hooks = mergeHooks(hooks, source.hooks);
|
|
7525
|
+
returnValue.hooks = hooks;
|
|
7526
|
+
}
|
|
7527
|
+
if (isObject2(source.headers)) {
|
|
7528
|
+
headers = mergeHeaders(headers, source.headers);
|
|
7529
|
+
returnValue.headers = headers;
|
|
7530
|
+
}
|
|
7531
|
+
}
|
|
7532
|
+
}
|
|
7533
|
+
return returnValue;
|
|
7534
|
+
};
|
|
7535
|
+
|
|
7536
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/normalize.js
|
|
7537
|
+
init_cjs_shims();
|
|
7420
7538
|
var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
7421
7539
|
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
7422
7540
|
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
@@ -7449,7 +7567,7 @@ var normalizeRetryOptions = (retry = {}) => {
|
|
|
7449
7567
|
};
|
|
7450
7568
|
};
|
|
7451
7569
|
|
|
7452
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7570
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/timeout.js
|
|
7453
7571
|
init_cjs_shims();
|
|
7454
7572
|
async function timeout(request, init, abortController, options) {
|
|
7455
7573
|
return new Promise((resolve, reject) => {
|
|
@@ -7465,7 +7583,7 @@ async function timeout(request, init, abortController, options) {
|
|
|
7465
7583
|
});
|
|
7466
7584
|
}
|
|
7467
7585
|
|
|
7468
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7586
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/delay.js
|
|
7469
7587
|
init_cjs_shims();
|
|
7470
7588
|
async function delay(ms, { signal }) {
|
|
7471
7589
|
return new Promise((resolve, reject) => {
|
|
@@ -7484,7 +7602,7 @@ async function delay(ms, { signal }) {
|
|
|
7484
7602
|
});
|
|
7485
7603
|
}
|
|
7486
7604
|
|
|
7487
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7605
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/options.js
|
|
7488
7606
|
init_cjs_shims();
|
|
7489
7607
|
var findUnknownOptions = (request, options) => {
|
|
7490
7608
|
const unknownOptions = {};
|
|
@@ -7496,7 +7614,7 @@ var findUnknownOptions = (request, options) => {
|
|
|
7496
7614
|
return unknownOptions;
|
|
7497
7615
|
};
|
|
7498
7616
|
|
|
7499
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7617
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/core/Ky.js
|
|
7500
7618
|
var Ky = class _Ky {
|
|
7501
7619
|
static create(input, options) {
|
|
7502
7620
|
const ky2 = new _Ky(input, options);
|
|
@@ -7527,12 +7645,16 @@ var Ky = class _Ky {
|
|
|
7527
7645
|
if (!supportsResponseStreams) {
|
|
7528
7646
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
7529
7647
|
}
|
|
7530
|
-
return
|
|
7648
|
+
return streamResponse(response.clone(), ky2._options.onDownloadProgress);
|
|
7531
7649
|
}
|
|
7532
7650
|
return response;
|
|
7533
7651
|
};
|
|
7534
7652
|
const isRetriableMethod = ky2._options.retry.methods.includes(ky2.request.method.toLowerCase());
|
|
7535
|
-
const result = isRetriableMethod ? ky2._retry(function_) : function_()
|
|
7653
|
+
const result = (isRetriableMethod ? ky2._retry(function_) : function_()).finally(async () => {
|
|
7654
|
+
if (!ky2.request.bodyUsed) {
|
|
7655
|
+
await ky2.request.body?.cancel();
|
|
7656
|
+
}
|
|
7657
|
+
});
|
|
7536
7658
|
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
7537
7659
|
result[type] = async () => {
|
|
7538
7660
|
ky2.request.headers.set("accept", ky2.request.headers.get("accept") || mimeType);
|
|
@@ -7593,15 +7715,9 @@ var Ky = class _Ky {
|
|
|
7593
7715
|
this._input = this._options.prefixUrl + this._input;
|
|
7594
7716
|
}
|
|
7595
7717
|
if (supportsAbortController) {
|
|
7596
|
-
this.abortController = new globalThis.AbortController();
|
|
7597
7718
|
const originalSignal = this._options.signal ?? this._input.signal;
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
}
|
|
7601
|
-
originalSignal?.addEventListener("abort", () => {
|
|
7602
|
-
this.abortController.abort(originalSignal.reason);
|
|
7603
|
-
});
|
|
7604
|
-
this._options.signal = this.abortController.signal;
|
|
7719
|
+
this.abortController = new globalThis.AbortController();
|
|
7720
|
+
this._options.signal = originalSignal ? AbortSignal.any([originalSignal, this.abortController.signal]) : this.abortController.signal;
|
|
7605
7721
|
}
|
|
7606
7722
|
if (supportsRequestStreams) {
|
|
7607
7723
|
this._options.duplex = "half";
|
|
@@ -7620,6 +7736,18 @@ var Ky = class _Ky {
|
|
|
7620
7736
|
}
|
|
7621
7737
|
this.request = new globalThis.Request(new globalThis.Request(url, { ...this.request }), this._options);
|
|
7622
7738
|
}
|
|
7739
|
+
if (this._options.onUploadProgress) {
|
|
7740
|
+
if (typeof this._options.onUploadProgress !== "function") {
|
|
7741
|
+
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
7742
|
+
}
|
|
7743
|
+
if (!supportsRequestStreams) {
|
|
7744
|
+
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
7745
|
+
}
|
|
7746
|
+
const originalBody = this.request.body;
|
|
7747
|
+
if (originalBody) {
|
|
7748
|
+
this.request = streamRequest(this.request, this._options.onUploadProgress);
|
|
7749
|
+
}
|
|
7750
|
+
}
|
|
7623
7751
|
}
|
|
7624
7752
|
_calculateRetryDelay(error) {
|
|
7625
7753
|
this._retryCount++;
|
|
@@ -7696,51 +7824,9 @@ var Ky = class _Ky {
|
|
|
7696
7824
|
}
|
|
7697
7825
|
return timeout(mainRequest, nonRequestOptions, this.abortController, this._options);
|
|
7698
7826
|
}
|
|
7699
|
-
/* istanbul ignore next */
|
|
7700
|
-
_stream(response, onDownloadProgress) {
|
|
7701
|
-
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
7702
|
-
let transferredBytes = 0;
|
|
7703
|
-
if (response.status === 204) {
|
|
7704
|
-
if (onDownloadProgress) {
|
|
7705
|
-
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
7706
|
-
}
|
|
7707
|
-
return new globalThis.Response(null, {
|
|
7708
|
-
status: response.status,
|
|
7709
|
-
statusText: response.statusText,
|
|
7710
|
-
headers: response.headers
|
|
7711
|
-
});
|
|
7712
|
-
}
|
|
7713
|
-
return new globalThis.Response(new globalThis.ReadableStream({
|
|
7714
|
-
async start(controller) {
|
|
7715
|
-
const reader = response.body.getReader();
|
|
7716
|
-
if (onDownloadProgress) {
|
|
7717
|
-
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
7718
|
-
}
|
|
7719
|
-
async function read() {
|
|
7720
|
-
const { done, value } = await reader.read();
|
|
7721
|
-
if (done) {
|
|
7722
|
-
controller.close();
|
|
7723
|
-
return;
|
|
7724
|
-
}
|
|
7725
|
-
if (onDownloadProgress) {
|
|
7726
|
-
transferredBytes += value.byteLength;
|
|
7727
|
-
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
7728
|
-
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
7729
|
-
}
|
|
7730
|
-
controller.enqueue(value);
|
|
7731
|
-
await read();
|
|
7732
|
-
}
|
|
7733
|
-
await read();
|
|
7734
|
-
}
|
|
7735
|
-
}), {
|
|
7736
|
-
status: response.status,
|
|
7737
|
-
statusText: response.statusText,
|
|
7738
|
-
headers: response.headers
|
|
7739
|
-
});
|
|
7740
|
-
}
|
|
7741
7827
|
};
|
|
7742
7828
|
|
|
7743
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7829
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/index.js
|
|
7744
7830
|
var createInstance = (defaults) => {
|
|
7745
7831
|
const ky2 = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
7746
7832
|
for (const method of requestMethods) {
|