1/**
2 * `@alchemy.run/frontend-frameworks/solidstart` — SolidStart integration
3 * implementing framework-core's `Framework` service, with the deploy target
4 * passed as a value (AWS Lambda by default, via the
5 * `@alchemy.run/frontend-frameworks/solidstart/aws` subpath module).
6 *
7 * SolidStart 2 is expressed entirely as Vite plugins: `solidStart()` owns
8 * routing, SSR, and the client/server environments, and
9 * `@solidjs/vite-plugin-nitro-2` turns the emitted SSR bundle into a nitro
10 * server. This integration drives the project's own Vite install
11 * (`createBuilder(...).buildApp()`) and appends its own nitro-plugin
12 * instance so the deploy target owns the nitro preset — the project's
13 * `vite.config.*` 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 SolidStart-specific options.
18 *
19 * This module (and `SolidStart.ts`) is target-agnostic by contract: it must
20 * not import anything AWS-specific. The AWS half — nitro's `aws-lambda`
21 * preset and its streaming handler — lives behind
22 * `@alchemy.run/frontend-frameworks/solidstart/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 SolidStartOptions } from "./SolidStart.ts";
29
30export {
31 DEFAULT_TARGET_SPECIFIER,
32 layer,
33 make,
34 NITRO_PLUGIN_SPECIFIER,
35 readNitroOutput,
36 SERVER_ENTRY_NAME,
37 type NitroOutputDirs,
38 type SolidStartNitroContext,
39 type SolidStartNitroPluginModule,
40 type SolidStartOptions,
41 type SolidStartTarget,
42 type SolidStartTargetConfig,
43 type SolidStartTargetInput,
44 type SolidStartViteBuilder,
45 type SolidStartViteDevServer,
46 type SolidStartViteModule,
47} from "./SolidStart.ts";
48
49export {
50 findPresetConflict,
51 hasForeignNitroPlugin,
52 isSamePreset,
53 markInjectedPlugins,
54 NITRO_PLUGIN_NAME,
55 normalizePresetName,
56 pluginConflictMessage,
57 presetConflictMessage,
58 resolveNitroConfig,
59 resolveNitroOutputDirs,
60 type NitroConfigSlice,
61 type NitroOutputConfigSlice,
62 type ResolveNitroConfigInput,
63} from "./UserConfig.ts";
64
65/**
66 * The structural subset of the e2e harness's `Options` this package reads.
67 * SolidStart's build carries no harness-configurable options today — the
68 * nitro overrides ride on {@link SolidStartOptions} instead.
69 */
70export interface HarnessOptions {
71 readonly solidstart?:
72 | { readonly nitro?: Record<string, unknown> | undefined }
73 | undefined;
74}
75
76/** Map the harness's options onto {@link SolidStartOptions}. */
77export const fromHarnessOptions = (
78 options: HarnessOptions,
79): SolidStartOptions => ({ nitro: options.solidstart?.nitro });
80
81/**
82 * The e2e-harness factory contract
83 * (`framework: "@alchemy.run/frontend-frameworks/solidstart"` in
84 * `e2e.config.ts`).
85 */
86const factory = (
87 options: HarnessOptions,
88): Layer.Layer<Framework, never, FileSystem.FileSystem | Path.Path> =>
89 layer(fromHarnessOptions(options ?? {}));
90
91export default factory;