next 15.5.21 → 15.5.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack-config.js +2 -2
  5. package/dist/client/app-bootstrap.js +1 -1
  6. package/dist/client/index.js +1 -1
  7. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
  8. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
  9. package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
  10. package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
  11. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  12. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  13. package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
  14. package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
  15. package/dist/esm/build/index.js +2 -2
  16. package/dist/esm/build/swc/index.js +1 -1
  17. package/dist/esm/build/webpack-config.js +2 -2
  18. package/dist/esm/client/app-bootstrap.js +1 -1
  19. package/dist/esm/client/index.js +1 -1
  20. package/dist/esm/lib/has-necessary-dependencies.js +2 -0
  21. package/dist/esm/lib/has-necessary-dependencies.js.map +1 -1
  22. package/dist/esm/lib/verify-typescript-setup.js +19 -0
  23. package/dist/esm/lib/verify-typescript-setup.js.map +1 -1
  24. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  25. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  26. package/dist/esm/server/lib/app-info-log.js +1 -1
  27. package/dist/esm/server/lib/start-server.js +1 -1
  28. package/dist/esm/shared/lib/canary-only.js +1 -1
  29. package/dist/lib/has-necessary-dependencies.js +2 -0
  30. package/dist/lib/has-necessary-dependencies.js.map +1 -1
  31. package/dist/lib/verify-typescript-setup.js +19 -0
  32. package/dist/lib/verify-typescript-setup.js.map +1 -1
  33. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  34. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  35. package/dist/server/lib/app-info-log.js +1 -1
  36. package/dist/server/lib/start-server.js +1 -1
  37. package/dist/shared/lib/canary-only.js +1 -1
  38. package/dist/telemetry/anonymous-meta.js +1 -1
  39. package/dist/telemetry/events/session-stopped.js +2 -2
  40. package/dist/telemetry/events/version.js +2 -2
  41. package/package.json +10 -10
@@ -299,7 +299,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
299
299
  const nextBuildSpan = trace('next-build', undefined, {
300
300
  buildMode: experimentalBuildMode,
301
301
  isTurboBuild: String(isTurbopack),
302
- version: "15.5.21"
302
+ version: "15.5.22"
303
303
  });
304
304
  NextBuildContext.nextBuildSpan = nextBuildSpan;
305
305
  NextBuildContext.dir = dir;
@@ -754,7 +754,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
754
754
  // Files outside of the distDir can be "type": "module"
755
755
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
756
756
  // These are written to distDir, so they need to come after creating and cleaning distDr.
757
- await recordFrameworkVersion("15.5.21");
757
+ await recordFrameworkVersion("15.5.22");
758
758
  await updateBuildDiagnostics({
759
759
  buildStage: 'start'
760
760
  });
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
11
11
  import { getDefineEnv } from '../define-env';
12
12
  import { getReactCompilerLoader } from '../get-babel-loader-config';
