@astrale-os/adapter-cloudflare 0.1.8 → 0.1.10

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 (123) hide show
  1. package/dist/assets-pack.d.ts +1 -1
  2. package/dist/assets-pack.js +1 -1
  3. package/dist/build.d.ts +15 -0
  4. package/dist/build.d.ts.map +1 -0
  5. package/dist/build.js +15 -0
  6. package/dist/build.js.map +1 -0
  7. package/dist/client.d.ts +9 -0
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +10 -1
  10. package/dist/client.js.map +1 -1
  11. package/dist/cloudflare.d.ts +15 -3
  12. package/dist/cloudflare.d.ts.map +1 -1
  13. package/dist/cloudflare.js +52 -18
  14. package/dist/cloudflare.js.map +1 -1
  15. package/dist/codegen/worker.d.ts +26 -6
  16. package/dist/codegen/worker.d.ts.map +1 -1
  17. package/dist/codegen/worker.js +67 -54
  18. package/dist/codegen/worker.js.map +1 -1
  19. package/dist/codegen/wrangler.d.ts +11 -2
  20. package/dist/codegen/wrangler.d.ts.map +1 -1
  21. package/dist/codegen/wrangler.js +11 -5
  22. package/dist/codegen/wrangler.js.map +1 -1
  23. package/dist/index.d.ts +6 -3
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +5 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/params.d.ts +30 -30
  28. package/dist/params.d.ts.map +1 -1
  29. package/dist/parse-output.d.ts +1 -1
  30. package/dist/parse-output.js +1 -1
  31. package/package.json +6 -2
  32. package/src/assets-pack.ts +1 -1
  33. package/src/build.ts +15 -0
  34. package/src/client.ts +11 -1
  35. package/src/cloudflare.ts +53 -18
  36. package/src/codegen/worker.ts +76 -59
  37. package/src/codegen/wrangler.ts +15 -5
  38. package/src/index.ts +6 -3
  39. package/src/params.ts +32 -31
  40. package/src/parse-output.ts +1 -1
  41. package/template/.agents/skills/astrale-cli/SKILL.md +26 -12
  42. package/template/.agents/skills/astrale-domain/SKILL.md +46 -29
  43. package/template/.env.example +6 -0
  44. package/template/README.md +25 -10
  45. package/template/astrale.config.ts +27 -33
  46. package/template/client/README.md +80 -63
  47. package/template/client/__tests__/app.test.tsx +188 -99
  48. package/template/client/__tests__/harness.ts +67 -12
  49. package/template/client/__tests__/kernel.test.ts +65 -50
  50. package/template/client/__tests__/seam.test.tsx +111 -0
  51. package/template/client/index.html +1 -1
  52. package/template/client/package.json +1 -0
  53. package/template/client/src/app.tsx +40 -83
  54. package/template/client/src/main.tsx +2 -2
  55. package/template/client/src/monitor/components/MonitorCard.tsx +50 -0
  56. package/template/client/src/monitor/components/index.ts +1 -0
  57. package/template/client/src/monitor/hooks/index.ts +3 -0
  58. package/template/client/src/monitor/hooks/useCheck.mutation.ts +16 -0
  59. package/template/client/src/monitor/hooks/useMonitor.query.ts +64 -0
  60. package/template/client/src/monitor/index.ts +6 -0
  61. package/template/client/src/monitor/monitor.api.ts +11 -0
  62. package/template/client/src/monitor/monitor.mappers.ts +38 -0
  63. package/template/client/src/monitor/monitor.types.ts +23 -0
  64. package/template/client/src/monitor/ui/MonitorDetails.UI.tsx +38 -0
  65. package/template/client/src/monitor/ui/StatusBadge.UI.tsx +14 -0
  66. package/template/client/src/monitor/ui/index.ts +8 -0
  67. package/template/client/src/shell/client.ts +67 -0
  68. package/template/client/src/shell/index.ts +20 -0
  69. package/template/client/src/shell/invoke.ts +35 -0
  70. package/template/client/src/shell/transformers.ts +72 -0
  71. package/template/client/src/shell/use-async.ts +56 -0
  72. package/template/client/src/shell/use-capability.ts +61 -0
  73. package/template/client/src/shell/use-node.ts +61 -0
  74. package/template/client/src/shell/use-shell.ts +91 -0
  75. package/template/client/src/shell/view-router.tsx +98 -0
  76. package/template/client/src/styles.css +177 -4
  77. package/template/client/src/ui/format.ts +24 -0
  78. package/template/client/src/ui/index.ts +9 -0
  79. package/template/client/src/ui/surface.tsx +56 -0
  80. package/template/client/src/ui/value.tsx +32 -0
  81. package/template/client/src/views/monitor.tsx +30 -0
  82. package/template/client/tsconfig.json +3 -2
  83. package/template/client/vite.config.ts +14 -15
  84. package/template/client/vitest.config.ts +12 -5
  85. package/template/core/monitor/health.ts +19 -0
  86. package/template/core/monitor/index.ts +9 -0
  87. package/template/core/monitor/keys.ts +29 -0
  88. package/template/core/monitor/node.ts +51 -0
  89. package/template/deps.ts +25 -0
  90. package/template/domain.ts +33 -0
  91. package/template/env.ts +4 -0
  92. package/template/integrations/prober/http.ts +43 -0
  93. package/template/integrations/prober/mock.ts +22 -0
  94. package/template/integrations/prober/port.ts +28 -0
  95. package/template/integrations/prober/registry.ts +66 -0
  96. package/template/package.json +2 -3
  97. package/template/pnpm-lock.yaml +2766 -0
  98. package/template/runtime/index.ts +79 -0
  99. package/template/runtime/monitor/check.ts +29 -0
  100. package/template/runtime/monitor/dependsOn.ts +16 -0
  101. package/template/runtime/monitor/index.ts +12 -0
  102. package/template/runtime/monitor/seed.ts +74 -0
  103. package/template/runtime/monitor/shared.ts +17 -0
  104. package/template/runtime/monitor/watch.ts +37 -0
  105. package/template/schema/index.ts +13 -4
  106. package/template/schema/monitor.ts +80 -0
  107. package/template/tsconfig.json +13 -2
  108. package/template/views/index.ts +9 -2
  109. package/template/views/monitor.ts +22 -0
  110. package/dist/astrale.d.ts +0 -27
  111. package/dist/astrale.d.ts.map +0 -1
  112. package/dist/astrale.js +0 -222
  113. package/dist/astrale.js.map +0 -1
  114. package/src/astrale.ts +0 -259
  115. package/template/client/src/lib/kernel.ts +0 -135
  116. package/template/client/src/lib/shell.ts +0 -197
  117. package/template/client/src/lib/use-node.ts +0 -66
  118. package/template/client/src/lib/use-shell.ts +0 -85
  119. package/template/methods/index.ts +0 -66
  120. package/template/methods/note.ts +0 -131
  121. package/template/schema/compiled.ts +0 -14
  122. package/template/schema/note.ts +0 -64
  123. package/template/views/note.ts +0 -21
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Pack a built client SPA (`dist-client/`) into the host box's asset-archive
2
+ * Pack a built client SPA (the `CLIENT_DIST_DIR` build) into the host box's asset-archive
3
3
  * format: `gzip(JSON [{ path, contentBase64 }])` — the exact shape
