/opt/canhelp/node_modules/better-auth/dist/integrations
NameSizeModeActions
next-js.d.mts11170644editdlrm
next-js.mjs23330644editdlrm
next-js.mjs.map54710644editdlrm
node.d.mts5120644editdlrm
node.mjs6000644editdlrm
node.mjs.map11980644editdlrm
solid-start.d.mts6170644editdlrm
solid-start.mjs3860644editdlrm
solid-start.mjs.map7810644editdlrm
svelte-kit.d.mts12300644editdlrm
svelte-kit.mjs19980644editdlrm
svelte-kit.mjs.map43120644editdlrm
tanstack-start-solid.d.mts10050644editdlrm
tanstack-start-solid.mjs16850644editdlrm
tanstack-start-solid.mjs.map28880644editdlrm
tanstack-start.d.mts9840644editdlrm
tanstack-start.mjs16640644editdlrm
tanstack-start.mjs.map28670644editdlrm
Edit: /opt/canhelp/node_modules/better-auth/dist/integrations/svelte-kit.mjs (1998B)
import { parseSetCookieHeader } from "../cookies/cookie-utils.mjs"; import "../cookies/index.mjs"; import { createAuthMiddleware } from "@better-auth/core/api"; //#region src/integrations/svelte-kit.ts const toSvelteKitHandler = (auth) => { return (event) => auth.handler(event.request); }; const svelteKitHandler = async ({ auth, event, resolve, building }) => { if (building) return resolve(event); const { request, url } = event; if (isAuthPath(url.toString(), auth.options)) return auth.handler(request); return resolve(event); }; function isAuthPath(url, options) { const _url = new URL(url); const baseURLStr = typeof options.baseURL === "string" ? options.baseURL : void 0; const baseURL = new URL(`${baseURLStr || _url.origin}${options.basePath || "/api/auth"}`); if (_url.origin !== baseURL.origin) return false; if (!_url.pathname.startsWith(baseURL.pathname.endsWith("/") ? baseURL.pathname : `${baseURL.pathname}/`)) return false; return true; } const sveltekitCookies = (getRequestEvent) => { return { id: "sveltekit-cookies", hooks: { after: [{ matcher() { return true; }, handler: createAuthMiddleware(async (ctx) => { const returned = ctx.context.responseHeaders; if ("_flag" in ctx && ctx._flag === "router") return; if (returned instanceof Headers) { const setCookies = returned?.get("set-cookie"); if (!setCookies) return; const event = getRequestEvent(); if (!event) return; const parsed = parseSetCookieHeader(setCookies); for (const [name, { value, ...ops }] of parsed) try { event.cookies.set(name, value, { sameSite: ops.samesite, path: ops.path || "/", expires: ops.expires, secure: ops.secure, httpOnly: ops.httponly, domain: ops.domain, maxAge: ops["max-age"] }); } catch {} } }) }] } }; }; //#endregion export { isAuthPath, svelteKitHandler, sveltekitCookies, toSvelteKitHandler }; //# sourceMappingURL=svelte-kit.mjs.map