void 0.21.2 → 0.21.4
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/{account-cmd-D8OC-U7y.mjs → account-cmd-DGt9cpRe.mjs} +4 -4
- package/dist/{agents-gni4eqBu.mjs → agents-B_pX_HmQ.mjs} +1 -1
- package/dist/ast-CPGPjb0V.mjs +18 -0
- package/dist/{auth-CAw7zHqj.mjs → auth-CZuiVsFh.mjs} +1 -1
- package/dist/{auth-B9_D6ygs.mjs → auth-DLNN0D3Z.mjs} +4 -4
- package/dist/{auth-link-BYFeMJAp.mjs → auth-link-Cl9vOuf7.mjs} +4 -4
- package/dist/{auth-router-OHZNmrb_.mjs → auth-router-D4ZcMUSf.mjs} +6 -6
- package/dist/{better-auth-shared-BoVwA5Vm.d.mts → better-auth-shared-BVkjZ3vM.d.mts} +1 -0
- package/dist/{better-auth-shared-syGYYmnY.mjs → better-auth-shared-rsBGBvWJ.mjs} +3 -6
- package/dist/{build-cmd-Bft7EY51.mjs → build-cmd-Dpt0jd-x.mjs} +4 -4
- package/dist/{cache-CKV1Gz2w.mjs → cache-7_UeZdTk.mjs} +4 -4
- package/dist/{cancel-deploy-BAKmkX4f.mjs → cancel-deploy-D23R1RXT.mjs} +3 -3
- package/dist/{cf-access-rAZxzMkL.mjs → cf-access-P0iZnu0q.mjs} +1 -1
- package/dist/{cf-build-output-CTdlo6Rt.mjs → cf-build-output-CGT03qCD.mjs} +2 -2
- package/dist/cli/cf-compat.mjs +2 -2
- package/dist/cli/cli.mjs +47 -43
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-4cDVv7BO.mjs +2 -0
- package/dist/{client-PdAJ-F0t.mjs → client-QTl6ko_D.mjs} +28 -5
- package/dist/{cloudflare-auth-BCmTc1X_.mjs → cloudflare-auth-B9jPCkV2.mjs} +1 -1
- package/dist/{cloudflare-cmd-D6PrKn7o.mjs → cloudflare-cmd-BjNxR1XF.mjs} +3 -3
- package/dist/{cloudflare-connect-DloREDlc.mjs → cloudflare-connect-CCUozPOe.mjs} +3 -3
- package/dist/{cloudflare-operations-BHNJVDbN.mjs → cloudflare-operations-BipGMJ5O.mjs} +1 -1
- package/dist/{cloudflare-operations-CPEdHYhM.mjs → cloudflare-operations-sMZXpk_S.mjs} +4 -4
- package/dist/collect-DLyFDiKW.mjs +2 -0
- package/dist/{collect-DXHNWHcT.mjs → collect-DiTn9yr6.mjs} +1 -1
- package/dist/config-0acf1oys.mjs +2 -0
- package/dist/{config-DywxBLQC.d.mts → config-CF69HgXc.d.mts} +7 -0
- package/dist/{config-Dxr6cTXn.mjs → config-CafTW6Cz.mjs} +12 -1
- package/dist/{config-BSe70f4T.mjs → config-D8MOgiQV.mjs} +3 -3
- package/dist/config-DPByhVck.mjs +32 -0
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config--T87TD8T.mjs → config-s7Xj7tPb.mjs} +1 -1
- package/dist/{config-write-y3CBI_ux.mjs → config-write-BSduPMY8.mjs} +3 -3
- package/dist/{connect-DLx1pRYk.mjs → connect-4Ph5Y0QE.mjs} +7 -7
- package/dist/{create-project-JV9-6ICF.mjs → create-project-BniEV0OW.mjs} +1 -1
- package/dist/{create-project-BZBl_gQ0.mjs → create-project-DBfFSZKY.mjs} +4 -4
- package/dist/{db-B98_UV4H.mjs → db-CTXIWD42.mjs} +123 -55
- package/dist/{delete-BEEyqlwd.mjs → delete-D6dZ9B6B.mjs} +4 -4
- package/dist/deploy-BVwow28d.mjs +2 -0
- package/dist/{deploy-Bsymb0_c.mjs → deploy-F1exK5F4.mjs} +567 -263
- package/dist/discover-AMCBXivQ.mjs +2 -0
- package/dist/{discover-C4O6YxVS.mjs → discover-BcPPiF1o.mjs} +2 -2
- package/dist/{dist-4WkAWhWx.mjs → dist-BVqXeR_h.mjs} +9 -1
- package/dist/dist-_UUlL6bg.mjs +2 -0
- package/dist/{domain-Av2AkLQP.mjs → domain-Dmhvb2oU.mjs} +4 -4
- package/dist/{email-C5kaZXzJ.mjs → email--tEtMoj_.mjs} +1 -1
- package/dist/{email-CUqa6TtH.mjs → email-BxHabktK.mjs} +9 -9
- package/dist/{entry-DdRFGK0y.mjs → entry-CF5wvH4w.mjs} +4 -21
- package/dist/{env-D4RIGEzz.mjs → env-Csi-tMbT.mjs} +7 -7
- package/dist/{env-Yz4HcvHs.mjs → env-D5liuQYR.mjs} +5 -2
- package/dist/{env-DX_v-Q-v.mjs → env-_v349JBd.mjs} +1 -1
- package/dist/{env-types-CWDtqHgw.mjs → env-types-C2_bIk_b.mjs} +2 -2
- package/dist/{env-validation-BsFEXps5.mjs → env-validation-BB4GkLxn.mjs} +4 -4
- package/dist/{env-validation-DIDGM7h4.mjs → env-validation-BXge7uyK.mjs} +1 -1
- package/dist/{gen-pg-Ojg8Y.mjs → gen-Dz3X1Qab.mjs} +8 -8
- package/dist/gen-Vnv2f65C.mjs +2 -0
- package/dist/{generate-C0VY6RVf.mjs → generate-GDbL7sUr.mjs} +2 -2
- package/dist/{github-cmd-BEK4VprE.mjs → github-cmd-BED3_9JD.mjs} +4 -4
- package/dist/{headers-B_HBMgi0.mjs → headers-BOg_velo.mjs} +2 -2
- package/dist/{help-iQOt7WHk.mjs → help-DC7gdz7L.mjs} +7 -3
- package/dist/help-DQMfeKMz.mjs +2 -0
- package/dist/index.mjs +132 -158
- package/dist/{init-D5niUPAz.mjs → init-CRGDXzVC.mjs} +105 -289
- package/dist/{link-3lGrfXzd.mjs → link-CsHOinF7.mjs} +5 -5
- package/dist/{list-CVjGr_C6.mjs → list-CDb-4bZ1.mjs} +5 -5
- package/dist/{local-d1-DzykTWY8.mjs → local-d1-CC8sKFGu.mjs} +3 -3
- package/dist/{login-BgQJzxAl.mjs → login-BQyISZuW.mjs} +3 -3
- package/dist/login-r2gL8l7B.mjs +2 -0
- package/dist/{logs-DbzD-QDf.mjs → logs-BdfiOezj.mjs} +4 -4
- package/dist/{migrate-BV8qHiCb.mjs → migrate-B8KuoYsO.mjs} +69 -44
- package/dist/migrate-TsHGBnDA.mjs +2 -0
- package/dist/{node-Cupyf7-s.mjs → node-BM43oz4G.mjs} +5 -5
- package/dist/{operator-auth-BkVgJqv-.mjs → operator-auth-8KnOVXVd.mjs} +2 -2
- package/dist/{operator-client-A0iex2yi.mjs → operator-client-DUwumHpQ.mjs} +2 -2
- package/dist/{operator-cmd-CR6Lxzt0.mjs → operator-cmd-Co-PeaeD.mjs} +6 -6
- package/dist/{package-json-iCbMg5XF.mjs → package-json-DXfiT1jV.mjs} +1 -1
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +11 -6
- package/dist/pages/islands-plugin.d.mts +271 -1
- package/dist/pages/islands-plugin.mjs +95 -18
- package/dist/parse-filename-DioPHiR9.mjs +77 -0
- package/dist/{platform-auth-config-De7BqRJm.mjs → platform-auth-config-TSw8edHw.mjs} +5 -5
- package/dist/{platform-auth-protection-Dcat-6zu.mjs → platform-auth-protection-Ba1XqGhn.mjs} +6 -6
- package/dist/{platform-auth-recovery-C9gsM640.mjs → platform-auth-recovery-BkT3EsF2.mjs} +5 -5
- package/dist/{platform-cmd-Cl9Uhzru.mjs → platform-cmd-C8OqhqPt.mjs} +1 -1
- package/dist/{platform-cmd-CudokNIg.mjs → platform-cmd-CRSKfu8k.mjs} +5 -5
- package/dist/{platform-domain-Ckpd2kXw.mjs → platform-domain-j9YCXRm6.mjs} +3 -3
- package/dist/{platform-lifecycle-DVzM2T4j.mjs → platform-lifecycle-78H0XQUA.mjs} +277 -229
- package/dist/{platform-lifecycle-DlpiGcjr.mjs → platform-lifecycle-DDc9zCeJ.mjs} +1 -1
- package/dist/{platform-management-ibuS1as0.mjs → platform-management-6w8-DUjC.mjs} +2 -2
- package/dist/{platform-management-44Bxd3YC.mjs → platform-management-DzKNsMlt.mjs} +1 -1
- package/dist/{platform-recovery-D_KmvdSk.mjs → platform-recovery-Do8VOyDE.mjs} +3 -3
- package/dist/{platform-registry-BJbgZLS1.mjs → platform-registry-QBa4DK32.mjs} +1 -1
- package/dist/{plugin-inference-DsvtJLll.mjs → plugin-inference-BMfKRSqE.mjs} +188 -85
- package/dist/prepare-BZXkjdNe.mjs +2 -0
- package/dist/{prepare-pcWcxSCh.mjs → prepare-C3kt3Rst.mjs} +11 -11
- package/dist/{prepare-_T-Haxrr.mjs → prepare-DyZ-Yok5.mjs} +1 -1
- package/dist/{prerender-render-Cf_WDE9W.mjs → prerender-render-D9qbLs2f.mjs} +1 -1
- package/dist/prerender-render.mjs +1 -1
- package/dist/{preset-Dowh9tTt.mjs → preset-UHj9ARyP.mjs} +4 -4
- package/dist/{project-BEBFDFLz.mjs → project-BuUwfj6f.mjs} +1 -1
- package/dist/{project-CWNIPoXc.mjs → project-C0Fqu05O.mjs} +2 -2
- package/dist/{project-cmd-BuF9doku.mjs → project-cmd-B44I8J_W.mjs} +15 -15
- package/dist/{project-paths-CKQ-Q5JS.mjs → project-paths-GgcMozYz.mjs} +1 -1
- package/dist/{project-team-B1Tia8vd.mjs → project-team-BkbYIsXN.mjs} +4 -4
- package/dist/{project-token-Bwxjf4y6.mjs → project-token-C8xEEQnB.mjs} +4 -4
- package/dist/{project-tsconfig-CwfqUnVp.mjs → project-tsconfig-B8GeM0RM.mjs} +2 -2
- package/dist/{provision-Cck2m3jJ.mjs → provision-BhreDAOS.mjs} +141 -78
- package/dist/provision-DNtrtaVD.mjs +3 -0
- package/dist/{requests-CphRF98D.mjs → requests-DFyhBMaf.mjs} +3 -3
- package/dist/{resolve-project-Xvis70DG.mjs → resolve-project-BG5ORGID.mjs} +1 -1
- package/dist/resolve-project-DtbidV4y.mjs +2 -0
- package/dist/{rollback-BYHJV2yD.mjs → rollback-DHHxXZiS.mjs} +4 -4
- package/dist/{route-types-Id82-veQ.mjs → route-types-Clm4WD0B.mjs} +39 -16
- package/dist/{runner-CQs_cDSG.mjs → runner-B8wXwWlo.mjs} +1 -1
- package/dist/{runner-mysql-1o47achK.mjs → runner-mysql-CEG5JozK.mjs} +1 -1
- package/dist/{runner-mysql-BhwMk2Bm.mjs → runner-mysql-DmWchSWJ.mjs} +1 -1
- package/dist/{runner-BGVsGgkb.mjs → runner-p-dMs2UN.mjs} +3 -3
- package/dist/{runner-pg-D7z01mQS.mjs → runner-pg-Bh4AgZdj.mjs} +1 -1
- package/dist/{runner-pg-CJ_JeGF6.mjs → runner-pg-D4OPlil-.mjs} +1 -1
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/db.mjs +8 -5
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-public.mjs +1 -1
- package/dist/runtime/env.d.mts +1 -1
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-server.mjs +38 -23
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/ws-server.d.mts +1 -1
- package/dist/runtime/ws-server.mjs +1 -1
- package/dist/{scan-DJbooZm2.mjs → scan-4tfN-PSn.mjs} +113 -99
- package/dist/{scan-DdDvRCU1.mjs → scan-ClYmX3sa.mjs} +35 -137
- package/dist/{secret-Rt9c4Ttw.mjs → secret-DN9sSNiV.mjs} +6 -6
- package/dist/{skills-B-690E7h.mjs → skills-O6FUaizK.mjs} +2 -2
- package/dist/sveltekit.mjs +1 -1
- package/dist/{validate-qNhV00PD.mjs → validate-CIUwFpjB.mjs} +2 -2
- package/dist/validate-EKmJWxmy.mjs +2 -0
- package/dist/{wrangler-D01qs6VB.mjs → wrangler-BymcxrRa.mjs} +3 -3
- package/dist/{yarn-pnp-CVEc3gE7.mjs → yarn-pnp-BV4AzNul.mjs} +1 -1
- package/package.json +7 -7
- package/schema.json +18 -0
- package/skills/void/docs/guide/app-types.md +1 -1
- package/skills/void/docs/guide/auth.md +2 -2
- package/skills/void/docs/guide/database/d1.md +6 -0
- package/skills/void/docs/guide/durable-state.md +1 -1
- package/skills/void/docs/guide/edge/rewrites.md +2 -3
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/pages-routing/markdown.md +1 -1
- package/skills/void/docs/guide/platform/development/local.md +1 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +2 -2
- package/skills/void/docs/guide/platform/installation/setup.md +1 -1
- package/skills/void/docs/guide/server-routing.md +2 -3
- package/skills/void/docs/guide/ssr.md +4 -10
- package/skills/void/docs/guide/websockets.md +1 -1
- package/skills/void/docs/integrations/cloudflare.md +3 -0
- package/skills/void/docs/reference/api.md +1 -1
- package/skills/void/docs/reference/cli.md +10 -3
- package/skills/void/docs/reference/config.md +11 -0
- package/skills/void/docs/reference/resource-inference.md +1 -1
- package/dist/client-DAAivdid.mjs +0 -2
- package/dist/collect-DAUItMDS.mjs +0 -2
- package/dist/config-DDIFxQYx.mjs +0 -2
- package/dist/config-uP7ZDtVZ.mjs +0 -21
- package/dist/deploy-CsjbRNyv.mjs +0 -2
- package/dist/discover-BBzDZe_o.mjs +0 -2
- package/dist/dist-D7-nEOXi.mjs +0 -2
- package/dist/gen-B87rlalt.mjs +0 -2
- package/dist/help-r_vrpH_d.mjs +0 -2
- package/dist/login-Bz0zEPoy.mjs +0 -2
- package/dist/migrate-BXY3B3m7.mjs +0 -2
- package/dist/prepare-D4CkM3_v.mjs +0 -2
- package/dist/provision-CNgEBkVA.mjs +0 -3
- package/dist/resolve-project-BTotl8Nn.mjs +0 -2
- package/dist/validate-DqJ33oHj.mjs +0 -2
|
@@ -3,6 +3,7 @@ import { t as __getLiveBindingName } from "../live-CB1y5IuC.mjs";
|
|
|
3
3
|
//#region src/runtime/live-server.ts
|
|
4
4
|
const GENERATION_KEY = "connection:generation";
|
|
5
5
|
const TOPIC_PRUNE_ALARM_DELAY_MS = 6e4;
|
|
6
|
+
const LIVE_FANOUT_CONCURRENCY = 6;
|
|
6
7
|
const textEncoder = new TextEncoder();
|
|
7
8
|
function createLiveDurableObject() {
|
|
8
9
|
class VoidLiveStreamDurableObject {
|
|
@@ -256,8 +257,10 @@ function createLiveDurableObject() {
|
|
|
256
257
|
...message.eventId !== void 0 && { eventId: message.eventId },
|
|
257
258
|
data: message.data
|
|
258
259
|
}) > message.limits.maxEncodedEventSize) return payloadTooLargeResponse(message.limits.maxEncodedEventSize);
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
const groups = [...grouped];
|
|
261
|
+
for (let offset = 0; offset < groups.length; offset += LIVE_FANOUT_CONCURRENCY) {
|
|
262
|
+
const batch = groups.slice(offset, offset + LIVE_FANOUT_CONCURRENCY);
|
|
263
|
+
const responses = await Promise.allSettled(batch.map(([connectionId, items]) => fetchWithTimeout(this.connectionStub(message.streamId, connectionId), internalUrl("/deliver"), {
|
|
261
264
|
method: "POST",
|
|
262
265
|
body: JSON.stringify({
|
|
263
266
|
streamId: message.streamId,
|
|
@@ -267,15 +270,20 @@ function createLiveDurableObject() {
|
|
|
267
270
|
eventId: message.eventId,
|
|
268
271
|
subscriptions: items.map((item) => item.row)
|
|
269
272
|
})
|
|
270
|
-
}, message.limits.deliveryAttemptTimeoutMs);
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
}, message.limits.deliveryAttemptTimeoutMs)));
|
|
274
|
+
for (const [index, outcome] of responses.entries()) {
|
|
275
|
+
if (outcome.status === "rejected") throw outcome.reason;
|
|
276
|
+
const response = outcome.value;
|
|
277
|
+
const items = batch[index][1];
|
|
278
|
+
if (!response || response.status === 410 || response.status === 404) {
|
|
279
|
+
await this.state.storage.delete(items.map((item) => item.key));
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (response.status === 413) return response;
|
|
283
|
+
if (response.ok) {
|
|
284
|
+
const staleKeys = (await response.json().catch(() => null))?.stale.map((staleIndex) => items[staleIndex]?.key).filter((key) => typeof key === "string");
|
|
285
|
+
if (staleKeys?.length) await this.state.storage.delete(staleKeys);
|
|
286
|
+
}
|
|
279
287
|
}
|
|
280
288
|
}
|
|
281
289
|
return Response.json({ ok: true });
|
|
@@ -297,20 +305,27 @@ function createLiveDurableObject() {
|
|
|
297
305
|
grouped.set(row.connectionId, list);
|
|
298
306
|
}
|
|
299
307
|
const staleKeys = [];
|
|
300
|
-
|
|
301
|
-
|
|
308
|
+
const groups = [...grouped];
|
|
309
|
+
for (let offset = 0; offset < groups.length; offset += LIVE_FANOUT_CONCURRENCY) {
|
|
310
|
+
const batch = groups.slice(offset, offset + LIVE_FANOUT_CONCURRENCY);
|
|
311
|
+
const responses = await Promise.allSettled(batch.map(([connectionId, items]) => fetchWithTimeout(this.connectionStub(items[0].row.streamId, connectionId), internalUrl("/check"), {
|
|
302
312
|
method: "POST",
|
|
303
313
|
body: JSON.stringify({ subscriptions: items.map((item) => item.row) })
|
|
304
|
-
}, limits.deliveryAttemptTimeoutMs);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
+
}, limits.deliveryAttemptTimeoutMs)));
|
|
315
|
+
for (const [index, outcome] of responses.entries()) {
|
|
316
|
+
if (outcome.status === "rejected") throw outcome.reason;
|
|
317
|
+
const response = outcome.value;
|
|
318
|
+
const items = batch[index][1];
|
|
319
|
+
if (!response || response.status === 410 || response.status === 404) {
|
|
320
|
+
staleKeys.push(...items.map((item) => item.key));
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (response.ok) {
|
|
324
|
+
const result = await response.json().catch(() => null);
|
|
325
|
+
for (const staleIndex of result?.stale ?? []) {
|
|
326
|
+
const key = items[staleIndex]?.key;
|
|
327
|
+
if (key) staleKeys.push(key);
|
|
328
|
+
}
|
|
314
329
|
}
|
|
315
330
|
}
|
|
316
331
|
}
|
package/dist/runtime/queues.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as requireRuntimeBinding } from "../env-
|
|
1
|
+
import { a as requireRuntimeBinding } from "../env-D5liuQYR.mjs";
|
|
2
2
|
//#region src/runtime/queues.ts
|
|
3
3
|
/** Typed queue producers — resolves `QUEUE_*` bindings from the active runtime environment. */
|
|
4
4
|
const queues = new Proxy({}, { get(_, name) {
|
package/dist/runtime/sandbox.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as getRawRuntimeEnv } from "../env-raw-Cx8ElDdj.mjs";
|
|
2
|
-
import { a as requireRuntimeBinding } from "../env-
|
|
2
|
+
import { a as requireRuntimeBinding } from "../env-D5liuQYR.mjs";
|
|
3
3
|
import { Sandbox, getSandbox as getSandbox$1 } from "@cloudflare/sandbox";
|
|
4
4
|
//#region src/runtime/sandbox.ts
|
|
5
5
|
const DEFAULT_SANDBOX_ID = "default";
|
package/dist/runtime/storage.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as AuthState } from "../auth-DkcFflXV.mjs";
|
|
2
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv } from "../better-auth-shared-
|
|
2
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv } from "../better-auth-shared-BVkjZ3vM.mjs";
|
|
3
3
|
import { t as AnyWebSocketDefinition } from "../ws-BwcqizuH.mjs";
|
|
4
4
|
//#region src/runtime/ws-server.d.ts
|
|
5
5
|
export type WebSocketRouteMeta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as authContext } from "../auth-3sGB0zJ1.mjs";
|
|
2
|
-
import { o as withRuntimeEnv } from "../env-
|
|
2
|
+
import { o as withRuntimeEnv } from "../env-D5liuQYR.mjs";
|
|
3
3
|
//#region src/runtime/ws-server.ts
|
|
4
4
|
function matchRoute(pattern, pathname) {
|
|
5
5
|
const patternSegments = pattern.split("/").filter(Boolean);
|
|
@@ -1,81 +1,40 @@
|
|
|
1
|
-
import { a as join, n as dirname, r as extname, t as basename } from "./dist-
|
|
2
|
-
import { n as readProjectPaths } from "./project-paths-
|
|
1
|
+
import { a as join, n as dirname, r as extname, t as basename } from "./dist-BVqXeR_h.mjs";
|
|
2
|
+
import { n as readProjectPaths } from "./project-paths-GgcMozYz.mjs";
|
|
3
3
|
import { t as glob } from "./dist-Bn8Kodjp.mjs";
|
|
4
|
+
import { n as isIdentifier, r as isLiteral } from "./ast-CPGPjb0V.mjs";
|
|
5
|
+
import { n as parseRouteFilename } from "./parse-filename-DioPHiR9.mjs";
|
|
4
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
for (const ext of EXTENSIONS) if (path.endsWith(ext)) {
|
|
17
|
-
path = path.slice(0, -ext.length);
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
if (isWebSocketRoute && path.endsWith(".ws")) path = path.slice(0, -3);
|
|
21
|
-
const segments = path.split("/");
|
|
22
|
-
let filename = segments.pop();
|
|
23
|
-
let env = null;
|
|
24
|
-
for (const suffix of ENV_SUFFIXES) if (filename.endsWith(`.${suffix}`)) {
|
|
25
|
-
env = suffix;
|
|
26
|
-
filename = filename.slice(0, -(suffix.length + 1));
|
|
27
|
-
break;
|
|
7
|
+
import { parseSync } from "vite";
|
|
8
|
+
//#region src/shared/static-exports.ts
|
|
9
|
+
/** Read the initializer of directly exported constants without evaluating user code. */
|
|
10
|
+
function staticExportInitializers(filename, source, names) {
|
|
11
|
+
const result = /* @__PURE__ */ new Map();
|
|
12
|
+
const program = parseSync(filename, source).program;
|
|
13
|
+
for (const statement of program.body ?? []) {
|
|
14
|
+
if (statement.type !== "ExportNamedDeclaration") continue;
|
|
15
|
+
const declaration = statement.declaration;
|
|
16
|
+
if (declaration?.type !== "VariableDeclaration" || declaration.kind !== "const") continue;
|
|
17
|
+
for (const variable of declaration.declarations ?? []) if (isIdentifier(variable.id) && names.has(variable.id.name) && variable.init) result.set(variable.id.name, variable.init);
|
|
28
18
|
}
|
|
29
|
-
|
|
30
|
-
if (segments[segments.length - 1] === "index") segments.pop();
|
|
31
|
-
const filtered = segments.filter((s) => !s.startsWith("(") || !s.endsWith(")"));
|
|
32
|
-
const params = [];
|
|
33
|
-
let catchAll = false;
|
|
34
|
-
return {
|
|
35
|
-
pattern: "/" + filtered.map((segment) => {
|
|
36
|
-
if (segment.startsWith("[...") && segment.endsWith("]")) {
|
|
37
|
-
const paramName = segment.slice(4, -1);
|
|
38
|
-
catchAll = true;
|
|
39
|
-
if (paramName) {
|
|
40
|
-
params.push(paramName);
|
|
41
|
-
return `:${paramName}{.+}`;
|
|
42
|
-
}
|
|
43
|
-
return "*";
|
|
44
|
-
}
|
|
45
|
-
if (segment.startsWith("[") && segment.endsWith("]")) {
|
|
46
|
-
const paramName = segment.slice(1, -1);
|
|
47
|
-
params.push(paramName);
|
|
48
|
-
return `:${paramName}`;
|
|
49
|
-
}
|
|
50
|
-
return segment;
|
|
51
|
-
}).join("/"),
|
|
52
|
-
methods: [],
|
|
53
|
-
params,
|
|
54
|
-
catchAll,
|
|
55
|
-
env,
|
|
56
|
-
filePath
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Parse a route filename (relative to routes/) into a RouteDefinition.
|
|
61
|
-
*
|
|
62
|
-
* Rules (applied in order):
|
|
63
|
-
* 1. Strip file extension (.ts, .js, .mts, .mjs)
|
|
64
|
-
* 2. Check for env suffix (.dev, .prod) → strip and record
|
|
65
|
-
* 3. Strip trailing "index" segment
|
|
66
|
-
* 4. Remove route group directories: (groupname)
|
|
67
|
-
* 5. Convert [param] → :param, [...param] → :param{.+}, [...] → *
|
|
68
|
-
* 6. Prefix with /
|
|
69
|
-
*/
|
|
70
|
-
function parseRouteFilename(relativePath) {
|
|
71
|
-
return parsePath(relativePath, false);
|
|
19
|
+
return result;
|
|
72
20
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
21
|
+
function unwrapStaticExpression(node) {
|
|
22
|
+
while (node && [
|
|
23
|
+
"ParenthesizedExpression",
|
|
24
|
+
"TSAsExpression",
|
|
25
|
+
"TSSatisfiesExpression",
|
|
26
|
+
"TSTypeAssertion"
|
|
27
|
+
].includes(node.type)) node = node.expression;
|
|
28
|
+
return node;
|
|
76
29
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
30
|
+
function staticLiteral(node) {
|
|
31
|
+
node = unwrapStaticExpression(node);
|
|
32
|
+
if (node?.type === "Literal") return node.value;
|
|
33
|
+
if (node?.type === "TemplateLiteral") {
|
|
34
|
+
const expressions = node.expressions;
|
|
35
|
+
const quasis = node.quasis;
|
|
36
|
+
if (expressions?.length === 0 && quasis?.length === 1) return quasis[0]?.value?.cooked;
|
|
37
|
+
}
|
|
79
38
|
}
|
|
80
39
|
//#endregion
|
|
81
40
|
//#region src/pages/layout-resolution.ts
|
|
@@ -161,16 +120,78 @@ const SERVER_EXTENSIONS = [
|
|
|
161
120
|
"mjs",
|
|
162
121
|
"mts"
|
|
163
122
|
];
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const SSR_FALSE_RE = /export\s+const\s+ssr\s*=\s*false\s*;?/;
|
|
170
|
-
const GET_PRERENDER_PATHS_RE = /export\s+(?:async\s+)?function\s+getPrerenderPaths\b/;
|
|
171
|
-
const LAYOUT_STRING_RE = /export\s+const\s+layout\s*=\s*["']([^"']+)["']\s*;?/;
|
|
172
|
-
const LAYOUT_FALSE_RE = /export\s+const\s+layout\s*=\s*false\s*;?/;
|
|
123
|
+
const PAGE_METHODS = /* @__PURE__ */ new Set([
|
|
124
|
+
"loader",
|
|
125
|
+
"action",
|
|
126
|
+
"actions"
|
|
127
|
+
]);
|
|
173
128
|
const MAX_REVALIDATE = 31536e3;
|
|
129
|
+
function componentLayout(source, filename) {
|
|
130
|
+
if (!source.includes("layout")) return;
|
|
131
|
+
const scripts = filename.endsWith(".vue") || filename.endsWith(".svelte") ? [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script\s*>/gi)].map((match) => match[1]) : [source];
|
|
132
|
+
for (const script of scripts) {
|
|
133
|
+
if (!script.includes("layout")) continue;
|
|
134
|
+
const value = staticLiteral(staticExportInitializers(filename.replace(/\.(vue|svelte)$/, ".ts"), script, /* @__PURE__ */ new Set(["layout"])).get("layout"));
|
|
135
|
+
if (typeof value === "string" || value === false) return value;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const TRANSPARENT_EXPRESSION_TYPES = /* @__PURE__ */ new Set([
|
|
139
|
+
"ParenthesizedExpression",
|
|
140
|
+
"TSAsExpression",
|
|
141
|
+
"TSNonNullExpression",
|
|
142
|
+
"TSSatisfiesExpression",
|
|
143
|
+
"TSTypeAssertion"
|
|
144
|
+
]);
|
|
145
|
+
function readLiteral(node) {
|
|
146
|
+
while (node && TRANSPARENT_EXPRESSION_TYPES.has(node.type)) node = node.expression;
|
|
147
|
+
return isLiteral(node) ? node.value : void 0;
|
|
148
|
+
}
|
|
149
|
+
function detectPageServerMetadata(source, filename) {
|
|
150
|
+
const metadata = { methods: [] };
|
|
151
|
+
let parsed;
|
|
152
|
+
try {
|
|
153
|
+
parsed = parseSync(filename, source);
|
|
154
|
+
} catch {
|
|
155
|
+
return metadata;
|
|
156
|
+
}
|
|
157
|
+
const program = parsed.program;
|
|
158
|
+
for (const node of program.body ?? []) {
|
|
159
|
+
if (node.type !== "ExportNamedDeclaration") continue;
|
|
160
|
+
const exported = node;
|
|
161
|
+
if (exported.exportKind === "type") continue;
|
|
162
|
+
const declaration = exported.declaration;
|
|
163
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
164
|
+
const variables = declaration;
|
|
165
|
+
for (const variable of variables.declarations ?? []) {
|
|
166
|
+
if (!isIdentifier(variable.id)) continue;
|
|
167
|
+
const name = variable.id.name;
|
|
168
|
+
if (PAGE_METHODS.has(name)) metadata.methods.push(name);
|
|
169
|
+
else if (name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
|
|
170
|
+
else if (variables.kind === "const") {
|
|
171
|
+
if (name === "revalidate") {
|
|
172
|
+
const value = readLiteral(variable.init);
|
|
173
|
+
if (typeof value === "number" && Number.isInteger(value) && value >= 0) metadata.revalidate = value;
|
|
174
|
+
} else if (name === "prerender" || name === "ssr") {
|
|
175
|
+
const value = readLiteral(variable.init);
|
|
176
|
+
if (typeof value === "boolean") metadata[name] = value;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
} else if (declaration?.type === "FunctionDeclaration") {
|
|
181
|
+
const functionName = declaration.id;
|
|
182
|
+
if (isIdentifier(functionName)) {
|
|
183
|
+
if (PAGE_METHODS.has(functionName.name)) metadata.methods.push(functionName.name);
|
|
184
|
+
else if (functionName.name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
for (const specifier of exported.specifiers ?? []) {
|
|
188
|
+
if (specifier.exportKind === "type" || !isIdentifier(specifier.exported)) continue;
|
|
189
|
+
if (PAGE_METHODS.has(specifier.exported.name)) metadata.methods.push(specifier.exported.name);
|
|
190
|
+
else if (specifier.exported.name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return metadata;
|
|
194
|
+
}
|
|
174
195
|
function inferAutoPrerender(page, options) {
|
|
175
196
|
const isDynamic = page.params.length > 0 || page.catchAll;
|
|
176
197
|
if (options?.output === "static") return !isDynamic || page.hasGetPrerenderPaths === true;
|
|
@@ -234,7 +255,8 @@ async function scanPages(root, options) {
|
|
|
234
255
|
});
|
|
235
256
|
continue;
|
|
236
257
|
}
|
|
237
|
-
const
|
|
258
|
+
const parseName = hasIslandSuffix ? file.replace(`.island${ext}`, ".ts") : file.replace(ext, ".ts");
|
|
259
|
+
const route = parseRouteFilename(parseName);
|
|
238
260
|
const componentId = file.replace(ext, "").replace(/\.island$/, "").replace(/\/index$/, "").replace(/^index$/, "") || "index";
|
|
239
261
|
let serverPath = null;
|
|
240
262
|
const methods = [];
|
|
@@ -247,15 +269,12 @@ async function scanPages(root, options) {
|
|
|
247
269
|
const candidate = `${serverBase}.server.${serverExt}`;
|
|
248
270
|
if (existsSync(join(pagesDir, candidate))) {
|
|
249
271
|
serverPath = candidate;
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (SSR_TRUE_RE.test(content)) ssr = true;
|
|
257
|
-
else if (SSR_FALSE_RE.test(content)) ssr = false;
|
|
258
|
-
if (GET_PRERENDER_PATHS_RE.test(content)) hasGetPrerenderPaths = true;
|
|
272
|
+
const metadata = detectPageServerMetadata(readFileSync(join(pagesDir, candidate), "utf-8"), candidate);
|
|
273
|
+
methods.push(...metadata.methods);
|
|
274
|
+
revalidate = metadata.revalidate;
|
|
275
|
+
prerender = metadata.prerender;
|
|
276
|
+
ssr = metadata.ssr;
|
|
277
|
+
hasGetPrerenderPaths = metadata.hasGetPrerenderPaths;
|
|
259
278
|
break;
|
|
260
279
|
}
|
|
261
280
|
}
|
|
@@ -276,12 +295,7 @@ async function scanPages(root, options) {
|
|
|
276
295
|
const mdContent = readFileSync(join(pagesDir, file), "utf-8");
|
|
277
296
|
metadata = extractFrontmatterMeta(mdContent);
|
|
278
297
|
layout = extractFrontmatterLayout(mdContent);
|
|
279
|
-
} else
|
|
280
|
-
const componentContent = readFileSync(join(pagesDir, file), "utf-8");
|
|
281
|
-
const layoutStringMatch = componentContent.match(LAYOUT_STRING_RE);
|
|
282
|
-
if (layoutStringMatch) layout = layoutStringMatch[1];
|
|
283
|
-
else if (LAYOUT_FALSE_RE.test(componentContent)) layout = false;
|
|
284
|
-
}
|
|
298
|
+
} else layout = componentLayout(readFileSync(join(pagesDir, file), "utf-8"), file);
|
|
285
299
|
pages.push({
|
|
286
300
|
pattern: route.pattern,
|
|
287
301
|
params: route.params,
|
|
@@ -352,4 +366,4 @@ function extractFrontmatterLayout(source) {
|
|
|
352
366
|
return value;
|
|
353
367
|
}
|
|
354
368
|
//#endregion
|
|
355
|
-
export { resolveNamedLayout as a,
|
|
369
|
+
export { resolveNamedLayout as a, unwrapStaticExpression as c, resolveLayoutIds as i, resolveEffectiveLayoutChain as n, staticExportInitializers as o, resolveLayoutChain as r, staticLiteral as s, scanPages as t };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { a as join, i as isAbsolute, t as basename } from "./dist-
|
|
2
|
-
import { n as readProjectPaths } from "./project-paths-
|
|
1
|
+
import { a as join, i as isAbsolute, t as basename } from "./dist-BVqXeR_h.mjs";
|
|
2
|
+
import { n as readProjectPaths } from "./project-paths-GgcMozYz.mjs";
|
|
3
3
|
import { n as globSync, t as glob } from "./dist-Bn8Kodjp.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
6
|
-
import {
|
|
4
|
+
import { n as isIdentifier } from "./ast-CPGPjb0V.mjs";
|
|
5
|
+
import { c as unwrapStaticExpression, o as staticExportInitializers, s as staticLiteral, t as scanPages } from "./scan-4tfN-PSn.mjs";
|
|
6
|
+
import { a as isWebSocketPatternFile, o as scanWebSocketRoutes } from "./plugin-inference-BMfKRSqE.mjs";
|
|
7
|
+
import { n as parseRouteFilename, t as isRouteEnabledForEnvironment } from "./parse-filename-DioPHiR9.mjs";
|
|
8
|
+
import { i as scanEmailHandlers } from "./email--tEtMoj_.mjs";
|
|
7
9
|
import { readFileSync } from "node:fs";
|
|
8
10
|
import { parseSync } from "vite";
|
|
9
11
|
//#region src/crons/scan.ts
|
|
@@ -17,21 +19,15 @@ function extractJobName(filePath) {
|
|
|
17
19
|
return filePath.replace(/\.[^.]+$/, "");
|
|
18
20
|
}
|
|
19
21
|
function extractCronExpressions(source, filePath) {
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!items || items.length === 0) throw new Error(`cron: Invalid job file '${filePath}'. Cron array cannot be empty.`);
|
|
30
|
-
return items.map((item) => {
|
|
31
|
-
return item.match(/['"`]([^'"`]+)['"`]/)[1].trim();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
throw new Error(`cron: Invalid job file '${filePath}'. Add \`export const cron = "<schedule>"\`.`);
|
|
22
|
+
const initializer = unwrapStaticExpression(staticExportInitializers(filePath, source, /* @__PURE__ */ new Set(["cron"])).get("cron"));
|
|
23
|
+
if (!initializer) throw new Error(`cron: Invalid job file '${filePath}'. Add \`export const cron = "<schedule>"\`.`);
|
|
24
|
+
const values = initializer.type === "ArrayExpression" ? initializer.elements ?? [] : [initializer];
|
|
25
|
+
if (values.length === 0) throw new Error(`cron: Invalid job file '${filePath}'. Cron array cannot be empty.`);
|
|
26
|
+
return values.map((value) => {
|
|
27
|
+
const cron = staticLiteral(value ?? void 0);
|
|
28
|
+
if (typeof cron !== "string" || !cron.trim()) throw new Error(`cron: Invalid job file '${filePath}'. Cron expression must be a nonempty string literal.`);
|
|
29
|
+
return cron.trim();
|
|
30
|
+
});
|
|
35
31
|
}
|
|
36
32
|
function resolveDir(root, dir) {
|
|
37
33
|
return isAbsolute(dir) ? dir : join(root, dir);
|
|
@@ -82,25 +78,34 @@ function extractName(filePath) {
|
|
|
82
78
|
function deriveQueueBindingName(name) {
|
|
83
79
|
return "QUEUE_" + name.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
84
80
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
const OPTION_NAMES = [
|
|
82
|
+
"maxBatchSize",
|
|
83
|
+
"maxBatchTimeout",
|
|
84
|
+
"maxRetries",
|
|
85
|
+
"retryDelay"
|
|
86
|
+
];
|
|
90
87
|
function parseQueueFiles(root, queuesDir, files) {
|
|
91
88
|
const queuesDirPath = isAbsolute(queuesDir) ? queuesDir : join(root, queuesDir);
|
|
92
89
|
const definitions = files.filter((filePath) => !filePath.split("/").some((segment) => segment.startsWith("_"))).sort().map((filePath) => {
|
|
93
90
|
const absPath = join(queuesDirPath, filePath);
|
|
94
91
|
const source = readFileSync(absPath, "utf-8");
|
|
95
92
|
const name = extractName(filePath);
|
|
93
|
+
const options = OPTION_NAMES.some((option) => source.includes(option)) ? staticExportInitializers(absPath, source, new Set(OPTION_NAMES)) : /* @__PURE__ */ new Map();
|
|
94
|
+
const optionValue = (option) => {
|
|
95
|
+
const initializer = options.get(option);
|
|
96
|
+
if (!initializer) return;
|
|
97
|
+
const value = staticLiteral(initializer);
|
|
98
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) throw new Error(`queue: ${option} in '${filePath}' must be a nonnegative integer literal.`);
|
|
99
|
+
return value;
|
|
100
|
+
};
|
|
96
101
|
return {
|
|
97
102
|
filePath,
|
|
98
103
|
name,
|
|
99
104
|
bindingName: deriveQueueBindingName(name),
|
|
100
|
-
maxBatchSize:
|
|
101
|
-
maxBatchTimeout:
|
|
102
|
-
maxRetries:
|
|
103
|
-
retryDelay:
|
|
105
|
+
maxBatchSize: optionValue("maxBatchSize"),
|
|
106
|
+
maxBatchTimeout: optionValue("maxBatchTimeout"),
|
|
107
|
+
maxRetries: optionValue("maxRetries"),
|
|
108
|
+
retryDelay: optionValue("retryDelay")
|
|
104
109
|
};
|
|
105
110
|
});
|
|
106
111
|
const filesByName = /* @__PURE__ */ new Map();
|
|
@@ -186,113 +191,6 @@ function detectHttpExports(absPath) {
|
|
|
186
191
|
return methods;
|
|
187
192
|
}
|
|
188
193
|
//#endregion
|
|
189
|
-
//#region src/router/websocket.ts
|
|
190
|
-
const HANDLER_EXTENSIONS = [
|
|
191
|
-
"ts",
|
|
192
|
-
"mts",
|
|
193
|
-
"js",
|
|
194
|
-
"mjs"
|
|
195
|
-
];
|
|
196
|
-
const WEBSOCKET_ROUTE_RE = /(?:\.(?:dev|prod))?\.ws\.(?:ts|mts|js|mjs)$/;
|
|
197
|
-
function isWebSocketRouteFile(filePath) {
|
|
198
|
-
return WEBSOCKET_ROUTE_RE.test(filePath.replace(/\\/g, "/"));
|
|
199
|
-
}
|
|
200
|
-
function toIdentifierPart(segment) {
|
|
201
|
-
return segment.replace(/^\(\s*|\s*\)$/g, "").replace(/^\[\.\.\.(.+)\]$/, "$1").replace(/^\[(.+)\]$/, "$1").replace(/\.ws$/, "").replace(/\.(dev|prod)$/, "").replace(/[^a-zA-Z0-9]+/g, " ").split(" ").filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
|
|
202
|
-
}
|
|
203
|
-
function deriveWebSocketClassName(filePath) {
|
|
204
|
-
const parts = filePath.replace(/\\/g, "/").replace(/\.(ts|mts|js|mjs)$/, "").split("/").filter((segment) => segment.length > 0 && !(segment.startsWith("(") && segment.endsWith(")"))).map(toIdentifierPart).filter(Boolean);
|
|
205
|
-
return (parts.length > 0 ? parts.join("") : "WebSocket") + "Ws";
|
|
206
|
-
}
|
|
207
|
-
function getPropertyName(node) {
|
|
208
|
-
if (!node) return null;
|
|
209
|
-
if (isIdentifier(node)) return node.name;
|
|
210
|
-
if (isLiteral(node) && typeof node.value === "string") return node.value;
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
function extractDefinition(call) {
|
|
214
|
-
if (!isCallExpression(call)) return null;
|
|
215
|
-
if (!isIdentifier(call.callee)) return null;
|
|
216
|
-
const calleeName = call.callee.name;
|
|
217
|
-
if (calleeName !== "defineRoom" && calleeName !== "defineWebSocket") return null;
|
|
218
|
-
let hasAuthGate = false;
|
|
219
|
-
const options = call.arguments?.[0];
|
|
220
|
-
if (isObjectExpression(options)) for (const property of options.properties ?? []) {
|
|
221
|
-
if (property.type !== "Property") continue;
|
|
222
|
-
if (getPropertyName(property.key) === "onBeforeConnect") {
|
|
223
|
-
hasAuthGate = true;
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return {
|
|
228
|
-
mode: calleeName === "defineRoom" ? "room" : "socket",
|
|
229
|
-
hasAuthGate
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
function detectWebSocketDefinition(absPath) {
|
|
233
|
-
const code = readFileSync(absPath, "utf-8");
|
|
234
|
-
const filename = absPath.split("/").pop() ?? absPath;
|
|
235
|
-
let parsed;
|
|
236
|
-
try {
|
|
237
|
-
parsed = parseSync(filename, code);
|
|
238
|
-
} catch {
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
const program = parsed.program;
|
|
242
|
-
const variableInitializers = /* @__PURE__ */ new Map();
|
|
243
|
-
for (const node of program.body ?? []) if (node.type === "VariableDeclaration") {
|
|
244
|
-
for (const declarator of node.declarations ?? []) if (isIdentifier(declarator.id) && declarator.init) variableInitializers.set(declarator.id.name, declarator.init);
|
|
245
|
-
}
|
|
246
|
-
for (const node of program.body ?? []) {
|
|
247
|
-
if (node.type !== "ExportDefaultDeclaration") continue;
|
|
248
|
-
const declaration = node.declaration;
|
|
249
|
-
if (isIdentifier(declaration)) return extractDefinition(variableInitializers.get(declaration.name));
|
|
250
|
-
return extractDefinition(declaration);
|
|
251
|
-
}
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
function buildWebSocketRoute(root, filePath, paths = readProjectPaths(root)) {
|
|
255
|
-
const parsed = parseWebSocketFilename(filePath);
|
|
256
|
-
const info = detectWebSocketDefinition(join(paths.routesDir, filePath));
|
|
257
|
-
const className = deriveWebSocketClassName(filePath);
|
|
258
|
-
return {
|
|
259
|
-
...parsed,
|
|
260
|
-
className,
|
|
261
|
-
bindingName: className,
|
|
262
|
-
mode: info?.mode ?? "socket",
|
|
263
|
-
hasAuthGate: info?.hasAuthGate ?? false
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function parseWebSocketFiles(root, files, paths = readProjectPaths(root), environment) {
|
|
267
|
-
return files.filter((f) => isWebSocketRouteFile(f)).filter((f) => !f.split("/").some((segment) => segment.startsWith("_"))).filter((filePath) => isRouteEnabledForEnvironment(parseWebSocketFilename(filePath), environment)).map((filePath) => buildWebSocketRoute(root, filePath, paths)).sort((a, b) => {
|
|
268
|
-
if (a.catchAll !== b.catchAll) return a.catchAll ? 1 : -1;
|
|
269
|
-
return a.pattern.localeCompare(b.pattern);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
async function scanWebSocketRoutes(root, paths = readProjectPaths(root), environment) {
|
|
273
|
-
const pattern = `**/*.{${HANDLER_EXTENSIONS.join(",")}}`;
|
|
274
|
-
return parseWebSocketFiles(root, await glob(pattern, {
|
|
275
|
-
cwd: paths.routesDir,
|
|
276
|
-
absolute: false
|
|
277
|
-
}).catch(() => []), paths, environment);
|
|
278
|
-
}
|
|
279
|
-
function scanWebSocketRoutesSync(root, paths = readProjectPaths(root), environment) {
|
|
280
|
-
const pattern = `**/*.{${HANDLER_EXTENSIONS.join(",")}}`;
|
|
281
|
-
let files;
|
|
282
|
-
try {
|
|
283
|
-
files = globSync(pattern, {
|
|
284
|
-
cwd: paths.routesDir,
|
|
285
|
-
absolute: false
|
|
286
|
-
});
|
|
287
|
-
} catch {
|
|
288
|
-
files = [];
|
|
289
|
-
}
|
|
290
|
-
return parseWebSocketFiles(root, files, paths, environment);
|
|
291
|
-
}
|
|
292
|
-
function isWebSocketPatternFile(filePath) {
|
|
293
|
-
return isWebSocketRouteFile(filePath);
|
|
294
|
-
}
|
|
295
|
-
//#endregion
|
|
296
194
|
//#region src/router/scan.ts
|
|
297
195
|
const ROUTE_PATTERN = `**/*.{${[
|
|
298
196
|
"ts",
|
|
@@ -384,4 +282,4 @@ function scanRoutePatternsSync(root, paths = readProjectPaths(root), environment
|
|
|
384
282
|
return routeFiles.filter((f) => !isWebSocketPatternFile(f)).filter((f) => !f.split("/").some((s) => s.startsWith("_"))).map((f) => parseRouteFilename(f)).filter((route) => isRouteEnabledForEnvironment(route, environment)).sort(compareRouteSpecificity);
|
|
385
283
|
}
|
|
386
284
|
//#endregion
|
|
387
|
-
export {
|
|
285
|
+
export { scanJobsSync as a, scanQueuesSync as i, scanRoutePatternsSync as n, scanRoutes as r, scanMiddlewareSync as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as cliTitle } from "./output-CCH48AMM.mjs";
|
|
2
|
-
import { c as getToken } from "./auth-
|
|
3
|
-
import { i as readDeploymentPlatform, o as readProjectConfig } from "./project-
|
|
4
|
-
import { _ as validateSecretValues } from "./env-validation-
|
|
2
|
+
import { c as getToken } from "./auth-DLNN0D3Z.mjs";
|
|
3
|
+
import { i as readDeploymentPlatform, o as readProjectConfig } from "./project-C0Fqu05O.mjs";
|
|
4
|
+
import { _ as validateSecretValues } from "./env-validation-BB4GkLxn.mjs";
|
|
5
5
|
import { E as confirm, F as password, N as note, O as intro, P as outro, T as cancel, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
|
|
6
|
-
import { n as PlatformClient } from "./client-
|
|
7
|
-
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-
|
|
6
|
+
import { n as PlatformClient } from "./client-QTl6ko_D.mjs";
|
|
7
|
+
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-BG5ORGID.mjs";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
//#region src/cli/secret.ts
|
|
10
10
|
async function runSecretCommand(root, args) {
|
|
@@ -78,7 +78,7 @@ async function runSecretCommand(root, args) {
|
|
|
78
78
|
}
|
|
79
79
|
async function runCloudflareSecretCommand(root, args) {
|
|
80
80
|
if (args.projectName) throw new Error("secret: --project selects a Void platform project and is not used for direct Cloudflare apps.");
|
|
81
|
-
const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-
|
|
81
|
+
const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-BipGMJ5O.mjs");
|
|
82
82
|
const context = resolveCloudflareOperationContext(root);
|
|
83
83
|
if (args.action === "list") {
|
|
84
84
|
const secrets = await listCloudflareSecrets(context);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as join, l as relative } from "./dist-
|
|
1
|
+
import { a as join, l as relative } from "./dist-BVqXeR_h.mjs";
|
|
2
2
|
import { j as log } from "./dist-Dn6nn2IU.mjs";
|
|
3
|
-
import { n as getPackageDir } from "./agents-
|
|
3
|
+
import { n as getPackageDir } from "./agents-B_pX_HmQ.mjs";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, readdirSync, readlinkSync, symlinkSync } from "node:fs";
|
|
5
5
|
//#region src/cli/skills.ts
|
|
6
6
|
function parseSkills(skillsDir) {
|
package/dist/sveltekit.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as join, i as isAbsolute, l as relative, u as resolve } from "./dist-
|
|
1
|
+
import { a as join, i as isAbsolute, l as relative, u as resolve } from "./dist-BVqXeR_h.mjs";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
//#region src/sveltekit.ts
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as join } from "./dist-
|
|
2
|
-
import { n as readJournal, r as stripSqlExt } from "./collect-
|
|
1
|
+
import { a as join } from "./dist-BVqXeR_h.mjs";
|
|
2
|
+
import { n as readJournal, r as stripSqlExt } from "./collect-DiTn9yr6.mjs";
|
|
3
3
|
import { t as DESTRUCTIVE_PRAGMA, u as tokenizeSql } from "./plan-BEZ8VJW0.mjs";
|
|
4
4
|
import { existsSync, readdirSync } from "node:fs";
|
|
5
5
|
//#region src/migrations/validate.ts
|