Erster Docker-Stand

This commit is contained in:
Ali
2026-02-20 16:06:40 +09:00
commit f31e2e8ed3
8818 changed files with 1605323 additions and 0 deletions

86
_node_modules/hono/dist/cjs/utils/accept.js generated vendored Normal file
View File

@@ -0,0 +1,86 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var accept_exports = {};
__export(accept_exports, {
parseAccept: () => parseAccept
});
module.exports = __toCommonJS(accept_exports);
const parseAccept = (acceptHeader) => {
if (!acceptHeader) {
return [];
}
const acceptValues = acceptHeader.split(",").map((value, index) => ({ value, index }));
return acceptValues.map(parseAcceptValue).filter((item) => Boolean(item)).sort(sortByQualityAndIndex).map(({ type, params, q }) => ({ type, params, q }));
};
const parseAcceptValueRegex = /;(?=(?:(?:[^"]*"){2})*[^"]*$)/;
const parseAcceptValue = ({ value, index }) => {
const parts = value.trim().split(parseAcceptValueRegex).map((s) => s.trim());
const type = parts[0];
if (!type) {
return null;
}
const params = parseParams(parts.slice(1));
const q = parseQuality(params.q);
return { type, params, q, index };
};
const parseParams = (paramParts) => {
return paramParts.reduce((acc, param) => {
const [key, val] = param.split("=").map((s) => s.trim());
if (key && val) {
acc[key] = val;
}
return acc;
}, {});
};
const parseQuality = (qVal) => {
if (qVal === void 0) {
return 1;
}
if (qVal === "") {
return 1;
}
if (qVal === "NaN") {
return 0;
}
const num = Number(qVal);
if (num === Infinity) {
return 1;
}
if (num === -Infinity) {
return 0;
}
if (Number.isNaN(num)) {
return 1;
}
if (num < 0 || num > 1) {
return 1;
}
return num;
};
const sortByQualityAndIndex = (a, b) => {
const qDiff = b.q - a.q;
if (qDiff !== 0) {
return qDiff;
}
return a.index - b.index;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
parseAccept
});

46
_node_modules/hono/dist/cjs/utils/basic-auth.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var basic_auth_exports = {};
__export(basic_auth_exports, {
auth: () => auth
});
module.exports = __toCommonJS(basic_auth_exports);
var import_encode = require("./encode");
const CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/;
const USER_PASS_REGEXP = /^([^:]*):(.*)$/;
const utf8Decoder = new TextDecoder();
const auth = (req) => {
const match = CREDENTIALS_REGEXP.exec(req.headers.get("Authorization") || "");
if (!match) {
return void 0;
}
let userPass = void 0;
try {
userPass = USER_PASS_REGEXP.exec(utf8Decoder.decode((0, import_encode.decodeBase64)(match[1])));
} catch {
}
if (!userPass) {
return void 0;
}
return { username: userPass[1], password: userPass[2] };
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
auth
});

95
_node_modules/hono/dist/cjs/utils/body.js generated vendored Normal file
View File

@@ -0,0 +1,95 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var body_exports = {};
__export(body_exports, {
parseBody: () => parseBody
});
module.exports = __toCommonJS(body_exports);
var import_request = require("../request");
const parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
const { all = false, dot = false } = options;
const headers = request instanceof import_request.HonoRequest ? request.raw.headers : request.headers;
const contentType = headers.get("Content-Type");
if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) {
return parseFormData(request, { all, dot });
}
return {};
};
async function parseFormData(request, options) {
const formData = await request.formData();
if (formData) {
return convertFormDataToBodyData(formData, options);
}
return {};
}
function convertFormDataToBodyData(formData, options) {
const form = /* @__PURE__ */ Object.create(null);
formData.forEach((value, key) => {
const shouldParseAllValues = options.all || key.endsWith("[]");
if (!shouldParseAllValues) {
form[key] = value;
} else {
handleParsingAllValues(form, key, value);
}
});
if (options.dot) {
Object.entries(form).forEach(([key, value]) => {
const shouldParseDotValues = key.includes(".");
if (shouldParseDotValues) {
handleParsingNestedValues(form, key, value);
delete form[key];
}
});
}
return form;
}
const handleParsingAllValues = (form, key, value) => {
if (form[key] !== void 0) {
if (Array.isArray(form[key])) {
;
form[key].push(value);
} else {
form[key] = [form[key], value];
}
} else {
if (!key.endsWith("[]")) {
form[key] = value;
} else {
form[key] = [value];
}
}
};
const handleParsingNestedValues = (form, key, value) => {
let nestedForm = form;
const keys = key.split(".");
keys.forEach((key2, index) => {
if (index === keys.length - 1) {
nestedForm[key2] = value;
} else {
if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
nestedForm[key2] = /* @__PURE__ */ Object.create(null);
}
nestedForm = nestedForm[key2];
}
});
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
parseBody
});

76
_node_modules/hono/dist/cjs/utils/buffer.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var buffer_exports = {};
__export(buffer_exports, {
bufferToFormData: () => bufferToFormData,
bufferToString: () => bufferToString,
equal: () => equal,
timingSafeEqual: () => timingSafeEqual
});
module.exports = __toCommonJS(buffer_exports);
var import_crypto = require("./crypto");
const equal = (a, b) => {
if (a === b) {
return true;
}
if (a.byteLength !== b.byteLength) {
return false;
}
const va = new DataView(a);
const vb = new DataView(b);
let i = va.byteLength;
while (i--) {
if (va.getUint8(i) !== vb.getUint8(i)) {
return false;
}
}
return true;
};
const timingSafeEqual = async (a, b, hashFunction) => {
if (!hashFunction) {
hashFunction = import_crypto.sha256;
}
const [sa, sb] = await Promise.all([hashFunction(a), hashFunction(b)]);
if (!sa || !sb) {
return false;
}
return sa === sb && a === b;
};
const bufferToString = (buffer) => {
if (buffer instanceof ArrayBuffer) {
const enc = new TextDecoder("utf-8");
return enc.decode(buffer);
}
return buffer;
};
const bufferToFormData = (arrayBuffer, contentType) => {
const response = new Response(arrayBuffer, {
headers: {
"Content-Type": contentType
}
});
return response.formData();
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
bufferToFormData,
bufferToString,
equal,
timingSafeEqual
});

49
_node_modules/hono/dist/cjs/utils/color.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var color_exports = {};
__export(color_exports, {
getColorEnabled: () => getColorEnabled,
getColorEnabledAsync: () => getColorEnabledAsync
});
module.exports = __toCommonJS(color_exports);
function getColorEnabled() {
const { process, Deno } = globalThis;
const isNoColor = typeof Deno?.noColor === "boolean" ? Deno.noColor : process !== void 0 ? (
// eslint-disable-next-line no-unsafe-optional-chaining
"NO_COLOR" in process?.env
) : false;
return !isNoColor;
}
async function getColorEnabledAsync() {
const { navigator } = globalThis;
const cfWorkers = "cloudflare:workers";
const isNoColor = navigator !== void 0 && navigator.userAgent === "Cloudflare-Workers" ? await (async () => {
try {
return "NO_COLOR" in ((await import(cfWorkers)).env ?? {});
} catch {
return false;
}
})() : !getColorEnabled();
return !isNoColor;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getColorEnabled,
getColorEnabledAsync
});

