chore: remove unused patch file
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 33s
All checks were successful
deploy to cloudflare pages / deploy (push) Successful in 33s
This commit is contained in:
parent
df35978722
commit
43e80a4688
1 changed files with 0 additions and 57 deletions
|
@ -1,57 +0,0 @@
|
||||||
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<string, any>} */
|
|
||||||
- const env = {};
|
|
||||||
- const prerender_platform = /** @type {App.Platform} */ (/** @type {unknown} */ ({ env }));
|
|
||||||
+ /** @type {Record<string, any>} */
|
|
||||||
+ 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;
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Add table
Add a link
Reference in a new issue