@webflow/cloud-app 0.1.0-beta.9 → 0.1.1-beta.bad4bbe.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.
Files changed (84) hide show
  1. package/README.md +40 -91
  2. package/dist/assetVersionToken.d.ts +9 -0
  3. package/dist/assetVersionToken.d.ts.map +1 -0
  4. package/dist/assetVersionToken.js +37 -0
  5. package/dist/assetVersionToken.js.map +1 -0
  6. package/dist/bindings.d.ts.map +1 -1
  7. package/dist/bindings.js +3 -2
  8. package/dist/bindings.js.map +1 -1
  9. package/dist/config/package-json.d.ts +2 -2
  10. package/dist/diagnostics.d.ts +23 -0
  11. package/dist/diagnostics.d.ts.map +1 -0
  12. package/dist/diagnostics.js +31 -0
  13. package/dist/diagnostics.js.map +1 -0
  14. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.d.ts +3 -3
  15. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.js +3 -3
  16. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts +34 -0
  17. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts.map +1 -0
  18. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js +89 -0
  19. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js.map +1 -0
  20. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts +39 -0
  21. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts.map +1 -0
  22. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.js +93 -0
  23. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.js.map +1 -0
  24. package/dist/frameworks/astro/astro5.d.ts +1 -0
  25. package/dist/frameworks/astro/astro5.d.ts.map +1 -1
  26. package/dist/frameworks/astro/astro5.js +5 -0
  27. package/dist/frameworks/astro/astro5.js.map +1 -1
  28. package/dist/frameworks/astro/astro6.d.ts +1 -0
  29. package/dist/frameworks/astro/astro6.d.ts.map +1 -1
  30. package/dist/frameworks/astro/astro6.js +16 -9
  31. package/dist/frameworks/astro/astro6.js.map +1 -1
  32. package/dist/frameworks/astro/astro7.d.ts +1 -0
  33. package/dist/frameworks/astro/astro7.d.ts.map +1 -1
  34. package/dist/frameworks/astro/astro7.js +17 -9
  35. package/dist/frameworks/astro/astro7.js.map +1 -1
  36. package/dist/frameworks/astro/session-check.d.ts +27 -0
  37. package/dist/frameworks/astro/session-check.d.ts.map +1 -0
  38. package/dist/frameworks/astro/session-check.js +173 -0
  39. package/dist/frameworks/astro/session-check.js.map +1 -0
  40. package/dist/frameworks/astro/templates/astro.config.webflow.ts +124 -2
  41. package/dist/frameworks/astro/templates/v5/astro.config.mjs.template +1 -0
  42. package/dist/frameworks/astro/templates/v5/webflow-loader.ts +4 -1
  43. package/dist/frameworks/astro/templates/v6/astro.config.mjs.template +1 -0
  44. package/dist/frameworks/astro/templates/v6/webflow-loader.ts +4 -1
  45. package/dist/frameworks/astro/templates/v7/astro.config.mjs.template +1 -0
  46. package/dist/frameworks/astro/templates/v7/webflow-loader.ts +4 -1
  47. package/dist/frameworks/base.d.ts +19 -1
  48. package/dist/frameworks/base.d.ts.map +1 -1
  49. package/dist/frameworks/base.js +24 -0
  50. package/dist/frameworks/base.js.map +1 -1
  51. package/dist/frameworks/nextjs/index.d.ts +13 -0
  52. package/dist/frameworks/nextjs/index.d.ts.map +1 -1
  53. package/dist/frameworks/nextjs/index.js +41 -1
  54. package/dist/frameworks/nextjs/index.js.map +1 -1
  55. package/dist/frameworks/nextjs/supportPolicy.d.ts +28 -0
  56. package/dist/frameworks/nextjs/supportPolicy.d.ts.map +1 -0
  57. package/dist/frameworks/nextjs/supportPolicy.js +127 -0
  58. package/dist/frameworks/nextjs/supportPolicy.js.map +1 -0
  59. package/dist/frameworks/nextjs/templates/next.config.ts.template +1 -0
  60. package/dist/frameworks/nextjs/templates/next.config.webflow.ts +6 -1
  61. package/dist/frameworks/static/templates/wrangler.json +2 -1
  62. package/dist/frameworks/types.d.ts +14 -0
  63. package/dist/frameworks/types.d.ts.map +1 -1
  64. package/dist/index.d.ts +9 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +25 -2
  67. package/dist/index.js.map +1 -1
  68. package/dist/pipeline.d.ts.map +1 -1
  69. package/dist/pipeline.js +25 -0
  70. package/dist/pipeline.js.map +1 -1
  71. package/dist/static-base-href.d.ts +31 -0
  72. package/dist/static-base-href.d.ts.map +1 -0
  73. package/dist/static-base-href.js +183 -0
  74. package/dist/static-base-href.js.map +1 -0
  75. package/dist/types.d.ts +2 -0
  76. package/dist/types.d.ts.map +1 -1
  77. package/dist/wrangler.d.ts.map +1 -1
  78. package/dist/wrangler.js +126 -5
  79. package/dist/wrangler.js.map +1 -1
  80. package/package.json +4 -4
  81. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts +0 -36
  82. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts.map +0 -1
  83. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js +0 -94
  84. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js.map +0 -1
