gemi 0.4.78 → 0.4.80

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 (117) hide show
  1. package/dist/app/App.d.ts +5 -10
  2. package/dist/app/App.d.ts.map +1 -1
  3. package/dist/app/index.js +60 -60
  4. package/dist/bin/index.js +104 -75
  5. package/dist/broadcasting/BroadcastingChannel.d.ts +5 -0
  6. package/dist/broadcasting/BroadcastingChannel.d.ts.map +1 -0
  7. package/dist/broadcasting/index.js +2 -0
  8. package/dist/chunk-02ba977a552fd2da.js +18 -0
  9. package/dist/chunk-0ba2cc302113ab40.js +3 -0
  10. package/dist/{chunk-28c7d04b6f555350.js → chunk-1e6b656dc70ab1fd.js} +2 -2
  11. package/dist/{chunk-e3d242546d1a2927.js → chunk-24a86f8f5ddc0cbd.js} +1 -1
  12. package/dist/chunk-2786cd9024d0d164.js +2 -0
  13. package/dist/chunk-357d6f34be7eafaa.js +2 -0
  14. package/dist/chunk-5075c75a0b45f02c.js +2 -0
  15. package/dist/{chunk-20e12a96dfe36b97.js → chunk-53b7d6267c9172bc.js} +1 -1
  16. package/dist/chunk-55c7fe17750b0378.js +9 -0
  17. package/dist/chunk-5ddf530ee3afe1d4.js +2 -0
  18. package/dist/{chunk-4e37f45d636da627.js → chunk-6a97611e6bd65152.js} +2 -2
  19. package/dist/chunk-7d5fe4acabfee228.js +2 -0
  20. package/dist/{chunk-9631e167bae739a0.js → chunk-813a4c185ab4c0c0.js} +1 -1
  21. package/dist/chunk-81fb135d80e84b06.js +2 -0
  22. package/dist/chunk-8ee09f1f74206a04.js +2 -0
  23. package/dist/chunk-9475c6ed18013dc8.js +2 -0
  24. package/dist/chunk-a7246b5b3e2f2366.js +2 -0
  25. package/dist/chunk-aebf7df48200842b.js +2 -0
  26. package/dist/chunk-b3b228374e54f4ff.js +6 -0
  27. package/dist/chunk-c22e0fc22de0403a.js +2 -0
  28. package/dist/chunk-e1a9177afdc46b3b.js +2 -0
  29. package/dist/chunk-e834f558250dac89.js +2 -0
  30. package/dist/chunk-e910e2a8677bca82.js +2 -0
  31. package/dist/chunk-f47acd04bf65c5c9.js +2 -0
  32. package/dist/{chunk-5ea45ebea038bef4.js → chunk-f9f264ce0c8e9699.js} +2 -2
  33. package/dist/{chunk-4ad752c87b795617.js → chunk-ff8cd8fd047cfee5.js} +2 -2
  34. package/dist/client/ClientRouter.d.ts.map +1 -1
  35. package/dist/client/HttpReload.d.ts.map +1 -1
  36. package/dist/client/WebsocketContext.d.ts +10 -0
  37. package/dist/client/WebsocketContext.d.ts.map +1 -0
  38. package/dist/client/index.d.ts +2 -0
  39. package/dist/client/index.d.ts.map +1 -1
  40. package/dist/client/index.js +114 -13
  41. package/dist/client/useBroadcast.d.ts +4 -0
  42. package/dist/client/useBroadcast.d.ts.map +1 -0
  43. package/dist/client/useQuery.d.ts.map +1 -1
  44. package/dist/client/useSearchParams.d.ts +1 -1
  45. package/dist/client/useSearchParams.d.ts.map +1 -1
  46. package/dist/client/useSubscription.d.ts +5 -0
  47. package/dist/client/useSubscription.d.ts.map +1 -0
  48. package/dist/email/Email.d.ts +12 -5
  49. package/dist/email/Email.d.ts.map +1 -1
  50. package/dist/email/index.d.ts +0 -2
  51. package/dist/email/index.d.ts.map +1 -1
  52. package/dist/email/index.js +1 -1
  53. package/dist/facades/Auth.d.ts.map +1 -1
  54. package/dist/facades/Broadcast.d.ts +6 -0
  55. package/dist/facades/Broadcast.d.ts.map +1 -0
  56. package/dist/facades/Prefetch.d.ts.map +1 -1
  57. package/dist/facades/index.d.ts +1 -0
  58. package/dist/facades/index.d.ts.map +1 -1
  59. package/dist/facades/index.js +1 -1
  60. package/dist/http/ApiRouter.d.ts.map +1 -1
  61. package/dist/http/BroadcastingRouter.d.ts +8 -0
  62. package/dist/http/BroadcastingRouter.d.ts.map +1 -0
  63. package/dist/http/HttpRequest.d.ts.map +1 -1
  64. package/dist/http/index.js +1 -1
  65. package/dist/kernel/Kernel.d.ts +9 -3
  66. package/dist/kernel/Kernel.d.ts.map +1 -1
  67. package/dist/kernel/context.d.ts +4 -2
  68. package/dist/kernel/context.d.ts.map +1 -1
  69. package/dist/kernel/index.js +1 -2
  70. package/dist/server/index.js +5 -5
  71. package/dist/services/ServiceContainer.d.ts +7 -0
  72. package/dist/services/ServiceContainer.d.ts.map +1 -0
  73. package/dist/services/email/EmailServiceContainer.d.ts +8 -0
  74. package/dist/services/email/EmailServiceContainer.d.ts.map +1 -0
  75. package/dist/services/email/EmailServiceProvider.d.ts +9 -0
  76. package/dist/services/email/EmailServiceProvider.d.ts.map +1 -0
  77. package/dist/services/email/drivers/EmailDriver.d.ts +5 -0
  78. package/dist/services/email/drivers/EmailDriver.d.ts.map +1 -0
  79. package/dist/services/email/drivers/ResendDriver.d.ts +8 -0
  80. package/dist/services/email/drivers/ResendDriver.d.ts.map +1 -0
  81. package/dist/{email → services/email/drivers}/types.d.ts +2 -3
  82. package/dist/services/email/drivers/types.d.ts.map +1 -0
  83. package/dist/services/index.d.ts +5 -0
  84. package/dist/services/index.d.ts.map +1 -1
  85. package/dist/services/index.js +1 -1
  86. package/dist/services/pubsub/BroadcastingServiceContainer.d.ts +24 -0
  87. package/dist/services/pubsub/BroadcastingServiceContainer.d.ts.map +1 -0
  88. package/dist/services/pubsub/BroadcastingServiceProvider.d.ts +7 -0
  89. package/dist/services/pubsub/BroadcastingServiceProvider.d.ts.map +1 -0
  90. package/dist/services/pubsub/types.d.ts +6 -0
  91. package/dist/services/pubsub/types.d.ts.map +1 -0
  92. package/dist/utils/applyParams.d.ts +1 -1
  93. package/dist/utils/applyParams.d.ts.map +1 -1
  94. package/package.json +4 -2
  95. package/dist/chunk-168ace6fc79b185b.js +0 -2
  96. package/dist/chunk-1c56f79378e4123d.js +0 -2
  97. package/dist/chunk-269dd2cd89aa1c32.js +0 -2
  98. package/dist/chunk-30daf610f498e198.js +0 -6
  99. package/dist/chunk-3abc648638ed6645.js +0 -18
  100. package/dist/chunk-48b2990a93ae50b3.js +0 -2
  101. package/dist/chunk-52dd5453e79e1cef.js +0 -2
  102. package/dist/chunk-5c1c113b94101135.js +0 -2
  103. package/dist/chunk-5fb9d31b7b4629e9.js +0 -1
  104. package/dist/chunk-8bf925705fdcef0c.js +0 -2
  105. package/dist/chunk-9c05674e98ebc485.js +0 -2
  106. package/dist/chunk-a5da5f8d6f9e8633.js +0 -2
  107. package/dist/chunk-b943cac32cc3670f.js +0 -2
  108. package/dist/chunk-d4eceea16ddc567d.js +0 -9
  109. package/dist/chunk-e64fe80074576b85.js +0 -2
  110. package/dist/chunk-f9d7921dc209275a.js +0 -2
  111. package/dist/email/EmailServiceProvider.d.ts +0 -8
  112. package/dist/email/EmailServiceProvider.d.ts.map +0 -1
  113. package/dist/email/EmailTemplate.d.ts +0 -22
  114. package/dist/email/EmailTemplate.d.ts.map +0 -1
  115. package/dist/email/providers.d.ts +0 -5
  116. package/dist/email/providers.d.ts.map +0 -1
  117. package/dist/email/types.d.ts.map +0 -1
