mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
init: solid start adapter
This commit is contained in:
@@ -340,6 +340,11 @@ async function buildAdapters() {
|
||||
platform: "node",
|
||||
}),
|
||||
|
||||
tsup.build({
|
||||
...baseConfig("solid-start"),
|
||||
platform: "node",
|
||||
}),
|
||||
|
||||
tsup.build({
|
||||
...baseConfig("sqlite/edge"),
|
||||
entry: ["src/adapter/sqlite/edge.ts"],
|
||||
|
||||
@@ -15,6 +15,9 @@ const configs = {
|
||||
nextjs: {
|
||||
base_path: "/admin",
|
||||
},
|
||||
"solid-start": {
|
||||
base_path: "/admin",
|
||||
},
|
||||
astro: {
|
||||
base_path: "/admin",
|
||||
},
|
||||
|
||||
@@ -258,6 +258,11 @@
|
||||
"import": "./dist/adapter/sveltekit/index.js",
|
||||
"require": "./dist/adapter/sveltekit/index.js"
|
||||
},
|
||||
"./adapter/solid-start": {
|
||||
"types": "./dist/types/adapter/solid-start/index.d.ts",
|
||||
"import": "./dist/adapter/solid-start/index.js",
|
||||
"require": "./dist/adapter/solid-start/index.js"
|
||||
},
|
||||
"./adapter/aws": {
|
||||
"types": "./dist/types/adapter/aws/index.d.ts",
|
||||
"import": "./dist/adapter/aws/index.js",
|
||||
@@ -292,6 +297,7 @@
|
||||
"adapter/node": ["./dist/types/adapter/node/index.d.ts"],
|
||||
"adapter/sveltekit": ["./dist/types/adapter/sveltekit/index.d.ts"],
|
||||
"adapter/tanstack-start": ["./dist/types/adapter/tanstack-start/index.d.ts"],
|
||||
"adapter/solid-start": ["./dist/types/adapter/solid-start/index.d.ts"],
|
||||
"adapter/sqlite": ["./dist/types/adapter/sqlite/edge.d.ts"]
|
||||
}
|
||||
},
|
||||
@@ -324,6 +330,7 @@
|
||||
"sveltekit",
|
||||
"svelte",
|
||||
"bun",
|
||||
"node"
|
||||
"node",
|
||||
"solid-start"
|
||||
]
|
||||
}
|
||||
|
||||
1
app/src/adapter/solid-start/index.ts
Normal file
1
app/src/adapter/solid-start/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./solid-start.adapter";
|
||||
16
app/src/adapter/solid-start/solid-start.adapter.spec.ts
Normal file
16
app/src/adapter/solid-start/solid-start.adapter.spec.ts
Normal 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,
|
||||
});
|
||||
});
|
||||
22
app/src/adapter/solid-start/solid-start.adapter.ts
Normal file
22
app/src/adapter/solid-start/solid-start.adapter.ts
Normal 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);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user