package/README.md CHANGED
@@ -10,13 +10,7 @@ config, runs the build, and produces a worker-ready output directory. No
10
10
  `wrangler.json`, no adapter packages in your `package.json`, no generated config
11
11
  files in your tree — all of that happens in an ephemeral build workspace.
12
12
 
13
- This is the same engine the Webflow CLI and Webflow Cloud's server-side builder
14
- use, so a build is identical wherever it runs.
15
-
16
- > **Status:** early. The public API and the host port seam below are stable; the
17
- > framework build pipeline is being extracted from the canonical
18
- > (cosmic-builder) implementation. `buildApp` throws `NotImplementedError` until
19
- > that lands.
13
+ > **Status:** early. The public API and the host port seam below are stable.
20
14
 
21
15
  ## Install
22
16
 
@@ -42,17 +36,38 @@ const result = await buildApp({
42
36
  console.log(result.framework, result.deploymentType, result.entrypointPath);
43
37
  ```
44
38
 
45
- ## Ports — running the same engine anywhere
46
-
47
- Everything environment-specific is injected, so the engine itself is pure build
48
- logic and stays public-safe (no auth, upload, secrets, or vendor SDKs baked in).
49
-
50
- | Port | Required | Default | Why a host overrides it |
51
- | ------------ | -------- | ----------------------------------------- | ---------------------------------------------------------------------- |
52
- | `logger` | yes | `consoleLogger` / `silentLogger` provided | route output into oclif spinners, ECS structured logs, etc. |
53
- | `runCommand` | yes | `nodeCommandRunner` provided | control/sandbox how `npm`, the framework build, and `wrangler` execute |
54
- | `telemetry` | no | `noopTelemetry` | wrap `dd-trace` so existing dashboards keep working |
55
- | `fs` | no | `nodeFileSystem` | plug in a virtual filesystem (e.g. browser-based agents) |
39
+ Hosts can supply an optional public `assetVersionToken` through `BuildOptions`
40
+ or `BuildContext`. Next.js emits it through `deploymentId`; Astro emits it through
41
+ the adapter's `client.assetQueryParams` as `?dpl=<token>`. The token must be URL-safe,
42
+ at most 128 characters, and must not start with `dpl_`. This requires Next.js
43
+ 14.1.4+ or Astro 5.15+. Existing callers without the input retain their framework
44
+ configuration. The token is public, not an authorization credential. Hosts
45
+ generate tokens and implement version-aware request routing. CSS `url()`
46
+ references may not carry the token.
47
+
48
+ Hosts that drive framework builders directly must await
49
+ `builder.validateInstalledDependencies()` after the final dependency install
50
+ and before executing the build command. `buildApp()` calls this hook automatically;
51
+ `getBuildCommand()` only returns the command and does not validate dependencies.
52
+
53
+ Known limitation: browser checks with Astro 5.18.2 and
54
+ `@astrojs/cloudflare` 12.6.13 found that stylesheet URLs carry the token, but
55
+ hydrated component entrypoints and their JavaScript imports do not. This occurs
56
+ at both `/` and `/app` mounts. The Astro 5.15+ requirement indicates API
57
+ availability, not complete asset coverage; Astro 5 token emission must not be
58
+ treated as full skew protection.
59
+
60
+ ## Ports — running the engine anywhere
61
+
62
+ Callers provide logging and command execution through the `ports` option.
63
+ Telemetry and filesystem operations have default implementations.
64
+
65
+ | Port | Required | Default | Purpose |
66
+ | ------------ | -------- | ----------------------------------------- | ---------------------------------------------------------------- |
67
+ | `logger` | yes | `consoleLogger` / `silentLogger` provided | Send build output to your application logs |
68
+ | `runCommand` | yes | `nodeCommandRunner` provided | Control how npm, framework builds, and Wrangler commands execute |
69
+ | `telemetry` | no | `noopTelemetry` | Connect build events and spans to your telemetry system |
70
+ | `fs` | no | `nodeFileSystem` | Supply filesystem operations through the filesystem port |
56
71
 
57
72
  ## `webflow.json`
58
73
 
@@ -75,8 +90,8 @@ pin it) and **bindings are declared here** rather than in `wrangler.json`:
75
90
  You declare the binding name (and, for R2/D1, the resource name) — Webflow Cloud
76
91
  provisions the resource and namespaces it per environment. KV ids / D1
77
92
  `database_id`s are assigned for you; omit them. Limits: up to 5 of each type; R2
78
- bucket names are lowercase alphanumeric + hyphens, ≤27 chars. (`vars` is not
79
- supported yet — it needs deployer support to propagate.)
93
+ bucket names are lowercase alphanumeric + hyphens, ≤27 chars. The `vars` field
94
+ is not supported.
80
95
 
81
96
  The deploy-contract fields (`contract_version`, `framework`, `deployment_type`,
82
97
  `entrypoint_path`, `skip_no_bundle`) are filled in by the build and validated
@@ -85,77 +100,11 @@ before output is produced.
85
100
 
86
101
  ## Development
87
102
 
88
- ```bash
89
- npm install # from the monorepo root
90
- npm test # jest
91
- npm run build # tsc → dist/
92
- npm run type-check
93
- ```
94
-
95
- ## How consumers resolve this package
96
-
97
- Two consumers build with this engine: the Webflow CLI (`apps/webflow-cli`, same
98
- monorepo) and the cosmic-builder image (`webflow/infrastructure`, a separate
99
- repo). Which copy of `@webflow/cloud-app` they load is decided by **where
100
- `npm install` ran**, not by how the code is bundled and not at runtime — a
101
- `require("@webflow/cloud-app")` just reads whatever `npm` put in `node_modules`.
102
-
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, e2e) | a symlink to `apps/webflow-cloud-app` | workspace (repo tree) |
108
- | cosmic-builder (separate repo) | the registry copy npm fetched | npm registry |
109
-
110
- - **Inside this monorepo the CLI always uses the workspace copy.**
111
- `apps/webflow-cloud-app` is a workspace member, so npm links it by name
112
- while the declared version matches — `apps/webflow-cli`
113
- depends on it at an exact pin equal to this package's version (enforced in CI
114
- by `npm run check:cloud-app-pin`; a mismatched pin would make npm silently
115
- install the registry copy instead). Edit the source here and it takes effect on
116
- the next build.
117
- - **The published CLI uses the registry copy.** The engine is kept external in
118
- the CLI's tsup bundle (it is CJS, not inlined), so the shipped `dist` keeps
119
- `require("@webflow/cloud-app")` and resolves it at the user's install time.
120
- The CLI's `package.json` carries an exact pin (not a caret, since this is a
121
- prerelease line the CLI is built and tested against), so released builds
122
- resolve exactly that version from npm.
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 (below) still
125
- matters even though the CLI links the workspace in development.
126
-
127
- ## Publishing
128
-
129
- Published **manually** from this folder — there is no GitHub Action. Its release
130
- cadence follows the build engine, not the CLI. It is a regular changesets
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`):
103
+ From the repository root:
142
104
 
143
105
  ```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
106
+ npm ci
107
+ npm test --workspace=@webflow/cloud-app
108
+ npm run build --workspace=@webflow/cloud-app
109
+ npm run type-check --workspace=@webflow/cloud-app
149
110
  ```
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`.
@@ -0,0 +1,9 @@
1
+ /** Hosts check this before requesting versioned framework output from a release. */
2
+ export declare const ASSET_VERSION_TOKEN_SUPPORT = 1;
3
+ /** Typed host input wins over customer/process env during template rendering. */
4
+ export declare function assetVersionTemplateEnvironment(token: string | undefined): {
5
+ WEBFLOW_ASSET_VERSION_TOKEN: string;
6
+ };
7
+ /** Run after dependency installation; older frameworks silently ignore this input. */
8
+ export declare function assertAssetVersionFrameworkSupport(token: string | undefined, framework: 'nextjs' | 'astro', cwd: string): void;
9
+ //# sourceMappingURL=assetVersionToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetVersionToken.d.ts","sourceRoot":"","sources":["../src/assetVersionToken.ts"],"names":[],"mappings":"AAKA,oFAAoF;AACpF,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAS7C,iFAAiF;AACjF,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG;IAC1E,2BAA2B,EAAE,MAAM,CAAC;CACrC,CAEA;AAED,sFAAsF;AACtF,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,QAAQ,GAAG,OAAO,EAC7B,GAAG,EAAE,MAAM,GACV,IAAI,CAaN"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ASSET_VERSION_TOKEN_SUPPORT = void 0;
7
+ exports.assetVersionTemplateEnvironment = assetVersionTemplateEnvironment;
8
+ exports.assertAssetVersionFrameworkSupport = assertAssetVersionFrameworkSupport;
9
+ const zod_1 = require("zod");
10
+ const node_fs_1 = __importDefault(require("node:fs"));
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const semver_1 = require("semver");
13
+ /** Hosts check this before requesting versioned framework output from a release. */
14
+ exports.ASSET_VERSION_TOKEN_SUPPORT = 1;
15
+ const tokenSchema = zod_1.z
16
+ .string()
17
+ .min(1)
18
+ .max(128)
19
+ .regex(/^[A-Za-z0-9_-]+$/)
20
+ .refine((token) => !token.startsWith('dpl_'), 'The dpl_ prefix is reserved');
21
+ /** Typed host input wins over customer/process env during template rendering. */
22
+ function assetVersionTemplateEnvironment(token) {
23
+ return { WEBFLOW_ASSET_VERSION_TOKEN: token === undefined ? '' : tokenSchema.parse(token) };
24
+ }
25
+ /** Run after dependency installation; older frameworks silently ignore this input. */
26
+ function assertAssetVersionFrameworkSupport(token, framework, cwd) {
27
+ if (token === undefined)
28
+ return;
29
+ const packageName = framework === 'nextjs' ? 'next' : 'astro';
30
+ const installed = zod_1.z
31
+ .object({ version: zod_1.z.string() })
32
+ .parse(JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(cwd, 'node_modules', packageName, 'package.json'), 'utf8')));
33
+ const supported = framework === 'nextjs' ? '>=14.1.4' : '>=5.15.0';
34
+ if (!(0, semver_1.satisfies)(installed.version, supported, { includePrerelease: true }))
35
+ throw new Error(`Asset version tokens require ${framework} ${supported}`);
36
+ }
37
+ //# sourceMappingURL=assetVersionToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetVersionToken.js","sourceRoot":"","sources":["../src/assetVersionToken.ts"],"names":[],"mappings":";;;;;;AAgBA,0EAIC;AAGD,gFAiBC;AAxCD,6BAAwB;AACxB,sDAAyB;AACzB,0DAA6B;AAC7B,mCAAmC;AAEnC,oFAAoF;AACvE,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAE7C,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,kBAAkB,CAAC;KACzB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,6BAA6B,CAAC,CAAC;AAE/E,iFAAiF;AACjF,SAAgB,+BAA+B,CAAC,KAAyB;IAGvE,OAAO,EAAE,2BAA2B,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;AAC9F,CAAC;AAED,sFAAsF;AACtF,SAAgB,kCAAkC,CAChD,KAAyB,EACzB,SAA6B,EAC7B,GAAW;IAEX,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,MAAM,WAAW,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9D,MAAM,SAAS,GAAG,OAAC;SAChB,MAAM,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC;SAC/B,KAAK,CACJ,IAAI,CAAC,KAAK,CACR,iBAAE,CAAC,YAAY,CAAC,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CACrF,CACF,CAAC;IAC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I,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; these only satisfy the
29
- // build-phase wrangler schema + `wrangler deploy --dry-run`.
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
@@ -1 +1 @@
1
- {"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":";;;AAwDA,sCAGC;AAGD,wCAGC;AAGD,oDAgBC;AAGD,4CAmBC;AAeD,wDAsBC;AA/ID;;;;;;;;;;;;;;GAcG;AACH,6BAAwB;AAExB,gDAA2D;AAG3D,uEAAuE;AAC1D,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAEvC,yEAAyE;AACzE,6DAA6D;AAC7D,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACzC,MAAM,iBAAiB,GAAG,sCAAsC,CAAC;AAEjE,gFAAgF;AAChF,wEAAwE;AAC3D,QAAA,eAAe,GAAG,OAAC;KAC7B,MAAM,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC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AAI,iBAAiB;SAC9B,CAAC,CAAC;QACH,UAAU,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1C,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,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"}
@@ -24,16 +24,16 @@ export declare const PackageJsonSchema: z.ZodObject<{
24
24
  node: z.ZodOptional<z.ZodUnknown>;
25
25
  }, z.ZodTypeAny, "passthrough">>>;
26
26
  }, "strip", z.ZodTypeAny, {
27
- name?: string | undefined;
28
27
  version?: string | undefined;
28
+ name?: string | undefined;
29
29
  dependencies?: Record<string, string> | undefined;
30
30
  devDependencies?: Record<string, string> | undefined;
31
31
  engines?: z.objectOutputType<{
32
32
  node: z.ZodOptional<z.ZodUnknown>;
33
33
  }, z.ZodTypeAny, "passthrough"> | undefined;
34
34
  }, {
35
- name?: string | undefined;
36
35
  version?: string | undefined;
36
+ name?: string | undefined;
37
37
  dependencies?: Record<string, string> | undefined;
38
38
  devDependencies?: Record<string, string> | undefined;
39
39
  engines?: z.objectInputType<{
@@ -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,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AC,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
- * `ensureFixedCloudflareAdapter` forces a fixed adapter, which is what keeps this nearly
24
- * unreachable. It is reachable through a non-semver adapter spec (git URL, `file:`, alias) or a
25
- * cross-major pin the forced upgrade leaves alone.
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
- * `ensureFixedCloudflareAdapter` forces a fixed adapter, which is what keeps this nearly
96
- * unreachable. It is reachable through a non-semver adapter spec (git URL, `file:`, alias) or a
97
- * cross-major pin the forced upgrade leaves alone.
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"}
@@ -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"}