gemi 0.46.0 → 0.47.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/chunk-3wjd8x9t.js +5 -0
- package/dist/chunk-3wjd8x9t.js.map +13 -0
- package/dist/{chunk-qmsngk2y.js → chunk-732aak4d.js} +1 -1
- package/dist/{chunk-3ervqphj.js → chunk-bk76mah1.js} +2 -2
- package/dist/{chunk-3ervqphj.js.map → chunk-bk76mah1.js.map} +1 -1
- package/dist/client/index.js +1 -6
- package/dist/client/index.js.map +1 -1
- package/dist/client/useQuery.d.ts.map +1 -1
- package/dist/server/compression.d.ts +69 -0
- package/dist/server/compression.d.ts.map +1 -0
- package/dist/server/httpProd.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-zp9ybbp6.js +0 -5
- package/dist/chunk-zp9ybbp6.js.map +0 -12
- /package/dist/{chunk-qmsngk2y.js.map → chunk-732aak4d.js.map} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{h as I,i as R}from"./chunk-bk76mah1.js";import"./chunk-ppt296ye.js";import{K as T,M as _}from"./chunk-d9k245jt.js";import"./chunk-evkv0xa7.js";import"./chunk-p5r0t9jh.js";import"./chunk-4z53shav.js";import"./chunk-m0earq80.js";import"./chunk-f18weffa.js";import{join as M}from"path";import{Duplex as E}from"stream";import{constants as P,createBrotliCompress as q,createGzip as m}from"zlib";var h=["br","gzip"],c=1024,l=5,o=19,d=6;function p($){if($===void 0)return 1;if(!/^\d+(\.\d{0,3})?$/.test($.trim()))return 1;let J=Number($.trim());return Number.isFinite(J)?Math.min(J,1):1}function n($){if($===null||$===void 0)return null;let J=new Map;for(let H of $.split(",")){let[z,...G]=H.split(";"),x=z.trim().toLowerCase();if(x==="")continue;let j=1;for(let Q of G){let k=Q.indexOf("=");if(k===-1)continue;if(Q.slice(0,k).trim().toLowerCase()==="q"){j=p(Q.slice(k+1));break}}J.set(x,j)}return J}function i($,J=h){let H=n($);if(!H)return null;let z=H.get("*"),G=null,x=0;for(let j of J){let Q=H.get(j)??z??0;if(Q>x)G=j,x=Q}return G}function t($,J){if(!$)return!1;return $.split(",").some((H)=>H.trim().toLowerCase().split("=")[0].trim()===J)}function a($,J){if($==="HEAD")return!1;if(!J.body)return!1;if(J.status<200||J.status===204||J.status===206||J.status===304)return!1;if(J.headers.has("Content-Range"))return!1;let H=J.headers.get("Content-Type");if(!H||!/^\s*text\/html\s*(;|$)/i.test(H))return!1;let z=J.headers.get("Content-Encoding");if(z&&z.trim().toLowerCase()!=="identity")return!1;if(t(J.headers.get("Cache-Control"),"no-transform"))return!1;let G=J.headers.get("Content-Length");if(G!==null&&Number(G)<c)return!1;return!0}function s($){let J=$==="br"?q({params:{[P.BROTLI_PARAM_QUALITY]:l,[P.BROTLI_PARAM_LGWIN]:o},flush:P.BROTLI_OPERATION_FLUSH}):m({level:d,flush:P.Z_SYNC_FLUSH});return E.toWeb(J)}function r($){let J=$.get("Vary");if(!J){$.set("Vary","Accept-Encoding");return}let H=J.split(",").map((z)=>z.trim().toLowerCase());if(H.includes("*")||H.includes("accept-encoding"))return;$.append("Vary","Accept-Encoding")}function V($,J){if(!a($.method,J))return J;let H=new Headers(J.headers);r(H);let z=i($.headers.get("Accept-Encoding"));if(!z)return new Response(J.body,{status:J.status,statusText:J.statusText,headers:H});let G;try{G=s(z)}catch{return new Response(J.body,{status:J.status,statusText:J.statusText,headers:H})}return H.set("Content-Encoding",z),H.delete("Content-Length"),new Response(J.body.pipeThrough(G),{status:J.status,statusText:J.statusText,headers:H})}function D($){let J=$.toString(),H=new Bun.CryptoHasher("sha1");return H.update(J),H.digest("hex")}if(!globalThis.URLPattern)globalThis.URLPattern=T;import{exists as e}from"fs/promises";var JJ=process.env.GEMI_PROJECT_DIR??"",C=M(process.cwd(),JJ),$J=M(C,"app"),A=M(C,"dist");async function OJ($,J){let H=await import(`${A}/client/.vite/manifest.json`),z=await import(`${A}/server/.vite/manifest.json`);process.env.ROOT_DIR=C,process.env.APP_DIR=$J,process.env.DIST_DIR=A;let G={},x={},j={},Q=(K,Z)=>`"${K}": () => import("${Z}")`,k=[];for(let K of["404",...$.getFlatComponentTree.call($)]){let Z=z[`app/views/${K}.tsx`];if(!Z?.file){console.log(`Server file not found for ${K}`),console.log(Z);let W=Object.keys(z),L=`app/views/${K}.tsx`;console.log(`${L} not found in server manifest`),console.log(W)}let X=await import(`${process.env.DIST_DIR}/server/${Z?.file}`);G[K]=X.default,x[K]=X.OpenGraph;let U=H[`app/views/${K}.tsx`];if(U?.css&&U?.css.length>0)j[K]=U?.css;if(U)k.push(Q(K,`/${U?.file}`))}let F=`{${k.join(",")}}`,w=H["app/client.tsx"]?.css??[],g=(await Promise.all(w.map((K)=>Bun.file(`${A}/client/${K}`).text()))).join(`
|
|
3
|
+
`),f=new T({pathname:"/*.:filetype(png|txt|js|css|jpg|svg|jpeg|avif|webp|ico|ttf|map)"});async function v(K){let{pathname:Z}=new URL(K.url),X=Z.startsWith("/.well-known"),U=f.test({pathname:Z})||X,W=Z.startsWith("/api");if(U&&!W){let L=new URL(K.url),B=K.url.replace(L.origin,"").split("?")[0],O=`${A}/client${B.replace("/assets/assets","/assets")}`,b=await e(O);if(!b&&L.pathname.includes(".js"))return new Response(`if(caches){caches?.delete("${O}")}window.location.reload();export {}`,{headers:{"Content-Type":"application/javascript"}});if(!b){if(Z===_||Z.startsWith(`${_}/`))return new Response("Not found",{status:404});return await N(K,Z)}try{let Y=Bun.file(O),y=D(Y.lastModified);return new Response(Y.stream(),{headers:{"Content-Type":Y.type,"Cache-Control":"public, max-age=31536000, must-revalidate","Content-Length":String(Y.size),ETag:y}})}catch(Y){return $.onException?.(Y),new Response("Not found",{status:404})}}return await N(K,Z)}async function N(K,Z){let X=$.fetch.bind($);try{let U=await X(K);if(U instanceof Response)return U;else{let W=[];return W.push({content:g}),await U({getStyles:async(B)=>{if(!B)return I([]);for(let O of B){let b=H[`app/views/${O}.tsx`];for(let Y of b?.css??[]){let y=Bun.file(`${process.env.DIST_DIR}/client/${Y}`);W.push({id:Y,content:await y.text()})}}return I(W)},bootstrapModules:[`/${H["app/client.tsx"].file}`],loaders:F,viewImportMap:G,ogMap:x,cssManifest:j})}}catch(U){if(console.error(U),Z.startsWith("/api"))return new Response(JSON.stringify({error:U.message}),{status:500,headers:{"Content-Type":"application/json"}});return $.onException?.(U),new Response(U.stack,{status:500})}}let u=(process.env.GEMI_COMPRESSION??"auto").toLowerCase()!=="off",S=Bun.serve({maxRequestBodySize:10737418240,fetch:async(K,Z)=>{if(!K.headers.get("x-forwarded-for")){let U=Z.requestIP(K);if(U)K.headers.set("x-forwarded-for",U.address)}let X=await J(K,v);return u?V(K,X):X},idleTimeout:Number(process.env.SERVER_IDLE_TIMEOUT??10),port:process.env.PORT||5173});return R({port:S.port,rootDir:C}),S}export{OJ as httpProd};
|
|
4
|
+
|
|
5
|
+
//# debugId=45C6664548EA439D64756E2164756E21
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../server/httpProd.ts", "../server/compression.ts", "../server/generateEtag.ts", "../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { join } from \"node:path\";\nimport { compressResponse } from \"./compression\";\nimport { generateETag } from \"./generateEtag\";\nimport { URLPattern } from \"urlpattern-polyfill\";\nimport { exists } from \"node:fs/promises\";\nimport { createStyles } from \"./styles\";\nimport type { App } from \"../app\";\nimport { Instrumentation } from \"./types\";\nimport { printStartupBanner } from \"./banner\";\nimport { RESERVED_ROUTE_PREFIX } from \"../services/router/ViewRouterServiceContainer\";\n\nconst projectDir = process.env.GEMI_PROJECT_DIR ?? \"\";\nconst rootDir = join(process.cwd(), projectDir);\n\nconst appDir = join(rootDir, \"app\");\nconst distDir = join(rootDir, \"dist\");\n\n// `app` is built by `Server.start` (from the kernel) and passed in — same as\n// `httpDev` — so prod and dev share one construction path. What differs here is\n// that views/styles are served from the built `dist/` manifests instead of\n// Vite's dev SSR graph.\nexport async function httpProd(app: App, instrumentation: Instrumentation) {\n const manifest = await import(`${distDir}/client/.vite/manifest.json`);\n const serverManifest = await import(`${distDir}/server/.vite/manifest.json`);\n\n process.env.ROOT_DIR = rootDir;\n process.env.APP_DIR = appDir;\n process.env.DIST_DIR = distDir;\n\n const viewImportMap = {};\n const ogMap = {};\n const cssManifest = {};\n const template = (viewName: string, path: string) => `\"${viewName}\": () => import(\"${path}\")`;\n const templates = [];\n\n for (const fileName of [\"404\", ...app.getFlatComponentTree.call(app)]) {\n const serverFile = serverManifest[`app/views/${fileName}.tsx`];\n if (!serverFile?.file) {\n console.log(`Server file not found for ${fileName}`);\n console.log(serverFile);\n const files = Object.keys(serverManifest);\n const path = `app/views/${fileName}.tsx`;\n console.log(`${path} not found in server manifest`);\n console.log(files);\n }\n const mod = await import(`${process.env.DIST_DIR}/server/${serverFile?.file}`);\n viewImportMap[fileName] = mod.default;\n ogMap[fileName] = mod.OpenGraph;\n const clientFile = manifest[`app/views/${fileName}.tsx`];\n\n if (clientFile?.css && clientFile?.css.length > 0) {\n cssManifest[fileName] = clientFile?.css;\n }\n if (clientFile) {\n templates.push(template(fileName, `/${clientFile?.file}`));\n }\n }\n\n const loaders = `{${templates.join(\",\")}}`;\n\n // Vite's manifest `css` field is a `string[]` — a client entry can emit more\n // than one CSS chunk. Read and concatenate them all instead of interpolating\n // the array into a single path (which only works for a one-element array).\n const appCssFiles: string[] = manifest[\"app/client.tsx\"]?.css ?? [];\n const appCSSContent = (\n await Promise.all(appCssFiles.map((cssFile) => Bun.file(`${distDir}/client/${cssFile}`).text()))\n ).join(\"\\n\");\n\n const staticFilePattern = new URLPattern({\n pathname: \"/*.:filetype(png|txt|js|css|jpg|svg|jpeg|avif|webp|ico|ttf|map)\",\n });\n\n async function requestHandler(req: Request) {\n const { pathname } = new URL(req.url);\n\n const isWellKnownFile = pathname.startsWith(\"/.well-known\");\n const isFileRequest = staticFilePattern.test({ pathname }) || isWellKnownFile;\n\n const isApi = pathname.startsWith(\"/api\");\n\n if (isFileRequest && !isApi) {\n const url = new URL(req.url);\n const filePath = req.url.replace(url.origin, \"\").split(\"?\")[0];\n const distPath = `${distDir}/client${filePath.replace(\"/assets/assets\", \"/assets\")}`;\n const doesExist = await exists(distPath);\n\n if (!doesExist && url.pathname.includes(\".js\")) {\n return new Response(\n `if(caches){caches?.delete(\"${distPath}\")}window.location.reload();export {}`,\n {\n headers: { \"Content-Type\": \"application/javascript\" },\n },\n );\n }\n\n if (!doesExist) {\n // `/assets` is reserved for build output (the router rejects routes\n // there at boot), so a miss is a miss — 404 without paying for an SSR\n // render.\n if (\n pathname === RESERVED_ROUTE_PREFIX ||\n pathname.startsWith(`${RESERVED_ROUTE_PREFIX}/`)\n ) {\n return new Response(\"Not found\", { status: 404 });\n }\n\n // Anywhere else the pattern above matched on extension alone, so this\n // may well be an app route — a file route like\n // `this.file(() => Bun.file(...))` mounted at `/files/logo.svg` lands\n // here too. Hand it to the app rather than 404ing on its behalf.\n return await handleWithApp(req, pathname);\n }\n\n // `Bun.file(path).stream()` is lazy — a missing file only throws ENOENT\n // once the body is streamed, which is *after* this handler has returned,\n // so the `try/catch` below can't catch it (it surfaces as an unhandled\n // rejection with the response already committed as 200). Never build the\n // streaming Response without checking existence first.\n\n try {\n const file = Bun.file(distPath);\n\n const etag = generateETag(file.lastModified);\n return new Response(file.stream(), {\n headers: {\n \"Content-Type\": file.type,\n \"Cache-Control\": \"public, max-age=31536000, must-revalidate\",\n \"Content-Length\": String(file.size),\n ETag: etag,\n },\n });\n } catch (error) {\n app.onException?.(error);\n return new Response(\"Not found\", { status: 404 });\n }\n }\n\n return await handleWithApp(req, pathname);\n }\n\n async function handleWithApp(req: Request, pathname: string) {\n const handler = app.fetch.bind(app);\n\n try {\n const result = await handler(req);\n if (result instanceof Response) {\n return result;\n } else {\n const styles = [];\n\n styles.push({\n content: appCSSContent,\n });\n\n const getStyles = async (currentViews: string[]) => {\n if (!currentViews) {\n return createStyles([]);\n }\n for (const view of currentViews) {\n const clientFile = manifest[`app/views/${view}.tsx`];\n for (const cssFile of clientFile?.css ?? []) {\n const css = Bun.file(`${process.env.DIST_DIR}/client/${cssFile}`);\n styles.push({\n id: cssFile,\n content: await css.text(),\n });\n }\n }\n return createStyles(styles);\n };\n\n return await result({\n getStyles,\n bootstrapModules: [`/${manifest[\"app/client.tsx\"].file}`],\n loaders,\n viewImportMap,\n ogMap,\n cssManifest,\n });\n }\n } catch (err) {\n console.error(err);\n if (pathname.startsWith(\"/api\")) {\n return new Response(JSON.stringify({ error: err.message }), {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n });\n }\n app.onException?.(err);\n return new Response(err.stack, { status: 500 });\n }\n }\n\n // Compression is on unless the deployment opts out — set `GEMI_COMPRESSION=off`\n // when a layer in front of the origin already compresses HTML and you would\n // rather not spend origin CPU on it.\n const compressionEnabled = (process.env.GEMI_COMPRESSION ?? \"auto\").toLowerCase() !== \"off\";\n\n const server = Bun.serve({\n maxRequestBodySize: 10 * 1024 * 1024 * 1024, // 10 GB\n fetch: async (req, server) => {\n if (!req.headers.get(\"x-forwarded-for\")) {\n // `requestIP` is null for closed/unix sockets — guard so it never\n // throws before the request is handled.\n const ip = server.requestIP(req);\n if (ip) req.headers.set(\"x-forwarded-for\", ip.address);\n }\n const res = await instrumentation(req, requestHandler);\n // Applied at the very edge, after instrumentation, so every HTML response\n // goes through the same negotiation — including the ones an app's\n // instrumentation produced itself. Anything that isn't HTML comes back\n // untouched.\n return compressionEnabled ? compressResponse(req, res) : res;\n },\n idleTimeout: Number(process.env.SERVER_IDLE_TIMEOUT ?? 10),\n port: process.env.PORT || 5173,\n });\n\n printStartupBanner({ port: server.port, rootDir });\n\n return server;\n}\n",
|
|
6
|
+
"/**\n * Transport-level compression for SSR HTML responses.\n *\n * This lives in the runtime rather than in an app, because every gemi app\n * serves the same shape of response: a streamed `text/html` document whose\n * bulk is critical CSS, markup and the `window.__GEMI_DATA__` hydration\n * payload. Compressing it here means the win is portable across deployments —\n * it does not depend on a CDN being configured to compress on the origin's\n * behalf — and it also cuts origin→edge bandwidth, which edge compression\n * cannot.\n *\n * Compression stays strictly at the transport layer: what the client decodes\n * is byte-for-byte the HTML React rendered, so hydration is unaffected.\n *\n * Deliberately dependency-free apart from `node:zlib`/`node:stream` so it can\n * be unit tested without booting a server.\n */\n\nimport { Duplex } from \"node:stream\";\nimport { constants, createBrotliCompress, createGzip } from \"node:zlib\";\n\n/** The content codings we can produce, in the order we prefer them. */\nexport type ContentEncoding = \"br\" | \"gzip\";\n\n/**\n * Server preference, used to break q-value ties. Brotli comes first: at the\n * quality we use it is both smaller *and* no more expensive than gzip on a\n * representative SSR document (~177 kB → 28.0 kB in ~2.0 ms, versus 31.6 kB in\n * ~2.0 ms for gzip).\n */\nconst SERVER_PREFERENCE: ContentEncoding[] = [\"br\", \"gzip\"];\n\n/**\n * Below this, an encoded body plus its framing overhead is not worth the CPU.\n * Only applied when the response declares a `Content-Length` — a streamed SSR\n * response does not, and buffering one just to measure it would defeat the\n * streaming render.\n */\nconst MIN_COMPRESSIBLE_BYTES = 1024;\n\n/**\n * Brotli quality 5 (of 11). The default, 11, is meant for static assets\n * compressed once at build time — on a streamed document it costs ~175 ms,\n * two orders of magnitude more than quality 5 for ~12% more savings. Quality 5\n * is the usual choice for dynamic content.\n *\n * `LGWIN` 19 caps the window at 512 kB rather than the default 16 MB. An SSR\n * document is far smaller than that, so the ratio is unchanged, and the bound\n * matters under concurrency: the window is allocated per in-flight response.\n */\nconst BROTLI_QUALITY = 5;\nconst BROTLI_WINDOW_BITS = 19;\n\n/** zlib's default level. Level 9 costs measurably more for ~1% on HTML. */\nconst GZIP_LEVEL = 6;\n\nfunction parseQValue(raw: string | undefined): number {\n if (raw === undefined) {\n return 1;\n }\n // `q` is a fixed-point number with at most three decimals (RFC 9110 §12.4.2).\n // Anything else is malformed; treat it as an unqualified \"acceptable\" rather\n // than dropping the encoding, matching what tolerant servers do.\n if (!/^\\d+(\\.\\d{0,3})?$/.test(raw.trim())) {\n return 1;\n }\n const value = Number(raw.trim());\n return Number.isFinite(value) ? Math.min(value, 1) : 1;\n}\n\n/**\n * Parses a request `Accept-Encoding` into `coding -> qvalue`.\n *\n * Returns `null` when the header is *absent*, which is distinct from an empty\n * one. RFC 9110 §12.5.3 says an absent header means any coding is acceptable,\n * but a client that cannot decode and forgets to say so is a broken page, not\n * a slow one — so we treat \"absent\" as \"identity\" and only encode when a\n * client has explicitly opted in. An empty header (`Accept-Encoding:`) is a\n * deliberate \"identity only\" and parses to an empty map.\n */\nexport function parseAcceptEncoding(header: string | null | undefined): Map<string, number> | null {\n if (header === null || header === undefined) {\n return null;\n }\n\n const accepted = new Map<string, number>();\n for (const part of header.split(\",\")) {\n const [rawCoding, ...params] = part.split(\";\");\n const coding = rawCoding.trim().toLowerCase();\n if (coding === \"\") {\n continue;\n }\n\n let q = 1;\n for (const param of params) {\n const separator = param.indexOf(\"=\");\n if (separator === -1) {\n continue;\n }\n if (param.slice(0, separator).trim().toLowerCase() === \"q\") {\n q = parseQValue(param.slice(separator + 1));\n break;\n }\n }\n\n accepted.set(coding, q);\n }\n\n return accepted;\n}\n\n/**\n * Picks the coding to use, or `null` for identity.\n *\n * A `q=0` is a refusal, `*` covers codings the client did not name, and ties\n * fall back to `available`'s order — so a plain `Accept-Encoding: gzip, br`\n * (equal q of 1) resolves to our preference rather than the client's.\n */\nexport function negotiateEncoding(\n header: string | null | undefined,\n available: ContentEncoding[] = SERVER_PREFERENCE,\n): ContentEncoding | null {\n const accepted = parseAcceptEncoding(header);\n if (!accepted) {\n return null;\n }\n\n const wildcard = accepted.get(\"*\");\n let best: ContentEncoding | null = null;\n let bestQ = 0;\n\n for (const coding of available) {\n const q = accepted.get(coding) ?? wildcard ?? 0;\n if (q > bestQ) {\n best = coding;\n bestQ = q;\n }\n }\n\n return best;\n}\n\nfunction hasDirective(headerValue: string | null, directive: string): boolean {\n if (!headerValue) {\n return false;\n }\n // Token match, not substring: `no-transform` must not be found inside\n // something like `x-no-transform`.\n return headerValue\n .split(\",\")\n .some((token) => token.trim().toLowerCase().split(\"=\")[0].trim() === directive);\n}\n\n/**\n * Whether this response's representation is one we may encode — and therefore\n * one that varies by `Accept-Encoding`, even on the requests where we end up\n * sending identity.\n *\n * HTML only, on purpose. JSON view-data and API responses are left alone so\n * that this change cannot alter how they are produced, framed or cached;\n * widening the set is a separate decision.\n */\nexport function isCompressible(method: string, res: Response): boolean {\n // A HEAD response carries no body to encode, and emitting `Content-Encoding`\n // without one would describe a body the client never receives.\n if (method === \"HEAD\") {\n return false;\n }\n\n if (!res.body) {\n return false;\n }\n\n // 204/304 are bodyless; 206 is a byte range of an already-committed\n // representation and re-encoding it would invalidate its `Content-Range`.\n if (res.status < 200 || res.status === 204 || res.status === 206 || res.status === 304) {\n return false;\n }\n\n if (res.headers.has(\"Content-Range\")) {\n return false;\n }\n\n const contentType = res.headers.get(\"Content-Type\");\n if (!contentType || !/^\\s*text\\/html\\s*(;|$)/i.test(contentType)) {\n return false;\n }\n\n // Already encoded upstream — `identity` is the one value that means \"not\n // encoded\" and is safe to replace.\n const contentEncoding = res.headers.get(\"Content-Encoding\");\n if (contentEncoding && contentEncoding.trim().toLowerCase() !== \"identity\") {\n return false;\n }\n\n // RFC 9110 §5.2.2.6: `no-transform` forbids intermediaries *and* us from\n // changing the representation's encoding.\n if (hasDirective(res.headers.get(\"Cache-Control\"), \"no-transform\")) {\n return false;\n }\n\n const contentLength = res.headers.get(\"Content-Length\");\n if (contentLength !== null && Number(contentLength) < MIN_COMPRESSIBLE_BYTES) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Builds the encoder as a web `TransformStream`-shaped pair.\n *\n * Both codings are driven through `node:zlib` with an explicit per-write flush.\n * Without it the compressor holds output until its internal buffer fills,\n * which would sit on React's shell flush and turn a streamed render into a\n * buffered one — the compression win would be paid for in time to first byte.\n */\nexport function createEncoderStream(encoding: ContentEncoding) {\n const compressor =\n encoding === \"br\"\n ? createBrotliCompress({\n params: {\n [constants.BROTLI_PARAM_QUALITY]: BROTLI_QUALITY,\n [constants.BROTLI_PARAM_LGWIN]: BROTLI_WINDOW_BITS,\n },\n flush: constants.BROTLI_OPERATION_FLUSH,\n })\n : createGzip({ level: GZIP_LEVEL, flush: constants.Z_SYNC_FLUSH });\n\n return Duplex.toWeb(compressor) as unknown as ReadableWritablePair<Uint8Array, Uint8Array>;\n}\n\nfunction withVaryAcceptEncoding(headers: Headers) {\n const vary = headers.get(\"Vary\");\n if (!vary) {\n headers.set(\"Vary\", \"Accept-Encoding\");\n return;\n }\n const tokens = vary.split(\",\").map((token) => token.trim().toLowerCase());\n // `Vary: *` already means \"never reuse for another request\"; narrowing it\n // would be a downgrade.\n if (tokens.includes(\"*\") || tokens.includes(\"accept-encoding\")) {\n return;\n }\n headers.append(\"Vary\", \"Accept-Encoding\");\n}\n\n/**\n * Compresses an SSR HTML response when the client asked for it.\n *\n * Non-HTML responses are returned untouched — same object, same body, so this\n * is safe to apply at the edge of the server for every request.\n *\n * HTML responses always gain `Vary: Accept-Encoding`, whether or not this\n * particular request got an encoded body: without it a shared cache could\n * serve a stored encoded variant to a client that cannot decode it.\n */\nexport function compressResponse(req: Request, res: Response): Response {\n if (!isCompressible(req.method, res)) {\n return res;\n }\n\n const headers = new Headers(res.headers);\n withVaryAcceptEncoding(headers);\n\n const encoding = negotiateEncoding(req.headers.get(\"Accept-Encoding\"));\n if (!encoding) {\n return new Response(res.body, {\n status: res.status,\n statusText: res.statusText,\n headers,\n });\n }\n\n let encoder: ReadableWritablePair<Uint8Array, Uint8Array>;\n try {\n encoder = createEncoderStream(encoding);\n } catch {\n // A compressor we cannot construct is not worth failing a page render\n // over. Serve identity — with the `Vary` we already added.\n return new Response(res.body, {\n status: res.status,\n statusText: res.statusText,\n headers,\n });\n }\n\n headers.set(\"Content-Encoding\", encoding);\n // The length of the identity representation says nothing about the encoded\n // body, and a stale one would truncate the response.\n headers.delete(\"Content-Length\");\n\n return new Response(res.body!.pipeThrough(encoder), {\n status: res.status,\n statusText: res.statusText,\n headers,\n });\n}\n",
|
|
7
|
+
"export function generateETag(lastModified: number): string {\n // Assuming the last modified timestamp is in milliseconds\n const lastModifiedStr = lastModified.toString();\n\n const hasher = new Bun.CryptoHasher(\"sha1\");\n hasher.update(lastModifiedStr);\n const hash = hasher.digest(\"hex\");\n\n return hash;\n}\n",
|
|
8
|
+
"import { URLPattern } from \"./dist/urlpattern.js\";\n\nexport { URLPattern };\n\nif (!globalThis.URLPattern) {\n globalThis.URLPattern = URLPattern;\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"mappings": ";gTAAA,SAAS,OCkBT,WAAS,SACT,cAAS,oBAAW,UAAsB,aAW1C,IAAM,EAAuC,CAAC,KAAM,MAAM,EAQpD,EAAyB,KAYzB,EAAiB,EACjB,EAAqB,GAGrB,EAAa,EAEnB,SAAS,CAAW,CAAC,EAAiC,CACpD,GAAI,IAAQ,OACV,MAAO,GAKT,GAAI,CAAC,oBAAoB,KAAK,EAAI,KAAK,CAAC,EACtC,MAAO,GAET,IAAM,EAAQ,OAAO,EAAI,KAAK,CAAC,EAC/B,OAAO,OAAO,SAAS,CAAK,EAAI,KAAK,IAAI,EAAO,CAAC,EAAI,EAahD,SAAS,CAAmB,CAAC,EAA+D,CACjG,GAAI,IAAW,MAAQ,IAAW,OAChC,OAAO,KAGT,IAAM,EAAW,IAAI,IACrB,QAAW,KAAQ,EAAO,MAAM,GAAG,EAAG,CACpC,IAAO,KAAc,GAAU,EAAK,MAAM,GAAG,EACvC,EAAS,EAAU,KAAK,EAAE,YAAY,EAC5C,GAAI,IAAW,GACb,SAGF,IAAI,EAAI,EACR,QAAW,KAAS,EAAQ,CAC1B,IAAM,EAAY,EAAM,QAAQ,GAAG,EACnC,GAAI,IAAc,GAChB,SAEF,GAAI,EAAM,MAAM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ACvB,mBAAoB,YACpB,MAAO,MAAO,EAAK,IAAW,CAC5B,GAAI,CAAC,EAAI,QAAQ,IAAI,iBAAiB,EAAG,CAGvC,IAAM,EAAK,EAAO,UAAU,CAAG,EAC/B,GAAI,EAAI,EAAI,QAAQ,IAAI,kBAAmB,EAAG,OAAO,EAEvD,IAAM,EAAM,MAAM,EAAgB,EAAK,CAAc,EAKrD,OAAO,EAAqB,EAAiB,EAAK,CAAG,EAAI,GAE3D,YAAa,OAAO,QAAQ,IAAI,qBAAuB,EAAE,EACzD,KAAM,QAAQ,IAAI,MAAQ,IAC5B,CAAC,EAID,OAFA,EAAmB,CAAE,KAAM,EAAO,KAAM,SAAQ,CAAC,EAE1C",
|
|
11
|
+
"debugId": "45C6664548EA439D64756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{g as I,i as f}from"./chunk-
|
|
2
|
+
import{g as I,i as f}from"./chunk-bk76mah1.js";import{j as b,k as y}from"./chunk-ghes36xj.js";import"./chunk-vv72kw74.js";import"./chunk-ppt296ye.js";import"./chunk-r64ba1pf.js";import"./chunk-d9k245jt.js";import"./chunk-evkv0xa7.js";import"./chunk-p5r0t9jh.js";import"./chunk-xkrthw08.js";import"./chunk-4z53shav.js";import"./chunk-m0earq80.js";import"./chunk-f18weffa.js";import{IncomingMessage as w,ServerResponse as N}from"http";import{Socket as T}from"net";import{join as g}from"path";import{createServer as E}from"vite";function S(H){return H.replace(/\x1b\[[0-9;]*m/g,"").replace(/\[[0-9;]*m/g,"").replace(/\n\s*\n/g,`
|
|
3
3
|
`).split(`
|
|
4
4
|
`).map((J)=>J.trim()).filter((J)=>J.length>0).join(`
|
|
5
5
|
`).trim()}function P(H){return`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m as y}from"./chunk-ppt296ye.js";import{createElement as j}from"react";function z(i,n){let t=Object.keys(n).sort((e,s)=>s.length-e.length).map((e)=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),p=new RegExp(t.join("|"),"g");return i.replace(p,(e)=>n[e])}async function W(i,n,t=[]){let p=[...t.map((b)=>`${i}/views/${b}.tsx`),`${i}/views/RootLayout.tsx`],e=new Set;for(let b of p){let u=n.moduleGraph.getModulesByFile(b);if(u)for(let g of u)e.add(g)}let s=[],r=[],c={};for(let b of e)if(b)for(let u of b.importedModules){if(u.file.includes("module.css"))c[u.file]=u.ssrTransformResult.map.sourcesContent.join("");if(u.file.includes(".css"))r.push(u.file)}for(let b of r){let u=await n.transformRequest(b+"?direct"),g=b.includes("module.css"),h="";if(g)h=z(c[b],u.default);s.push({isDev:!0,id:b,content:g?h:u.code})}return s.map((b,u)=>{return j("style",{key:u,type:"text/css","data-vite-dev-id":b.id,dangerouslySetInnerHTML:{__html:b.content}})})}async function X(i=[]){return i.map((n,t)=>{return j("style",{key:t,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as T}from"fs";import{basename as a}from"path";import{networkInterfaces as q}from"os";var v={name:"gemi",version:"0.
|
|
2
|
+
import{m as y}from"./chunk-ppt296ye.js";import{createElement as j}from"react";function z(i,n){let t=Object.keys(n).sort((e,s)=>s.length-e.length).map((e)=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),p=new RegExp(t.join("|"),"g");return i.replace(p,(e)=>n[e])}async function W(i,n,t=[]){let p=[...t.map((b)=>`${i}/views/${b}.tsx`),`${i}/views/RootLayout.tsx`],e=new Set;for(let b of p){let u=n.moduleGraph.getModulesByFile(b);if(u)for(let g of u)e.add(g)}let s=[],r=[],c={};for(let b of e)if(b)for(let u of b.importedModules){if(u.file.includes("module.css"))c[u.file]=u.ssrTransformResult.map.sourcesContent.join("");if(u.file.includes(".css"))r.push(u.file)}for(let b of r){let u=await n.transformRequest(b+"?direct"),g=b.includes("module.css"),h="";if(g)h=z(c[b],u.default);s.push({isDev:!0,id:b,content:g?h:u.code})}return s.map((b,u)=>{return j("style",{key:u,type:"text/css","data-vite-dev-id":b.id,dangerouslySetInnerHTML:{__html:b.content}})})}async function X(i=[]){return i.map((n,t)=>{return j("style",{key:t,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as T}from"fs";import{basename as a}from"path";import{networkInterfaces as q}from"os";var v={name:"gemi",version:"0.47.0",private:!1,license:"MIT",author:"Enes Tufekci <enes@gemijs.dev>",repository:{type:"git",url:"git+https://github.com/nstfkc/gemi.git",directory:"packages/gemi"},bin:{gemi:"./dist/bin/gemi.js"},files:["dist/**/*"],module:!0,exports:{"./http":"./http/index.ts","./client":"./client/index.ts","./app":"./app/index.ts","./facades":"./facades/index.ts","./email":"./email/index.ts","./vite":"./dist/vite/index.mjs","./runtime":"./client/runtime.ts","./kernel":"./kernel/index.ts","./services":"./services/index.ts","./broadcasting":"./broadcasting/index.ts","./i18n":"./i18n/index.ts","./server":"./server/index.ts","./config":"./config/index.ts","./bun/preload":"./bun/preload.ts","./bun/plugin":"./bun/plugin.ts"},scripts:{lint:"oxlint",build:"NODE_ENV=production bun run build:core && bun run build:bin && bun run build:types && bun run build:client && bun run build:plugin && bun run build:client-types","build:core":"bun ./scripts/build.ts","build:bin":"bun build --outdir=./dist/bin --target=bun --external=vite --external=react-dom --external=react/jsx-runtime --external=bun --external=sharp --external=@azure/storage-blob --sourcemap ./bin/gemi.ts && bun ./scripts/prepare-bin.ts","build:client":"vite build -c vite.client.config.mts","build:plugin":"vite build -c vite.plugin.config.mts","build:types":"tsc","build:client-types":"tsc -p tsconfig.browser.json",test:"vitest","test:types":"vitest run --typecheck.only","build:publish":"bun scripts/build-publish.ts",prepublishOnly:"echo 'Do not publish from this directory \u2014 its exports point at TS source. Run: bun run build:publish, then publish from .publish/' && exit 1"},dependencies:{"@aws-sdk/client-s3":"^3.629.0","@aws-sdk/s3-request-presigner":"^3.629.0","@prisma/client":"^6.4.1","ast-types":"^0.14.2",commander:"^12.1.0",history:"^5.3.0","jsx-email":"2.0.0-rc2.1",open:"^10.1.0","react-error-boundary":"^6.0.0",recast:"^0.23.9",resend:"^6.12.3",satori:"^0.12.2","temporal-polyfill":"^0.2.5","twitter-api-v2":"^1.20.2","urlpattern-polyfill":"^10.0.0",uuid:"^9.0.1"},devDependencies:{"@babel/parser":"^7.25.4","@repo/typescript-config":"*","@types/bun":"^1.3.14","@types/eslint":"^8.56.5","@types/node":"^20.11.24","@types/react":"^19.0.2","@types/react-dom":"^19.0.2",eslint:"^8.57.0",oxlint:"^1.39.0",react:"19.2.3","react-dom":"19.2.3",typescript:"^5.7.3",vitest:"^4.0.0"},peerDependencies:{"@azure/storage-blob":"^12.28.0",react:">=19","react-dom":">=19",sharp:"^0.34.2",vite:"^8.0.0"},peerDependenciesMeta:{"@azure/storage-blob":{optional:!0}}};var _=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557","\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551","\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D"],k=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,l=(i,n)=>k?`\x1B[${i}m${n}\x1B[0m`:n,G=(i)=>l("1",i),d=(i)=>l("2",i),x=(i)=>l("36",i),H=(i)=>l("32",i),J=(i)=>l("35",i);function L(){return v.version??"?"}function N(i){for(let n of Object.values(q()))for(let t of n??[])if((t.family==="IPv4"||t.family===4)&&!t.internal)return`http://${t.address}:${i}`;return null}function Q(i){return y(i).filter((n)=>T(n)).map((n)=>a(n))}function I(i){let{port:n,rootDir:t}=i,p=`http://localhost:${n}`,e=N(n),s=Q(t),r=(b,u)=>` ${H("\u279C")} ${G(b.padEnd(9))}${u}`,c=["",..._.map((b)=>J(b)),"",` ${d("gemi")} ${x(`v${L()}`)}`,"",r("Local:",x(p)),r("Network:",e?x(e):d("unavailable")),r("Env:",s.length?s.join(", "):d("none")),""];console.log(c.join(`
|
|
3
3
|
`))}
|
|
4
4
|
export{W as g,X as h,I as i};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=B5F81512E2755AB864756E2164756E21
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"import { existsSync } from \"node:fs\";\nimport { basename } from \"node:path\";\nimport { networkInterfaces } from \"node:os\";\nimport { envFiles } from \"./watchEnv\";\nimport pkg from \"../package.json\";\n\n// \"GEMI\" — ANSI Shadow figlet font.\nconst ART = [\n \" ██████╗ ███████╗███╗ ███╗██╗\",\n \"██╔════╝ ██╔════╝████╗ ████║██║\",\n \"██║ ███╗█████╗ ██╔████╔██║██║\",\n \"██║ ██║██╔══╝ ██║╚██╔╝██║██║\",\n \"╚██████╔╝███████╗██║ ╚═╝ ██║██║\",\n \" ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝\",\n];\n\nconst useColor = Boolean(process.stdout.isTTY) && !process.env.NO_COLOR;\nconst paint = (code: string, text: string) =>\n useColor ? `\\x1b[${code}m${text}\\x1b[0m` : text;\nconst bold = (t: string) => paint(\"1\", t);\nconst dim = (t: string) => paint(\"2\", t);\nconst cyan = (t: string) => paint(\"36\", t);\nconst green = (t: string) => paint(\"32\", t);\nconst magenta = (t: string) => paint(\"35\", t);\n\nfunction gemiVersion(): string {\n return (pkg as { version?: string }).version ?? \"?\";\n}\n\nfunction networkUrl(port: number | string): string | null {\n for (const ifaces of Object.values(networkInterfaces())) {\n for (const iface of ifaces ?? []) {\n // Node <18 reported `family` as the number 4; newer Bun/Node use \"IPv4\".\n const isV4 = iface.family === \"IPv4\" || (iface.family as unknown) === 4;\n if (isV4 && !iface.internal) return `http://${iface.address}:${port}`;\n }\n }\n return null;\n}\n\nfunction loadedEnvFiles(rootDir: string): string[] {\n return envFiles(rootDir)\n .filter((file) => existsSync(file))\n .map((file) => basename(file));\n}\n\nexport function printStartupBanner(params: {\n port: number | string;\n rootDir: string;\n}) {\n const { port, rootDir } = params;\n const local = `http://localhost:${port}`;\n const network = networkUrl(port);\n const env = loadedEnvFiles(rootDir);\n\n const row = (label: string, value: string) =>\n ` ${green(\"➜\")} ${bold(label.padEnd(9))}${value}`;\n\n const out = [\n \"\",\n ...ART.map((line) => magenta(line)),\n \"\",\n ` ${dim(\"gemi\")} ${cyan(`v${gemiVersion()}`)}`,\n \"\",\n row(\"Local:\", cyan(local)),\n row(\"Network:\", network ? cyan(network) : dim(\"unavailable\")),\n row(\"Env:\", env.length ? env.join(\", \") : dim(\"none\")),\n \"\",\n ];\n\n console.log(out.join(\"\\n\"));\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";wCAAA,wBAAS,cAGT,SAAS,CAAc,CAAC,EAAc,EAAwC,CAC5E,IAAM,EAAc,OAAO,KAAK,CAAM,EACnC,KAAK,CAAC,EAAG,IAAM,EAAE,OAAS,EAAE,MAAM,EAClC,IAAI,CAAC,IAAQ,EAAI,QAAQ,sBAAuB,MAAM,CAAC,EAGp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CAAC,EAClC,GACA,KAAK,EAAI,MAAM,KAAK,EAAK,IAAI,EAAY,GAAG,IAC5C,GACA,EAAI,SAAU,EAAK,CAAK,CAAC,EACzB,EAAI,WAAY,EAAU,EAAK,CAAO,EAAI,EAAI,aAAa,CAAC,EAC5D,EAAI,OAAQ,EAAI,OAAS,EAAI,KAAK,IAAI,EAAI,EAAI,MAAM,CAAC,EACrD,EACF,EAEA,QAAQ,IAAI,EAAI,KAAK;AAAA,CAAI,CAAC",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "B5F81512E2755AB864756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/client/index.js
CHANGED
|
@@ -321,12 +321,7 @@ function useQuery(url, ...args) {
|
|
|
321
321
|
error: null,
|
|
322
322
|
version: 0
|
|
323
323
|
};
|
|
324
|
-
return resource.peek(variantKey)
|
|
325
|
-
loading: true,
|
|
326
|
-
data: null,
|
|
327
|
-
error: null,
|
|
328
|
-
version: 0
|
|
329
|
-
};
|
|
324
|
+
return resource.peek(variantKey);
|
|
330
325
|
});
|
|
331
326
|
const retry = useCallback((vk) => {
|
|
332
327
|
if (!retryingMap.current.get(vk)) {
|