@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 101 lines 3.66 KB
Raw
1 import type {
2 DurableObjectNamespace,
3 HyperdriveOrigin,
4 QueueConsumer,
5 RuntimeWorker,
6 Workflow,
7 } from "@alchemy.run/cloudflare-runtime/core";
8 import type { BundleOutput } from "alchemy/Bundle/Bundle";
9 import type { FoldkitBuildMetadata } from "../Website/FoldkitBuild.ts";
10 import type { WorkerAssetsConfig, WorkerSourceDescriptor } from "./Worker.ts";
11 import type { WorkerBinding } from "./WorkerBinding.ts";
12
13 /**
14 * Default first port of the local dev-server range. Vite and
15 * cloudflare-runtime advance to the next available port when it is taken,
16 * unless `strictPort` is set.
17 */
18 export const DEFAULT_DEV_PORT = 1337;
19
20 /** Plain-data configuration transferred from the provider to a Vite child. */
21 export interface ViteChildConfig {
22 rootDir: string;
23 publicUrl: string;
24 accountId: string;
25 storageDirectory: string;
26 stack: { name: string; stage: string };
27 env: Record<string, unknown>;
28 source?: {
29 descriptor: WorkerSourceDescriptor;
30 id: string;
31 fqn: string;
32 assets: WorkerAssetsConfig | undefined;
33 };
34 worker: {
35 name: string;
36 compatibility: { date: string; flags: string[] };
37 main: string | undefined;
38 viteEnvironments: { entry?: string; children?: string[] } | undefined;
39 hasAssets: boolean;
40 /** The zone outbound `fetch()`es report in `CF-Worker`. */
41 zone?: string;
42 bindingDescriptors: WorkerBinding[];
43 /** Binding name → opt-out of local emulation (`Alchemy.remote()`). */
44 devRemote: Record<string, boolean>;
45 /** Simulated Cloudflare Access config (`dev: { access: ... }`). */
46 devAccess?: { aud?: string; identity?: Record<string, unknown> };
47 durableObjectNamespaces: (DurableObjectNamespace & {
48 uniqueKey: string;
49 })[];
50 workflows: Workflow[];
51 hyperdrives: Record<string, Required<HyperdriveOrigin>>;
52 queueConsumers: QueueConsumer[];
53 crons: RuntimeWorker["crons"];
54 /** Tail consumers by script name, resolved through the dev registry. */
55 tails: RuntimeWorker["tails"];
56 /** Streaming tail consumers by script name. */
57 streamingTails: RuntimeWorker["streamingTails"];
58 /** Cache API opt-out (`dev: { cache: false }`). */
59 cache: RuntimeWorker["cache"];
60 /** `request.cf` override (`dev: { cf: {...} }`). */
61 cf: RuntimeWorker["cf"];
62 /** workerd process overrides (`dev: { workerd: {...} }`). */
63 workerd: RuntimeWorker["workerd"];
64 assets: RuntimeWorker["assets"];
65 };
66 }
67
68 export const VITE_CHILD_READY_PREFIX = "<ALCHEMY_VITE_ADDRESS>";
69 export const VITE_CHILD_READY_SUFFIX = "</ALCHEMY_VITE_ADDRESS>";
70
71 /**
72 * Plain-data configuration transferred from the provider to a one-shot
73 * Vite *build* child (`ViteBuildChildRunner.ts`). Deliberately much
74 * smaller than {@link ViteChildConfig}: a production build needs no
75 * workerd runtime, credentials, or binding materialization.
76 */
77 export interface ViteBuildChildConfig {
78 /** Absolute project root; also the child process's working directory. */
79 rootDir: string;
80 /**
81 * `VITE_`-prefixed env entries — the only ones the build consumes
82 * (inlined as `import.meta.env.*` defines).
83 */
84 env: Record<string, unknown>;
85 main: string | undefined;
86 framework?: "foldkit";
87 compatibilityDate: string | undefined;
88 compatibilityFlags: string[] | undefined;
89 viteEnvironments: { entry?: string; children?: string[] } | undefined;
90 /** Absolute path the child writes the V8-serialized result to. */
91 outputPath: string;
92 }
93
94 /** Result the build child writes to `outputPath` (V8-serialized). */
95 export interface ViteBuildChildResult {
96 clientDirectory: string | undefined;
97 foldkit: FoldkitBuildMetadata | undefined;
98 base: string | undefined;
99 serverBundle: BundleOutput | undefined;
100 externalWorkspaces: string[];
101 }