Unverified Commit 58f4af6a authored by Benjamin Woodruff ‮'s avatar Benjamin Woodruff Committed by GitHub

Upgrade from pnpm v10 to v12 (#99827)

Hopefully this should make test setup a little faster and it should make
it easier for me to test compatibility with pnpm GVS (#99758).

I previously tried to upgrade us to pnpm 11, but couldn't because it
requires Node 22+, and we need to test against Node 20. However, pnpm 12
is written in Rust, and does not depend on particular versions of Node.

## Other notable changes
- Nx: Some of our tests needed an upgrade. It parses the pnpm lockfile,
like Turborepo.
- pnpm 12 fails to install from an uncompressed tarball (only supports
gziped-tarballs?), so this builds the `tgz` from source (previously we
had a binary tarball committed to the repo).

## Testing

I manually ran the e2e deployment tests:
https://github.com/vercel/next.js/actions/runs/38491349790
parent 919395d0
...@@ -469,7 +469,7 @@ echo "tree ${a.name} ready"` ...@@ -469,7 +469,7 @@ echo "tree ${a.name} ready"`
await sbExec( await sbExec(
vm, vm,
'55m', '55m',
`set -e\nnpm i -g pnpm@10.33.0 >/dev/null 2>&1\n` + `set -e\nnpm i -g pnpm@12.9.1 >/dev/null 2>&1\n` +
`(while true; do echo "hb mem=$(free -m | awk '/^Mem/{print $3}')MB"; sleep 30; done) & HB=$!\n` + `(while true; do echo "hb mem=$(free -m | awk '/^Mem/{print $3}')MB"; sleep 30; done) & HB=$!\n` +
`${extractCached}\n${installs}\n${builds}\n${waits}\n${verifies}\nkill $HB\n` + `${extractCached}\n${installs}\n${builds}\n${waits}\n${verifies}\nkill $HB\n` +
`echo "PHASE done $(date +%s)"\n` + `echo "PHASE done $(date +%s)"\n` +
......
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
"engines": { "engines": {
"node": ">=20.9.0" "node": ">=20.9.0"
}, },
"packageManager": "pnpm@10.33.0" "packageManager": "pnpm@12.9.1"
} }
{ {
"name": "next-github-workflows", "name": "next-github-workflows",
"private": true, "private": true,
"packageManager": "pnpm@10.33.0" "packageManager": "pnpm@12.9.1"
} }
---
lockfileVersion: '9.0'
importers:
.:
configDependencies: {}
packageManagerDependencies:
pnpm:
specifier: 12.9.1
version: 12.9.1
packages:
'@pnpm/exe.android-arm64@12.9.1':
resolution: {integrity: sha512-Hgm1XdqMTfBC8PdGLL+NjZWv4xyi7D6XNrN9fb24XGYlyTBmUtdCefKnCLmHujShRD8BEO1zqM30SNcKBDLysw==}
cpu: [arm64]
os: [android]
'@pnpm/exe.android-x64@12.9.1':
resolution: {integrity: sha512-WDGCe6jZRVZP3RC/q6hOkZylkPkIQIi1/GcrR/d/YzbihhAHXCczrk+UYnV5TgbsEnAYO7Cx+2rX3nfhHvy24w==}
cpu: [x64]
os: [android]
'@pnpm/exe.darwin-arm64@12.9.1':
resolution: {integrity: sha512-+7iiEEBgYN9szPWUnAuN6eOVMTI6Hrki5bcuC9n9xl9tTnT53Tpxpo45Hml+W4IrAU0d+Tmd0sPnVIbX59PD6w==}
cpu: [arm64]
os: [darwin]
'@pnpm/exe.darwin-x64@12.9.1':
resolution: {integrity: sha512-SK7TxJiR12GbJZGffRFHItkc+Mx+99v6xMMJ9/X//8NwWV1wo17a2bwfGI8qZpl17YwsrmPEFOOqhzE1GIlrtQ==}
cpu: [x64]
os: [darwin]
'@pnpm/exe.freebsd-x64@12.9.1':
resolution: {integrity: sha512-4AjLk6uvTs2iO6wMit2hcxJ2M32xb7OV5SNFk+w6G8/NzcjcMB7ENEpyeXyLiP0kcnp8uaCGUct2NfrLCJ35eQ==}
cpu: [x64]
os: [freebsd]
'@pnpm/exe.linux-arm64-musl@12.9.1':
resolution: {integrity: sha512-dZL2ES1ckDWM9v+EtxoOklZ0WNdtayooi9iLiDUubopudX3zXPNR2mlrxBRgjbDgECOndQen2SmyxL5eZiBuKw==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-arm64@12.9.1':
resolution: {integrity: sha512-cx+uF6xqwEtm7B8NV+1ve0xBg9gcuzQZ5R+0WgOWvKG/h978UljS6BgWs1ipIGuGgUdeVhm3PKmBltXIcczLXA==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-ppc64@12.9.1':
resolution: {integrity: sha512-MpjPsy4XR17zAtLziQZfsN+wveWa/bUJggZtwfo3+SuyRmXnSvVkFD4+v8/3RTWyYaM6mwLUTjZDJ+g3urL+ew==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-riscv64@12.9.1':
resolution: {integrity: sha512-Oo67TKqqH+Bno+L6X7Xyorwp1QG82zKIkL0vbo1x2kcPTDiyPbdM+d6lIs4+hzeB1KHT5FDoGzZj2dad7Ft+eg==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-s390x@12.9.1':
resolution: {integrity: sha512-QAD5FRCdW36HfD58BV7DoDm6z8yv+GgSqcUV1+ERwYjpVQuG6ZTpf5o0x3KDas8eTLIW7MLYVdDdlAurWeArEg==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-x64-musl@12.9.1':
resolution: {integrity: sha512-mQDhBsGqcTkrLQM4q5igmRFcr6EAl4UM/FGawY+0CWGcqPpUmYUvDy9LHy80xxkHIWVJ886gvvso2XOjfav1Jw==}
cpu: [x64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-x64@12.9.1':
resolution: {integrity: sha512-+M5N74hM4fc87AAckxx/UIW+dUnWf2eko+HchJs/NZUxehLhekNyMI/GNaNXlvd+kWR+97XXBD51XRkkNiUtrA==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@pnpm/exe.win32-arm64@12.9.1':
resolution: {integrity: sha512-mI28C2wxobrDi6x1OYhBRyG10hnDq/4sEIyy5RzoX6LB4kLuv6K/d25HOpMwlW20cuM4M72k9NZpOdcmUxMbEA==}
cpu: [arm64]
os: [win32]
'@pnpm/exe.win32-x64@12.9.1':
resolution: {integrity: sha512-SWoDMT0oD7NrDSIoPpkKD09D9fAQKNjwFZ3lezlCUhAfXxMv70zsfrNT2/P+GoCK2kefXF9OysUZkH1l5vvvfA==}
cpu: [x64]
os: [win32]
pnpm@12.9.1:
resolution: {integrity: sha512-BrBV//XNINwSeB3hc87TMQzglRvy7GICEaFgRdVETVyTpmMhB2TvKaZTphBFm6A2jw50+E2AxUcjz5Wq57wNbQ==}
engines: {node: '>=18.*'}
hasBin: true
snapshots:
'@pnpm/exe.android-arm64@12.9.1':
optional: true
'@pnpm/exe.android-x64@12.9.1':
optional: true
'@pnpm/exe.darwin-arm64@12.9.1':
optional: true
'@pnpm/exe.darwin-x64@12.9.1':
optional: true
'@pnpm/exe.freebsd-x64@12.9.1':
optional: true
'@pnpm/exe.linux-arm64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-arm64@12.9.1':
optional: true
'@pnpm/exe.linux-ppc64@12.9.1':
optional: true
'@pnpm/exe.linux-riscv64@12.9.1':
optional: true
'@pnpm/exe.linux-s390x@12.9.1':
optional: true
'@pnpm/exe.linux-x64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-x64@12.9.1':
optional: true
'@pnpm/exe.win32-arm64@12.9.1':
optional: true
'@pnpm/exe.win32-x64@12.9.1':
optional: true
pnpm@12.9.1:
optionalDependencies:
'@pnpm/exe.android-arm64': 12.9.1
'@pnpm/exe.android-x64': 12.9.1
'@pnpm/exe.darwin-arm64': 12.9.1
'@pnpm/exe.darwin-x64': 12.9.1
'@pnpm/exe.freebsd-x64': 12.9.1
'@pnpm/exe.linux-arm64': 12.9.1
'@pnpm/exe.linux-arm64-musl': 12.9.1
'@pnpm/exe.linux-ppc64': 12.9.1
'@pnpm/exe.linux-riscv64': 12.9.1
'@pnpm/exe.linux-s390x': 12.9.1
'@pnpm/exe.linux-x64': 12.9.1
'@pnpm/exe.linux-x64-musl': 12.9.1
'@pnpm/exe.win32-arm64': 12.9.1
'@pnpm/exe.win32-x64': 12.9.1
---
lockfileVersion: '9.0' lockfileVersion: '9.0'
settings: settings:
......
...@@ -376,9 +376,9 @@ jobs: ...@@ -376,9 +376,9 @@ jobs:
name: next-swc-binary-${{ runner.os }}-${{ runner.arch }} name: next-swc-binary-${{ runner.os }}-${{ runner.arch }}
path: packages/next-swc/native/next-swc.*.node path: packages/next-swc/native/next-swc.*.node
# undo normalize version changes for install/build # Restore manifests and lockfile (undoing normalization) before installing dependencies.
- run: git checkout . - run: git checkout .
if: ${{ inputs.skipInstallBuild != 'yes' }} if: ${{ inputs.skipInstallBuild != 'yes' || inputs.needsRustJsInstall == 'yes' }}
- name: Get pnpm store directory - name: Get pnpm store directory
id: get-store-path id: get-store-path
......
auto-install-peers = true
lockfile = true
link-workspace-packages = true
provenance = true
save-exact = true
strict-peer-dependencies = false
tag-version-prefix=""
\ No newline at end of file
...@@ -25,9 +25,8 @@ _You'll need a working node.js environment with pnpm._ ...@@ -25,9 +25,8 @@ _You'll need a working node.js environment with pnpm._
`npm install -g corepack@latest`. `npm install -g corepack@latest`.
`pnpm` [respects the `packageManager` field in `package.json` by `pnpm` [respects the `packageManager` field in `package.json` by
default](https://pnpm.io/settings#managepackagemanagerversions), even when default](https://pnpm.io/settings/cli#pmonfail), even when installed without
installed without Corepack. This ensures that pnpm behaves the same locally as Corepack. This ensures that pnpm behaves the same locally as it does in CI.
it does in CI.
- _(Optional)_ Install [fnm](https://github.com/Schniz/fnm) or - _(Optional)_ Install [fnm](https://github.com/Schniz/fnm) or
[nvm](https://github.com/nvm-sh/nvm). This will ensure you use the same [nvm](https://github.com/nvm-sh/nvm). This will ensure you use the same
......
...@@ -303,47 +303,5 @@ ...@@ -303,47 +303,5 @@
"engines": { "engines": {
"node": ">=20.9.0" "node": ">=20.9.0"
}, },
"packageManager": "pnpm@10.33.0", "packageManager": "pnpm@12.9.1"
"pnpm": {
"overrides": {
"postcss": "8.5.23",
"webpack": "5.98.0",
"browserslist": "4.28.1",
"caniuse-lite": "1.0.30001746",
"@types/node": "20.17.7",
"@babel/core": "7.26.10",
"@babel/parser": "7.27.0",
"@babel/types": "7.27.0",
"@babel/traverse": "7.27.0",
"@types/react": "19.2.18",
"@types/react-dom": "19.2.4",
"@types/retry": "0.12.0",
"jest-snapshot": "30.0.0-alpha.6",
"react": "npm:react@19.3.0-canary-07dde64d-20261013",
"react-dom": "npm:react-dom@19.3.0-canary-07dde64d-20261013",
"react-is": "npm:react-is@19.3.0-canary-07dde64d-20261013",
"scheduler": "npm:scheduler@0.28.0-canary-07dde64d-20261013"
},
"packageExtensions": {
"eslint-plugin-react-hooks@0.0.0-experimental-6de32a5a-20250822": {
"dependencies": {
"@babel/plugin-proposal-private-methods": "^7.18.6"
}
}
},
"patchedDependencies": {
"webpack-sources@3.2.3": "patches/webpack-sources@3.2.3.patch",
"stacktrace-parser@0.1.10": "patches/stacktrace-parser@0.1.10.patch",
"taskr@1.1.0": "patches/taskr@1.1.0.patch",
"minizlib@3.1.0": "patches/minizlib@3.1.0.patch",
"@rspack/core@1.6.7": "patches/@rspack__core@1.6.7.patch",
"@modelcontextprotocol/sdk": "patches/@modelcontextprotocol__sdk.patch",
"@vercel/blob": "patches/@vercel__blob.patch",
"postcss-scss": "patches/postcss-scss.patch",
"playwright-core@1.61.0": "patches/playwright-core@1.61.0.patch",
"@types/node@20.17.7": "patches/@types__node@20.17.7.patch",
"@vercel/agent-eval@2.2.1": "patches/@vercel__agent-eval@2.2.1.patch",
"@vercel/og@1.0.1": "patches/@vercel__og@1.0.1.patch"
}
}
} }
...@@ -4,9 +4,22 @@ jest.autoMockOff() ...@@ -4,9 +4,22 @@ jest.autoMockOff()
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const os = require('os') const os = require('os')
const { execFileSync } = require('child_process')
const { runAgentsMd } = require('../../bin/agents-md') const { runAgentsMd } = require('../../bin/agents-md')
const { getNextjsVersion } = require('../../lib/agents-md') const { getNextjsVersion } = require('../../lib/agents-md')
function execNodeWithoutNodePath(script, options = {}) {
// pnpm 12's Jest launcher exposes hoisted dependencies through NODE_PATH.
// A fresh Node process must omit it to resolve only the fixture's dependencies.
const env = { ...process.env, ...options.env }
delete env.NODE_PATH
return execFileSync(process.execPath, ['-e', script], {
...options,
env,
encoding: 'utf8',
})
}
/** /**
* TRUE E2E TESTS * TRUE E2E TESTS
* These tests invoke the actual CLI entry point (runAgentsMd), * These tests invoke the actual CLI entry point (runAgentsMd),
...@@ -711,11 +724,25 @@ This is my project documentation. ...@@ -711,11 +724,25 @@ This is my project documentation.
return require('strip-ansi')(consoleOutput.join('\n')) return require('strip-ansi')(consoleOutput.join('\n'))
} }
it('uses the bundled docs of a workspace package when run from the root', async () => { function runFromWorkspaceRoot() {
return require('strip-ansi')(
execNodeWithoutNodePath(
`const { runAgentsMd } = require(${JSON.stringify(
path.join(__dirname, '../../bin/agents-md.js')
)})
runAgentsMd({ output: 'AGENTS.md' }).catch((error) => {
console.error(error)
process.exitCode = 1
})`,
{ cwd: testProjectDir }
)
)
}
it('uses the bundled docs of a workspace package when run from the root', () => {
setupWorkspace(['apps/*'], { 'apps/web': '16.4.0' }) setupWorkspace(['apps/*'], { 'apps/web': '16.4.0' })
process.chdir(testProjectDir)
await runAgentsMd({ output: 'AGENTS.md' }) const cliOutput = runFromWorkspaceRoot()
const agentsMdPath = path.join(testProjectDir, 'AGENTS.md') const agentsMdPath = path.join(testProjectDir, 'AGENTS.md')
expect(readIndex(agentsMdPath).root).toBe( expect(readIndex(agentsMdPath).root).toBe(
...@@ -724,49 +751,49 @@ This is my project documentation. ...@@ -724,49 +751,49 @@ This is my project documentation.
expect( expect(
fs.existsSync(path.join(resolveRoot(agentsMdPath), '01-app')) fs.existsSync(path.join(resolveRoot(agentsMdPath), '01-app'))
).toBe(true) ).toBe(true)
expect(pullDocsSpy).not.toHaveBeenCalled()
expect(fs.existsSync(path.join(testProjectDir, '.next-docs'))).toBe( expect(fs.existsSync(path.join(testProjectDir, '.next-docs'))).toBe(
false false
) )
expect(fs.existsSync(path.join(testProjectDir, '.gitignore'))).toBe( expect(fs.existsSync(path.join(testProjectDir, '.gitignore'))).toBe(
false false
) )
expect(output()).toContain('workspace package apps/web') expect(cliOutput).toContain('workspace package apps/web')
}) })
it('indexes the package with the highest Next.js version', async () => { it('indexes the package with the highest Next.js version', () => {
setupWorkspace(['apps/a', 'apps/b'], { setupWorkspace(['apps/a', 'apps/b'], {
'apps/a': '16.3.0', 'apps/a': '16.3.0',
'apps/b': '16.4.0', 'apps/b': '16.4.0',
}) })
process.chdir(testProjectDir)
await runAgentsMd({ output: 'AGENTS.md' }) const cliOutput = runFromWorkspaceRoot()
const { root, content } = readIndex( const { root, content } = readIndex(
path.join(testProjectDir, 'AGENTS.md') path.join(testProjectDir, 'AGENTS.md')
) )
expect(root).toBe('./apps/b/node_modules/next/dist/docs') expect(root).toBe('./apps/b/node_modules/next/dist/docs')
expect(content).toContain('docs-16.4.0.md') expect(content).toContain('docs-16.4.0.md')
expect(pullDocsSpy).not.toHaveBeenCalled() expect(cliOutput).not.toContain('Downloading')
expect(fs.existsSync(path.join(testProjectDir, '.next-docs'))).toBe(
false
)
}) })
it('picks the first matching package in workspace order and logs it', async () => { it('picks the first matching package in workspace order and logs it', () => {
// Listed b before a, so the choice follows the workspace patterns // Listed b before a, so the choice follows the workspace patterns
// rather than alphabetical order. // rather than alphabetical order.
setupWorkspace(['apps/b', 'apps/a'], { setupWorkspace(['apps/b', 'apps/a'], {
'apps/a': '16.4.0', 'apps/a': '16.4.0',
'apps/b': '16.4.0', 'apps/b': '16.4.0',
}) })
process.chdir(testProjectDir)
await runAgentsMd({ output: 'AGENTS.md' }) const cliOutput = runFromWorkspaceRoot()
expect(readIndex(path.join(testProjectDir, 'AGENTS.md')).root).toBe( expect(readIndex(path.join(testProjectDir, 'AGENTS.md')).root).toBe(
'./apps/b/node_modules/next/dist/docs' './apps/b/node_modules/next/dist/docs'
) )
expect(output()).toContain('workspace package apps/b') expect(cliOutput).toContain('workspace package apps/b')
expect(output()).not.toContain('workspace package apps/a') expect(cliOutput).not.toContain('workspace package apps/a')
}) })
it('prefers a matching install resolved from the cwd', async () => { it('prefers a matching install resolved from the cwd', async () => {
...@@ -840,9 +867,15 @@ This is my project documentation. ...@@ -840,9 +867,15 @@ This is my project documentation.
}) })
it('returns error when Next.js is not installed', () => { it('returns error when Next.js is not installed', () => {
// Use a directory where next is not installed const result = JSON.parse(
const nonNextDir = '/tmp' execNodeWithoutNodePath(
const result = getNextjsVersion(nonNextDir) `const { getNextjsVersion } = require(${JSON.stringify(
path.join(__dirname, '../agents-md.js')
)})
console.log(JSON.stringify(getNextjsVersion(process.cwd())))`,
{ cwd: testProjectDir }
)
)
expect(result.version).toBeNull() expect(result.version).toBeNull()
expect(result.error).toBe('Next.js is not installed in this project.') expect(result.error).toBe('Next.js is not installed in this project.')
......
...@@ -58,11 +58,28 @@ module.exports = ({ dev, ...rest }) => { ...@@ -58,11 +58,28 @@ module.exports = ({ dev, ...rest }) => {
resolve: { resolve: {
alias: { alias: {
// TODO: Get dedicated React version for NDT to uncouple development. // TODO: Get dedicated React version for NDT to uncouple development.
react: `next/dist/compiled/react${bundledReactChannel}`, // Absolute paths keep dependencies from resolving a hoisted npm copy
'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}`, // of Next and bundling a second React instance.
'react-dom/client$': `next/dist/compiled/react-dom${bundledReactChannel}/client`, react: path.join(
'react-is$': `next/dist/compiled/react-is${bundledReactChannel}`, __dirname,
scheduler$: `next/dist/compiled/scheduler${bundledReactChannel}`, `dist/compiled/react${bundledReactChannel}`
),
'react-dom$': path.join(
__dirname,
`dist/compiled/react-dom${bundledReactChannel}`
),
'react-dom/client$': path.join(
__dirname,
`dist/compiled/react-dom${bundledReactChannel}/client`
),
'react-is$': path.join(
__dirname,
`dist/compiled/react-is${bundledReactChannel}`
),
scheduler$: path.join(
__dirname,
`dist/compiled/scheduler${bundledReactChannel}`
),
}, },
extensions: ['.ts', '.tsx', '.js', '.json'], extensions: ['.ts', '.tsx', '.js', '.json'],
}, },
......
---
lockfileVersion: '9.0'
importers:
.:
configDependencies: {}
packageManagerDependencies:
pnpm:
specifier: 12.9.1
version: 12.9.1
packages:
'@pnpm/exe.android-arm64@12.9.1':
resolution: {integrity: sha512-Hgm1XdqMTfBC8PdGLL+NjZWv4xyi7D6XNrN9fb24XGYlyTBmUtdCefKnCLmHujShRD8BEO1zqM30SNcKBDLysw==}
cpu: [arm64]
os: [android]
'@pnpm/exe.android-x64@12.9.1':
resolution: {integrity: sha512-WDGCe6jZRVZP3RC/q6hOkZylkPkIQIi1/GcrR/d/YzbihhAHXCczrk+UYnV5TgbsEnAYO7Cx+2rX3nfhHvy24w==}
cpu: [x64]
os: [android]
'@pnpm/exe.darwin-arm64@12.9.1':
resolution: {integrity: sha512-+7iiEEBgYN9szPWUnAuN6eOVMTI6Hrki5bcuC9n9xl9tTnT53Tpxpo45Hml+W4IrAU0d+Tmd0sPnVIbX59PD6w==}
cpu: [arm64]
os: [darwin]
'@pnpm/exe.darwin-x64@12.9.1':
resolution: {integrity: sha512-SK7TxJiR12GbJZGffRFHItkc+Mx+99v6xMMJ9/X//8NwWV1wo17a2bwfGI8qZpl17YwsrmPEFOOqhzE1GIlrtQ==}
cpu: [x64]
os: [darwin]
'@pnpm/exe.freebsd-x64@12.9.1':
resolution: {integrity: sha512-4AjLk6uvTs2iO6wMit2hcxJ2M32xb7OV5SNFk+w6G8/NzcjcMB7ENEpyeXyLiP0kcnp8uaCGUct2NfrLCJ35eQ==}
cpu: [x64]
os: [freebsd]
'@pnpm/exe.linux-arm64-musl@12.9.1':
resolution: {integrity: sha512-dZL2ES1ckDWM9v+EtxoOklZ0WNdtayooi9iLiDUubopudX3zXPNR2mlrxBRgjbDgECOndQen2SmyxL5eZiBuKw==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-arm64@12.9.1':
resolution: {integrity: sha512-cx+uF6xqwEtm7B8NV+1ve0xBg9gcuzQZ5R+0WgOWvKG/h978UljS6BgWs1ipIGuGgUdeVhm3PKmBltXIcczLXA==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-ppc64@12.9.1':
resolution: {integrity: sha512-MpjPsy4XR17zAtLziQZfsN+wveWa/bUJggZtwfo3+SuyRmXnSvVkFD4+v8/3RTWyYaM6mwLUTjZDJ+g3urL+ew==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-riscv64@12.9.1':
resolution: {integrity: sha512-Oo67TKqqH+Bno+L6X7Xyorwp1QG82zKIkL0vbo1x2kcPTDiyPbdM+d6lIs4+hzeB1KHT5FDoGzZj2dad7Ft+eg==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-s390x@12.9.1':
resolution: {integrity: sha512-QAD5FRCdW36HfD58BV7DoDm6z8yv+GgSqcUV1+ERwYjpVQuG6ZTpf5o0x3KDas8eTLIW7MLYVdDdlAurWeArEg==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-x64-musl@12.9.1':
resolution: {integrity: sha512-mQDhBsGqcTkrLQM4q5igmRFcr6EAl4UM/FGawY+0CWGcqPpUmYUvDy9LHy80xxkHIWVJ886gvvso2XOjfav1Jw==}
cpu: [x64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-x64@12.9.1':
resolution: {integrity: sha512-+M5N74hM4fc87AAckxx/UIW+dUnWf2eko+HchJs/NZUxehLhekNyMI/GNaNXlvd+kWR+97XXBD51XRkkNiUtrA==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@pnpm/exe.win32-arm64@12.9.1':
resolution: {integrity: sha512-mI28C2wxobrDi6x1OYhBRyG10hnDq/4sEIyy5RzoX6LB4kLuv6K/d25HOpMwlW20cuM4M72k9NZpOdcmUxMbEA==}
cpu: [arm64]
os: [win32]
'@pnpm/exe.win32-x64@12.9.1':
resolution: {integrity: sha512-SWoDMT0oD7NrDSIoPpkKD09D9fAQKNjwFZ3lezlCUhAfXxMv70zsfrNT2/P+GoCK2kefXF9OysUZkH1l5vvvfA==}
cpu: [x64]
os: [win32]
pnpm@12.9.1:
resolution: {integrity: sha512-BrBV//XNINwSeB3hc87TMQzglRvy7GICEaFgRdVETVyTpmMhB2TvKaZTphBFm6A2jw50+E2AxUcjz5Wq57wNbQ==}
engines: {node: '>=18.*'}
hasBin: true
snapshots:
'@pnpm/exe.android-arm64@12.9.1':
optional: true
'@pnpm/exe.android-x64@12.9.1':
optional: true
'@pnpm/exe.darwin-arm64@12.9.1':
optional: true
'@pnpm/exe.darwin-x64@12.9.1':
optional: true
'@pnpm/exe.freebsd-x64@12.9.1':
optional: true
'@pnpm/exe.linux-arm64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-arm64@12.9.1':
optional: true
'@pnpm/exe.linux-ppc64@12.9.1':
optional: true
'@pnpm/exe.linux-riscv64@12.9.1':
optional: true
'@pnpm/exe.linux-s390x@12.9.1':
optional: true
'@pnpm/exe.linux-x64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-x64@12.9.1':
optional: true
'@pnpm/exe.win32-arm64@12.9.1':
optional: true
'@pnpm/exe.win32-x64@12.9.1':
optional: true
pnpm@12.9.1:
optionalDependencies:
'@pnpm/exe.android-arm64': 12.9.1
'@pnpm/exe.android-x64': 12.9.1
'@pnpm/exe.darwin-arm64': 12.9.1
'@pnpm/exe.darwin-x64': 12.9.1
'@pnpm/exe.freebsd-x64': 12.9.1
'@pnpm/exe.linux-arm64': 12.9.1
'@pnpm/exe.linux-arm64-musl': 12.9.1
'@pnpm/exe.linux-ppc64': 12.9.1
'@pnpm/exe.linux-riscv64': 12.9.1
'@pnpm/exe.linux-s390x': 12.9.1
'@pnpm/exe.linux-x64': 12.9.1
'@pnpm/exe.linux-x64-musl': 12.9.1
'@pnpm/exe.win32-arm64': 12.9.1
'@pnpm/exe.win32-x64': 12.9.1
---
lockfileVersion: '9.0' lockfileVersion: '9.0'
settings: settings:
...@@ -26,42 +184,18 @@ overrides: ...@@ -26,42 +184,18 @@ overrides:
packageExtensionsChecksum: sha256-ylDR55omOZlT4Sfpfh6n7mO2r/cLCmlirAikJ/E/LAw= packageExtensionsChecksum: sha256-ylDR55omOZlT4Sfpfh6n7mO2r/cLCmlirAikJ/E/LAw=
patchedDependencies: patchedDependencies:
'@modelcontextprotocol/sdk': '@modelcontextprotocol/sdk': 680fe4edb7abd1de29d08cdf217a22506e815a8cc1c2282201d5d47aa3e5da12
hash: 680fe4edb7abd1de29d08cdf217a22506e815a8cc1c2282201d5d47aa3e5da12 '@rspack/core@1.6.7': 4cf28ea116b0e27c7c80b09035905f9d16a7b18d1f2b7d312fc80d42cd57068d
path: patches/@modelcontextprotocol__sdk.patch '@types/node@20.17.7': fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab
'@rspack/core@1.6.7': '@vercel/agent-eval@2.2.1': c453f42ffcf4e7e070b8cba54135cd4788d4df5fdb829e0065f453fd1646e5c1
hash: 4cf28ea116b0e27c7c80b09035905f9d16a7b18d1f2b7d312fc80d42cd57068d '@vercel/blob': cb53bfa5effb15b3a361e176003df667cadf757b27b7c9b458c2f0fce86ea893
path: patches/@rspack__core@1.6.7.patch '@vercel/og@1.0.1': 3d59af991a9f85bbc368d2891b4e965f10dd11c86b9786e79fc4a362bb01401b
'@types/node@20.17.7': minizlib@3.1.0: 587688821244aaee46680929cd869947377a284ac1b30c9ae8660a5ea7d2be67
hash: fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab playwright-core@1.61.0: 1a56033776b3ac43fe8f35b6c9afa6d9f13a0d5163892f2a31d7661504b93b93
path: patches/@types__node@20.17.7.patch postcss-scss: 88893e632b3e099730dc0ffcc93cf3654b31c277da9e2796e822f6b5aeedc093
'@vercel/agent-eval@2.2.1': stacktrace-parser@0.1.10: ff70befa8ec032ce77713d8cf9b1cef70ccb047d635eddb4072bc72a6c744522
hash: c453f42ffcf4e7e070b8cba54135cd4788d4df5fdb829e0065f453fd1646e5c1 taskr@1.1.0: 1d0f571943b5d4761d4f2f39723796e402dd317f14a7c714e2021d3f12cc481c
path: patches/@vercel__agent-eval@2.2.1.patch webpack-sources@3.2.3: 26afc15966a3fc37a3d1d366312a95ce66723513f6a3a720e4166a37147da8bd
'@vercel/blob':
hash: cb53bfa5effb15b3a361e176003df667cadf757b27b7c9b458c2f0fce86ea893
path: patches/@vercel__blob.patch
'@vercel/og@1.0.1':
hash: 3d59af991a9f85bbc368d2891b4e965f10dd11c86b9786e79fc4a362bb01401b
path: patches/@vercel__og@1.0.1.patch
minizlib@3.1.0:
hash: 587688821244aaee46680929cd869947377a284ac1b30c9ae8660a5ea7d2be67
path: patches/minizlib@3.1.0.patch
playwright-core@1.61.0:
hash: 1a56033776b3ac43fe8f35b6c9afa6d9f13a0d5163892f2a31d7661504b93b93
path: patches/playwright-core@1.61.0.patch
postcss-scss:
hash: 88893e632b3e099730dc0ffcc93cf3654b31c277da9e2796e822f6b5aeedc093
path: patches/postcss-scss.patch
stacktrace-parser@0.1.10:
hash: ff70befa8ec032ce77713d8cf9b1cef70ccb047d635eddb4072bc72a6c744522
path: patches/stacktrace-parser@0.1.10.patch
taskr@1.1.0:
hash: 1d0f571943b5d4761d4f2f39723796e402dd317f14a7c714e2021d3f12cc481c
path: patches/taskr@1.1.0.patch
webpack-sources@3.2.3:
hash: 26afc15966a3fc37a3d1d366312a95ce66723513f6a3a720e4166a37147da8bd
path: patches/webpack-sources@3.2.3.patch
importers: importers:
...@@ -8374,7 +8508,7 @@ packages: ...@@ -8374,7 +8508,7 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
ci-info@https://codeload.github.com/watson/ci-info/tar.gz/f43f6a1cefff47fb361c88cf4b943fdbcaafe540: ci-info@https://codeload.github.com/watson/ci-info/tar.gz/f43f6a1cefff47fb361c88cf4b943fdbcaafe540:
resolution: {tarball: https://codeload.github.com/watson/ci-info/tar.gz/f43f6a1cefff47fb361c88cf4b943fdbcaafe540} resolution: {gitHosted: true, tarball: https://codeload.github.com/watson/ci-info/tar.gz/f43f6a1cefff47fb361c88cf4b943fdbcaafe540}
version: 2.0.0 version: 2.0.0
cipher-base@1.0.4: cipher-base@1.0.4:
...@@ -6,28 +6,36 @@ packages: ...@@ -6,28 +6,36 @@ packages:
- 'turbopack/crates/*/js' - 'turbopack/crates/*/js'
- 'turbopack/crates/turbopack-tests/tests/execution' - 'turbopack/crates/turbopack-tests/tests/execution'
updateNotifier: false updateNotifier: false
linkWorkspacePackages: true
saveExact: true
provenance: true
tagVersionPrefix: ''
# pnpm 11+ defaults this to `install`, which makes `pnpm run` (including the
# script invocations turbo makes) install dependencies first if it considers
# them stale. CI jobs that only run Rust tasks intentionally skip the install.
# TODO: Fix the CI jobs, and remove this line.
verifyDepsBeforeRun: false
publicHoistPattern: publicHoistPattern:
- '*eslint*' - '*eslint*'
allowBuilds: allowBuilds:
'@ast-grep/cli': true '@ast-grep/cli': true
ignoredBuiltDependencies: '@datadog/native-appsec': false
- '@datadog/native-appsec' '@datadog/native-metrics': false
- '@datadog/native-metrics' '@datadog/pprof': false
- '@datadog/pprof' '@swc/core': false
- '@swc/core' '@tailwindcss/oxide': false
- '@tailwindcss/oxide' core-js: false
- core-js cpu-features: false
- cpu-features dd-trace: false
- dd-trace esbuild: false
- esbuild msw: false
- msw nx: false
- nx playwright-chromium: false
- playwright-chromium protobufjs: false
- protobufjs sharp: false
- sharp ssh2: false
- ssh2 unrs-resolver: false
- unrs-resolver wasm-pack: false
- wasm-pack
# - Keep security related settings in sync with pnpm-workspace.yaml written to # - Keep security related settings in sync with pnpm-workspace.yaml written to
# temporary fixture dirs in `file://./scripts/install-native.mjs` # temporary fixture dirs in `file://./scripts/install-native.mjs`
...@@ -53,3 +61,43 @@ minimumReleaseAgeExclude: ...@@ -53,3 +61,43 @@ minimumReleaseAgeExclude:
- satori@0.33.5 - satori@0.33.5
- scheduler - scheduler
- turbo - turbo
# Caution: `file://./scripts/sync-react.js` updates the React entries in place using a regex as part
# of a GH Action. If you update this section, make sure you also update that script.
overrides:
postcss: 8.5.23
webpack: 5.98.0
browserslist: 4.28.1
caniuse-lite: 1.0.30001746
'@types/node': 20.17.7
'@babel/core': 7.26.10
'@babel/parser': 7.27.0
'@babel/types': 7.27.0
'@babel/traverse': 7.27.0
'@types/react': 19.2.18
'@types/react-dom': 19.2.4
'@types/retry': 0.12.0
jest-snapshot: 30.0.0-alpha.6
react: 'npm:react@19.3.0-canary-07dde64d-20261013'
react-dom: 'npm:react-dom@19.3.0-canary-07dde64d-20261013'
react-is: 'npm:react-is@19.3.0-canary-07dde64d-20261013'
scheduler: 'npm:scheduler@0.28.0-canary-07dde64d-20261013'
packageExtensions:
eslint-plugin-react-hooks@0.0.0-experimental-6de32a5a-20250822:
dependencies:
'@babel/plugin-proposal-private-methods': ^7.18.6
patchedDependencies:
webpack-sources@3.2.3: patches/webpack-sources@3.2.3.patch
stacktrace-parser@0.1.10: patches/stacktrace-parser@0.1.10.patch
taskr@1.1.0: patches/taskr@1.1.0.patch
minizlib@3.1.0: patches/minizlib@3.1.0.patch
'@rspack/core@1.6.7': patches/@rspack__core@1.6.7.patch
'@modelcontextprotocol/sdk': patches/@modelcontextprotocol__sdk.patch
'@vercel/blob': patches/@vercel__blob.patch
postcss-scss: patches/postcss-scss.patch
playwright-core@1.61.0: patches/playwright-core@1.61.0.patch
'@types/node@20.17.7': patches/@types__node@20.17.7.patch
'@vercel/agent-eval@2.2.1': patches/@vercel__agent-eval@2.2.1.patch
'@vercel/og@1.0.1': patches/@vercel__og@1.0.1.patch
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"type": "git", "type": "git",
"url": "git+https://github.com/vercel/next.js.git" "url": "git+https://github.com/vercel/next.js.git"
}, },
"packageManager": "pnpm@10.33.0", "packageManager": "pnpm@12.9.1",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"exports": { "exports": {
......
---
lockfileVersion: '9.0'
importers:
.:
configDependencies: {}
packageManagerDependencies:
pnpm:
specifier: 12.9.1
version: 12.9.1
packages:
'@pnpm/exe.android-arm64@12.9.1':
resolution: {integrity: sha512-Hgm1XdqMTfBC8PdGLL+NjZWv4xyi7D6XNrN9fb24XGYlyTBmUtdCefKnCLmHujShRD8BEO1zqM30SNcKBDLysw==}
cpu: [arm64]
os: [android]
'@pnpm/exe.android-x64@12.9.1':
resolution: {integrity: sha512-WDGCe6jZRVZP3RC/q6hOkZylkPkIQIi1/GcrR/d/YzbihhAHXCczrk+UYnV5TgbsEnAYO7Cx+2rX3nfhHvy24w==}
cpu: [x64]
os: [android]
'@pnpm/exe.darwin-arm64@12.9.1':
resolution: {integrity: sha512-+7iiEEBgYN9szPWUnAuN6eOVMTI6Hrki5bcuC9n9xl9tTnT53Tpxpo45Hml+W4IrAU0d+Tmd0sPnVIbX59PD6w==}
cpu: [arm64]
os: [darwin]
'@pnpm/exe.darwin-x64@12.9.1':
resolution: {integrity: sha512-SK7TxJiR12GbJZGffRFHItkc+Mx+99v6xMMJ9/X//8NwWV1wo17a2bwfGI8qZpl17YwsrmPEFOOqhzE1GIlrtQ==}
cpu: [x64]
os: [darwin]
'@pnpm/exe.freebsd-x64@12.9.1':
resolution: {integrity: sha512-4AjLk6uvTs2iO6wMit2hcxJ2M32xb7OV5SNFk+w6G8/NzcjcMB7ENEpyeXyLiP0kcnp8uaCGUct2NfrLCJ35eQ==}
cpu: [x64]
os: [freebsd]
'@pnpm/exe.linux-arm64-musl@12.9.1':
resolution: {integrity: sha512-dZL2ES1ckDWM9v+EtxoOklZ0WNdtayooi9iLiDUubopudX3zXPNR2mlrxBRgjbDgECOndQen2SmyxL5eZiBuKw==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-arm64@12.9.1':
resolution: {integrity: sha512-cx+uF6xqwEtm7B8NV+1ve0xBg9gcuzQZ5R+0WgOWvKG/h978UljS6BgWs1ipIGuGgUdeVhm3PKmBltXIcczLXA==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-ppc64@12.9.1':
resolution: {integrity: sha512-MpjPsy4XR17zAtLziQZfsN+wveWa/bUJggZtwfo3+SuyRmXnSvVkFD4+v8/3RTWyYaM6mwLUTjZDJ+g3urL+ew==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-riscv64@12.9.1':
resolution: {integrity: sha512-Oo67TKqqH+Bno+L6X7Xyorwp1QG82zKIkL0vbo1x2kcPTDiyPbdM+d6lIs4+hzeB1KHT5FDoGzZj2dad7Ft+eg==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-s390x@12.9.1':
resolution: {integrity: sha512-QAD5FRCdW36HfD58BV7DoDm6z8yv+GgSqcUV1+ERwYjpVQuG6ZTpf5o0x3KDas8eTLIW7MLYVdDdlAurWeArEg==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-x64-musl@12.9.1':
resolution: {integrity: sha512-mQDhBsGqcTkrLQM4q5igmRFcr6EAl4UM/FGawY+0CWGcqPpUmYUvDy9LHy80xxkHIWVJ886gvvso2XOjfav1Jw==}
cpu: [x64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-x64@12.9.1':
resolution: {integrity: sha512-+M5N74hM4fc87AAckxx/UIW+dUnWf2eko+HchJs/NZUxehLhekNyMI/GNaNXlvd+kWR+97XXBD51XRkkNiUtrA==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@pnpm/exe.win32-arm64@12.9.1':
resolution: {integrity: sha512-mI28C2wxobrDi6x1OYhBRyG10hnDq/4sEIyy5RzoX6LB4kLuv6K/d25HOpMwlW20cuM4M72k9NZpOdcmUxMbEA==}
cpu: [arm64]
os: [win32]
'@pnpm/exe.win32-x64@12.9.1':
resolution: {integrity: sha512-SWoDMT0oD7NrDSIoPpkKD09D9fAQKNjwFZ3lezlCUhAfXxMv70zsfrNT2/P+GoCK2kefXF9OysUZkH1l5vvvfA==}
cpu: [x64]
os: [win32]
pnpm@12.9.1:
resolution: {integrity: sha512-BrBV//XNINwSeB3hc87TMQzglRvy7GICEaFgRdVETVyTpmMhB2TvKaZTphBFm6A2jw50+E2AxUcjz5Wq57wNbQ==}
engines: {node: '>=18.*'}
hasBin: true
snapshots:
'@pnpm/exe.android-arm64@12.9.1':
optional: true
'@pnpm/exe.android-x64@12.9.1':
optional: true
'@pnpm/exe.darwin-arm64@12.9.1':
optional: true
'@pnpm/exe.darwin-x64@12.9.1':
optional: true
'@pnpm/exe.freebsd-x64@12.9.1':
optional: true
'@pnpm/exe.linux-arm64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-arm64@12.9.1':
optional: true
'@pnpm/exe.linux-ppc64@12.9.1':
optional: true
'@pnpm/exe.linux-riscv64@12.9.1':
optional: true
'@pnpm/exe.linux-s390x@12.9.1':
optional: true
'@pnpm/exe.linux-x64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-x64@12.9.1':
optional: true
'@pnpm/exe.win32-arm64@12.9.1':
optional: true
'@pnpm/exe.win32-x64@12.9.1':
optional: true
pnpm@12.9.1:
optionalDependencies:
'@pnpm/exe.android-arm64': 12.9.1
'@pnpm/exe.android-x64': 12.9.1
'@pnpm/exe.darwin-arm64': 12.9.1
'@pnpm/exe.darwin-x64': 12.9.1
'@pnpm/exe.freebsd-x64': 12.9.1
'@pnpm/exe.linux-arm64': 12.9.1
'@pnpm/exe.linux-arm64-musl': 12.9.1
'@pnpm/exe.linux-ppc64': 12.9.1
'@pnpm/exe.linux-riscv64': 12.9.1
'@pnpm/exe.linux-s390x': 12.9.1
'@pnpm/exe.linux-x64': 12.9.1
'@pnpm/exe.linux-x64-musl': 12.9.1
'@pnpm/exe.win32-arm64': 12.9.1
'@pnpm/exe.win32-x64': 12.9.1
---
lockfileVersion: '9.0' lockfileVersion: '9.0'
settings: settings:
......
...@@ -51,12 +51,13 @@ const writeJson = async (filePath, data) => ...@@ -51,12 +51,13 @@ const writeJson = async (filePath, data) =>
await fs.writeFile(path.join(cwd, 'pnpm-lock.yaml'), '') await fs.writeFile(path.join(cwd, 'pnpm-lock.yaml'), '')
const rootPkgJsonPath = path.join(cwd, 'package.json') const rootPkgJsonPath = path.join(cwd, 'package.json')
const { packageManager } = await readJson(rootPkgJsonPath)
await writeJson(rootPkgJsonPath, { await writeJson(rootPkgJsonPath, {
name: 'nextjs-project', name: 'nextjs-project',
version: '0.0.0', version: '0.0.0',
private: true, private: true,
workspaces: ['packages/*'], workspaces: ['packages/*'],
scripts: {}, scripts: {},
packageManager: 'pnpm@10.33.0', packageManager,
}) })
})() })()
...@@ -105,6 +105,35 @@ function getPackageVersion(packageName, versionStr) { ...@@ -105,6 +105,35 @@ function getPackageVersion(packageName, versionStr) {
return `npm:${packageName}@${versionStr}` return `npm:${packageName}@${versionStr}`
} }
/**
* Replaces an existing entry of the top-level `overrides` map in
* `pnpm-workspace.yaml`, leaving the rest of the file (comments, ordering,
* quoting) untouched.
*
* @param {string} workspaceYaml
* @param {string} packageName
* @param {string} version
* @returns {string}
*/
function setPnpmWorkspaceOverride(workspaceYaml, packageName, version) {
const overridesMatch = /^overrides:\n((?:[ #].*\n|\n)*)/m.exec(workspaceYaml)
if (overridesMatch === null) {
throw new Error('Expected an `overrides` map in pnpm-workspace.yaml')
}
const entry = new RegExp(`^ '?${packageName}'?:.*$`, 'm')
if (!entry.test(overridesMatch[1])) {
throw new Error(
`Expected an override for "${packageName}" in pnpm-workspace.yaml`
)
}
const overridesStart = overridesMatch.index + 'overrides:\n'.length
return (
workspaceYaml.slice(0, overridesStart) +
overridesMatch[1].replace(entry, ` ${packageName}: '${version}'`) +
workspaceYaml.slice(overridesStart + overridesMatch[1].length)
)
}
async function sync({ channel, newVersionStr, noInstall }) { async function sync({ channel, newVersionStr, noInstall }) {
const useExperimental = channel === 'experimental' const useExperimental = channel === 'experimental'
const cwd = process.cwd() const cwd = process.cwd()
...@@ -112,7 +141,8 @@ async function sync({ channel, newVersionStr, noInstall }) { ...@@ -112,7 +141,8 @@ async function sync({ channel, newVersionStr, noInstall }) {
await fsp.readFile(path.join(cwd, 'package.json'), 'utf-8') await fsp.readFile(path.join(cwd, 'package.json'), 'utf-8')
) )
const devDependencies = pkgJson.devDependencies const devDependencies = pkgJson.devDependencies
const pnpmOverrides = pkgJson.pnpm.overrides /** @type {Record<string, string>} */
const pnpmOverrides = {}
const baseVersionStr = devDependencies[ const baseVersionStr = devDependencies[
useExperimental ? 'react-experimental-builtin' : 'react-builtin' useExperimental ? 'react-experimental-builtin' : 'react-builtin'
].replace(/^npm:react@/, '') ].replace(/^npm:react@/, '')
...@@ -172,6 +202,17 @@ async function sync({ channel, newVersionStr, noInstall }) { ...@@ -172,6 +202,17 @@ async function sync({ channel, newVersionStr, noInstall }) {
// Prettier would add a newline anyway so do it manually to skip the additional `pnpm prettier-write` // Prettier would add a newline anyway so do it manually to skip the additional `pnpm prettier-write`
'\n' '\n'
) )
const pnpmWorkspacePath = path.join(cwd, 'pnpm-workspace.yaml')
let pnpmWorkspace = await fsp.readFile(pnpmWorkspacePath, 'utf-8')
for (const [packageName, version] of Object.entries(pnpmOverrides)) {
pnpmWorkspace = setPnpmWorkspaceOverride(
pnpmWorkspace,
packageName,
version
)
}
await fsp.writeFile(pnpmWorkspacePath, pnpmWorkspace)
} }
/** /**
......
...@@ -51,7 +51,7 @@ module.exports = function bindings(name) { ...@@ -51,7 +51,7 @@ module.exports = function bindings(name) {
throw new Error( throw new Error(
`bindings: ${binary} does not exist. The fixture addon is compiled by ` + `bindings: ${binary} does not exist. The fixture addon is compiled by ` +
`node-gyp during install, which requires the package to be listed in ` + `node-gyp during install, which requires the package to be listed in ` +
`the test's pnpm.onlyBuiltDependencies.` `\`allowBuilds\` in the test's pnpm-workspace.yaml.`
) )
} }
......
# `single-context-addon` is compiled by node-gyp during install, and pnpm does # `single-context-addon` is compiled by node-gyp during install, and pnpm does
# not run a dependency's build scripts unless they are approved here. The repo # not run a dependency's build scripts unless they are approved here. Local
# root uses the same key for the one package it allows to build. # file dependencies require an approval for their full dependency path.
allowBuilds: allowBuilds:
single-context-addon: true single-context-addon@file:single-context-addon: true
...@@ -41,11 +41,6 @@ describe('agent upgrade terminal', () => { ...@@ -41,11 +41,6 @@ describe('agent upgrade terminal', () => {
// The first release with Linux prebuilds, so CI does not compile it. // The first release with Linux prebuilds, so CI does not compile it.
'node-pty': '1.2.0-beta.15', 'node-pty': '1.2.0-beta.15',
}, },
packageJson: {
pnpm: {
onlyBuiltDependencies: ['node-pty'],
},
},
}) })
if (skipped) { if (skipped) {
......
# `node-pty` downloads or compiles its native binary in an install script, and
# pnpm does not run a dependency's build scripts unless they are approved here.
allowBuilds:
node-pty: true
...@@ -27,16 +27,16 @@ describe('nx-handling', () => { ...@@ -27,16 +27,16 @@ describe('nx-handling', () => {
dependencies: { dependencies: {
react: '19.0.0', react: '19.0.0',
'react-dom': '19.0.0', 'react-dom': '19.0.0',
'@nx/js': '21.1.3', '@nx/js': '23.2.1',
'@nx/next': '21.1.3', '@nx/next': '23.2.1',
'@nx/workspace': '21.1.3', '@nx/workspace': '23.2.1',
'@swc-node/register': '~1.9.1', '@swc-node/register': '~1.9.1',
'@swc/cli': '~0.6.0', '@swc/cli': '~0.6.0',
'@swc/core': '~1.5.7', '@swc/core': '~1.5.7',
'@swc/helpers': '~0.5.11', '@swc/helpers': '~0.5.11',
'@types/react': '19.0.0', '@types/react': '19.0.0',
'@types/react-dom': '19.0.0', '@types/react-dom': '19.0.0',
nx: '21.1.3', nx: '23.2.1',
tslib: '^2.3.0', tslib: '^2.3.0',
typescript: '~5.7.2', typescript: '~5.7.2',
}, },
......
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
"dependencies": { "dependencies": {
"react": "19.0.0", "react": "19.0.0",
"react-dom": "19.0.0", "react-dom": "19.0.0",
"@nx/js": "21.1.3", "@nx/js": "23.2.1",
"@nx/next": "21.1.3", "@nx/next": "23.2.1",
"@nx/workspace": "21.1.3", "@nx/workspace": "23.2.1",
"@swc-node/register": "~1.9.1", "@swc-node/register": "~1.9.1",
"@swc/cli": "~0.6.0", "@swc/cli": "~0.6.0",
"@swc/core": "~1.5.7", "@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.23", "@swc/helpers": "~0.5.23",
"@types/react": "19.0.0", "@types/react": "19.0.0",
"@types/react-dom": "19.0.0", "@types/react-dom": "19.0.0",
"nx": "21.1.3", "nx": "23.2.1",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"typescript": "~5.7.2" "typescript": "~5.7.2"
}, },
......
packages: packages:
- 'apps/*' - 'apps/*'
allowBuilds:
'@swc/core': true
nx: true
...@@ -63,7 +63,7 @@ function getBuildError(cliOutput: string): string { ...@@ -63,7 +63,7 @@ function getBuildError(cliOutput: string): string {
// Package-manager and Vercel command failures are not compiler output. // Package-manager and Vercel command failures are not compiler output.
if ( if (
/^(?:ELIFECYCLE\s|Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$)/.test( /^(?:\[ELIFECYCLE\]\s|Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$)/.test(
line line
) )
) { ) {
......
{ {
"private": true, "private": true,
"dependencies": { "dependencies": {
"my-package": "file:./my-package.tar" "internal-pkg": "file:./internal-pkg.tgz"
} }
} }
import { nextTestSetup } from 'e2e-utils' import { FileRef, nextTestSetup } from 'e2e-utils'
import { execFileSync } from 'child_process'
import { mkdtemp, rm } from 'fs/promises'
import { tmpdir } from 'os'
import { join } from 'path'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode. // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// This test is skipped when deployed because the local tarball appears corrupted // This test is skipped when deployed because the local tarball appears corrupted
// It also doesn't seem particularly useful to test when deployed // It also doesn't seem particularly useful to test when deployed
// @force-gate !deploy // @force-gate !deploy
describe('self-importing-package', () => { describe('self-importing-package', () => {
const overrideFiles: Record<string, FileRef> = {}
let archiveDir: string
beforeAll(async () => {
archiveDir = await mkdtemp(join(tmpdir(), 'internal-pkg-'))
const archivePath = join(archiveDir, 'internal-pkg.tgz')
execFileSync('tar', ['-czf', archivePath, 'internal-pkg'], {
cwd: __dirname,
})
overrideFiles['internal-pkg.tgz'] = new FileRef(archivePath)
})
afterAll(async () => {
if (archiveDir) {
await rm(archiveDir, { recursive: true, force: true })
}
})
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
overrideFiles,
dependencies: { dependencies: {
'internal-pkg': 'file:./internal-pkg.tar', 'internal-pkg': 'file:./internal-pkg.tgz',
}, },
}) })
......
...@@ -51,7 +51,7 @@ module.exports = function bindings(name) { ...@@ -51,7 +51,7 @@ module.exports = function bindings(name) {
throw new Error( throw new Error(
`bindings: ${binary} does not exist. The fixture addon is compiled by ` + `bindings: ${binary} does not exist. The fixture addon is compiled by ` +
`node-gyp during install, which requires the package to be listed in ` + `node-gyp during install, which requires the package to be listed in ` +
`the test's pnpm.onlyBuiltDependencies.` `\`allowBuilds\` in the test's pnpm-workspace.yaml.`
) )
} }
......
# `native-addon` is compiled by node-gyp during install, and pnpm does # `native-addon` is compiled by node-gyp during install, and pnpm does
# not run a dependency's build scripts unless they are approved here. The repo # not run a dependency's build scripts unless they are approved here. Local
# root uses the same key for the one package it allows to build. # file dependencies require an approval for their full dependency path.
allowBuilds: allowBuilds:
native-addon: true native-addon@file:native-addon: true
{ {
"private": true, "private": true,
"dependencies": { "dependencies": {
"my-differentiated-files": "file:./my-differentiated-files.tar" "my-differentiated-files": "file:./my-differentiated-files.tgz"
} }
} }
import { nextTestSetup } from 'e2e-utils' import { FileRef, nextTestSetup } from 'e2e-utils'
import { execFileSync } from 'child_process'
import { mkdtemp, rm } from 'fs/promises'
import { tmpdir } from 'os'
import { join } from 'path'
describe('typeof-window', () => { describe('typeof-window', () => {
const overrideFiles: Record<string, FileRef> = {}
let archiveDir: string
beforeAll(async () => {
archiveDir = await mkdtemp(join(tmpdir(), 'my-differentiated-files-'))
const archivePath = join(archiveDir, 'my-differentiated-files.tgz')
execFileSync('tar', ['-czf', archivePath, 'my-differentiated-files'], {
cwd: __dirname,
})
overrideFiles['my-differentiated-files.tgz'] = new FileRef(archivePath)
})
afterAll(async () => {
if (archiveDir) {
await rm(archiveDir, { recursive: true, force: true })
}
})
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
overrideFiles,
dependencies: { dependencies: {
'my-differentiated-files': 'file:./my-differentiated-files.tar', 'my-differentiated-files': 'file:./my-differentiated-files.tgz',
}, },
}) })
......
...@@ -189,7 +189,7 @@ function getBuildOutput(cliOutput: string, isNextDeploy: boolean): string { ...@@ -189,7 +189,7 @@ function getBuildOutput(cliOutput: string, isNextDeploy: boolean): string {
// Package-manager command failures and inspect metadata are not compiler output. // Package-manager command failures and inspect metadata are not compiler output.
if ( if (
isNextDeploy && isNextDeploy &&
/^(?:ELIFECYCLE\s|Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$)/.test( /^(?:\[ELIFECYCLE\]\s|Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$)/.test(
stripAnsi(line).trim() stripAnsi(line).trim()
) )
) { ) {
......
...@@ -4,8 +4,8 @@ import { renderViaHTTP } from 'next-test-utils' ...@@ -4,8 +4,8 @@ import { renderViaHTTP } from 'next-test-utils'
describe('handle-non-hoisted-swc-helpers', () => { describe('handle-non-hoisted-swc-helpers', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: { files: {
'.npmrc': `# The helper move below needs real package directories, not pnpm symlinks. 'pnpm-workspace.yaml': `# The helper move below needs real package directories, not pnpm symlinks.
node-linker=hoisted nodeLinker: hoisted
`, `,
'pages/index.js': ` 'pages/index.js': `
export default function Page() { export default function Page() {
......
...@@ -51,7 +51,7 @@ module.exports = function bindings(name) { ...@@ -51,7 +51,7 @@ module.exports = function bindings(name) {
throw new Error( throw new Error(
`bindings: ${binary} does not exist. The fixture addon is compiled by ` + `bindings: ${binary} does not exist. The fixture addon is compiled by ` +
`node-gyp during install, which requires the package to be listed in ` + `node-gyp during install, which requires the package to be listed in ` +
`the test's pnpm.onlyBuiltDependencies.` `\`allowBuilds\` in the test's pnpm-workspace.yaml.`
) )
} }
......
# `native-addon` is compiled by node-gyp during install, and pnpm does # `native-addon` is compiled by node-gyp during install, and pnpm does
# not run a dependency's build scripts unless they are approved here. The repo # not run a dependency's build scripts unless they are approved here. Local
# root uses the same key for the one package it allows to build. # file dependencies require an approval for their full dependency path.
allowBuilds: allowBuilds:
native-addon: true native-addon@file:native-addon: true
...@@ -9,7 +9,7 @@ const lockfile = require('proper-lockfile') ...@@ -9,7 +9,7 @@ const lockfile = require('proper-lockfile')
const yaml = require('js-yaml') const yaml = require('js-yaml')
const { const {
getPnpmSecuritySettings, getPnpmSecuritySettings,
mergePnpmSecuritySettingsIntoYaml, mergeSettingsIntoYaml,
getYarnSecuritySettings, getYarnSecuritySettings,
mergeYarnSecuritySettingsIntoYaml, mergeYarnSecuritySettingsIntoYaml,
} = require('./pnpm-security-settings') } = require('./pnpm-security-settings')
...@@ -18,6 +18,14 @@ const PREFER_OFFLINE = process.env.NEXT_TEST_PREFER_OFFLINE === '1' ...@@ -18,6 +18,14 @@ const PREFER_OFFLINE = process.env.NEXT_TEST_PREFER_OFFLINE === '1'
const useRspack = process.env.NEXT_TEST_USE_RSPACK === '1' const useRspack = process.env.NEXT_TEST_USE_RSPACK === '1'
const ROOT_PACKAGE_MANAGER = require('../../package.json').packageManager const ROOT_PACKAGE_MANAGER = require('../../package.json').packageManager
const PNPM_TEST_DIR_SETTINGS = {
// fixtures depend on packages with build scripts that they don't declare in `allowBuilds`: this
// will skip them (`allowBuilds` defaults to `false` for unlisted packages) instead of failing
strictDepBuilds: false,
// pnpm auto-installs before running scripts, we want to be explicit about this in tests
verifyDepsBeforeRun: false,
}
async function installDependencies(cwd, tmpDir) { async function installDependencies(cwd, tmpDir) {
const args = [ const args = [
'install', 'install',
...@@ -73,6 +81,10 @@ async function findConfigFile(fileName, installDir, isolationRoot) { ...@@ -73,6 +81,10 @@ async function findConfigFile(fileName, installDir, isolationRoot) {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async function applyInstallSecuritySettings(installDir, isolationRoot) { async function applyInstallSecuritySettings(installDir, isolationRoot) {
const pnpmSettings = {
...getPnpmSecuritySettings(),
...PNPM_TEST_DIR_SETTINGS,
}
const workspaceFile = await findConfigFile( const workspaceFile = await findConfigFile(
'pnpm-workspace.yaml', 'pnpm-workspace.yaml',
installDir, installDir,
...@@ -81,14 +93,15 @@ async function applyInstallSecuritySettings(installDir, isolationRoot) { ...@@ -81,14 +93,15 @@ async function applyInstallSecuritySettings(installDir, isolationRoot) {
if (workspaceFile !== null) { if (workspaceFile !== null) {
await fs.writeFile( await fs.writeFile(
workspaceFile, workspaceFile,
mergePnpmSecuritySettingsIntoYaml( mergeSettingsIntoYaml(
await fs.readFile(workspaceFile, 'utf8') await fs.readFile(workspaceFile, 'utf8'),
pnpmSettings
) )
) )
} else { } else {
await fs.writeFile( await fs.writeFile(
path.join(installDir, 'pnpm-workspace.yaml'), path.join(installDir, 'pnpm-workspace.yaml'),
yaml.dump(getPnpmSecuritySettings()) yaml.dump(pnpmSettings)
) )
} }
...@@ -155,14 +168,17 @@ async function lockfileResolvesLocalTarball( ...@@ -155,14 +168,17 @@ async function lockfileResolvesLocalTarball(
packageName, packageName,
expectedTarballPath expectedTarballPath
) { ) {
const lockfile = /** @type {Record<string, any>} */ ( // pnpm 11+ prepends a separate YAML document that locks pnpm itself.
yaml.load( const lockfileDocuments = /** @type {Record<string, any>[]} */ (
yaml.loadAll(
await fs.readFile(path.join(installDir, 'pnpm-lock.yaml'), 'utf8') await fs.readFile(path.join(installDir, 'pnpm-lock.yaml'), 'utf8')
) )
) )
const expectedRealpath = await fs.realpath(expectedTarballPath) const expectedRealpath = await fs.realpath(expectedTarballPath)
for (const [key, pkg] of Object.entries(lockfile.packages || {})) { for (const [key, pkg] of lockfileDocuments.flatMap((lockfile) =>
Object.entries(lockfile?.packages || {})
)) {
const tarball = pkg?.resolution?.tarball const tarball = pkg?.resolution?.tarball
if ( if (
!key.startsWith(`${packageName}@file:`) || !key.startsWith(`${packageName}@file:`) ||
...@@ -418,6 +434,8 @@ async function createNextInstall({ ...@@ -418,6 +434,8 @@ async function createNextInstall({
childProcess.execSync(installString, { childProcess.execSync(installString, {
cwd: installDir, cwd: installDir,
stdio: ['ignore', 'inherit', 'inherit'], stdio: ['ignore', 'inherit', 'inherit'],
// Synchronous installs block Jest's timeout from firing.
timeout: 5 * 60 * 1000,
}) })
}) })
} else { } else {
...@@ -469,6 +487,7 @@ async function createNextInstall({ ...@@ -469,6 +487,7 @@ async function createNextInstall({
} }
module.exports = { module.exports = {
PNPM_TEST_DIR_SETTINGS,
createNextInstall, createNextInstall,
getPkgPaths: linkPackages, getPkgPaths: linkPackages,
packPackages, packPackages,
......
import os from 'os' import os from 'os'
import path from 'path' import path from 'path'
import { existsSync, promises as fs, rmSync, readFileSync } from 'fs' import { randomBytes } from 'crypto'
import {
existsSync,
promises as fs,
mkdirSync,
readFileSync,
renameSync,
rmSync,
statSync,
writeFileSync,
} from 'fs'
import treeKill from 'tree-kill' import treeKill from 'tree-kill'
import type { NextConfig } from 'next' import type { NextConfig } from 'next'
import { FileRef, isNextDeploy, PatchedFileRef } from '../e2e-utils' import { FileRef, isNextDeploy, PatchedFileRef } from '../e2e-utils'
...@@ -429,6 +439,9 @@ export class NextInstance { ...@@ -429,6 +439,9 @@ export class NextInstance {
await fs.rm(path.join(this.testDir, 'pnpm-workspace.yaml'), { await fs.rm(path.join(this.testDir, 'pnpm-workspace.yaml'), {
force: true, force: true,
}) })
// Keep pnpm from reinstalling and recreating the workspace marker
// after we remove the YAML that normally disables this behavior.
this.env.pnpm_config_verify_deps_before_run = 'false'
} }
const testDirFiles = await fs.readdir(this.testDir) const testDirFiles = await fs.readdir(this.testDir)
...@@ -665,6 +678,7 @@ export class NextInstance { ...@@ -665,6 +678,7 @@ export class NextInstance {
'package.json', 'package.json',
'yarn.lock', 'yarn.lock',
'pnpm-lock.yaml', 'pnpm-lock.yaml',
'pnpm-workspace.yaml',
] ]
for (const file of await fs.readdir(this.testDir)) { for (const file of await fs.readdir(this.testDir)) {
if (!keptFiles.includes(file)) { if (!keptFiles.includes(file)) {
...@@ -1097,28 +1111,48 @@ export class NextInstance { ...@@ -1097,28 +1111,48 @@ export class NextInstance {
runWithTempContent?: (context: { newFile: boolean }) => Promise<void> runWithTempContent?: (context: { newFile: boolean }) => Promise<void>
): Promise<{ newFile: boolean }> { ): Promise<{ newFile: boolean }> {
const outputPath = path.join(this.testDir, filename) const outputPath = path.join(this.testDir, filename)
const newFile = !existsSync(outputPath) const originalStat = statSync(outputPath, { throwIfNoEntry: false })
await fs.mkdir(path.dirname(outputPath), { recursive: true }) const newFile = originalStat === undefined
const previousContent = newFile ? undefined : await this.readFile(filename) mkdirSync(path.dirname(outputPath), { recursive: true })
await fs.writeFile( let patchedContent: string
outputPath, if (typeof content === 'function') {
typeof content === 'function' ? content(previousContent) : content, let previousContent: string | undefined
{ if (!newFile) {
flush: true, previousContent = this.readFileSync(filename)
} }
) patchedContent = content(previousContent)
} else {
patchedContent = content
}
if (runWithTempContent) { let backupPath: string | undefined
try { if (!newFile && runWithTempContent) {
backupPath = `${outputPath}.${randomBytes(4).toString('hex')}.bak`
}
// Never modify files in place: pnpm installs hard links, so a patch could
// corrupt its shared store and affect other fixtures. Keep the original
// inode for temporary patches and write the replacement as a new file.
if (backupPath) {
renameSync(outputPath, backupPath)
} else if (!newFile) {
rmSync(outputPath, { force: true })
}
try {
writeFileSync(outputPath, patchedContent, {
flush: true,
mode: originalStat?.mode,
})
if (runWithTempContent) {
await runWithTempContent({ newFile }) await runWithTempContent({ newFile })
} finally { }
if (previousContent === undefined) { } finally {
await fs.rm(outputPath) if (runWithTempContent) {
} else { rmSync(outputPath, { force: true })
await fs.writeFile(outputPath, previousContent, { if (backupPath) {
flush: true, renameSync(backupPath, outputPath)
})
} }
} }
} }
......
...@@ -10,7 +10,11 @@ import { Span } from 'next/dist/trace' ...@@ -10,7 +10,11 @@ import { Span } from 'next/dist/trace'
import { setTimeout } from 'timers/promises' import { setTimeout } from 'timers/promises'
import { FileRef } from '../e2e-utils' import { FileRef } from '../e2e-utils'
import { PROXY_HOST_MAP_ENV_KEY } from '../browsers/launch' import { PROXY_HOST_MAP_ENV_KEY } from '../browsers/launch'
import { packPackages } from '../create-next-install' import { packPackages, PNPM_TEST_DIR_SETTINGS } from '../create-next-install'
import {
getPnpmSecuritySettings,
mergeSettingsIntoYaml,
} from '../pnpm-security-settings'
export class NextDeployInstance extends NextInstance { export class NextDeployInstance extends NextInstance {
private _cliOutput: string private _cliOutput: string
...@@ -20,6 +24,7 @@ export class NextDeployInstance extends NextInstance { ...@@ -20,6 +24,7 @@ export class NextDeployInstance extends NextInstance {
private _writtenHostsLine: string | null = null private _writtenHostsLine: string | null = null
private _restoreDnsLookup: (() => void) | null = null private _restoreDnsLookup: (() => void) | null = null
private _startPromise: Promise<void> | undefined private _startPromise: Promise<void> | undefined
private _npmrcAuthFile: string | undefined
constructor(opts: NextInstanceOpts) { constructor(opts: NextInstanceOpts) {
super(opts) super(opts)
...@@ -297,6 +302,29 @@ export class NextDeployInstance extends NextInstance { ...@@ -297,6 +302,29 @@ export class NextDeployInstance extends NextInstance {
) { ) {
await this.prepareLocalPackages(parentSpan) await this.prepareLocalPackages(parentSpan)
} }
this.preparePnpmSettings()
}
private preparePnpmSettings(): void {
const workspacePath = path.join(this.testDir, 'pnpm-workspace.yaml')
const settings = {
...getPnpmSecuritySettings(),
...PNPM_TEST_DIR_SETTINGS,
// Our preview tarballs reference other packages from the same commit by
// URL. pnpm rejects those subdependencies even with explicit overrides.
...(process.env.NEXT_TEST_VERSION && { blockExoticSubdeps: false }),
}
let workspace: string
if (fs.existsSync(workspacePath)) {
workspace = mergeSettingsIntoYaml(
fs.readFileSync(workspacePath, 'utf8'),
settings
)
} else {
workspace = dump(settings)
}
this.writeFixtureConfiguration(workspacePath, workspace)
} }
private async deploy() { private async deploy() {
...@@ -515,6 +543,13 @@ export class NextDeployInstance extends NextInstance { ...@@ -515,6 +543,13 @@ export class NextDeployInstance extends NextInstance {
'NEXT_TELEMETRY_DISABLED=1', 'NEXT_TELEMETRY_DISABLED=1',
'--build-env', '--build-env',
'VERCEL_NEXT_BUNDLED_SERVER=1', 'VERCEL_NEXT_BUNDLED_SERVER=1',
// See: https://pnpm.io/npmrc#environment-variables-in-auth-settings
...(this._npmrcAuthFile
? [
'--build-env',
`PNPM_CONFIG_NPMRC_AUTH_FILE=${this._npmrcAuthFile}`,
]
: []),
...additionalEnv.flatMap((pair) => [ ...additionalEnv.flatMap((pair) => [
'--env', '--env',
pair, pair,
...@@ -580,22 +615,9 @@ export class NextDeployInstance extends NextInstance { ...@@ -580,22 +615,9 @@ export class NextDeployInstance extends NextInstance {
this.parseIdsFromCliOutput() this.parseIdsFromCliOutput()
} }
private async writeFixtureConfiguration( private writeFixtureConfiguration(filePath: string, contents: string): void {
filePath: string, fs.rmSync(filePath, { force: true })
contents: string fs.writeFileSync(filePath, contents)
): Promise<void> {
const temporaryDirectory = await fs.mkdtemp(
path.join(path.dirname(filePath), '.next-test-config-')
)
const temporaryPath = path.join(temporaryDirectory, path.basename(filePath))
try {
// Preserve permissions and replace links rather than their targets.
await fs.copyFile(filePath, temporaryPath, fs.constants.COPYFILE_EXCL)
await fs.writeFile(temporaryPath, contents)
await fs.rename(temporaryPath, filePath)
} finally {
await fs.remove(temporaryDirectory)
}
} }
/** /**
...@@ -783,7 +805,7 @@ export class NextDeployInstance extends NextInstance { ...@@ -783,7 +805,7 @@ export class NextDeployInstance extends NextInstance {
} }
} }
await this.writeFixtureConfiguration( this.writeFixtureConfiguration(
packageJsonPath, packageJsonPath,
JSON.stringify(packageJson, null, 2) + '\n' JSON.stringify(packageJson, null, 2) + '\n'
) )
...@@ -811,12 +833,11 @@ export class NextDeployInstance extends NextInstance { ...@@ -811,12 +833,11 @@ export class NextDeployInstance extends NextInstance {
...packageJson.pnpm.overrides, ...packageJson.pnpm.overrides,
...workspace.overrides, ...workspace.overrides,
} }
await this.writeFixtureConfiguration(filePath, dump(workspace)) this.writeFixtureConfiguration(filePath, dump(workspace))
} else if (contents !== '') { } else if (contents !== '') {
const separator = contents.endsWith('\n') ? '' : '\n' this.writeFixtureConfiguration(
await this.writeFixtureConfiguration(
filePath, filePath,
`${contents}${separator}!/${directoryName}\n!/${directoryName}/**\n` `${contents}\n!/${directoryName}\n!/${directoryName}/**\n`
) )
break break
} }
...@@ -826,32 +847,25 @@ export class NextDeployInstance extends NextInstance { ...@@ -826,32 +847,25 @@ export class NextDeployInstance extends NextInstance {
) )
} }
// When preview builds are private, the deploy build installs Next.js // Private preview builds authenticate with the remote build's Vercel OIDC
// artifacts from an auth-protected route and needs credentials. The build // token. pnpm only expands auth placeholders in trusted configuration, so
// authenticates with the Vercel OIDC token that Vercel automatically // pass a separate mirror auth file through PNPM_CONFIG_NPMRC_AUTH_FILE.
// provides to builds (vercel-packages accepts it for allowlisted teams), so // https://pnpm.io/npmrc#environment-variables-in-auth-settings
// we write an `.npmrc` referencing it. Referencing the environment variable // This keeps tokens out of uploaded source without trusting fixture .npmrc
// instead of inlining a token keeps credentials out of the uploaded // files. Public builds need no auth file or OIDC token.
// deployment source. Only written for private preview builds since public
// ones need no credentials and pnpm fails when an `.npmrc` references an
// unset environment variable.
// TODO: pnpm >= 10.34.2 no longer expands environment variables in
// repository .npmrc files (GHSA-3qhv-2rgh-x77r). An install command writing
// to the user-level pnpm config (like vercel/front does) did not work with
// `vercel deploy` and needs more investigation.
private async writeMirrorNpmrcIfNecessary(): Promise<void> { private async writeMirrorNpmrcIfNecessary(): Promise<void> {
const baseUrlRaw = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL const baseUrlRaw = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL
const access = process.env.PREVIEW_BUILDS_ACCESS const access = process.env.PREVIEW_BUILDS_ACCESS
if (access !== 'private') { if (access !== 'private') {
require('console').log( require('console').log(
`Skipping .npmrc write for preview-builds mirror: preview builds are public` `Skipping mirror auth file: preview builds are public`
) )
return return
} }
if (!baseUrlRaw) { if (!baseUrlRaw) {
require('console').warn( require('console').warn(
`Skipping .npmrc write for preview-builds mirror: PREVIEW_BUILDS_ACCESS=private but NEXT_TEST_PREVIEW_BUILDS_BASE_URL is not set, so the remote build cannot authenticate to the mirror` `Skipping mirror auth file: PREVIEW_BUILDS_ACCESS=private but NEXT_TEST_PREVIEW_BUILDS_BASE_URL is not set, so the remote build cannot authenticate to the mirror`
) )
return return
} }
...@@ -861,21 +875,13 @@ export class NextDeployInstance extends NextInstance { ...@@ -861,21 +875,13 @@ export class NextDeployInstance extends NextInstance {
// ensure a trailing slash so it matches requests to that registry path. // ensure a trailing slash so it matches requests to that registry path.
const registryKey = `//${baseUrl.host}${baseUrl.pathname.replace(/\/?$/, '/')}` const registryKey = `//${baseUrl.host}${baseUrl.pathname.replace(/\/?$/, '/')}`
require('console').log( require('console').log(`Writing mirror auth file: ${registryKey}`)
`Writing .npmrc for preview-builds mirror: ${registryKey}` const authFile = '.next-test-auth.npmrc'
)
// Appended rather than written, because a fixture may ship its own `.npmrc`
// (several do) and overwriting it silently drops that configuration.
const npmrcPath = path.join(this.testDir, '.npmrc')
const existing = (await fs.pathExists(npmrcPath))
? await fs.readFile(npmrcPath, 'utf8')
: ''
const separator = existing === '' || existing.endsWith('\n') ? '' : '\n'
await fs.writeFile( await fs.writeFile(
npmrcPath, path.join(this.testDir, authFile),
`${existing}${separator}${registryKey}:_authToken=\${VERCEL_OIDC_TOKEN}\n` `${registryKey}:_authToken=\${VERCEL_OIDC_TOKEN}\n`
) )
this._npmrcAuthFile = authFile
} }
/** /**
......
const PNPM_HOISTED_CONFIG = `# Work around the Node.js realpath bug fixed in 24.21.0 and 26.8.0. const PNPM_HOISTED_CONFIG = `# Work around the Node.js realpath bug fixed in 24.21.0 and 26.8.0.
# https://github.com/nodejs/node/pull/65113 # https://github.com/nodejs/node/pull/65113
node-linker=hoisted nodeLinker: hoisted
` `
function hasNodeRealpathFix(nodeVersion: string): boolean { function hasNodeRealpathFix(nodeVersion: string): boolean {
...@@ -16,5 +16,5 @@ export function getPnpmRealpathWorkaround( ...@@ -16,5 +16,5 @@ export function getPnpmRealpathWorkaround(
if (hasNodeRealpathFix(nodeVersion)) { if (hasNodeRealpathFix(nodeVersion)) {
return undefined return undefined
} }
return { '.npmrc': PNPM_HOISTED_CONFIG } return { 'pnpm-workspace.yaml': PNPM_HOISTED_CONFIG }
} }
...@@ -76,14 +76,6 @@ function mergeSettingsIntoYaml(yamlText, settings) { ...@@ -76,14 +76,6 @@ function mergeSettingsIntoYaml(yamlText, settings) {
return yaml.dump(config) return yaml.dump(config)
} }
/**
* @param {string} yamlText text of an existing `pnpm-workspace.yaml`
* @returns {string}
*/
function mergePnpmSecuritySettingsIntoYaml(yamlText) {
return mergeSettingsIntoYaml(yamlText, getPnpmSecuritySettings())
}
/** /**
* @param {string} yamlText text of an existing `.yarnrc.yml` * @param {string} yamlText text of an existing `.yarnrc.yml`
* @returns {string} * @returns {string}
...@@ -96,6 +88,6 @@ module.exports = { ...@@ -96,6 +88,6 @@ module.exports = {
SECURITY_SETTING_KEYS, SECURITY_SETTING_KEYS,
getPnpmSecuritySettings, getPnpmSecuritySettings,
getYarnSecuritySettings, getYarnSecuritySettings,
mergePnpmSecuritySettingsIntoYaml, mergeSettingsIntoYaml,
mergeYarnSecuritySettingsIntoYaml, mergeYarnSecuritySettingsIntoYaml,
} }
# TypeScript 7 is intentionally tested immediately after release.
minimum-release-age=0
...@@ -48,15 +48,14 @@ const pagesFiles: File[] = [ ...@@ -48,15 +48,14 @@ const pagesFiles: File[] = [
describe('build-spinners', () => { describe('build-spinners', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
skipStart: true, skipStart: true,
files: {}, files: {
'pnpm-workspace.yaml': `allowBuilds:
node-pty: true
`,
},
dependencies: { dependencies: {
'node-pty': '0.10.1', 'node-pty': '0.10.1',
}, },
packageJson: {
pnpm: {
onlyBuiltDependencies: ['node-pty'],
},
},
}) })
beforeEach(async () => { beforeEach(async () => {
......
# put modules outside of the app folder, to simulate what happens in a pnpm workspace # put modules outside of the app folder, to simulate what happens in a pnpm workspace
virtual-store-dir=../pnpm virtualStoreDir: ../pnpm
\ No newline at end of file
...@@ -61,7 +61,9 @@ describe('pnpm support', () => { ...@@ -61,7 +61,9 @@ describe('pnpm support', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: { files: {
pages: new FileRef(path.join(__dirname, 'app-multi-page/pages')), pages: new FileRef(path.join(__dirname, 'app-multi-page/pages')),
'.npmrc': new FileRef(path.join(__dirname, 'app-multi-page/.npmrc')), 'pnpm-workspace.yaml': new FileRef(
path.join(__dirname, 'app-multi-page/pnpm-workspace.yaml')
),
'next.config.js': new FileRef( 'next.config.js': new FileRef(
path.join(__dirname, 'app-multi-page/next.config.js') path.join(__dirname, 'app-multi-page/next.config.js')
), ),
......
...@@ -51,7 +51,7 @@ module.exports = function bindings(name) { ...@@ -51,7 +51,7 @@ module.exports = function bindings(name) {
throw new Error( throw new Error(
`bindings: ${binary} does not exist. The fixture addon is compiled by ` + `bindings: ${binary} does not exist. The fixture addon is compiled by ` +
`node-gyp during install, which requires the package to be listed in ` + `node-gyp during install, which requires the package to be listed in ` +
`the test's pnpm.onlyBuiltDependencies.` `\`allowBuilds\` in the test's pnpm-workspace.yaml.`
) )
} }
......
# `single-context-addon` is compiled by node-gyp during install, and pnpm does # `single-context-addon` is compiled by node-gyp during install, and pnpm does
# not run a dependency's build scripts unless they are approved here. The repo # not run a dependency's build scripts unless they are approved here. Local
# root uses the same key for the one package it allows to build. # file dependencies require an approval for their full dependency path.
allowBuilds: allowBuilds:
single-context-addon: true single-context-addon@file:single-context-addon: true
...@@ -56,6 +56,9 @@ describe('deployment lifecycle', () => { ...@@ -56,6 +56,9 @@ describe('deployment lifecycle', () => {
jest jest
.spyOn(NextDeployInstance.prototype as any, 'writeMirrorNpmrcIfNecessary') .spyOn(NextDeployInstance.prototype as any, 'writeMirrorNpmrcIfNecessary')
.mockResolvedValue(undefined) .mockResolvedValue(undefined)
jest
.spyOn(NextDeployInstance.prototype as any, 'preparePnpmSettings')
.mockReturnValue(undefined)
jest jest
.spyOn(NextDeployInstance.prototype as any, 'configureProxyAddress') .spyOn(NextDeployInstance.prototype as any, 'configureProxyAddress')
.mockResolvedValue(undefined) .mockResolvedValue(undefined)
......
...@@ -28,5 +28,5 @@ ...@@ -28,5 +28,5 @@
"buffer": "^5.5.0||^6.0.0", "buffer": "^5.5.0||^6.0.0",
"process": "0.11.10" "process": "0.11.10"
}, },
"packageManager": "pnpm@10.33.0" "packageManager": "pnpm@12.9.1"
} }
---
lockfileVersion: '9.0'
importers:
.:
configDependencies: {}
packageManagerDependencies:
pnpm:
specifier: 12.9.1
version: 12.9.1
packages:
'@pnpm/exe.android-arm64@12.9.1':
resolution: {integrity: sha512-Hgm1XdqMTfBC8PdGLL+NjZWv4xyi7D6XNrN9fb24XGYlyTBmUtdCefKnCLmHujShRD8BEO1zqM30SNcKBDLysw==}
cpu: [arm64]
os: [android]
'@pnpm/exe.android-x64@12.9.1':
resolution: {integrity: sha512-WDGCe6jZRVZP3RC/q6hOkZylkPkIQIi1/GcrR/d/YzbihhAHXCczrk+UYnV5TgbsEnAYO7Cx+2rX3nfhHvy24w==}
cpu: [x64]
os: [android]
'@pnpm/exe.darwin-arm64@12.9.1':
resolution: {integrity: sha512-+7iiEEBgYN9szPWUnAuN6eOVMTI6Hrki5bcuC9n9xl9tTnT53Tpxpo45Hml+W4IrAU0d+Tmd0sPnVIbX59PD6w==}
cpu: [arm64]
os: [darwin]
'@pnpm/exe.darwin-x64@12.9.1':
resolution: {integrity: sha512-SK7TxJiR12GbJZGffRFHItkc+Mx+99v6xMMJ9/X//8NwWV1wo17a2bwfGI8qZpl17YwsrmPEFOOqhzE1GIlrtQ==}
cpu: [x64]
os: [darwin]
'@pnpm/exe.freebsd-x64@12.9.1':
resolution: {integrity: sha512-4AjLk6uvTs2iO6wMit2hcxJ2M32xb7OV5SNFk+w6G8/NzcjcMB7ENEpyeXyLiP0kcnp8uaCGUct2NfrLCJ35eQ==}
cpu: [x64]
os: [freebsd]
'@pnpm/exe.linux-arm64-musl@12.9.1':
resolution: {integrity: sha512-dZL2ES1ckDWM9v+EtxoOklZ0WNdtayooi9iLiDUubopudX3zXPNR2mlrxBRgjbDgECOndQen2SmyxL5eZiBuKw==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-arm64@12.9.1':
resolution: {integrity: sha512-cx+uF6xqwEtm7B8NV+1ve0xBg9gcuzQZ5R+0WgOWvKG/h978UljS6BgWs1ipIGuGgUdeVhm3PKmBltXIcczLXA==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-ppc64@12.9.1':
resolution: {integrity: sha512-MpjPsy4XR17zAtLziQZfsN+wveWa/bUJggZtwfo3+SuyRmXnSvVkFD4+v8/3RTWyYaM6mwLUTjZDJ+g3urL+ew==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-riscv64@12.9.1':
resolution: {integrity: sha512-Oo67TKqqH+Bno+L6X7Xyorwp1QG82zKIkL0vbo1x2kcPTDiyPbdM+d6lIs4+hzeB1KHT5FDoGzZj2dad7Ft+eg==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-s390x@12.9.1':
resolution: {integrity: sha512-QAD5FRCdW36HfD58BV7DoDm6z8yv+GgSqcUV1+ERwYjpVQuG6ZTpf5o0x3KDas8eTLIW7MLYVdDdlAurWeArEg==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-x64-musl@12.9.1':
resolution: {integrity: sha512-mQDhBsGqcTkrLQM4q5igmRFcr6EAl4UM/FGawY+0CWGcqPpUmYUvDy9LHy80xxkHIWVJ886gvvso2XOjfav1Jw==}
cpu: [x64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-x64@12.9.1':
resolution: {integrity: sha512-+M5N74hM4fc87AAckxx/UIW+dUnWf2eko+HchJs/NZUxehLhekNyMI/GNaNXlvd+kWR+97XXBD51XRkkNiUtrA==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@pnpm/exe.win32-arm64@12.9.1':
resolution: {integrity: sha512-mI28C2wxobrDi6x1OYhBRyG10hnDq/4sEIyy5RzoX6LB4kLuv6K/d25HOpMwlW20cuM4M72k9NZpOdcmUxMbEA==}
cpu: [arm64]
os: [win32]
'@pnpm/exe.win32-x64@12.9.1':
resolution: {integrity: sha512-SWoDMT0oD7NrDSIoPpkKD09D9fAQKNjwFZ3lezlCUhAfXxMv70zsfrNT2/P+GoCK2kefXF9OysUZkH1l5vvvfA==}
cpu: [x64]
os: [win32]
pnpm@12.9.1:
resolution: {integrity: sha512-BrBV//XNINwSeB3hc87TMQzglRvy7GICEaFgRdVETVyTpmMhB2TvKaZTphBFm6A2jw50+E2AxUcjz5Wq57wNbQ==}
engines: {node: '>=18.*'}
hasBin: true
snapshots:
'@pnpm/exe.android-arm64@12.9.1':
optional: true
'@pnpm/exe.android-x64@12.9.1':
optional: true
'@pnpm/exe.darwin-arm64@12.9.1':
optional: true
'@pnpm/exe.darwin-x64@12.9.1':
optional: true
'@pnpm/exe.freebsd-x64@12.9.1':
optional: true
'@pnpm/exe.linux-arm64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-arm64@12.9.1':
optional: true
'@pnpm/exe.linux-ppc64@12.9.1':
optional: true
'@pnpm/exe.linux-riscv64@12.9.1':
optional: true
'@pnpm/exe.linux-s390x@12.9.1':
optional: true
'@pnpm/exe.linux-x64-musl@12.9.1':
optional: true
'@pnpm/exe.linux-x64@12.9.1':
optional: true
'@pnpm/exe.win32-arm64@12.9.1':
optional: true
'@pnpm/exe.win32-x64@12.9.1':
optional: true
pnpm@12.9.1:
optionalDependencies:
'@pnpm/exe.android-arm64': 12.9.1
'@pnpm/exe.android-x64': 12.9.1
'@pnpm/exe.darwin-arm64': 12.9.1
'@pnpm/exe.darwin-x64': 12.9.1
'@pnpm/exe.freebsd-x64': 12.9.1
'@pnpm/exe.linux-arm64': 12.9.1
'@pnpm/exe.linux-arm64-musl': 12.9.1
'@pnpm/exe.linux-ppc64': 12.9.1
'@pnpm/exe.linux-riscv64': 12.9.1
'@pnpm/exe.linux-s390x': 12.9.1
'@pnpm/exe.linux-x64': 12.9.1
'@pnpm/exe.linux-x64-musl': 12.9.1
'@pnpm/exe.win32-arm64': 12.9.1
'@pnpm/exe.win32-x64': 12.9.1
---
lockfileVersion: '9.0' lockfileVersion: '9.0'
settings: settings:
......
...@@ -22,6 +22,8 @@ allowBuilds: ...@@ -22,6 +22,8 @@ allowBuilds:
es5-ext: true es5-ext: true
esbuild: true esbuild: true
ffmpeg-static: true ffmpeg-static: true
# macOS-only optional dependency; builds from source with node-gyp
fsevents: false
leveldown: true leveldown: true
microtime: true microtime: true
msgpackr-extract: true msgpackr-extract: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment