Skip to content

Commit 5920fe7

Browse files
committed
Support Next.js specific IO semantics
Adds an export map for `next-js` condition and a new `index.next-js.ts` entrypoint for TSUP. converts the default test fixture to Next.js with cache components which will use the new entrypoint. Renames the existing test fixtures to use the latest Next.js release and not have cache components enabled which will continue to use the default entrypoint. To support cache components we use "use cache". However rather than actually caching all edge config reads we use cacheLife to determine whether the particular API call should be dynamic (zero expiration) or cached (default cache life). by default "use cache" will not ever reach out over the network so this should add minimal overhead to all edge config reads. However there is some serialization overhead. We will be updating Next.js to optimize cache reads that end up not caching the result (expiration zero) so that we can skip serialization and key generation. For now there may be a minor degredation in the fastest reads due to this additional overhead howevcer it will only affect users who are using Cache Components wiht Next.js and won't have any impact on other users.
1 parent 7a03863 commit 5920fe7

File tree

117 files changed

+467109
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+467109
-36
lines changed

.changeset/all-forks-camp.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@vercel/edge-config': patch
3+
'vercel-storage-integration-test-suite-legacy': patch
4+
---
5+
6+
New Next.js entrypoint for edge-config

packages/edge-config/package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
"sideEffects": false,
1313
"type": "module",
1414
"exports": {
15-
"import": "./dist/index.js",
16-
"require": "./dist/index.cjs"
15+
".": {
16+
"next-js": {
17+
"import": "./dist/index.next-js.js",
18+
"require": "./dist/index.next-js.cjs"
19+
},
20+
"import": "./dist/index.js",
21+
"require": "./dist/index.cjs"
22+
}
1723
},
1824
"main": "./dist/index.cjs",
1925
"module": "./dist/index.js",
@@ -53,6 +59,7 @@
5359
"eslint-config-custom": "workspace:*",
5460
"jest": "29.7.0",
5561
"jest-fetch-mock": "3.0.3",
62+
"next": "16.0.0-canary.15",
5663
"node-domexception": "2.0.1",
5764
"prettier": "3.5.2",
5865
"ts-jest": "29.2.6",
@@ -61,11 +68,15 @@
6168
"typescript": "5.7.3"
6269
},
6370
"peerDependencies": {
64-
"@opentelemetry/api": "^1.7.0"
71+
"@opentelemetry/api": "^1.7.0",
72+
"next": ">=1"
6573
},
6674
"peerDependenciesMeta": {
6775
"@opentelemetry/api": {
6876
"optional": true
77+
},
78+
"next": {
79+
"optional": true
6980
}
7081
},
7182
"engines": {

0 commit comments

Comments
 (0)