@powerlines/plugin-automd 0.1.237 → 0.1.239
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/chunk-BrXtsOCC.cjs +41 -0
- package/dist/{_virtual/rolldown_runtime.cjs → chunk-CS8OKu3y.mjs} +5 -2
- package/dist/dist-8g8frrZv.cjs +246 -0
- package/dist/dist-BavrV299.cjs +682 -0
- package/dist/dist-DVv98dZY.cjs +87 -0
- package/dist/dist-Jfd0GR_C.mjs +223 -0
- package/dist/dist-Jfd0GR_C.mjs.map +1 -0
- package/dist/dist-PRh64A_O.mjs +70 -0
- package/dist/dist-PRh64A_O.mjs.map +1 -0
- package/dist/dist-PXnBmevt.mjs +681 -0
- package/dist/dist-PXnBmevt.mjs.map +1 -0
- package/dist/index-B8OHl-c_.d.mts +1 -0
- package/dist/index-CmCelmEL.d.cts +1 -0
- package/dist/index.cjs +9607 -15
- package/dist/index.d.cts +5 -4
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +9600 -12
- package/dist/index.mjs.map +1 -0
- package/dist/loader-BRhKFmUn.mjs +58373 -0
- package/dist/loader-BRhKFmUn.mjs.map +1 -0
- package/dist/loader-DNEbMIIe.cjs +58372 -0
- package/dist/multipart-parser-C_EjwsED.cjs +178 -0
- package/dist/multipart-parser-CglOohoL.mjs +179 -0
- package/dist/multipart-parser-CglOohoL.mjs.map +1 -0
- package/dist/node-CsMhpAoX.cjs +269 -0
- package/dist/node-DapIDpAC.cjs +4024 -0
- package/dist/node-Du1vi9nA.mjs +3974 -0
- package/dist/node-Du1vi9nA.mjs.map +1 -0
- package/dist/node-d_BpkPSt.mjs +267 -0
- package/dist/node-d_BpkPSt.mjs.map +1 -0
- package/dist/plugin-BVD0UMjp.d.cts +52 -0
- package/dist/plugin-BVD0UMjp.d.cts.map +1 -0
- package/dist/plugin-C6jB5e_j.d.mts +52 -0
- package/dist/plugin-C6jB5e_j.d.mts.map +1 -0
- package/dist/plugin-Ckx8qAq8.cjs +0 -0
- package/dist/plugin-jZ9N9Mz-.mjs +1 -0
- package/dist/toc-BN2Ji9Yo.d.mts +35 -0
- package/dist/toc-BN2Ji9Yo.d.mts.map +1 -0
- package/dist/toc-BQgoCyR1.cjs +0 -0
- package/dist/toc-BrayIFG6.d.cts +35 -0
- package/dist/toc-BrayIFG6.d.cts.map +1 -0
- package/dist/toc-CBjybXug.mjs +1 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +2 -50
- package/dist/types/plugin.d.mts +2 -50
- package/dist/types/plugin.mjs +2 -0
- package/dist/types/toc.cjs +1 -0
- package/dist/types/toc.d.cts +1 -33
- package/dist/types/toc.d.mts +1 -33
- package/dist/types/toc.mjs +2 -0
- package/dist/types--fVOUYBq.mjs +1 -0
- package/dist/types-D208vOSb.cjs +0 -0
- package/package.json +4 -4
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
const require_node = require('./node-DapIDpAC.cjs');
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
let node_url = require("node:url");
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
let node_util = require("node:util");
|
|
6
|
+
let node_http = require("node:http");
|
|
7
|
+
let node_https = require("node:https");
|
|
8
|
+
let node_zlib = require("node:zlib");
|
|
9
|
+
let node_stream = require("node:stream");
|
|
10
|
+
let node_buffer = require("node:buffer");
|
|
11
|
+
let node_net = require("node:net");
|
|
12
|
+
|
|
13
|
+
//#region ../../node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs
|
|
14
|
+
var B = Object.defineProperty;
|
|
15
|
+
var E = (u, a) => B(u, "name", {
|
|
16
|
+
value: a,
|
|
17
|
+
configurable: !0
|
|
18
|
+
});
|
|
19
|
+
let D = 0;
|
|
20
|
+
const t = {
|
|
21
|
+
START_BOUNDARY: D++,
|
|
22
|
+
HEADER_FIELD_START: D++,
|
|
23
|
+
HEADER_FIELD: D++,
|
|
24
|
+
HEADER_VALUE_START: D++,
|
|
25
|
+
HEADER_VALUE: D++,
|
|
26
|
+
HEADER_VALUE_ALMOST_DONE: D++,
|
|
27
|
+
HEADERS_ALMOST_DONE: D++,
|
|
28
|
+
PART_DATA_START: D++,
|
|
29
|
+
PART_DATA: D++,
|
|
30
|
+
END: D++
|
|
31
|
+
};
|
|
32
|
+
let w = 1;
|
|
33
|
+
const R = {
|
|
34
|
+
PART_BOUNDARY: w,
|
|
35
|
+
LAST_BOUNDARY: w *= 2
|
|
36
|
+
}, g = 10, N = 13, x = 32, P = 45, C = 58, I = 97, M = 122, $ = E((u) => u | 32, "lower"), m = E(() => {}, "noop"), F = class F$1 {
|
|
37
|
+
constructor(a) {
|
|
38
|
+
this.index = 0, this.flags = 0, this.onHeaderEnd = m, this.onHeaderField = m, this.onHeadersEnd = m, this.onHeaderValue = m, this.onPartBegin = m, this.onPartData = m, this.onPartEnd = m, this.boundaryChars = {}, a = `\r
|
|
39
|
+
--` + a;
|
|
40
|
+
const n = new Uint8Array(a.length);
|
|
41
|
+
for (let r = 0; r < a.length; r++) n[r] = a.charCodeAt(r), this.boundaryChars[n[r]] = !0;
|
|
42
|
+
this.boundary = n, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = t.START_BOUNDARY;
|
|
43
|
+
}
|
|
44
|
+
write(a) {
|
|
45
|
+
let n = 0;
|
|
46
|
+
const r = a.length;
|
|
47
|
+
let d = this.index, { lookbehind: l, boundary: c, boundaryChars: p, index: e, state: i, flags: A } = this;
|
|
48
|
+
const H = this.boundary.length, O = H - 1, y = a.length;
|
|
49
|
+
let o, L;
|
|
50
|
+
const f = E((h) => {
|
|
51
|
+
this[h + "Mark"] = n;
|
|
52
|
+
}, "mark"), s = E((h) => {
|
|
53
|
+
delete this[h + "Mark"];
|
|
54
|
+
}, "clear"), T = E((h, S, _, U) => {
|
|
55
|
+
(S === void 0 || S !== _) && this[h](U && U.subarray(S, _));
|
|
56
|
+
}, "callback"), b = E((h, S) => {
|
|
57
|
+
const _ = h + "Mark";
|
|
58
|
+
_ in this && (S ? (T(h, this[_], n, a), delete this[_]) : (T(h, this[_], a.length, a), this[_] = 0));
|
|
59
|
+
}, "dataCallback");
|
|
60
|
+
for (n = 0; n < r; n++) switch (o = a[n], i) {
|
|
61
|
+
case t.START_BOUNDARY:
|
|
62
|
+
if (e === c.length - 2) {
|
|
63
|
+
if (o === P) A |= R.LAST_BOUNDARY;
|
|
64
|
+
else if (o !== N) return;
|
|
65
|
+
e++;
|
|
66
|
+
break;
|
|
67
|
+
} else if (e - 1 === c.length - 2) {
|
|
68
|
+
if (A & R.LAST_BOUNDARY && o === P) i = t.END, A = 0;
|
|
69
|
+
else if (!(A & R.LAST_BOUNDARY) && o === g) e = 0, T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
70
|
+
else return;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
o !== c[e + 2] && (e = -2), o === c[e + 2] && e++;
|
|
74
|
+
break;
|
|
75
|
+
case t.HEADER_FIELD_START: i = t.HEADER_FIELD, f("onHeaderField"), e = 0;
|
|
76
|
+
case t.HEADER_FIELD:
|
|
77
|
+
if (o === N) {
|
|
78
|
+
s("onHeaderField"), i = t.HEADERS_ALMOST_DONE;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
if (e++, o === P) break;
|
|
82
|
+
if (o === C) {
|
|
83
|
+
if (e === 1) return;
|
|
84
|
+
b("onHeaderField", !0), i = t.HEADER_VALUE_START;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (L = $(o), L < I || L > M) return;
|
|
88
|
+
break;
|
|
89
|
+
case t.HEADER_VALUE_START:
|
|
90
|
+
if (o === x) break;
|
|
91
|
+
f("onHeaderValue"), i = t.HEADER_VALUE;
|
|
92
|
+
case t.HEADER_VALUE:
|
|
93
|
+
o === N && (b("onHeaderValue", !0), T("onHeaderEnd"), i = t.HEADER_VALUE_ALMOST_DONE);
|
|
94
|
+
break;
|
|
95
|
+
case t.HEADER_VALUE_ALMOST_DONE:
|
|
96
|
+
if (o !== g) return;
|
|
97
|
+
i = t.HEADER_FIELD_START;
|
|
98
|
+
break;
|
|
99
|
+
case t.HEADERS_ALMOST_DONE:
|
|
100
|
+
if (o !== g) return;
|
|
101
|
+
T("onHeadersEnd"), i = t.PART_DATA_START;
|
|
102
|
+
break;
|
|
103
|
+
case t.PART_DATA_START: i = t.PART_DATA, f("onPartData");
|
|
104
|
+
case t.PART_DATA:
|
|
105
|
+
if (d = e, e === 0) {
|
|
106
|
+
for (n += O; n < y && !(a[n] in p);) n += H;
|
|
107
|
+
n -= O, o = a[n];
|
|
108
|
+
}
|
|
109
|
+
if (e < c.length) c[e] === o ? (e === 0 && b("onPartData", !0), e++) : e = 0;
|
|
110
|
+
else if (e === c.length) e++, o === N ? A |= R.PART_BOUNDARY : o === P ? A |= R.LAST_BOUNDARY : e = 0;
|
|
111
|
+
else if (e - 1 === c.length) if (A & R.PART_BOUNDARY) {
|
|
112
|
+
if (e = 0, o === g) {
|
|
113
|
+
A &= ~R.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
} else A & R.LAST_BOUNDARY && o === P ? (T("onPartEnd"), i = t.END, A = 0) : e = 0;
|
|
117
|
+
if (e > 0) l[e - 1] = o;
|
|
118
|
+
else if (d > 0) {
|
|
119
|
+
const h = new Uint8Array(l.buffer, l.byteOffset, l.byteLength);
|
|
120
|
+
T("onPartData", 0, d, h), d = 0, f("onPartData"), n--;
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
case t.END: break;
|
|
124
|
+
default: throw new Error(`Unexpected state entered: ${i}`);
|
|
125
|
+
}
|
|
126
|
+
b("onHeaderField"), b("onHeaderValue"), b("onPartData"), this.index = e, this.state = i, this.flags = A;
|
|
127
|
+
}
|
|
128
|
+
end() {
|
|
129
|
+
if (this.state === t.HEADER_FIELD_START && this.index === 0 || this.state === t.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
|
|
130
|
+
else if (this.state !== t.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
E(F, "MultipartParser");
|
|
134
|
+
let k = F;
|
|
135
|
+
function v(u) {
|
|
136
|
+
const a = u.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
137
|
+
if (!a) return;
|
|
138
|
+
const n = a[2] || a[3] || "";
|
|
139
|
+
let r = n.slice(n.lastIndexOf("\\") + 1);
|
|
140
|
+
return r = r.replace(/%22/g, "\""), r = r.replace(/&#(\d{4});/g, (d, l) => String.fromCharCode(l)), r;
|
|
141
|
+
}
|
|
142
|
+
E(v, "_fileName");
|
|
143
|
+
async function Z(u, a) {
|
|
144
|
+
if (!/multipart/i.test(a)) throw new TypeError("Failed to fetch");
|
|
145
|
+
const n = a.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
146
|
+
if (!n) throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
147
|
+
const r = new k(n[1] || n[2]);
|
|
148
|
+
let d, l, c, p, e, i;
|
|
149
|
+
const A = [], H = new require_node.br(), O = E((s) => {
|
|
150
|
+
c += f.decode(s, { stream: !0 });
|
|
151
|
+
}, "onPartData"), y = E((s) => {
|
|
152
|
+
A.push(s);
|
|
153
|
+
}, "appendToFile"), o = E(() => {
|
|
154
|
+
const s = new require_node.qn(A, i, { type: e });
|
|
155
|
+
H.append(p, s);
|
|
156
|
+
}, "appendFileToFormData"), L = E(() => {
|
|
157
|
+
H.append(p, c);
|
|
158
|
+
}, "appendEntryToFormData"), f = new TextDecoder("utf-8");
|
|
159
|
+
f.decode(), r.onPartBegin = function() {
|
|
160
|
+
r.onPartData = O, r.onPartEnd = L, d = "", l = "", c = "", p = "", e = "", i = null, A.length = 0;
|
|
161
|
+
}, r.onHeaderField = function(s) {
|
|
162
|
+
d += f.decode(s, { stream: !0 });
|
|
163
|
+
}, r.onHeaderValue = function(s) {
|
|
164
|
+
l += f.decode(s, { stream: !0 });
|
|
165
|
+
}, r.onHeaderEnd = function() {
|
|
166
|
+
if (l += f.decode(), d = d.toLowerCase(), d === "content-disposition") {
|
|
167
|
+
const s = l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
168
|
+
s && (p = s[2] || s[3] || ""), i = v(l), i && (r.onPartData = y, r.onPartEnd = o);
|
|
169
|
+
} else d === "content-type" && (e = l);
|
|
170
|
+
l = "", d = "";
|
|
171
|
+
};
|
|
172
|
+
for await (const s of u) r.write(s);
|
|
173
|
+
return r.end(), H;
|
|
174
|
+
}
|
|
175
|
+
E(Z, "toFormData");
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
exports.toFormData = Z;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { o as qn, r as br } from "./node-Du1vi9nA.mjs";
|
|
2
|
+
import "node:fs";
|
|
3
|
+
import "node:url";
|
|
4
|
+
import "node:path";
|
|
5
|
+
import "node:util";
|
|
6
|
+
import "node:http";
|
|
7
|
+
import "node:https";
|
|
8
|
+
import "node:zlib";
|
|
9
|
+
import "node:stream";
|
|
10
|
+
import "node:buffer";
|
|
11
|
+
import "node:net";
|
|
12
|
+
|
|
13
|
+
//#region ../../node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs
|
|
14
|
+
var B = Object.defineProperty;
|
|
15
|
+
var E = (u, a) => B(u, "name", {
|
|
16
|
+
value: a,
|
|
17
|
+
configurable: !0
|
|
18
|
+
});
|
|
19
|
+
let D = 0;
|
|
20
|
+
const t = {
|
|
21
|
+
START_BOUNDARY: D++,
|
|
22
|
+
HEADER_FIELD_START: D++,
|
|
23
|
+
HEADER_FIELD: D++,
|
|
24
|
+
HEADER_VALUE_START: D++,
|
|
25
|
+
HEADER_VALUE: D++,
|
|
26
|
+
HEADER_VALUE_ALMOST_DONE: D++,
|
|
27
|
+
HEADERS_ALMOST_DONE: D++,
|
|
28
|
+
PART_DATA_START: D++,
|
|
29
|
+
PART_DATA: D++,
|
|
30
|
+
END: D++
|
|
31
|
+
};
|
|
32
|
+
let w = 1;
|
|
33
|
+
const R = {
|
|
34
|
+
PART_BOUNDARY: w,
|
|
35
|
+
LAST_BOUNDARY: w *= 2
|
|
36
|
+
}, g = 10, N = 13, x = 32, P = 45, C = 58, I = 97, M = 122, $ = E((u) => u | 32, "lower"), m = E(() => {}, "noop"), F = class F$1 {
|
|
37
|
+
constructor(a) {
|
|
38
|
+
this.index = 0, this.flags = 0, this.onHeaderEnd = m, this.onHeaderField = m, this.onHeadersEnd = m, this.onHeaderValue = m, this.onPartBegin = m, this.onPartData = m, this.onPartEnd = m, this.boundaryChars = {}, a = `\r
|
|
39
|
+
--` + a;
|
|
40
|
+
const n = new Uint8Array(a.length);
|
|
41
|
+
for (let r = 0; r < a.length; r++) n[r] = a.charCodeAt(r), this.boundaryChars[n[r]] = !0;
|
|
42
|
+
this.boundary = n, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = t.START_BOUNDARY;
|
|
43
|
+
}
|
|
44
|
+
write(a) {
|
|
45
|
+
let n = 0;
|
|
46
|
+
const r = a.length;
|
|
47
|
+
let d = this.index, { lookbehind: l, boundary: c, boundaryChars: p, index: e, state: i, flags: A } = this;
|
|
48
|
+
const H = this.boundary.length, O = H - 1, y = a.length;
|
|
49
|
+
let o, L;
|
|
50
|
+
const f = E((h) => {
|
|
51
|
+
this[h + "Mark"] = n;
|
|
52
|
+
}, "mark"), s = E((h) => {
|
|
53
|
+
delete this[h + "Mark"];
|
|
54
|
+
}, "clear"), T = E((h, S, _, U) => {
|
|
55
|
+
(S === void 0 || S !== _) && this[h](U && U.subarray(S, _));
|
|
56
|
+
}, "callback"), b = E((h, S) => {
|
|
57
|
+
const _ = h + "Mark";
|
|
58
|
+
_ in this && (S ? (T(h, this[_], n, a), delete this[_]) : (T(h, this[_], a.length, a), this[_] = 0));
|
|
59
|
+
}, "dataCallback");
|
|
60
|
+
for (n = 0; n < r; n++) switch (o = a[n], i) {
|
|
61
|
+
case t.START_BOUNDARY:
|
|
62
|
+
if (e === c.length - 2) {
|
|
63
|
+
if (o === P) A |= R.LAST_BOUNDARY;
|
|
64
|
+
else if (o !== N) return;
|
|
65
|
+
e++;
|
|
66
|
+
break;
|
|
67
|
+
} else if (e - 1 === c.length - 2) {
|
|
68
|
+
if (A & R.LAST_BOUNDARY && o === P) i = t.END, A = 0;
|
|
69
|
+
else if (!(A & R.LAST_BOUNDARY) && o === g) e = 0, T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
70
|
+
else return;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
o !== c[e + 2] && (e = -2), o === c[e + 2] && e++;
|
|
74
|
+
break;
|
|
75
|
+
case t.HEADER_FIELD_START: i = t.HEADER_FIELD, f("onHeaderField"), e = 0;
|
|
76
|
+
case t.HEADER_FIELD:
|
|
77
|
+
if (o === N) {
|
|
78
|
+
s("onHeaderField"), i = t.HEADERS_ALMOST_DONE;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
if (e++, o === P) break;
|
|
82
|
+
if (o === C) {
|
|
83
|
+
if (e === 1) return;
|
|
84
|
+
b("onHeaderField", !0), i = t.HEADER_VALUE_START;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (L = $(o), L < I || L > M) return;
|
|
88
|
+
break;
|
|
89
|
+
case t.HEADER_VALUE_START:
|
|
90
|
+
if (o === x) break;
|
|
91
|
+
f("onHeaderValue"), i = t.HEADER_VALUE;
|
|
92
|
+
case t.HEADER_VALUE:
|
|
93
|
+
o === N && (b("onHeaderValue", !0), T("onHeaderEnd"), i = t.HEADER_VALUE_ALMOST_DONE);
|
|
94
|
+
break;
|
|
95
|
+
case t.HEADER_VALUE_ALMOST_DONE:
|
|
96
|
+
if (o !== g) return;
|
|
97
|
+
i = t.HEADER_FIELD_START;
|
|
98
|
+
break;
|
|
99
|
+
case t.HEADERS_ALMOST_DONE:
|
|
100
|
+
if (o !== g) return;
|
|
101
|
+
T("onHeadersEnd"), i = t.PART_DATA_START;
|
|
102
|
+
break;
|
|
103
|
+
case t.PART_DATA_START: i = t.PART_DATA, f("onPartData");
|
|
104
|
+
case t.PART_DATA:
|
|
105
|
+
if (d = e, e === 0) {
|
|
106
|
+
for (n += O; n < y && !(a[n] in p);) n += H;
|
|
107
|
+
n -= O, o = a[n];
|
|
108
|
+
}
|
|
109
|
+
if (e < c.length) c[e] === o ? (e === 0 && b("onPartData", !0), e++) : e = 0;
|
|
110
|
+
else if (e === c.length) e++, o === N ? A |= R.PART_BOUNDARY : o === P ? A |= R.LAST_BOUNDARY : e = 0;
|
|
111
|
+
else if (e - 1 === c.length) if (A & R.PART_BOUNDARY) {
|
|
112
|
+
if (e = 0, o === g) {
|
|
113
|
+
A &= ~R.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
} else A & R.LAST_BOUNDARY && o === P ? (T("onPartEnd"), i = t.END, A = 0) : e = 0;
|
|
117
|
+
if (e > 0) l[e - 1] = o;
|
|
118
|
+
else if (d > 0) {
|
|
119
|
+
const h = new Uint8Array(l.buffer, l.byteOffset, l.byteLength);
|
|
120
|
+
T("onPartData", 0, d, h), d = 0, f("onPartData"), n--;
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
case t.END: break;
|
|
124
|
+
default: throw new Error(`Unexpected state entered: ${i}`);
|
|
125
|
+
}
|
|
126
|
+
b("onHeaderField"), b("onHeaderValue"), b("onPartData"), this.index = e, this.state = i, this.flags = A;
|
|
127
|
+
}
|
|
128
|
+
end() {
|
|
129
|
+
if (this.state === t.HEADER_FIELD_START && this.index === 0 || this.state === t.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
|
|
130
|
+
else if (this.state !== t.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
E(F, "MultipartParser");
|
|
134
|
+
let k = F;
|
|
135
|
+
function v(u) {
|
|
136
|
+
const a = u.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
137
|
+
if (!a) return;
|
|
138
|
+
const n = a[2] || a[3] || "";
|
|
139
|
+
let r = n.slice(n.lastIndexOf("\\") + 1);
|
|
140
|
+
return r = r.replace(/%22/g, "\""), r = r.replace(/&#(\d{4});/g, (d, l) => String.fromCharCode(l)), r;
|
|
141
|
+
}
|
|
142
|
+
E(v, "_fileName");
|
|
143
|
+
async function Z(u, a) {
|
|
144
|
+
if (!/multipart/i.test(a)) throw new TypeError("Failed to fetch");
|
|
145
|
+
const n = a.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
146
|
+
if (!n) throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
147
|
+
const r = new k(n[1] || n[2]);
|
|
148
|
+
let d, l, c, p, e, i;
|
|
149
|
+
const A = [], H = new br(), O = E((s) => {
|
|
150
|
+
c += f.decode(s, { stream: !0 });
|
|
151
|
+
}, "onPartData"), y = E((s) => {
|
|
152
|
+
A.push(s);
|
|
153
|
+
}, "appendToFile"), o = E(() => {
|
|
154
|
+
const s = new qn(A, i, { type: e });
|
|
155
|
+
H.append(p, s);
|
|
156
|
+
}, "appendFileToFormData"), L = E(() => {
|
|
157
|
+
H.append(p, c);
|
|
158
|
+
}, "appendEntryToFormData"), f = new TextDecoder("utf-8");
|
|
159
|
+
f.decode(), r.onPartBegin = function() {
|
|
160
|
+
r.onPartData = O, r.onPartEnd = L, d = "", l = "", c = "", p = "", e = "", i = null, A.length = 0;
|
|
161
|
+
}, r.onHeaderField = function(s) {
|
|
162
|
+
d += f.decode(s, { stream: !0 });
|
|
163
|
+
}, r.onHeaderValue = function(s) {
|
|
164
|
+
l += f.decode(s, { stream: !0 });
|
|
165
|
+
}, r.onHeaderEnd = function() {
|
|
166
|
+
if (l += f.decode(), d = d.toLowerCase(), d === "content-disposition") {
|
|
167
|
+
const s = l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
168
|
+
s && (p = s[2] || s[3] || ""), i = v(l), i && (r.onPartData = y, r.onPartEnd = o);
|
|
169
|
+
} else d === "content-type" && (e = l);
|
|
170
|
+
l = "", d = "";
|
|
171
|
+
};
|
|
172
|
+
for await (const s of u) r.write(s);
|
|
173
|
+
return r.end(), H;
|
|
174
|
+
}
|
|
175
|
+
E(Z, "toFormData");
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
export { Z as toFormData };
|
|
179
|
+
//# sourceMappingURL=multipart-parser-CglOohoL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multipart-parser-CglOohoL.mjs","names":["F","V","Y"],"sources":["../../../node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs"],"sourcesContent":["var B=Object.defineProperty;var E=(u,a)=>B(u,\"name\",{value:a,configurable:!0});import{FormData as V,File as Y}from\"../node.mjs\";import\"node:http\";import\"node:https\";import\"node:zlib\";import\"node:stream\";import\"node:buffer\";import\"node:util\";import\"../shared/node-fetch-native.DfbY2q-x.mjs\";import\"node:url\";import\"node:net\";import\"node:fs\";import\"node:path\";let D=0;const t={START_BOUNDARY:D++,HEADER_FIELD_START:D++,HEADER_FIELD:D++,HEADER_VALUE_START:D++,HEADER_VALUE:D++,HEADER_VALUE_ALMOST_DONE:D++,HEADERS_ALMOST_DONE:D++,PART_DATA_START:D++,PART_DATA:D++,END:D++};let w=1;const R={PART_BOUNDARY:w,LAST_BOUNDARY:w*=2},g=10,N=13,x=32,P=45,C=58,I=97,M=122,$=E(u=>u|32,\"lower\"),m=E(()=>{},\"noop\"),F=class F{constructor(a){this.index=0,this.flags=0,this.onHeaderEnd=m,this.onHeaderField=m,this.onHeadersEnd=m,this.onHeaderValue=m,this.onPartBegin=m,this.onPartData=m,this.onPartEnd=m,this.boundaryChars={},a=`\\r\n--`+a;const n=new Uint8Array(a.length);for(let r=0;r<a.length;r++)n[r]=a.charCodeAt(r),this.boundaryChars[n[r]]=!0;this.boundary=n,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=t.START_BOUNDARY}write(a){let n=0;const r=a.length;let d=this.index,{lookbehind:l,boundary:c,boundaryChars:p,index:e,state:i,flags:A}=this;const H=this.boundary.length,O=H-1,y=a.length;let o,L;const f=E(h=>{this[h+\"Mark\"]=n},\"mark\"),s=E(h=>{delete this[h+\"Mark\"]},\"clear\"),T=E((h,S,_,U)=>{(S===void 0||S!==_)&&this[h](U&&U.subarray(S,_))},\"callback\"),b=E((h,S)=>{const _=h+\"Mark\";_ in this&&(S?(T(h,this[_],n,a),delete this[_]):(T(h,this[_],a.length,a),this[_]=0))},\"dataCallback\");for(n=0;n<r;n++)switch(o=a[n],i){case t.START_BOUNDARY:if(e===c.length-2){if(o===P)A|=R.LAST_BOUNDARY;else if(o!==N)return;e++;break}else if(e-1===c.length-2){if(A&R.LAST_BOUNDARY&&o===P)i=t.END,A=0;else if(!(A&R.LAST_BOUNDARY)&&o===g)e=0,T(\"onPartBegin\"),i=t.HEADER_FIELD_START;else return;break}o!==c[e+2]&&(e=-2),o===c[e+2]&&e++;break;case t.HEADER_FIELD_START:i=t.HEADER_FIELD,f(\"onHeaderField\"),e=0;case t.HEADER_FIELD:if(o===N){s(\"onHeaderField\"),i=t.HEADERS_ALMOST_DONE;break}if(e++,o===P)break;if(o===C){if(e===1)return;b(\"onHeaderField\",!0),i=t.HEADER_VALUE_START;break}if(L=$(o),L<I||L>M)return;break;case t.HEADER_VALUE_START:if(o===x)break;f(\"onHeaderValue\"),i=t.HEADER_VALUE;case t.HEADER_VALUE:o===N&&(b(\"onHeaderValue\",!0),T(\"onHeaderEnd\"),i=t.HEADER_VALUE_ALMOST_DONE);break;case t.HEADER_VALUE_ALMOST_DONE:if(o!==g)return;i=t.HEADER_FIELD_START;break;case t.HEADERS_ALMOST_DONE:if(o!==g)return;T(\"onHeadersEnd\"),i=t.PART_DATA_START;break;case t.PART_DATA_START:i=t.PART_DATA,f(\"onPartData\");case t.PART_DATA:if(d=e,e===0){for(n+=O;n<y&&!(a[n]in p);)n+=H;n-=O,o=a[n]}if(e<c.length)c[e]===o?(e===0&&b(\"onPartData\",!0),e++):e=0;else if(e===c.length)e++,o===N?A|=R.PART_BOUNDARY:o===P?A|=R.LAST_BOUNDARY:e=0;else if(e-1===c.length)if(A&R.PART_BOUNDARY){if(e=0,o===g){A&=~R.PART_BOUNDARY,T(\"onPartEnd\"),T(\"onPartBegin\"),i=t.HEADER_FIELD_START;break}}else A&R.LAST_BOUNDARY&&o===P?(T(\"onPartEnd\"),i=t.END,A=0):e=0;if(e>0)l[e-1]=o;else if(d>0){const h=new Uint8Array(l.buffer,l.byteOffset,l.byteLength);T(\"onPartData\",0,d,h),d=0,f(\"onPartData\"),n--}break;case t.END:break;default:throw new Error(`Unexpected state entered: ${i}`)}b(\"onHeaderField\"),b(\"onHeaderValue\"),b(\"onPartData\"),this.index=e,this.state=i,this.flags=A}end(){if(this.state===t.HEADER_FIELD_START&&this.index===0||this.state===t.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==t.END)throw new Error(\"MultipartParser.end(): stream ended unexpectedly\")}};E(F,\"MultipartParser\");let k=F;function v(u){const a=u.match(/\\bfilename=(\"(.*?)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))($|;\\s)/i);if(!a)return;const n=a[2]||a[3]||\"\";let r=n.slice(n.lastIndexOf(\"\\\\\")+1);return r=r.replace(/%22/g,'\"'),r=r.replace(/&#(\\d{4});/g,(d,l)=>String.fromCharCode(l)),r}E(v,\"_fileName\");async function Z(u,a){if(!/multipart/i.test(a))throw new TypeError(\"Failed to fetch\");const n=a.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);if(!n)throw new TypeError(\"no or bad content-type header, no multipart boundary\");const r=new k(n[1]||n[2]);let d,l,c,p,e,i;const A=[],H=new V,O=E(s=>{c+=f.decode(s,{stream:!0})},\"onPartData\"),y=E(s=>{A.push(s)},\"appendToFile\"),o=E(()=>{const s=new Y(A,i,{type:e});H.append(p,s)},\"appendFileToFormData\"),L=E(()=>{H.append(p,c)},\"appendEntryToFormData\"),f=new TextDecoder(\"utf-8\");f.decode(),r.onPartBegin=function(){r.onPartData=O,r.onPartEnd=L,d=\"\",l=\"\",c=\"\",p=\"\",e=\"\",i=null,A.length=0},r.onHeaderField=function(s){d+=f.decode(s,{stream:!0})},r.onHeaderValue=function(s){l+=f.decode(s,{stream:!0})},r.onHeaderEnd=function(){if(l+=f.decode(),d=d.toLowerCase(),d===\"content-disposition\"){const s=l.match(/\\bname=(\"([^\"]*)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))/i);s&&(p=s[2]||s[3]||\"\"),i=v(l),i&&(r.onPartData=y,r.onPartEnd=o)}else d===\"content-type\"&&(e=l);l=\"\",d=\"\"};for await(const s of u)r.write(s);return r.end(),H}E(Z,\"toFormData\");export{Z as toFormData};\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;AAAA,IAAI,IAAE,OAAO;AAAe,IAAI,KAAG,GAAE,MAAI,EAAE,GAAE,QAAO;CAAC,OAAM;CAAE,cAAa,CAAC;CAAE,CAAC;AAAwR,IAAI,IAAE;AAAE,MAAM,IAAE;CAAC,gBAAe;CAAI,oBAAmB;CAAI,cAAa;CAAI,oBAAmB;CAAI,cAAa;CAAI,0BAAyB;CAAI,qBAAoB;CAAI,iBAAgB;CAAI,WAAU;CAAI,KAAI;CAAI;AAAC,IAAI,IAA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,OAAO,GAAE,EAAE;IAAE,wBAAwB,EAAC,IAAE,IAAI,YAAY,QAAQ;AAAC,GAAE,QAAQ,EAAC,EAAE,cAAY,WAAU;AAAC,IAAE,aAAW,GAAE,EAAE,YAAU,GAAE,IAAE,IAAG,IAAE,IAAG,IAAE,IAAG,IAAE,IAAG,IAAE,IAAG,IAAE,MAAK,EAAE,SAAO;IAAG,EAAE,gBAAc,SAAS,GAAE;AAAC,OAAG,EAAE,OAAO,GAAE,EAAC,QAAO,CAAC,GAAE,CAAC;IAAE,EAAE,gBAAc,SAAS,GAAE;AAAC,OAAG,EAAE,OAAO,GAAE,EAAC,QAAO,CAAC,GAAE,CAAC;IAAE,EAAE,cAAY,WAAU;AAAC,MAAG,KAAG,EAAE,QAAQ,EAAC,IAAE,EAAE,aAAa,EAAC,MAAI,uBAAsB;GAAC,MAAM,IAAE,EAAE,MAAM,oDAAoD;AAAC,SAAI,IAAE,EAAE,MAAI,EAAE,MAAI,KAAI,IAAE,EAAE,EAAE,EAAC,MAAI,EAAE,aAAW,GAAE,EAAE,YAAU;QAAQ,OAAI,mBAAiB,IAAE;AAAG,MAAE,IAAG,IAAE;;AAAI,YAAU,MAAM,KAAK,EAAE,GAAE,MAAM,EAAE;AAAC,QAAO,EAAE,KAAK,EAAC;;AAAE,EAAE,GAAE,aAAa"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-BrXtsOCC.cjs');
|
|
2
|
+
const require_dist = require('./dist-8g8frrZv.cjs');
|
|
3
|
+
const require_node = require('./node-DapIDpAC.cjs');
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
let node_url = require("node:url");
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
let node_util = require("node:util");
|
|
8
|
+
let node_http = require("node:http");
|
|
9
|
+
node_http = require_chunk.__toESM(node_http);
|
|
10
|
+
let node_https = require("node:https");
|
|
11
|
+
node_https = require_chunk.__toESM(node_https);
|
|
12
|
+
let node_zlib = require("node:zlib");
|
|
13
|
+
let node_stream = require("node:stream");
|
|
14
|
+
let node_buffer = require("node:buffer");
|
|
15
|
+
let node_net = require("node:net");
|
|
16
|
+
|
|
17
|
+
//#region ../../node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs
|
|
18
|
+
const o = !!globalThis.process?.env?.FORCE_NODE_FETCH, r = !o && globalThis.fetch || require_node.Mi, p = !o && globalThis.Blob || require_node.ut, F = !o && globalThis.File || require_node.qn, h = !o && globalThis.FormData || require_node.br, n = !o && globalThis.Headers || require_node.ye, c = !o && globalThis.Request || require_node.dt, R = !o && globalThis.Response || require_node.le, T = !o && globalThis.AbortController || require_node.Mn;
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ../../node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs
|
|
22
|
+
var FetchError = class extends Error {
|
|
23
|
+
constructor(message, opts) {
|
|
24
|
+
super(message, opts);
|
|
25
|
+
this.name = "FetchError";
|
|
26
|
+
if (opts?.cause && !this.cause) this.cause = opts.cause;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function createFetchError(ctx) {
|
|
30
|
+
const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
|
|
31
|
+
const method = ctx.request?.method || ctx.options?.method || "GET";
|
|
32
|
+
const url = ctx.request?.url || String(ctx.request) || "/";
|
|
33
|
+
const fetchError = new FetchError(`${`[${method}] ${JSON.stringify(url)}`}: ${ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>"}${errorMessage ? ` ${errorMessage}` : ""}`, ctx.error ? { cause: ctx.error } : void 0);
|
|
34
|
+
for (const key of [
|
|
35
|
+
"request",
|
|
36
|
+
"options",
|
|
37
|
+
"response"
|
|
38
|
+
]) Object.defineProperty(fetchError, key, { get() {
|
|
39
|
+
return ctx[key];
|
|
40
|
+
} });
|
|
41
|
+
for (const [key, refKey] of [
|
|
42
|
+
["data", "_data"],
|
|
43
|
+
["status", "status"],
|
|
44
|
+
["statusCode", "status"],
|
|
45
|
+
["statusText", "statusText"],
|
|
46
|
+
["statusMessage", "statusText"]
|
|
47
|
+
]) Object.defineProperty(fetchError, key, { get() {
|
|
48
|
+
return ctx.response && ctx.response[refKey];
|
|
49
|
+
} });
|
|
50
|
+
return fetchError;
|
|
51
|
+
}
|
|
52
|
+
const payloadMethods = new Set(Object.freeze([
|
|
53
|
+
"PATCH",
|
|
54
|
+
"POST",
|
|
55
|
+
"PUT",
|
|
56
|
+
"DELETE"
|
|
57
|
+
]));
|
|
58
|
+
function isPayloadMethod(method = "GET") {
|
|
59
|
+
return payloadMethods.has(method.toUpperCase());
|
|
60
|
+
}
|
|
61
|
+
function isJSONSerializable(value) {
|
|
62
|
+
if (value === void 0) return false;
|
|
63
|
+
const t = typeof value;
|
|
64
|
+
if (t === "string" || t === "number" || t === "boolean" || t === null) return true;
|
|
65
|
+
if (t !== "object") return false;
|
|
66
|
+
if (Array.isArray(value)) return true;
|
|
67
|
+
if (value.buffer) return false;
|
|
68
|
+
if (value instanceof FormData || value instanceof URLSearchParams) return false;
|
|
69
|
+
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
|
|
70
|
+
}
|
|
71
|
+
const textTypes = /* @__PURE__ */ new Set([
|
|
72
|
+
"image/svg",
|
|
73
|
+
"application/xml",
|
|
74
|
+
"application/xhtml",
|
|
75
|
+
"application/html"
|
|
76
|
+
]);
|
|
77
|
+
const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
78
|
+
function detectResponseType(_contentType = "") {
|
|
79
|
+
if (!_contentType) return "json";
|
|
80
|
+
const contentType = _contentType.split(";").shift() || "";
|
|
81
|
+
if (JSON_RE.test(contentType)) return "json";
|
|
82
|
+
if (contentType === "text/event-stream") return "stream";
|
|
83
|
+
if (textTypes.has(contentType) || contentType.startsWith("text/")) return "text";
|
|
84
|
+
return "blob";
|
|
85
|
+
}
|
|
86
|
+
function resolveFetchOptions(request, input, defaults, Headers$1) {
|
|
87
|
+
const headers = mergeHeaders(input?.headers ?? request?.headers, defaults?.headers, Headers$1);
|
|
88
|
+
let query;
|
|
89
|
+
if (defaults?.query || defaults?.params || input?.params || input?.query) query = {
|
|
90
|
+
...defaults?.params,
|
|
91
|
+
...defaults?.query,
|
|
92
|
+
...input?.params,
|
|
93
|
+
...input?.query
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
...defaults,
|
|
97
|
+
...input,
|
|
98
|
+
query,
|
|
99
|
+
params: query,
|
|
100
|
+
headers
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function mergeHeaders(input, defaults, Headers$1) {
|
|
104
|
+
if (!defaults) return new Headers$1(input);
|
|
105
|
+
const headers = new Headers$1(defaults);
|
|
106
|
+
if (input) for (const [key, value] of Symbol.iterator in input || Array.isArray(input) ? input : new Headers$1(input)) headers.set(key, value);
|
|
107
|
+
return headers;
|
|
108
|
+
}
|
|
109
|
+
async function callHooks(context, hooks) {
|
|
110
|
+
if (hooks) if (Array.isArray(hooks)) for (const hook of hooks) await hook(context);
|
|
111
|
+
else await hooks(context);
|
|
112
|
+
}
|
|
113
|
+
const retryStatusCodes = /* @__PURE__ */ new Set([
|
|
114
|
+
408,
|
|
115
|
+
409,
|
|
116
|
+
425,
|
|
117
|
+
429,
|
|
118
|
+
500,
|
|
119
|
+
502,
|
|
120
|
+
503,
|
|
121
|
+
504
|
|
122
|
+
]);
|
|
123
|
+
const nullBodyResponses = /* @__PURE__ */ new Set([
|
|
124
|
+
101,
|
|
125
|
+
204,
|
|
126
|
+
205,
|
|
127
|
+
304
|
|
128
|
+
]);
|
|
129
|
+
function createFetch(globalOptions = {}) {
|
|
130
|
+
const { fetch: fetch$1 = globalThis.fetch, Headers: Headers$1 = globalThis.Headers, AbortController: AbortController$1 = globalThis.AbortController } = globalOptions;
|
|
131
|
+
async function onError(context) {
|
|
132
|
+
const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
|
|
133
|
+
if (context.options.retry !== false && !isAbort) {
|
|
134
|
+
let retries;
|
|
135
|
+
if (typeof context.options.retry === "number") retries = context.options.retry;
|
|
136
|
+
else retries = isPayloadMethod(context.options.method) ? 0 : 1;
|
|
137
|
+
const responseCode = context.response && context.response.status || 500;
|
|
138
|
+
if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
|
|
139
|
+
const retryDelay = typeof context.options.retryDelay === "function" ? context.options.retryDelay(context) : context.options.retryDelay || 0;
|
|
140
|
+
if (retryDelay > 0) await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
141
|
+
return $fetchRaw(context.request, {
|
|
142
|
+
...context.options,
|
|
143
|
+
retry: retries - 1
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const error = createFetchError(context);
|
|
148
|
+
if (Error.captureStackTrace) Error.captureStackTrace(error, $fetchRaw);
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {
|
|
152
|
+
const context = {
|
|
153
|
+
request: _request,
|
|
154
|
+
options: resolveFetchOptions(_request, _options, globalOptions.defaults, Headers$1),
|
|
155
|
+
response: void 0,
|
|
156
|
+
error: void 0
|
|
157
|
+
};
|
|
158
|
+
if (context.options.method) context.options.method = context.options.method.toUpperCase();
|
|
159
|
+
if (context.options.onRequest) {
|
|
160
|
+
await callHooks(context, context.options.onRequest);
|
|
161
|
+
if (!(context.options.headers instanceof Headers$1)) context.options.headers = new Headers$1(context.options.headers || {});
|
|
162
|
+
}
|
|
163
|
+
if (typeof context.request === "string") {
|
|
164
|
+
if (context.options.baseURL) context.request = require_dist.withBase(context.request, context.options.baseURL);
|
|
165
|
+
if (context.options.query) {
|
|
166
|
+
context.request = require_dist.withQuery(context.request, context.options.query);
|
|
167
|
+
delete context.options.query;
|
|
168
|
+
}
|
|
169
|
+
if ("query" in context.options) delete context.options.query;
|
|
170
|
+
if ("params" in context.options) delete context.options.params;
|
|
171
|
+
}
|
|
172
|
+
if (context.options.body && isPayloadMethod(context.options.method)) {
|
|
173
|
+
if (isJSONSerializable(context.options.body)) {
|
|
174
|
+
const contentType = context.options.headers.get("content-type");
|
|
175
|
+
if (typeof context.options.body !== "string") context.options.body = contentType === "application/x-www-form-urlencoded" ? new URLSearchParams(context.options.body).toString() : JSON.stringify(context.options.body);
|
|
176
|
+
if (!contentType) context.options.headers.set("content-type", "application/json");
|
|
177
|
+
if (!context.options.headers.has("accept")) context.options.headers.set("accept", "application/json");
|
|
178
|
+
} else if ("pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || typeof context.options.body.pipe === "function") {
|
|
179
|
+
if (!("duplex" in context.options)) context.options.duplex = "half";
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let abortTimeout;
|
|
183
|
+
if (!context.options.signal && context.options.timeout) {
|
|
184
|
+
const controller = new AbortController$1();
|
|
185
|
+
abortTimeout = setTimeout(() => {
|
|
186
|
+
const error = /* @__PURE__ */ new Error("[TimeoutError]: The operation was aborted due to timeout");
|
|
187
|
+
error.name = "TimeoutError";
|
|
188
|
+
error.code = 23;
|
|
189
|
+
controller.abort(error);
|
|
190
|
+
}, context.options.timeout);
|
|
191
|
+
context.options.signal = controller.signal;
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
context.response = await fetch$1(context.request, context.options);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
context.error = error;
|
|
197
|
+
if (context.options.onRequestError) await callHooks(context, context.options.onRequestError);
|
|
198
|
+
return await onError(context);
|
|
199
|
+
} finally {
|
|
200
|
+
if (abortTimeout) clearTimeout(abortTimeout);
|
|
201
|
+
}
|
|
202
|
+
if ((context.response.body || context.response._bodyInit) && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD") {
|
|
203
|
+
const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
|
|
204
|
+
switch (responseType) {
|
|
205
|
+
case "json": {
|
|
206
|
+
const data = await context.response.text();
|
|
207
|
+
const parseFunction = context.options.parseResponse || require_dist.destr;
|
|
208
|
+
context.response._data = parseFunction(data);
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
case "stream":
|
|
212
|
+
context.response._data = context.response.body || context.response._bodyInit;
|
|
213
|
+
break;
|
|
214
|
+
default: context.response._data = await context.response[responseType]();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (context.options.onResponse) await callHooks(context, context.options.onResponse);
|
|
218
|
+
if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
|
|
219
|
+
if (context.options.onResponseError) await callHooks(context, context.options.onResponseError);
|
|
220
|
+
return await onError(context);
|
|
221
|
+
}
|
|
222
|
+
return context.response;
|
|
223
|
+
};
|
|
224
|
+
const $fetch$1 = async function $fetch2(request, options) {
|
|
225
|
+
return (await $fetchRaw(request, options))._data;
|
|
226
|
+
};
|
|
227
|
+
$fetch$1.raw = $fetchRaw;
|
|
228
|
+
$fetch$1.native = (...args) => fetch$1(...args);
|
|
229
|
+
$fetch$1.create = (defaultOptions = {}, customGlobalOptions = {}) => createFetch({
|
|
230
|
+
...globalOptions,
|
|
231
|
+
...customGlobalOptions,
|
|
232
|
+
defaults: {
|
|
233
|
+
...globalOptions.defaults,
|
|
234
|
+
...customGlobalOptions.defaults,
|
|
235
|
+
...defaultOptions
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
return $fetch$1;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region ../../node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs
|
|
243
|
+
function createNodeFetch() {
|
|
244
|
+
if (!JSON.parse(process.env.FETCH_KEEP_ALIVE || "false")) return r;
|
|
245
|
+
const agentOptions = { keepAlive: true };
|
|
246
|
+
const httpAgent = new node_http.default.Agent(agentOptions);
|
|
247
|
+
const httpsAgent = new node_https.default.Agent(agentOptions);
|
|
248
|
+
const nodeFetchOptions = { agent(parsedURL) {
|
|
249
|
+
return parsedURL.protocol === "http:" ? httpAgent : httpsAgent;
|
|
250
|
+
} };
|
|
251
|
+
return function nodeFetchWithKeepAlive(input, init) {
|
|
252
|
+
return r(input, {
|
|
253
|
+
...nodeFetchOptions,
|
|
254
|
+
...init
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const fetch = globalThis.fetch ? (...args) => globalThis.fetch(...args) : createNodeFetch();
|
|
259
|
+
const Headers = globalThis.Headers || n;
|
|
260
|
+
const AbortController = globalThis.AbortController || T;
|
|
261
|
+
const ofetch = createFetch({
|
|
262
|
+
fetch,
|
|
263
|
+
Headers,
|
|
264
|
+
AbortController
|
|
265
|
+
});
|
|
266
|
+
const $fetch = ofetch;
|
|
267
|
+
|
|
268
|
+
//#endregion
|
|
269
|
+
exports.$fetch = $fetch;
|