gemi 0.107.0 → 0.109.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 (217) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/app/index.js +1 -1
  4. package/dist/bin/gemi.js +242 -33
  5. package/dist/bin/gemi.js.map +9 -7
  6. package/dist/bun/plugin.js +1 -1
  7. package/dist/bun/preload.js +1 -1
  8. package/dist/{chunk-9jz4rggd.js → chunk-1es50p4k.js} +2 -2
  9. package/dist/{chunk-9jz4rggd.js.map → chunk-1es50p4k.js.map} +1 -1
  10. package/dist/{chunk-2gmgd05c.js → chunk-367kyrdx.js} +2 -2
  11. package/dist/{chunk-2gmgd05c.js.map → chunk-367kyrdx.js.map} +1 -1
  12. package/dist/{chunk-h7pafjej.js → chunk-3x86bhfn.js} +3 -3
  13. package/dist/{chunk-h7pafjej.js.map → chunk-3x86bhfn.js.map} +1 -1
  14. package/dist/{chunk-kda25fn4.js → chunk-52vsdnny.js} +1 -1
  15. package/dist/{chunk-m31pfz1s.js → chunk-5d6eaxab.js} +2 -2
  16. package/dist/{chunk-m31pfz1s.js.map → chunk-5d6eaxab.js.map} +1 -1
  17. package/dist/{chunk-njkk498k.js → chunk-6zekebzt.js} +2 -2
  18. package/dist/{chunk-njkk498k.js.map → chunk-6zekebzt.js.map} +1 -1
  19. package/dist/{chunk-00y49jcf.js → chunk-7mc5e61r.js} +2 -2
  20. package/dist/{chunk-00y49jcf.js.map → chunk-7mc5e61r.js.map} +1 -1
  21. package/dist/{chunk-47rgq59q.js → chunk-7ssjzp87.js} +2 -2
  22. package/dist/{chunk-47rgq59q.js.map → chunk-7ssjzp87.js.map} +1 -1
  23. package/dist/{chunk-5wt25tyd.js → chunk-9m18pknp.js} +2 -2
  24. package/dist/{chunk-5wt25tyd.js.map → chunk-9m18pknp.js.map} +1 -1
  25. package/dist/{chunk-vj2t77x1.js → chunk-9qw9fa6z.js} +2 -2
  26. package/dist/{chunk-vj2t77x1.js.map → chunk-9qw9fa6z.js.map} +1 -1
  27. package/dist/{chunk-v52dyw0q.js → chunk-c8dhvdrs.js} +2 -2
  28. package/dist/{chunk-v52dyw0q.js.map → chunk-c8dhvdrs.js.map} +1 -1
  29. package/dist/{chunk-kstvyvr0.js → chunk-d2tngs73.js} +2 -2
  30. package/dist/{chunk-kstvyvr0.js.map → chunk-d2tngs73.js.map} +1 -1
  31. package/dist/{chunk-q7y9v2v5.js → chunk-d5sbnzng.js} +13 -13
  32. package/dist/{chunk-q7y9v2v5.js.map → chunk-d5sbnzng.js.map} +5 -4
  33. package/dist/{chunk-1npdp1w2.js → chunk-dpy08xw4.js} +2 -2
  34. package/dist/{chunk-1npdp1w2.js.map → chunk-dpy08xw4.js.map} +1 -1
  35. package/dist/{chunk-h3t4n0bn.js → chunk-ehasw3qm.js} +2 -2
  36. package/dist/{chunk-h3t4n0bn.js.map → chunk-ehasw3qm.js.map} +1 -1
  37. package/dist/{chunk-331s9wqr.js → chunk-eyg88bgv.js} +2 -2
  38. package/dist/{chunk-331s9wqr.js.map → chunk-eyg88bgv.js.map} +1 -1
  39. package/dist/{chunk-fq3sb3xt.js → chunk-f7jhkg8x.js} +3 -3
  40. package/dist/{chunk-fq3sb3xt.js.map → chunk-f7jhkg8x.js.map} +1 -1
  41. package/dist/chunk-fe1pcnw6.js +6 -0
  42. package/dist/chunk-fe1pcnw6.js.map +11 -0
  43. package/dist/chunk-fj6yftm7.js +58 -0
  44. package/dist/{chunk-6zqqec7r.js.map → chunk-fj6yftm7.js.map} +3 -3
  45. package/dist/{chunk-vbm1ng3f.js → chunk-g5a3ptsa.js} +2 -2
  46. package/dist/{chunk-vbm1ng3f.js.map → chunk-g5a3ptsa.js.map} +1 -1
  47. package/dist/{chunk-2q7m8a16.js → chunk-g74qwhvf.js} +2 -2
  48. package/dist/{chunk-2q7m8a16.js.map → chunk-g74qwhvf.js.map} +1 -1
  49. package/dist/{chunk-eytdyahy.js → chunk-g7fr2cy2.js} +2 -2
  50. package/dist/{chunk-eytdyahy.js.map → chunk-g7fr2cy2.js.map} +1 -1
  51. package/dist/{chunk-yebaheh7.js → chunk-ga533cpz.js} +2 -2
  52. package/dist/{chunk-yebaheh7.js.map → chunk-ga533cpz.js.map} +1 -1
  53. package/dist/{chunk-q2fyp44f.js → chunk-gdsby5jh.js} +2 -2
  54. package/dist/{chunk-q2fyp44f.js.map → chunk-gdsby5jh.js.map} +1 -1
  55. package/dist/{chunk-sbyqs03h.js → chunk-grs8dnkd.js} +2 -2
  56. package/dist/{chunk-sbyqs03h.js.map → chunk-grs8dnkd.js.map} +1 -1
  57. package/dist/{chunk-k17prwhx.js → chunk-h15eae7g.js} +2 -2
  58. package/dist/{chunk-k17prwhx.js.map → chunk-h15eae7g.js.map} +1 -1
  59. package/dist/{chunk-9mqqr05d.js → chunk-h6g9g8qc.js} +3 -3
  60. package/dist/{chunk-9mqqr05d.js.map → chunk-h6g9g8qc.js.map} +1 -1
  61. package/dist/{chunk-82hpq0bq.js → chunk-hf32yq23.js} +2 -2
  62. package/dist/{chunk-82hpq0bq.js.map → chunk-hf32yq23.js.map} +1 -1
  63. package/dist/{chunk-xpyhmg45.js → chunk-hgz8sx40.js} +2 -2
  64. package/dist/{chunk-3s3awh38.js.map → chunk-hgz8sx40.js.map} +1 -1
  65. package/dist/{chunk-8pynv9rw.js → chunk-jc4j61xb.js} +2 -2
  66. package/dist/{chunk-8pynv9rw.js.map → chunk-jc4j61xb.js.map} +1 -1
  67. package/dist/{chunk-h4x7cba0.js → chunk-jgtean4t.js} +2 -2
  68. package/dist/{chunk-h4x7cba0.js.map → chunk-jgtean4t.js.map} +1 -1
  69. package/dist/{chunk-6rz8kyqb.js → chunk-jm4jn28j.js} +2 -2
  70. package/dist/{chunk-6rz8kyqb.js.map → chunk-jm4jn28j.js.map} +1 -1
  71. package/dist/{chunk-jnw73s8c.js → chunk-k1ezptt8.js} +2 -2
  72. package/dist/{chunk-jnw73s8c.js.map → chunk-k1ezptt8.js.map} +1 -1
  73. package/dist/{chunk-xg9vye7c.js → chunk-m9609t1y.js} +1 -1
  74. package/dist/{chunk-mhq2bd9c.js → chunk-mp5krm14.js} +3 -3
  75. package/dist/{chunk-mhq2bd9c.js.map → chunk-mp5krm14.js.map} +1 -1
  76. package/dist/{chunk-k9qmr2wa.js → chunk-ngw4xzrt.js} +3 -3
  77. package/dist/{chunk-k9qmr2wa.js.map → chunk-ngw4xzrt.js.map} +1 -1
  78. package/dist/{chunk-ydkjf626.js → chunk-nxxx0m1a.js} +2 -2
  79. package/dist/{chunk-ydkjf626.js.map → chunk-nxxx0m1a.js.map} +1 -1
  80. package/dist/{chunk-rn2kgbg4.js → chunk-pa3khk46.js} +2 -2
  81. package/dist/{chunk-rn2kgbg4.js.map → chunk-pa3khk46.js.map} +1 -1
  82. package/dist/{chunk-wsftnxzs.js → chunk-q8k7f11z.js} +2 -2
  83. package/dist/{chunk-wsftnxzs.js.map → chunk-q8k7f11z.js.map} +1 -1
  84. package/dist/{chunk-rjernda5.js → chunk-qnq110tw.js} +2 -2
  85. package/dist/{chunk-rjernda5.js.map → chunk-qnq110tw.js.map} +1 -1
  86. package/dist/{chunk-ftgd68se.js → chunk-qyyxzy04.js} +2 -2
  87. package/dist/{chunk-ftgd68se.js.map → chunk-qyyxzy04.js.map} +1 -1
  88. package/dist/{chunk-pj2e1p07.js → chunk-qz9aaw5x.js} +2 -2
  89. package/dist/{chunk-pj2e1p07.js.map → chunk-qz9aaw5x.js.map} +1 -1
  90. package/dist/{chunk-2xqrh6d0.js → chunk-r9gzbjc5.js} +1 -1
  91. package/dist/{chunk-wedwkqe7.js → chunk-rgfzqwpg.js} +3 -3
  92. package/dist/{chunk-wedwkqe7.js.map → chunk-rgfzqwpg.js.map} +1 -1
  93. package/dist/{chunk-hdhahvd4.js → chunk-rjcsdazt.js} +2 -2
  94. package/dist/{chunk-hdhahvd4.js.map → chunk-rjcsdazt.js.map} +1 -1
  95. package/dist/chunk-s5aa4hty.js +17 -0
  96. package/dist/{chunk-5mj7a141.js.map → chunk-s5aa4hty.js.map} +9 -7
  97. package/dist/{chunk-rh9j8cwv.js → chunk-sp2v357a.js} +3 -3
  98. package/dist/{chunk-rh9j8cwv.js.map → chunk-sp2v357a.js.map} +1 -1
  99. package/dist/{chunk-cfsscms3.js → chunk-t0bp8nrc.js} +4 -4
  100. package/dist/{chunk-cfsscms3.js.map → chunk-t0bp8nrc.js.map} +1 -1
  101. package/dist/{chunk-kqff894s.js → chunk-t3qw9syt.js} +2 -2
  102. package/dist/{chunk-kqff894s.js.map → chunk-t3qw9syt.js.map} +1 -1
  103. package/dist/{chunk-zrdbytx4.js → chunk-t85rca2p.js} +2 -2
  104. package/dist/{chunk-zrdbytx4.js.map → chunk-t85rca2p.js.map} +1 -1
  105. package/dist/{chunk-tyhrrnp5.js → chunk-tr9mxdth.js} +3 -3
  106. package/dist/{chunk-tyhrrnp5.js.map → chunk-tr9mxdth.js.map} +1 -1
  107. package/dist/{chunk-6wrhc9bq.js → chunk-vee4j6ft.js} +2 -2
  108. package/dist/{chunk-6wrhc9bq.js.map → chunk-vee4j6ft.js.map} +1 -1
  109. package/dist/{chunk-kqz8jp6v.js → chunk-vna85rdq.js} +2 -2
  110. package/dist/{chunk-kqz8jp6v.js.map → chunk-vna85rdq.js.map} +1 -1
  111. package/dist/{chunk-4rr9wmh8.js → chunk-vsnmdtrs.js} +2 -2
  112. package/dist/{chunk-4rr9wmh8.js.map → chunk-vsnmdtrs.js.map} +1 -1
  113. package/dist/{chunk-anp4kv3w.js → chunk-vwkdfngg.js} +1 -1
  114. package/dist/chunk-w3j53r0a.js +24 -0
  115. package/dist/chunk-w3j53r0a.js.map +19 -0
  116. package/dist/{chunk-gqpge54c.js → chunk-wdpdqjr1.js} +2 -2
  117. package/dist/{chunk-gqpge54c.js.map → chunk-wdpdqjr1.js.map} +1 -1
  118. package/dist/{chunk-wzqkdmjd.js → chunk-whe0x70j.js} +2 -2
  119. package/dist/{chunk-wzqkdmjd.js.map → chunk-whe0x70j.js.map} +1 -1
  120. package/dist/{chunk-1rs13253.js → chunk-wqsdjweb.js} +3 -3
  121. package/dist/{chunk-1rs13253.js.map → chunk-wqsdjweb.js.map} +1 -1
  122. package/dist/{chunk-3s3awh38.js → chunk-wvwee7dn.js} +2 -2
  123. package/dist/{chunk-xpyhmg45.js.map → chunk-wvwee7dn.js.map} +1 -1
  124. package/dist/{chunk-ffagkj3x.js → chunk-y66ntxbg.js} +2 -2
  125. package/dist/{chunk-ffagkj3x.js.map → chunk-y66ntxbg.js.map} +1 -1
  126. package/dist/chunk-z9x8x3wq.js +5 -0
  127. package/dist/{chunk-mrvcaakf.js.map → chunk-z9x8x3wq.js.map} +1 -1
  128. package/dist/{chunk-we2sj339.js → chunk-zh1t33nq.js} +2 -2
  129. package/dist/{chunk-we2sj339.js.map → chunk-zh1t33nq.js.map} +1 -1
  130. package/dist/{chunk-661wezaf.js → chunk-zhm3qvrc.js} +2 -2
  131. package/dist/{chunk-661wezaf.js.map → chunk-zhm3qvrc.js.map} +1 -1
  132. package/dist/{chunk-kh273hj0.js → chunk-zys7kecf.js} +2 -2
  133. package/dist/{chunk-kh273hj0.js.map → chunk-zys7kecf.js.map} +1 -1
  134. package/dist/{chunk-fwympxqk.js → chunk-zz7h6tdr.js} +2 -2
  135. package/dist/{chunk-fwympxqk.js.map → chunk-zz7h6tdr.js.map} +1 -1
  136. package/dist/chunks/{ThemeProvider-Cqfwr6dk.js → ThemeProvider-BgLyzzOL.js} +8 -2
  137. package/dist/chunks/ThemeProvider-BgLyzzOL.js.map +1 -0
  138. package/dist/client/ClientRouter.d.ts +2 -0
  139. package/dist/client/ClientRouter.d.ts.map +1 -1
  140. package/dist/client/ClientRouterContext.d.ts.map +1 -1
  141. package/dist/client/ServerDataProvider.d.ts +2 -0
  142. package/dist/client/ServerDataProvider.d.ts.map +1 -1
  143. package/dist/client/createRoot.d.ts.map +1 -1
  144. package/dist/client/index.d.ts +2 -0
  145. package/dist/client/index.d.ts.map +1 -1
  146. package/dist/client/index.js +76 -6
  147. package/dist/client/index.js.map +1 -1
  148. package/dist/client/islands.d.ts +84 -0
  149. package/dist/client/islands.d.ts.map +1 -0
  150. package/dist/config/index.js +1 -1
  151. package/dist/console/run.js +2 -2
  152. package/dist/console/run.js.map +1 -1
  153. package/dist/container/index.js +2 -2
  154. package/dist/container/index.js.map +1 -1
  155. package/dist/database/index.js +2 -2
  156. package/dist/database/index.js.map +1 -1
  157. package/dist/email/index.js +2 -2
  158. package/dist/email/index.js.map +1 -1
  159. package/dist/facades/index.js +2 -2
  160. package/dist/facades/index.js.map +1 -1
  161. package/dist/foundation/index.js +2 -2
  162. package/dist/foundation/index.js.map +1 -1
  163. package/dist/http/ViewRouter.d.ts +38 -0
  164. package/dist/http/ViewRouter.d.ts.map +1 -1
  165. package/dist/http/index.d.ts +1 -1
  166. package/dist/http/index.d.ts.map +1 -1
  167. package/dist/http/index.js +2 -2
  168. package/dist/http/index.js.map +1 -1
  169. package/dist/i18n/dictionaryRuntime.js +2 -2
  170. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  171. package/dist/i18n/index.js +2 -2
  172. package/dist/i18n/index.js.map +1 -1
  173. package/dist/kernel/index.js +2 -2
  174. package/dist/kernel/index.js.map +1 -1
  175. package/dist/orm/index.js +2 -2
  176. package/dist/orm/index.js.map +1 -1
  177. package/dist/server/devFetch.d.ts.map +1 -1
  178. package/dist/server/httpProd.d.ts.map +1 -1
  179. package/dist/server/index.js +2 -2
  180. package/dist/server/index.js.map +1 -1
  181. package/dist/server/modulePreloads.d.ts +17 -0
  182. package/dist/server/modulePreloads.d.ts.map +1 -1
  183. package/dist/server/staticFile.d.ts +20 -1
  184. package/dist/server/staticFile.d.ts.map +1 -1
  185. package/dist/server/styles.d.ts +3 -1
  186. package/dist/server/styles.d.ts.map +1 -1
  187. package/dist/services/index.d.ts +1 -0
  188. package/dist/services/index.d.ts.map +1 -1
  189. package/dist/services/index.js +3 -3
  190. package/dist/services/index.js.map +2 -2
  191. package/dist/services/queue/work.js +2 -2
  192. package/dist/services/queue/work.js.map +1 -1
  193. package/dist/services/router/ViewRouteDispatcher.d.ts +27 -1
  194. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  195. package/dist/services/router/createComponentTree.d.ts.map +1 -1
  196. package/dist/services/router/createFlatViewRoutes.d.ts +13 -1
  197. package/dist/services/router/createFlatViewRoutes.d.ts.map +1 -1
  198. package/dist/services/router/staticDocument.d.ts +44 -0
  199. package/dist/services/router/staticDocument.d.ts.map +1 -0
  200. package/dist/support/index.js +2 -2
  201. package/dist/support/index.js.map +1 -1
  202. package/dist/testing/index.js +1 -1
  203. package/dist/vite/index.mjs +72 -3
  204. package/dist/vitest/index.js +1 -1
  205. package/package.json +1 -1
  206. package/dist/chunk-5mj7a141.js +0 -17
  207. package/dist/chunk-6tyf0h6k.js +0 -24
  208. package/dist/chunk-6tyf0h6k.js.map +0 -18
  209. package/dist/chunk-6zqqec7r.js +0 -58
  210. package/dist/chunk-mrvcaakf.js +0 -5
  211. package/dist/chunk-z38355mx.js +0 -6
  212. package/dist/chunk-z38355mx.js.map +0 -11
  213. package/dist/chunks/ThemeProvider-Cqfwr6dk.js.map +0 -1
  214. /package/dist/{chunk-kda25fn4.js.map → chunk-52vsdnny.js.map} +0 -0
  215. /package/dist/{chunk-xg9vye7c.js.map → chunk-m9609t1y.js.map} +0 -0
  216. /package/dist/{chunk-2xqrh6d0.js.map → chunk-r9gzbjc5.js.map} +0 -0
  217. /package/dist/{chunk-anp4kv3w.js.map → chunk-vwkdfngg.js.map} +0 -0
