@kasperpeulen/vitest-plugin-nextjs 0.0.0-alpha.0 → 0.1.0-alpha.0
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/README.md +249 -2
- package/dist/_virtual/_rolldown/runtime.js +14 -0
- package/dist/action-ids.d.ts +18 -0
- package/dist/action-ids.js +44 -0
- package/dist/adapter.d.ts +8 -0
- package/dist/adapter.js +12 -0
- package/dist/app-requests.d.ts +63 -0
- package/dist/app-requests.js +253 -0
- package/dist/browser-context.d.ts +24 -0
- package/dist/browser-context.js +157 -0
- package/dist/build-output.d.ts +68 -0
- package/dist/build-output.js +216 -0
- package/dist/build.d.ts +26 -0
- package/dist/build.js +39 -0
- package/dist/built-files.d.ts +9 -0
- package/dist/built-files.js +22 -0
- package/dist/cache.d.ts +44 -0
- package/dist/cache.js +99 -0
- package/dist/client-components.d.ts +3 -0
- package/dist/client-components.js +4 -0
- package/dist/client-file-key.d.ts +5 -0
- package/dist/client-file-key.js +5 -0
- package/dist/client-files.d.ts +83 -0
- package/dist/client-files.js +186 -0
- package/dist/client-graph.d.ts +94 -0
- package/dist/client-graph.js +266 -0
- package/dist/client-modules.d.ts +10 -0
- package/dist/client-modules.js +43 -0
- package/dist/client.d.ts +42 -0
- package/dist/client.js +263 -0
- package/dist/commonjs.d.ts +44 -0
- package/dist/commonjs.js +111 -0
- package/dist/compat/browser/client.d.ts +19 -0
- package/dist/compat/browser/client.js +13 -0
- package/dist/compat/build.d.ts +145 -0
- package/dist/compat/build.js +149 -0
- package/dist/compat/checks.d.ts +16 -0
- package/dist/compat/checks.js +148 -0
- package/dist/compat/patches.d.ts +13 -0
- package/dist/compat/patches.js +30 -0
- package/dist/compat/paths.d.ts +74 -0
- package/dist/compat/paths.js +160 -0
- package/dist/compat/rsc/handlers.d.ts +2 -0
- package/dist/compat/rsc/handlers.js +2 -0
- package/dist/compat/rsc/prerender.d.ts +10 -0
- package/dist/compat/rsc/prerender.js +9 -0
- package/dist/compat/server/headers.d.ts +3 -0
- package/dist/compat/server/headers.js +3 -0
- package/dist/compat/ssr/build-output.d.ts +4 -0
- package/dist/compat/ssr/build-output.js +3 -0
- package/dist/compat/ssr/cache.d.ts +6 -0
- package/dist/compat/ssr/cache.js +6 -0
- package/dist/compat/ssr/handler.d.ts +8 -0
- package/dist/compat/ssr/handler.js +8 -0
- package/dist/compat/ssr/node-server.d.ts +5 -0
- package/dist/compat/ssr/node-server.js +4 -0
- package/dist/compat/ssr/render-errors.d.ts +4 -0
- package/dist/compat/ssr/render-errors.js +4 -0
- package/dist/compat/ssr/senders.d.ts +6 -0
- package/dist/compat/ssr/senders.js +6 -0
- package/dist/compat/types.d.ts +8 -0
- package/dist/compat/types.js +1 -0
- package/dist/compile.d.ts +31 -0
- package/dist/compile.js +140 -0
- package/dist/disk.d.ts +16 -0
- package/dist/disk.js +13 -0
- package/dist/document-loads.d.ts +15 -0
- package/dist/document-loads.js +53 -0
- package/dist/document.d.ts +79 -0
- package/dist/document.js +328 -0
- package/dist/downloads.d.ts +15 -0
- package/dist/downloads.js +71 -0
- package/dist/esm-require.d.ts +11 -0
- package/dist/esm-require.js +32 -0
- package/dist/fast-crypto/index.js +1093 -0
- package/dist/fast-crypto.d.ts +20 -0
- package/dist/fast-crypto.js +151 -0
- package/dist/flight.d.ts +19 -0
- package/dist/flight.js +42 -0
- package/dist/form-submission.d.ts +15 -0
- package/dist/form-submission.js +27 -0
- package/dist/from-page.d.ts +5 -0
- package/dist/from-page.js +44 -0
- package/dist/globals.d.ts +1 -0
- package/dist/globals.js +197 -0
- package/dist/host-document.d.ts +26 -0
- package/dist/host-document.js +34 -0
- package/dist/index.d.ts +280 -0
- package/dist/index.js +281 -0
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +3 -0
- package/dist/leftovers.d.ts +11 -0
- package/dist/leftovers.js +55 -0
- package/dist/mode.d.ts +169 -0
- package/dist/mode.js +31 -0
- package/dist/node/LICENSES.md +3540 -0
- package/dist/node/assert/strict.js +29 -0
- package/dist/node/assert.js +3044 -0
- package/dist/node/buffer.js +1499 -0
- package/dist/node/child_process.js +45 -0
- package/dist/node/cluster.js +85 -0
- package/dist/node/console.js +96 -0
- package/dist/node/constants.js +495 -0
- package/dist/node/crypto.js +1388 -0
- package/dist/node/dgram.js +78 -0
- package/dist/node/diagnostics_channel.js +122 -0
- package/dist/node/dns/promises.js +129 -0
- package/dist/node/dns.js +137 -0
- package/dist/node/domain.js +43 -0
- package/dist/node/events.js +1155 -0
- package/dist/node/fs/promises.js +40 -0
- package/dist/node/fs.js +10375 -0
- package/dist/node/http.js +326 -0
- package/dist/node/http2.js +305 -0
- package/dist/node/https.js +57 -0
- package/dist/node/inspector/promises.js +66 -0
- package/dist/node/inspector.js +76 -0
- package/dist/node/module.js +205 -0
- package/dist/node/net.js +392 -0
- package/dist/node/os.js +259 -0
- package/dist/node/path/posix.js +25 -0
- package/dist/node/path/win32.js +25 -0
- package/dist/node/path.js +384 -0
- package/dist/node/perf_hooks.js +313 -0
- package/dist/node/process.js +452 -0
- package/dist/node/punycode.js +178 -0
- package/dist/node/querystring.js +934 -0
- package/dist/node/readline/promises.js +71 -0
- package/dist/node/readline.js +56 -0
- package/dist/node/repl.js +44 -0
- package/dist/node/sqlite.js +22 -0
- package/dist/node/stream/consumers.js +47 -0
- package/dist/node/stream/promises.js +6 -0
- package/dist/node/stream/web.js +52 -0
- package/dist/node/stream.js +4323 -0
- package/dist/node/string_decoder.js +276 -0
- package/dist/node/sys.js +6 -0
- package/dist/node/timers/promises.js +71 -0
- package/dist/node/timers.js +133 -0
- package/dist/node/tls.js +122 -0
- package/dist/node/trace_events.js +23 -0
- package/dist/node/tty.js +69 -0
- package/dist/node/url.js +1426 -0
- package/dist/node/util/types.js +1456 -0
- package/dist/node/util.js +4807 -0
- package/dist/node/v8.js +160 -0
- package/dist/node/vm.js +88 -0
- package/dist/node/wasi.js +16 -0
- package/dist/node/worker_threads.js +123 -0
- package/dist/node/zlib.js +1396 -0
- package/dist/node-builtins.d.ts +40 -0
- package/dist/node-builtins.js +74 -0
- package/dist/node-on-page.d.ts +46 -0
- package/dist/node-on-page.js +101 -0
- package/dist/node-platform.d.ts +36 -0
- package/dist/node-platform.js +152 -0
- package/dist/node-rendered.d.ts +21 -0
- package/dist/node-rendered.js +26 -0
- package/dist/node-server.d.ts +46 -0
- package/dist/node-server.js +193 -0
- package/dist/optimizer-cache-key.d.ts +26 -0
- package/dist/optimizer-cache-key.js +73 -0
- package/dist/own-package.d.ts +1 -0
- package/dist/own-package.js +6 -0
- package/dist/page-store.d.ts +33 -0
- package/dist/page-store.js +80 -0
- package/dist/page-timers.d.ts +22 -0
- package/dist/page-timers.js +47 -0
- package/dist/page.d.ts +112 -0
- package/dist/page.js +549 -0
- package/dist/paths.d.ts +13 -0
- package/dist/paths.js +47 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.js +995 -0
- package/dist/prerender-verdict.d.ts +8 -0
- package/dist/prerender-verdict.js +67 -0
- package/dist/project/context.d.ts +546 -0
- package/dist/project/context.js +111 -0
- package/dist/project/entries.d.ts +42 -0
- package/dist/project/entries.js +189 -0
- package/dist/project/env-worker.d.ts +1 -0
- package/dist/project/env-worker.js +9 -0
- package/dist/project/env.d.ts +36 -0
- package/dist/project/env.js +82 -0
- package/dist/project/layers.d.ts +31 -0
- package/dist/project/layers.js +150 -0
- package/dist/project/loaders.d.ts +71 -0
- package/dist/project/loaders.js +300 -0
- package/dist/project/metadata.d.ts +8 -0
- package/dist/project/metadata.js +34 -0
- package/dist/project/module-exports.d.ts +29 -0
- package/dist/project/module-exports.js +77 -0
- package/dist/project/routes.d.ts +19 -0
- package/dist/project/routes.js +92 -0
- package/dist/project/routing.d.ts +46 -0
- package/dist/project/routing.js +280 -0
- package/dist/project/transform.d.ts +8 -0
- package/dist/project/transform.js +110 -0
- package/dist/project/webpack.d.ts +46 -0
- package/dist/project/webpack.js +160 -0
- package/dist/project.d.ts +264 -0
- package/dist/project.js +58 -0
- package/dist/registry-global.d.ts +5 -0
- package/dist/registry-global.js +5 -0
- package/dist/registry.d.ts +241 -0
- package/dist/registry.js +30 -0
- package/dist/route-chunks.d.ts +13 -0
- package/dist/route-chunks.js +32 -0
- package/dist/route-lookup.d.ts +34 -0
- package/dist/route-lookup.js +207 -0
- package/dist/routes-ahead-shared.d.ts +17 -0
- package/dist/routes-ahead-shared.js +9 -0
- package/dist/routes-ahead.d.ts +10 -0
- package/dist/routes-ahead.js +54 -0
- package/dist/rsc.d.ts +19 -0
- package/dist/rsc.js +171 -0
- package/dist/server-action.d.ts +9 -0
- package/dist/server-action.js +15 -0
- package/dist/server-code.d.ts +176 -0
- package/dist/server-code.js +357 -0
- package/dist/server-in-front.d.ts +37 -0
- package/dist/server-in-front.js +90 -0
- package/dist/server-layers.d.ts +22 -0
- package/dist/server-layers.js +33 -0
- package/dist/setup-browser.d.ts +1 -0
- package/dist/setup-browser.js +8 -0
- package/dist/setup-node.d.ts +1 -0
- package/dist/setup-node.js +6 -0
- package/dist/setup.d.ts +8 -0
- package/dist/setup.js +62 -0
- package/dist/speed-features.d.ts +13 -0
- package/dist/speed-features.js +95 -0
- package/dist/ssr.d.ts +70 -0
- package/dist/ssr.js +480 -0
- package/dist/static-build.d.ts +36 -0
- package/dist/static-build.js +92 -0
- package/dist/storage.d.ts +31 -0
- package/dist/storage.js +94 -0
- package/dist/styles-shared.d.ts +137 -0
- package/dist/styles-shared.js +124 -0
- package/dist/styles.d.ts +102 -0
- package/dist/styles.js +730 -0
- package/dist/stylesheet-versions.d.ts +17 -0
- package/dist/stylesheet-versions.js +43 -0
- package/dist/tester.html +10 -0
- package/dist/use-cache.d.ts +15 -0
- package/dist/use-cache.js +93 -0
- package/dist/vitest-version.d.ts +6 -0
- package/dist/vitest-version.js +12 -0
- package/package.json +125 -4
package/dist/node/url.js
ADDED
|
@@ -0,0 +1,1426 @@
|
|
|
1
|
+
import * as querystring from "node:querystring";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/punycode/punycode.mjs
|
|
4
|
+
const maxInt = 2147483647;
|
|
5
|
+
const base = 36;
|
|
6
|
+
const tMin = 1;
|
|
7
|
+
const tMax = 26;
|
|
8
|
+
const skew = 38;
|
|
9
|
+
const damp = 700;
|
|
10
|
+
const initialBias = 72;
|
|
11
|
+
const initialN = 128;
|
|
12
|
+
const delimiter = "-";
|
|
13
|
+
const regexPunycode = /^xn--/;
|
|
14
|
+
const regexNonASCII = /[^\0-\u007F]/;
|
|
15
|
+
const regexSeparators = /[.\u3002\uFF0E\uFF61]/g;
|
|
16
|
+
const errors = {
|
|
17
|
+
overflow: "Overflow: input needs wider integers to process",
|
|
18
|
+
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
19
|
+
"invalid-input": "Invalid input"
|
|
20
|
+
};
|
|
21
|
+
const baseMinusTMin = 35;
|
|
22
|
+
const floor = Math.floor;
|
|
23
|
+
const stringFromCharCode = String.fromCharCode;
|
|
24
|
+
function error(type) {
|
|
25
|
+
throw new RangeError(errors[type]);
|
|
26
|
+
}
|
|
27
|
+
function map(array, callback) {
|
|
28
|
+
const result = [];
|
|
29
|
+
let length = array.length;
|
|
30
|
+
while (length--) result[length] = callback(array[length]);
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
function mapDomain(domain, callback) {
|
|
34
|
+
const parts = domain.split("@");
|
|
35
|
+
let result = "";
|
|
36
|
+
if (parts.length > 1) {
|
|
37
|
+
result = parts[0] + "@";
|
|
38
|
+
domain = parts[1];
|
|
39
|
+
}
|
|
40
|
+
domain = domain.replace(regexSeparators, ".");
|
|
41
|
+
const encoded = map(domain.split("."), callback).join(".");
|
|
42
|
+
return result + encoded;
|
|
43
|
+
}
|
|
44
|
+
function ucs2decode(string) {
|
|
45
|
+
const output = [];
|
|
46
|
+
let counter = 0;
|
|
47
|
+
const length = string.length;
|
|
48
|
+
while (counter < length) {
|
|
49
|
+
const value = string.charCodeAt(counter++);
|
|
50
|
+
if (value >= 55296 && value <= 56319 && counter < length) {
|
|
51
|
+
const extra = string.charCodeAt(counter++);
|
|
52
|
+
if ((extra & 64512) == 56320) output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
|
|
53
|
+
else {
|
|
54
|
+
output.push(value);
|
|
55
|
+
counter--;
|
|
56
|
+
}
|
|
57
|
+
} else output.push(value);
|
|
58
|
+
}
|
|
59
|
+
return output;
|
|
60
|
+
}
|
|
61
|
+
const basicToDigit = function(codePoint) {
|
|
62
|
+
if (codePoint >= 48 && codePoint < 58) return 26 + (codePoint - 48);
|
|
63
|
+
if (codePoint >= 65 && codePoint < 91) return codePoint - 65;
|
|
64
|
+
if (codePoint >= 97 && codePoint < 123) return codePoint - 97;
|
|
65
|
+
return base;
|
|
66
|
+
};
|
|
67
|
+
const digitToBasic = function(digit, flag) {
|
|
68
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
69
|
+
};
|
|
70
|
+
const adapt = function(delta, numPoints, firstTime) {
|
|
71
|
+
let k = 0;
|
|
72
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
73
|
+
delta += floor(delta / numPoints);
|
|
74
|
+
for (; delta > 455; k += base) delta = floor(delta / baseMinusTMin);
|
|
75
|
+
return floor(k + 36 * delta / (delta + skew));
|
|
76
|
+
};
|
|
77
|
+
const decode = function(input) {
|
|
78
|
+
const output = [];
|
|
79
|
+
const inputLength = input.length;
|
|
80
|
+
let i = 0;
|
|
81
|
+
let n = initialN;
|
|
82
|
+
let bias = initialBias;
|
|
83
|
+
let basic = input.lastIndexOf(delimiter);
|
|
84
|
+
if (basic < 0) basic = 0;
|
|
85
|
+
for (let j = 0; j < basic; ++j) {
|
|
86
|
+
if (input.charCodeAt(j) >= 128) error("not-basic");
|
|
87
|
+
output.push(input.charCodeAt(j));
|
|
88
|
+
}
|
|
89
|
+
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength;) {
|
|
90
|
+
const oldi = i;
|
|
91
|
+
for (let w = 1, k = base;; k += base) {
|
|
92
|
+
if (index >= inputLength) error("invalid-input");
|
|
93
|
+
const digit = basicToDigit(input.charCodeAt(index++));
|
|
94
|
+
if (digit >= base) error("invalid-input");
|
|
95
|
+
if (digit > floor((maxInt - i) / w)) error("overflow");
|
|
96
|
+
i += digit * w;
|
|
97
|
+
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
98
|
+
if (digit < t) break;
|
|
99
|
+
const baseMinusT = base - t;
|
|
100
|
+
if (w > floor(maxInt / baseMinusT)) error("overflow");
|
|
101
|
+
w *= baseMinusT;
|
|
102
|
+
}
|
|
103
|
+
const out = output.length + 1;
|
|
104
|
+
bias = adapt(i - oldi, out, oldi === 0);
|
|
105
|
+
if (floor(i / out) > maxInt - n) error("overflow");
|
|
106
|
+
n += floor(i / out);
|
|
107
|
+
i %= out;
|
|
108
|
+
output.splice(i++, 0, n);
|
|
109
|
+
}
|
|
110
|
+
return String.fromCodePoint(...output);
|
|
111
|
+
};
|
|
112
|
+
const encode = function(_input) {
|
|
113
|
+
const output = [];
|
|
114
|
+
const input = ucs2decode(_input);
|
|
115
|
+
const inputLength = input.length;
|
|
116
|
+
let n = initialN;
|
|
117
|
+
let delta = 0;
|
|
118
|
+
let bias = initialBias;
|
|
119
|
+
for (const currentValue of input) if (currentValue < 128) output.push(stringFromCharCode(currentValue));
|
|
120
|
+
const basicLength = output.length;
|
|
121
|
+
let handledCPCount = basicLength;
|
|
122
|
+
if (basicLength) output.push(delimiter);
|
|
123
|
+
while (handledCPCount < inputLength) {
|
|
124
|
+
let m = maxInt;
|
|
125
|
+
for (const currentValue of input) if (currentValue >= n && currentValue < m) m = currentValue;
|
|
126
|
+
const handledCPCountPlusOne = handledCPCount + 1;
|
|
127
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) error("overflow");
|
|
128
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
129
|
+
n = m;
|
|
130
|
+
for (const currentValue of input) {
|
|
131
|
+
if (currentValue < n && ++delta > maxInt) error("overflow");
|
|
132
|
+
if (currentValue === n) {
|
|
133
|
+
let q = delta;
|
|
134
|
+
for (let k = base;; k += base) {
|
|
135
|
+
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
136
|
+
if (q < t) break;
|
|
137
|
+
const qMinusT = q - t;
|
|
138
|
+
const baseMinusT = base - t;
|
|
139
|
+
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
|
|
140
|
+
q = floor(qMinusT / baseMinusT);
|
|
141
|
+
}
|
|
142
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
143
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
|
144
|
+
delta = 0;
|
|
145
|
+
++handledCPCount;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
++delta;
|
|
149
|
+
++n;
|
|
150
|
+
}
|
|
151
|
+
return output.join("");
|
|
152
|
+
};
|
|
153
|
+
const toUnicode = function(input) {
|
|
154
|
+
return mapDomain(input, function(string) {
|
|
155
|
+
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
const toASCII = function(input) {
|
|
159
|
+
return mapDomain(input, function(string) {
|
|
160
|
+
return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/querystring/querystring.mjs
|
|
165
|
+
var ERR_INVALID_URI = class extends URIError {
|
|
166
|
+
code = "ERR_INVALID_URI";
|
|
167
|
+
constructor() {
|
|
168
|
+
super("URI malformed");
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const hexTable = Array.from({ length: 256 });
|
|
172
|
+
for (let i = 0; i < 256; ++i) hexTable[i] = "%" + String.prototype.toUpperCase.call((i < 16 ? "0" : "") + Number.prototype.toString.call(i, 16));
|
|
173
|
+
new Int8Array([
|
|
174
|
+
0,
|
|
175
|
+
0,
|
|
176
|
+
0,
|
|
177
|
+
0,
|
|
178
|
+
0,
|
|
179
|
+
0,
|
|
180
|
+
0,
|
|
181
|
+
0,
|
|
182
|
+
0,
|
|
183
|
+
0,
|
|
184
|
+
0,
|
|
185
|
+
0,
|
|
186
|
+
0,
|
|
187
|
+
0,
|
|
188
|
+
0,
|
|
189
|
+
0,
|
|
190
|
+
0,
|
|
191
|
+
0,
|
|
192
|
+
0,
|
|
193
|
+
0,
|
|
194
|
+
0,
|
|
195
|
+
0,
|
|
196
|
+
0,
|
|
197
|
+
0,
|
|
198
|
+
0,
|
|
199
|
+
0,
|
|
200
|
+
0,
|
|
201
|
+
0,
|
|
202
|
+
0,
|
|
203
|
+
0,
|
|
204
|
+
0,
|
|
205
|
+
0,
|
|
206
|
+
0,
|
|
207
|
+
0,
|
|
208
|
+
0,
|
|
209
|
+
0,
|
|
210
|
+
0,
|
|
211
|
+
0,
|
|
212
|
+
0,
|
|
213
|
+
0,
|
|
214
|
+
0,
|
|
215
|
+
0,
|
|
216
|
+
0,
|
|
217
|
+
0,
|
|
218
|
+
0,
|
|
219
|
+
0,
|
|
220
|
+
0,
|
|
221
|
+
0,
|
|
222
|
+
1,
|
|
223
|
+
1,
|
|
224
|
+
1,
|
|
225
|
+
1,
|
|
226
|
+
1,
|
|
227
|
+
1,
|
|
228
|
+
1,
|
|
229
|
+
1,
|
|
230
|
+
1,
|
|
231
|
+
1,
|
|
232
|
+
0,
|
|
233
|
+
0,
|
|
234
|
+
0,
|
|
235
|
+
0,
|
|
236
|
+
0,
|
|
237
|
+
0,
|
|
238
|
+
0,
|
|
239
|
+
1,
|
|
240
|
+
1,
|
|
241
|
+
1,
|
|
242
|
+
1,
|
|
243
|
+
1,
|
|
244
|
+
1,
|
|
245
|
+
0,
|
|
246
|
+
0,
|
|
247
|
+
0,
|
|
248
|
+
0,
|
|
249
|
+
0,
|
|
250
|
+
0,
|
|
251
|
+
0,
|
|
252
|
+
0,
|
|
253
|
+
0,
|
|
254
|
+
0,
|
|
255
|
+
0,
|
|
256
|
+
0,
|
|
257
|
+
0,
|
|
258
|
+
0,
|
|
259
|
+
0,
|
|
260
|
+
0,
|
|
261
|
+
0,
|
|
262
|
+
0,
|
|
263
|
+
0,
|
|
264
|
+
0,
|
|
265
|
+
0,
|
|
266
|
+
0,
|
|
267
|
+
0,
|
|
268
|
+
0,
|
|
269
|
+
0,
|
|
270
|
+
0,
|
|
271
|
+
1,
|
|
272
|
+
1,
|
|
273
|
+
1,
|
|
274
|
+
1,
|
|
275
|
+
1,
|
|
276
|
+
1,
|
|
277
|
+
0,
|
|
278
|
+
0,
|
|
279
|
+
0,
|
|
280
|
+
0,
|
|
281
|
+
0,
|
|
282
|
+
0,
|
|
283
|
+
0,
|
|
284
|
+
0,
|
|
285
|
+
0,
|
|
286
|
+
0,
|
|
287
|
+
0,
|
|
288
|
+
0,
|
|
289
|
+
0,
|
|
290
|
+
0,
|
|
291
|
+
0,
|
|
292
|
+
0,
|
|
293
|
+
0,
|
|
294
|
+
0,
|
|
295
|
+
0,
|
|
296
|
+
0,
|
|
297
|
+
0,
|
|
298
|
+
0,
|
|
299
|
+
0,
|
|
300
|
+
0,
|
|
301
|
+
0,
|
|
302
|
+
0,
|
|
303
|
+
0,
|
|
304
|
+
0,
|
|
305
|
+
0,
|
|
306
|
+
0,
|
|
307
|
+
0,
|
|
308
|
+
0,
|
|
309
|
+
0,
|
|
310
|
+
0,
|
|
311
|
+
0,
|
|
312
|
+
0,
|
|
313
|
+
0,
|
|
314
|
+
0,
|
|
315
|
+
0,
|
|
316
|
+
0,
|
|
317
|
+
0,
|
|
318
|
+
0,
|
|
319
|
+
0,
|
|
320
|
+
0,
|
|
321
|
+
0,
|
|
322
|
+
0,
|
|
323
|
+
0,
|
|
324
|
+
0,
|
|
325
|
+
0,
|
|
326
|
+
0,
|
|
327
|
+
0,
|
|
328
|
+
0,
|
|
329
|
+
0,
|
|
330
|
+
0,
|
|
331
|
+
0,
|
|
332
|
+
0,
|
|
333
|
+
0,
|
|
334
|
+
0,
|
|
335
|
+
0,
|
|
336
|
+
0,
|
|
337
|
+
0,
|
|
338
|
+
0,
|
|
339
|
+
0,
|
|
340
|
+
0,
|
|
341
|
+
0,
|
|
342
|
+
0,
|
|
343
|
+
0,
|
|
344
|
+
0,
|
|
345
|
+
0,
|
|
346
|
+
0,
|
|
347
|
+
0,
|
|
348
|
+
0,
|
|
349
|
+
0,
|
|
350
|
+
0,
|
|
351
|
+
0,
|
|
352
|
+
0,
|
|
353
|
+
0,
|
|
354
|
+
0,
|
|
355
|
+
0,
|
|
356
|
+
0,
|
|
357
|
+
0,
|
|
358
|
+
0,
|
|
359
|
+
0,
|
|
360
|
+
0,
|
|
361
|
+
0,
|
|
362
|
+
0,
|
|
363
|
+
0,
|
|
364
|
+
0,
|
|
365
|
+
0,
|
|
366
|
+
0,
|
|
367
|
+
0,
|
|
368
|
+
0,
|
|
369
|
+
0,
|
|
370
|
+
0,
|
|
371
|
+
0,
|
|
372
|
+
0,
|
|
373
|
+
0,
|
|
374
|
+
0,
|
|
375
|
+
0,
|
|
376
|
+
0,
|
|
377
|
+
0,
|
|
378
|
+
0,
|
|
379
|
+
0,
|
|
380
|
+
0,
|
|
381
|
+
0,
|
|
382
|
+
0,
|
|
383
|
+
0,
|
|
384
|
+
0,
|
|
385
|
+
0,
|
|
386
|
+
0,
|
|
387
|
+
0,
|
|
388
|
+
0,
|
|
389
|
+
0,
|
|
390
|
+
0,
|
|
391
|
+
0,
|
|
392
|
+
0,
|
|
393
|
+
0,
|
|
394
|
+
0,
|
|
395
|
+
0,
|
|
396
|
+
0,
|
|
397
|
+
0,
|
|
398
|
+
0,
|
|
399
|
+
0,
|
|
400
|
+
0,
|
|
401
|
+
0,
|
|
402
|
+
0,
|
|
403
|
+
0,
|
|
404
|
+
0,
|
|
405
|
+
0,
|
|
406
|
+
0,
|
|
407
|
+
0,
|
|
408
|
+
0,
|
|
409
|
+
0,
|
|
410
|
+
0,
|
|
411
|
+
0,
|
|
412
|
+
0,
|
|
413
|
+
0,
|
|
414
|
+
0,
|
|
415
|
+
0,
|
|
416
|
+
0,
|
|
417
|
+
0,
|
|
418
|
+
0,
|
|
419
|
+
0,
|
|
420
|
+
0,
|
|
421
|
+
0,
|
|
422
|
+
0,
|
|
423
|
+
0,
|
|
424
|
+
0,
|
|
425
|
+
0,
|
|
426
|
+
0,
|
|
427
|
+
0,
|
|
428
|
+
0,
|
|
429
|
+
0
|
|
430
|
+
]);
|
|
431
|
+
function encodeStr(str, noEscapeTable, hexTable) {
|
|
432
|
+
const len = str.length;
|
|
433
|
+
if (len === 0) return "";
|
|
434
|
+
let out = "";
|
|
435
|
+
let lastPos = 0;
|
|
436
|
+
let i = 0;
|
|
437
|
+
outer: for (; i < len; i++) {
|
|
438
|
+
let c = String.prototype.charCodeAt.call(str, i);
|
|
439
|
+
while (c < 128) {
|
|
440
|
+
if (noEscapeTable[c] !== 1) {
|
|
441
|
+
if (lastPos < i) out += String.prototype.slice.call(str, lastPos, i);
|
|
442
|
+
lastPos = i + 1;
|
|
443
|
+
out += hexTable[c];
|
|
444
|
+
}
|
|
445
|
+
if (++i === len) break outer;
|
|
446
|
+
c = String.prototype.charCodeAt.call(str, i);
|
|
447
|
+
}
|
|
448
|
+
if (lastPos < i) out += String.prototype.slice.call(str, lastPos, i);
|
|
449
|
+
if (c < 2048) {
|
|
450
|
+
lastPos = i + 1;
|
|
451
|
+
out += hexTable[192 | c >> 6] + hexTable[128 | c & 63];
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (c < 55296 || c >= 57344) {
|
|
455
|
+
lastPos = i + 1;
|
|
456
|
+
out += hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
++i;
|
|
460
|
+
if (i >= len) throw new ERR_INVALID_URI();
|
|
461
|
+
const c2 = String.prototype.charCodeAt.call(str, i) & 1023;
|
|
462
|
+
lastPos = i + 1;
|
|
463
|
+
c = 65536 + ((c & 1023) << 10 | c2);
|
|
464
|
+
out += hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
|
|
465
|
+
}
|
|
466
|
+
if (lastPos === 0) return str;
|
|
467
|
+
if (lastPos < len) return out + String.prototype.slice.call(str, lastPos);
|
|
468
|
+
return out;
|
|
469
|
+
}
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/url/util.mjs
|
|
472
|
+
function spliceOne(list, index) {
|
|
473
|
+
for (; index + 1 < list.length; index++) list[index] = list[index + 1];
|
|
474
|
+
list.pop();
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/url/errors.mjs
|
|
478
|
+
function fmt(val) {
|
|
479
|
+
if (Array.isArray(val)) return val.map((v) => fmt(v)).join(" or ");
|
|
480
|
+
if (!val) return "" + val;
|
|
481
|
+
return val.toString();
|
|
482
|
+
}
|
|
483
|
+
var ERR_INVALID_ARG_VALUE = class extends TypeError {
|
|
484
|
+
code = "ERR_INVALID_ARG_VALUE";
|
|
485
|
+
constructor(name, value, reason) {
|
|
486
|
+
super(`The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${value}`);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
var ERR_INVALID_ARG_TYPE = class extends TypeError {
|
|
490
|
+
code = "ERR_INVALID_ARG_TYPE";
|
|
491
|
+
constructor(name, expected, actual) {
|
|
492
|
+
super(`The "${name}" argument must be of type ${fmt(expected)}. Received ${fmt(actual)}`);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
var ERR_INVALID_URL = class extends TypeError {
|
|
496
|
+
code = "ERR_INVALID_URL";
|
|
497
|
+
input;
|
|
498
|
+
base;
|
|
499
|
+
constructor(input, base) {
|
|
500
|
+
super("Invalid URL");
|
|
501
|
+
this.input = input;
|
|
502
|
+
if (base != null) this.base = base;
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
var ERR_INVALID_URL_SCHEME = class extends TypeError {
|
|
506
|
+
code = "ERR_INVALID_URL_SCHEME";
|
|
507
|
+
constructor(expected) {
|
|
508
|
+
super(`The URL must be of scheme ${expected}`);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
var ERR_INVALID_FILE_URL_PATH = class extends TypeError {
|
|
512
|
+
code = "ERR_INVALID_FILE_URL_PATH";
|
|
513
|
+
constructor(path) {
|
|
514
|
+
super(`Invalid ile URL path: ${path}`);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
var ERR_INVALID_FILE_URL_HOST = class extends TypeError {
|
|
518
|
+
code = "ERR_INVALID_FILE_URL_HOST";
|
|
519
|
+
constructor(host) {
|
|
520
|
+
super(`File URL host must be "localhost" or empty on ${host}`);
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
//#endregion
|
|
524
|
+
//#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/url/url.mjs
|
|
525
|
+
const unsafeProtocol = /* @__PURE__ */ new Set(["javascript", "javascript:"]);
|
|
526
|
+
const hostlessProtocol = /* @__PURE__ */ new Set(["javascript", "javascript:"]);
|
|
527
|
+
const slashedProtocol = /* @__PURE__ */ new Set([
|
|
528
|
+
"http",
|
|
529
|
+
"http:",
|
|
530
|
+
"https",
|
|
531
|
+
"https:",
|
|
532
|
+
"ftp",
|
|
533
|
+
"ftp:",
|
|
534
|
+
"gopher",
|
|
535
|
+
"gopher:",
|
|
536
|
+
"file",
|
|
537
|
+
"file:",
|
|
538
|
+
"ws",
|
|
539
|
+
"ws:",
|
|
540
|
+
"wss",
|
|
541
|
+
"wss:"
|
|
542
|
+
]);
|
|
543
|
+
const FORWARD_SLASH = /\//g;
|
|
544
|
+
function pathToFileURL$1(filepath, options) {
|
|
545
|
+
const windows = options?.windows;
|
|
546
|
+
if (windows && String.prototype.startsWith.call(filepath, "\\\\")) {
|
|
547
|
+
const outURL = new URL("file://");
|
|
548
|
+
const prefixLength = String.prototype.startsWith.call(filepath, "\\\\?\\UNC\\") ? 8 : 2;
|
|
549
|
+
const hostnameEndIndex = String.prototype.indexOf.call(filepath, "\\", prefixLength);
|
|
550
|
+
if (hostnameEndIndex === -1) throw new ERR_INVALID_ARG_VALUE("path", filepath, "Missing UNC resource path");
|
|
551
|
+
const hostname = String.prototype.slice.call(filepath, prefixLength, hostnameEndIndex);
|
|
552
|
+
outURL.hostname = toASCII(hostname);
|
|
553
|
+
outURL.pathname = encodePathChars(filepath.slice(hostnameEndIndex).replace(backslashRegEx, "/"), { windows });
|
|
554
|
+
return outURL;
|
|
555
|
+
}
|
|
556
|
+
let resolved = windows ? path.win32.resolve(filepath) : path.posix.resolve(filepath);
|
|
557
|
+
const filePathLast = String.prototype.charCodeAt.call(filepath, filepath.length - 1);
|
|
558
|
+
if ((filePathLast === 47 || windows && filePathLast === 92) && resolved.at(-1) !== path.sep) resolved += "/";
|
|
559
|
+
resolved = encodePathChars(resolved, { windows });
|
|
560
|
+
if (String.prototype.indexOf.call(resolved, "?") !== -1) resolved = resolved.replace(questionRegex, "%3F");
|
|
561
|
+
if (String.prototype.indexOf.call(resolved, "#") !== -1) resolved = resolved.replace(hashRegex, "%23");
|
|
562
|
+
return new URL(`file://${resolved}`);
|
|
563
|
+
}
|
|
564
|
+
function fileURLToPath$1(path, options) {
|
|
565
|
+
const windows = options?.windows;
|
|
566
|
+
if (typeof path === "string") path = new URL(path);
|
|
567
|
+
else if (!isURL(path)) throw new ERR_INVALID_ARG_TYPE("path", ["string", "URL"], path);
|
|
568
|
+
if (path.protocol !== "file:") throw new ERR_INVALID_URL_SCHEME("file");
|
|
569
|
+
return windows ? getPathFromURLWin32(path) : getPathFromURLPosix(path);
|
|
570
|
+
}
|
|
571
|
+
function urlToHttpOptions(url) {
|
|
572
|
+
const { hostname, pathname, port, username, password, search } = url;
|
|
573
|
+
return {
|
|
574
|
+
__proto__: null,
|
|
575
|
+
...url,
|
|
576
|
+
protocol: url.protocol,
|
|
577
|
+
hostname: hostname && String.prototype.startsWith.call(hostname, "[") ? String.prototype.slice.call(hostname, 1, -1) : hostname,
|
|
578
|
+
hash: url.hash,
|
|
579
|
+
search,
|
|
580
|
+
pathname,
|
|
581
|
+
path: `${pathname || ""}${search || ""}`,
|
|
582
|
+
href: url.href,
|
|
583
|
+
port: port === "" ? void 0 : Number(port),
|
|
584
|
+
auth: username || password ? `${decodeURIComponent(username)}:${decodeURIComponent(password)}` : void 0
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
const percentRegEx = /%/g;
|
|
588
|
+
const backslashRegEx = /\\/g;
|
|
589
|
+
const newlineRegEx = /\n/g;
|
|
590
|
+
const carriageReturnRegEx = /\r/g;
|
|
591
|
+
const tabRegEx = /\t/g;
|
|
592
|
+
const questionRegex = /\?/g;
|
|
593
|
+
const hashRegex = /#/g;
|
|
594
|
+
function encodePathChars(filepath, options) {
|
|
595
|
+
const windows = options?.windows;
|
|
596
|
+
if (String.prototype.indexOf.call(filepath, "%") !== -1) filepath = filepath.replace(percentRegEx, "%25");
|
|
597
|
+
if (!windows && String.prototype.indexOf.call(filepath, "\\") !== -1) filepath = filepath.replace(backslashRegEx, "%5C");
|
|
598
|
+
if (String.prototype.indexOf.call(filepath, "\n") !== -1) filepath = filepath.replace(newlineRegEx, "%0A");
|
|
599
|
+
if (String.prototype.indexOf.call(filepath, "\r") !== -1) filepath = filepath.replace(carriageReturnRegEx, "%0D");
|
|
600
|
+
if (String.prototype.indexOf.call(filepath, " ") !== -1) filepath = filepath.replace(tabRegEx, "%09");
|
|
601
|
+
return filepath;
|
|
602
|
+
}
|
|
603
|
+
function getPathFromURLWin32(url) {
|
|
604
|
+
const hostname = url.hostname;
|
|
605
|
+
let pathname = url.pathname;
|
|
606
|
+
for (let n = 0; n < pathname.length; n++) if (pathname[n] === "%") {
|
|
607
|
+
const third = pathname.codePointAt(n + 2) | 32;
|
|
608
|
+
if (pathname[n + 1] === "2" && third === 102 || pathname[n + 1] === "5" && third === 99) throw new ERR_INVALID_FILE_URL_PATH(String.raw`must not include encoded \ or / characters`);
|
|
609
|
+
}
|
|
610
|
+
pathname = pathname.replace(FORWARD_SLASH, "\\");
|
|
611
|
+
pathname = decodeURIComponent(pathname);
|
|
612
|
+
if (hostname !== "") return `\\\\${toUnicode(hostname)}${pathname}`;
|
|
613
|
+
const letter = String.prototype.codePointAt.call(pathname, 1) | 32;
|
|
614
|
+
const sep = String.prototype.charAt.call(pathname, 2);
|
|
615
|
+
if (letter < 97 || letter > 122 || sep !== ":") throw new ERR_INVALID_FILE_URL_PATH("must be absolute");
|
|
616
|
+
return String.prototype.slice.call(pathname, 1);
|
|
617
|
+
}
|
|
618
|
+
function getPathFromURLPosix(url) {
|
|
619
|
+
if (url.hostname !== "") throw new ERR_INVALID_FILE_URL_HOST("??");
|
|
620
|
+
const pathname = url.pathname;
|
|
621
|
+
for (let n = 0; n < pathname.length; n++) if (pathname[n] === "%") {
|
|
622
|
+
const third = String.prototype.codePointAt.call(pathname, n + 2) | 32;
|
|
623
|
+
if (pathname[n + 1] === "2" && third === 102) throw new ERR_INVALID_FILE_URL_PATH("must not include encoded / characters");
|
|
624
|
+
}
|
|
625
|
+
return decodeURIComponent(pathname);
|
|
626
|
+
}
|
|
627
|
+
function isURL(self) {
|
|
628
|
+
return Boolean(self?.href && self.protocol && self.auth === void 0 && self.path === void 0);
|
|
629
|
+
}
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/url.mjs
|
|
632
|
+
var Url = class Url {
|
|
633
|
+
auth = null;
|
|
634
|
+
hash = null;
|
|
635
|
+
host = null;
|
|
636
|
+
hostname = null;
|
|
637
|
+
href = null;
|
|
638
|
+
path = null;
|
|
639
|
+
pathname = null;
|
|
640
|
+
protocol = null;
|
|
641
|
+
search = null;
|
|
642
|
+
slashes = null;
|
|
643
|
+
port = null;
|
|
644
|
+
query = null;
|
|
645
|
+
parse(url, parseQueryString, slashesDenoteHost) {
|
|
646
|
+
if (typeof url !== "string") throw new ERR_INVALID_ARG_TYPE("url", "string", url);
|
|
647
|
+
let hasHash = false;
|
|
648
|
+
let hasAt = false;
|
|
649
|
+
let start = -1;
|
|
650
|
+
let end = -1;
|
|
651
|
+
let rest = "";
|
|
652
|
+
let lastPos = 0;
|
|
653
|
+
for (let i = 0, inWs = false, split = false; i < url.length; ++i) {
|
|
654
|
+
const code = url.charCodeAt(i);
|
|
655
|
+
const isWs = code < 33 || code === 160 || code === 65279;
|
|
656
|
+
if (start === -1) {
|
|
657
|
+
if (isWs) continue;
|
|
658
|
+
lastPos = start = i;
|
|
659
|
+
} else if (inWs) {
|
|
660
|
+
if (!isWs) {
|
|
661
|
+
end = -1;
|
|
662
|
+
inWs = false;
|
|
663
|
+
}
|
|
664
|
+
} else if (isWs) {
|
|
665
|
+
end = i;
|
|
666
|
+
inWs = true;
|
|
667
|
+
}
|
|
668
|
+
if (!split) switch (code) {
|
|
669
|
+
case 64:
|
|
670
|
+
hasAt = true;
|
|
671
|
+
break;
|
|
672
|
+
case 35: hasHash = true;
|
|
673
|
+
case 63:
|
|
674
|
+
split = true;
|
|
675
|
+
break;
|
|
676
|
+
case 92:
|
|
677
|
+
if (i - lastPos > 0) rest += url.slice(lastPos, i);
|
|
678
|
+
rest += "/";
|
|
679
|
+
lastPos = i + 1;
|
|
680
|
+
}
|
|
681
|
+
else if (!hasHash && code === 35) hasHash = true;
|
|
682
|
+
}
|
|
683
|
+
if (start !== -1) {
|
|
684
|
+
if (lastPos === start) {
|
|
685
|
+
if (end === -1) {
|
|
686
|
+
if (start === 0) rest = url;
|
|
687
|
+
else rest = url.slice(start);
|
|
688
|
+
} else rest = url.slice(start, end);
|
|
689
|
+
} else if (end === -1 && lastPos < url.length) rest += url.slice(lastPos);
|
|
690
|
+
else if (end !== -1 && lastPos < end) rest += url.slice(lastPos, end);
|
|
691
|
+
}
|
|
692
|
+
if (!slashesDenoteHost && !hasHash && !hasAt) {
|
|
693
|
+
const simplePath = simplePathPattern.exec(rest);
|
|
694
|
+
if (simplePath) {
|
|
695
|
+
this.path = rest;
|
|
696
|
+
this.href = rest;
|
|
697
|
+
this.pathname = simplePath[1];
|
|
698
|
+
if (simplePath[2]) {
|
|
699
|
+
this.search = simplePath[2];
|
|
700
|
+
if (parseQueryString) this.query = querystring.parse(this.search.slice(1));
|
|
701
|
+
else this.query = this.search.slice(1);
|
|
702
|
+
} else if (parseQueryString) {
|
|
703
|
+
this.search = null;
|
|
704
|
+
this.query = { __proto__: null };
|
|
705
|
+
}
|
|
706
|
+
return this;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const protoMatch = protocolPattern.exec(rest);
|
|
710
|
+
let proto, lowerProto;
|
|
711
|
+
if (protoMatch) {
|
|
712
|
+
proto = protoMatch[0];
|
|
713
|
+
lowerProto = proto.toLowerCase();
|
|
714
|
+
this.protocol = lowerProto;
|
|
715
|
+
rest = rest.slice(proto.length);
|
|
716
|
+
}
|
|
717
|
+
let slashes;
|
|
718
|
+
if (slashesDenoteHost || proto || hostPattern.test(rest)) {
|
|
719
|
+
slashes = rest.charCodeAt(0) === 47 && rest.charCodeAt(1) === 47;
|
|
720
|
+
if (slashes && !(proto && hostlessProtocol.has(lowerProto))) {
|
|
721
|
+
rest = rest.slice(2);
|
|
722
|
+
this.slashes = true;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (!hostlessProtocol.has(lowerProto) && (slashes || proto && !slashedProtocol.has(proto))) {
|
|
726
|
+
let hostEnd = -1;
|
|
727
|
+
let atSign = -1;
|
|
728
|
+
let nonHost = -1;
|
|
729
|
+
for (let i = 0; i < rest.length; ++i) {
|
|
730
|
+
switch (rest.charCodeAt(i)) {
|
|
731
|
+
case 9:
|
|
732
|
+
case 10:
|
|
733
|
+
case 13:
|
|
734
|
+
rest = rest.slice(0, i) + rest.slice(i + 1);
|
|
735
|
+
i -= 1;
|
|
736
|
+
break;
|
|
737
|
+
case 32:
|
|
738
|
+
case 34:
|
|
739
|
+
case 37:
|
|
740
|
+
case 39:
|
|
741
|
+
case 59:
|
|
742
|
+
case 60:
|
|
743
|
+
case 62:
|
|
744
|
+
case 92:
|
|
745
|
+
case 94:
|
|
746
|
+
case 96:
|
|
747
|
+
case 123:
|
|
748
|
+
case 124:
|
|
749
|
+
case 125:
|
|
750
|
+
if (nonHost === -1) nonHost = i;
|
|
751
|
+
break;
|
|
752
|
+
case 35:
|
|
753
|
+
case 47:
|
|
754
|
+
case 63:
|
|
755
|
+
if (nonHost === -1) nonHost = i;
|
|
756
|
+
hostEnd = i;
|
|
757
|
+
break;
|
|
758
|
+
case 64:
|
|
759
|
+
atSign = i;
|
|
760
|
+
nonHost = -1;
|
|
761
|
+
}
|
|
762
|
+
if (hostEnd !== -1) break;
|
|
763
|
+
}
|
|
764
|
+
start = 0;
|
|
765
|
+
if (atSign !== -1) {
|
|
766
|
+
this.auth = decodeURIComponent(rest.slice(0, atSign));
|
|
767
|
+
start = atSign + 1;
|
|
768
|
+
}
|
|
769
|
+
if (nonHost === -1) {
|
|
770
|
+
this.host = rest.slice(start);
|
|
771
|
+
rest = "";
|
|
772
|
+
} else {
|
|
773
|
+
this.host = rest.slice(start, nonHost);
|
|
774
|
+
rest = rest.slice(nonHost);
|
|
775
|
+
}
|
|
776
|
+
this.parseHost();
|
|
777
|
+
if (typeof this.hostname !== "string") this.hostname = "";
|
|
778
|
+
const hostname = this.hostname;
|
|
779
|
+
const ipv6Hostname = isIpv6Hostname(hostname);
|
|
780
|
+
if (!ipv6Hostname) rest = getHostname(this, rest, hostname, url);
|
|
781
|
+
if (this.hostname.length > hostnameMaxLen) this.hostname = "";
|
|
782
|
+
else this.hostname = this.hostname.toLowerCase();
|
|
783
|
+
if (this.hostname !== "") {
|
|
784
|
+
if (ipv6Hostname) {
|
|
785
|
+
if (forbiddenHostCharsIpv6.test(this.hostname)) throw new ERR_INVALID_URL(url);
|
|
786
|
+
} else {
|
|
787
|
+
this.hostname = toASCII(this.hostname);
|
|
788
|
+
if (this.hostname === "" || forbiddenHostChars.test(this.hostname)) throw new ERR_INVALID_URL(url);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
const p = this.port ? ":" + this.port : "";
|
|
792
|
+
const h = this.hostname || "";
|
|
793
|
+
this.host = h + p;
|
|
794
|
+
if (ipv6Hostname) {
|
|
795
|
+
this.hostname = this.hostname.slice(1, -1);
|
|
796
|
+
if (rest[0] !== "/") rest = "/" + rest;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
if (!unsafeProtocol.has(lowerProto)) rest = autoEscapeStr(rest);
|
|
800
|
+
let questionIdx = -1;
|
|
801
|
+
let hashIdx = -1;
|
|
802
|
+
for (let i = 0; i < rest.length; ++i) {
|
|
803
|
+
const code = rest.charCodeAt(i);
|
|
804
|
+
if (code === 35) {
|
|
805
|
+
this.hash = rest.slice(i);
|
|
806
|
+
hashIdx = i;
|
|
807
|
+
break;
|
|
808
|
+
} else if (code === 63 && questionIdx === -1) questionIdx = i;
|
|
809
|
+
}
|
|
810
|
+
if (questionIdx !== -1) {
|
|
811
|
+
if (hashIdx === -1) {
|
|
812
|
+
this.search = rest.slice(questionIdx);
|
|
813
|
+
this.query = rest.slice(questionIdx + 1);
|
|
814
|
+
} else {
|
|
815
|
+
this.search = rest.slice(questionIdx, hashIdx);
|
|
816
|
+
this.query = rest.slice(questionIdx + 1, hashIdx);
|
|
817
|
+
}
|
|
818
|
+
if (parseQueryString) this.query = querystring.parse(this.query);
|
|
819
|
+
} else if (parseQueryString) {
|
|
820
|
+
this.search = null;
|
|
821
|
+
this.query = { __proto__: null };
|
|
822
|
+
}
|
|
823
|
+
const firstIdx = questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx) ? questionIdx : hashIdx;
|
|
824
|
+
if (firstIdx === -1) {
|
|
825
|
+
if (rest.length > 0) this.pathname = rest;
|
|
826
|
+
} else if (firstIdx > 0) this.pathname = rest.slice(0, firstIdx);
|
|
827
|
+
if (slashedProtocol.has(lowerProto) && this.hostname && !this.pathname) this.pathname = "/";
|
|
828
|
+
if (this.pathname || this.search) {
|
|
829
|
+
const p = this.pathname || "";
|
|
830
|
+
const s = this.search || "";
|
|
831
|
+
this.path = p + s;
|
|
832
|
+
}
|
|
833
|
+
this.href = this.format();
|
|
834
|
+
return this;
|
|
835
|
+
}
|
|
836
|
+
format() {
|
|
837
|
+
let auth = this.auth || "";
|
|
838
|
+
if (auth) {
|
|
839
|
+
auth = encodeStr(auth, noEscapeAuth, hexTable);
|
|
840
|
+
auth += "@";
|
|
841
|
+
}
|
|
842
|
+
let protocol = this.protocol || "";
|
|
843
|
+
let pathname = this.pathname || "";
|
|
844
|
+
let hash = this.hash || "";
|
|
845
|
+
let host = "";
|
|
846
|
+
let query = "";
|
|
847
|
+
if (this.host) host = auth + this.host;
|
|
848
|
+
else if (this.hostname) {
|
|
849
|
+
host = auth + (this.hostname.includes(":") && !isIpv6Hostname(this.hostname) ? "[" + this.hostname + "]" : this.hostname);
|
|
850
|
+
if (this.port) host += ":" + this.port;
|
|
851
|
+
}
|
|
852
|
+
if (this.query !== null && typeof this.query === "object") query = querystring.stringify(this.query);
|
|
853
|
+
let search = this.search || query && "?" + query || "";
|
|
854
|
+
if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58) protocol += ":";
|
|
855
|
+
let newPathname = "";
|
|
856
|
+
let lastPos = 0;
|
|
857
|
+
for (let i = 0; i < pathname.length; ++i) switch (pathname.charCodeAt(i)) {
|
|
858
|
+
case 35:
|
|
859
|
+
if (i - lastPos > 0) newPathname += pathname.slice(lastPos, i);
|
|
860
|
+
newPathname += "%23";
|
|
861
|
+
lastPos = i + 1;
|
|
862
|
+
break;
|
|
863
|
+
case 63:
|
|
864
|
+
if (i - lastPos > 0) newPathname += pathname.slice(lastPos, i);
|
|
865
|
+
newPathname += "%3F";
|
|
866
|
+
lastPos = i + 1;
|
|
867
|
+
}
|
|
868
|
+
if (lastPos > 0) {
|
|
869
|
+
if (lastPos === pathname.length) pathname = newPathname;
|
|
870
|
+
else pathname = newPathname + pathname.slice(lastPos);
|
|
871
|
+
}
|
|
872
|
+
if (this.slashes || slashedProtocol.has(protocol)) {
|
|
873
|
+
if (this.slashes || host) {
|
|
874
|
+
if (pathname && pathname.charCodeAt(0) !== 47) pathname = "/" + pathname;
|
|
875
|
+
host = "//" + host;
|
|
876
|
+
} else if (protocol.length >= 4 && protocol.charCodeAt(0) === 102 && protocol.charCodeAt(1) === 105 && protocol.charCodeAt(2) === 108 && protocol.charCodeAt(3) === 101) host = "//";
|
|
877
|
+
}
|
|
878
|
+
search = search.replace(/#/g, "%23");
|
|
879
|
+
if (hash && hash.charCodeAt(0) !== 35) hash = "#" + hash;
|
|
880
|
+
if (search && search.charCodeAt(0) !== 63) search = "?" + search;
|
|
881
|
+
return protocol + host + pathname + search + hash;
|
|
882
|
+
}
|
|
883
|
+
resolve(relative) {
|
|
884
|
+
return this.resolveObject(urlParse(relative, false, true)).format();
|
|
885
|
+
}
|
|
886
|
+
resolveObject(relative) {
|
|
887
|
+
if (typeof relative === "string") {
|
|
888
|
+
const rel = new Url();
|
|
889
|
+
rel.parse(relative, false, true);
|
|
890
|
+
relative = rel;
|
|
891
|
+
}
|
|
892
|
+
const result = new Url();
|
|
893
|
+
Object.assign(result, this);
|
|
894
|
+
result.hash = relative.hash;
|
|
895
|
+
if (relative.href === "") {
|
|
896
|
+
result.href = result.format();
|
|
897
|
+
return result;
|
|
898
|
+
}
|
|
899
|
+
if (relative.slashes && !relative.protocol) {
|
|
900
|
+
const relativeWithoutProtocol = Object.keys(relative).reduce((acc, key) => {
|
|
901
|
+
if (key !== "protocol") acc[key] = relative[key];
|
|
902
|
+
return acc;
|
|
903
|
+
}, {});
|
|
904
|
+
Object.assign(result, relativeWithoutProtocol);
|
|
905
|
+
if (slashedProtocol.has(result.protocol) && result.hostname && !result.pathname) result.path = result.pathname = "/";
|
|
906
|
+
result.href = result.format();
|
|
907
|
+
return result;
|
|
908
|
+
}
|
|
909
|
+
if (relative.protocol && relative.protocol !== result.protocol) {
|
|
910
|
+
if (!slashedProtocol.has(relative.protocol)) {
|
|
911
|
+
Object.assign(result, relative);
|
|
912
|
+
result.href = result.format();
|
|
913
|
+
return result;
|
|
914
|
+
}
|
|
915
|
+
result.protocol = relative.protocol;
|
|
916
|
+
if (!relative.host && !/^file:?$/.test(relative.protocol) && !hostlessProtocol.has(relative.protocol)) {
|
|
917
|
+
const relPath = (relative.pathname || "").split("/");
|
|
918
|
+
while (relPath.length > 0 && !(relative.host = relPath.shift()));
|
|
919
|
+
if (!relative.host) relative.host = "";
|
|
920
|
+
if (!relative.hostname) relative.hostname = "";
|
|
921
|
+
if (relPath[0] !== "") relPath.unshift("");
|
|
922
|
+
if (relPath.length < 2) relPath.unshift("");
|
|
923
|
+
result.pathname = relPath.join("/");
|
|
924
|
+
} else result.pathname = relative.pathname;
|
|
925
|
+
result.search = relative.search;
|
|
926
|
+
result.query = relative.query;
|
|
927
|
+
result.host = relative.host || "";
|
|
928
|
+
result.auth = relative.auth;
|
|
929
|
+
result.hostname = relative.hostname || relative.host;
|
|
930
|
+
result.port = relative.port;
|
|
931
|
+
if (result.pathname || result.search) result.path = (result.pathname || "") + (result.search || "");
|
|
932
|
+
result.slashes = result.slashes || relative.slashes;
|
|
933
|
+
result.href = result.format();
|
|
934
|
+
return result;
|
|
935
|
+
}
|
|
936
|
+
const isSourceAbs = result.pathname && result.pathname.charAt(0) === "/";
|
|
937
|
+
const isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === "/";
|
|
938
|
+
let mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname;
|
|
939
|
+
const removeAllDots = mustEndAbs;
|
|
940
|
+
let srcPath = result.pathname && result.pathname.split("/") || [];
|
|
941
|
+
const relPath = relative.pathname && relative.pathname.split("/") || [];
|
|
942
|
+
const noLeadingSlashes = result.protocol && !slashedProtocol.has(result.protocol);
|
|
943
|
+
if (noLeadingSlashes) {
|
|
944
|
+
result.hostname = "";
|
|
945
|
+
result.port = null;
|
|
946
|
+
if (result.host) {
|
|
947
|
+
if (srcPath[0] === "") srcPath[0] = result.host;
|
|
948
|
+
else srcPath.unshift(result.host);
|
|
949
|
+
}
|
|
950
|
+
result.host = "";
|
|
951
|
+
if (relative.protocol) {
|
|
952
|
+
relative.hostname = null;
|
|
953
|
+
relative.port = null;
|
|
954
|
+
result.auth = null;
|
|
955
|
+
if (relative.host) {
|
|
956
|
+
if (relPath[0] === "") relPath[0] = relative.host;
|
|
957
|
+
else relPath.unshift(relative.host);
|
|
958
|
+
}
|
|
959
|
+
relative.host = null;
|
|
960
|
+
}
|
|
961
|
+
mustEndAbs = mustEndAbs && (relPath[0] === "" || srcPath[0] === "");
|
|
962
|
+
}
|
|
963
|
+
if (isRelAbs) {
|
|
964
|
+
if (relative.host || relative.host === "") {
|
|
965
|
+
if (result.host !== relative.host) result.auth = null;
|
|
966
|
+
result.host = relative.host;
|
|
967
|
+
result.port = relative.port;
|
|
968
|
+
}
|
|
969
|
+
if (relative.hostname || relative.hostname === "") {
|
|
970
|
+
if (result.hostname !== relative.hostname) result.auth = null;
|
|
971
|
+
result.hostname = relative.hostname;
|
|
972
|
+
}
|
|
973
|
+
result.search = relative.search;
|
|
974
|
+
result.query = relative.query;
|
|
975
|
+
srcPath = relPath;
|
|
976
|
+
} else if (relPath.length > 0) {
|
|
977
|
+
if (!srcPath) srcPath = [];
|
|
978
|
+
srcPath.pop();
|
|
979
|
+
srcPath = srcPath.concat(relPath);
|
|
980
|
+
result.search = relative.search;
|
|
981
|
+
result.query = relative.query;
|
|
982
|
+
} else if (relative.search !== null && relative.search !== void 0) {
|
|
983
|
+
if (noLeadingSlashes) {
|
|
984
|
+
result.hostname = result.host = srcPath.shift();
|
|
985
|
+
const authInHost = result.host && result.host.indexOf("@") > 0 && result.host.split("@");
|
|
986
|
+
if (authInHost) {
|
|
987
|
+
result.auth = authInHost.shift();
|
|
988
|
+
result.host = result.hostname = authInHost.shift();
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
result.search = relative.search;
|
|
992
|
+
result.query = relative.query;
|
|
993
|
+
if (result.pathname !== null || result.search !== null) result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
|
|
994
|
+
result.href = result.format();
|
|
995
|
+
return result;
|
|
996
|
+
}
|
|
997
|
+
if (srcPath.length === 0) {
|
|
998
|
+
result.pathname = null;
|
|
999
|
+
if (result.search) result.path = "/" + result.search;
|
|
1000
|
+
else result.path = null;
|
|
1001
|
+
result.href = result.format();
|
|
1002
|
+
return result;
|
|
1003
|
+
}
|
|
1004
|
+
let last = srcPath.at(-1);
|
|
1005
|
+
const hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === "." || last === "..") || last === "";
|
|
1006
|
+
let up = 0;
|
|
1007
|
+
for (let i = srcPath.length - 1; i >= 0; i--) {
|
|
1008
|
+
last = srcPath[i];
|
|
1009
|
+
if (last === ".") spliceOne(srcPath, i);
|
|
1010
|
+
else if (last === "..") {
|
|
1011
|
+
spliceOne(srcPath, i);
|
|
1012
|
+
up++;
|
|
1013
|
+
} else if (up) {
|
|
1014
|
+
spliceOne(srcPath, i);
|
|
1015
|
+
up--;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
if (!mustEndAbs && !removeAllDots) while (up--) srcPath.unshift("..");
|
|
1019
|
+
if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charAt(0) !== "/")) srcPath.unshift("");
|
|
1020
|
+
if (hasTrailingSlash && srcPath.join("/").slice(-1) !== "/") srcPath.push("");
|
|
1021
|
+
const isAbsolute = srcPath[0] === "" || srcPath[0] && srcPath[0].charAt(0) === "/";
|
|
1022
|
+
if (noLeadingSlashes) {
|
|
1023
|
+
result.hostname = result.host = isAbsolute ? "" : srcPath.length > 0 ? srcPath.shift() : "";
|
|
1024
|
+
const authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
|
|
1025
|
+
if (authInHost) {
|
|
1026
|
+
result.auth = authInHost.shift();
|
|
1027
|
+
result.host = result.hostname = authInHost.shift();
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
mustEndAbs = mustEndAbs || result.host && srcPath.length;
|
|
1031
|
+
if (mustEndAbs && !isAbsolute) srcPath.unshift("");
|
|
1032
|
+
if (srcPath.length === 0) {
|
|
1033
|
+
result.pathname = null;
|
|
1034
|
+
result.path = null;
|
|
1035
|
+
} else result.pathname = srcPath.join("/");
|
|
1036
|
+
if (result.pathname !== null || result.search !== null) result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
|
|
1037
|
+
result.auth = relative.auth || result.auth;
|
|
1038
|
+
result.slashes = result.slashes || relative.slashes;
|
|
1039
|
+
result.href = result.format();
|
|
1040
|
+
return result;
|
|
1041
|
+
}
|
|
1042
|
+
parseHost() {
|
|
1043
|
+
let host = this.host;
|
|
1044
|
+
const portMatch = portPattern.exec(host);
|
|
1045
|
+
if (portMatch) {
|
|
1046
|
+
const port = portMatch[0];
|
|
1047
|
+
if (port !== ":") this.port = port.slice(1);
|
|
1048
|
+
host = host.slice(0, host.length - port.length);
|
|
1049
|
+
}
|
|
1050
|
+
if (host) this.hostname = host;
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
const protocolPattern = /^[\d+.a-z-]+:/i;
|
|
1054
|
+
const portPattern = /:\d*$/;
|
|
1055
|
+
const hostPattern = /^\/\/[^/@]+@[^/@]+/;
|
|
1056
|
+
const simplePathPattern = /^(\/\/?(?!\/)[^\s?]*)(\?\S*)?$/;
|
|
1057
|
+
const forbiddenHostChars = /[\0\t\n\r #%/:<>?@[\\\]^|]/;
|
|
1058
|
+
const forbiddenHostCharsIpv6 = /[\0\t\n\r #%/<>?@\\^|]/;
|
|
1059
|
+
const noEscapeAuth = new Int8Array([
|
|
1060
|
+
0,
|
|
1061
|
+
0,
|
|
1062
|
+
0,
|
|
1063
|
+
0,
|
|
1064
|
+
0,
|
|
1065
|
+
0,
|
|
1066
|
+
0,
|
|
1067
|
+
0,
|
|
1068
|
+
0,
|
|
1069
|
+
0,
|
|
1070
|
+
0,
|
|
1071
|
+
0,
|
|
1072
|
+
0,
|
|
1073
|
+
0,
|
|
1074
|
+
0,
|
|
1075
|
+
0,
|
|
1076
|
+
0,
|
|
1077
|
+
0,
|
|
1078
|
+
0,
|
|
1079
|
+
0,
|
|
1080
|
+
0,
|
|
1081
|
+
0,
|
|
1082
|
+
0,
|
|
1083
|
+
0,
|
|
1084
|
+
0,
|
|
1085
|
+
0,
|
|
1086
|
+
0,
|
|
1087
|
+
0,
|
|
1088
|
+
0,
|
|
1089
|
+
0,
|
|
1090
|
+
0,
|
|
1091
|
+
0,
|
|
1092
|
+
0,
|
|
1093
|
+
1,
|
|
1094
|
+
0,
|
|
1095
|
+
0,
|
|
1096
|
+
0,
|
|
1097
|
+
0,
|
|
1098
|
+
0,
|
|
1099
|
+
1,
|
|
1100
|
+
1,
|
|
1101
|
+
1,
|
|
1102
|
+
1,
|
|
1103
|
+
0,
|
|
1104
|
+
0,
|
|
1105
|
+
1,
|
|
1106
|
+
1,
|
|
1107
|
+
0,
|
|
1108
|
+
1,
|
|
1109
|
+
1,
|
|
1110
|
+
1,
|
|
1111
|
+
1,
|
|
1112
|
+
1,
|
|
1113
|
+
1,
|
|
1114
|
+
1,
|
|
1115
|
+
1,
|
|
1116
|
+
1,
|
|
1117
|
+
1,
|
|
1118
|
+
1,
|
|
1119
|
+
0,
|
|
1120
|
+
0,
|
|
1121
|
+
0,
|
|
1122
|
+
0,
|
|
1123
|
+
0,
|
|
1124
|
+
0,
|
|
1125
|
+
1,
|
|
1126
|
+
1,
|
|
1127
|
+
1,
|
|
1128
|
+
1,
|
|
1129
|
+
1,
|
|
1130
|
+
1,
|
|
1131
|
+
1,
|
|
1132
|
+
1,
|
|
1133
|
+
1,
|
|
1134
|
+
1,
|
|
1135
|
+
1,
|
|
1136
|
+
1,
|
|
1137
|
+
1,
|
|
1138
|
+
1,
|
|
1139
|
+
1,
|
|
1140
|
+
1,
|
|
1141
|
+
1,
|
|
1142
|
+
1,
|
|
1143
|
+
1,
|
|
1144
|
+
1,
|
|
1145
|
+
1,
|
|
1146
|
+
1,
|
|
1147
|
+
1,
|
|
1148
|
+
1,
|
|
1149
|
+
1,
|
|
1150
|
+
1,
|
|
1151
|
+
0,
|
|
1152
|
+
0,
|
|
1153
|
+
0,
|
|
1154
|
+
0,
|
|
1155
|
+
1,
|
|
1156
|
+
0,
|
|
1157
|
+
1,
|
|
1158
|
+
1,
|
|
1159
|
+
1,
|
|
1160
|
+
1,
|
|
1161
|
+
1,
|
|
1162
|
+
1,
|
|
1163
|
+
1,
|
|
1164
|
+
1,
|
|
1165
|
+
1,
|
|
1166
|
+
1,
|
|
1167
|
+
1,
|
|
1168
|
+
1,
|
|
1169
|
+
1,
|
|
1170
|
+
1,
|
|
1171
|
+
1,
|
|
1172
|
+
1,
|
|
1173
|
+
1,
|
|
1174
|
+
1,
|
|
1175
|
+
1,
|
|
1176
|
+
1,
|
|
1177
|
+
1,
|
|
1178
|
+
1,
|
|
1179
|
+
1,
|
|
1180
|
+
1,
|
|
1181
|
+
1,
|
|
1182
|
+
1,
|
|
1183
|
+
0,
|
|
1184
|
+
0,
|
|
1185
|
+
0,
|
|
1186
|
+
1,
|
|
1187
|
+
0
|
|
1188
|
+
]);
|
|
1189
|
+
const escapedCodes = [
|
|
1190
|
+
"",
|
|
1191
|
+
"",
|
|
1192
|
+
"",
|
|
1193
|
+
"",
|
|
1194
|
+
"",
|
|
1195
|
+
"",
|
|
1196
|
+
"",
|
|
1197
|
+
"",
|
|
1198
|
+
"",
|
|
1199
|
+
"%09",
|
|
1200
|
+
"%0A",
|
|
1201
|
+
"",
|
|
1202
|
+
"",
|
|
1203
|
+
"%0D",
|
|
1204
|
+
"",
|
|
1205
|
+
"",
|
|
1206
|
+
"",
|
|
1207
|
+
"",
|
|
1208
|
+
"",
|
|
1209
|
+
"",
|
|
1210
|
+
"",
|
|
1211
|
+
"",
|
|
1212
|
+
"",
|
|
1213
|
+
"",
|
|
1214
|
+
"",
|
|
1215
|
+
"",
|
|
1216
|
+
"",
|
|
1217
|
+
"",
|
|
1218
|
+
"",
|
|
1219
|
+
"",
|
|
1220
|
+
"",
|
|
1221
|
+
"",
|
|
1222
|
+
"%20",
|
|
1223
|
+
"",
|
|
1224
|
+
"%22",
|
|
1225
|
+
"",
|
|
1226
|
+
"",
|
|
1227
|
+
"",
|
|
1228
|
+
"",
|
|
1229
|
+
"%27",
|
|
1230
|
+
"",
|
|
1231
|
+
"",
|
|
1232
|
+
"",
|
|
1233
|
+
"",
|
|
1234
|
+
"",
|
|
1235
|
+
"",
|
|
1236
|
+
"",
|
|
1237
|
+
"",
|
|
1238
|
+
"",
|
|
1239
|
+
"",
|
|
1240
|
+
"",
|
|
1241
|
+
"",
|
|
1242
|
+
"",
|
|
1243
|
+
"",
|
|
1244
|
+
"",
|
|
1245
|
+
"",
|
|
1246
|
+
"",
|
|
1247
|
+
"",
|
|
1248
|
+
"",
|
|
1249
|
+
"",
|
|
1250
|
+
"%3C",
|
|
1251
|
+
"",
|
|
1252
|
+
"%3E",
|
|
1253
|
+
"",
|
|
1254
|
+
"",
|
|
1255
|
+
"",
|
|
1256
|
+
"",
|
|
1257
|
+
"",
|
|
1258
|
+
"",
|
|
1259
|
+
"",
|
|
1260
|
+
"",
|
|
1261
|
+
"",
|
|
1262
|
+
"",
|
|
1263
|
+
"",
|
|
1264
|
+
"",
|
|
1265
|
+
"",
|
|
1266
|
+
"",
|
|
1267
|
+
"",
|
|
1268
|
+
"",
|
|
1269
|
+
"",
|
|
1270
|
+
"",
|
|
1271
|
+
"",
|
|
1272
|
+
"",
|
|
1273
|
+
"",
|
|
1274
|
+
"",
|
|
1275
|
+
"",
|
|
1276
|
+
"",
|
|
1277
|
+
"",
|
|
1278
|
+
"",
|
|
1279
|
+
"",
|
|
1280
|
+
"",
|
|
1281
|
+
"",
|
|
1282
|
+
"%5C",
|
|
1283
|
+
"",
|
|
1284
|
+
"%5E",
|
|
1285
|
+
"",
|
|
1286
|
+
"%60",
|
|
1287
|
+
"",
|
|
1288
|
+
"",
|
|
1289
|
+
"",
|
|
1290
|
+
"",
|
|
1291
|
+
"",
|
|
1292
|
+
"",
|
|
1293
|
+
"",
|
|
1294
|
+
"",
|
|
1295
|
+
"",
|
|
1296
|
+
"",
|
|
1297
|
+
"",
|
|
1298
|
+
"",
|
|
1299
|
+
"",
|
|
1300
|
+
"",
|
|
1301
|
+
"",
|
|
1302
|
+
"",
|
|
1303
|
+
"",
|
|
1304
|
+
"",
|
|
1305
|
+
"",
|
|
1306
|
+
"",
|
|
1307
|
+
"",
|
|
1308
|
+
"",
|
|
1309
|
+
"",
|
|
1310
|
+
"",
|
|
1311
|
+
"",
|
|
1312
|
+
"",
|
|
1313
|
+
"%7B",
|
|
1314
|
+
"%7C",
|
|
1315
|
+
"%7D"
|
|
1316
|
+
];
|
|
1317
|
+
const hostnameMaxLen = 255;
|
|
1318
|
+
let urlParseWarned = false;
|
|
1319
|
+
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
|
1320
|
+
if (!urlParseWarned) {
|
|
1321
|
+
urlParseWarned = true;
|
|
1322
|
+
console.warn("[DeprecationWarning] [unenv] [node:url] DEP0169: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.");
|
|
1323
|
+
}
|
|
1324
|
+
if (url instanceof Url) return url;
|
|
1325
|
+
const urlObject = new Url();
|
|
1326
|
+
urlObject.parse(url, parseQueryString, slashesDenoteHost);
|
|
1327
|
+
return urlObject;
|
|
1328
|
+
}
|
|
1329
|
+
function isIpv6Hostname(hostname) {
|
|
1330
|
+
return String.prototype.charCodeAt.call(hostname, 0) === 91 && String.prototype.charCodeAt.call(hostname, hostname.length - 1) === 93;
|
|
1331
|
+
}
|
|
1332
|
+
let warnInvalidPort = true;
|
|
1333
|
+
function getHostname(self, rest, hostname, url) {
|
|
1334
|
+
for (let i = 0; i < hostname.length; ++i) {
|
|
1335
|
+
const code = hostname.charCodeAt(i);
|
|
1336
|
+
if (!(code !== 47 && code !== 92 && code !== 35 && code !== 63 && code !== 58)) {
|
|
1337
|
+
if (warnInvalidPort && code === 58) {
|
|
1338
|
+
console.warn(`[DeprecationWarning] [unenv] [node:url] DEP0170: The URL ${url} is invalid. Future versions of Node.js will throw an error.`);
|
|
1339
|
+
warnInvalidPort = false;
|
|
1340
|
+
}
|
|
1341
|
+
self.hostname = hostname.slice(0, i);
|
|
1342
|
+
return `/${hostname.slice(i)}${rest}`;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
return rest;
|
|
1346
|
+
}
|
|
1347
|
+
function autoEscapeStr(rest) {
|
|
1348
|
+
let escaped = "";
|
|
1349
|
+
let lastEscapedPos = 0;
|
|
1350
|
+
for (let i = 0; i < rest.length; ++i) {
|
|
1351
|
+
const escapedChar = escapedCodes[rest.charCodeAt(i)];
|
|
1352
|
+
if (escapedChar) {
|
|
1353
|
+
if (i > lastEscapedPos) escaped += rest.slice(lastEscapedPos, i);
|
|
1354
|
+
escaped += escapedChar;
|
|
1355
|
+
lastEscapedPos = i + 1;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
if (lastEscapedPos === 0) return rest;
|
|
1359
|
+
if (lastEscapedPos < rest.length) escaped += rest.slice(lastEscapedPos);
|
|
1360
|
+
return escaped;
|
|
1361
|
+
}
|
|
1362
|
+
function urlFormat(urlObject, options) {
|
|
1363
|
+
if (typeof urlObject === "string") urlObject = urlParse(urlObject);
|
|
1364
|
+
else if (typeof urlObject !== "object" || urlObject === null) throw new ERR_INVALID_ARG_TYPE("urlObject", ["Object", "string"], urlObject);
|
|
1365
|
+
else if (urlObject instanceof URL$1) {
|
|
1366
|
+
let fragment = true;
|
|
1367
|
+
let unicode = false;
|
|
1368
|
+
let search = true;
|
|
1369
|
+
let auth = true;
|
|
1370
|
+
if (options) {
|
|
1371
|
+
if (options.fragment != null) fragment = Boolean(options.fragment);
|
|
1372
|
+
if (options.unicode != null) unicode = Boolean(options.unicode);
|
|
1373
|
+
if (options.search != null) search = Boolean(options.search);
|
|
1374
|
+
if (options.auth != null) auth = Boolean(options.auth);
|
|
1375
|
+
}
|
|
1376
|
+
const _url = new URL$1(urlObject.href);
|
|
1377
|
+
if (!fragment) _url.hash = "";
|
|
1378
|
+
if (!search) _url.search = "";
|
|
1379
|
+
if (!auth) _url.username = _url.password = "";
|
|
1380
|
+
if (unicode) return Url.prototype.format.call(_url);
|
|
1381
|
+
return _url.href;
|
|
1382
|
+
}
|
|
1383
|
+
return Url.prototype.format.call(urlObject);
|
|
1384
|
+
}
|
|
1385
|
+
function urlResolve(source, relative) {
|
|
1386
|
+
return urlParse(source, false, true).resolve(relative);
|
|
1387
|
+
}
|
|
1388
|
+
function urlResolveObject(source, relative) {
|
|
1389
|
+
if (!source) return relative;
|
|
1390
|
+
return urlParse(source, false, true).resolveObject(relative);
|
|
1391
|
+
}
|
|
1392
|
+
function pathToFileURL(path, options) {
|
|
1393
|
+
return pathToFileURL$1(path, options);
|
|
1394
|
+
}
|
|
1395
|
+
const URL$1 = globalThis.URL;
|
|
1396
|
+
const URLSearchParams = globalThis.URLSearchParams;
|
|
1397
|
+
const domainToASCII = toASCII;
|
|
1398
|
+
const domainToUnicode = toUnicode;
|
|
1399
|
+
var url_default$1 = {
|
|
1400
|
+
Url,
|
|
1401
|
+
parse: urlParse,
|
|
1402
|
+
resolve: urlResolve,
|
|
1403
|
+
resolveObject: urlResolveObject,
|
|
1404
|
+
format: urlFormat,
|
|
1405
|
+
URL: URL$1,
|
|
1406
|
+
URLSearchParams,
|
|
1407
|
+
domainToASCII,
|
|
1408
|
+
domainToUnicode,
|
|
1409
|
+
pathToFileURL,
|
|
1410
|
+
fileURLToPath: fileURLToPath$1,
|
|
1411
|
+
urlToHttpOptions
|
|
1412
|
+
};
|
|
1413
|
+
//#endregion
|
|
1414
|
+
//#region src/node/url.ts
|
|
1415
|
+
const fileURLToPath = (url, options) => {
|
|
1416
|
+
const parsed = typeof url === "string" ? new URL(url) : url;
|
|
1417
|
+
const page = globalThis.location;
|
|
1418
|
+
if (!/^https?:$/.test(parsed.protocol) || parsed.origin !== page?.origin) return fileURLToPath$1(url, options);
|
|
1419
|
+
return decodeURIComponent(parsed.pathname.replace(/^\/@fs\//, "/"));
|
|
1420
|
+
};
|
|
1421
|
+
var url_default = {
|
|
1422
|
+
...url_default$1,
|
|
1423
|
+
fileURLToPath
|
|
1424
|
+
};
|
|
1425
|
+
//#endregion
|
|
1426
|
+
export { URL$1 as URL, URLSearchParams, Url, url_default as default, domainToASCII, domainToUnicode, fileURLToPath, urlFormat as format, urlParse as parse, pathToFileURL, urlResolve as resolve, urlResolveObject as resolveObject, urlToHttpOptions };
|