Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
d670adf0
Commit
d670adf0
authored
Feb 09, 2026
by
Jimmy Lai
Browse files
Options
Browse Files
Download
Plain Diff
stack: merge cache-fix into node-stream-rewrite
parents
7a8a6944
6b6a8edb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
15 deletions
+46
-15
cache.js
packages/next/cache.js
+46
-15
No files found.
packages/next/cache.js
View file @
d670adf0
const
cacheExports
=
{
unstable_cache
:
require
(
'next/dist/server/web/spec-extension/unstable-cache'
)
.
unstable_cache
,
let
cacheExports
updateTag
:
require
(
'next/dist/server/web/spec-extension/revalidate'
)
.
updateTag
,
if
(
process
.
env
.
NEXT_RUNTIME
===
''
)
{
const
notAvailableInClient
=
(
name
)
=>
{
return
function
notAvailable
()
{
throw
new
Error
(
`\`
${
name
}
\` is only available in a Server Component.`
)
}
}
cacheExports
=
{
unstable_cache
:
function
unstable_cache
(
cb
)
{
// Legacy behavior: allow importing/using unstable_cache from client bundles
// without pulling in server internals.
if
(
typeof
cb
!==
'function'
)
return
cb
return
function
cached
()
{
return
cb
.
apply
(
this
,
arguments
)
}
},
unstable_noStore
:
function
unstable_noStore
()
{},
updateTag
:
notAvailableInClient
(
'updateTag'
),
revalidateTag
:
notAvailableInClient
(
'revalidateTag'
),
revalidatePath
:
notAvailableInClient
(
'revalidatePath'
),
refresh
:
notAvailableInClient
(
'refresh'
),
cacheLife
:
notAvailableInClient
(
'cacheLife'
),
cacheTag
:
notAvailableInClient
(
'cacheTag'
),
}
}
else
{
// Keep server requires in this branch so browser builds can DCE them.
cacheExports
=
{
unstable_cache
:
require
(
'next/dist/server/web/spec-extension/unstable-cache'
)
.
unstable_cache
,
updateTag
:
require
(
'next/dist/server/web/spec-extension/revalidate'
)
.
updateTag
,
revalidateTag
:
require
(
'next/dist/server/web/spec-extension/revalidate'
)
.
revalidateTag
,
revalidatePath
:
require
(
'next/dist/server/web/spec-extension/revalidate'
)
.
revalidatePath
,
revalidateTag
:
require
(
'next/dist/server/web/spec-extension/revalidate'
)
.
revalidateTag
,
revalidatePath
:
require
(
'next/dist/server/web/spec-extension/revalidate'
)
.
revalidatePath
,
refresh
:
require
(
'next/dist/server/web/spec-extension/revalidate'
).
refresh
,
refresh
:
require
(
'next/dist/server/web/spec-extension/revalidate'
).
refresh
,
unstable_noStore
:
require
(
'next/dist/server/web/spec-extension/unstable-no-store'
)
.
unstable_noStore
,
cacheLife
:
require
(
'next/dist/server/use-cache/cache-life'
).
cacheLife
,
cacheTag
:
require
(
'next/dist/server/use-cache/cache-tag'
).
cacheTag
,
unstable_noStore
:
require
(
'next/dist/server/web/spec-extension/unstable-no-store'
)
.
unstable_noStore
,
cacheLife
:
require
(
'next/dist/server/use-cache/cache-life'
).
cacheLife
,
cacheTag
:
require
(
'next/dist/server/use-cache/cache-tag'
).
cacheTag
,
}
}
let
didWarnCacheLife
=
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment