@webflow/cloud-app 0.1.0-beta.7
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.
- package/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/bindings.d.ts +185 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +120 -0
- package/dist/bindings.js.map +1 -0
- package/dist/config/package-json.d.ts +57 -0
- package/dist/config/package-json.d.ts.map +1 -0
- package/dist/config/package-json.js +94 -0
- package/dist/config/package-json.js.map +1 -0
- package/dist/config/webflow-json.d.ts +53 -0
- package/dist/config/webflow-json.d.ts.map +1 -0
- package/dist/config/webflow-json.js +72 -0
- package/dist/config/webflow-json.js.map +1 -0
- package/dist/create-webflow-json.d.ts +24 -0
- package/dist/create-webflow-json.d.ts.map +1 -0
- package/dist/create-webflow-json.js +170 -0
- package/dist/create-webflow-json.js.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +23 -0
- package/dist/errors.js.map +1 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts +36 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts.map +1 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js +94 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js.map +1 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.d.ts +2 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.d.ts.map +1 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.js +97 -0
- package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.js.map +1 -0
- package/dist/frameworks/astro/astro5.d.ts +28 -0
- package/dist/frameworks/astro/astro5.d.ts.map +1 -0
- package/dist/frameworks/astro/astro5.js +259 -0
- package/dist/frameworks/astro/astro5.js.map +1 -0
- package/dist/frameworks/astro/astro6.d.ts +28 -0
- package/dist/frameworks/astro/astro6.d.ts.map +1 -0
- package/dist/frameworks/astro/astro6.js +286 -0
- package/dist/frameworks/astro/astro6.js.map +1 -0
- package/dist/frameworks/astro/astro7.d.ts +28 -0
- package/dist/frameworks/astro/astro7.d.ts.map +1 -0
- package/dist/frameworks/astro/astro7.js +283 -0
- package/dist/frameworks/astro/astro7.js.map +1 -0
- package/dist/frameworks/astro/index.d.ts +10 -0
- package/dist/frameworks/astro/index.d.ts.map +1 -0
- package/dist/frameworks/astro/index.js +16 -0
- package/dist/frameworks/astro/index.js.map +1 -0
- package/dist/frameworks/astro/templates/astro.config.webflow.ts +61 -0
- package/dist/frameworks/astro/templates/v5/astro.config.mjs.template +25 -0
- package/dist/frameworks/astro/templates/v5/webflow-loader.ts +103 -0
- package/dist/frameworks/astro/templates/v5/wrangler.json +6 -0
- package/dist/frameworks/astro/templates/v6/astro.config.mjs.template +35 -0
- package/dist/frameworks/astro/templates/v6/webflow-loader.ts +112 -0
- package/dist/frameworks/astro/templates/v6/wrangler.json +9 -0
- package/dist/frameworks/astro/templates/v7/astro.config.mjs.template +34 -0
- package/dist/frameworks/astro/templates/v7/webflow-loader.ts +113 -0
- package/dist/frameworks/astro/templates/v7/wrangler.json +9 -0
- package/dist/frameworks/base.d.ts +134 -0
- package/dist/frameworks/base.d.ts.map +1 -0
- package/dist/frameworks/base.js +175 -0
- package/dist/frameworks/base.js.map +1 -0
- package/dist/frameworks/errors.d.ts +72 -0
- package/dist/frameworks/errors.d.ts.map +1 -0
- package/dist/frameworks/errors.js +120 -0
- package/dist/frameworks/errors.js.map +1 -0
- package/dist/frameworks/nextjs/adapter-resolver.d.ts +72 -0
- package/dist/frameworks/nextjs/adapter-resolver.d.ts.map +1 -0
- package/dist/frameworks/nextjs/adapter-resolver.js +246 -0
- package/dist/frameworks/nextjs/adapter-resolver.js.map +1 -0
- package/dist/frameworks/nextjs/index.d.ts +38 -0
- package/dist/frameworks/nextjs/index.d.ts.map +1 -0
- package/dist/frameworks/nextjs/index.js +268 -0
- package/dist/frameworks/nextjs/index.js.map +1 -0
- package/dist/frameworks/nextjs/templates/next.config.ts.template +13 -0
- package/dist/frameworks/nextjs/templates/next.config.webflow.ts +46 -0
- package/dist/frameworks/nextjs/templates/open-next.config.ts +3 -0
- package/dist/frameworks/nextjs/templates/webflow-loader.ts +44 -0
- package/dist/frameworks/nextjs/templates/wrangler.json +6 -0
- package/dist/frameworks/registry.d.ts +127 -0
- package/dist/frameworks/registry.d.ts.map +1 -0
- package/dist/frameworks/registry.js +257 -0
- package/dist/frameworks/registry.js.map +1 -0
- package/dist/frameworks/static/index.d.ts +93 -0
- package/dist/frameworks/static/index.d.ts.map +1 -0
- package/dist/frameworks/static/index.js +352 -0
- package/dist/frameworks/static/index.js.map +1 -0
- package/dist/frameworks/static/templates/wrangler.json +7 -0
- package/dist/frameworks/types.d.ts +138 -0
- package/dist/frameworks/types.d.ts.map +1 -0
- package/dist/frameworks/types.js +3 -0
- package/dist/frameworks/types.js.map +1 -0
- package/dist/frameworks/vite/index.d.ts +46 -0
- package/dist/frameworks/vite/index.d.ts.map +1 -0
- package/dist/frameworks/vite/index.js +303 -0
- package/dist/frameworks/vite/index.js.map +1 -0
- package/dist/frameworks/vite/templates/vite.config.ts.template +14 -0
- package/dist/frameworks/vite/templates/vite.config.webflow.ts +52 -0
- package/dist/frameworks/vite/templates/wrangler.json +10 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/pipeline.d.ts +8 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +263 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/ports/command-runner.d.ts +60 -0
- package/dist/ports/command-runner.d.ts.map +1 -0
- package/dist/ports/command-runner.js +116 -0
- package/dist/ports/command-runner.js.map +1 -0
- package/dist/ports/filesystem.d.ts +19 -0
- package/dist/ports/filesystem.d.ts.map +1 -0
- package/dist/ports/filesystem.js +68 -0
- package/dist/ports/filesystem.js.map +1 -0
- package/dist/ports/index.d.ts +17 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +14 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/logger.d.ts +22 -0
- package/dist/ports/logger.d.ts.map +1 -0
- package/dist/ports/logger.js +18 -0
- package/dist/ports/logger.js.map +1 -0
- package/dist/ports/telemetry.d.ts +23 -0
- package/dist/ports/telemetry.d.ts.map +1 -0
- package/dist/ports/telemetry.js +12 -0
- package/dist/ports/telemetry.js.map +1 -0
- package/dist/toolchain/errors.d.ts +32 -0
- package/dist/toolchain/errors.d.ts.map +1 -0
- package/dist/toolchain/errors.js +31 -0
- package/dist/toolchain/errors.js.map +1 -0
- package/dist/toolchain/resolver.d.ts +25 -0
- package/dist/toolchain/resolver.d.ts.map +1 -0
- package/dist/toolchain/resolver.js +200 -0
- package/dist/toolchain/resolver.js.map +1 -0
- package/dist/toolchain/types.d.ts +52 -0
- package/dist/toolchain/types.d.ts.map +1 -0
- package/dist/toolchain/types.js +10 -0
- package/dist/toolchain/types.js.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/fs.d.ts +29 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +126 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +27 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/node-version.d.ts +20 -0
- package/dist/utils/node-version.d.ts.map +1 -0
- package/dist/utils/node-version.js +113 -0
- package/dist/utils/node-version.js.map +1 -0
- package/dist/utils/process.d.ts +25 -0
- package/dist/utils/process.d.ts.map +1 -0
- package/dist/utils/process.js +40 -0
- package/dist/utils/process.js.map +1 -0
- package/dist/utils/reserved-env.d.ts +26 -0
- package/dist/utils/reserved-env.d.ts.map +1 -0
- package/dist/utils/reserved-env.js +51 -0
- package/dist/utils/reserved-env.js.map +1 -0
- package/dist/utils/template.d.ts +15 -0
- package/dist/utils/template.d.ts.map +1 -0
- package/dist/utils/template.js +75 -0
- package/dist/utils/template.js.map +1 -0
- package/dist/utils/version.d.ts +9 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +52 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/wrangler.d.ts +192 -0
- package/dist/wrangler.d.ts.map +1 -0
- package/dist/wrangler.js +246 -0
- package/dist/wrangler.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,352 @@
|
|
|
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.findRuntimeBuildIndicators = findRuntimeBuildIndicators;
|
|
39
|
+
/**
|
|
40
|
+
* Static Framework Builder
|
|
41
|
+
*
|
|
42
|
+
* Handles no-framework apps: a plain HTML/CSS/JS site with no build step and
|
|
43
|
+
* no server-side worker. The committed files are served verbatim from
|
|
44
|
+
* Cloudflare Workers static assets (assets-only deployment — no `main`).
|
|
45
|
+
*
|
|
46
|
+
* Key characteristics:
|
|
47
|
+
* - No package.json / dependencies required
|
|
48
|
+
* - No build command (getBuildCommand returns null)
|
|
49
|
+
* - No worker entry (assets-only; deployment type "static")
|
|
50
|
+
* - Asset source is the repo root, minus the infra/control files below
|
|
51
|
+
*/
|
|
52
|
+
const fs = __importStar(require("node:fs"));
|
|
53
|
+
const path = __importStar(require("node:path"));
|
|
54
|
+
const base_1 = require("../base");
|
|
55
|
+
const utils_1 = require("../../utils");
|
|
56
|
+
/** Base path for static templates. */
|
|
57
|
+
const TEMPLATE_BASE = path.join(__dirname, 'templates');
|
|
58
|
+
/**
|
|
59
|
+
* `_headers` / `_redirects` are Cloudflare asset-root metadata, not page
|
|
60
|
+
* content. They're only honored at the root of the assets directory, so the
|
|
61
|
+
* host relocates them there (regardless of mount path) rather than copying
|
|
62
|
+
* them under the mount-path prefix.
|
|
63
|
+
*/
|
|
64
|
+
exports.ASSET_ROOT_METADATA = ['_headers', '_redirects'];
|
|
65
|
+
/**
|
|
66
|
+
* Non-dotfile basename patterns that must never be published as static assets
|
|
67
|
+
* (`*` is a simple glob — see `matchesExcludePattern`). Dotfiles are handled
|
|
68
|
+
* separately by `shouldExcludeStaticAsset` (all excluded except `.well-known`).
|
|
69
|
+
*/
|
|
70
|
+
exports.STATIC_ASSET_EXCLUDES = [
|
|
71
|
+
// Dependencies
|
|
72
|
+
'node_modules',
|
|
73
|
+
'package.json',
|
|
74
|
+
'package-lock.json',
|
|
75
|
+
'yarn.lock',
|
|
76
|
+
'pnpm-lock.yaml',
|
|
77
|
+
// Webflow Cloud / wrangler control files (not user content)
|
|
78
|
+
'webflow.json',
|
|
79
|
+
'webflow.jsonc',
|
|
80
|
+
'wrangler.json',
|
|
81
|
+
'wrangler.jsonc',
|
|
82
|
+
'wrangler.toml',
|
|
83
|
+
'clouduser.wrangler.json',
|
|
84
|
+
'clouduser',
|
|
85
|
+
// Infrastructure state / secrets that aren't dotfiles
|
|
86
|
+
'terraform.tfstate',
|
|
87
|
+
'terraform.tfstate.*',
|
|
88
|
+
'*.tfvars',
|
|
89
|
+
// Package-manager credential files that aren't dotfiles (Composer `auth.json`)
|
|
90
|
+
'auth.json',
|
|
91
|
+
// Key material
|
|
92
|
+
'*.pem',
|
|
93
|
+
'*.key',
|
|
94
|
+
'*.pfx',
|
|
95
|
+
'*.p12',
|
|
96
|
+
'id_rsa',
|
|
97
|
+
'id_rsa.*',
|
|
98
|
+
'id_dsa',
|
|
99
|
+
'id_ecdsa',
|
|
100
|
+
'id_ed25519',
|
|
101
|
+
];
|
|
102
|
+
/**
|
|
103
|
+
* The static publication boundary: decide whether a repo-root entry must be
|
|
104
|
+
* withheld from the published assets. Because the asset source is the whole
|
|
105
|
+
* checkout, the safe default is to treat anything config/secret/metadata-shaped
|
|
106
|
+
* as non-public rather than to enumerate every risky name.
|
|
107
|
+
*
|
|
108
|
+
* Policy:
|
|
109
|
+
* - `.well-known` IS published (ACME challenges, security.txt, etc.).
|
|
110
|
+
* - every OTHER dotfile / dot-directory is withheld — this covers `.env*`,
|
|
111
|
+
* `.envrc`, `.git`, `.git-credentials`, `.npmrc`, `.aws/`, `.docker/`,
|
|
112
|
+
* `.ssh/`, `.dev.vars`, … in one rule instead of a leaky enumeration.
|
|
113
|
+
* - `_headers` / `_redirects` are withheld here because they're relocated to
|
|
114
|
+
* the assets root separately.
|
|
115
|
+
* - plus the explicit non-dotfile deny patterns above (deps, control files,
|
|
116
|
+
* tf state, key material).
|
|
117
|
+
*/
|
|
118
|
+
function shouldExcludeStaticAsset(basename) {
|
|
119
|
+
if (basename === '.well-known') {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
if (basename.startsWith('.')) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (exports.ASSET_ROOT_METADATA.includes(basename)) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return exports.STATIC_ASSET_EXCLUDES.some((pattern) => (0, utils_1.matchesExcludePattern)(basename, pattern));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Build/runtime/package/auth manifest files whose presence means the repo is
|
|
132
|
+
* NOT a no-framework static site — it has a build step or a server runtime.
|
|
133
|
+
*
|
|
134
|
+
* Zero-config static inference (`index.html` + no package.json) is only a
|
|
135
|
+
* preflight signal; per the Static Site Hosting PRD it must be rejected when
|
|
136
|
+
* any of these appear alongside, so we never silently publish a mixed
|
|
137
|
+
* static+runtime repo's source (e.g. `server.py` next to a Composer
|
|
138
|
+
* `auth.json`). Node's `package.json` is handled separately by the detection
|
|
139
|
+
* flow, so it isn't listed here.
|
|
140
|
+
*/
|
|
141
|
+
exports.RUNTIME_BUILD_INDICATORS = [
|
|
142
|
+
// Python
|
|
143
|
+
'requirements.txt',
|
|
144
|
+
'Pipfile',
|
|
145
|
+
'Pipfile.lock',
|
|
146
|
+
'pyproject.toml',
|
|
147
|
+
'setup.py',
|
|
148
|
+
'setup.cfg',
|
|
149
|
+
// PHP / Composer (auth.json carries registry credentials)
|
|
150
|
+
'composer.json',
|
|
151
|
+
'composer.lock',
|
|
152
|
+
'auth.json',
|
|
153
|
+
// Ruby
|
|
154
|
+
'Gemfile',
|
|
155
|
+
'Gemfile.lock',
|
|
156
|
+
'config.ru',
|
|
157
|
+
// Go
|
|
158
|
+
'go.mod',
|
|
159
|
+
'go.sum',
|
|
160
|
+
// Rust
|
|
161
|
+
'Cargo.toml',
|
|
162
|
+
'Cargo.lock',
|
|
163
|
+
// JVM
|
|
164
|
+
'pom.xml',
|
|
165
|
+
'build.gradle',
|
|
166
|
+
'build.gradle.kts',
|
|
167
|
+
// Deno / Bun
|
|
168
|
+
'deno.json',
|
|
169
|
+
'deno.jsonc',
|
|
170
|
+
'bun.lockb',
|
|
171
|
+
// Elixir
|
|
172
|
+
'mix.exs',
|
|
173
|
+
// Service / container runtimes
|
|
174
|
+
'Dockerfile',
|
|
175
|
+
'Procfile',
|
|
176
|
+
];
|
|
177
|
+
/**
|
|
178
|
+
* Clear server entrypoint filenames. Unlike manifests these are source files,
|
|
179
|
+
* but a repo whose published tree contains one is running a server, not serving
|
|
180
|
+
* static assets — so it must not be inferred as static.
|
|
181
|
+
*/
|
|
182
|
+
exports.SERVER_ENTRYPOINT_FILES = [
|
|
183
|
+
// Python
|
|
184
|
+
'server.py',
|
|
185
|
+
'app.py',
|
|
186
|
+
'wsgi.py',
|
|
187
|
+
'asgi.py',
|
|
188
|
+
'manage.py',
|
|
189
|
+
'main.py',
|
|
190
|
+
// Node (no package.json — a raw `node server.js` runtime)
|
|
191
|
+
'server.js',
|
|
192
|
+
'server.mjs',
|
|
193
|
+
// Go / Ruby / PHP
|
|
194
|
+
'main.go',
|
|
195
|
+
'app.rb',
|
|
196
|
+
'index.php',
|
|
197
|
+
];
|
|
198
|
+
const RUNTIME_INDICATOR_NAMES = new Set([...exports.RUNTIME_BUILD_INDICATORS, ...exports.SERVER_ENTRYPOINT_FILES]);
|
|
199
|
+
/**
|
|
200
|
+
* Scan the **published tree** (not just the root) for build/runtime/server
|
|
201
|
+
* indicators, returning their repo-relative paths.
|
|
202
|
+
*
|
|
203
|
+
* The static copy publishes the whole checkout recursively, so a manifest or
|
|
204
|
+
* server entrypoint nested under e.g. `api/` (a root `index.html` next to
|
|
205
|
+
* `api/requirements.txt` + `api/server.py`) is just as much a mixed
|
|
206
|
+
* static+runtime signal as one at the root — and its source would otherwise be
|
|
207
|
+
* served publicly. Directories that are never published (dotfiles/dot-dirs,
|
|
208
|
+
* `node_modules`, and anything `shouldExcludeStaticAsset` withholds) are not
|
|
209
|
+
* descended into, and symlinks are not followed — matching the copy policy.
|
|
210
|
+
*
|
|
211
|
+
* A **nested** `package.json` (below the root) counts here too: it marks a
|
|
212
|
+
* Node runtime whose sibling source (e.g. `api/index.js`) would otherwise be
|
|
213
|
+
* published verbatim. The *root* `package.json` is intentionally NOT a signal —
|
|
214
|
+
* its presence means the repo isn't a zero-config static app at all, which the
|
|
215
|
+
* upstream detection flow already handles (static inference requires that there
|
|
216
|
+
* be no root `package.json`).
|
|
217
|
+
*/
|
|
218
|
+
function findRuntimeBuildIndicators(cwd) {
|
|
219
|
+
const found = [];
|
|
220
|
+
const walk = (dir, rel) => {
|
|
221
|
+
let entries;
|
|
222
|
+
try {
|
|
223
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
for (const entry of entries) {
|
|
229
|
+
const relPath = rel ? `${rel}/${entry.name}` : entry.name;
|
|
230
|
+
if (entry.isSymbolicLink()) {
|
|
231
|
+
continue; // never follow links (matches recursiveCopy)
|
|
232
|
+
}
|
|
233
|
+
if (entry.isDirectory()) {
|
|
234
|
+
// Only descend into directories that would actually be published.
|
|
235
|
+
if (!shouldExcludeStaticAsset(entry.name)) {
|
|
236
|
+
walk(path.join(dir, entry.name), relPath);
|
|
237
|
+
}
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (!entry.isFile()) {
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
// A package.json anywhere below the root is a nested Node runtime; the
|
|
244
|
+
// root one (`relPath === 'package.json'`) is handled upstream, not here.
|
|
245
|
+
const isNestedPackageManifest = entry.name === 'package.json' && relPath !== 'package.json';
|
|
246
|
+
if (isNestedPackageManifest || RUNTIME_INDICATOR_NAMES.has(entry.name)) {
|
|
247
|
+
found.push(relPath);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
walk(cwd, '');
|
|
252
|
+
return found;
|
|
253
|
+
}
|
|
254
|
+
class StaticBuilder extends base_1.FrameworkBuilder {
|
|
255
|
+
static frameworkName = 'static';
|
|
256
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
257
|
+
// FRAMEWORK INFO
|
|
258
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
259
|
+
get info() {
|
|
260
|
+
return {
|
|
261
|
+
name: 'static',
|
|
262
|
+
version: 'n/a',
|
|
263
|
+
displayName: 'Static (HTML/CSS/JS)',
|
|
264
|
+
// No npm package backs a static app; getCustomerMajorVersion returns
|
|
265
|
+
// 'unknown' for a name absent from package.json, which is correct here.
|
|
266
|
+
packageName: 'static',
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
270
|
+
// DETECTION
|
|
271
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
272
|
+
/**
|
|
273
|
+
* Match only when webflow.json explicitly opts in with framework "static".
|
|
274
|
+
*
|
|
275
|
+
* Implicit detection for a no-framework app (no package.json / index.html at
|
|
276
|
+
* the root) is handled as a fallback in the host, which has the working
|
|
277
|
+
* directory that this static, package.json-only signature cannot see.
|
|
278
|
+
*/
|
|
279
|
+
static detect(packageJson, webflowJson) {
|
|
280
|
+
if (webflowJson?.cloud?.framework === 'static') {
|
|
281
|
+
return { detected: true, reason: 'Specified as static in webflow.json' };
|
|
282
|
+
}
|
|
283
|
+
return { detected: false };
|
|
284
|
+
}
|
|
285
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
286
|
+
// VALIDATION / DEPENDENCIES (no-ops)
|
|
287
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
288
|
+
async validate() {
|
|
289
|
+
// Inferred static apps never reach here with runtime files (inference
|
|
290
|
+
// requires none). An explicit `framework: "static"` bypasses that check, so
|
|
291
|
+
// warn if the repo ships build/runtime files: they'll be published verbatim
|
|
292
|
+
// as static assets. CLD-2398.
|
|
293
|
+
const runtimeIndicators = findRuntimeBuildIndicators(this.cwd);
|
|
294
|
+
if (runtimeIndicators.length > 0) {
|
|
295
|
+
this.log.warn(`static app declared, but build/runtime files are present ` +
|
|
296
|
+
`(${runtimeIndicators.join(', ')}); they will be published as ` +
|
|
297
|
+
`static assets unless removed`);
|
|
298
|
+
}
|
|
299
|
+
this.log.info('Static app: no framework, no dependencies, no build — nothing to validate');
|
|
300
|
+
}
|
|
301
|
+
async installDependencies() {
|
|
302
|
+
// A static app has no dependencies to install.
|
|
303
|
+
}
|
|
304
|
+
getCloudflareAdapter() {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
getRequiredIntegrations() {
|
|
308
|
+
return [];
|
|
309
|
+
}
|
|
310
|
+
getWebflowLoader() {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
getNodeVersionRequirement() {
|
|
314
|
+
// No Node runtime is used to build or serve a static app.
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
318
|
+
// CONFIGURATION
|
|
319
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
320
|
+
getWranglerTemplatePath() {
|
|
321
|
+
return path.join(TEMPLATE_BASE, 'wrangler.json');
|
|
322
|
+
}
|
|
323
|
+
async prepareConfig() {
|
|
324
|
+
// Nothing to configure: the files are served exactly as the user committed
|
|
325
|
+
// them. The deploy-time wrangler (assets-only, no main) is rendered by the
|
|
326
|
+
// host from its static wrangler template.
|
|
327
|
+
}
|
|
328
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
329
|
+
// BUILD
|
|
330
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
331
|
+
getBuildCommand() {
|
|
332
|
+
// No build step. The build phase skips the build command for a null return.
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
336
|
+
// OUTPUT
|
|
337
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
338
|
+
static getOutputDeployMetadata() {
|
|
339
|
+
return {
|
|
340
|
+
// The repo root is the asset root. The publication boundary is applied by
|
|
341
|
+
// `shouldExcludeStaticAsset` (via recursiveCopy's excludeFn in the host),
|
|
342
|
+
// not a plain pattern list, so it can withhold all dotfiles/secrets.
|
|
343
|
+
staticAssetsPath: '.',
|
|
344
|
+
// Assets-only: no worker, so no entrypoint and no ASSETS binding.
|
|
345
|
+
deploymentType: 'static',
|
|
346
|
+
usesAssetsBinding: false,
|
|
347
|
+
skipNoBundle: false,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
exports.StaticBuilder = StaticBuilder;
|
|
352
|
+
//# 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;AA6FD,gEAoCC;AA3OD;;;;;;;;;;;;GAYG;AACH,4CAA8B;AAC9B,gDAAkC;AAElC,kCAA2C;AAC3C,uCAAoD;AAapD,sCAAsC;AACtC,MAAM,aAAa,GAAG,IAAI,CAAC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EAA0E;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,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. NOTE: historical name — it does NOT skip the mount
|
|
80
|
+
* path. A fixed `@astrojs/cloudflare` (>= 13.3.1 / all 14.x) sets `base = mountPath` and
|
|
81
|
+
* nests the client tree under `dist/client/<mount>/`, so `copyAssets` descends into that
|
|
82
|
+
* exact mount dir via `stripCloudflareBaseNesting` and then re-appends the mount once —
|
|
83
|
+
* instead of the blind append used for Astro 5 / Next.js.
|
|
84
|
+
*/
|
|
85
|
+
assetsSourceSkipMountPath?: 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,KAA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,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"}
|