gemi 0.41.4 → 0.42.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 (124) hide show
  1. package/dist/app/index.js +2 -2
  2. package/dist/app/index.js.map +1 -1
  3. package/dist/bin/gemi.js +98 -18
  4. package/dist/bin/gemi.js.map +4 -4
  5. package/dist/broadcasting/index.js +1 -1
  6. package/dist/bun/plugin.js +1 -1
  7. package/dist/bun/preload.js +1 -1
  8. package/dist/{chunk-4e4ax9bs.js → chunk-0pjn1a5d.js} +2 -2
  9. package/dist/{chunk-4e4ax9bs.js.map → chunk-0pjn1a5d.js.map} +1 -1
  10. package/dist/{chunk-awscq13h.js → chunk-1kmbs8cd.js} +3 -3
  11. package/dist/{chunk-awscq13h.js.map → chunk-1kmbs8cd.js.map} +1 -1
  12. package/dist/{chunk-4f45pw0v.js → chunk-22pr1w8v.js} +2 -2
  13. package/dist/{chunk-4f45pw0v.js.map → chunk-22pr1w8v.js.map} +1 -1
  14. package/dist/{chunk-xdk56snm.js → chunk-358x9aca.js} +3 -3
  15. package/dist/{chunk-xdk56snm.js.map → chunk-358x9aca.js.map} +1 -1
  16. package/dist/{chunk-9nfdjzen.js → chunk-522q81af.js} +4 -4
  17. package/dist/{chunk-9nfdjzen.js.map → chunk-522q81af.js.map} +1 -1
  18. package/dist/{chunk-8rm601h3.js → chunk-81yxskss.js} +2 -2
  19. package/dist/{chunk-8rm601h3.js.map → chunk-81yxskss.js.map} +1 -1
  20. package/dist/{chunk-jt0z45dn.js → chunk-8cqkdzyh.js} +4 -4
  21. package/dist/{chunk-jt0z45dn.js.map → chunk-8cqkdzyh.js.map} +1 -1
  22. package/dist/{chunk-r9p9g2x9.js → chunk-8mgsjrcc.js} +2 -2
  23. package/dist/{chunk-r9p9g2x9.js.map → chunk-8mgsjrcc.js.map} +1 -1
  24. package/dist/{chunk-c1bjq2ss.js → chunk-9byxbqnn.js} +2 -2
  25. package/dist/{chunk-c1bjq2ss.js.map → chunk-9byxbqnn.js.map} +1 -1
  26. package/dist/{chunk-1g3qpb60.js → chunk-ayjtdck4.js} +2 -2
  27. package/dist/{chunk-1g3qpb60.js.map → chunk-ayjtdck4.js.map} +1 -1
  28. package/dist/{chunk-6b1abejc.js → chunk-b3qebxqh.js} +3 -3
  29. package/dist/{chunk-6b1abejc.js.map → chunk-b3qebxqh.js.map} +1 -1
  30. package/dist/{chunk-c1hsc4aa.js → chunk-bfnh3gwv.js} +2 -2
  31. package/dist/{chunk-c1hsc4aa.js.map → chunk-bfnh3gwv.js.map} +1 -1
  32. package/dist/{chunk-agvzqxv7.js → chunk-cwq1vdcb.js} +2 -2
  33. package/dist/{chunk-21r4g9h0.js.map → chunk-cwq1vdcb.js.map} +1 -1
  34. package/dist/{chunk-b4xfh9pg.js → chunk-cx38xsyf.js} +2 -2
  35. package/dist/{chunk-b4xfh9pg.js.map → chunk-cx38xsyf.js.map} +1 -1
  36. package/dist/{chunk-q3wpyr9y.js → chunk-gsvzrj5r.js} +2 -2
  37. package/dist/{chunk-q3wpyr9y.js.map → chunk-gsvzrj5r.js.map} +1 -1
  38. package/dist/{chunk-s3zn2vas.js → chunk-hzw2y2rz.js} +3 -3
  39. package/dist/{chunk-s3zn2vas.js.map → chunk-hzw2y2rz.js.map} +1 -1
  40. package/dist/{chunk-xnhktttd.js → chunk-n1xpxhm0.js} +2 -2
  41. package/dist/{chunk-xnhktttd.js.map → chunk-n1xpxhm0.js.map} +1 -1
  42. package/dist/{chunk-3hjfype8.js → chunk-n78kxce1.js} +2 -2
  43. package/dist/{chunk-3hjfype8.js.map → chunk-n78kxce1.js.map} +1 -1
  44. package/dist/{chunk-c74f9zbq.js → chunk-pfaq2mer.js} +2 -2
  45. package/dist/{chunk-c74f9zbq.js.map → chunk-pfaq2mer.js.map} +1 -1
  46. package/dist/chunk-pjgfvdr6.js +79 -0
  47. package/dist/{chunk-88fb6hzq.js.map → chunk-pjgfvdr6.js.map} +5 -4
  48. package/dist/{chunk-4cqg9kg4.js → chunk-pr3pvtmh.js} +2 -2
  49. package/dist/{chunk-4cqg9kg4.js.map → chunk-pr3pvtmh.js.map} +1 -1
  50. package/dist/{chunk-wfbgtbae.js → chunk-pxcv9ccp.js} +3 -3
  51. package/dist/{chunk-wfbgtbae.js.map → chunk-pxcv9ccp.js.map} +1 -1
  52. package/dist/{chunk-yk9aw128.js → chunk-pygcsw1f.js} +2 -2
  53. package/dist/{chunk-yk9aw128.js.map → chunk-pygcsw1f.js.map} +1 -1
  54. package/dist/{chunk-1nm4bfjq.js → chunk-q0y425d3.js} +3 -3
  55. package/dist/{chunk-1nm4bfjq.js.map → chunk-q0y425d3.js.map} +1 -1
  56. package/dist/{chunk-y7qsts67.js → chunk-qeq8hv3t.js} +2 -2
  57. package/dist/{chunk-y7qsts67.js.map → chunk-qeq8hv3t.js.map} +1 -1
  58. package/dist/chunk-qprvfg0b.js +5 -0
  59. package/dist/chunk-qprvfg0b.js.map +12 -0
  60. package/dist/{chunk-kd4whs4z.js → chunk-qyn10pv7.js} +1 -1
  61. package/dist/{chunk-h465ja8n.js → chunk-qzemjynx.js} +3 -3
  62. package/dist/{chunk-h465ja8n.js.map → chunk-qzemjynx.js.map} +1 -1
  63. package/dist/{chunk-rm5y1v00.js → chunk-ratbccpg.js} +2 -2
  64. package/dist/{chunk-rm5y1v00.js.map → chunk-ratbccpg.js.map} +1 -1
  65. package/dist/{chunk-p9qt93zk.js → chunk-rrwtgt86.js} +2 -2
  66. package/dist/{chunk-agvzqxv7.js.map → chunk-rrwtgt86.js.map} +1 -1
  67. package/dist/{chunk-wzxsj3cp.js → chunk-s2tm33hd.js} +2 -2
  68. package/dist/{chunk-wzxsj3cp.js.map → chunk-s2tm33hd.js.map} +2 -2
  69. package/dist/{chunk-sns685hn.js → chunk-s4seq23x.js} +2 -2
  70. package/dist/{chunk-sns685hn.js.map → chunk-s4seq23x.js.map} +1 -1
  71. package/dist/{chunk-p6ezs2w7.js → chunk-sbmg0hfr.js} +3 -3
  72. package/dist/{chunk-p6ezs2w7.js.map → chunk-sbmg0hfr.js.map} +1 -1
  73. package/dist/{chunk-3hgk4fxz.js → chunk-shpca068.js} +3 -3
  74. package/dist/{chunk-3hgk4fxz.js.map → chunk-shpca068.js.map} +1 -1
  75. package/dist/{chunk-vfvetfjg.js → chunk-syaxsp9y.js} +3 -3
  76. package/dist/{chunk-vfvetfjg.js.map → chunk-syaxsp9y.js.map} +1 -1
  77. package/dist/chunk-tb8yy4rf.js +5 -0
  78. package/dist/{chunk-emt6gz1d.js.map → chunk-tb8yy4rf.js.map} +1 -1
  79. package/dist/{chunk-sgv88qqn.js → chunk-wa84ybnt.js} +5 -5
  80. package/dist/{chunk-sgv88qqn.js.map → chunk-wa84ybnt.js.map} +1 -1
  81. package/dist/{chunk-rkf1stc0.js → chunk-x3vy6dbw.js} +2 -2
  82. package/dist/{chunk-rkf1stc0.js.map → chunk-x3vy6dbw.js.map} +1 -1
  83. package/dist/chunk-xpk460d1.js +4 -0
  84. package/dist/{chunk-p9qt93zk.js.map → chunk-xpk460d1.js.map} +1 -1
  85. package/dist/{chunk-q91708he.js → chunk-xzr4t6k9.js} +3 -3
  86. package/dist/{chunk-q91708he.js.map → chunk-xzr4t6k9.js.map} +1 -1
  87. package/dist/chunk-yeqwzeq7.js +4 -0
  88. package/dist/{chunk-a8wmfnw6.js.map → chunk-yeqwzeq7.js.map} +3 -3
  89. package/dist/{chunk-85hzphk5.js → chunk-z9vdcpqr.js} +2 -2
  90. package/dist/{chunk-85hzphk5.js.map → chunk-z9vdcpqr.js.map} +1 -1
  91. package/dist/{chunk-kw1g4bjh.js → chunk-zaa3yt2w.js} +3 -3
  92. package/dist/{chunk-kw1g4bjh.js.map → chunk-zaa3yt2w.js.map} +1 -1
  93. package/dist/config/index.js +1 -1
  94. package/dist/email/index.js +2 -2
  95. package/dist/email/index.js.map +1 -1
  96. package/dist/facades/index.js +2 -2
  97. package/dist/facades/index.js.map +1 -1
  98. package/dist/http/ViewRouter.d.ts +29 -5
  99. package/dist/http/ViewRouter.d.ts.map +1 -1
  100. package/dist/http/index.d.ts +2 -2
  101. package/dist/http/index.d.ts.map +1 -1
  102. package/dist/http/index.js +2 -2
  103. package/dist/http/index.js.map +1 -1
  104. package/dist/i18n/index.js +2 -2
  105. package/dist/i18n/index.js.map +2 -2
  106. package/dist/kernel/index.js +2 -2
  107. package/dist/kernel/index.js.map +2 -2
  108. package/dist/server/httpProd.d.ts.map +1 -1
  109. package/dist/server/index.js +2 -2
  110. package/dist/server/index.js.map +2 -2
  111. package/dist/services/index.js +2 -2
  112. package/dist/services/index.js.map +1 -1
  113. package/dist/services/router/ViewRouterServiceContainer.d.ts +9 -0
  114. package/dist/services/router/ViewRouterServiceContainer.d.ts.map +1 -1
  115. package/package.json +1 -1
  116. package/dist/chunk-21r4g9h0.js +0 -4
  117. package/dist/chunk-88fb6hzq.js +0 -79
  118. package/dist/chunk-a8wmfnw6.js +0 -4
  119. package/dist/chunk-c9wa4rtm.js +0 -5
  120. package/dist/chunk-c9wa4rtm.js.map +0 -10
  121. package/dist/chunk-emt6gz1d.js +0 -5
  122. package/dist/chunk-kyw5n83x.js +0 -5
  123. package/dist/chunk-kyw5n83x.js.map +0 -12
  124. /package/dist/{chunk-kd4whs4z.js.map → chunk-qyn10pv7.js.map} +0 -0
