@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.
Files changed (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -0
  3. package/dist/bindings.d.ts +185 -0
  4. package/dist/bindings.d.ts.map +1 -0
  5. package/dist/bindings.js +120 -0
  6. package/dist/bindings.js.map +1 -0
  7. package/dist/config/package-json.d.ts +57 -0
  8. package/dist/config/package-json.d.ts.map +1 -0
  9. package/dist/config/package-json.js +94 -0
  10. package/dist/config/package-json.js.map +1 -0
  11. package/dist/config/webflow-json.d.ts +53 -0
  12. package/dist/config/webflow-json.d.ts.map +1 -0
  13. package/dist/config/webflow-json.js +72 -0
  14. package/dist/config/webflow-json.js.map +1 -0
  15. package/dist/create-webflow-json.d.ts +24 -0
  16. package/dist/create-webflow-json.d.ts.map +1 -0
  17. package/dist/create-webflow-json.js +170 -0
  18. package/dist/create-webflow-json.js.map +1 -0
  19. package/dist/errors.d.ts +13 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/errors.js +23 -0
  22. package/dist/errors.js.map +1 -0
  23. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts +36 -0
  24. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.d.ts.map +1 -0
  25. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js +94 -0
  26. package/dist/frameworks/astro/adapter-patches/ensure-fixed-cloudflare-adapter.js.map +1 -0
  27. package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.d.ts +2 -0
  28. package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.d.ts.map +1 -0
  29. package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.js +97 -0
  30. package/dist/frameworks/astro/adapter-patches/strip-cloudflare-base-nesting.js.map +1 -0
  31. package/dist/frameworks/astro/astro5.d.ts +28 -0
  32. package/dist/frameworks/astro/astro5.d.ts.map +1 -0
  33. package/dist/frameworks/astro/astro5.js +259 -0
  34. package/dist/frameworks/astro/astro5.js.map +1 -0
  35. package/dist/frameworks/astro/astro6.d.ts +28 -0
  36. package/dist/frameworks/astro/astro6.d.ts.map +1 -0
  37. package/dist/frameworks/astro/astro6.js +286 -0
  38. package/dist/frameworks/astro/astro6.js.map +1 -0
  39. package/dist/frameworks/astro/astro7.d.ts +28 -0
  40. package/dist/frameworks/astro/astro7.d.ts.map +1 -0
  41. package/dist/frameworks/astro/astro7.js +283 -0
  42. package/dist/frameworks/astro/astro7.js.map +1 -0
  43. package/dist/frameworks/astro/index.d.ts +10 -0
  44. package/dist/frameworks/astro/index.d.ts.map +1 -0
  45. package/dist/frameworks/astro/index.js +16 -0
  46. package/dist/frameworks/astro/index.js.map +1 -0
  47. package/dist/frameworks/astro/templates/astro.config.webflow.ts +61 -0
  48. package/dist/frameworks/astro/templates/v5/astro.config.mjs.template +25 -0
  49. package/dist/frameworks/astro/templates/v5/webflow-loader.ts +103 -0
  50. package/dist/frameworks/astro/templates/v5/wrangler.json +6 -0
  51. package/dist/frameworks/astro/templates/v6/astro.config.mjs.template +35 -0
  52. package/dist/frameworks/astro/templates/v6/webflow-loader.ts +112 -0
  53. package/dist/frameworks/astro/templates/v6/wrangler.json +9 -0
  54. package/dist/frameworks/astro/templates/v7/astro.config.mjs.template +34 -0
  55. package/dist/frameworks/astro/templates/v7/webflow-loader.ts +113 -0
  56. package/dist/frameworks/astro/templates/v7/wrangler.json +9 -0
  57. package/dist/frameworks/base.d.ts +134 -0
  58. package/dist/frameworks/base.d.ts.map +1 -0
  59. package/dist/frameworks/base.js +175 -0
  60. package/dist/frameworks/base.js.map +1 -0
  61. package/dist/frameworks/errors.d.ts +72 -0
  62. package/dist/frameworks/errors.d.ts.map +1 -0
  63. package/dist/frameworks/errors.js +120 -0
  64. package/dist/frameworks/errors.js.map +1 -0
  65. package/dist/frameworks/nextjs/adapter-resolver.d.ts +72 -0
  66. package/dist/frameworks/nextjs/adapter-resolver.d.ts.map +1 -0
  67. package/dist/frameworks/nextjs/adapter-resolver.js +246 -0
  68. package/dist/frameworks/nextjs/adapter-resolver.js.map +1 -0
  69. package/dist/frameworks/nextjs/index.d.ts +38 -0
  70. package/dist/frameworks/nextjs/index.d.ts.map +1 -0
  71. package/dist/frameworks/nextjs/index.js +268 -0
  72. package/dist/frameworks/nextjs/index.js.map +1 -0
  73. package/dist/frameworks/nextjs/templates/next.config.ts.template +13 -0
  74. package/dist/frameworks/nextjs/templates/next.config.webflow.ts +46 -0
  75. package/dist/frameworks/nextjs/templates/open-next.config.ts +3 -0
  76. package/dist/frameworks/nextjs/templates/webflow-loader.ts +44 -0
  77. package/dist/frameworks/nextjs/templates/wrangler.json +6 -0
  78. package/dist/frameworks/registry.d.ts +127 -0
  79. package/dist/frameworks/registry.d.ts.map +1 -0
  80. package/dist/frameworks/registry.js +257 -0
  81. package/dist/frameworks/registry.js.map +1 -0
  82. package/dist/frameworks/static/index.d.ts +93 -0
  83. package/dist/frameworks/static/index.d.ts.map +1 -0
  84. package/dist/frameworks/static/index.js +352 -0
  85. package/dist/frameworks/static/index.js.map +1 -0
  86. package/dist/frameworks/static/templates/wrangler.json +7 -0
  87. package/dist/frameworks/types.d.ts +138 -0
  88. package/dist/frameworks/types.d.ts.map +1 -0
  89. package/dist/frameworks/types.js +3 -0
  90. package/dist/frameworks/types.js.map +1 -0
  91. package/dist/frameworks/vite/index.d.ts +46 -0
  92. package/dist/frameworks/vite/index.d.ts.map +1 -0
  93. package/dist/frameworks/vite/index.js +303 -0
  94. package/dist/frameworks/vite/index.js.map +1 -0
  95. package/dist/frameworks/vite/templates/vite.config.ts.template +14 -0
  96. package/dist/frameworks/vite/templates/vite.config.webflow.ts +52 -0
  97. package/dist/frameworks/vite/templates/wrangler.json +10 -0
  98. package/dist/index.d.ts +44 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +118 -0
  101. package/dist/index.js.map +1 -0
  102. package/dist/pipeline.d.ts +8 -0
  103. package/dist/pipeline.d.ts.map +1 -0
  104. package/dist/pipeline.js +263 -0
  105. package/dist/pipeline.js.map +1 -0
  106. package/dist/ports/command-runner.d.ts +60 -0
  107. package/dist/ports/command-runner.d.ts.map +1 -0
  108. package/dist/ports/command-runner.js +116 -0
  109. package/dist/ports/command-runner.js.map +1 -0
  110. package/dist/ports/filesystem.d.ts +19 -0
  111. package/dist/ports/filesystem.d.ts.map +1 -0
  112. package/dist/ports/filesystem.js +68 -0
  113. package/dist/ports/filesystem.js.map +1 -0
  114. package/dist/ports/index.d.ts +17 -0
  115. package/dist/ports/index.d.ts.map +1 -0
  116. package/dist/ports/index.js +14 -0
  117. package/dist/ports/index.js.map +1 -0
  118. package/dist/ports/logger.d.ts +22 -0
  119. package/dist/ports/logger.d.ts.map +1 -0
  120. package/dist/ports/logger.js +18 -0
  121. package/dist/ports/logger.js.map +1 -0
  122. package/dist/ports/telemetry.d.ts +23 -0
  123. package/dist/ports/telemetry.d.ts.map +1 -0
  124. package/dist/ports/telemetry.js +12 -0
  125. package/dist/ports/telemetry.js.map +1 -0
  126. package/dist/toolchain/errors.d.ts +32 -0
  127. package/dist/toolchain/errors.d.ts.map +1 -0
  128. package/dist/toolchain/errors.js +31 -0
  129. package/dist/toolchain/errors.js.map +1 -0
  130. package/dist/toolchain/resolver.d.ts +25 -0
  131. package/dist/toolchain/resolver.d.ts.map +1 -0
  132. package/dist/toolchain/resolver.js +200 -0
  133. package/dist/toolchain/resolver.js.map +1 -0
  134. package/dist/toolchain/types.d.ts +52 -0
  135. package/dist/toolchain/types.d.ts.map +1 -0
  136. package/dist/toolchain/types.js +10 -0
  137. package/dist/toolchain/types.js.map +1 -0
  138. package/dist/types.d.ts +66 -0
  139. package/dist/types.d.ts.map +1 -0
  140. package/dist/types.js +3 -0
  141. package/dist/types.js.map +1 -0
  142. package/dist/utils/fs.d.ts +29 -0
  143. package/dist/utils/fs.d.ts.map +1 -0
  144. package/dist/utils/fs.js +126 -0
  145. package/dist/utils/fs.js.map +1 -0
  146. package/dist/utils/index.d.ts +11 -0
  147. package/dist/utils/index.d.ts.map +1 -0
  148. package/dist/utils/index.js +27 -0
  149. package/dist/utils/index.js.map +1 -0
  150. package/dist/utils/node-version.d.ts +20 -0
  151. package/dist/utils/node-version.d.ts.map +1 -0
  152. package/dist/utils/node-version.js +113 -0
  153. package/dist/utils/node-version.js.map +1 -0
  154. package/dist/utils/process.d.ts +25 -0
  155. package/dist/utils/process.d.ts.map +1 -0
  156. package/dist/utils/process.js +40 -0
  157. package/dist/utils/process.js.map +1 -0
  158. package/dist/utils/reserved-env.d.ts +26 -0
  159. package/dist/utils/reserved-env.d.ts.map +1 -0
  160. package/dist/utils/reserved-env.js +51 -0
  161. package/dist/utils/reserved-env.js.map +1 -0
  162. package/dist/utils/template.d.ts +15 -0
  163. package/dist/utils/template.d.ts.map +1 -0
  164. package/dist/utils/template.js +75 -0
  165. package/dist/utils/template.js.map +1 -0
  166. package/dist/utils/version.d.ts +9 -0
  167. package/dist/utils/version.d.ts.map +1 -0
  168. package/dist/utils/version.js +52 -0
  169. package/dist/utils/version.js.map +1 -0
  170. package/dist/wrangler.d.ts +192 -0
  171. package/dist/wrangler.d.ts.map +1 -0
  172. package/dist/wrangler.js +246 -0
  173. package/dist/wrangler.js.map +1 -0
  174. package/package.json +47 -0
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /**
3
+ * Custom error types for framework builders.
4
+ *
5
+ * These errors carry remediation hints, documentation links, and
6
+ * framework-specific context so hosts can render actionable failures.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FrameworkDetectionError = exports.FrameworkConfigError = exports.FrameworkBuildError = exports.FrameworkValidationError = exports.FrameworkError = void 0;
10
+ /**
11
+ * Base error for all framework-related errors.
12
+ * Includes optional remediation hints and documentation links.
13
+ */
14
+ class FrameworkError extends Error {
15
+ remediation;
16
+ documentationUrl;
17
+ cause;
18
+ constructor(message, options) {
19
+ super(message);
20
+ this.name = 'FrameworkError';
21
+ this.cause = options?.cause;
22
+ this.remediation = options?.remediation;
23
+ this.documentationUrl = options?.documentationUrl;
24
+ // Maintains proper stack trace for where error was thrown (V8 engines)
25
+ if (Error.captureStackTrace) {
26
+ Error.captureStackTrace(this, this.constructor);
27
+ }
28
+ }
29
+ /**
30
+ * Format the error for display, including remediation if available.
31
+ */
32
+ toDisplayString() {
33
+ let result = this.message;
34
+ if (this.remediation) {
35
+ result += `\n\nHow to fix: ${this.remediation}`;
36
+ }
37
+ if (this.documentationUrl) {
38
+ result += `\n\nDocumentation: ${this.documentationUrl}`;
39
+ }
40
+ return result;
41
+ }
42
+ }
43
+ exports.FrameworkError = FrameworkError;
44
+ // ─────────────────────────────────────────────────────────────────────────────
45
+ // Validation Error
46
+ // ─────────────────────────────────────────────────────────────────────────────
47
+ /**
48
+ * Thrown when project validation fails.
49
+ *
50
+ * Examples:
51
+ * - Wrong Node.js version
52
+ * - Missing required dependencies
53
+ * - Invalid configuration
54
+ * - Unsupported framework version
55
+ */
56
+ class FrameworkValidationError extends FrameworkError {
57
+ constructor(message, options) {
58
+ super(message, options);
59
+ this.name = 'FrameworkValidationError';
60
+ }
61
+ }
62
+ exports.FrameworkValidationError = FrameworkValidationError;
63
+ /**
64
+ * Thrown when the build command fails.
65
+ * Includes framework-specific debugging hints.
66
+ */
67
+ class FrameworkBuildError extends FrameworkError {
68
+ buildCommand;
69
+ constructor(message, options) {
70
+ super(message, options);
71
+ this.name = 'FrameworkBuildError';
72
+ this.buildCommand = options?.buildCommand;
73
+ }
74
+ toDisplayString() {
75
+ let result = super.toDisplayString();
76
+ if (this.buildCommand) {
77
+ result += `\n\nBuild command: ${this.buildCommand}`;
78
+ }
79
+ return result;
80
+ }
81
+ }
82
+ exports.FrameworkBuildError = FrameworkBuildError;
83
+ /**
84
+ * Thrown when configuration is invalid or cannot be processed.
85
+ *
86
+ * Examples:
87
+ * - Malformed astro.config.mjs
88
+ * - Invalid wrangler.json
89
+ * - Missing required config fields
90
+ */
91
+ class FrameworkConfigError extends FrameworkError {
92
+ configFile;
93
+ constructor(message, options) {
94
+ super(message, options);
95
+ this.name = 'FrameworkConfigError';
96
+ this.configFile = options?.configFile;
97
+ }
98
+ toDisplayString() {
99
+ let result = super.toDisplayString();
100
+ if (this.configFile) {
101
+ result += `\n\nConfig file: ${this.configFile}`;
102
+ }
103
+ return result;
104
+ }
105
+ }
106
+ exports.FrameworkConfigError = FrameworkConfigError;
107
+ // ─────────────────────────────────────────────────────────────────────────────
108
+ // Detection Error
109
+ // ─────────────────────────────────────────────────────────────────────────────
110
+ /**
111
+ * Thrown when framework cannot be detected.
112
+ */
113
+ class FrameworkDetectionError extends FrameworkError {
114
+ constructor(message, options) {
115
+ super(message, options);
116
+ this.name = 'FrameworkDetectionError';
117
+ }
118
+ }
119
+ exports.FrameworkDetectionError = FrameworkDetectionError;
120
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/frameworks/errors.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAYH;;;GAGG;AACH,MAAa,cAAe,SAAQ,KAAK;IACvB,WAAW,CAAU;IACrB,gBAAgB,CAAU;IACjB,KAAK,CAAW;IAEzC,YAAY,OAAe,EAAE,OAA+B;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,OAAO,EAAE,gBAAgB,CAAC;QAElD,uEAAuE;QACvE,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,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AE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;IACxC,CAAC;IAEQ,eAAe;QACtB,IAAI,MAAM,GAAG,KAAK,CAAC,eAAe,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM,IAAI,oBAAoB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAhBD,oDAgBC;AAED,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF;;GAEG;AACH,MAAa,uBAAwB,SAAQ,cAAc;IACzD,YAAY,OAAe,EAAE,OAA+B;QAC1D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AALD,0DAKC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Cloudflare adapter version resolution for Next.js.
3
+ *
4
+ * `@opennextjs/cloudflare` declares a `next` peer dependency whose range moves
5
+ * with each release and sometimes carves out "dead zones" — Next.js versions
6
+ * that are newer than an old floor but excluded by a tighter upper bound (e.g.
7
+ * peer `>=15.5.18 <16 || >=16.2.6` excludes next@16.0.0–16.2.5). Installing the
8
+ * adapter with no version constraint always pulls the latest, so an app pinned
9
+ * inside a dead zone fails with a cryptic npm `ERESOLVE` before the build even
10
+ * starts.
11
+ *
12
+ * This module resolves the concrete Next.js version the app will install and
13
+ * picks the highest published adapter release whose peer range accepts it,
14
+ * pinning that version explicitly. When the version cannot be determined it
15
+ * signals a fallback to the previous "install latest" behaviour; when no
16
+ * release is compatible it raises an actionable error instead of letting npm
17
+ * fail opaquely.
18
+ *
19
+ * All metadata is read through the app's own npm configuration (`npm view` run
20
+ * in the app directory), so adapter selection and the subsequent install
21
+ * resolve against the same registry, scoped registry, and auth.
22
+ */
23
+ import type { Logger } from '../../ports';
24
+ /** A published adapter version and the Next.js range it declares as a peer. */
25
+ export interface AdapterCandidate {
26
+ /** Concrete published version, e.g. "1.20.1". */
27
+ version: string;
28
+ /** Value of `peerDependencies.next`, or undefined if the version declares none. */
29
+ nextPeerRange?: string;
30
+ }
31
+ /**
32
+ * I/O the resolver depends on, injectable so unit tests can run without
33
+ * touching the network or the `npm` CLI. Both lookups take the app's `cwd` so
34
+ * they honor its npm configuration (registry, scoped registry, auth) — the same
35
+ * surface the subsequent install resolves against.
36
+ */
37
+ export interface AdapterResolverIO {
38
+ /** Fetch every published adapter version and its `next` peer range. */
39
+ fetchAdapterCandidates: (adapterName: string, cwd: string) => Promise<AdapterCandidate[]>;
40
+ /**
41
+ * Resolve a package.json version spec to the concrete Next.js version npm
42
+ * would install, or null when it cannot be determined (local/workspace/git
43
+ * specs, an empty spec, or no matching published version).
44
+ */
45
+ resolveInstalledNextVersion: (nextSpec: string, cwd: string) => Promise<string | null>;
46
+ }
47
+ /**
48
+ * Pick the highest stable adapter version whose declared `next` peer range is
49
+ * satisfied by `installedNext`.
50
+ *
51
+ * Versions that declare no `next` peer dependency are ignored: they predate the
52
+ * adapter pinning Next.js and silently installing one would mask a real
53
+ * incompatibility. Prerelease adapter versions are ignored too. Returns null
54
+ * when nothing matches.
55
+ */
56
+ export declare function selectAdapterVersion(installedNext: string, candidates: AdapterCandidate[]): string | null;
57
+ /**
58
+ * Resolve the adapter version to install for a project pinned to `nextSpec`,
59
+ * reading all metadata through the app's npm config at `cwd`.
60
+ *
61
+ * - Returns a concrete version string to pin when a compatible release exists.
62
+ * - Returns null when the Next.js version can't be determined or the metadata
63
+ * lookup fails — the caller should fall back to installing the latest adapter
64
+ * (the previous behaviour), which is no worse than before.
65
+ * - Throws {@link FrameworkValidationError} when the Next.js version is known
66
+ * but no published adapter release accepts it, surfacing a clear remediation
67
+ * instead of a downstream npm `ERESOLVE`.
68
+ */
69
+ export declare function resolveCompatibleAdapterVersion(log: Logger, adapterName: string, nextSpec: string, cwd: string, io?: AdapterResolverIO): Promise<string | null>;
70
+ /** Production I/O: `npm view` run in the app's cwd. */
71
+ export declare const defaultAdapterResolverIO: AdapterResolverIO;
72
+ //# sourceMappingURL=adapter-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-resolver.d.ts","sourceRoot":"","sources":["../../../src/frameworks/nextjs/adapter-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAc1C,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,uEAAuE;IACvE,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1F;;;;OAIG;IACH,2BAA2B,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,gBAAgB,EAAE,GAC7B,MAAM,GAAG,IAAI,CAaf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,EAAE,GAAE,iBAA4C,GAC/C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmDxB;AA2HD,uDAAuD;AACvD,eAAO,MAAM,wBAAwB,EAAE,iBAGtC,CAAC"}
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ /**
3
+ * Cloudflare adapter version resolution for Next.js.
4
+ *
5
+ * `@opennextjs/cloudflare` declares a `next` peer dependency whose range moves
6
+ * with each release and sometimes carves out "dead zones" — Next.js versions
7
+ * that are newer than an old floor but excluded by a tighter upper bound (e.g.
8
+ * peer `>=15.5.18 <16 || >=16.2.6` excludes next@16.0.0–16.2.5). Installing the
9
+ * adapter with no version constraint always pulls the latest, so an app pinned
10
+ * inside a dead zone fails with a cryptic npm `ERESOLVE` before the build even
11
+ * starts.
12
+ *
13
+ * This module resolves the concrete Next.js version the app will install and
14
+ * picks the highest published adapter release whose peer range accepts it,
15
+ * pinning that version explicitly. When the version cannot be determined it
16
+ * signals a fallback to the previous "install latest" behaviour; when no
17
+ * release is compatible it raises an actionable error instead of letting npm
18
+ * fail opaquely.
19
+ *
20
+ * All metadata is read through the app's own npm configuration (`npm view` run
21
+ * in the app directory), so adapter selection and the subsequent install
22
+ * resolve against the same registry, scoped registry, and auth.
23
+ */
24
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ var desc = Object.getOwnPropertyDescriptor(m, k);
27
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
28
+ desc = { enumerable: true, get: function() { return m[k]; } };
29
+ }
30
+ Object.defineProperty(o, k2, desc);
31
+ }) : (function(o, m, k, k2) {
32
+ if (k2 === undefined) k2 = k;
33
+ o[k2] = m[k];
34
+ }));
35
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
36
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
37
+ }) : function(o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar = (this && this.__importStar) || (function () {
41
+ var ownKeys = function(o) {
42
+ ownKeys = Object.getOwnPropertyNames || function (o) {
43
+ var ar = [];
44
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
45
+ return ar;
46
+ };
47
+ return ownKeys(o);
48
+ };
49
+ return function (mod) {
50
+ if (mod && mod.__esModule) return mod;
51
+ var result = {};
52
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
53
+ __setModuleDefault(result, mod);
54
+ return result;
55
+ };
56
+ })();
57
+ Object.defineProperty(exports, "__esModule", { value: true });
58
+ exports.defaultAdapterResolverIO = void 0;
59
+ exports.selectAdapterVersion = selectAdapterVersion;
60
+ exports.resolveCompatibleAdapterVersion = resolveCompatibleAdapterVersion;
61
+ const node_child_process_1 = require("node:child_process");
62
+ const node_util_1 = require("node:util");
63
+ const semver = __importStar(require("semver"));
64
+ const errors_1 = require("../errors");
65
+ const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
66
+ /**
67
+ * Generous stdout cap for `npm view`: the adapter's full metadata (one manifest
68
+ * per published version) is a few MB and grows as releases accumulate.
69
+ */
70
+ const NPM_MAX_BUFFER = 32 * 1024 * 1024;
71
+ /** The framework package the adapter declares as a peer dependency. */
72
+ const NEXT_PACKAGE = 'next';
73
+ /**
74
+ * Pick the highest stable adapter version whose declared `next` peer range is
75
+ * satisfied by `installedNext`.
76
+ *
77
+ * Versions that declare no `next` peer dependency are ignored: they predate the
78
+ * adapter pinning Next.js and silently installing one would mask a real
79
+ * incompatibility. Prerelease adapter versions are ignored too. Returns null
80
+ * when nothing matches.
81
+ */
82
+ function selectAdapterVersion(installedNext, candidates) {
83
+ const compatible = candidates
84
+ .filter((c) => c.nextPeerRange !== undefined)
85
+ .filter((c) => semver.valid(c.version) !== null && semver.prerelease(c.version) === null)
86
+ .filter((c) => semver.satisfies(installedNext, c.nextPeerRange, { includePrerelease: false }))
87
+ .map((c) => c.version);
88
+ if (compatible.length === 0) {
89
+ return null;
90
+ }
91
+ return compatible.sort(semver.rcompare)[0];
92
+ }
93
+ /**
94
+ * Resolve the adapter version to install for a project pinned to `nextSpec`,
95
+ * reading all metadata through the app's npm config at `cwd`.
96
+ *
97
+ * - Returns a concrete version string to pin when a compatible release exists.
98
+ * - Returns null when the Next.js version can't be determined or the metadata
99
+ * lookup fails — the caller should fall back to installing the latest adapter
100
+ * (the previous behaviour), which is no worse than before.
101
+ * - Throws {@link FrameworkValidationError} when the Next.js version is known
102
+ * but no published adapter release accepts it, surfacing a clear remediation
103
+ * instead of a downstream npm `ERESOLVE`.
104
+ */
105
+ async function resolveCompatibleAdapterVersion(log, adapterName, nextSpec, cwd, io = exports.defaultAdapterResolverIO) {
106
+ let installedNext;
107
+ try {
108
+ installedNext = await io.resolveInstalledNextVersion(nextSpec, cwd);
109
+ }
110
+ catch (err) {
111
+ log.warn(`Could not determine the Next.js version from "${nextSpec}" (${errorMessage(err)}); ` +
112
+ `installing the latest ${adapterName}.`);
113
+ return null;
114
+ }
115
+ if (installedNext === null || semver.prerelease(installedNext) !== null) {
116
+ log.info(`Next.js version "${installedNext ?? nextSpec}" is unpinned, a prerelease, or local; ` +
117
+ `installing the latest ${adapterName}.`);
118
+ return null;
119
+ }
120
+ let candidates;
121
+ try {
122
+ candidates = await io.fetchAdapterCandidates(adapterName, cwd);
123
+ }
124
+ catch (err) {
125
+ log.warn(`Could not fetch ${adapterName} versions (${errorMessage(err)}); installing the latest.`);
126
+ return null;
127
+ }
128
+ const selected = selectAdapterVersion(installedNext, candidates);
129
+ if (selected !== null) {
130
+ log.info(`Resolved ${adapterName}@${selected} as compatible with next@${installedNext}.`);
131
+ return selected;
132
+ }
133
+ const supported = summarizeSupportedRanges(candidates);
134
+ // The build's top-level handler logs only `error.message`, so the actionable
135
+ // guidance must live in the message itself — not just in `remediation`.
136
+ throw new errors_1.FrameworkValidationError(`No ${adapterName} release is compatible with the installed Next.js version (next@${installedNext}). ` +
137
+ `Supported Next.js ranges: ${supported}. ` +
138
+ `Upgrade Next.js to a version within a supported range (e.g. the latest patch of your major), ` +
139
+ `or add a compatible ${adapterName} version to package.json.`, {
140
+ remediation: `Upgrade Next.js to a version within a supported range (for example, the latest patch of your major), ` +
141
+ `or add a compatible "${adapterName}" version to your package.json yourself.`,
142
+ documentationUrl: 'https://opennext.js.org/cloudflare',
143
+ });
144
+ }
145
+ /**
146
+ * Distinct `next` peer ranges across stable adapter releases, newest first,
147
+ * capped at a few entries — used to make the dead-zone error actionable.
148
+ */
149
+ function summarizeSupportedRanges(candidates) {
150
+ const seen = new Set();
151
+ const ranges = [];
152
+ const stable = candidates
153
+ .filter((c) => c.nextPeerRange !== undefined)
154
+ .filter((c) => semver.valid(c.version) !== null && semver.prerelease(c.version) === null)
155
+ .sort((a, b) => semver.rcompare(a.version, b.version));
156
+ for (const c of stable) {
157
+ const range = c.nextPeerRange;
158
+ if (!seen.has(range)) {
159
+ seen.add(range);
160
+ ranges.push(range);
161
+ }
162
+ }
163
+ return ranges.slice(0, 3).join('; ') || '(none published)';
164
+ }
165
+ function errorMessage(err) {
166
+ return err instanceof Error ? err.message : String(err);
167
+ }
168
+ /** Run `npm view <args> --json` in `cwd` and return the parsed JSON (or null). */
169
+ async function npmViewJson(args, cwd) {
170
+ const { stdout } = await execFileAsync('npm', ['view', ...args, '--json'], {
171
+ cwd,
172
+ maxBuffer: NPM_MAX_BUFFER,
173
+ });
174
+ const trimmed = stdout.trim();
175
+ return trimmed === '' ? null : JSON.parse(trimmed);
176
+ }
177
+ /**
178
+ * Read every published adapter version and its `next` peer range via `npm view`
179
+ * run in the app's `cwd`, so the metadata comes from the same registry/auth
180
+ * surface the install uses.
181
+ *
182
+ * `npm view <pkg>@>=0.0.0 --json` returns one manifest per published version
183
+ * (a single object when only one matches) with a stable shape — unlike
184
+ * field-filtered queries, whose JSON collapses to bare values when some versions
185
+ * omit the field. Each element redundantly carries the full packument, so the
186
+ * payload is a few MB; acceptable for this one-time, adapter-absent build step.
187
+ */
188
+ async function fetchAdapterCandidatesViaNpm(adapterName, cwd) {
189
+ const parsed = await npmViewJson([`${adapterName}@>=0.0.0`], cwd);
190
+ const manifests = Array.isArray(parsed)
191
+ ? parsed
192
+ : parsed !== null
193
+ ? [parsed]
194
+ : [];
195
+ const candidates = [];
196
+ for (const manifest of manifests) {
197
+ if (typeof manifest.version !== 'string') {
198
+ continue;
199
+ }
200
+ const nextPeerRange = manifest.peerDependencies?.[NEXT_PACKAGE];
201
+ candidates.push({
202
+ version: manifest.version,
203
+ nextPeerRange: typeof nextPeerRange === 'string' ? nextPeerRange : undefined,
204
+ });
205
+ }
206
+ return candidates;
207
+ }
208
+ /**
209
+ * Resolve the concrete Next.js version npm would install for `nextSpec`, using
210
+ * the app's npm config at `cwd`.
211
+ *
212
+ * Exact pins skip the network. Ranges (`^`, `~`, `>=`, …) and dist-tags
213
+ * (`latest`, `canary`) are resolved with `npm view`. Non-registry specs
214
+ * (`file:`, `link:`, `workspace:`, `git+…`) make `npm view` exit non-zero; the
215
+ * caller treats the rejection as "unresolvable" and falls back to installing
216
+ * the latest adapter.
217
+ */
218
+ async function resolveInstalledNextVersionViaNpm(nextSpec, cwd) {
219
+ const spec = nextSpec.trim();
220
+ if (spec === '') {
221
+ return null;
222
+ }
223
+ if (semver.valid(spec) !== null) {
224
+ return spec;
225
+ }
226
+ const parsed = await npmViewJson([`${NEXT_PACKAGE}@${spec}`, 'version'], cwd);
227
+ const list = Array.isArray(parsed)
228
+ ? parsed.filter((v) => typeof v === 'string')
229
+ : typeof parsed === 'string'
230
+ ? [parsed]
231
+ : [];
232
+ const valid = list.filter((v) => semver.valid(v) !== null);
233
+ if (valid.length === 0) {
234
+ return null;
235
+ }
236
+ // Mirror npm's default of installing the highest matching version, preferring
237
+ // a stable release over a prerelease when both match.
238
+ const stable = valid.filter((v) => semver.prerelease(v) === null);
239
+ return (stable.length > 0 ? stable : valid).sort(semver.rcompare)[0];
240
+ }
241
+ /** Production I/O: `npm view` run in the app's cwd. */
242
+ exports.defaultAdapterResolverIO = {
243
+ fetchAdapterCandidates: fetchAdapterCandidatesViaNpm,
244
+ resolveInstalledNextVersion: resolveInstalledNextVersionViaNpm,
245
+ };
246
+ //# sourceMappingURL=adapter-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-resolver.js","sourceRoot":"","sources":["../../../src/frameworks/nextjs/adapter-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDH,oDAgBC;AAcD,0EAyDC;AA5ID,2DAA8C;AAC9C,yCAAsC;AAEtC,+CAAiC;AAGjC,sCAAqD;AAErD,MAAM,aAAa,GAAG,IAAA,qBAAS,EAAC,6BAAQ,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAExC,uEAAuE;AACvE,MAAM,YAAY,GAAG,MAAM,CAAC;AA2B5B;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,aAAqB,EACrB,UAA8B;IAE9B,MAAM,UAAU,GAAG,UAAU;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,SAAS,CAAC;SAC5C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;SACxF,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACZ,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,aAAuB,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CACzF;SACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,UAAU,CAAC,I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CAAC;IACD,8EAA8E;IAC9E,sDAAsD;IACtD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAClE,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,uDAAuD;AAC1C,QAAA,wBAAwB,GAAsB;IACzD,sBAAsB,EAAE,4BAA4B;IACpD,2BAA2B,EAAE,iCAAiC;CAC/D,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { FrameworkBuilder } from '../base';
2
+ import type { BuildOutput, FrameworkInfo, PackageJson, WebflowJson, DetectionResult, AdapterPackage, IntegrationPackage, WebflowLoaderConfig, NodeVersionRequirement } from '../types';
3
+ export declare class NextJsBuilder extends FrameworkBuilder {
4
+ static frameworkName: string;
5
+ get info(): FrameworkInfo;
6
+ getFrameworkVersion(): string | undefined;
7
+ /**
8
+ * Detect if this is a Next.js project.
9
+ */
10
+ static detect(packageJson: PackageJson, webflowJson?: WebflowJson): DetectionResult;
11
+ validate(): Promise<void>;
12
+ getCloudflareAdapter(): AdapterPackage;
13
+ getRequiredIntegrations(): IntegrationPackage[];
14
+ installDependencies(): Promise<void>;
15
+ getWebflowLoader(): WebflowLoaderConfig;
16
+ getUserConfigPatterns(): string[];
17
+ getWranglerTemplatePath(): string;
18
+ getAdditionalConfigFiles(): string[];
19
+ /** Checks if open-next.config.ts exists. */
20
+ private findOpenNextConfig;
21
+ /**
22
+ * Ensures open-next.config.ts exists.
23
+ * - If it exists: leave it alone for opennextjs-cloudflare to validate.
24
+ * - If missing: create it from the template.
25
+ */
26
+ private ensureOpenNextConfig;
27
+ prepareConfig(): Promise<void>;
28
+ getBuildCommand(): string;
29
+ getNodeVersionRequirement(): NodeVersionRequirement | null;
30
+ static getOutputDeployMetadata(): BuildOutput;
31
+ /**
32
+ * Detect Next.js from built output: presence of `./worker.js` (the bundled
33
+ * entrypoint produced by `opennextjs-cloudflare build`). Mirrors the legacy
34
+ * fallback the deploy phase used to hardcode.
35
+ */
36
+ static detectFromBuiltOutput(cwd: string): boolean;
37
+ }
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frameworks/nextjs/index.ts"],"names":[],"mappings":"AAaA,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;AAQlB,qBAAa,aAAc,SAAQ,gBAAgB;IACjD,OAAgB,aAAa,SAAY;IAMzC,IAAI,IAAI,IAAI,aAAa,CAOxB;IAEQ,mBAAmB,IAAI,MAAM,GAAG,SAAS;IAQlD;;OAEG;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;IAStC,uBAAuB,IAAI,kBAAkB,EAAE;IAKzC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiC1C,gBAAgB,IAAI,mBAAmB;IAQvC,qBAAqB,IAAI,MAAM,EAAE;IAIjC,uBAAuB,IAAI,MAAM;IAIjC,wBAAwB,IAAI,MAAM,EAAE;IAKpC,4CAA4C;IAC5C,OAAO,CAAC,kBAAkB;IAQ1B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAwBtB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA6DpC,eAAe,IAAI,MAAM;IAIzB,yBAAyB,IAAI,sBAAsB,GAAG,IAAI;WAW1C,uBAAuB,IAAI,WAAW;IAUtD;;;;OAIG;WACa,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAG5D"}