package/dist/app/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{za as a}from"../chunk-wsftnxzs.js";import"../chunk-82hpq0bq.js";import"../chunk-3s3awh38.js";export{a as App};
2
+ import{za as a}from"../chunk-q8k7f11z.js";import"../chunk-hf32yq23.js";import"../chunk-wvwee7dn.js";export{a as App};
3
3
 
4
4
  //# debugId=EB7487A2EF3436A164756E2164756E21
package/dist/bin/gemi.js CHANGED
@@ -36002,10 +36002,10 @@ function extractAgent(ts, reference, { cwd = process.cwd(), name } = {}) {
36002
36002
  ].join(`
36003
36003
  `);
36004
36004
  const host = ts.createCompilerHost(options);
36005
- const { getSourceFile, fileExists, readFile: readFile2 } = host;
36005
+ const { getSourceFile, fileExists, readFile: readFile3 } = host;
36006
36006
  host.getSourceFile = (fileName, languageVersion, ...rest) => fileName === probe ? ts.createSourceFile(fileName, source, languageVersion) : getSourceFile.call(host, fileName, languageVersion, ...rest);
36007
36007
  host.fileExists = (fileName) => fileName === probe || fileExists.call(host, fileName);
36008
- host.readFile = (fileName) => fileName === probe ? source : readFile2.call(host, fileName);
36008
+ host.readFile = (fileName) => fileName === probe ? source : readFile3.call(host, fileName);
36009
36009
  const second = ts.createProgram({ rootNames: [file, probe], options, host, oldProgram: first });