package/dist/app/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{o as a,p as b}from"../chunk-q3wpyr9y.js";import"../chunk-88fb6hzq.js";import"../chunk-c9wa4rtm.js";import"../chunk-a8wmfnw6.js";import"../chunk-p6ezs2w7.js";import"../chunk-6b1abejc.js";import"../chunk-xnhktttd.js";import"../chunk-c1hsc4aa.js";import"../chunk-agvzqxv7.js";export{b as prismaExtension,a as App};
2
+ import{o as a,p as b}from"../chunk-gsvzrj5r.js";import"../chunk-pjgfvdr6.js";import"../chunk-yeqwzeq7.js";import"../chunk-sbmg0hfr.js";import"../chunk-b3qebxqh.js";import"../chunk-n1xpxhm0.js";import"../chunk-bfnh3gwv.js";import"../chunk-cwq1vdcb.js";export{b as prismaExtension,a as App};
3
3
 
4
- //# debugId=2854D00658AA381564756E2164756E21
4
+ //# debugId=15EBDBCE0B2D702364756E2164756E21
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "2854D00658AA381564756E2164756E21",
7
+ "debugId": "15EBDBCE0B2D702364756E2164756E21",
8
8
  "names": []
9
9
  }
package/dist/bin/gemi.js CHANGED
@@ -50639,11 +50639,7 @@ class RedirectRoute {
50639
50639
  }
