@webflow/cloud-app 0.1.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +161 -0
  3. package/dist/bindings.d.ts +190 -0
  4. package/dist/bindings.d.ts.map +1 -0
  5. package/dist/bindings.js +126 -0
  6. package/dist/bindings.js.map +1 -0
  7. package/dist/compat-date.d.ts +68 -0
  8. package/dist/compat-date.d.ts.map +1 -0
  9. package/dist/compat-date.js +169 -0
  10. package/dist/compat-date.js.map +1 -0
  11. package/dist/config/package-json.d.ts +57 -0
  12. package/dist/config/package-json.d.ts.map +1 -0
  13. package/dist/config/package-json.js +94 -0
  14. package/dist/config/package-json.js.map +1 -0
  15. package/dist/config/webflow-json.d.ts +47 -0
  16. package/dist/config/webflow-json.d.ts.map +1 -0
  17. package/dist/config/webflow-json.js +72 -0
  18. package/dist/config/webflow-json.js.map +1 -0
  19. package/dist/create-webflow-json.d.ts +21 -0
  20. package/dist/create-webflow-json.d.ts.map +1 -0
  21. package/dist/create-webflow-json.js +168 -0
  22. package/dist/create-webflow-json.js.map +1 -0
  23. package/dist/diagnostics.d.ts +23 -0
  24. package/dist/diagnostics.d.ts.map +1 -0
  25. package/dist/diagnostics.js +31 -0
  26. package/dist/diagnostics.js.map +1 -0
  27. package/dist/errors.d.ts +13 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +23 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.d.ts +28 -0
  32. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.d.ts.map +1 -0
  33. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.js +148 -0
  34. package/dist/frameworks/astro/adapter-patches/assert-adapter-nested-under-mount.js.map +1 -0
  35. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts +34 -0
  36. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.d.ts.map +1 -0
  37. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js +89 -0
  38. package/dist/frameworks/astro/adapter-patches/ensure-compatible-cloudflare-adapter.js.map +1 -0
  39. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts +39 -0
  40. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.d.ts.map +1 -0
  41. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.js +93 -0
  42. package/dist/frameworks/astro/adapter-patches/resolve-cloudflare-adapter.js.map +1 -0
  43. package/dist/frameworks/astro/astro5.d.ts +28 -0
  44. package/dist/frameworks/astro/astro5.d.ts.map +1 -0
  45. package/dist/frameworks/astro/astro5.js +276 -0
  46. package/dist/frameworks/astro/astro5.js.map +1 -0
  47. package/dist/frameworks/astro/astro6.d.ts +28 -0
  48. package/dist/frameworks/astro/astro6.d.ts.map +1 -0
  49. package/dist/frameworks/astro/astro6.js +305 -0
  50. package/dist/frameworks/astro/astro6.js.map +1 -0
  51. package/dist/frameworks/astro/astro7.d.ts +28 -0
  52. package/dist/frameworks/astro/astro7.d.ts.map +1 -0
  53. package/dist/frameworks/astro/astro7.js +303 -0
  54. package/dist/frameworks/astro/astro7.js.map +1 -0
  55. package/dist/frameworks/astro/index.d.ts +10 -0
  56. package/dist/frameworks/astro/index.d.ts.map +1 -0
  57. package/dist/frameworks/astro/index.js +16 -0
  58. package/dist/frameworks/astro/index.js.map +1 -0
  59. package/dist/frameworks/astro/session-check.d.ts +24 -0
  60. package/dist/frameworks/astro/session-check.d.ts.map +1 -0
  61. package/dist/frameworks/astro/session-check.js +166 -0
  62. package/dist/frameworks/astro/session-check.js.map +1 -0
  63. package/dist/frameworks/astro/templates/astro.config.webflow.ts +61 -0
  64. package/dist/frameworks/astro/templates/v5/astro.config.mjs.template +25 -0
  65. package/dist/frameworks/astro/templates/v5/webflow-loader.ts +126 -0
  66. package/dist/frameworks/astro/templates/v5/wrangler.json +6 -0
  67. package/dist/frameworks/astro/templates/v6/astro.config.mjs.template +35 -0
  68. package/dist/frameworks/astro/templates/v6/webflow-loader.ts +126 -0
  69. package/dist/frameworks/astro/templates/v6/wrangler.json +9 -0
  70. package/dist/frameworks/astro/templates/v7/astro.config.mjs.template +34 -0
  71. package/dist/frameworks/astro/templates/v7/webflow-loader.ts +125 -0
  72. package/dist/frameworks/astro/templates/v7/wrangler.json +9 -0
  73. package/dist/frameworks/astro/templates/webflow-image-url.ts +140 -0
  74. package/dist/frameworks/base.d.ts +134 -0
  75. package/dist/frameworks/base.d.ts.map +1 -0
  76. package/dist/frameworks/base.js +175 -0
  77. package/dist/frameworks/base.js.map +1 -0
  78. package/dist/frameworks/errors.d.ts +72 -0
  79. package/dist/frameworks/errors.d.ts.map +1 -0
  80. package/dist/frameworks/errors.js +120 -0
  81. package/dist/frameworks/errors.js.map +1 -0
  82. package/dist/frameworks/nextjs/adapter-resolver.d.ts +72 -0
  83. package/dist/frameworks/nextjs/adapter-resolver.d.ts.map +1 -0
  84. package/dist/frameworks/nextjs/adapter-resolver.js +246 -0
  85. package/dist/frameworks/nextjs/adapter-resolver.js.map +1 -0
  86. package/dist/frameworks/nextjs/index.d.ts +38 -0
  87. package/dist/frameworks/nextjs/index.d.ts.map +1 -0
  88. package/dist/frameworks/nextjs/index.js +268 -0
  89. package/dist/frameworks/nextjs/index.js.map +1 -0
  90. package/dist/frameworks/nextjs/templates/next.config.ts.template +13 -0
  91. package/dist/frameworks/nextjs/templates/next.config.webflow.ts +46 -0
  92. package/dist/frameworks/nextjs/templates/open-next.config.ts +3 -0
  93. package/dist/frameworks/nextjs/templates/webflow-loader.ts +44 -0
  94. package/dist/frameworks/nextjs/templates/wrangler.json +6 -0
  95. package/dist/frameworks/registry.d.ts +127 -0
  96. package/dist/frameworks/registry.d.ts.map +1 -0
  97. package/dist/frameworks/registry.js +257 -0
  98. package/dist/frameworks/registry.js.map +1 -0
  99. package/dist/frameworks/static/index.d.ts +116 -0
  100. package/dist/frameworks/static/index.d.ts.map +1 -0
  101. package/dist/frameworks/static/index.js +394 -0
  102. package/dist/frameworks/static/index.js.map +1 -0
  103. package/dist/frameworks/static/templates/wrangler.json +8 -0
  104. package/dist/frameworks/types.d.ts +138 -0
  105. package/dist/frameworks/types.d.ts.map +1 -0
  106. package/dist/frameworks/types.js +3 -0
  107. package/dist/frameworks/types.js.map +1 -0
  108. package/dist/frameworks/vite/index.d.ts +46 -0
  109. package/dist/frameworks/vite/index.d.ts.map +1 -0
  110. package/dist/frameworks/vite/index.js +303 -0
  111. package/dist/frameworks/vite/index.js.map +1 -0
  112. package/dist/frameworks/vite/templates/vite.config.ts.template +14 -0
  113. package/dist/frameworks/vite/templates/vite.config.webflow.ts +52 -0
  114. package/dist/frameworks/vite/templates/wrangler.json +10 -0
  115. package/dist/index.d.ts +49 -0
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +136 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/pipeline.d.ts +12 -0
  120. package/dist/pipeline.d.ts.map +1 -0
  121. package/dist/pipeline.js +293 -0
  122. package/dist/pipeline.js.map +1 -0
  123. package/dist/ports/command-runner.d.ts +59 -0
  124. package/dist/ports/command-runner.d.ts.map +1 -0
  125. package/dist/ports/command-runner.js +126 -0
  126. package/dist/ports/command-runner.js.map +1 -0
  127. package/dist/ports/filesystem.d.ts +19 -0
  128. package/dist/ports/filesystem.d.ts.map +1 -0
  129. package/dist/ports/filesystem.js +68 -0
  130. package/dist/ports/filesystem.js.map +1 -0
  131. package/dist/ports/index.d.ts +17 -0
  132. package/dist/ports/index.d.ts.map +1 -0
  133. package/dist/ports/index.js +14 -0
  134. package/dist/ports/index.js.map +1 -0
  135. package/dist/ports/logger.d.ts +22 -0
  136. package/dist/ports/logger.d.ts.map +1 -0
  137. package/dist/ports/logger.js +18 -0
  138. package/dist/ports/logger.js.map +1 -0
  139. package/dist/ports/telemetry.d.ts +23 -0
  140. package/dist/ports/telemetry.d.ts.map +1 -0
  141. package/dist/ports/telemetry.js +12 -0
  142. package/dist/ports/telemetry.js.map +1 -0
  143. package/dist/static-base-href.d.ts +31 -0
  144. package/dist/static-base-href.d.ts.map +1 -0
  145. package/dist/static-base-href.js +183 -0
  146. package/dist/static-base-href.js.map +1 -0
  147. package/dist/toolchain/errors.d.ts +32 -0
  148. package/dist/toolchain/errors.d.ts.map +1 -0
  149. package/dist/toolchain/errors.js +31 -0
  150. package/dist/toolchain/errors.js.map +1 -0
  151. package/dist/toolchain/resolver.d.ts +25 -0
  152. package/dist/toolchain/resolver.d.ts.map +1 -0
  153. package/dist/toolchain/resolver.js +200 -0
  154. package/dist/toolchain/resolver.js.map +1 -0
  155. package/dist/toolchain/types.d.ts +52 -0
  156. package/dist/toolchain/types.d.ts.map +1 -0
  157. package/dist/toolchain/types.js +10 -0
  158. package/dist/toolchain/types.js.map +1 -0
  159. package/dist/types.d.ts +71 -0
  160. package/dist/types.d.ts.map +1 -0
  161. package/dist/types.js +3 -0
  162. package/dist/types.js.map +1 -0
  163. package/dist/utils/fs.d.ts +29 -0
  164. package/dist/utils/fs.d.ts.map +1 -0
  165. package/dist/utils/fs.js +126 -0
  166. package/dist/utils/fs.js.map +1 -0
  167. package/dist/utils/index.d.ts +11 -0
  168. package/dist/utils/index.d.ts.map +1 -0
  169. package/dist/utils/index.js +27 -0
  170. package/dist/utils/index.js.map +1 -0
  171. package/dist/utils/node-version.d.ts +20 -0
  172. package/dist/utils/node-version.d.ts.map +1 -0
  173. package/dist/utils/node-version.js +113 -0
  174. package/dist/utils/node-version.js.map +1 -0
  175. package/dist/utils/process.d.ts +25 -0
  176. package/dist/utils/process.d.ts.map +1 -0
  177. package/dist/utils/process.js +40 -0
  178. package/dist/utils/process.js.map +1 -0
  179. package/dist/utils/reserved-env.d.ts +26 -0
  180. package/dist/utils/reserved-env.d.ts.map +1 -0
  181. package/dist/utils/reserved-env.js +51 -0
  182. package/dist/utils/reserved-env.js.map +1 -0
  183. package/dist/utils/template.d.ts +15 -0
  184. package/dist/utils/template.d.ts.map +1 -0
  185. package/dist/utils/template.js +75 -0
  186. package/dist/utils/template.js.map +1 -0
  187. package/dist/utils/version.d.ts +9 -0
  188. package/dist/utils/version.d.ts.map +1 -0
  189. package/dist/utils/version.js +52 -0
  190. package/dist/utils/version.js.map +1 -0
  191. package/dist/wrangler.d.ts +195 -0
  192. package/dist/wrangler.d.ts.map +1 -0
  193. package/dist/wrangler.js +372 -0
  194. package/dist/wrangler.js.map +1 -0
  195. package/package.json +48 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Node runtime selection types.