package/dist/bin/index.js CHANGED
@@ -7694,7 +7694,7 @@ var require_command = __commonJS((exports) => {
7694
7694
  };
7695
7695
  var EventEmitter = import.meta.require("events").EventEmitter;
7696
7696
  var childProcess = import.meta.require("child_process");
7697
- var path3 = import.meta.require("path");
7697
+ var path2 = import.meta.require("path");
7698
7698
  var fs = import.meta.require("fs");
7699
7699
  var process2 = import.meta.require("process");
7700
7700
  var { Argument, humanReadableArgName } = require_argument();
@@ -8189,10 +8189,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
8189
8189
  let launchWithNode = false;
8190
8190
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
8191
8191
  function findFile(baseDir, baseName) {
8192
- const localBin = path3.resolve(baseDir, baseName);
8192
+ const localBin = path2.resolve(baseDir, baseName);
8193
8193
  if (fs.existsSync(localBin))
8194
8194
  return localBin;
8195
- if (sourceExt.includes(path3.extname(baseName)))
8195
+ if (sourceExt.includes(path2.extname(baseName)))
8196
8196
  return;
8197
8197
  const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
8198
8198
  if (foundExt)
@@ -8210,19 +8210,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
8210
8210
  } catch (err) {
8211
8211
  resolvedScriptPath = this._scriptPath;
8212
8212
  }
8213
- executableDir = path3.resolve(path3.dirname(resolvedScriptPath), executableDir);
8213
+ executableDir = path2.resolve(path2.dirname(resolvedScriptPath), executableDir);
8214
8214
  }
