-
Notifications
You must be signed in to change notification settings - Fork 84
add defineCloudflareConfig utility
#412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
8b3e3bc
add `defineConfig` utility
dario-piotrowicz 508ec2c
add `defineConfig` utility
dario-piotrowicz 8017fec
`defineConfig` -> `defineCloudflareConfig`
dario-piotrowicz d56c5b0
remove unnecessary `dangerous.enableCacheInterception` option
dario-piotrowicz 36cb6d0
improve jsdoc comments
dario-piotrowicz fe3a51b
update some missing `open-next.config.ts` files
dario-piotrowicz 1cb04e3
Update packages/cloudflare/src/api/config.ts
dario-piotrowicz 6881358
remove unnecessary empty object
dario-piotrowicz ea6e59d
remove unnecessary package.json export
dario-piotrowicz cbbdd6a
re-export `defineCloudflareConfig` from index
dario-piotrowicz a95dfcd
reorder `defineCloudflareConfig` import
dario-piotrowicz 24d7032
update jsdoc comments to point to cloudflare caching doc page
dario-piotrowicz 7d00c94
Apply suggestions from code review
dario-piotrowicz c3973ef
remove unnecessary async await
dario-piotrowicz b22e564
fix incorrect type
dario-piotrowicz b9b9ade
add back await
dario-piotrowicz 121c363
bump `@opennextjs/aws` dependency to `https://pkg.pr.new/@opennextjs/…
dario-piotrowicz 1f3e289
Apply suggestions from code review
dario-piotrowicz f5e69d5
fix broken types
dario-piotrowicz f29e5c0
use consistent names in overrides
dario-piotrowicz 77d2a25
remove no-longer valid changeset
dario-piotrowicz 9f47151
update some inconsistent imports
dario-piotrowicz 53e43d2
update last missing import
dario-piotrowicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,20 @@ | ||
| --- | ||
| "@opennextjs/cloudflare": patch | ||
| --- | ||
|
|
||
| add `defineCloudflareConfig` utility | ||
|
|
||
| this change adds a new `defineCloudflareConfig` utility that developers can use in their `open-next.config.ts` | ||
| file to easily generate a configuration compatible with the adapter | ||
|
|
||
| Example usage: | ||
|
|
||
| ```ts | ||
| // open-next.config.ts | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
| import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
|
|
||
| export default defineCloudflareConfig({ | ||
| incrementalCache: kvIncrementalCache, | ||
| }); | ||
| ``` |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,3 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| // Unused implementation | ||
| incrementalCache: "dummy", | ||
| tagCache: "dummy", | ||
| queue: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig(); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,3 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| // Unused implementation | ||
| incrementalCache: "dummy", | ||
| tagCache: "dummy", | ||
| queue: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig(); | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,24 +1,3 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| incrementalCache: "dummy", | ||
| tagCache: "dummy", | ||
| queue: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig(); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,3 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| // Unused implementation | ||
| incrementalCache: "dummy", | ||
| tagCache: "dummy", | ||
| queue: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig(); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,27 +1,8 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import kvCache from "@opennextjs/cloudflare/kv-cache"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
| import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
| import memoryQueue from "@opennextjs/cloudflare/memory-queue"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| incrementalCache: () => kvCache, | ||
| queue: () => memoryQueue, | ||
| // Unused implementation | ||
| tagCache: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig({ | ||
| incrementalCache: kvIncrementalCache, | ||
| queue: memoryQueue, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,27 +1,10 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import tagCache from "@opennextjs/cloudflare/d1-tag-cache"; | ||
| import incrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
| import d1TagCache from "@opennextjs/cloudflare/d1-tag-cache"; | ||
| import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
| import memoryQueue from "@opennextjs/cloudflare/memory-queue"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| incrementalCache: async () => incrementalCache, | ||
| tagCache: () => tagCache, | ||
| queue: () => memoryQueue, | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig({ | ||
| incrementalCache: kvIncrementalCache, | ||
| tagCache: d1TagCache, | ||
| queue: memoryQueue, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,27 +1,8 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import kvCache from "@opennextjs/cloudflare/kv-cache"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
| import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
| import memoryQueue from "@opennextjs/cloudflare/memory-queue"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| incrementalCache: () => kvCache, | ||
| queue: () => memoryQueue, | ||
| // Unused implementation | ||
| tagCache: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig({ | ||
| incrementalCache: kvIncrementalCache, | ||
| queue: memoryQueue, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,3 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| // Unused implementation | ||
| incrementalCache: "dummy", | ||
| tagCache: "dummy", | ||
| queue: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig(); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,25 +1,3 @@ | ||
| import type { OpenNextConfig } from '@opennextjs/aws/types/open-next.js'; | ||
| import { defineCloudflareConfig } from '@opennextjs/cloudflare/config'; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: 'cloudflare-node', | ||
| converter: 'edge', | ||
| // Unused implementation | ||
| incrementalCache: 'dummy', | ||
| tagCache: 'dummy', | ||
| queue: 'dummy', | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: 'cloudflare-edge', | ||
| converter: 'edge', | ||
| proxyExternalRequest: 'fetch', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig(); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,26 +1,6 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import cache from "@opennextjs/cloudflare/kv-cache"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
| import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| incrementalCache: async () => cache, | ||
| queue: "direct", | ||
| // Unused implementation | ||
| tagCache: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig({ | ||
| incrementalCache: kvIncrementalCache, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,26 +1,6 @@ | ||
| import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; | ||
| import cache from "@opennextjs/cloudflare/kv-cache"; | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
| import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
|
|
||
| const config: OpenNextConfig = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| incrementalCache: async () => cache, | ||
| queue: "direct", | ||
| // Unused implementation | ||
| tagCache: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig({ | ||
| incrementalCache: kvIncrementalCache, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,26 +1,6 @@ | ||
| // default open-next.config.ts file created by @opennextjs/cloudflare | ||
| import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | ||
| import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; | ||
|
|
||
| import cache from "@opennextjs/cloudflare/kv-cache"; | ||
|
|
||
| const config = { | ||
| default: { | ||
| override: { | ||
| wrapper: "cloudflare-node", | ||
| converter: "edge", | ||
| incrementalCache: async () => cache, | ||
| tagCache: "dummy", | ||
| queue: "dummy", | ||
| }, | ||
| }, | ||
|
|
||
| middleware: { | ||
| external: true, | ||
| override: { | ||
| wrapper: "cloudflare-edge", | ||
| converter: "edge", | ||
| proxyExternalRequest: "fetch", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
| export default defineCloudflareConfig({ | ||
| incrementalCache: kvIncrementalCache, | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.