@unocss/language-server 66.6.3
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/LICENSE +21 -0
- package/bin/unocss-language-server.js +2 -0
- package/dist/babel.cjs +246 -0
- package/dist/chunk-C9ebiww4.mjs +32 -0
- package/dist/dist-BUrt6dYo.cjs +193 -0
- package/dist/dist-Dwf-d4OE.mjs +175 -0
- package/dist/index.d.mts +156 -0
- package/dist/index.mjs +12482 -0
- package/dist/jiti-B459FbZV.cjs +4477 -0
- package/dist/loader-CxlILAbz.mjs +572 -0
- package/dist/multipart-parser-D3zGHRx2.mjs +168 -0
- package/dist/multipart-parser-s9tbX9e1.cjs +178 -0
- package/dist/node-B8nS8lcG.cjs +313 -0
- package/dist/node-CautW6cw.cjs +4024 -0
- package/dist/node-DvibxqDE.mjs +302 -0
- package/dist/node-loader-BO0uvH6Z.cjs +7151 -0
- package/dist/node-loader-DpZIWCu9.mjs +7144 -0
- package/dist/node-rKyHxxpg.mjs +3973 -0
- package/dist/prompt-BJqhZQ-_.cjs +851 -0
- package/dist/server.cjs +55261 -0
- package/dist/server.d.cts +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { o as qn, r as br } from "./node-rKyHxxpg.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs
|
|
4
|
+
var B = Object.defineProperty;
|
|
5
|
+
var E = (u, a) => B(u, "name", {
|
|
6
|
+
value: a,
|
|
7
|
+
configurable: !0
|
|
8
|
+
});
|
|
9
|
+
let D = 0;
|
|
10
|
+
const t = {
|
|
11
|
+
START_BOUNDARY: D++,
|
|
12
|
+
HEADER_FIELD_START: D++,
|
|
13
|
+
HEADER_FIELD: D++,
|
|
14
|
+
HEADER_VALUE_START: D++,
|
|
15
|
+
HEADER_VALUE: D++,
|
|
16
|
+
HEADER_VALUE_ALMOST_DONE: D++,
|
|
17
|
+
HEADERS_ALMOST_DONE: D++,
|
|
18
|
+
PART_DATA_START: D++,
|
|
19
|
+
PART_DATA: D++,
|
|
20
|
+
END: D++
|
|
21
|
+
};
|
|
22
|
+
let w = 1;
|
|
23
|
+
const R = {
|
|
24
|
+
PART_BOUNDARY: w,
|
|
25
|
+
LAST_BOUNDARY: w *= 2
|
|
26
|
+
}, 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 {
|
|
27
|
+
constructor(a) {
|
|
28
|
+
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
|
|
29
|
+
--` + a;
|
|
30
|
+
const n = new Uint8Array(a.length);
|
|
31
|
+
for (let r = 0; r < a.length; r++) n[r] = a.charCodeAt(r), this.boundaryChars[n[r]] = !0;
|
|
32
|
+
this.boundary = n, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = t.START_BOUNDARY;
|
|
33
|
+
}
|
|
34
|
+
write(a) {
|
|
35
|
+
let n = 0;
|
|
36
|
+
const r = a.length;
|
|
37
|
+
let d = this.index, { lookbehind: l, boundary: c, boundaryChars: p, index: e, state: i, flags: A } = this;
|
|
38
|
+
const H = this.boundary.length, O = H - 1, y = a.length;
|
|
39
|
+
let o, L;
|
|
40
|
+
const f = E((h) => {
|
|
41
|
+
this[h + "Mark"] = n;
|
|
42
|
+
}, "mark"), s = E((h) => {
|
|
43
|
+
delete this[h + "Mark"];
|
|
44
|
+
}, "clear"), T = E((h, S, _, U) => {
|
|
45
|
+
(S === void 0 || S !== _) && this[h](U && U.subarray(S, _));
|
|
46
|
+
}, "callback"), b = E((h, S) => {
|
|
47
|
+
const _ = h + "Mark";
|
|
48
|
+
_ in this && (S ? (T(h, this[_], n, a), delete this[_]) : (T(h, this[_], a.length, a), this[_] = 0));
|
|
49
|
+
}, "dataCallback");
|
|
50
|
+
for (n = 0; n < r; n++) switch (o = a[n], i) {
|
|
51
|
+
case t.START_BOUNDARY:
|
|
52
|
+
if (e === c.length - 2) {
|
|
53
|
+
if (o === P) A |= R.LAST_BOUNDARY;
|
|
54
|
+
else if (o !== N) return;
|
|
55
|
+
e++;
|
|
56
|
+
break;
|
|
57
|
+
} else if (e - 1 === c.length - 2) {
|
|
58
|
+
if (A & R.LAST_BOUNDARY && o === P) i = t.END, A = 0;
|
|
59
|
+
else if (!(A & R.LAST_BOUNDARY) && o === g) e = 0, T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
60
|
+
else return;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
o !== c[e + 2] && (e = -2), o === c[e + 2] && e++;
|
|
64
|
+
break;
|
|
65
|
+
case t.HEADER_FIELD_START: i = t.HEADER_FIELD, f("onHeaderField"), e = 0;
|
|
66
|
+
case t.HEADER_FIELD:
|
|
67
|
+
if (o === N) {
|
|
68
|
+
s("onHeaderField"), i = t.HEADERS_ALMOST_DONE;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
if (e++, o === P) break;
|
|
72
|
+
if (o === C) {
|
|
73
|
+
if (e === 1) return;
|
|
74
|
+
b("onHeaderField", !0), i = t.HEADER_VALUE_START;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
if (L = $(o), L < I || L > M) return;
|
|
78
|
+
break;
|
|
79
|
+
case t.HEADER_VALUE_START:
|
|
80
|
+
if (o === x) break;
|
|
81
|
+
f("onHeaderValue"), i = t.HEADER_VALUE;
|
|
82
|
+
case t.HEADER_VALUE:
|
|
83
|
+
o === N && (b("onHeaderValue", !0), T("onHeaderEnd"), i = t.HEADER_VALUE_ALMOST_DONE);
|
|
84
|
+
break;
|
|
85
|
+
case t.HEADER_VALUE_ALMOST_DONE:
|
|
86
|
+
if (o !== g) return;
|
|
87
|
+
i = t.HEADER_FIELD_START;
|
|
88
|
+
break;
|
|
89
|
+
case t.HEADERS_ALMOST_DONE:
|
|
90
|
+
if (o !== g) return;
|
|
91
|
+
T("onHeadersEnd"), i = t.PART_DATA_START;
|
|
92
|
+
break;
|
|
93
|
+
case t.PART_DATA_START: i = t.PART_DATA, f("onPartData");
|
|
94
|
+
case t.PART_DATA:
|
|
95
|
+
if (d = e, e === 0) {
|
|
96
|
+
for (n += O; n < y && !(a[n] in p);) n += H;
|
|
97
|
+
n -= O, o = a[n];
|
|
98
|
+
}
|
|
99
|
+
if (e < c.length) c[e] === o ? (e === 0 && b("onPartData", !0), e++) : e = 0;
|
|
100
|
+
else if (e === c.length) e++, o === N ? A |= R.PART_BOUNDARY : o === P ? A |= R.LAST_BOUNDARY : e = 0;
|
|
101
|
+
else if (e - 1 === c.length) if (A & R.PART_BOUNDARY) {
|
|
102
|
+
if (e = 0, o === g) {
|
|
103
|
+
A &= ~R.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), i = t.HEADER_FIELD_START;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
} else A & R.LAST_BOUNDARY && o === P ? (T("onPartEnd"), i = t.END, A = 0) : e = 0;
|
|
107
|
+
if (e > 0) l[e - 1] = o;
|
|
108
|
+
else if (d > 0) {
|
|
109
|
+
const h = new Uint8Array(l.buffer, l.byteOffset, l.byteLength);
|
|
110
|
+
T("onPartData", 0, d, h), d = 0, f("onPartData"), n--;
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
case t.END: break;
|
|
114
|
+
default: throw new Error(`Unexpected state entered: ${i}`);
|
|
115
|
+
}
|
|
116
|
+
b("onHeaderField"), b("onHeaderValue"), b("onPartData"), this.index = e, this.state = i, this.flags = A;
|
|
117
|
+
}
|
|
118
|
+
end() {
|
|
119
|
+
if (this.state === t.HEADER_FIELD_START && this.index === 0 || this.state === t.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
|
|
120
|
+
else if (this.state !== t.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
E(F, "MultipartParser");
|
|
124
|
+
let k = F;
|
|
125
|
+
function v(u) {
|
|
126
|
+
const a = u.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
127
|
+
if (!a) return;
|
|
128
|
+
const n = a[2] || a[3] || "";
|
|
129
|
+
let r = n.slice(n.lastIndexOf("\\") + 1);
|
|
130
|
+
return r = r.replace(/%22/g, "\""), r = r.replace(/&#(\d{4});/g, (d, l) => String.fromCharCode(l)), r;
|
|
131
|
+
}
|
|
132
|
+
E(v, "_fileName");
|
|
133
|
+
async function Z(u, a) {
|
|
134
|
+
if (!/multipart/i.test(a)) throw new TypeError("Failed to fetch");
|
|
135
|
+
const n = a.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
136
|
+
if (!n) throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
137
|
+
const r = new k(n[1] || n[2]);
|
|
138
|
+
let d, l, c, p, e, i;
|
|
139
|
+
const A = [], H = new br(), O = E((s) => {
|
|
140
|
+
c += f.decode(s, { stream: !0 });
|
|
141
|
+
}, "onPartData"), y = E((s) => {
|
|
142
|
+
A.push(s);
|
|
143
|
+
}, "appendToFile"), o = E(() => {
|
|
144
|
+
const s = new qn(A, i, { type: e });
|
|
145
|
+
H.append(p, s);
|
|
146
|
+
}, "appendFileToFormData"), L = E(() => {
|
|
147
|
+
H.append(p, c);
|
|
148
|
+
}, "appendEntryToFormData"), f = new TextDecoder("utf-8");
|
|
149
|
+
f.decode(), r.onPartBegin = function() {
|
|
150
|
+
r.onPartData = O, r.onPartEnd = L, d = "", l = "", c = "", p = "", e = "", i = null, A.length = 0;
|
|
151
|
+
}, r.onHeaderField = function(s) {
|
|
152
|
+
d += f.decode(s, { stream: !0 });
|
|
153
|
+
}, r.onHeaderValue = function(s) {
|
|
154
|
+
l += f.decode(s, { stream: !0 });
|
|
155
|
+
}, r.onHeaderEnd = function() {
|
|
156
|
+
if (l += f.decode(), d = d.toLowerCase(), d === "content-disposition") {
|
|
157
|
+
const s = l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
158
|
+
s && (p = s[2] || s[3] || ""), i = v(l), i && (r.onPartData = y, r.onPartEnd = o);
|
|
159
|
+
} else d === "content-type" && (e = l);
|
|
160
|
+
l = "", d = "";
|
|
161
|
+
};
|
|
162
|
+
for await (const s of u) r.write(s);
|
|
163
|
+
return r.end(), H;
|
|
164
|
+
}
|
|
165
|
+
E(Z, "toFormData");
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
export { Z as toFormData };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
const require_node = require('./node-CautW6cw.cjs');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
let node_url = require("node:url");
|
|
4
|
+
let node_util = require("node:util");
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
|
+
let node_stream = require("node:stream");
|
|
7
|
+
let node_http = require("node:http");
|
|
8
|
+
let node_https = require("node:https");
|
|
9
|
+
let node_zlib = require("node:zlib");
|
|
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,313 @@
|
|
|
1
|
+
const require_server = require('./server.cjs');
|
|
2
|
+
const require_dist = require('./dist-BUrt6dYo.cjs');
|
|
3
|
+
const require_node = require('./node-CautW6cw.cjs');
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
let node_url = require("node:url");
|
|
6
|
+
let node_util = require("node:util");
|
|
7
|
+
let node_fs = require("node:fs");
|
|
8
|
+
let node_stream = require("node:stream");
|
|
9
|
+
let node_http = require("node:http");
|
|
10
|
+
node_http = require_server.__toESM(node_http);
|
|
11
|
+
let node_https = require("node:https");
|
|
12
|
+
node_https = require_server.__toESM(node_https);
|
|
13
|
+
let node_zlib = require("node:zlib");
|
|
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/destr@2.0.5/node_modules/destr/dist/index.mjs
|
|
22
|
+
const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
|
|
23
|
+
const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
24
|
+
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
25
|
+
function jsonParseTransform(key, value) {
|
|
26
|
+
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
27
|
+
warnKeyDropped(key);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function warnKeyDropped(key) {
|
|
33
|
+
console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
|
|
34
|
+
}
|
|
35
|
+
function destr(value, options = {}) {
|
|
36
|
+
if (typeof value !== "string") return value;
|
|
37
|
+
if (value[0] === "\"" && value[value.length - 1] === "\"" && value.indexOf("\\") === -1) return value.slice(1, -1);
|
|
38
|
+
const _value = value.trim();
|
|
39
|
+
if (_value.length <= 9) switch (_value.toLowerCase()) {
|
|
40
|
+
case "true": return true;
|
|
41
|
+
case "false": return false;
|
|
42
|
+
case "undefined": return;
|
|
43
|
+
case "null": return null;
|
|
44
|
+
case "nan": return NaN;
|
|
45
|
+
case "infinity": return Number.POSITIVE_INFINITY;
|
|
46
|
+
case "-infinity": return Number.NEGATIVE_INFINITY;
|
|
47
|
+
}
|
|
48
|
+
if (!JsonSigRx.test(value)) {
|
|
49
|
+
if (options.strict) throw new SyntaxError("[destr] Invalid JSON");
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
|
|
54
|
+
if (options.strict) throw new Error("[destr] Possible prototype pollution");
|
|
55
|
+
return JSON.parse(value, jsonParseTransform);
|
|
56
|
+
}
|
|
57
|
+
return JSON.parse(value);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (options.strict) throw error;
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region ../../node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs
|
|
66
|
+
var FetchError = class extends Error {
|
|
67
|
+
constructor(message, opts) {
|
|
68
|
+
super(message, opts);
|
|
69
|
+
this.name = "FetchError";
|
|
70
|
+
if (opts?.cause && !this.cause) this.cause = opts.cause;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function createFetchError(ctx) {
|
|
74
|
+
const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
|
|
75
|
+
const method = ctx.request?.method || ctx.options?.method || "GET";
|
|
76
|
+
const url = ctx.request?.url || String(ctx.request) || "/";
|
|
77
|
+
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);
|
|
78
|
+
for (const key of [
|
|
79
|
+
"request",
|
|
80
|
+
"options",
|
|
81
|
+
"response"
|
|
82
|
+
]) Object.defineProperty(fetchError, key, { get() {
|
|
83
|
+
return ctx[key];
|
|
84
|
+
} });
|
|
85
|
+
for (const [key, refKey] of [
|
|
86
|
+
["data", "_data"],
|
|
87
|
+
["status", "status"],
|
|
88
|
+
["statusCode", "status"],
|
|
89
|
+
["statusText", "statusText"],
|
|
90
|
+
["statusMessage", "statusText"]
|
|
91
|
+
]) Object.defineProperty(fetchError, key, { get() {
|
|
92
|
+
return ctx.response && ctx.response[refKey];
|
|
93
|
+
} });
|
|
94
|
+
return fetchError;
|
|
95
|
+
}
|
|
96
|
+
const payloadMethods = new Set(Object.freeze([
|
|
97
|
+
"PATCH",
|
|
98
|
+
"POST",
|
|
99
|
+
"PUT",
|
|
100
|
+
"DELETE"
|
|
101
|
+
]));
|
|
102
|
+
function isPayloadMethod(method = "GET") {
|
|
103
|
+
return payloadMethods.has(method.toUpperCase());
|
|
104
|
+
}
|
|
105
|
+
function isJSONSerializable(value) {
|
|
106
|
+
if (value === void 0) return false;
|
|
107
|
+
const t = typeof value;
|
|
108
|
+
if (t === "string" || t === "number" || t === "boolean" || t === null) return true;
|
|
109
|
+
if (t !== "object") return false;
|
|
110
|
+
if (Array.isArray(value)) return true;
|
|
111
|
+
if (value.buffer) return false;
|
|
112
|
+
if (value instanceof FormData || value instanceof URLSearchParams) return false;
|
|
113
|
+
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
|
|
114
|
+
}
|
|
115
|
+
const textTypes = /* @__PURE__ */ new Set([
|
|
116
|
+
"image/svg",
|
|
117
|
+
"application/xml",
|
|
118
|
+
"application/xhtml",
|
|
119
|
+
"application/html"
|
|
120
|
+
]);
|
|
121
|
+
const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
122
|
+
function detectResponseType(_contentType = "") {
|
|
123
|
+
if (!_contentType) return "json";
|
|
124
|
+
const contentType = _contentType.split(";").shift() || "";
|
|
125
|
+
if (JSON_RE.test(contentType)) return "json";
|
|
126
|
+
if (contentType === "text/event-stream") return "stream";
|
|
127
|
+
if (textTypes.has(contentType) || contentType.startsWith("text/")) return "text";
|
|
128
|
+
return "blob";
|
|
129
|
+
}
|
|
130
|
+
function resolveFetchOptions(request, input, defaults, Headers$1) {
|
|
131
|
+
const headers = mergeHeaders(input?.headers ?? request?.headers, defaults?.headers, Headers$1);
|
|
132
|
+
let query;
|
|
133
|
+
if (defaults?.query || defaults?.params || input?.params || input?.query) query = {
|
|
134
|
+
...defaults?.params,
|
|
135
|
+
...defaults?.query,
|
|
136
|
+
...input?.params,
|
|
137
|
+
...input?.query
|
|
138
|
+
};
|
|
139
|
+
return {
|
|
140
|
+
...defaults,
|
|
141
|
+
...input,
|
|
142
|
+
query,
|
|
143
|
+
params: query,
|
|
144
|
+
headers
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function mergeHeaders(input, defaults, Headers$1) {
|
|
148
|
+
if (!defaults) return new Headers$1(input);
|
|
149
|
+
const headers = new Headers$1(defaults);
|
|
150
|
+
if (input) for (const [key, value] of Symbol.iterator in input || Array.isArray(input) ? input : new Headers$1(input)) headers.set(key, value);
|
|
151
|
+
return headers;
|
|
152
|
+
}
|
|
153
|
+
async function callHooks(context, hooks) {
|
|
154
|
+
if (hooks) if (Array.isArray(hooks)) for (const hook of hooks) await hook(context);
|
|
155
|
+
else await hooks(context);
|
|
156
|
+
}
|
|
157
|
+
const retryStatusCodes = /* @__PURE__ */ new Set([
|
|
158
|
+
408,
|
|
159
|
+
409,
|
|
160
|
+
425,
|
|
161
|
+
429,
|
|
162
|
+
500,
|
|
163
|
+
502,
|
|
164
|
+
503,
|
|
165
|
+
504
|
|
166
|
+
]);
|
|
167
|
+
const nullBodyResponses = /* @__PURE__ */ new Set([
|
|
168
|
+
101,
|
|
169
|
+
204,
|
|
170
|
+
205,
|
|
171
|
+
304
|
|
172
|
+
]);
|
|
173
|
+
function createFetch(globalOptions = {}) {
|
|
174
|
+
const { fetch: fetch$1 = globalThis.fetch, Headers: Headers$1 = globalThis.Headers, AbortController: AbortController$1 = globalThis.AbortController } = globalOptions;
|
|
175
|
+
async function onError(context) {
|
|
176
|
+
const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
|
|
177
|
+
if (context.options.retry !== false && !isAbort) {
|
|
178
|
+
let retries;
|
|
179
|
+
if (typeof context.options.retry === "number") retries = context.options.retry;
|
|
180
|
+
else retries = isPayloadMethod(context.options.method) ? 0 : 1;
|
|
181
|
+
const responseCode = context.response && context.response.status || 500;
|
|
182
|
+
if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
|
|
183
|
+
const retryDelay = typeof context.options.retryDelay === "function" ? context.options.retryDelay(context) : context.options.retryDelay || 0;
|
|
184
|
+
if (retryDelay > 0) await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
185
|
+
return $fetchRaw(context.request, {
|
|
186
|
+
...context.options,
|
|
187
|
+
retry: retries - 1
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const error = createFetchError(context);
|
|
192
|
+
if (Error.captureStackTrace) Error.captureStackTrace(error, $fetchRaw);
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
const $fetchRaw = async function $fetchRaw2(_request, _options = {}) {
|
|
196
|
+
const context = {
|
|
197
|
+
request: _request,
|
|
198
|
+
options: resolveFetchOptions(_request, _options, globalOptions.defaults, Headers$1),
|
|
199
|
+
response: void 0,
|
|
200
|
+
error: void 0
|
|
201
|
+
};
|
|
202
|
+
if (context.options.method) context.options.method = context.options.method.toUpperCase();
|
|
203
|
+
if (context.options.onRequest) {
|
|
204
|
+
await callHooks(context, context.options.onRequest);
|
|
205
|
+
if (!(context.options.headers instanceof Headers$1)) context.options.headers = new Headers$1(context.options.headers || {});
|
|
206
|
+
}
|
|
207
|
+
if (typeof context.request === "string") {
|
|
208
|
+
if (context.options.baseURL) context.request = require_dist.withBase(context.request, context.options.baseURL);
|
|
209
|
+
if (context.options.query) {
|
|
210
|
+
context.request = require_dist.withQuery(context.request, context.options.query);
|
|
211
|
+
delete context.options.query;
|
|
212
|
+
}
|
|
213
|
+
if ("query" in context.options) delete context.options.query;
|
|
214
|
+
if ("params" in context.options) delete context.options.params;
|
|
215
|
+
}
|
|
216
|
+
if (context.options.body && isPayloadMethod(context.options.method)) {
|
|
217
|
+
if (isJSONSerializable(context.options.body)) {
|
|
218
|
+
const contentType = context.options.headers.get("content-type");
|
|
219
|
+
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);
|
|
220
|
+
if (!contentType) context.options.headers.set("content-type", "application/json");
|
|
221
|
+
if (!context.options.headers.has("accept")) context.options.headers.set("accept", "application/json");
|
|
222
|
+
} else if ("pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || typeof context.options.body.pipe === "function") {
|
|
223
|
+
if (!("duplex" in context.options)) context.options.duplex = "half";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
let abortTimeout;
|
|
227
|
+
if (!context.options.signal && context.options.timeout) {
|
|
228
|
+
const controller = new AbortController$1();
|
|
229
|
+
abortTimeout = setTimeout(() => {
|
|
230
|
+
const error = /* @__PURE__ */ new Error("[TimeoutError]: The operation was aborted due to timeout");
|
|
231
|
+
error.name = "TimeoutError";
|
|
232
|
+
error.code = 23;
|
|
233
|
+
controller.abort(error);
|
|
234
|
+
}, context.options.timeout);
|
|
235
|
+
context.options.signal = controller.signal;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
context.response = await fetch$1(context.request, context.options);
|
|
239
|
+
} catch (error) {
|
|
240
|
+
context.error = error;
|
|
241
|
+
if (context.options.onRequestError) await callHooks(context, context.options.onRequestError);
|
|
242
|
+
return await onError(context);
|
|
243
|
+
} finally {
|
|
244
|
+
if (abortTimeout) clearTimeout(abortTimeout);
|
|
245
|
+
}
|
|
246
|
+
if ((context.response.body || context.response._bodyInit) && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD") {
|
|
247
|
+
const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
|
|
248
|
+
switch (responseType) {
|
|
249
|
+
case "json": {
|
|
250
|
+
const data = await context.response.text();
|
|
251
|
+
const parseFunction = context.options.parseResponse || destr;
|
|
252
|
+
context.response._data = parseFunction(data);
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case "stream":
|
|
256
|
+
context.response._data = context.response.body || context.response._bodyInit;
|
|
257
|
+
break;
|
|
258
|
+
default: context.response._data = await context.response[responseType]();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (context.options.onResponse) await callHooks(context, context.options.onResponse);
|
|
262
|
+
if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
|
|
263
|
+
if (context.options.onResponseError) await callHooks(context, context.options.onResponseError);
|
|
264
|
+
return await onError(context);
|
|
265
|
+
}
|
|
266
|
+
return context.response;
|
|
267
|
+
};
|
|
268
|
+
const $fetch$1 = async function $fetch2(request, options) {
|
|
269
|
+
return (await $fetchRaw(request, options))._data;
|
|
270
|
+
};
|
|
271
|
+
$fetch$1.raw = $fetchRaw;
|
|
272
|
+
$fetch$1.native = (...args) => fetch$1(...args);
|
|
273
|
+
$fetch$1.create = (defaultOptions = {}, customGlobalOptions = {}) => createFetch({
|
|
274
|
+
...globalOptions,
|
|
275
|
+
...customGlobalOptions,
|
|
276
|
+
defaults: {
|
|
277
|
+
...globalOptions.defaults,
|
|
278
|
+
...customGlobalOptions.defaults,
|
|
279
|
+
...defaultOptions
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
return $fetch$1;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region ../../node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs
|
|
287
|
+
function createNodeFetch() {
|
|
288
|
+
if (!JSON.parse(process.env.FETCH_KEEP_ALIVE || "false")) return r;
|
|
289
|
+
const agentOptions = { keepAlive: true };
|
|
290
|
+
const httpAgent = new node_http.default.Agent(agentOptions);
|
|
291
|
+
const httpsAgent = new node_https.default.Agent(agentOptions);
|
|
292
|
+
const nodeFetchOptions = { agent(parsedURL) {
|
|
293
|
+
return parsedURL.protocol === "http:" ? httpAgent : httpsAgent;
|
|
294
|
+
} };
|
|
295
|
+
return function nodeFetchWithKeepAlive(input, init) {
|
|
296
|
+
return r(input, {
|
|
297
|
+
...nodeFetchOptions,
|
|
298
|
+
...init
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
const fetch = globalThis.fetch ? (...args) => globalThis.fetch(...args) : createNodeFetch();
|
|
303
|
+
const Headers = globalThis.Headers || n;
|
|
304
|
+
const AbortController = globalThis.AbortController || T;
|
|
305
|
+
const ofetch = createFetch({
|
|
306
|
+
fetch,
|
|
307
|
+
Headers,
|
|
308
|
+
AbortController
|
|
309
|
+
});
|
|
310
|
+
const $fetch = ofetch;
|
|
311
|
+
|
|
312
|
+
//#endregion
|
|
313
|
+
exports.$fetch = $fetch;
|