28
_node_modules/hono/dist/cjs/utils/compress.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var compress_exports = {};
__export(compress_exports, {
COMPRESSIBLE_CONTENT_TYPE_REGEX: () => COMPRESSIBLE_CONTENT_TYPE_REGEX
});
module.exports = __toCommonJS(compress_exports);
const COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/(?!event-stream(?:[;\s]|$))[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
COMPRESSIBLE_CONTENT_TYPE_REGEX
});

62
_node_modules/hono/dist/cjs/utils/concurrent.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var concurrent_exports = {};
__export(concurrent_exports, {
createPool: () => createPool
});
module.exports = __toCommonJS(concurrent_exports);
const DEFAULT_CONCURRENCY = 1024;
const createPool = ({
concurrency,
interval
} = {}) => {
concurrency ||= DEFAULT_CONCURRENCY;
if (concurrency === Infinity) {
return {
run: async (fn) => fn()
};
}
const pool = /* @__PURE__ */ new Set();
const run = async (fn, promise, resolve) => {
if (pool.size >= concurrency) {
promise ||= new Promise((r) => resolve = r);
setTimeout(() => run(fn, promise, resolve));
return promise;
}
const marker = {};
pool.add(marker);
const result = await fn();
if (interval) {
setTimeout(() => pool.delete(marker), interval);
} else {
pool.delete(marker);
}
if (resolve) {
resolve(result);
return promise;
} else {
return result;
}
};
return { run };
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createPool
});

28
_node_modules/hono/dist/cjs/utils/constants.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var constants_exports = {};
__export(constants_exports, {
COMPOSED_HANDLER: () => COMPOSED_HANDLER
});
module.exports = __toCommonJS(constants_exports);
const COMPOSED_HANDLER = "__COMPOSED_HANDLER";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
COMPOSED_HANDLER
});

173
_node_modules/hono/dist/cjs/utils/cookie.js generated vendored Normal file
View File

