gemi 0.41.2 → 0.41.3

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.
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{h as W,i as g}from"./chunk-w96mexnd.js";import"./chunk-ppt296ye.js";import{M as Y}from"./chunk-c9wa4rtm.js";import"./chunk-agvzqxv7.js";import{join as x}from"path";function V(T){let _=T.toString(),k=new Bun.CryptoHasher("sha1");return k.update(_),k.digest("hex")}if(!globalThis.URLPattern)globalThis.URLPattern=Y;import{exists as F}from"fs/promises";var u=process.env.GEMI_PROJECT_DIR??"",Z=x(process.cwd(),u),h=x(Z,"app"),Q=x(Z,"dist");async function a(T,_){let k=await import(`${Q}/client/.vite/manifest.json`),$=await import(`${Q}/server/.vite/manifest.json`);process.env.ROOT_DIR=Z,process.env.APP_DIR=h,process.env.DIST_DIR=Q;let A={},I={},P={},S=(L,U)=>`"${L}": () => import("${U}")`,C=[];for(let L of["404",...T.getFlatComponentTree.call(T)]){let U=$[`app/views/${L}.tsx`];if(!U?.file){console.log(`Server file not found for ${L}`),console.log(U);let B=Object.keys($),H=`app/views/${L}.tsx`;console.log(`${H} not found in server manifest`),console.log(B)}let z=await import(`${process.env.DIST_DIR}/server/${U?.file}`);A[L]=z.default,I[L]=z.OpenGraph;let G=k[`app/views/${L}.tsx`];if(G?.css&&G?.css.length>0)P[L]=G?.css;if(G)C.push(S(L,`/${G?.file}`))}let y=`{${C.join(",")}}`,N=k["app/client.tsx"]?.css??[],w=(await Promise.all(N.map((L)=>Bun.file(`${Q}/client/${L}`).text()))).join(`
2
+ import{h as W,i as g}from"./chunk-pdr63tqe.js";import"./chunk-ppt296ye.js";import{M as Y}from"./chunk-c9wa4rtm.js";import"./chunk-agvzqxv7.js";import{join as x}from"path";function V(T){let _=T.toString(),k=new Bun.CryptoHasher("sha1");return k.update(_),k.digest("hex")}if(!globalThis.URLPattern)globalThis.URLPattern=Y;import{exists as F}from"fs/promises";var u=process.env.GEMI_PROJECT_DIR??"",Z=x(process.cwd(),u),h=x(Z,"app"),Q=x(Z,"dist");async function a(T,_){let k=await import(`${Q}/client/.vite/manifest.json`),$=await import(`${Q}/server/.vite/manifest.json`);process.env.ROOT_DIR=Z,process.env.APP_DIR=h,process.env.DIST_DIR=Q;let A={},I={},P={},S=(L,U)=>`"${L}": () => import("${U}")`,C=[];for(let L of["404",...T.getFlatComponentTree.call(T)]){let U=$[`app/views/${L}.tsx`];if(!U?.file){console.log(`Server file not found for ${L}`),console.log(U);let B=Object.keys($),H=`app/views/${L}.tsx`;console.log(`${H} not found in server manifest`),console.log(B)}let z=await import(`${process.env.DIST_DIR}/server/${U?.file}`);A[L]=z.default,I[L]=z.OpenGraph;let G=k[`app/views/${L}.tsx`];if(G?.css&&G?.css.length>0)P[L]=G?.css;if(G)C.push(S(L,`/${G?.file}`))}let y=`{${C.join(",")}}`,N=k["app/client.tsx"]?.css??[],w=(await Promise.all(N.map((L)=>Bun.file(`${Q}/client/${L}`).text()))).join(`
3
3
  `);async function D(L){let{pathname:U}=new URL(L.url),z=new Y({pathname:"/*.:filetype(png|txt|js|css|jpg|svg|jpeg|avif|webp|ico|ttf|map)"}),G=U.startsWith("/.well-known"),B=z.test({pathname:U})||G,H=U.startsWith("/api");if(B&&!H){let R=new URL(L.url),J=L.url.replace(R.origin,"").split("?")[0],X=`${Q}/client${J.replace("/assets/assets","/assets")}`,O=await F(X);if(!O&&R.pathname.includes(".js"))return new Response(`if(caches){caches?.delete("${X}")}window.location.reload();export {}`,{headers:{"Content-Type":"application/javascript"}});if(!O)return new Response("Not found",{status:404});try{let b=Bun.file(X),K=V(b.lastModified);return new Response(b.stream(),{headers:{"Content-Type":b.type,"Cache-Control":"public, max-age=31536000, must-revalidate","Content-Length":String(b.size),ETag:K}})}catch(b){return T.onException?.(b),new Response("Not found",{status:404})}}let M=T.fetch.bind(T);try{let R=await M(L);if(R instanceof Response)return R;else{let J=[];return J.push({content:w}),await R({getStyles:async(O)=>{if(!O)return W([]);for(let b of O){let K=k[`app/views/${b}.tsx`];for(let E of K?.css??[]){let v=Bun.file(`${process.env.DIST_DIR}/client/${E}`);J.push({id:E,content:await v.text()})}}return W(J)},bootstrapModules:[`/${k["app/client.tsx"].file}`],loaders:y,viewImportMap:A,ogMap:I,cssManifest:P})}}catch(R){if(console.error(R),U.startsWith("/api"))return new Response(JSON.stringify({error:R.message}),{status:500,headers:{"Content-Type":"application/json"}});return T.onException?.(R),new Response(R.stack,{status:500})}}let j=Bun.serve({maxRequestBodySize:10737418240,fetch:async(L,U)=>{if(!L.headers.get("x-forwarded-for")){let z=U.requestIP(L);if(z)L.headers.set("x-forwarded-for",z.address)}return await _(L,D)},idleTimeout:Number(process.env.SERVER_IDLE_TIMEOUT??10),port:process.env.PORT||5173});return g({port:j.port,rootDir:Z}),j}export{a as httpProd};
4
4
 
5
5
  //# debugId=9746BCBA13C1DFAB64756E2164756E21
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{m as O}from"./chunk-ppt296ye.js";import{createElement as j}from"react";function T(i,n){let t=Object.keys(n).sort((p,s)=>s.length-p.length).map((p)=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),e=new RegExp(t.join("|"),"g");return i.replace(e,(p)=>n[p])}async function Y(i,n,t=[]){let e=[...t.map((b)=>`${i}/views/${b}.tsx`),`${i}/views/RootLayout.tsx`],p=new Set;for(let b of e){let u=n.moduleGraph.getModulesByFile(b);if(u)for(let d of u)p.add(d)}let s=[],r=[],c={};for(let b of p)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"),d=b.includes("module.css"),h="";if(d)h=T(c[b],u.default);s.push({isDev:!0,id:b,content:d?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 Z(i=[]){return i.map((n,t)=>{return j("style",{key:t,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as y}from"fs";import{basename as _}from"path";import{networkInterfaces as z}from"os";var v={name:"gemi",version:"0.41.2",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 --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","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:{react:">=19","react-dom":">=19",sharp:"^0.34.2",vite:"^8.0.0"}};var G=[" \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"],H=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,l=(i,n)=>H?`\x1B[${i}m${n}\x1B[0m`:n,J=(i)=>l("1",i),g=(i)=>l("2",i),x=(i)=>l("36",i),L=(i)=>l("32",i),N=(i)=>l("35",i);function Q(){return v.version??"?"}function R(i){for(let n of Object.values(z()))for(let t of n??[])if((t.family==="IPv4"||t.family===4)&&!t.internal)return`http://${t.address}:${i}`;return null}function W(i){return O(i).filter((n)=>y(n)).map((n)=>_(n))}function K(i){let{port:n,rootDir:t}=i,e=`http://localhost:${n}`,p=R(n),s=W(t),r=(b,u)=>` ${L("\u279C")} ${J(b.padEnd(9))}${u}`,c=["",...G.map((b)=>N(b)),"",` ${g("gemi")} ${x(`v${Q()}`)}`,"",r("Local:",x(e)),r("Network:",p?x(p):g("unavailable")),r("Env:",s.length?s.join(", "):g("none")),""];console.log(c.join(`
2
+ import{m as O}from"./chunk-ppt296ye.js";import{createElement as j}from"react";function T(i,n){let t=Object.keys(n).sort((p,s)=>s.length-p.length).map((p)=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),e=new RegExp(t.join("|"),"g");return i.replace(e,(p)=>n[p])}async function Y(i,n,t=[]){let e=[...t.map((b)=>`${i}/views/${b}.tsx`),`${i}/views/RootLayout.tsx`],p=new Set;for(let b of e){let u=n.moduleGraph.getModulesByFile(b);if(u)for(let d of u)p.add(d)}let s=[],r=[],c={};for(let b of p)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"),d=b.includes("module.css"),h="";if(d)h=T(c[b],u.default);s.push({isDev:!0,id:b,content:d?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 Z(i=[]){return i.map((n,t)=>{return j("style",{key:t,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as y}from"fs";import{basename as _}from"path";import{networkInterfaces as z}from"os";var v={name:"gemi",version:"0.41.3",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 --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","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:{react:">=19","react-dom":">=19",sharp:"^0.34.2",vite:"^8.0.0"}};var G=[" \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"],H=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,l=(i,n)=>H?`\x1B[${i}m${n}\x1B[0m`:n,J=(i)=>l("1",i),g=(i)=>l("2",i),x=(i)=>l("36",i),L=(i)=>l("32",i),N=(i)=>l("35",i);function Q(){return v.version??"?"}function R(i){for(let n of Object.values(z()))for(let t of n??[])if((t.family==="IPv4"||t.family===4)&&!t.internal)return`http://${t.address}:${i}`;return null}function W(i){return O(i).filter((n)=>y(n)).map((n)=>_(n))}function K(i){let{port:n,rootDir:t}=i,e=`http://localhost:${n}`,p=R(n),s=W(t),r=(b,u)=>` ${L("\u279C")} ${J(b.padEnd(9))}${u}`,c=["",...G.map((b)=>N(b)),"",` ${g("gemi")} ${x(`v${Q()}`)}`,"",r("Local:",x(e)),r("Network:",p?x(p):g("unavailable")),r("Env:",s.length?s.join(", "):g("none")),""];console.log(c.join(`
3
3
  `))}
4
4
  export{Y as g,Z as h,K as i};
5
5
 
6
- //# debugId=56D246655CC94C1964756E2164756E21
6
+ //# debugId=3E1DF21312C6668D64756E2164756E21
@@ -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,EAGpD,EAAQ,IAAI,OAAO,EAAY,KAAK,GAAG,EAAG,GAAG,EAEnD,OAAO,EAAK,QAAQ,EAAO,CAAC,IAAU,EAAO,EAAM,EAGrD,eAAsB,CAAe,CACnC,EACA,EACA,EAAyB,CAAC,EAC1B,CACA,IAAM,EAAQ,CACZ,GAAG,EAAa,IAAI,CAAC,IAAS,GAAG,WAAgB,OAAU,EAC3D,GAAG,wBACL,EAEM,EAAU,IAAI,IACpB,QAAW,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAK,YAAY,iBAAiB,CAAI,EAClD,GAAI,EACF,QAAW,KAAK,EAAK,EAAQ,IA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  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{g as I,i as f}from"./chunk-w96mexnd.js";import{j as b,k as y}from"./chunk-j7290k00.js";import"./chunk-vv72kw74.js";import"./chunk-ppt296ye.js";import"./chunk-q3wpyr9y.js";import"./chunk-88fb6hzq.js";import"./chunk-c9wa4rtm.js";import"./chunk-a8wmfnw6.js";import"./chunk-p6ezs2w7.js";import"./chunk-6b1abejc.js";import"./chunk-xnhktttd.js";import"./chunk-c1hsc4aa.js";import"./chunk-agvzqxv7.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,`
2
+ import{g as I,i as f}from"./chunk-pdr63tqe.js";import{j as b,k as y}from"./chunk-j7290k00.js";import"./chunk-vv72kw74.js";import"./chunk-ppt296ye.js";import"./chunk-q3wpyr9y.js";import"./chunk-88fb6hzq.js";import"./chunk-c9wa4rtm.js";import"./chunk-a8wmfnw6.js";import"./chunk-p6ezs2w7.js";import"./chunk-6b1abejc.js";import"./chunk-xnhktttd.js";import"./chunk-c1hsc4aa.js";import"./chunk-agvzqxv7.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 +1 @@
1
- {"version":3,"file":"QueryResource.d.ts","sourceRoot":"","sources":["../../client/QueryResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,GAAG,CAAC;IACV,K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79,7 +79,10 @@ var QueryResource = class {
79
79
  } catch (err) {}
80
80
  const store = this.store.getValue();
81
81
  const state = store.get(variantKey);
82
- if (!state || !state.data) return;
82
+ if (!state || !state.data) {
83
+ this.resolveVariant(variantKey, false, false);
84
+ return;
85
+ }
83
86
  const data = fn(state.data);
84
87
  this.staleVariants.add(variantKey);
85
88
  this.store.next(store.set(variantKey, {
@@ -373,18 +376,15 @@ function useQuery(url, ...args) {
373
376
  return resource.mutate(variantKey, (data) => {
374
377
  if (data === void 0 || data === null) {
375
378
  console.warn("Mutate function called before the query.");
376
- return;
379
+ return data;
377
380
  }
378
381
  const updatedData = typeof fn === "function" ? fn(data) : fn;
379
382
  if (isPlainObject(data)) {
380
- if (isPlainObject(updatedData)) return {
381
- ...data,
382
- ...updatedData
383
- };
383
+ if (isPlainObject(updatedData)) return updatedData;
384
384
  throw new Error("Mutate function must return an object when the current data is an object.");
385
385
  }
386
386
  if (Array.isArray(data)) {
387
- if (Array.isArray(updatedData)) return [...data, ...updatedData];
387
+ if (Array.isArray(updatedData)) return updatedData;
388
388
  throw new Error("Mutate function must return an array when the current data is an array.");
389
389
  }
390
390
  if (typeof data !== typeof updatedData) throw new Error("Mutate function must return the same type as the current data.");
@@ -610,19 +610,16 @@ function useMutate() {
610
610
  return resource.mutate.call(resource, variantKey, (data) => {
611
611
  if (data === void 0 || data === null) {
612
612
  console.warn("Mutate function called before the query.");
613
- return;
613
+ return data;
614
614
  }
615
615
  if (!fn) return data;
616
616
  const updatedData = typeof fn === "function" ? fn(data) : fn;
617
617
  if (isPlainObject(data)) {
618
- if (isPlainObject(updatedData)) return {
619
- ...data,
620
- ...updatedData
621
- };
618
+ if (isPlainObject(updatedData)) return updatedData;
622
619
  throw new Error("Mutate function must return an object when the current data is an object.");
623
620
  }
624
621
  if (Array.isArray(data)) {
625
- if (Array.isArray(updatedData)) return [...data, ...updatedData];
622
+ if (Array.isArray(updatedData)) return updatedData;
626
623
  throw new Error("Mutate function must return an array when the current data is an array.");
627
624
  }
628
625
  if (typeof data !== typeof updatedData) throw new Error("Mutate function must return the same type as the current data.");