From 51d13e2f6ce3a9e03c33d80af6716847f6a78061 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 15 Oct 2024 15:07:18 +0100 Subject: [PATCH] feat: accept `URL` for entry points (#12226) Co-authored-by: Bjorn Lu --- .changeset/eighty-donkeys-fly.md | 14 ++++++++++++++ packages/astro/src/core/client-directive/build.ts | 6 +++++- packages/astro/src/core/preview/index.ts | 2 +- packages/astro/src/core/render/renderer.ts | 2 +- packages/astro/src/core/routing/manifest/create.ts | 2 +- packages/astro/src/integrations/hooks.ts | 4 +++- packages/astro/src/runtime/server/hydration.ts | 4 +++- .../astro/src/toolbar/vite-plugin-dev-toolbar.ts | 4 ++-- packages/astro/src/types/public/integrations.ts | 14 +++++++------- packages/astro/src/types/public/toolbar.ts | 2 +- packages/astro/src/virtual-modules/container.ts | 2 +- .../vite-plugin-integrations-container/index.ts | 2 +- .../middleware-no-user-middleware/astro.config.mjs | 5 +++++ .../integration-middleware-url.js | 9 +++++++++ .../src/pages/url.astro | 0 .../multiple-renderers/renderers/two/index.mjs | 2 +- .../reuse-injected-entrypoint/astro.config.mjs | 9 +++++++-- packages/astro/test/middleware.test.js | 6 ++++++ .../astro/test/reuse-injected-entrypoint.test.js | 6 ++++++ 19 files changed, 74 insertions(+), 21 deletions(-) create mode 100644 .changeset/eighty-donkeys-fly.md create mode 100644 packages/astro/test/fixtures/middleware-no-user-middleware/integration-middleware-url.js create mode 100644 packages/astro/test/fixtures/middleware-no-user-middleware/src/pages/url.astro diff --git a/.changeset/eighty-donkeys-fly.md b/.changeset/eighty-donkeys-fly.md new file mode 100644 index 0000000000..8cec462363 --- /dev/null +++ b/.changeset/eighty-donkeys-fly.md @@ -0,0 +1,14 @@ +--- +'astro': minor +--- + +The following renderer fields and integration fields now accept `URL` as a type: + +**Renderers**: +- `AstroRenderer.clientEntrpoint` +- `AstroRenderer.serverEntrypoint` + +**Integrations**: +- `InjectedRoute.entrypoint` +- `AstroIntegrationMiddleware.entrypoint` +- `DevToolbarAppEntry.entrypoint` diff --git a/packages/astro/src/core/client-directive/build.ts b/packages/astro/src/core/client-directive/build.ts index e618a9e8a9..eafd07c3ce 100644 --- a/packages/astro/src/core/client-directive/build.ts +++ b/packages/astro/src/core/client-directive/build.ts @@ -4,7 +4,11 @@ import { build } from 'esbuild'; /** * Build a client directive entrypoint into code that can directly run in a `