@@ -0,0 +1,173 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var cookie_exports = {};
__export(cookie_exports, {
parse: () => parse,
parseSigned: () => parseSigned,
serialize: () => serialize,
serializeSigned: () => serializeSigned
});
module.exports = __toCommonJS(cookie_exports);
var import_url = require("./url");
const algorithm = { name: "HMAC", hash: "SHA-256" };
const getCryptoKey = async (secret) => {
const secretBuf = typeof secret === "string" ? new TextEncoder().encode(secret) : secret;
return await crypto.subtle.importKey("raw", secretBuf, algorithm, false, ["sign", "verify"]);
};
const makeSignature = async (value, secret) => {
const key = await getCryptoKey(secret);
const signature = await crypto.subtle.sign(algorithm.name, key, new TextEncoder().encode(value));
return btoa(String.fromCharCode(...new Uint8Array(signature)));
};
const verifySignature = async (base64Signature, value, secret) => {
try {
const signatureBinStr = atob(base64Signature);
const signature = new Uint8Array(signatureBinStr.length);
for (let i = 0, len = signatureBinStr.length; i < len; i++) {
signature[i] = signatureBinStr.charCodeAt(i);
}
return await crypto.subtle.verify(algorithm, secret, signature, new TextEncoder().encode(value));
} catch {
return false;
}
};
const validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
const validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
const parse = (cookie, name) => {
if (name && cookie.indexOf(name) === -1) {
return {};
}
const pairs = cookie.trim().split(";");
const parsedCookie = {};
for (let pairStr of pairs) {
pairStr = pairStr.trim();
const valueStartPos = pairStr.indexOf("=");
if (valueStartPos === -1) {
continue;
}
const cookieName = pairStr.substring(0, valueStartPos).trim();
if (name && name !== cookieName || !validCookieNameRegEx.test(cookieName)) {
continue;
}
let cookieValue = pairStr.substring(valueStartPos + 1).trim();
if (cookieValue.startsWith('"') && cookieValue.endsWith('"')) {
cookieValue = cookieValue.slice(1, -1);
}
if (validCookieValueRegEx.test(cookieValue)) {
parsedCookie[cookieName] = cookieValue.indexOf("%") !== -1 ? (0, import_url.tryDecode)(cookieValue, import_url.decodeURIComponent_) : cookieValue;
if (name) {
break;
}
}
}
return parsedCookie;
};
const parseSigned = async (cookie, secret, name) => {
const parsedCookie = {};
const secretKey = await getCryptoKey(secret);
for (const [key, value] of Object.entries(parse(cookie, name))) {
const signatureStartPos = value.lastIndexOf(".");
if (signatureStartPos < 1) {
continue;
}
const signedValue = value.substring(0, signatureStartPos);
const signature = value.substring(signatureStartPos + 1);
if (signature.length !== 44 || !signature.endsWith("=")) {
continue;
}
const isVerified = await verifySignature(signature, signedValue, secretKey);
parsedCookie[key] = isVerified ? signedValue : false;
}
return parsedCookie;
};
const _serialize = (name, value, opt = {}) => {
let cookie = `${name}=${value}`;
if (name.startsWith("__Secure-") && !opt.secure) {
throw new Error("__Secure- Cookie must have Secure attributes");
}
if (name.startsWith("__Host-")) {
if (!opt.secure) {
throw new Error("__Host- Cookie must have Secure attributes");
}
if (opt.path !== "/") {
throw new Error('__Host- Cookie must have Path attributes with "/"');
}
if (opt.domain) {
throw new Error("__Host- Cookie must not have Domain attributes");
}
}
if (opt && typeof opt.maxAge === "number" && opt.maxAge >= 0) {
if (opt.maxAge > 3456e4) {
throw new Error(
"Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration."
);
}
cookie += `; Max-Age=${opt.maxAge | 0}`;
}
if (opt.domain && opt.prefix !== "host") {
cookie += `; Domain=${opt.domain}`;
}
if (opt.path) {
cookie += `; Path=${opt.path}`;
}
if (opt.expires) {
if (opt.expires.getTime() - Date.now() > 3456e7) {
throw new Error(
"Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future."
);
}
cookie += `; Expires=${opt.expires.toUTCString()}`;
}
if (opt.httpOnly) {
cookie += "; HttpOnly";
}
if (opt.secure) {
cookie += "; Secure";
}
if (opt.sameSite) {
cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`;
}
if (opt.priority) {
cookie += `; Priority=${opt.priority.charAt(0).toUpperCase() + opt.priority.slice(1)}`;
}
if (opt.partitioned) {
if (!opt.secure) {
throw new Error("Partitioned Cookie must have Secure attributes");
}
cookie += "; Partitioned";
}
return cookie;
};
const serialize = (name, value, opt) => {
value = encodeURIComponent(value);
return _serialize(name, value, opt);
};
const serializeSigned = async (name, value, secret, opt = {}) => {
const signature = await makeSignature(value, secret);
value = `${value}.${signature}`;
value = encodeURIComponent(value);
return _serialize(name, value, opt);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
parse,
parseSigned,
serialize,
serializeSigned
});

70
_node_modules/hono/dist/cjs/utils/crypto.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var crypto_exports = {};
__export(crypto_exports, {
createHash: () => createHash,
md5: () => md5,
sha1: () => sha1,
sha256: () => sha256
});
module.exports = __toCommonJS(crypto_exports);
const sha256 = async (data) => {
const algorithm = { name: "SHA-256", alias: "sha256" };
const hash = await createHash(data, algorithm);
return hash;
};
const sha1 = async (data) => {
const algorithm = { name: "SHA-1", alias: "sha1" };
const hash = await createHash(data, algorithm);
return hash;
};
const md5 = async (data) => {
const algorithm = { name: "MD5", alias: "md5" };
const hash = await createHash(data, algorithm);
return hash;
};
const createHash = async (data, algorithm) => {
let sourceBuffer;
if (ArrayBuffer.isView(data) || data instanceof ArrayBuffer) {
sourceBuffer = data;
} else {
if (typeof data === "object") {
data = JSON.stringify(data);
}
sourceBuffer = new TextEncoder().encode(String(data));
}
if (crypto && crypto.subtle) {
const buffer = await crypto.subtle.digest(
{
name: algorithm.name
},
sourceBuffer
);
const hash = Array.prototype.map.call(new Uint8Array(buffer), (x) => ("00" + x.toString(16)).slice(-2)).join("");
return hash;
}
return null;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createHash,
md5,
sha1,
sha256
});

55
_node_modules/hono/dist/cjs/utils/encode.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var encode_exports = {};
__export(encode_exports, {
decodeBase64: () => decodeBase64,
decodeBase64Url: () => decodeBase64Url,
encodeBase64: () => encodeBase64,
encodeBase64Url: () => encodeBase64Url
});
module.exports = __toCommonJS(encode_exports);
const decodeBase64Url = (str) => {
return decodeBase64(str.replace(/_|-/g, (m) => ({ _: "/", "-": "+" })[m] ?? m));
};
const encodeBase64Url = (buf) => encodeBase64(buf).replace(/\/|\+/g, (m) => ({ "/": "_", "+": "-" })[m] ?? m);
const encodeBase64 = (buf) => {
let binary = "";
const bytes = new Uint8Array(buf);
for (let i = 0, len = bytes.length; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return btoa(binary);
};
const decodeBase64 = (str) => {
const binary = atob(str);
const bytes = new Uint8Array(new ArrayBuffer(binary.length));
const half = binary.length / 2;
for (let i = 0, j = binary.length - 1; i <= half; i++, j--) {
bytes[i] = binary.charCodeAt(i);
bytes[j] = binary.charCodeAt(j);
}
return bytes;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
decodeBase64,
decodeBase64Url,
encodeBase64,
encodeBase64Url
});

59
_node_modules/hono/dist/cjs/utils/filepath.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var filepath_exports = {};
__export(filepath_exports, {
getFilePath: () => getFilePath,
getFilePathWithoutDefaultDocument: () => getFilePathWithoutDefaultDocument
});
module.exports = __toCommonJS(filepath_exports);
const getFilePath = (options) => {
let filename = options.filename;
const defaultDocument = options.defaultDocument || "index.html";
if (filename.endsWith("/")) {
filename = filename.concat(defaultDocument);
} else if (!filename.match(/\.[a-zA-Z0-9_-]+$/)) {
filename = filename.concat("/" + defaultDocument);
}
const path = getFilePathWithoutDefaultDocument({
root: options.root,
filename
});
return path;
};
const getFilePathWithoutDefaultDocument = (options) => {
let root = options.root || "";
let filename = options.filename;
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
return;
}
filename = filename.replace(/^\.?[\/\\]/, "");
filename = filename.replace(/\\/, "/");
root = root.replace(/\/$/, "");
let path = root ? root + "/" + filename : filename;
path = path.replace(/^\.?\//, "");
if (root[0] !== "/" && path[0] === "/") {
return;
}
return path;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getFilePath,
getFilePathWithoutDefaultDocument
});

37
_node_modules/hono/dist/cjs/utils/handler.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var handler_exports = {};
__export(handler_exports, {
findTargetHandler: () => findTargetHandler,
isMiddleware: () => isMiddleware
});
module.exports = __toCommonJS(handler_exports);
var import_constants = require("./constants");
const isMiddleware = (handler) => handler.length > 1;
const findTargetHandler = (handler) => {
return handler[import_constants.COMPOSED_HANDLER] ? (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
findTargetHandler(handler[import_constants.COMPOSED_HANDLER])
) : handler;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
findTargetHandler,
isMiddleware
});

16
_node_modules/hono/dist/cjs/utils/headers.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var headers_exports = {};
module.exports = __toCommonJS(headers_exports);

151
_node_modules/hono/dist/cjs/utils/html.js generated vendored Normal file
View File

@@ -0,0 +1,151 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var html_exports = {};
__export(html_exports, {
HtmlEscapedCallbackPhase: () => HtmlEscapedCallbackPhase,
escapeToBuffer: () => escapeToBuffer,
raw: () => raw,
resolveCallback: () => resolveCallback,
resolveCallbackSync: () => resolveCallbackSync,
stringBufferToString: () => stringBufferToString
});
module.exports = __toCommonJS(html_exports);
const HtmlEscapedCallbackPhase = {
Stringify: 1,
BeforeStream: 2,
Stream: 3
};
const raw = (value, callbacks) => {
const escapedString = new String(value);
escapedString.isEscaped = true;
escapedString.callbacks = callbacks;
return escapedString;
};
const escapeRe = /[&<>'"]/;
const stringBufferToString = async (buffer, callbacks) => {
let str = "";
callbacks ||= [];
const resolvedBuffer = await Promise.all(buffer);
for (let i = resolvedBuffer.length - 1; ; i--) {
str += resolvedBuffer[i];
i--;
if (i < 0) {
break;
}
let r = resolvedBuffer[i];
if (typeof r === "object") {
callbacks.push(...r.callbacks || []);
}
const isEscaped = r.isEscaped;
r = await (typeof r === "object" ? r.toString() : r);
if (typeof r === "object") {
callbacks.push(...r.callbacks || []);
}
if (r.isEscaped ?? isEscaped) {
str += r;
} else {
const buf = [str];
escapeToBuffer(r, buf);
str = buf[0];
}
}
return raw(str, callbacks);
};
const escapeToBuffer = (str, buffer) => {
const match = str.search(escapeRe);
if (match === -1) {
buffer[0] += str;
return;
}
let escape;
let index;
let lastIndex = 0;
for (index = match; index < str.length; index++) {
switch (str.charCodeAt(index)) {
case 34:
escape = "&quot;";
break;
case 39:
escape = "&#39;";
break;
case 38:
escape = "&amp;";
break;
case 60:
escape = "&lt;";
break;
case 62:
escape = "&gt;";
break;
default:
continue;
}
buffer[0] += str.substring(lastIndex, index) + escape;
lastIndex = index + 1;
}
buffer[0] += str.substring(lastIndex, index);
};
const resolveCallbackSync = (str) => {
const callbacks = str.callbacks;
if (!callbacks?.length) {
return str;
}
const buffer = [str];
const context = {};
callbacks.forEach((c) => c({ phase: HtmlEscapedCallbackPhase.Stringify, buffer, context }));
return buffer[0];
};
const resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
if (typeof str === "object" && !(str instanceof String)) {
if (!(str instanceof Promise)) {
str = str.toString();
}
if (str instanceof Promise) {
str = await str;
}
}
const callbacks = str.callbacks;
if (!callbacks?.length) {
return Promise.resolve(str);
}
if (buffer) {
buffer[0] += str;
} else {
buffer = [str];
}
const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context }))).then(
(res) => Promise.all(
res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))
).then(() => buffer[0])
);
if (preserveCallbacks) {
return raw(await resStr, callbacks);
} else {
return resStr;
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
HtmlEscapedCallbackPhase,
escapeToBuffer,
raw,
resolveCallback,
resolveCallbackSync,
stringBufferToString
});

16
_node_modules/hono/dist/cjs/utils/http-status.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var http_status_exports = {};
module.exports = __toCommonJS(http_status_exports);

129
_node_modules/hono/dist/cjs/utils/ipaddr.js generated vendored Normal file
View File

@@ -0,0 +1,129 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ipaddr_exports = {};
__export(ipaddr_exports, {
convertIPv4BinaryToString: () => convertIPv4BinaryToString,
convertIPv4ToBinary: () => convertIPv4ToBinary,
convertIPv6BinaryToString: () => convertIPv6BinaryToString,
convertIPv6ToBinary: () => convertIPv6ToBinary,
distinctRemoteAddr: () => distinctRemoteAddr,
expandIPv6: () => expandIPv6
});
module.exports = __toCommonJS(ipaddr_exports);
const expandIPv6 = (ipV6) => {
const sections = ipV6.split(":");
if (IPV4_REGEX.test(sections.at(-1))) {
sections.splice(
-1,
1,
...convertIPv6BinaryToString(convertIPv4ToBinary(sections.at(-1))).substring(2).split(":")
// => ['7f00', '0001']
);
}
for (let i = 0; i < sections.length; i++) {
const node = sections[i];
if (node !== "") {
sections[i] = node.padStart(4, "0");
} else {
sections[i + 1] === "" && sections.splice(i + 1, 1);
sections[i] = new Array(8 - sections.length + 1).fill("0000").join(":");
}
}
return sections.join(":");
};
const IPV4_REGEX = /^[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}$/;
const distinctRemoteAddr = (remoteAddr) => {
if (IPV4_REGEX.test(remoteAddr)) {
return "IPv4";
}
if (remoteAddr.includes(":")) {
return "IPv6";
}
};
const convertIPv4ToBinary = (ipv4) => {
const parts = ipv4.split(".");
let result = 0n;
for (let i = 0; i < 4; i++) {
result <<= 8n;
result += BigInt(parts[i]);
}
return result;
};
const convertIPv6ToBinary = (ipv6) => {
const sections = expandIPv6(ipv6).split(":");
let result = 0n;
for (let i = 0; i < 8; i++) {
result <<= 16n;
result += BigInt(parseInt(sections[i], 16));
}
return result;
};
const convertIPv4BinaryToString = (ipV4) => {
const sections = [];
for (let i = 0; i < 4; i++) {
sections.push(ipV4 >> BigInt(8 * (3 - i)) & 0xffn);
}
return sections.join(".");
};
const convertIPv6BinaryToString = (ipV6) => {
if (ipV6 >> 32n === 0xffffn) {
return `::ffff:${convertIPv4BinaryToString(ipV6 & 0xffffffffn)}`;
}
const sections = [];
for (let i = 0; i < 8; i++) {
sections.push((ipV6 >> BigInt(16 * (7 - i)) & 0xffffn).toString(16));
}
let currentZeroStart = -1;
let maxZeroStart = -1;
let maxZeroEnd = -1;
for (let i = 0; i < 8; i++) {
if (sections[i] === "0") {
if (currentZeroStart === -1) {
currentZeroStart = i;
}
} else {
if (currentZeroStart > -1) {
if (i - currentZeroStart > maxZeroEnd - maxZeroStart) {
maxZeroStart = currentZeroStart;
maxZeroEnd = i;
}
currentZeroStart = -1;
}
}
}
if (currentZeroStart > -1) {
if (8 - currentZeroStart > maxZeroEnd - maxZeroStart) {
maxZeroStart = currentZeroStart;
maxZeroEnd = 8;
}
}
if (maxZeroStart !== -1) {
sections.splice(maxZeroStart, maxZeroEnd - maxZeroStart, ":");
}
return sections.join(":").replace(/:{2,}/g, "::");
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
convertIPv4BinaryToString,
convertIPv4ToBinary,
convertIPv6BinaryToString,
convertIPv6ToBinary,
distinctRemoteAddr,
expandIPv6
});

29
_node_modules/hono/dist/cjs/utils/jwt/index.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var jwt_exports = {};
__export(jwt_exports, {
Jwt: () => Jwt
});
module.exports = __toCommonJS(jwt_exports);
var import_jwt = require("./jwt");
const Jwt = { sign: import_jwt.sign, verify: import_jwt.verify, decode: import_jwt.decode, verifyWithJwks: import_jwt.verifyWithJwks };
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Jwt
});

43
_node_modules/hono/dist/cjs/utils/jwt/jwa.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var jwa_exports = {};
__export(jwa_exports, {
AlgorithmTypes: () => AlgorithmTypes
});
module.exports = __toCommonJS(jwa_exports);
var AlgorithmTypes = /* @__PURE__ */ ((AlgorithmTypes2) => {
AlgorithmTypes2["HS256"] = "HS256";
AlgorithmTypes2["HS384"] = "HS384";
AlgorithmTypes2["HS512"] = "HS512";
AlgorithmTypes2["RS256"] = "RS256";
AlgorithmTypes2["RS384"] = "RS384";
AlgorithmTypes2["RS512"] = "RS512";
AlgorithmTypes2["PS256"] = "PS256";
AlgorithmTypes2["PS384"] = "PS384";
AlgorithmTypes2["PS512"] = "PS512";
AlgorithmTypes2["ES256"] = "ES256";
AlgorithmTypes2["ES384"] = "ES384";
AlgorithmTypes2["ES512"] = "ES512";
AlgorithmTypes2["EdDSA"] = "EdDSA";
return AlgorithmTypes2;
})(AlgorithmTypes || {});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AlgorithmTypes
});

216
_node_modules/hono/dist/cjs/utils/jwt/jws.js generated vendored Normal file
View File

@@ -0,0 +1,216 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var jws_exports = {};
__export(jws_exports, {
signing: () => signing,
verifying: () => verifying
});
module.exports = __toCommonJS(jws_exports);
var import_adapter = require("../../helper/adapter");
var import_encode = require("../encode");
var import_types = require("./types");
var import_utf8 = require("./utf8");
async function signing(privateKey, alg, data) {
const algorithm = getKeyAlgorithm(alg);
const cryptoKey = await importPrivateKey(privateKey, algorithm);
return await crypto.subtle.sign(algorithm, cryptoKey, data);
}
async function verifying(publicKey, alg, signature, data) {
const algorithm = getKeyAlgorithm(alg);
const cryptoKey = await importPublicKey(publicKey, algorithm);
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
}
function pemToBinary(pem) {
return (0, import_encode.decodeBase64)(pem.replace(/-+(BEGIN|END).*/g, "").replace(/\s/g, ""));
}
async function importPrivateKey(key, alg) {
if (!crypto.subtle || !crypto.subtle.importKey) {
throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");
}
if (isCryptoKey(key)) {
if (key.type !== "private" && key.type !== "secret") {
throw new Error(
`unexpected key type: CryptoKey.type is ${key.type}, expected private or secret`
);
}
return key;
}
const usages = [import_types.CryptoKeyUsage.Sign];
if (typeof key === "object") {
return await crypto.subtle.importKey("jwk", key, alg, false, usages);
}
if (key.includes("PRIVATE")) {
return await crypto.subtle.importKey("pkcs8", pemToBinary(key), alg, false, usages);
}
return await crypto.subtle.importKey("raw", import_utf8.utf8Encoder.encode(key), alg, false, usages);
}
async function importPublicKey(key, alg) {
if (!crypto.subtle || !crypto.subtle.importKey) {
throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");
}
if (isCryptoKey(key)) {
if (key.type === "public" || key.type === "secret") {
return key;
}
key = await exportPublicJwkFrom(key);
}
if (typeof key === "string" && key.includes("PRIVATE")) {
const privateKey = await crypto.subtle.importKey("pkcs8", pemToBinary(key), alg, true, [
import_types.CryptoKeyUsage.Sign
]);
key = await exportPublicJwkFrom(privateKey);
}
const usages = [import_types.CryptoKeyUsage.Verify];
if (typeof key === "object") {
return await crypto.subtle.importKey("jwk", key, alg, false, usages);
}
if (key.includes("PUBLIC")) {
return await crypto.subtle.importKey("spki", pemToBinary(key), alg, false, usages);
}
return await crypto.subtle.importKey("raw", import_utf8.utf8Encoder.encode(key), alg, false, usages);
}
async function exportPublicJwkFrom(privateKey) {
if (privateKey.type !== "private") {
throw new Error(`unexpected key type: ${privateKey.type}`);
}
if (!privateKey.extractable) {
throw new Error("unexpected private key is unextractable");
}
const jwk = await crypto.subtle.exportKey("jwk", privateKey);
const { kty } = jwk;
const { alg, e, n } = jwk;
const { crv, x, y } = jwk;
return { kty, alg, e, n, crv, x, y, key_ops: [import_types.CryptoKeyUsage.Verify] };
}
function getKeyAlgorithm(name) {
switch (name) {
case "HS256":
return {
name: "HMAC",
hash: {
name: "SHA-256"
}
};
case "HS384":
return {
name: "HMAC",
hash: {
name: "SHA-384"
}
};
case "HS512":
return {
name: "HMAC",
hash: {
name: "SHA-512"
}
};
case "RS256":
return {
name: "RSASSA-PKCS1-v1_5",
hash: {
name: "SHA-256"
}
};
case "RS384":
return {
name: "RSASSA-PKCS1-v1_5",
hash: {
name: "SHA-384"
}
};
case "RS512":
return {
name: "RSASSA-PKCS1-v1_5",
hash: {
name: "SHA-512"
}
};
case "PS256":
return {
name: "RSA-PSS",
hash: {
name: "SHA-256"
},
saltLength: 32
// 256 >> 3
};
case "PS384":
return {
name: "RSA-PSS",
hash: {
name: "SHA-384"
},
saltLength: 48
// 384 >> 3
};
case "PS512":
return {
name: "RSA-PSS",
hash: {
name: "SHA-512"
},
saltLength: 64
// 512 >> 3,
};
case "ES256":
return {
name: "ECDSA",
hash: {
name: "SHA-256"
},
namedCurve: "P-256"
};
case "ES384":
return {
name: "ECDSA",
hash: {
name: "SHA-384"
},
namedCurve: "P-384"
};
case "ES512":
return {
name: "ECDSA",
hash: {
name: "SHA-512"
},
namedCurve: "P-521"
};
case "EdDSA":
return {
name: "Ed25519",
namedCurve: "Ed25519"
};
default:
throw new import_types.JwtAlgorithmNotImplemented(name);
}
}
function isCryptoKey(key) {
const runtime = (0, import_adapter.getRuntimeKey)();
if (runtime === "node" && !!crypto.webcrypto) {
return key instanceof crypto.webcrypto.CryptoKey;
}
return key instanceof CryptoKey;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
signing,
verifying
});

210
_node_modules/hono/dist/cjs/utils/jwt/jwt.js generated vendored Normal file
View File

@@ -0,0 +1,210 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var jwt_exports = {};
__export(jwt_exports, {
decode: () => decode,
decodeHeader: () => decodeHeader,
isTokenHeader: () => isTokenHeader,
sign: () => sign,
verify: () => verify,
verifyWithJwks: () => verifyWithJwks
});
module.exports = __toCommonJS(jwt_exports);
var import_encode = require("../../utils/encode");
var import_jwa = require("./jwa");
var import_jws = require("./jws");
var import_types = require("./types");
var import_utf8 = require("./utf8");
const encodeJwtPart = (part) => (0, import_encode.encodeBase64Url)(import_utf8.utf8Encoder.encode(JSON.stringify(part)).buffer).replace(/=/g, "");
const encodeSignaturePart = (buf) => (0, import_encode.encodeBase64Url)(buf).replace(/=/g, "");
const decodeJwtPart = (part) => JSON.parse(import_utf8.utf8Decoder.decode((0, import_encode.decodeBase64Url)(part)));
function isTokenHeader(obj) {
if (typeof obj === "object" && obj !== null) {
const objWithAlg = obj;
return "alg" in objWithAlg && Object.values(import_jwa.AlgorithmTypes).includes(objWithAlg.alg) && (!("typ" in objWithAlg) || objWithAlg.typ === "JWT");
}
return false;
}
const sign = async (payload, privateKey, alg = "HS256") => {
const encodedPayload = encodeJwtPart(payload);
let encodedHeader;
if (typeof privateKey === "object" && "alg" in privateKey) {
alg = privateKey.alg;
encodedHeader = encodeJwtPart({ alg, typ: "JWT", kid: privateKey.kid });
} else {
encodedHeader = encodeJwtPart({ alg, typ: "JWT" });
}
const partialToken = `${encodedHeader}.${encodedPayload}`;
const signaturePart = await (0, import_jws.signing)(privateKey, alg, import_utf8.utf8Encoder.encode(partialToken));
const signature = encodeSignaturePart(signaturePart);
return `${partialToken}.${signature}`;
};
const verify = async (token, publicKey, algOrOptions) => {
if (!algOrOptions) {
throw new import_types.JwtAlgorithmRequired();
}
const {
alg,
iss,
nbf = true,
exp = true,
iat = true,
aud
} = typeof algOrOptions === "string" ? { alg: algOrOptions } : algOrOptions;
if (!alg) {
throw new import_types.JwtAlgorithmRequired();
}
const tokenParts = token.split(".");
if (tokenParts.length !== 3) {
throw new import_types.JwtTokenInvalid(token);
}
const { header, payload } = decode(token);
if (!isTokenHeader(header)) {
throw new import_types.JwtHeaderInvalid(header);
}
if (header.alg !== alg) {
throw new import_types.JwtAlgorithmMismatch(alg, header.alg);
}
const now = Date.now() / 1e3 | 0;
if (nbf && payload.nbf && payload.nbf > now) {
throw new import_types.JwtTokenNotBefore(token);
}
if (exp && payload.exp && payload.exp <= now) {
throw new import_types.JwtTokenExpired(token);
}
if (iat && payload.iat && now < payload.iat) {
throw new import_types.JwtTokenIssuedAt(now, payload.iat);
}
if (iss) {
if (!payload.iss) {
throw new import_types.JwtTokenIssuer(iss, null);
}
if (typeof iss === "string" && payload.iss !== iss) {
throw new import_types.JwtTokenIssuer(iss, payload.iss);
}
if (iss instanceof RegExp && !iss.test(payload.iss)) {
throw new import_types.JwtTokenIssuer(iss, payload.iss);
}
}
if (aud) {
if (!payload.aud) {
throw new import_types.JwtPayloadRequiresAud(payload);
}
const audiences = Array.isArray(payload.aud) ? payload.aud : [payload.aud];
const matched = audiences.some(
(payloadAud) => aud instanceof RegExp ? aud.test(payloadAud) : typeof aud === "string" ? payloadAud === aud : Array.isArray(aud) && aud.includes(payloadAud)
);
if (!matched) {
throw new import_types.JwtTokenAudience(aud, payload.aud);
}
}
const headerPayload = token.substring(0, token.lastIndexOf("."));
const verified = await (0, import_jws.verifying)(
publicKey,
alg,
(0, import_encode.decodeBase64Url)(tokenParts[2]),
import_utf8.utf8Encoder.encode(headerPayload)
);
if (!verified) {
throw new import_types.JwtTokenSignatureMismatched(token);
}
return payload;
};
const symmetricAlgorithms = [
import_jwa.AlgorithmTypes.HS256,
import_jwa.AlgorithmTypes.HS384,
import_jwa.AlgorithmTypes.HS512
];
const verifyWithJwks = async (token, options, init) => {
const verifyOpts = options.verification || {};
const header = decodeHeader(token);
if (!isTokenHeader(header)) {
throw new import_types.JwtHeaderInvalid(header);
}
if (!header.kid) {
throw new import_types.JwtHeaderRequiresKid(header);
}
if (symmetricAlgorithms.includes(header.alg)) {
throw new import_types.JwtSymmetricAlgorithmNotAllowed(header.alg);
}
if (!options.allowedAlgorithms.includes(header.alg)) {
throw new import_types.JwtAlgorithmNotAllowed(header.alg, options.allowedAlgorithms);
}
if (options.jwks_uri) {
const response = await fetch(options.jwks_uri, init);
if (!response.ok) {
throw new Error(`failed to fetch JWKS from ${options.jwks_uri}`);
}
const data = await response.json();
if (!data.keys) {
throw new Error('invalid JWKS response. "keys" field is missing');
}
if (!Array.isArray(data.keys)) {
throw new Error('invalid JWKS response. "keys" field is not an array');
}
if (options.keys) {
options.keys.push(...data.keys);
} else {
options.keys = data.keys;
}
} else if (!options.keys) {
throw new Error('verifyWithJwks requires options for either "keys" or "jwks_uri" or both');
}
const matchingKey = options.keys.find((key) => key.kid === header.kid);
if (!matchingKey) {
throw new import_types.JwtTokenInvalid(token);
}
if (matchingKey.alg && matchingKey.alg !== header.alg) {
throw new import_types.JwtAlgorithmMismatch(matchingKey.alg, header.alg);
}
return await verify(token, matchingKey, {
alg: header.alg,
...verifyOpts
});
};
const decode = (token) => {
try {
const [h, p] = token.split(".");
const header = decodeJwtPart(h);
const payload = decodeJwtPart(p);
return {
header,
payload
};
} catch {
throw new import_types.JwtTokenInvalid(token);
}
};
const decodeHeader = (token) => {
try {
const [h] = token.split(".");
return decodeJwtPart(h);
} catch {
throw new import_types.JwtTokenInvalid(token);
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
decode,
decodeHeader,
isTokenHeader,
sign,
verify,
verifyWithJwks
});

162
_node_modules/hono/dist/cjs/utils/jwt/types.js generated vendored Normal file
View File

@@ -0,0 +1,162 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var types_exports = {};
__export(types_exports, {
CryptoKeyUsage: () => CryptoKeyUsage,
JwtAlgorithmMismatch: () => JwtAlgorithmMismatch,
JwtAlgorithmNotAllowed: () => JwtAlgorithmNotAllowed,
JwtAlgorithmNotImplemented: () => JwtAlgorithmNotImplemented,
JwtAlgorithmRequired: () => JwtAlgorithmRequired,
JwtHeaderInvalid: () => JwtHeaderInvalid,
JwtHeaderRequiresKid: () => JwtHeaderRequiresKid,
JwtPayloadRequiresAud: () => JwtPayloadRequiresAud,
JwtSymmetricAlgorithmNotAllowed: () => JwtSymmetricAlgorithmNotAllowed,
JwtTokenAudience: () => JwtTokenAudience,
JwtTokenExpired: () => JwtTokenExpired,
JwtTokenInvalid: () => JwtTokenInvalid,
JwtTokenIssuedAt: () => JwtTokenIssuedAt,
JwtTokenIssuer: () => JwtTokenIssuer,
JwtTokenNotBefore: () => JwtTokenNotBefore,
JwtTokenSignatureMismatched: () => JwtTokenSignatureMismatched
});
module.exports = __toCommonJS(types_exports);
class JwtAlgorithmNotImplemented extends Error {
constructor(alg) {
super(`${alg} is not an implemented algorithm`);
this.name = "JwtAlgorithmNotImplemented";
}
}
class JwtAlgorithmRequired extends Error {
constructor() {
super('JWT verification requires "alg" option to be specified');
this.name = "JwtAlgorithmRequired";
}
}
class JwtAlgorithmMismatch extends Error {
constructor(expected, actual) {
super(`JWT algorithm mismatch: expected "${expected}", got "${actual}"`);
this.name = "JwtAlgorithmMismatch";
}
}
class JwtTokenInvalid extends Error {
constructor(token) {
super(`invalid JWT token: ${token}`);
this.name = "JwtTokenInvalid";
}
}
class JwtTokenNotBefore extends Error {
constructor(token) {
super(`token (${token}) is being used before it's valid`);
this.name = "JwtTokenNotBefore";
}
}
class JwtTokenExpired extends Error {
constructor(token) {
super(`token (${token}) expired`);
this.name = "JwtTokenExpired";
}
}
class JwtTokenIssuedAt extends Error {
constructor(currentTimestamp, iat) {
super(
`Invalid "iat" claim, must be a valid number lower than "${currentTimestamp}" (iat: "${iat}")`
);
this.name = "JwtTokenIssuedAt";
}
}
class JwtTokenIssuer extends Error {
constructor(expected, iss) {
super(`expected issuer "${expected}", got ${iss ? `"${iss}"` : "none"} `);
this.name = "JwtTokenIssuer";
}
}
class JwtHeaderInvalid extends Error {
constructor(header) {
super(`jwt header is invalid: ${JSON.stringify(header)}`);
this.name = "JwtHeaderInvalid";
}
}
class JwtHeaderRequiresKid extends Error {
constructor(header) {
super(`required "kid" in jwt header: ${JSON.stringify(header)}`);
this.name = "JwtHeaderRequiresKid";
}
}
class JwtSymmetricAlgorithmNotAllowed extends Error {
constructor(alg) {
super(`symmetric algorithm "${alg}" is not allowed for JWK verification`);
this.name = "JwtSymmetricAlgorithmNotAllowed";
}
}
class JwtAlgorithmNotAllowed extends Error {
constructor(alg, allowedAlgorithms) {
super(`algorithm "${alg}" is not in the allowed list: [${allowedAlgorithms.join(", ")}]`);
this.name = "JwtAlgorithmNotAllowed";
}
}
class JwtTokenSignatureMismatched extends Error {
constructor(token) {
super(`token(${token}) signature mismatched`);
this.name = "JwtTokenSignatureMismatched";
}
}
class JwtPayloadRequiresAud extends Error {
constructor(payload) {
super(`required "aud" in jwt payload: ${JSON.stringify(payload)}`);
this.name = "JwtPayloadRequiresAud";
}
}
class JwtTokenAudience extends Error {
constructor(expected, aud) {
super(
`expected audience "${Array.isArray(expected) ? expected.join(", ") : expected}", got "${aud}"`
);
this.name = "JwtTokenAudience";
}
}
var CryptoKeyUsage = /* @__PURE__ */ ((CryptoKeyUsage2) => {
CryptoKeyUsage2["Encrypt"] = "encrypt";
CryptoKeyUsage2["Decrypt"] = "decrypt";
CryptoKeyUsage2["Sign"] = "sign";
CryptoKeyUsage2["Verify"] = "verify";
CryptoKeyUsage2["DeriveKey"] = "deriveKey";
CryptoKeyUsage2["DeriveBits"] = "deriveBits";
CryptoKeyUsage2["WrapKey"] = "wrapKey";
CryptoKeyUsage2["UnwrapKey"] = "unwrapKey";
return CryptoKeyUsage2;
})(CryptoKeyUsage || {});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CryptoKeyUsage,
JwtAlgorithmMismatch,
JwtAlgorithmNotAllowed,
JwtAlgorithmNotImplemented,
JwtAlgorithmRequired,
JwtHeaderInvalid,
JwtHeaderRequiresKid,
JwtPayloadRequiresAud,
JwtSymmetricAlgorithmNotAllowed,
JwtTokenAudience,
JwtTokenExpired,
JwtTokenInvalid,
JwtTokenIssuedAt,
JwtTokenIssuer,
JwtTokenNotBefore,
JwtTokenSignatureMismatched
});

