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
07cb54f7
Unverified
Commit
07cb54f7
authored
Aug 18, 2026
by
David Alexandru Ilie
Committed by
GitHub
Aug 18, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiled JWT compatibility with Node 26
parent
0b7e96f4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
45 deletions
+115
-45
package.json
packages/next/package.json
+1
-1
index.js
packages/next/src/compiled/jsonwebtoken/index.js
+2
-10
pnpm-lock.yaml
pnpm-lock.yaml
+57
-16
preview-fallback.test.ts
test/e2e/preview-fallback/preview-fallback.test.ts
+24
-18
jsonwebtoken-node-compat.test.ts
test/unit/jsonwebtoken-node-compat.test.ts
+31
-0
No files found.
packages/next/package.json
View file @
07cb54f7
...
@@ -279,7 +279,7 @@
...
@@ -279,7 +279,7 @@
"is-wsl"
:
"2.2.0"
,
"is-wsl"
:
"2.2.0"
,
"jest-worker"
:
"27.5.1"
,
"jest-worker"
:
"27.5.1"
,
"json5"
:
"2.2.3"
,
"json5"
:
"2.2.3"
,
"jsonwebtoken"
:
"9.0.
0
"
,
"jsonwebtoken"
:
"9.0.
3
"
,
"loader-runner"
:
"4.3.0"
,
"loader-runner"
:
"4.3.0"
,
"loader-utils2"
:
"npm:loader-utils@2.0.4"
,
"loader-utils2"
:
"npm:loader-utils@2.0.4"
,
"loader-utils3"
:
"npm:loader-utils@3.1.3"
,
"loader-utils3"
:
"npm:loader-utils@3.1.3"
,
...
...
packages/next/src/compiled/jsonwebtoken/index.js
View file @
07cb54f7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
pnpm-lock.yaml
View file @
07cb54f7
...
@@ -1573,8 +1573,8 @@ importers:
...
@@ -1573,8 +1573,8 @@ importers:
specifier
:
2.2.3
specifier
:
2.2.3
version
:
2.2.3
version
:
2.2.3
jsonwebtoken
:
jsonwebtoken
:
specifier
:
9.0.
0
specifier
:
9.0.
3
version
:
9.0.
0
version
:
9.0.
3
loader-runner
:
loader-runner
:
specifier
:
4.3.0
specifier
:
4.3.0
version
:
4.3.0
version
:
4.3.0
...
@@ -12948,8 +12948,8 @@ packages:
...
@@ -12948,8 +12948,8 @@ packages:
resolution
:
{
integrity
:
sha512-CXcRvMyTlnR53xMcKnuMzfCA5i/nfblTnnr74CZb6C4vG39eu6w51t7nKmU5MfLfbTgGItliNyjO/ciNPDqClg==
}
resolution
:
{
integrity
:
sha512-CXcRvMyTlnR53xMcKnuMzfCA5i/nfblTnnr74CZb6C4vG39eu6w51t7nKmU5MfLfbTgGItliNyjO/ciNPDqClg==
}
engines
:
{
node
:
'
>=0.10.0'
}
engines
:
{
node
:
'
>=0.10.0'
}
jsonwebtoken@9.0.
0
:
jsonwebtoken@9.0.
3
:
resolution
:
{
integrity
:
sha512-
tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw
==
}
resolution
:
{
integrity
:
sha512-
MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g
==
}
engines
:
{
node
:
'
>=12'
,
npm
:
'
>=6'
}
engines
:
{
node
:
'
>=12'
,
npm
:
'
>=6'
}
jsprim@1.4.1
:
jsprim@1.4.1
:
...
@@ -12977,11 +12977,11 @@ packages:
...
@@ -12977,11 +12977,11 @@ packages:
just-diff@6.0.2
:
just-diff@6.0.2
:
resolution
:
{
integrity
:
sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==
}
resolution
:
{
integrity
:
sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==
}
jwa@
1.4
.1
:
jwa@
2.0
.1
:
resolution
:
{
integrity
:
sha512-
qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA
==
}
resolution
:
{
integrity
:
sha512-
hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg
==
}
jws@
3.2.2
:
jws@
4.0.1
:
resolution
:
{
integrity
:
sha512-
YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0H
A==
}
resolution
:
{
integrity
:
sha512-
EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRdu
A==
}
katex@0.16.10
:
katex@0.16.10
:
resolution
:
{
integrity
:
sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==
}
resolution
:
{
integrity
:
sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==
}
...
@@ -13322,6 +13322,9 @@ packages:
...
@@ -13322,6 +13322,9 @@ packages:
resolution
:
{
integrity
:
sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==
}
resolution
:
{
integrity
:
sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==
}
deprecated
:
This package is deprecated. Use the optional chaining (?.) operator instead.
deprecated
:
This package is deprecated. Use the optional chaining (?.) operator instead.
lodash.includes@4.3.0
:
resolution
:
{
integrity
:
sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==
}
lodash.intersection@4.4.0
:
lodash.intersection@4.4.0
:
resolution
:
{
integrity
:
sha512-N+L0cCfnqMv6mxXtSPeKt+IavbOBBSiAEkKyLasZ8BVcP9YXQgxLO12oPR8OyURwKV8l5vJKiE1M8aS70heuMg==
}
resolution
:
{
integrity
:
sha512-N+L0cCfnqMv6mxXtSPeKt+IavbOBBSiAEkKyLasZ8BVcP9YXQgxLO12oPR8OyURwKV8l5vJKiE1M8aS70heuMg==
}
...
@@ -13331,9 +13334,24 @@ packages:
...
@@ -13331,9 +13334,24 @@ packages:
lodash.isarray@3.0.4
:
lodash.isarray@3.0.4
:
resolution
:
{
integrity
:
sha512-JwObCrNJuT0Nnbuecmqr5DgtuBppuCvGD9lxjFpAzwnVtdGoDQ1zig+5W8k5/6Gcn0gZ3936HDAlGd28i7sOGQ==
}
resolution
:
{
integrity
:
sha512-JwObCrNJuT0Nnbuecmqr5DgtuBppuCvGD9lxjFpAzwnVtdGoDQ1zig+5W8k5/6Gcn0gZ3936HDAlGd28i7sOGQ==
}
lodash.isboolean@3.0.3
:
resolution
:
{
integrity
:
sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==
}
lodash.isinteger@4.0.4
:
resolution
:
{
integrity
:
sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==
}
lodash.ismatch@4.4.0
:
lodash.ismatch@4.4.0
:
resolution
:
{
integrity
:
sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==
}
resolution
:
{
integrity
:
sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==
}
lodash.isnumber@3.0.3
:
resolution
:
{
integrity
:
sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==
}
lodash.isplainobject@4.0.6
:
resolution
:
{
integrity
:
sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==
}
lodash.isstring@4.0.1
:
resolution
:
{
integrity
:
sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==
}
lodash.kebabcase@4.1.1
:
lodash.kebabcase@4.1.1
:
resolution
:
{
integrity
:
sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==
}
resolution
:
{
integrity
:
sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==
}
...
@@ -13349,6 +13367,9 @@ packages:
...
@@ -13349,6 +13367,9 @@ packages:
lodash.merge@4.6.2
:
lodash.merge@4.6.2
:
resolution
:
{
integrity
:
sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
}
resolution
:
{
integrity
:
sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
}
lodash.once@4.1.1
:
resolution
:
{
integrity
:
sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==
}
lodash.pick@4.4.0
:
lodash.pick@4.4.0
:
resolution
:
{
integrity
:
sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==
}
resolution
:
{
integrity
:
sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==
}
deprecated
:
This package is deprecated. Use destructuring assignment syntax instead.
deprecated
:
This package is deprecated. Use destructuring assignment syntax instead.
...
@@ -30378,7 +30399,7 @@ snapshots:
...
@@ -30378,7 +30399,7 @@ snapshots:
npm-package-arg
:
13.0.1
npm-package-arg
:
13.0.1
promzard
:
2.0.0
promzard
:
2.0.0
read
:
4.1.0
read
:
4.1.0
semver
:
7.
7.3
semver
:
7.
8.5
validate-npm-package-license
:
3.0.4
validate-npm-package-license
:
3.0.4
validate-npm-package-name
:
6.0.2
validate-npm-package-name
:
6.0.2
...
@@ -31661,10 +31682,16 @@ snapshots:
...
@@ -31661,10 +31682,16 @@ snapshots:
jsonpointer@4.1.0
:
{}
jsonpointer@4.1.0
:
{}
jsonwebtoken@9.0.
0
:
jsonwebtoken@9.0.
3
:
dependencies
:
dependencies
:
jws
:
3.2.2
jws
:
4.0.1
lodash
:
4.18.1
lodash.includes
:
4.3.0
lodash.isboolean
:
3.0.3
lodash.isinteger
:
4.0.4
lodash.isnumber
:
3.0.3
lodash.isplainobject
:
4.0.6
lodash.isstring
:
4.0.1
lodash.once
:
4.1.1
ms
:
2.1.3
ms
:
2.1.3
semver
:
7.6.3
semver
:
7.6.3
...
@@ -31696,15 +31723,15 @@ snapshots:
...
@@ -31696,15 +31723,15 @@ snapshots:
just-diff@6.0.2
:
{}
just-diff@6.0.2
:
{}
jwa@
1.4
.1
:
jwa@
2.0
.1
:
dependencies
:
dependencies
:
buffer-equal-constant-time
:
1.0.1
buffer-equal-constant-time
:
1.0.1
ecdsa-sig-formatter
:
1.0.11
ecdsa-sig-formatter
:
1.0.11
safe-buffer
:
5.2.1
safe-buffer
:
5.2.1
jws@
3.2.2
:
jws@
4.0.1
:
dependencies
:
dependencies
:
jwa
:
1.4
.1
jwa
:
2.0
.1
safe-buffer
:
5.2.1
safe-buffer
:
5.2.1
katex@0.16.10
:
katex@0.16.10
:
...
@@ -32125,14 +32152,26 @@ snapshots:
...
@@ -32125,14 +32152,26 @@ snapshots:
lodash.get@4.4.2
:
{}
lodash.get@4.4.2
:
{}
lodash.includes@4.3.0
:
{}
lodash.intersection@4.4.0
:
{}
lodash.intersection@4.4.0
:
{}
lodash.isarguments@3.1.0
:
{}
lodash.isarguments@3.1.0
:
{}
lodash.isarray@3.0.4
:
{}
lodash.isarray@3.0.4
:
{}
lodash.isboolean@3.0.3
:
{}
lodash.isinteger@4.0.4
:
{}
lodash.ismatch@4.4.0
:
{}
lodash.ismatch@4.4.0
:
{}
lodash.isnumber@3.0.3
:
{}
lodash.isplainobject@4.0.6
:
{}
lodash.isstring@4.0.1
:
{}
lodash.kebabcase@4.1.1
:
{}
lodash.kebabcase@4.1.1
:
{}
lodash.keys@3.1.2
:
lodash.keys@3.1.2
:
...
@@ -32147,6 +32186,8 @@ snapshots:
...
@@ -32147,6 +32186,8 @@ snapshots:
lodash.merge@4.6.2
:
{}
lodash.merge@4.6.2
:
{}
lodash.once@4.1.1
:
{}
lodash.pick@4.4.0
:
{}
lodash.pick@4.4.0
:
{}
lodash.reduce@4.6.0
:
{}
lodash.reduce@4.6.0
:
{}
...
@@ -38159,7 +38200,7 @@ snapshots:
...
@@ -38159,7 +38200,7 @@ snapshots:
universal-github-app-jwt@1.1.1
:
universal-github-app-jwt@1.1.1
:
dependencies
:
dependencies
:
'
@types/jsonwebtoken'
:
9.0.0
'
@types/jsonwebtoken'
:
9.0.0
jsonwebtoken
:
9.0.
0
jsonwebtoken
:
9.0.
3
universal-user-agent@6.0.0
:
{}
universal-user-agent@6.0.0
:
{}
test/e2e/preview-fallback/preview-fallback.test.ts
View file @
07cb54f7
import
{
nextTestSetup
,
isNextStart
}
from
'e2e-utils'
import
{
nextTestSetup
,
isNextStart
}
from
'e2e-utils'
import
cheerio
from
'cheerio'
import
cheerio
from
'cheerio'
import
cookie
from
'cookie'
import
{
retry
}
from
'next-test-utils'
import
{
retry
}
from
'next-test-utils'
import
fs
from
'fs'
import
fs
from
'fs'
import
{
join
}
from
'path'
import
{
join
}
from
'path'
...
@@ -8,35 +7,42 @@ import { join } from 'path'
...
@@ -8,35 +7,42 @@ import { join } from 'path'
describe
(
'Preview mode with fallback pages'
,
()
=>
{
describe
(
'Preview mode with fallback pages'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
files
:
__dirname
,
dependencies
:
{
cookie
:
'0.7.2'
,
},
})
})
let
previewCookie
:
string
let
previewCookie
:
string
it
(
'should
get preview cookie correctly
'
,
async
()
=>
{
it
(
'should
set and read preview cookies over HTTP
'
,
async
()
=>
{
const
res
=
await
next
.
fetch
(
'/api/enable'
)
const
res
=
await
next
.
fetch
(
'/api/enable'
)
previewCookie
=
''
previewCookie
=
''
expect
(
res
.
status
).
toBe
(
200
)
expect
(
res
.
headers
.
get
(
'set-cookie'
)).
toMatch
(
expect
(
res
.
headers
.
get
(
'set-cookie'
)).
toMatch
(
/
(
__prerender_bypass|__next_preview_data
)
/
/
(
__prerender_bypass|__next_preview_data
)
/
)
)
res
.
headers
const
setCookie
=
res
.
headers
.
get
(
'set-cookie'
)
!
.
get
(
'set-cookie'
)
!
previewCookie
=
[
'__prerender_bypass'
,
'__next_preview_data'
]
.
split
(
','
)
.
map
((
name
)
=>
{
.
forEach
((
c
)
=>
{
const
value
=
setCookie
.
match
(
const
cookies
=
cookie
.
parse
(
c
)
new
RegExp
(
`(?:^|,\\s*)
${
name
}
=([^;]+)`
)
const
isBypass
=
cookies
.
__prerender_bypass
)?.[
1
]
expect
(
value
).
toBeDefined
()
return
`
${
name
}
=
${
value
}
`
})
.
join
(
'; '
)
if
(
isBypass
||
cookies
.
__next_preview_data
)
{
const
previewRes
=
await
next
.
fetch
(
'/'
,
{
if
(
previewCookie
)
previewCookie
+=
'; '
headers
:
{
cookie
:
previewCookie
,
},
})
const
previewHtml
=
await
previewRes
.
text
()
const
previewProps
=
JSON
.
parse
(
cheerio
.
load
(
previewHtml
)(
'#props'
).
text
())
previewCookie
+=
`
${
expect
(
previewRes
.
status
).
toBe
(
200
)
isBypass
?
'__prerender_bypass'
:
'__next_preview_data'
expect
(
previewProps
).
toEqual
({
}
=
${
cookies
[
isBypass
?
'__prerender_bypass'
:
'__next_preview_data'
]}
`
preview
:
true
,
}
previewData
:
{},
})
})
})
})
...
...
test/unit/jsonwebtoken-node-compat.test.ts
0 → 100644
View file @
07cb54f7
import
{
spawnSync
}
from
'node:child_process'
describe
(
'compiled jsonwebtoken'
,
()
=>
{
it
(
'signs and verifies when SlowBuffer is unavailable'
,
()
=>
{
const
jsonwebtokenPath
=
require
.
resolve
(
'next/dist/compiled/jsonwebtoken'
)
const
script
=
`
const buffer = require('node:buffer')
delete buffer.SlowBuffer
const jsonwebtoken = require(
${
JSON
.
stringify
(
jsonwebtokenPath
)}
)
const token = jsonwebtoken.sign(
{ preview: true },
'test-secret',
{ algorithm: 'HS256' }
)
const payload = jsonwebtoken.verify(token, 'test-secret', {
algorithms: ['HS256'],
})
if (payload.preview !== true) {
throw new Error('jsonwebtoken round trip failed')
}
`
const
result
=
spawnSync
(
process
.
execPath
,
[
'-e'
,
script
],
{
encoding
:
'utf8'
,
})
expect
(
result
.
stderr
).
toBe
(
''
)
expect
(
result
.
status
).
toBe
(
0
)
})
})
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