From e586d7d704d475afe3373a1de6ae20d504f79d6d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 14:25:23 +0000 Subject: Sync from a8e1c0a7402940e0fc5beef669522b315052df1b --- .../hosted-astro-project/src/assets/penguin.png | Bin 0 -> 7295878 bytes .../test/hosted/hosted-astro-project/src/env.d.ts | 1 + .../hosted/hosted-astro-project/src/middleware.ts | 11 +++++++++++ .../hosted-astro-project/src/pages/country.astro | 7 +++++++ .../hosted/hosted-astro-project/src/pages/index.astro | 13 +++++++++++++ .../hosted/hosted-astro-project/src/pages/time.astro | 5 +++++ 6 files changed, 37 insertions(+) create mode 100644 packages/integrations/netlify/test/hosted/hosted-astro-project/src/assets/penguin.png create mode 100644 packages/integrations/netlify/test/hosted/hosted-astro-project/src/env.d.ts create mode 100644 packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts create mode 100644 packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/country.astro create mode 100644 packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/index.astro create mode 100644 packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro (limited to 'packages/integrations/netlify/test/hosted/hosted-astro-project/src') diff --git a/packages/integrations/netlify/test/hosted/hosted-astro-project/src/assets/penguin.png b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/assets/penguin.png new file mode 100644 index 000000000..218acde5b Binary files /dev/null and b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/assets/penguin.png differ diff --git a/packages/integrations/netlify/test/hosted/hosted-astro-project/src/env.d.ts b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/env.d.ts new file mode 100644 index 000000000..f7cbe9c1d --- /dev/null +++ b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts new file mode 100644 index 000000000..1112a3566 --- /dev/null +++ b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts @@ -0,0 +1,11 @@ +import https from 'node:https'; + +export const onRequest = (context, next) => { + console.info(context.netlify); + context.locals.middleware = context?.locals?.netlify?.context?.geo?.country?.code ?? null; + context.locals.runtime = 'Deno' in globalThis ? 'Deno' : 'Node'; + context.locals.title = 'Middleware'; + context.locals.nodePrefixedImportExists = !!https; + + return next(); +}; diff --git a/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/country.astro b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/country.astro new file mode 100644 index 000000000..cad7116d6 --- /dev/null +++ b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/country.astro @@ -0,0 +1,7 @@ +--- +const country = Astro.locals.middleware; +--- + +

{country}

+

{country ? 'has context' : 'no context'}

+

{Astro.locals.runtime}

diff --git a/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/index.astro b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/index.astro new file mode 100644 index 000000000..7d2cfcdc3 --- /dev/null +++ b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/index.astro @@ -0,0 +1,13 @@ +--- +import { Image } from 'astro:assets'; +import penguin from '../assets/penguin.png'; +--- + + + +Astro diff --git a/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro new file mode 100644 index 000000000..873b5c720 --- /dev/null +++ b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro @@ -0,0 +1,5 @@ +--- +const currentTime = new Date().getTime(); +--- + +{currentTime} -- cgit v1.2.3