36010
36010
  const probeFile = second.getSourceFile(probe);
36011
36011
  const alias = (aliasName) => {
@@ -36067,8 +36067,8 @@ function exportedType(ts, checker, sourceFile, reference) {
36067
36067
  return { type: checker.getTypeOfSymbolAtLocation(symbol, sourceFile), name: symbol.getName() };
36068
36068
  }
36069
36069
  function specifier(from, to) {
36070
- const relative4 = path7.relative(path7.dirname(from), to).split(path7.sep).join("/").replace(/(\.d)?\.(ts|tsx|mts|cts)$/, "");
36071
- return relative4.startsWith(".") ? relative4 : `./${relative4}`;
36070
+ const relative5 = path7.relative(path7.dirname(from), to).split(path7.sep).join("/").replace(/(\.d)?\.(ts|tsx|mts|cts)$/, "");
36071
+ return relative5.startsWith(".") ? relative5 : `./${relative5}`;
36072
36072
  }
36073
36073
  function isFrameworkJsonValue(type) {
36074
36074
  const alias = type.aliasSymbol;
@@ -36748,8 +36748,16 @@ async function createRollupInput_default(appDir) {
36748
36748
  continue;
36749
36749
  if (/\.(test|spec)\.tsx$/.test(file))
36750
36750
  continue;
36751
+ if (/\.island\.tsx$/.test(file))
36752
+ continue;
36751
36753
  entries.add(`/app/views/${file}`);
36752
36754
  }
36755
+ const islandGlob = new Glob("**/*.island.{ts,tsx,js,jsx,mts,mjs}");
36756
+ for await (const file of islandGlob.scan({ cwd: appDir })) {
36757
+ if (file.split("/").includes("node_modules"))
36758
+ continue;
36759
+ entries.add(`/app/${file}`);
36760
+ }
36753
36761
  return Array.from(entries);
36754
36762
  }
36755
36763
 
@@ -40088,6 +40096,55 @@ function documentBase(base) {
40088
40096
  return base.startsWith("/") || /^[a-z][a-z\d+.-]*:\/\//i.test(base) ? normalizeAssetBase(base) : DEFAULT_ASSET_BASE;
40089
40097
  }
40090
40098
 
40099
+ // vite/islandPlugin.ts
40100
+ import { realpathSync } from "fs";
40101
+ import { relative, sep } from "path";
40102
+ var ISLAND_LOADER = /\(\s*\)\s*=>\s*import\(\s*(["'])([^"'\n]+?\.island(?:\.[cm]?[jt]sx?)?)\1\s*\)/g;
40103
+ function realPath(path3) {
40104
+ try {
40105
+ return realpathSync(path3);
40106
+ } catch {
40107
+ return path3;
40108
+ }
40109
+ }
40110
+ function gemiIslandPlugin() {
40111
+ let root = process.cwd();
40112
+ return {
40113
+ name: "gemi-plugin-islands",
40114
+ enforce: "pre",
40115
+ configResolved(config) {
40116
+ root = realPath(config.root);
40117
+ },
40118
+ async transform(code, id, options) {
40119
+ if (id.includes("/node_modules/") || id.startsWith("\x00"))
40120
+ return null;
40121
+ if (!/\.[cm]?[jt]sx?$/.test(id.split("?")[0]))
40122
+ return null;
40123
+ if (!code.includes(".island"))
40124
+ return null;
40125
+ const ssr = Boolean(options?.ssr) || this.environment?.config?.consumer === "server";
40126
+ const s = new MagicString(code);
40127
+ let changed = false;
40128
+ for (const match of code.matchAll(ISLAND_LOADER)) {
40129
+ const [whole, quote, specifier] = match;
40130
+ const resolved = await this.resolve(specifier, id);
40131
+ if (!resolved || resolved.external)
40132
+ continue;
40133
+ const file = realPath(resolved.id.split("?")[0]);
40134
+ const key = relative(root, file).split(sep).join("/");
40135
+ if (key.startsWith(".."))
40136
+ continue;
40137
+ const loader = ssr ? `() => Promise.reject(new Error("Island modules load in the browser."))` : `() => import(${quote}${specifier}${quote})`;
40138
+ s.overwrite(match.index, match.index + whole.length, `Object.assign(${loader}, { gemiIsland: ${JSON.stringify(key)} })`);
40139
+ changed = true;
40140
+ }
40141
+ if (!changed)
40142
+ return null;
40143
+ return { code: s.toString(), map: s.generateMap({ hires: true }) };
40144
+ }
40145
+ };
40146
+ }
40147
+
40091
40148
  // vite/index.ts
40092
40149
  var gemi = async () => {
40093
40150
  const userConfig = await loadGemiConfig(process.cwd());
@@ -40106,7 +40163,7 @@ var gemi = async () => {
40106
40163
  ssrEmitAssets: true,
40107
40164
  sourcemap: true,
40108
40165
  rollupOptions: {
40109
- input: Array.from(JSON.parse(process.env.GEMI_INPUT ?? "[]")),
40166
+ input: Array.from(JSON.parse(process.env.GEMI_INPUT ?? "[]")).filter((entry) => !(env.isSsrBuild && /\.island\.[cm]?[jt]sx?$/.test(entry))),
40110
40167
  preserveEntrySignatures: "strict",
40111
40168
  ...env.isSsrBuild ? { external: isGemiExternal } : {}
40112
40169
  }
@@ -40124,6 +40181,7 @@ var gemi = async () => {
40124
40181
  config: () => userViteConfig
40125
40182
  },
40126
40183
  gemiAssetBasePlugin(assetBase),
40184
+ gemiIslandPlugin(),
40127
40185
  {
40128
40186
  name: "gemi-plugin-hot-reload",
40129
40187
  handleHotUpdate({ server, modules }) {
@@ -40140,7 +40198,7 @@ var vite_default = gemi;
40140
40198
 
40141
40199
  // vite/previousAssets.ts
40142
40200
  import { copyFile, lstat, mkdir as mkdir2, readdir, readFile, stat, writeFile as writeFile2 } from "fs/promises";
40143
- import { dirname as dirname2, isAbsolute, join as join4, relative, resolve, sep } from "path";
40201
+ import { dirname as dirname2, isAbsolute, join as join4, relative as relative2, resolve, sep as sep2 } from "path";
40144
40202
  var PREVIOUS_ASSETS_RECORD = ".vite/previous-assets.json";
40145
40203
  var DEFAULT_RETAINED_RELEASES = 2;
40146
40204
  var DEFAULT_RETAINED_MAX_AGE_SECONDS = 7 * 24 * 60 * 60;
@@ -40174,7 +40232,9 @@ async function stagePreviousAssets(options, stagingDir, now = new Date) {
40174
40232
  }
40175
40233
  const carried = await readRecord(from);
40176
40234
  const carriedFiles = new Set(carried.flatMap((release) => release.files));
40177
- const own = (await listFiles(from, ASSETS_DIR)).filter((file) => isCarriable(file) && !carriedFiles.has(file));
40235
+ const listed = await listFiles(from, ASSETS_DIR);
40236
+ const listedSet = new Set(listed);
40237
+ const own = listed.filter((file) => isCarriable(file) && !carriedFiles.has(file) && !isSiblingIn(file, listedSet));
40178
40238
  const releases = [
40179
40239
  { retiredAt: now.toISOString(), files: own },
40180
40240
  ...carried.filter((release) => now.getTime() - Date.parse(release.retiredAt) < options.maxAgeMs)
@@ -40190,6 +40250,7 @@ async function stagePreviousAssets(options, stagingDir, now = new Date) {
40190
40250
  const target = join4(stagingDir, file);
40191
40251
  await mkdir2(dirname2(target), { recursive: true });
40192
40252
  await copyFile(source, target);
40253
+ await copySiblings(source, target);
40193
40254
  files.push(file);
40194
40255
  }
40195
40256
  if (files.length > 0) {
@@ -40200,6 +40261,7 @@ async function stagePreviousAssets(options, stagingDir, now = new Date) {
40200
40261
  }
40201
40262
  async function restorePreviousAssets(stagingDir, clientDir, releases) {
40202
40263
  const record = [];
40264
+ const paths = [];
40203
40265
  let count = 0;
40204
40266
  for (const release of releases) {
40205
40267
  const files = [];
@@ -40210,7 +40272,9 @@ async function restorePreviousAssets(stagingDir, clientDir, releases) {
40210
40272
  }
40211
40273
  await mkdir2(dirname2(target), { recursive: true });
40212
40274
  await copyFile(join4(stagingDir, file), target);
40275
+ await copySiblings(join4(stagingDir, file), target);
40213
40276
  files.push(file);
40277
+ paths.push(file);
40214
40278
  }
40215
40279
  if (files.length > 0) {
40216
40280
  record.push({ retiredAt: release.retiredAt, files });
@@ -40221,7 +40285,19 @@ async function restorePreviousAssets(stagingDir, clientDir, releases) {
40221
40285
  await mkdir2(dirname2(recordPath), { recursive: true });
40222
40286
  await writeFile2(recordPath, `${JSON.stringify({ releases: record }, null, 2)}
40223
40287
  `);
40224
- return { files: count, releases: record.length };
40288
+ return { files: count, releases: record.length, paths };
40289
+ }
40290
+ var SIBLING_SUFFIXES = [".br", ".gz"];
40291
+ function isSiblingIn(file, files) {
40292
+ const suffix = SIBLING_SUFFIXES.find((ext) => file.endsWith(ext));
40293
+ return suffix !== undefined && files.has(file.slice(0, -suffix.length));
40294
+ }
40295
+ async function copySiblings(source, target) {
40296
+ for (const ext of SIBLING_SUFFIXES) {
40297
+ if (await isFile(source + ext)) {
40298
+ await copyFile(source + ext, target + ext);
40299
+ }
40300
+ }
40225
40301
  }
40226
40302
  async function readRecord(clientDir) {
40227
40303
  let raw;
@@ -40256,8 +40332,8 @@ function isCarriable(file) {
40256
40332
  }
40257
40333
  function inside(root, file) {
40258
40334
  const path3 = resolve(root, file);
40259
- const rel2 = relative(root, path3);
40260
- return rel2 && !rel2.startsWith("..") && !isAbsolute(rel2) && rel2.split(sep)[0] === ASSETS_DIR ? path3 : null;
40335
+ const rel2 = relative2(root, path3);
40336
+ return rel2 && !rel2.startsWith("..") && !isAbsolute(rel2) && rel2.split(sep2)[0] === ASSETS_DIR ? path3 : null;
40261
40337
  }
40262
40338
  async function isDirectory(path3) {
40263
40339
  try {
@@ -40282,6 +40358,115 @@ async function exists(path3) {
40282
40358
  }
40283
40359
  }
40284
40360
 
40361
+ // vite/precompressAssets.ts
40362
+ import { mkdir as mkdir3, readFile as readFile2, stat as stat2, writeFile as writeFile3 } from "fs/promises";
40363
+ import { availableParallelism } from "os";
40364
+ import { dirname as dirname3, join as join5 } from "path";
40365
+ import { promisify } from "util";
40366
+ import { brotliCompress, constants, gzip } from "zlib";
40367
+ var STATIC_ASSETS_RECORD = ".vite/static-assets.json";
40368
+ var PRECOMPRESS_MIN_BYTES = 1024;
40369
+ var COMPRESSIBLE = /\.(?:m?js|cjs|css|svg|json|webmanifest|wasm|txt|xml|ttf|otf|eot)$/i;
40370
+ var TEXT = /\.(?:m?js|cjs|css|svg|json|webmanifest|txt|xml)$/i;
40371
+ var FONT = /\.(?:ttf|otf|eot)$/i;
40372
+ var SIBLING_EXTENSION = {
40373
+ br: ".br",
40374
+ gzip: ".gz"
40375
+ };
40376
+ var ENCODINGS = ["br", "gzip"];
40377
+ var brotli = promisify(brotliCompress);
40378
+ var gzipAsync = promisify(gzip);
40379
+ function isPrecompressible(file) {
40380
+ return COMPRESSIBLE.test(file);
40381
+ }
40382
+ async function encode2(encoding, file, input) {
40383
+ if (encoding === "gzip") {
40384
+ return gzipAsync(input, { level: 9 });
40385
+ }
40386
+ return brotli(input, {
40387
+ params: {
40388
+ [constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MAX_QUALITY,
40389
+ [constants.BROTLI_PARAM_MODE]: TEXT.test(file) ? constants.BROTLI_MODE_TEXT : FONT.test(file) ? constants.BROTLI_MODE_FONT : constants.BROTLI_MODE_GENERIC,
40390
+ [constants.BROTLI_PARAM_SIZE_HINT]: input.length
40391
+ }
40392
+ });
40393
+ }
40394
+ async function fileSize(path3) {
40395
+ try {
40396
+ const info = await stat2(path3);
40397
+ return info.isFile() ? info.size : null;
40398
+ } catch {
40399
+ return null;
40400
+ }
40401
+ }
40402
+ async function precompressAssets(clientDir, files, options = {}) {
40403
+ const minBytes = options.minBytes ?? PRECOMPRESS_MIN_BYTES;
40404
+ const record = { files: {} };
40405
+ const stats = {
40406
+ files: 0,
40407
+ identityBytes: 0,
40408
+ brBytes: 0,
40409
+ gzipBytes: 0
40410
+ };
40411
+ const queue = [...new Set(files)];
40412
+ for (const file of queue) {
40413
+ record.files[file] = [];
40414
+ }
40415
+ async function work(file) {
40416
+ if (!isPrecompressible(file)) {
40417
+ return;
40418
+ }
40419
+ const path3 = join5(clientDir, file);
40420
+ const size = await fileSize(path3);
40421
+ if (size === null || size < minBytes) {
40422
+ return;
40423
+ }
40424
+ let input = null;
40425
+ const available = [];
40426
+ const sizes = {};
40427
+ for (const encoding of ENCODINGS) {
40428
+ const siblingPath = path3 + SIBLING_EXTENSION[encoding];
40429
+ const existing = options.reuseExisting ? await fileSize(siblingPath) : null;
40430
+ if (existing !== null) {
40431
+ if (existing < size) {
40432
+ available.push(encoding);
40433
+ sizes[encoding] = existing;
40434
+ }
40435
+ continue;
40436
+ }
40437
+ input ??= await readFile2(path3);
40438
+ const output = await encode2(encoding, file, input);
40439
+ if (output.length < size) {
40440
+ await writeFile3(siblingPath, output);
40441
+ available.push(encoding);
40442
+ sizes[encoding] = output.length;
40443
+ }
40444
+ }
40445
+ record.files[file] = available;
40446
+ if (available.length > 0) {
40447
+ stats.files += 1;
40448
+ stats.identityBytes += size;
40449
+ stats.brBytes += sizes.br ?? size;
40450
+ stats.gzipBytes += sizes.gzip ?? size;
40451
+ }
40452
+ }
40453
+ const concurrency = Math.max(1, options.concurrency ?? Math.min(8, availableParallelism()));
40454
+ let next = 0;
40455
+ await Promise.all(Array.from({ length: Math.min(concurrency, queue.length) }, async () => {
40456
+ while (next < queue.length) {
40457
+ await work(queue[next++]);
40458
+ }
40459
+ }));
40460
+ return { record, stats };
40461
+ }
40462
+ async function writeStaticAssetsRecord(clientDir, record) {
40463
+ const path3 = join5(clientDir, STATIC_ASSETS_RECORD);
40464
+ await mkdir3(dirname3(path3), { recursive: true });
40465
+ const files = Object.fromEntries(Object.entries(record.files).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
40466
+ await writeFile3(path3, `${JSON.stringify({ files }, null, 2)}
40467
+ `);
40468
+ }
40469
+
40285
40470
  // ../../node_modules/.bun/commander@12.1.0/node_modules/commander/esm.mjs
40286
40471
  var import__ = __toESM(require_commander(), 1);
40287
40472
  var {
@@ -40300,26 +40485,26 @@ var {
40300
40485
 
40301
40486
  // bin/check-models.ts
40302
40487
  import { statSync as statSync2 } from "fs";
40303
- import { relative as relative3, resolve as resolve2 } from "path";
40488
+ import { relative as relative4, resolve as resolve2 } from "path";
40304
40489
 
40305
40490
  // support/discover.ts
40306
40491
  import { existsSync as existsSync3, readdirSync as readdirSync2 } from "fs";
40307
- import { join as join5, relative as relative2 } from "path";
40492
+ import { join as join6, relative as relative3 } from "path";
40308
40493
  function sourceFiles(dir, ignore = []) {
40309
40494
  const out = [];
40310
40495
  const ignored = (path3) => {
40311
- const rel2 = relative2(dir, path3).split("\\").join("/");
40496
+ const rel2 = relative3(dir, path3).split("\\").join("/");
40312
40497
  return ignore.some((pattern) => rel2 === pattern || rel2.startsWith(`${pattern}/`));
40313
40498
  };
40314
40499
  const walk3 = (current) => {
40315
40500
  for (const entry of readdirSync2(current, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
40316
- const path3 = join5(current, entry.name);
40501
+ const path3 = join6(current, entry.name);
40317
40502
  if (ignored(path3))
40318
40503
  continue;
40319
40504
  if (entry.isDirectory()) {
40320
40505
  if (entry.name.startsWith(".") || entry.name === "node_modules")
40321
40506
  continue;
40322
- if (existsSync3(join5(path3, "package.json")))
40507
+ if (existsSync3(join6(path3, "package.json")))
40323
40508
  continue;
40324
40509
  walk3(path3);
40325
40510
  continue;
@@ -40412,7 +40597,7 @@ async function declaredModules(rootDir) {
40412
40597
  try {
40413
40598
  ({ default: Kernel } = await import(path3));
40414
40599
  } catch (error) {
40415
- throw new CheckModelsError(`Could not load ${relative3(rootDir, path3)}:
40600
+ throw new CheckModelsError(`Could not load ${relative4(rootDir, path3)}:
40416
40601
  ${error.message}`);
40417
40602
  }
40418
40603
  return new Kernel().models ?? [];
@@ -40465,8 +40650,8 @@ ${error.message}`);
40465
40650
  const paths = modelFiles(modelsDir, ignore);
40466
40651
  const files = [];
40467
40652
  for (const path3 of paths) {
40468
- const label = relative3(rootDir, path3);
40469
- const specifier = `./${relative3(modelsDir, path3).split("\\").join("/").replace(/\.tsx?$/, "")}`;
40653
+ const label = relative4(rootDir, path3);
40654
+ const specifier = `./${relative4(modelsDir, path3).split("\\").join("/").replace(/\.tsx?$/, "")}`;
40470
40655
  try {
40471
40656
  files.push({
40472
40657
  label,
@@ -40515,7 +40700,7 @@ function indent(message) {
40515
40700
 
40516
40701
  // bin/ide/generateApiManifest.ts
40517
40702
  var import_recast2 = __toESM(require_main2(), 1);
40518
- import { join as join6 } from "path";
40703
+ import { join as join7 } from "path";
40519
40704
  import { existsSync as existsSync4 } from "fs";
40520
40705
 
40521
40706
  // utils/toCamelCase.ts
@@ -40567,7 +40752,7 @@ class ApiManifestGenerator {
40567
40752
  rootRouterBody;
40568
40753
  routerBodyCache = new Map;
40569
40754
  controllerCache = new Map;
40570
- manifestCacheDir = join6(ROOT, ".gemi/cache/api-routes-manifest");
40755
+ manifestCacheDir = join7(ROOT, ".gemi/cache/api-routes-manifest");
40571
40756
  async writeManifest(cacheFilePath) {
40572
40757
  const manifest = {};
40573
40758
  for (const [routeName, method] of this.routes.entries()) {
@@ -40599,7 +40784,7 @@ class ApiManifestGenerator {
40599
40784
  if (path4.startsWith("@/app")) {
40600
40785
  return path4.replace("@", "") + ".ts";
40601
40786
  }
40602
- return join6(parentPath, path4) + ".ts";
40787
+ return join7(parentPath, path4) + ".ts";
40603
40788
  }
40604
40789
  isFileShouldBeParsed(path4) {
40605
40790
  return path4.includes("app/http/router") || path4.includes("app/http/controllers");
@@ -40647,7 +40832,7 @@ class ApiManifestGenerator {
40647
40832
  if (normalizedPath.startsWith("/app/http/controllers")) {
40648
40833
  for (const specifier of node.specifiers) {
40649
40834
  const name = specifier.type === "ImportDefaultSpecifier" ? specifier.local.name : specifier.imported.name;
40650
- await this.parseControllerFile(await this.parseFile(join6(ROOT, normalizedPath)), name, normalizedPath);
40835
+ await this.parseControllerFile(await this.parseFile(join7(ROOT, normalizedPath)), name, normalizedPath);
40651
40836
  }
40652
40837
  }
40653
40838
  if (normalizedPath.startsWith("/app/http/routes")) {
@@ -40751,7 +40936,7 @@ class ApiManifestGenerator {
40751
40936
  }
40752
40937
  async parse(cacheFilePath, filePath, isRoot = true, name = "") {
40753
40938
  console.log({ ROOT, filePath });
40754
- const file = await this.parseFile(join6(ROOT, filePath));
40939
+ const file = await this.parseFile(join7(ROOT, filePath));
40755
40940
  for (const body of file.program.body) {
40756
40941
  if (!this.isNodeShouldBeParsed(body))
40757
40942
  continue;
@@ -40787,7 +40972,7 @@ class ApiManifestGenerator {
40787
40972
  }
40788
40973
  async run(filePath) {
40789
40974
  const cacheId = generateGitDiffId();
40790
- const cacheFilePath = join6(this.manifestCacheDir, `${cacheId}.json`);
40975
+ const cacheFilePath = join7(this.manifestCacheDir, `${cacheId}.json`);
40791
40976
  if (existsSync4(cacheFilePath)) {
40792
40977
  console.log(await Bun.file(cacheFilePath).text());
40793
40978
  } else {
@@ -40999,11 +41184,11 @@ function hashDirectory(dir) {
40999
41184
  const entries = readdirSync3(current, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
41000
41185
  for (const entry of entries) {
41001
41186
  const full = path5.join(current, entry.name);
41002
- const relative4 = prefix ? `${prefix}/${entry.name}` : entry.name;
41187
+ const relative5 = prefix ? `${prefix}/${entry.name}` : entry.name;
41003
41188
  if (entry.isDirectory()) {
41004
- walk3(full, relative4);
41189
+ walk3(full, relative5);
41005
41190
  } else if (entry.isFile()) {
41006
- hash.update(relative4);
41191
+ hash.update(relative5);
41007
41192
  hash.update("\x00");
41008
41193
  hash.update(readFileSync3(full));
41009
41194
  hash.update("\x00");
@@ -41266,7 +41451,7 @@ gemi is now ${resolved}.`);
41266
41451
  }
41267
41452
 
41268
41453
  // bin/forwardSignals.ts
41269
- import { constants } from "os";
41454
+ import { constants as constants2 } from "os";
41270
41455
  var FORWARDED = ["SIGTERM", "SIGINT"];
41271
41456
  async function spawnForwardingSignals(options) {
41272
41457
  const proc = Bun.spawn({
@@ -41296,7 +41481,7 @@ async function spawnForwardingSignals(options) {
41296
41481
  function exitCodeOf(proc) {
41297
41482
  if (proc.exitCode !== null)
41298
41483
  return proc.exitCode;
41299
- const signal = proc.signalCode && constants.signals[proc.signalCode];
41484
+ const signal = proc.signalCode && constants2.signals[proc.signalCode];
41300
41485
  return signal ? 128 + signal : 1;
41301
41486
  }
41302
41487
 
@@ -41343,23 +41528,47 @@ program.command("build").action(async () => {
41343
41528
  process.env.GEMI_INPUT = JSON.stringify(input);
41344
41529
  const previousAssets = resolvePreviousAssets(config.previousAssets, rootDir);
41345
41530
  const stagingDir = previousAssets ? await mkdtemp(path9.join(tmpdir(), "gemi-previous-assets-")) : undefined;
41531
+ const clientDir = path9.join(rootDir, "dist", "client");
41532
+ const emitted = [];
41533
+ let carriedPaths = [];
41346
41534
  try {
41347
41535
  const retained = previousAssets && stagingDir ? await stagePreviousAssets(previousAssets, stagingDir) : [];
41348
41536
  console.log("Building client...");
41349
41537
  await build({
41350
41538
  configFile: false,
41351
- plugins: [vite_default()],
41539
+ plugins: [
41540
+ vite_default(),
41541
+ {
41542
+ name: "gemi:emitted-assets",
41543
+ apply: "build",
41544
+ writeBundle(_options, bundle) {
41545
+ for (const file of Object.keys(bundle)) {
41546
+ if (file.startsWith("assets/"))
41547
+ emitted.push(file);
41548
+ }
41549
+ }
41550
+ }
41551
+ ],
41352
41552
  build: { outDir: "dist/client" }
41353
41553
  });
41354
41554
  if (stagingDir) {
41355
- const carried = await restorePreviousAssets(stagingDir, path9.join(rootDir, "dist", "client"), retained);
41356
- console.log(`Kept ${carried.files} asset file(s) from ${carried.releases} earlier release(s).`);
41555
+ const carried2 = await restorePreviousAssets(stagingDir, clientDir, retained);
41556
+ carriedPaths = carried2.paths;
41557
+ console.log(`Kept ${carried2.files} asset file(s) from ${carried2.releases} earlier release(s).`);
41357
41558
  }
41358
41559
  } finally {
41359
41560
  if (stagingDir) {
41360
41561
  await rm(stagingDir, { recursive: true, force: true });
41361
41562
  }
41362
41563
  }
41564
+ const startedAt = performance.now();
41565
+ const fresh = await precompressAssets(clientDir, emitted);
41566
+ const carried = await precompressAssets(clientDir, carriedPaths, { reuseExisting: true });
41567
+ await writeStaticAssetsRecord(clientDir, {
41568
+ files: { ...carried.record.files, ...fresh.record.files }
41569
+ });
41570
+ const kb = (bytes) => `${(bytes / 1024).toFixed(1)} kB`;
41571
+ console.log(`Precompressed ${fresh.stats.files} asset(s): ${kb(fresh.stats.identityBytes)} \u2192 ` + `${kb(fresh.stats.brBytes)} br / ${kb(fresh.stats.gzipBytes)} gzip ` + `(${Math.round(performance.now() - startedAt)} ms).`);
41363
41572
  console.log("Building server...");
41364
41573
  await build({
41365
41574
  configFile: false,
@@ -41515,5 +41724,5 @@ program.command("app:route-manifest").action(async () => {
41515
41724
  });
41516
41725
  program.parse();
41517
41726
 
41518
- //# debugId=D394A7B3011B327964756E2164756E21
41727
+ //# debugId=C2424D7419BD4C9164756E2164756E21
41519
41728
  //# sourceMappingURL=gemi.js.map