@vibesdotdev/infra-cloudflare 0.0.1

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 (128) hide show
  1. package/README.md +107 -0
  2. package/SPEC.md +166 -0
  3. package/dist/cloudflare.plugin.d.ts +73 -0
  4. package/dist/cloudflare.plugin.d.ts.map +1 -0
  5. package/dist/cloudflare.plugin.js +334 -0
  6. package/dist/cloudflare.plugin.js.map +1 -0
  7. package/dist/implementations/alerts.descriptor.d.ts +13 -0
  8. package/dist/implementations/alerts.descriptor.d.ts.map +1 -0
  9. package/dist/implementations/alerts.descriptor.js +30 -0
  10. package/dist/implementations/alerts.descriptor.js.map +1 -0
  11. package/dist/implementations/alerts.impl.d.ts +35 -0
  12. package/dist/implementations/alerts.impl.d.ts.map +1 -0
  13. package/dist/implementations/alerts.impl.js +283 -0
  14. package/dist/implementations/alerts.impl.js.map +1 -0
  15. package/dist/implementations/kv.impl.d.ts +29 -0
  16. package/dist/implementations/kv.impl.d.ts.map +1 -0
  17. package/dist/implementations/kv.impl.js +36 -0
  18. package/dist/implementations/kv.impl.js.map +1 -0
  19. package/dist/implementations/logs.descriptor.d.ts +15 -0
  20. package/dist/implementations/logs.descriptor.d.ts.map +1 -0
  21. package/dist/implementations/logs.descriptor.js +26 -0
  22. package/dist/implementations/logs.descriptor.js.map +1 -0
  23. package/dist/implementations/logs.impl.d.ts +108 -0
  24. package/dist/implementations/logs.impl.d.ts.map +1 -0
  25. package/dist/implementations/logs.impl.js +154 -0
  26. package/dist/implementations/logs.impl.js.map +1 -0
  27. package/dist/implementations/observability.descriptor.d.ts +9 -0
  28. package/dist/implementations/observability.descriptor.d.ts.map +1 -0
  29. package/dist/implementations/observability.descriptor.js +22 -0
  30. package/dist/implementations/observability.descriptor.js.map +1 -0
  31. package/dist/implementations/observability.impl.d.ts +35 -0
  32. package/dist/implementations/observability.impl.d.ts.map +1 -0
  33. package/dist/implementations/observability.impl.js +229 -0
  34. package/dist/implementations/observability.impl.js.map +1 -0
  35. package/dist/implementations/pages.impl.d.ts +98 -0
  36. package/dist/implementations/pages.impl.d.ts.map +1 -0
  37. package/dist/implementations/pages.impl.js +132 -0
  38. package/dist/implementations/pages.impl.js.map +1 -0
  39. package/dist/implementations/queues.impl.d.ts +29 -0
  40. package/dist/implementations/queues.impl.d.ts.map +1 -0
  41. package/dist/implementations/queues.impl.js +34 -0
  42. package/dist/implementations/queues.impl.js.map +1 -0
  43. package/dist/implementations/r2.impl.d.ts +31 -0
  44. package/dist/implementations/r2.impl.d.ts.map +1 -0
  45. package/dist/implementations/r2.impl.js +41 -0
  46. package/dist/implementations/r2.impl.js.map +1 -0
  47. package/dist/implementations/rum.descriptor.d.ts +13 -0
  48. package/dist/implementations/rum.descriptor.d.ts.map +1 -0
  49. package/dist/implementations/rum.descriptor.js +32 -0
  50. package/dist/implementations/rum.descriptor.js.map +1 -0
  51. package/dist/implementations/rum.impl.d.ts +34 -0
  52. package/dist/implementations/rum.impl.d.ts.map +1 -0
  53. package/dist/implementations/rum.impl.js +153 -0
  54. package/dist/implementations/rum.impl.js.map +1 -0
  55. package/dist/implementations/web-app.impl.d.ts +294 -0
  56. package/dist/implementations/web-app.impl.d.ts.map +1 -0
  57. package/dist/implementations/web-app.impl.js +208 -0
  58. package/dist/implementations/web-app.impl.js.map +1 -0
  59. package/dist/implementations/workers.impl.d.ts +157 -0
  60. package/dist/implementations/workers.impl.d.ts.map +1 -0
  61. package/dist/implementations/workers.impl.js +247 -0
  62. package/dist/implementations/workers.impl.js.map +1 -0
  63. package/dist/index.d.ts +17 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +12 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/pages.d.ts +9 -0
  68. package/dist/pages.d.ts.map +1 -0
  69. package/dist/pages.js +9 -0
  70. package/dist/pages.js.map +1 -0
  71. package/dist/regen.d.ts +58 -0
  72. package/dist/regen.d.ts.map +1 -0
  73. package/dist/regen.js +69 -0
  74. package/dist/regen.js.map +1 -0
  75. package/dist/secrets/cloudflare-api.descriptor.d.ts +18 -0
  76. package/dist/secrets/cloudflare-api.descriptor.d.ts.map +1 -0
  77. package/dist/secrets/cloudflare-api.descriptor.js +32 -0
  78. package/dist/secrets/cloudflare-api.descriptor.js.map +1 -0
  79. package/dist/secrets/cloudflare-api.impl.d.ts +30 -0
  80. package/dist/secrets/cloudflare-api.impl.d.ts.map +1 -0
  81. package/dist/secrets/cloudflare-api.impl.js +111 -0
  82. package/dist/secrets/cloudflare-api.impl.js.map +1 -0
  83. package/dist/secrets/cloudflare-secrets-store.descriptor.d.ts +10 -0
  84. package/dist/secrets/cloudflare-secrets-store.descriptor.d.ts.map +1 -0
  85. package/dist/secrets/cloudflare-secrets-store.descriptor.js +24 -0
  86. package/dist/secrets/cloudflare-secrets-store.descriptor.js.map +1 -0
  87. package/dist/secrets/cloudflare-secrets-store.impl.d.ts +27 -0
  88. package/dist/secrets/cloudflare-secrets-store.impl.d.ts.map +1 -0
  89. package/dist/secrets/cloudflare-secrets-store.impl.js +72 -0
  90. package/dist/secrets/cloudflare-secrets-store.impl.js.map +1 -0
  91. package/dist/secrets/index.d.ts +6 -0
  92. package/dist/secrets/index.d.ts.map +1 -0
  93. package/dist/secrets/index.js +6 -0
  94. package/dist/secrets/index.js.map +1 -0
  95. package/dist/secrets/resolve-cf-credentials.d.ts +18 -0
  96. package/dist/secrets/resolve-cf-credentials.d.ts.map +1 -0
  97. package/dist/secrets/resolve-cf-credentials.js +57 -0
  98. package/dist/secrets/resolve-cf-credentials.js.map +1 -0
  99. package/dist/web-app.d.ts +11 -0
  100. package/dist/web-app.d.ts.map +1 -0
  101. package/dist/web-app.js +11 -0
  102. package/dist/web-app.js.map +1 -0
  103. package/package.json +153 -0
  104. package/src/cloudflare.plugin.ts +477 -0
  105. package/src/implementations/alerts.descriptor.ts +33 -0
  106. package/src/implementations/alerts.impl.ts +332 -0
  107. package/src/implementations/kv.impl.ts +51 -0
  108. package/src/implementations/logs.descriptor.ts +29 -0
  109. package/src/implementations/logs.impl.ts +201 -0
  110. package/src/implementations/observability.descriptor.ts +25 -0
  111. package/src/implementations/observability.impl.ts +307 -0
  112. package/src/implementations/pages.impl.ts +189 -0
  113. package/src/implementations/queues.impl.ts +48 -0
  114. package/src/implementations/r2.impl.ts +58 -0
  115. package/src/implementations/rum.descriptor.ts +35 -0
  116. package/src/implementations/rum.impl.ts +192 -0
  117. package/src/implementations/web-app.impl.ts +494 -0
  118. package/src/implementations/workers.impl.ts +336 -0
  119. package/src/index.ts +60 -0
  120. package/src/pages.ts +18 -0
  121. package/src/regen.ts +87 -0
  122. package/src/secrets/cloudflare-api.descriptor.ts +35 -0
  123. package/src/secrets/cloudflare-api.impl.ts +131 -0
  124. package/src/secrets/cloudflare-secrets-store.descriptor.ts +27 -0
  125. package/src/secrets/cloudflare-secrets-store.impl.ts +87 -0
  126. package/src/secrets/index.ts +13 -0
  127. package/src/secrets/resolve-cf-credentials.ts +63 -0
  128. package/src/web-app.ts +32 -0
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @vibesdotdev/infra-cloudflare
2
+
3
+ Cloudflare slice of the vibes deployment toolkit. Generates wrangler-shaped
4
+ config fragments for Cloudflare Workers, Queues, R2, and KV, and registers a
5
+ write-only `secrets/store` backend that pushes secrets to Cloudflare via the
6
+ v4 REST API.
7
+
8
+ See [`SPEC.md`](./SPEC.md) for the contract and
9
+ [`PROD-CHECKLIST.md`](./PROD-CHECKLIST.md) for verification status.
10
+
11
+ ## What's in here
12
+
13
+ - `src/cloudflare.plugin.ts` — `cloudflarePlugin` registers loaders against
14
+ `infra/worker`, `infra/queue`, `infra/object-storage`, `infra/cache`, and
15
+ `secrets/store` kinds owned by [`infra-core`](../infra-core/SPEC.md) and
16
+ [`secrets`](../secrets/SPEC.md).
17
+ - `src/implementations/workers.impl.ts` —
18
+ `generateCloudflareWorkerConfig` plus the cloud Flow job-consumer
19
+ convention (`generateJobConsumerWorkerConfig`,
20
+ `JOB_RESULT_STORE_BINDING` / `_CLASS` / `_INITIAL_MIGRATION_TAG`).
21
+ - `src/implementations/queues.impl.ts` — Cloudflare Queues producer
22
+ bindings.
23
+ - `src/implementations/r2.impl.ts` — R2 bucket bindings (preview buckets,
24
+ jurisdiction).
25
+ - `src/implementations/kv.impl.ts` — KV namespace bindings (preview ids).
26
+ - `src/secrets/` — `cloudflareApiDescriptor` + `createCloudflareApiStore`
27
+ (push-only `secrets/store`) and the raw v4 client helpers.
28
+
29
+ ## Common usage
30
+
31
+ Register the plugin alongside `infraPlugin` during runtime bootstrap:
32
+
33
+ ```ts
34
+ import { createVibesRuntime } from '@vibesdotdev/runtime';
35
+ import infraPlugin from '@vibesdotdev/infra-core/plugin';
36
+ import cloudflarePlugin from '@vibesdotdev/infra-cloudflare/plugin';
37
+
38
+ const runtime = createVibesRuntime({
39
+ plugins: [infraPlugin, cloudflarePlugin]
40
+ });
41
+ ```
42
+
43
+ Generate a worker config from a descriptor:
44
+
45
+ ```ts
46
+ import { generateCloudflareWorkerConfig } from '@vibesdotdev/infra-cloudflare/implementations/workers';
47
+
48
+ const config = generateCloudflareWorkerConfig({
49
+ kind: 'infra/worker',
50
+ id: 'billing',
51
+ name: 'Billing Worker',
52
+ adapter: 'cloudflare-workers',
53
+ workerName: 'vibes-billing-worker',
54
+ main: 'src/worker.ts',
55
+ consumers: [{ queue: 'billing-jobs' }],
56
+ kvNamespaces: [{ binding: 'CACHE', id: 'abc123' }]
57
+ });
58
+ ```
59
+
60
+ Generate a cloud Flow job-consumer worker (auto-injects the
61
+ `JOB_RESULT_STORE` Durable Object binding + initial SQLite migration the
62
+ [`workers`](../workers/SPEC.md) rendezvous protocol expects):
63
+
64
+ ```ts
65
+ import { generateJobConsumerWorkerConfig } from '@vibesdotdev/infra-cloudflare/implementations/workers';
66
+
67
+ const config = generateJobConsumerWorkerConfig({
68
+ kind: 'infra/worker',
69
+ id: 'flow-consumer',
70
+ name: 'Flow Consumer',
71
+ adapter: 'cloudflare-workers',
72
+ workerName: 'vibes-flow-consumer',
73
+ main: 'src/worker.ts',
74
+ consumers: [{ queue: 'flow-jobs' }]
75
+ });
76
+ ```
77
+
78
+ Push secrets via the Cloudflare API backend (requires
79
+ `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` in the environment):
80
+
81
+ ```ts
82
+ import { createCloudflareApiStore } from '@vibesdotdev/infra-cloudflare';
83
+
84
+ const store = createCloudflareApiStore();
85
+ await store.impl.setAll('production', {
86
+ STRIPE_SECRET_KEY: '...',
87
+ RESEND_API_KEY: '...'
88
+ });
89
+ ```
90
+
91
+ ## Verification
92
+
93
+ ```bash
94
+ cd packages/infra-cloudflare
95
+ bun test
96
+ bun --bun tsc -p tsconfig.json --noEmit
97
+ ```
98
+
99
+ ## Links
100
+
101
+ - [SPEC.md](./SPEC.md)
102
+ - [PROD-CHECKLIST.md](./PROD-CHECKLIST.md)
103
+ - [`infra-core`](../infra-core/SPEC.md)
104
+ - [`infra-doks`](../infra-doks/SPEC.md)
105
+ - [`secrets`](../secrets/SPEC.md)
106
+ - [`workers`](../workers/SPEC.md)
107
+ - [`deploy`](../deploy/SPEC.md)
package/SPEC.md ADDED
@@ -0,0 +1,166 @@
1
+ # @vibesdotdev/infra-cloudflare
2
+
3
+ Cloudflare adapter for [`infra-core`](../infra-core/SPEC.md) kinds. Provides the
4
+ Cloudflare slice of the vibes deployment toolkit: generates wrangler-shaped
5
+ config fragments for Cloudflare Workers, Queues, R2, and KV, and registers a
6
+ write-only `secrets/store` backend that pushes secrets to Cloudflare Pages
7
+ projects and Workers scripts via the v4 REST API. Consumed by per-app
8
+ `deployment.config.ts` files (and `infra/manifest.ts` / `infra/generate.ts`)
9
+ inside this monorepo, and intended to be consumed by end-user vibes projects
10
+ that target Cloudflare. Pairs with [`infra-doks`](../infra-doks/SPEC.md) on the
11
+ DigitalOcean side.
12
+
13
+ ## Owns
14
+
15
+ - **Plugin descriptors registered by the plugin:** `cloudflarePlugin`
16
+ (id `infra-cloudflare`, depends on `infra`) registers loaders for:
17
+ - `infra/worker` → `cloudflare-workers`
18
+ - `infra/queue` → `cloudflare-queues`
19
+ - `infra/object-storage` → `cloudflare-r2`
20
+ - `infra/cache` → `cloudflare-kv`
21
+ - `secrets/store` → `cloudflare-api` (priority 20)
22
+ - **Worker config generator** (`./implementations/workers`):
23
+ `generateCloudflareWorkerConfig` plus the cloud Flow job-consumer
24
+ convention (`generateJobConsumerWorkerConfig`,
25
+ `JOB_RESULT_STORE_BINDING` / `_CLASS` / `_INITIAL_MIGRATION_TAG`). Emits a
26
+ wrangler-shaped object: `name`, `main`, compatibility, `vars`, `queues`,
27
+ `kv_namespaces`, `r2_buckets`, `durable_objects`, `migrations`, optional
28
+ smart placement.
29
+ - **Web-app wrangler.jsonc generator** (`./implementations/web-app`):
30
+ `createCloudflareWebAppDeployment({ ... }).generateWranglerConfig()` is the
31
+ authoritative emitter for SvelteKit/SSR apps. Supports every wrangler key
32
+ currently in use across the repo: `name`, `main`, `compatibility_date`,
33
+ `compatibility_flags`, `assets`, `routes`, `vars`, `secrets_store_secrets`,
34
+ `secrets.required`, `d1_databases`, `r2_buckets`, `services`,
35
+ `observability`, `triggers`, `queues`, `durable_objects`, `migrations`,
36
+ `send_email`, `workers_dev`, `preview_urls`. `apps/<name>/wrangler.jsonc`
37
+ is a build artifact regenerated from `deployment.config.ts` by
38
+ `vibes infra deploy regenerate` (the sole supported path).
39
+ CI drift is enforced via the CLI `--check`. To adopt: express the surface in
40
+ `deployment.config.ts`, run `vibes infra deploy regenerate --adopt --path <dir>`.
41
+ - **Queue producer config generator** (`./implementations/queues`):
42
+ `generateCloudflareQueueConfig` for `infra/queue` when
43
+ `engine === 'cloudflare-queues'`.
44
+ - **R2 bucket config generator** (`./implementations/r2`):
45
+ `generateCloudflareR2Config` for `infra/object-storage` when
46
+ `adapter === 'cloudflare-r2'`. Supports preview buckets and jurisdiction.
47
+ - **KV namespace config generator** (`./implementations/kv`):
48
+ `generateCloudflareKVConfig` for `infra/cache` when
49
+ `engine === 'cloudflare-kv'`. Supports preview namespaces.
50
+ - **Cloudflare API secrets backend** (`./src/secrets/`):
51
+ `cloudflareApiDescriptor` + `createCloudflareApiStore` register a
52
+ push-only `secrets/store` against CF Pages project `env_vars` and Worker
53
+ script `secrets`, plus the raw client helpers (`listPagesSecrets`,
54
+ `setPagesSecrets`, `listWorkerSecrets`, `setWorkerSecrets`).
55
+
56
+ ## Does not own
57
+
58
+ - The kind contracts themselves (descriptor schema shapes for `infra/*` and
59
+ `secrets/store`) → [`infra-core`](../infra-core/SPEC.md) and
60
+ [`secrets`](../secrets/SPEC.md). This package only registers
61
+ implementations against those kinds.
62
+ - DigitalOcean / DOKS / Spaces / Managed DB equivalents →
63
+ [`infra-doks`](../infra-doks/SPEC.md).
64
+ - Deployment orchestration, manifest generation, env materialization →
65
+ [`deploy`](../deploy/SPEC.md). Per-app `deployment.config.ts` lives in
66
+ the consuming app.
67
+ - Local / encrypted / env-file secret backends →
68
+ [`secrets`](../secrets/SPEC.md).
69
+
70
+ ## Hard rules
71
+
72
+ - This package implements adapters; it never declares new runtime kinds.
73
+ New kinds belong in [`infra-core`](../infra-core/SPEC.md).
74
+ - Pure TypeScript and global `fetch`. No Node-only APIs, no filesystem, no
75
+ `wrangler` CLI dependency. Generators return plain objects callers can
76
+ serialize to wrangler.jsonc.
77
+ - The `cloudflare-api` secrets store is push-only. `get` / `getAll` always
78
+ return empty/undefined and `unset` is a no-op (Cloudflare does not return
79
+ secret values or expose per-key delete). Callers that round-trip through
80
+ `get` are broken; reads must come from a different backend.
81
+ - `cloudflareApiDescriptor.tiers` is `['staging', 'production']` and
82
+ `priority` is `20`. Local backends in
83
+ [`secrets`](../secrets/SPEC.md) must out-prioritize this for `local` /
84
+ `dev` tiers, or local development will attempt to push to Cloudflare.
85
+ - `getClientConfig` throws when `CLOUDFLARE_API_TOKEN` or
86
+ `CLOUDFLARE_ACCOUNT_ID` (or the descriptor-overridden env var names) are
87
+ unset. Bootstrapping a CF push without those env vars is a hard failure,
88
+ not a silent skip.
89
+ - `JOB_RESULT_STORE_BINDING` / `JOB_RESULT_STORE_CLASS` /
90
+ `JOB_RESULT_STORE_INITIAL_MIGRATION_TAG` are the contract for cloud Flow
91
+ job-consumer workers. Consumers must use
92
+ `generateJobConsumerWorkerConfig` (or replicate the binding name and
93
+ initial-migration tag verbatim) — the [`workers`](../workers/SPEC.md)
94
+ cloud rendezvous protocol expects this exact shape.
95
+ - New CF Durable Object classes must register via `newSqliteClasses` in
96
+ their initial migration. Plain `newClasses` is the legacy non-SQLite form
97
+ and is rejected by Cloudflare for accounts created after 2024-04-01.
98
+
99
+ ## Migration debt (completed)
100
+
101
+ - [x] **Pages surface is missing.** 19 consumers (15
102
+ `apps/*/deployment.config.ts`, plus `infra/manifest.ts` and
103
+ `infra/generate.ts`) import `createCloudflarePagesDeployment` and
104
+ `renderWranglerJson` from `@vibesdotdev/infra-cloudflare/pages`. ~~The
105
+ `./pages` subpath is not declared in `package.json#exports`, no
106
+ `src/pages.ts` / `src/implementations/pages.impl.ts` files exist, and
107
+ there is no Pages-typed loader registered by the plugin. Restore the
108
+ Pages module (`pages` helpers, `implementations/pages.impl.ts`, plugin
109
+ registration for whichever kind it targets) and re-add the
110
+ `./pages` + `./implementations/pages` exports.~~
111
+ **Resolution:** Created `src/implementations/pages.impl.ts` with
112
+ `createCloudflarePagesDeployment`, `renderWranglerJson`, and
113
+ `generateCloudflarePagesDescriptor`. Created `src/pages.ts` as public
114
+ entrypoint. Added `./pages` and `./implementations/pages` to
115
+ `package.json#exports`. Registered `cloudflare-pages` loader for
116
+ `infra/web-app` kind in plugin.
117
+ - [x] `src/secrets/cloudflare-api.impl.ts` uses
118
+ `require('@vibesdotdev/runtime')` inside `getCFProjectNames()` to dodge
119
+ a circular dependency. ~~Replace with a constructor-injected runtime
120
+ handle or a registered query callback so the file is ESM-clean.~~
121
+ **Resolution:** Replaced `require()` hack with a
122
+ `CFProjectNamesResolver` function type injected via constructor.
123
+ Plugin passes a resolver that queries `runtime.assets('infra/web-app')`
124
+ through the runtime handle. The implementation is now ESM-clean with
125
+ no dynamic requires.
126
+ - [x] `getCFProjectNames()` derives Cloudflare project names from
127
+ `infra/web-app` descriptors using a hardcoded `vibes-{appId}` pattern.
128
+ ~~Move project-name resolution onto the descriptor (e.g. an explicit
129
+ `cfProjectName` field on `infra/web-app`) or codify the convention in
130
+ `infra-core`.~~ **Resolution:** Added optional `cfProjectName` field to
131
+ `WebAppDescriptorSchema` in `infra-core/src/kinds/web-app.kind.ts`.
132
+ The secrets backend now prefers `descriptor.cfProjectName` when
133
+ available, falling back to the `vibes-{appId}` convention for
134
+ backward compatibility.
135
+ - [x] `cloudflareApiDescriptor` lives in `./src/secrets/` but is reachable
136
+ only via the package root. ~~Add a `./secrets` subpath in
137
+ `package.json#exports` so end users can import the descriptor + helper
138
+ client without pulling everything.~~ **Resolution:** Added
139
+ `"./secrets": "./src/secrets/index.ts"` to `package.json#exports`.
140
+
141
+ ## Public entrypoints
142
+
143
+ `.`, `./pages`, `./implementations/workers`, `./implementations/queues`,
144
+ `./implementations/r2`, `./implementations/kv`, `./implementations/pages`,
145
+ `./plugin`, `./secrets`.
146
+
147
+ The root export re-exports every `implementations/*` module plus
148
+ `./secrets/index` and `cloudflarePlugin`.
149
+
150
+ ## Verification
151
+
152
+ `bun test` from `packages/infra-cloudflare`. Covers descriptor parse +
153
+ generated-config shape for workers, queues, r2, kv
154
+ (`__tests__/{workers,queues,r2,kv}.test.ts`) plus plugin metadata and
155
+ per-impl creation (`__tests__/plugin.test.ts`, 6 cases). Does not cover
156
+ the `cloudflare-api` secrets backend — there is no
157
+ `__tests__/secrets.test.ts`, and the v4 REST calls are not exercised in
158
+ CI. `bun --bun tsc -p tsconfig.json --noEmit` is the type gate.
159
+
160
+ ## Links
161
+
162
+ - [infra-core/SPEC.md](../infra-core/SPEC.md)
163
+ - [infra-doks/SPEC.md](../infra-doks/SPEC.md)
164
+ - [deploy/SPEC.md](../deploy/SPEC.md)
165
+ - [secrets/SPEC.md](../secrets/SPEC.md)
166
+ - [workers/SPEC.md](../workers/SPEC.md)
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Cloudflare Infrastructure Plugin
3
+ *
4
+ * Registers Cloudflare provider implementations for each infra kind.
5
+ * When a descriptor's adapter/engine matches a Cloudflare provider,
6
+ * the corresponding config generator is loaded.
7
+ *
8
+ * Web apps deploy via @sveltejs/adapter-cloudflare Workers Static Assets,
9
+ * configured per-app in apps/{app}-web/wrangler.jsonc. The Pages module
10
+ * provides `createCloudflarePagesDeployment` and `renderWranglerJson`
11
+ * for consumers that need programmatic wrangler config generation.
12
+ */
13
+ import { type CloudflareWorkerDescriptorInput, type WranglerWorkerConfig } from './implementations/workers.impl';
14
+ import { type CloudflareQueueDescriptor } from './implementations/queues.impl';
15
+ import { type CloudflareR2Descriptor } from './implementations/r2.impl';
16
+ import { type CloudflareKVDescriptor } from './implementations/kv.impl';
17
+ import { type CloudflarePagesDescriptor } from './implementations/pages.impl';
18
+ import { type CloudflareWebAppDescriptorInput } from './implementations/web-app.impl';
19
+ import { type CloudflareLogsDescriptorInput } from './implementations/logs.impl';
20
+ import { type CloudflareAlertsDescriptorInput } from './implementations/alerts.impl';
21
+ import { type CloudflareObservabilityDescriptorInput } from './implementations/observability.impl';
22
+ import { type CloudflareRumDescriptorInput } from './implementations/rum.impl';
23
+ declare function createWorkerImpl(input: CloudflareWorkerDescriptorInput): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<{
24
+ generateConfig: () => WranglerWorkerConfig;
25
+ }>;
26
+ declare function createQueueImpl(input: CloudflareQueueDescriptor): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<{
27
+ generateConfig: () => import("./index.ts").WranglerQueueProducerConfig;
28
+ }>;
29
+ declare function createR2Impl(input: CloudflareR2Descriptor): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<{
30
+ generateConfig: () => import("./index.ts").WranglerR2Config;
31
+ }>;
32
+ declare function createKVImpl(input: CloudflareKVDescriptor): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<{
33
+ generateConfig: () => import("./index.ts").WranglerKVConfig;
34
+ }>;
35
+ declare function createPagesImpl(input: CloudflarePagesDescriptor): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<{
36
+ generateConfig: () => {
37
+ kind: "infra/web-app";
38
+ id: string;
39
+ name: string;
40
+ adapter: "cloudflare-workers" | "cloudflare-pages";
41
+ cfProjectName: string;
42
+ outputDir: string;
43
+ compatibilityFlags: string[];
44
+ env: Record<string, string>;
45
+ compatibilityDate?: string | undefined;
46
+ secretsStoreId?: string | undefined;
47
+ };
48
+ getProjectName: () => string;
49
+ }>;
50
+ declare function createWebAppImpl(input: CloudflareWebAppDescriptorInput): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<{
51
+ generateConfig: () => {
52
+ kind: "infra/web-app";
53
+ id: string;
54
+ name: string;
55
+ adapter: "cloudflare-workers";
56
+ cfWorkerName: string;
57
+ outputDir: string;
58
+ workerEntry: string;
59
+ compatibilityFlags: string[];
60
+ env: Record<string, string>;
61
+ compatibilityDate?: string | undefined;
62
+ secretsStoreId?: string | undefined;
63
+ };
64
+ getWorkerName: () => string;
65
+ }>;
66
+ declare function createLogsImpl(input: CloudflareLogsDescriptorInput): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<import("./index.ts").LogsImplementation>;
67
+ declare function createAlertsImpl(input: CloudflareAlertsDescriptorInput): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<import("@vibesdotdev/infra-core").AlertsImplementation>;
68
+ declare function createObservabilityImpl(input: CloudflareObservabilityDescriptorInput): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<import("@vibesdotdev/infra-core").ObservabilityImplementation>;
69
+ declare function createRumImpl(input: CloudflareRumDescriptorInput): import("@vibesdotdev/runtime").RuntimeImplementationWrapper<import("@vibesdotdev/infra-core").RumImplementation>;
70
+ export { createWorkerImpl, createQueueImpl, createR2Impl, createKVImpl, createPagesImpl, createWebAppImpl, createLogsImpl, createAlertsImpl, createObservabilityImpl, createRumImpl };
71
+ declare const _default: import("@vibesdotdev/runtime").RuntimePlugin;
72
+ export default _default;
73
+ //# sourceMappingURL=cloudflare.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudflare.plugin.d.ts","sourceRoot":"","sources":["../src/cloudflare.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAGN,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGN,KAAK,yBAAyB,EAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGN,KAAK,sBAAsB,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGN,KAAK,sBAAsB,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGN,KAAK,yBAAyB,EAC9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEN,KAAK,+BAA+B,EACpC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGN,KAAK,6BAA6B,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGN,KAAK,+BAA+B,EACpC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGN,KAAK,sCAAsC,EAC3C,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGN,KAAK,4BAA4B,EACjC,MAAM,4BAA4B,CAAC;AAQpC,iBAAS,gBAAgB,CAAC,KAAK,EAAE,+BAA+B;;GAU/D;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,yBAAyB;;GAUxD;AAED,iBAAS,YAAY,CAAC,KAAK,EAAE,sBAAsB;;GAUlD;AAED,iBAAS,YAAY,CAAC,KAAK,EAAE,sBAAsB;;GAUlD;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,yBAAyB;;;;;;;;;;;;;;GAWxD;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,+BAA+B;;;;;;;;;;;;;;;GAW/D;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,6BAA6B,wGAS3D;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,+BAA+B,uHAS/D;AAED,iBAAS,uBAAuB,CAAC,KAAK,EAAE,sCAAsC,8HAS7E;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,4BAA4B,oHASzD;AAED,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,CAAC;;AAEF,wBAkRG"}