gemi 0.130.0 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.js +2 -2
- package/dist/ai/index.js.map +1 -1
- package/dist/app/App.d.ts +9 -0
- package/dist/app/App.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bin/gemi.js +182 -128
- package/dist/bin/gemi.js.map +7 -6
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-t7gvgz20.js → chunk-0g5f8ymy.js} +2 -2
- package/dist/{chunk-t7gvgz20.js.map → chunk-0g5f8ymy.js.map} +1 -1
- package/dist/{chunk-peng31np.js → chunk-0q68t71d.js} +3 -3
- package/dist/{chunk-peng31np.js.map → chunk-0q68t71d.js.map} +1 -1
- package/dist/{chunk-vc5kpxdk.js → chunk-2senwsdq.js} +2 -2
- package/dist/{chunk-vc5kpxdk.js.map → chunk-2senwsdq.js.map} +1 -1
- package/dist/{chunk-2869cbhd.js → chunk-2tda49mv.js} +3 -3
- package/dist/{chunk-2869cbhd.js.map → chunk-2tda49mv.js.map} +1 -1
- package/dist/{chunk-1z311hyj.js → chunk-2x0n3ze1.js} +2 -2
- package/dist/{chunk-1z311hyj.js.map → chunk-2x0n3ze1.js.map} +1 -1
- package/dist/{chunk-cp84b0ev.js → chunk-35zw2s61.js} +3 -3
- package/dist/{chunk-cp84b0ev.js.map → chunk-35zw2s61.js.map} +1 -1
- package/dist/{chunk-7ynnce4b.js → chunk-3wnczt5w.js} +3 -3
- package/dist/{chunk-7ynnce4b.js.map → chunk-3wnczt5w.js.map} +3 -3
- package/dist/{chunk-v09w6pr2.js → chunk-3xy41vc0.js} +3 -3
- package/dist/{chunk-v09w6pr2.js.map → chunk-3xy41vc0.js.map} +1 -1
- package/dist/{chunk-fezaxj28.js → chunk-47eav3ex.js} +2 -2
- package/dist/{chunk-fezaxj28.js.map → chunk-47eav3ex.js.map} +1 -1
- package/dist/{chunk-ww86zqbw.js → chunk-4gmhx2ba.js} +2 -2
- package/dist/{chunk-ww86zqbw.js.map → chunk-4gmhx2ba.js.map} +1 -1
- package/dist/{chunk-k10vbrjx.js → chunk-4wda9teq.js} +3 -3
- package/dist/{chunk-k10vbrjx.js.map → chunk-4wda9teq.js.map} +1 -1
- package/dist/{chunk-ja41ts8v.js → chunk-4z0rt6ws.js} +2 -2
- package/dist/{chunk-ja41ts8v.js.map → chunk-4z0rt6ws.js.map} +1 -1
- package/dist/{chunk-xtqhagxz.js → chunk-539w9yt3.js} +2 -2
- package/dist/{chunk-xtqhagxz.js.map → chunk-539w9yt3.js.map} +1 -1
- package/dist/{chunk-9122838b.js → chunk-58mg4rpd.js} +2 -2
- package/dist/{chunk-9122838b.js.map → chunk-58mg4rpd.js.map} +1 -1
- package/dist/{chunk-0m2fyw7g.js → chunk-63xekerg.js} +2 -2
- package/dist/{chunk-0m2fyw7g.js.map → chunk-63xekerg.js.map} +1 -1
- package/dist/{chunk-qv8sj2z3.js → chunk-65fq5a9d.js} +2 -2
- package/dist/{chunk-qv8sj2z3.js.map → chunk-65fq5a9d.js.map} +1 -1
- package/dist/{chunk-bg5qb9hm.js → chunk-65s63bdh.js} +2 -2
- package/dist/{chunk-bg5qb9hm.js.map → chunk-65s63bdh.js.map} +1 -1
- package/dist/chunk-77ymcf7q.js +4 -0
- package/dist/chunk-77ymcf7q.js.map +10 -0
- package/dist/{chunk-wn437678.js → chunk-7j48ymk1.js} +2 -2
- package/dist/{chunk-wn437678.js.map → chunk-7j48ymk1.js.map} +1 -1
- package/dist/{chunk-dak8txaw.js → chunk-7n0zn5h4.js} +2 -2
- package/dist/{chunk-dak8txaw.js.map → chunk-7n0zn5h4.js.map} +1 -1
- package/dist/{chunk-p528pvmm.js → chunk-822p54vc.js} +2 -2
- package/dist/{chunk-p528pvmm.js.map → chunk-822p54vc.js.map} +1 -1
- package/dist/{chunk-qjmcn5m5.js → chunk-838cdh6v.js} +2 -2
- package/dist/{chunk-qjmcn5m5.js.map → chunk-838cdh6v.js.map} +1 -1
- package/dist/{chunk-h55c9bdf.js → chunk-8fvt7kys.js} +1 -1
- package/dist/{chunk-xtnbcbkf.js → chunk-aprjvzrz.js} +2 -2
- package/dist/{chunk-nvfhx9d1.js.map → chunk-aprjvzrz.js.map} +1 -1
- package/dist/{chunk-sh39q44t.js → chunk-asmszzkp.js} +3 -3
- package/dist/{chunk-sh39q44t.js.map → chunk-asmszzkp.js.map} +1 -1
- package/dist/{chunk-nvfhx9d1.js → chunk-ayjfs5mm.js} +2 -2
- package/dist/{chunk-xtnbcbkf.js.map → chunk-ayjfs5mm.js.map} +1 -1
- package/dist/{chunk-kmcnfk2s.js → chunk-b00z33zg.js} +1 -1
- package/dist/{chunk-pgddb43b.js → chunk-c1gq2ttb.js} +2 -2
- package/dist/{chunk-pgddb43b.js.map → chunk-c1gq2ttb.js.map} +1 -1
- package/dist/{chunk-0vxwrc4t.js → chunk-cggywjzz.js} +2 -2
- package/dist/{chunk-0vxwrc4t.js.map → chunk-cggywjzz.js.map} +1 -1
- package/dist/{chunk-n1t4ea9g.js → chunk-d5g1caxb.js} +3 -3
- package/dist/{chunk-n1t4ea9g.js.map → chunk-d5g1caxb.js.map} +1 -1
- package/dist/{chunk-f8ce6e9c.js → chunk-dp2yz8bj.js} +2 -2
- package/dist/{chunk-f8ce6e9c.js.map → chunk-dp2yz8bj.js.map} +1 -1
- package/dist/{chunk-43vjbd6n.js → chunk-dxm5gxqk.js} +1 -1
- package/dist/{chunk-9701fx4z.js → chunk-dz76qhx8.js} +2 -2
- package/dist/{chunk-9701fx4z.js.map → chunk-dz76qhx8.js.map} +1 -1
- package/dist/{chunk-fv53h1q2.js → chunk-e1fhy2h5.js} +2 -2
- package/dist/{chunk-fv53h1q2.js.map → chunk-e1fhy2h5.js.map} +1 -1
- package/dist/{chunk-1yttk239.js → chunk-e4ay1vg9.js} +2 -2
- package/dist/{chunk-1yttk239.js.map → chunk-e4ay1vg9.js.map} +1 -1
- package/dist/{chunk-5nkvpc0a.js → chunk-f21v4n2v.js} +1 -1
- package/dist/{chunk-wv3nnq8c.js → chunk-fgtr9cds.js} +3 -3
- package/dist/{chunk-wv3nnq8c.js.map → chunk-fgtr9cds.js.map} +1 -1
- package/dist/chunk-fx7r6pdf.js +122 -0
- package/dist/{chunk-0ryswty9.js.map → chunk-fx7r6pdf.js.map} +9 -8
- package/dist/{chunk-nh9ewam0.js → chunk-fxm8fqh9.js} +1 -1
- package/dist/{chunk-tn3y2qkj.js → chunk-fzs7g6mc.js} +2 -2
- package/dist/{chunk-tn3y2qkj.js.map → chunk-fzs7g6mc.js.map} +1 -1
- package/dist/{chunk-1rq53cb0.js → chunk-gnaxedwh.js} +2 -2
- package/dist/{chunk-1rq53cb0.js.map → chunk-gnaxedwh.js.map} +1 -1
- package/dist/{chunk-njaxnv6c.js → chunk-h0xye69a.js} +2 -2
- package/dist/{chunk-njaxnv6c.js.map → chunk-h0xye69a.js.map} +1 -1
- package/dist/{chunk-ty5sp1ym.js → chunk-hdgbh8hn.js} +2 -2
- package/dist/{chunk-ty5sp1ym.js.map → chunk-hdgbh8hn.js.map} +1 -1
- package/dist/{chunk-jcps2gpp.js → chunk-hnf11jhc.js} +2 -2
- package/dist/{chunk-jcps2gpp.js.map → chunk-hnf11jhc.js.map} +1 -1
- package/dist/{chunk-vjpby5sf.js → chunk-hr8annr1.js} +3 -3
- package/dist/{chunk-vjpby5sf.js.map → chunk-hr8annr1.js.map} +1 -1
- package/dist/{chunk-k107vw69.js → chunk-j1wc4afr.js} +2 -2
- package/dist/{chunk-k107vw69.js.map → chunk-j1wc4afr.js.map} +1 -1
- package/dist/{chunk-2z1gd231.js → chunk-j4y0sjdc.js} +2 -2
- package/dist/{chunk-2z1gd231.js.map → chunk-j4y0sjdc.js.map} +1 -1
- package/dist/{chunk-er5ed5pg.js → chunk-jbd723h1.js} +3 -3
- package/dist/{chunk-er5ed5pg.js.map → chunk-jbd723h1.js.map} +1 -1
- package/dist/{chunk-5ym464xx.js → chunk-jd1afbrs.js} +4 -4
- package/dist/{chunk-5ym464xx.js.map → chunk-jd1afbrs.js.map} +1 -1
- package/dist/{chunk-xhm5wgfe.js → chunk-jxmc33m9.js} +2 -2
- package/dist/{chunk-xhm5wgfe.js.map → chunk-jxmc33m9.js.map} +1 -1
- package/dist/{chunk-pxsq9841.js → chunk-jxvec7jc.js} +2 -2
- package/dist/{chunk-pxsq9841.js.map → chunk-jxvec7jc.js.map} +1 -1
- package/dist/chunk-mvka90rq.js +5 -0
- package/dist/{chunk-pqn9j5s8.js.map → chunk-mvka90rq.js.map} +1 -1
- package/dist/{chunk-mc8mxx2a.js → chunk-mym7egdq.js} +2 -2
- package/dist/{chunk-mc8mxx2a.js.map → chunk-mym7egdq.js.map} +1 -1
- package/dist/{chunk-np73p641.js → chunk-mz73066c.js} +2 -2
- package/dist/{chunk-np73p641.js.map → chunk-mz73066c.js.map} +1 -1
- package/dist/{chunk-3dyd4z06.js → chunk-n7sbwpce.js} +2 -2
- package/dist/{chunk-3dyd4z06.js.map → chunk-n7sbwpce.js.map} +1 -1
- package/dist/{chunk-gpdsxwkt.js → chunk-p320fd3g.js} +2 -2
- package/dist/{chunk-gpdsxwkt.js.map → chunk-p320fd3g.js.map} +1 -1
- package/dist/{chunk-nwzsgzvy.js → chunk-p462p2xe.js} +2 -2
- package/dist/{chunk-nwzsgzvy.js.map → chunk-p462p2xe.js.map} +1 -1
- package/dist/{chunk-2bmk0fzm.js → chunk-p642ja42.js} +3 -3
- package/dist/{chunk-2bmk0fzm.js.map → chunk-p642ja42.js.map} +1 -1
- package/dist/{chunk-jj1ppnnk.js → chunk-p6b0cyf8.js} +2 -2
- package/dist/{chunk-jj1ppnnk.js.map → chunk-p6b0cyf8.js.map} +1 -1
- package/dist/{chunk-8jqve5dr.js → chunk-pahr13xg.js} +2 -2
- package/dist/{chunk-8jqve5dr.js.map → chunk-pahr13xg.js.map} +1 -1
- package/dist/{chunk-wf3qe12c.js → chunk-pzb3agv9.js} +2 -2
- package/dist/{chunk-wf3qe12c.js.map → chunk-pzb3agv9.js.map} +1 -1
- package/dist/{chunk-87rtxv9n.js → chunk-qspam5cf.js} +2 -2
- package/dist/{chunk-87rtxv9n.js.map → chunk-qspam5cf.js.map} +1 -1
- package/dist/{chunk-n4dk0dc9.js → chunk-qz89m7ss.js} +2 -2
- package/dist/{chunk-n4dk0dc9.js.map → chunk-qz89m7ss.js.map} +1 -1
- package/dist/{chunk-gzaaspe7.js → chunk-rjyw1thg.js} +2 -2
- package/dist/{chunk-gzaaspe7.js.map → chunk-rjyw1thg.js.map} +1 -1
- package/dist/{chunk-2epj17ac.js → chunk-t227jn4b.js} +2 -2
- package/dist/{chunk-2epj17ac.js.map → chunk-t227jn4b.js.map} +1 -1
- package/dist/{chunk-x92g4x4w.js → chunk-v5esvs66.js} +2 -2
- package/dist/{chunk-x92g4x4w.js.map → chunk-v5esvs66.js.map} +1 -1
- package/dist/{chunk-4yp84g2y.js → chunk-w26cw41m.js} +2 -2
- package/dist/{chunk-4yp84g2y.js.map → chunk-w26cw41m.js.map} +1 -1
- package/dist/{chunk-03wc6em7.js → chunk-x07rp3fc.js} +1 -1
- package/dist/{chunk-7321qjgb.js → chunk-x4yq0c9v.js} +3 -3
- package/dist/{chunk-7321qjgb.js.map → chunk-x4yq0c9v.js.map} +1 -1
- package/dist/{chunk-5bk7767a.js → chunk-xhvknqvn.js} +2 -2
- package/dist/{chunk-5bk7767a.js.map → chunk-xhvknqvn.js.map} +1 -1
- package/dist/{chunk-1gdzajwb.js → chunk-xjs72pb0.js} +2 -2
- package/dist/{chunk-1gdzajwb.js.map → chunk-xjs72pb0.js.map} +1 -1
- package/dist/{chunk-13agap7z.js → chunk-y14weak4.js} +4 -4
- package/dist/{chunk-13agap7z.js.map → chunk-y14weak4.js.map} +3 -3
- package/dist/{chunk-pgh7gsag.js → chunk-z1gjgr1c.js} +2 -2
- package/dist/{chunk-pgh7gsag.js.map → chunk-z1gjgr1c.js.map} +1 -1
- package/dist/{chunk-jm1f9cas.js → chunk-zc5962gh.js} +2 -2
- package/dist/{chunk-jm1f9cas.js.map → chunk-zc5962gh.js.map} +1 -1
- package/dist/{chunk-b7wmssj5.js → chunk-zzgt759n.js} +2 -2
- package/dist/{chunk-b7wmssj5.js.map → chunk-zzgt759n.js.map} +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/ViewRouter.d.ts +17 -0
- package/dist/http/ViewRouter.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/httpDev.d.ts.map +1 -1
- package/dist/server/httpProd.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -3
- package/dist/services/index.js.map +2 -2
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/DomainResolver.d.ts +12 -0
- package/dist/services/router/DomainResolver.d.ts.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/config.d.ts +21 -5
- package/dist/services/router/config.d.ts.map +1 -1
- package/dist/services/router/documentScript.d.ts +46 -0
- package/dist/services/router/documentScript.d.ts.map +1 -0
- package/dist/services/router/staticDocument.d.ts +11 -1
- package/dist/services/router/staticDocument.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +4 -2
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/staticDocument.d.ts +8 -2
- package/dist/testing/staticDocument.d.ts.map +1 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-0ryswty9.js +0 -120
- package/dist/chunk-bnp6wpzd.js +0 -4
- package/dist/chunk-bnp6wpzd.js.map +0 -10
- package/dist/chunk-pqn9j5s8.js +0 -5
- /package/dist/{chunk-h55c9bdf.js.map → chunk-8fvt7kys.js.map} +0 -0
- /package/dist/{chunk-kmcnfk2s.js.map → chunk-b00z33zg.js.map} +0 -0
- /package/dist/{chunk-43vjbd6n.js.map → chunk-dxm5gxqk.js.map} +0 -0
- /package/dist/{chunk-5nkvpc0a.js.map → chunk-f21v4n2v.js.map} +0 -0
- /package/dist/{chunk-nh9ewam0.js.map → chunk-fxm8fqh9.js.map} +0 -0
- /package/dist/{chunk-03wc6em7.js.map → chunk-x07rp3fc.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fd as H,Id as _}from"../../chunk-
|
|
2
|
+
import{Fd as H,Id as _}from"../../chunk-0g5f8ymy.js";import{wj as O}from"../../chunk-z1gjgr1c.js";import"../../chunk-j4y0sjdc.js";import"../../chunk-w26cw41m.js";import"../../chunk-0q68t71d.js";import"../../chunk-e4ay1vg9.js";import"../../chunk-35zw2s61.js";import"../../chunk-h0xye69a.js";import{Pk as U,Qk as V,Uk as Z}from"../../chunk-mz73066c.js";import{Yk as Y}from"../../chunk-hdgbh8hn.js";import"../../chunk-aprjvzrz.js";import X from"path";function T(z){if(!z.config.get("route.channels"))return null;let C=z.config.get("broadcast",{}).driver;if(!(C===void 0||C==="memory"||C instanceof O))return null;return'[gemi] Broadcasts from this worker reach no one: the broadcast driver is "memory", which delivers to the sockets of the process that emits, and a worker has none. Set `driver: "redis"` in app/config/broadcast.ts.'}class J extends Error{name="QueueWorkerRefused"}class N{kernel;stopping;keepAlive;settings;constructor(z,C={}){this.kernel=z;this.settings={...V(),...C}}async start(){if(await this.kernel.waitForBoot(),this.stopping)return;let z=this.kernel.app;if(!z.bound(H))throw new J("[gemi] `gemi queue:work` has no queue to claim from: this application does not register QueueServiceProvider.");let C=z.make(H);if(!C.durable)throw new J('[gemi] `gemi queue:work` refuses to start: the queue uses the memory driver, which keeps each job in the process that dispatched it, so a worker never sees one. Set `driver: "database"` (or another driver every process can reach) in app/config/queue.ts, or run jobs in the server and drop the worker.');C.start(),this.keepAlive=setInterval(()=>{},1073741824),console.log(`[gemi] Queue worker started: claiming up to ${C.config.concurrency} job(s) at a time.`);let E=T(z);if(E)console.warn(E)}stop(z={}){return this.stopping??=this.drain({...this.settings,...z}),this.stopping}async drain(z){U();let C=this.kernel.app,E=C.resolved(H)?C.make(H):void 0;if(E)console.log(`[gemi] Shutting down: waiting for ${E.running} running job(s) (up to ${z.timeoutMs/1000}s).`),await E.drain(z.timeoutMs);let F=await this.kernel.shutdown({timeoutMs:z.providerTimeoutMs});clearInterval(this.keepAlive);let G=(E?.running??0)===0&&F.failed.length===0&&F.timedOut.length===0;return console.log(`[gemi] Shutdown ${G?"complete":"finished with errors"}.`),G?0:1}}async function $(){let z=Y();process.env.ROOT_DIR=z,process.env.APP_DIR=X.join(z,"app"),_();let C=X.join(z,"app/kernel/Kernel.ts"),{default:E}=await import(C);if(typeof E!=="function")return console.error(`[gemi] ${C} has no default export to boot the worker from.`),1;let F=new E;F.boot();let G=new N(F);Z(()=>G.stop());try{await G.start()}catch(L){if(!(L instanceof J))throw L;return console.error(L.message),1}return}$().then((z)=>{if(z!==void 0)process.exit(z)},(z)=>{console.error("[gemi] The queue worker failed to start:",z),process.exit(1)});
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=D2C30B0C0F737DA264756E2164756E21
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import type { Application, ShutdownReport } from \"../../foundation/Application\";\nimport { markShuttingDown, shutdownSettings, type ShutdownSettings } from \"../../server/shutdown\";\nimport { memoryBroadcastInWorker } from \"../broadcast/workerWarning\";\nimport { QueueManager } from \"./QueueManager\";\n\n/** The part of a `Kernel` a worker drives. */\nexport type WorkerKernel = {\n readonly app: Application;\n waitForBoot(): Promise<void>;\n shutdown(options?: { timeoutMs?: number }): Promise<ShutdownReport>;\n};\n\n/**\n * A worker that was told to start in an application it cannot claim for. The\n * message is written for the operator reading the deploy's logs.\n */\nexport class QueueWorkerRefused extends Error {\n name = \"QueueWorkerRefused\";\n}\n\n/**\n * The process `gemi queue:work` runs: the application booted as a server boots\n * it, claiming from the queue, and no `Bun.serve`. It exists so job capacity\n * can be scaled apart from request traffic, which needs a driver both kinds of\n * process can reach; see `start` for why the memory driver is refused.\n *\n * The caller marks the process as a worker (`markQueueWorker`) before the\n * kernel registers, so every claim rule that asks `claimsInThisProcess` sees a\n * process that claims, whatever `GEMI_QUEUE_CLAIM` says.\n */\nexport class QueueWorker {\n private stopping: Promise<number> | undefined;\n private keepAlive: ReturnType<typeof setInterval> | undefined;\n private readonly settings: ShutdownSettings;\n\n /**\n * `settings` default to the `GEMI_SHUTDOWN_*` variables, read here rather\n * than at the signal so a bad value is warned about while the deploy is\n * being watched, as `Server.start` does.\n */\n constructor(\n private readonly kernel: WorkerKernel,\n settings: Partial<ShutdownSettings> = {},\n ) {\n this.settings = { ...shutdownSettings(), ...settings };\n }\n\n /**\n * Boots the application and starts claiming. Rejects with\n * `QueueWorkerRefused` when the application has no queue, or its queue uses\n * the memory driver.\n *\n * Refused rather than warned about, because a memory worker can never do\n * anything: its jobs live in a `Map` in the process that dispatched them,\n * so a worker's is always empty. Left running, it looks like a healthy\n * deploy — a process up, no errors — that runs nothing, and scaling it out\n * adds no capacity. An exit the platform reports as a crash loop is a form\n * of the mistake someone will see.\n */\n async start(): Promise<void> {\n await this.kernel.waitForBoot();\n // A signal during the boot has already drained and cleared the handle\n // below. Going on would start the loop again and arm a handle nothing\n // clears, holding open a worker that has finished shutting down.\n if (this.stopping) return;\n\n const application = this.kernel.app;\n // `bound`, not `make` in a try: an application built without the queue\n // provider is a configuration to name, not an unbound-token stack trace.\n if (!application.bound(QueueManager)) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` has no queue to claim from: this application \" +\n \"does not register QueueServiceProvider.\",\n );\n }\n const queue = application.make(QueueManager);\n if (!queue.durable) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` refuses to start: the queue uses the memory \" +\n \"driver, which keeps each job in the process that dispatched it, so \" +\n 'a worker never sees one. Set `driver: \"database\"` (or another driver ' +\n \"every process can reach) in app/config/queue.ts, or run jobs in the \" +\n \"server and drop the worker.\",\n );\n }\n\n // Idempotent: a production boot with a durable driver has already started\n // it (`startClaimingIfServing`). Development has not, and a worker claims\n // in either.\n queue.start();\n // The queue's poll timer is unref'd, so that a script's queue does not\n // hold it open; here the queue is the process, and without a handle of its\n // own an idle worker would exit 0 as soon as it booted.\n this.keepAlive = setInterval(() => {}, 1 << 30);\n console.log(\n `[gemi] Queue worker started: claiming up to ${queue.config.concurrency} job(s) at a time.`,\n );\n const broadcastWarning = memoryBroadcastInWorker(application);\n if (broadcastWarning) console.warn(broadcastWarning);\n }\n\n /**\n * Stops claiming, waits for the running jobs, runs every provider's\n * `shutdown()`, and resolves with the exit code: 0 when no job was left\n * running and every provider finished in time, 1 otherwise. Idempotent.\n *\n * `gemi start`'s drain, with the jobs where the requests were:\n * `isShuttingDown()` turns true, which stops a durable queue claiming;\n * running jobs get `timeoutMs` (`GEMI_SHUTDOWN_TIMEOUT`), which a server\n * spends on requests; then `Application.shutdown` gets `providerTimeoutMs`,\n * and in it the queue provider waits for whatever is still running and\n * names it. The two budgets add up as they do for a server, so a worker\n * fits the same grace period. `delayMs` is not waited: it is for a load\n * balancer, and nothing routes to a worker.\n */\n stop(settings: Partial<ShutdownSettings> = {}): Promise<number> {\n this.stopping ??= this.drain({ ...this.settings, ...settings });\n return this.stopping;\n }\n\n private async drain(settings: ShutdownSettings): Promise<number> {\n markShuttingDown();\n const application = this.kernel.app;\n // Resolving the manager now would build a driver only to stop it, which\n // is what a signal during the boot, before the provider resolved it, finds.\n const queue = application.resolved(QueueManager) ? application.make(QueueManager) : undefined;\n if (queue) {\n console.log(\n `[gemi] Shutting down: waiting for ${queue.running} running job(s) ` +\n `(up to ${settings.timeoutMs / 1000}s).`,\n );\n await queue.drain(settings.timeoutMs);\n }\n\n const report = await this.kernel.shutdown({ timeoutMs: settings.providerTimeoutMs });\n clearInterval(this.keepAlive);\n const clean =\n (queue?.running ?? 0) === 0 && report.failed.length === 0 && report.timedOut.length === 0;\n console.log(`[gemi] Shutdown ${clean ? \"complete\" : \"finished with errors\"}.`);\n return clean ? 0 : 1;\n }\n}\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";gcAYA,kBCDO,OAAS,DAAuB,DAAC,AAAyC,DAC/E,CAAI,DAAC,AAAY,KAAO,IAAI,gBAAgB,EAAG,OAAO,KACtD,IAAM,EAAS,EAAY,OAAO,IAAqB,YAAa,CAAC,CAAC,EAAE,OAGxE,GAAI,EADF,IAAW,QAAa,IAAW,UAAY,aAAkB,GACtD,OAAO,KACpB,MACE,uNCFG,MAAM,UAA2B,KAAM,CAC5C,KAAO,oBACT,CAYO,MAAM,CAAY,CAWJ,OAVX,SACA,UACS,SAOjB,WAAW,CACQ,EACjB,EAAsC,CAAC,EACvC,CAFiB,cAGjB,KAAK,SAAW,IAAK,EAAiB,KAAM,CAAS,OAejD,MAAK,EAAkB,CAK3B,GAJA,MAAM,KAAK,OAAO,YAAY,EAI1B,KAAK,SAAU,OAEnB,IAAM,EAAc,KAAK,OAAO,IAGhC,GAAI,CAA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,IAAM,EAAS,IAAI,EACnB,EAAO,KAAK,EAEZ,IAAM,EAAS,IAAI,EAAY,CAAM,EAKrC,EAAuB,IAAM,EAAO,KAAK,CAAC,EAE1C,GAAI,CACF,MAAM,EAAO,MAAM,EACnB,MAAO,EAAO,CACd,GAAI,EAAE,aAAiB,GAAqB,MAAM,EAElD,OADA,QAAQ,MAAM,EAAM,OAAO,EACpB,EAGT,OAGF,EAAK,EAAE,KACL,CAAC,IAAS,CACR,GAAI,IAAS,OAAW,QAAQ,KAAK,CAAI,GAE3C,CAAC,IAAU,CACT,QAAQ,MAAM,2CAA4C,CAAK,EAC/D,QAAQ,KAAK,CAAC,EAElB",
|
|
10
|
-
"debugId": "
|
|
10
|
+
"debugId": "D2C30B0C0F737DA264756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -59,6 +59,18 @@ export declare class DomainResolver {
|
|
|
59
59
|
* the platform's health checks and its own domain for the app keep working.
|
|
60
60
|
*/
|
|
61
61
|
private forwardedHost;
|
|
62
|
+
/**
|
|
63
|
+
* The client address `trustProxy.clientIpHeader` names — its first entry —
|
|
64
|
+
* or `null` when no such header is configured, the secret is missing or
|
|
65
|
+
* wrong, or the header is absent or not an IPv4/IPv6 address.
|
|
66
|
+
*/
|
|
67
|
+
trustedClientIp(req: Request): string | null;
|
|
68
|
+
/**
|
|
69
|
+
* Makes `trustedClientIp(req)`, when there is one, the address the rest of
|
|
70
|
+
* gemi reads: the only entry of `X-Forwarded-For`, with `X-Real-IP` dropped
|
|
71
|
+
* (as `gemi start` leaves them). Otherwise leaves `req` alone. Idempotent.
|
|
72
|
+
*/
|
|
73
|
+
applyClientIp(req: Request): void;
|
|
62
74
|
/** The hostname the request is addressed to, honouring `trustProxy`. */
|
|
63
75
|
hostOf(req: Request): string | null;
|
|
64
76
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainResolver.d.ts","sourceRoot":"","sources":["../../../services/router/DomainResolver.ts"],"names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C,CAAC;QAClC;;;;;;;;;;;WAWG;QACH,WAAW,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;QACpD;;;WAGG;QACH,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,wEAAwE;QACxE,aAAa,CAAC,EAAE,cAAc,CAAC;QAC/B;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CAs7BJ"}
|
|
@@ -127,7 +127,8 @@ export interface CustomDomainConfig {
|
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* `route.domains.trustProxy` in its long form: which header carries the host
|
|
130
|
-
* the client addressed, and what proves the proxy
|
|
130
|
+
* the client addressed, which one its IP address, and what proves the proxy
|
|
131
|
+
* sent them.
|
|
131
132
|
*/
|
|
132
133
|
export interface TrustProxyConfig {
|
|
133
134
|
/**
|
|
@@ -142,7 +143,22 @@ export interface TrustProxyConfig {
|
|
|
142
143
|
*/
|
|
143
144
|
hostHeader?: string;
|
|
144
145
|
/**
|
|
145
|
-
*
|
|
146
|
+
* A header the proxy writes the client's IP address into, e.g.
|
|
147
|
+
* `"x-client-ip"` set from Cloudflare's `CF-Connecting-IP`. On a request
|
|
148
|
+
* that carries `secret`, its first entry replaces the address
|
|
149
|
+
* `GEMI_TRUST_PROXY` settled on: gemi writes it into `X-Forwarded-For` (and
|
|
150
|
+
* drops `X-Real-IP`) before the global middleware runs, so `clientIp(req)`
|
|
151
|
+
* and every rate limit keyed on it see the visitor rather than the proxy.
|
|
152
|
+
*
|
|
153
|
+
* For a proxy whose request to the app is a new one (a Worker's `fetch()`),
|
|
154
|
+
* so the client's address is not in `X-Forwarded-For` at all. Requires
|
|
155
|
+
* `secret`: without proof the proxy sent it, any client that reaches the
|
|
156
|
+
* app directly could pick its own address. A missing header, or one that
|
|
157
|
+
* is not an IPv4/IPv6 address, changes nothing.
|
|
158
|
+
*/
|
|
159
|
+
clientIpHeader?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Trusts `hostHeader` and `clientIpHeader` only on a request that carries this header with this
|
|
146
162
|
* value — a shared secret the proxy adds, so a client that reaches the app
|
|
147
163
|
* directly, around the proxy, cannot name its own host. Without it the
|
|
148
164
|
* request is routed by its own host, exactly as with `trustProxy` left out.
|
|
@@ -167,9 +183,9 @@ export interface DomainsConfig {
|
|
|
167
183
|
* request URL. Only set it behind a proxy that overwrites that header, or a
|
|
168
184
|
* client picks its own host.
|
|
169
185
|
*
|
|
170
|
-
* `true` reads `X-Forwarded-Host`. An object names the header,
|
|
171
|
-
* trusting it depend on a shared secret the proxy sends
|
|
172
|
-
* {@link TrustProxyConfig}.
|
|
186
|
+
* `true` reads `X-Forwarded-Host`. An object names the header, can make
|
|
187
|
+
* trusting it depend on a shared secret the proxy sends, and can name a
|
|
188
|
+
* header that carries the client's IP address — see {@link TrustProxyConfig}.
|
|
173
189
|
*
|
|
174
190
|
* The scheme is read from `X-Forwarded-Proto` whether or not this is set.
|
|
175
191
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../services/router/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;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E,WAAW,GAAG,WAAW,CAElE;AAGD,wBAAgB,sBAAsB,IAAI,IAAI,CAC5C,QAAQ,CAAC,cAAc,CAAC,EACxB,YAAY,CACb,CAMA;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAC7C,QAAQ,CAAC,eAAe,CAAC,EACzB,MAAM,GAAG,YAAY,CACtB,CASA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A static view's document script (#919): `.static({ script: "site/clicks" })`
|
|
3
|
+
* inlines `app/views/site/clicks.script.ts`, bundled and minified, once in the
|
|
4
|
+
* document's head.
|
|
5
|
+
*
|
|
6
|
+
* `gemi build` bundles every `app/views/**\/*.script.{ts,js}` into
|
|
7
|
+
* `dist/server/document-scripts.json` (name → source), which `gemi start`
|
|
8
|
+
* reads. Anywhere else (dev, a test through `app.fetch`) a script is bundled
|
|
9
|
+
* from source on each use, so an edit shows on the next load.
|
|
10
|
+
*/
|
|
11
|
+
/** The suffix that marks a file under `app/views` as a document script. */
|
|
12
|
+
export declare const DOCUMENT_SCRIPT_SUFFIX = ".script";
|
|
13
|
+
/** Under `dist/server`. */
|
|
14
|
+
export declare const DOCUMENT_SCRIPTS_MANIFEST = "document-scripts.json";
|
|
15
|
+
/** The attribute the inlined `<script>` carries, naming its script. */
|
|
16
|
+
export declare const DOCUMENT_SCRIPT_ATTRIBUTE = "data-gemi-script";
|
|
17
|
+
/** The source file of `name` under `appDir`, or `null` when there is none. */
|
|
18
|
+
export declare function documentScriptFile(appDir: string, name: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Bundles one script for the browser: imports inlined, minified, wrapped in an
|
|
21
|
+
* IIFE so nothing leaks into the page's scope. Throws when it does not bundle,
|
|
22
|
+
* or when the output holds `</script` or `<!--`, which would end (or confuse)
|
|
23
|
+
* the inline `<script>` element it is put in.
|
|
24
|
+
*/
|
|
25
|
+
export declare function bundleDocumentScript(file: string): Promise<string>;
|
|
26
|
+
/** Every document script under `appDir/views`, bundled: what `gemi build` writes. */
|
|
27
|
+
export declare function bundleDocumentScripts(appDir: string): Promise<Record<string, string>>;
|
|
28
|
+
/** `'sha256-…'` of `source`, for a `script-src` directive. */
|
|
29
|
+
export declare function cspHashOf(source: string): string;
|
|
30
|
+
/** Forgets the manifest read by `documentScriptSource` (tests). @internal */
|
|
31
|
+
export declare function resetDocumentScripts(): void;
|
|
32
|
+
/**
|
|
33
|
+
* The inlined text of the document script `name`.
|
|
34
|
+
*
|
|
35
|
+
* In production, from `dist/server/document-scripts.json`. A name the
|
|
36
|
+
* manifest lacks (or no manifest) is bundled from source once. Elsewhere it is
|
|
37
|
+
* bundled from source each time. Throws when there is no such file.
|
|
38
|
+
*/
|
|
39
|
+
export declare function documentScriptSource(name: string): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* `'sha256-…'` for the document script `name` exactly as a page inlines it,
|
|
42
|
+
* for a `script-src` directive next to `STATIC_NAVIGATION_CSP_HASH`. In dev
|
|
43
|
+
* it follows the source, so it changes as the file does.
|
|
44
|
+
*/
|
|
45
|
+
export declare function documentScriptCspHash(name: string): Promise<string>;
|
|
46
|
+
//# sourceMappingURL=documentScript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentScript.d.ts","sourceRoot":"","sources":["../../../services/router/documentScript.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,2BAA2B;AAC3B,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AACjE,uEAAuE;AACvE,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAa5D,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9E;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBxE;AAED,qFAAqF;AACrF,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAa3F;AAED,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhD;AAeD,6EAA6E;AAC7E,wBAAgB,oBAAoB,SAGnC;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBxE;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzE"}
|
|
@@ -40,6 +40,11 @@ export interface StaticNavigationMarker {
|
|
|
40
40
|
identity: string;
|
|
41
41
|
prefetch: "intent" | "none";
|
|
42
42
|
}
|
|
43
|
+
/** A document script to inline: its name and bundled source (#919). */
|
|
44
|
+
export interface DocumentScript {
|
|
45
|
+
name: string;
|
|
46
|
+
source: string;
|
|
47
|
+
}
|
|
43
48
|
/**
|
|
44
49
|
* Adds the client runtime to a settled static document.
|
|
45
50
|
*
|
|
@@ -54,8 +59,13 @@ export interface StaticNavigationMarker {
|
|
|
54
59
|
*
|
|
55
60
|
* Without a resolver (a test rendering through `app.fetch`), no island table
|
|
56
61
|
* is injected and nothing is logged.
|
|
62
|
+
*
|
|
63
|
+
* A `script` (`.static({ script })`) is inlined at the end of the head as a
|
|
64
|
+
* module script, whatever else the page has. The navigation runtime leaves
|
|
65
|
+
* the head's scripts alone when it swaps a page in, so it runs once per
|
|
66
|
+
* document.
|
|
57
67
|
*/
|
|
58
|
-
export declare function injectIslands(html: string, collector: StaticRenderCollector, resolveIsland: IslandResolver | undefined, dev: boolean, navigation?: StaticNavigationMarker): string;
|
|
68
|
+
export declare function injectIslands(html: string, collector: StaticRenderCollector, resolveIsland: IslandResolver | undefined, dev: boolean, navigation?: StaticNavigationMarker, script?: DocumentScript): string;
|
|
59
69
|
/**
|
|
60
70
|
* Moves each island's children into its slot.
|
|
61
71
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticDocument.d.ts","sourceRoot":"","sources":["../../../services/router/staticDocument.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"staticDocument.d.ts","sourceRoot":"","sources":["../../../services/router/staticDocument.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAGlF,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE7D,qFAAqF;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;AAE5E,uEAAuE;AACvE,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,QAEb,CAAC;AAgBvB;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,QAEjB,CAAC;AAWvB,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC7B;AAED,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,qBAAqB,EAChC,aAAa,EAAE,cAAc,GAAG,SAAS,EACzC,GAAG,EAAE,OAAO,EACZ,UAAU,CAAC,EAAE,sBAAsB,EACnC,MAAM,CAAC,EAAE,cAAc,GACtB,MAAM,CA+CR;AAcD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgBtD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-
|
|
2
|
+
import"../chunk-aprjvzrz.js";import M from"path";import{writeFileSync as Q}from"fs";var L=new Set(["FILE","REDIRECT"]);function H(j){return j.run(()=>{let x=[];for(let{group:z,view:D}of j.domains().viewGroups())for(let[G,B]of Object.entries(D.flatViewRoutes)){let C=D.routeManifest[G]??B.segments.map((K)=>K.viewPath);if(C.length===0||L.has(C.at(-1)))continue;x.push({path:G,group:z,views:C,...B.static?{static:{...B.static.layout?{layout:B.static.layout}:{},...B.static.navigation?{navigation:!0}:{}}}:{}})}return x})}var J=process.argv[2];async function U(){if(!J)throw Error("usage: route-table <out.json>");let j=M.resolve(process.cwd(),"app/kernel/Kernel.ts"),x=await import(j);if(typeof x.default!=="function")throw Error(`${j} has no default export (the Kernel subclass).`);let z=new x.default;z.boot();try{Q(J,JSON.stringify(H(z)))}finally{z.destroy()}}U().then(()=>process.exit(0),(j)=>{console.error(j?.stack??String(j)),process.exit(1)});
|
|
3
3
|
|
|
4
4
|
//# debugId=05EB0087C5A2060D64756E2164756E21
|
package/dist/support/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Nd as Y}from"../chunk-py1twqh8.js";import{
|
|
2
|
+
import{Nd as Y}from"../chunk-py1twqh8.js";import{Bj as M}from"../chunk-w26cw41m.js";import{Dk as P,Fk as R}from"../chunk-35zw2s61.js";import"../chunk-h0xye69a.js";import{Vk as Q,Wk as U,Xk as V,Yk as W}from"../chunk-hdgbh8hn.js";import"../chunk-aprjvzrz.js";class S{static token;async boot(){}static inject(){if(!this.token)throw Error(`Service [${this.name}] does not declare a \`static token\`, so the container has no key to resolve it by.`);try{return R(this)}catch(x){throw Error(`Could not inject [${this.name}]. Services are constructed when the kernel boots, so `+"inject() only works from code that runs after that \u2014 a constructor default or a method "+`body, never module top level. Check that [${this.name}] is listed in \`services\` on your Kernel.`,{cause:x})}}static with(x){let f=new this;for(let[C,g]of Object.entries(x))if(g!==void 0)f[C]=g;return f}}import{readdir as z}from"fs/promises";import{join as B,parse as j}from"path";var H=[".ts",".tsx",".js",".mjs",".jsx"];function J(x={}){let f={};for(let[C,g]of Object.entries(x))f[C]=q(g);return new P(f)}async function L(x,f=new P){let C=[];try{C=await z(x)}catch(D){return f}let g=C.filter((D)=>{let{ext:v,name:F}=j(D);return H.includes(v)&&!F.startsWith(".")}).sort();for(let D of g){let{name:v}=j(D),F=await import(B(x,D));f.set(v,q(F))}return f}function q(x){if(x&&typeof x==="object"&&"default"in x)return x.default;return x}export{M as withDefaults,Q as sourceFiles,W as projectRoot,L as loadConfigFrom,V as discoverClasses,J as createConfigRepository,Y as ServiceProvider,S as Service,P as Repository,U as DiscoveryError};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=C7BC5A516D5D322964756E2164756E21
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"import { readdir } from \"node:fs/promises\";\nimport { join, parse } from \"node:path\";\n\nimport { Repository } from \"./Repository\";\n\nconst CONFIG_EXTENSIONS = [\".ts\", \".tsx\", \".js\", \".mjs\", \".jsx\"];\n\n// Builds a Repository from an already-imported map of config modules. The map\n// key becomes the top-level config key, so `{ mail: mailModule }` is readable\n// as `config.get(\"mail.driver\")`. Each entry may be either the module namespace\n// (its `default` export is unwrapped) or the config object itself.\nexport function createConfigRepository(\n modules: Record<string, any> = {},\n): Repository {\n const items: Record<string, any> = {};\n\n for (const [key, mod] of Object.entries(modules)) {\n items[key] = unwrap(mod);\n }\n\n return new Repository(items);\n}\n\n// Reads every config module in an app's `app/config` directory into a\n// Repository. The file's basename is the top-level key: `app/config/mail.ts`\n// populates `mail.*`. A missing directory yields an empty Repository so apps\n// that declare no config still boot.\nexport async function loadConfigFrom(\n directory: string,\n repository = new Repository(),\n): Promise<Repository> {\n let entries: string[] = [];\n\n try {\n entries = await readdir(directory);\n } catch (err) {\n return repository;\n }\n\n const files = entries\n .filter((entry) => {\n const { ext, name } = parse(entry);\n return CONFIG_EXTENSIONS.includes(ext) && !name.startsWith(\".\");\n })\n .sort();\n\n for (const file of files) {\n const { name } = parse(file);\n const mod = await import(join(directory, file));\n repository.set(name, unwrap(mod));\n }\n\n return repository;\n}\n\nfunction unwrap(mod: any) {\n if (mod && typeof mod === \"object\" && \"default\" in mod) {\n return mod.default;\n }\n return mod;\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";2RAgCO,CAAe,JAAQ,EAOrB,OAMD,AAAI,EAAkB,QAmBrB,OAAS,EAKX,CACH,GAAI,CAAC,KAAK,MACR,MAAU,MACR,YAAY,KAAK,0FACnB,EAGF,GAAI,CACF,OAAO,EAAI,IAAuB,EAClC,MAAO,EAAO,CACd,MAAU,MACR,qBAAqB,KAAK,6DACxB,+FACA,6CAA6C,KAAK,kDAEpD,CAAE,OAAM,CACV,SAoBG,KAAuB,CAAoB,EAA0B,CAC1E,IAAM,EAAW,IAAI,KACrB,QAAY,EAAK,KAAU,OAAO,QAAQ,CAAS,EACjD,GAAI,IAAU,OAAW,EAAS,GAAO,EAE3C,OAAO,EAEX,CChHA,kBAAS,oBACT,eAAS,WAAM,aAIf,IAAM,EAAoB,CAAC,MAAO,OAAQ,MAAO,OAAQ,MAAM,EAMxD,SAAS,CAAsB,CACpC,EAA+B,CAAC,EACpB,CACZ,IAAM,EAA6B,CAAC,EAEpC,QAAY,EAAK,KAAQ,OAAO,QAAQ,CAAO,EAC7C,EAAM,GAAO,EAAO,CAAG,EAGzB,OAAO,IAAI,EAAW,CAAK,EAO7B,eAAsB,CAAc,CAClC,EACA,EAAa,IAAI,EACI,CACrB,IAAI,EAAoB,CAAC,EAEzB,GAAI,CACF,EAAU,MAAM,EAAQ,CAAS,EACjC,MAAO,EAAK,CACZ,OAAO,EAGT,IAAM,EAAQ,EACX,OAAO,CAAC,IAAU,CACjB,IAAQ,MAAK,QAAS,EAAM,CAAK,EACjC,OAAO,EAAkB,SAAS,CAAG,GAAK,CAAC,EAAK,WAAW,GAAG,EAC/D,EACA,KAAK,EAER,QAAW,KAAQ,EAAO,CACxB,IAAQ,QAAS,EAAM,CAAI,EACrB,EAAM,MAAa,SAAK,EAAW,CAAI,GAC7C,EAAW,IAAI,EAAM,EAAO,CAAG,CAAC,EAGlC,OAAO,EAGT,SAAS,CAAM,CAAC,EAAU,CACxB,GAAI,GAAO,OAAO,IAAQ,UAAY,YAAa,EACjD,OAAO,EAAI,QAEb,OAAO",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "C7BC5A516D5D322964756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/testing/index.js
CHANGED
|
@@ -596,8 +596,8 @@ var hydrate = new Function("createElement", "hydrateRoot", `${ISLAND_HYDRATE_SOU
|
|
|
596
596
|
* page.dispose();
|
|
597
597
|
* ```
|
|
598
598
|
*
|
|
599
|
-
* The document's own scripts do not run (the helper runs the runtime itself
|
|
600
|
-
* and a link the runtime leaves alone is not followed. Islands hydrate
|
|
599
|
+
* The document's own scripts do not run (the helper runs the runtime itself,
|
|
600
|
+
* and the document script with `documentScript: true`), and a link the runtime leaves alone is not followed. Islands hydrate
|
|
601
601
|
* asynchronously, as in a browser: wrap what follows in `act`, or wait for it.
|
|
602
602
|
*/
|
|
603
603
|
function renderStaticDocument(html, options = {}) {
|
|
@@ -614,6 +614,7 @@ function renderStaticDocument(html, options = {}) {
|
|
|
614
614
|
});
|
|
615
615
|
history.replaceState(null, "", options.url ?? "/");
|
|
616
616
|
const parsed = new DOMParser().parseFromString(html, "text/html");
|
|
617
|
+
const documentScript = options.documentScript ? parsed.querySelector("head > script[data-gemi-script]")?.textContent : void 0;
|
|
617
618
|
for (const script of Array.from(parsed.querySelectorAll("script"))) if (!/json/.test(script.type)) script.remove();
|
|
618
619
|
document.replaceChild(document.importNode(parsed.documentElement, true), document.documentElement);
|
|
619
620
|
const fullLoad = (url) => {
|
|
@@ -683,6 +684,7 @@ function renderStaticDocument(html, options = {}) {
|
|
|
683
684
|
window.scrollTo = () => {};
|
|
684
685
|
const scrollIntoView = Element.prototype.scrollIntoView;
|
|
685
686
|
Element.prototype.scrollIntoView = function() {};
|
|
687
|
+
if (documentScript) new Function(documentScript)();
|
|
686
688
|
const source = STATIC_NAVIGATION_SOURCE.replace("import(", "__import(");
|
|
687
689
|
new Function("__import", "location", "fetch", source)(importIsland, location, fetch);
|
|
688
690
|
return {
|