31
_node_modules/hono/dist/cjs/utils/jwt/utf8.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var utf8_exports = {};
__export(utf8_exports, {
utf8Decoder: () => utf8Decoder,
utf8Encoder: () => utf8Encoder
});
module.exports = __toCommonJS(utf8_exports);
const utf8Encoder = new TextEncoder();
const utf8Decoder = new TextDecoder();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
utf8Decoder,
utf8Encoder
});

109
_node_modules/hono/dist/cjs/utils/mime.js generated vendored Normal file
View File

@@ -0,0 +1,109 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var mime_exports = {};
__export(mime_exports, {
getExtension: () => getExtension,
getMimeType: () => getMimeType,
mimes: () => baseMimes
});
module.exports = __toCommonJS(mime_exports);
const getMimeType = (filename, mimes = baseMimes) => {
const regexp = /\.([a-zA-Z0-9]+?)$/;
const match = filename.match(regexp);
if (!match) {
return;
}
let mimeType = mimes[match[1]];
if (mimeType && mimeType.startsWith("text")) {
mimeType += "; charset=utf-8";
}
return mimeType;
};
const getExtension = (mimeType) => {
for (const ext in baseMimes) {
if (baseMimes[ext] === mimeType) {
return ext;
}
}
};
const _baseMimes = {
aac: "audio/aac",
avi: "video/x-msvideo",
avif: "image/avif",
av1: "video/av1",
bin: "application/octet-stream",
bmp: "image/bmp",
css: "text/css",
csv: "text/csv",
eot: "application/vnd.ms-fontobject",
epub: "application/epub+zip",
gif: "image/gif",
gz: "application/gzip",
htm: "text/html",
html: "text/html",
ico: "image/x-icon",
ics: "text/calendar",
jpeg: "image/jpeg",
jpg: "image/jpeg",
js: "text/javascript",
json: "application/json",
jsonld: "application/ld+json",
map: "application/json",
mid: "audio/x-midi",
midi: "audio/x-midi",
mjs: "text/javascript",
mp3: "audio/mpeg",
mp4: "video/mp4",
mpeg: "video/mpeg",
oga: "audio/ogg",
ogv: "video/ogg",
ogx: "application/ogg",
opus: "audio/opus",
otf: "font/otf",
pdf: "application/pdf",
png: "image/png",
rtf: "application/rtf",
svg: "image/svg+xml",
tif: "image/tiff",
tiff: "image/tiff",
ts: "video/mp2t",
ttf: "font/ttf",
txt: "text/plain",
wasm: "application/wasm",
webm: "video/webm",
weba: "audio/webm",
webmanifest: "application/manifest+json",
webp: "image/webp",
woff: "font/woff",
woff2: "font/woff2",
xhtml: "application/xhtml+xml",
xml: "application/xml",
zip: "application/zip",
"3gp": "video/3gpp",
"3g2": "video/3gpp2",
gltf: "model/gltf+json",
glb: "model/gltf-binary"
};
const baseMimes = _baseMimes;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getExtension,
getMimeType,
mimes
});

