-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Netlify Edge: forward requests for static assets (#3170)
* Netlify Edge: forward requests for static assets * Adds a changeset * Don't run edge tests, yet
- Loading branch information
Showing
14 changed files
with
106 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'astro': patch | ||
'@astrojs/netlify': patch | ||
--- | ||
|
||
Netlify Edge: Forward requests for static assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/integrations/netlify/test/edge-functions/fixtures/root-dynamic/astro.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import { netlifyEdgeFunctions } from '@astrojs/netlify'; | ||
|
||
export default defineConfig({ | ||
adapter: netlifyEdgeFunctions({ | ||
dist: new URL('./dist/', import.meta.url), | ||
}), | ||
experimental: { | ||
ssr: true | ||
} | ||
}) |
9 changes: 9 additions & 0 deletions
9
packages/integrations/netlify/test/edge-functions/fixtures/root-dynamic/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@test/netlify-edge-root-dynamic", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"astro": "workspace:*", | ||
"@astrojs/netlify": "workspace:*" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/integrations/netlify/test/edge-functions/fixtures/root-dynamic/public/styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: blue; | ||
} |
9 changes: 9 additions & 0 deletions
9
...s/integrations/netlify/test/edge-functions/fixtures/root-dynamic/src/pages/[...all].astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html> | ||
<head> | ||
<title>Testing</title> | ||
<link rel="stylesheet" href="/styles.css"> | ||
</head> | ||
<body> | ||
<h1>Testing</h1> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
packages/integrations/netlify/test/edge-functions/root-dynamic.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @ts-ignore | ||
import { runBuild } from './test-utils.ts'; | ||
// @ts-ignore | ||
import { assertEquals, assert, DOMParser } from './deps.ts'; | ||
|
||
// @ts-ignore | ||
Deno.test({ | ||
name: 'Assets are preferred over HTML routes', | ||
async fn() { | ||
let close = await runBuild('./fixtures/root-dynamic/'); | ||
const { default: handler } = await import('./fixtures/root-dynamic/dist/edge-functions/entry.js'); | ||
const response = await handler(new Request('http://example.com/styles.css')); | ||
assertEquals(response, undefined, 'No response because this is an asset'); | ||
await close(); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.