next 16.1.1-canary.13 → 16.1.1-canary.14
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.
- package/dist/.build-commit +1 -1
- package/dist/bin/next +2 -2
- package/dist/build/index.js +3 -3
- package/dist/build/swc/index.js +1 -1
- package/dist/build/type-check.js +4 -3
- package/dist/build/type-check.js.map +1 -1
- package/dist/build/webpack-config.js +3 -3
- package/dist/bundle-analyzer/404.html +2 -2
- package/dist/bundle-analyzer/__next.__PAGE__.txt +1 -1
- package/dist/bundle-analyzer/__next._full.txt +1 -1
- package/dist/bundle-analyzer/__next._head.txt +1 -1
- package/dist/bundle-analyzer/__next._index.txt +1 -1
- package/dist/bundle-analyzer/__next._tree.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._full.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._head.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._index.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._not-found.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._tree.txt +1 -1
- package/dist/bundle-analyzer/_not-found.html +2 -2
- package/dist/bundle-analyzer/_not-found.txt +1 -1
- package/dist/bundle-analyzer/index.html +2 -2
- package/dist/bundle-analyzer/index.txt +1 -1
- package/dist/cli/next-test.js +2 -1
- package/dist/cli/next-test.js.map +1 -1
- package/dist/cli/next-typegen.js +4 -2
- package/dist/cli/next-typegen.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/type-check.js +4 -3
- package/dist/esm/build/type-check.js.map +1 -1
- package/dist/esm/build/webpack-config.js +3 -3
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/lib/typescript/writeAppTypeDeclarations.js +18 -10
- package/dist/esm/lib/typescript/writeAppTypeDeclarations.js.map +1 -1
- package/dist/esm/lib/typescript/writeConfigurationDefaults.js +8 -7
- package/dist/esm/lib/typescript/writeConfigurationDefaults.js.map +1 -1
- package/dist/esm/lib/verify-typescript-setup.js +5 -4
- package/dist/esm/lib/verify-typescript-setup.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/router-utils/route-types-utils.js +0 -20
- package/dist/esm/server/lib/router-utils/route-types-utils.js.map +1 -1
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +3 -8
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
- package/dist/esm/server/lib/router-utils/typegen.js +7 -11
- package/dist/esm/server/lib/router-utils/typegen.js.map +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/lib/typescript/writeAppTypeDeclarations.d.ts +3 -3
- package/dist/lib/typescript/writeAppTypeDeclarations.js +18 -10
- package/dist/lib/typescript/writeAppTypeDeclarations.js.map +1 -1
- package/dist/lib/typescript/writeConfigurationDefaults.d.ts +1 -1
- package/dist/lib/typescript/writeConfigurationDefaults.js +8 -7
- package/dist/lib/typescript/writeConfigurationDefaults.js.map +1 -1
- package/dist/lib/verify-typescript-setup.d.ts +3 -3
- package/dist/lib/verify-typescript-setup.js +5 -4
- package/dist/lib/verify-typescript-setup.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/router-utils/route-types-utils.d.ts +0 -9
- package/dist/server/lib/router-utils/route-types-utils.js +0 -17
- package/dist/server/lib/router-utils/route-types-utils.js.map +1 -1
- package/dist/server/lib/router-utils/setup-dev-bundler.js +2 -7
- package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
- package/dist/server/lib/router-utils/typegen.js +7 -11
- package/dist/server/lib/router-utils/typegen.js.map +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
- /package/dist/bundle-analyzer/_next/static/{bo6zOIZ5tUP7aVRjeqElS → mqnk7CZQ-0CmHbCRF2ua6}/_buildManifest.js +0 -0
- /package/dist/bundle-analyzer/_next/static/{bo6zOIZ5tUP7aVRjeqElS → mqnk7CZQ-0CmHbCRF2ua6}/_clientMiddlewareManifest.json +0 -0
- /package/dist/bundle-analyzer/_next/static/{bo6zOIZ5tUP7aVRjeqElS → mqnk7CZQ-0CmHbCRF2ua6}/_ssgManifest.js +0 -0
package/dist/esm/build/index.js
CHANGED
|
@@ -305,7 +305,7 @@ export default async function build(dir, experimentalAnalyze = false, reactProdu
|
|
|
305
305
|
try {
|
|
306
306
|
const nextBuildSpan = trace('next-build', undefined, {
|
|
307
307
|
buildMode: experimentalBuildMode,
|
|
308
|
-
version: "16.1.1-canary.
|
|
308
|
+
version: "16.1.1-canary.14"
|
|
309
309
|
});
|
|
310
310
|
NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
311
311
|
NextBuildContext.dir = dir;
|
|
@@ -803,7 +803,7 @@ export default async function build(dir, experimentalAnalyze = false, reactProdu
|
|
|
803
803
|
// Files outside of the distDir can be "type": "module"
|
|
804
804
|
await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
805
805
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
806
|
-
await recordFrameworkVersion("16.1.1-canary.
|
|
806
|
+
await recordFrameworkVersion("16.1.1-canary.14");
|
|
807
807
|
await updateBuildDiagnostics({
|
|
808
808
|
buildStage: 'start'
|
|
809
809
|
});
|
|
@@ -2478,7 +2478,7 @@ export default async function build(dir, experimentalAnalyze = false, reactProdu
|
|
|
2478
2478
|
configOutDir: path.join(dir, configOutDir),
|
|
2479
2479
|
staticPages,
|
|
2480
2480
|
serverPropsPages,
|
|
2481
|
-
nextVersion: "16.1.1-canary.
|
|
2481
|
+
nextVersion: "16.1.1-canary.14",
|
|
2482
2482
|
tracingRoot: outputFileTracingRoot,
|
|
2483
2483
|
hasNodeMiddleware,
|
|
2484
2484
|
hasInstrumentationHook,
|
|
@@ -10,7 +10,7 @@ import { downloadNativeNextSwc, downloadWasmSwc } from '../../lib/download-swc';
|
|
|
10
10
|
import { isDeepStrictEqual } from 'util';
|
|
11
11
|
import { getDefineEnv } from '../define-env';
|
|
12
12
|
import { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error';
|
|
13
|
-
const nextVersion = "16.1.1-canary.
|
|
13
|
+
const nextVersion = "16.1.1-canary.14";
|
|
14
14
|
const ArchName = arch();
|
|
15
15
|
const PlatformName = platform();
|
|
16
16
|
function infoLog(...args) {
|
|
@@ -11,7 +11,7 @@ import { hrtimeDurationToString } from './duration-to-string';
|
|
|
11
11
|
* Since it is impossible to pass a function from main thread to a worker,
|
|
12
12
|
* instead of running "next/lib/typescript/runTypeCheck" in a worker,
|
|
13
13
|
* we will run entire "next/lib/verify-typescript-setup" in a worker instead.
|
|
14
|
-
*/ function verifyTypeScriptSetup(dir, distDir,
|
|
14
|
+
*/ function verifyTypeScriptSetup(dir, distDir, strictRouteTypes, typeCheckPreflight, tsconfigPath, typedRoutes, disableStaticImages, cacheDir, enableWorkerThreads, hasAppDir, hasPagesDir, isolatedDevBuild, appDir, pagesDir, debugBuildPaths) {
|
|
15
15
|
const typeCheckWorker = new Worker(require.resolve('../lib/verify-typescript-setup'), {
|
|
16
16
|
exposedMethods: [
|
|
17
17
|
'verifyTypeScriptSetup'
|
|
@@ -25,9 +25,10 @@ import { hrtimeDurationToString } from './duration-to-string';
|
|
|
25
25
|
return typeCheckWorker.verifyTypeScriptSetup({
|
|
26
26
|
dir,
|
|
27
27
|
distDir,
|
|
28
|
-
|
|
28
|
+
strictRouteTypes,
|
|
29
29
|
typeCheckPreflight,
|
|
30
30
|
tsconfigPath,
|
|
31
|
+
typedRoutes,
|
|
31
32
|
disableStaticImages,
|
|
32
33
|
cacheDir,
|
|
33
34
|
hasAppDir,
|
|
@@ -61,7 +62,7 @@ export async function startTypeChecking({ cacheDir, config, dir, nextBuildSpan,
|
|
|
61
62
|
const typeCheckAndLintStart = process.hrtime();
|
|
62
63
|
try {
|
|
63
64
|
var _createSpinner;
|
|
64
|
-
const [verifyResult, typeCheckEnd] = await nextBuildSpan.traceChild('run-typescript').traceAsyncFn(()=>verifyTypeScriptSetup(dir, config.distDir, config.
|
|
65
|
+
const [verifyResult, typeCheckEnd] = await nextBuildSpan.traceChild('run-typescript').traceAsyncFn(()=>verifyTypeScriptSetup(dir, config.distDir, Boolean(config.experimental.strictRouteTypes), !ignoreTypeScriptErrors, config.typescript.tsconfigPath, Boolean(config.typedRoutes), config.images.disableStaticImages, cacheDir, config.experimental.workerThreads, !!appDir, !!pagesDir, config.experimental.isolatedDevBuild, appDir, pagesDir, debugBuildPaths).then((resolved)=>{
|
|
65
66
|
const checkEnd = process.hrtime(typeCheckAndLintStart);
|
|
66
67
|
return [
|
|
67
68
|
resolved,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/build/type-check.ts"],"sourcesContent":["import type { NextConfigComplete } from '../server/config-shared'\nimport type { Telemetry } from '../telemetry/storage'\nimport type { Span } from '../trace'\n\nimport * as Log from './output/log'\nimport { Worker } from '../lib/worker'\nimport createSpinner from './spinner'\nimport { eventTypeCheckCompleted } from '../telemetry/events'\nimport isError from '../lib/is-error'\nimport { hrtimeDurationToString } from './duration-to-string'\n\n/**\n * typescript will be loaded in \"next/lib/verify-typescript-setup\" and\n * then passed to \"next/lib/typescript/runTypeCheck\" as a parameter.\n *\n * Since it is impossible to pass a function from main thread to a worker,\n * instead of running \"next/lib/typescript/runTypeCheck\" in a worker,\n * we will run entire \"next/lib/verify-typescript-setup\" in a worker instead.\n */\nfunction verifyTypeScriptSetup(\n dir: string,\n distDir: string,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/build/type-check.ts"],"sourcesContent":["import type { NextConfigComplete } from '../server/config-shared'\nimport type { Telemetry } from '../telemetry/storage'\nimport type { Span } from '../trace'\n\nimport * as Log from './output/log'\nimport { Worker } from '../lib/worker'\nimport createSpinner from './spinner'\nimport { eventTypeCheckCompleted } from '../telemetry/events'\nimport isError from '../lib/is-error'\nimport { hrtimeDurationToString } from './duration-to-string'\n\n/**\n * typescript will be loaded in \"next/lib/verify-typescript-setup\" and\n * then passed to \"next/lib/typescript/runTypeCheck\" as a parameter.\n *\n * Since it is impossible to pass a function from main thread to a worker,\n * instead of running \"next/lib/typescript/runTypeCheck\" in a worker,\n * we will run entire \"next/lib/verify-typescript-setup\" in a worker instead.\n */\nfunction verifyTypeScriptSetup(\n dir: string,\n distDir: string,\n strictRouteTypes: boolean,\n typeCheckPreflight: boolean,\n tsconfigPath: string | undefined,\n typedRoutes: boolean,\n disableStaticImages: boolean,\n cacheDir: string | undefined,\n enableWorkerThreads: boolean | undefined,\n hasAppDir: boolean,\n hasPagesDir: boolean,\n isolatedDevBuild: boolean | undefined,\n appDir: string | undefined,\n pagesDir: string | undefined,\n debugBuildPaths: { app?: string[]; pages?: string[] } | undefined\n) {\n const typeCheckWorker = new Worker(\n require.resolve('../lib/verify-typescript-setup'),\n {\n exposedMethods: ['verifyTypeScriptSetup'],\n debuggerPortOffset: -1,\n isolatedMemory: false,\n numWorkers: 1,\n enableWorkerThreads,\n maxRetries: 0,\n }\n ) as Worker & {\n verifyTypeScriptSetup: typeof import('../lib/verify-typescript-setup').verifyTypeScriptSetup\n }\n\n return typeCheckWorker\n .verifyTypeScriptSetup({\n dir,\n distDir,\n strictRouteTypes,\n typeCheckPreflight,\n tsconfigPath,\n typedRoutes,\n disableStaticImages,\n cacheDir,\n hasAppDir,\n hasPagesDir,\n isolatedDevBuild,\n appDir,\n pagesDir,\n debugBuildPaths,\n })\n .then((result) => {\n typeCheckWorker.end()\n return result\n })\n .catch(() => {\n // The error is already logged in the worker, we simply exit the main thread to prevent the\n // `Jest worker encountered 1 child process exceptions, exceeding retry limit` from showing up\n process.exit(1)\n })\n}\n\nexport async function startTypeChecking({\n cacheDir,\n config,\n dir,\n nextBuildSpan,\n pagesDir,\n telemetry,\n appDir,\n debugBuildPaths,\n}: {\n cacheDir: string\n config: NextConfigComplete\n dir: string\n nextBuildSpan: Span\n pagesDir?: string\n telemetry: Telemetry\n appDir?: string\n debugBuildPaths?: { app?: string[]; pages?: string[] }\n}) {\n const ignoreTypeScriptErrors = Boolean(config.typescript.ignoreBuildErrors)\n\n if (ignoreTypeScriptErrors) {\n Log.info('Skipping validation of types')\n }\n\n let typeCheckingSpinnerPrefixText: string | undefined\n let typeCheckingSpinner: ReturnType<typeof createSpinner> | undefined\n\n if (!ignoreTypeScriptErrors) {\n typeCheckingSpinnerPrefixText = 'Running TypeScript'\n }\n\n if (typeCheckingSpinnerPrefixText) {\n typeCheckingSpinner = createSpinner(typeCheckingSpinnerPrefixText)\n }\n\n const typeCheckAndLintStart = process.hrtime()\n\n try {\n const [verifyResult, typeCheckEnd] = await nextBuildSpan\n .traceChild('run-typescript')\n .traceAsyncFn(() =>\n verifyTypeScriptSetup(\n dir,\n config.distDir,\n Boolean(config.experimental.strictRouteTypes),\n !ignoreTypeScriptErrors,\n config.typescript.tsconfigPath,\n Boolean(config.typedRoutes),\n config.images.disableStaticImages,\n cacheDir,\n config.experimental.workerThreads,\n !!appDir,\n !!pagesDir,\n config.experimental.isolatedDevBuild,\n appDir,\n pagesDir,\n debugBuildPaths\n ).then((resolved) => {\n const checkEnd = process.hrtime(typeCheckAndLintStart)\n return [resolved, checkEnd] as const\n })\n )\n\n if (typeCheckingSpinner) {\n typeCheckingSpinner.stop()\n }\n\n createSpinner(\n `Finished TypeScript${ignoreTypeScriptErrors ? ' config validation' : ''} in ${hrtimeDurationToString(typeCheckEnd)}`\n )?.stopAndPersist()\n\n if (!ignoreTypeScriptErrors && verifyResult) {\n telemetry.record(\n eventTypeCheckCompleted({\n durationInSeconds: typeCheckEnd[0],\n typescriptVersion: verifyResult.version,\n inputFilesCount: verifyResult.result?.inputFilesCount,\n totalFilesCount: verifyResult.result?.totalFilesCount,\n incremental: verifyResult.result?.incremental,\n })\n )\n }\n } catch (err) {\n // prevent showing jest-worker internal error as it\n // isn't helpful for users and clutters output\n if (isError(err) && err.message === 'Call retries were exceeded') {\n await telemetry.flush()\n process.exit(1)\n }\n throw err\n }\n}\n"],"names":["Log","Worker","createSpinner","eventTypeCheckCompleted","isError","hrtimeDurationToString","verifyTypeScriptSetup","dir","distDir","strictRouteTypes","typeCheckPreflight","tsconfigPath","typedRoutes","disableStaticImages","cacheDir","enableWorkerThreads","hasAppDir","hasPagesDir","isolatedDevBuild","appDir","pagesDir","debugBuildPaths","typeCheckWorker","require","resolve","exposedMethods","debuggerPortOffset","isolatedMemory","numWorkers","maxRetries","then","result","end","catch","process","exit","startTypeChecking","config","nextBuildSpan","telemetry","ignoreTypeScriptErrors","Boolean","typescript","ignoreBuildErrors","info","typeCheckingSpinnerPrefixText","typeCheckingSpinner","typeCheckAndLintStart","hrtime","verifyResult","typeCheckEnd","traceChild","traceAsyncFn","experimental","images","workerThreads","resolved","checkEnd","stop","stopAndPersist","record","durationInSeconds","typescriptVersion","version","inputFilesCount","totalFilesCount","incremental","err","message","flush"],"mappings":"AAIA,YAAYA,SAAS,eAAc;AACnC,SAASC,MAAM,QAAQ,gBAAe;AACtC,OAAOC,mBAAmB,YAAW;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AA8B;YAChE,MAAM7B,UAAU8B,KAAK;YACrBnC,QAAQC,IAAI,CAAC;QACf;QACA,MAAMgC;IACR;AACF","ignoreList":[0]}
|
|
@@ -1622,7 +1622,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1622
1622
|
isClient && new CopyFilePlugin({
|
|
1623
1623
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1624
1624
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1625
|
-
cacheKey: "16.1.1-canary.
|
|
1625
|
+
cacheKey: "16.1.1-canary.14",
|
|
1626
1626
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1627
1627
|
minimize: false,
|
|
1628
1628
|
info: {
|
|
@@ -1816,7 +1816,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1816
1816
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1817
1817
|
// - Next.js version
|
|
1818
1818
|
// - next.config.js keys that affect compilation
|
|
1819
|
-
version: `${__dirname}|${"16.1.1-canary.
|
|
1819
|
+
version: `${__dirname}|${"16.1.1-canary.14"}|${configVars}`,
|
|
1820
1820
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
|
1821
1821
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1822
1822
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -1872,7 +1872,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1872
1872
|
type: 'filesystem',
|
|
1873
1873
|
directory: cache.cacheDirectory
|
|
1874
1874
|
},
|
|
1875
|
-
version: `${__dirname}|${"16.1.1-canary.
|
|
1875
|
+
version: `${__dirname}|${"16.1.1-canary.14"}|${configVars}`
|
|
1876
1876
|
};
|
|
1877
1877
|
}
|
|
1878
1878
|
if (process.env.NEXT_WEBPACK_LOGGING) {
|
|
@@ -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 = "16.1.1-canary.
|
|
8
|
+
const version = "16.1.1-canary.14";
|
|
9
9
|
window.next = {
|
|
10
10
|
version,
|
|
11
11
|
appDir: true
|
package/dist/esm/client/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
|
|
|
25
25
|
import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
|
|
26
26
|
import tracer from './tracing/tracer';
|
|
27
27
|
import { isNextRouterError } from './components/is-next-router-error';
|
|
28
|
-
export const version = "16.1.1-canary.
|
|
28
|
+
export const version = "16.1.1-canary.14";
|
|
29
29
|
export let router;
|
|
30
30
|
export const emitter = mitt();
|
|
31
31
|
const looseToArray = (input)=>[].slice.call(input);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { promises as fs } from 'fs';
|
|
4
|
-
export async function writeAppTypeDeclarations({ baseDir, distDir,
|
|
4
|
+
export async function writeAppTypeDeclarations({ baseDir, distDir, imageImportsEnabled, hasPagesDir, hasAppDir, strictRouteTypes, typedRoutes }) {
|
|
5
5
|
// Reference `next` types
|
|
6
6
|
const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts');
|
|
7
7
|
// Defaults EOL to system default
|
|
@@ -24,24 +24,32 @@ export async function writeAppTypeDeclarations({ baseDir, distDir, distDirRoot,
|
|
|
24
24
|
* using Typescript .
|
|
25
25
|
*
|
|
26
26
|
* @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html
|
|
27
|
-
*/ const
|
|
27
|
+
*/ const lines = [
|
|
28
28
|
// Include the core Next.js typings.
|
|
29
29
|
'/// <reference types="next" />'
|
|
30
30
|
];
|
|
31
31
|
if (imageImportsEnabled) {
|
|
32
|
-
|
|
32
|
+
lines.push('/// <reference types="next/image-types/global" />');
|
|
33
33
|
}
|
|
34
34
|
if (hasAppDir && hasPagesDir) {
|
|
35
|
-
|
|
35
|
+
lines.push('/// <reference types="next/navigation-types/compat/navigation" />');
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
const stableDistDir = (distDirRoot ?? distDir).replaceAll(path.win32.sep, path.posix.sep);
|
|
39
|
-
const routeTypesPath = path.posix.join(stableDistDir, 'types/routes.d.ts');
|
|
37
|
+
const routeTypesPath = path.posix.join(distDir.replaceAll(path.win32.sep, path.posix.sep), 'types/routes.d.ts');
|
|
40
38
|
// Use ESM import instead of triple-slash reference for better ESLint compatibility
|
|
41
|
-
|
|
39
|
+
lines.push(`import "./${routeTypesPath}";`);
|
|
40
|
+
if (strictRouteTypes) {
|
|
41
|
+
const cacheLifePath = path.posix.join(distDir.replaceAll(path.win32.sep, path.posix.sep), 'types/cache-life.d.ts');
|
|
42
|
+
lines.push(`import "./${cacheLifePath}";`);
|
|
43
|
+
const routeValidatorPath = path.posix.join(distDir.replaceAll(path.win32.sep, path.posix.sep), 'types/validator.ts');
|
|
44
|
+
lines.push(`import "./${routeValidatorPath}";`);
|
|
45
|
+
if (typedRoutes === true) {
|
|
46
|
+
const linkTypesPath = path.posix.join(distDir.replaceAll(path.win32.sep, path.posix.sep), 'types/link.d.ts');
|
|
47
|
+
lines.push(`import "./${linkTypesPath}";`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
// Push the notice in.
|
|
43
|
-
|
|
44
|
-
const content =
|
|
51
|
+
lines.push('', '// NOTE: This file should not be edited', `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`);
|
|
52
|
+
const content = lines.join(eol) + eol;
|
|
45
53
|
// Avoids an un-necessary write on read-only fs
|
|
46
54
|
if (currentContent === content) {
|
|
47
55
|
return;
|
|
@@ -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\nexport async function writeAppTypeDeclarations({\n baseDir,\n distDir,\n
|
|
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\nexport async function writeAppTypeDeclarations({\n baseDir,\n distDir,\n imageImportsEnabled,\n hasPagesDir,\n hasAppDir,\n strictRouteTypes,\n typedRoutes,\n}: {\n baseDir: string\n distDir: string\n imageImportsEnabled: boolean\n hasPagesDir: boolean\n hasAppDir: boolean\n strictRouteTypes: boolean\n typedRoutes: 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 lines: string[] = [\n // Include the core Next.js typings.\n '/// <reference types=\"next\" />',\n ]\n\n if (imageImportsEnabled) {\n lines.push('/// <reference types=\"next/image-types/global\" />')\n }\n\n if (hasAppDir && hasPagesDir) {\n lines.push(\n '/// <reference types=\"next/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 lines.push(`import \"./${routeTypesPath}\";`)\n\n if (strictRouteTypes) {\n const cacheLifePath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/cache-life.d.ts'\n )\n lines.push(`import \"./${cacheLifePath}\";`)\n\n const routeValidatorPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/validator.ts'\n )\n lines.push(`import \"./${routeValidatorPath}\";`)\n\n if (typedRoutes === true) {\n const linkTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/link.d.ts'\n )\n lines.push(`import \"./${linkTypesPath}\";`)\n }\n }\n\n // Push the notice in.\n lines.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 = lines.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","writeAppTypeDeclarations","baseDir","distDir","imageImportsEnabled","hasPagesDir","hasAppDir","strictRouteTypes","typedRoutes","appTypeDeclarations","join","eol","EOL","currentContent","readFile","lf","indexOf","lines","push","routeTypesPath","posix","replaceAll","win32","sep","cacheLifePath","routeValidatorPath","linkTypesPath","content","writeFile"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,YAAYC,EAAE,QAAQ,KAAI;AAEnC,OAAO,eAAeC,yBAAyB,EAC7CC,OAAO,EACPC,OAAO,EACPC,mBAAmB,EACnBC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,WAAW,EASZ;IACC,yBAAyB;IACzB,MAAMC,sBAAsBX,KAAKY,IAAI,CAACR,SAAS;IAE/C,iCAAiC;IACjC,IAAIS,MAAMd,GAAGe,GAAG;IAChB,IAAIC;IAEJ,IAAI;QACFA,iBAAiB,MAAMb,GAAGc,QAAQ,CAACL,qBAAqB;QACxD,uDAAuD;QACvD,MAAMM,KAAKF,eAAeG,OAAO,CAAC,MAAM,+BAA+B,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AAc,EAAE,CAAC;QAC3C;IACF;IAEA,sBAAsB;IACtBT,MAAMC,IAAI,CACR,IACA,2CACA,CAAC,+BAA+B,EAAEZ,YAAY,QAAQ,QAAQ,sDAAsD,CAAC;IAGvH,MAAMqB,UAAUV,MAAMP,IAAI,CAACC,OAAOA;IAElC,+CAA+C;IAC/C,IAAIE,mBAAmBc,SAAS;QAC9B;IACF;IACA,MAAM3B,GAAG4B,SAAS,CAACnB,qBAAqBkB;AAC1C","ignoreList":[0]}
|
|
@@ -156,7 +156,7 @@ export function getRequiredConfiguration(typescript) {
|
|
|
156
156
|
return res;
|
|
157
157
|
}
|
|
158
158
|
const localDevTestFilesExcludeAction = 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE';
|
|
159
|
-
export async function writeConfigurationDefaults(typescriptVersion, tsConfigPath, isFirstTimeSetup, hasAppDir, distDir, hasPagesDir, isolatedDevBuild) {
|
|
159
|
+
export async function writeConfigurationDefaults(typescriptVersion, tsConfigPath, isFirstTimeSetup, hasAppDir, distDir, hasPagesDir, isolatedDevBuild, strictRouteTypes) {
|
|
160
160
|
var _userTsConfig_compilerOptions;
|
|
161
161
|
if (isFirstTimeSetup) {
|
|
162
162
|
writeFileSync(tsConfigPath, '{}' + os.EOL);
|
|
@@ -215,11 +215,11 @@ export async function writeConfigurationDefaults(typescriptVersion, tsConfigPath
|
|
|
215
215
|
const resolvedIsolatedDevBuild = isolatedDevBuild === undefined ? defaultConfig.experimental.isolatedDevBuild : isolatedDevBuild;
|
|
216
216
|
// Get type definition glob patterns using shared utility to ensure consistency
|
|
217
217
|
// with other TypeScript infrastructure (e.g., runTypeCheck.ts)
|
|
218
|
-
const
|
|
218
|
+
const nextTypes = getTypeDefinitionGlobPatterns(distDir, resolvedIsolatedDevBuild);
|
|
219
219
|
if (!('include' in userTsConfig)) {
|
|
220
|
-
|
|
220
|
+
const defaultInclude = hasAppDir && !strictRouteTypes ? [
|
|
221
221
|
'next-env.d.ts',
|
|
222
|
-
...
|
|
222
|
+
...nextTypes,
|
|
223
223
|
'**/*.mts',
|
|
224
224
|
'**/*.ts',
|
|
225
225
|
'**/*.tsx'
|
|
@@ -229,10 +229,11 @@ export async function writeConfigurationDefaults(typescriptVersion, tsConfigPath
|
|
|
229
229
|
'**/*.ts',
|
|
230
230
|
'**/*.tsx'
|
|
231
231
|
];
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
userTsConfig.include = defaultInclude;
|
|
233
|
+
suggestedActions.push(cyan('include') + ' was set to [' + bold(defaultInclude.map((type)=>`'${type}'`).join(', ')) + ']');
|
|
234
|
+
} else if (hasAppDir && !strictRouteTypes) {
|
|
234
235
|
const missingFromResolved = [];
|
|
235
|
-
for (const type of
|
|
236
|
+
for (const type of nextTypes){
|
|
236
237
|
if (!userTsConfig.include.includes(type)) {
|
|
237
238
|
missingFromResolved.push(type);
|
|
238
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { readFileSync, writeFileSync } 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 { getTypeDefinitionGlobPatterns } from './type-paths'\nimport * as Log from '../../build/output/log'\nimport { defaultConfig } from '../../server/config-shared'\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 typescriptVersion: string,\n userTsConfig?: Record<string, any>\n): DesiredCompilerOptionsShape {\n // ModuleKind\n const moduleKindESNext = 'esnext'\n const moduleKindES2020 = 'es2020'\n const moduleKindPreserve = 'preserve'\n const moduleKindNodeNext = 'nodenext'\n const moduleKindNode16 = 'node16'\n const moduleKindCommonJS = 'commonjs'\n const moduleKindAMD = 'amd'\n\n // ModuleResolutionKind\n const moduleResolutionKindBundler = 'bundler'\n const moduleResolutionKindNode10 = 'node10'\n const moduleResolutionKindNode12 = 'node12'\n const moduleResolutionKindNodeJs = 'node'\n\n // Jsx\n const jsxEmitReactJSX = 'react-jsx'\n\n return {\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 noEmit: { suggested: true },\n incremental: { suggested: true },\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: moduleKindESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(typescriptVersion, '5.4.0') && moduleKindPreserve,\n moduleKindES2020,\n moduleKindESNext,\n moduleKindCommonJS,\n moduleKindAMD,\n moduleKindNodeNext,\n moduleKindNode16,\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(typescriptVersion, '5.4.0') &&\n userTsConfig?.compilerOptions?.module?.toLowerCase() === moduleKindPreserve\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: moduleResolutionKindBundler,\n // All of these values work:\n parsedValues: [\n moduleResolutionKindNode10,\n moduleResolutionKindNodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n moduleResolutionKindNode12,\n moduleKindNode16,\n moduleKindNodeNext,\n moduleResolutionKindBundler,\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 ...(userTsConfig?.compilerOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: jsxEmitReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n } satisfies DesiredCompilerOptionsShape\n}\n\nexport function getRequiredConfiguration(\n typescript: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n const typescriptVersion = typescript.version\n\n const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n\n const value = ev.parsedValue ?? ev.value\n\n // Convert string values back to TypeScript enum values\n if (optionKey === 'module' && typeof value === 'string') {\n const moduleMap: Record<string, import('typescript').ModuleKind> = {\n esnext: typescript.ModuleKind.ESNext,\n es2020: typescript.ModuleKind.ES2020,\n ...(typescript.ModuleKind.Preserve !== undefined\n ? { preserve: typescript.ModuleKind.Preserve }\n : {}),\n nodenext: typescript.ModuleKind.NodeNext,\n node16: typescript.ModuleKind.Node16,\n commonjs: typescript.ModuleKind.CommonJS,\n amd: typescript.ModuleKind.AMD,\n }\n res[optionKey] = moduleMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'moduleResolution' && typeof value === 'string') {\n const moduleResolutionMap: Record<\n string,\n import('typescript').ModuleResolutionKind\n > = {\n bundler: typescript.ModuleResolutionKind.Bundler,\n node10: typescript.ModuleResolutionKind.Node10,\n node12: (typescript.ModuleResolutionKind as any).Node12,\n node: typescript.ModuleResolutionKind.NodeJs,\n }\n res[optionKey] = moduleResolutionMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'jsx' && typeof value === 'string') {\n const jsxMap: Record<string, import('typescript').JsxEmit> = {\n 'react-jsx': typescript.JsxEmit.ReactJSX,\n }\n res[optionKey] = jsxMap[value.toLowerCase()] ?? value\n } else {\n res[optionKey] = value\n }\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n typescriptVersion: string,\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean,\n isolatedDevBuild: boolean | undefined\n): Promise<void> {\n if (isFirstTimeSetup) {\n writeFileSync(tsConfigPath, '{}' + os.EOL)\n }\n\n const userTsConfigContent = readFileSync(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n\n // Bail automatic setup when the user has extended or referenced another config\n if ('extends' in userTsConfig || 'references' in userTsConfig) {\n return\n }\n\n if (userTsConfig?.compilerOptions == null) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(\n typescriptVersion,\n userTsConfig\n )\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey in desiredCompilerOptions) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in userTsConfig?.compilerOptions)) {\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 let existingValue = userTsConfig?.compilerOptions?.[optionKey]\n\n if (typeof existingValue === 'string') {\n existingValue = existingValue.toLowerCase()\n }\n\n const shouldWriteRequiredValue = () => {\n // Check if the option has multiple allowed values\n if (check.parsedValues) {\n return !check.parsedValues.includes(existingValue)\n }\n\n // Check if the option has a single parsed value\n if (check.parsedValue) {\n return check.parsedValue !== existingValue\n }\n\n // Fall back to direct value comparison\n return check.value !== existingValue\n }\n\n if (shouldWriteRequiredValue()) {\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 const _: never = check\n }\n }\n\n const resolvedIsolatedDevBuild =\n isolatedDevBuild === undefined\n ? defaultConfig.experimental.isolatedDevBuild\n : isolatedDevBuild\n\n // Get type definition glob patterns using shared utility to ensure consistency\n // with other TypeScript infrastructure (e.g., runTypeCheck.ts)\n const nextAppTypes = getTypeDefinitionGlobPatterns(\n distDir,\n resolvedIsolatedDevBuild\n )\n\n if (!('include' in userTsConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', ...nextAppTypes, '**/*.mts', '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.mts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', ${nextAppTypes.map((type) => `'${type}'`).join(', ')}, '**/*.mts', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.mts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir) {\n const missingFromResolved = []\n for (const type of nextAppTypes) {\n if (!userTsConfig.include.includes(type)) {\n missingFromResolved.push(type)\n }\n }\n\n if (missingFromResolved.length > 0) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n\n missingFromResolved.forEach((item) => {\n userTsConfig.include.push(item)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${item}'`)\n )\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(userTsConfig?.plugins) ? userTsConfig.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 userTsConfig &&\n (!userTsConfig.compilerOptions ||\n !userTsConfig.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 !userTsConfig?.compilerOptions?.strict &&\n !('strictNullChecks' in userTsConfig?.compilerOptions)\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 userTsConfig)) {\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 writeFileSync(\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":["readFileSync","writeFileSync","bold","cyan","white","CommentJson","semver","os","getTypeDefinitionGlobPatterns","Log","defaultConfig","getDesiredCompilerOptions","typescriptVersion","userTsConfig","moduleKindESNext","moduleKindES2020","moduleKindPreserve","moduleKindNodeNext","moduleKindNode16","moduleKindCommonJS","moduleKindAMD","moduleResolutionKindBundler","moduleResolutionKindNode10","moduleResolutionKindNode12","moduleResolutionKindNodeJs","jsxEmitReactJSX","target","suggested","reason","lib","allowJs","skipLibCheck","strict","noEmit","incremental","module","parsedValue","parsedValues","gte","value","compilerOptions","toLowerCase","esModuleInterop","moduleResolution","filter","val","resolveJsonModule","verbatimModuleSyntax","undefined","isolatedModules","jsx","getRequiredConfiguration","typescript","res","version","desiredCompilerOptions","optionKey","Object","keys","ev","moduleMap","esnext","ModuleKind","ESNext","es2020","ES2020","Preserve","preserve","nodenext","NodeNext","node16","Node16","commonjs","CommonJS","amd","AMD","moduleResolutionMap","bundler","ModuleResolutionKind","Bundler","node10","Node10","node12","Node12","node","NodeJs","jsxMap","JsxEmit","ReactJSX","localDevTestFilesExcludeAction","writeConfigurationDefaults","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","isolatedDevBuild","EOL","userTsConfigContent","encoding","parse","suggestedActions","requiredActions","check","push","existingValue","shouldWriteRequiredValue","includes","_","resolvedIsolatedDevBuild","experimental","nextAppTypes","include","map","type","join","missingFromResolved","length","Array","isArray","forEach","item","plugins","hasNextPlugin","some","name","info","strictNullChecks","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","stringify","action","requiredActionsToBeLogged"],"mappings":"AAAA,SAASA,YAAY,EAAEC,aAAa,QAAQ,KAAI;AAChD,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;AACjD,YAAYC,iBAAiB,kCAAiC;AAC9D,OAAOC,YAAY,4BAA2B;AAC9C,OAAOC,QAAQ,KAAI;AAEnB,SAASC,6BAA6B,QAAQ,eAAc;AAC5D,YAAYC,SAAS,yBAAwB;AAC7C,SAASC,aAAa,QAAQ,6BAA4B;AAa1D,SAASC,0BACPC,iBAAyB,EACzBC,YAAkC;QAuDhCA,sCAAAA,+BAmCIA;IAxFN,aAAa;IACb,MAAMC,mBAAmB;IACzB,MAAMC,mBAAmB;IACzB,MAAMC,q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,CAACgB,SAAW/H,IAAIqH,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAE7D/H,IAAIqH,IAAI,CAAC;IACX;IAEA,MAAMW,4BAA4BR,QAAQC,GAAG,CAACC,sBAAsB,GAChE7B,gBAAgB1D,MAAM,CACpB,CAAC4F,SAAWA,WAAW/C,kCAEzBa;IAEJ,IAAImC,0BAA0BpB,MAAM,EAAE;QACpC5G,IAAIqH,IAAI,CACN,CAAC,cAAc,EAAE1H,MAAM,qBAAqB,mBAAmB,EAAED,KAC/D,iBACA,GAAG,CAAC;QAGRsI,0BAA0BjB,OAAO,CAAC,CAACgB,SAAW/H,IAAIqH,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAEtE/H,IAAIqH,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { readFileSync, writeFileSync } 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 { getTypeDefinitionGlobPatterns } from './type-paths'\nimport * as Log from '../../build/output/log'\nimport { defaultConfig } from '../../server/config-shared'\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 typescriptVersion: string,\n userTsConfig?: Record<string, any>\n): DesiredCompilerOptionsShape {\n // ModuleKind\n const moduleKindESNext = 'esnext'\n const moduleKindES2020 = 'es2020'\n const moduleKindPreserve = 'preserve'\n const moduleKindNodeNext = 'nodenext'\n const moduleKindNode16 = 'node16'\n const moduleKindCommonJS = 'commonjs'\n const moduleKindAMD = 'amd'\n\n // ModuleResolutionKind\n const moduleResolutionKindBundler = 'bundler'\n const moduleResolutionKindNode10 = 'node10'\n const moduleResolutionKindNode12 = 'node12'\n const moduleResolutionKindNodeJs = 'node'\n\n // Jsx\n const jsxEmitReactJSX = 'react-jsx'\n\n return {\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 noEmit: { suggested: true },\n incremental: { suggested: true },\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: moduleKindESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(typescriptVersion, '5.4.0') && moduleKindPreserve,\n moduleKindES2020,\n moduleKindESNext,\n moduleKindCommonJS,\n moduleKindAMD,\n moduleKindNodeNext,\n moduleKindNode16,\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(typescriptVersion, '5.4.0') &&\n userTsConfig?.compilerOptions?.module?.toLowerCase() === moduleKindPreserve\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: moduleResolutionKindBundler,\n // All of these values work:\n parsedValues: [\n moduleResolutionKindNode10,\n moduleResolutionKindNodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n moduleResolutionKindNode12,\n moduleKindNode16,\n moduleKindNodeNext,\n moduleResolutionKindBundler,\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 ...(userTsConfig?.compilerOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: jsxEmitReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n } satisfies DesiredCompilerOptionsShape\n}\n\nexport function getRequiredConfiguration(\n typescript: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n const typescriptVersion = typescript.version\n\n const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n\n const value = ev.parsedValue ?? ev.value\n\n // Convert string values back to TypeScript enum values\n if (optionKey === 'module' && typeof value === 'string') {\n const moduleMap: Record<string, import('typescript').ModuleKind> = {\n esnext: typescript.ModuleKind.ESNext,\n es2020: typescript.ModuleKind.ES2020,\n ...(typescript.ModuleKind.Preserve !== undefined\n ? { preserve: typescript.ModuleKind.Preserve }\n : {}),\n nodenext: typescript.ModuleKind.NodeNext,\n node16: typescript.ModuleKind.Node16,\n commonjs: typescript.ModuleKind.CommonJS,\n amd: typescript.ModuleKind.AMD,\n }\n res[optionKey] = moduleMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'moduleResolution' && typeof value === 'string') {\n const moduleResolutionMap: Record<\n string,\n import('typescript').ModuleResolutionKind\n > = {\n bundler: typescript.ModuleResolutionKind.Bundler,\n node10: typescript.ModuleResolutionKind.Node10,\n node12: (typescript.ModuleResolutionKind as any).Node12,\n node: typescript.ModuleResolutionKind.NodeJs,\n }\n res[optionKey] = moduleResolutionMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'jsx' && typeof value === 'string') {\n const jsxMap: Record<string, import('typescript').JsxEmit> = {\n 'react-jsx': typescript.JsxEmit.ReactJSX,\n }\n res[optionKey] = jsxMap[value.toLowerCase()] ?? value\n } else {\n res[optionKey] = value\n }\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n typescriptVersion: string,\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean,\n isolatedDevBuild: boolean | undefined,\n strictRouteTypes: boolean\n): Promise<void> {\n if (isFirstTimeSetup) {\n writeFileSync(tsConfigPath, '{}' + os.EOL)\n }\n\n const userTsConfigContent = readFileSync(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n\n // Bail automatic setup when the user has extended or referenced another config\n if ('extends' in userTsConfig || 'references' in userTsConfig) {\n return\n }\n\n if (userTsConfig?.compilerOptions == null) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(\n typescriptVersion,\n userTsConfig\n )\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey in desiredCompilerOptions) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in userTsConfig?.compilerOptions)) {\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 let existingValue = userTsConfig?.compilerOptions?.[optionKey]\n\n if (typeof existingValue === 'string') {\n existingValue = existingValue.toLowerCase()\n }\n\n const shouldWriteRequiredValue = () => {\n // Check if the option has multiple allowed values\n if (check.parsedValues) {\n return !check.parsedValues.includes(existingValue)\n }\n\n // Check if the option has a single parsed value\n if (check.parsedValue) {\n return check.parsedValue !== existingValue\n }\n\n // Fall back to direct value comparison\n return check.value !== existingValue\n }\n\n if (shouldWriteRequiredValue()) {\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 const _: never = check\n }\n }\n\n const resolvedIsolatedDevBuild =\n isolatedDevBuild === undefined\n ? defaultConfig.experimental.isolatedDevBuild\n : isolatedDevBuild\n\n // Get type definition glob patterns using shared utility to ensure consistency\n // with other TypeScript infrastructure (e.g., runTypeCheck.ts)\n const nextTypes = getTypeDefinitionGlobPatterns(\n distDir,\n resolvedIsolatedDevBuild\n )\n\n if (!('include' in userTsConfig)) {\n const defaultInclude =\n hasAppDir && !strictRouteTypes\n ? ['next-env.d.ts', ...nextTypes, '**/*.mts', '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.mts', '**/*.ts', '**/*.tsx']\n\n userTsConfig.include = defaultInclude\n suggestedActions.push(\n cyan('include') +\n ' was set to [' +\n bold(defaultInclude.map((type) => `'${type}'`).join(', ')) +\n ']'\n )\n } else if (hasAppDir && !strictRouteTypes) {\n const missingFromResolved = []\n for (const type of nextTypes) {\n if (!userTsConfig.include.includes(type)) {\n missingFromResolved.push(type)\n }\n }\n\n if (missingFromResolved.length > 0) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n\n missingFromResolved.forEach((item) => {\n userTsConfig.include.push(item)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${item}'`)\n )\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(userTsConfig?.plugins) ? userTsConfig.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 userTsConfig &&\n (!userTsConfig.compilerOptions ||\n !userTsConfig.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 !userTsConfig?.compilerOptions?.strict &&\n !('strictNullChecks' in userTsConfig?.compilerOptions)\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 userTsConfig)) {\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 writeFileSync(\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":["readFileSync","writeFileSync","bold","cyan","white","CommentJson","semver","os","getTypeDefinitionGlobPatterns","Log","defaultConfig","getDesiredCompilerOptions","typescriptVersion","userTsConfig","moduleKindESNext","moduleKindES2020","moduleKindPreserve","moduleKindNodeNext","moduleKindNode16","moduleKindCommonJS","moduleKindAMD","moduleResolutionKindBundler","moduleResolutionKindNode10","moduleResolutionKindNode12","moduleResolutionKindNodeJs","jsxEmitReactJSX","target","suggested","reason","lib","allowJs","skipLibCheck","strict","noEmit","incremental","module","parsedValue","parsedValues","gte","value","compilerOptions","toLowerCase","esModuleInterop","moduleResolution","filter","val","resolveJsonModule","verbatimModuleSyntax","undefined","isolatedModules","jsx","getRequiredConfiguration","typescript","res","version","desiredCompilerOptions","optionKey","Object","keys","ev","moduleMap","esnext","ModuleKind","ESNext","es2020","ES2020","Preserve","preserve","nodenext","NodeNext","node16","Node16","commonjs","CommonJS","amd","AMD","moduleResolutionMap","bundler","ModuleResolutionKind","Bundler","node10","Node10","node12","Node12","node","NodeJs","jsxMap","JsxEmit","ReactJSX","localDevTestFilesExcludeAction","writeConfigurationDefaults","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","isolatedDevBuild","strictRouteTypes","EOL","userTsConfigContent","encoding","parse","suggestedActions","requiredActions","check","push","existingValue","shouldWriteRequiredValue","includes","_","resolvedIsolatedDevBuild","experimental","nextTypes","defaultInclude","include","map","type","join","missingFromResolved","length","Array","isArray","forEach","item","plugins","hasNextPlugin","some","name","info","strictNullChecks","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","stringify","action","requiredActionsToBeLogged"],"mappings":"AAAA,SAASA,YAAY,EAAEC,aAAa,QAAQ,KAAI;AAChD,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;AACjD,YAAYC,iBAAiB,kCAAiC;AAC9D,OAAOC,YAAY,4BAA2B;AAC9C,OAAOC,QAAQ,KAAI;AAEnB,SAASC,6BAA6B,QAAQ,eAAc;AAC5D,YAAYC,SAAS,yBAAwB;AAC7C,SAASC,aAAa,QAAQ,6BAA4B;AAa1D,SAASC,0BACPC,iBAAyB,EACzBC,YAAkC;QAuDhCA,sCAAAA,+BAmCIA;IAxFN,aAAa;IACb,MAAMC,mBAAmB;IACzB,MAAMC,mBAAmB;IACzB,MAAMC,qBAAqB;IAC3B,MAAMC,qBAAqB;IAC3B,MAAMC,mBAAmB;IACzB,MAAMC,qBAAqB;IAC3B,MAAMC,gBAAgB;IAEtB,u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I,CAAC;IACX;IAEA,MAAMW,4BAA4BR,QAAQC,GAAG,CAACC,sBAAsB,GAChE9B,gBAAgB3D,MAAM,CACpB,CAAC8F,SAAWA,WAAWjD,kCAEzBc;IAEJ,IAAIoC,0BAA0BpB,MAAM,EAAE;QACpC9G,IAAIuH,IAAI,CACN,CAAC,cAAc,EAAE5H,MAAM,qBAAqB,mBAAmB,EAAED,KAC/D,iBACA,GAAG,CAAC;QAGRwI,0BAA0BjB,OAAO,CAAC,CAACgB,SAAWjI,IAAIuH,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAEtEjI,IAAIuH,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
|
|
@@ -27,7 +27,7 @@ const requiredPackages = [
|
|
|
27
27
|
exportsRestrict: true
|
|
28
28
|
}
|
|
29
29
|
];
|
|
30
|
-
export async function verifyTypeScriptSetup({ dir, distDir,
|
|
30
|
+
export async function verifyTypeScriptSetup({ dir, distDir, cacheDir, strictRouteTypes, tsconfigPath, typeCheckPreflight, typedRoutes, disableStaticImages, hasAppDir, hasPagesDir, isolatedDevBuild, appDir, pagesDir, debugBuildPaths }) {
|
|
31
31
|
const tsConfigFileName = tsconfigPath || 'tsconfig.json';
|
|
32
32
|
const resolvedTsConfigPath = path.join(dir, tsConfigFileName);
|
|
33
33
|
// Construct intentDirs from appDir and pagesDir for getTypeScriptIntent
|
|
@@ -69,16 +69,17 @@ export async function verifyTypeScriptSetup({ dir, distDir, distDirRoot, cacheDi
|
|
|
69
69
|
log.warn(`Minimum recommended TypeScript version is v5.1.0, older versions can potentially be incompatible with Next.js. Detected: ${typescriptVersion}`);
|
|
70
70
|
}
|
|
71
71
|
// Reconfigure (or create) the user's `tsconfig.json` for them:
|
|
72
|
-
await writeConfigurationDefaults(typescriptVersion, resolvedTsConfigPath, intent.firstTimeSetup, hasAppDir, distDir, hasPagesDir, isolatedDevBuild);
|
|
72
|
+
await writeConfigurationDefaults(typescriptVersion, resolvedTsConfigPath, intent.firstTimeSetup, hasAppDir, distDir, hasPagesDir, isolatedDevBuild, strictRouteTypes);
|
|
73
73
|
// Write out the necessary `next-env.d.ts` file to correctly register
|
|
74
74
|
// Next.js' types:
|
|
75
75
|
await writeAppTypeDeclarations({
|
|
76
76
|
baseDir: dir,
|
|
77
77
|
distDir,
|
|
78
|
-
distDirRoot,
|
|
79
78
|
imageImportsEnabled: !disableStaticImages,
|
|
80
79
|
hasPagesDir,
|
|
81
|
-
hasAppDir
|
|
80
|
+
hasAppDir,
|
|
81
|
+
strictRouteTypes,
|
|
82
|
+
typedRoutes
|
|
82
83
|
});
|
|
83
84
|
let result;
|
|
84
85
|
if (typeCheckPreflight) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path, { join } from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n distDirRoot,\n cacheDir,\n tsconfigPath,\n typeCheckPreflight,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n isolatedDevBuild,\n appDir,\n pagesDir,\n debugBuildPaths,\n}: {\n dir: string\n distDir: string\n /** The original distDir before any modifications (e.g., for isolatedDevBuild). */\n distDirRoot?: string\n cacheDir?: string\n tsconfigPath: string | undefined\n typeCheckPreflight: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n isolatedDevBuild: boolean | undefined\n appDir?: string\n pagesDir?: string\n debugBuildPaths?: { app?: string[]; pages?: string[] }\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const tsConfigFileName = tsconfigPath || 'tsconfig.json'\n const resolvedTsConfigPath = path.join(dir, tsConfigFileName)\n\n // Construct intentDirs from appDir and pagesDir for getTypeScriptIntent\n const intentDirs = [pagesDir, appDir].filter(Boolean) as string[]\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsConfigFileName)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n if (deps.missing?.length > 0) {\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, deps.missing)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, deps.missing, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPackageJsonPath = deps.resolved.get(\n join('typescript', 'package.json')\n )!\n const typescriptPackageJson = require(tsPackageJsonPath)\n\n const typescriptVersion = typescriptPackageJson.version\n\n if (semver.lt(typescriptVersion, '5.1.0')) {\n log.warn(\n `Minimum recommended TypeScript version is v5.1.0, older versions can potentially be incompatible with Next.js. Detected: ${typescriptVersion}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n typescriptVersion,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir,\n isolatedDevBuild\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n distDirRoot,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n\n const tsPath = deps.resolved.get('typescript')!\n const typescript = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n typescript,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir,\n isolatedDevBuild,\n { app: appDir, pages: pagesDir },\n debugBuildPaths\n )\n }\n return { result, version: typescriptVersion }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.IS_NEXT_WORKER) {\n if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n process.exit(1)\n }\n // we are in the main thread, throw the error and it will be handled by the caller\n throw err\n }\n}\n"],"names":["bold","cyan","red","yellow","path","join","hasNecessaryDependencies","semver","CompileError","log","getTypeScriptIntent","writeAppTypeDeclarations","writeConfigurationDefaults","installDependencies","isCI","missingDepsError","requiredPackages","file","pkg","exportsRestrict","verifyTypeScriptSetup","dir","distDir","distDirRoot","cacheDir","tsconfigPath","typeCheckPreflight","disableStaticImages","hasAppDir","hasPagesDir","isolatedDevBuild","appDir","pagesDir","debugBuildPaths","tsConfigFileName","resolvedTsConfigPath","intentDirs","filter","Boolean","deps","intent","version","missing","length","console","catch","err","error","command","tsPackageJsonPath","resolved","get","typescriptPackageJson","require","typescriptVersion","lt","warn","firstTimeSetup","baseDir","imageImportsEnabled","result","runTypeCheck","tsPath","typescript","Promise","resolve","app","pages","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,QAAQ,eAAc;AACtD,OAAOC,QAAQC,IAAI,QAAQ,OAAM;AAEjC,SAASC,wBAAwB,QAAQ,+BAA8B;AAEvE,OAAOC,YAAY,4BAA2B;AAC9C,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,YAAYC,SAAS,sBAAqB;AAE1C,SAASC,mBAAmB,QAAQ,mCAAkC;AAEtE,SAASC,wBAAwB,QAAQ,wCAAuC;AAChF,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,SAASC,IAAI,QAAQ,oBAAmB;AACxC,SAASC,gBAAgB,QAAQ,sCAAqC;AAEtE,MAAMC,mBAAmB;IACvB;QACEC,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;IACA;QACEF,MAAM;QACNC,KAAK;QACLC,iBAAiB;IACnB;CACD;AAED,OAAO,eAAeC,sBAAsB,EAC1CC,GAAG,EACHC,OAAO,EACPC,WAAW,EACXC,QAAQ,EACRC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB,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I+C,IAAI,CACN,CAAC,yHAAyH,EAAEF,mBAAmB;QAEnJ;QAEA,+DAA+D;QAC/D,MAAM1C,2BACJ0C,mBACAnB,sBACAK,OAAOiB,cAAc,EACrB7B,WACAN,SACAO,aACAC;QAEF,qEAAqE;QACrE,kBAAkB;QAClB,MAAMnB,yBAAyB;YAC7B+C,SAASrC;YACTC;YACAC;YACAoC,qBAAqB,CAAChC;YACtBE;YACAD;QACF;QAEA,IAAIgC;QACJ,IAAIlC,oBAAoB;YACtB,MAAM,EAAEmC,YAAY,EAAE,GACpBR,QAAQ;YAEV,MAAMS,SAASvB,KAAKW,QAAQ,CAACC,GAAG,CAAC;YACjC,MAAMY,aAAc,MAAMC,QAAQC,OAAO,CACvCZ,QAAQS;YAGV,yEAAyE;YACzEF,SAAS,MAAMC,aACbE,YACA1C,KACAC,SACAa,sBACAX,UACAI,WACAE,kBACA;gBAAEoC,KAAKnC;gBAAQoC,OAAOnC;YAAS,GAC/BC;QAEJ;QACA,OAAO;YAAE2B;YAAQnB,SAASa;QAAkB;IAC9C,EAAE,OAAOR,KAAK;QACZ,+DAA+D;QAC/D,IAAIA,eAAetC,cAAc;YAC/BoC,QAAQG,KAAK,CAAC7C,IAAI;YAClB0C,QAAQG,KAAK,CAACD,IAAIsB,OAAO;YACzBC,QAAQC,IAAI,CAAC;QACf;QAEA;;;;KAIC,GAED,mEAAmE;QACnE,IAAID,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC9B,IAAI1B,eAAe2B,OAAO;gBACxB7B,QAAQG,KAAK,CAACD,IAAIsB,OAAO;YAC3B,OAAO;gBACLxB,QAAQG,KAAK,CAACD;YAChB;YACAuB,QAAQC,IAAI,CAAC;QACf;QACA,kFAAkF;QAClF,MAAMxB;IACR;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path, { join } from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport semver from 'next/dist/compiled/semver'\nimport { CompileError } from './compile-error'\nimport * as log from '../build/output/log'\n\nimport { getTypeScriptIntent } from './typescript/getTypeScriptIntent'\nimport type { TypeCheckResult } from './typescript/runTypeCheck'\nimport { writeAppTypeDeclarations } from './typescript/writeAppTypeDeclarations'\nimport { writeConfigurationDefaults } from './typescript/writeConfigurationDefaults'\nimport { installDependencies } from './install-dependencies'\nimport { isCI } from '../server/ci-info'\nimport { missingDepsError } from './typescript/missingDependencyError'\n\nconst requiredPackages = [\n {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n },\n {\n file: '@types/react/index.d.ts',\n pkg: '@types/react',\n exportsRestrict: true,\n },\n {\n file: '@types/node/index.d.ts',\n pkg: '@types/node',\n exportsRestrict: true,\n },\n]\n\nexport async function verifyTypeScriptSetup({\n dir,\n distDir,\n cacheDir,\n strictRouteTypes,\n tsconfigPath,\n typeCheckPreflight,\n typedRoutes,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n isolatedDevBuild,\n appDir,\n pagesDir,\n debugBuildPaths,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n strictRouteTypes: boolean\n tsconfigPath: string | undefined\n typeCheckPreflight: boolean\n typedRoutes: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n isolatedDevBuild: boolean | undefined\n appDir?: string\n pagesDir?: string\n debugBuildPaths?: { app?: string[]; pages?: string[] }\n}): Promise<{ result?: TypeCheckResult; version: string | null }> {\n const tsConfigFileName = tsconfigPath || 'tsconfig.json'\n const resolvedTsConfigPath = path.join(dir, tsConfigFileName)\n\n // Construct intentDirs from appDir and pagesDir for getTypeScriptIntent\n const intentDirs = [pagesDir, appDir].filter(Boolean) as string[]\n\n try {\n // Check if the project uses TypeScript:\n const intent = await getTypeScriptIntent(dir, intentDirs, tsConfigFileName)\n if (!intent) {\n return { version: null }\n }\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n if (deps.missing?.length > 0) {\n if (isCI) {\n // we don't attempt auto install in CI to avoid side-effects\n // and instead log the error for installing needed packages\n missingDepsError(dir, deps.missing)\n }\n console.log(\n bold(\n yellow(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n' +\n 'Installing dependencies' +\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n ) +\n '\\n'\n )\n await installDependencies(dir, deps.missing, true).catch((err) => {\n if (err && typeof err === 'object' && 'command' in err) {\n console.error(\n `Failed to install required TypeScript dependencies, please install them manually to continue:\\n` +\n (err as any).command +\n '\\n'\n )\n }\n throw err\n })\n deps = hasNecessaryDependencies(dir, requiredPackages)\n }\n\n // Load TypeScript after we're sure it exists:\n const tsPackageJsonPath = deps.resolved.get(\n join('typescript', 'package.json')\n )!\n const typescriptPackageJson = require(tsPackageJsonPath)\n\n const typescriptVersion = typescriptPackageJson.version\n\n if (semver.lt(typescriptVersion, '5.1.0')) {\n log.warn(\n `Minimum recommended TypeScript version is v5.1.0, older versions can potentially be incompatible with Next.js. Detected: ${typescriptVersion}`\n )\n }\n\n // Reconfigure (or create) the user's `tsconfig.json` for them:\n await writeConfigurationDefaults(\n typescriptVersion,\n resolvedTsConfigPath,\n intent.firstTimeSetup,\n hasAppDir,\n distDir,\n hasPagesDir,\n isolatedDevBuild,\n strictRouteTypes\n )\n // Write out the necessary `next-env.d.ts` file to correctly register\n // Next.js' types:\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n strictRouteTypes,\n typedRoutes,\n })\n\n let result\n if (typeCheckPreflight) {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n\n const tsPath = deps.resolved.get('typescript')!\n const typescript = (await Promise.resolve(\n require(tsPath)\n )) as typeof import('typescript')\n\n // Verify the project passes type-checking before we go to webpack phase:\n result = await runTypeCheck(\n typescript,\n dir,\n distDir,\n resolvedTsConfigPath,\n cacheDir,\n hasAppDir,\n isolatedDevBuild,\n { app: appDir, pages: pagesDir },\n debugBuildPaths\n )\n }\n return { result, version: typescriptVersion }\n } catch (err) {\n // These are special errors that should not show a stack trace:\n if (err instanceof CompileError) {\n console.error(red('Failed to compile.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyTypeScriptSetup can be either invoked directly in the main thread (during next dev / next lint)\n * or run in a worker (during next build). In the latter case, we need to print the error message, as the\n * parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\n\n // we are in a worker, print the error message and exit the process\n if (process.env.IS_NEXT_WORKER) {\n if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n process.exit(1)\n }\n // we are in the main thread, throw the error and it will be handled by the caller\n throw err\n }\n}\n"],"names":["bold","cyan","red","yellow","path","join","hasNecessaryDependencies","semver","CompileError","log","getTypeScriptIntent","writeAppTypeDeclarations","writeConfigurationDefaults","installDependencies","isCI","missingDepsError","requiredPackages","file","pkg","exportsRestrict","verifyTypeScriptSetup","dir","distDir","cacheDir","strictRouteTypes","tsconfigPath","typeCheckPreflight","typedRoutes","disableStaticImages","hasAppDir","hasPagesDir","isolatedDevBuild","appDir","pagesDir","debugBuildPaths","tsConfigFileName","resolvedTsConfigPath","intentDirs","filter","Boolean","deps","intent","version","missing","length","console","catch","err","error","command","tsPackageJsonPath","resolved","get","typescriptPackageJson","require","typescriptVersion","lt","warn","firstTimeSetup","baseDir","imageImportsEnabled","result","runTypeCheck","tsPath","typescript","Promise","resolve","app","pages","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":"AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM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YACA3C,KACAC,SACAc,sBACAb,UACAM,WACAE,kBACA;gBAAEoC,KAAKnC;gBAAQoC,OAAOnC;YAAS,GAC/BC;QAEJ;QACA,OAAO;YAAE2B;YAAQnB,SAASa;QAAkB;IAC9C,EAAE,OAAOR,KAAK;QACZ,+DAA+D;QAC/D,IAAIA,eAAevC,cAAc;YAC/BqC,QAAQG,KAAK,CAAC9C,IAAI;YAClB2C,QAAQG,KAAK,CAACD,IAAIsB,OAAO;YACzBC,QAAQC,IAAI,CAAC;QACf;QAEA;;;;KAIC,GAED,mEAAmE;QACnE,IAAID,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC9B,IAAI1B,eAAe2B,OAAO;gBACxB7B,QAAQG,KAAK,CAACD,IAAIsB,OAAO;YAC3B,OAAO;gBACLxB,QAAQG,KAAK,CAACD;YAChB;YACAuB,QAAQC,IAAI,CAAC;QACf;QACA,kFAAkF;QAClF,MAAMxB;IACR;AACF","ignoreList":[0]}
|
|
@@ -97,7 +97,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
|
|
|
97
97
|
}
|
|
98
98
|
const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
|
|
99
99
|
const hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
100
|
-
version: "16.1.1-canary.
|
|
100
|
+
version: "16.1.1-canary.14"
|
|
101
101
|
});
|
|
102
102
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
103
103
|
// of the current `next dev` invocation.
|
|
@@ -165,7 +165,7 @@ export default class HotReloaderWebpack {
|
|
|
165
165
|
this.previewProps = previewProps;
|
|
166
166
|
this.rewrites = rewrites;
|
|
167
167
|
this.hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
168
|
-
version: "16.1.1-canary.
|
|
168
|
+
version: "16.1.1-canary.14"
|
|
169
169
|
});
|
|
170
170
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
171
171
|
// of the current `next dev` invocation.
|
|
@@ -23,7 +23,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
|
|
|
23
23
|
if (parts.length > 0) {
|
|
24
24
|
versionSuffix = ` (${parts.join(', ')})`;
|
|
25
25
|
}
|
|
26
|
-
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"16.1.1-canary.
|
|
26
|
+
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"16.1.1-canary.14"}`))}${versionSuffix}`);
|
|
27
27
|
if (appUrl) {
|
|
28
28
|
Log.bootstrap(`- Local: ${appUrl}`);
|
|
29
29
|
}
|
|
@@ -251,25 +251,5 @@ export async function writeValidatorFile(manifest, filePath, strict) {
|
|
|
251
251
|
}
|
|
252
252
|
await fs.promises.writeFile(filePath, strict ? generateValidatorFileStrict(manifest) : generateValidatorFile(manifest));
|
|
253
253
|
}
|
|
254
|
-
/**
|
|
255
|
-
* Writes a proxy routes.d.ts file at the stable path that re-exports from
|
|
256
|
-
* the actual dev types location. This allows next-env.d.ts to always reference
|
|
257
|
-
* the same stable path regardless of dev/build mode.
|
|
258
|
-
*
|
|
259
|
-
* @param stableTypesDir - The stable types directory (e.g., .next/types)
|
|
260
|
-
* @param devTypesRelativePath - Relative path from stable dir to dev types (e.g., ../dev/types/routes.d.ts)
|
|
261
|
-
*/ export async function writeRouteTypesProxy(stableTypesDir, devTypesRelativePath) {
|
|
262
|
-
if (!fs.existsSync(stableTypesDir)) {
|
|
263
|
-
await fs.promises.mkdir(stableTypesDir, {
|
|
264
|
-
recursive: true
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
const proxyFilePath = path.join(stableTypesDir, 'routes.d.ts');
|
|
268
|
-
const proxyContent = `// This file re-exports route types from the dev types location.
|
|
269
|
-
// This provides a stable import path for next-env.d.ts across dev/build modes.
|
|
270
|
-
export * from '${devTypesRelativePath}';
|
|
271
|
-
`;
|
|
272
|
-
await fs.promises.writeFile(proxyFilePath, proxyContent);
|
|
273
|
-
}
|
|
274
254
|
|
|
275
255
|
//# sourceMappingURL=route-types-utils.js.map
|