13
13
  import { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error';
14
- const nextVersion = "15.5.21";
14
+ const nextVersion = "15.5.22";
15
15
  const ArchName = arch();
16
16
  const PlatformName = platform();
17
17
  function infoLog(...args) {
@@ -1608,7 +1608,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1608
1608
  isClient && new CopyFilePlugin({
1609
1609
  // file path to build output of `@next/polyfill-nomodule`
1610
1610
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1611
- cacheKey: "15.5.21",
1611
+ cacheKey: "15.5.22",
1612
1612
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1613
1613
  minimize: false,
1614
1614
  info: {
@@ -1786,7 +1786,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1786
1786
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1787
1787
  // - Next.js version
1788
1788
  // - next.config.js keys that affect compilation
1789
- version: `${__dirname}|${"15.5.21"}|${configVars}`,
1789
+ version: `${__dirname}|${"15.5.22"}|${configVars}`,
1790
1790
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1791
1791
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1792
1792
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -4,7 +4,7 @@
4
4
  * - Polyfills
5
5
  * - next/script with `beforeInteractive` strategy
6
6
  */ import { setAttributesFromProps } from './set-attributes-from-props';
7
- const version = "15.5.21";
7
+ const version = "15.5.22";
8
8
  window.next = {
9
9
  version,
10
10
  appDir: true
@@ -26,7 +26,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
26
26
  import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
27
27
  import tracer from './tracing/tracer';
28
28
  import { isNextRouterError } from './components/is-next-router-error';
29
- export const version = "15.5.21";
29
+ export const version = "15.5.22";
30
30
  export let router;
31
31
  export const emitter = mitt();
32
32
  const looseToArray = (input)=>[].slice.call(input);
@@ -8,6 +8,8 @@ export async function hasNecessaryDependencies(baseDir, requiredPackages) {
8
8
  try {
9
9
  const pkgPath = await fs.realpath(resolveFrom(baseDir, `${p.pkg}/package.json`));
10
10
  const pkgDir = dirname(pkgPath);
11
+ // Default to the package.json, if the file we want isn't there we can still read the package.json
12
+ resolutions.set(join(p.pkg, 'package.json'), pkgPath);
11
13
  if (p.exportsRestrict) {
12
14
  const fileNameToVerify = relative(p.pkg, p.file);
13
15
  if (fileNameToVerify) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/has-necessary-dependencies.ts"],"sourcesContent":["import { existsSync, promises as fs } from 'fs'\nimport { resolveFrom } from './resolve-from'\nimport { dirname, join, relative } from 'path'\n\nexport interface MissingDependency {\n file: string\n /**\n * The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve.\n * If `exportsRestrict` is false, `${file}` MUST also resolve.\n */\n pkg: string\n /**\n * If true, the pkg's package.json needs to be resolvable.\n * If true, will resolve `file` relative to the real path of the package.json.\n *\n * For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts`\n * resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`.\n *\n * If false, will resolve `file` relative to the baseDir.\n * ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve `@types/react/index.d.ts` directly.\n */\n exportsRestrict: boolean\n}\n\nexport type NecessaryDependencies = {\n resolved: Map<string, string>\n missing: MissingDependency[]\n}\n\nexport async function hasNecessaryDependencies(\n baseDir: string,\n requiredPackages: MissingDependency[]\n): Promise<NecessaryDependencies> {\n let resolutions = new Map<string, string>()\n const missingPackages: MissingDependency[] = []\n\n await Promise.all(\n requiredPackages.map(async (p) => {\n try {\n const pkgPath = await fs.realpath(\n resolveFrom(baseDir, `${p.pkg}/package.json`)\n )\n const pkgDir = dirname(pkgPath)\n\n if (p.exportsRestrict) {\n const fileNameToVerify = relative(p.pkg, p.file)\n if (fileNameToVerify) {\n const fileToVerify = join(pkgDir, fileNameToVerify)\n if (existsSync(fileToVerify)) {\n resolutions.set(p.pkg, fileToVerify)\n } else {\n return missingPackages.push(p)\n }\n } else {\n resolutions.set(p.pkg, pkgPath)\n }\n } else {\n resolutions.set(p.pkg, resolveFrom(baseDir, p.file))\n }\n } catch (_) {\n return missingPackages.push(p)\n }\n })\n )\n\n return {\n resolved: resolutions,\n missing: missingPackages,\n }\n}\n"],"names":["existsSync","promises","fs","resolveFrom","dirname","join","relative","hasNecessaryDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","p","pkgPath","realpath","pkg","pkgDir","exportsRestrict","fileNameToVerify","file","fileToVerify","set","push","_","resolved","missing"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAC/C,SAASC,WAAW,QAAQ,iBAAgB;AAC5C,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,OAAM;AA6B9C,OAAO,eAAeC,yBACpBC,OAAe,EACfC,gBAAqC;IAErC,IAAIC,cAAc,IAAIC;IACtB,MAAMC,kBAAuC,EAAE;IAE/C,MAAMC,QAAQC,GAAG,CACfL,iBAAiBM,GAAG,CAAC,OAAOC;QAC1B,IAAI;YACF,MAAMC,UAAU,MAAMf,GAAGgB,QAAQ,CAC/Bf,YAAYK,SAAS,GAAGQ,EAAEG,GAAG,CAAC,aAAa,CAAC;YAE9C,MAAMC,SAAShB,QAAQa;YAEvB,IAAID,EAAEK,eAAe,EAAE;gBACrB,MAAMC,mBAAmBhB,SAASU,EAAEG,GAAG,EAAEH,EAAEO,IAAI;gBAC/C,IAAID,kBAAkB;oBACpB,MAAME,eAAenB,KAAKe,QAAQE;oBAClC,IAAItB,WAAWwB,eAAe;wBAC5Bd,YAAYe,GAAG,CAACT,EAAEG,GAAG,EAAEK;oBACzB,OAAO;wBACL,OAAOZ,gBAAgBc,IAAI,CAACV;oBAC9B;gBACF,OAAO;oBACLN,YAAYe,GAAG,CAACT,EAAEG,GAAG,EAAEF;gBACzB;YACF,OAAO;gBACLP,YAAYe,GAAG,CAACT,EAAEG,GAAG,EAAEhB,YAAYK,SAASQ,EAAEO,IAAI;YACpD;QACF,EAAE,OAAOI,GAAG;YACV,OAAOf,gBAAgBc,IAAI,CAACV;QAC9B;IACF;IAGF,OAAO;QACLY,UAAUlB;QACVmB,SAASjB;IACX;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/lib/has-necessary-dependencies.ts"],"sourcesContent":["import { existsSync, promises as fs } from 'fs'\nimport { resolveFrom } from './resolve-from'\nimport { dirname, join, relative } from 'path'\n\nexport interface MissingDependency {\n file: string\n /**\n * The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve.\n * If `exportsRestrict` is false, `${file}` MUST also resolve.\n */\n pkg: string\n /**\n * If true, the pkg's package.json needs to be resolvable.\n * If true, will resolve `file` relative to the real path of the package.json.\n *\n * For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts`\n * resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`.\n *\n * If false, will resolve `file` relative to the baseDir.\n * ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve `@types/react/index.d.ts` directly.\n */\n exportsRestrict: boolean\n}\n\nexport type NecessaryDependencies = {\n resolved: Map<string, string>\n missing: MissingDependency[]\n}\n\nexport async function hasNecessaryDependencies(\n baseDir: string,\n requiredPackages: MissingDependency[]\n): Promise<NecessaryDependencies> {\n let resolutions = new Map<string, string>()\n const missingPackages: MissingDependency[] = []\n\n await Promise.all(\n requiredPackages.map(async (p) => {\n try {\n const pkgPath = await fs.realpath(\n resolveFrom(baseDir, `${p.pkg}/package.json`)\n )\n const pkgDir = dirname(pkgPath)\n\n // Default to the package.json, if the file we want isn't there we can still read the package.json\n resolutions.set(join(p.pkg, 'package.json'), pkgPath)\n\n if (p.exportsRestrict) {\n const fileNameToVerify = relative(p.pkg, p.file)\n if (fileNameToVerify) {\n const fileToVerify = join(pkgDir, fileNameToVerify)\n if (existsSync(fileToVerify)) {\n resolutions.set(p.pkg, fileToVerify)\n } else {\n return missingPackages.push(p)\n }\n } else {\n resolutions.set(p.pkg, pkgPath)\n }\n } else {\n resolutions.set(p.pkg, resolveFrom(baseDir, p.file))\n }\n } catch (_) {\n return missingPackages.push(p)\n }\n })\n )\n\n return {\n resolved: resolutions,\n missing: missingPackages,\n }\n}\n"],"names":["existsSync","promises","fs","resolveFrom","dirname","join","relative","hasNecessaryDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","p","pkgPath","realpath","pkg","pkgDir","set","exportsRestrict","fileNameToVerify","file","fileToVerify","push","_","resolved","missing"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAC/C,SAASC,WAAW,QAAQ,iBAAgB;AAC5C,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,OAAM;AA6B9C,OAAO,eAAeC,yBACpBC,OAAe,EACfC,gBAAqC;IAErC,IAAIC,cAAc,IAAIC;IACtB,MAAMC,kBAAuC,EAAE;IAE/C,MAAMC,QAAQC,GAAG,CACfL,iBAAiBM,GAAG,CAAC,OAAOC;QAC1B,IAAI;YACF,MAAMC,UAAU,MAAMf,GAAGgB,QAAQ,CAC/Bf,YAAYK,SAAS,GAAGQ,EAAEG,GAAG,CAAC,aAAa,CAAC;YAE9C,MAAMC,SAAShB,QAAQa;YAEvB,kGAAkG;YAClGP,YAAYW,GAAG,CAAChB,KAAKW,EAAEG,GAAG,EAAE,iBAAiBF;YAE7C,IAAID,EAAEM,eAAe,EAAE;gBACrB,MAAMC,mBAAmBjB,SAASU,EAAEG,GAAG,EAAEH,EAAEQ,IAAI;gBAC/C,IAAID,kBAAkB;oBACpB,MAAME,eAAepB,KAAKe,QAAQG;oBAClC,IAAIvB,WAAWyB,eAAe;wBAC5Bf,YAAYW,GAAG,CAACL,EAAEG,GAAG,EAAEM;oBACzB,OAAO;wBACL,OAAOb,gBAAgBc,IAAI,CAACV;oBAC9B;gBACF,OAAO;oBACLN,YAAYW,GAAG,CAACL,EAAEG,GAAG,EAAEF;gBACzB;YACF,OAAO;gBACLP,YAAYW,GAAG,CAACL,EAAEG,GAAG,EAAEhB,YAAYK,SAASQ,EAAEQ,IAAI;YACpD;QACF,EAAE,OAAOG,GAAG;YACV,OAAOf,gBAAgBc,IAAI,CAACV;QAC9B;IACF;IAGF,OAAO;QACLY,UAAUlB;QACVmB,SAASjB;IACX;AACF","ignoreList":[0]}
@@ -41,6 +41,25 @@ export async function verifyTypeScriptSetup({ dir, distDir, cacheDir, intentDirs
41
41
  }
42
42
  // Ensure TypeScript and necessary `@types/*` are installed:
43
43
  let deps = await hasNecessaryDependencies(dir, requiredPackages);
44
+ // TypeScript 7's native compiler no longer ships the JavaScript compiler API
45
+ // (`typescript/lib/typescript.js`) that Next.js loads via `require('typescript')`.
46
+ // This causes surprising errors so proactively reject it.
47
+ const installedTypescriptPackageJsonPath = deps.resolved.get(path.join('typescript', 'package.json'));
48
+ if (installedTypescriptPackageJsonPath) {
49
+ const installedTypescriptVersion = require(installedTypescriptPackageJsonPath).version;
50
+ if (installedTypescriptVersion && // Use the lowest prerelease sentinel `7.0.0-0` so that TypeScript 7
51
+ // prereleases (e.g. `7.0.0-beta`, `7.0.0-rc`, or nightly `7.0.0-dev.*`
52
+ // builds published to the `next` dist-tag) are also rejected.
53
+ semver.gte(installedTypescriptVersion, '7.0.0-0', {
54
+ includePrerelease: true
55
+ })) {
56
+ throw Object.defineProperty(new CompileError(`TypeScript ${installedTypescriptVersion} is not supported by this version of Next.js. ` + `The TypeScript 7 native compiler does not provide the JavaScript compiler API that Next.js requires. ` + `Install TypeScript 6 (e.g. ${bold('npm install --save-dev typescript@^6')}) or upgrade to a Next.js v16.2.11 or later to get support for TypeScript 7.`), "__NEXT_ERROR_CODE", {
57
+ value: "E798",
58
+ enumerable: false,
59
+ configurable: true
60
+ });
61
+ }
62
+ }
44
63
  if (((_deps_missing = deps.missing) == null ? void 0 : _deps_missing.length) > 0) {
45
64
  const missingPackages = deps.missing.map((pkg)=>({
46
65
  ...pkg,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { getTypeScriptPackageSpec } from './typescript/required-packages'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n cacheDir,\n intentDirs,\n tsconfigPath,\n typeCheckPreflight,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n tsconfigPath: string\n intentDirs: string[]\n typeCheckPreflight: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const resolvedTsConfigPath = path.join(dir, tsconfigPath)\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsconfigPath)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = await hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n if (deps.missing?.length > 0) {\n const missingPackages = deps.missing.map((pkg) => ({\n ...pkg,\n pkg: getTypeScriptPackageSpec(pkg.pkg),\n }))\n\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, missingPackages)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, missingPackages, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = await hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPath = deps.resolved.get('typescript')!\n const ts = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n if (semver.lt(ts.version, '4.5.2')) {\n log.warn(\n `Minimum recommended TypeScript version is v4.5.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n ts,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n ts,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir\n )\n }\n return { result, version: ts.version }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.IS_NEXT_WORKER) {\n if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n process.exit(1)\n }\n // we are in the main thread, throw the error and it will be handled by the caller\n throw err\n }\n}\n"],"names":["bold","cyan","red","yellow","path","hasNecessaryDependencies","semver","CompileError","log","getTypeScriptIntent","getTypeScriptPackageSpec","writeAppTypeDeclarations","writeConfigurationDefaults","installDependencies","isCI","missingDepsError","requiredPackages","file","pkg","exportsRestrict","verifyTypeScriptSetup","dir","distDir","cacheDir","intentDirs","tsconfigPath","typeCheckPreflight","disableStaticImages","hasAppDir","hasPagesDir","resolvedTsConfigPath","join","deps","intent","version","missing","length","missingPackages","map","console","catch","err","error","command","tsPath","resolved","get","ts","Promise","resolve","require","lt","warn","firstTimeSetup","baseDir","imageImportsEnabled","result","runTypeCheck","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,QAAQ,eAAc;AACtD,OAAOC,UAAU,OAAM;AAEvB,SAASC,wBAAwB,QAAQ,+BAA8B;AAEvE,OAAOC,YAAY,4BAA2B;AAC9C,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,YAAYC,SAAS,sBAAqB;AAE1C,SAASC,mBAAmB,QAAQ,mCAAkC;AAEtE,SAASC,wBAAwB,QAAQ,iCAAgC;AACzE,SAASC,wBAAwB,QAAQ,wCAAuC;AAChF,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,SAASC,IAAI,QAAQ,oBAAmB;AACxC,SAASC,gBAAgB,QAAQ,sCAAqC;AAEtE,MAAMC,mBAA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OAAO,MAAM3B,yBAAyBgB,KAAKL;QAC7C;QAEA,8CAA8C;QAC9C,MAAM4B,SAASZ,KAAKa,QAAQ,CAACC,GAAG,CAAC;QACjC,MAAMC,KAAM,MAAMC,QAAQC,OAAO,CAC/BC,QAAQN;QAGV,IAAItC,OAAO6C,EAAE,CAACJ,GAAGb,OAAO,EAAE,UAAU;YAClC1B,IAAI4C,IAAI,CACN,CAAC,yHAAyH,EAAEL,GAAGb,OAAO,EAAE;QAE5I;QAEA,+DAA+D;QAC/D,MAAMtB,2BACJmC,IACAjB,sBACAG,OAAOoB,cAAc,EACrBzB,WACAN,SACAO;QAEF,qEAAqE;QACrE,kBAAkB;QAClB,MAAMlB,yBAAyB;YAC7B2C,SAASjC;YACTC;YACAiC,qBAAqB,CAAC5B;YACtBE;YACAD;QACF;QAEA,IAAI4B;QACJ,IAAI9B,oBAAoB;YACtB,MAAM,EAAE+B,YAAY,EAAE,GACpBP,QAAQ;YAEV,yEAAyE;YACzEM,SAAS,MAAMC,aACbV,IACA1B,KACAC,SACAQ,sBACAP,UACAK;QAEJ;QACA,OAAO;YAAE4B;YAAQtB,SAASa,GAAGb,OAAO;QAAC;IACvC,EAAE,OAAOO,KAAK;QACZ,+DAA+D;QAC/D,IAAIA,eAAelC,cAAc;YAC/BgC,QAAQG,KAAK,CAACxC,IAAI;YAClBqC,QAAQG,KAAK,CAACD,IAAIiB,OAAO;YACzBC,QAAQC,IAAI,CAAC;QACf;QAEA;;;;KAIC,GAED,mEAAmE;QACnE,IAAID,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC9B,IAAIrB,eAAesB,OAAO;gBACxBxB,QAAQG,KAAK,CAACD,IAAIiB,OAAO;YAC3B,OAAO;gBACLnB,QAAQG,KAAK,CAACD;YAChB;YACAkB,QAAQC,IAAI,CAAC;QACf;QACA,kFAAkF;QAClF,MAAMnB;IACR;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { getTypeScriptPackageSpec } from './typescript/required-packages'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n cacheDir,\n intentDirs,\n tsconfigPath,\n typeCheckPreflight,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n tsconfigPath: string\n intentDirs: string[]\n typeCheckPreflight: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const resolvedTsConfigPath = path.join(dir, tsconfigPath)\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsconfigPath)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = await hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n // TypeScript 7's native compiler no longer ships the JavaScript compiler API\n // (`typescript/lib/typescript.js`) that Next.js loads via `require('typescript')`.\n // This causes surprising errors so proactively reject it.\n const installedTypescriptPackageJsonPath = deps.resolved.get(\n path.join('typescript', 'package.json')\n )\n if (installedTypescriptPackageJsonPath) {\n const installedTypescriptVersion = require(\n installedTypescriptPackageJsonPath\n ).version\n if (\n installedTypescriptVersion &&\n // Use the lowest prerelease sentinel `7.0.0-0` so that TypeScript 7\n // prereleases (e.g. `7.0.0-beta`, `7.0.0-rc`, or nightly `7.0.0-dev.*`\n // builds published to the `next` dist-tag) are also rejected.\n semver.gte(installedTypescriptVersion, '7.0.0-0', {\n includePrerelease: true,\n })\n ) {\n throw new CompileError(\n `TypeScript ${installedTypescriptVersion} is not supported by this version of Next.js. ` +\n `The TypeScript 7 native compiler does not provide the JavaScript compiler API that Next.js requires. ` +\n `Install TypeScript 6 (e.g. ${bold('npm install --save-dev typescript@^6')}) or upgrade to a Next.js v16.2.11 or later to get support for TypeScript 7.`\n )\n }\n }\n\n if (deps.missing?.length > 0) {\n const missingPackages = deps.missing.map((pkg) => ({\n ...pkg,\n pkg: getTypeScriptPackageSpec(pkg.pkg),\n }))\n\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, missingPackages)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, missingPackages, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = await hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPath = deps.resolved.get('typescript')!\n const ts = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n if (semver.lt(ts.version, '4.5.2')) {\n log.warn(\n `Minimum recommended TypeScript version is v4.5.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n ts,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n ts,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir\n )\n }\n return { result, version: ts.version }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.IS_NEXT_WORKER) {\n if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n process.exit(1)\n }\n // we are in the main thread, throw the error and it will be handled by the caller\n throw err\n }\n}\n"],"names":["bold","cyan","red","yellow","path","hasNecessaryDependencies","semver","CompileError","log","getTypeScriptIntent","getTypeScriptPackageSpec","writeAppTypeDeclarations","writeConfigurationDefaults","installDependencies","isCI","missingDepsError","requiredPackages","file","pkg","exportsRestrict","verifyTypeScriptSetup","dir","distDir","cacheDir","intentDirs","tsconfigPath","typeCheckPreflight","disableStaticImages","hasAppDir","hasPagesDir","resolvedTsConfigPath","join","deps","intent","version","installedTypescriptPackageJsonPath","resolved","get","installedTypescriptVersion","require","gte","includePrerelease","missing","length","missingPackages","map","console","catch","err","error","command","tsPath","ts","Promise","resolve","lt","warn","firstTimeSetup","baseDir","imageImportsEnabled","result","runTypeCheck","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,QAAQ,eAAc;AACtD,OAAOC,UAAU,OAAM;AAEvB,SAASC,wBAAwB,QAAQ,+BAA8B;AAEvE,OAAOC,YAAY,4BAA2B;AAC9C,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,YAAYC,SAAS,sBAAqB;AAE1C,SAASC,mBAAmB,QAAQ,mCAAkC;AAEtE,SAASC,wBAAwB,QAAQ,iCAAgC;AACzE,SAASC,wBAAwB,QAAQ,wCAAuC;AAChF,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,SAASC,IAAI,QAAQ,oBAAmB;AACxC,SAASC,gBAAgB,QAAQ,sCAAqC;AAEtE,MAAMC,mBAAmB;IACvB;QACEC,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;CACD;AAED,OAAO,eAAeC,sBAAsB,EAC1CC,GAAG,EACHC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB,EACnBC,SAAS,EACTC,WAAW,EAWZ;IACC,MAAMC,uBAAuB1B,KAAK2B,IAAI,CAACV,KAAKI;IAE5C,IAAI;YAwCEO;QAvCJ,wCAAwC;QACxC,MAAMC,SAAS,MAAMxB,oBAAoBY,KAAKG,YAAYC;QAC1D,IAAI,CAACQ,QAAQ;YACX,OAAO;gBAAEC,SAAS;YAAK;QACzB;QAEA,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createHotReloaderTurbopack(opts, serverFields, distDir, re
89
89
  }
90
90
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
91
91
  const hotReloaderSpan = trace('hot-reloader', undefined, {
92
- version: "15.5.21"
92
+ version: "15.5.22"
93
93
  });
94
94
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
95
95
  // of the current `next dev` invocation.
@@ -186,7 +186,7 @@ export default class HotReloaderWebpack {
186
186
  this.previewProps = previewProps;
187
187
  this.rewrites = rewrites;
188
188
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
189
- version: "15.5.21"
189
+ version: "15.5.22"
190
190
  });
191
191
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
192
192
  // of the current `next dev` invocation.
@@ -12,7 +12,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
12
12
  } else {
13
13
  bundlerSuffix = '';
14
14
  }
15
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.5.21"}`))}${bundlerSuffix}`);
15
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.5.22"}`))}${bundlerSuffix}`);
16
16
  if (appUrl) {
17
17
  Log.bootstrap(`- Local: ${appUrl}`);
18
18
  }
@@ -111,7 +111,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
111
111
  export async function startServer(serverOptions) {
112
112
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
113
113
  let { port } = serverOptions;
114
- process.title = `next-server (v${"15.5.21"})`;
114
+ process.title = `next-server (v${"15.5.22"})`;
115
115
  let handlersReady = ()=>{};
116
116
  let handlersError = ()=>{};
117
117
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -1,6 +1,6 @@
1
1
  export function isStableBuild() {
2
2
  var _process_env___NEXT_VERSION;
3
- return !((_process_env___NEXT_VERSION = "15.5.21") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
3
+ return !((_process_env___NEXT_VERSION = "15.5.22") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
4
4
  }
5
5
  export class CanaryOnlyError extends Error {
6
6
  constructor(arg){
@@ -18,6 +18,8 @@ async function hasNecessaryDependencies(baseDir, requiredPackages) {
18
18
  try {
19
19
  const pkgPath = await _fs.promises.realpath((0, _resolvefrom.resolveFrom)(baseDir, `${p.pkg}/package.json`));
20
20
  const pkgDir = (0, _path.dirname)(pkgPath);
21
+ // Default to the package.json, if the file we want isn't there we can still read the package.json
22
+ resolutions.set((0, _path.join)(p.pkg, 'package.json'), pkgPath);
21
23
  if (p.exportsRestrict) {
22
24
  const fileNameToVerify = (0, _path.relative)(p.pkg, p.file);
23
25
  if (fileNameToVerify) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/has-necessary-dependencies.ts"],"sourcesContent":["import { existsSync, promises as fs } from 'fs'\nimport { resolveFrom } from './resolve-from'\nimport { dirname, join, relative } from 'path'\n\nexport interface MissingDependency {\n file: string\n /**\n * The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve.\n * If `exportsRestrict` is false, `${file}` MUST also resolve.\n */\n pkg: string\n /**\n * If true, the pkg's package.json needs to be resolvable.\n * If true, will resolve `file` relative to the real path of the package.json.\n *\n * For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts`\n * resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`.\n *\n * If false, will resolve `file` relative to the baseDir.\n * ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve `@types/react/index.d.ts` directly.\n */\n exportsRestrict: boolean\n}\n\nexport type NecessaryDependencies = {\n resolved: Map<string, string>\n missing: MissingDependency[]\n}\n\nexport async function hasNecessaryDependencies(\n baseDir: string,\n requiredPackages: MissingDependency[]\n): Promise<NecessaryDependencies> {\n let resolutions = new Map<string, string>()\n const missingPackages: MissingDependency[] = []\n\n await Promise.all(\n requiredPackages.map(async (p) => {\n try {\n const pkgPath = await fs.realpath(\n resolveFrom(baseDir, `${p.pkg}/package.json`)\n )\n const pkgDir = dirname(pkgPath)\n\n if (p.exportsRestrict) {\n const fileNameToVerify = relative(p.pkg, p.file)\n if (fileNameToVerify) {\n const fileToVerify = join(pkgDir, fileNameToVerify)\n if (existsSync(fileToVerify)) {\n resolutions.set(p.pkg, fileToVerify)\n } else {\n return missingPackages.push(p)\n }\n } else {\n resolutions.set(p.pkg, pkgPath)\n }\n } else {\n resolutions.set(p.pkg, resolveFrom(baseDir, p.file))\n }\n } catch (_) {\n return missingPackages.push(p)\n }\n })\n )\n\n return {\n resolved: resolutions,\n missing: missingPackages,\n }\n}\n"],"names":["hasNecessaryDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","p","pkgPath","fs","realpath","resolveFrom","pkg","pkgDir","dirname","exportsRestrict","fileNameToVerify","relative","file","fileToVerify","join","existsSync","set","push","_","resolved","missing"],"mappings":";;;;+BA+BsBA;;;eAAAA;;;oBA/BqB;6BACf;sBACY;AA6BjC,eAAeA,yBACpBC,OAAe,EACfC,gBAAqC;IAErC,IAAIC,cAAc,IAAIC;IACtB,MAAMC,kBAAuC,EAAE;IAE/C,MAAMC,QAAQC,GAAG,CACfL,iBAAiBM,GAAG,CAAC,OAAOC;QAC1B,IAAI;YACF,MAAMC,UAAU,MAAMC,YAAE,CAACC,QAAQ,CAC/BC,IAAAA,wBAAW,EAACZ,SAAS,GAAGQ,EAAEK,GAAG,CAAC,aAAa,CAAC;YAE9C,MAAMC,SAASC,IAAAA,aAAO,EAACN;YAEvB,IAAID,EAAEQ,eAAe,EAAE;gBACrB,MAAMC,mBAAmBC,IAAAA,cAAQ,EAACV,EAAEK,GAAG,EAAEL,EAAEW,IAAI;gBAC/C,IAAIF,kBAAkB;oBACpB,MAAMG,eAAeC,IAAAA,UAAI,EAACP,QAAQG;oBAClC,IAAIK,IAAAA,cAAU,EAACF,eAAe;wBAC5BlB,YAAYqB,GAAG,CAACf,EAAEK,GAAG,EAAEO;oBACzB,OAAO;wBACL,OAAOhB,gBAAgBoB,IAAI,CAAChB;oBAC9B;gBACF,OAAO;oBACLN,YAAYqB,GAAG,CAACf,EAAEK,GAAG,EAAEJ;gBACzB;YACF,OAAO;gBACLP,YAAYqB,GAAG,CAACf,EAAEK,GAAG,EAAED,IAAAA,wBAAW,EAACZ,SAASQ,EAAEW,IAAI;YACpD;QACF,EAAE,OAAOM,GAAG;YACV,OAAOrB,gBAAgBoB,IAAI,CAAChB;QAC9B;IACF;IAGF,OAAO;QACLkB,UAAUxB;QACVyB,SAASvB;IACX;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/lib/has-necessary-dependencies.ts"],"sourcesContent":["import { existsSync, promises as fs } from 'fs'\nimport { resolveFrom } from './resolve-from'\nimport { dirname, join, relative } from 'path'\n\nexport interface MissingDependency {\n file: string\n /**\n * The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve.\n * If `exportsRestrict` is false, `${file}` MUST also resolve.\n */\n pkg: string\n /**\n * If true, the pkg's package.json needs to be resolvable.\n * If true, will resolve `file` relative to the real path of the package.json.\n *\n * For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts`\n * resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`.\n *\n * If false, will resolve `file` relative to the baseDir.\n * ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve `@types/react/index.d.ts` directly.\n */\n exportsRestrict: boolean\n}\n\nexport type NecessaryDependencies = {\n resolved: Map<string, string>\n missing: MissingDependency[]\n}\n\nexport async function hasNecessaryDependencies(\n baseDir: string,\n requiredPackages: MissingDependency[]\n): Promise<NecessaryDependencies> {\n let resolutions = new Map<string, string>()\n const missingPackages: MissingDependency[] = []\n\n await Promise.all(\n requiredPackages.map(async (p) => {\n try {\n const pkgPath = await fs.realpath(\n resolveFrom(baseDir, `${p.pkg}/package.json`)\n )\n const pkgDir = dirname(pkgPath)\n\n // Default to the package.json, if the file we want isn't there we can still read the package.json\n resolutions.set(join(p.pkg, 'package.json'), pkgPath)\n\n if (p.exportsRestrict) {\n const fileNameToVerify = relative(p.pkg, p.file)\n if (fileNameToVerify) {\n const fileToVerify = join(pkgDir, fileNameToVerify)\n if (existsSync(fileToVerify)) {\n resolutions.set(p.pkg, fileToVerify)\n } else {\n return missingPackages.push(p)\n }\n } else {\n resolutions.set(p.pkg, pkgPath)\n }\n } else {\n resolutions.set(p.pkg, resolveFrom(baseDir, p.file))\n }\n } catch (_) {\n return missingPackages.push(p)\n }\n })\n )\n\n return {\n resolved: resolutions,\n missing: missingPackages,\n }\n}\n"],"names":["hasNecessaryDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","p","pkgPath","fs","realpath","resolveFrom","pkg","pkgDir","dirname","set","join","exportsRestrict","fileNameToVerify","relative","file","fileToVerify","existsSync","push","_","resolved","missing"],"mappings":";;;;+BA+BsBA;;;eAAAA;;;oBA/BqB;6BACf;sBACY;AA6BjC,eAAeA,yBACpBC,OAAe,EACfC,gBAAqC;IAErC,IAAIC,cAAc,IAAIC;IACtB,MAAMC,kBAAuC,EAAE;IAE/C,MAAMC,QAAQC,GAAG,CACfL,iBAAiBM,GAAG,CAAC,OAAOC;QAC1B,IAAI;YACF,MAAMC,UAAU,MAAMC,YAAE,CAACC,QAAQ,CAC/BC,IAAAA,wBAAW,EAACZ,SAAS,GAAGQ,EAAEK,GAAG,CAAC,aAAa,CAAC;YAE9C,MAAMC,SAASC,IAAAA,aAAO,EAACN;YAEvB,kGAAkG;YAClGP,YAAYc,GAAG,CAACC,IAAAA,UAAI,EAACT,EAAEK,GAAG,EAAE,iBAAiBJ;YAE7C,IAAID,EAAEU,eAAe,EAAE;gBACrB,MAAMC,mBAAmBC,IAAAA,cAAQ,EAACZ,EAAEK,GAAG,EAAEL,EAAEa,IAAI;gBAC/C,IAAIF,kBAAkB;oBACpB,MAAMG,eAAeL,IAAAA,UAAI,EAACH,QAAQK;oBAClC,IAAII,IAAAA,cAAU,EAACD,eAAe;wBAC5BpB,YAAYc,GAAG,CAACR,EAAEK,GAAG,EAAES;oBACzB,OAAO;wBACL,OAAOlB,gBAAgBoB,IAAI,CAAChB;oBAC9B;gBACF,OAAO;oBACLN,YAAYc,GAAG,CAACR,EAAEK,GAAG,EAAEJ;gBACzB;YACF,OAAO;gBACLP,YAAYc,GAAG,CAACR,EAAEK,GAAG,EAAED,IAAAA,wBAAW,EAACZ,SAASQ,EAAEa,IAAI;YACpD;QACF,EAAE,OAAOI,GAAG;YACV,OAAOrB,gBAAgBoB,IAAI,CAAChB;QAC9B;IACF;IAGF,OAAO;QACLkB,UAAUxB;QACVyB,SAASvB;IACX;AACF","ignoreList":[0]}
@@ -97,6 +97,25 @@ async function verifyTypeScriptSetup({ dir, distDir, cacheDir, intentDirs, tscon
97
97
  }
98
98
  // Ensure TypeScript and necessary `@types/*` are installed:
99
99
  let deps = await (0, _hasnecessarydependencies.hasNecessaryDependencies)(dir, requiredPackages);
100
+ // TypeScript 7's native compiler no longer ships the JavaScript compiler API
101
+ // (`typescript/lib/typescript.js`) that Next.js loads via `require('typescript')`.
102
+ // This causes surprising errors so proactively reject it.
103
+ const installedTypescriptPackageJsonPath = deps.resolved.get(_path.default.join('typescript', 'package.json'));
104
+ if (installedTypescriptPackageJsonPath) {
105
+ const installedTypescriptVersion = require(installedTypescriptPackageJsonPath).version;
106
+ if (installedTypescriptVersion && // Use the lowest prerelease sentinel `7.0.0-0` so that TypeScript 7
107
+ // prereleases (e.g. `7.0.0-beta`, `7.0.0-rc`, or nightly `7.0.0-dev.*`
108
+ // builds published to the `next` dist-tag) are also rejected.
109
+ _semver.default.gte(installedTypescriptVersion, '7.0.0-0', {
110
+ includePrerelease: true
111
+ })) {
112
+ throw Object.defineProperty(new _compileerror.CompileError(`TypeScript ${installedTypescriptVersion} is not supported by this version of Next.js. ` + `The TypeScript 7 native compiler does not provide the JavaScript compiler API that Next.js requires. ` + `Install TypeScript 6 (e.g. ${(0, _picocolors.bold)('npm install --save-dev typescript@^6')}) or upgrade to a Next.js v16.2.11 or later to get support for TypeScript 7.`), "__NEXT_ERROR_CODE", {
113
+ value: "E798",
114
+ enumerable: false,
115
+ configurable: true
116
+ });
117
+ }
118
+ }
100
119
  if (((_deps_missing = deps.missing) == null ? void 0 : _deps_missing.length) > 0) {
101
120
  const missingPackages = deps.missing.map((pkg)=>({
102
121
  ...pkg,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { getTypeScriptPackageSpec } from './typescript/required-packages'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n cacheDir,\n intentDirs,\n tsconfigPath,\n typeCheckPreflight,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n tsconfigPath: string\n intentDirs: string[]\n typeCheckPreflight: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const resolvedTsConfigPath = path.join(dir, tsconfigPath)\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsconfigPath)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = await hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n if (deps.missing?.length > 0) {\n const missingPackages = deps.missing.map((pkg) => ({\n ...pkg,\n pkg: getTypeScriptPackageSpec(pkg.pkg),\n }))\n\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, missingPackages)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, missingPackages, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = await hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPath = deps.resolved.get('typescript')!\n const ts = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n if (semver.lt(ts.version, '4.5.2')) {\n log.warn(\n `Minimum recommended TypeScript version is v4.5.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n ts,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n ts,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir\n )\n }\n return { result, version: ts.version }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.IS_NEXT_WORKER) {\n if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n process.exit(1)\n }\n // we are in the main thread, throw the error and it will be handled by the caller\n throw err\n }\n}\n"],"names":["verifyTypeScriptSetup","requiredPackages","file","pkg","exportsRestrict","dir","distDir","cacheDir","intentDirs","tsconfigPath","typeCheckPreflight","disableStaticImages","hasAppDir","hasPagesDir","resolvedTsConfigPath","path","join","deps","intent","getTypeScriptIntent","version","hasNecessaryDependencies","missing","length","missingPackages","map","getTypeScriptPackageSpec","isCI","missingDepsError","console","log","bold","yellow","cyan","installDependencies","catch","err","error","command","tsPath","resolved","get","ts","Promise","resolve","require","semver","lt","warn","writeConfigurationDefaults","firstTimeSetup","writeAppTypeDeclarations","baseDir","imageImportsEnabled","result","runTypeCheck","CompileError","red","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":";;;;+BAoCsBA;;;eAAAA;;;4BApCkB;6DACvB;0CAEwB;+DAEtB;8BACU;6DACR;qCAEe;kCAEK;0CACA;4CACE;qCACP;wBACf;wCACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,MAAMC,mBAAmB;IACvB;QACEC,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;CACD;AAEM,eAAeJ,sBAAsB,EAC1CK,GAAG,EACHC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB,EACnBC,SAAS,EACTC,WAAW,EAWZ;IACC,MAAMC,uBAAuBC,aAAI,CAACC,IAAI,CAACX,KAAKI;IAE5C,IAAI;YAaEQ;QAZJ,wCAAwC;QACxC,MAAMC,SAAS,MAAMC,IAAAA,wCAAmB,EAACd,KAAKG,YAAYC;QAC1D,IAAI,CAACS,QAAQ;YACX,OAAO;gBAAEE,SAAS;YAAK;QACzB;QAEA,4DAA4D;QAC5D,IAAIH,OAA8B,MAAMI,IAAAA,kDAAwB,EAC9DhB,KACAJ;QAGF,IAAIgB,EAAAA,gBAAAA,KAAKK,OAAO,qBAAZL,cAAcM,MAAM,IAAG,GAAG;YAC5B,MAAMC,kBAAkBP,KAAKK,OAAO,CAACG,GAAG,CAAC,CAACtB,MAAS,CAAA;oBACjD,GAAGA,GAAG;oBACNA,KAAKuB,IAAAA,0CAAwB,EAACvB,IAAIA,GAAG;gBACvC,CAAA;YAEA,IAAIwB,YAAI,EAAE;gBACR,4DAA4D;g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,GAAGtB,OAAO;QAAC;IACvC,EAAE,OAAOgB,KAAK;QACZ,+DAA+D;QAC/D,IAAIA,eAAeoB,0BAAY,EAAE;YAC/B3B,QAAQQ,KAAK,CAACoB,IAAAA,eAAG,EAAC;YAClB5B,QAAQQ,KAAK,CAACD,IAAIsB,OAAO;YACzBC,QAAQC,IAAI,CAAC;QACf;QAEA;;;;KAIC,GAED,mEAAmE;QACnE,IAAID,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC9B,IAAI1B,eAAe2B,OAAO;gBACxBlC,QAAQQ,KAAK,CAACD,IAAIsB,OAAO;YAC3B,OAAO;gBACL7B,QAAQQ,KAAK,CAACD;YAChB;YACAuB,QAAQC,IAAI,CAAC;QACf;QACA,kFAAkF;QAClF,MAAMxB;IACR;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { getTypeScriptPackageSpec } from './typescript/required-packages'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n cacheDir,\n intentDirs,\n tsconfigPath,\n typeCheckPreflight,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n tsconfigPath: string\n intentDirs: string[]\n typeCheckPreflight: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const resolvedTsConfigPath = path.join(dir, tsconfigPath)\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsconfigPath)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = await hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n // TypeScript 7's native compiler no longer ships the JavaScript compiler API\n // (`typescript/lib/typescript.js`) that Next.js loads via `require('typescript')`.\n // This causes surprising errors so proactively reject it.\n const installedTypescriptPackageJsonPath = deps.resolved.get(\n path.join('typescript', 'package.json')\n )\n if (installedTypescriptPackageJsonPath) {\n const installedTypescriptVersion = require(\n installedTypescriptPackageJsonPath\n ).version\n if (\n installedTypescriptVersion &&\n // Use the lowest prerelease sentinel `7.0.0-0` so that TypeScript 7\n // prereleases (e.g. `7.0.0-beta`, `7.0.0-rc`, or nightly `7.0.0-dev.*`\n // builds published to the `next` dist-tag) are also rejected.\n semver.gte(installedTypescriptVersion, '7.0.0-0', {\n includePrerelease: true,\n })\n ) {\n throw new CompileError(\n `TypeScript ${installedTypescriptVersion} is not supported by this version of Next.js. ` +\n `The TypeScript 7 native compiler does not provide the JavaScript compiler API that Next.js requires. ` +\n `Install TypeScript 6 (e.g. ${bold('npm install --save-dev typescript@^6')}) or upgrade to a Next.js v16.2.11 or later to get support for TypeScript 7.`\n )\n }\n }\n\n if (deps.missing?.length > 0) {\n const missingPackages = deps.missing.map((pkg) => ({\n ...pkg,\n pkg: getTypeScriptPackageSpec(pkg.pkg),\n }))\n\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, missingPackages)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, missingPackages, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = await hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPath = deps.resolved.get('typescript')!\n const ts = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n if (semver.lt(ts.version, '4.5.2')) {\n log.warn(\n `Minimum recommended TypeScript version is v4.5.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n ts,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n ts,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir\n )\n }\n return { result, version: ts.version }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.IS_NEXT_WORKER) {\n if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n process.exit(1)\n }\n // we are in the main thread, throw the error and it will be handled by the caller\n throw err\n }\n}\n"],"names":["verifyTypeScriptSetup","requiredPackages","file","pkg","exportsRestrict","dir","distDir","cacheDir","intentDirs","tsconfigPath","typeCheckPreflight","disableStaticImages","hasAppDir","hasPagesDir","resolvedTsConfigPath","path","join","deps","intent","getTypeScriptIntent","version","hasNecessaryDependencies","installedTypescriptPackageJsonPath","resolved","get","installedTypescriptVersion","require","semver","gte","includePrerelease","CompileError","bold","missing","length","missingPackages","map","getTypeScriptPackageSpec","isCI","missingDepsError","console","log","yellow","cyan","installDependencies","catch","err","error","command","tsPath","ts","Promise","resolve","lt","warn","writeConfigurationDefaults","firstTimeSetup","writeAppTypeDeclarations","baseDir","imageImportsEnabled","result","runTypeCheck","red","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":";;;;+BAoCsBA;;;eAAAA;;;4BApCkB;6DACvB;0CAEwB;+DAEtB;8BACU;6DACR;qCAEe;kCAEK;0CACA;4CACE;qCACP;wBACf;wCACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,MAAMC,mBAAmB;IACvB;QACEC,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;CACD;AAEM,eAAeJ,sBAAsB,EAC1CK,GAAG,EACHC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB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AK;QACZ,+DAA+D;QAC/D,IAAIA,eAAef,0BAAY,EAAE;YAC/BS,QAAQO,KAAK,CAACe,IAAAA,eAAG,EAAC;YAClBtB,QAAQO,KAAK,CAACD,IAAIiB,OAAO;YACzBC,QAAQC,IAAI,CAAC;QACf;QAEA;;;;KAIC,GAED,mEAAmE;QACnE,IAAID,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC9B,IAAIrB,eAAesB,OAAO;gBACxB5B,QAAQO,KAAK,CAACD,IAAIiB,OAAO;YAC3B,OAAO;gBACLvB,QAAQO,KAAK,CAACD;YAChB;YACAkB,QAAQC,IAAI,CAAC;QACf;QACA,kFAAkF;QAClF,MAAMnB;IACR;AACF","ignoreList":[0]}
@@ -145,7 +145,7 @@ async function createHotReloaderTurbopack(opts, serverFields, distDir, resetFetc
145
145
  }
146
146
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
147
147
  const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
148
- version: "15.5.21"
148
+ version: "15.5.22"
149
149
  });
150
150
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
151
151
  // of the current `next dev` invocation.
@@ -262,7 +262,7 @@ class HotReloaderWebpack {
262
262
  this.previewProps = previewProps;
263
263
  this.rewrites = rewrites;
264
264
  this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
265
- version: "15.5.21"
265
+ version: "15.5.22"
266
266
  });
267
267
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
268
268
  // of the current `next dev` invocation.
@@ -80,7 +80,7 @@ function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, maxEx
80
80
  } else {
81
81
  bundlerSuffix = '';
82
82
  }
83
- _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.5.21"}`))}${bundlerSuffix}`);
83
+ _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.5.22"}`))}${bundlerSuffix}`);
84
84
  if (appUrl) {
85
85
  _log.bootstrap(`- Local: ${appUrl}`);
86
86
  }
@@ -179,7 +179,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
179
179
  async function startServer(serverOptions) {
180
180
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
181
181
  let { port } = serverOptions;
182
- process.title = `next-server (v${"15.5.21"})`;
182
+ process.title = `next-server (v${"15.5.22"})`;
183
183
  let handlersReady = ()=>{};
184
184
  let handlersError = ()=>{};
185
185
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -22,7 +22,7 @@ _export(exports, {
22
22
  });
23
23
  function isStableBuild() {
24
24
  var _process_env___NEXT_VERSION;
25
- return !((_process_env___NEXT_VERSION = "15.5.21") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
25
+ return !((_process_env___NEXT_VERSION = "15.5.22") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
26
26
  }
27
27
  class CanaryOnlyError extends Error {
28
28
  constructor(arg){
@@ -81,7 +81,7 @@ function getAnonymousMeta() {
81
81
  isWsl: _iswsl.default,
82
82
  isCI: _ciinfo.isCI,
83
83
  ciName: _ciinfo.isCI && _ciinfo.name || null,
84
- nextVersion: "15.5.21"
84
+ nextVersion: "15.5.22"
85
85
  };
86
86
  return traits;
87
87
  }
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "eventCliSessionStopped", {
11
11
  const EVENT_VERSION = 'NEXT_CLI_SESSION_STOPPED';
12
12
  function eventCliSessionStopped(event) {
13
13
  // This should be an invariant, if it fails our build tooling is broken.
14
- if (typeof "15.5.21" !== 'string') {
14
+ if (typeof "15.5.22" !== 'string') {
15
15
  return [];
16
16
  }
17
17
  const payload = {
18
- nextVersion: "15.5.21",
18
+ nextVersion: "15.5.22",
19
19
  nodeVersion: process.version,
20
20
  cliCommand: event.cliCommand,
21
21
  durationMilliseconds: event.durationMilliseconds,
@@ -36,12 +36,12 @@ function hasBabelConfig(dir) {
36
36
  function eventCliSession(dir, nextConfig, event) {
37
37
  var _nextConfig_experimental_staleTimes, _nextConfig_experimental_staleTimes1, _nextConfig_experimental_reactCompiler, _nextConfig_experimental_reactCompiler1;
38
38
  // This should be an invariant, if it fails our build tooling is broken.
39
- if (typeof "15.5.21" !== 'string') {
39
+ if (typeof "15.5.22" !== 'string') {
40
40
  return [];
41
41
  }
42
42
  const { images, i18n } = nextConfig || {};
43
43
  const payload = {
44
- nextVersion: "15.5.21",
44
+ nextVersion: "15.5.22",
45
45
  nodeVersion: process.version,
46
46
  cliCommand: event.cliCommand,
47
47
  isSrcDir: event.isSrcDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next",
3
- "version": "15.5.21",
3
+ "version": "15.5.22",
4
4
  "description": "The React Framework",
5
5
  "main": "./dist/server/next.js",
6
6
  "license": "MIT",
@@ -82,7 +82,7 @@
82
82
  "next": "./dist/bin/next"
83
83
  },
84
84
  "dependencies": {
85
- "@next/env": "15.5.21",
85
+ "@next/env": "15.5.22",
86
86
  "@swc/helpers": "0.5.15",
87
87
  "caniuse-lite": "^1.0.30001579",
88
88
  "postcss": "8.4.31",
@@ -112,14 +112,14 @@
112
112
  },
113
113
  "optionalDependencies": {
114
114
  "sharp": "^0.34.3",
115
- "@next/swc-darwin-arm64": "15.5.21",
116
- "@next/swc-darwin-x64": "15.5.21",
117
- "@next/swc-linux-arm64-gnu": "15.5.21",
118
- "@next/swc-linux-arm64-musl": "15.5.21",
119
- "@next/swc-linux-x64-gnu": "15.5.21",
120
- "@next/swc-linux-x64-musl": "15.5.21",
121
- "@next/swc-win32-arm64-msvc": "15.5.21",
122
- "@next/swc-win32-x64-msvc": "15.5.21"
115
+ "@next/swc-darwin-arm64": "15.5.22",
116
+ "@next/swc-darwin-x64": "15.5.22",
117
+ "@next/swc-linux-arm64-gnu": "15.5.22",
118
+ "@next/swc-linux-arm64-musl": "15.5.22",
119
+ "@next/swc-linux-x64-gnu": "15.5.22",
120
+ "@next/swc-linux-x64-musl": "15.5.22",
121
+ "@next/swc-win32-arm64-msvc": "15.5.22",
122
+ "@next/swc-win32-x64-msvc": "15.5.22"
123
123
  },
124
124
  "keywords": [
125
125
  "react",