init: solid start adapter

This commit is contained in:
2026-03-14 15:59:40 +05:30
parent feb3911d46
commit c3ee31a565
34 changed files with 1099 additions and 2 deletions

View File

@@ -0,0 +1 @@
export * from "./solid-start.adapter";

View File

@@ -0,0 +1,16 @@
import { afterAll, beforeAll, describe } from "bun:test";
import * as solidStart from "./solid-start.adapter";
import { disableConsoleLog, enableConsoleLog } from "core/utils";
import { adapterTestSuite } from "adapter/adapter-test-suite";
import { bunTestRunner } from "adapter/bun/test";
import type { SolidStartBkndConfig } from "./solid-start.adapter";
beforeAll(disableConsoleLog);
afterAll(enableConsoleLog);
describe("solid-start adapter", () => {
adapterTestSuite<SolidStartBkndConfig>(bunTestRunner, {
makeApp: solidStart.getApp,
makeHandler: solidStart.serve,
});
});

View File

@@ -0,0 +1,22 @@
import { createRuntimeApp, type RuntimeBkndConfig } from "bknd/adapter";
export type SolidStartEnv = NodeJS.ProcessEnv;
export type SolidStartBkndConfig<Env = SolidStartEnv> = RuntimeBkndConfig<Env>;
export async function getApp<Env = SolidStartEnv>(
config: SolidStartBkndConfig<Env>,
args: Env = process.env as Env,
) {
return await createRuntimeApp(config, args);
}
export function serve<Env = SolidStartEnv>(
config: SolidStartBkndConfig<Env> = {},
args: Env = process.env as Env,
) {
return async (req: Request) => {
const app = await getApp(config, args);
return app.fetch(req);
};
}