@openuiai/next 15.6.0-bun.24 → 15.6.0-bun.26

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 (45) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +3 -3
  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.dev.js +1 -1
  8. package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
  9. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
  10. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
  11. package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
  12. package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
  13. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  14. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  15. package/dist/compiled/next-server/server.runtime.prod.js +14 -0
  16. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -0
  17. package/dist/esm/build/index.js +3 -3
  18. package/dist/esm/build/swc/index.js +1 -1
  19. package/dist/esm/build/webpack-config.js +2 -2
  20. package/dist/esm/client/app-bootstrap.js +1 -1
  21. package/dist/esm/client/index.js +1 -1
  22. package/dist/esm/lib/typescript/writeAppTypeDeclarations.js +2 -1
  23. package/dist/esm/lib/typescript/writeAppTypeDeclarations.js.map +1 -1
  24. package/dist/esm/lib/typescript/writeConfigurationDefaults.js +29 -0
  25. package/dist/esm/lib/typescript/writeConfigurationDefaults.js.map +1 -1
  26. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  27. package/dist/esm/server/lib/app-info-log.js +1 -1
  28. package/dist/esm/server/lib/start-server.js +1 -1
  29. package/dist/esm/server/require-hook.js +4 -1
  30. package/dist/esm/server/require-hook.js.map +1 -1
  31. package/dist/esm/shared/lib/canary-only.js +1 -1
  32. package/dist/lib/typescript/writeAppTypeDeclarations.js +2 -1
  33. package/dist/lib/typescript/writeAppTypeDeclarations.js.map +1 -1
  34. package/dist/lib/typescript/writeConfigurationDefaults.js +29 -0
  35. package/dist/lib/typescript/writeConfigurationDefaults.js.map +1 -1
  36. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  37. package/dist/server/lib/app-info-log.js +1 -1
  38. package/dist/server/lib/start-server.js +1 -1
  39. package/dist/server/require-hook.js +4 -1
  40. package/dist/server/require-hook.js.map +1 -1
  41. package/dist/shared/lib/canary-only.js +1 -1
  42. package/dist/telemetry/anonymous-meta.js +1 -1
  43. package/dist/telemetry/events/session-stopped.js +2 -2
  44. package/dist/telemetry/events/version.js +2 -2
  45. package/package.json +1 -1
@@ -301,7 +301,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
301
301
  const nextBuildSpan = trace('next-build', undefined, {
302
302
  buildMode: experimentalBuildMode,
303
303
  isTurboBuild: String(isTurbopack),
304
- version: "15.6.0-bun.23"
304
+ version: "15.6.0-bun.25"
305
305
  });
306
306
  NextBuildContext.nextBuildSpan = nextBuildSpan;
307
307
  NextBuildContext.dir = dir;
@@ -780,7 +780,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
780
780
  // Files outside of the distDir can be "type": "module"
781
781
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
782
782
  // These are written to distDir, so they need to come after creating and cleaning distDr.
783
- await recordFrameworkVersion("15.6.0-bun.23");
783
+ await recordFrameworkVersion("15.6.0-bun.25");
784
784
  await updateBuildDiagnostics({
785
785
  buildStage: 'start'
786
786
  });
@@ -2425,7 +2425,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
2425
2425
  distDir,
2426
2426
  config,
2427
2427
  staticPages,
2428
- nextVersion: "15.6.0-bun.23",
2428
+ nextVersion: "15.6.0-bun.25",
2429
2429
  tracingRoot: outputFileTracingRoot,
2430
2430
  hasNodeMiddleware,
2431
2431
  hasInstrumentationHook,
@@ -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.6.0-bun.23";
14
+ const nextVersion = "15.6.0-bun.25";
15
15
  const ArchName = arch();
16
16
  const PlatformName = platform();
