@webflow/cloud-app 0.1.0-beta.9 → 0.1.0
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/README.md +20 -51
- package/dist/bindings.d.ts.map +1 -1
- package/dist/bindings.js +3 -2
- package/dist/bindings.js.map +1 -1
- package/dist/diagnostics.d.ts +23 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +31 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.d.ts +3 -3
- package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.js +3 -3
- package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts +34 -0
- package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts.map +1 -0
- package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js +89 -0
- package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js.map +1 -0
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts +2 -2
- package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js +2 -2
- package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts +39 -0
- package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts.map +1 -0
- package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.js +93 -0
- package/dist/frameworks/astro/adapter-patches/resolve-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/astro6.d.ts.map +1 -1
- package/dist/frameworks/astro/astro6.js +11 -9
- package/dist/frameworks/astro/astro6.js.map +1 -1
- package/dist/frameworks/astro/astro7.d.ts.map +1 -1
- package/dist/frameworks/astro/astro7.js +12 -9
- package/dist/frameworks/astro/astro7.js.map +1 -1
- package/dist/frameworks/astro/session-check.d.ts +27 -0
- package/dist/frameworks/astro/session-check.d.ts.map +1 -0
- package/dist/frameworks/astro/session-check.js +173 -0
- package/dist/frameworks/astro/session-check.js.map +1 -0
- package/dist/frameworks/astro/templates/astro.config.webflow.ts +86 -1
- package/dist/frameworks/astro/templates/v5/webflow-loader.ts +4 -1
- package/dist/frameworks/astro/templates/v6/webflow-loader.ts +4 -1
- package/dist/frameworks/astro/templates/v7/webflow-loader.ts +4 -1
- package/dist/frameworks/static/templates/wrangler.json +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +12 -0
- package/dist/pipeline.js.map +1 -1
- package/dist/static-base-href.d.ts +31 -0
- package/dist/static-base-href.d.ts.map +1 -0
- package/dist/static-base-href.js +183 -0
- package/dist/static-base-href.js.map +1 -0
- package/dist/wrangler.d.ts.map +1 -1
- package/dist/wrangler.js +126 -5
- package/dist/wrangler.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -100,62 +100,31 @@ repo). Which copy of `@webflow/cloud-app` they load is decided by **where
|
|
|
100
100
|
`npm install` ran**, not by how the code is bundled and not at runtime — a
|
|
101
101
|
`require("@webflow/cloud-app")` just reads whatever `npm` put in `node_modules`.
|
|
102
102
|
|
|
103
|
-
| Scenario | `node_modules/@webflow/cloud-app` is…
|
|
104
|
-
| ---------------------------------------------------------------------------- |
|
|
105
|
-
| End user runs `npm i -g @webflow/webflow-cli` | the registry copy npm fetched
|
|
106
|
-
| Engineer working in the webflow-cli repo (`npm ci`, build, run local `dist`) | a symlink to `apps/webflow-cloud-app`
|
|
107
|
-
| CI for webflow-cli (unit, regression
|
|
108
|
-
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
by `npm run check:cloud-app-pin
|
|
115
|
-
|
|
116
|
-
the next build.
|
|
103
|
+
| Scenario | `node_modules/@webflow/cloud-app` is… | Source |
|
|
104
|
+
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ------------------------------------- |
|
|
105
|
+
| End user runs `npm i -g @webflow/webflow-cli` | the registry copy npm fetched | npm registry |
|
|
106
|
+
| Engineer working in the webflow-cli repo (`npm ci`, build, run local `dist`) | a symlink to `apps/webflow-cloud-app` | workspace (repo tree) |
|
|
107
|
+
| CI for webflow-cli (unit, regression) | a symlink to `apps/webflow-cloud-app` | workspace (repo tree) |
|
|
108
|
+
| CI for webflow-cli (e2e, temp workspace outside the repo) | a tarball packed from this folder, or the published version the CLI depends on while it lags | workspace (repo tree) or npm registry |
|
|
109
|
+
| cosmic-builder (separate repo) | the registry copy npm fetched | npm registry |
|
|
110
|
+
|
|
111
|
+
- **Inside this monorepo the CLI uses the workspace copy while it depends on
|
|
112
|
+
this package's current version.** `apps/webflow-cli` depends on it through an
|
|
113
|
+
npm alias to an exact version (`npm:@webflow/cloud-app@<version>`, enforced in
|
|
114
|
+
CI by `npm run check:cloud-app-pin`). While that version equals this package's
|
|
115
|
+
version, npm links the workspace copy, so editing the source here takes effect
|
|
116
|
+
on the next build. When this package has moved ahead, the CLI keeps using the
|
|
117
|
+
published version its alias names until the alias is changed on purpose.
|
|
117
118
|
- **The published CLI uses the registry copy.** The engine is kept external in
|
|
118
119
|
the CLI's tsup bundle (it is CJS, not inlined), so the shipped `dist` keeps
|
|
119
120
|
`require("@webflow/cloud-app")` and resolves it at the user's install time.
|
|
120
|
-
The
|
|
121
|
-
|
|
122
|
-
resolve exactly that version from npm.
|
|
121
|
+
The alias names an exact version, so released builds resolve exactly that
|
|
122
|
+
version from npm.
|
|
123
123
|
- **cosmic-builder is a different repo**, so it has no workspace copy and always
|
|
124
|
-
resolves from the registry. That is why publishing to npm
|
|
124
|
+
resolves from the registry. That is why publishing to npm still
|
|
125
125
|
matters even though the CLI links the workspace in development.
|
|
126
126
|
|
|
127
127
|
## Publishing
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
workspace package, but `changeset publish` always publishes with `--tag latest`,
|
|
132
|
-
which would move `latest` onto a beta, so it must already be on npm before a CLI
|
|
133
|
-
release: `publish-packages.sh` refuses to run otherwise, and skips it once it is.
|
|
134
|
-
Don't add changesets for this package — changesets can't increment a prerelease
|
|
135
|
-
(it would turn `0.1.0-beta.7` into `0.1.0`); bump the version by hand. CI fails
|
|
136
|
-
(`npm run check:cloud-app-pin`) if a changeset names it.
|
|
137
|
-
|
|
138
|
-
This is a prerelease line (`0.1.0-beta.x`), so always pass an explicit
|
|
139
|
-
`--tag` — npm would otherwise move the `latest` tag onto a beta. The CLI pins
|
|
140
|
-
this exact version, so move the pin in the same PR (CI runs
|
|
141
|
-
`npm run check:cloud-app-pin`):
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
# from apps/webflow-cloud-app
|
|
145
|
-
npm version prerelease --preid beta --no-git-tag-version # 0.1.0-beta.7 → 0.1.0-beta.8
|
|
146
|
-
# set "@webflow/cloud-app" in apps/webflow-cli/package.json to the same version
|
|
147
|
-
# and run `npm install` from the repo root
|
|
148
|
-
npm publish --tag beta # installs via @webflow/cloud-app@beta
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
To test a build against the consumers (webflow-cli, cosmic-builder) before a
|
|
152
|
-
real release, publish the same version under a throwaway ticket-scoped tag so
|
|
153
|
-
it never touches `latest` or `beta`:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
npm publish --tag beta7-cloud888 # installs via @webflow/cloud-app@beta7-cloud888
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Consumers then pin that exact version (e.g. `"@webflow/cloud-app": "0.1.0-beta.8"`)
|
|
160
|
-
and CI resolves it from the registry. Remove a throwaway tag when done with
|
|
161
|
-
`npm dist-tag rm @webflow/cloud-app beta7-cloud888`.
|
|
129
|
+
Release instructions for the Cloud team are in
|
|
130
|
+
[RELEASING.md](./RELEASING.md).
|
package/dist/bindings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAUvC,eAAO,MAAM,eAAe;;;;;;;;;gCAEZ,CAAC;AACjB,eAAO,MAAM,eAAe;;;;;;;;;gCAEZ,CAAC;AACjB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;gCAOZ,CAAC;AAEjB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAMX,CAAC;AAEjB,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7D,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAGvE;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,GAAG,OAAO,CAG7E;AAED,2GAA2G;AAC3G,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBvD;AAED,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAmBhE;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,IAAI,SAAgB,GACnB,YAAY,CAmBd"}
|
package/dist/bindings.js
CHANGED
|
@@ -25,8 +25,9 @@ const zod_1 = require("zod");
|
|
|
25
25
|
const errors_1 = require("./frameworks/errors");
|
|
26
26
|
/** Max number of each binding type, matching the deployer's limits. */
|
|
27
27
|
exports.MAX_BINDINGS_PER_TYPE = 5;
|
|
28
|
-
// Cloudflare assigns the real ids at deploy time
|
|
29
|
-
//
|
|
28
|
+
// Cloudflare assigns the real ids at deploy time. The user wrangler schema and
|
|
29
|
+
// `wrangler deploy --dry-run` accept bindings without ids; the placeholders keep
|
|
30
|
+
// the bridge valid against the strict `loadWranglerJson` schema.
|
|
30
31
|
const KV_ID_PLACEHOLDER = '0'.repeat(32);
|
|
31
32
|
const D1_ID_PLACEHOLDER = '00000000-0000-0000-0000-000000000000';
|
|
32
33
|
// `binding` is the JS binding name (e.g. `env.MY_KV`). `id` / `database_id` are
|
package/dist/bindings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":";;;AAyDA,sCAGC;AAGD,wCAGC;AAGD,oDAgBC;AAGD,4CAmBC;AAeD,wDAsBC;AAhJD;;;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ClB,WAAW,EAAE,CAAC,CAAC,WAAW;SAC3B,CAAC,CAAC;QACH,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5C,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,aAAa,EAAE,CAAC,CAAC,aAAa;YAC9B,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,iBAAiB;YAC/C,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClE,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type DiagnosticLevel = 'warn' | 'error';
|
|
2
|
+
export declare const DiagnosticCode: {
|
|
3
|
+
readonly ASTRO_SESSION_BINDING_MISSING: "ASTRO_SESSION_BINDING_MISSING";
|
|
4
|
+
readonly WRANGLER_JSON_INVALID: "WRANGLER_JSON_INVALID";
|
|
5
|
+
};
|
|
6
|
+
export type DiagnosticCode = (typeof DiagnosticCode)[keyof typeof DiagnosticCode];
|
|
7
|
+
export interface Diagnostic {
|
|
8
|
+
level: DiagnosticLevel;
|
|
9
|
+
code: DiagnosticCode;
|
|
10
|
+
/** One sentence: what is wrong and what it breaks. No newlines. */
|
|
11
|
+
message: string;
|
|
12
|
+
/** One sentence: the exact change to make. No newlines. */
|
|
13
|
+
fix?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DIAGNOSTIC_LINE_PATTERN: RegExp;
|
|
16
|
+
export declare function formatDiagnostic({ level, code, message, fix }: Diagnostic): string;
|
|
17
|
+
export declare function parseDiagnostic(line: string): {
|
|
18
|
+
level: DiagnosticLevel;
|
|
19
|
+
code: string;
|
|
20
|
+
message: string;
|
|
21
|
+
fix?: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAElF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAID,eAAO,MAAM,uBAAuB,QAC6B,CAAC;AAElE,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,UAAU,GAAG,MAAM,CAKlF;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GACX;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAOrF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Machine-readable build diagnostics. The format and code registry match cosmic-builder's BUILD_DIAGNOSTICS.md
|
|
3
|
+
// (keep codes in sync). Agents, the CLI and (later) the dashboard pick these
|
|
4
|
+
// lines out of the build log by the `[cloud:<level>:<CODE>]` prefix, so a code
|
|
5
|
+
// must never change meaning once shipped.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DIAGNOSTIC_LINE_PATTERN = exports.DiagnosticCode = void 0;
|
|
8
|
+
exports.formatDiagnostic = formatDiagnostic;
|
|
9
|
+
exports.parseDiagnostic = parseDiagnostic;
|
|
10
|
+
exports.DiagnosticCode = {
|
|
11
|
+
ASTRO_SESSION_BINDING_MISSING: 'ASTRO_SESSION_BINDING_MISSING',
|
|
12
|
+
WRANGLER_JSON_INVALID: 'WRANGLER_JSON_INVALID',
|
|
13
|
+
};
|
|
14
|
+
// Matches the first line of a diagnostic. Errors may carry detail lines after it.
|
|
15
|
+
// Leading whitespace is allowed because the CLI indents every log line.
|
|
16
|
+
exports.DIAGNOSTIC_LINE_PATTERN = /^\s*\[cloud:(warn|error):([A-Z0-9_]+)\] (.*?)(?: Fix: (.*))?$/;
|
|
17
|
+
function formatDiagnostic({ level, code, message, fix }) {
|
|
18
|
+
if (/[\r\n]/.test(message) || (fix && /[\r\n]/.test(fix))) {
|
|
19
|
+
throw new Error(`diagnostic ${code}: message and fix must be single-line`);
|
|
20
|
+
}
|
|
21
|
+
return `[cloud:${level}:${code}] ${message}` + (fix ? ` Fix: ${fix}` : '');
|
|
22
|
+
}
|
|
23
|
+
function parseDiagnostic(line) {
|
|
24
|
+
const match = exports.DIAGNOSTIC_LINE_PATTERN.exec(line.split(/\r?\n/, 1)[0].replace(/\r+$/, ''));
|
|
25
|
+
if (!match) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const [, level, code, message, fix] = match;
|
|
29
|
+
return { level: level, code, message, ...(fix !== undefined ? { fix } : {}) };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":";AAAA,+GAA+G;AAC/G,6EAA6E;AAC7E,+EAA+E;AAC/E,0CAA0C;;;AAyB1C,4CAKC;AAED,0CASC;AArCY,QAAA,cAAc,GAAG;IAC5B,6BAA6B,EAAE,+BAA+B;IAC9D,qBAAqB,EAAE,uBAAuB;CACtC,CAAC;AAaX,kFAAkF;AAClF,wEAAwE;AAC3D,QAAA,uBAAuB,GAClC,+DAA+D,CAAC;AAElE,SAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAc;IACxE,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,uCAAuC,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,UAAU,KAAK,IAAI,IAAI,KAAK,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,SAAgB,eAAe,CAC7B,IAAY;IAEZ,MAAM,KAAK,GAAG,+BAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IAC1F,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;IAC5C,OAAO,EAAE,KAAK,EAAE,KAAwB,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
* Everything else passes: a missing `assetsPath`, a metadata-only tree, and an asset-less app
|
|
21
21
|
* (an empty `<mount>/` dir still counts as nested).
|
|
22
22
|
*
|
|
23
|
-
* `
|
|
24
|
-
* unreachable. It is reachable through a non-semver adapter spec (git URL,
|
|
25
|
-
*
|
|
23
|
+
* `ensureCompatibleCloudflareAdapter` clamps the adapter into a base-path-fixed range, which is
|
|
24
|
+
* what keeps this nearly unreachable. It is reachable through a non-semver adapter spec (git URL,
|
|
25
|
+
* `file:`, alias) whose range it cannot verify and therefore leaves alone.
|
|
26
26
|
*/
|
|
27
27
|
export declare function assertAdapterNestedUnderMount(cwd: string, assetsPath: string, cleanMountPath: string): void;
|
|
28
28
|
//# sourceMappingURL=assert-adapter-nested-under-mount.d.ts.map
|
|
@@ -92,9 +92,9 @@ function listEntries(dir) {
|
|
|
92
92
|
* Everything else passes: a missing `assetsPath`, a metadata-only tree, and an asset-less app
|
|
93
93
|
* (an empty `<mount>/` dir still counts as nested).
|
|
94
94
|
*
|
|
95
|
-
* `
|
|
96
|
-
* unreachable. It is reachable through a non-semver adapter spec (git URL,
|
|
97
|
-
*
|
|
95
|
+
* `ensureCompatibleCloudflareAdapter` clamps the adapter into a base-path-fixed range, which is
|
|
96
|
+
* what keeps this nearly unreachable. It is reachable through a non-semver adapter spec (git URL,
|
|
97
|
+
* `file:`, alias) whose range it cannot verify and therefore leaves alone.
|
|
98
98
|
*/
|
|
99
99
|
function assertAdapterNestedUnderMount(cwd, assetsPath, cleanMountPath) {
|
|
100
100
|
if (!cleanMountPath) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Logger, CommandRunner } from '../../../ports';
|
|
2
|
+
export interface EnsureCompatibleCloudflareAdapterParams {
|
|
3
|
+
log: Logger;
|
|
4
|
+
runCommand: CommandRunner;
|
|
5
|
+
cwd: string;
|
|
6
|
+
/** e.g. `@astrojs/cloudflare`. */
|
|
7
|
+
adapterName: string;
|
|
8
|
+
/**
|
|
9
|
+
* The adapter range compatible with the project's Astro version, from
|
|
10
|
+
* `resolveCloudflareAdapterRange` (e.g. `>=14.1.7 <14.2.0` or `^13.3.1`).
|
|
11
|
+
*/
|
|
12
|
+
compatibleRange: string;
|
|
13
|
+
/** The user's declared adapter spec (from package.json), or undefined if absent. */
|
|
14
|
+
declaredVersion: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Ensure the project resolves a `@astrojs/cloudflare` within the range that is
|
|
18
|
+
* compatible with its Astro version (see `resolveCloudflareAdapterRange`).
|
|
19
|
+
*
|
|
20
|
+
* - Adapter absent -> install the compatible range.
|
|
21
|
+
* - Declared range NOT a subset of the compatible range -> force-install the
|
|
22
|
+
* compatible range and warn. This catches both a too-low range (a base-path-buggy
|
|
23
|
+
* 13.x, withastro/astro#16276) and a too-high one (an unbounded `^14.0.0` that
|
|
24
|
+
* floats to 14.2.x and breaks Astro 7.0/7.1, whose adapter peerDeps lie).
|
|
25
|
+
* - Declared range already within the compatible range -> leave it alone.
|
|
26
|
+
* - Unparseable spec (`workspace:` / `file:` / `npm:` alias) -> warn and leave it;
|
|
27
|
+
* we cannot reason about the range, and forcing could clobber an intentional link.
|
|
28
|
+
*
|
|
29
|
+
* `npm install --save <pkg>@<range>` rewrites BOTH package.json and the lockfile
|
|
30
|
+
* entry for this package, so a forced install overrides a lockfile-pinned
|
|
31
|
+
* incompatible version.
|
|
32
|
+
*/
|
|
33
|
+
export declare function ensureCompatibleCloudflareAdapter(params: EnsureCompatibleCloudflareAdapterParams): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=ensure-compatible-cloudflare-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-compatible-cloudflare-adapter.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5D,MAAM,WAAW,uCAAuC;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,aAAa,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,uCAAuC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.ensureCompatibleCloudflareAdapter = ensureCompatibleCloudflareAdapter;
|
|
37
|
+
const semver = __importStar(require("semver"));
|
|
38
|
+
const utils_1 = require("../../../utils");
|
|
39
|
+
/**
|
|
40
|
+
* Ensure the project resolves a `@astrojs/cloudflare` within the range that is
|
|
41
|
+
* compatible with its Astro version (see `resolveCloudflareAdapterRange`).
|
|
42
|
+
*
|
|
43
|
+
* - Adapter absent -> install the compatible range.
|
|
44
|
+
* - Declared range NOT a subset of the compatible range -> force-install the
|
|
45
|
+
* compatible range and warn. This catches both a too-low range (a base-path-buggy
|
|
46
|
+
* 13.x, withastro/astro#16276) and a too-high one (an unbounded `^14.0.0` that
|
|
47
|
+
* floats to 14.2.x and breaks Astro 7.0/7.1, whose adapter peerDeps lie).
|
|
48
|
+
* - Declared range already within the compatible range -> leave it alone.
|
|
49
|
+
* - Unparseable spec (`workspace:` / `file:` / `npm:` alias) -> warn and leave it;
|
|
50
|
+
* we cannot reason about the range, and forcing could clobber an intentional link.
|
|
51
|
+
*
|
|
52
|
+
* `npm install --save <pkg>@<range>` rewrites BOTH package.json and the lockfile
|
|
53
|
+
* entry for this package, so a forced install overrides a lockfile-pinned
|
|
54
|
+
* incompatible version.
|
|
55
|
+
*/
|
|
56
|
+
async function ensureCompatibleCloudflareAdapter(params) {
|
|
57
|
+
const { log, runCommand, cwd, adapterName, compatibleRange, declaredVersion } = params;
|
|
58
|
+
if (!declaredVersion) {
|
|
59
|
+
log.warn(`Installing ${adapterName}@${compatibleRange} (required for Cloudflare deployment)...`);
|
|
60
|
+
await (0, utils_1.npm)({
|
|
61
|
+
log,
|
|
62
|
+
runCommand,
|
|
63
|
+
cwd,
|
|
64
|
+
args: ['install', '--save', `${adapterName}@${compatibleRange}`],
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const declaredRange = semver.validRange(declaredVersion);
|
|
69
|
+
if (!declaredRange) {
|
|
70
|
+
// workspace:/file:/npm: alias and other non-semver specs — can't compare, leave as-is.
|
|
71
|
+
log.warn(`Cannot verify ${adapterName}@${declaredVersion} against the compatible range ${compatibleRange}; ` +
|
|
72
|
+
`leaving it as declared. If the build fails, pin ${adapterName}@${compatibleRange} manually.`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (semver.subset(declaredRange, compatibleRange)) {
|
|
76
|
+
// Every version the declared range allows is already compatible.
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
log.warn(`${adapterName}@${declaredVersion} is outside the range compatible with your Astro version ` +
|
|
80
|
+
`(${compatibleRange}). Installing ${adapterName}@${compatibleRange} to avoid broken asset serving ` +
|
|
81
|
+
`or missing-export build failures on mounted apps.`);
|
|
82
|
+
await (0, utils_1.npm)({
|
|
83
|
+
log,
|
|
84
|
+
runCommand,
|
|
85
|
+
cwd,
|
|
86
|
+
args: ['install', '--save', `${adapterName}@${compatibleRange}`],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=ensure-compatible-cloudflare-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-compatible-cloudflare-adapter.js","sourceRoot":"","sources":["../../../../src/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,8EA4CC;AAjFD,+CAAiC;AAGjC,0CAAqC;AAiBrC;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,iCAAiC,CACrD,MAA+C;IAE/C,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAEvF,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,GAAG,CAAC,IAAI,CACN,cAAc,WAAW,IAAI,eAAe,0CAA0C,CACvF,CAAC;QACF,MAAM,IAAA,WAAG,EAAC;YACR,GAAG;YACH,UAAU;YACV,GAAG;YACH,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC;SACjE,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IACzD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,uFAAuF;QACvF,GAAG,CAAC,IAAI,CACN,iBAAiB,WAAW,IAAI,eAAe,iCAAiC,eAAe,IAAI;YACjG,mDAAmD,WAAW,IAAI,eAAe,YAAY,CAChG,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,EAAE,CAAC;QAClD,iEAAiE;QACjE,OAAO;IACT,CAAC;IAED,GAAG,CAAC,IAAI,CACN,GAAG,WAAW,IAAI,eAAe,2DAA2D;QAC1F,IAAI,eAAe,iBAAiB,WAAW,IAAI,eAAe,iCAAiC;QACnG,mDAAmD,CACtD,CAAC;IACF,MAAM,IAAA,WAAG,EAAC;QACR,GAAG;QACH,UAAU;QACV,GAAG;QACH,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC;KACjE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -15,8 +15,8 @@ export interface EnsureFixedCloudflareAdapterParams {
|
|
|
15
15
|
/**
|
|
16
16
|
* Ensure the project resolves a `@astrojs/cloudflare` adapter at or above the release that
|
|
17
17
|
* fixes the base-path bug (withastro/astro#16276, fixed in 13.3.1). Companion to
|
|
18
|
-
* `
|
|
19
|
-
*
|
|
18
|
+
* `stripCloudflareBaseNesting`: forcing a fixed adapter is what keeps the strip a rare
|
|
19
|
+
* backstop rather than load-bearing — a buggy 13.0.0–13.3.0 adapter emits the client tree
|
|
20
20
|
* WITHOUT the base prefix, so assets end up at the wrong URL no matter how we copy them.
|
|
21
21
|
*
|
|
22
22
|
* - Adapter absent → install our pinned version.
|
|
@@ -39,8 +39,8 @@ const utils_1 = require("../../../utils");
|
|
|
39
39
|
/**
|
|
40
40
|
* Ensure the project resolves a `@astrojs/cloudflare` adapter at or above the release that
|
|
41
41
|
* fixes the base-path bug (withastro/astro#16276, fixed in 13.3.1). Companion to
|
|
42
|
-
* `
|
|
43
|
-
*
|
|
42
|
+
* `stripCloudflareBaseNesting`: forcing a fixed adapter is what keeps the strip a rare
|
|
43
|
+
* backstop rather than load-bearing — a buggy 13.0.0–13.3.0 adapter emits the client tree
|
|
44
44
|
* WITHOUT the base prefix, so assets end up at the wrong URL no matter how we copy them.
|
|
45
45
|
*
|
|
46
46
|
* - Adapter absent → install our pinned version.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** One Astro line and the `@astrojs/cloudflare` range that is compatible with it. */
|
|
2
|
+
export interface AdapterCompatRow {
|
|
3
|
+
/** Matched against the project's declared Astro version (coerced to its floor). */
|
|
4
|
+
astroRange: string;
|
|
5
|
+
/** The `@astrojs/cloudflare` range to install/clamp to for this Astro line. */
|
|
6
|
+
adapterRange: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Astro -> `@astrojs/cloudflare` compatibility, newest Astro line first.
|
|
10
|
+
*
|
|
11
|
+
* The adapter's own peerDependencies are too loose to trust: 14.2.0 imports
|
|
12
|
+
* `beginContentEntryCollection`, an export that only exists in astro@7.2.0, yet
|
|
13
|
+
* still declares peer `astro@^7.0.0`. An unbounded `^14.0.0` install therefore
|
|
14
|
+
* floats to 14.2.x and breaks Astro 7.0/7.1 builds. We pin a bounded window per
|
|
15
|
+
* Astro line instead: wide enough to pull the latest compatible adapter, capped
|
|
16
|
+
* below the first release that needs a newer Astro than the declared line
|
|
17
|
+
* guarantees.
|
|
18
|
+
*
|
|
19
|
+
* Each floor also sits at or above the base-path fix (withastro/astro#16276,
|
|
20
|
+
* adapter 13.3.1; every 14.x is clean), so resolving from this table keeps the
|
|
21
|
+
* verbatim `dist/client` copy correct.
|
|
22
|
+
*
|
|
23
|
+
* Keyed on the declared Astro floor: a project that declares `astro@^7.0.0`
|
|
24
|
+
* promises to run on 7.0, so its adapter must stay 7.0-compatible (< 14.2.0)
|
|
25
|
+
* even if the caret later floats Astro up. Adapter 14.1.x works across all of
|
|
26
|
+
* 7.x, so clamping down is always safe.
|
|
27
|
+
*/
|
|
28
|
+
export declare const CLOUDFLARE_ADAPTER_TABLE: readonly AdapterCompatRow[];
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the compatible `@astrojs/cloudflare` range for a declared Astro version.
|
|
31
|
+
*
|
|
32
|
+
* Matches the first table row the Astro version's floor satisfies. Throws when
|
|
33
|
+
* the version is unparseable or outside every known line, so a builder fails
|
|
34
|
+
* loudly rather than silently installing an unbounded adapter.
|
|
35
|
+
*
|
|
36
|
+
* @param declaredAstroVersion The `astro` spec from package.json (e.g. `^7.0.0`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveCloudflareAdapterRange(declaredAstroVersion: string | undefined): string;
|
|
39
|
+
//# sourceMappingURL=resolve-cloudflare-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-cloudflare-adapter.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.ts"],"names":[],"mappings":"AAIA,qFAAqF;AACrF,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,gBAAgB,EAQ/D,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CA2B9F"}
|
|
@@ -0,0 +1,93 @@
|
|
|
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.CLOUDFLARE_ADAPTER_TABLE = void 0;
|
|
37
|
+
exports.resolveCloudflareAdapterRange = resolveCloudflareAdapterRange;
|
|
38
|
+
const semver = __importStar(require("semver"));
|
|
39
|
+
const errors_1 = require("../../errors");
|
|
40
|
+
/**
|
|
41
|
+
* Astro -> `@astrojs/cloudflare` compatibility, newest Astro line first.
|
|
42
|
+
*
|
|
43
|
+
* The adapter's own peerDependencies are too loose to trust: 14.2.0 imports
|
|
44
|
+
* `beginContentEntryCollection`, an export that only exists in astro@7.2.0, yet
|
|
45
|
+
* still declares peer `astro@^7.0.0`. An unbounded `^14.0.0` install therefore
|
|
46
|
+
* floats to 14.2.x and breaks Astro 7.0/7.1 builds. We pin a bounded window per
|
|
47
|
+
* Astro line instead: wide enough to pull the latest compatible adapter, capped
|
|
48
|
+
* below the first release that needs a newer Astro than the declared line
|
|
49
|
+
* guarantees.
|
|
50
|
+
*
|
|
51
|
+
* Each floor also sits at or above the base-path fix (withastro/astro#16276,
|
|
52
|
+
* adapter 13.3.1; every 14.x is clean), so resolving from this table keeps the
|
|
53
|
+
* verbatim `dist/client` copy correct.
|
|
54
|
+
*
|
|
55
|
+
* Keyed on the declared Astro floor: a project that declares `astro@^7.0.0`
|
|
56
|
+
* promises to run on 7.0, so its adapter must stay 7.0-compatible (< 14.2.0)
|
|
57
|
+
* even if the caret later floats Astro up. Adapter 14.1.x works across all of
|
|
58
|
+
* 7.x, so clamping down is always safe.
|
|
59
|
+
*/
|
|
60
|
+
exports.CLOUDFLARE_ADAPTER_TABLE = [
|
|
61
|
+
// Bounded at `<8.0.0` on purpose: `Astro7Builder.detect` accepts major >= 7, so a
|
|
62
|
+
// future Astro 8 would land here. Leaving it open-ended would silently hand Astro 8
|
|
63
|
+
// a `^14.2.0` adapter that only peers `astro@^7`. The bound makes an unmapped major
|
|
64
|
+
// fail loudly (see resolveCloudflareAdapterRange) until a row is added for it.
|
|
65
|
+
{ astroRange: '>=7.2.0 <8.0.0', adapterRange: '^14.2.0' },
|
|
66
|
+
{ astroRange: '>=7.0.0 <7.2.0', adapterRange: '>=14.1.7 <14.2.0' },
|
|
67
|
+
{ astroRange: '>=6.0.0 <7.0.0', adapterRange: '^13.3.1' },
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Resolve the compatible `@astrojs/cloudflare` range for a declared Astro version.
|
|
71
|
+
*
|
|
72
|
+
* Matches the first table row the Astro version's floor satisfies. Throws when
|
|
73
|
+
* the version is unparseable or outside every known line, so a builder fails
|
|
74
|
+
* loudly rather than silently installing an unbounded adapter.
|
|
75
|
+
*
|
|
76
|
+
* @param declaredAstroVersion The `astro` spec from package.json (e.g. `^7.0.0`).
|
|
77
|
+
*/
|
|
78
|
+
function resolveCloudflareAdapterRange(declaredAstroVersion) {
|
|
79
|
+
const coerced = declaredAstroVersion ? semver.coerce(declaredAstroVersion) : null;
|
|
80
|
+
if (!coerced) {
|
|
81
|
+
throw new errors_1.FrameworkValidationError(`Cannot resolve a @astrojs/cloudflare version: unrecognized Astro version "${declaredAstroVersion ?? '(absent)'}".`, {
|
|
82
|
+
remediation: 'Pin a concrete Astro version, e.g.: npm install astro@^7.0.0',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const row = exports.CLOUDFLARE_ADAPTER_TABLE.find((candidate) => semver.satisfies(coerced, candidate.astroRange));
|
|
86
|
+
if (!row) {
|
|
87
|
+
throw new errors_1.FrameworkValidationError(`No @astrojs/cloudflare mapping for Astro ${coerced.version}. Add a row to CLOUDFLARE_ADAPTER_TABLE.`, {
|
|
88
|
+
remediation: 'This Astro version is outside the range this builder supports. Pin a supported Astro major, or update CLOUDFLARE_ADAPTER_TABLE.',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return row.adapterRange;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=resolve-cloudflare-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-cloudflare-adapter.js","sourceRoot":"","sources":["../../../../src/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,sEA2BC;AA9ED,+CAAiC;AAEjC,yCAAwD;AAUxD;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,wBAAwB,GAAgC;IACnE,kFAAkF;IAClF,oFAAoF;IACpF,oFAAoF;IACpF,+EAA+E;IAC/E,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE;IACzD,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAE;IAClE,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE;CAC1D,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAgB,6BAA6B,CAAC,oBAAwC;IACpF,MAAM,OAAO,GAAG,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,iCAAwB,CAChC,6EACE,oBAAoB,IAAI,UAC1B,IAAI,EACJ;YACE,WAAW,EAAE,8DAA8D;SAC5E,CACF,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,gCAAwB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CACtD,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,CAChD,CAAC;IACF,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,iCAAwB,CAChC,4CAA4C,OAAO,CAAC,OAAO,0CAA0C,EACrG;YACE,WAAW,EACT,iIAAiI;SACpI,CACF,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC,YAAY,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-cloudflare-base-nesting.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.ts"],"names":[],"mappings":"AA6CA,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,MAAM,CAkBR"}
|