UNPKG

@backan/core

Version:

All in one web API builder. Create endpoints with type validations and OpenApi documentation, safely and quickly.

108 lines (107 loc) 3.31 kB
import { swaggerUI } from "@hono/swagger-ui"; import { cache } from "hono/cache"; import { cors } from "hono/cors"; import { hc } from "hono/client"; import { appendTrailingSlash, trimTrailingSlash } from "hono/trailing-slash"; import { env, getRuntimeKey } from "hono/adapter"; import { secureHeaders } from "hono/secure-headers"; import { ipRestriction } from "hono/ip-restriction"; import { compress } from "hono/compress"; import { timeout } from "hono/timeout"; import { bodyLimit } from "hono/body-limit"; import { prettyJSON } from "hono/pretty-json"; import { every, except, some } from "hono/combine"; import { contextStorage, getContext } from "hono/context-storage"; import { deleteCookie, getCookie, getSignedCookie, setCookie, setSignedCookie } from "hono/cookie"; import { z } from "@hono/zod-openapi"; import { z as z2 } from "@hono/zod-openapi"; export * from "hono/factory"; import { poweredBy } from "hono/powered-by"; import { accepts } from "hono/accepts"; import { proxy } from "hono/proxy"; import { jwt } from "hono/jwt"; import { jwk } from "hono/jwk"; import { csrf } from "hono/csrf"; import { etag } from "hono/etag"; import { logger } from "hono/logger"; import { languageDetector } from "hono/language"; import { methodOverride } from "hono/method-override"; import { HTTPException } from "hono/http-exception"; import { stream, streamSSE, streamText } from "hono/streaming"; const createLiteralObjectValues = (obj) => { const literals = Object.values(obj).map((value) => z.literal(value)); return z.union(literals); }; const getConnInfo = async (type) => { if (type === "bun") return (await import("hono/bun")).getConnInfo; else if (type === "deno") return (await import("hono/deno")).getConnInfo; else if (type === "cf-workers") return (await import("hono/cloudflare-workers")).getConnInfo; else if (type === "vercel") return (await import("hono/vercel")).getConnInfo; else return void 0; }; const hookStdout = (callback) => { const boundProcessStdout = process.stdout.write.bind(process.stdout); const boundProcessStderr = process.stderr.write.bind(process.stderr); process.stdout.write = (string, encoding, fd) => { boundProcessStdout(string, encoding); callback(string, encoding, false, fd); return true; }; process.stderr.write = (string, encoding, fd) => { boundProcessStderr(string, encoding); callback(string, encoding, true, fd); return true; }; return () => { process.stdout.write = boundProcessStdout; process.stderr.write = boundProcessStderr; }; }; const hook = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hookStdout }, Symbol.toStringTag, { value: "Module" })); export { HTTPException, accepts, appendTrailingSlash, bodyLimit, cache, compress, contextStorage, cors, hc as createClient, createLiteralObjectValues, csrf, deleteCookie, env, etag, every, except, getConnInfo, getContext, getCookie, getRuntimeKey, getSignedCookie, ipRestriction, jwk, jwt, languageDetector, logger, methodOverride, poweredBy, prettyJSON, proxy, secureHeaders, setCookie, setSignedCookie, some, stream, streamSSE, streamText, swaggerUI, timeout, trimTrailingSlash, hook as utils, z2 as validate };