@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,394 @@
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.StaticBuilder = exports.SERVER_ENTRYPOINT_FILES = exports.RUNTIME_BUILD_INDICATORS = exports.STATIC_ASSET_EXCLUDES = exports.ASSET_ROOT_METADATA = void 0;
37
+ exports.shouldExcludeStaticAsset = shouldExcludeStaticAsset;
38
+ exports.findRuntimeBuildIndicatorsInPaths = findRuntimeBuildIndicatorsInPaths;
39
+ exports.findRuntimeBuildIndicators = findRuntimeBuildIndicators;
40
+ /**
41
+ * Static Framework Builder
42
+ *
43
+ * Handles no-framework apps: a plain HTML/CSS/JS site with no build step and
44
+ * no server-side worker. The committed files are served verbatim from
45
+ * Cloudflare Workers static assets (assets-only deployment — no `main`).
46
+ *
47
+ * Key characteristics:
48
+ * - No package.json / dependencies required
49
+ * - No build command (getBuildCommand returns null)
50
+ * - No worker entry (assets-only; deployment type "static")
51
+ * - Asset source is the repo root, minus the infra/control files below
52
+ */
53
+ const fs = __importStar(require("node:fs"));
54
+ const path = __importStar(require("node:path"));
55
+ const base_1 = require("../base");
56
+ const utils_1 = require("../../utils");
57
+ /** Base path for static templates. */
58
+ const TEMPLATE_BASE = path.join(__dirname, 'templates');
59
+ /**
60
+ * `_headers` / `_redirects` are Cloudflare asset-root metadata, not page
61
+ * content. They're only honored at the root of the assets directory, so the
62
+ * host relocates them there (regardless of mount path) rather than copying
63
+ * them under the mount-path prefix.
64
+ */
65
+ exports.ASSET_ROOT_METADATA = ['_headers', '_redirects'];
66
+ /**
67
+ * Non-dotfile basename patterns that must never be published as static assets
68
+ * (`*` is a simple glob — see `matchesExcludePattern`). Dotfiles are handled
69
+ * separately by `shouldExcludeStaticAsset` (all excluded except `.well-known`).
70
+ */
71
+ exports.STATIC_ASSET_EXCLUDES = [
72
+ // Dependencies
73
+ 'node_modules',
74
+ 'package.json',
75
+ 'package-lock.json',
76
+ 'yarn.lock',
77
+ 'pnpm-lock.yaml',
78
+ // Webflow Cloud / wrangler control files (not user content)
79
+ 'webflow.json',
80
+ 'webflow.jsonc',
81
+ 'wrangler.json',
82
+ 'wrangler.jsonc',
83
+ 'wrangler.toml',
84
+ 'clouduser.wrangler.json',
85
+ 'clouduser',
86
+ // Infrastructure state / secrets that aren't dotfiles
87
+ 'terraform.tfstate',
88
+ 'terraform.tfstate.*',
89
+ '*.tfvars',
90
+ // Package-manager credential files that aren't dotfiles (Composer `auth.json`)
91
+ 'auth.json',
92
+ // Key material
93
+ '*.pem',
94
+ '*.key',
95
+ '*.pfx',
96
+ '*.p12',
97
+ 'id_rsa',
98
+ 'id_rsa.*',
99
+ 'id_dsa',
100
+ 'id_ecdsa',
101
+ 'id_ed25519',
102
+ ];
103
+ /**
104
+ * The static publication boundary: decide whether a repo-root entry must be
105
+ * withheld from the published assets. Because the asset source is the whole
106
+ * checkout, the safe default is to treat anything config/secret/metadata-shaped
107
+ * as non-public rather than to enumerate every risky name.
108
+ *
109
+ * Policy:
110
+ * - `.well-known` IS published (ACME challenges, security.txt, etc.).
111
+ * - every OTHER dotfile / dot-directory is withheld — this covers `.env*`,
112
+ * `.envrc`, `.git`, `.git-credentials`, `.npmrc`, `.aws/`, `.docker/`,
113
+ * `.ssh/`, `.dev.vars`, … in one rule instead of a leaky enumeration.
114
+ * - `_headers` / `_redirects` are withheld here because they're relocated to
115
+ * the assets root separately.
116
+ * - plus the explicit non-dotfile deny patterns above (deps, control files,
117
+ * tf state, key material).
118
+ */
119
+ function shouldExcludeStaticAsset(basename) {
120
+ if (basename === '.well-known') {
121
+ return false;
122
+ }
123
+ if (basename.startsWith('.')) {
124
+ return true;
125
+ }
126
+ if (exports.ASSET_ROOT_METADATA.includes(basename)) {
127
+ return true;
128
+ }
129
+ return exports.STATIC_ASSET_EXCLUDES.some((pattern) => (0, utils_1.matchesExcludePattern)(basename, pattern));
130
+ }
131
+ /**
132
+ * Build/runtime/package/auth manifest files whose presence means the repo is
133
+ * NOT a no-framework static site — it has a build step or a server runtime.
134
+ *
135
+ * Zero-config static inference (`index.html` + no package.json) is only a
136
+ * preflight signal; per the Static Site Hosting PRD it must be rejected when
137
+ * any of these appear alongside, so we never silently publish a mixed
138
+ * static+runtime repo's source (e.g. `server.py` next to a Composer
139
+ * `auth.json`). Node's `package.json` is handled separately by the detection
140
+ * flow, so it isn't listed here.
141
+ */
142
+ exports.RUNTIME_BUILD_INDICATORS = [
143
+ // Python
144
+ 'requirements.txt',
145
+ 'Pipfile',
146
+ 'Pipfile.lock',
147
+ 'pyproject.toml',
148
+ 'setup.py',
149
+ 'setup.cfg',
150
+ // PHP / Composer (auth.json carries registry credentials)
151
+ 'composer.json',
152
+ 'composer.lock',
153
+ 'auth.json',
154
+ // Ruby
155
+ 'Gemfile',
156
+ 'Gemfile.lock',
157
+ 'config.ru',
158
+ // Go
159
+ 'go.mod',
160
+ 'go.sum',
161
+ // Rust
162
+ 'Cargo.toml',
163
+ 'Cargo.lock',
164
+ // JVM
165
+ 'pom.xml',
166
+ 'build.gradle',
167
+ 'build.gradle.kts',
168
+ // Deno / Bun
169
+ 'deno.json',
170
+ 'deno.jsonc',
171
+ 'bun.lockb',
172
+ // Elixir
173
+ 'mix.exs',
174
+ // Service / container runtimes
175
+ 'Dockerfile',
176
+ 'Procfile',
177
+ ];
178
+ /**
179
+ * Clear server entrypoint filenames. Unlike manifests these are source files,
180
+ * but a repo whose published tree contains one is running a server, not serving
181
+ * static assets — so it must not be inferred as static.
182
+ */
183
+ exports.SERVER_ENTRYPOINT_FILES = [
184
+ // Python
185
+ 'server.py',
186
+ 'app.py',
187
+ 'wsgi.py',
188
+ 'asgi.py',
189
+ 'manage.py',
190
+ 'main.py',
191
+ // Node (no package.json — a raw `node server.js` runtime)
192
+ 'server.js',
193
+ 'server.mjs',
194
+ // Go / Ruby / PHP
195
+ 'main.go',
196
+ 'app.rb',
197
+ 'index.php',
198
+ ];
199
+ const RUNTIME_INDICATOR_NAMES = new Set([...exports.RUNTIME_BUILD_INDICATORS, ...exports.SERVER_ENTRYPOINT_FILES]);
200
+ /**
201
+ * Evaluate repo-relative file paths for build/runtime/server indicators,
202
+ * returning matching paths in input order.
203
+ *
204
+ * This helper is filesystem-free so hosts that only have a remote file listing
205
+ * (for example a GitHub recursive tree result) can reuse exactly the same
206
+ * indicator semantics as the local filesystem scanner.
207
+ *
208
+ * Input contract:
209
+ * - `paths` must represent regular file paths only (blob/file entries).
210
+ * - Callers must pre-filter non-file items (directories, submodules, symlinks).
211
+ * For a GitHub recursive tree this means keeping only `type === 'blob'` with
212
+ * `mode !== '120000'` (symlink); submodules arrive as `type === 'commit'`.
213
+ * The local filesystem scanner skips symlinks, so a caller that keeps them
214
+ * would diverge from it.
215
+ * - Exclusion applies to ancestor directory segments only; the final basename
216
+ * is always considered as an indicator candidate.
217
+ * - Leading/duplicate slashes and `.` segments are normalized for matching
218
+ * only. Matches are returned with the caller's original spelling
219
+ * (`./api/server.py` in, `./api/server.py` out), so callers that key off the
220
+ * returned paths must not assume they are canonicalized.
221
+ */
222
+ function findRuntimeBuildIndicatorsInPaths(paths) {
223
+ const found = [];
224
+ for (const relPath of paths) {
225
+ // Drop empty segments (`/a`, `a//b`) and `.` (`./a`) so those spellings
226
+ // behave exactly like the clean path. `.` would otherwise count as a
227
+ // dot-directory ancestor and hide real indicators such as `./api/server.py`.
228
+ const segments = relPath.split('/').filter((segment) => segment && segment !== '.');
229
+ if (segments.length === 0) {
230
+ continue;
231
+ }
232
+ const directorySegments = segments.slice(0, -1);
233
+ if (directorySegments.some((segment) => shouldExcludeStaticAsset(segment))) {
234
+ continue;
235
+ }
236
+ const basename = segments[segments.length - 1];
237
+ // A package.json anywhere below the root is a nested Node runtime (at least
238
+ // one directory segment); the root one is handled upstream, not here.
239
+ const isNestedPackageManifest = basename === 'package.json' && segments.length > 1;
240
+ if (isNestedPackageManifest || RUNTIME_INDICATOR_NAMES.has(basename)) {
241
+ found.push(relPath);
242
+ }
243
+ }
244
+ return found;
245
+ }
246
+ /**
247
+ * Scan the **published tree** (not just the root) for build/runtime/server
248
+ * indicators, returning their repo-relative paths.
249
+ *
250
+ * The static copy publishes the whole checkout recursively, so a manifest or
251
+ * server entrypoint nested under e.g. `api/` (a root `index.html` next to
252
+ * `api/requirements.txt` + `api/server.py`) is just as much a mixed
253
+ * static+runtime signal as one at the root — and its source would otherwise be
254
+ * served publicly. Directories that are never published (dotfiles/dot-dirs,
255
+ * `node_modules`, and anything `shouldExcludeStaticAsset` withholds) are not
256
+ * descended into, and symlinks are not followed — matching the copy policy.
257
+ *
258
+ * A **nested** `package.json` (below the root) counts here too: it marks a
259
+ * Node runtime whose sibling source (e.g. `api/index.js`) would otherwise be
260
+ * published verbatim. The *root* `package.json` is intentionally NOT a signal —
261
+ * its presence means the repo isn't a zero-config static app at all, which the
262
+ * upstream detection flow already handles (static inference requires that there
263
+ * be no root `package.json`).
264
+ */
265
+ function findRuntimeBuildIndicators(cwd) {
266
+ const filePaths = [];
267
+ const walk = (dir, rel) => {
268
+ let entries;
269
+ try {
270
+ entries = fs.readdirSync(dir, { withFileTypes: true });
271
+ }
272
+ catch {
273
+ return;
274
+ }
275
+ for (const entry of entries) {
276
+ const relPath = rel ? `${rel}/${entry.name}` : entry.name;
277
+ if (entry.isSymbolicLink()) {
278
+ continue; // never follow links (matches recursiveCopy)
279
+ }
280
+ if (entry.isDirectory()) {
281
+ // Only descend into directories that would actually be published.
282
+ if (!shouldExcludeStaticAsset(entry.name)) {
283
+ walk(path.join(dir, entry.name), relPath);
284
+ }
285
+ continue;
286
+ }
287
+ if (!entry.isFile()) {
288
+ continue;
289
+ }
290
+ filePaths.push(relPath);
291
+ }
292
+ };
293
+ walk(cwd, '');
294
+ return findRuntimeBuildIndicatorsInPaths(filePaths);
295
+ }
296
+ class StaticBuilder extends base_1.FrameworkBuilder {
297
+ static frameworkName = 'static';
298
+ // ───────────────────────────────────────────────────────────────────────────
299
+ // FRAMEWORK INFO
300
+ // ───────────────────────────────────────────────────────────────────────────
301
+ get info() {
302
+ return {
303
+ name: 'static',
304
+ version: 'n/a',
305
+ displayName: 'Static (HTML/CSS/JS)',
306
+ // No npm package backs a static app; getCustomerMajorVersion returns
307
+ // 'unknown' for a name absent from package.json, which is correct here.
308
+ packageName: 'static',
309
+ };
310
+ }
311
+ // ───────────────────────────────────────────────────────────────────────────
312
+ // DETECTION
313
+ // ───────────────────────────────────────────────────────────────────────────
314
+ /**
315
+ * Match only when webflow.json explicitly opts in with framework "static".
316
+ *
317
+ * Implicit detection for a no-framework app (no package.json / index.html at
318
+ * the root) is handled as a fallback in the host, which has the working
319
+ * directory that this static, package.json-only signature cannot see.
320
+ */
321
+ static detect(packageJson, webflowJson) {
322
+ if (webflowJson?.cloud?.framework === 'static') {
323
+ return { detected: true, reason: 'Specified as static in webflow.json' };
324
+ }
325
+ return { detected: false };
326
+ }
327
+ // ───────────────────────────────────────────────────────────────────────────
328
+ // VALIDATION / DEPENDENCIES (no-ops)
329
+ // ───────────────────────────────────────────────────────────────────────────
330
+ async validate() {
331
+ // Inferred static apps never reach here with runtime files (inference
332
+ // requires none). An explicit `framework: "static"` bypasses that check, so
333
+ // warn if the repo ships build/runtime files: they'll be published verbatim
334
+ // as static assets.
335
+ const runtimeIndicators = findRuntimeBuildIndicators(this.cwd);
336
+ if (runtimeIndicators.length > 0) {
337
+ this.log.warn(`static app declared, but build/runtime files are present ` +
338
+ `(${runtimeIndicators.join(', ')}); they will be published as ` +
339
+ `static assets unless removed`);
340
+ }
341
+ this.log.info('Static app: no framework, no dependencies, no build — nothing to validate');
342
+ }
343
+ async installDependencies() {
344
+ // A static app has no dependencies to install.
345
+ }
346
+ getCloudflareAdapter() {
347
+ return null;
348
+ }
349
+ getRequiredIntegrations() {
350
+ return [];
351
+ }
352
+ getWebflowLoader() {
353
+ return null;
354
+ }
355
+ getNodeVersionRequirement() {
356
+ // No Node runtime is used to build or serve a static app.
357
+ return null;
358
+ }
359
+ // ───────────────────────────────────────────────────────────────────────────
360
+ // CONFIGURATION
361
+ // ───────────────────────────────────────────────────────────────────────────
362
+ getWranglerTemplatePath() {
363
+ return path.join(TEMPLATE_BASE, 'wrangler.json');
364
+ }
365
+ async prepareConfig() {
366
+ // Nothing to configure: the files are served exactly as the user committed
367
+ // them. The deploy-time wrangler (assets-only, no main) is rendered by the
368
+ // host from its static wrangler template.
369
+ }
370
+ // ───────────────────────────────────────────────────────────────────────────
371
+ // BUILD
372
+ // ───────────────────────────────────────────────────────────────────────────
373
+ getBuildCommand() {
374
+ // No build step. The build phase skips the build command for a null return.
375
+ return null;
376
+ }
377
+ // ───────────────────────────────────────────────────────────────────────────
378
+ // OUTPUT
379
+ // ───────────────────────────────────────────────────────────────────────────
380
+ static getOutputDeployMetadata() {
381
+ return {
382
+ // The repo root is the asset root. The publication boundary is applied by
383
+ // `shouldExcludeStaticAsset` (via recursiveCopy's excludeFn in the host),
384
+ // not a plain pattern list, so it can withhold all dotfiles/secrets.
385
+ staticAssetsPath: '.',
386
+ // Assets-only: no worker, so no entrypoint and no ASSETS binding.
387
+ deploymentType: 'static',
388
+ usesAssetsBinding: false,
389
+ skipNoBundle: false,
390
+ };
391
+ }
392
+ }
393
+ exports.StaticBuilder = StaticBuilder;
394
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/frameworks/static/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,4DAWC;AAgGD,8EA2BC;AAqBD,gEA+BC;AAzRD;;;;;;;;;;;;GAYG;AACH,4CAA8B;AAC9B,gDAAkC;AAElC,kCAA2C;AAC3C,uCAAoD;AAapD,sCAAsC;AACtC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAExD;;;;;GAKG;AACU,QAAA,mBAAmB,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAE9D;;;;GAIG;AACU,QAAA,qBAAqB,GAAG;IACnC,eAAe;IACf,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,WAA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,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uBAAuB;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yBAAyB;QACvB,0DAA0D;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8EAA8E;IAC9E,gBAAgB;IAChB,8EAA8E;IAE9E,uBAAuB;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,2EAA2E;QAC3E,2EAA2E;QAC3E,0CAA0C;IAC5C,CAAC;IAED,8EAA8E;IAC9E,QAAQ;IACR,8EAA8E;IAE9E,eAAe;QACb,4EAA4E;QAC5E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8EAA8E;IAC9E,SAAS;IACT,8EAA8E;IAE9E,MAAM,CAAU,uBAAuB;QACrC,OAAO;YACL,0EAA0E;YAC1E,0EAA0E;YAC1E,qEAAqE;YACrE,gBAAgB,EAAE,GAAG;YACrB,kEAAkE;YAClE,cAAc,EAAE,QAAQ;YACxB,iBAAiB,EAAE,KAAK;YACxB,YAAY,EAAE,KAAK;SACpB,CAAC;IACJ,CAAC;;AApHH,sCAqHC"}
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "webflow-cloud-static-app",
3
+ "compatibility_date": "2025-03-03",
4
+ "assets": {
5
+ "directory": "assets",
6
+ "not_found_handling": "404-page"
7
+ }
8
+ }
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Shared types for framework builders.
3
+ *
4
+ * The notable change from the original cosmic-builder shape: `BuildContext`
5
+ * now carries the host-injected ports (logger, command runner, telemetry,
6
+ * filesystem) instead of a single concrete logger. That's what lets the same
7
+ * builders run unchanged in ECS, the CLI, and headless hosts.
8
+ */
9
+ import type { DeploymentType } from '@webflow/cosmic-deploy-contract';
10
+ import type { Logger, CommandRunner, Telemetry, FileSystemPort } from '../ports';
11
+ import type { PackageJson as PackageJsonType } from '../config/package-json';
12
+ import type { WebflowJson as WebflowJsonType } from '../config/webflow-json';
13
+ export type { DeploymentType } from '@webflow/cosmic-deploy-contract';
14
+ export type PackageJson = PackageJsonType;
15
+ export type WebflowJson = WebflowJsonType;
16
+ /** Build context passed to all builder methods. */
17
+ export interface BuildContext {
18
+ /** Working directory — the ephemeral build workspace, not the user's source tree. */
19
+ cwd: string;
20
+ /** Logger port. */
21
+ log: Logger;
22
+ /** Command-runner port (npm, framework build, wrangler). */
23
+ runCommand: CommandRunner;
24
+ /** Telemetry port (no-op unless the host injects one). */
25
+ telemetry: Telemetry;
26
+ /** Filesystem port for workspace-level operations. */
27
+ fs: FileSystemPort;
28
+ /** Parsed package.json. */
29
+ packageJson: PackageJson;
30
+ /** Environment variables made available to build commands. Matches
31
+ * `NodeJS.ProcessEnv` so producers can pass a process env directly without
32
+ * first stripping `undefined` values. */
33
+ userEnv: NodeJS.ProcessEnv;
34
+ /** URL mount path the app is served under (a.k.a. COSMIC_MOUNT_PATH). */
35
+ mountPath?: string;
36
+ /** Deploy URL, substituted into generated framework config where needed. */
37
+ deployUrl?: string;
38
+ }
39
+ /** Framework identification. */
40
+ export interface FrameworkInfo {
41
+ /** Framework name (e.g., "astro", "nextjs"). */
42
+ name: string;
43
+ /** Builder-supported version specifier (e.g., "5.x", "6.x"). Distinct from
44
+ * `packageName`'s installed major. */
45
+ version: string;
46
+ /** Human-readable display name (e.g., "Astro 5", "Astro 6"). */
47
+ displayName: string;
48
+ /** npm package whose customer-installed major version is reported to telemetry.
49
+ * Differs from `name` when the brand and npm package diverge (e.g. name='nextjs'
50
+ * but packageName='next'). */
51
+ packageName: string;
52
+ }
53
+ /** Build output configuration — describes where build artifacts are located. */
54
+ export interface BuildOutput {
55
+ /** Path to static assets to upload (e.g., 'dist/client' for Astro 6, 'dist' for Astro 5). */
56
+ staticAssetsPath: string;
57
+ /** Patterns to exclude from static assets (e.g., ['_worker.js']). */
58
+ staticAssetsExclude?: string[];
59
+ /** Path to the worker entry file (e.g., 'dist/server/entry.mjs' or
60
+ * 'dist/_worker.js/index.js'). Omitted for assets-only static apps, which
61
+ * have no worker. */
62
+ workerEntryPath?: string;
63
+ /**
64
+ * Override for wrangler.json 'main' field if different from workerEntryPath.
65
+ * e.g., '@astrojs/cloudflare/entrypoints/server' for Astro 6.
66
+ */
67
+ wranglerMainOverride?: string;
68
+ /** Deployment type for wrangler configuration. */
69
+ deploymentType: DeploymentType;
70
+ /** Whether this framework uses the new Cloudflare assets binding approach. */
71
+ usesAssetsBinding?: boolean;
72
+ /**
73
+ * Whether to skip --no-bundle during deploy. Set to true for frameworks like
74
+ * Astro 6 that output multiple files (entry.mjs + chunks/) which need wrangler
75
+ * to bundle them together.
76
+ */
77
+ skipNoBundle?: boolean;
78
+ /**
79
+ * Set by the Astro 6/7 builders: `staticAssetsPath` already mirrors the served URL layout,
80
+ * including the mount. The generated astro.config sets `base = mountPath`, so a fixed
81
+ * `@astrojs/cloudflare` (>= 13.3.1 / all 14.x; withastro/astro#16276) nests the client tree
82
+ * under `<staticAssetsPath>/<mount>/`. `copyAssets` then copies `staticAssetsPath` verbatim
83
+ * into the assets root instead of the blind mount append used for Astro 5 / Next.js.
84
+ */
85
+ staticAssetsMirrorUrlLayout?: boolean;
86
+ /**
87
+ * The entry file path after wrangler dry-run bundles the worker. Frameworks
88
+ * produce different output filenames (Astro 5: './index.js', Astro 6:
89
+ * './entry.mjs', Next.js: './worker.js').
90
+ */
91
+ dryRunEntryPath?: string;
92
+ }
93
+ /** Cloudflare adapter package configuration. */
94
+ export interface AdapterPackage {
95
+ /** Package name (e.g., '@astrojs/cloudflare'). */
96
+ name: string;
97
+ /** Version specifier (e.g., '^12.0.0' for Astro 5, '^13.0.0' for Astro 6). */
98
+ version: string;
99
+ /** Peer dependencies that should also be installed. */
100
+ peerDependencies?: string[];
101
+ }
102
+ /** Framework integration package. */
103
+ export interface IntegrationPackage {
104
+ /** Package name (e.g., '@astrojs/react'). */
105
+ name: string;
106
+ /** Version specifier (e.g., '^4.0.0'). */
107
+ version: string;
108
+ /** Reason for requiring this package (optional). */
109
+ reason?: string;
110
+ /** Install as dev dependency (--save-dev) instead of regular dependency. */
111
+ dev?: boolean;
112
+ }
113
+ /** Webflow loader configuration. */
114
+ export interface WebflowLoaderConfig {
115
+ /** Full path to the loader template. */
116
+ templatePath: string;
117
+ /** Destination filename (e.g., 'webflow-loader.ts'). */
118
+ destinationName: string;
119
+ /** Path to reference in framework config (e.g., './webflow-loader.ts'). */
120
+ configPath?: string;
121
+ }
122
+ /** Result from framework detection. */
123
+ export interface DetectionResult {
124
+ /** Whether this builder can handle the project. */
125
+ detected: boolean;
126
+ /** Reason for detection (for logging). */
127
+ reason?: string;
128
+ }
129
+ /** Node.js version requirement. */
130
+ export interface NodeVersionRequirement {
131
+ /** Minimum required version (e.g., "22.12.0"). */
132
+ minimum: string;
133
+ /** Recommended version (optional). */
134
+ recommended?: string;
135
+ /** Severity: 'warn' = may work but not guaranteed, 'error' = will definitely fail. */
136
+ severity: 'warn' | 'error';
137
+ }
138
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/frameworks/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE7E,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAC1C,MAAM,MAAM,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MAAM,CAAC;CAC1B;AAMD,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,qCAAqC;AACrC,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,uCAAuC;AACvC,MAAM,WAAW,eAAe;IAC9B,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,mCAAmC;AACnC,MAAM,WAAW,sBAAsB;IACrC,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sFAAsF;IACtF,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/frameworks/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { FrameworkBuilder } from '../base';
2
+ import type { BuildOutput, FrameworkInfo, PackageJson, WebflowJson, DetectionResult, AdapterPackage, IntegrationPackage, WebflowLoaderConfig, NodeVersionRequirement } from '../types';
3
+ export declare class ViteBuilder extends FrameworkBuilder {
4
+ static frameworkName: string;
5
+ get info(): FrameworkInfo;
6
+ getFrameworkVersion(): string | undefined;
7
+ /**
8
+ * Detect if this is a Vite project.
9
+ *
10
+ * Checked last in the registry, so frameworks that use Vite internally
11
+ * (Astro) are detected first.
12
+ */
13
+ static detect(packageJson: PackageJson, webflowJson?: WebflowJson): DetectionResult;
14
+ validate(): Promise<void>;
15
+ getCloudflareAdapter(): AdapterPackage;
16
+ getRequiredIntegrations(): IntegrationPackage[];
17
+ installDependencies(): Promise<void>;
18
+ getWebflowLoader(): WebflowLoaderConfig | null;
19
+ getUserConfigPatterns(): string[];
20
+ getWranglerTemplatePath(): string;
21
+ getAdditionalConfigFiles(): string[];
22
+ /**
23
+ * If the user supplied their own wrangler with a custom `main` entrypoint
24
+ * (anything other than `./src/worker.ts`), return that value so we can
25
+ * preserve their server-side code. Returns null otherwise.
26
+ *
27
+ * Reads from `clouduser.wrangler.{json,jsonc}` — `handleWranglerJson` has
28
+ * already saved the user's original file there and overwritten the in-place
29
+ * `wrangler.json` with the framework template (which always declares
30
+ * `./src/worker.ts`), so reading the in-place file would always miss.
31
+ */
32
+ private getCustomWorkerEntry;
33
+ /**
34
+ * Create a minimal worker.ts if it doesn't exist.
35
+ *
36
+ * Some users only want a SPA (asset serving, no custom server-side code); in
37
+ * that case we write a minimal worker.ts that serves static assets. Called
38
+ * from prepareConfig only when the user doesn't have a custom worker entry.
39
+ */
40
+ private ensureWorkerEntry;
41
+ prepareConfig(): Promise<void>;
42
+ getBuildCommand(): string;
43
+ getNodeVersionRequirement(): NodeVersionRequirement | null;
44
+ static getOutputDeployMetadata(): BuildOutput;
45
+ }
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frameworks/vite/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAOlB,qBAAa,WAAY,SAAQ,gBAAgB;IAC/C,OAAgB,aAAa,SAAU;IAMvC,IAAI,IAAI,IAAI,aAAa,CAOxB;IAEQ,mBAAmB,IAAI,MAAM,GAAG,SAAS;IAQlD;;;;;OAKG;WACa,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,eAAe;IA2BtF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB/B,oBAAoB,IAAI,cAAc;IAOtC,uBAAuB,IAAI,kBAAkB,EAAE;IAKzC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoC1C,gBAAgB,IAAI,mBAAmB,GAAG,IAAI;IAK9C,qBAAqB,IAAI,MAAM,EAAE;IAIjC,uBAAuB,IAAI,MAAM;IAIjC,wBAAwB,IAAI,MAAM,EAAE;IAIpC;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAyB5B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA4BnB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA2DpC,eAAe,IAAI,MAAM;IAQzB,yBAAyB,IAAI,sBAAsB,GAAG,IAAI;WAW1C,uBAAuB,IAAI,WAAW;CAQvD"}