8215
8215
  if (executableDir) {
8216
8216
  let localFile = findFile(executableDir, executableFile);
8217
8217
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
8218
- const legacyName = path3.basename(this._scriptPath, path3.extname(this._scriptPath));
8218
+ const legacyName = path2.basename(this._scriptPath, path2.extname(this._scriptPath));
8219
8219
  if (legacyName !== this._name) {
8220
8220
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
8221
8221
  }
8222
8222
  }
8223
8223
  executableFile = localFile || executableFile;
8224
8224
  }
8225
- launchWithNode = sourceExt.includes(path3.extname(executableFile));
8225
+ launchWithNode = sourceExt.includes(path2.extname(executableFile));
8226
8226
  let proc;
8227
8227
  if (process2.platform !== "win32") {
8228
8228
  if (launchWithNode) {
@@ -8784,13 +8784,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
8784
8784
  return this;
8785
8785
  }
8786
8786
  nameFromFilename(filename) {
8787
- this._name = path3.basename(filename, path3.extname(filename));
8787
+ this._name = path2.basename(filename, path2.extname(filename));
8788
8788
  return this;
8789
8789
  }
8790
- executableDir(path4) {
8791
- if (path4 === undefined)
8790
+ executableDir(path3) {
8791
+ if (path3 === undefined)
8792
8792
  return this._executableDir;
8793
- this._executableDir = path4;
8793
+ this._executableDir = path3;
8794
8794
  return this;
8795
8795
  }
8796
8796
  helpInformation(contextOptions) {
@@ -8922,10 +8922,10 @@ var require_commander = __commonJS((exports) => {
8922
8922
 
8923
8923
  // bin/gemi.ts
8924
8924
  var {$ } = globalThis.Bun;
8925
- import path3 from "path";
8925
+ import path2 from "path";
8926
8926
 
8927
8927
  // server/dev.ts
8928
- import path from "path";
8928
+ import {join} from "path";
8929
8929
 
8930
8930
  // server/styles.tsx
8931
8931
  var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
@@ -9049,11 +9049,8 @@ async function startDevServer() {
9049
9049
  });
9050
9050
  process.env.ROOT_DIR = rootDir;
9051
9051
  process.env.APP_DIR = appDir;
9052
- async function requestHandler(req) {
9052
+ async function handleDevRequests(req) {
9053
9053
  const { pathname } = new URL(req.url);
9054
- if (pathname.startsWith("/__gemi/image")) {
9055
- return await imageHandler(req);
9056
- }
9057
9054
  if (pathname.startsWith("/refresh.js")) {
9058
9055
  return new Response(`
9059
9056
  import RefreshRuntime from "http://localhost:5173/@react-refresh";
@@ -9075,77 +9072,109 @@ async function startDevServer() {
9075
9072
  } catch (err) {
9076
9073
  console.log(err);
9077
9074
  }
9078
- let app = null;
9075
+ }
9076
+ async function getApp() {
9077
+ let app2;
9079
9078
  try {
9080
- app = (await vite.ssrLoadModule(path.join(appDir, "bootstrap.ts"))).app;
9081
- } catch (err) {
9082
- return new Response(renderErrorPage(err), {
9083
- status: 500,
9084
- headers: { "Content-Type": "text/html" }
9079
+ app2 = (await vite.ssrLoadModule(join(appDir, "bootstrap.ts"))).app;
9080
+ const { default: css } = await vite.ssrLoadModule(`${appDir}/app.css`);
9081
+ const styles2 = [];
9082
+ styles2.push({
9083
+ isDev: true,
9084
+ id: `${appDir}/app.css`,
9085
+ content: css
9085
9086
  });
9086
- }
9087
- const { default: css } = await vite.ssrLoadModule(`${appDir}/app.css`);
9088
- const styles2 = [];
9089
- styles2.push({
9090
- isDev: true,
9091
- id: `${appDir}/app.css`,
9092
- content: css
9093
- });
9094
- app.setRenderParams({
9095
- styles: createStyles(styles2),
9096
- manifest: null,
9097
- serverManifest: null,
9098
- bootstrapModules: [
9099
- "/refresh.js",
9100
- "/app/client.tsx",
9101
- "http://localhost:5173/@vite/client"
9102
- ]
9103
- });
9104
- const handler = app.fetch.bind(app);
9105
- try {
9106
- return await handler(req);
9107
- } catch (err) {
9108
- console.log(err);
9109
- if (pathname.startsWith("/api")) {
9110
- return new Response(JSON.stringify({ error: err.message }), {
9111
- status: 500,
9112
- headers: { "Content-Type": "application/json" }
9113
- });
9114
- }
9115
- return new Response(renderErrorPage(err), {
9116
- headers: { "Content-Type": "text/html" }
9087
+ app2.setRenderParams({
9088
+ styles: createStyles(styles2),
9089
+ manifest: null,
9090
+ serverManifest: null,
9091
+ bootstrapModules: [
9092
+ "/refresh.js",
9093
+ "/app/client.tsx",
9094
+ "http://localhost:5173/@vite/client"
9095
+ ]
9117
9096
  });
9097
+ return app2;
9098
+ } catch (err) {
9099
+ console.log("Can't load bootstrap.ts");
9100
+ console.error(err);
9118
9101
  }
9119
9102
  }
9103
+ async function createServe(app2) {
9104
+ const handler = app2.fetch.bind(app2);
9105
+ return {
9106
+ fetch: async (req, server2) => {
9107
+ if (server2.upgrade(req, { data: { headers: req.headers } })) {
9108
+ return;
9109
+ }
9110
+ if (!req.headers.get("x-forwarded-for")) {
9111
+ const ip = server2.requestIP(req);
9112
+ req.headers.set("x-forwarded-for", ip.address);
9113
+ }
9114
+ const { pathname } = new URL(req.url);
9115
+ const devResponse = await handleDevRequests(req);
9116
+ if (devResponse instanceof Response) {
9117
+ return devResponse;
9118
+ }
9119
+ if (pathname.startsWith("/__gemi/image")) {
9120
+ return await imageHandler(req);
9121
+ }
9122
+ try {
9123
+ return await handler(req);
9124
+ } catch (err) {
9125
+ if (pathname.startsWith("/api")) {
9126
+ return new Response(JSON.stringify({ error: err.message }), {
9127
+ status: 500,
9128
+ headers: { "Content-Type": "application/json" }
9129
+ });
9130
+ }
9131
+ return new Response(renderErrorPage(err), {
9132
+ headers: { "Content-Type": "text/html" }
9133
+ });
9134
+ }
9135
+ },
9136
+ port: process.env.PORT || 5173,
9137
+ websocket: app2.websocket
9138
+ };
9139
+ }
9120
9140
  await vite.listen(5174);
9121
- const server = Bun.serve({
9122
- fetch: async (req, server2) => {
9123
- if (!req.headers.get("x-forwarded-for")) {
9124
- const ip = server2.requestIP(req);
9125
- req.headers.set("x-forwarded-for", ip.address);
9126
- }
9127
- return await requestHandler(req);
9128
- },
9129
- port: process.env.PORT || 5173
9141
+ const app = await getApp();
9142
+ const serve = await createServe(app);
9143
+ const server = Bun.serve(serve);
9144
+ app.onPublish((topic, data, compress) => {
9145
+ server.publish(topic, data, compress);
9130
9146
  });
9131
9147
  console.log(`Server started on http://localhost:${process.env.PORT || 5173}`);
9132
9148
  vite.watcher.on("change", async (file) => {
9133
- if (file.includes("app/views")) {
9149
+ const fileRelativePath = file.replace(rootDir, "");
9150
+ if (fileRelativePath.startsWith("app/views")) {
9151
+ console.log(`[vite] ${fileRelativePath} changed. \uD83C\uDF5C Hot reloading...`);
9134
9152
  return;
9135
9153
  }
9136
- console.log(`[vite] ${file} changed. Updating...`);
9137
- const mod = await vite.moduleGraph.getModuleByUrl(`/${file}`);
9138
- if (mod) {
9139
- console.log(`[vite] ${file} changed. Updating...`);
9154
+ console.log(`[vite] ${fileRelativePath} changed. Reloading...`);
9155
+ const modules = vite.moduleGraph.getModulesByFile(file);
9156
+ for (const mod of Array.from(modules)) {
9157
+ await vite.reloadModule(mod);
9158
+ }
9159
+ try {
9160
+ const app2 = await getApp();
9161
+ const serve2 = await createServe(app2);
9162
+ app2.onPublish((topic, data, compress) => {
9163
+ server.publish(topic, data, compress);
9164
+ });
9165
+ server.reload(serve2);
9166
+ } catch (err) {
9167
+ console.log("Error on server reload");
9168
+ console.log(err);
9140
9169
  }
9141
9170
  });
9142
9171
  return server;
9143
9172
  }
9144
9173
  var rootDir = process.cwd();
9145
- var appDir = path.join(rootDir, "app");
9174
+ var appDir = join(rootDir, "app");
9146
9175
 
9147
9176
  // server/prod.ts
9148
- import {join} from "path";
9177
+ import {join as join2} from "path";
9149
9178
 
9150
9179
  // server/generateEtag.ts
9151
9180
  function generateETag(lastModified) {
@@ -10018,11 +10047,11 @@ async function startProdServer() {
10018
10047
  return server;
10019
10048
  }
10020
10049
  var rootDir2 = process.cwd();
10021
- var appDir2 = join(rootDir2, "app");
10022
- var distDir = join(rootDir2, "dist");
10050
+ var appDir2 = join2(rootDir2, "app");
10051
+ var distDir = join2(rootDir2, "dist");
10023
10052
 
10024
10053
  // bin/createRollupInput.ts
10025
- import path2 from "path";
10054
+ import path from "path";
10026
10055
 
10027
10056
  // client/helpers/flattenComponentTree.ts
10028
10057
  function flattenComponentTree(componentTree) {
@@ -10035,7 +10064,7 @@ function flattenComponentTree(componentTree) {
10035
10064
 
10036
10065
  // bin/createRollupInput.ts
10037
10066
  async function createRollupInput_default() {
10038
- const { app } = await import(path2.resolve("./app/bootstrap.ts"));
10067
+ const { app } = await import(path.resolve("./app/bootstrap.ts"));
10039
10068
  const entries = app.getComponentTree();
10040
10069
  function getEntries(componentTree) {
10041
10070
  const out = ["/app/client.tsx"];
@@ -10077,8 +10106,8 @@ program.command("dev").action(async () => {
10077
10106
  program.command("build").action(async () => {
10078
10107
  process.env.NODE_ENV = "production";
10079
10108
  const input = await createRollupInput_default();
10080
- const rootDir3 = path3.resolve(process.cwd());
10081
- const appDir3 = path3.join(rootDir3, "app");
10109
+ const rootDir3 = path2.resolve(process.cwd());
10110
+ const appDir3 = path2.join(rootDir3, "app");
10082
10111
  console.log("Building client...");
10083
10112
  await $`GEMI_INPUT=${JSON.stringify(input)} vite build --outDir dist/client`;
10084
10113
  console.log("Building server...");
@@ -0,0 +1,5 @@
1
+ export declare class BroadcastingChannel {
2
+ subscribe(user: any): Promise<boolean>;
3
+ publish(input: any): any;
4
+ }
5
+ //# sourceMappingURL=BroadcastingChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BroadcastingChannel.d.ts","sourceRoot":"","sources":["../../broadcasting/BroadcastingChannel.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAmB;IACxB,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5C,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG;CAGzB"}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"../chunk-24a86f8f5ddc0cbd.js";class n{async subscribe(r){return!0}publish(r){return{}}}export{n as BroadcastingChannel};