| 1 | import { layer } from "./Astro.ts"; |
| 2 | |
| 3 | export { |
| 4 | layer, |
| 5 | make, |
| 6 | makeAstroInlineConfig, |
| 7 | type AstroConfigInputs, |
| 8 | type AstroFrameworkOptions, |
| 9 | } from "./Astro.ts"; |
| 10 | export { NODE_ENVIRONMENTS } from "./environments.ts"; |
| 11 | export { |
| 12 | DEFAULT_TARGET_SPECIFIER, |
| 13 | isAstroTarget, |
| 14 | type AstroTarget, |
| 15 | type AstroTargetInput, |
| 16 | } from "./Target.ts"; |
| 17 | |
| 18 | /** |
| 19 | * The slice of the e2e harness's options this factory reads, structurally |
| 20 | * (this package deliberately does not depend on the harness): the |
| 21 | * target-scoped cloudflare carriage with the deprecated top-level `vite` |
| 22 | * alias as fallback. |
| 23 | */ |
| 24 | interface HarnessOptions { |
| 25 | readonly target?: |
| 26 | | { readonly cloudflare?: { readonly worker?: unknown } | undefined } |
| 27 | | undefined; |
| 28 | readonly vite?: unknown; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * The e2e-harness framework factory contract: default-export a |
| 33 | * `(options) => Layer<Framework>` factory. Reads the harness's cloudflare |
| 34 | * worker configuration (`options.target?.cloudflare?.worker`, falling back to |
| 35 | * the deprecated `options.vite` alias) and hands it — opaquely — to the |
| 36 | * default Cloudflare target module as its config. |
| 37 | */ |
| 38 | const framework = (options?: HarnessOptions) => |
| 39 | layer({ |
| 40 | targetConfig: { |
| 41 | worker: options?.target?.cloudflare?.worker ?? options?.vite, |
| 42 | }, |
| 43 | }); |
| 44 | |
| 45 | export default framework; |