diff --git a/bun.lockb b/bun.lockb index 6d350b7..6084e67 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 906ddcb..6ffac9e 100644 --- a/package.json +++ b/package.json @@ -34,5 +34,8 @@ "typescript-eslint": "^8.11.0", "vite": "^5.4.10" }, - "type": "module" -} + "type": "module", + "patchedDependencies": { + "@sveltejs/adapter-cloudflare@4.7.4": "patches/@sveltejs%2Fadapter-cloudflare@4.7.4.patch" + } +} \ No newline at end of file diff --git a/patches/@sveltejs%2Fadapter-cloudflare@4.7.4.patch b/patches/@sveltejs%2Fadapter-cloudflare@4.7.4.patch new file mode 100644 index 0000000..ed91f99 --- /dev/null +++ b/patches/@sveltejs%2Fadapter-cloudflare@4.7.4.patch @@ -0,0 +1,57 @@ +diff --git a/index.js b/index.js +index 0fe55898e5697fc6a061299780e163ca4553cb05..e9fb7fea0082c7d3df7b07df21bd99cca6c4957c 100644 +--- a/index.js ++++ b/index.js +@@ -144,29 +144,33 @@ export default function (options = {}) { + ); + } + }, +- async emulate() { +- const proxy = await getPlatformProxy(options.platformProxy); +- const platform = /** @type {App.Platform} */ ({ +- env: proxy.env, +- context: proxy.ctx, +- caches: proxy.caches, +- cf: proxy.cf +- }); ++ emulate() { ++ const getting_platform = (async () => { ++ const proxy = await getPlatformProxy(options.platformProxy); ++ const platform = /** @type {App.Platform} */ ({ ++ env: proxy.env, ++ context: proxy.ctx, ++ caches: proxy.caches, ++ cf: proxy.cf ++ }); + +- /** @type {Record} */ +- const env = {}; +- const prerender_platform = /** @type {App.Platform} */ (/** @type {unknown} */ ({ env })); ++ /** @type {Record} */ ++ const env = {}; ++ const prerender_platform = /** @type {App.Platform} */ (/** @type {unknown} */ ({ env })); + +- for (const key in proxy.env) { +- Object.defineProperty(env, key, { +- get: () => { +- throw new Error(`Cannot access platform.env.${key} in a prerenderable route`); +- } +- }); +- } ++ for (const key in proxy.env) { ++ Object.defineProperty(env, key, { ++ get: () => { ++ throw new Error(`Cannot access platform.env.${key} in a prerenderable route`); ++ } ++ }); ++ } ++ return { platform, prerender_platform }; ++ })(); + + return { +- platform: ({ prerender }) => { ++ platform: async ({ prerender }) => { ++ const { platform, prerender_platform } = await getting_platform; + return prerender ? prerender_platform : platform; + } + };