1/**
2 * `@alchemy.run/frontend-frameworks/tanstack-start` — TanStack Start
3 * integration implementing framework-core's `Framework` service, with the
4 * deploy target passed as a value (AWS Lambda by default, via the
5 * `@alchemy.run/frontend-frameworks/tanstack-start/aws` subpath module).
6 *
7 * TanStack Start is expressed entirely as Vite plugins: `tanstackStart()`
8 * owns routing, server functions, server routes, and the `client`/`ssr`
9 * environments, and its `builder.buildApp` builds both in one pass. This
10 * integration drives the project's own Vite install
11 * (`createBuilder(...).buildApp()`) and forces the SSR bundle to be
12 * self-contained so it deploys as a standalone Lambda — the project's
13 * `vite.config.ts` needs no adapter wiring.
14 *
15 * The default export is the e2e-harness factory contract: a
16 * `(options) => Layer<Framework>` function. Use {@link layer} directly for
17 * the fully-typed path with TanStack Start-specific options.
18 *
19 * This module (and `TanStackStart.ts`) is target-agnostic by contract: it
20 * must not import anything AWS-specific. The AWS half — the Lambda entry
21 * and the streaming adapter — lives behind
22 * `@alchemy.run/frontend-frameworks/tanstack-start/aws`.
23 */
24import type * as FileSystem from "effect/FileSystem";
25import type * as Layer from "effect/Layer";
26import type * as Path from "effect/Path";
27import type { Framework } from "../core/index.ts";
28import { layer, type TanStackStartOptions } from "./TanStackStart.ts";
29
30export {
31 DEFAULT_OUT_DIR,
32 DEFAULT_SERVER_ENTRY_FILE_NAME,
33 DEFAULT_TARGET_SPECIFIER,
34 inlineBuildConfig,
35 layer,
36 make,
37 readTanStackStartOutput,
38 selectServerEntryName,
39 TANSTACK_START_PLUGIN_SPECIFIER,
40 type TanStackStartOptions,
41 type TanStackStartOutputDirs,
42 type TanStackStartTarget,
43 type TanStackStartTargetConfig,
44 type TanStackStartTargetInput,
45 type TanStackStartViteBuilder,
46 type TanStackStartViteDevServer,
47 type TanStackStartViteModule,
48} from "./TanStackStart.ts";
49
50/**
51 * The structural subset of the e2e harness's `Options` this package reads.
52 */
53export interface HarnessOptions {
54 readonly tanstackStart?: { readonly outDir?: string | undefined } | undefined;
55}
56
57/** Map the harness's options onto {@link TanStackStartOptions}. */
58export const fromHarnessOptions = (
59 options: HarnessOptions,
60): TanStackStartOptions => ({ outDir: options.tanstackStart?.outDir });
61
62/**
63 * The e2e-harness factory contract
64 * (`framework: "@alchemy.run/frontend-frameworks/tanstack-start"` in
65 * `e2e.config.ts`).
66 */
67const factory = (
68 options: HarnessOptions,
69): Layer.Layer<Framework, never, FileSystem.FileSystem | Path.Path> =>
70 layer(fromHarnessOptions(options ?? {}));
71
72export default factory;