-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(@astrojs/cloudflare): port functionPerRoute (#8078)
* port functionPerRoute to cloudflare * add changeset * port bugfix to next * update changeset * Update packages/astro/src/core/build/generate.ts Co-authored-by: Emanuele Stoppa <[email protected]> * update changeset * update README * add TODO comment * Update .changeset/wise-cameras-agree.md Co-authored-by: Sarah Rainsberger <[email protected]> * Update .changeset/wise-cameras-agree.md Co-authored-by: Sarah Rainsberger <[email protected]> * Update .changeset/nasty-garlics-listen.md Co-authored-by: Sarah Rainsberger <[email protected]> * update README * Update .changeset/wise-cameras-agree.md Co-authored-by: Yan Thomas <[email protected]> * Update packages/integrations/cloudflare/README.md Co-authored-by: Yan Thomas <[email protected]> --------- Co-authored-by: Emanuele Stoppa <[email protected]> Co-authored-by: Sarah Rainsberger <[email protected]> Co-authored-by: Yan Thomas <[email protected]>
- Loading branch information
1 parent
bbf0b74
commit 2540fee
Showing
20 changed files
with
97 additions
and
34 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,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Reimplement https://github.com/withastro/astro/pull/7509 to correctly emit pre-rendered pages now that `build.split` is deprecated and this configuration has been moved to `functionPerRoute` inside the adapter. |
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,23 @@ | ||
--- | ||
'@astrojs/cloudflare': major | ||
--- | ||
|
||
The configuration `build.split` and `build.excludeMiddleware` are deprecated. | ||
|
||
You can now configure this behavior using `functionPerRoute` in your Cloudflare integration config: | ||
|
||
```diff | ||
import {defineConfig} from "astro/config"; | ||
import cloudflare from '@astrojs/cloudflare'; | ||
|
||
export default defineConfig({ | ||
- build: { | ||
- split: true | ||
- }, | ||
- adapter: cloudflare() | ||
+ adapter: cloudflare({ | ||
+ mode: 'directory', | ||
+ functionPerRoute: true | ||
+ }) | ||
}) | ||
``` |
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
15 changes: 15 additions & 0 deletions
15
packages/integrations/cloudflare/test/fixtures/function-per-route/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,15 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import cloudflare from '@astrojs/cloudflare'; | ||
|
||
export default defineConfig({ | ||
adapter: cloudflare({ | ||
mode: 'directory', | ||
functionPerRoute: true | ||
}), | ||
output: 'server', | ||
vite: { | ||
build: { | ||
minify: false, | ||
}, | ||
}, | ||
}); |
2 changes: 1 addition & 1 deletion
2
...oudflare/test/fixtures/split/package.json → .../fixtures/function-per-route/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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 3 additions & 15 deletions
18
...s/cloudflare/test/directory-split.test.js → ...loudflare/test/function-per-route.test.js
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.