@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,44 @@
1
+ import { webflowAssetPrefix, webflowBasePath } from './next.config';
2
+
3
+ const basePath = webflowBasePath;
4
+ const assetPrefix = webflowAssetPrefix || basePath;
5
+
6
+ function normalizeSrc(src: string) {
7
+ // For local assets, include the base path but not the asset prefix
8
+ if (assetPrefix && src.startsWith(assetPrefix)) {
9
+ return `${basePath}${src.slice(assetPrefix.length)}`;
10
+ } else if (basePath && src.startsWith(basePath)) {
11
+ return src;
12
+ } else if (src.startsWith('/')) {
13
+ return basePath + src;
14
+ }
15
+ return src;
16
+ }
17
+
18
+ export default function cloudflareLoader({
19
+ src,
20
+ width,
21
+ quality,
22
+ }: {
23
+ src: string;
24
+ width: number;
25
+ quality?: number;
26
+ }) {
27
+ const normalizedSrc = normalizeSrc(src);
28
+
29
+ // Our cloudflare zone doesn't allow optimizing external images for security reasons, so just load the original image
30
+ // For now, also skip optimization for images hosted on regular webflow sites (cdn.website-files.com)
31
+ // because optimizing them would result in two bandwidth charges: one from the website-files zone (for the full image)
32
+ // and one from the cosmic.webflow.services zone (for the resized image)
33
+ if (normalizedSrc.startsWith('http://') || normalizedSrc.startsWith('https://')) {
34
+ return normalizedSrc;
35
+ }
36
+
37
+ const params = [`width=${width}`];
38
+ if (quality) {
39
+ params.push(`quality=${quality}`);
40
+ }
41
+ const paramsString = params.join(',');
42
+ const workerUrl = basePath ? assetPrefix.slice(0, -basePath.length) : assetPrefix;
43
+ return `${workerUrl}/cdn-cgi/image/${paramsString}${normalizedSrc}`;
44
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "cosmic-builder-dry-run",
3
+ "main": ".open-next/worker.js",
4
+ "compatibility_date": "2025-03-03",
5
+ "compatibility_flags": ["nodejs_compat"]
6
+ }
@@ -0,0 +1,127 @@
1
+ import type { BuildContext, BuildOutput, PackageJson, WebflowJson, DetectionResult } from './types';
2
+ import { FrameworkBuilder } from './base';
3
+ /** Type for a builder class with static detect method. */
4
+ export interface BuilderClass {
5
+ /** Canonical framework name (e.g. 'nextjs', 'astro', 'vite'). */
6
+ frameworkName: string;
7
+ detect(packageJson: PackageJson, webflowJson?: WebflowJson): DetectionResult;
8
+ detectFromBuiltOutput(cwd: string): boolean;
9
+ getOutputDeployMetadata(): BuildOutput;
10
+ new (ctx: BuildContext): FrameworkBuilder;
11
+ }
12
+ /** Detection result with the matched builder. */
13
+ export interface DetectionMatch {
14
+ Builder: BuilderClass;
15
+ result: DetectionResult;
16
+ }
17
+ /**
18
+ * All registered framework builders, in detection order.
19
+ *
20
+ * IMPORTANT: Order matters — first match wins. More specific frameworks must
21
+ * come before generic ones.
22
+ *
23
+ * - Astro 7 before Astro 6 before Astro 5 (version-specific, newest first)
24
+ * - Next.js before Vite (uses Vite internally)
25
+ * - Vite before Static (Vite catches generic Vite SPAs)
26
+ * - Static last: matches only an explicit `framework: "static"` here; implicit
27
+ * no-framework detection is a filesystem fallback the host resolves via
28
+ * `resolveIsStaticApp` before calling into detection.
29
+ */
30
+ export declare const FRAMEWORK_BUILDERS: BuilderClass[];
31
+ /**
32
+ * Allowed framework names for webflow.json. Single source of truth is the
33
+ * deploy contract's `Framework` enum — what's deployable is what's allowed.
34
+ *
35
+ * Note: Astro version (5 vs 6) is detected automatically from package.json.
36
+ * Users should always specify 'astro', not 'astro5' or 'astro6'.
37
+ */
38
+ export declare const ALLOWED_FRAMEWORKS: ["astro", "nextjs", "vite", "static"];
39
+ export type AllowedFramework = (typeof ALLOWED_FRAMEWORKS)[number];
40
+ /**
41
+ * Detect which framework builder should handle this project. First-match-wins;
42
+ * order in FRAMEWORK_BUILDERS determines precedence.
43
+ *
44
+ * @returns The first matching builder class, or null if no match.
45
+ */
46
+ export declare function detectFrameworkBuilder(packageJson: PackageJson, webflowJson?: WebflowJson): DetectionMatch | null;
47
+ /**
48
+ * Detect which framework produced the build artifacts in `cwd`.
49
+ *
50
+ * Used at deploy time when webflow.json may not have been written by the
51
+ * producer. Iterates registered builders and returns the first one whose
52
+ * `detectFromBuiltOutput` recognizes the output. Returns null if none match.
53
+ */
54
+ export declare function detectFrameworkFromBuiltOutput(cwd: string): BuilderClass | null;
55
+ /**
56
+ * Detect and create the appropriate framework builder.
57
+ *
58
+ * @throws FrameworkDetectionError if no framework can be detected
59
+ */
60
+ export declare function detectAndCreateBuilder(ctx: BuildContext, webflowJson?: WebflowJson): FrameworkBuilder;
61
+ /**
62
+ * Decide whether a project is a no-framework static app.
63
+ *
64
+ * Two ways in:
65
+ * - **explicit**: webflow.json declares `framework: "static"`. This wins
66
+ * unconditionally — even with a package.json present — so the explicit
67
+ * opt-in is honored ahead of the package/index guard in the build flow.
68
+ * - **inferred (zero-config)**: no package.json, a real `index.html` file at
69
+ * the root, no *other* framework explicitly declared, and **no runtime/build
70
+ * indicators** (`hasRuntimeIndicators`). `index.html` + no package.json is
71
+ * only a preflight signal; a repo that also ships a build/server manifest
72
+ * (requirements.txt, composer.json, Gemfile, Dockerfile, …) is a mixed
73
+ * static+runtime repo and must NOT be silently published — the caller
74
+ * rejects that case. The caller resolves `hasRootIndexHtmlFile` with a
75
+ * regular-file check (not `existsSync`), so a directory or symlink named
76
+ * `index.html` does not trigger inference.
77
+ */
78
+ export declare function resolveIsStaticApp(params: {
79
+ hasPackageJson: boolean;
80
+ specifiedFramework?: string;
81
+ hasRootIndexHtmlFile: boolean;
82
+ hasRuntimeIndicators: boolean;
83
+ }): boolean;
84
+ /**
85
+ * Resolve whether `cwd` is a no-framework static app, doing the filesystem
86
+ * checks that `resolveIsStaticApp` needs: a regular-file root index.html and a
87
+ * recursive scan for runtime indicators. This is the single implementation both
88
+ * producers (cosmic-builder, webflow-cli) call, so static detection is
89
+ * identical everywhere.
90
+ *
91
+ * `index.html` + no package.json is only a preflight signal: a repo that also
92
+ * ships a build/server manifest is a mixed static+runtime repo whose source
93
+ * must not be silently published as assets. On the inference path (no explicit
94
+ * framework) such a repo is rejected loudly, naming the offending files. An
95
+ * explicit `framework: "static"` is honored even when those files are present.
96
+ *
97
+ * Requires a regular file for the inferred index.html (lstat, not existsSync)
98
+ * so a directory or symlink named index.html can't trigger inference.
99
+ *
100
+ * @throws FrameworkDetectionError for a mixed static+runtime repo on inference.
101
+ */
102
+ export declare function detectStaticApp(cwd: string, packageJson: PackageJson | undefined, webflowJson?: WebflowJson): {
103
+ isStatic: boolean;
104
+ };
105
+ /**
106
+ * Read the customer's installed major version of a framework's primary npm
107
+ * package. Used only for metric tagging.
108
+ *
109
+ * `getMajorVersion` is defensive on empty/non-semver input (dist-tags, git
110
+ * URLs, 'workspace:*', etc.), so the 'unknown' fallback is unreachable in the
111
+ * normal path — kept for resilience to silent dep-tree changes.
112
+ */
113
+ export declare function getCustomerMajorVersion(packageName: string, packageJson: PackageJson): string;
114
+ /**
115
+ * Validate that a framework name from webflow.json is supported.
116
+ *
117
+ * @throws FrameworkDetectionError if framework is not supported
118
+ */
119
+ export declare function validateFrameworkName(frameworkName: string): asserts frameworkName is AllowedFramework;
120
+ export { Astro5Builder, Astro6Builder, Astro7Builder } from './astro';
121
+ export { NextJsBuilder } from './nextjs';
122
+ export { ViteBuilder } from './vite';
123
+ export { StaticBuilder } from './static';
124
+ export { FrameworkBuilder } from './base';
125
+ export * from './types';
126
+ export * from './errors';
127
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/frameworks/registry.ts"],"names":[],"mappings":"AAW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BAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,oBAAoB,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CASV;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,WAAW,GAAG,SAAS,EACpC,WAAW,CAAC,EAAE,WAAW,GACxB;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAkCvB;AAMD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM,CAK7F;AAMD;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,IAAI,gBAAgB,CAM3C;AAMD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,257 @@
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
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.FrameworkBuilder = exports.StaticBuilder = exports.ViteBuilder = exports.NextJsBuilder = exports.Astro7Builder = exports.Astro6Builder = exports.Astro5Builder = exports.ALLOWED_FRAMEWORKS = exports.FRAMEWORK_BUILDERS = void 0;
40
+ exports.detectFrameworkBuilder = detectFrameworkBuilder;
41
+ exports.detectFrameworkFromBuiltOutput = detectFrameworkFromBuiltOutput;
42
+ exports.detectAndCreateBuilder = detectAndCreateBuilder;
43
+ exports.resolveIsStaticApp = resolveIsStaticApp;
44
+ exports.detectStaticApp = detectStaticApp;
45
+ exports.getCustomerMajorVersion = getCustomerMajorVersion;
46
+ exports.validateFrameworkName = validateFrameworkName;
47
+ /**
48
+ * Framework Registry
49
+ *
50
+ * Central registry for all framework builders. Handles framework detection and
51
+ * builder creation.
52
+ */
53
+ const fs = __importStar(require("node:fs"));
54
+ const path = __importStar(require("node:path"));
55
+ const cosmic_deploy_contract_1 = require("@webflow/cosmic-deploy-contract");
56
+ const errors_1 = require("./errors");
57
+ const utils_1 = require("../utils");
58
+ const astro_1 = require("./astro");
59
+ const nextjs_1 = require("./nextjs");
60
+ const vite_1 = require("./vite");
61
+ const static_1 = require("./static");
62
+ // ───────────────────────────────────────────────────────────────────────────
63
+ // FRAMEWORK REGISTRY
64
+ // ───────────────────────────────────────────────────────────────────────────
65
+ /**
66
+ * All registered framework builders, in detection order.
67
+ *
68
+ * IMPORTANT: Order matters — first match wins. More specific frameworks must
69
+ * come before generic ones.
70
+ *
71
+ * - Astro 7 before Astro 6 before Astro 5 (version-specific, newest first)
72
+ * - Next.js before Vite (uses Vite internally)
73
+ * - Vite before Static (Vite catches generic Vite SPAs)
74
+ * - Static last: matches only an explicit `framework: "static"` here; implicit
75
+ * no-framework detection is a filesystem fallback the host resolves via
76
+ * `resolveIsStaticApp` before calling into detection.
77
+ */
78
+ exports.FRAMEWORK_BUILDERS = [
79
+ astro_1.Astro7Builder,
80
+ astro_1.Astro6Builder,
81
+ astro_1.Astro5Builder,
82
+ nextjs_1.NextJsBuilder,
83
+ vite_1.ViteBuilder,
84
+ static_1.StaticBuilder,
85
+ ];
86
+ /**
87
+ * Allowed framework names for webflow.json. Single source of truth is the
88
+ * deploy contract's `Framework` enum — what's deployable is what's allowed.
89
+ *
90
+ * Note: Astro version (5 vs 6) is detected automatically from package.json.
91
+ * Users should always specify 'astro', not 'astro5' or 'astro6'.
92
+ */
93
+ exports.ALLOWED_FRAMEWORKS = cosmic_deploy_contract_1.Framework.options;
94
+ // ───────────────────────────────────────────────────────────────────────────
95
+ // DETECTION
96
+ // ───────────────────────────────────────────────────────────────────────────
97
+ /**
98
+ * Detect which framework builder should handle this project. First-match-wins;
99
+ * order in FRAMEWORK_BUILDERS determines precedence.
100
+ *
101
+ * @returns The first matching builder class, or null if no match.
102
+ */
103
+ function detectFrameworkBuilder(packageJson, webflowJson) {
104
+ for (const Builder of exports.FRAMEWORK_BUILDERS) {
105
+ const result = Builder.detect(packageJson, webflowJson);
106
+ if (result.detected) {
107
+ return { Builder, result };
108
+ }
109
+ }
110
+ return null;
111
+ }
112
+ /**
113
+ * Detect which framework produced the build artifacts in `cwd`.
114
+ *
115
+ * Used at deploy time when webflow.json may not have been written by the
116
+ * producer. Iterates registered builders and returns the first one whose
117
+ * `detectFromBuiltOutput` recognizes the output. Returns null if none match.
118
+ */
119
+ function detectFrameworkFromBuiltOutput(cwd) {
120
+ for (const Builder of exports.FRAMEWORK_BUILDERS) {
121
+ if (Builder.detectFromBuiltOutput(cwd)) {
122
+ return Builder;
123
+ }
124
+ }
125
+ return null;
126
+ }
127
+ /**
128
+ * Detect and create the appropriate framework builder.
129
+ *
130
+ * @throws FrameworkDetectionError if no framework can be detected
131
+ */
132
+ function detectAndCreateBuilder(ctx, webflowJson) {
133
+ const match = detectFrameworkBuilder(ctx.packageJson, webflowJson);
134
+ if (!match) {
135
+ throw new errors_1.FrameworkDetectionError('Could not detect framework from package.json or webflow.json', {
136
+ remediation: 'Create a webflow.json file with: { "cloud": { "framework": "astro" } } ' +
137
+ `(or one of: ${exports.ALLOWED_FRAMEWORKS.join(', ')}). ` +
138
+ 'For a no-framework static site, use { "cloud": { "framework": "static" } }.',
139
+ });
140
+ }
141
+ ctx.log.info(`Detected framework: ${match.result.reason}`);
142
+ return new match.Builder(ctx);
143
+ }
144
+ /**
145
+ * Decide whether a project is a no-framework static app.
146
+ *
147
+ * Two ways in:
148
+ * - **explicit**: webflow.json declares `framework: "static"`. This wins
149
+ * unconditionally — even with a package.json present — so the explicit
150
+ * opt-in is honored ahead of the package/index guard in the build flow.
151
+ * - **inferred (zero-config)**: no package.json, a real `index.html` file at
152
+ * the root, no *other* framework explicitly declared, and **no runtime/build
153
+ * indicators** (`hasRuntimeIndicators`). `index.html` + no package.json is
154
+ * only a preflight signal; a repo that also ships a build/server manifest
155
+ * (requirements.txt, composer.json, Gemfile, Dockerfile, …) is a mixed
156
+ * static+runtime repo and must NOT be silently published — the caller
157
+ * rejects that case. The caller resolves `hasRootIndexHtmlFile` with a
158
+ * regular-file check (not `existsSync`), so a directory or symlink named
159
+ * `index.html` does not trigger inference.
160
+ */
161
+ function resolveIsStaticApp(params) {
162
+ const { hasPackageJson, specifiedFramework, hasRootIndexHtmlFile, hasRuntimeIndicators } = params;
163
+ if (specifiedFramework === 'static') {
164
+ return true;
165
+ }
166
+ const declaresOtherFramework = specifiedFramework != null && specifiedFramework !== 'static';
167
+ return (!hasPackageJson && !declaresOtherFramework && hasRootIndexHtmlFile && !hasRuntimeIndicators);
168
+ }
169
+ /**
170
+ * Resolve whether `cwd` is a no-framework static app, doing the filesystem
171
+ * checks that `resolveIsStaticApp` needs: a regular-file root index.html and a
172
+ * recursive scan for runtime indicators. This is the single implementation both
173
+ * producers (cosmic-builder, webflow-cli) call, so static detection is
174
+ * identical everywhere.
175
+ *
176
+ * `index.html` + no package.json is only a preflight signal: a repo that also
177
+ * ships a build/server manifest is a mixed static+runtime repo whose source
178
+ * must not be silently published as assets. On the inference path (no explicit
179
+ * framework) such a repo is rejected loudly, naming the offending files. An
180
+ * explicit `framework: "static"` is honored even when those files are present.
181
+ *
182
+ * Requires a regular file for the inferred index.html (lstat, not existsSync)
183
+ * so a directory or symlink named index.html can't trigger inference.
184
+ *
185
+ * @throws FrameworkDetectionError for a mixed static+runtime repo on inference.
186
+ */
187
+ function detectStaticApp(cwd, packageJson, webflowJson) {
188
+ const specifiedFramework = webflowJson?.cloud?.framework;
189
+ const indexHtmlStat = fs.lstatSync(path.join(cwd, 'index.html'), { throwIfNoEntry: false });
190
+ const hasRootIndexHtmlFile = indexHtmlStat?.isFile() ?? false;
191
+ const runtimeIndicators = (0, static_1.findRuntimeBuildIndicators)(cwd);
192
+ const isStatic = resolveIsStaticApp({
193
+ hasPackageJson: packageJson != null,
194
+ specifiedFramework,
195
+ hasRootIndexHtmlFile,
196
+ hasRuntimeIndicators: runtimeIndicators.length > 0,
197
+ });
198
+ if (!packageJson &&
199
+ !isStatic &&
200
+ hasRootIndexHtmlFile &&
201
+ runtimeIndicators.length > 0 &&
202
+ specifiedFramework == null) {
203
+ throw new errors_1.FrameworkDetectionError(`Found index.html but also build/runtime indicators (${runtimeIndicators.join(', ')}); this is not a no-framework static app and will not be published as static assets.`, {
204
+ remediation: 'Remove those files, or declare a framework in webflow.json (e.g. { "cloud": { "framework": "static" } } to force static).',
205
+ });
206
+ }
207
+ return { isStatic };
208
+ }
209
+ // ───────────────────────────────────────────────────────────────────────────
210
+ // TELEMETRY
211
+ // ───────────────────────────────────────────────────────────────────────────
212
+ /**
213
+ * Read the customer's installed major version of a framework's primary npm
214
+ * package. Used only for metric tagging.
215
+ *
216
+ * `getMajorVersion` is defensive on empty/non-semver input (dist-tags, git
217
+ * URLs, 'workspace:*', etc.), so the 'unknown' fallback is unreachable in the
218
+ * normal path — kept for resilience to silent dep-tree changes.
219
+ */
220
+ function getCustomerMajorVersion(packageName, packageJson) {
221
+ const spec = packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? '';
222
+ const major = (0, utils_1.getMajorVersion)(spec);
223
+ return major !== null ? String(major) : 'unknown';
224
+ }
225
+ // ───────────────────────────────────────────────────────────────────────────
226
+ // VALIDATION
227
+ // ───────────────────────────────────────────────────────────────────────────
228
+ /**
229
+ * Validate that a framework name from webflow.json is supported.
230
+ *
231
+ * @throws FrameworkDetectionError if framework is not supported
232
+ */
233
+ function validateFrameworkName(frameworkName) {
234
+ if (!exports.ALLOWED_FRAMEWORKS.includes(frameworkName)) {
235
+ throw new errors_1.FrameworkDetectionError(`Framework "${frameworkName}" is not supported`, {
236
+ remediation: `Must be one of: ${exports.ALLOWED_FRAMEWORKS.join(', ')}`,
237
+ });
238
+ }
239
+ }
240
+ // ───────────────────────────────────────────────────────────────────────────
241
+ // EXPORTS
242
+ // ───────────────────────────────────────────────────────────────────────────
243
+ var astro_2 = require("./astro");
244
+ Object.defineProperty(exports, "Astro5Builder", { enumerable: true, get: function () { return astro_2.Astro5Builder; } });
245
+ Object.defineProperty(exports, "Astro6Builder", { enumerable: true, get: function () { return astro_2.Astro6Builder; } });
246
+ Object.defineProperty(exports, "Astro7Builder", { enumerable: true, get: function () { return astro_2.Astro7Builder; } });
247
+ var nextjs_2 = require("./nextjs");
248
+ Object.defineProperty(exports, "NextJsBuilder", { enumerable: true, get: function () { return nextjs_2.NextJsBuilder; } });
249
+ var vite_2 = require("./vite");
250
+ Object.defineProperty(exports, "ViteBuilder", { enumerable: true, get: function () { return vite_2.ViteBuilder; } });
251
+ var static_2 = require("./static");
252
+ Object.defineProperty(exports, "StaticBuilder", { enumerable: true, get: function () { return static_2.StaticBuilder; } });
253
+ var base_1 = require("./base");
254
+ Object.defineProperty(exports, "FrameworkBuilder", { enumerable: true, get: function () { return base_1.FrameworkBuilder; } });
255
+ __exportStar(require("./types"), exports);
256
+ __exportStar(require("./errors"), exports);
257
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/frameworks/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,wDAWC;AASD,wEAOC;AAOD,wDAoBC;AAmBD,gDAcC;AAoBD,0CAsCC;AAcD,0DAKC;AAWD,sDAQC;AA/QD;;;;;GAKG;AACH,4CAA8B;AAC9B,gDAAkC;AAElC,4EAA4D;AAI5D,qCAAmD;AACnD,oCAA2C;AAE3C,mCAAsE;AACtE,qCAAyC;AACzC,iCAAqC;AACrC,qCAAqE;AAsBrE,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;;;;;;;;;GAYG;AACU,QAAA,kBAAkB,GAAmB;IAChD,qBAAa;IACb,qBAAa;IACb,qBAAa;IACb,sBAAa;IACb,kBAAW;IACX,sBAAa;CACd,CAAC;AAEF;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,kCAAS,CAAC,OAAO,CAAC;AAIpD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;G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;AAED,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,WAAmB,EAAE,WAAwB;IACnF,MAAM,IAAI,GACR,WAAW,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAC9F,MAAM,KAAK,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,CAAC;IACpC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;GAIG;AACH,SAAgB,qBAAqB,CACnC,aAAqB;IAErB,IAAI,CAAC,0BAAkB,CAAC,QAAQ,CAAC,aAAiC,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,gCAAuB,CAAC,cAAc,aAAa,oBAAoB,EAAE;YACjF,WAAW,EAAE,mBAAmB,0BAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SAChE,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,iCAAsE;AAA7D,sGAAA,aAAa,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,sGAAA,aAAa,OAAA;AACpD,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AACtB,+BAAqC;AAA5B,mGAAA,WAAW,OAAA;AACpB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAEtB,+BAA0C;AAAjC,wGAAA,gBAAgB,OAAA;AACzB,0CAAwB;AACxB,2CAAyB"}
@@ -0,0 +1,116 @@
1
+ import { FrameworkBuilder } from '../base';
2
+ import type { BuildOutput, FrameworkInfo, PackageJson, WebflowJson, DetectionResult, AdapterPackage, IntegrationPackage, WebflowLoaderConfig, NodeVersionRequirement } from '../types';
3
+ /**
4
+ * `_headers` / `_redirects` are Cloudflare asset-root metadata, not page
5
+ * content. They're only honored at the root of the assets directory, so the
6
+ * host relocates them there (regardless of mount path) rather than copying
7
+ * them under the mount-path prefix.
8
+ */
9
+ export declare const ASSET_ROOT_METADATA: string[];
10
+ /**
11
+ * Non-dotfile basename patterns that must never be published as static assets
12
+ * (`*` is a simple glob — see `matchesExcludePattern`). Dotfiles are handled
13
+ * separately by `shouldExcludeStaticAsset` (all excluded except `.well-known`).
14
+ */
15
+ export declare const STATIC_ASSET_EXCLUDES: string[];
16
+ /**
17
+ * The static publication boundary: decide whether a repo-root entry must be
18
+ * withheld from the published assets. Because the asset source is the whole
19
+ * checkout, the safe default is to treat anything config/secret/metadata-shaped
20
+ * as non-public rather than to enumerate every risky name.
21
+ *
22
+ * Policy:
23
+ * - `.well-known` IS published (ACME challenges, security.txt, etc.).
24
+ * - every OTHER dotfile / dot-directory is withheld — this covers `.env*`,
25
+ * `.envrc`, `.git`, `.git-credentials`, `.npmrc`, `.aws/`, `.docker/`,
26
+ * `.ssh/`, `.dev.vars`, … in one rule instead of a leaky enumeration.
27
+ * - `_headers` / `_redirects` are withheld here because they're relocated to
28
+ * the assets root separately.
29
+ * - plus the explicit non-dotfile deny patterns above (deps, control files,
30
+ * tf state, key material).
31
+ */
32
+ export declare function shouldExcludeStaticAsset(basename: string): boolean;
33
+ /**
34
+ * Build/runtime/package/auth manifest files whose presence means the repo is
35
+ * NOT a no-framework static site — it has a build step or a server runtime.
36
+ *
37
+ * Zero-config static inference (`index.html` + no package.json) is only a
38
+ * preflight signal; per the Static Site Hosting PRD it must be rejected when
39
+ * any of these appear alongside, so we never silently publish a mixed
40
+ * static+runtime repo's source (e.g. `server.py` next to a Composer
41
+ * `auth.json`). Node's `package.json` is handled separately by the detection
42
+ * flow, so it isn't listed here.
43
+ */
44
+ export declare const RUNTIME_BUILD_INDICATORS: string[];
45
+ /**
46
+ * Clear server entrypoint filenames. Unlike manifests these are source files,
47
+ * but a repo whose published tree contains one is running a server, not serving
48
+ * static assets — so it must not be inferred as static.
49
+ */
50
+ export declare const SERVER_ENTRYPOINT_FILES: string[];
51
+ /**
52
+ * Evaluate repo-relative file paths for build/runtime/server indicators,
53
+ * returning matching paths in input order.
54
+ *
55
+ * This helper is filesystem-free so hosts that only have a remote file listing
56
+ * (for example a GitHub recursive tree result) can reuse exactly the same
57
+ * indicator semantics as the local filesystem scanner.
58
+ *
59
+ * Input contract:
60
+ * - `paths` must represent regular file paths only (blob/file entries).
61
+ * - Callers must pre-filter non-file items (directories, submodules, symlinks).
62
+ * For a GitHub recursive tree this means keeping only `type === 'blob'` with
63
+ * `mode !== '120000'` (symlink); submodules arrive as `type === 'commit'`.
64
+ * The local filesystem scanner skips symlinks, so a caller that keeps them
65
+ * would diverge from it.
66
+ * - Exclusion applies to ancestor directory segments only; the final basename
67
+ * is always considered as an indicator candidate.
68
+ * - Leading/duplicate slashes and `.` segments are normalized for matching
69
+ * only. Matches are returned with the caller's original spelling
70
+ * (`./api/server.py` in, `./api/server.py` out), so callers that key off the
71
+ * returned paths must not assume they are canonicalized.
72
+ */
73
+ export declare function findRuntimeBuildIndicatorsInPaths(paths: string[]): string[];
74
+ /**
75
+ * Scan the **published tree** (not just the root) for build/runtime/server
76
+ * indicators, returning their repo-relative paths.
77
+ *
78
+ * The static copy publishes the whole checkout recursively, so a manifest or
79
+ * server entrypoint nested under e.g. `api/` (a root `index.html` next to
80
+ * `api/requirements.txt` + `api/server.py`) is just as much a mixed
81
+ * static+runtime signal as one at the root — and its source would otherwise be
82
+ * served publicly. Directories that are never published (dotfiles/dot-dirs,
83
+ * `node_modules`, and anything `shouldExcludeStaticAsset` withholds) are not
84
+ * descended into, and symlinks are not followed — matching the copy policy.
85
+ *
86
+ * A **nested** `package.json` (below the root) counts here too: it marks a
87
+ * Node runtime whose sibling source (e.g. `api/index.js`) would otherwise be
88
+ * published verbatim. The *root* `package.json` is intentionally NOT a signal —
89
+ * its presence means the repo isn't a zero-config static app at all, which the
90
+ * upstream detection flow already handles (static inference requires that there
91
+ * be no root `package.json`).
92
+ */
93
+ export declare function findRuntimeBuildIndicators(cwd: string): string[];
94
+ export declare class StaticBuilder extends FrameworkBuilder {
95
+ static frameworkName: string;
96
+ get info(): FrameworkInfo;
97
+ /**
98
+ * Match only when webflow.json explicitly opts in with framework "static".
99
+ *
100
+ * Implicit detection for a no-framework app (no package.json / index.html at
101
+ * the root) is handled as a fallback in the host, which has the working
102
+ * directory that this static, package.json-only signature cannot see.
103
+ */
104
+ static detect(packageJson: PackageJson, webflowJson?: WebflowJson): DetectionResult;
105
+ validate(): Promise<void>;
106
+ installDependencies(): Promise<void>;
107
+ getCloudflareAdapter(): AdapterPackage | null;
108
+ getRequiredIntegrations(): IntegrationPackage[];
109
+ getWebflowLoader(): WebflowLoaderConfig | null;
110
+ getNodeVersionRequirement(): NodeVersionRequirement | null;
111
+ getWranglerTemplatePath(): string;
112
+ prepareConfig(): Promise<void>;
113
+ getBuildCommand(): string | null;
114
+ static getOutputDeployMetadata(): BuildOutput;
115
+ }
116
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frameworks/static/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAKlB;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,UAA6B,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UA+BjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAWlE;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,w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