50640
50640
  }
50641
50641
  async run(req, path) {
50642
- const {
50643
- destination,
50644
- permanent = false,
50645
- status = 307
50646
- } = await this.handler(req);
50642
+ const { destination, permanent = false, status = 307 } = await this.handler(req);
50647
50643
  if (!destination) {
50648
50644
  throw new Error(`Redirect destination is required see ${path}`);
50649
50645
  }
@@ -50655,6 +50651,74 @@ class RedirectRoute {
50655
50651
  return this;
50656
50652
  }
50657
50653
  }
50654
+ function contentDisposition(name, download) {
50655
+ const kind = download ? "attachment" : "inline";
50656
+ const fallback = name.replace(/["\\]/g, "").replace(/[^\x20-\x7e]/g, "_");
50657
+ return `${kind}; filename="${fallback}"; filename*=UTF-8''${encodeURIComponent(name)}`;
50658
+ }
50659
+ async function createFileResponse(output, headers) {
50660
+ if (output instanceof Response) {
50661
+ return output;
50662
+ }
50663
+ const isBlob = output instanceof Blob;
50664
+ const body = isBlob ? output : output.file;
50665
+ const name = isBlob ? output.name : output.name ?? output.file?.name;
50666
+ const type = (isBlob ? output.type : output.type ?? output.file?.type) || "";
50667
+ const download = isBlob ? false : output.download ?? false;
50668
+ const status = isBlob ? 200 : output.status ?? 200;
50669
+ if (!isBlob) {
50670
+ for (const [key, value] of Object.entries(output.headers ?? {})) {
50671
+ headers.set(key, value);
50672
+ }
50673
+ }
50674
+ if (body instanceof Blob && "exists" in body && typeof body.exists === "function") {
50675
+ const exists = await body.exists();
50676
+ if (!exists) {
50677
+ return new Response("Not found", { status: 404 });
50678
+ }
50679
+ }
50680
+ headers.set("Content-Type", type || "application/octet-stream");
50681
+ if (body instanceof Blob) {
50682
+ headers.set("Content-Length", String(body.size));
50683
+ }
50684
+ if (name) {
50685
+ headers.set("Content-Disposition", contentDisposition(name, download));
50686
+ }
50687
+ return new Response(body instanceof Blob ? body.stream() : body, {
50688
+ status,
50689
+ headers
50690
+ });
50691
+ }
50692
+
50693
+ class FileRoute {
50694
+ kind = "file";
50695
+ viewPath = "FILE";
50696
+ middlewares = [];
50697
+ handler;
50698
+ constructor(handler) {
50699
+ if (!handler) {
50700
+ this.handler = () => null;
50701
+ } else if (typeof handler === "function") {
50702
+ this.handler = handler;
50703
+ } else {
50704
+ const [controller, methodName] = handler;
50705
+ const controllerInstance = new controller;
50706
+ const controllerHandler = controllerInstance[methodName].bind(controllerInstance);
50707
+ this.handler = (req) => controllerHandler(req);
50708
+ }
50709
+ }
50710
+ async run(req, path) {
50711
+ const file = await this.handler(req);
50712
+ if (!file) {
50713
+ throw new Error(`File route handler must return a file see ${path}`);
50714
+ }
50715
+ return { FILE: file };
50716
+ }
50717
+ middleware(middlewares) {
50718
+ this.middlewares = middlewares;
50719
+ return this;
50720
+ }
50721
+ }
50658
50722
 
50659
50723
  class ViewRoute {
50660
50724
  viewPath;
@@ -50677,11 +50741,6 @@ class ViewRoute {
50677
50741
  }
50678
50742
  async run(req, path) {
50679
50743
  const data = await this.handler(req);
50680
- if (this.viewPath === "FILE") {
50681
- return {
50682
- FILE: data
50683
- };
50684
- }
50685
50744
  return {
50686
50745
  [this.viewPath]: {
50687
50746
  ...data,
@@ -50751,6 +50810,9 @@ class ViewRouter {
50751
50810
  view(viewPath, handler) {
50752
50811
  return new ViewRoute(viewPath, handler);
50753
50812
  }
50813
+ file(handler) {
50814
+ return new FileRoute(handler);
50815
+ }
50754
50816
  redirect(handler) {
50755
50817
  return new RedirectRoute(handler);
50756
50818
  }
@@ -67889,12 +67951,21 @@ async function getTtfFont(family, weight, style) {
67889
67951
  const ttfUrl = css.match(/url\(([^)]+)\)/)?.[1];
67890
67952
  return await fetch(ttfUrl).then((res) => res.arrayBuffer());
67891
67953
  }
67954
+ var RESERVED_ROUTE_PREFIX = "/assets";
67955
+ function assertNoReservedRoutePaths(routePaths) {
67956
+ const reserved = routePaths.filter((path) => path === RESERVED_ROUTE_PREFIX || path.startsWith(`${RESERVED_ROUTE_PREFIX}/`));
67957
+ if (reserved.length > 0) {
67958
+ const many = reserved.length > 1;
67959
+ throw new Error(`View route path${many ? "s" : ""} ${reserved.map((path) => `"${path}"`).join(", ")} ` + `use${many ? "" : "s"} the reserved "${RESERVED_ROUTE_PREFIX}" prefix. ` + `The client build output is served from there before the router runs, so the route would never match. ` + `Mount it somewhere else.`);
67960
+ }
67961
+ }
67892
67962
 
67893
67963
  class ViewRouterServiceContainer extends ServiceContainer {
67894
67964
  service;
67895
67965
  static _name = "ViewRouterServiceContainer";
67896
67966
  flatViewRoutes = {};
67897
67967
  routeManifest = {};
67968
+ clientRouteManifest = {};
67898
67969
  componentTree = [];
67899
67970
  flatComponentTree = [];
67900
67971
  root = null;
@@ -67906,7 +67977,9 @@ class ViewRouterServiceContainer extends ServiceContainer {
67906
67977
  "/auth": AuthViewRouter
67907
67978
  };
67908
67979
  this.flatViewRoutes = createFlatViewRoutes(routes);
67980
+ assertNoReservedRoutePaths(Object.keys(this.flatViewRoutes));
67909
67981
  this.routeManifest = createRouteManifest(routes);
67982
+ this.clientRouteManifest = Object.fromEntries(Object.entries(this.routeManifest).filter(([, views]) => views.at(-1) !== "FILE"));
67910
67983
  this.componentTree = createComponentTree(routes);
67911
67984
  this.flatComponentTree = flattenComponentTree(this.componentTree);
67912
67985
  this.root = service.root;
@@ -67953,7 +68026,7 @@ class ViewRouterServiceContainer extends ServiceContainer {
67953
68026
  prefetchedData,
67954
68027
  i18n,
67955
68028
  auth: { user },
67956
- routeManifest: this.routeManifest,
68029
+ routeManifest: this.clientRouteManifest,
67957
68030
  breadcrumbs,
67958
68031
  router: {
67959
68032
  urlLocaleSegment,
@@ -68160,12 +68233,19 @@ class ViewRouterServiceContainer extends ServiceContainer {
68160
68233
  breadcrumbs[`${key}:${currentPathName2}`] = value.breadcrumb;
68161
68234
  viewData[key] = value;
68162
68235
  }
68163
- const views = this.routeManifest[currentPathName2];
68164
- const isFileRequest = views?.[views?.length ?? 0 - 1] === "FILE";
68165
- if (isFileRequest) {
68166
- const file = viewData.FILE;
68167
- headers.set("Content-Type", file.type || "application/octet-stream");
68168
- return new Response(file.stream(), { headers });
68236
+ const fileOutput = viewData.FILE;
68237
+ if (fileOutput) {
68238
+ for (const cookie of cookies) {
68239
+ headers.append("Set-Cookie", cookie.toString());
68240
+ }
68241
+ try {
68242
+ await this.onRequestEnd(httpRequest2);
68243
+ } catch (err2) {
68244
+ Log.error(err2?.message ?? 'Error in "onRequestEnd" event handler', {
68245
+ err: JSON.stringify(err2)
68246
+ });
68247
+ }
68248
+ return await createFileResponse(fileOutput, headers);
68169
68249
  }
68170
68250
  if (isViewDataRequest) {
68171
68251
  headers.set("Content-Type", "application/json; charset=utf-8");
@@ -69181,5 +69261,5 @@ program.command("app:route-manifest").action(async () => {
69181
69261
  });
69182
69262
  program.parse();
69183
69263
 
69184
- //# debugId=80FA759F65E85D4464756E2164756E21
69264
+ //# debugId=ED465C15ADFED86164756E2164756E21
69185
69265
  //# sourceMappingURL=gemi.js.map