@webflow/cloud-app 0.1.0-beta.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 (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +161 -0
  3. package/dist/bindings.d.ts +190 -0
  4. package/dist/bindings.d.ts.map +1 -0
  5. package/dist/bindings.js +126 -0
  6. package/dist/bindings.js.map +1 -0
  7. package/dist/compat-date.d.ts +68 -0
  8. package/dist/compat-date.d.ts.map +1 -0
  9. package/dist/compat-date.js +169 -0
  10. package/dist/compat-date.js.map +1 -0
  11. package/dist/config/package-json.d.ts +57 -0
  12. package/dist/config/package-json.d.ts.map +1 -0
  13. package/dist/config/package-json.js +94 -0
  14. package/dist/config/package-json.js.map +1 -0
  15. package/dist/config/webflow-json.d.ts +47 -0
  16. package/dist/config/webflow-json.d.ts.map +1 -0
  17. package/dist/config/webflow-json.js +72 -0
  18. package/dist/config/webflow-json.js.map +1 -0
  19. package/dist/create-webflow-json.d.ts +21 -0
  20. package/dist/create-webflow-json.d.ts.map +1 -0
  21. package/dist/create-webflow-json.js +168 -0
  22. package/dist/create-webflow-json.js.map +1 -0
  23. package/dist/diagnostics.d.ts +23 -0
  24. package/dist/diagnostics.d.ts.map +1 -0
  25. package/dist/diagnostics.js +31 -0
  26. package/dist/diagnostics.js.map +1 -0
  27. package/dist/errors.d.ts +13 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +23 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.d.ts +28 -0
  32. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.d.ts.map +1 -0
  33. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.js +148 -0
  34. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.js.map +1 -0
  35. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts +34 -0
  36. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts.map +1 -0
  37. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js +89 -0
  38. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js.map +1 -0
  39. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts +39 -0
  40. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts.map +1 -0
  41. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.js +93 -0
  42. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.js.map +1 -0
  43. package/dist/frameworks/astro/astro5.d.ts +28 -0
  44. package/dist/frameworks/astro/astro5.d.ts.map +1 -0
  45. package/dist/frameworks/astro/astro5.js +276 -0
  46. package/dist/frameworks/astro/astro5.js.map +1 -0
  47. package/dist/frameworks/astro/astro6.d.ts +28 -0
  48. package/dist/frameworks/astro/astro6.d.ts.map +1 -0
  49. package/dist/frameworks/astro/astro6.js +305 -0
  50. package/dist/frameworks/astro/astro6.js.map +1 -0
  51. package/dist/frameworks/astro/astro7.d.ts +28 -0
  52. package/dist/frameworks/astro/astro7.d.ts.map +1 -0
  53. package/dist/frameworks/astro/astro7.js +303 -0
  54. package/dist/frameworks/astro/astro7.js.map +1 -0
  55. package/dist/frameworks/astro/index.d.ts +10 -0
  56. package/dist/frameworks/astro/index.d.ts.map +1 -0
  57. package/dist/frameworks/astro/index.js +16 -0
  58. package/dist/frameworks/astro/index.js.map +1 -0
  59. package/dist/frameworks/astro/session-check.d.ts +24 -0
  60. package/dist/frameworks/astro/session-check.d.ts.map +1 -0
  61. package/dist/frameworks/astro/session-check.js +166 -0
  62. package/dist/frameworks/astro/session-check.js.map +1 -0
  63. package/dist/frameworks/astro/templates/astro.config.webflow.ts +61 -0
  64. package/dist/frameworks/astro/templates/v5/astro.config.mjs.template +25 -0
  65. package/dist/frameworks/astro/templates/v5/webflow-loader.ts +126 -0
  66. package/dist/frameworks/astro/templates/v5/wrangler.json +6 -0
  67. package/dist/frameworks/astro/templates/v6/astro.config.mjs.template +35 -0
  68. package/dist/frameworks/astro/templates/v6/webflow-loader.ts +126 -0
  69. package/dist/frameworks/astro/templates/v6/wrangler.json +9 -0
  70. package/dist/frameworks/astro/templates/v7/astro.config.mjs.template +34 -0
  71. package/dist/frameworks/astro/templates/v7/webflow-loader.ts +125 -0
  72. package/dist/frameworks/astro/templates/v7/wrangler.json +9 -0
  73. package/dist/frameworks/astro/templates/webflow-image-url.ts +140 -0
  74. package/dist/frameworks/base.d.ts +134 -0
  75. package/dist/frameworks/base.d.ts.map +1 -0
  76. package/dist/frameworks/base.js +175 -0
  77. package/dist/frameworks/base.js.map +1 -0
  78. package/dist/frameworks/errors.d.ts +72 -0
  79. package/dist/frameworks/errors.d.ts.map +1 -0
  80. package/dist/frameworks/errors.js +120 -0
  81. package/dist/frameworks/errors.js.map +1 -0
  82. package/dist/frameworks/nextjs/adapter-resolver.d.ts +72 -0
  83. package/dist/frameworks/nextjs/adapter-resolver.d.ts.map +1 -0
  84. package/dist/frameworks/nextjs/adapter-resolver.js +246 -0
  85. package/dist/frameworks/nextjs/adapter-resolver.js.map +1 -0
  86. package/dist/frameworks/nextjs/index.d.ts +38 -0
  87. package/dist/frameworks/nextjs/index.d.ts.map +1 -0
  88. package/dist/frameworks/nextjs/index.js +268 -0
  89. package/dist/frameworks/nextjs/index.js.map +1 -0
  90. package/dist/frameworks/nextjs/templates/next.config.ts.template +13 -0
  91. package/dist/frameworks/nextjs/templates/next.config.webflow.ts +46 -0
  92. package/dist/frameworks/nextjs/templates/open-next.config.ts +3 -0
  93. package/dist/frameworks/nextjs/templates/webflow-loader.ts +44 -0
  94. package/dist/frameworks/nextjs/templates/wrangler.json +6 -0
  95. package/dist/frameworks/registry.d.ts +127 -0
  96. package/dist/frameworks/registry.d.ts.map +1 -0
  97. package/dist/frameworks/registry.js +257 -0
  98. package/dist/frameworks/registry.js.map +1 -0
  99. package/dist/frameworks/static/index.d.ts +116 -0
  100. package/dist/frameworks/static/index.d.ts.map +1 -0
  101. package/dist/frameworks/static/index.js +394 -0
  102. package/dist/frameworks/static/index.js.map +1 -0
  103. package/dist/frameworks/static/templates/wrangler.json +8 -0
  104. package/dist/frameworks/types.d.ts +138 -0
  105. package/dist/frameworks/types.d.ts.map +1 -0
  106. package/dist/frameworks/types.js +3 -0
  107. package/dist/frameworks/types.js.map +1 -0
  108. package/dist/frameworks/vite/index.d.ts +46 -0
  109. package/dist/frameworks/vite/index.d.ts.map +1 -0
  110. package/dist/frameworks/vite/index.js +303 -0
  111. package/dist/frameworks/vite/index.js.map +1 -0
  112. package/dist/frameworks/vite/templates/vite.config.ts.template +14 -0
  113. package/dist/frameworks/vite/templates/vite.config.webflow.ts +52 -0
  114. package/dist/frameworks/vite/templates/wrangler.json +10 -0
  115. package/dist/index.d.ts +49 -0
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +136 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/pipeline.d.ts +12 -0
  120. package/dist/pipeline.d.ts.map +1 -0
  121. package/dist/pipeline.js +293 -0
  122. package/dist/pipeline.js.map +1 -0
  123. package/dist/ports/command-runner.d.ts +59 -0
  124. package/dist/ports/command-runner.d.ts.map +1 -0
  125. package/dist/ports/command-runner.js +126 -0
  126. package/dist/ports/command-runner.js.map +1 -0
  127. package/dist/ports/filesystem.d.ts +19 -0
  128. package/dist/ports/filesystem.d.ts.map +1 -0
  129. package/dist/ports/filesystem.js +68 -0
  130. package/dist/ports/filesystem.js.map +1 -0
  131. package/dist/ports/index.d.ts +17 -0
  132. package/dist/ports/index.d.ts.map +1 -0
  133. package/dist/ports/index.js +14 -0
  134. package/dist/ports/index.js.map +1 -0
  135. package/dist/ports/logger.d.ts +22 -0
  136. package/dist/ports/logger.d.ts.map +1 -0
  137. package/dist/ports/logger.js +18 -0
  138. package/dist/ports/logger.js.map +1 -0
  139. package/dist/ports/telemetry.d.ts +23 -0
  140. package/dist/ports/telemetry.d.ts.map +1 -0
  141. package/dist/ports/telemetry.js +12 -0
  142. package/dist/ports/telemetry.js.map +1 -0
  143. package/dist/static-base-href.d.ts +31 -0
  144. package/dist/static-base-href.d.ts.map +1 -0
  145. package/dist/static-base-href.js +183 -0
  146. package/dist/static-base-href.js.map +1 -0
  147. package/dist/toolchain/errors.d.ts +32 -0
  148. package/dist/toolchain/errors.d.ts.map +1 -0
  149. package/dist/toolchain/errors.js +31 -0
  150. package/dist/toolchain/errors.js.map +1 -0
  151. package/dist/toolchain/resolver.d.ts +25 -0
  152. package/dist/toolchain/resolver.d.ts.map +1 -0
  153. package/dist/toolchain/resolver.js +200 -0
  154. package/dist/toolchain/resolver.js.map +1 -0
  155. package/dist/toolchain/types.d.ts +52 -0
  156. package/dist/toolchain/types.d.ts.map +1 -0
  157. package/dist/toolchain/types.js +10 -0
  158. package/dist/toolchain/types.js.map +1 -0
  159. package/dist/types.d.ts +71 -0
  160. package/dist/types.d.ts.map +1 -0
  161. package/dist/types.js +3 -0
  162. package/dist/types.js.map +1 -0
  163. package/dist/utils/fs.d.ts +29 -0
  164. package/dist/utils/fs.d.ts.map +1 -0
  165. package/dist/utils/fs.js +126 -0
  166. package/dist/utils/fs.js.map +1 -0
  167. package/dist/utils/index.d.ts +11 -0
  168. package/dist/utils/index.d.ts.map +1 -0
  169. package/dist/utils/index.js +27 -0
  170. package/dist/utils/index.js.map +1 -0
  171. package/dist/utils/node-version.d.ts +20 -0
  172. package/dist/utils/node-version.d.ts.map +1 -0
  173. package/dist/utils/node-version.js +113 -0
  174. package/dist/utils/node-version.js.map +1 -0
  175. package/dist/utils/process.d.ts +25 -0
  176. package/dist/utils/process.d.ts.map +1 -0
  177. package/dist/utils/process.js +40 -0
  178. package/dist/utils/process.js.map +1 -0
  179. package/dist/utils/reserved-env.d.ts +26 -0
  180. package/dist/utils/reserved-env.d.ts.map +1 -0
  181. package/dist/utils/reserved-env.js +51 -0
  182. package/dist/utils/reserved-env.js.map +1 -0
  183. package/dist/utils/template.d.ts +15 -0
  184. package/dist/utils/template.d.ts.map +1 -0
  185. package/dist/utils/template.js +75 -0
  186. package/dist/utils/template.js.map +1 -0
  187. package/dist/utils/version.d.ts +9 -0
  188. package/dist/utils/version.d.ts.map +1 -0
  189. package/dist/utils/version.js +52 -0
  190. package/dist/utils/version.js.map +1 -0
  191. package/dist/wrangler.d.ts +195 -0
  192. package/dist/wrangler.d.ts.map +1 -0
  193. package/dist/wrangler.js +372 -0
  194. package/dist/wrangler.js.map +1 -0
  195. package/package.json +48 -0
@@ -0,0 +1,372 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.loadWranglerJson = loadWranglerJson;
37
+ exports.handleWranglerJson = handleWranglerJson;
38
+ /**
39
+ * Build-phase wrangler.json synthesis.
40
+ *
41
+ * `handleWranglerJson` is the SOLE writer of wrangler.json during the build —
42
+ * it runs before `builder.prepareConfig()`, and framework builders must not
43
+ * touch the file. It backs up the user's wrangler aside as
44
+ * `clouduser.wrangler.json` (always `.json`, even from a `.jsonc` source, since
45
+ * the deployer hardcodes that path), copies the framework template into place,
46
+ * and merges the user's KV/R2/D1 bindings + D1 migrations.
47
+ *
48
+ * Deploy-phase wrangler generation (regenerating from the deployment-type
49
+ * template, binding namespacing) lives in the deployer/host, not here.
50
+ */
51
+ const fs = __importStar(require("node:fs"));
52
+ const path = __importStar(require("node:path"));
53
+ const zod_1 = require("zod");
54
+ const jsonc = __importStar(require("jsonc-parser"));
55
+ const utils_1 = require("./utils");
56
+ const webflow_json_1 = require("./config/webflow-json");
57
+ const compat_date_1 = require("./compat-date");
58
+ const errors_1 = require("./frameworks/errors");
59
+ const session_check_1 = require("./frameworks/astro/session-check");
60
+ const diagnostics_1 = require("./diagnostics");
61
+ const bindings_1 = require("./bindings");
62
+ // Strict schema for the framework template and generated files; the user's
63
+ // source uses `userWranglerJsonSchema` below. `main` is optional because the
64
+ // user's source may omit it.
65
+ const wranglerJsonSchema = zod_1.z
66
+ .object({
67
+ name: zod_1.z.string(),
68
+ main: zod_1.z.string().optional(),
69
+ compatibility_date: zod_1.z.string(),
70
+ compatibility_flags: zod_1.z.array(zod_1.z.string()).optional(),
71
+ placement: zod_1.z
72
+ .object({
73
+ mode: zod_1.z.literal('smart'),
74
+ })
75
+ .passthrough()
76
+ .optional(),
77
+ assets: zod_1.z
78
+ .object({
79
+ directory: zod_1.z.string(),
80
+ binding: zod_1.z.string().optional(),
81
+ })
82
+ .passthrough()
83
+ .optional(),
84
+ d1_databases: zod_1.z
85
+ .array(zod_1.z
86
+ .object({
87
+ database_name: zod_1.z.string(),
88
+ database_id: zod_1.z.string(),
89
+ binding: zod_1.z.string(),
90
+ migrations_dir: zod_1.z.string().optional(),
91
+ })
92
+ .passthrough())
93
+ .default([]),
94
+ kv_namespaces: zod_1.z
95
+ .array(zod_1.z
96
+ .object({
97
+ binding: zod_1.z.string(),
98
+ id: zod_1.z.string(),
99
+ })
100
+ .passthrough())
101
+ .default([]),
102
+ r2_buckets: zod_1.z
103
+ .array(zod_1.z
104
+ .object({
105
+ binding: zod_1.z.string(),
106
+ bucket_name: zod_1.z.string(),
107
+ })
108
+ .passthrough())
109
+ .default([]),
110
+ })
111
+ .passthrough();
112
+ // The user's source config (and its clouduser.wrangler.json backup). KV `id` and
113
+ // D1 `database_id` are optional here: the deployer provisions each resource and
114
+ // writes the real id, so the user's value is a placeholder. `placement.mode`
115
+ // takes any string: wrangler also accepts "off", and a schema mismatch here fails
116
+ // the build. `assets.directory` is optional: the Cloudflare Vite plugin fills it
117
+ // in, and the build takes `assets` from the template, not from this file.
118
+ // Template and generated files keep the strict schema above.
119
+ const userWranglerJsonSchema = wranglerJsonSchema.extend({
120
+ assets: zod_1.z
121
+ .object({
122
+ directory: zod_1.z.string().optional(),
123
+ binding: zod_1.z.string().optional(),
124
+ })
125
+ .passthrough()
126
+ .optional(),
127
+ placement: zod_1.z
128
+ .object({
129
+ mode: zod_1.z.string(),
130
+ })
131
+ .passthrough()
132
+ .optional(),
133
+ d1_databases: zod_1.z
134
+ .array(zod_1.z
135
+ .object({
136
+ database_name: zod_1.z.string(),
137
+ database_id: zod_1.z.string().optional(),
138
+ binding: zod_1.z.string(),
139
+ migrations_dir: zod_1.z.string().optional(),
140
+ })
141
+ .passthrough())
142
+ .default([]),
143
+ kv_namespaces: zod_1.z
144
+ .array(zod_1.z
145
+ .object({
146
+ binding: zod_1.z.string(),
147
+ id: zod_1.z.string().optional(),
148
+ })
149
+ .passthrough())
150
+ .default([]),
151
+ });
152
+ // Wrangler itself accepts comments and trailing commas in both wrangler.json and
153
+ // wrangler.jsonc, so only real syntax errors count. jsonc.parse never throws: it
154
+ // repairs what it can and reports the rest through `errors`.
155
+ function parseJsonc(raw) {
156
+ const errors = [];
157
+ const value = jsonc.parse(raw, errors, { allowTrailingComma: true });
158
+ const problems = errors.map((e) => {
159
+ const before = raw.slice(0, e.offset).split('\n');
160
+ const line = before.length;
161
+ const column = before[before.length - 1].length + 1;
162
+ return `line ${line}, column ${column}: ${jsonc.printParseErrorCode(e.error)}`;
163
+ });
164
+ return { value, problems };
165
+ }
166
+ function formatZodIssues(error) {
167
+ return error.issues.map((issue) => {
168
+ const fieldPath = issue.path.reduce((acc, part) => typeof part === 'number' ? `${acc}[${part}]` : acc ? `${acc}.${part}` : String(part), '');
169
+ return fieldPath ? `${fieldPath}: ${issue.message}` : issue.message;
170
+ });
171
+ }
172
+ // Reads the user's wrangler config, telling "no file" (most apps) apart from
173
+ // "file present but invalid", which must fail the build rather than silently
174
+ // drop every storage binding.
175
+ function readUserWranglerJson(cwd, file) {
176
+ const filePath = path.join(cwd, file);
177
+ if (!fs.statSync(filePath, { throwIfNoEntry: false })) {
178
+ return { kind: 'absent' };
179
+ }
180
+ const { value, problems } = parseJsonc(fs.readFileSync(filePath, 'utf8'));
181
+ if (problems.length > 0) {
182
+ return { kind: 'invalid', filePath, problems };
183
+ }
184
+ const result = userWranglerJsonSchema.safeParse(value);
185
+ if (!result.success) {
186
+ return { kind: 'invalid', filePath, problems: formatZodIssues(result.error) };
187
+ }
188
+ return { kind: 'valid', filePath, config: result.data };
189
+ }
190
+ function invalidUserWranglerJsonError(filePath, problems) {
191
+ const file = path.basename(filePath);
192
+ // Hosts that log only `message` still show the fields and the fix, so both go
193
+ // in the message itself; `remediation` adds the hint on top. The first line is
194
+ // a WRANGLER_JSON_INVALID diagnostic, the same as cosmic-builder's.
195
+ return new errors_1.FrameworkValidationError((0, diagnostics_1.formatDiagnostic)({
196
+ level: 'error',
197
+ code: diagnostics_1.DiagnosticCode.WRANGLER_JSON_INVALID,
198
+ message: `${file} is invalid, so its storage bindings (kv_namespaces, d1_databases, r2_buckets) cannot be applied.`,
199
+ fix: `correct the problems below in ${file} and redeploy.`,
200
+ }) +
201
+ '\n' +
202
+ problems.map((p) => ` - ${p}`).join('\n') +
203
+ `\nRequired fields: name, compatibility_date; ` +
204
+ `kv_namespaces[].binding; d1_databases[].binding and database_name; r2_buckets[].binding and bucket_name.`, {
205
+ remediation: 'The platform provisions the KV namespace and D1 database ids at deploy time, so `id` and `database_id` can be omitted.',
206
+ });
207
+ }
208
+ function loadWranglerJson(log, cwd, file = 'wrangler.json') {
209
+ const filePath = path.join(cwd, file);
210
+ if (!fs.statSync(filePath, { throwIfNoEntry: false })) {
211
+ if (file.endsWith('.json')) {
212
+ log?.warn(`${filePath} not found, checking for ${filePath}c`);
213
+ return loadWranglerJson(log, cwd, file + 'c');
214
+ }
215
+ log?.warn(`${filePath} not found`);
216
+ return undefined;
217
+ }
218
+ const raw = fs.readFileSync(filePath).toString('utf8');
219
+ log.debug(`read ${filePath}: ${JSON.stringify(raw)}`);
220
+ let unparsed;
221
+ try {
222
+ unparsed = jsonc.parse(raw);
223
+ }
224
+ catch (e) {
225
+ log?.error(`${filePath} loaded but could not parse as JSONC: ${e}`);
226
+ return undefined;
227
+ }
228
+ try {
229
+ const wranglerJson = wranglerJsonSchema.parse(unparsed);
230
+ log.debug(`loaded ${filePath}: ${JSON.stringify(wranglerJson)}`);
231
+ return wranglerJson;
232
+ }
233
+ catch (e) {
234
+ log?.error(`${filePath} valid JSONC but schema validation failed: ${e}`);
235
+ return undefined;
236
+ }
237
+ }
238
+ /** Whether a parsed wrangler.json declares any KV / R2 / D1 bindings. */
239
+ function hasLegacyBindings(w) {
240
+ return Boolean(w.kv_namespaces?.length || w.r2_buckets?.length || w.d1_databases?.length);
241
+ }
242
+ /**
243
+ * Sole writer of `wrangler.json` during the build. Runs before
244
+ * `builder.prepareConfig()`; frameworks must not touch the file.
245
+ *
246
+ * 1. Save user `wrangler.{json,jsonc}` as `clouduser.wrangler.json`.
247
+ * 2. Copy `builder.getWranglerTemplatePath()` over `wrangler.json`, then settle its
248
+ * `compatibility_date` (see compat-date.ts) so the build bundles at it.
249
+ * 3. Merge user `kv_namespaces` / `r2_buckets` / `d1_databases` into it.
250
+ * 4. Copy D1 migrations dirs into `clouduser/migrations/<dir>`.
251
+ */
252
+ function handleWranglerJson(log, builder, cwd, opts = {}) {
253
+ // Find the user's wrangler config (prefer .json, fall back to .jsonc).
254
+ let originalFilePath = null;
255
+ const jsonPath = path.join(cwd, 'wrangler.json');
256
+ const jsoncPath = path.join(cwd, 'wrangler.jsonc');
257
+ if (fs.statSync(jsonPath, { throwIfNoEntry: false })) {
258
+ originalFilePath = jsonPath;
259
+ }
260
+ else if (fs.statSync(jsoncPath, { throwIfNoEntry: false })) {
261
+ originalFilePath = jsoncPath;
262
+ }
263
+ // An invalid file fails the build even when webflow.json declares the
264
+ // bindings: `main` and `compatibility_date` still come from it.
265
+ const userResult = originalFilePath
266
+ ? readUserWranglerJson(cwd, path.basename(originalFilePath))
267
+ : { kind: 'absent' };
268
+ if (userResult.kind === 'invalid') {
269
+ throw invalidUserWranglerJsonError(userResult.filePath, userResult.problems);
270
+ }
271
+ const legacyUserWrangler = userResult.kind === 'valid' ? userResult.config : undefined;
272
+ if (legacyUserWrangler) {
273
+ log.debug(`loaded ${originalFilePath}: ${JSON.stringify(legacyUserWrangler)}`);
274
+ }
275
+ // Bindings declared in webflow.json (the canonical, user-facing surface) take
276
+ // precedence over a legacy user wrangler.json. Synthesize the same binding
277
+ // bridge from them so the rest of this function — and the deployer — are
278
+ // unchanged.
279
+ const webflowBindings = (0, bindings_1.parseBindings)((0, webflow_json_1.loadWebflowJson)(log, cwd)?.cloud?.bindings);
280
+ let userProvided;
281
+ if ((0, bindings_1.hasAnyBindings)(webflowBindings)) {
282
+ (0, bindings_1.validateBindings)(webflowBindings);
283
+ if (legacyUserWrangler && hasLegacyBindings(legacyUserWrangler)) {
284
+ log.warn('bindings declared in both webflow.json and wrangler.json; using webflow.json (the canonical source)');
285
+ }
286
+ log.info('using cloud bindings declared in webflow.json');
287
+ userProvided = (0, bindings_1.bindingsToWranglerJson)(webflowBindings, legacyUserWrangler?.name);
288
+ // Preserve a custom worker entry from a legacy wrangler.json, if present.
289
+ if (legacyUserWrangler?.main) {
290
+ userProvided.main = legacyUserWrangler.main;
291
+ }
292
+ }
293
+ else {
294
+ userProvided = legacyUserWrangler;
295
+ }
296
+ // Warning only: never fails the build and never provisions (detection is a heuristic).
297
+ const sessionWarning = (0, session_check_1.astroSessionBindingWarning)({
298
+ framework: builder.info.name,
299
+ cwd,
300
+ configFile: originalFilePath ? path.basename(originalFilePath) : undefined,
301
+ kvNamespaces: userProvided?.kv_namespaces ?? [],
302
+ });
303
+ if (sessionWarning) {
304
+ log.warn(sessionWarning);
305
+ }
306
+ // Step 1: save the parsed user config as clouduser.wrangler.json. We always
307
+ // normalize to .json — even when the source is .jsonc — because every
308
+ // downstream consumer hardcodes that path. Comments in the user's .jsonc are
309
+ // stripped during parse; the bindings/migrations we consume survive intact.
310
+ if (userProvided) {
311
+ log.info(`saving user-provided wrangler JSON as ${cwd}/clouduser.wrangler.json...`);
312
+ fs.writeFileSync(path.join(cwd, 'clouduser.wrangler.json'), JSON.stringify(userProvided));
313
+ }
314
+ // Step 2: copy framework template into place. This is the ONLY write of
315
+ // wrangler.json during the build lifecycle.
316
+ const templatePath = builder.getWranglerTemplatePath();
317
+ const targetPath = path.join(cwd, 'wrangler.json');
318
+ if (!fs.statSync(templatePath, { throwIfNoEntry: false })) {
319
+ throw new Error(`Wrangler template not found at ${templatePath}. Make sure the template is properly copied during build.`);
320
+ }
321
+ log.info(`copying wrangler template for ${builder.info.name} to ${targetPath}`);
322
+ fs.copyFileSync(templatePath, targetPath);
323
+ // The user's own date comes from their wrangler.json, never from the webflow.json bindings
324
+ // bridge (whose date is a placeholder).
325
+ (0, compat_date_1.applyCompatDateAtBuild)(log, cwd, legacyUserWrangler?.compatibility_date, {
326
+ policyEnabled: opts.compatDatePolicy,
327
+ });
328
+ if (!userProvided) {
329
+ log.debug('no user-provided wrangler.json found, skipping binding merge and migrations');
330
+ return;
331
+ }
332
+ // Step 3: merge user bindings (KV / R2 / D1) into the template wrangler.json.
333
+ const templateWrangler = JSON.parse(fs.readFileSync(targetPath, 'utf8'));
334
+ if (userProvided.kv_namespaces && userProvided.kv_namespaces.length > 0) {
335
+ templateWrangler.kv_namespaces = userProvided.kv_namespaces;
336
+ log.info(`merged ${userProvided.kv_namespaces.length} KV namespace(s) into template`);
337
+ }
338
+ if (userProvided.r2_buckets && userProvided.r2_buckets.length > 0) {
339
+ templateWrangler.r2_buckets = userProvided.r2_buckets;
340
+ log.info(`merged ${userProvided.r2_buckets.length} R2 bucket(s) into template`);
341
+ }
342
+ if (userProvided.d1_databases && userProvided.d1_databases.length > 0) {
343
+ templateWrangler.d1_databases = userProvided.d1_databases;
344
+ log.info(`merged ${userProvided.d1_databases.length} D1 database(s) into template`);
345
+ }
346
+ fs.writeFileSync(targetPath, JSON.stringify(templateWrangler, null, 2));
347
+ // Step 4: copy D1 migration dirs into clouduser/migrations/<dir> for the deployer.
348
+ if (userProvided.d1_databases.length === 0) {
349
+ log.debug('no d1_databases in user-provided wrangler.json, skipping migrations');
350
+ return;
351
+ }
352
+ for (const i in userProvided.d1_databases) {
353
+ const db = userProvided.d1_databases[i];
354
+ if (!db.migrations_dir) {
355
+ log.debug(`skipping migrations for database ${i} in wrangler.json; migrations dir is not defined`);
356
+ continue;
357
+ }
358
+ const migrationDir = db.migrations_dir;
359
+ if (!fs.statSync(path.join(cwd, migrationDir), { throwIfNoEntry: false })) {
360
+ log.debug(`skipping migrations for database ${i} in wrangler.json; migrations dir (${path.join(cwd, migrationDir)}) does not exist`);
361
+ continue;
362
+ }
363
+ const filesCount = (0, utils_1.recursiveCopy)(log, path.join(cwd, migrationDir), path.join(cwd, 'clouduser', 'migrations', migrationDir));
364
+ if (filesCount > 0) {
365
+ log.info(`copied ${filesCount} migration(s) to ${path.join(cwd, 'clouduser', 'migrations', migrationDir)}`);
366
+ }
367
+ else {
368
+ log.debug(`skipping migrations for database ${i} in wrangler.json; migrations dir (${path.join(cwd, migrationDir)}) is empty`);
369
+ }
370
+ }
371
+ }
372
+ //# sourceMappingURL=wrangler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrangler.js","sourceRoot":"","sources":["../src/wrangler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0NA,4CAmCC;AAiBD,gDAkKC;AAhbD;;;;;;;;;;;;GAYG;AACH,4CAA8B;AAC9B,gDAAkC;AAElC,6BAAwB;AACxB,oDAAsC;AAGtC,mCAAwC;AAExC,wDAAwD;AACxD,+CAAuD;AACvD,gDAA+D;AAC/D,oEAA8E;AAC9E,+CAAiE;AACjE,yCAKoB;AAEpB,2EAA2E;AAC3E,6EAA6E;AAC7E,6BAA6B;AAC7B,MAAM,kBAAkB,GAAG,OAAC;KACzB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,kBAAkB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC9B,mBAAmB,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACnD,SAAS,EAAE,OAAC;SACT,MAAM,CAAC;QACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC;KACzB,CAAC;SACD,WAAW,EAAE;SACb,QAAQ,EAAE;IACb,MAAM,EAAE,OAAC;SACN,MAAM,CAAC;QACN,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;QACrB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC/B,CAAC;SACD,WAAW,EAAE;SACb,QAAQ,EAAE;IACb,YAAY,EAAE,OAAC;SACZ,KA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G,CAAC,KAAK,CACP,oCAAoC,CAAC,kDAAkD,CACxF,CAAC;YACF,SAAS;QACX,CAAC;QACD,MAAM,YAAY,GAAW,EAAE,CAAC,cAAc,CAAC;QAE/C,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YAC1E,GAAG,CAAC,KAAK,CACP,oCAAoC,CAAC,sCAAsC,IAAI,CAAC,IAAI,CAClF,GAAG,EACH,YAAY,CACb,kBAAkB,CACpB,CAAC;YACF,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,qBAAa,EAC9B,GAAG,EACH,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CACxD,CAAC;QACF,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;YACnB,GAAG,CAAC,IAAI,CACN,UAAU,UAAU,oBAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE,CAClG,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CACP,oCAAoC,CAAC,sCAAsC,IAAI,CAAC,IAAI,CAClF,GAAG,EACH,YAAY,CACb,YAAY,CACd,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@webflow/cloud-app",
3
+ "version": "0.1.0-beta.10",
4
+ "description": "Build a JS framework app (Vite, Next.js, Astro) into a Webflow Cloud (Cloudflare Workers) bundle. Framework detection, adapter injection, and config generation are handled for you — declare what you need in webflow.json and nothing else.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/webflow/webflow-cli.git",
9
+ "directory": "apps/webflow-cloud-app"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "main": "dist/index.js",
15
+ "types": "dist/index.d.ts",
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc && node scripts/copy-templates.mjs",
23
+ "lint": "eslint src",
24
+ "test": "jest --ci",
25
+ "test:unit": "jest --ci",
26
+ "test:local": "jest",
27
+ "type-check": "tsc --noEmit",
28
+ "prepublishOnly": "npm run build"
29
+ },
30
+ "dependencies": {
31
+ "@webflow/cosmic-deploy-contract": "^1.1.0",
32
+ "jsonc-parser": "^3.3.1",
33
+ "semver": "^7.7.2",
34
+ "zod": "^3.25.57"
35
+ },
36
+ "devDependencies": {
37
+ "@types/jest": "^30.0.0",
38
+ "@types/node": "^20.0.0",
39
+ "@types/semver": "^7.5.8",
40
+ "jest": "^30.0.3",
41
+ "ts-jest": "^29.4.0",
42
+ "tsconfig": "*",
43
+ "typescript": "^5"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ }
48
+ }