aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/hosted/hosted-astro-project/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/netlify/test/hosted/hosted-astro-project/src')
-rw-r--r--packages/integrations/netlify/test/hosted/hosted-astro-project/src/assets/penguin.pngbin0 -> 7295878 bytes
-rw-r--r--packages/integrations/netlify/test/hosted/hosted-astro-project/src/env.d.ts1
-rw-r--r--packages/integrations/netlify/test/hosted/hosted-astro-project/src/middleware.ts11
-rw-r--r--packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/country.astro7
-rw-r--r--packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/index.astro13
-rw-r--r--packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro5
6 files changed, 37 insertions, 0 deletions
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
--- /dev/null
+++ b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/assets/penguin.png
Binary files 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 @@
+/// <reference types="astro/client-image" />
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;
+---
+
+<h1>{country}</h1>
+<h3>{country ? 'has context' : 'no context'}</h3>
+<h2>{Astro.locals.runtime}</h2>
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';
+---
+
+<Image src={penguin} width={300} alt="" />
+
+<Image
+ src="https://images.unsplash.com/photo-1567674867291-b2595ac53ab4"
+ width={300}
+ height={400}
+ alt="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}