gemi 0.173.0 → 0.175.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.
Files changed (45) hide show
  1. package/dist/bin/gemi.js +13 -2
  2. package/dist/bin/gemi.js.map +3 -3
  3. package/dist/{chunk-yeaftz5a.js → chunk-1670g2gy.js} +1 -1
  4. package/dist/{chunk-9pet8zmd.js → chunk-ewf24h4z.js} +13 -2
  5. package/dist/chunk-ewf24h4z.js.map +10 -0
  6. package/dist/chunk-k036qfj0.js +117 -0
  7. package/dist/{chunk-1pvfgfhj.js.map → chunk-k036qfj0.js.map} +11 -7
  8. package/dist/{chunk-eykb93pv.js → chunk-q1s9y4ce.js} +1 -1
  9. package/dist/{chunk-x2e20w8g.js → chunk-r5wtc9fw.js} +1 -1
  10. package/dist/{chunk-psmwxtf5.js → chunk-wf81wenb.js} +2 -2
  11. package/dist/{chunk-psmwxtf5.js.map → chunk-wf81wenb.js.map} +1 -1
  12. package/dist/{chunk-dxtry1gh.js → chunk-xnkx1kz8.js} +1 -1
  13. package/dist/{chunk-z58zh5gm.js → chunk-yc2w8x64.js} +1 -1
  14. package/dist/client/IslandI18nContext.d.ts +32 -0
  15. package/dist/client/IslandI18nContext.d.ts.map +1 -0
  16. package/dist/client/index.js +29 -4
  17. package/dist/client/index.js.map +1 -1
  18. package/dist/client/islands.d.ts +40 -2
  19. package/dist/client/islands.d.ts.map +1 -1
  20. package/dist/client/useDictionary.d.ts.map +1 -1
  21. package/dist/facades/index.js +1 -1
  22. package/dist/http/index.js +1 -1
  23. package/dist/i18n/index.js +1 -1
  24. package/dist/internal/islandRuntime.d.ts +10 -2
  25. package/dist/internal/islandRuntime.d.ts.map +1 -1
  26. package/dist/kernel/index.js +1 -1
  27. package/dist/server/index.js +1 -1
  28. package/dist/services/index.js +1 -1
  29. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  30. package/dist/services/router/config.d.ts +6 -0
  31. package/dist/services/router/config.d.ts.map +1 -1
  32. package/dist/services/router/staticDocument.d.ts +10 -0
  33. package/dist/services/router/staticDocument.d.ts.map +1 -1
  34. package/dist/testing/index.js +20 -1
  35. package/dist/testing/index.js.map +1 -1
  36. package/dist/vite/index.mjs +12 -1
  37. package/dist/vitest/index.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-1pvfgfhj.js +0 -117
  40. package/dist/chunk-9pet8zmd.js.map +0 -10
  41. /package/dist/{chunk-yeaftz5a.js.map → chunk-1670g2gy.js.map} +0 -0
  42. /package/dist/{chunk-eykb93pv.js.map → chunk-q1s9y4ce.js.map} +0 -0
  43. /package/dist/{chunk-x2e20w8g.js.map → chunk-r5wtc9fw.js.map} +0 -0
  44. /package/dist/{chunk-dxtry1gh.js.map → chunk-xnkx1kz8.js.map} +0 -0
  45. /package/dist/{chunk-z58zh5gm.js.map → chunk-yc2w8x64.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{X as y,Y as IJ,Z as NJ,_ as FJ}from"./chunk-psmwxtf5.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-1pvfgfhj.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-9pet8zmd.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>
2
+ import{X as y,Y as IJ,Z as NJ,_ as FJ}from"./chunk-wf81wenb.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-k036qfj0.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" />
@@ -22,7 +22,18 @@ export { h } from ${JSON.stringify("virtual:gemi-island-runtime")};
22
22
  dangerouslySetInnerHTML: { __html: slot.innerHTML },
23
23
  })]
24
24
  : [];
25
- return hydrateRoot(marker, createElement(Component, props, ...children), {
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=E33096164F38A2D164756E2164756E21
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
+ }