102
_node_modules/hono/dist/cjs/utils/stream.js generated vendored Normal file
View File

@@ -0,0 +1,102 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stream_exports = {};
__export(stream_exports, {
StreamingApi: () => StreamingApi
});
module.exports = __toCommonJS(stream_exports);
class StreamingApi {
writer;
encoder;
writable;
abortSubscribers = [];
responseReadable;
/**
* Whether the stream has been aborted.
*/
aborted = false;
/**
* Whether the stream has been closed normally.
*/
closed = false;
constructor(writable, _readable) {
this.writable = writable;
this.writer = writable.getWriter();
this.encoder = new TextEncoder();
const reader = _readable.getReader();
this.abortSubscribers.push(async () => {
await reader.cancel();
});
this.responseReadable = new ReadableStream({
async pull(controller) {
const { done, value } = await reader.read();
done ? controller.close() : controller.enqueue(value);
},
cancel: () => {
this.abort();
}
});
}
async write(input) {
try {
if (typeof input === "string") {
input = this.encoder.encode(input);
}
await this.writer.write(input);
} catch {
}
return this;
}
async writeln(input) {
await this.write(input + "\n");
return this;
}
sleep(ms) {
return new Promise((res) => setTimeout(res, ms));
}
async close() {
try {
await this.writer.close();
} catch {
}
this.closed = true;
}
async pipe(body) {
this.writer.releaseLock();
await body.pipeTo(this.writable, { preventClose: true });
this.writer = this.writable.getWriter();
}
onAbort(listener) {
this.abortSubscribers.push(listener);
}
/**
* Abort the stream.
* You can call this method when stream is aborted by external event.
*/
abort() {
if (!this.aborted) {
this.aborted = true;
this.abortSubscribers.forEach((subscriber) => subscriber());
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
StreamingApi
});

16
_node_modules/hono/dist/cjs/utils/types.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var types_exports = {};
module.exports = __toCommonJS(types_exports);

253
_node_modules/hono/dist/cjs/utils/url.js generated vendored Normal file
View File

@@ -0,0 +1,253 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var url_exports = {};
__export(url_exports, {
checkOptionalParameter: () => checkOptionalParameter,
decodeURIComponent_: () => decodeURIComponent_,
getPath: () => getPath,
getPathNoStrict: () => getPathNoStrict,
getPattern: () => getPattern,
getQueryParam: () => getQueryParam,
getQueryParams: () => getQueryParams,
getQueryStrings: () => getQueryStrings,
mergePath: () => mergePath,
splitPath: () => splitPath,
splitRoutingPath: () => splitRoutingPath,
tryDecode: () => tryDecode
});
module.exports = __toCommonJS(url_exports);
const splitPath = (path) => {
const paths = path.split("/");
if (paths[0] === "") {
paths.shift();
}
return paths;
};
const splitRoutingPath = (routePath) => {
const { groups, path } = extractGroupsFromPath(routePath);
const paths = splitPath(path);
return replaceGroupMarks(paths, groups);
};
const extractGroupsFromPath = (path) => {
const groups = [];
path = path.replace(/\{[^}]+\}/g, (match, index) => {
const mark = `@${index}`;
groups.push([mark, match]);
return mark;
});
return { groups, path };
};
const replaceGroupMarks = (paths, groups) => {
for (let i = groups.length - 1; i >= 0; i--) {
const [mark] = groups[i];
for (let j = paths.length - 1; j >= 0; j--) {
if (paths[j].includes(mark)) {
paths[j] = paths[j].replace(mark, groups[i][1]);
break;
}
}
}
return paths;
};
const patternCache = {};
const getPattern = (label, next) => {
if (label === "*") {
return "*";
}
const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
if (match) {
const cacheKey = `${label}#${next}`;
if (!patternCache[cacheKey]) {
if (match[2]) {
patternCache[cacheKey] = next && next[0] !== ":" && next[0] !== "*" ? [cacheKey, match[1], new RegExp(`^${match[2]}(?=/${next})`)] : [label, match[1], new RegExp(`^${match[2]}$`)];
} else {
patternCache[cacheKey] = [label, match[1], true];
}
}
return patternCache[cacheKey];
}
return null;
};
const tryDecode = (str, decoder) => {
try {
return decoder(str);
} catch {
return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
try {
return decoder(match);
} catch {
return match;
}
});
}
};
const tryDecodeURI = (str) => tryDecode(str, decodeURI);
const getPath = (request) => {
const url = request.url;
const start = url.indexOf("/", url.indexOf(":") + 4);
let i = start;
for (; i < url.length; i++) {
const charCode = url.charCodeAt(i);
if (charCode === 37) {
const queryIndex = url.indexOf("?", i);
const path = url.slice(start, queryIndex === -1 ? void 0 : queryIndex);
return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path);
} else if (charCode === 63) {
break;
}
}
return url.slice(start, i);
};
const getQueryStrings = (url) => {
const queryIndex = url.indexOf("?", 8);
return queryIndex === -1 ? "" : "?" + url.slice(queryIndex + 1);
};
const getPathNoStrict = (request) => {
const result = getPath(request);
return result.length > 1 && result.at(-1) === "/" ? result.slice(0, -1) : result;
};
const mergePath = (base, sub, ...rest) => {
if (rest.length) {
sub = mergePath(sub, ...rest);
}
return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
};
const checkOptionalParameter = (path) => {
if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(":")) {
return null;
}
const segments = path.split("/");
const results = [];
let basePath = "";
segments.forEach((segment) => {
if (segment !== "" && !/\:/.test(segment)) {
basePath += "/" + segment;
} else if (/\:/.test(segment)) {
if (/\?/.test(segment)) {
if (results.length === 0 && basePath === "") {
results.push("/");
} else {
results.push(basePath);
}
const optionalSegment = segment.replace("?", "");
basePath += "/" + optionalSegment;
results.push(basePath);
} else {
basePath += "/" + segment;
}
}
});
return results.filter((v, i, a) => a.indexOf(v) === i);
};
const _decodeURI = (value) => {
if (!/[%+]/.test(value)) {
return value;
}
if (value.indexOf("+") !== -1) {
value = value.replace(/\+/g, " ");
}
return value.indexOf("%") !== -1 ? tryDecode(value, decodeURIComponent_) : value;
};
const _getQueryParam = (url, key, multiple) => {
let encoded;
if (!multiple && key && !/[%+]/.test(key)) {
let keyIndex2 = url.indexOf("?", 8);
if (keyIndex2 === -1) {
return void 0;
}
if (!url.startsWith(key, keyIndex2 + 1)) {
keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
}
while (keyIndex2 !== -1) {
const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1);
if (trailingKeyCode === 61) {
const valueIndex = keyIndex2 + key.length + 2;
const endIndex = url.indexOf("&", valueIndex);
return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));
} else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) {
return "";
}
keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
}
encoded = /[%+]/.test(url);
if (!encoded) {
return void 0;
}
}
const results = {};
encoded ??= /[%+]/.test(url);
let keyIndex = url.indexOf("?", 8);
while (keyIndex !== -1) {
const nextKeyIndex = url.indexOf("&", keyIndex + 1);
let valueIndex = url.indexOf("=", keyIndex);
if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) {
valueIndex = -1;
}
let name = url.slice(
keyIndex + 1,
valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex
);
if (encoded) {
name = _decodeURI(name);
}
keyIndex = nextKeyIndex;
if (name === "") {
continue;
}
let value;
if (valueIndex === -1) {
value = "";
} else {
value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);
if (encoded) {
value = _decodeURI(value);
}
}
if (multiple) {
if (!(results[name] && Array.isArray(results[name]))) {
results[name] = [];
}
;
results[name].push(value);
} else {
results[name] ??= value;
}
}
return key ? results[key] : results;
};
const getQueryParam = _getQueryParam;
const getQueryParams = (url, key) => {
return _getQueryParam(url, key, true);
};
const decodeURIComponent_ = decodeURIComponent;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
checkOptionalParameter,
decodeURIComponent_,
getPath,
getPathNoStrict,
getPattern,
getQueryParam,
getQueryParams,
getQueryStrings,
mergePath,
splitPath,
splitRoutingPath,
tryDecode
});