@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/index.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();
|
|
@@ -7264,13 +7264,13 @@ init_cjs_shims();
|
|
|
7264
7264
|
// ../../node_modules/.pnpm/package-json@10.0.1/node_modules/package-json/index.js
|
|
7265
7265
|
init_cjs_shims();
|
|
7266
7266
|
|
|
7267
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7267
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/index.js
|
|
7268
7268
|
init_cjs_shims();
|
|
7269
7269
|
|
|
7270
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7270
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/core/Ky.js
|
|
7271
7271
|
init_cjs_shims();
|
|
7272
7272
|
|
|
7273
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7273
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/errors/HTTPError.js
|
|
7274
7274
|
init_cjs_shims();
|
|
7275
7275
|
var HTTPError = class extends Error {
|
|
7276
7276
|
response;
|
|
@@ -7289,7 +7289,7 @@ var HTTPError = class extends Error {
|
|
|
7289
7289
|
}
|
|
7290
7290
|
};
|
|
7291
7291
|
|
|
7292
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7292
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/errors/TimeoutError.js
|
|
7293
7293
|
init_cjs_shims();
|
|
7294
7294
|
var TimeoutError = class extends Error {
|
|
7295
7295
|
request;
|
|
@@ -7300,78 +7300,10 @@ var TimeoutError = class extends Error {
|
|
|
7300
7300
|
}
|
|
7301
7301
|
};
|
|
7302
7302
|
|
|
7303
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7303
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/body.js
|
|
7304
7304
|
init_cjs_shims();
|
|
7305
7305
|
|
|
7306
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7307
|
-
init_cjs_shims();
|
|
7308
|
-
var isObject3 = (value) => value !== null && typeof value === "object";
|
|
7309
|
-
|
|
7310
|
-
// ../../node_modules/.pnpm/ky@1.7.5/node_modules/ky/distribution/utils/merge.js
|
|
7311
|
-
var validateAndMerge = (...sources) => {
|
|
7312
|
-
for (const source of sources) {
|
|
7313
|
-
if ((!isObject3(source) || Array.isArray(source)) && source !== void 0) {
|
|
7314
|
-
throw new TypeError("The `options` argument must be an object");
|
|
7315
|
-
}
|
|
7316
|
-
}
|
|
7317
|
-
return deepMerge({}, ...sources);
|
|
7318
|
-
};
|
|
7319
|
-
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
7320
|
-
const result = new globalThis.Headers(source1);
|
|
7321
|
-
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
7322
|
-
const source = new globalThis.Headers(source2);
|
|
7323
|
-
for (const [key, value] of source.entries()) {
|
|
7324
|
-
if (isHeadersInstance && value === "undefined" || value === void 0) {
|
|
7325
|
-
result.delete(key);
|
|
7326
|
-
} else {
|
|
7327
|
-
result.set(key, value);
|
|
7328
|
-
}
|
|
7329
|
-
}
|
|
7330
|
-
return result;
|
|
7331
|
-
};
|
|
7332
|
-
function newHookValue(original, incoming, property) {
|
|
7333
|
-
return Object.hasOwn(incoming, property) && incoming[property] === void 0 ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
7334
|
-
}
|
|
7335
|
-
var mergeHooks = (original = {}, incoming = {}) => ({
|
|
7336
|
-
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
7337
|
-
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
7338
|
-
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
7339
|
-
beforeError: newHookValue(original, incoming, "beforeError")
|
|
7340
|
-
});
|
|
7341
|
-
var deepMerge = (...sources) => {
|
|
7342
|
-
let returnValue = {};
|
|
7343
|
-
let headers = {};
|
|
7344
|
-
let hooks = {};
|
|
7345
|
-
for (const source of sources) {
|
|
7346
|
-
if (Array.isArray(source)) {
|
|
7347
|
-
if (!Array.isArray(returnValue)) {
|
|
7348
|
-
returnValue = [];
|
|
7349
|
-
}
|
|
7350
|
-
returnValue = [...returnValue, ...source];
|
|
7351
|
-
} else if (isObject3(source)) {
|
|
7352
|
-
for (let [key, value] of Object.entries(source)) {
|
|
7353
|
-
if (isObject3(value) && key in returnValue) {
|
|
7354
|
-
value = deepMerge(returnValue[key], value);
|
|
7355
|
-
}
|
|
7356
|
-
returnValue = { ...returnValue, [key]: value };
|
|
7357
|
-
}
|
|
7358
|
-
if (isObject3(source.hooks)) {
|
|
7359
|
-
hooks = mergeHooks(hooks, source.hooks);
|
|
7360
|
-
returnValue.hooks = hooks;
|
|
7361
|
-
}
|
|
7362
|
-
if (isObject3(source.headers)) {
|
|
7363
|
-
headers = mergeHeaders(headers, source.headers);
|
|
7364
|
-
returnValue.headers = headers;
|
|
7365
|
-
}
|
|
7366
|
-
}
|
|
7367
|
-
}
|
|
7368
|
-
return returnValue;
|
|
7369
|
-
};
|
|
7370
|
-
|
|
7371
|
-
// ../../node_modules/.pnpm/ky@1.7.5/node_modules/ky/distribution/utils/normalize.js
|
|
7372
|
-
init_cjs_shims();
|
|
7373
|
-
|
|
7374
|
-
// ../../node_modules/.pnpm/ky@1.7.5/node_modules/ky/distribution/core/constants.js
|
|
7306
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/core/constants.js
|
|
7375
7307
|
init_cjs_shims();
|
|
7376
7308
|
var supportsRequestStreams = (() => {
|
|
7377
7309
|
let duplexAccessed = false;
|
|
@@ -7412,6 +7344,7 @@ var responseTypes = {
|
|
|
7412
7344
|
blob: "*/*"
|
|
7413
7345
|
};
|
|
7414
7346
|
var maxSafeTimeout = 2147483647;
|
|
7347
|
+
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
7415
7348
|
var stop = Symbol("stop");
|
|
7416
7349
|
var kyOptionKeys = {
|
|
7417
7350
|
json: true,
|
|
@@ -7424,6 +7357,7 @@ var kyOptionKeys = {
|
|
|
7424
7357
|
hooks: true,
|
|
7425
7358
|
throwHttpErrors: true,
|
|
7426
7359
|
onDownloadProgress: true,
|
|
7360
|
+
onUploadProgress: true,
|
|
7427
7361
|
fetch: true
|
|
7428
7362
|
};
|
|
7429
7363
|
var requestOptionsRegistry = {
|
|
@@ -7445,7 +7379,191 @@ var requestOptionsRegistry = {
|
|
|
7445
7379
|
priority: true
|
|
7446
7380
|
};
|
|
7447
7381
|
|
|
7448
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7382
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/body.js
|
|
7383
|
+
var getBodySize = (body) => {
|
|
7384
|
+
if (!body) {
|
|
7385
|
+
return 0;
|
|
7386
|
+
}
|
|
7387
|
+
if (body instanceof FormData) {
|
|
7388
|
+
let size = 0;
|
|
7389
|
+
for (const [key, value] of body) {
|
|
7390
|
+
size += usualFormBoundarySize;
|
|
7391
|
+
size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
7392
|
+
size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
|
|
7393
|
+
}
|
|
7394
|
+
return size;
|
|
7395
|
+
}
|
|
7396
|
+
if (body instanceof Blob) {
|
|
7397
|
+
return body.size;
|
|
7398
|
+
}
|
|
7399
|
+
if (body instanceof ArrayBuffer) {
|
|
7400
|
+
return body.byteLength;
|
|
7401
|
+
}
|
|
7402
|
+
if (typeof body === "string") {
|
|
7403
|
+
return new TextEncoder().encode(body).length;
|
|
7404
|
+
}
|
|
7405
|
+
if (body instanceof URLSearchParams) {
|
|
7406
|
+
return new TextEncoder().encode(body.toString()).length;
|
|
7407
|
+
}
|
|
7408
|
+
if ("byteLength" in body) {
|
|
7409
|
+
return body.byteLength;
|
|
7410
|
+
}
|
|
7411
|
+
if (typeof body === "object" && body !== null) {
|
|
7412
|
+
try {
|
|
7413
|
+
const jsonString = JSON.stringify(body);
|
|
7414
|
+
return new TextEncoder().encode(jsonString).length;
|
|
7415
|
+
} catch {
|
|
7416
|
+
return 0;
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
return 0;
|
|
7420
|
+
};
|
|
7421
|
+
var streamResponse = (response, onDownloadProgress) => {
|
|
7422
|
+
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
7423
|
+
let transferredBytes = 0;
|
|
7424
|
+
if (response.status === 204) {
|
|
7425
|
+
if (onDownloadProgress) {
|
|
7426
|
+
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
7427
|
+
}
|
|
7428
|
+
return new Response(null, {
|
|
7429
|
+
status: response.status,
|
|
7430
|
+
statusText: response.statusText,
|
|
7431
|
+
headers: response.headers
|
|
7432
|
+
});
|
|
7433
|
+
}
|
|
7434
|
+
return new Response(new ReadableStream({
|
|
7435
|
+
async start(controller) {
|
|
7436
|
+
const reader = response.body.getReader();
|
|
7437
|
+
if (onDownloadProgress) {
|
|
7438
|
+
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
7439
|
+
}
|
|
7440
|
+
async function read() {
|
|
7441
|
+
const { done, value } = await reader.read();
|
|
7442
|
+
if (done) {
|
|
7443
|
+
controller.close();
|
|
7444
|
+
return;
|
|
7445
|
+
}
|
|
7446
|
+
if (onDownloadProgress) {
|
|
7447
|
+
transferredBytes += value.byteLength;
|
|
7448
|
+
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
7449
|
+
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
7450
|
+
}
|
|
7451
|
+
controller.enqueue(value);
|
|
7452
|
+
await read();
|
|
7453
|
+
}
|
|
7454
|
+
await read();
|
|
7455
|
+
}
|
|
7456
|
+
}), {
|
|
7457
|
+
status: response.status,
|
|
7458
|
+
statusText: response.statusText,
|
|
7459
|
+
headers: response.headers
|
|
7460
|
+
});
|
|
7461
|
+
};
|
|
7462
|
+
var streamRequest = (request, onUploadProgress) => {
|
|
7463
|
+
const totalBytes = getBodySize(request.body);
|
|
7464
|
+
let transferredBytes = 0;
|
|
7465
|
+
return new Request(request, {
|
|
7466
|
+
// @ts-expect-error - Types are outdated.
|
|
7467
|
+
duplex: "half",
|
|
7468
|
+
body: new ReadableStream({
|
|
7469
|
+
async start(controller) {
|
|
7470
|
+
const reader = request.body instanceof ReadableStream ? request.body.getReader() : new Response("").body.getReader();
|
|
7471
|
+
async function read() {
|
|
7472
|
+
const { done, value } = await reader.read();
|
|
7473
|
+
if (done) {
|
|
7474
|
+
if (onUploadProgress) {
|
|
7475
|
+
onUploadProgress({ percent: 1, transferredBytes, totalBytes: Math.max(totalBytes, transferredBytes) }, new Uint8Array());
|
|
7476
|
+
}
|
|
7477
|
+
controller.close();
|
|
7478
|
+
return;
|
|
7479
|
+
}
|
|
7480
|
+
transferredBytes += value.byteLength;
|
|
7481
|
+
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
7482
|
+
if (totalBytes < transferredBytes || percent === 1) {
|
|
7483
|
+
percent = 0.99;
|
|
7484
|
+
}
|
|
7485
|
+
if (onUploadProgress) {
|
|
7486
|
+
onUploadProgress({ percent: Number(percent.toFixed(2)), transferredBytes, totalBytes }, value);
|
|
7487
|
+
}
|
|
7488
|
+
controller.enqueue(value);
|
|
7489
|
+
await read();
|
|
7490
|
+
}
|
|
7491
|
+
await read();
|
|
7492
|
+
}
|
|
7493
|
+
})
|
|
7494
|
+
});
|
|
7495
|
+
};
|
|
7496
|
+
|
|
7497
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/merge.js
|
|
7498
|
+
init_cjs_shims();
|
|
7499
|
+
|
|
7500
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/is.js
|
|
7501
|
+
init_cjs_shims();
|
|
7502
|
+
var isObject3 = (value) => value !== null && typeof value === "object";
|
|
7503
|
+
|
|
7504
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/merge.js
|
|
7505
|
+
var validateAndMerge = (...sources) => {
|
|
7506
|
+
for (const source of sources) {
|
|
7507
|
+
if ((!isObject3(source) || Array.isArray(source)) && source !== void 0) {
|
|
7508
|
+
throw new TypeError("The `options` argument must be an object");
|
|
7509
|
+
}
|
|
7510
|
+
}
|
|
7511
|
+
return deepMerge({}, ...sources);
|
|
7512
|
+
};
|
|
7513
|
+
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
7514
|
+
const result = new globalThis.Headers(source1);
|
|
7515
|
+
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
7516
|
+
const source = new globalThis.Headers(source2);
|
|
7517
|
+
for (const [key, value] of source.entries()) {
|
|
7518
|
+
if (isHeadersInstance && value === "undefined" || value === void 0) {
|
|
7519
|
+
result.delete(key);
|
|
7520
|
+
} else {
|
|
7521
|
+
result.set(key, value);
|
|
7522
|
+
}
|
|
7523
|
+
}
|
|
7524
|
+
return result;
|
|
7525
|
+
};
|
|
7526
|
+
function newHookValue(original, incoming, property) {
|
|
7527
|
+
return Object.hasOwn(incoming, property) && incoming[property] === void 0 ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
7528
|
+
}
|
|
7529
|
+
var mergeHooks = (original = {}, incoming = {}) => ({
|
|
7530
|
+
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
7531
|
+
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
7532
|
+
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
7533
|
+
beforeError: newHookValue(original, incoming, "beforeError")
|
|
7534
|
+
});
|
|
7535
|
+
var deepMerge = (...sources) => {
|
|
7536
|
+
let returnValue = {};
|
|
7537
|
+
let headers = {};
|
|
7538
|
+
let hooks = {};
|
|
7539
|
+
for (const source of sources) {
|
|
7540
|
+
if (Array.isArray(source)) {
|
|
7541
|
+
if (!Array.isArray(returnValue)) {
|
|
7542
|
+
returnValue = [];
|
|
7543
|
+
}
|
|
7544
|
+
returnValue = [...returnValue, ...source];
|
|
7545
|
+
} else if (isObject3(source)) {
|
|
7546
|
+
for (let [key, value] of Object.entries(source)) {
|
|
7547
|
+
if (isObject3(value) && key in returnValue) {
|
|
7548
|
+
value = deepMerge(returnValue[key], value);
|
|
7549
|
+
}
|
|
7550
|
+
returnValue = { ...returnValue, [key]: value };
|
|
7551
|
+
}
|
|
7552
|
+
if (isObject3(source.hooks)) {
|
|
7553
|
+
hooks = mergeHooks(hooks, source.hooks);
|
|
7554
|
+
returnValue.hooks = hooks;
|
|
7555
|
+
}
|
|
7556
|
+
if (isObject3(source.headers)) {
|
|
7557
|
+
headers = mergeHeaders(headers, source.headers);
|
|
7558
|
+
returnValue.headers = headers;
|
|
7559
|
+
}
|
|
7560
|
+
}
|
|
7561
|
+
}
|
|
7562
|
+
return returnValue;
|
|
7563
|
+
};
|
|
7564
|
+
|
|
7565
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/normalize.js
|
|
7566
|
+
init_cjs_shims();
|
|
7449
7567
|
var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
7450
7568
|
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
7451
7569
|
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
@@ -7478,7 +7596,7 @@ var normalizeRetryOptions = (retry = {}) => {
|
|
|
7478
7596
|
};
|
|
7479
7597
|
};
|
|
7480
7598
|
|
|
7481
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7599
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/timeout.js
|
|
7482
7600
|
init_cjs_shims();
|
|
7483
7601
|
async function timeout(request, init, abortController, options) {
|
|
7484
7602
|
return new Promise((resolve, reject) => {
|
|
@@ -7494,7 +7612,7 @@ async function timeout(request, init, abortController, options) {
|
|
|
7494
7612
|
});
|
|
7495
7613
|
}
|
|
7496
7614
|
|
|
7497
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7615
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/delay.js
|
|
7498
7616
|
init_cjs_shims();
|
|
7499
7617
|
async function delay(ms, { signal }) {
|
|
7500
7618
|
return new Promise((resolve, reject) => {
|
|
@@ -7513,7 +7631,7 @@ async function delay(ms, { signal }) {
|
|
|
7513
7631
|
});
|
|
7514
7632
|
}
|
|
7515
7633
|
|
|
7516
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7634
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/utils/options.js
|
|
7517
7635
|
init_cjs_shims();
|
|
7518
7636
|
var findUnknownOptions = (request, options) => {
|
|
7519
7637
|
const unknownOptions = {};
|
|
@@ -7525,7 +7643,7 @@ var findUnknownOptions = (request, options) => {
|
|
|
7525
7643
|
return unknownOptions;
|
|
7526
7644
|
};
|
|
7527
7645
|
|
|
7528
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7646
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/core/Ky.js
|
|
7529
7647
|
var Ky = class _Ky {
|
|
7530
7648
|
static create(input, options) {
|
|
7531
7649
|
const ky2 = new _Ky(input, options);
|
|
@@ -7556,12 +7674,16 @@ var Ky = class _Ky {
|
|
|
7556
7674
|
if (!supportsResponseStreams) {
|
|
7557
7675
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
7558
7676
|
}
|
|
7559
|
-
return
|
|
7677
|
+
return streamResponse(response.clone(), ky2._options.onDownloadProgress);
|
|
7560
7678
|
}
|
|
7561
7679
|
return response;
|
|
7562
7680
|
};
|
|
7563
7681
|
const isRetriableMethod = ky2._options.retry.methods.includes(ky2.request.method.toLowerCase());
|
|
7564
|
-
const result = isRetriableMethod ? ky2._retry(function_) : function_()
|
|
7682
|
+
const result = (isRetriableMethod ? ky2._retry(function_) : function_()).finally(async () => {
|
|
7683
|
+
if (!ky2.request.bodyUsed) {
|
|
7684
|
+
await ky2.request.body?.cancel();
|
|
7685
|
+
}
|
|
7686
|
+
});
|
|
7565
7687
|
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
7566
7688
|
result[type] = async () => {
|
|
7567
7689
|
ky2.request.headers.set("accept", ky2.request.headers.get("accept") || mimeType);
|
|
@@ -7622,15 +7744,9 @@ var Ky = class _Ky {
|
|
|
7622
7744
|
this._input = this._options.prefixUrl + this._input;
|
|
7623
7745
|
}
|
|
7624
7746
|
if (supportsAbortController) {
|
|
7625
|
-
this.abortController = new globalThis.AbortController();
|
|
7626
7747
|
const originalSignal = this._options.signal ?? this._input.signal;
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
}
|
|
7630
|
-
originalSignal?.addEventListener("abort", () => {
|
|
7631
|
-
this.abortController.abort(originalSignal.reason);
|
|
7632
|
-
});
|
|
7633
|
-
this._options.signal = this.abortController.signal;
|
|
7748
|
+
this.abortController = new globalThis.AbortController();
|
|
7749
|
+
this._options.signal = originalSignal ? AbortSignal.any([originalSignal, this.abortController.signal]) : this.abortController.signal;
|
|
7634
7750
|
}
|
|
7635
7751
|
if (supportsRequestStreams) {
|
|
7636
7752
|
this._options.duplex = "half";
|
|
@@ -7649,6 +7765,18 @@ var Ky = class _Ky {
|
|
|
7649
7765
|
}
|
|
7650
7766
|
this.request = new globalThis.Request(new globalThis.Request(url, { ...this.request }), this._options);
|
|
7651
7767
|
}
|
|
7768
|
+
if (this._options.onUploadProgress) {
|
|
7769
|
+
if (typeof this._options.onUploadProgress !== "function") {
|
|
7770
|
+
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
7771
|
+
}
|
|
7772
|
+
if (!supportsRequestStreams) {
|
|
7773
|
+
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
7774
|
+
}
|
|
7775
|
+
const originalBody = this.request.body;
|
|
7776
|
+
if (originalBody) {
|
|
7777
|
+
this.request = streamRequest(this.request, this._options.onUploadProgress);
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
7652
7780
|
}
|
|
7653
7781
|
_calculateRetryDelay(error) {
|
|
7654
7782
|
this._retryCount++;
|
|
@@ -7725,51 +7853,9 @@ var Ky = class _Ky {
|
|
|
7725
7853
|
}
|
|
7726
7854
|
return timeout(mainRequest, nonRequestOptions, this.abortController, this._options);
|
|
7727
7855
|
}
|
|
7728
|
-
/* istanbul ignore next */
|
|
7729
|
-
_stream(response, onDownloadProgress) {
|
|
7730
|
-
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
7731
|
-
let transferredBytes = 0;
|
|
7732
|
-
if (response.status === 204) {
|
|
7733
|
-
if (onDownloadProgress) {
|
|
7734
|
-
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
7735
|
-
}
|
|
7736
|
-
return new globalThis.Response(null, {
|
|
7737
|
-
status: response.status,
|
|
7738
|
-
statusText: response.statusText,
|
|
7739
|
-
headers: response.headers
|
|
7740
|
-
});
|
|
7741
|
-
}
|
|
7742
|
-
return new globalThis.Response(new globalThis.ReadableStream({
|
|
7743
|
-
async start(controller) {
|
|
7744
|
-
const reader = response.body.getReader();
|
|
7745
|
-
if (onDownloadProgress) {
|
|
7746
|
-
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
7747
|
-
}
|
|
7748
|
-
async function read() {
|
|
7749
|
-
const { done, value } = await reader.read();
|
|
7750
|
-
if (done) {
|
|
7751
|
-
controller.close();
|
|
7752
|
-
return;
|
|
7753
|
-
}
|
|
7754
|
-
if (onDownloadProgress) {
|
|
7755
|
-
transferredBytes += value.byteLength;
|
|
7756
|
-
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
7757
|
-
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
7758
|
-
}
|
|
7759
|
-
controller.enqueue(value);
|
|
7760
|
-
await read();
|
|
7761
|
-
}
|
|
7762
|
-
await read();
|
|
7763
|
-
}
|
|
7764
|
-
}), {
|
|
7765
|
-
status: response.status,
|
|
7766
|
-
statusText: response.statusText,
|
|
7767
|
-
headers: response.headers
|
|
7768
|
-
});
|
|
7769
|
-
}
|
|
7770
7856
|
};
|
|
7771
7857
|
|
|
7772
|
-
// ../../node_modules/.pnpm/ky@1.
|
|
7858
|
+
// ../../node_modules/.pnpm/ky@1.8.1/node_modules/ky/distribution/index.js
|
|
7773
7859
|
var createInstance = (defaults) => {
|
|
7774
7860
|
const ky2 = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
7775
7861
|
for (const method of requestMethods) {
|