Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "16.2.0-canary.45"
"version": "16.2.0-canary.46"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"description": "ESLint configuration used by Next.js.",
"license": "MIT",
"repository": {
Expand All @@ -12,7 +12,7 @@
"dist"
],
"dependencies": {
"@next/eslint-plugin-next": "16.2.0-canary.45",
"@next/eslint-plugin-next": "16.2.0-canary.46",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.32.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-internal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/eslint-plugin-internal",
"private": true,
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"description": "ESLint plugin for working on Next.js.",
"exports": {
".": "./src/eslint-plugin-internal.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/font",
"private": true,
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
32 changes: 32 additions & 0 deletions packages/next-codemod/lib/__tests__/agents-md-e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const fs = require('fs')
const path = require('path')
const os = require('os')
const { runAgentsMd } = require('../../bin/agents-md')
const { getNextjsVersion } = require('../../lib/agents-md')

/**
* TRUE E2E TESTS
Expand Down Expand Up @@ -291,4 +292,35 @@ This is my project documentation.
process.chdir(originalCwd)
}
}, 30000) // Increase timeout for git clone

describe('getNextjsVersion', () => {
const fixturesDir = path.join(__dirname, 'fixtures/agents-md')

it('returns the installed Next.js version from node_modules', () => {
const fixture = path.join(fixturesDir, 'next-specific-version')
const result = getNextjsVersion(fixture)

expect(result.version).toBe('15.4.0')
expect(result.error).toBeUndefined()
})

it('returns actual installed version, not the tag from package.json', () => {
// package.json has "next": "latest", but node_modules has version "16.0.0"
const fixture = path.join(fixturesDir, 'next-tag')
const result = getNextjsVersion(fixture)

// Should return the actual installed version, not "latest"
expect(result.version).toBe('16.0.0')
expect(result.error).toBeUndefined()
})

it('returns error when Next.js is not installed', () => {
// Use a directory where next is not installed
const nonNextDir = '/tmp'
const result = getNextjsVersion(nonNextDir)

expect(result.version).toBeNull()
expect(result.error).toBe('Next.js is not installed in this project.')
})
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Allow node_modules in test fixtures
!node_modules/

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "next-specific-version",
"dependencies": {
"next": "15.4.0"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "next-tag",
"dependencies": {
"next": "latest"
}
}
45 changes: 11 additions & 34 deletions packages/next-codemod/lib/agents-md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,11 @@ interface NextjsVersionResult {
}

export function getNextjsVersion(cwd: string): NextjsVersionResult {
const packageJsonPath = path.join(cwd, 'package.json')

if (!fs.existsSync(packageJsonPath)) {
return {
version: null,
error: 'No package.json found in the current directory',
}
}

try {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))
const dependencies = packageJson.dependencies || {}
const devDependencies = packageJson.devDependencies || {}

const nextVersion = dependencies.next || devDependencies.next

if (nextVersion) {
const cleanVersion = nextVersion.replace(/^[\^~>=<]+/, '')
return { version: cleanVersion }
}

const nextPkgPath = require.resolve('next/package.json', { paths: [cwd] })
const pkg = JSON.parse(fs.readFileSync(nextPkgPath, 'utf-8'))
return { version: pkg.version }
} catch {
// Not found at root - check for monorepo workspace
const workspace = detectWorkspace(cwd)
if (workspace.isMonorepo && workspace.packages.length > 0) {
Expand All @@ -56,11 +40,6 @@ export function getNextjsVersion(cwd: string): NextjsVersionResult {
version: null,
error: 'Next.js is not installed in this project.',
}
} catch (err) {
return {
version: null,
error: `Failed to parse package.json: ${err instanceof Error ? err.message : String(err)}`,
}
}
}

Expand Down Expand Up @@ -525,18 +504,16 @@ function findNextjsInWorkspace(cwd: string, patterns: string[]): string | null {
const versions: string[] = []

for (const pkgPath of packagePaths) {
const packageJsonPath = path.join(pkgPath, 'package.json')
if (!fs.existsSync(packageJsonPath)) continue

try {
const content = fs.readFileSync(packageJsonPath, 'utf-8')
const pkg = JSON.parse(content)
const nextVersion = pkg.dependencies?.next || pkg.devDependencies?.next
if (nextVersion) {
versions.push(nextVersion.replace(/^[\^~>=<]+/, ''))
const nextPkgPath = require.resolve('next/package.json', {
paths: [pkgPath],
})
const pkg = JSON.parse(fs.readFileSync(nextPkgPath, 'utf-8'))
if (pkg.version) {
versions.push(pkg.version)
}
} catch {
// Skip invalid package.json
// Next.js not installed in this package
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-routing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/routing",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-rspack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-rspack",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-rspack"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"private": true,
"files": [
"native/"
Expand Down
3 changes: 2 additions & 1 deletion packages/next/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -1050,5 +1050,6 @@
"1049": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\nTo use Next.js on this platform, use Webpack instead:\\n next dev --webpack\\n\\nFor more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms",
"1050": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\nTo build on this platform, use Webpack instead:\\n next build --webpack\\n\\nFor more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms",
"1051": "Turbopack trace server is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.",
"1052": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings. Use the --webpack flag instead."
"1052": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings. Use the --webpack flag instead.",
"1053": "Export encountered errors on %s %s:\\n\\t%s"
}
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -97,7 +97,7 @@
]
},
"dependencies": {
"@next/env": "16.2.0-canary.45",
"@next/env": "16.2.0-canary.46",
"@swc/helpers": "0.5.15",
"baseline-browser-mapping": "^2.9.19",
"caniuse-lite": "^1.0.30001579",
Expand Down Expand Up @@ -162,11 +162,11 @@
"@modelcontextprotocol/sdk": "1.18.1",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/font": "16.2.0-canary.45",
"@next/polyfill-module": "16.2.0-canary.45",
"@next/polyfill-nomodule": "16.2.0-canary.45",
"@next/react-refresh-utils": "16.2.0-canary.45",
"@next/swc": "16.2.0-canary.45",
"@next/font": "16.2.0-canary.46",
"@next/polyfill-module": "16.2.0-canary.46",
"@next/polyfill-nomodule": "16.2.0-canary.46",
"@next/react-refresh-utils": "16.2.0-canary.46",
"@next/swc": "16.2.0-canary.46",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.51.1",
"@rspack/core": "1.6.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ async function exportAppImpl(
if (failedExportAttemptsByPage.size > 0) {
const failedPages = Array.from(failedExportAttemptsByPage.keys())
throw new ExportError(
`Export encountered errors on following paths:\n\t${failedPages
`Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\n\t${failedPages
.sort()
.join('\n\t')}`
)
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/third-parties/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/third-parties",
"version": "16.2.0-canary.45",
"version": "16.2.0-canary.46",
"repository": {
"url": "vercel/next.js",
"directory": "packages/third-parties"
Expand All @@ -26,7 +26,7 @@
"third-party-capital": "1.0.20"
},
"devDependencies": {
"next": "16.2.0-canary.45",
"next": "16.2.0-canary.46",
"outdent": "0.8.0",
"prettier": "2.5.1",
"typescript": "5.9.2"
Expand Down
Loading
Loading