17
17
  function infoLog(...args) {
@@ -1575,7 +1575,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1575
1575
  isClient && new CopyFilePlugin({
1576
1576
  // file path to build output of `@next/polyfill-nomodule`
1577
1577
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1578
- cacheKey: "15.6.0-bun.23",
1578
+ cacheKey: "15.6.0-bun.25",
1579
1579
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1580
1580
  minimize: false,
1581
1581
  info: {
@@ -1756,7 +1756,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1756
1756
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1757
1757
  // - Next.js version
1758
1758
  // - next.config.js keys that affect compilation
1759
- version: `${__dirname}|${"15.6.0-bun.23"}|${configVars}`,
1759
+ version: `${__dirname}|${"15.6.0-bun.25"}|${configVars}`,
1760
1760
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1761
1761
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1762
1762
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -5,7 +5,7 @@
5
5
  * - next/script with `beforeInteractive` strategy
6
6
  */ import { getAssetPrefix } from './asset-prefix';
7
7
  import { setAttributesFromProps } from './set-attributes-from-props';
8
- const version = "15.6.0-bun.23";
8
+ const version = "15.6.0-bun.25";
9
9
  window.next = {
10
10
  version,
11
11
  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.6.0-bun.23";
29
+ export const version = "15.6.0-bun.25";
30
30
  export let router;
31
31
  export const emitter = mitt();
32
32
  const looseToArray = (input)=>[].slice.call(input);
@@ -2,7 +2,8 @@ import os from 'os';
2
2
  import path from 'path';
3
3
  import { promises as fs } from 'fs';
4
4
  // Read package name dynamically to support forked packages
5
- const PKG_NAME = require(path.join(__dirname, '../../package.json')).name;
5
+ // From dist/lib/typescript, go up 3 levels to reach package root
6
+ const PKG_NAME = require(path.join(__dirname, '../../../package.json')).name;
6
7
  export async function writeAppTypeDeclarations({ baseDir, distDir, imageImportsEnabled, hasPagesDir, hasAppDir }) {
7
8
  // Reference `next` types
8
9
  const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/typescript/writeAppTypeDeclarations.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport { promises as fs } from 'fs'\n\n// Read package name dynamically to support forked packages\nconst PKG_NAME = require(path.join(__dirname, '../../package.json')).name\n\nexport async function writeAppTypeDeclarations({\n baseDir,\n distDir,\n imageImportsEnabled,\n hasPagesDir,\n hasAppDir,\n}: {\n baseDir: string\n distDir: string\n imageImportsEnabled: boolean\n hasPagesDir: boolean\n hasAppDir: boolean\n}): Promise<void> {\n // Reference `next` types\n const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts')\n\n // Defaults EOL to system default\n let eol = os.EOL\n let currentContent: string | undefined\n\n try {\n currentContent = await fs.readFile(appTypeDeclarations, 'utf8')\n // If file already exists then preserve its line ending\n const lf = currentContent.indexOf('\\n', /* skip first so we can lf - 1 */ 1)\n\n if (lf !== -1) {\n if (currentContent[lf - 1] === '\\r') {\n eol = '\\r\\n'\n } else {\n eol = '\\n'\n }\n }\n } catch {}\n\n /**\n * \"Triple-slash directives\" used to create typings files for Next.js projects\n * using Typescript .\n *\n * @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html\n */\n const directives: string[] = [\n // Include the core Next.js typings.\n `/// <reference types=\"${PKG_NAME}\" />`,\n ]\n\n if (imageImportsEnabled) {\n directives.push(`/// <reference types=\"${PKG_NAME}/image-types/global\" />`)\n }\n\n if (hasAppDir && hasPagesDir) {\n directives.push(\n `/// <reference types=\"${PKG_NAME}/navigation-types/compat/navigation\" />`\n )\n }\n\n const routeTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/routes.d.ts'\n )\n\n // Use ESM import instead of triple-slash reference for better ESLint compatibility\n directives.push(`import \"./${routeTypesPath}\";`)\n\n // Push the notice in.\n directives.push(\n '',\n '// NOTE: This file should not be edited',\n `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`\n )\n\n const content = directives.join(eol) + eol\n\n // Avoids an un-necessary write on read-only fs\n if (currentContent === content) {\n return\n }\n await fs.writeFile(appTypeDeclarations, content)\n}\n"],"names":["os","path","promises","fs","PKG_NAME","require","join","__dirname","name","writeAppTypeDeclarations","baseDir","distDir","imageImportsEnabled","hasPagesDir","hasAppDir","appTypeDeclarations","eol","EOL","currentContent","readFile","lf","indexOf","directives","push","routeTypesPath","posix","replaceAll","win32","sep","content","writeFile"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,YAAYC,EAAE,QAAQ,KAAI;AAEnC,2DAA2D;AAC3D,MAAMC,WAAWC,QAAQJ,KAAKK,IAAI,CAACC,WAAW,uBAAuBC,IAAI;AAEzE,OAAO,eAAeC,yBAAyB,EAC7CC,OAAO,EACPC,OAAO,EACPC,mBAAmB,EACnBC,WAAW,EACXC,SAAS,EAOV;IACC,yBAAyB;IACzB,MAAMC,sBAAsBd,KAAKK,IAAI,CAACI,SAAS;IAE/C,iCAAiC;IACjC,IAAIM,MAAMhB,GAAGiB,GAAG;IAChB,IAAIC;IAEJ,IAAI;QACFA,iBAAiB,MAAMf,GAAGgB,QAAQ,CAACJ,qBAAqB;QACxD,uDAAuD;QACvD,MAAMK,KAAKF,eAAeG,OAAO,CAAC,MAAM,+BAA+B,GAAG;QAE1E,IAAID,OAAO,CAAC,GAAG;YACb,IAAIF,cAAc,CAACE,KAAK,EAAE,KAAK,MAAM;gBACnCJ,MAAM;YACR,OAAO;gBACLA,MAAM;YACR;QACF;IACF,EAAE,OAAM,CAAC;IAET;;;;;GAKC,GACD,MAAMM,aAAuB;QAC3B,oCAAoC;QACpC,CAAC,sBAAsB,EAAElB,SAAS,IAAI,CAAC;KACxC;IAED,IAAIQ,qBAAqB;QACvBU,WAAWC,IAAI,CAAC,CAAC,sBAAsB,EAAEnB,SAAS,uBAAuB,CAAC;IAC5E;IAEA,IAAIU,aAAaD,aAAa;QAC5BS,WAAWC,IAAI,CACb,CAAC,sBAAsB,EAAEnB,SAAS,uCAAuC,CAAC;IAE9E;IAEA,MAAMoB,iBAAiBvB,KAAKwB,KAAK,CAACnB,IAAI,CACpCK,QAAQe,UAAU,CAACzB,KAAK0B,KAAK,CAACC,GAAG,EAAE3B,KAAKwB,KAAK,CAACG,GAAG,GACjD;IAGF,mFAAmF;IACnFN,WAAWC,IAAI,CAAC,CAAC,UAAU,EAAEC,eAAe,EAAE,CAAC;IAE/C,sBAAsB;IACtBF,WAAWC,IAAI,CACb,IACA,2CACA,CAAC,+BAA+B,EAAET,YAAY,QAAQ,QAAQ,sDAAsD,CAAC;IAGvH,MAAMe,UAAUP,WAAWhB,IAAI,CAACU,OAAOA;IAEvC,+CAA+C;IAC/C,IAAIE,mBAAmBW,SAAS;QAC9B;IACF;IACA,MAAM1B,GAAG2B,SAAS,CAACf,qBAAqBc;AAC1C","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/lib/typescript/writeAppTypeDeclarations.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport { promises as fs } from 'fs'\n\n// Read package name dynamically to support forked packages\n// From dist/lib/typescript, go up 3 levels to reach package root\nconst PKG_NAME = require(path.join(__dirname, '../../../package.json')).name\n\nexport async function writeAppTypeDeclarations({\n baseDir,\n distDir,\n imageImportsEnabled,\n hasPagesDir,\n hasAppDir,\n}: {\n baseDir: string\n distDir: string\n imageImportsEnabled: boolean\n hasPagesDir: boolean\n hasAppDir: boolean\n}): Promise<void> {\n // Reference `next` types\n const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts')\n\n // Defaults EOL to system default\n let eol = os.EOL\n let currentContent: string | undefined\n\n try {\n currentContent = await fs.readFile(appTypeDeclarations, 'utf8')\n // If file already exists then preserve its line ending\n const lf = currentContent.indexOf('\\n', /* skip first so we can lf - 1 */ 1)\n\n if (lf !== -1) {\n if (currentContent[lf - 1] === '\\r') {\n eol = '\\r\\n'\n } else {\n eol = '\\n'\n }\n }\n } catch {}\n\n /**\n * \"Triple-slash directives\" used to create typings files for Next.js projects\n * using Typescript .\n *\n * @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html\n */\n const directives: string[] = [\n // Include the core Next.js typings.\n `/// <reference types=\"${PKG_NAME}\" />`,\n ]\n\n if (imageImportsEnabled) {\n directives.push(`/// <reference types=\"${PKG_NAME}/image-types/global\" />`)\n }\n\n if (hasAppDir && hasPagesDir) {\n directives.push(\n `/// <reference types=\"${PKG_NAME}/navigation-types/compat/navigation\" />`\n )\n }\n\n const routeTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/routes.d.ts'\n )\n\n // Use ESM import instead of triple-slash reference for better ESLint compatibility\n directives.push(`import \"./${routeTypesPath}\";`)\n\n // Push the notice in.\n directives.push(\n '',\n '// NOTE: This file should not be edited',\n `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`\n )\n\n const content = directives.join(eol) + eol\n\n // Avoids an un-necessary write on read-only fs\n if (currentContent === content) {\n return\n }\n await fs.writeFile(appTypeDeclarations, content)\n}\n"],"names":["os","path","promises","fs","PKG_NAME","require","join","__dirname","name","writeAppTypeDeclarations","baseDir","distDir","imageImportsEnabled","hasPagesDir","hasAppDir","appTypeDeclarations","eol","EOL","currentContent","readFile","lf","indexOf","directives","push","routeTypesPath","posix","replaceAll","win32","sep","content","writeFile"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,YAAYC,EAAE,QAAQ,KAAI;AAEnC,2DAA2D;AAC3D,iEAAiE;AACjE,MAAMC,WAAWC,QAAQJ,KAAKK,IAAI,CAACC,WAAW,0BAA0BC,IAAI;AAE5E,OAAO,eAAeC,yBAAyB,EAC7CC,OAAO,EACPC,OAAO,EACPC,mBAAmB,EACnBC,WAAW,EACXC,SAAS,EAOV;IACC,yBAAyB;IACzB,MAAMC,sBAAsBd,KAAKK,IAAI,CAACI,SAAS;IAE/C,iCAAiC;IACjC,IAAIM,MAAMhB,GAAGiB,GAAG;IAChB,IAAIC;IAEJ,IAAI;QACFA,iBAAiB,MAAMf,GAAGgB,QAAQ,CAACJ,qBAAqB;QACxD,uDAAuD;QACvD,MAAMK,KAAKF,eAAeG,OAAO,CAAC,MAAM,+BAA+B,GAAG;QAE1E,IAAID,OAAO,CAAC,GAAG;YACb,IAAIF,cAAc,CAACE,KAAK,EAAE,KAAK,MAAM;gBACnCJ,MAAM;YACR,OAAO;gBACLA,MAAM;YACR;QACF;IACF,EAAE,OAAM,CAAC;IAET;;;;;GAKC,GACD,MAAMM,aAAuB;QAC3B,oCAAoC;QACpC,CAAC,sBAAsB,EAAElB,SAAS,IAAI,CAAC;KACxC;IAED,IAAIQ,qBAAqB;QACvBU,WAAWC,IAAI,CAAC,CAAC,sBAAsB,EAAEnB,SAAS,uBAAuB,CAAC;IAC5E;IAEA,IAAIU,aAAaD,aAAa;QAC5BS,WAAWC,IAAI,CACb,CAAC,sBAAsB,EAAEnB,SAAS,uCAAuC,CAAC;IAE9E;IAEA,MAAMoB,iBAAiBvB,KAAKwB,KAAK,CAACnB,IAAI,CACpCK,QAAQe,UAAU,CAACzB,KAAK0B,KAAK,CAACC,GAAG,EAAE3B,KAAKwB,KAAK,CAACG,GAAG,GACjD;IAGF,mFAAmF;IACnFN,WAAWC,IAAI,CAAC,CAAC,UAAU,EAAEC,eAAe,EAAE,CAAC;IAE/C,sBAAsB;IACtBF,WAAWC,IAAI,CACb,IACA,2CACA,CAAC,+BAA+B,EAAET,YAAY,QAAQ,QAAQ,sDAAsD,CAAC;IAGvH,MAAMe,UAAUP,WAAWhB,IAAI,CAACU,OAAOA;IAEvC,+CAA+C;IAC/C,IAAIE,mBAAmBW,SAAS;QAC9B;IACF;IACA,MAAM1B,GAAG2B,SAAS,CAACf,qBAAqBc;AAC1C","ignoreList":[0]}
@@ -3,8 +3,12 @@ import { bold, cyan, white } from '../picocolors';
3
3
  import * as CommentJson from 'next/dist/compiled/comment-json';
4
4
  import semver from 'next/dist/compiled/semver';
5
5
  import os from 'os';
6
+ import path from 'path';
6
7
  import { getTypeScriptConfiguration } from './getTypeScriptConfiguration';
7
8
  import * as Log from '../../build/output/log';
9
+ // Read package name dynamically to support forked packages
10
+ // From dist/lib/typescript, go up 3 levels to reach package root
11
+ const PKG_NAME = require(path.join(__dirname, '../../../package.json')).name;
8
12
  function getDesiredCompilerOptions(ts, tsOptions) {
9
13
  const o = {
10
14
  target: {
@@ -217,6 +221,31 @@ export async function writeConfigurationDefaults(ts, tsConfigPath, isFirstTimeSe
217
221
  suggestedActions.push(cyan('strictNullChecks') + ' was set to ' + bold(`true`));
218
222
  }
219
223
  }
224
+ // If the package name is not 'next', add a path mapping to redirect 'next' imports
225
+ // to the actual package name. This is necessary for forked packages.
226
+ if (PKG_NAME !== 'next') {
227
+ if (!userTsConfig.compilerOptions) {
228
+ userTsConfig.compilerOptions = {};
229
+ }
230
+ if (!userTsConfig.compilerOptions.paths) {
231
+ userTsConfig.compilerOptions.paths = {};
232
+ }
233
+ // Add path mapping for 'next' and 'next/*' to redirect to the actual package
234
+ const nextMapping = `${PKG_NAME}`;
235
+ const nextWildcardMapping = `${PKG_NAME}/*`;
236
+ if (!userTsConfig.compilerOptions.paths['next']) {
237
+ userTsConfig.compilerOptions.paths['next'] = [
238
+ nextMapping
239
+ ];
240
+ suggestedActions.push(cyan('paths["next"]') + ' was set to ' + bold(`["${nextMapping}"]`) + ' (for forked package support)');
241
+ }
242
+ if (!userTsConfig.compilerOptions.paths['next/*']) {
243
+ userTsConfig.compilerOptions.paths['next/*'] = [
244
+ nextWildcardMapping
245
+ ];
246
+ suggestedActions.push(cyan('paths["next/*"]') + ' was set to ' + bold(`["${nextWildcardMapping}"]`) + ' (for forked package support)');
247
+ }
248
+ }
220
249
  if (!('exclude' in rawConfig)) {
221
250
  userTsConfig.exclude = [
222
251
  'node_modules'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { bold, cyan, white } from '../picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport type { CompilerOptions } from 'typescript'\nimport { getTypeScriptConfiguration } from './getTypeScriptConfiguration'\nimport * as Log from '../../build/output/log'\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array<any>\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n ts: typeof import('typescript'),\n tsOptions?: CompilerOptions\n): DesiredCompilerOptionsShape {\n const o: DesiredCompilerOptionsShape = {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n ...(semver.lt(ts.version, '5.0.0')\n ? { forceConsistentCasingInFileNames: { suggested: true } }\n : undefined),\n noEmit: { suggested: true },\n ...(semver.gte(ts.version, '4.4.2')\n ? { incremental: { suggested: true } }\n : undefined),\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: ts.ModuleKind.ESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(ts.version, '5.4.0') && (ts.ModuleKind as any).Preserve,\n ts.ModuleKind.ES2020,\n ts.ModuleKind.ESNext,\n ts.ModuleKind.CommonJS,\n ts.ModuleKind.AMD,\n ts.ModuleKind.NodeNext,\n ts.ModuleKind.Node16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(ts.version, '5.4.0') &&\n tsOptions?.module === (ts.ModuleKind as any).Preserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n // In TypeScript 5.0, `NodeJs` has renamed to `Node10`\n parsedValue:\n ts.ModuleResolutionKind.Bundler ??\n ts.ModuleResolutionKind.NodeNext ??\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // All of these values work:\n parsedValues: [\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n (ts.ModuleResolutionKind as any).Node12,\n ts.ModuleResolutionKind.Node16,\n ts.ModuleResolutionKind.NodeNext,\n ts.ModuleResolutionKind.Bundler,\n ].filter((val) => typeof val !== 'undefined'),\n value: 'node',\n reason: 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(tsOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: ts.JsxEmit.ReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n }\n\n return o\n}\n\nexport function getRequiredConfiguration(\n ts: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n res[optionKey] = ev.parsedValue ?? ev.value\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n ts: typeof import('typescript'),\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean\n): Promise<void> {\n if (isFirstTimeSetup) {\n await fs.writeFile(tsConfigPath, '{}' + os.EOL)\n }\n\n const { options: tsOptions, raw: rawConfig } =\n await getTypeScriptConfiguration(ts, tsConfigPath, true)\n\n const userTsConfigContent = await fs.readFile(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n if (userTsConfig.compilerOptions == null && !('extends' in rawConfig)) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts, tsOptions)\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in tsOptions)) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n const ev = tsOptions[optionKey]\n if (\n !('parsedValues' in check\n ? check.parsedValues?.includes(ev)\n : 'parsedValue' in check\n ? check.parsedValue === ev\n : check.value === ev)\n ) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = check\n }\n }\n\n const nextAppTypes = `${distDir}/types/**/*.ts`\n\n if (!('include' in rawConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', nextAppTypes, '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', '${nextAppTypes}', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir && !rawConfig.include.includes(nextAppTypes)) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n // rawConfig will resolve all extends and include paths (ex: tsconfig.json, tsconfig.base.json, etc.)\n // if it doesn't match userTsConfig then update the userTsConfig to add the\n // rawConfig's includes in addition to nextAppTypes\n if (\n rawConfig.include.length !== userTsConfig.include.length ||\n JSON.stringify(rawConfig.include.sort()) !==\n JSON.stringify(userTsConfig.include.sort())\n ) {\n userTsConfig.include.push(...rawConfig.include, nextAppTypes)\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n `[${[...rawConfig.include, nextAppTypes]\n .map((i) => `'${i}'`)\n .join(', ')}]`\n )\n )\n } else {\n userTsConfig.include.push(nextAppTypes)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${nextAppTypes}'`)\n )\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(tsOptions.plugins) ? tsOptions.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in rawConfig &&\n (!rawConfig.compilerOptions || !rawConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !tsOptions.strict &&\n !('strictNullChecks' in tsOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n if (!('exclude' in rawConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n await fs.writeFile(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["promises","fs","bold","cyan","white","CommentJson","semver","os","getTypeScriptConfiguration","Log","getDesiredCompilerOptions","ts","tsOptions","o","target","suggested","reason","lib","allowJs","skipLibCheck","strict","lt","version","forceConsistentCasingInFileNames","undefined","noEmit","gte","incremental","module","parsedValue","ModuleKind","ESNext","parsedValues","Preserve","ES2020","CommonJS","AMD","NodeNext","Node16","value","esModuleInterop","moduleResolution","ModuleResolutionKind","Bundler","Node10","NodeJs","Node12","filter","val","resolveJsonModule","verbatimModuleSyntax","isolatedModules","jsx","JsxEmit","ReactJSX","getRequiredConfiguration","res","desiredCompilerOptions","optionKey","Object","keys","ev","localDevTestFilesExcludeAction","writeConfigurationDefaults","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","userTsConfig","writeFile","EOL","options","raw","rawConfig","userTsConfigContent","readFile","encoding","parse","compilerOptions","suggestedActions","requiredActions","check","push","includes","_","nextAppTypes","include","Array","isArray","length","JSON","stringify","sort","map","i","join","plugins","hasNextPlugin","some","name","info","strictNullChecks","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","forEach","action","requiredActionsToBeLogged"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;AACjD,YAAYC,iBAAiB,kCAAiC;AAC9D,OAAOC,YAAY,4BAA2B;AAC9C,OAAOC,QAAQ,KAAI;AAEnB,SAASC,0BAA0B,QAAQ,+BAA8B;AACzE,YAAYC,SAAS,yBAAwB;AAa7C,SAASC,0BACPC,EAA+B,EAC/BC,SAA2B;IAE3B,MAAMC,IAAiC;QACrCC,QAAQ;YACNC,WAAW;YACXC,QACE;QACJ;QACA,qEAAqE;QACrE,gBAAgB;QAChBC,KAAK;YAAEF,WAAW;gBAAC;gBAAO;gBAAgB;aAAS;QAAC;QACpDG,SAAS;YAAEH,WAAW;QAAK;QAC3BI,cAAc;YAAEJ,WAAW;QAAK;QACh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,EACdkE,EAAAA,gCAAAA,aAAaU,eAAe,qBAA5BV,8BAA8BjD,MAAM,IAChC,KACA,CAAC,uBAAuB,EAAEjB,KAAK,SAAS,YAAY,CAAC,EACzD;IAGJ,IAAI6E,iBAAiBU,MAAM,EAAE;QAC3BjF,IAAI4F,IAAI,CACN,CAAC,kDAAkD,EAAElG,KACnD,iBACA,eAAe,EAAEA,KAAK,kBAAkB,+BAA+B,CAAC;QAG5E6E,iBAAiB8B,OAAO,CAAC,CAACC,SAAWtG,IAAI4F,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAE7DtG,IAAI4F,IAAI,CAAC;IACX;IAEA,MAAMW,4BAA4BR,QAAQC,GAAG,CAACC,sBAAsB,GAChEzB,gBAAgBlC,MAAM,CACpB,CAACgE,SAAWA,WAAWjD,kCAEzBmB;IAEJ,IAAI+B,0BAA0BtB,MAAM,EAAE;QACpCjF,IAAI4F,IAAI,CACN,CAAC,cAAc,EAAEjG,MAAM,qBAAqB,mBAAmB,EAAED,KAC/D,iBACA,GAAG,CAAC;QAGR6G,0BAA0BF,OAAO,CAAC,CAACC,SAAWtG,IAAI4F,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAEtEtG,IAAI4F,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { bold, cyan, white } from '../picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport path from 'path'\nimport type { CompilerOptions } from 'typescript'\nimport { getTypeScriptConfiguration } from './getTypeScriptConfiguration'\nimport * as Log from '../../build/output/log'\n\n// Read package name dynamically to support forked packages\n// From dist/lib/typescript, go up 3 levels to reach package root\nconst PKG_NAME = require(path.join(__dirname, '../../../package.json')).name\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array<any>\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n ts: typeof import('typescript'),\n tsOptions?: CompilerOptions\n): DesiredCompilerOptionsShape {\n const o: DesiredCompilerOptionsShape = {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n ...(semver.lt(ts.version, '5.0.0')\n ? { forceConsistentCasingInFileNames: { suggested: true } }\n : undefined),\n noEmit: { suggested: true },\n ...(semver.gte(ts.version, '4.4.2')\n ? { incremental: { suggested: true } }\n : undefined),\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: ts.ModuleKind.ESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(ts.version, '5.4.0') && (ts.ModuleKind as any).Preserve,\n ts.ModuleKind.ES2020,\n ts.ModuleKind.ESNext,\n ts.ModuleKind.CommonJS,\n ts.ModuleKind.AMD,\n ts.ModuleKind.NodeNext,\n ts.ModuleKind.Node16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(ts.version, '5.4.0') &&\n tsOptions?.module === (ts.ModuleKind as any).Preserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n // In TypeScript 5.0, `NodeJs` has renamed to `Node10`\n parsedValue:\n ts.ModuleResolutionKind.Bundler ??\n ts.ModuleResolutionKind.NodeNext ??\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // All of these values work:\n parsedValues: [\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n (ts.ModuleResolutionKind as any).Node12,\n ts.ModuleResolutionKind.Node16,\n ts.ModuleResolutionKind.NodeNext,\n ts.ModuleResolutionKind.Bundler,\n ].filter((val) => typeof val !== 'undefined'),\n value: 'node',\n reason: 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(tsOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: ts.JsxEmit.ReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n }\n\n return o\n}\n\nexport function getRequiredConfiguration(\n ts: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n res[optionKey] = ev.parsedValue ?? ev.value\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n ts: typeof import('typescript'),\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean\n): Promise<void> {\n if (isFirstTimeSetup) {\n await fs.writeFile(tsConfigPath, '{}' + os.EOL)\n }\n\n const { options: tsOptions, raw: rawConfig } =\n await getTypeScriptConfiguration(ts, tsConfigPath, true)\n\n const userTsConfigContent = await fs.readFile(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n if (userTsConfig.compilerOptions == null && !('extends' in rawConfig)) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts, tsOptions)\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in tsOptions)) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n const ev = tsOptions[optionKey]\n if (\n !('parsedValues' in check\n ? check.parsedValues?.includes(ev)\n : 'parsedValue' in check\n ? check.parsedValue === ev\n : check.value === ev)\n ) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = check\n }\n }\n\n const nextAppTypes = `${distDir}/types/**/*.ts`\n\n if (!('include' in rawConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', nextAppTypes, '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', '${nextAppTypes}', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir && !rawConfig.include.includes(nextAppTypes)) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n // rawConfig will resolve all extends and include paths (ex: tsconfig.json, tsconfig.base.json, etc.)\n // if it doesn't match userTsConfig then update the userTsConfig to add the\n // rawConfig's includes in addition to nextAppTypes\n if (\n rawConfig.include.length !== userTsConfig.include.length ||\n JSON.stringify(rawConfig.include.sort()) !==\n JSON.stringify(userTsConfig.include.sort())\n ) {\n userTsConfig.include.push(...rawConfig.include, nextAppTypes)\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n `[${[...rawConfig.include, nextAppTypes]\n .map((i) => `'${i}'`)\n .join(', ')}]`\n )\n )\n } else {\n userTsConfig.include.push(nextAppTypes)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${nextAppTypes}'`)\n )\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(tsOptions.plugins) ? tsOptions.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in rawConfig &&\n (!rawConfig.compilerOptions || !rawConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !tsOptions.strict &&\n !('strictNullChecks' in tsOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n // If the package name is not 'next', add a path mapping to redirect 'next' imports\n // to the actual package name. This is necessary for forked packages.\n if (PKG_NAME !== 'next') {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n if (!userTsConfig.compilerOptions.paths) {\n userTsConfig.compilerOptions.paths = {}\n }\n\n // Add path mapping for 'next' and 'next/*' to redirect to the actual package\n const nextMapping = `${PKG_NAME}`\n const nextWildcardMapping = `${PKG_NAME}/*`\n\n if (!userTsConfig.compilerOptions.paths['next']) {\n userTsConfig.compilerOptions.paths['next'] = [nextMapping]\n suggestedActions.push(\n cyan('paths[\"next\"]') + ' was set to ' + bold(`[\"${nextMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n\n if (!userTsConfig.compilerOptions.paths['next/*']) {\n userTsConfig.compilerOptions.paths['next/*'] = [nextWildcardMapping]\n suggestedActions.push(\n cyan('paths[\"next/*\"]') + ' was set to ' + bold(`[\"${nextWildcardMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n }\n\n if (!('exclude' in rawConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n await fs.writeFile(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["promises","fs","bold","cyan","white","CommentJson","semver","os","path","getTypeScriptConfiguration","Log","PKG_NAME","require","join","__dirname","name","getDesiredCompilerOptions","ts","tsOptions","o","target","suggested","reason","lib","allowJs","skipLibCheck","strict","lt","version","forceConsistentCasingInFileNames","undefined","noEmit","gte","incremental","module","parsedValue","ModuleKind","ESNext","parsedValues","Preserve","ES2020","CommonJS","AMD","NodeNext","Node16","value","esModuleInterop","moduleResolution","ModuleResolutionKind","Bundler","Node10","NodeJs","Node12","filter","val","resolveJsonModule","verbatimModuleSyntax","isolatedModules","jsx","JsxEmit","ReactJSX","getRequiredConfiguration","res","desiredCompilerOptions","optionKey","Object","keys","ev","localDevTestFilesExcludeAction","writeConfigurationDefaults","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","userTsConfig","writeFile","EOL","options","raw","rawConfig","userTsConfigContent","readFile","encoding","parse","compilerOptions","suggestedActions","requiredActions","check","push","includes","_","nextAppTypes","include","Array","isArray","length","JSON","stringify","sort","map","i","plugins","hasNextPlugin","some","info","strictNullChecks","paths","nextMapping","nextWildcardMapping","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","forEach","action","requiredActionsToBeLogged"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;AACjD,YAAYC,iBAAiB,kCAAiC;AAC9D,OAAOC,YAAY,4BAA2B;AAC9C,OAAOC,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB,SAASC,0BAA0B,QAAQ,+BAA8B;AACzE,YAAYC,SAAS,yBAAwB;AAE7C,2DAA2D;AAC3D,iEAAiE;AACjE,MAAMC,WAAWC,QAAQJ,KAAKK,IAAI,CAACC,WAAW,0BAA0BC,IAAI;AAa5E,SAASC,0BACPC,EAA+B,EAC/BC,SAA2B;IAE3B,MAAMC,IAAiC;QACrCC,QAAQ;YACNC,WAAW;YACXC,QACE;QACJ;QACA,qEAAqE;QACrE,gBAAgB;QAChBC,KAAK;YAAEF,WAAW;gBAAC;gBAAO;gBAAgB;aAAS;QAAC;QACpDG,SAAS;YAAEH,WAAW;QAAK;QAC3BI,cAAc;YAAEJ,WAAW;QAAK;QAChCK,QAAQ;YAAEL,WAAW;QAAM;QAC3B,GAAIf,OAAOqB,EAAE,CAACV,GAAGW,OAAO,EAAE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pB,CAACiE,SAAWA,WAAWlD,kCAEzBmB;IAEJ,IAAIgC,0BAA0BvB,MAAM,EAAE;QACpCtF,IAAI+F,IAAI,CACN,CAAC,cAAc,EAAErG,MAAM,qBAAqB,mBAAmB,EAAED,KAC/D,iBACA,GAAG,CAAC;QAGRoH,0BAA0BF,OAAO,CAAC,CAACC,SAAW5G,IAAI+F,IAAI,CAAC,CAAC,IAAI,EAAEa,QAAQ;QAEtE5G,IAAI+F,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
@@ -158,7 +158,7 @@ export default class HotReloaderWebpack {
158
158
  this.previewProps = previewProps;
159
159
  this.rewrites = rewrites;
160
160
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
161
- version: "15.6.0-bun.23"
161
+ version: "15.6.0-bun.25"
162
162
  });
163
163
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
164
164
  // of the current `next dev` invocation.
@@ -14,7 +14,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
14
14
  bundlerSuffix = ' (webpack)';
15
15
  }
16
16
  }
17
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-bun.23"}`))}${bundlerSuffix}`);
17
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-bun.25"}`))}${bundlerSuffix}`);
18
18
  if (appUrl) {
19
19
  Log.bootstrap(`- Local: ${appUrl}`);
20
20
  }
@@ -87,7 +87,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
87
87
  export async function startServer(serverOptions) {
88
88
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
89
89
  let { port } = serverOptions;
90
- process.title = `next-server (v${"15.6.0-bun.23"})`;
90
+ process.title = `next-server (v${"15.6.0-bun.25"})`;
91
91
  let handlersReady = ()=>{};
92
92
  let handlersError = ()=>{};
93
93
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -4,8 +4,11 @@
4
4
  // This module will only be loaded once per process.
5
5
  const path = require('path');
6
6
  const mod = require('module');
7
+ const fs = require('fs');
7
8
  // Read package name dynamically to support forked packages
8
- const PKG_NAME = require('../../package.json').name;
9
+ // Use a dynamic path that won't be resolved by bundlers
10
+ const packageJsonPath = path.join(__dirname, '../../package.json');
11
+ const PKG_NAME = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name;
9
12
  const originalRequire = mod.prototype.require;
10
13
  const resolveFilename = // @ts-expect-error
11
14
  mod._resolveFilename;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/require-hook.ts"],"sourcesContent":["// Synchronously inject a require hook for webpack and webpack/. It's required to use the internal ncc webpack version.\n// This is needed for userland plugins to attach to the same webpack instance as Next.js'.\n// Individually compiled modules are as defined for the compilation in bundles/webpack/packages/*.\n\n// This module will only be loaded once per process.\nconst path = require('path') as typeof import('path')\nconst mod = require('module') as typeof import('module')\n\n// Read package name dynamically to support forked packages\nconst PKG_NAME = require('../../package.json').name\nconst originalRequire = mod.prototype.require\nconst resolveFilename =\n // @ts-expect-error\n mod._resolveFilename\n\nlet resolve: typeof require.resolve = process.env.NEXT_MINIMAL\n ? // @ts-ignore\n __non_webpack_require__.resolve\n : require.resolve\n\nexport const hookPropertyMap = new Map()\n\nexport const defaultOverrides = {\n 'styled-jsx': path.dirname(resolve('styled-jsx/package.json')),\n 'styled-jsx/style': resolve('styled-jsx/style'),\n 'styled-jsx/style.js': resolve('styled-jsx/style'),\n}\n\nconst toResolveMap = (map: Record<string, string>): [string, string][] =>\n Object.entries(map).map(([key, value]) => [key, resolve(value)])\n\nexport function addHookAliases(aliases: [string, string][] = []) {\n for (const [key, value] of aliases) {\n hookPropertyMap.set(key, value)\n }\n}\n\naddHookAliases(toResolveMap(defaultOverrides))\n\n// @ts-expect-error\nmod._resolveFilename = function (\n originalResolveFilename: (\n request: string,\n parent: string,\n isMain: boolean,\n opts: any\n ) => string,\n requestMap: Map<string, string>,\n pkgName: string,\n request: string,\n parent: string,\n isMain: boolean,\n options: any\n) {\n const hookResolved = requestMap.get(request)\n if (hookResolved) request = hookResolved\n\n // Redirect next/dist/, next/font/, and next/package.json requests to the actual package name (supports forked packages)\n if (request.startsWith('next/dist/')) {\n request = request.replace('next/dist/', `${pkgName}/dist/`)\n } else if (request.startsWith('next/font/')) {\n request = request.replace('next/font/', `${pkgName}/font/`)\n } else if (request === 'next/package.json') {\n request = `${pkgName}/package.json`\n }\n\n return originalResolveFilename.call(mod, request, parent, isMain, options)\n\n // We use `bind` here to avoid referencing outside variables to create potential memory leaks.\n}.bind(null, resolveFilename, hookPropertyMap, PKG_NAME)\n\n// @ts-expect-error\n// This is a hack to make sure that if a user requires a Next.js module that wasn't bundled\n// that needs to point to the rendering runtime version, it will point to the correct one.\n// This can happen on `pages` when a user requires a dependency that uses next/image for example.\nmod.prototype.require = function (request: string) {\n if (request.endsWith('.shared-runtime')) {\n return originalRequire.call(\n this,\n `${PKG_NAME}/dist/server/route-modules/pages/vendored/contexts/${path.basename(\n request,\n '.shared-runtime'\n )}`\n )\n }\n\n // Redirect next/dist/, next/font/, and next/package.json requests to the actual package name (supports forked packages)\n if (request.startsWith('next/dist/')) {\n return originalRequire.call(this, request.replace('next/dist/', `${PKG_NAME}/dist/`))\n } else if (request.startsWith('next/font/')) {\n return originalRequire.call(this, request.replace('next/font/', `${PKG_NAME}/font/`))\n } else if (request === 'next/package.json') {\n return originalRequire.call(this, `${PKG_NAME}/package.json`)\n }\n\n return originalRequire.call(this, request)\n}\n"],"names":["path","require","mod","PKG_NAME","name","originalRequire","prototype","resolveFilename","_resolveFilename","resolve","process","env","NEXT_MINIMAL","__non_webpack_require__","hookPropertyMap","Map","defaultOverrides","dirname","toResolveMap","map","Object","entries","key","value","addHookAliases","aliases","set","originalResolveFilename","requestMap","pkgName","request","parent","isMain","options","hookResolved","get","startsWith","replace","call","bind","endsWith","basename"],"mappings":"AAAA,uHAAuH;AACvH,0FAA0F;AAC1F,kGAAkG;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AC5D,OAAO,IAAIC,YAAY,qBAAqB;QAC1CA,UAAU,GAAGD,QAAQ,aAAa,CAAC;IACrC;IAEA,OAAOF,wBAAwBW,IAAI,CAACpC,KAAK4B,SAASC,QAAQC,QAAQC;AAElE,8FAA8F;AAChG,CAAA,EAAEM,IAAI,CAAC,MAAMhC,iBAAiBO,iBAAiBX;AAE/C,mBAAmB;AACnB,2FAA2F;AAC3F,0FAA0F;AAC1F,iGAAiG;AACjGD,IAAII,SAAS,CAACL,OAAO,GAAG,SAAU6B,OAAe;IAC/C,IAAIA,QAAQU,QAAQ,CAAC,oBAAoB;QACvC,OAAOnC,gBAAgBiC,IAAI,CACzB,IAAI,EACJ,GAAGnC,SAAS,mDAAmD,EAAEH,KAAKyC,QAAQ,CAC5EX,SACA,oBACC;IAEP;IAEA,wHAAwH;IACxH,IAAIA,QAAQM,UAAU,CAAC,eAAe;QACpC,OAAO/B,gBAAgBiC,IAAI,CAAC,IAAI,EAAER,QAAQO,OAAO,CAAC,cAAc,GAAGlC,SAAS,MAAM,CAAC;IACrF,OAAO,IAAI2B,QAAQM,UAAU,CAAC,eAAe;QAC3C,OAAO/B,gBAAgBiC,IAAI,CAAC,IAAI,EAAER,QAAQO,OAAO,CAAC,cAAc,GAAGlC,SAAS,MAAM,CAAC;IACrF,OAAO,IAAI2B,YAAY,qBAAqB;QAC1C,OAAOzB,gBAAgBiC,IAAI,CAAC,IAAI,EAAE,GAAGnC,SAAS,aAAa,CAAC;IAC9D;IAEA,OAAOE,gBAAgBiC,IAAI,CAAC,IAAI,EAAER;AACpC","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/server/require-hook.ts"],"sourcesContent":["// Synchronously inject a require hook for webpack and webpack/. It's required to use the internal ncc webpack version.\n// This is needed for userland plugins to attach to the same webpack instance as Next.js'.\n// Individually compiled modules are as defined for the compilation in bundles/webpack/packages/*.\n\n// This module will only be loaded once per process.\nconst path = require('path') as typeof import('path')\nconst mod = require('module') as typeof import('module')\nconst fs = require('fs') as typeof import('fs')\n\n// Read package name dynamically to support forked packages\n// Use a dynamic path that won't be resolved by bundlers\nconst packageJsonPath = path.join(__dirname, '../../package.json')\nconst PKG_NAME = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name\nconst originalRequire = mod.prototype.require\nconst resolveFilename =\n // @ts-expect-error\n mod._resolveFilename\n\nlet resolve: typeof require.resolve = process.env.NEXT_MINIMAL\n ? // @ts-ignore\n __non_webpack_require__.resolve\n : require.resolve\n\nexport const hookPropertyMap = new Map()\n\nexport const defaultOverrides = {\n 'styled-jsx': path.dirname(resolve('styled-jsx/package.json')),\n 'styled-jsx/style': resolve('styled-jsx/style'),\n 'styled-jsx/style.js': resolve('styled-jsx/style'),\n}\n\nconst toResolveMap = (map: Record<string, string>): [string, string][] =>\n Object.entries(map).map(([key, value]) => [key, resolve(value)])\n\nexport function addHookAliases(aliases: [string, string][] = []) {\n for (const [key, value] of aliases) {\n hookPropertyMap.set(key, value)\n }\n}\n\naddHookAliases(toResolveMap(defaultOverrides))\n\n// @ts-expect-error\nmod._resolveFilename = function (\n originalResolveFilename: (\n request: string,\n parent: string,\n isMain: boolean,\n opts: any\n ) => string,\n requestMap: Map<string, string>,\n pkgName: string,\n request: string,\n parent: string,\n isMain: boolean,\n options: any\n) {\n const hookResolved = requestMap.get(request)\n if (hookResolved) request = hookResolved\n\n // Redirect next/dist/, next/font/, and next/package.json requests to the actual package name (supports forked packages)\n if (request.startsWith('next/dist/')) {\n request = request.replace('next/dist/', `${pkgName}/dist/`)\n } else if (request.startsWith('next/font/')) {\n request = request.replace('next/font/', `${pkgName}/font/`)\n } else if (request === 'next/package.json') {\n request = `${pkgName}/package.json`\n }\n\n return originalResolveFilename.call(mod, request, parent, isMain, options)\n\n // We use `bind` here to avoid referencing outside variables to create potential memory leaks.\n}.bind(null, resolveFilename, hookPropertyMap, PKG_NAME)\n\n// @ts-expect-error\n// This is a hack to make sure that if a user requires a Next.js module that wasn't bundled\n// that needs to point to the rendering runtime version, it will point to the correct one.\n// This can happen on `pages` when a user requires a dependency that uses next/image for example.\nmod.prototype.require = function (request: string) {\n if (request.endsWith('.shared-runtime')) {\n return originalRequire.call(\n this,\n `${PKG_NAME}/dist/server/route-modules/pages/vendored/contexts/${path.basename(\n request,\n '.shared-runtime'\n )}`\n )\n }\n\n // Redirect next/dist/, next/font/, and next/package.json requests to the actual package name (supports forked packages)\n if (request.startsWith('next/dist/')) {\n return originalRequire.call(this, request.replace('next/dist/', `${PKG_NAME}/dist/`))\n } else if (request.startsWith('next/font/')) {\n return originalRequire.call(this, request.replace('next/font/', `${PKG_NAME}/font/`))\n } else if (request === 'next/package.json') {\n return originalRequire.call(this, `${PKG_NAME}/package.json`)\n }\n\n return originalRequire.call(this, request)\n}\n"],"names":["path","require","mod","fs","packageJsonPath","join","__dirname","PKG_NAME","JSON","parse","readFileSync","name","originalRequire","prototype","resolveFilename","_resolveFilename","resolve","process","env","NEXT_MINIMAL","__non_webpack_require__","hookPropertyMap","Map","defaultOverrides","dirname","toResolveMap","map","Object","entries","key","value","addHookAliases","aliases","set","originalResolveFilename","requestMap","pkgName","request","parent","isMain","options","hookResolved","get","startsWith","replace","call","bind","endsWith","basename"],"mappings":"AAAA,uHAAuH;AACvH,0FAA0F;AAC1F,kGAAkG;AAElG,oDAAoD;AACpD,MAAMA,OAAOC,QAAQ;AACrB,MAAMC,MAAMD,QAAQ;AACpB,MAAME,KAAKF,QAAQ;AAEnB,2DAA2D;AAC3D,wDAAwD;AACxD,MAAMG,kBAAkBJ,KAAKK,IAAI,CAACC,WAAW;AAC7C,MAAMC,WAAWC,KAAKC,KAAK,CAACN,GAAGO,YAAY,CAACN,iBAAiB,SAASO,IAAI;AAC1E,MAAMC,kBAAkBV,IAAIW,SAAS,CAACZ,OAAO;AAC7C,MAAMa,kBACJ,mBAAmB;AACnBZ,IAAIa,gBAAgB;AAEtB,IAAIC,UAAkCC,QAAQC,GAAG,CAACC,YAAY,GAE1DC,wBAAwBJ,OAAO,GAC/B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,OAAO,GAAG,SAAUoC,OAAe;IAC/C,IAAIA,QAAQU,QAAQ,CAAC,oBAAoB;QACvC,OAAOnC,gBAAgBiC,IAAI,CACzB,IAAI,EACJ,GAAGtC,SAAS,mDAAmD,EAAEP,KAAKgD,QAAQ,CAC5EX,SACA,oBACC;IAEP;IAEA,wHAAwH;IACxH,IAAIA,QAAQM,UAAU,CAAC,eAAe;QACpC,OAAO/B,gBAAgBiC,IAAI,CAAC,IAAI,EAAER,QAAQO,OAAO,CAAC,cAAc,GAAGrC,SAAS,MAAM,CAAC;IACrF,OAAO,IAAI8B,QAAQM,UAAU,CAAC,eAAe;QAC3C,OAAO/B,gBAAgBiC,IAAI,CAAC,IAAI,EAAER,QAAQO,OAAO,CAAC,cAAc,GAAGrC,SAAS,MAAM,CAAC;IACrF,OAAO,IAAI8B,YAAY,qBAAqB;QAC1C,OAAOzB,gBAAgBiC,IAAI,CAAC,IAAI,EAAE,GAAGtC,SAAS,aAAa,CAAC;IAC9D;IAEA,OAAOK,gBAAgBiC,IAAI,CAAC,IAAI,EAAER;AACpC","ignoreList":[0]}
@@ -1,6 +1,6 @@
1
1
  export function isStableBuild() {
2
2
  var _process_env___NEXT_VERSION;
3
- return !((_process_env___NEXT_VERSION = "15.6.0-bun.23") == 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.6.0-bun.25") == 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){
@@ -17,7 +17,8 @@ function _interop_require_default(obj) {
17
17
  };
18
18
  }
19
19
  // Read package name dynamically to support forked packages
20
- const PKG_NAME = require(_path.default.join(__dirname, '../../package.json')).name;
20
+ // From dist/lib/typescript, go up 3 levels to reach package root
21
+ const PKG_NAME = require(_path.default.join(__dirname, '../../../package.json')).name;
21
22
  async function writeAppTypeDeclarations({ baseDir, distDir, imageImportsEnabled, hasPagesDir, hasAppDir }) {
22
23
  // Reference `next` types
23
24
  const appTypeDeclarations = _path.default.join(baseDir, 'next-env.d.ts');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/typescript/writeAppTypeDeclarations.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport { promises as fs } from 'fs'\n\n// Read package name dynamically to support forked packages\nconst PKG_NAME = require(path.join(__dirname, '../../package.json')).name\n\nexport async function writeAppTypeDeclarations({\n baseDir,\n distDir,\n imageImportsEnabled,\n hasPagesDir,\n hasAppDir,\n}: {\n baseDir: string\n distDir: string\n imageImportsEnabled: boolean\n hasPagesDir: boolean\n hasAppDir: boolean\n}): Promise<void> {\n // Reference `next` types\n const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts')\n\n // Defaults EOL to system default\n let eol = os.EOL\n let currentContent: string | undefined\n\n try {\n currentContent = await fs.readFile(appTypeDeclarations, 'utf8')\n // If file already exists then preserve its line ending\n const lf = currentContent.indexOf('\\n', /* skip first so we can lf - 1 */ 1)\n\n if (lf !== -1) {\n if (currentContent[lf - 1] === '\\r') {\n eol = '\\r\\n'\n } else {\n eol = '\\n'\n }\n }\n } catch {}\n\n /**\n * \"Triple-slash directives\" used to create typings files for Next.js projects\n * using Typescript .\n *\n * @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html\n */\n const directives: string[] = [\n // Include the core Next.js typings.\n `/// <reference types=\"${PKG_NAME}\" />`,\n ]\n\n if (imageImportsEnabled) {\n directives.push(`/// <reference types=\"${PKG_NAME}/image-types/global\" />`)\n }\n\n if (hasAppDir && hasPagesDir) {\n directives.push(\n `/// <reference types=\"${PKG_NAME}/navigation-types/compat/navigation\" />`\n )\n }\n\n const routeTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/routes.d.ts'\n )\n\n // Use ESM import instead of triple-slash reference for better ESLint compatibility\n directives.push(`import \"./${routeTypesPath}\";`)\n\n // Push the notice in.\n directives.push(\n '',\n '// NOTE: This file should not be edited',\n `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`\n )\n\n const content = directives.join(eol) + eol\n\n // Avoids an un-necessary write on read-only fs\n if (currentContent === content) {\n return\n }\n await fs.writeFile(appTypeDeclarations, content)\n}\n"],"names":["writeAppTypeDeclarations","PKG_NAME","require","path","join","__dirname","name","baseDir","distDir","imageImportsEnabled","hasPagesDir","hasAppDir","appTypeDeclarations","eol","os","EOL","currentContent","fs","readFile","lf","indexOf","directives","push","routeTypesPath","posix","replaceAll","win32","sep","content","writeFile"],"mappings":";;;;+BAOsBA;;;eAAAA;;;2DAPP;6DACE;oBACc;;;;;;AAE/B,2DAA2D;AAC3D,MAAMC,WAAWC,QAAQC,aAAI,CAACC,IAAI,CAACC,WAAW,uBAAuBC,IAAI;AAElE,eAAeN,yBAAyB,EAC7CO,OAAO,EACPC,OAAO,EACPC,mBAAmB,EACnBC,WAAW,EACXC,SAAS,EAOV;IACC,yBAAyB;IACzB,MAAMC,sBAAsBT,aAAI,CAACC,IAAI,CAACG,SAAS;IAE/C,iCAAiC;IACjC,IAAIM,MAAMC,WAAE,CAACC,GAAG;IAChB,IAAIC;IAEJ,IAAI;QACFA,iBAAiB,MAAMC,YAAE,CAACC,QAAQ,CAACN,qBAAqB;QACxD,uDAAuD;QACvD,MAAMO,KAAKH,eAAeI,OAAO,CAAC,MAAM,+BAA+B,GAAG;QAE1E,IAAID,OAAO,CAAC,GAAG;YACb,IAAIH,cAAc,CAACG,KAAK,EAAE,KAAK,MAAM;gBACnCN,MAAM;YACR,OAAO;gBACLA,MAAM;YACR;QACF;IACF,EAAE,OAAM,CAAC;IAET;;;;;GAKC,GACD,MAAMQ,aAAuB;QAC3B,oCAAoC;QACpC,CAAC,sBAAsB,EAAEpB,SAAS,IAAI,CAAC;KACxC;IAED,IAAIQ,qBAAqB;QACvBY,WAAWC,IAAI,CAAC,CAAC,sBAAsB,EAAErB,SAAS,uBAAuB,CAAC;IAC5E;IAEA,IAAIU,aAAaD,aAAa;QAC5BW,WAAWC,IAAI,CACb,CAAC,sBAAsB,EAAErB,SAAS,uCAAuC,CAAC;IAE9E;IAEA,MAAMsB,iBAAiBpB,aAAI,CAACqB,KAAK,CAACpB,IAAI,CACpCI,QAAQiB,UAAU,CAACtB,aAAI,CAACuB,KAAK,CAACC,GAAG,EAAExB,aAAI,CAACqB,KAAK,CAACG,GAAG,GACjD;IAGF,mFAAmF;IACnFN,WAAWC,IAAI,CAAC,CAAC,UAAU,EAAEC,eAAe,EAAE,CAAC;IAE/C,sBAAsB;IACtBF,WAAWC,IAAI,CACb,IACA,2CACA,CAAC,+BAA+B,EAAEX,YAAY,QAAQ,QAAQ,sDAAsD,CAAC;IAGvH,MAAMiB,UAAUP,WAAWjB,IAAI,CAACS,OAAOA;IAEvC,+CAA+C;IAC/C,IAAIG,mBAAmBY,SAAS;QAC9B;IACF;IACA,MAAMX,YAAE,CAACY,SAAS,CAACjB,qBAAqBgB;AAC1C","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/lib/typescript/writeAppTypeDeclarations.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport { promises as fs } from 'fs'\n\n// Read package name dynamically to support forked packages\n// From dist/lib/typescript, go up 3 levels to reach package root\nconst PKG_NAME = require(path.join(__dirname, '../../../package.json')).name\n\nexport async function writeAppTypeDeclarations({\n baseDir,\n distDir,\n imageImportsEnabled,\n hasPagesDir,\n hasAppDir,\n}: {\n baseDir: string\n distDir: string\n imageImportsEnabled: boolean\n hasPagesDir: boolean\n hasAppDir: boolean\n}): Promise<void> {\n // Reference `next` types\n const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts')\n\n // Defaults EOL to system default\n let eol = os.EOL\n let currentContent: string | undefined\n\n try {\n currentContent = await fs.readFile(appTypeDeclarations, 'utf8')\n // If file already exists then preserve its line ending\n const lf = currentContent.indexOf('\\n', /* skip first so we can lf - 1 */ 1)\n\n if (lf !== -1) {\n if (currentContent[lf - 1] === '\\r') {\n eol = '\\r\\n'\n } else {\n eol = '\\n'\n }\n }\n } catch {}\n\n /**\n * \"Triple-slash directives\" used to create typings files for Next.js projects\n * using Typescript .\n *\n * @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html\n */\n const directives: string[] = [\n // Include the core Next.js typings.\n `/// <reference types=\"${PKG_NAME}\" />`,\n ]\n\n if (imageImportsEnabled) {\n directives.push(`/// <reference types=\"${PKG_NAME}/image-types/global\" />`)\n }\n\n if (hasAppDir && hasPagesDir) {\n directives.push(\n `/// <reference types=\"${PKG_NAME}/navigation-types/compat/navigation\" />`\n )\n }\n\n const routeTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/routes.d.ts'\n )\n\n // Use ESM import instead of triple-slash reference for better ESLint compatibility\n directives.push(`import \"./${routeTypesPath}\";`)\n\n // Push the notice in.\n directives.push(\n '',\n '// NOTE: This file should not be edited',\n `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`\n )\n\n const content = directives.join(eol) + eol\n\n // Avoids an un-necessary write on read-only fs\n if (currentContent === content) {\n return\n }\n await fs.writeFile(appTypeDeclarations, content)\n}\n"],"names":["writeAppTypeDeclarations","PKG_NAME","require","path","join","__dirname","name","baseDir","distDir","imageImportsEnabled","hasPagesDir","hasAppDir","appTypeDeclarations","eol","os","EOL","currentContent","fs","readFile","lf","indexOf","directives","push","routeTypesPath","posix","replaceAll","win32","sep","content","writeFile"],"mappings":";;;;+BAQsBA;;;eAAAA;;;2DARP;6DACE;oBACc;;;;;;AAE/B,2DAA2D;AAC3D,iEAAiE;AACjE,MAAMC,WAAWC,QAAQC,aAAI,CAACC,IAAI,CAACC,WAAW,0BAA0BC,IAAI;AAErE,eAAeN,yBAAyB,EAC7CO,OAAO,EACPC,OAAO,E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;IACA,MAAMX,YAAE,CAACY,SAAS,CAACjB,qBAAqBgB;AAC1C","ignoreList":[0]}
@@ -25,6 +25,7 @@ const _picocolors = require("../picocolors");
25
25
  const _commentjson = /*#__PURE__*/ _interop_require_wildcard(require("next/dist/compiled/comment-json"));
26
26
  const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver"));
27
27
  const _os = /*#__PURE__*/ _interop_require_default(require("os"));
28
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
28
29
  const _getTypeScriptConfiguration = require("./getTypeScriptConfiguration");
29
30
  const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log"));
30
31
  function _interop_require_default(obj) {
@@ -73,6 +74,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
73
74
  }
74
75
  return newObj;
75
76
  }
77
+ // Read package name dynamically to support forked packages
78
+ // From dist/lib/typescript, go up 3 levels to reach package root
79
+ const PKG_NAME = require(_path.default.join(__dirname, '../../../package.json')).name;
76
80
  function getDesiredCompilerOptions(ts, tsOptions) {
77
81
  const o = {
78
82
  target: {
@@ -285,6 +289,31 @@ async function writeConfigurationDefaults(ts, tsConfigPath, isFirstTimeSetup, ha
285
289
  suggestedActions.push((0, _picocolors.cyan)('strictNullChecks') + ' was set to ' + (0, _picocolors.bold)(`true`));
286
290
  }
287
291
  }
292
+ // If the package name is not 'next', add a path mapping to redirect 'next' imports
293
+ // to the actual package name. This is necessary for forked packages.
294
+ if (PKG_NAME !== 'next') {
295
+ if (!userTsConfig.compilerOptions) {
296
+ userTsConfig.compilerOptions = {};
297
+ }
298
+ if (!userTsConfig.compilerOptions.paths) {
299
+ userTsConfig.compilerOptions.paths = {};
300
+ }
301
+ // Add path mapping for 'next' and 'next/*' to redirect to the actual package
302
+ const nextMapping = `${PKG_NAME}`;
303
+ const nextWildcardMapping = `${PKG_NAME}/*`;
304
+ if (!userTsConfig.compilerOptions.paths['next']) {
305
+ userTsConfig.compilerOptions.paths['next'] = [
306
+ nextMapping
307
+ ];
308
+ suggestedActions.push((0, _picocolors.cyan)('paths["next"]') + ' was set to ' + (0, _picocolors.bold)(`["${nextMapping}"]`) + ' (for forked package support)');
309
+ }
310
+ if (!userTsConfig.compilerOptions.paths['next/*']) {
311
+ userTsConfig.compilerOptions.paths['next/*'] = [
312
+ nextWildcardMapping
313
+ ];
314
+ suggestedActions.push((0, _picocolors.cyan)('paths["next/*"]') + ' was set to ' + (0, _picocolors.bold)(`["${nextWildcardMapping}"]`) + ' (for forked package support)');
315
+ }
316
+ }
288
317
  if (!('exclude' in rawConfig)) {
289
318
  userTsConfig.exclude = [
290
319
  'node_modules'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { bold, cyan, white } from '../picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport type { CompilerOptions } from 'typescript'\nimport { getTypeScriptConfiguration } from './getTypeScriptConfiguration'\nimport * as Log from '../../build/output/log'\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array<any>\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n ts: typeof import('typescript'),\n tsOptions?: CompilerOptions\n): DesiredCompilerOptionsShape {\n const o: DesiredCompilerOptionsShape = {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n ...(semver.lt(ts.version, '5.0.0')\n ? { forceConsistentCasingInFileNames: { suggested: true } }\n : undefined),\n noEmit: { suggested: true },\n ...(semver.gte(ts.version, '4.4.2')\n ? { incremental: { suggested: true } }\n : undefined),\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: ts.ModuleKind.ESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(ts.version, '5.4.0') && (ts.ModuleKind as any).Preserve,\n ts.ModuleKind.ES2020,\n ts.ModuleKind.ESNext,\n ts.ModuleKind.CommonJS,\n ts.ModuleKind.AMD,\n ts.ModuleKind.NodeNext,\n ts.ModuleKind.Node16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(ts.version, '5.4.0') &&\n tsOptions?.module === (ts.ModuleKind as any).Preserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n // In TypeScript 5.0, `NodeJs` has renamed to `Node10`\n parsedValue:\n ts.ModuleResolutionKind.Bundler ??\n ts.ModuleResolutionKind.NodeNext ??\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // All of these values work:\n parsedValues: [\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n (ts.ModuleResolutionKind as any).Node12,\n ts.ModuleResolutionKind.Node16,\n ts.ModuleResolutionKind.NodeNext,\n ts.ModuleResolutionKind.Bundler,\n ].filter((val) => typeof val !== 'undefined'),\n value: 'node',\n reason: 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(tsOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: ts.JsxEmit.ReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n }\n\n return o\n}\n\nexport function getRequiredConfiguration(\n ts: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n res[optionKey] = ev.parsedValue ?? ev.value\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n ts: typeof import('typescript'),\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean\n): Promise<void> {\n if (isFirstTimeSetup) {\n await fs.writeFile(tsConfigPath, '{}' + os.EOL)\n }\n\n const { options: tsOptions, raw: rawConfig } =\n await getTypeScriptConfiguration(ts, tsConfigPath, true)\n\n const userTsConfigContent = await fs.readFile(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n if (userTsConfig.compilerOptions == null && !('extends' in rawConfig)) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts, tsOptions)\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in tsOptions)) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n const ev = tsOptions[optionKey]\n if (\n !('parsedValues' in check\n ? check.parsedValues?.includes(ev)\n : 'parsedValue' in check\n ? check.parsedValue === ev\n : check.value === ev)\n ) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = check\n }\n }\n\n const nextAppTypes = `${distDir}/types/**/*.ts`\n\n if (!('include' in rawConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', nextAppTypes, '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', '${nextAppTypes}', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir && !rawConfig.include.includes(nextAppTypes)) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n // rawConfig will resolve all extends and include paths (ex: tsconfig.json, tsconfig.base.json, etc.)\n // if it doesn't match userTsConfig then update the userTsConfig to add the\n // rawConfig's includes in addition to nextAppTypes\n if (\n rawConfig.include.length !== userTsConfig.include.length ||\n JSON.stringify(rawConfig.include.sort()) !==\n JSON.stringify(userTsConfig.include.sort())\n ) {\n userTsConfig.include.push(...rawConfig.include, nextAppTypes)\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n `[${[...rawConfig.include, nextAppTypes]\n .map((i) => `'${i}'`)\n .join(', ')}]`\n )\n )\n } else {\n userTsConfig.include.push(nextAppTypes)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${nextAppTypes}'`)\n )\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(tsOptions.plugins) ? tsOptions.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in rawConfig &&\n (!rawConfig.compilerOptions || !rawConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !tsOptions.strict &&\n !('strictNullChecks' in tsOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n if (!('exclude' in rawConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n await fs.writeFile(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["getRequiredConfiguration","writeConfigurationDefaults","getDesiredCompilerOptions","ts","tsOptions","o","target","suggested","reason","lib","allowJs","skipLibCheck","strict","semver","lt","version","forceConsistentCasingInFileNames","undefined","noEmit","gte","incremental","module","parsedValue","ModuleKind","ESNext","parsedValues","Preserve","ES2020","CommonJS","AMD","NodeNext","Node16","value","esModuleInterop","moduleResolution","ModuleResolutionKind","Bundler","Node10","NodeJs","Node12","filter","val","resolveJsonModule","verbatimModuleSyntax","isolatedModules","jsx","JsxEmit","ReactJSX","res","desiredCompilerOptions","optionKey","Object","keys","ev","localDevTestFilesExcludeAction","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","userTsConfig","fs","writeFile","os","EOL","options","raw","rawConfig","getTypeScriptConfiguration","userTsConfigContent","readFile","encoding","CommentJson","parse","compilerOptions","suggestedActions","requiredActions","check","push","cyan","bold","includes","_","nextAppTypes","include","Array","isArray","length","JSON","stringify","sort","map","i","join","plugins","hasNextPlugin","some","name","Log","info","strictNullChecks","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","forEach","action","requiredActionsToBeLogged","white"],"mappings":";;;;;;;;;;;;;;;IAyHgBA,wBAAwB;eAAxBA;;IAoBMC,0BAA0B;eAA1BA;;;oBA7IS;4BACG;qEACL;+DACV;2DACJ;4CAE4B;6DACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAarB,SAASC,0BACPC,EAA+B,EAC/BC,SAA2B;IAE3B,MAAMC,IAAiC;QACrCC,QAAQ;YACNC,WAAW;YACXC,QACE;QACJ;QACA,qEAAqE;QACrE,gBAAgB;QAChBC,KAAK;YAAEF,WAAW;gBAAC;gBAAO;gBAAgB;aAAS;QAAC;QACpDG,SAAS;YAAEH,WAAW;QAAK;QAC3BI,cAAc;YAAEJ,WAAW;QAAK;QAChCK,QAAQ;YAAEL,WAAW;QAAM;QAC3B,GAAIM,eAAM,CAACC,EAAE,CAACX,GAAGY,OAAO,EAAE,WACtB;YAAEC,kCAAkC;gBAAET,WAAW;YAAK;QAAE,IACxDU,SAAS;QACbC,QAAQ;YAAEX,WAAW;QAAK;QAC1B,GAAIM,eAAM,CAACM,GAAG,CAAChB,GA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C,IAAI,CACN,CAAC,6DAA6D,EAAEpB,IAAAA,gBAAI,EAClE,iBACA,cAAc,EACdnB,EAAAA,gCAAAA,aAAac,eAAe,qBAA5Bd,8BAA8BhD,MAAM,IAChC,KACA,CAAC,uBAAuB,EAAEmE,IAAAA,gBAAI,EAAC,SAAS,YAAY,CAAC,EACzD;IAGJ,IAAIJ,iBAAiBY,MAAM,EAAE;QAC3BW,KAAIC,IAAI,CACN,CAAC,kDAAkD,EAAEpB,IAAAA,gBAAI,EACvD,iBACA,eAAe,EAAEA,IAAAA,gBAAI,EAAC,kBAAkB,+BAA+B,CAAC;QAG5EJ,iBAAiBiC,OAAO,CAAC,CAACC,SAAWX,KAAIC,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAE7DX,KAAIC,IAAI,CAAC;IACX;IAEA,MAAMW,4BAA4BR,QAAQC,GAAG,CAACC,sBAAsB,GAChE5B,gBAAgBpC,MAAM,CACpB,CAACqE,SAAWA,WAAWvD,kCAEzBsB;IAEJ,IAAIkC,0BAA0BvB,MAAM,EAAE;QACpCW,KAAIC,IAAI,CACN,CAAC,cAAc,EAAEY,IAAAA,iBAAK,EAAC,qBAAqB,mBAAmB,EAAEhC,IAAAA,gBAAI,EACnE,iBACA,GAAG,CAAC;QAGR+B,0BAA0BF,OAAO,CAAC,CAACC,SAAWX,KAAIC,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAEtEX,KAAIC,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { bold, cyan, white } from '../picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport path from 'path'\nimport type { CompilerOptions } from 'typescript'\nimport { getTypeScriptConfiguration } from './getTypeScriptConfiguration'\nimport * as Log from '../../build/output/log'\n\n// Read package name dynamically to support forked packages\n// From dist/lib/typescript, go up 3 levels to reach package root\nconst PKG_NAME = require(path.join(__dirname, '../../../package.json')).name\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array<any>\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n ts: typeof import('typescript'),\n tsOptions?: CompilerOptions\n): DesiredCompilerOptionsShape {\n const o: DesiredCompilerOptionsShape = {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n ...(semver.lt(ts.version, '5.0.0')\n ? { forceConsistentCasingInFileNames: { suggested: true } }\n : undefined),\n noEmit: { suggested: true },\n ...(semver.gte(ts.version, '4.4.2')\n ? { incremental: { suggested: true } }\n : undefined),\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: ts.ModuleKind.ESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(ts.version, '5.4.0') && (ts.ModuleKind as any).Preserve,\n ts.ModuleKind.ES2020,\n ts.ModuleKind.ESNext,\n ts.ModuleKind.CommonJS,\n ts.ModuleKind.AMD,\n ts.ModuleKind.NodeNext,\n ts.ModuleKind.Node16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(ts.version, '5.4.0') &&\n tsOptions?.module === (ts.ModuleKind as any).Preserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n // In TypeScript 5.0, `NodeJs` has renamed to `Node10`\n parsedValue:\n ts.ModuleResolutionKind.Bundler ??\n ts.ModuleResolutionKind.NodeNext ??\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // All of these values work:\n parsedValues: [\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n (ts.ModuleResolutionKind as any).Node12,\n ts.ModuleResolutionKind.Node16,\n ts.ModuleResolutionKind.NodeNext,\n ts.ModuleResolutionKind.Bundler,\n ].filter((val) => typeof val !== 'undefined'),\n value: 'node',\n reason: 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(tsOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: ts.JsxEmit.ReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n }\n\n return o\n}\n\nexport function getRequiredConfiguration(\n ts: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n res[optionKey] = ev.parsedValue ?? ev.value\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n ts: typeof import('typescript'),\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean\n): Promise<void> {\n if (isFirstTimeSetup) {\n await fs.writeFile(tsConfigPath, '{}' + os.EOL)\n }\n\n const { options: tsOptions, raw: rawConfig } =\n await getTypeScriptConfiguration(ts, tsConfigPath, true)\n\n const userTsConfigContent = await fs.readFile(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n if (userTsConfig.compilerOptions == null && !('extends' in rawConfig)) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts, tsOptions)\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in tsOptions)) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n const ev = tsOptions[optionKey]\n if (\n !('parsedValues' in check\n ? check.parsedValues?.includes(ev)\n : 'parsedValue' in check\n ? check.parsedValue === ev\n : check.value === ev)\n ) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = check\n }\n }\n\n const nextAppTypes = `${distDir}/types/**/*.ts`\n\n if (!('include' in rawConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', nextAppTypes, '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', '${nextAppTypes}', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir && !rawConfig.include.includes(nextAppTypes)) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n // rawConfig will resolve all extends and include paths (ex: tsconfig.json, tsconfig.base.json, etc.)\n // if it doesn't match userTsConfig then update the userTsConfig to add the\n // rawConfig's includes in addition to nextAppTypes\n if (\n rawConfig.include.length !== userTsConfig.include.length ||\n JSON.stringify(rawConfig.include.sort()) !==\n JSON.stringify(userTsConfig.include.sort())\n ) {\n userTsConfig.include.push(...rawConfig.include, nextAppTypes)\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n `[${[...rawConfig.include, nextAppTypes]\n .map((i) => `'${i}'`)\n .join(', ')}]`\n )\n )\n } else {\n userTsConfig.include.push(nextAppTypes)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${nextAppTypes}'`)\n )\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(tsOptions.plugins) ? tsOptions.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in rawConfig &&\n (!rawConfig.compilerOptions || !rawConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !tsOptions.strict &&\n !('strictNullChecks' in tsOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n // If the package name is not 'next', add a path mapping to redirect 'next' imports\n // to the actual package name. This is necessary for forked packages.\n if (PKG_NAME !== 'next') {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n if (!userTsConfig.compilerOptions.paths) {\n userTsConfig.compilerOptions.paths = {}\n }\n\n // Add path mapping for 'next' and 'next/*' to redirect to the actual package\n const nextMapping = `${PKG_NAME}`\n const nextWildcardMapping = `${PKG_NAME}/*`\n\n if (!userTsConfig.compilerOptions.paths['next']) {\n userTsConfig.compilerOptions.paths['next'] = [nextMapping]\n suggestedActions.push(\n cyan('paths[\"next\"]') + ' was set to ' + bold(`[\"${nextMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n\n if (!userTsConfig.compilerOptions.paths['next/*']) {\n userTsConfig.compilerOptions.paths['next/*'] = [nextWildcardMapping]\n suggestedActions.push(\n cyan('paths[\"next/*\"]') + ' was set to ' + bold(`[\"${nextWildcardMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n }\n\n if (!('exclude' in rawConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n await fs.writeFile(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["getRequiredConfiguration","writeConfigurationDefaults","PKG_NAME","require","path","join","__dirname","name","getDesiredCompilerOptions","ts","tsOptions","o","target","suggested","reason","lib","allowJs","skipLibCheck","strict","semver","lt","version","forceConsistentCasingInFileNames","undefined","noEmit","gte","incremental","module","parsedValue","ModuleKind","ESNext","parsedValues","Preserve","ES2020","CommonJS","AMD","NodeNext","Node16","value","esModuleInterop","moduleResolution","ModuleResolutionKind","Bundler","Node10","NodeJs","Node12","filter","val","resolveJsonModule","verbatimModuleSyntax","isolatedModules","jsx","JsxEmit","ReactJSX","res","desiredCompilerOptions","optionKey","Object","keys","ev","localDevTestFilesExcludeAction","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","userTsConfig","fs","writeFile","os","EOL","options","raw","rawConfig","getTypeScriptConfiguration","userTsConfigContent","readFile","encoding","CommentJson","parse","compilerOptions","suggestedActions","requiredActions","check","push","cyan","bold","includes","_","nextAppTypes","include","Array","isArray","length","JSON","stringify","sort","map","i","plugins","hasNextPlugin","some","Log","info","strictNullChecks","paths","nextMapping","nextWildcardMapping","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","forEach","action","requiredActionsToBeLogged","white"],"mappings":";;;;;;;;;;;;;;;IA8HgBA,wBAAwB;eAAxBA;;IAoBMC,0BAA0B;eAA1BA;;;oBAlJS;4BACG;qEACL;+DACV;2DACJ;6DACE;4CAE0B;6DACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,2DAA2D;AAC3D,iEAAiE;AACjE,MAAMC,WAAWC,QAAQC,aAAI,CAACC,IAAI,CAACC,WAAW,0BAA0BC,IAAI;AAa5E,SAASC,0BACPC,EAA+B,EAC/BC,SAA2B;IAE3B,MAAMC,IAAiC;QACrCC,QAAQ;YACNC,WAAW;YACXC,QACE;QACJ;QACA,qEAAqE;QACrE,gBAAgB;QAChBC,KAAK;YAAEF,WAAW;gBAAC;gBAAO;gBAAgB;aAAS;QAAC;QACpDG,SAAS;YAAEH,WAAW;QAAK;QAC3BI,cAAc;YAAEJ,WAAW;QAAK;QAChCK,QAAQ;YAAEL,WAAW;QAAM;QAC3B,GAAIM,eAAM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