4
4
  * `downloadAssets` on the box consumes (kernel/host workerd service layout).
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Pack a built client SPA (`dist-client/`) into the host box's asset-archive
2
+ * Pack a built client SPA (the `CLIENT_DIST_DIR` build) into the host box's asset-archive
3
3
  * format: `gzip(JSON [{ path, contentBase64 }])` — the exact shape
4
4
  * `downloadAssets` on the box consumes (kernel/host workerd service layout).
5
5
  */
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `@astrale-os/adapter-cloudflare/build` — the shared Cloudflare-Workers build
3
+ * toolkit, exposed for sibling deploy adapters (e.g.
4
+ * `@astrale-os/adapter-astrale`).
5
+ *
6
+ * This is the "compile a `defineDomain` into a Cloudflare Workers bundle + run
7
+ * local dev" surface that every Cloudflare-Workers deploy strategy shares,
8
+ * regardless of WHERE the bundle ultimately ships. It is NOT part of the public
9
+ * adapter API (`@astrale-os/adapter-cloudflare`) — it's the seam two adapters
10
+ * build on so the codegen/bundling/dev logic lives in exactly one place.
11
+ */
12
+ export { logTo, prepare } from './cloudflare';
13
+ export { buildClient, CLIENT_DIST_DIR } from './client';
14
+ export { runWranglerBundle, runWranglerDev } from './wrangler-cli';
15
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/build.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `@astrale-os/adapter-cloudflare/build` — the shared Cloudflare-Workers build
3
+ * toolkit, exposed for sibling deploy adapters (e.g.
4
+ * `@astrale-os/adapter-astrale`).
5
+ *
6
+ * This is the "compile a `defineDomain` into a Cloudflare Workers bundle + run
7
+ * local dev" surface that every Cloudflare-Workers deploy strategy shares,
8
+ * regardless of WHERE the bundle ultimately ships. It is NOT part of the public
9
+ * adapter API (`@astrale-os/adapter-cloudflare`) — it's the seam two adapters
10
+ * build on so the codegen/bundling/dev logic lives in exactly one place.
11
+ */
12
+ export { logTo, prepare } from './cloudflare';
13
+ export { buildClient, CLIENT_DIST_DIR } from './client';
14
+ export { runWranglerBundle, runWranglerDev } from './wrangler-cli';
15
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/client.d.ts CHANGED
@@ -3,5 +3,14 @@
3
3
  * has no `client/` or no resolvable Vite, we skip — the RPC surface and inline
4
4
  * Views still work without a built SPA.
5
5
  */
6
+ /**
7
+ * Where the adapter expects the built client SPA to land, relative to the
8
+ * project root. This is a contract: the domain's Vite config MUST emit here
9
+ * (`build.outDir`), and the wrangler `assets.directory` binding + the managed
10
+ * deploy's asset reader both look here. Dot-prefixed so the build output sorts
11
+ * out of the way with the other generated dirs (`.astrale`) instead of
12
+ * polluting the middle of the project listing.
13
+ */
14
+ export declare const CLIENT_DIST_DIR = ".dist";
6
15
  export declare function buildClient(clientDir: string, projectDir: string, onLog?: (line: string) => void): Promise<void>;
7
16
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,wBAAsB,WAAW,CAC/B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC,CAkBf"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UAAU,CAAA;AAEtC,wBAAsB,WAAW,CAC/B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC,CAkBf"}
package/dist/client.js CHANGED
@@ -6,6 +6,15 @@
6
6
  import { spawn } from 'node:child_process';
7
7
  import { existsSync } from 'node:fs';
8
8
  import { join } from 'node:path';
9
+ /**
10
+ * Where the adapter expects the built client SPA to land, relative to the
11
+ * project root. This is a contract: the domain's Vite config MUST emit here
12
+ * (`build.outDir`), and the wrangler `assets.directory` binding + the managed
13
+ * deploy's asset reader both look here. Dot-prefixed so the build output sorts
14
+ * out of the way with the other generated dirs (`.astrale`) instead of
15
+ * polluting the middle of the project listing.
16
+ */
17
+ export const CLIENT_DIST_DIR = '.dist';
9
18
  export async function buildClient(clientDir, projectDir, onLog) {
10
19
  const viteBin = [
11
20
  join(clientDir, 'node_modules', '.bin', 'vite'),
@@ -13,7 +22,7 @@ export async function buildClient(clientDir, projectDir, onLog) {
13
22
  ].find((p) => existsSync(p));
14
23
  if (!viteBin) {
15
24
  // The project has a client/ but its deps aren't installed — wrangler would
16
- // otherwise fail cryptically on the missing dist-client assets dir. Fail
25
+ // otherwise fail cryptically on the missing built-assets dir. Fail
17
26
  // loud with the fix (the client is a workspace package — one install covers it).
18
27
  throw new Error(`client build: vite not found in ${clientDir}. Run \`pnpm install\` at the project root ` +
19
28
  `first (the client/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AE,IAAI,IAAI,CAAC,IAAI,EAAE;oBAAE,KAAK,EAAE,CAAC,IAAI,CAAC,CAAA;QACrE,CAAC,CAAA;QACD,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QAC7D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -5,10 +5,10 @@
5
5
  * config (the dev never sees a `wrangler.jsonc`), builds the optional client
6
6
  * SPA, and shells out to `wrangler`. `watch` → `wrangler dev` (local URL);
7
7
  * `deploy` → `wrangler deploy` (workers.dev or a custom-domain URL); secrets →
8
- * `wrangler secret bulk`. Both `watch` and `deploy` return the URL the devkit
9
- * prints and `astrale instance install <url>` consumes.
8
+ * `wrangler secret bulk`. Both `watch` and `deploy` return the URL the CLI
9
+ * prints and `astrale domain install <url>` consumes.
10
10
  */
11
- import type { DeployCtx, DomainAdapter, WatchCtx } from '@astrale-os/devkit';
11
+ import type { DeployCtx, DomainAdapter, WatchCtx } from '@astrale-os/sdk';
12
12
  import type { CloudflareParams } from './params';
13
13
  export declare function cloudflare(envs: Record<string, CloudflareParams>): DomainAdapter<CloudflareParams>;
14
14
  export declare function prepare(params: CloudflareParams, ctx: WatchCtx | DeployCtx, mode: 'dev' | 'deploy'): Promise<{
@@ -18,5 +18,17 @@ export declare function prepare(params: CloudflareParams, ctx: WatchCtx | Deploy
18
18
  workerName: string;
19
19
  }>;
20
20
  export declare function workerName(params: CloudflareParams, origin: string): string;
21
+ /**
22
+ * Resolve the instance-router config. ON by default (targets `admin-router`) so
23
+ * every adapter-deployed worker can reach other instances' hosts internally and
24
+ * verify cross-instance credentials without a 522; `false` disables it. The
25
+ * returned shape carries every value the worker- and wrangler-codegen need.
26
+ */
27
+ export declare function resolveRouter(ir: CloudflareParams['router']): {
28
+ binding: string;
29
+ service: string;
30
+ hostSuffix: string;
31
+ minLabels: number;
32
+ } | undefined;
21
33
  export declare function logTo(): (line: string) => void;
22
34
  //# sourceMappingURL=cloudflare.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../src/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAM5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAUhD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GACrC,aAAa,CAAC,gBAAgB,CAAC,CAmEjC;AAID,wBAAsB,OAAO,CAC3B,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,QAAQ,GAAG,SAAS,EACzB,IAAI,EAAE,KAAK,GAAG,QAAQ,GACrB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAkFhG;AA8CD,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAsB3E;AAED,wBAAgB,KAAK,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAE9C"}
1
+ {"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../src/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAMzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAUhD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GACrC,aAAa,CAAC,gBAAgB,CAAC,CAmEjC;AAID,wBAAsB,OAAO,CAC3B,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,QAAQ,GAAG,SAAS,EACzB,IAAI,EAAE,KAAK,GAAG,QAAQ,GACrB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAkGhG;AA8CD,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAsB3E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CASzF;AAED,wBAAgB,KAAK,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAE9C"}
@@ -5,10 +5,10 @@
5
5
  * config (the dev never sees a `wrangler.jsonc`), builds the optional client
6
6
  * SPA, and shells out to `wrangler`. `watch` → `wrangler dev` (local URL);
7
7
  * `deploy` → `wrangler deploy` (workers.dev or a custom-domain URL); secrets →
8
- * `wrangler secret bulk`. Both `watch` and `deploy` return the URL the devkit
9
- * prints and `astrale instance install <url>` consumes.
8
+ * `wrangler secret bulk`. Both `watch` and `deploy` return the URL the CLI
9
+ * prints and `astrale domain install <url>` consumes.
10
10
  */
11
- import { defineAdapter, hasStarModule } from '@astrale-os/devkit';
11
+ import { defineAdapter } from '@astrale-os/sdk';
12
12
  import { mkdir, rename, writeFile } from 'node:fs/promises';
13
13
  import { join } from 'node:path';
14
14
  import { buildClient } from './client';
@@ -69,7 +69,7 @@ export function cloudflare(envs) {
69
69
  });
70
70
  }
71
71
  // A first deploy on a fresh `*.workers.dev` host can take ~30-60s to
72
- // propagate; an `astrale instance install <url>` issued right away would
72
+ // propagate; an `astrale domain install <url>` issued right away would
73
73
  // 404 (Cloudflare 1042). Block until the URL actually serves so the
74
74
  // install line we print is immediately actionable.
75
75
  await waitUntilLive(url, logTo());
@@ -86,20 +86,33 @@ export async function prepare(params, ctx, mode) {
86
86
  await mkdir(astraleDir, { recursive: true });
87
87
  await ensureIdentity(astraleDir, ctx.domain.origin);
88
88
  const name = workerName(params, ctx.domain.origin);
89
- // Shared ★-files probe: must agree with the codegen's `import { views } from
90
- // '../views'` resolution (folder index OR sibling file) a folder-only
91
- // existsSync would deploy a worker whose graph silently lacks a sibling-file
92
- // module the diagnostic spec includes.
93
- const hasViews = hasStarModule(ctx.projectDir, 'views');
94
- const hasFunctions = hasStarModule(ctx.projectDir, 'functions');
95
- const hasClient = Boolean(ctx.clientDir);
96
- await writeFileAtomic(join(astraleDir, 'worker.gen.ts'), generateWorkerEntry({
89
+ // Instance-router service binding (on by default admin-router): lets the
90
+ // worker reach other instances' hosts internally, so a cross-instance JWKS
91
+ // fetch doesn't 522. Resolved once, fed to BOTH codegens below.
92
+ const router = resolveRouter(params.router);
93
+ // Two distinct client signals: the WORKER's `/ui` hook is present whenever the
94
+ // domain declares a client (`ctx.domain.hasClient`) — including managed
95
+ // deploys, which ship the built assets separately and pass no `clientDir`; the
96
+ // wrangler `assets.directory` binding is wired only when there's a local dir to
97
+ // point at (`ctx.clientDir` — direct Cloudflare deploys + local dev).
98
+ const servesClient = ctx.domain.hasClient;
99
+ const bundleAssets = Boolean(ctx.clientDir);
100
+ await writeFileAtomic(join(astraleDir, 'worker.gen.ts'),
101
+ // Everything else — schema/methods/deps/views/functions/requires/postInstall —
102
+ // rides the `...domain` spread the generated entry imports from `../domain`;
103
+ // the only remaining build-time signal is whether to wire the /ui asset hook.
104
+ generateWorkerEntry({
97
105
  origin: ctx.domain.origin,
98
- ...(ctx.domain.postInstall ? { postInstall: ctx.domain.postInstall } : {}),
99
- requires: ctx.domain.requires,
100
- hasViews,
101
- hasFunctions,
102
- hasClient,
106
+ hasClient: servesClient,
107
+ ...(router
108
+ ? {
109
+ router: {
110
+ binding: router.binding,
111
+ hostSuffix: router.hostSuffix,
112
+ minLabels: router.minLabels,
113
+ },
114
+ }
115
+ : {}),
103
116
  }));
104
117
  // Pin the worker's canonical serving URL (its `iss` identity) for routed
105
118
  // deploys: a routed worker may ALSO be reachable via `*.workers.dev`, so
@@ -124,8 +137,12 @@ export async function prepare(params, ctx, mode) {
124
137
  const baseConfig = {
125
138
  workerName: name,
126
139
  ...(mode === 'deploy' && params.route ? { route: params.route } : {}),
127
- hasClient,
140
+ hasClient: bundleAssets,
128
141
  vars,
142
+ // Router service binding flows into BOTH the SELF and SELF-less fallback
143
+ // configs — the first-deploy two-pass must keep it. `admin-router` already
144
+ // exists, so unlike SELF it always resolves (no first-deploy chicken-egg).
145
+ ...(router ? { router: { binding: router.binding, service: router.service } } : {}),
129
146
  // Escape hatch: extra bindings (KV/R2/D1/queues/…) deep-merged on top. Same
130
147
  // overlay in dev and deploy — it's infra, not env-specific plumbing — and it
131
148
  // flows into both the SELF and the SELF-less fallback config below.
@@ -209,6 +226,23 @@ export function workerName(params, origin) {
209
226
  .slice(0, 54)
210
227
  .replace(/^-+|-+$/g, '');
211
228
  }
229
+ /**
230
+ * Resolve the instance-router config. ON by default (targets `admin-router`) so
231
+ * every adapter-deployed worker can reach other instances' hosts internally and
232
+ * verify cross-instance credentials without a 522; `false` disables it. The
233
+ * returned shape carries every value the worker- and wrangler-codegen need.
234
+ */
235
+ export function resolveRouter(ir) {
236
+ if (ir === false)
237
+ return undefined;
238
+ const cfg = ir ?? {};
239
+ return {
240
+ binding: cfg.binding ?? 'ROUTER',
241
+ service: cfg.service ?? 'admin-router',
242
+ hostSuffix: cfg.hostSuffix ?? '.astrale.ai',
243
+ minLabels: cfg.minLabels ?? 4,
244
+ };
245
+ }
212
246
  export function logTo() {
213
247
  return (line) => process.stderr.write(`\x1b[2m ${line}\x1b[0m\n`);
214
248
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare.js","sourceRoot":"","sources":["../src/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAIhC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAElF,MAAM,YAAY,GAAG,IAAI,CAAA;AAEzB,MAAM,UAAU,UAAU,CACxB,IAAsC;IAEtC,OAAO,aAAa,CAAmB;QACrC,IAAI,EAAE,YAAY;QAClB,IAAI;QAEJ,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG;YACrB,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;YAC9D,IAAI,GAAG,CAAC,SAAS;gBAAE,MAAM,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,UAAU,E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
4
- * The dev writes only schema/methods/views/functions; this generates the
5
- * `export default { fetch }` plumbing the adapter owns. Key properties:
4
+ * The dev wires the domain ONCE in a worker-safe `domain.ts`
5
+ * (`export const domain = defineDomain({ schema, methods, deps, views,
6
+ * functions, client })`) and binds it to an adapter in `astrale.config.ts`
7
+ * (`deploy(domain, cloudflare({ … }))`). This generates the
8
+ * `export default { fetch }` plumbing the adapter owns by importing that single
9
+ * `domain` and SPREADING it into `domainWorkerEntry` — so the author's folder
10
+ * layout is irrelevant (any internal organization works as long as `domain.ts`
11
+ * re-exports the wired definition) and the node-only deploy adapter, which lives
12
+ * in `astrale.config.ts`, never enters this worker bundle.
13
+ *
14
+ * Everything the entry needs — schema/methods/deps/views/functions/requires/
15
+ * postInstall — rides on the spread; the only build-time signal left is whether
16
+ * the domain serves a client SPA (`hasClient`), which gates the `/ui` asset hook
17
+ * and its import. Key properties:
6
18
  *
7
19
  * • Per-request `url` = the live serving origin (`scheme://host`). It is passed
8
20
  * only to `createRemoteServer({ url })`; the SDK stamps every
@@ -21,11 +33,19 @@
21
33
  */
22
34
  export interface WorkerCodegenOptions {
23
35
  origin: string;
24
- postInstall?: string;
25
- requires: readonly string[];
26
- hasViews: boolean;
27
- hasFunctions: boolean;
28
36
  hasClient: boolean;
37
+ /**
38
+ * When set, the worker routes subrequests to platform INSTANCE hostnames
39
+ * through `<binding>` (a service binding to a router Worker) instead of the
40
+ * public edge — a same-zone Worker→Worker public fetch 522s, which otherwise
41
+ * blocks fetching an instance kernel's JWKS to verify a cross-instance
42
+ * credential.
43
+ */
44
+ router?: {
45
+ binding: string;
46
+ hostSuffix: string;
47
+ minLabels: number;
48
+ };
29
49
  }
30
50
  export declare function generateWorkerEntry(opts: WorkerCodegenOptions): string;
31
51
  //# sourceMappingURL=worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/codegen/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CA4EtE"}
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/codegen/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CACpE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CA6EtE"}
@@ -1,8 +1,20 @@
1
1
  /**
2
2
  * Codegen for the Cloudflare Worker entry (`.astrale/worker.gen.ts`).
3
3
  *
4
- * The dev writes only schema/methods/views/functions; this generates the
5
- * `export default { fetch }` plumbing the adapter owns. Key properties:
4
+ * The dev wires the domain ONCE in a worker-safe `domain.ts`
5
+ * (`export const domain = defineDomain({ schema, methods, deps, views,
6
+ * functions, client })`) and binds it to an adapter in `astrale.config.ts`
7
+ * (`deploy(domain, cloudflare({ … }))`). This generates the
8
+ * `export default { fetch }` plumbing the adapter owns by importing that single
9
+ * `domain` and SPREADING it into `domainWorkerEntry` — so the author's folder
10
+ * layout is irrelevant (any internal organization works as long as `domain.ts`
11
+ * re-exports the wired definition) and the node-only deploy adapter, which lives
12
+ * in `astrale.config.ts`, never enters this worker bundle.
13
+ *
14
+ * Everything the entry needs — schema/methods/deps/views/functions/requires/
15
+ * postInstall — rides on the spread; the only build-time signal left is whether
16
+ * the domain serves a client SPA (`hasClient`), which gates the `/ui` asset hook
17
+ * and its import. Key properties:
6
18
  *
7
19
  * • Per-request `url` = the live serving origin (`scheme://host`). It is passed
8
20
  * only to `createRemoteServer({ url })`; the SDK stamps every
@@ -20,38 +32,68 @@
20
32
  * dev via `VIEW_DEV_URL`).
21
33
  */
22
34
  export function generateWorkerEntry(opts) {
23
- const optionalImports = [
24
- opts.hasViews ? `import { views } from '../views'` : `const views = undefined`,
25
- opts.hasFunctions ? `import { functions } from '../functions'` : `const functions = undefined`,
26
- ].join('\n');
27
- const postInstallLine = opts.postInstall !== undefined
28
- ? `const POST_INSTALL = ${JSON.stringify(opts.postInstall)}`
29
- : `const POST_INSTALL = undefined`;
35
+ // The asset-serving hook is a library helper (`assets`), not inlined string
36
+ // logic imported only when the domain declares a `client` binding.
37
+ const serverImport = opts.hasClient
38
+ ? `import { assets, domainWorkerEntry } from '@astrale-os/sdk/server'`
39
+ : `import { domainWorkerEntry } from '@astrale-os/sdk/server'`;
40
+ const clientHook = opts.hasClient
41
+ ? `
42
+ // Client assets under /ui/* — served from the ASSETS binding (or proxied to
43
+ // Vite in dev via VIEW_DEV_URL). The matching/stripping logic lives in the SDK helper.
44
+ before: assets({ binding: (env) => env.ASSETS, devProxy: (env) => env.VIEW_DEV_URL }),`
45
+ : '';
46
+ const router = opts.router;
47
+ // Service binding for instance-host subrequest routing (Env field + helper +
48
+ // routeSubrequest), wired only when the adapter's `router` is set.
49
+ const routerEnvField = router
50
+ ? `
51
+ ${router.binding}?: { fetch(request: Request): Promise<Response> }`
52
+ : '';
53
+ const routerHelper = router
54
+ ? `
55
+ // A platform INSTANCE hostname (e.g. <slug>.<region>${router.hostSuffix}) is served
56
+ // by a router Worker on the SAME zone — a direct Worker→Worker public fetch 522s.
57
+ // Route those subrequests (e.g. fetching an instance kernel's JWKS to verify a
58
+ // cross-instance credential) through the ${router.binding} service binding instead.
59
+ function isInstanceHost(host) {
60
+ return host.endsWith('${router.hostSuffix}') && host.split('.').length >= ${router.minLabels}
61
+ }
62
+ `
63
+ : '';
64
+ const routerHook = router
65
+ ? `
66
+ // Divert instance-host subrequests through ${router.binding} (CF 522s a same-zone
67
+ // Worker→Worker public fetch). No-op when the binding is absent.
68
+ routeSubrequest: (url, env) => (env.${router.binding} && isInstanceHost(url.hostname) ? env.${router.binding} : null),`
69
+ : '';
30
70
  return `// AUTO-GENERATED by @astrale-os/adapter-cloudflare — do not edit.
31
- // Regenerated on every \`astrale-domain dev|deploy\`. Edit schema/methods/views
32
- // instead. (origin: ${opts.origin})
33
- import { defineRemoteDomain } from '@astrale-os/sdk'
34
- import { createWorkerEntry } from '@astrale-os/sdk/server'
71
+ // Regenerated on every \`astrale-domain dev|deploy\`. Edit your domain.ts (the
72
+ // wired \`defineDomain\`) and astrale.config.ts (the \`deploy(domain, …)\`).
73
+ // (origin: ${opts.origin})
74
+ ${serverImport}
35
75
 
36
- import { schema } from '../schema'
37
- import { methods } from '../methods'
38
- ${optionalImports}
76
+ // The worker-safe domain definition schema/methods/deps/views/functions plus
77
+ // origin/requires/postInstall wired by the author in domain.ts. Spreading it
78
+ // keeps this entry layout-agnostic; the deploy adapter stays in astrale.config.ts.
79
+ import { domain } from '../domain'
39
80
  import { PRIVATE_JWK } from './identity'
40
81
 
41
- const REQUIRES = ${JSON.stringify(opts.requires)}
42
- ${postInstallLine}
43
-
44
82
  interface Env {
45
83
  WORKER_URL?: string
46
84
  ASSETS?: { fetch(request: Request): Promise<Response> }
47
85
  SELF?: { fetch(request: Request): Promise<Response> }
48
- VIEW_DEV_URL?: string
86
+ VIEW_DEV_URL?: string${routerEnvField}
49
87
  [key: string]: unknown
50
88
  }
51
-
52
- // All the shared worker plumbing JWKS self-fetch shim, SELF-binding routing,
53
- // per-URL app cache, canonical iss resolution lives in createWorkerEntry.
54
- export default createWorkerEntry<Env>({
89
+ ${routerHelper}
90
+ // \`domainWorkerEntry\` folds the runtime-domain compile + server build + the
91
+ // shared worker plumbing (JWKS self-resolution, SELF-binding routing, per-URL
92
+ // app cache, canonical iss resolution) into one declaration. \`deps\` (when the
93
+ // domain declares one) rides the spread and runs per cold isolate / serving URL.
94
+ export default domainWorkerEntry<Env>()({
95
+ ...domain,
96
+ privateKey: PRIVATE_JWK,
55
97
  // The worker's serving URL = its identity (iss). Prefer the adapter-injected
56
98
  // WORKER_URL (pins one canonical host for routed deploys, so iss stays stable
57
99
  // even when also reachable via *.workers.dev); fall back to the per-request
@@ -60,36 +102,7 @@ export default createWorkerEntry<Env>({
60
102
  // upgrades the fallback origin via X-Forwarded-Proto, so iss = the public
61
103
  // https URL, not the raw http one workerd sees.
62
104
  resolveUrl: (env, requestOrigin) => env.WORKER_URL ?? requestOrigin,
63
- selfBinding: (env) => env.SELF,
64
- build: (url, env) => {
65
- const domain = defineRemoteDomain()({
66
- schema,
67
- methods,
68
- ...(views ? { views } : {}),
69
- ...(functions ? { remoteFunctions: functions } : {}),
70
- })
71
- return {
72
- domain,
73
- deps: env,
74
- url,
75
- privateKey: PRIVATE_JWK,
76
- ...(POST_INSTALL ? { postInstall: POST_INSTALL } : {}),
77
- ...(REQUIRES.length ? { requires: REQUIRES } : {}),
78
- }
79
- },
80
- // SPA under /ui/* (views with a client renderer).
81
- before: (env, url, request) => {
82
- if (env.ASSETS && (url.pathname === '/ui' || url.pathname.startsWith('/ui/'))) {
83
- if (env.VIEW_DEV_URL) {
84
- const devBase = env.VIEW_DEV_URL.replace(/\\/$/, '')
85
- return fetch(new Request(\`\${devBase}\${url.pathname}\${url.search}\`, request))
86
- }
87
- const stripped = url.pathname.replace(/^\\/ui\\/?/, '/')
88
- const rewritten = new URL(stripped + url.search, url.origin)
89
- return env.ASSETS.fetch(new Request(rewritten, request))
90
- }
91
- return undefined
92
- },
105
+ selfBinding: (env) => env.SELF,${routerHook}${clientHook}
93
106
  })
94
107
  `;
95
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/codegen/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH,MAAM,UAAU,mBAAmB,CAAC,IAA0B;IAC5D,MAAM,eAAe,GAAG;QACtB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,yBAAyB;QAC9E,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,6BAA6B;KAC/F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEZ,MAAM,eAAe,GACnB,IAAI,CAAC,WAAW,KAAK,SAAS;QAC5B,CAAC,CAAC,wBAAwB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;QAC5D,CAAC,CAAC,gCAAgC,CAAA;IAEtC,OAAO;;uBAEc,IAAI,CAAC,MAAM;;;;;;EAMhC,eAAe;;;mBAGE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;EAC9C,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDhB,CAAA;AACD,CAAC"}
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/codegen/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAeH,MAAM,UAAU,mBAAmB,CAAC,IAA0B;IAC5D,4EAA4E;IAC5E,qEAAqE;IACrE,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS;QACjC,CAAC,CAAC,oEAAoE;QACtE,CAAC,CAAC,4DAA4D,CAAA;IAEhE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS;QAC/B,CAAC,CAAC;;;yFAGmF;QACrF,CAAC,CAAC,EAAE,CAAA;IAEN,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC1B,6EAA6E;IAC7E,mEAAmE;IACnE,MAAM,cAAc,GAAG,MAAM;QAC3B,CAAC,CAAC;IACF,MAAM,CAAC,OAAO,mDAAmD;QACjE,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,YAAY,GAAG,MAAM;QACzB,CAAC,CAAC;uDACiD,MAAM,CAAC,UAAU;;;4CAG5B,MAAM,CAAC,OAAO;;0BAEhC,MAAM,CAAC,UAAU,mCAAmC,MAAM,CAAC,SAAS;;CAE7F;QACG,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,UAAU,GAAG,MAAM;QACvB,CAAC,CAAC;gDAC0C,MAAM,CAAC,OAAO;;wCAEtB,MAAM,CAAC,OAAO,0CAA0C,MAAM,CAAC,OAAO,WAAW;QACrH,CAAC,CAAC,EAAE,CAAA;IAEN,OAAO;;;cAGK,IAAI,CAAC,MAAM;EACvB,YAAY;;;;;;;;;;;;yBAYW,cAAc;;;EAGrC,YAAY;;;;;;;;;;;;;;;;mCAgBqB,UAAU,GAAG,UAAU;;CAEzD,CAAA;AACD,CAAC"}
@@ -3,8 +3,8 @@
3
3
  * `wrangler.jsonc` that used to be hand-copied into every domain — now an
4
4
  * internal adapter detail the dev never sees.
5
5
  *
6
- * `main` is `./worker.gen.ts` (same dir). `assets.directory` is `../dist-client`
7
- * (the project's Vite build). A `SELF` service binding enables autobinding
6
+ * `main` is `./worker.gen.ts` (same dir). `assets.directory` points at the
7
+ * project's Vite build (`CLIENT_DIST_DIR`). A `SELF` service binding enables autobinding
8
8
  * (a handler calling back into its own domain). Custom-domain deploys attach a
9
9
  * `custom_domain` route; otherwise the Worker ships to `*.workers.dev`.
10
10
  *
@@ -21,6 +21,15 @@ export interface WranglerCodegenOptions {
21
21
  vars?: Record<string, string>;
22
22
  /** Add the SELF service binding (autobinding). */
23
23
  selfBinding: boolean;
24
+ /**
25
+ * Add a service binding to a router Worker for instance-host subrequest
26
+ * routing (see `CloudflareParams.router`). Pairs with the worker
27
+ * entry's `routeSubrequest`.
28
+ */
29
+ router?: {
30
+ binding: string;
31
+ service: string;
32
+ };
24
33
  /**
25
34
  * Raw wrangler config to deep-merge over the generated base — the escape
26
35
  * hatch for extra bindings (KV, R2, D1, queues, service bindings, extra
@@ -1 +1 @@
1
- {"version":3,"file":"wrangler.d.ts","sourceRoot":"","sources":["../../src/codegen/wrangler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAA;IAClB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,kDAAkD;IAClD,WAAW,EAAE,OAAO,CAAA;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAID,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAiC3E"}
1
+ {"version":3,"file":"wrangler.d.ts","sourceRoot":"","sources":["../../src/codegen/wrangler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAA;IAClB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,kDAAkD;IAClD,WAAW,EAAE,OAAO,CAAA;IACpB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAID,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAoC3E"}
@@ -3,14 +3,15 @@
3
3
  * `wrangler.jsonc` that used to be hand-copied into every domain — now an
4
4
  * internal adapter detail the dev never sees.
5
5
  *
6
- * `main` is `./worker.gen.ts` (same dir). `assets.directory` is `../dist-client`
7
- * (the project's Vite build). A `SELF` service binding enables autobinding
6
+ * `main` is `./worker.gen.ts` (same dir). `assets.directory` points at the
7
+ * project's Vite build (`CLIENT_DIST_DIR`). A `SELF` service binding enables autobinding
8
8
  * (a handler calling back into its own domain). Custom-domain deploys attach a
9
9
  * `custom_domain` route; otherwise the Worker ships to `*.workers.dev`.
10
10
  *
11
11
  * A dev's `params.wrangler` escape hatch is deep-merged on top of this base
12
12
  * (extra bindings: KV, R2, D1, queues, …) — see `mergeUserConfig`.
13
13
  */
14
+ import { CLIENT_DIST_DIR } from '../client';
14
15
  import { deepMergeConfig } from './merge';
15
16
  const COMPATIBILITY_DATE = '2025-03-01';
16
17
  export function generateWranglerConfig(opts) {
@@ -27,15 +28,20 @@ export function generateWranglerConfig(opts) {
27
28
  }
28
29
  if (opts.hasClient) {
29
30
  config.assets = {
30
- directory: '../dist-client',
31
+ directory: `../${CLIENT_DIST_DIR}`,
31
32
  binding: 'ASSETS',
32
33
  not_found_handling: 'single-page-application',
33
34
  run_worker_first: true,
34
35
  };
35
36
  }
36
- if (opts.selfBinding) {
37
- config.services = [{ binding: 'SELF', service: opts.workerName }];
37
+ const services = [];
38
+ if (opts.selfBinding)
39
+ services.push({ binding: 'SELF', service: opts.workerName });
40
+ if (opts.router) {
41
+ services.push({ binding: opts.router.binding, service: opts.router.service });
38
42
  }
43
+ if (services.length > 0)
44
+ config.services = services;
39
45
  if (opts.vars && Object.keys(opts.vars).length > 0) {
40
46
  config.vars = opts.vars;
41
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wrangler.js","sourceRoot":"","sources":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