gemi 0.4.49 → 0.4.51

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{w as T,x as C} from"../chunk-e9695f3cdafee20b.js";import{y as E} from"../chunk-7ce930fe69575c87.js";import{wa as L} from"../chunk-f08ca4bd263b132b.js";import S from"path";function g(r){return r.map((t,c)=>{if(t.isDev)return x("style",{type:"text/css","data-vite-dev-id":t.id,children:t.content},t.id,!1,void 0,this);else return x("style",{type:"text/css",children:t.content},c,!1,void 0,this)})}import{jsxDEV as x} from"react/jsx-dev-runtime";var P=E(L(),1);async function w(r){const t=new URL(r.url),c=t.searchParams.get("url"),u=Number(t.searchParams.get("w")),s=Number(t.searchParams.get("h")),i=t.searchParams.get("fit")??"cover",o=Number(t.searchParams.get("q"));if(!c)return new Response(JSON.stringify({error:"url query parameter is required"}),{headers:{"Content-Type":"application/json"},status:404});const p=`${c.startsWith("http")?"":`http://localhost:${process.env.PORT||5173}`}${c}`,e=await fetch(p);if(!e.ok)return new Response(JSON.stringify({error:"Image not found",info:p}),{headers:{"Content-Type":"application/json"},status:404});const n=Buffer.from(await e.arrayBuffer()),f=await P.default(n).resize(u>0?u:void 0,s>0?s:void 0,{fit:i}).webp({quality:o>0?o:80,force:!0}).toBuffer();return e.headers.delete("Content-Type"),e.headers.delete("Content-Length"),new Response(f,{headers:{"Content-Type":"image/webp","Content-Length":`${f.byteLength}`,...e.headers.toJSON()}})}function R(r){return`
2
+ import{w as T,x as C} from"../chunk-e9695f3cdafee20b.js";import{y as E} from"../chunk-7ce930fe69575c87.js";import{ya as L} from"../chunk-96b635a3bdba7415.js";import S from"path";function g(r){return r.map((t,c)=>{if(t.isDev)return x("style",{type:"text/css","data-vite-dev-id":t.id,children:t.content},t.id,!1,void 0,this);else return x("style",{type:"text/css",children:t.content},c,!1,void 0,this)})}import{jsxDEV as x} from"react/jsx-dev-runtime";var P=E(L(),1);async function w(r){const t=new URL(r.url),c=t.searchParams.get("url"),u=Number(t.searchParams.get("w")),s=Number(t.searchParams.get("h")),i=t.searchParams.get("fit")??"cover",o=Number(t.searchParams.get("q"));if(!c)return new Response(JSON.stringify({error:"url query parameter is required"}),{headers:{"Content-Type":"application/json"},status:404});const p=`${c.startsWith("http")?"":`http://localhost:${process.env.PORT||5173}`}${c}`,e=await fetch(p);if(!e.ok)return new Response(JSON.stringify({error:"Image not found",info:p}),{headers:{"Content-Type":"application/json"},status:404});const n=Buffer.from(await e.arrayBuffer()),f=await P.default(n).resize(u>0?u:void 0,s>0?s:void 0,{fit:i}).webp({quality:o>0?o:80,force:!0}).toBuffer();return e.headers.delete("Content-Type"),e.headers.delete("Content-Length"),new Response(f,{headers:{"Content-Type":"image/webp","Content-Length":`${f.byteLength}`,...e.headers.toJSON()}})}function R(r){return`
3
3
  <!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
@@ -25,13 +25,13 @@ import{w as T,x as C} from"../chunk-e9695f3cdafee20b.js";import{y as E} from"../
25
25
  <script type="module" src="/refresh.js"></script>
26
26
  </body>
27
27
  </html>
28
- `}async function B(){const r=process.cwd(),t=await(await import("vite")).createServer({root:r,logLevel:"error",server:{watch:{usePolling:!0,interval:100},hmr:{clientPort:5174}},appType:"custom",resolve:{alias:{"@/app":h}}});process.env.ROOT_DIR=b,process.env.APP_DIR=h;async function c(s){const{pathname:i}=new URL(s.url);if(i.startsWith("/__gemi/image"))return await w(s);if(i.startsWith("/refresh.js"))return new Response(`
28
+ `}async function B(){const r=process.cwd(),t=await(await import("vite")).createServer({root:r,logLevel:"error",server:{watch:{usePolling:!0,interval:100},hmr:{clientPort:5174}},appType:"custom",resolve:{alias:{"@/app":d}}});process.env.ROOT_DIR=b,process.env.APP_DIR=d;async function c(s){const{pathname:i}=new URL(s.url);if(i.startsWith("/__gemi/image"))return await w(s);if(i.startsWith("/refresh.js"))return new Response(`
29
29
  import RefreshRuntime from "http://localhost:5173/@react-refresh";
30
30
  RefreshRuntime.injectIntoGlobalHook(window);
31
31
  window.\$RefreshReg\$ = () => {};
32
32
  window.\$RefreshSig\$ = () => (type) => type;
33
33
  window.__vite_plugin_react_preamble_installed__ = true;
34
- `,{headers:{"Content-Type":"application/javascript"}});try{const n=await fetch(`http://localhost:5174${i}`);if(n.ok)return n}catch(n){console.log(n)}let o=null;try{o=(await t.ssrLoadModule(S.join(h,"bootstrap.ts"))).app}catch(n){return new Response(R(n),{status:500,headers:{"Content-Type":"text/html"}})}const{default:a}=await t.ssrLoadModule(`${h}/app.css`),p=[];p.push({isDev:!0,id:`${h}/app.css`,content:a}),o.setRenderParams({styles:g(p),manifest:null,serverManifest:null,bootstrapModules:["/refresh.js","/app/client.tsx","http://localhost:5173/@vite/client"]});const e=o.fetch.bind(o);try{return await e(s)}catch(n){if(console.log(n),i.startsWith("/api"))return new Response(JSON.stringify({error:n.message}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(R(n),{headers:{"Content-Type":"text/html"}})}}await t.listen(5174);const u=Bun.serve({fetch:async(s)=>{return await c(s)},port:process.env.PORT||5173});return console.log(`Server started on http://localhost:${process.env.PORT||5173}`),t.watcher.on("change",async(s)=>{if(s.includes("app/views"))return;if(console.log(`[vite] ${s} changed. Updating...`),await t.moduleGraph.getModuleByUrl(`/${s}`))console.log(`[vite] ${s} changed. Updating...`)}),u}var b=process.cwd(),h=S.join(b,"app");import{join as $} from"path";async function U(){const{app:r}=await import(`${d}/server/bootstrap.mjs`),t=await import(`${d}/client/.vite/manifest.json`),c=await import(`${d}/server/.vite/manifest.json`),s=await Bun.file(`${d}/client/${t["app/client.tsx"].css}`).text();process.env.ROOT_DIR=v,process.env.APP_DIR=I,process.env.DIST_DIR=d;async function i(a){const{pathname:p}=new URL(a.url);if(p.startsWith("/__gemi/image"))return await w(a);const e=new T({pathname:"/*.:filetype(png|txt|js|css|jpg|svg|jpeg|ico|ttf)"}),n=p.startsWith("/api");if(e.test({pathname:p})&&!n){const y=new URL(a.url),O=a.url.replace(y.origin,"").split("?")[0],l=Bun.file(`dist/client${O.replace("/assets/assets","/assets")}`);if(!l)return new Response("Not found",{status:404});const j=C(l.lastModified);return new Response(l.stream(),{headers:{"Content-Type":l.type,"Cache-Control":"public, max-age=31536000, must-revalidate","Content-Length":String(l.size),ETag:j}})}const f=[];f.push({content:s}),r.setRenderParams({styles:g(f),manifest:t,serverManifest:c,bootstrapModules:[`/${t["app/client.tsx"].file}`]});const m=r.fetch.bind(r);try{return await m(a)}catch(y){if(p.startsWith("/api"))return new Response(JSON.stringify({error:y.message}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(y.stack,{status:500})}}return Bun.serve({fetch:async(a)=>{return await i(a)},port:process.env.PORT||5173})}var v=process.cwd(),I=$(v,"app"),d=$(v,"dist");import k from"path";async function N(r){const{app:t,RootLayout:c}=r,u=process.cwd(),s=k.join(u,"app"),i=process.cwd(),o=await(await import("vite")).createServer({root:i,logLevel:"error",server:{watch:{usePolling:!0,interval:100},hmr:{clientPort:5174}},appType:"custom",resolve:{alias:{"@/app":s}}});process.env.ROOT_DIR=u,process.env.APP_DIR=s;async function a(e){const{pathname:n}=new URL(e.url);if(n.startsWith("/refresh.js"))return new Response(`
34
+ `,{headers:{"Content-Type":"application/javascript"}});try{const n=await fetch(`http://localhost:5174${i}`);if(n.ok)return n}catch(n){console.log(n)}let o=null;try{o=(await t.ssrLoadModule(S.join(d,"bootstrap.ts"))).app}catch(n){return new Response(R(n),{status:500,headers:{"Content-Type":"text/html"}})}const{default:a}=await t.ssrLoadModule(`${d}/app.css`),p=[];p.push({isDev:!0,id:`${d}/app.css`,content:a}),o.setRenderParams({styles:g(p),manifest:null,serverManifest:null,bootstrapModules:["/refresh.js","/app/client.tsx","http://localhost:5173/@vite/client"]});const e=o.fetch.bind(o);try{return await e(s)}catch(n){if(console.log(n),i.startsWith("/api"))return new Response(JSON.stringify({error:n.message}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(R(n),{headers:{"Content-Type":"text/html"}})}}await t.listen(5174);const u=Bun.serve({fetch:async(s)=>{return await c(s)},port:process.env.PORT||5173});return console.log(`Server started on http://localhost:${process.env.PORT||5173}`),t.watcher.on("change",async(s)=>{if(s.includes("app/views"))return;if(console.log(`[vite] ${s} changed. Updating...`),await t.moduleGraph.getModuleByUrl(`/${s}`))console.log(`[vite] ${s} changed. Updating...`)}),u}var b=process.cwd(),d=S.join(b,"app");import{join as $} from"path";async function U(){const{app:r}=await import(`${h}/server/bootstrap.mjs`),t=await import(`${h}/client/.vite/manifest.json`),c=await import(`${h}/server/.vite/manifest.json`),s=await Bun.file(`${h}/client/${t["app/client.tsx"].css}`).text();process.env.ROOT_DIR=v,process.env.APP_DIR=I,process.env.DIST_DIR=h;async function i(a){const{pathname:p}=new URL(a.url);if(p.startsWith("/__gemi/image"))return await w(a);const e=new T({pathname:"/*.:filetype(png|txt|js|css|jpg|svg|jpeg|ico|ttf)"}),n=p.startsWith("/api");if(e.test({pathname:p})&&!n){const y=new URL(a.url),O=a.url.replace(y.origin,"").split("?")[0],l=Bun.file(`dist/client${O.replace("/assets/assets","/assets")}`);if(!l)return new Response("Not found",{status:404});const j=C(l.lastModified);return new Response(l.stream(),{headers:{"Content-Type":l.type,"Cache-Control":"public, max-age=31536000, must-revalidate","Content-Length":String(l.size),ETag:j}})}const f=[];f.push({content:s}),r.setRenderParams({styles:g(f),manifest:t,serverManifest:c,bootstrapModules:[`/${t["app/client.tsx"].file}`]});const m=r.fetch.bind(r);try{return await m(a)}catch(y){if(p.startsWith("/api"))return new Response(JSON.stringify({error:y.message}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(y.stack,{status:500})}}const o=Bun.serve({fetch:async(a)=>{return await i(a)},port:process.env.PORT||5173});return console.log("Production server running on",o.url),o}var v=process.cwd(),I=$(v,"app"),h=$(v,"dist");import k from"path";async function N(r){const{app:t,RootLayout:c}=r,u=process.cwd(),s=k.join(u,"app"),i=process.cwd(),o=await(await import("vite")).createServer({root:i,logLevel:"error",server:{watch:{usePolling:!0,interval:100},hmr:{clientPort:5174}},appType:"custom",resolve:{alias:{"@/app":s}}});process.env.ROOT_DIR=u,process.env.APP_DIR=s;async function a(e){const{pathname:n}=new URL(e.url);if(n.startsWith("/refresh.js"))return new Response(`
35
35
  import RefreshRuntime from "http://localhost:5173/@react-refresh";
36
36
  RefreshRuntime.injectIntoGlobalHook(window);
37
37
  window.\$RefreshReg\$ = () => {};