3
+ *
4
+ * These are intentionally host-agnostic: the resolver determines what a
5
+ * project requests, while a host-provided runtime adapter decides how to make
6
+ * that version available.
7
+ */
8
+ /** The file or manifest field that selected the Node version. */
9
+ export type NodeVersionDeclarationSource = 'nvmrc' | 'node-version' | 'package-engines' | 'default';
10
+ /**
11
+ * Stable outcome of resolving a repository's Node declaration. Hosts can use
12
+ * this for telemetry and customer-facing behavior without matching warnings.
13
+ */
14
+ export type NodeToolchainResolution = 'declared' | 'default' | 'invalid' | 'unsupported' | 'unresolvable' | 'conflicting';
15
+ /** Node releases a host permits for customer builds. Values must be exact semver versions. */
16
+ export interface NodeToolchainPolicy {
17
+ /** Exact version used when the project does not declare one. */
18
+ defaultVersion: string;
19
+ /** Exact versions the host is prepared to provision. */
20
+ supportedVersions: readonly string[];
21
+ /** Exact supported releases the host designates as LTS. */
22
+ supportedLtsVersions: readonly string[];
23
+ }
24
+ /** The resolved, exact Node runtime a build should use. */
25
+ export interface ResolvedNodeToolchain {
26
+ declarationSource: NodeVersionDeclarationSource;
27
+ /** Raw version declaration from the repository, omitted when the host default is used. */
28
+ requestedVersion?: string;
29
+ /** Exact supported Node release selected for this build. */
30
+ resolvedVersion: string;
31
+ /** Machine-readable resolution outcome. */
32
+ resolution: NodeToolchainResolution;
33
+ /** Lower-priority sources that requested a different supported release. */
34
+ conflictingDeclarationSources?: readonly Exclude<NodeVersionDeclarationSource, 'default'>[];
35
+ /** Non-fatal information a host may choose to expose in build logs. */
36
+ warning?: string;
37
+ }
38
+ /** Environment and version returned by a host's provisioned Node runtime. */
39
+ export interface PreparedNodeRuntime {
40
+ /** Exact version that was provisioned and verified. */
41
+ version: string;
42
+ /** Environment that ensures `node` and `npm` resolve to this runtime. */
43
+ commandEnv: Record<string, string>;
44
+ }
45
+ /**
46
+ * Host-provided runtime implementation. `@webflow/cloud-app` never installs Node on
47
+ * its own; Cosmic can use NVM while other hosts provide a suitable adapter.
48
+ */
49
+ export interface NodeRuntimePort {
50
+ prepare(toolchain: ResolvedNodeToolchain): Promise<PreparedNodeRuntime>;
51
+ }
52
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/toolchain/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iEAAiE;AACjE,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG,cAAc,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAEpG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GACjC,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,cAAc,GAAG,aAAa,CAAC;AAEtF,8FAA8F;AAC9F,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,2DAA2D;IAC3D,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,EAAE,4BAA4B,CAAC;IAChD,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,UAAU,EAAE,uBAAuB,CAAC;IACpC,2EAA2E;IAC3E,6BAA6B,CAAC,EAAE,SAAS,OAAO,CAAC,4BAA4B,EAAE,SAAS,CAAC,EAAE,CAAC;IAC5F,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzE"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * Node runtime selection types.
4
+ *
5
+ * These are intentionally host-agnostic: the resolver determines what a
6
+ * project requests, while a host-provided runtime adapter decides how to make
7
+ * that version available.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/toolchain/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Public types for the build engine.
3
+ *
4
+ * Framework / deployment vocabulary is re-used from
5
+ * `@webflow/cosmic-deploy-contract` so there's a single source of truth shared
6
+ * with the deployer — the engine never re-declares these.
7
+ */
8
+ import type { Framework, DeploymentType, WebflowJsonV1 } from '@webflow/cosmic-deploy-contract';
9
+ import type { Logger, CommandRunner, Telemetry, FileSystemPort } from './ports';
10
+ /**
11
+ * Host-injected capabilities. `logger` and `runCommand` are required (every
12
+ * host has its own); `telemetry` and `fs` fall back to the no-op / node
13
+ * defaults when omitted.
14
+ */
15
+ export interface BuildPorts {
16
+ logger: Logger;
17
+ runCommand: CommandRunner;
18
+ telemetry?: Telemetry;
19
+ fs?: FileSystemPort;
20
+ }
21
+ export interface BuildOptions {
22
+ /** The user's project root. Treated as read-only — never mutated in place. */
23
+ projectDir: string;
24
+ /** Where the worker-ready output (entry + assets + webflow.json) is emitted. */
25
+ outputDir: string;
26
+ /**
27
+ * Ephemeral build directory. The project is copied here, mutated, and built,
28
+ * leaving `projectDir` pristine. Defaults to a fresh temp directory.
29
+ */
30
+ workspaceDir?: string;
31
+ /** URL mount path the app is served under (a.k.a. COSMIC_MOUNT_PATH). */
32
+ mountPath?: string;
33
+ /** Deploy URL, substituted into generated framework config where needed. */
34
+ deployUrl?: string;
35
+ /** Framework override; normally read from `webflow.json#cloud.framework`. */
36
+ frameworkHint?: Framework;
37
+ /**
38
+ * Settle the worker's `compatibility_date` at build and record it for the deploy (see
39
+ * compat-date.ts). Off by default: the template date is used unchanged.
40
+ */
41
+ compatDatePolicy?: boolean;
42
+ /** Extra environment variables made available to the build. */
43
+ env?: Record<string, string>;
44
+ /** Host-injected ports. */
45
+ ports: BuildPorts;
46
+ }
47
+ export interface BuildResult {
48
+ /** Detected framework (the contract's coarse vocabulary: astro | nextjs | vite). */
49
+ framework: Framework;
50
+ /** Deployment type the deployer uses to pick its wrangler template. */
51
+ deploymentType: DeploymentType;
52
+ /** Path to the bundled worker entry, relative to `outputDir`. */
53
+ entrypointPath: string;
54
+ /** The contract-validated webflow.json that was emitted. */
55
+ webflowJson: WebflowJsonV1;
56
+ /** Directory containing the worker entry, static assets, and webflow.json. */
57
+ outputDir: string;
58
+ }
59
+ export interface FrameworkDetection {
60
+ /** Detected framework (coarse vocabulary). */
61
+ framework: Framework;
62
+ /**
63
+ * Builder major when a framework ships incompatible majors the engine treats
64
+ * as distinct internally (e.g. Astro 5 vs 6). Undefined when not applicable.
65
+ */
66
+ major?: number;
67
+ /** Human-readable explanation of how it was detected, for logging. */
68
+ reason: string;
69
+ }
70
+ export type { Framework, DeploymentType, WebflowJsonV1 } from '@webflow/cosmic-deploy-contract';
71
+ //# sourceMappingURL=types.d.ts.map
@@ -0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IACjC,8CAA8C;IAC9C,SAAS,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import type { Logger } from '../ports';
2
+ export interface RecursiveCopyOptions {
3
+ /** Pattern(s) to exclude from copying (matched against the basename). */
4
+ exclude?: string | string[];
5
+ }
6
+ /**
7
+ * Recursively copy directory contents.
8
+ *
9
+ * @returns Number of files copied.
10
+ */
11
+ export declare function recursiveCopy(log: Logger, src: string, dest: string, options?: RecursiveCopyOptions): number;
12
+ /** Check if a file exists. */
13
+ export declare function fileExists(filePath: string): boolean;
14
+ /**
15
+ * Match a basename against a simple glob pattern where `*` matches any run of
16
+ * non-`/` characters. A pattern without `*` is an exact-name match. Used by the
17
+ * static builder's asset-exclusion policy.
18
+ */
19
+ export declare function matchesExcludePattern(name: string, pattern: string): boolean;
20
+ /**
21
+ * Rename a user config file to a `clouduser.*` prefix.
22
+ *
23
+ * Searches for a config file with the given base name and extensions, renaming
24
+ * the first found to `clouduser.{baseName}.{ext}`.
25
+ *
26
+ * @returns Path to the renamed file, or null if no config found.
27
+ */
28
+ export declare function renameUserConfig(log: Logger, cwd: string, baseName: string, extensions: string[]): string | null;
29
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CAqCR;AAED,8BAA8B;AAC9B,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAOD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAM5E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,GAAG,IAAI,CAWf"}
@@ -0,0 +1,126 @@
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.recursiveCopy = recursiveCopy;
37
+ exports.fileExists = fileExists;
38
+ exports.matchesExcludePattern = matchesExcludePattern;
39
+ exports.renameUserConfig = renameUserConfig;
40
+ /**
41
+ * Synchronous filesystem helpers used for in-workspace file manipulation
42
+ * (copying build artifacts, renaming user configs aside). These operate on the
43
+ * ephemeral workspace; workspace-level isolate/collect goes through the
44
+ * FileSystem port instead.
45
+ */
46
+ const fs = __importStar(require("node:fs"));
47
+ const path = __importStar(require("node:path"));
48
+ /**
49
+ * Recursively copy directory contents.
50
+ *
51
+ * @returns Number of files copied.
52
+ */
53
+ function recursiveCopy(log, src, dest, options) {
54
+ const excludePatterns = options?.exclude
55
+ ? Array.isArray(options.exclude)
56
+ ? options.exclude
57
+ : [options.exclude]
58
+ : [];
59
+ const baseName = path.basename(src);
60
+ if (excludePatterns.some((p) => baseName === p)) {
61
+ log.debug(`Skipping excluded: ${src}`);
62
+ return 0;
63
+ }
64
+ const stat = fs.statSync(src, { throwIfNoEntry: false });
65
+ if (!stat) {
66
+ log.debug(`Source does not exist: ${src}`);
67
+ return 0;
68
+ }
69
+ if (stat.isDirectory()) {
70
+ log.debug(`Copying directory: ${src} -> ${dest}`);
71
+ const contents = fs.readdirSync(src);
72
+ let count = 0;
73
+ for (const entry of contents) {
74
+ count += recursiveCopy(log, path.join(src, entry), path.join(dest, entry), options);
75
+ }
76
+ return count;
77
+ }
78
+ const destDir = path.dirname(dest);
79
+ if (!fs.existsSync(destDir)) {
80
+ fs.mkdirSync(destDir, { recursive: true });
81
+ }
82
+ log.debug(`Copying file: ${src} -> ${dest}`);
83
+ fs.copyFileSync(src, dest);
84
+ return 1;
85
+ }
86
+ /** Check if a file exists. */
87
+ function fileExists(filePath) {
88
+ return fs.existsSync(filePath);
89
+ }
90
+ /** Escape a string for safe embedding in a RegExp. */
91
+ function escapeRegExp(s) {
92
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
93
+ }
94
+ /**
95
+ * Match a basename against a simple glob pattern where `*` matches any run of
96
+ * non-`/` characters. A pattern without `*` is an exact-name match. Used by the
97
+ * static builder's asset-exclusion policy.
98
+ */
99
+ function matchesExcludePattern(name, pattern) {
100
+ if (!pattern.includes('*')) {
101
+ return name === pattern;
102
+ }
103
+ const escaped = pattern.split('*').map(escapeRegExp).join('[^/]*');
104
+ return new RegExp(`^${escaped}$`).test(name);
105
+ }
106
+ /**
107
+ * Rename a user config file to a `clouduser.*` prefix.
108
+ *
109
+ * Searches for a config file with the given base name and extensions, renaming
110
+ * the first found to `clouduser.{baseName}.{ext}`.
111
+ *
112
+ * @returns Path to the renamed file, or null if no config found.
113
+ */
114
+ function renameUserConfig(log, cwd, baseName, extensions) {
115
+ for (const ext of extensions) {
116
+ const from = path.join(cwd, `${baseName}.${ext}`);
117
+ if (fs.existsSync(from)) {
118
+ const to = path.join(cwd, `clouduser.${baseName}.${ext}`);
119
+ log.info(`Renaming user config: ${baseName}.${ext} -> clouduser.${baseName}.${ext}`);
120
+ fs.renameSync(from, to);
121
+ return to;
122
+ }
123
+ }
124
+ return null;
125
+ }
126
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,sCA0CC;AAGD,gCAEC;AAYD,sDAMC;AAUD,4CAgBC;AAhHD;;;;;GAKG;AACH,4CAA8B;AAC9B,gDAAkC;AASlC;;;;GAIG;AAC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;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,IAAI,GAAG,EAAE,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,QAAQ,IAAI,GAAG,EAAE,CAAC,CAAC;YAC1D,GAAG,CAAC,IAAI,CAAC,yBAAyB,QAAQ,IAAI,GAAG,iBAAiB,QAAQ,IAAI,GAAG,EAAE,CAAC,CAAC;YACrF,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Utility barrel. Builders import helpers from here (`../../utils`), matching
3
+ * the cosmic-builder layout so the cloned builder tests can mock this module.
4
+ */
5
+ export * from './version';
6
+ export * from './node-version';
7
+ export * from './reserved-env';
8
+ export * from './fs';
9
+ export * from './template';
10
+ export * from './process';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,27 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Utility barrel. Builders import helpers from here (`../../utils`), matching
19
+ * the cosmic-builder layout so the cloned builder tests can mock this module.
20
+ */
21
+ __exportStar(require("./version"), exports);
22
+ __exportStar(require("./node-version"), exports);
23
+ __exportStar(require("./reserved-env"), exports);
24
+ __exportStar(require("./fs"), exports);
25
+ __exportStar(require("./template"), exports);
26
+ __exportStar(require("./process"), exports);
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,4CAA0B;AAC1B,iDAA+B;AAC/B,iDAA+B;AAC/B,uCAAqB;AACrB,6CAA2B;AAC3B,4CAA0B"}
@@ -0,0 +1,20 @@
1
+ import type { Logger } from '../ports';
2
+ import type { NodeVersionRequirement } from '../frameworks/types';
3
+ /** Get the current Node.js version string (without the 'v' prefix). */
4
+ export declare function getCurrentNodeVersion(): string;
5
+ /** Get the major version from a version string using semver.coerce. */
6
+ export declare function getNodeMajorVersion(version: string): number | null;
7
+ /** Compare two version strings. -1 if a<b, 0 if a==b, 1 if a>b, null if incomparable. */
8
+ export declare function compareNodeVersions(a: string, b: string): number | null;
9
+ /** Check whether `current` meets the `minimum` requirement (current >= minimum). */
10
+ export declare function meetsVersionRequirement(current: string, minimum: string): boolean;
11
+ /**
12
+ * Validate that the current Node.js version meets the requirement.
13
+ *
14
+ * - 'warn': logs a warning but allows the build to continue
15
+ * - 'error': throws FrameworkValidationError, stopping the build
16
+ */
17
+ export declare function validateNodeVersion(log: Logger, requirement: NodeVersionRequirement, frameworkName: string): void;
18
+ /** Get a human-readable description of the Node.js version requirement. */
19
+ export declare function describeRequirement(requirement: NodeVersionRequirement): string;
20
+ //# sourceMappingURL=node-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-version.d.ts","sourceRoot":"","sources":["../../src/utils/node-version.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,uEAAuE;AACvE,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGlE;AAED,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvE;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CASjF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,MAAM,GACpB,IAAI,CAwBN;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,sBAAsB,GAAG,MAAM,CAG/E"}
@@ -0,0 +1,113 @@
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.getCurrentNodeVersion = getCurrentNodeVersion;
37
+ exports.getNodeMajorVersion = getNodeMajorVersion;
38
+ exports.compareNodeVersions = compareNodeVersions;
39
+ exports.meetsVersionRequirement = meetsVersionRequirement;
40
+ exports.validateNodeVersion = validateNodeVersion;
41
+ exports.describeRequirement = describeRequirement;
42
+ /**
43
+ * Node.js version validation.
44
+ *
45
+ * Checks that the current Node.js version meets framework requirements, using
46
+ * semver for all parsing and comparison.
47
+ *
48
+ * - 'warn' severity: logs a warning but continues
49
+ * - 'error' severity: throws FrameworkValidationError
50
+ */
51
+ const semver = __importStar(require("semver"));
52
+ const errors_1 = require("../frameworks/errors");
53
+ /** Get the current Node.js version string (without the 'v' prefix). */
54
+ function getCurrentNodeVersion() {
55
+ return process.version.slice(1);
56
+ }
57
+ /** Get the major version from a version string using semver.coerce. */
58
+ function getNodeMajorVersion(version) {
59
+ const coerced = semver.coerce(version);
60
+ return coerced ? coerced.major : null;
61
+ }
62
+ /** Compare two version strings. -1 if a<b, 0 if a==b, 1 if a>b, null if incomparable. */
63
+ function compareNodeVersions(a, b) {
64
+ const coercedA = semver.coerce(a);
65
+ const coercedB = semver.coerce(b);
66
+ if (!coercedA || !coercedB)
67
+ return null;
68
+ return semver.compare(coercedA, coercedB);
69
+ }
70
+ /** Check whether `current` meets the `minimum` requirement (current >= minimum). */
71
+ function meetsVersionRequirement(current, minimum) {
72
+ const coercedCurrent = semver.coerce(current);
73
+ const coercedMinimum = semver.coerce(minimum);
74
+ if (!coercedCurrent || !coercedMinimum) {
75
+ return false;
76
+ }
77
+ return semver.gte(coercedCurrent, coercedMinimum);
78
+ }
79
+ /**
80
+ * Validate that the current Node.js version meets the requirement.
81
+ *
82
+ * - 'warn': logs a warning but allows the build to continue
83
+ * - 'error': throws FrameworkValidationError, stopping the build
84
+ */
85
+ function validateNodeVersion(log, requirement, frameworkName) {
86
+ const current = getCurrentNodeVersion();
87
+ const minimum = requirement.minimum;
88
+ if (!meetsVersionRequirement(current, minimum)) {
89
+ const majorVersion = getNodeMajorVersion(minimum);
90
+ const message = `${frameworkName} requires Node.js ${minimum} or higher. ` + `Current version: ${current}`;
91
+ if (requirement.severity === 'error') {
92
+ throw new errors_1.FrameworkValidationError(message, {
93
+ remediation: `Please upgrade Node.js to ${minimum} or higher. ` +
94
+ `You can use nvm, fnm, or similar tools to manage Node.js versions.\n\n` +
95
+ ` nvm install ${majorVersion}\n` +
96
+ ` nvm use ${majorVersion}`,
97
+ documentationUrl: 'https://nodejs.org/en/download/',
98
+ });
99
+ }
100
+ else {
101
+ log.warn(`${message}. Build may fail or behave unexpectedly.`);
102
+ }
103
+ }
104
+ else {
105
+ log.debug(`Node.js version ${current} meets requirement ${minimum}`);
106
+ }
107
+ }
108
+ /** Get a human-readable description of the Node.js version requirement. */
109
+ function describeRequirement(requirement) {
110
+ const severity = requirement.severity === 'error' ? 'required' : 'recommended';
111
+ return `Node.js ${requirement.minimum}+ (${severity})`;
112
+ }
113
+ //# sourceMappingURL=node-version.js.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runs through the
5
+ * injected CommandRunner port so the host controls execution (and can sandbox
6
+ * it). Kept as a free function — rather than a base-class method — so it can be
7
+ * mocked at the module boundary the same way the cosmic-builder tests do.
8
+ */
9
+ import type { Logger, CommandRunner } from '../ports';
10
+ /** Standard npm arguments to reduce noise. */
11
+ export declare const NPM_ARGS: string[];
12
+ export interface NpmOptions {
13
+ log: Logger;
14
+ runCommand: CommandRunner;
15
+ cwd: string;
16
+ args: string[];
17
+ env?: Record<string, string>;
18
+ }
19
+ /**
20
+ * Execute an npm command with standardized arguments and telemetry disabled.
21
+ *
22
+ * Rejects (via the runner's CommandError) on a non-zero exit.
23
+ */
24
+ export declare function npm(options: NpmOptions): Promise<void>;
25
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,8CAA8C;AAC9C,eAAO,MAAM,QAAQ,UAAuE,CAAC;AAE7F,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,aAAa,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B5D"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NPM_ARGS = void 0;
4
+ exports.npm = npm;
5
+ /** Standard npm arguments to reduce noise. */
6
+ exports.NPM_ARGS = ['--no-update-notifier', '--no-progress', '--no-audit', '--no-fund'];
7
+ /**
8
+ * Execute an npm command with standardized arguments and telemetry disabled.
9
+ *
10
+ * Rejects (via the runner's CommandError) on a non-zero exit.
11
+ */
12
+ async function npm(options) {
13
+ const { log, runCommand, cwd, args } = options;
14
+ // Inherit the host environment as the base so registry auth, proxies, custom
15
+ // CAs (NODE_EXTRA_CA_CERTS), and npm config resolution keep working — this
16
+ // matches how the legacy cosmic-builder / CLI ran npm (inherited env). A host
17
+ // that needs a hermetic or secret-isolated build env should inject its own
18
+ // CommandRunner rather than relying on this default.
19
+ const env = {};
20
+ for (const [key, value] of Object.entries(process.env)) {
21
+ if (value !== undefined)
22
+ env[key] = value;
23
+ }
24
+ // Caller-supplied vars (e.g. the user's build env) override inherited ones.
25
+ Object.assign(env, options.env ?? {});
26
+ // Disable telemetry regardless of what was inherited or passed.
27
+ env.WRANGLER_SEND_METRICS = 'false';
28
+ env.NEXT_TELEMETRY_DISABLED = '1';
29
+ log.debug(`npm ${[...exports.NPM_ARGS, ...args].join(' ')} (in ${cwd})`);
30
+ await runCommand.run('npm', [...exports.NPM_ARGS, ...args], {
31
+ cwd,
32
+ env,
33
+ onOutput: (chunk) => {
34
+ const trimmed = chunk.replace(/\s+$/, '');
35
+ if (trimmed)
36
+ log.info(trimmed);
37
+ },
38
+ });
39
+ }
40
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":";;;AA0BA,kBA8BC;AA9CD,8CAA8C;AACjC,QAAA,QAAQ,GAAG,CAAC,sBAAsB,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AAU7F;;;;GAIG;AACI,KAAK,UAAU,GAAG,CAAC,OAAmB;IAC3C,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAE/C,6EAA6E;IAC7E,2EAA2E;IAC3E,8EAA8E;IAC9E,2EAA2E;IAC3E,qDAAqD;IACrD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC5C,CAAC;IAED,4EAA4E;IAC5E,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IAEtC,gEAAgE;IAChE,GAAG,CAAC,qBAAqB,GAAG,OAAO,CAAC;IACpC,GAAG,CAAC,uBAAuB,GAAG,GAAG,CAAC;IAElC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,gBAAQ,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;IAEjE,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,gBAAQ,EAAE,GAAG,IAAI,CAAC,EAAE;QAClD,GAAG;QACH,GAAG;QACH,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC1C,IAAI,OAAO;gBAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Environment variable names that Webflow Cloud reserves for internal use.
3
+ *
4
+ * The build/deploy pipeline injects these names and the deployer maps them to
5
+ * Cloudflare Worker bindings. If a user-defined env var collides with one of
6
+ * them, the deploy step fails when Cloudflare rejects the duplicate binding
7
+ * (e.g. `Binding name 'COSMIC_MOUNT_PATH' already in use`), which previously
8
+ * surfaced only as a silent hang.
9
+ *
10
+ * This is a safety net: the dashboard (UI) and API reject reserved names before
11
+ * they are ever stored. This filter only catches names that slip through. Keep
12
+ * it in sync with the monorepo source of truth at
13
+ * `packages/systems/cosmic/constants/reservedEnvVarNames.ts` and with the
14
+ * system env declarations in cosmic-builder's `images/env.ts`.
15
+ */
16
+ /** Reserved name prefixes — any key starting with one of these is reserved. */
17
+ export declare const RESERVED_ENV_VAR_PREFIXES: readonly ["COSMIC_", "CLOUDFLARE_", "WRANGLER_"];
18
+ /** Reserved exact names not already covered by a reserved prefix. */
19
+ export declare const RESERVED_ENV_VAR_NAMES: readonly ["APP_NAME", "APP_PATH", "COMMIT_HASH", "DEPLOYMENT_ID", "COMPLETION_URL", "STARTED_URL", "OUTPUT_URL", "REPO_URL", "TARBALL_URL", "UPLOAD_CREDENTIALS", "HOSTNAME", "NODE_ENV", "NODE_VERSION"];
20
+ /**
21
+ * Returns true if `key` is reserved for Webflow Cloud internal use and must not
22
+ * be applied as a user-defined environment variable. Matching is
23
+ * case-insensitive and ignores surrounding whitespace.
24
+ */
25
+ export declare function isReservedEnvVarName(key: string): boolean;
26
+ //# sourceMappingURL=reserved-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reserved-env.d.ts","sourceRoot":"","sources":["../../src/utils/reserved-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,kDAAmD,CAAC;AAE1F,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,2MAczB,CAAC;AAIX;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAMzD"}