From 24b7d17ab3de1724030416103f99bf80d99dd9ff Mon Sep 17 00:00:00 2001 From: Gaoyao Massimo Hu Date: Tue, 17 Dec 2024 16:58:55 +0100 Subject: [PATCH 1/6] fix: unique imports in #nitro-internal-virtual/server-handlers-meta --- src/rollup/plugins/handlers.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rollup/plugins/handlers.ts b/src/rollup/plugins/handlers.ts index 87108a1123..eeabdc7892 100644 --- a/src/rollup/plugins/handlers.ts +++ b/src/rollup/plugins/handlers.ts @@ -93,10 +93,11 @@ ${handlers }, "#nitro-internal-virtual/server-handlers-meta": () => { const handlers = getHandlers(); + const imports = unique(handlers.map((h) => h.handler)); return /* js */ ` - ${handlers + ${imports .map( - (h) => `import ${getImportId(h.handler)}Meta from "${h.handler}?meta";` + (handler) => `import ${getImportId(handler)}Meta from "${handler}?meta";` ) .join("\n")} export const handlersMeta = [ From f26ea5d96a4adc73f8369b612f8bfe540a4b76e8 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 19 Dec 2024 22:28:54 +0100 Subject: [PATCH 2/6] test: add fixture --- test/fixture/nitro.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/fixture/nitro.config.ts b/test/fixture/nitro.config.ts index 63d8eca4cd..06639ebdaa 100644 --- a/test/fixture/nitro.config.ts +++ b/test/fixture/nitro.config.ts @@ -24,6 +24,11 @@ export default defineNitroConfig({ // @ts-expect-error #2382 method: "GET", }, + { + route: "/api/hello2", + handler: "~/api/hello.ts", + method: "GET", + } ], devProxy: { "/proxy/example": { target: "https://example.com", changeOrigin: true }, From 153b6c609d4d6034b6c52deb7f280d8744430305 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:29:59 +0000 Subject: [PATCH 3/6] chore: apply automated updates --- test/fixture/nitro.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixture/nitro.config.ts b/test/fixture/nitro.config.ts index 06639ebdaa..fc7952228d 100644 --- a/test/fixture/nitro.config.ts +++ b/test/fixture/nitro.config.ts @@ -28,7 +28,7 @@ export default defineNitroConfig({ route: "/api/hello2", handler: "~/api/hello.ts", method: "GET", - } + }, ], devProxy: { "/proxy/example": { target: "https://example.com", changeOrigin: true }, From d338d6ccfb641ac90c9eb0b0f7664204f5b9bfab Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:37:56 +0000 Subject: [PATCH 4/6] chore: apply automated updates --- src/presets/cloudflare/runtime/cloudflare-pages.ts | 6 +++++- src/runtime/internal/storage.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/presets/cloudflare/runtime/cloudflare-pages.ts b/src/presets/cloudflare/runtime/cloudflare-pages.ts index a7f59cad6e..753de02d7d 100644 --- a/src/presets/cloudflare/runtime/cloudflare-pages.ts +++ b/src/presets/cloudflare/runtime/cloudflare-pages.ts @@ -41,7 +41,11 @@ export default { import.meta._websocket && request.headers.get("upgrade") === "websocket" ) { - return ws!.handleUpgrade(request as any, env, context as unknown as ExecutionContext); + return ws!.handleUpgrade( + request as any, + env, + context as unknown as ExecutionContext + ); } const url = new URL(request.url); diff --git a/src/runtime/internal/storage.ts b/src/runtime/internal/storage.ts index ad76e9098e..66dee2faa6 100644 --- a/src/runtime/internal/storage.ts +++ b/src/runtime/internal/storage.ts @@ -5,5 +5,7 @@ import { storage } from "#nitro-internal-virtual/storage"; export function useStorage( base = "" ): Storage { - return (base ? prefixStorage(storage, base) : storage) as unknown as Storage; + return (base + ? prefixStorage(storage, base) + : storage) as unknown as Storage; } From d60a16b6c85acf224ffebf7b50d5a1435d6e665f Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 19 Dec 2024 22:41:18 +0100 Subject: [PATCH 5/6] update fixture --- test/fixture/nitro.config.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/fixture/nitro.config.ts b/test/fixture/nitro.config.ts index fc7952228d..59a6958c06 100644 --- a/test/fixture/nitro.config.ts +++ b/test/fixture/nitro.config.ts @@ -26,8 +26,7 @@ export default defineNitroConfig({ }, { route: "/api/hello2", - handler: "~/api/hello.ts", - method: "GET", + handler: "~/api/hello.ts" }, ], devProxy: { From c5433e8c7549c87acbc67bce3aee2c11027b4883 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:42:11 +0000 Subject: [PATCH 6/6] chore: apply automated updates --- test/fixture/nitro.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixture/nitro.config.ts b/test/fixture/nitro.config.ts index 59a6958c06..c9f35e67d2 100644 --- a/test/fixture/nitro.config.ts +++ b/test/fixture/nitro.config.ts @@ -26,7 +26,7 @@ export default defineNitroConfig({ }, { route: "/api/hello2", - handler: "~/api/hello.ts" + handler: "~/api/hello.ts", }, ], devProxy: {