@sveltejs/adapter-cloudflare-workers
Advanced tools
Comparing version 1.0.0-next.33 to 1.0.0-next.34
@@ -1,3 +0,3 @@ | ||
declare module 'APP' { | ||
export { App } from '@sveltejs/kit'; | ||
declare module 'SERVER' { | ||
export { Server } from '@sveltejs/kit'; | ||
} | ||
@@ -11,1 +11,8 @@ | ||
} | ||
declare abstract class FetchEvent extends Event { | ||
readonly request: Request; | ||
respondWith(promise: Response | Promise<Response>): void; | ||
passThroughOnException(): void; | ||
waitUntil(promise: Promise<any>): void; | ||
} |
@@ -1,6 +0,6 @@ | ||
import { App } from 'APP'; | ||
import { Server } from 'SERVER'; | ||
import { manifest, prerendered } from 'MANIFEST'; | ||
import { getAssetFromKV } from '@cloudflare/kv-asset-handler'; | ||
const app = new App(manifest); | ||
const server = new Server(manifest); | ||
@@ -53,3 +53,3 @@ const prefix = `/${manifest.appDir}/`; | ||
try { | ||
return await app.render(request); | ||
return await server.respond(request); | ||
} catch (e) { | ||
@@ -56,0 +56,0 @@ return new Response('Error rendering route:' + (e.message || e.toString()), { status: 500 }); |
14
index.js
@@ -16,3 +16,6 @@ import { existsSync, readFileSync, writeFileSync } from 'fs'; | ||
const bucket = site.bucket; | ||
// @ts-ignore | ||
const { bucket } = site; | ||
// @ts-ignore | ||
const entrypoint = site['entry-point'] || 'workers-site'; | ||
@@ -27,5 +30,3 @@ | ||
builder.log.info('Prerendering static pages...'); | ||
const { paths } = await builder.prerender({ | ||
dest: bucket | ||
}); | ||
const prerendered = await builder.prerender({ dest: bucket }); | ||
@@ -44,3 +45,3 @@ builder.log.info('Installing worker dependencies...'); | ||
replace: { | ||
APP: `${relativePath}/app.js`, | ||
SERVER: `${relativePath}/index.js`, | ||
MANIFEST: './manifest.js' | ||
@@ -54,3 +55,3 @@ } | ||
relativePath | ||
})};\n\nexport const prerendered = new Set(${JSON.stringify(paths)});\n` | ||
})};\n\nexport const prerendered = new Set(${JSON.stringify(prerendered.paths)});\n` | ||
); | ||
@@ -87,2 +88,3 @@ | ||
// @ts-ignore | ||
if (!wrangler_config.site || !wrangler_config.site.bucket) { | ||
@@ -89,0 +91,0 @@ throw new Error( |
{ | ||
"name": "@sveltejs/adapter-cloudflare-workers", | ||
"version": "1.0.0-next.33", | ||
"version": "1.0.0-next.34", | ||
"repository": { | ||
@@ -30,4 +30,3 @@ "type": "git", | ||
"@cloudflare/kv-asset-handler": "^0.2.0", | ||
"@cloudflare/workers-types": "^3.3.0", | ||
"@sveltejs/kit": "1.0.0-next.266" | ||
"@sveltejs/kit": "1.0.0-next.280" | ||
}, | ||
@@ -34,0 +33,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10377
2
157