gemi 0.173.0 → 0.174.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/bin/gemi.js +13 -2
- package/dist/bin/gemi.js.map +3 -3
- package/dist/{chunk-z58zh5gm.js → chunk-48pgk5j8.js} +1 -1
- package/dist/{chunk-dxtry1gh.js → chunk-a8c7fe9s.js} +1 -1
- package/dist/{chunk-1pvfgfhj.js → chunk-d6x90qty.js} +25 -25
- package/dist/{chunk-1pvfgfhj.js.map → chunk-d6x90qty.js.map} +10 -6
- package/dist/{chunk-9pet8zmd.js → chunk-ewf24h4z.js} +13 -2
- package/dist/chunk-ewf24h4z.js.map +10 -0
- package/dist/{chunk-psmwxtf5.js → chunk-hz37kkwy.js} +2 -2
- package/dist/{chunk-psmwxtf5.js.map → chunk-hz37kkwy.js.map} +1 -1
- package/dist/{chunk-yeaftz5a.js → chunk-jy4hy8d4.js} +1 -1
- package/dist/{chunk-eykb93pv.js → chunk-q1s9y4ce.js} +1 -1
- package/dist/{chunk-x2e20w8g.js → chunk-r5wtc9fw.js} +1 -1
- package/dist/client/IslandI18nContext.d.ts +32 -0
- package/dist/client/IslandI18nContext.d.ts.map +1 -0
- package/dist/client/index.js +29 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/islands.d.ts +40 -2
- package/dist/client/islands.d.ts.map +1 -1
- package/dist/client/useDictionary.d.ts.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/internal/islandRuntime.d.ts +10 -2
- package/dist/internal/islandRuntime.d.ts.map +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/staticDocument.d.ts +10 -0
- package/dist/services/router/staticDocument.d.ts.map +1 -1
- package/dist/testing/index.js +20 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/vite/index.mjs +12 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-9pet8zmd.js.map +0 -10
- /package/dist/{chunk-z58zh5gm.js.map → chunk-48pgk5j8.js.map} +0 -0
- /package/dist/{chunk-dxtry1gh.js.map → chunk-a8c7fe9s.js.map} +0 -0
- /package/dist/{chunk-yeaftz5a.js.map → chunk-jy4hy8d4.js.map} +0 -0
- /package/dist/{chunk-eykb93pv.js.map → chunk-q1s9y4ce.js.map} +0 -0
- /package/dist/{chunk-x2e20w8g.js.map → chunk-r5wtc9fw.js.map} +0 -0
|
@@ -22,7 +22,18 @@ export { h } from ${JSON.stringify("virtual:gemi-island-runtime")};
|
|
|
22
22
|
dangerouslySetInnerHTML: { __html: slot.innerHTML },
|
|
23
23
|
})]
|
|
24
24
|
: [];
|
|
25
|
-
|
|
25
|
+
let element = createElement(Component, props, ...children);
|
|
26
|
+
const i18n = document.getElementById("gemi-island-i18n");
|
|
27
|
+
const context = globalThis[Symbol.for("gemi.islandI18n")];
|
|
28
|
+
if (i18n && context) {
|
|
29
|
+
const payload = (i18n.p = i18n.p || JSON.parse(i18n.textContent));
|
|
30
|
+
const dictionaries = (self.__GEMI_DICT__ = self.__GEMI_DICT__ || []);
|
|
31
|
+
for (const entry of payload.dictionaries || []) dictionaries.push(entry);
|
|
32
|
+
element = createElement(context.Provider, {
|
|
33
|
+
value: { currentLocale: payload.currentLocale, defaultLocale: payload.defaultLocale, timeZone: payload.timeZone },
|
|
34
|
+
}, element);
|
|
35
|
+
}
|
|
36
|
+
return hydrateRoot(marker, element, {
|
|
26
37
|
identifierPrefix: marker.getAttribute("data-uid") || undefined,
|
|
27
38
|
});
|
|
28
39
|
}`,M=`import { createElement } from "react";
|
|
@@ -31,4 +42,4 @@ export ${z}
|
|
|
31
42
|
`,Q='const d=document,c=JSON.parse(d.getElementById("gemi-islands").textContent),w=f=>(window.requestIdleCallback||setTimeout)(f),m=(e,o)=>{if(!e.g){e.g=1;import(o.s).then(x=>x.h(e,x.m[o.e])).catch(r=>console.error(r))}};for(const e of d.querySelectorAll("gemi-island")){const o=c.i[e.dataset.island];if(!o)continue;if(o.l=="eager")m(e,o);else if(o.l=="idle"||!window.IntersectionObserver||!e.children.length)w(()=>m(e,o));else{const v=new IntersectionObserver(n=>{if(n.some(x=>x.isIntersecting)){v.disconnect();m(e,o)}});for(const k of e.children)v.observe(k)}}';
|
|
32
43
|
export{B as il,F as jl,G as kl,J as ll,M as ml,Q as nl};
|
|
33
44
|
|
|
34
|
-
//# debugId=
|
|
45
|
+
//# debugId=7B5309074404540764756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../internal/islandRuntime.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * The browser side of islands, shared by the Vite plugin (which builds it), the\n * servers (which point the loader at it) and the tests.\n *\n * No imports: the Vite plugin is built on its own and the servers load it at\n * boot, so this file stays plain strings.\n */\n\n/**\n * The module that hydrates islands: React, `react-dom/client` and the small\n * `h(marker, Component)` below. A virtual module of gemi's Vite plugin that\n * every island entry imports, so the islands on a page share one copy of\n * React, in one chunk.\n */\nexport const ISLAND_RUNTIME_ID = \"virtual:gemi-island-runtime\";\n\n/** What `resolveId` turns `ISLAND_RUNTIME_ID` into (Vite's virtual-module convention). */\nexport const RESOLVED_ISLAND_RUNTIME_ID = `\\0${ISLAND_RUNTIME_ID}`;\n\n/**\n * The query that turns a module into its island entry: `Counter.tsx?gemi-island`\n * is a module of the plugin's that re-exports `Counter.tsx` as `m` next to the\n * runtime's `h`. It is what a static page imports for an island, and so it\n * is what the client manifest lists, keyed `app/…/Counter.tsx?gemi-island`,\n * with React and `react-dom/client` among its imports.\n */\nexport const ISLAND_ENTRY_QUERY = \"?gemi-island\";\n\n/** The island entry module for `file` (an absolute path or a root-relative URL). */\nexport function islandEntrySource(file: string) {\n return `import * as m from ${JSON.stringify(file)};\nexport { m };\nexport { h } from ${JSON.stringify(ISLAND_RUNTIME_ID)};\n`;\n}\n\n/**\n * `h(marker, Component)`: hydrates one `<gemi-island>` marker with the island's\n * component and the props the server serialised into `data-props`.\n *\n * The island's static children were rendered on the server into a\n * `<gemi-slot>` (the first one that belongs to this marker, not to an island\n * nested in it). They are handed back to the component as that same element\n * with the server's HTML, so hydration matches and React leaves them alone.\n *\n * `data-uid` is the `identifierPrefix` the server rendered the island with, so\n * `useId` agrees on both sides and two islands never share an id.\n *\n * When the page carries `#gemi-island-i18n` (its islands read the page's\n * locale or dictionaries, #1095), the dictionaries in it are seeded into the\n * dictionary registry through `__GEMI_DICT__` and the island's root gets the\n * locale and zone in `IslandI18nContext` (found on `globalThis`, where\n * `gemi/client` puts it), so `useDictionary` resolves synchronously, with the\n * strings the server rendered, and fetches nothing. An island that does not\n * import `gemi/client` has no such context to read, and is left as it was.\n *\n * Written as a function body with `createElement` and `hydrateRoot` free, so a\n * test can run it against real React without a bundler.\n */\nexport const ISLAND_HYDRATE_SOURCE = `function h(marker, Component) {\n if (typeof Component !== \"function\" && (typeof Component !== \"object\" || Component === null)) {\n throw new Error(\"gemi: island module has no component export for \" + marker.outerHTML.slice(0, 80));\n }\n const json = marker.getAttribute(\"data-props\");\n const props = json ? JSON.parse(json) : {};\n let slot = null;\n for (const candidate of marker.querySelectorAll(\"gemi-slot\")) {\n if (candidate.closest(\"gemi-island\") === marker) {\n slot = candidate;\n break;\n }\n }\n const children = slot\n ? [createElement(\"gemi-slot\", {\n style: { display: \"contents\" },\n suppressHydrationWarning: true,\n dangerouslySetInnerHTML: { __html: slot.innerHTML },\n })]\n : [];\n let element = createElement(Component, props, ...children);\n const i18n = document.getElementById(\"gemi-island-i18n\");\n const context = globalThis[Symbol.for(\"gemi.islandI18n\")];\n if (i18n && context) {\n const payload = (i18n.p = i18n.p || JSON.parse(i18n.textContent));\n const dictionaries = (self.__GEMI_DICT__ = self.__GEMI_DICT__ || []);\n for (const entry of payload.dictionaries || []) dictionaries.push(entry);\n element = createElement(context.Provider, {\n value: { currentLocale: payload.currentLocale, defaultLocale: payload.defaultLocale, timeZone: payload.timeZone },\n }, element);\n }\n return hydrateRoot(marker, element, {\n identifierPrefix: marker.getAttribute(\"data-uid\") || undefined,\n });\n}`;\n\n/** The runtime module's source, as the plugin serves and builds it. */\nexport const ISLAND_RUNTIME_SOURCE = `import { createElement } from \"react\";\nimport { hydrateRoot } from \"react-dom/client\";\nexport ${ISLAND_HYDRATE_SOURCE}\n`;\n\n/**\n * The island loader, inlined into a static document that uses islands.\n *\n * Kept byte-for-byte constant (the per-page island table travels in a\n * separate `<script type=\"application/json\">`, which a Content Security Policy\n * does not treat as script), so a strict policy can allow it by hash:\n * `script-src 'sha256-…'` with `ISLAND_LOADER_CSP_HASH`. Everything it loads\n * is a plain `import()` of a same-origin (or asset-base) file.\n *\n * The table is `{ i: [{ s: entry URL, e: export, l: load }] }` and each\n * marker's `data-island` indexes `i`. Per marker, on its schedule: import the\n * island's entry (the module as `m`, the runtime's `h`), then\n * `h(marker, m[export])`, which calls `hydrateRoot`. A failure is logged and\n * leaves the server-rendered markup in place.\n */\nexport const ISLAND_LOADER_SOURCE =\n 'const d=document,c=JSON.parse(d.getElementById(\"gemi-islands\").textContent),' +\n \"w=f=>(window.requestIdleCallback||setTimeout)(f),\" +\n \"m=(e,o)=>{if(!e.g){e.g=1;import(o.s).then(x=>x.h(e,x.m[o.e])).catch(r=>console.error(r))}};\" +\n 'for(const e of d.querySelectorAll(\"gemi-island\")){const o=c.i[e.dataset.island];if(!o)continue;' +\n 'if(o.l==\"eager\")m(e,o);else if(o.l==\"idle\"||!window.IntersectionObserver||!e.children.length)w(()=>m(e,o));' +\n \"else{const v=new IntersectionObserver(n=>{if(n.some(x=>x.isIntersecting)){v.disconnect();m(e,o)}});for(const k of e.children)v.observe(k)}}\";\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAcO,IAAM,EAAoB,8BAGpB,EAA6B,kCAS7B,EAAqB,eAG3B,SAAS,CAAiB,CAAC,EAAc,CAC9C,MAAO,sBAAsB,KAAK,UAAU,CAAI;AAAA;AAAA,oBAE9B,KAAK,UAlBQ,6BAkBmB;AAAA,EA2B7C,IAAM,EAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAqCxB,EAAwB;AAAA;AAAA,SAE5B;AAAA,EAkBI,EACX",
|
|
8
|
+
"debugId": "7B5309074404540764756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ca as f}from"./chunk-s0z61m9j.js";import{createElement as v}from"react";function q(i,t){let e=Object.keys(t).sort((s,r)=>r.length-s.length).map((s)=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),p=new RegExp(e.join("|"),"g");return i.replace(p,(s)=>t[s])}async function Y(i,t,e=[],p){let s=[...e.map((n)=>`${i}/views/${n}.tsx`),p?`${i}/views/${p}.tsx`:`${i}/views/RootLayout.tsx`],r=new Set;for(let n of s){let u=t.moduleGraph.getModulesByFile(n);if(u)for(let d of u)r.add(d)}let b=[],l=[],g={};for(let n of r)if(n)for(let u of n.importedModules){if(u.file.includes("module.css"))g[u.file]=u.ssrTransformResult.map.sourcesContent.join("");if(u.file.includes(".css"))l.push(u.file)}for(let n of l){let u=await t.transformRequest(n+"?direct"),d=n.includes("module.css"),j="";if(d)j=q(g[n],u.default);b.push({isDev:!0,id:n,content:d?j:u.code})}return b.map((n,u)=>{return v("style",{key:u,type:"text/css","data-vite-dev-id":n.id,dangerouslySetInnerHTML:{__html:n.content}})})}async function Z(i=[]){return i.map((t,e)=>{return v("style",{key:e,id:t?.id,type:"text/css",dangerouslySetInnerHTML:{__html:t.content}})})}import{existsSync as y}from"fs";import{basename as z}from"path";import{networkInterfaces as $}from"os";var a={name:"gemi",version:"0.
|
|
2
|
+
import{Ca as f}from"./chunk-s0z61m9j.js";import{createElement as v}from"react";function q(i,t){let e=Object.keys(t).sort((s,r)=>r.length-s.length).map((s)=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),p=new RegExp(e.join("|"),"g");return i.replace(p,(s)=>t[s])}async function Y(i,t,e=[],p){let s=[...e.map((n)=>`${i}/views/${n}.tsx`),p?`${i}/views/${p}.tsx`:`${i}/views/RootLayout.tsx`],r=new Set;for(let n of s){let u=t.moduleGraph.getModulesByFile(n);if(u)for(let d of u)r.add(d)}let b=[],l=[],g={};for(let n of r)if(n)for(let u of n.importedModules){if(u.file.includes("module.css"))g[u.file]=u.ssrTransformResult.map.sourcesContent.join("");if(u.file.includes(".css"))l.push(u.file)}for(let n of l){let u=await t.transformRequest(n+"?direct"),d=n.includes("module.css"),j="";if(d)j=q(g[n],u.default);b.push({isDev:!0,id:n,content:d?j:u.code})}return b.map((n,u)=>{return v("style",{key:u,type:"text/css","data-vite-dev-id":n.id,dangerouslySetInnerHTML:{__html:n.content}})})}async function Z(i=[]){return i.map((t,e)=>{return v("style",{key:e,id:t?.id,type:"text/css",dangerouslySetInnerHTML:{__html:t.content}})})}import{existsSync as y}from"fs";import{basename as z}from"path";import{networkInterfaces as $}from"os";var a={name:"gemi",version:"0.174.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","gemi-orm-generator":"./dist/bin/orm-generator.js"},files:["dist/**/*","ide/typescript-plugin/package.json","skills/**/*"],module:!0,exports:{"./http":"./http/index.ts","./client":"./client/index.ts","./ai":"./ai/index.ts","./ai/client":"./ai/client/index.ts","./ai/voice":"./ai/voice/index.ts","./testing":"./testing/index.ts","./app":"./app/index.ts","./facades":"./facades/index.ts","./email":"./email/index.ts","./vite":"./dist/vite/index.mjs","./kernel":"./kernel/index.ts","./services":"./services/index.ts","./i18n":"./i18n/index.ts","./dictionary":"./i18n/dictionaryRuntime.ts","./server":"./server/index.ts","./config":"./config/index.ts","./container":"./container/index.ts","./foundation":"./foundation/index.ts","./database":"./database/index.ts","./orm":"./orm/index.ts","./support":"./support/index.ts","./probe":"./probe/index.ts","./console/run":"./console/run.ts","./queue/work":"./services/queue/work.ts","./stats/route-table":"./stats/route-table.ts","./ide/typescript-plugin":"./ide/typescript-plugin/index.ts","./bun/preload":"./bun/preload.ts","./bun/plugin":"./bun/plugin.ts","./vitest":"./vitest/index.ts"},scripts:{lint:"oxlint",typecheck:"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.browser.json && tsc --noEmit -p ide/typescript-plugin/tsconfig.json",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:ts-plugin && bun run build:client-types && bun run build:augmentation","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 --external=typescript --sourcemap ./bin/gemi.ts ./bin/orm-generator.ts && bun ./scripts/prepare-bin.ts","build:client":"rm -rf dist/client dist/testing dist/ai/client dist/ai/voice dist/chunks && vite build -c vite.client.config.mts","build:plugin":"vite build -c vite.plugin.config.mts","build:ts-plugin":"bun ./scripts/build-ts-plugin.ts","build:types":"tsc -p tsconfig.build.json","build:client-types":"tsc -p tsconfig.browser.json",test:"bun --bun x vitest","test:types":"vitest run --typecheck.only","test:live":"bun --bun x vitest run ai/live","test:packaging":"bun --bun x vitest run --config vitest.packaging.config.ts","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","build:augmentation":"bun ./scripts/wire-augmentation.ts"},dependencies:{"@aws-sdk/client-s3":"^3.629.0","@aws-sdk/s3-request-presigner":"^3.629.0","ast-types":"^0.14.2",commander:"^12.1.0",history:"^5.3.0","jsx-email":"2.0.0-rc2.1","magic-string":"^0.30.17",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","@prisma/generator-helper":"^6.5.0","@repo/typescript-config":"*","@testing-library/react":"^16.3.2","@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",jsdom:"^30.0.1",oxlint:"^1.39.0",postgres:"^3.4.5",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",typescript:">=5",vite:"^8.0.0",postgres:"^3.4.0"},peerDependenciesMeta:{"@azure/storage-blob":{optional:!0},typescript:{optional:!0},postgres:{optional:!0}}};var h=[" \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"],E=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,c=(i,t)=>E?`\x1B[${i}m${t}\x1B[0m`:t,G=(i)=>c("1",i),x=(i)=>c("2",i),o=(i)=>c("36",i),J=(i)=>c("32",i),N=(i)=>c("35",i);function O(){return a.version??"?"}function Q(i){for(let t of Object.values($()))for(let e of t??[])if((e.family==="IPv4"||e.family===4)&&!e.internal)return`http://${e.address}:${i}`;return null}function W(i){return f(i).filter((t)=>y(t)).map((t)=>z(t))}function F(i){let{port:t,rootDir:e}=i,p=`http://localhost:${t}`,s=Q(t),r=W(e),b=(g,n)=>` ${J("\u279C")} ${G(g.padEnd(9))}${n}`,l=["",...h.map((g)=>N(g)),"",` ${x("gemi")} ${o(`v${O()}`)}`,"",b("Local:",o(p)),b("Network:",s?o(s):x("unavailable")),b("Env:",r.length?r.join(", "):x("none")),""];console.log(l.join(`
|
|
3
3
|
`))}function V(i,t){return Error(`app/views/${i}.tsx is missing. gemi's auth routes render it because ${t} is on. Add the view, or turn that setting off in app/config/auth.ts.`)}function U(i=process.env.SERVER_IDLE_TIMEOUT){if(i===void 0||i.trim()==="")return 10;let t=Number(i.trim());if(!Number.isInteger(t)||t<0||t>255)throw Error(`SERVER_IDLE_TIMEOUT must be a whole number of seconds from 0 to 255 (0 disables the timeout), got ${JSON.stringify(i)}.`);return t}
|
|
4
4
|
export{Y as W,Z as X,F as Y,V as Z,U as _};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=ECB48E5833EF6DE464756E2164756E21
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
"/**\n * Bun's default, and what both servers use when `SERVER_IDLE_TIMEOUT` is unset.\n */\nexport const DEFAULT_SERVER_IDLE_TIMEOUT = 10;\n\n/**\n * The `idleTimeout` (seconds) both `gemi dev` and `gemi start` pass to\n * `Bun.serve`, from `SERVER_IDLE_TIMEOUT` (#787).\n *\n * One reader for both servers, so a long-poll that works under `gemi start`\n * also works under `gemi dev`. Before this, only `httpProd` read the variable\n * and the dev server always ran at Bun's 10 seconds.\n *\n * It is the time a connection may stay silent, a response that has not started\n * included, before Bun closes it; `0` disables it. It does not apply to an\n * upgraded websocket (the HMR relay included), which has its own\n * `websocket.idleTimeout`.\n *\n * Unset or blank means the default. Anything that is not a whole number from 0\n * to 255 (Bun's own limits) fails the boot with the variable's name, instead\n * of Bun's \"expects idleTimeout to be an integer\", which does not say where the\n * value came from.\n */\nexport function serverIdleTimeout(raw: string | undefined = process.env.SERVER_IDLE_TIMEOUT): number {\n if (raw === undefined || raw.trim() === \"\") return DEFAULT_SERVER_IDLE_TIMEOUT;\n\n const seconds = Number(raw.trim());\n if (!Number.isInteger(seconds) || seconds < 0 || seconds > 255) {\n throw new Error(\n `SERVER_IDLE_TIMEOUT must be a whole number of seconds from 0 to 255 ` +\n `(0 disables the timeout), got ${JSON.stringify(raw)}.`,\n );\n }\n return seconds;\n}\n"
|
|
9
9
|
],
|
|
10
10
|
"mappings": "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",
|
|
11
|
-
"debugId": "
|
|
11
|
+
"debugId": "ECB48E5833EF6DE464756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{X as y,Y as IJ,Z as NJ,_ as FJ}from"./chunk-
|
|
2
|
+
import{X as y,Y as IJ,Z as NJ,_ as FJ}from"./chunk-hz37kkwy.js";import{pa as T,ta as M,ua as MJ}from"./chunk-bwg7genv.js";import"./chunk-s0z61m9j.js";import{Hg as CJ,Ig as LJ,Jg as _J,le as ZJ,yg as UJ,zg as B}from"./chunk-d6x90qty.js";import"./chunk-hr9twa8v.js";import"./chunk-m0nvysa5.js";import{Oh as e,Ph as JJ,Sh as $J}from"./chunk-r22svpab.js";import{Ui as xJ}from"./chunk-4dnr1vg7.js";import"./chunk-4hhvaa7a.js";import"./chunk-6srzhv88.js";import"./chunk-0v46hne6.js";import"./chunk-rjsd8f8q.js";import"./chunk-vzz91xsm.js";import"./chunk-d7a79eqm.js";import"./chunk-ksgeqtcv.js";import"./chunk-6rh3brnr.js";import"./chunk-vpmbynke.js";import"./chunk-9bcsfce4.js";import"./chunk-9zcsshgb.js";import"./chunk-bsnp7h5w.js";import"./chunk-xtj7cgsx.js";import{kl as WJ}from"./chunk-ewf24h4z.js";import"./chunk-ykd2ayw8.js";import{yl as KJ}from"./chunk-7gc1jp2z.js";import{Al as S}from"./chunk-sjg5g92s.js";import"./chunk-xe126csw.js";import{createHash as V2}from"crypto";import{join as g,resolve as TJ,sep as AJ}from"path";import{Duplex as gJ}from"stream";import{constants as P,createBrotliCompress as fJ,createGzip as mJ}from"zlib";var uJ=["br","gzip"],hJ=1024,cJ=5,pJ=19,dJ=6;function lJ(J){if(J===void 0)return 1;if(!/^\d+(\.\d{0,3})?$/.test(J.trim()))return 1;let $=Number(J.trim());return Number.isFinite($)?Math.min($,1):1}function oJ(J){if(J===null||J===void 0)return null;let $=new Map;for(let Z of J.split(",")){let[X,...j]=Z.split(";"),W=X.trim().toLowerCase();if(W==="")continue;let G=1;for(let Y of j){let O=Y.indexOf("=");if(O===-1)continue;if(Y.slice(0,O).trim().toLowerCase()==="q"){G=lJ(Y.slice(O+1));break}}$.set(W,G)}return $}function w(J,$=uJ){let Z=oJ(J);if(!Z)return null;let X=Z.get("*"),j=null,W=0;for(let G of $){let Y=Z.get(G)??X??0;if(Y>W)j=G,W=Y}return j}function nJ(J,$){if(!J)return!1;return J.split(",").some((Z)=>Z.trim().toLowerCase().split("=")[0].trim()===$)}function iJ(J,$){if(J==="HEAD")return!1;if($.status<200||$.status===204||$.status===206||$.status===304)return!1;if($.headers.has("Content-Range"))return!1;let Z=$.headers.get("Content-Type");if(!Z||!/^\s*text\/html\s*(;|$)/i.test(Z))return!1;if(!$.body)return!1;let X=$.headers.get("Content-Encoding");if(X&&X.trim().toLowerCase()!=="identity")return!1;if(nJ($.headers.get("Cache-Control"),"no-transform"))return!1;let j=$.headers.get("Content-Length");if(j!==null&&Number(j)<hJ)return!1;return!0}function aJ(J){let $=J==="br"?fJ({params:{[P.BROTLI_PARAM_QUALITY]:cJ,[P.BROTLI_PARAM_LGWIN]:pJ},flush:P.BROTLI_OPERATION_FLUSH}):mJ({level:dJ,flush:P.Z_SYNC_FLUSH});return gJ.toWeb($)}function tJ(J){let $=J.get("Vary");if(!$){J.set("Vary","Accept-Encoding");return}let Z=$.split(",").map((X)=>X.trim().toLowerCase());if(Z.includes("*")||Z.includes("accept-encoding"))return;J.append("Vary","Accept-Encoding")}function a(J,$){if(!iJ(J.method,$))return $;let Z=new Headers($.headers);tJ(Z);let X=w(J.headers.get("Accept-Encoding"));if(!X)return new Response($.body,{status:$.status,statusText:$.statusText,headers:Z});let j;try{j=aJ(X)}catch{return new Response($.body,{status:$.status,statusText:$.statusText,headers:Z})}return Z.set("Content-Encoding",X),Z.delete("Content-Length"),new Response($.body.pipeThrough(j),{status:$.status,statusText:$.statusText,headers:Z})}import{readdir as X2,stat as XJ}from"fs/promises";import{join as Q2}from"path";import{mkdir as I2,readFile as rJ,stat as N2,writeFile as F2}from"fs/promises";import{dirname as A2,join as sJ}from"path";import{promisify as t}from"util";import{brotliCompress as eJ,constants as R2,gzip as J2}from"zlib";var $2=".vite/static-assets.json";var r={br:".br",gzip:".gz"},Z2=["br","gzip"],B2=t(eJ),S2=t(J2);async function s(J){let $;try{$=await rJ(sJ(J,$2),"utf8")}catch{return null}let Z;try{Z=JSON.parse($)?.files}catch{return null}if(!Z||typeof Z!=="object")return null;let X={files:{}};for(let[j,W]of Object.entries(Z)){if(!Array.isArray(W))continue;X.files[j]=Z2.filter((G)=>W.includes(G))}return X}function k(J){let $=J.toString(),Z=new Bun.CryptoHasher("sha1");return Z.update($),Z.digest("hex")}async function QJ(J){let $=new Set;async function Z(X,j){let W;try{W=await X2(X,{withFileTypes:!0})}catch{return}for(let G of W){if(G.name.startsWith("."))continue;if(j&&G.name==="assets")continue;let Y=Q2(X,G.name),O=G.isDirectory(),V=G.isFile();if(G.isSymbolicLink())try{let K=await XJ(Y);O=K.isDirectory(),V=K.isFile()}catch{continue}if(V)$.add(Y);else if(O&&!G.isSymbolicLink())await Z(Y,!1)}}return await Z(J,!0),$}var j2="public, max-age=31536000, must-revalidate",W2="public, max-age=31536000, immutable";async function G2(J,$,Z){if(Z.length===0||J.headers.has("Range"))return null;let X=w(J.headers.get("Accept-Encoding"),Z);if(!X)return null;let j=$+r[X];try{let W=await XJ(j);return W.isFile()?{encoding:X,path:j,size:W.size}:null}catch{return null}}async function jJ(J,$,Z={}){let X=Bun.file($),j=Z.encodings??[],W={"Content-Type":X.type||"application/octet-stream","Cache-Control":Z.immutable?W2:j2,"Accept-Ranges":"bytes"};if(j.length>0)W.Vary="Accept-Encoding";let G=await G2(J,$,j);if(G){let V=Bun.file(G.path);return new Response(V.stream(),{headers:{...W,"Content-Encoding":G.encoding,"Content-Length":String(G.size),ETag:`${k(V.lastModified)}-${G.encoding}`}})}let Y=X.size;W.ETag=k(X.lastModified);let O=e(J.headers.get("Range"));if(O){let V=JJ(O,Y);if(!V)return ZJ(Y);return new Response(X.slice(V.start,V.end+1).stream(),{status:206,headers:{...W,"Content-Range":$J(V.start,V.end,Y),"Content-Length":String(V.length)}})}return new Response(X.stream(),{headers:{...W,"Content-Length":String(Y)}})}import{stat as U2}from"fs/promises";var R="app/client.tsx";function GJ(J,$=T){let Z=J[R]?.file;if(!Z)return;return{module:M(Z,$),preload:_(J,R,$)}}function _(J,$,Z=T){let X=[],j=new Set,W=(G)=>{if(j.has(G))return;j.add(G);let Y=J[G];if(!Y?.file)return;X.push(M(Y.file,Z));for(let O of Y.imports??[])W(O)};return W($),X}function H2(J,$,Z=T){let X=new Set(_(J,$,Z)),j=[],W=new Set,G=(O)=>{if(W.has(O))return;W.add(O);let V=J[O];if(!V)return;for(let K of V.dynamicImports??[])if(!/(^|\/)node_modules\//.test(K)&&!j.includes(K))j.push(K);for(let K of V.imports??[])G(K)};G($);let Y=[];for(let O of j)for(let V of _(J,O,Z))if(!X.has(V))X.add(V),Y.push(V);return Y}function HJ(J,$){let Z=[],X=new Set,j=new Set,W=(G)=>{if(j.has(G))return;j.add(G);let Y=J[G];if(!Y)return;for(let O of Y.imports??[])W(O);for(let O of Y.css??[])if(!X.has(O))X.add(O),Z.push(O)};return W($),Z}function YJ(J,$=T){let Z=new Map;return(X)=>{if(!Z.has(X)){let j=`${X}${WJ}`,W=J[j]?.file;Z.set(X,W?{src:M(W,$),preload:_(J,j,$),dynamicPreload:H2(J,j,$)}:void 0)}return Z.get(X)}}var OJ="x-gemi-build";function VJ(J,$=30000){let Z=JSON.stringify("gemi:chunk-reload"),X=JSON.stringify(`Failed to fetch dynamically imported module: ${J}`);return`var r=!1;try{var s=window.sessionStorage,u=window.location.href,m=JSON.parse(s.getItem(${Z})||"{}");if(!m||typeof m!=="object")m={};var d=Date.now()-m[u];if(navigator.onLine!==!1&&!(d>=0&&d<${$})){m[u]=Date.now();s.setItem(${Z},JSON.stringify(m));r=!0}}catch(e){}if(r)window.location.reload();else throw new Error(${X});export {}`}var Y2=new RegExp(`^${UJ}/.+\\.m?js$`);function v(J){return Y2.test(J)}function zJ(J){if(v(J))return new Response(VJ(J),{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store"}});if(B(J))return new Response("Not found",{status:404});return}var O2=`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{il as I,jl as N,kl as A,ll as x,ml as k}from"./chunk-
|
|
2
|
+
import{il as I,jl as N,kl as A,ll as x,ml as k}from"./chunk-ewf24h4z.js";import{realpathSync as r}from"fs";import{relative as t,sep as n}from"path";var g=44,p=59,T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b=new Uint8Array(64),l=new Uint8Array(128);for(let z=0;z<T.length;z++){let J=T.charCodeAt(z);b[z]=J,l[J]=z}function q(z,J,K){let X=J-K;X=X<0?-X<<1|1:X<<1;do{let Z=X&31;if(X>>>=5,X>0)Z|=32;z.write(b[Z])}while(X>0);return J}var v=16384,R=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(z){return Buffer.from(z.buffer,z.byteOffset,z.byteLength).toString()}}:{decode(z){let J="";for(let K=0;K<z.length;K++)J+=String.fromCharCode(z[K]);return J}},h=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(v)}write(z){let{buffer:J}=this;if(J[this.pos++]=z,this.pos===v)this.out+=R.decode(J),this.pos=0}flush(){let{buffer:z,out:J,pos:K}=this;return K>0?J+R.decode(z.subarray(0,K)):J}};function L(z){let J=new h,K=0,X=0,Z=0,$=0;for(let W=0;W<z.length;W++){let F=z[W];if(W>0)J.write(p);if(F.length===0)continue;let G=0;for(let H=0;H<F.length;H++){let Q=F[H];if(H>0)J.write(g);if(G=q(J,Q[0],G),Q.length===1)continue;if(K=q(J,Q[1],K),X=q(J,Q[2],X),Z=q(J,Q[3],Z),Q.length===4)continue;$=q(J,Q[4],$)}}return J.flush()}class P{constructor(z){this.bits=z instanceof P?z.bits.slice():[]}add(z){this.bits[z>>5]|=1<<(z&31)}has(z){return!!(this.bits[z>>5]&1<<(z&31))}}class j{constructor(z,J,K){this.start=z,this.end=J,this.original=K,this.intro="",this.outro="",this.content=K,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(z){this.outro+=z}appendRight(z){this.intro=this.intro+z}clone(){let z=new j(this.start,this.end,this.original);return z.intro=this.intro,z.outro=this.outro,z.content=this.content,z.storeName=this.storeName,z.edited=this.edited,z}contains(z){return this.start<z&&z<this.end}eachNext(z){let J=this;while(J)z(J),J=J.next}eachPrevious(z){let J=this;while(J)z(J),J=J.previous}edit(z,J,K){if(this.content=z,!K)this.intro="",this.outro="";return this.storeName=J,this.edited=!0,this}prependLeft(z){this.outro=z+this.outro}prependRight(z){this.intro=z+this.intro}reset(){if(this.intro="",this.outro="",this.edited)this.content=this.original,this.storeName=!1,this.edited=!1}split(z){let J=z-this.start,K=this.original.slice(0,J),X=this.original.slice(J);this.original=K;let Z=new j(z,this.end,X);if(Z.outro=this.outro,this.outro="",this.end=z,this.edited)Z.edit("",!1),this.content="";else this.content=K;if(Z.next=this.next,Z.next)Z.next.previous=Z;return Z.previous=this,this.next=Z,Z}toString(){return this.intro+this.content+this.outro}trimEnd(z){if(this.outro=this.outro.replace(z,""),this.outro.length)return!0;let J=this.content.replace(z,"");if(J.length){if(J!==this.content){if(this.split(this.start+J.length).edit("",void 0,!0),this.edited)this.edit(J,this.storeName,!0)}return!0}else if(this.edit("",void 0,!0),this.intro=this.intro.replace(z,""),this.intro.length)return!0}trimStart(z){if(this.intro=this.intro.replace(z,""),this.intro.length)return!0;let J=this.content.replace(z,"");if(J.length){if(J!==this.content){let K=this.split(this.end-J.length);if(this.edited)K.edit(J,this.storeName,!0);this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(z,""),this.outro.length)return!0}}function u(){if(typeof globalThis<"u"&&typeof globalThis.btoa==="function")return(z)=>globalThis.btoa(unescape(encodeURIComponent(z)));else if(typeof Buffer==="function")return(z)=>Buffer.from(z,"utf-8").toString("base64");else return()=>{throw Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}var d=u();class w{constructor(z){if(this.version=3,this.file=z.file,this.sources=z.sources,this.sourcesContent=z.sourcesContent,this.names=z.names,this.mappings=L(z.mappings),typeof z.x_google_ignoreList<"u")this.x_google_ignoreList=z.x_google_ignoreList;if(typeof z.debugId<"u")this.debugId=z.debugId}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+d(this.toString())}}function a(z){let J=z.split(`
|
|
3
3
|
`),K=J.filter(($)=>/^\t+/.test($)),X=J.filter(($)=>/^ {2,}/.test($));if(K.length===0&&X.length===0)return null;if(K.length>=X.length)return"\t";let Z=X.reduce(($,W)=>{let F=/^ +/.exec(W)[0].length;return Math.min(F,$)},1/0);return Array(Z+1).join(" ")}function o(z,J){let K=z.split(/[/\\]/),X=J.split(/[/\\]/);K.pop();while(K[0]===X[0])K.shift(),X.shift();if(K.length){let Z=K.length;while(Z--)K[Z]=".."}return K.concat(X).join("/")}var s=Object.prototype.toString;function c(z){return s.call(z)==="[object Object]"}function f(z){let J=z.split(`
|
|
4
4
|
`),K=[];for(let X=0,Z=0;X<J.length;X++)K.push(Z),Z+=J[X].length+1;return function(Z){let $=0,W=K.length;while($<W){let H=$+W>>1;if(Z<K[H])W=H;else $=H+1}let F=$-1,G=Z-K[F];return{line:F,column:G}}}var i=/\w/;class C{constructor(z){this.hires=z,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(z,J,K,X){if(J.length){let Z=J.length-1,$=J.indexOf(`
|
|
5
5
|
`,0),W=-1;while($>=0&&Z>$){let G=[this.generatedCodeColumn,z,K.line,K.column];if(X>=0)G.push(X);this.rawSegments.push(G),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,W=$,$=J.indexOf(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pa as w,qa as P,ra as R,sa as b}from"./chunk-bwg7genv.js";import{va as K,wa as _,xa as L,ya as A}from"./chunk-mvd4mc8p.js";import{za as I}from"./chunk-7txst143.js";import{Aa as T,Ba as E}from"./chunk-
|
|
2
|
+
import{pa as w,qa as P,ra as R,sa as b}from"./chunk-bwg7genv.js";import{va as K,wa as _,xa as L,ya as A}from"./chunk-mvd4mc8p.js";import{za as I}from"./chunk-7txst143.js";import{Aa as T,Ba as E}from"./chunk-q1s9y4ce.js";var i=["gemi","gemi/client","gemi/http","gemi/app","gemi/facades","gemi/email","gemi/kernel","gemi/services","gemi/i18n","gemi/dictionary"];function O(q){return q==="gemi"||q.startsWith("gemi/")}import{parseAstAsync as h}from"vite";var V="virtual:gemi-dict/",x="\x00virtual:gemi-dict/",f=new Set(["gemi/dictionary","gemi/client","gemi/i18n"]),y="gemi/dictionary";function B(){let q=new Map;return{name:"gemi-plugin-dictionary",enforce:"post",resolveId(H){if(H.startsWith(V))return`\x00${H}`;return null},async load(H){if(!H.startsWith(x))return null;let Q=H.slice(x.length),W=Q.lastIndexOf("/"),J=Q.slice(0,W),Y=Q.slice(W+1),$=q.get(J);if(!$){let M=g(J);if(M){try{await this.load({id:M})}catch{}$=q.get(J)}}if(!$)return this.error(`No dictionary registered for "${J}". If this persists, restart the dev server.`),null;let G=_($.translations,Y,$.locales);return`export default ${JSON.stringify(G)};
|
|
3
3
|
`},async transform(H,Q){if(!H.includes("defineDictionary"))return null;if(Q.startsWith("\x00")||Q.includes("/node_modules/"))return null;let W=await h(H),J=new Set;for(let Z of W.body){if(Z.type!=="ImportDeclaration")continue;if(!f.has(Z.source?.value))continue;for(let z of Z.specifiers??[])if(z.type==="ImportSpecifier"&&z.imported?.name==="defineDictionary")J.add(z.local.name)}let Y=[],$=0;if(X(W,(Z)=>{if(Z.type!=="CallExpression")return;let z=Z.callee;if(z?.type==="Identifier"&&J.has(z.name)){Y.push(Z);return}if((z?.type==="Identifier"?z.name:z?.type==="MemberExpression"&&!z.computed?z.property?.name:void 0)==="defineDictionary")$++}),$>0&&p(W,"defineDictionary"))$=0;if($>0)this.warn(`${Q}: ${$} defineDictionary() call(s) could not be traced to an import of "gemi/dictionary", "gemi/client" or "gemi/i18n", so their locales were left inline and will all ship to the browser. Import defineDictionary directly by name rather than through a namespace import or a local re-export.`);if(Y.length===0)return null;let G=new T(H),M=!1;for(let Z of Y){if(Z.arguments?.length<1||Z.arguments?.length>2)this.error({message:"defineDictionary() takes an object literal and an optional options object.",pos:Z.start});let z=m(Z.arguments[0],(j)=>this.error({message:j,pos:Z.arguments[0]?.start??Z.start})),F=v(Z.arguments[1],(j)=>this.error({message:j,pos:Z.arguments[1]?.start??Z.start})),D=A(z),C=`${Buffer.from(Q).toString("base64url")}/${D}`,N=K(z,F);if(N.length===0)this.error({message:'defineDictionary() declares no locales \u2014 every key needs at least one "<locale>": "<string>" entry.',pos:Z.start});if(!F){let j=L(z);if(j)this.error({message:`defineDictionary() cannot infer a source language. Key "${j.againstKey}" lists "${j.againstFirst}" first but "${j.key}" lists "${j.first}" first, so the locale every key falls back to depends on the order `+"they are written in \u2014 moving one key would change what language a reader sees. "+'Pass { sourceLocale: "<locale>" } as the second argument to pin it.',pos:Z.start})}q.set(C,{id:D,locales:N,translations:z});let S=N.map((j)=>`${JSON.stringify(j)}:()=>import(${JSON.stringify(`${V}${C}/${j}`)})`).join(",");G.overwrite(Z.start,Z.end,`__gemi_dict__(${JSON.stringify(D)},{${S}})`),M=!0}if(!M)return null;return G.append(`
|
|
4
4
|
import { __gemi_dict__ } from ${JSON.stringify(y)};
|
|
5
5
|
`),{code:G.toString(),map:G.generateMap({hires:!0})}}}}function g(q){let H=q.indexOf("/");if(H===-1)return null;try{return Buffer.from(q.slice(0,H),"base64url").toString("utf8")}catch{return null}}function m(q,H){if(q?.type!=="ObjectExpression")H("defineDictionary() needs an inline object literal \u2014 it is read at build time, so a variable or spread cannot be resolved.");let Q={};for(let W of q.properties){let J=U(W);if(J===null)H("defineDictionary() keys must be plain string keys \u2014 computed keys and spreads cannot be read at build time.");if(W.value?.type!=="ObjectExpression")H(`defineDictionary() entry "${J}" must be an object of "<locale>": "<string>" pairs.`);let Y={};for(let $ of W.value.properties){let G=U($);if(G===null)H(`defineDictionary() entry "${J}" has a locale key that cannot be read at build time.`);let M=$.value;if(M?.type!=="Literal"||typeof M.value!=="string")H(`defineDictionary() entry "${J}" locale "${G}" must be a string literal. Use {{param}} interpolation instead of a template literal or a function.`);Y[G]=M.value}Q[J]=Y}return Q}function v(q,H){if(q===void 0)return;if(q.type!=="ObjectExpression")H("defineDictionary() options must be an inline object literal \u2014 it is read at build time.");for(let Q of q.properties){if(U(Q)!=="sourceLocale")continue;let W=Q.value;if(W?.type!=="Literal"||typeof W.value!=="string")H("defineDictionary() sourceLocale must be a string literal.");return W.value}return}function p(q,H){let Q=!1;return X(q,(W)=>{if(Q)return;if(W.type==="FunctionDeclaration"&&W.id?.name===H)Q=!0;if(W.type==="VariableDeclarator"&&W.id?.name===H)Q=!0}),Q}function U(q){if(q?.type!=="Property"||q.computed)return null;if(q.key?.type==="Identifier")return q.key.name;if(q.key?.type==="Literal"&&typeof q.key.value==="string")return q.key.value;return null}function X(q,H){if(q===null||typeof q!=="object")return;if(Array.isArray(q)){for(let Q of q)X(Q,H);return}if(typeof q.type==="string")H(q);for(let Q of Object.keys(q)){if(Q==="parent")continue;let W=q[Q];if(W&&typeof W==="object")X(W,H)}}import{mkdir as u,writeFile as c}from"fs/promises";import{dirname as r,join as t}from"path";function k(q){let H;return{name:"gemi-plugin-asset-base",config:(Q,W)=>W.command==="build"&&q?{base:q}:void 0,configResolved(Q){H=Q},async writeBundle(Q){if(!H||H.command!=="build"||H.build.ssr||!Q.dir)return;let W=t(Q.dir,P);await u(r(W),{recursive:!0}),await c(W,`${JSON.stringify({assetBase:d(H.base)})}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Context } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The page's i18n, as much of it as an island on a static page gets (#1095):
|
|
4
|
+
* the locale strings resolve in and the zone dates are formatted in.
|
|
5
|
+
*/
|
|
6
|
+
export interface IslandI18n {
|
|
7
|
+
/** The page's resolved locale; absent when the app configures none. */
|
|
8
|
+
currentLocale?: string;
|
|
9
|
+
defaultLocale?: string;
|
|
10
|
+
/** The IANA zone dates are formatted in, resolved on the server. */
|
|
11
|
+
timeZone?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The key the island runtime (`h`) finds this context under. */
|
|
14
|
+
export declare const ISLAND_I18N_CONTEXT_KEY = "gemi.islandI18n";
|
|
15
|
+
/**
|
|
16
|
+
* @internal Provided around an island's own root on a static page: by the
|
|
17
|
+
* server while it renders the island, and by the island runtime when it
|
|
18
|
+
* hydrates it, from the document's `gemi-island-i18n` payload. `null`
|
|
19
|
+
* everywhere else.
|
|
20
|
+
*
|
|
21
|
+
* On `globalThis`, like `StaticRenderContext`: the runtime is plain source
|
|
22
|
+
* with no imports of gemi's, so it looks the context up by this key, and the
|
|
23
|
+
* published package bundles `gemi/client` and the server side separately.
|
|
24
|
+
*/
|
|
25
|
+
export declare const IslandI18nContext: Context<IslandI18n | null>;
|
|
26
|
+
/**
|
|
27
|
+
* @internal The page's i18n payload: the route's in a view, the island's own
|
|
28
|
+
* on a static page, where an island is a React root of its own and the
|
|
29
|
+
* route's does not reach it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function usePageI18n(): IslandI18n | undefined;
|
|
32
|
+
//# sourceMappingURL=IslandI18nContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IslandI18nContext.d.ts","sourceRoot":"","sources":["../../client/IslandI18nContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAA6B,MAAM,OAAO,CAAC;AAGhE;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,UAAU,GAAG,IAAI,CAEkB,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,UAAU,GAAG,SAAS,CAIpD"}
|
package/dist/client/index.js
CHANGED
|
@@ -2763,6 +2763,31 @@ function createFormatter(init) {
|
|
|
2763
2763
|
};
|
|
2764
2764
|
}
|
|
2765
2765
|
//#endregion
|
|
2766
|
+
//#region client/IslandI18nContext.ts
|
|
2767
|
+
/** The key the island runtime (`h`) finds this context under. */
|
|
2768
|
+
var ISLAND_I18N_CONTEXT_KEY = "gemi.islandI18n";
|
|
2769
|
+
/**
|
|
2770
|
+
* @internal Provided around an island's own root on a static page: by the
|
|
2771
|
+
* server while it renders the island, and by the island runtime when it
|
|
2772
|
+
* hydrates it, from the document's `gemi-island-i18n` payload. `null`
|
|
2773
|
+
* everywhere else.
|
|
2774
|
+
*
|
|
2775
|
+
* On `globalThis`, like `StaticRenderContext`: the runtime is plain source
|
|
2776
|
+
* with no imports of gemi's, so it looks the context up by this key, and the
|
|
2777
|
+
* published package bundles `gemi/client` and the server side separately.
|
|
2778
|
+
*/
|
|
2779
|
+
var IslandI18nContext = globalThis[Symbol.for(ISLAND_I18N_CONTEXT_KEY)] ??= createContext(null);
|
|
2780
|
+
/**
|
|
2781
|
+
* @internal The page's i18n payload: the route's in a view, the island's own
|
|
2782
|
+
* on a static page, where an island is a React root of its own and the
|
|
2783
|
+
* route's does not reach it.
|
|
2784
|
+
*/
|
|
2785
|
+
function usePageI18n() {
|
|
2786
|
+
const { i18n } = useRouteData();
|
|
2787
|
+
const island = useContext(IslandI18nContext);
|
|
2788
|
+
return i18n ?? island ?? void 0;
|
|
2789
|
+
}
|
|
2790
|
+
//#endregion
|
|
2766
2791
|
//#region client/useFormatter.ts
|
|
2767
2792
|
/**
|
|
2768
2793
|
* Format dates, numbers, relative times and lists in the active locale and the
|
|
@@ -2783,7 +2808,7 @@ function createFormatter(init) {
|
|
|
2783
2808
|
* Pass `options` to pin a zone for one subtree (`useFormatter({ timeZone })`).
|
|
2784
2809
|
*/
|
|
2785
2810
|
function useFormatter(options = {}) {
|
|
2786
|
-
const
|
|
2811
|
+
const i18n = usePageI18n();
|
|
2787
2812
|
const locale = options.locale ?? i18n?.currentLocale ?? i18n?.defaultLocale ?? "en-US";
|
|
2788
2813
|
const timeZone = options.timeZone ?? (isValidTimeZone(i18n?.timeZone) ? i18n.timeZone : "UTC");
|
|
2789
2814
|
return useMemo(() => createFormatter({
|
|
@@ -2814,7 +2839,7 @@ function useFormatter(options = {}) {
|
|
|
2814
2839
|
* Replaces `useTranslator`, which is deprecated.
|
|
2815
2840
|
*/
|
|
2816
2841
|
function useDictionary(dictionary) {
|
|
2817
|
-
const
|
|
2842
|
+
const i18n = usePageI18n();
|
|
2818
2843
|
const sink = useContext(DictionarySinkContext);
|
|
2819
2844
|
const locale = i18n?.currentLocale ?? dictionary.locales[0];
|
|
2820
2845
|
setActiveLocale(locale);
|
|
@@ -3125,10 +3150,10 @@ function island(loader, options = {}) {
|
|
|
3125
3150
|
const { children, ...rest } = props;
|
|
3126
3151
|
if (!isProduction()) assertSerialisableProps(rest, label);
|
|
3127
3152
|
const uid = `i${collector.count++}-`;
|
|
3128
|
-
const html = (loader.gemiModule ? Promise.resolve(pick(loader.gemiModule)) : loader().then(pick)).then((Component) => collector.render(createElement(StaticRenderContext.Provider, { value: null }, hasChildren(children) ? createElement(Component, rest, createElement(ISLAND_SLOT_TAG, {
|
|
3153
|
+
const html = (loader.gemiModule ? Promise.resolve(pick(loader.gemiModule)) : loader().then(pick)).then((Component) => collector.render(createElement(StaticRenderContext.Provider, { value: null }, createElement(IslandI18nContext.Provider, { value: collector.i18n }, createElement(DictionarySinkContext.Provider, { value: collector.sink }, hasChildren(children) ? createElement(Component, rest, createElement(ISLAND_SLOT_TAG, {
|
|
3129
3154
|
[ISLAND_SLOT_ATTRIBUTE]: uid,
|
|
3130
3155
|
style: { display: "contents" }
|
|
3131
|
-
})) : createElement(Component, rest)), uid));
|
|
3156
|
+
})) : createElement(Component, rest)))), uid));
|
|
3132
3157
|
html.catch(() => {});
|
|
3133
3158
|
const json = JSON.stringify(rest);
|
|
3134
3159
|
return {
|