mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 00:26:01 +00:00
fix: updated cloudflare adapter to use runtime config, aligned vite
This commit is contained in:
@@ -40,7 +40,6 @@ export async function getCached<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
);
|
||||
await config.beforeBuild?.(app);
|
||||
},
|
||||
adminOptions: { html: config.html },
|
||||
},
|
||||
{ env, ctx, ...args },
|
||||
);
|
||||
|
||||
@@ -25,9 +25,7 @@ export async function getDurable<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
|
||||
const res = await stub.fire(ctx.request, {
|
||||
config: create_config,
|
||||
html: config.html,
|
||||
keepAliveSeconds: config.keepAliveSeconds,
|
||||
setAdminHtml: config.setAdminHtml,
|
||||
});
|
||||
|
||||
const headers = new Headers(res.headers);
|
||||
@@ -110,6 +108,7 @@ export class DurableBkndApp extends DurableObject {
|
||||
}
|
||||
|
||||
async onBuilt(app: App) {}
|
||||
|
||||
async beforeBuild(app: App) {}
|
||||
|
||||
protected keepAlive(seconds: number) {
|
||||
|
||||
@@ -7,22 +7,15 @@ export async function makeApp<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
args: Env = {} as Env,
|
||||
opts?: RuntimeOptions,
|
||||
) {
|
||||
return await createRuntimeApp<Env>(
|
||||
{
|
||||
...makeConfig(config, args),
|
||||
adminOptions: config.html ? { html: config.html } : undefined,
|
||||
},
|
||||
args,
|
||||
opts,
|
||||
);
|
||||
return await createRuntimeApp<Env>(makeConfig(config, args), args, opts);
|
||||
}
|
||||
|
||||
export async function getWarm<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
export async function getFresh<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
config: CloudflareBkndConfig<Env>,
|
||||
ctx: Context<Env>,
|
||||
opts: RuntimeOptions = {},
|
||||
) {
|
||||
const app = await makeApp(
|
||||
return await makeApp(
|
||||
{
|
||||
...config,
|
||||
onBuilt: async (app) => {
|
||||
@@ -33,16 +26,4 @@ export async function getWarm<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
ctx.env,
|
||||
opts,
|
||||
);
|
||||
return app.fetch(ctx.request);
|
||||
}
|
||||
|
||||
export async function getFresh<Env extends CloudflareEnv = CloudflareEnv>(
|
||||
config: CloudflareBkndConfig<Env>,
|
||||
ctx: Context<Env>,
|
||||
opts: RuntimeOptions = {},
|
||||
) {
|
||||
return await getWarm(config, ctx, {
|
||||
...opts,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user