Skip to content

Commit d19b949

Browse files
committed
feat: add middleware support
middleware step
1 parent 29aa483 commit d19b949

File tree

24 files changed

+2151
-97
lines changed

24 files changed

+2151
-97
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ node_modules
33

44
output
55
.worker-next
6-
.save.next
6+
.open-next
7+
.wrangler
78
dist

examples/api/open-next.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { OpenNextConfig } from "@opennextjs/aws/types/open-next";
2+
3+
const config: OpenNextConfig = {
4+
default: {},
5+
6+
middleware: {
7+
external: true,
8+
override: {
9+
wrapper: "cloudflare",
10+
converter: "edge",
11+
},
12+
},
13+
};
14+
15+
export default config;

examples/api/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
]
2020
},
2121
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx", "worker-configuration.d.ts"],
22-
"exclude": ["node_modules"]
22+
"exclude": ["node_modules", "open-next.config.ts"]
2323
}

examples/api/wrangler.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#:schema node_modules/wrangler/config-schema.json
22
name = "api"
3-
main = ".worker-next/index.mjs"
4-
compatibility_date = "2024-09-16"
5-
compatibility_flags = ["nodejs_compat_v2"]
3+
main = ".open-next/index.mjs"
4+
compatibility_date = "2024-09-23"
5+
compatibility_flags = ["nodejs_compat"]
66

7-
assets = { directory = ".worker-next/assets", binding = "ASSETS" }
7+
assets = { directory = ".open-next/assets", binding = "ASSETS" }
88

99
[vars]
1010
hello = 'Hello World from the cloudflare context!'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { OpenNextConfig } from "@opennextjs/aws/types/open-next";
2+
3+
const config: OpenNextConfig = {
4+
default: {},
5+
6+
middleware: {
7+
external: true,
8+
override: {
9+
wrapper: "cloudflare",
10+
converter: "edge",
11+
},
12+
},
13+
};
14+
15+
export default config;

examples/create-next-app/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
}
2323
},
2424
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25-
"exclude": ["node_modules"]
25+
"exclude": ["node_modules", "open-next.config.ts"]
2626
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#:schema node_modules/wrangler/config-schema.json
22
name = "create-next-app"
3-
main = ".worker-next/index.mjs"
3+
main = ".open-next/index.mjs"
44

5-
compatibility_date = "2024-08-29"
6-
compatibility_flags = ["nodejs_compat_v2"]
5+
compatibility_date = "2024-09-23"
6+
compatibility_flags = ["nodejs_compat"]
77

88
# Use the new Workers + Assets to host the static frontend files
9-
assets = { directory = ".worker-next/assets", binding = "ASSETS" }
9+
assets = { directory = ".open-next/assets", binding = "ASSETS" }

examples/middleware/wrangler.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#:schema node_modules/wrangler/config-schema.json
2+
name = "middleware"
3+
main = ".open-next/index.mjs"
4+
5+
compatibility_date = "2024-09-23"
6+
compatibility_flags = ["nodejs_compat"]
7+
8+
# Use the new Workers + Assets to host the static frontend files
9+
assets = { directory = ".open-next/assets", binding = "ASSETS" }
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { OpenNextConfig } from "@opennextjs/aws/types/open-next";
2+
3+
const config: OpenNextConfig = {
4+
default: {},
5+
6+
middleware: {
7+
external: true,
8+
override: {
9+
wrapper: "cloudflare",
10+
converter: "edge",
11+
},
12+
},
13+
};
14+
15+
export default config;

examples/vercel-blog-starter/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
}
2323
},
2424
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25-
"exclude": ["node_modules"]
25+
"exclude": ["node_modules", "open-next.config.ts"]
2626
}

0 commit comments

Comments
 (0)