usage-board 1.0.0 → 2.0.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/dist/index.mjs +18 -9
- package/dist/public/_nuxt/B-CIibMz.js +25 -0
- package/dist/public/_nuxt/BFLIXB9O.js +9 -0
- package/dist/public/_nuxt/{DcPhnO3V.js → BNPuv5_2.js} +18 -18
- package/dist/public/_nuxt/Brp07rVz.js +3 -0
- package/dist/public/_nuxt/Bvg0CuDs.js +258 -0
- package/dist/public/_nuxt/CvpNFEwm.js +1 -0
- package/dist/public/_nuxt/D3pogf62.js +1 -0
- package/dist/public/_nuxt/{DLRBRF52.js → D9KD20BD.js} +1 -1
- package/dist/public/_nuxt/DUfyK9T8.js +21 -0
- package/dist/public/_nuxt/{BKFuB2T3.js → DsWoOjFk.js} +2 -2
- package/dist/public/_nuxt/builds/latest.json +1 -1
- package/dist/public/_nuxt/builds/meta/38460625-fa40-4f13-86da-ddec4bfb4ab8.json +1 -0
- package/dist/public/_nuxt/entry.CJkVK2j6.css +1 -0
- package/dist/public/_nuxt/{CileeSf2.js → f_iPFAtL.js} +1 -1
- package/dist/server/chunks/_/error-500.mjs +14 -0
- package/dist/server/chunks/_/index.min.mjs +348 -0
- package/dist/server/chunks/_/shared.cjs.prod.mjs +1 -1
- package/dist/server/chunks/build/client.precomputed.mjs +1 -1
- package/dist/server/chunks/nitro/nitro.mjs +164 -815
- package/dist/server/chunks/routes/api/payload.json.mjs +10 -348
- package/dist/server/chunks/routes/renderer.mjs +1 -2
- package/dist/server/chunks/routes/ws.mjs +1063 -0
- package/dist/server/index.mjs +1 -2
- package/package.json +6 -2
- package/dist/public/_nuxt/BNf7fR7M.js +0 -282
- package/dist/public/_nuxt/DAg3mJyk.js +0 -1
- package/dist/public/_nuxt/DoxGa6D0.js +0 -9
- package/dist/public/_nuxt/DptRzj9K.js +0 -3
- package/dist/public/_nuxt/builds/meta/12cca5fc-d3df-4df1-b723-c944bdd0c587.json +0 -1
- package/dist/public/_nuxt/entry.DrzELaFO.css +0 -1
|
@@ -8,7 +8,6 @@ import { EventEmitter } from 'node:events';
|
|
|
8
8
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
9
9
|
import { createHash } from 'node:crypto';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
|
-
import { Readable, PassThrough } from 'node:stream';
|
|
12
11
|
import { formatWithOptions } from 'node:util';
|
|
13
12
|
import g$2 from 'node:process';
|
|
14
13
|
import * as tty from 'node:tty';
|
|
@@ -49,7 +48,7 @@ function decodeQueryValue(text) {
|
|
|
49
48
|
return decode(text.replace(PLUS_RE, " "));
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
function parseQuery
|
|
51
|
+
function parseQuery(parametersString = "") {
|
|
53
52
|
const object = /* @__PURE__ */ Object.create(null);
|
|
54
53
|
if (parametersString[0] === "?") {
|
|
55
54
|
parametersString = parametersString.slice(1);
|
|
@@ -156,12 +155,12 @@ function withoutBase(input, base) {
|
|
|
156
155
|
}
|
|
157
156
|
function withQuery(input, query) {
|
|
158
157
|
const parsed = parseURL(input);
|
|
159
|
-
const mergedQuery = { ...parseQuery
|
|
158
|
+
const mergedQuery = { ...parseQuery(parsed.search), ...query };
|
|
160
159
|
parsed.search = stringifyQuery(mergedQuery);
|
|
161
160
|
return stringifyParsedURL(parsed);
|
|
162
161
|
}
|
|
163
|
-
function getQuery$
|
|
164
|
-
return parseQuery
|
|
162
|
+
function getQuery$1(input) {
|
|
163
|
+
return parseQuery(parseURL(input).search);
|
|
165
164
|
}
|
|
166
165
|
function isEmptyURL(url) {
|
|
167
166
|
return !url || url === "/";
|
|
@@ -666,10 +665,10 @@ class H3Error extends Error {
|
|
|
666
665
|
toJSON() {
|
|
667
666
|
const obj = {
|
|
668
667
|
message: this.message,
|
|
669
|
-
statusCode: sanitizeStatusCode
|
|
668
|
+
statusCode: sanitizeStatusCode(this.statusCode, 500)
|
|
670
669
|
};
|
|
671
670
|
if (this.statusMessage) {
|
|
672
|
-
obj.statusMessage = sanitizeStatusMessage
|
|
671
|
+
obj.statusMessage = sanitizeStatusMessage(this.statusMessage);
|
|
673
672
|
}
|
|
674
673
|
if (this.data !== void 0) {
|
|
675
674
|
obj.data = this.data;
|
|
@@ -677,7 +676,7 @@ class H3Error extends Error {
|
|
|
677
676
|
return obj;
|
|
678
677
|
}
|
|
679
678
|
}
|
|
680
|
-
function createError$
|
|
679
|
+
function createError$1(input) {
|
|
681
680
|
if (typeof input === "string") {
|
|
682
681
|
return new H3Error(input);
|
|
683
682
|
}
|
|
@@ -705,9 +704,9 @@ function createError$2(input) {
|
|
|
705
704
|
err.data = input.data;
|
|
706
705
|
}
|
|
707
706
|
if (input.statusCode) {
|
|
708
|
-
err.statusCode = sanitizeStatusCode
|
|
707
|
+
err.statusCode = sanitizeStatusCode(input.statusCode, err.statusCode);
|
|
709
708
|
} else if (input.status) {
|
|
710
|
-
err.statusCode = sanitizeStatusCode
|
|
709
|
+
err.statusCode = sanitizeStatusCode(input.status, err.statusCode);
|
|
711
710
|
}
|
|
712
711
|
if (input.statusMessage) {
|
|
713
712
|
err.statusMessage = input.statusMessage;
|
|
@@ -716,7 +715,7 @@ function createError$2(input) {
|
|
|
716
715
|
}
|
|
717
716
|
if (err.statusMessage) {
|
|
718
717
|
const originalMessage = err.statusMessage;
|
|
719
|
-
const sanitizedMessage = sanitizeStatusMessage
|
|
718
|
+
const sanitizedMessage = sanitizeStatusMessage(err.statusMessage);
|
|
720
719
|
if (sanitizedMessage !== originalMessage) {
|
|
721
720
|
console.warn(
|
|
722
721
|
"[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future, `statusMessage` will be sanitized by default."
|
|
@@ -735,7 +734,7 @@ function sendError(event, error, debug) {
|
|
|
735
734
|
if (event.handled) {
|
|
736
735
|
return;
|
|
737
736
|
}
|
|
738
|
-
const h3Error = isError(error) ? error : createError$
|
|
737
|
+
const h3Error = isError(error) ? error : createError$1(error);
|
|
739
738
|
const responseBody = {
|
|
740
739
|
statusCode: h3Error.statusCode,
|
|
741
740
|
statusMessage: h3Error.statusMessage,
|
|
@@ -757,8 +756,8 @@ function isError(input) {
|
|
|
757
756
|
return input?.constructor?.__h3_error__ === true;
|
|
758
757
|
}
|
|
759
758
|
|
|
760
|
-
function getQuery
|
|
761
|
-
return getQuery$
|
|
759
|
+
function getQuery(event) {
|
|
760
|
+
return getQuery$1(event.path || "");
|
|
762
761
|
}
|
|
763
762
|
function isMethod(event, expected, allowHead) {
|
|
764
763
|
if (typeof expected === "string") {
|
|
@@ -772,7 +771,7 @@ function isMethod(event, expected, allowHead) {
|
|
|
772
771
|
}
|
|
773
772
|
function assertMethod(event, expected, allowHead) {
|
|
774
773
|
if (!isMethod(event, expected)) {
|
|
775
|
-
throw createError$
|
|
774
|
+
throw createError$1({
|
|
776
775
|
statusCode: 405,
|
|
777
776
|
statusMessage: "HTTP method is not allowed."
|
|
778
777
|
});
|
|
@@ -791,7 +790,7 @@ function getRequestHeader(event, name) {
|
|
|
791
790
|
const value = headers[name.toLowerCase()];
|
|
792
791
|
return value;
|
|
793
792
|
}
|
|
794
|
-
function getRequestHost
|
|
793
|
+
function getRequestHost(event, opts = {}) {
|
|
795
794
|
if (opts.xForwardedHost) {
|
|
796
795
|
const _header = event.node.req.headers["x-forwarded-host"];
|
|
797
796
|
const xForwardedHost = (_header || "").split(",").shift()?.trim();
|
|
@@ -801,15 +800,15 @@ function getRequestHost$1(event, opts = {}) {
|
|
|
801
800
|
}
|
|
802
801
|
return event.node.req.headers.host || "localhost";
|
|
803
802
|
}
|
|
804
|
-
function getRequestProtocol
|
|
803
|
+
function getRequestProtocol(event, opts = {}) {
|
|
805
804
|
if (opts.xForwardedProto !== false && event.node.req.headers["x-forwarded-proto"] === "https") {
|
|
806
805
|
return "https";
|
|
807
806
|
}
|
|
808
807
|
return event.node.req.connection?.encrypted ? "https" : "http";
|
|
809
808
|
}
|
|
810
|
-
function getRequestURL
|
|
811
|
-
const host = getRequestHost
|
|
812
|
-
const protocol = getRequestProtocol
|
|
809
|
+
function getRequestURL(event, opts = {}) {
|
|
810
|
+
const host = getRequestHost(event, opts);
|
|
811
|
+
const protocol = getRequestProtocol(event, opts);
|
|
813
812
|
const path = (event.node.req.originalUrl || event.path).replace(
|
|
814
813
|
/^[/\\]+/g,
|
|
815
814
|
"/"
|
|
@@ -959,11 +958,11 @@ const MIMES = {
|
|
|
959
958
|
json: "application/json"
|
|
960
959
|
};
|
|
961
960
|
|
|
962
|
-
const DISALLOWED_STATUS_CHARS
|
|
963
|
-
function sanitizeStatusMessage
|
|
964
|
-
return statusMessage.replace(DISALLOWED_STATUS_CHARS
|
|
961
|
+
const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
|
|
962
|
+
function sanitizeStatusMessage(statusMessage = "") {
|
|
963
|
+
return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
|
|
965
964
|
}
|
|
966
|
-
function sanitizeStatusCode
|
|
965
|
+
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
|
|
967
966
|
if (!statusCode) {
|
|
968
967
|
return defaultStatusCode;
|
|
969
968
|
}
|
|
@@ -1052,7 +1051,7 @@ function sendNoContent(event, code) {
|
|
|
1052
1051
|
if (!code && event.node.res.statusCode !== 200) {
|
|
1053
1052
|
code = event.node.res.statusCode;
|
|
1054
1053
|
}
|
|
1055
|
-
const _code = sanitizeStatusCode
|
|
1054
|
+
const _code = sanitizeStatusCode(code, 204);
|
|
1056
1055
|
if (_code === 204) {
|
|
1057
1056
|
event.node.res.removeHeader("content-length");
|
|
1058
1057
|
}
|
|
@@ -1061,13 +1060,13 @@ function sendNoContent(event, code) {
|
|
|
1061
1060
|
}
|
|
1062
1061
|
function setResponseStatus(event, code, text) {
|
|
1063
1062
|
if (code) {
|
|
1064
|
-
event.node.res.statusCode = sanitizeStatusCode
|
|
1063
|
+
event.node.res.statusCode = sanitizeStatusCode(
|
|
1065
1064
|
code,
|
|
1066
1065
|
event.node.res.statusCode
|
|
1067
1066
|
);
|
|
1068
1067
|
}
|
|
1069
1068
|
if (text) {
|
|
1070
|
-
event.node.res.statusMessage = sanitizeStatusMessage
|
|
1069
|
+
event.node.res.statusMessage = sanitizeStatusMessage(text);
|
|
1071
1070
|
}
|
|
1072
1071
|
}
|
|
1073
1072
|
function getResponseStatus(event) {
|
|
@@ -1082,7 +1081,7 @@ function defaultContentType(event, type) {
|
|
|
1082
1081
|
}
|
|
1083
1082
|
}
|
|
1084
1083
|
function sendRedirect(event, location, code = 302) {
|
|
1085
|
-
event.node.res.statusCode = sanitizeStatusCode
|
|
1084
|
+
event.node.res.statusCode = sanitizeStatusCode(
|
|
1086
1085
|
code,
|
|
1087
1086
|
event.node.res.statusCode
|
|
1088
1087
|
);
|
|
@@ -1190,13 +1189,13 @@ function sendWebResponse(event, response) {
|
|
|
1190
1189
|
}
|
|
1191
1190
|
}
|
|
1192
1191
|
if (response.status) {
|
|
1193
|
-
event.node.res.statusCode = sanitizeStatusCode
|
|
1192
|
+
event.node.res.statusCode = sanitizeStatusCode(
|
|
1194
1193
|
response.status,
|
|
1195
1194
|
event.node.res.statusCode
|
|
1196
1195
|
);
|
|
1197
1196
|
}
|
|
1198
1197
|
if (response.statusText) {
|
|
1199
|
-
event.node.res.statusMessage = sanitizeStatusMessage
|
|
1198
|
+
event.node.res.statusMessage = sanitizeStatusMessage(response.statusText);
|
|
1200
1199
|
}
|
|
1201
1200
|
if (response.redirected) {
|
|
1202
1201
|
event.node.res.setHeader("location", response.url);
|
|
@@ -1231,7 +1230,7 @@ async function proxyRequest(event, target, opts = {}) {
|
|
|
1231
1230
|
}
|
|
1232
1231
|
}
|
|
1233
1232
|
const method = opts.fetchOptions?.method || event.method;
|
|
1234
|
-
const fetchHeaders = mergeHeaders$
|
|
1233
|
+
const fetchHeaders = mergeHeaders$1(
|
|
1235
1234
|
getProxyRequestHeaders(event, { host: target.startsWith("/") }),
|
|
1236
1235
|
opts.fetchOptions?.headers,
|
|
1237
1236
|
opts.headers
|
|
@@ -1257,17 +1256,17 @@ async function sendProxy(event, target, opts = {}) {
|
|
|
1257
1256
|
...opts.fetchOptions
|
|
1258
1257
|
});
|
|
1259
1258
|
} catch (error) {
|
|
1260
|
-
throw createError$
|
|
1259
|
+
throw createError$1({
|
|
1261
1260
|
status: 502,
|
|
1262
1261
|
statusMessage: "Bad Gateway",
|
|
1263
1262
|
cause: error
|
|
1264
1263
|
});
|
|
1265
1264
|
}
|
|
1266
|
-
event.node.res.statusCode = sanitizeStatusCode
|
|
1265
|
+
event.node.res.statusCode = sanitizeStatusCode(
|
|
1267
1266
|
response.status,
|
|
1268
1267
|
event.node.res.statusCode
|
|
1269
1268
|
);
|
|
1270
|
-
event.node.res.statusMessage = sanitizeStatusMessage
|
|
1269
|
+
event.node.res.statusMessage = sanitizeStatusMessage(response.statusText);
|
|
1271
1270
|
const cookies = [];
|
|
1272
1271
|
for (const [key, value] of response.headers.entries()) {
|
|
1273
1272
|
if (key === "content-encoding") {
|
|
@@ -1374,7 +1373,7 @@ function rewriteCookieProperty(header, map, property) {
|
|
|
1374
1373
|
}
|
|
1375
1374
|
);
|
|
1376
1375
|
}
|
|
1377
|
-
function mergeHeaders$
|
|
1376
|
+
function mergeHeaders$1(defaults, ...inputs) {
|
|
1378
1377
|
const _inputs = inputs.filter(Boolean);
|
|
1379
1378
|
if (_inputs.length === 0) {
|
|
1380
1379
|
return defaults;
|
|
@@ -1390,8 +1389,19 @@ function mergeHeaders$2(defaults, ...inputs) {
|
|
|
1390
1389
|
}
|
|
1391
1390
|
return merged;
|
|
1392
1391
|
}
|
|
1392
|
+
function defineWebSocketHandler(hooks) {
|
|
1393
|
+
return defineEventHandler({
|
|
1394
|
+
handler() {
|
|
1395
|
+
throw createError$1({
|
|
1396
|
+
statusCode: 426,
|
|
1397
|
+
statusMessage: "Upgrade Required"
|
|
1398
|
+
});
|
|
1399
|
+
},
|
|
1400
|
+
websocket: hooks
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1393
1403
|
|
|
1394
|
-
|
|
1404
|
+
class H3Event {
|
|
1395
1405
|
"__is_event__" = true;
|
|
1396
1406
|
// Context
|
|
1397
1407
|
node;
|
|
@@ -1454,12 +1464,12 @@ let H3Event$1 = class H3Event {
|
|
|
1454
1464
|
get res() {
|
|
1455
1465
|
return this.node.res;
|
|
1456
1466
|
}
|
|
1457
|
-
}
|
|
1467
|
+
}
|
|
1458
1468
|
function isEvent(input) {
|
|
1459
1469
|
return hasProp(input, "__is_event__");
|
|
1460
1470
|
}
|
|
1461
1471
|
function createEvent(req, res) {
|
|
1462
|
-
return new H3Event
|
|
1472
|
+
return new H3Event(req, res);
|
|
1463
1473
|
}
|
|
1464
1474
|
function _normalizeNodeHeaders(nodeHeaders) {
|
|
1465
1475
|
const headers = new Headers();
|
|
@@ -1475,7 +1485,7 @@ function _normalizeNodeHeaders(nodeHeaders) {
|
|
|
1475
1485
|
return headers;
|
|
1476
1486
|
}
|
|
1477
1487
|
|
|
1478
|
-
function defineEventHandler
|
|
1488
|
+
function defineEventHandler(handler) {
|
|
1479
1489
|
if (typeof handler === "function") {
|
|
1480
1490
|
handler.__is_handler__ = true;
|
|
1481
1491
|
return handler;
|
|
@@ -1513,7 +1523,7 @@ async function _callHandler(event, handler, hooks) {
|
|
|
1513
1523
|
}
|
|
1514
1524
|
return response.body;
|
|
1515
1525
|
}
|
|
1516
|
-
const eventHandler = defineEventHandler
|
|
1526
|
+
const eventHandler = defineEventHandler;
|
|
1517
1527
|
function isEventHandler(input) {
|
|
1518
1528
|
return hasProp(input, "__is_handler__");
|
|
1519
1529
|
}
|
|
@@ -1642,7 +1652,7 @@ function createAppEventHandler(stack, options) {
|
|
|
1642
1652
|
}
|
|
1643
1653
|
}
|
|
1644
1654
|
if (!event.handled) {
|
|
1645
|
-
throw createError$
|
|
1655
|
+
throw createError$1({
|
|
1646
1656
|
statusCode: 404,
|
|
1647
1657
|
statusMessage: `Cannot find any path matching ${event.path || "/"}.`
|
|
1648
1658
|
});
|
|
@@ -1719,7 +1729,7 @@ function handleHandlerResponse(event, val, jsonSpace) {
|
|
|
1719
1729
|
});
|
|
1720
1730
|
}
|
|
1721
1731
|
if (val instanceof Error) {
|
|
1722
|
-
throw createError$
|
|
1732
|
+
throw createError$1(val);
|
|
1723
1733
|
}
|
|
1724
1734
|
if (typeof val.end === "function") {
|
|
1725
1735
|
return true;
|
|
@@ -1735,7 +1745,7 @@ function handleHandlerResponse(event, val, jsonSpace) {
|
|
|
1735
1745
|
if (valType === "bigint") {
|
|
1736
1746
|
return send(event, val.toString(), MIMES.json);
|
|
1737
1747
|
}
|
|
1738
|
-
throw createError$
|
|
1748
|
+
throw createError$1({
|
|
1739
1749
|
statusCode: 500,
|
|
1740
1750
|
statusMessage: `[h3] Cannot send ${valType} as response.`
|
|
1741
1751
|
});
|
|
@@ -1811,7 +1821,7 @@ function createRouter(opts = {}) {
|
|
|
1811
1821
|
const matched = _router.lookup(path);
|
|
1812
1822
|
if (!matched || !matched.handlers) {
|
|
1813
1823
|
return {
|
|
1814
|
-
error: createError$
|
|
1824
|
+
error: createError$1({
|
|
1815
1825
|
statusCode: 404,
|
|
1816
1826
|
name: "Not Found",
|
|
1817
1827
|
statusMessage: `Cannot find any route matching ${path || "/"}.`
|
|
@@ -1839,7 +1849,7 @@ function createRouter(opts = {}) {
|
|
|
1839
1849
|
}
|
|
1840
1850
|
if (!handler) {
|
|
1841
1851
|
return {
|
|
1842
|
-
error: createError$
|
|
1852
|
+
error: createError$1({
|
|
1843
1853
|
statusCode: 405,
|
|
1844
1854
|
name: "Method Not Allowed",
|
|
1845
1855
|
statusMessage: `Method ${method} is not allowed on this route.`
|
|
@@ -1898,7 +1908,7 @@ function toNodeListener(app) {
|
|
|
1898
1908
|
try {
|
|
1899
1909
|
await app.handler(event);
|
|
1900
1910
|
} catch (_error) {
|
|
1901
|
-
const error = createError$
|
|
1911
|
+
const error = createError$1(_error);
|
|
1902
1912
|
if (!isError(_error)) {
|
|
1903
1913
|
error.unhandled = true;
|
|
1904
1914
|
}
|
|
@@ -2180,7 +2190,7 @@ const payloadMethods = new Set(
|
|
|
2180
2190
|
function isPayloadMethod(method = "GET") {
|
|
2181
2191
|
return payloadMethods.has(method.toUpperCase());
|
|
2182
2192
|
}
|
|
2183
|
-
function isJSONSerializable
|
|
2193
|
+
function isJSONSerializable(value) {
|
|
2184
2194
|
if (value === void 0) {
|
|
2185
2195
|
return false;
|
|
2186
2196
|
}
|
|
@@ -2364,7 +2374,7 @@ function createFetch(globalOptions = {}) {
|
|
|
2364
2374
|
}
|
|
2365
2375
|
}
|
|
2366
2376
|
if (context.options.body && isPayloadMethod(context.options.method)) {
|
|
2367
|
-
if (isJSONSerializable
|
|
2377
|
+
if (isJSONSerializable(context.options.body)) {
|
|
2368
2378
|
const contentType = context.options.headers.get("content-type");
|
|
2369
2379
|
if (typeof context.options.body !== "string") {
|
|
2370
2380
|
context.options.body = contentType === "application/x-www-form-urlencoded" ? new URLSearchParams(
|
|
@@ -3122,21 +3132,21 @@ const assets$1 = {
|
|
|
3122
3132
|
function defineDriver(factory) {
|
|
3123
3133
|
return factory;
|
|
3124
3134
|
}
|
|
3125
|
-
function createError
|
|
3135
|
+
function createError(driver, message, opts) {
|
|
3126
3136
|
const err = new Error(`[unstorage] [${driver}] ${message}`, opts);
|
|
3127
3137
|
if (Error.captureStackTrace) {
|
|
3128
|
-
Error.captureStackTrace(err, createError
|
|
3138
|
+
Error.captureStackTrace(err, createError);
|
|
3129
3139
|
}
|
|
3130
3140
|
return err;
|
|
3131
3141
|
}
|
|
3132
3142
|
function createRequiredError(driver, name) {
|
|
3133
3143
|
if (Array.isArray(name)) {
|
|
3134
|
-
return createError
|
|
3144
|
+
return createError(
|
|
3135
3145
|
driver,
|
|
3136
3146
|
`Missing some of the required options ${name.map((n) => "`" + n + "`").join(", ")}`
|
|
3137
3147
|
);
|
|
3138
3148
|
}
|
|
3139
|
-
return createError
|
|
3149
|
+
return createError(driver, `Missing required option \`${name}\`.`);
|
|
3140
3150
|
}
|
|
3141
3151
|
|
|
3142
3152
|
function ignoreNotfound(err) {
|
|
@@ -3215,7 +3225,7 @@ const unstorage_47drivers_47fs_45lite = defineDriver((opts = {}) => {
|
|
|
3215
3225
|
opts.base = resolve$1(opts.base);
|
|
3216
3226
|
const r = (key) => {
|
|
3217
3227
|
if (PATH_TRAVERSE_RE.test(key)) {
|
|
3218
|
-
throw createError
|
|
3228
|
+
throw createError(
|
|
3219
3229
|
DRIVER_NAME,
|
|
3220
3230
|
`Invalid key: ${JSON.stringify(key)}. It should not contain .. segments`
|
|
3221
3231
|
);
|
|
@@ -3752,7 +3762,7 @@ function defineCachedEventHandler(handler, opts = defaultCacheOptions()) {
|
|
|
3752
3762
|
},
|
|
3753
3763
|
_opts
|
|
3754
3764
|
);
|
|
3755
|
-
return defineEventHandler
|
|
3765
|
+
return defineEventHandler(async (event) => {
|
|
3756
3766
|
if (opts.headersOnly) {
|
|
3757
3767
|
if (handleCacheHeaders(event, { maxAge: opts.maxAge })) {
|
|
3758
3768
|
return;
|
|
@@ -4240,7 +4250,7 @@ function _expandFromEnv(value) {
|
|
|
4240
4250
|
const _inlineRuntimeConfig = {
|
|
4241
4251
|
"app": {
|
|
4242
4252
|
"baseURL": "/",
|
|
4243
|
-
"buildId": "
|
|
4253
|
+
"buildId": "38460625-fa40-4f13-86da-ddec4bfb4ab8",
|
|
4244
4254
|
"buildAssetsDir": "/_nuxt/",
|
|
4245
4255
|
"cdnURL": ""
|
|
4246
4256
|
},
|
|
@@ -4268,7 +4278,7 @@ const _inlineRuntimeConfig = {
|
|
|
4268
4278
|
}
|
|
4269
4279
|
},
|
|
4270
4280
|
"public": {
|
|
4271
|
-
"appVersion": "
|
|
4281
|
+
"appVersion": "2.0.0",
|
|
4272
4282
|
"home": "/Users/tangchenghui"
|
|
4273
4283
|
},
|
|
4274
4284
|
"icon": {
|
|
@@ -4440,7 +4450,7 @@ function createRouteRulesHandler(ctx) {
|
|
|
4440
4450
|
}
|
|
4441
4451
|
target = joinURL(target.slice(0, -3), targetPath);
|
|
4442
4452
|
} else if (event.path.includes("?")) {
|
|
4443
|
-
const query = getQuery$
|
|
4453
|
+
const query = getQuery$1(event.path);
|
|
4444
4454
|
target = withQuery(target, query);
|
|
4445
4455
|
}
|
|
4446
4456
|
return sendRedirect(event, target, routeRules.redirect.statusCode);
|
|
@@ -4455,7 +4465,7 @@ function createRouteRulesHandler(ctx) {
|
|
|
4455
4465
|
}
|
|
4456
4466
|
target = joinURL(target.slice(0, -3), targetPath);
|
|
4457
4467
|
} else if (event.path.includes("?")) {
|
|
4458
|
-
const query = getQuery$
|
|
4468
|
+
const query = getQuery$1(event.path);
|
|
4459
4469
|
target = withQuery(target, query);
|
|
4460
4470
|
}
|
|
4461
4471
|
return proxyRequest(event, target, {
|
|
@@ -4612,7 +4622,7 @@ function defaultHandler(error, event, opts) {
|
|
|
4612
4622
|
const isSensitive = error.unhandled || error.fatal;
|
|
4613
4623
|
const statusCode = error.statusCode || 500;
|
|
4614
4624
|
const statusMessage = error.statusMessage || "Server Error";
|
|
4615
|
-
const url = getRequestURL
|
|
4625
|
+
const url = getRequestURL(event, { xForwardedHost: true, xForwardedProto: true });
|
|
4616
4626
|
if (statusCode === 404) {
|
|
4617
4627
|
const baseURL = "/";
|
|
4618
4628
|
if (/^\/[^/]/.test(baseURL) && !url.pathname.startsWith(baseURL)) {
|
|
@@ -4686,114 +4696,135 @@ const assets = {
|
|
|
4686
4696
|
"/logo.svg": {
|
|
4687
4697
|
"type": "image/svg+xml",
|
|
4688
4698
|
"etag": "\"1550-fwYFdULdJ83Qp0FjnnX31iQz9oI\"",
|
|
4689
|
-
"mtime": "2026-04-
|
|
4699
|
+
"mtime": "2026-04-23T15:26:51.056Z",
|
|
4690
4700
|
"size": 5456,
|
|
4691
4701
|
"path": "../public/logo.svg"
|
|
4692
4702
|
},
|
|
4703
|
+
"/favicon.ico": {
|
|
4704
|
+
"type": "image/vnd.microsoft.icon",
|
|
4705
|
+
"etag": "\"1083e-LfyFZ+1JmdianDqe/sQN2Ou0IzQ\"",
|
|
4706
|
+
"mtime": "2026-04-23T15:26:51.056Z",
|
|
4707
|
+
"size": 67646,
|
|
4708
|
+
"path": "../public/favicon.ico"
|
|
4709
|
+
},
|
|
4693
4710
|
"/robots.txt": {
|
|
4694
4711
|
"type": "text/plain; charset=utf-8",
|
|
4695
4712
|
"etag": "\"18-j8OIsL9qGDmNZ+lHhp2tyH4XtaE\"",
|
|
4696
|
-
"mtime": "2026-04-
|
|
4713
|
+
"mtime": "2026-04-23T15:26:51.056Z",
|
|
4697
4714
|
"size": 24,
|
|
4698
4715
|
"path": "../public/robots.txt"
|
|
4699
4716
|
},
|
|
4700
|
-
"/
|
|
4701
|
-
"type": "
|
|
4702
|
-
"etag": "\"
|
|
4703
|
-
"mtime": "2026-04-
|
|
4704
|
-
"size":
|
|
4705
|
-
"path": "../public/
|
|
4717
|
+
"/_nuxt/B-CIibMz.js": {
|
|
4718
|
+
"type": "text/javascript; charset=utf-8",
|
|
4719
|
+
"etag": "\"368c-ZOAeSA1+BPFFfKwdaTmyusApI6I\"",
|
|
4720
|
+
"mtime": "2026-04-23T15:26:51.052Z",
|
|
4721
|
+
"size": 13964,
|
|
4722
|
+
"path": "../public/_nuxt/B-CIibMz.js"
|
|
4706
4723
|
},
|
|
4707
|
-
"/_nuxt/
|
|
4724
|
+
"/_nuxt/BNPuv5_2.js": {
|
|
4708
4725
|
"type": "text/javascript; charset=utf-8",
|
|
4709
|
-
"etag": "\"
|
|
4710
|
-
"mtime": "2026-04-
|
|
4711
|
-
"size":
|
|
4712
|
-
"path": "../public/_nuxt/
|
|
4726
|
+
"etag": "\"9f03-CzUVnH9DarQ693z3GqzmcnfJqyw\"",
|
|
4727
|
+
"mtime": "2026-04-23T15:26:51.053Z",
|
|
4728
|
+
"size": 40707,
|
|
4729
|
+
"path": "../public/_nuxt/BNPuv5_2.js"
|
|
4713
4730
|
},
|
|
4714
|
-
"/_nuxt/
|
|
4731
|
+
"/_nuxt/Brp07rVz.js": {
|
|
4715
4732
|
"type": "text/javascript; charset=utf-8",
|
|
4716
|
-
"etag": "\"
|
|
4717
|
-
"mtime": "2026-04-
|
|
4718
|
-
"size":
|
|
4719
|
-
"path": "../public/_nuxt/
|
|
4733
|
+
"etag": "\"5a3c-dGFqCADU7n/A9G4ZOgxbXv1vyRQ\"",
|
|
4734
|
+
"mtime": "2026-04-23T15:26:51.053Z",
|
|
4735
|
+
"size": 23100,
|
|
4736
|
+
"path": "../public/_nuxt/Brp07rVz.js"
|
|
4720
4737
|
},
|
|
4721
|
-
"/_nuxt/
|
|
4738
|
+
"/_nuxt/CvpNFEwm.js": {
|
|
4722
4739
|
"type": "text/javascript; charset=utf-8",
|
|
4723
|
-
"etag": "\"
|
|
4724
|
-
"mtime": "2026-04-
|
|
4740
|
+
"etag": "\"1d49-iv5YvgCbv1LLOgEWZLy9YnivLv0\"",
|
|
4741
|
+
"mtime": "2026-04-23T15:26:51.053Z",
|
|
4742
|
+
"size": 7497,
|
|
4743
|
+
"path": "../public/_nuxt/CvpNFEwm.js"
|
|
4744
|
+
},
|
|
4745
|
+
"/_nuxt/D3pogf62.js": {
|
|
4746
|
+
"type": "text/javascript; charset=utf-8",
|
|
4747
|
+
"etag": "\"15e9-mTmHcgDkykSIYe6CBz3u+awR8Hk\"",
|
|
4748
|
+
"mtime": "2026-04-23T15:26:51.053Z",
|
|
4749
|
+
"size": 5609,
|
|
4750
|
+
"path": "../public/_nuxt/D3pogf62.js"
|
|
4751
|
+
},
|
|
4752
|
+
"/_nuxt/D9KD20BD.js": {
|
|
4753
|
+
"type": "text/javascript; charset=utf-8",
|
|
4754
|
+
"etag": "\"d7b-r9q08XuXqXzLqvQjo70HVlhqz/o\"",
|
|
4755
|
+
"mtime": "2026-04-23T15:26:51.053Z",
|
|
4725
4756
|
"size": 3451,
|
|
4726
|
-
"path": "../public/_nuxt/
|
|
4757
|
+
"path": "../public/_nuxt/D9KD20BD.js"
|
|
4727
4758
|
},
|
|
4728
|
-
"/_nuxt/
|
|
4759
|
+
"/_nuxt/DUfyK9T8.js": {
|
|
4729
4760
|
"type": "text/javascript; charset=utf-8",
|
|
4730
|
-
"etag": "\"
|
|
4731
|
-
"mtime": "2026-04-
|
|
4732
|
-
"size":
|
|
4733
|
-
"path": "../public/_nuxt/
|
|
4761
|
+
"etag": "\"1922a-LgFusHuzZdvSKtiEjOxgdeTFj4o\"",
|
|
4762
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4763
|
+
"size": 102954,
|
|
4764
|
+
"path": "../public/_nuxt/DUfyK9T8.js"
|
|
4734
4765
|
},
|
|
4735
|
-
"/_nuxt/
|
|
4766
|
+
"/_nuxt/DsWoOjFk.js": {
|
|
4736
4767
|
"type": "text/javascript; charset=utf-8",
|
|
4737
|
-
"etag": "\"
|
|
4738
|
-
"mtime": "2026-04-
|
|
4739
|
-
"size":
|
|
4740
|
-
"path": "../public/_nuxt/
|
|
4768
|
+
"etag": "\"4ca1-rjLJXc9adkkE38QPKQ5Za0qOz28\"",
|
|
4769
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4770
|
+
"size": 19617,
|
|
4771
|
+
"path": "../public/_nuxt/DsWoOjFk.js"
|
|
4741
4772
|
},
|
|
4742
|
-
"/_nuxt/
|
|
4773
|
+
"/_nuxt/BFLIXB9O.js": {
|
|
4743
4774
|
"type": "text/javascript; charset=utf-8",
|
|
4744
|
-
"etag": "\"
|
|
4745
|
-
"mtime": "2026-04-
|
|
4746
|
-
"size":
|
|
4747
|
-
"path": "../public/_nuxt/
|
|
4775
|
+
"etag": "\"4c36d-coEJNIeYUOsQJuzqUwxrrX5OKDE\"",
|
|
4776
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4777
|
+
"size": 312173,
|
|
4778
|
+
"path": "../public/_nuxt/BFLIXB9O.js"
|
|
4748
4779
|
},
|
|
4749
4780
|
"/_nuxt/error-404.B0EXnOcv.css": {
|
|
4750
4781
|
"type": "text/css; charset=utf-8",
|
|
4751
4782
|
"etag": "\"97e-kQ0ZEshAxA5Nrtoiwq6n4Sz6H94\"",
|
|
4752
|
-
"mtime": "2026-04-
|
|
4783
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4753
4784
|
"size": 2430,
|
|
4754
4785
|
"path": "../public/_nuxt/error-404.B0EXnOcv.css"
|
|
4755
4786
|
},
|
|
4756
|
-
"/_nuxt/CileeSf2.js": {
|
|
4757
|
-
"type": "text/javascript; charset=utf-8",
|
|
4758
|
-
"etag": "\"e99-C7uDVfuL1RnLDg/SRhDRgPOIRvI\"",
|
|
4759
|
-
"mtime": "2026-04-20T08:31:06.188Z",
|
|
4760
|
-
"size": 3737,
|
|
4761
|
-
"path": "../public/_nuxt/CileeSf2.js"
|
|
4762
|
-
},
|
|
4763
4787
|
"/_nuxt/error-500.CnSNZoEG.css": {
|
|
4764
4788
|
"type": "text/css; charset=utf-8",
|
|
4765
4789
|
"etag": "\"773-muVEP28ocnl3dl4Mg2tNj2UV4+I\"",
|
|
4766
|
-
"mtime": "2026-04-
|
|
4790
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4767
4791
|
"size": 1907,
|
|
4768
4792
|
"path": "../public/_nuxt/error-500.CnSNZoEG.css"
|
|
4769
4793
|
},
|
|
4770
4794
|
"/_nuxt/builds/latest.json": {
|
|
4771
4795
|
"type": "application/json",
|
|
4772
|
-
"etag": "\"47-
|
|
4773
|
-
"mtime": "2026-04-
|
|
4796
|
+
"etag": "\"47-v5MJxL3xFqihMYxGUK+/hFODBCM\"",
|
|
4797
|
+
"mtime": "2026-04-23T15:26:51.050Z",
|
|
4774
4798
|
"size": 71,
|
|
4775
4799
|
"path": "../public/_nuxt/builds/latest.json"
|
|
4776
4800
|
},
|
|
4777
|
-
"/_nuxt/builds/meta/
|
|
4801
|
+
"/_nuxt/builds/meta/38460625-fa40-4f13-86da-ddec4bfb4ab8.json": {
|
|
4778
4802
|
"type": "application/json",
|
|
4779
|
-
"etag": "\"58-
|
|
4780
|
-
"mtime": "2026-04-
|
|
4803
|
+
"etag": "\"58-n5yNqlXR70307BUQhhRfTvwLQzA\"",
|
|
4804
|
+
"mtime": "2026-04-23T15:26:51.048Z",
|
|
4781
4805
|
"size": 88,
|
|
4782
|
-
"path": "../public/_nuxt/builds/meta/
|
|
4806
|
+
"path": "../public/_nuxt/builds/meta/38460625-fa40-4f13-86da-ddec4bfb4ab8.json"
|
|
4783
4807
|
},
|
|
4784
|
-
"/_nuxt/entry.
|
|
4808
|
+
"/_nuxt/entry.CJkVK2j6.css": {
|
|
4785
4809
|
"type": "text/css; charset=utf-8",
|
|
4786
|
-
"etag": "\"
|
|
4787
|
-
"mtime": "2026-04-
|
|
4788
|
-
"size":
|
|
4789
|
-
"path": "../public/_nuxt/entry.
|
|
4810
|
+
"etag": "\"1d46d-stbCy1Tut4jJ9o/SQqQnCWyUQuw\"",
|
|
4811
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4812
|
+
"size": 119917,
|
|
4813
|
+
"path": "../public/_nuxt/entry.CJkVK2j6.css"
|
|
4814
|
+
},
|
|
4815
|
+
"/_nuxt/f_iPFAtL.js": {
|
|
4816
|
+
"type": "text/javascript; charset=utf-8",
|
|
4817
|
+
"etag": "\"e99-THO7ycOklzpOO/J8iB0jeJdbpVc\"",
|
|
4818
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4819
|
+
"size": 3737,
|
|
4820
|
+
"path": "../public/_nuxt/f_iPFAtL.js"
|
|
4790
4821
|
},
|
|
4791
|
-
"/_nuxt/
|
|
4822
|
+
"/_nuxt/Bvg0CuDs.js": {
|
|
4792
4823
|
"type": "text/javascript; charset=utf-8",
|
|
4793
|
-
"etag": "\"
|
|
4794
|
-
"mtime": "2026-04-
|
|
4795
|
-
"size":
|
|
4796
|
-
"path": "../public/_nuxt/
|
|
4824
|
+
"etag": "\"348ac-JtGNJ4RxjwySIBnS/IM4p0s1pmc\"",
|
|
4825
|
+
"mtime": "2026-04-23T15:26:51.054Z",
|
|
4826
|
+
"size": 215212,
|
|
4827
|
+
"path": "../public/_nuxt/Bvg0CuDs.js"
|
|
4797
4828
|
}
|
|
4798
4829
|
};
|
|
4799
4830
|
|
|
@@ -4963,7 +4994,7 @@ const _4bo09N = eventHandler((event) => {
|
|
|
4963
4994
|
if (!asset) {
|
|
4964
4995
|
if (isPublicAssetURL(id)) {
|
|
4965
4996
|
removeResponseHeader(event, "Cache-Control");
|
|
4966
|
-
throw createError$
|
|
4997
|
+
throw createError$1({ statusCode: 404 });
|
|
4967
4998
|
}
|
|
4968
4999
|
return;
|
|
4969
5000
|
}
|
|
@@ -4999,692 +5030,6 @@ const _4bo09N = eventHandler((event) => {
|
|
|
4999
5030
|
return readAsset(id);
|
|
5000
5031
|
});
|
|
5001
5032
|
|
|
5002
|
-
const NullProtoObj = /* @__PURE__ */ (() => {
|
|
5003
|
-
const e = function() {};
|
|
5004
|
-
return e.prototype = Object.create(null), Object.freeze(e.prototype), e;
|
|
5005
|
-
})();
|
|
5006
|
-
|
|
5007
|
-
//#region src/_inherit.ts
|
|
5008
|
-
function lazyInherit(target, source, sourceKey) {
|
|
5009
|
-
for (const key of [...Object.getOwnPropertyNames(source), ...Object.getOwnPropertySymbols(source)]) {
|
|
5010
|
-
if (key === "constructor") continue;
|
|
5011
|
-
const targetDesc = Object.getOwnPropertyDescriptor(target, key);
|
|
5012
|
-
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
5013
|
-
let modified = false;
|
|
5014
|
-
if (desc.get) {
|
|
5015
|
-
modified = true;
|
|
5016
|
-
desc.get = targetDesc?.get || function() {
|
|
5017
|
-
return this[sourceKey][key];
|
|
5018
|
-
};
|
|
5019
|
-
}
|
|
5020
|
-
if (desc.set) {
|
|
5021
|
-
modified = true;
|
|
5022
|
-
desc.set = targetDesc?.set || function(value) {
|
|
5023
|
-
this[sourceKey][key] = value;
|
|
5024
|
-
};
|
|
5025
|
-
}
|
|
5026
|
-
if (!targetDesc?.value && typeof desc.value === "function") {
|
|
5027
|
-
modified = true;
|
|
5028
|
-
desc.value = function(...args) {
|
|
5029
|
-
return this[sourceKey][key](...args);
|
|
5030
|
-
};
|
|
5031
|
-
}
|
|
5032
|
-
if (modified) Object.defineProperty(target, key, desc);
|
|
5033
|
-
}
|
|
5034
|
-
}
|
|
5035
|
-
//#endregion
|
|
5036
|
-
//#region src/_url.ts
|
|
5037
|
-
const _needsNormRE = /(?:(?:^|\/)(?:\.|\.\.|%2e|%2e\.|\.%2e|%2e%2e)(?:\/|$))|[\\^\x80-\uffff]/i;
|
|
5038
|
-
/**
|
|
5039
|
-
* URL wrapper with fast paths to access to the following props:
|
|
5040
|
-
*
|
|
5041
|
-
* - `url.pathname`
|
|
5042
|
-
* - `url.search`
|
|
5043
|
-
* - `url.searchParams`
|
|
5044
|
-
* - `url.protocol`
|
|
5045
|
-
*
|
|
5046
|
-
* **NOTES:**
|
|
5047
|
-
*
|
|
5048
|
-
* - It is assumed that the input URL is **already encoded** and formatted from an HTTP request and contains no hash.
|
|
5049
|
-
* - Triggering the setters or getters on other props will deoptimize to full URL parsing.
|
|
5050
|
-
* - Changes to `searchParams` will be discarded as we don't track them.
|
|
5051
|
-
*/
|
|
5052
|
-
const FastURL = /* @__PURE__ */ (() => {
|
|
5053
|
-
const NativeURL = globalThis.URL;
|
|
5054
|
-
const FastURL = class URL {
|
|
5055
|
-
#url;
|
|
5056
|
-
#href;
|
|
5057
|
-
#protocol;
|
|
5058
|
-
#host;
|
|
5059
|
-
#pathname;
|
|
5060
|
-
#search;
|
|
5061
|
-
#searchParams;
|
|
5062
|
-
#pos;
|
|
5063
|
-
constructor(url) {
|
|
5064
|
-
if (typeof url === "string") if (url[0] === "/") this.#href = url;
|
|
5065
|
-
else this.#url = new NativeURL(url);
|
|
5066
|
-
else if (_needsNormRE.test(url.pathname)) this.#url = new NativeURL(`${url.protocol || "http:"}//${url.host || "localhost"}${url.pathname}${url.search || ""}`);
|
|
5067
|
-
else {
|
|
5068
|
-
this.#protocol = url.protocol;
|
|
5069
|
-
this.#host = url.host;
|
|
5070
|
-
this.#pathname = url.pathname;
|
|
5071
|
-
this.#search = url.search;
|
|
5072
|
-
}
|
|
5073
|
-
}
|
|
5074
|
-
static [Symbol.hasInstance](val) {
|
|
5075
|
-
return val instanceof NativeURL;
|
|
5076
|
-
}
|
|
5077
|
-
get _url() {
|
|
5078
|
-
if (this.#url) return this.#url;
|
|
5079
|
-
this.#url = new NativeURL(this.href);
|
|
5080
|
-
this.#href = void 0;
|
|
5081
|
-
this.#protocol = void 0;
|
|
5082
|
-
this.#host = void 0;
|
|
5083
|
-
this.#pathname = void 0;
|
|
5084
|
-
this.#search = void 0;
|
|
5085
|
-
this.#searchParams = void 0;
|
|
5086
|
-
this.#pos = void 0;
|
|
5087
|
-
return this.#url;
|
|
5088
|
-
}
|
|
5089
|
-
get href() {
|
|
5090
|
-
if (this.#url) return this.#url.href;
|
|
5091
|
-
if (!this.#href) this.#href = `${this.#protocol || "http:"}//${this.#host || "localhost"}${this.#pathname || "/"}${this.#search || ""}`;
|
|
5092
|
-
return this.#href;
|
|
5093
|
-
}
|
|
5094
|
-
#getPos() {
|
|
5095
|
-
if (!this.#pos) {
|
|
5096
|
-
const url = this.href;
|
|
5097
|
-
const protoIndex = url.indexOf("://");
|
|
5098
|
-
const pathnameIndex = protoIndex === -1 ? -1 : url.indexOf("/", protoIndex + 4);
|
|
5099
|
-
this.#pos = [
|
|
5100
|
-
protoIndex,
|
|
5101
|
-
pathnameIndex,
|
|
5102
|
-
pathnameIndex === -1 ? -1 : url.indexOf("?", pathnameIndex)
|
|
5103
|
-
];
|
|
5104
|
-
}
|
|
5105
|
-
return this.#pos;
|
|
5106
|
-
}
|
|
5107
|
-
get pathname() {
|
|
5108
|
-
if (this.#url) return this.#url.pathname;
|
|
5109
|
-
if (this.#pathname === void 0) {
|
|
5110
|
-
const [, pathnameIndex, queryIndex] = this.#getPos();
|
|
5111
|
-
if (pathnameIndex === -1) return this._url.pathname;
|
|
5112
|
-
this.#pathname = this.href.slice(pathnameIndex, queryIndex === -1 ? void 0 : queryIndex);
|
|
5113
|
-
}
|
|
5114
|
-
return this.#pathname;
|
|
5115
|
-
}
|
|
5116
|
-
get search() {
|
|
5117
|
-
if (this.#url) return this.#url.search;
|
|
5118
|
-
if (this.#search === void 0) {
|
|
5119
|
-
const [, pathnameIndex, queryIndex] = this.#getPos();
|
|
5120
|
-
if (pathnameIndex === -1) return this._url.search;
|
|
5121
|
-
const url = this.href;
|
|
5122
|
-
this.#search = queryIndex === -1 || queryIndex === url.length - 1 ? "" : url.slice(queryIndex);
|
|
5123
|
-
}
|
|
5124
|
-
return this.#search;
|
|
5125
|
-
}
|
|
5126
|
-
get searchParams() {
|
|
5127
|
-
if (this.#url) return this.#url.searchParams;
|
|
5128
|
-
if (!this.#searchParams) this.#searchParams = new URLSearchParams(this.search);
|
|
5129
|
-
return this.#searchParams;
|
|
5130
|
-
}
|
|
5131
|
-
get protocol() {
|
|
5132
|
-
if (this.#url) return this.#url.protocol;
|
|
5133
|
-
if (this.#protocol === void 0) {
|
|
5134
|
-
const [protocolIndex] = this.#getPos();
|
|
5135
|
-
if (protocolIndex === -1) return this._url.protocol;
|
|
5136
|
-
this.#protocol = this.href.slice(0, protocolIndex + 1);
|
|
5137
|
-
}
|
|
5138
|
-
return this.#protocol;
|
|
5139
|
-
}
|
|
5140
|
-
toString() {
|
|
5141
|
-
return this.href;
|
|
5142
|
-
}
|
|
5143
|
-
toJSON() {
|
|
5144
|
-
return this.href;
|
|
5145
|
-
}
|
|
5146
|
-
};
|
|
5147
|
-
lazyInherit(FastURL.prototype, NativeURL.prototype, "_url");
|
|
5148
|
-
Object.setPrototypeOf(FastURL.prototype, NativeURL.prototype);
|
|
5149
|
-
Object.setPrototypeOf(FastURL, NativeURL);
|
|
5150
|
-
return FastURL;
|
|
5151
|
-
})();
|
|
5152
|
-
|
|
5153
|
-
//#endregion
|
|
5154
|
-
//#region src/adapters/_node/response.ts
|
|
5155
|
-
/**
|
|
5156
|
-
* Fast Response for Node.js runtime
|
|
5157
|
-
*
|
|
5158
|
-
* It is faster because in most cases it doesn't create a full Response instance.
|
|
5159
|
-
*/
|
|
5160
|
-
const NodeResponse = /* @__PURE__ */ (() => {
|
|
5161
|
-
const NativeResponse = globalThis.Response;
|
|
5162
|
-
const STATUS_CODES = globalThis.process?.getBuiltinModule?.("node:http")?.STATUS_CODES || {};
|
|
5163
|
-
class NodeResponse {
|
|
5164
|
-
#body;
|
|
5165
|
-
#init;
|
|
5166
|
-
#headers;
|
|
5167
|
-
#response;
|
|
5168
|
-
constructor(body, init) {
|
|
5169
|
-
this.#body = body;
|
|
5170
|
-
this.#init = init;
|
|
5171
|
-
}
|
|
5172
|
-
static [Symbol.hasInstance](val) {
|
|
5173
|
-
return val instanceof NativeResponse;
|
|
5174
|
-
}
|
|
5175
|
-
get status() {
|
|
5176
|
-
return this.#response?.status || this.#init?.status || 200;
|
|
5177
|
-
}
|
|
5178
|
-
get statusText() {
|
|
5179
|
-
return this.#response?.statusText || this.#init?.statusText || STATUS_CODES[this.status] || "";
|
|
5180
|
-
}
|
|
5181
|
-
get headers() {
|
|
5182
|
-
if (this.#response) return this.#response.headers;
|
|
5183
|
-
if (this.#headers) return this.#headers;
|
|
5184
|
-
const initHeaders = this.#init?.headers;
|
|
5185
|
-
return this.#headers = initHeaders instanceof Headers ? initHeaders : new Headers(initHeaders);
|
|
5186
|
-
}
|
|
5187
|
-
get ok() {
|
|
5188
|
-
if (this.#response) return this.#response.ok;
|
|
5189
|
-
const status = this.status;
|
|
5190
|
-
return status >= 200 && status < 300;
|
|
5191
|
-
}
|
|
5192
|
-
get _response() {
|
|
5193
|
-
if (this.#response) return this.#response;
|
|
5194
|
-
let body = this.#body;
|
|
5195
|
-
if (body && typeof body.pipe === "function" && !(body instanceof Readable)) {
|
|
5196
|
-
const stream = new PassThrough();
|
|
5197
|
-
body.pipe(stream);
|
|
5198
|
-
const abort = body.abort;
|
|
5199
|
-
if (abort) stream.once("close", () => abort());
|
|
5200
|
-
body = stream;
|
|
5201
|
-
}
|
|
5202
|
-
this.#response = new NativeResponse(body, this.#headers ? {
|
|
5203
|
-
...this.#init,
|
|
5204
|
-
headers: this.#headers
|
|
5205
|
-
} : this.#init);
|
|
5206
|
-
this.#init = void 0;
|
|
5207
|
-
this.#headers = void 0;
|
|
5208
|
-
this.#body = void 0;
|
|
5209
|
-
return this.#response;
|
|
5210
|
-
}
|
|
5211
|
-
_toNodeResponse() {
|
|
5212
|
-
const status = this.status;
|
|
5213
|
-
const statusText = this.statusText;
|
|
5214
|
-
let body;
|
|
5215
|
-
let contentType;
|
|
5216
|
-
let contentLength;
|
|
5217
|
-
if (this.#response) body = this.#response.body;
|
|
5218
|
-
else if (this.#body) if (this.#body instanceof ReadableStream) body = this.#body;
|
|
5219
|
-
else if (typeof this.#body === "string") {
|
|
5220
|
-
body = this.#body;
|
|
5221
|
-
contentType = "text/plain; charset=UTF-8";
|
|
5222
|
-
contentLength = Buffer.byteLength(this.#body);
|
|
5223
|
-
} else if (this.#body instanceof ArrayBuffer) {
|
|
5224
|
-
body = Buffer.from(this.#body);
|
|
5225
|
-
contentLength = this.#body.byteLength;
|
|
5226
|
-
} else if (this.#body instanceof Uint8Array) {
|
|
5227
|
-
body = this.#body;
|
|
5228
|
-
contentLength = this.#body.byteLength;
|
|
5229
|
-
} else if (this.#body instanceof DataView) {
|
|
5230
|
-
body = Buffer.from(this.#body.buffer);
|
|
5231
|
-
contentLength = this.#body.byteLength;
|
|
5232
|
-
} else if (this.#body instanceof Blob) {
|
|
5233
|
-
body = this.#body.stream();
|
|
5234
|
-
contentType = this.#body.type;
|
|
5235
|
-
contentLength = this.#body.size;
|
|
5236
|
-
} else if (typeof this.#body.pipe === "function") body = this.#body;
|
|
5237
|
-
else body = this._response.body;
|
|
5238
|
-
const headers = [];
|
|
5239
|
-
const initHeaders = this.#init?.headers;
|
|
5240
|
-
const headerEntries = this.#response?.headers || this.#headers || (initHeaders ? Array.isArray(initHeaders) ? initHeaders : initHeaders?.entries ? initHeaders.entries() : Object.entries(initHeaders).map(([k, v]) => [k.toLowerCase(), v]) : void 0);
|
|
5241
|
-
let hasContentTypeHeader;
|
|
5242
|
-
let hasContentLength;
|
|
5243
|
-
if (headerEntries) for (const [key, value] of headerEntries) {
|
|
5244
|
-
if (Array.isArray(value)) for (const v of value) headers.push([key, v]);
|
|
5245
|
-
else headers.push([key, value]);
|
|
5246
|
-
if (key === "content-type") hasContentTypeHeader = true;
|
|
5247
|
-
else if (key === "content-length") hasContentLength = true;
|
|
5248
|
-
}
|
|
5249
|
-
if (contentType && !hasContentTypeHeader) headers.push(["content-type", contentType]);
|
|
5250
|
-
if (contentLength && !hasContentLength) headers.push(["content-length", String(contentLength)]);
|
|
5251
|
-
this.#init = void 0;
|
|
5252
|
-
this.#headers = void 0;
|
|
5253
|
-
this.#response = void 0;
|
|
5254
|
-
this.#body = void 0;
|
|
5255
|
-
return {
|
|
5256
|
-
status,
|
|
5257
|
-
statusText,
|
|
5258
|
-
headers,
|
|
5259
|
-
body
|
|
5260
|
-
};
|
|
5261
|
-
}
|
|
5262
|
-
}
|
|
5263
|
-
lazyInherit(NodeResponse.prototype, NativeResponse.prototype, "_response");
|
|
5264
|
-
Object.setPrototypeOf(NodeResponse, NativeResponse);
|
|
5265
|
-
Object.setPrototypeOf(NodeResponse.prototype, NativeResponse.prototype);
|
|
5266
|
-
return NodeResponse;
|
|
5267
|
-
})();
|
|
5268
|
-
|
|
5269
|
-
function decodePathname(pathname) {
|
|
5270
|
-
return decodeURI(pathname.includes("%25") ? pathname.replace(/%25/g, "%2525") : pathname);
|
|
5271
|
-
}
|
|
5272
|
-
const kEventNS = "h3.internal.event.";
|
|
5273
|
-
const kEventRes = /* @__PURE__ */ Symbol.for(`${kEventNS}res`);
|
|
5274
|
-
const kEventResHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.headers`);
|
|
5275
|
-
const kEventResErrHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.err.headers`);
|
|
5276
|
-
var H3Event = class {
|
|
5277
|
-
app;
|
|
5278
|
-
req;
|
|
5279
|
-
url;
|
|
5280
|
-
context;
|
|
5281
|
-
static __is_event__ = true;
|
|
5282
|
-
constructor(req, context, app) {
|
|
5283
|
-
this.context = context || req.context || new NullProtoObj();
|
|
5284
|
-
this.req = req;
|
|
5285
|
-
this.app = app;
|
|
5286
|
-
const _url = req._url;
|
|
5287
|
-
const url = _url && _url instanceof URL ? _url : new FastURL(req.url);
|
|
5288
|
-
if (url.pathname.includes("%")) url.pathname = decodePathname(url.pathname);
|
|
5289
|
-
this.url = url;
|
|
5290
|
-
}
|
|
5291
|
-
get res() {
|
|
5292
|
-
return this[kEventRes] ||= new H3EventResponse();
|
|
5293
|
-
}
|
|
5294
|
-
get runtime() {
|
|
5295
|
-
return this.req.runtime;
|
|
5296
|
-
}
|
|
5297
|
-
waitUntil(promise) {
|
|
5298
|
-
this.req.waitUntil?.(promise);
|
|
5299
|
-
}
|
|
5300
|
-
toString() {
|
|
5301
|
-
return `[${this.req.method}] ${this.req.url}`;
|
|
5302
|
-
}
|
|
5303
|
-
toJSON() {
|
|
5304
|
-
return this.toString();
|
|
5305
|
-
}
|
|
5306
|
-
get node() {
|
|
5307
|
-
return this.req.runtime?.node;
|
|
5308
|
-
}
|
|
5309
|
-
get headers() {
|
|
5310
|
-
return this.req.headers;
|
|
5311
|
-
}
|
|
5312
|
-
get path() {
|
|
5313
|
-
return this.url.pathname + this.url.search;
|
|
5314
|
-
}
|
|
5315
|
-
get method() {
|
|
5316
|
-
return this.req.method;
|
|
5317
|
-
}
|
|
5318
|
-
};
|
|
5319
|
-
var H3EventResponse = class {
|
|
5320
|
-
status;
|
|
5321
|
-
statusText;
|
|
5322
|
-
get headers() {
|
|
5323
|
-
return this[kEventResHeaders] ||= new Headers();
|
|
5324
|
-
}
|
|
5325
|
-
get errHeaders() {
|
|
5326
|
-
return this[kEventResErrHeaders] ||= new Headers();
|
|
5327
|
-
}
|
|
5328
|
-
};
|
|
5329
|
-
const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
|
|
5330
|
-
function sanitizeStatusMessage(statusMessage = "") {
|
|
5331
|
-
return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
|
|
5332
|
-
}
|
|
5333
|
-
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
|
|
5334
|
-
if (!statusCode) return defaultStatusCode;
|
|
5335
|
-
if (typeof statusCode === "string") statusCode = +statusCode;
|
|
5336
|
-
if (statusCode < 100 || statusCode > 599) return defaultStatusCode;
|
|
5337
|
-
return statusCode;
|
|
5338
|
-
}
|
|
5339
|
-
var HTTPError = class HTTPError extends Error {
|
|
5340
|
-
get name() {
|
|
5341
|
-
return "HTTPError";
|
|
5342
|
-
}
|
|
5343
|
-
status;
|
|
5344
|
-
statusText;
|
|
5345
|
-
headers;
|
|
5346
|
-
cause;
|
|
5347
|
-
data;
|
|
5348
|
-
body;
|
|
5349
|
-
unhandled;
|
|
5350
|
-
static isError(input) {
|
|
5351
|
-
return input instanceof Error && input?.name === "HTTPError";
|
|
5352
|
-
}
|
|
5353
|
-
static status(status, statusText, details) {
|
|
5354
|
-
return new HTTPError({
|
|
5355
|
-
...details,
|
|
5356
|
-
statusText,
|
|
5357
|
-
status
|
|
5358
|
-
});
|
|
5359
|
-
}
|
|
5360
|
-
constructor(arg1, arg2) {
|
|
5361
|
-
let messageInput;
|
|
5362
|
-
let details;
|
|
5363
|
-
if (typeof arg1 === "string") {
|
|
5364
|
-
messageInput = arg1;
|
|
5365
|
-
details = arg2;
|
|
5366
|
-
} else details = arg1;
|
|
5367
|
-
const status = sanitizeStatusCode(details?.status || details?.statusCode || (details?.cause)?.status || (details?.cause)?.statusCode, 500);
|
|
5368
|
-
const statusText = sanitizeStatusMessage(details?.statusText || details?.statusMessage || (details?.cause)?.statusText || (details?.cause)?.statusMessage);
|
|
5369
|
-
const message = messageInput || details?.message || (details?.cause)?.message || details?.statusText || details?.statusMessage || [
|
|
5370
|
-
"HTTPError",
|
|
5371
|
-
status,
|
|
5372
|
-
statusText
|
|
5373
|
-
].filter(Boolean).join(" ");
|
|
5374
|
-
super(message, { cause: details });
|
|
5375
|
-
this.cause = details;
|
|
5376
|
-
this.status = status;
|
|
5377
|
-
this.statusText = statusText || void 0;
|
|
5378
|
-
const rawHeaders = details?.headers || (details?.cause)?.headers;
|
|
5379
|
-
this.headers = rawHeaders ? new Headers(rawHeaders) : void 0;
|
|
5380
|
-
this.unhandled = details?.unhandled ?? (details?.cause)?.unhandled ?? void 0;
|
|
5381
|
-
this.data = details?.data;
|
|
5382
|
-
this.body = details?.body;
|
|
5383
|
-
}
|
|
5384
|
-
get statusCode() {
|
|
5385
|
-
return this.status;
|
|
5386
|
-
}
|
|
5387
|
-
get statusMessage() {
|
|
5388
|
-
return this.statusText;
|
|
5389
|
-
}
|
|
5390
|
-
toJSON() {
|
|
5391
|
-
const unhandled = this.unhandled;
|
|
5392
|
-
return {
|
|
5393
|
-
status: this.status,
|
|
5394
|
-
statusText: this.statusText,
|
|
5395
|
-
unhandled,
|
|
5396
|
-
message: unhandled ? "HTTPError" : this.message,
|
|
5397
|
-
data: unhandled ? void 0 : this.data,
|
|
5398
|
-
...unhandled ? void 0 : this.body
|
|
5399
|
-
};
|
|
5400
|
-
}
|
|
5401
|
-
};
|
|
5402
|
-
function isJSONSerializable(value, _type) {
|
|
5403
|
-
if (value === null || value === void 0) return true;
|
|
5404
|
-
if (_type !== "object") return _type === "boolean" || _type === "number" || _type === "string";
|
|
5405
|
-
if (typeof value.toJSON === "function") return true;
|
|
5406
|
-
if (Array.isArray(value)) return true;
|
|
5407
|
-
if (typeof value.pipe === "function" || typeof value.pipeTo === "function") return false;
|
|
5408
|
-
if (value instanceof NullProtoObj) return true;
|
|
5409
|
-
const proto = Object.getPrototypeOf(value);
|
|
5410
|
-
return proto === Object.prototype || proto === null;
|
|
5411
|
-
}
|
|
5412
|
-
const kNotFound = /* @__PURE__ */ Symbol.for("h3.notFound");
|
|
5413
|
-
const kHandled = /* @__PURE__ */ Symbol.for("h3.handled");
|
|
5414
|
-
function toResponse(val, event, config = {}) {
|
|
5415
|
-
if (typeof val?.then === "function") return (val.catch?.((error) => error) || Promise.resolve(val)).then((resolvedVal) => toResponse(resolvedVal, event, config));
|
|
5416
|
-
const response = prepareResponse(val, event, config);
|
|
5417
|
-
if (typeof response?.then === "function") return toResponse(response, event, config);
|
|
5418
|
-
const { onResponse } = config;
|
|
5419
|
-
return onResponse ? Promise.resolve(onResponse(response, event)).then(() => response) : response;
|
|
5420
|
-
}
|
|
5421
|
-
var HTTPResponse = class {
|
|
5422
|
-
#headers;
|
|
5423
|
-
#init;
|
|
5424
|
-
body;
|
|
5425
|
-
constructor(body, init) {
|
|
5426
|
-
this.body = body;
|
|
5427
|
-
this.#init = init;
|
|
5428
|
-
}
|
|
5429
|
-
get status() {
|
|
5430
|
-
return this.#init?.status || 200;
|
|
5431
|
-
}
|
|
5432
|
-
get statusText() {
|
|
5433
|
-
return this.#init?.statusText || "OK";
|
|
5434
|
-
}
|
|
5435
|
-
get headers() {
|
|
5436
|
-
return this.#headers ||= new Headers(this.#init?.headers);
|
|
5437
|
-
}
|
|
5438
|
-
};
|
|
5439
|
-
function prepareResponse(val, event, config, nested) {
|
|
5440
|
-
if (val === kHandled) return new NodeResponse(null);
|
|
5441
|
-
if (val === kNotFound) val = new HTTPError({
|
|
5442
|
-
status: 404,
|
|
5443
|
-
message: `Cannot find any route matching [${event.req.method}] ${event.url}`
|
|
5444
|
-
});
|
|
5445
|
-
if (val && val instanceof Error) {
|
|
5446
|
-
const isHTTPError = HTTPError.isError(val);
|
|
5447
|
-
const error = isHTTPError ? val : new HTTPError(val);
|
|
5448
|
-
if (!isHTTPError) {
|
|
5449
|
-
error.unhandled = true;
|
|
5450
|
-
if (val?.stack) error.stack = val.stack;
|
|
5451
|
-
}
|
|
5452
|
-
if (error.unhandled && !config.silent) console.error(error);
|
|
5453
|
-
const { onError } = config;
|
|
5454
|
-
const errHeaders = event[kEventRes]?.[kEventResErrHeaders];
|
|
5455
|
-
return onError && !nested ? Promise.resolve(onError(error, event)).catch((error) => error).then((newVal) => prepareResponse(newVal ?? val, event, config, true)) : errorResponse(error, config.debug, errHeaders);
|
|
5456
|
-
}
|
|
5457
|
-
const preparedRes = event[kEventRes];
|
|
5458
|
-
const preparedHeaders = preparedRes?.[kEventResHeaders];
|
|
5459
|
-
event[kEventRes] = void 0;
|
|
5460
|
-
if (!(val instanceof Response)) {
|
|
5461
|
-
const res = prepareResponseBody(val, event, config);
|
|
5462
|
-
const status = res.status || preparedRes?.status;
|
|
5463
|
-
return new NodeResponse(nullBody(event.req.method, status) ? null : res.body, {
|
|
5464
|
-
status,
|
|
5465
|
-
statusText: res.statusText || preparedRes?.statusText,
|
|
5466
|
-
headers: res.headers && preparedHeaders ? mergeHeaders$1(res.headers, preparedHeaders) : res.headers || preparedHeaders
|
|
5467
|
-
});
|
|
5468
|
-
}
|
|
5469
|
-
if (!preparedHeaders || nested || !val.ok) return val;
|
|
5470
|
-
try {
|
|
5471
|
-
mergeHeaders$1(val.headers, preparedHeaders, val.headers);
|
|
5472
|
-
return val;
|
|
5473
|
-
} catch {
|
|
5474
|
-
return new NodeResponse(nullBody(event.req.method, val.status) ? null : val.body, {
|
|
5475
|
-
status: val.status,
|
|
5476
|
-
statusText: val.statusText,
|
|
5477
|
-
headers: mergeHeaders$1(val.headers, preparedHeaders)
|
|
5478
|
-
});
|
|
5479
|
-
}
|
|
5480
|
-
}
|
|
5481
|
-
function mergeHeaders$1(base, overrides, target = new Headers(base)) {
|
|
5482
|
-
for (const [name, value] of overrides) if (name === "set-cookie") target.append(name, value);
|
|
5483
|
-
else target.set(name, value);
|
|
5484
|
-
return target;
|
|
5485
|
-
}
|
|
5486
|
-
const frozen = (name) => (...args) => {
|
|
5487
|
-
throw new Error(`Headers are frozen (${name} ${args.join(", ")})`);
|
|
5488
|
-
};
|
|
5489
|
-
var FrozenHeaders = class extends Headers {
|
|
5490
|
-
set = frozen("set");
|
|
5491
|
-
append = frozen("append");
|
|
5492
|
-
delete = frozen("delete");
|
|
5493
|
-
};
|
|
5494
|
-
const emptyHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-length": "0" });
|
|
5495
|
-
const jsonHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-type": "application/json;charset=UTF-8" });
|
|
5496
|
-
function prepareResponseBody(val, event, config) {
|
|
5497
|
-
if (val === null || val === void 0) return {
|
|
5498
|
-
body: "",
|
|
5499
|
-
headers: emptyHeaders
|
|
5500
|
-
};
|
|
5501
|
-
const valType = typeof val;
|
|
5502
|
-
if (valType === "string") return { body: val };
|
|
5503
|
-
if (val instanceof Uint8Array) {
|
|
5504
|
-
event.res.headers.set("content-length", val.byteLength.toString());
|
|
5505
|
-
return { body: val };
|
|
5506
|
-
}
|
|
5507
|
-
if (val instanceof HTTPResponse || val?.constructor?.name === "HTTPResponse") return val;
|
|
5508
|
-
if (isJSONSerializable(val, valType)) return {
|
|
5509
|
-
body: JSON.stringify(val, void 0, config.debug ? 2 : void 0),
|
|
5510
|
-
headers: jsonHeaders
|
|
5511
|
-
};
|
|
5512
|
-
if (valType === "bigint") return {
|
|
5513
|
-
body: val.toString(),
|
|
5514
|
-
headers: jsonHeaders
|
|
5515
|
-
};
|
|
5516
|
-
if (val instanceof Blob) {
|
|
5517
|
-
const headers = new Headers({
|
|
5518
|
-
"content-type": val.type,
|
|
5519
|
-
"content-length": val.size.toString()
|
|
5520
|
-
});
|
|
5521
|
-
let filename = val.name;
|
|
5522
|
-
if (filename) {
|
|
5523
|
-
filename = encodeURIComponent(filename);
|
|
5524
|
-
headers.set("content-disposition", `filename="${filename}"; filename*=UTF-8''${filename}`);
|
|
5525
|
-
}
|
|
5526
|
-
return {
|
|
5527
|
-
body: val.stream(),
|
|
5528
|
-
headers
|
|
5529
|
-
};
|
|
5530
|
-
}
|
|
5531
|
-
if (valType === "symbol") return { body: val.toString() };
|
|
5532
|
-
if (valType === "function") return { body: `${val.name}()` };
|
|
5533
|
-
return { body: val };
|
|
5534
|
-
}
|
|
5535
|
-
function nullBody(method, status) {
|
|
5536
|
-
return method === "HEAD" || status === 100 || status === 101 || status === 102 || status === 204 || status === 205 || status === 304;
|
|
5537
|
-
}
|
|
5538
|
-
function errorResponse(error, debug, errHeaders) {
|
|
5539
|
-
let headers = error.headers ? mergeHeaders$1(jsonHeaders, error.headers) : new Headers(jsonHeaders);
|
|
5540
|
-
if (errHeaders) headers = mergeHeaders$1(headers, errHeaders);
|
|
5541
|
-
return new NodeResponse(JSON.stringify({
|
|
5542
|
-
...error.toJSON(),
|
|
5543
|
-
stack: debug && error.stack ? error.stack.split("\n").map((l) => l.trim()) : void 0
|
|
5544
|
-
}, void 0, debug ? 2 : void 0), {
|
|
5545
|
-
status: error.status,
|
|
5546
|
-
statusText: error.statusText,
|
|
5547
|
-
headers
|
|
5548
|
-
});
|
|
5549
|
-
}
|
|
5550
|
-
function callMiddleware(event, middleware, handler, index = 0) {
|
|
5551
|
-
if (index === middleware.length) return handler(event);
|
|
5552
|
-
const fn = middleware[index];
|
|
5553
|
-
let nextCalled;
|
|
5554
|
-
let nextResult;
|
|
5555
|
-
const next = () => {
|
|
5556
|
-
if (nextCalled) return nextResult;
|
|
5557
|
-
nextCalled = true;
|
|
5558
|
-
nextResult = callMiddleware(event, middleware, handler, index + 1);
|
|
5559
|
-
return nextResult;
|
|
5560
|
-
};
|
|
5561
|
-
const ret = fn(event, next);
|
|
5562
|
-
return isUnhandledResponse(ret) ? next() : typeof ret?.then === "function" ? ret.then((resolved) => isUnhandledResponse(resolved) ? next() : resolved) : ret;
|
|
5563
|
-
}
|
|
5564
|
-
function isUnhandledResponse(val) {
|
|
5565
|
-
return val === void 0 || val === kNotFound;
|
|
5566
|
-
}
|
|
5567
|
-
const plusRegex = /\+/g;
|
|
5568
|
-
function parseQuery(input) {
|
|
5569
|
-
const params = new NullProtoObj();
|
|
5570
|
-
if (!input || input === "?") return params;
|
|
5571
|
-
const inputLength = input.length;
|
|
5572
|
-
let key = "";
|
|
5573
|
-
let value = "";
|
|
5574
|
-
let startingIndex = -1;
|
|
5575
|
-
let equalityIndex = -1;
|
|
5576
|
-
let shouldDecodeKey = false;
|
|
5577
|
-
let shouldDecodeValue = false;
|
|
5578
|
-
let keyHasPlus = false;
|
|
5579
|
-
let valueHasPlus = false;
|
|
5580
|
-
let hasBothKeyValuePair = false;
|
|
5581
|
-
let c = 0;
|
|
5582
|
-
for (let i = 0; i < inputLength + 1; i++) {
|
|
5583
|
-
c = i === inputLength ? 38 : input.charCodeAt(i);
|
|
5584
|
-
switch (c) {
|
|
5585
|
-
case 38:
|
|
5586
|
-
hasBothKeyValuePair = equalityIndex > startingIndex;
|
|
5587
|
-
if (!hasBothKeyValuePair) equalityIndex = i;
|
|
5588
|
-
key = input.slice(startingIndex + 1, equalityIndex);
|
|
5589
|
-
if (hasBothKeyValuePair || key.length > 0) {
|
|
5590
|
-
if (keyHasPlus) key = key.replace(plusRegex, " ");
|
|
5591
|
-
if (shouldDecodeKey) try {
|
|
5592
|
-
key = decodeURIComponent(key);
|
|
5593
|
-
} catch {}
|
|
5594
|
-
if (hasBothKeyValuePair) {
|
|
5595
|
-
value = input.slice(equalityIndex + 1, i);
|
|
5596
|
-
if (valueHasPlus) value = value.replace(plusRegex, " ");
|
|
5597
|
-
if (shouldDecodeValue) try {
|
|
5598
|
-
value = decodeURIComponent(value);
|
|
5599
|
-
} catch {}
|
|
5600
|
-
}
|
|
5601
|
-
const currentValue = params[key];
|
|
5602
|
-
if (currentValue === void 0) params[key] = value;
|
|
5603
|
-
else if (Array.isArray(currentValue)) currentValue.push(value);
|
|
5604
|
-
else params[key] = [currentValue, value];
|
|
5605
|
-
}
|
|
5606
|
-
value = "";
|
|
5607
|
-
startingIndex = i;
|
|
5608
|
-
equalityIndex = i;
|
|
5609
|
-
shouldDecodeKey = false;
|
|
5610
|
-
shouldDecodeValue = false;
|
|
5611
|
-
keyHasPlus = false;
|
|
5612
|
-
valueHasPlus = false;
|
|
5613
|
-
break;
|
|
5614
|
-
case 61:
|
|
5615
|
-
if (equalityIndex <= startingIndex) equalityIndex = i;
|
|
5616
|
-
else shouldDecodeValue = true;
|
|
5617
|
-
break;
|
|
5618
|
-
case 43:
|
|
5619
|
-
if (equalityIndex > startingIndex) valueHasPlus = true;
|
|
5620
|
-
else keyHasPlus = true;
|
|
5621
|
-
break;
|
|
5622
|
-
case 37:
|
|
5623
|
-
if (equalityIndex > startingIndex) shouldDecodeValue = true;
|
|
5624
|
-
else shouldDecodeKey = true;
|
|
5625
|
-
break;
|
|
5626
|
-
}
|
|
5627
|
-
}
|
|
5628
|
-
return params;
|
|
5629
|
-
}
|
|
5630
|
-
function getQuery(event) {
|
|
5631
|
-
return parseQuery((event.url || new URL(event.req.url)).search.slice(1));
|
|
5632
|
-
}
|
|
5633
|
-
function getRequestHost(event, opts = {}) {
|
|
5634
|
-
if (opts.xForwardedHost) {
|
|
5635
|
-
const xForwardedHost = (event.req.headers.get("x-forwarded-host") || "").split(",").shift()?.trim();
|
|
5636
|
-
if (xForwardedHost) return xForwardedHost;
|
|
5637
|
-
}
|
|
5638
|
-
return event.req.headers.get("host") || "";
|
|
5639
|
-
}
|
|
5640
|
-
function getRequestProtocol(event, opts = {}) {
|
|
5641
|
-
if (opts.xForwardedProto !== false) {
|
|
5642
|
-
const forwardedProto = event.req.headers.get("x-forwarded-proto");
|
|
5643
|
-
if (forwardedProto === "https") return "https";
|
|
5644
|
-
if (forwardedProto === "http") return "http";
|
|
5645
|
-
}
|
|
5646
|
-
return (event.url || new URL(event.req.url)).protocol.slice(0, -1);
|
|
5647
|
-
}
|
|
5648
|
-
function getRequestURL(event, opts = {}) {
|
|
5649
|
-
const url = new URL(event.url || event.req.url);
|
|
5650
|
-
url.protocol = getRequestProtocol(event, opts);
|
|
5651
|
-
if (opts.xForwardedHost) {
|
|
5652
|
-
const host = getRequestHost(event, opts);
|
|
5653
|
-
if (host) {
|
|
5654
|
-
url.host = host;
|
|
5655
|
-
if (!/:\d+$/.test(host)) url.port = "";
|
|
5656
|
-
}
|
|
5657
|
-
}
|
|
5658
|
-
return url;
|
|
5659
|
-
}
|
|
5660
|
-
function defineHandler(input) {
|
|
5661
|
-
if (typeof input === "function") return handlerWithFetch(input);
|
|
5662
|
-
const handler = input.handler || (input.fetch ? function _fetchHandler(event) {
|
|
5663
|
-
return input.fetch(event.req);
|
|
5664
|
-
} : NoHandler);
|
|
5665
|
-
return Object.assign(handlerWithFetch(input.middleware?.length ? function _handlerMiddleware(event) {
|
|
5666
|
-
return callMiddleware(event, input.middleware, handler);
|
|
5667
|
-
} : handler), input);
|
|
5668
|
-
}
|
|
5669
|
-
function handlerWithFetch(handler) {
|
|
5670
|
-
if ("fetch" in handler) return handler;
|
|
5671
|
-
return Object.assign(handler, { fetch: (req) => {
|
|
5672
|
-
if (typeof req === "string") req = new URL(req, "http://_");
|
|
5673
|
-
if (req instanceof URL) req = new Request(req);
|
|
5674
|
-
const event = new H3Event(req);
|
|
5675
|
-
try {
|
|
5676
|
-
return Promise.resolve(toResponse(handler(event), event));
|
|
5677
|
-
} catch (error) {
|
|
5678
|
-
return Promise.resolve(toResponse(error, event));
|
|
5679
|
-
}
|
|
5680
|
-
} });
|
|
5681
|
-
}
|
|
5682
|
-
const NoHandler = () => kNotFound;
|
|
5683
|
-
function createError(arg1, arg2) {
|
|
5684
|
-
return new HTTPError(arg1, arg2);
|
|
5685
|
-
}
|
|
5686
|
-
const defineEventHandler = defineHandler;
|
|
5687
|
-
|
|
5688
5033
|
const _SxA8c9 = defineEventHandler(() => {});
|
|
5689
5034
|
|
|
5690
5035
|
/** Default values for dimensions */
|
|
@@ -8391,6 +7736,8 @@ function cloneDate(date) {
|
|
|
8391
7736
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
8392
7737
|
}
|
|
8393
7738
|
|
|
7739
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : "undefined" !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7740
|
+
|
|
8394
7741
|
const collections = {
|
|
8395
7742
|
};
|
|
8396
7743
|
|
|
@@ -8398,7 +7745,7 @@ const DEFAULT_ENDPOINT = "https://api.iconify.design";
|
|
|
8398
7745
|
const _wKCHD4 = defineCachedEventHandler(async (event) => {
|
|
8399
7746
|
const url = getRequestURL(event);
|
|
8400
7747
|
if (!url)
|
|
8401
|
-
return createError({ status: 400, message: "Invalid icon request" });
|
|
7748
|
+
return createError$1({ status: 400, message: "Invalid icon request" });
|
|
8402
7749
|
const options = useAppConfig().icon;
|
|
8403
7750
|
const collectionName = event.context.params?.collection?.replace(/\.json$/, "");
|
|
8404
7751
|
const collection = collectionName ? await collections[collectionName]?.() : null;
|
|
@@ -8418,7 +7765,7 @@ const _wKCHD4 = defineCachedEventHandler(async (event) => {
|
|
|
8418
7765
|
const apiUrl = new URL("./" + basename(url.pathname) + url.search, apiEndPoint);
|
|
8419
7766
|
consola.debug(`[Icon] fetching ${(icons || []).map((i) => "`" + collectionName + ":" + i + "`").join(",")} from iconify api`);
|
|
8420
7767
|
if (apiUrl.host !== new URL(apiEndPoint).host) {
|
|
8421
|
-
return createError({ status: 400, message: "Invalid icon request" });
|
|
7768
|
+
return createError$1({ status: 400, message: "Invalid icon request" });
|
|
8422
7769
|
}
|
|
8423
7770
|
try {
|
|
8424
7771
|
const data = await $fetch(apiUrl.href);
|
|
@@ -8426,12 +7773,12 @@ const _wKCHD4 = defineCachedEventHandler(async (event) => {
|
|
|
8426
7773
|
} catch (e) {
|
|
8427
7774
|
consola.error(e);
|
|
8428
7775
|
if (e.status === 404)
|
|
8429
|
-
return createError({ status: 404 });
|
|
7776
|
+
return createError$1({ status: 404 });
|
|
8430
7777
|
else
|
|
8431
|
-
return createError({ status: 500, message: "Failed to fetch fallback icon" });
|
|
7778
|
+
return createError$1({ status: 500, message: "Failed to fetch fallback icon" });
|
|
8432
7779
|
}
|
|
8433
7780
|
}
|
|
8434
|
-
return createError({ status: 404 });
|
|
7781
|
+
return createError$1({ status: 404 });
|
|
8435
7782
|
}, {
|
|
8436
7783
|
group: "nuxt",
|
|
8437
7784
|
name: "icon",
|
|
@@ -8446,11 +7793,13 @@ const _wKCHD4 = defineCachedEventHandler(async (event) => {
|
|
|
8446
7793
|
});
|
|
8447
7794
|
|
|
8448
7795
|
const _lazy_x_4o7G = () => import('../routes/api/payload.json.mjs');
|
|
7796
|
+
const _lazy_15NmlJ = () => import('../routes/ws.mjs');
|
|
8449
7797
|
const _lazy_rWaGII = () => import('../routes/renderer.mjs');
|
|
8450
7798
|
|
|
8451
7799
|
const handlers = [
|
|
8452
7800
|
{ route: '', handler: _4bo09N, lazy: false, middleware: true, method: undefined },
|
|
8453
7801
|
{ route: '/api/payload.json', handler: _lazy_x_4o7G, lazy: true, middleware: false, method: undefined },
|
|
7802
|
+
{ route: '/ws', handler: _lazy_15NmlJ, lazy: true, middleware: false, method: undefined },
|
|
8454
7803
|
{ route: '/__nuxt_error', handler: _lazy_rWaGII, lazy: true, middleware: false, method: undefined },
|
|
8455
7804
|
{ route: '/__nuxt_island/**', handler: _SxA8c9, lazy: false, middleware: false, method: undefined },
|
|
8456
7805
|
{ route: '/api/_nuxt_icon/:collection', handler: _wKCHD4, lazy: false, middleware: false, method: undefined },
|
|
@@ -8600,8 +7949,8 @@ runNitroPlugins(nitroApp$1);
|
|
|
8600
7949
|
|
|
8601
7950
|
const nitroApp = useNitroApp();
|
|
8602
7951
|
const listener = toNodeListener(nitroApp.h3App);
|
|
8603
|
-
const websocket =
|
|
7952
|
+
const websocket = nitroApp.h3App.websocket ;
|
|
8604
7953
|
const handler = listener;
|
|
8605
7954
|
trapUnhandledNodeErrors();
|
|
8606
7955
|
|
|
8607
|
-
export { convertGeminiTokenUsage as A, getGeminiLookupCandidates as B, defineEventHandler as C, resolveConfig as D, useRuntimeConfig as E,
|
|
7956
|
+
export { convertGeminiTokenUsage as A, getGeminiLookupCandidates as B, defineEventHandler as C, resolveConfig as D, useRuntimeConfig as E, getDateKey as F, getWeekLabel as G, getMonthKey as H, formatDuration as I, formatDateLabelFromDateKey as J, defineWebSocketHandler as K, withLeadingSlash as L, buildAssetsURL as M, getResponseStatusText as N, getResponseStatus as O, defineRenderHandler as P, publicAssetsURL as Q, getQuery as R, createError$1 as S, destr as T, getRouteRules as U, joinURL as V, useNitroApp as W, commonjsGlobal as X, handler as Y, listener as Z, websocket as _, getDurationMinutes as a, buildLoadUsageResult as b, getClaudeLookupCandidates as c, decodeClaudeProjectPath as d, extractClaudeProjectFromPath as e, createEmptyUsage as f, getProjectName as g, addUsage as h, normalizeRepositoryUrl as i, getThreadName as j, extractModelName as k, normalizeRawUsage as l, convertCodexRawUsage as m, normalizeNumber as n, isZeroUsage as o, parseJsonlFile as p, isOpenRouterFreeModel as q, roundCurrency as r, subtractRawUsage as s, toIsoString as t, uniqueItems as u, parseJsonFile as v, getGeminiProjectRoot as w, getGeminiProjectKeyFromPath as x, getRepositoryNameFromProjectRoot as y, extractGeminiMessageText as z };
|