next 16.2.11 → 16.2.12
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/load-jsconfig.js +40 -20
- package/dist/build/load-jsconfig.js.map +1 -1
- package/dist/build/next-config-ts/transpile-config.js +3 -114
- package/dist/build/next-config-ts/transpile-config.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/turbopack-analyze/index.js +1 -1
- package/dist/build/turbopack-build/impl.js +1 -1
- package/dist/build/type-check.js +20 -13
- 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 +2 -1
- 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-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/docs/01-app/01-getting-started/01-installation.md +33 -0
- package/dist/docs/01-app/01-getting-started/02-project-structure.md +1 -1
- package/dist/docs/01-app/01-getting-started/06-fetching-data.md +1 -1
- package/dist/docs/01-app/01-getting-started/09-revalidating.md +1 -1
- package/dist/docs/01-app/02-guides/authentication.md +18 -10
- package/dist/docs/01-app/02-guides/backend-for-frontend.md +1 -1
- package/dist/docs/01-app/02-guides/debugging.md +2 -2
- package/dist/docs/01-app/02-guides/migrating/app-router-migration.md +18 -14
- package/dist/docs/01-app/02-guides/single-page-applications.md +1 -1
- package/dist/docs/01-app/02-guides/static-exports.md +2 -0
- package/dist/docs/01-app/03-api-reference/02-components/form.md +1 -1
- package/dist/docs/01-app/03-api-reference/03-file-conventions/error.md +2 -0
- package/dist/docs/01-app/03-api-reference/03-file-conventions/not-found.md +3 -1
- package/dist/docs/01-app/03-api-reference/04-functions/redirect.md +1 -0
- package/dist/docs/01-app/03-api-reference/04-functions/refresh.md +4 -1
- package/dist/docs/01-app/03-api-reference/04-functions/revalidatePath.md +3 -0
- package/dist/docs/01-app/03-api-reference/04-functions/revalidateTag.md +3 -0
- package/dist/docs/01-app/03-api-reference/04-functions/unstable_cache.md +5 -5
- package/dist/docs/01-app/03-api-reference/04-functions/use-search-params.md +1 -1
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/headers.md +11 -11
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/redirects.md +10 -10
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/rewrites.md +16 -16
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/serverActions.md +4 -1
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/useTypeScriptCli.md +62 -0
- package/dist/docs/01-app/03-api-reference/05-config/02-typescript.md +55 -1
- package/dist/docs/01-app/03-api-reference/07-adapters/05-routing-with-next-routing.md +0 -3
- package/dist/docs/02-pages/02-guides/forms.md +6 -6
- package/dist/docs/02-pages/03-building-your-application/01-routing/08-custom-error.md +2 -0
- package/dist/docs/02-pages/04-api-reference/04-config/01-next-config-js/useTypeScriptCli.md +8 -0
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/load-jsconfig.js +40 -20
- package/dist/esm/build/load-jsconfig.js.map +1 -1
- package/dist/esm/build/next-config-ts/transpile-config.js +3 -73
- package/dist/esm/build/next-config-ts/transpile-config.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/turbopack-analyze/index.js +1 -1
- package/dist/esm/build/turbopack-build/impl.js +1 -1
- package/dist/esm/build/type-check.js +20 -13
- 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/has-necessary-dependencies.js.map +1 -1
- package/dist/esm/lib/install-dependencies.js +1 -1
- package/dist/esm/lib/install-dependencies.js.map +1 -1
- package/dist/esm/lib/patch-incorrect-lockfile.js +3 -3
- package/dist/esm/lib/typescript/loadTsConfig.js +129 -0
- package/dist/esm/lib/typescript/loadTsConfig.js.map +1 -0
- package/dist/esm/lib/typescript/missingDependencyError.js +1 -1
- package/dist/esm/lib/typescript/missingDependencyError.js.map +1 -1
- package/dist/esm/lib/typescript/runTypeCheck.js.map +1 -1
- package/dist/esm/lib/typescript/runTypeCheckCli.js +38 -0
- package/dist/esm/lib/typescript/runTypeCheckCli.js.map +1 -0
- package/dist/esm/lib/typescript/runTypeScriptCli.js +217 -0
- package/dist/esm/lib/typescript/runTypeScriptCli.js.map +1 -0
- package/dist/esm/lib/verify-typescript-setup.js +87 -52
- package/dist/esm/lib/verify-typescript-setup.js.map +1 -1
- package/dist/esm/server/config-schema.js +1 -0
- package/dist/esm/server/config-schema.js.map +1 -1
- package/dist/esm/server/config-shared.js +1 -0
- package/dist/esm/server/config-shared.js.map +1 -1
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +2 -2
- 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/setup-dev-bundler.js +2 -1
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.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/has-necessary-dependencies.d.ts +2 -0
- package/dist/lib/has-necessary-dependencies.js.map +1 -1
- package/dist/lib/install-dependencies.js +1 -1
- package/dist/lib/install-dependencies.js.map +1 -1
- package/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/dist/lib/typescript/loadTsConfig.d.ts +13 -0
- package/dist/lib/typescript/loadTsConfig.js +181 -0
- package/dist/lib/typescript/loadTsConfig.js.map +1 -0
- package/dist/lib/typescript/missingDependencyError.js +1 -1
- package/dist/lib/typescript/missingDependencyError.js.map +1 -1
- package/dist/lib/typescript/runTypeCheck.d.ts +2 -2
- package/dist/lib/typescript/runTypeCheck.js.map +1 -1
- package/dist/lib/typescript/runTypeCheckCli.d.ts +12 -0
- package/dist/lib/typescript/runTypeCheckCli.js +53 -0
- package/dist/lib/typescript/runTypeCheckCli.js.map +1 -0
- package/dist/lib/typescript/runTypeScriptCli.d.ts +38 -0
- package/dist/lib/typescript/runTypeScriptCli.js +256 -0
- package/dist/lib/typescript/runTypeScriptCli.js.map +1 -0
- package/dist/lib/verify-typescript-setup.d.ts +16 -1
- package/dist/lib/verify-typescript-setup.js +97 -56
- package/dist/lib/verify-typescript-setup.js.map +1 -1
- package/dist/server/config-schema.d.ts +1 -0
- package/dist/server/config-schema.js +1 -0
- package/dist/server/config-schema.js.map +1 -1
- package/dist/server/config-shared.d.ts +6 -0
- package/dist/server/config-shared.js +1 -0
- package/dist/server/config-shared.js.map +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +2 -2
- 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/setup-dev-bundler.js +2 -1
- package/dist/server/lib/router-utils/setup-dev-bundler.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/build.d.ts +1 -0
- package/dist/telemetry/events/build.js.map +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/swc-load-failure.js +1 -1
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +10 -10
- /package/dist/bundle-analyzer/_next/static/{yuLxudwpXbv0jKSL-s0ZM → xR78HbVQBty3GRl-Ydf7i}/_buildManifest.js +0 -0
- /package/dist/bundle-analyzer/_next/static/{yuLxudwpXbv0jKSL-s0ZM → xR78HbVQBty3GRl-Ydf7i}/_clientMiddlewareManifest.json +0 -0
- /package/dist/bundle-analyzer/_next/static/{yuLxudwpXbv0jKSL-s0ZM → xR78HbVQBty3GRl-Ydf7i}/_ssgManifest.js +0 -0
package/dist/.build-commit
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2234717e74ff24cd179d8128fa8af6c46cc4f24e
|
package/dist/bin/next
CHANGED
|
@@ -84,7 +84,7 @@ const program = new NextRootCommand();
|
|
|
84
84
|
program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
|
|
85
85
|
formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
|
|
86
86
|
subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
|
|
87
|
-
}).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"16.2.
|
|
87
|
+
}).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"16.2.12"}`, '-v, --version', 'Outputs the Next.js version.');
|
|
88
88
|
program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('--experimental-analyze', 'Analyze bundle output. Only compatible with Turbopack.').option('-d, --debug', 'Enables a more verbose build output.').option('--debug-prerender', 'Enables debug mode for prerendering. Not for production use!').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Builds using Turbopack.').option('--turbopack', 'Builds using Turbopack.').option('--webpack', 'Builds using webpack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
|
|
89
89
|
'compile',
|
|
90
90
|
'generate',
|
|
@@ -170,7 +170,7 @@ program.command('telemetry').description(`Allows you to enable or disable Next.j
|
|
|
170
170
|
program.command('typegen').description('Generate TypeScript definitions for routes, pages, and layouts without running a full build.').argument('[directory]', `A directory on which to generate types. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).action((directory, options)=>// ensure process exits after typegen completes so open handles/connections
|
|
171
171
|
// don't cause process to hang
|
|
172
172
|
import('../cli/next-typegen.js').then((mod)=>mod.nextTypegen(options, directory).then(()=>process.exit(0)))).usage('[directory] [options]');
|
|
173
|
-
const nextVersion = "16.2.
|
|
173
|
+
const nextVersion = "16.2.12" || 'unknown';
|
|
174
174
|
program.command('upgrade').description('Upgrade Next.js apps to desired versions with a single command.').argument('[directory]', `A Next.js project directory to upgrade. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).usage('[directory] [options]').option('--revision <revision>', 'Specify the target Next.js version using an NPM dist tag (e.g. "latest", "canary", "rc", "beta") or an exact version number (e.g. "15.0.0").', nextVersion.includes('-canary.') ? 'canary' : nextVersion.includes('-rc.') ? 'rc' : nextVersion.includes('-beta.') ? 'beta' : 'latest').option('--verbose', 'Verbose output', false).action(async (directory, options)=>{
|
|
175
175
|
const mod = await import('../cli/next-upgrade.js');
|
|
176
176
|
mod.spawnNextUpgrade(directory, options);
|
package/dist/build/index.js
CHANGED
|
@@ -401,7 +401,7 @@ async function build(dir, experimentalAnalyze = false, reactProductionProfiling
|
|
|
401
401
|
try {
|
|
402
402
|
const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
|
|
403
403
|
buildMode: experimentalBuildMode,
|
|
404
|
-
version: "16.2.
|
|
404
|
+
version: "16.2.12",
|
|
405
405
|
...enabledFeatures
|
|
406
406
|
});
|
|
407
407
|
_buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
@@ -837,7 +837,7 @@ async function build(dir, experimentalAnalyze = false, reactProductionProfiling
|
|
|
837
837
|
// Files outside of the distDir can be "type": "module"
|
|
838
838
|
await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
839
839
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
840
|
-
await (0, _builddiagnostics.recordFrameworkVersion)("16.2.
|
|
840
|
+
await (0, _builddiagnostics.recordFrameworkVersion)("16.2.12");
|
|
841
841
|
await (0, _builddiagnostics.updateBuildDiagnostics)({
|
|
842
842
|
buildStage: 'start'
|
|
843
843
|
});
|
|
@@ -2565,7 +2565,7 @@ async function build(dir, experimentalAnalyze = false, reactProductionProfiling
|
|
|
2565
2565
|
configOutDir: _path.default.join(dir, configOutDir),
|
|
2566
2566
|
staticPages,
|
|
2567
2567
|
serverPropsPages,
|
|
2568
|
-
nextVersion: "16.2.
|
|
2568
|
+
nextVersion: "16.2.12",
|
|
2569
2569
|
tracingRoot: outputFileTracingRoot,
|
|
2570
2570
|
hasNodeMiddleware,
|
|
2571
2571
|
hasInstrumentationHook,
|
|
@@ -25,8 +25,9 @@ const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
|
25
25
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("./output/log"));
|
|
26
26
|
const _getTypeScriptConfiguration = require("../lib/typescript/getTypeScriptConfiguration");
|
|
27
27
|
const _iserror = /*#__PURE__*/ _interop_require_default(require("../lib/is-error"));
|
|
28
|
-
const _hasnecessarydependencies = require("../lib/has-necessary-dependencies");
|
|
29
28
|
const _codeframe = require("../shared/lib/errors/code-frame");
|
|
29
|
+
const _runTypeScriptCli = require("../lib/typescript/runTypeScriptCli");
|
|
30
|
+
const _loadTsConfig = require("../lib/typescript/loadTsConfig");
|
|
30
31
|
function _interop_require_default(obj) {
|
|
31
32
|
return obj && obj.__esModule ? obj : {
|
|
32
33
|
default: obj
|
|
@@ -103,19 +104,14 @@ function parseJsonFile(filePath) {
|
|
|
103
104
|
}
|
|
104
105
|
async function loadJsConfig(dir, config) {
|
|
105
106
|
var _jsConfig_compilerOptions;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
pkg: 'typescript',
|
|
111
|
-
file: 'typescript/lib/typescript.js',
|
|
112
|
-
exportsRestrict: true
|
|
113
|
-
}
|
|
114
|
-
]);
|
|
115
|
-
typeScriptPath = deps.resolved.get('typescript');
|
|
116
|
-
} catch {}
|
|
107
|
+
const useTypeScriptCli = Boolean(config.experimental.useTypeScriptCli);
|
|
108
|
+
const typeScriptPackage = (0, _runTypeScriptCli.getTypeScriptPackageInfo)(dir);
|
|
109
|
+
const typeScriptPath = useTypeScriptCli ? typeScriptPackage == null ? void 0 : typeScriptPackage.tscPath : typeScriptPackage == null ? void 0 : typeScriptPackage.apiPath;
|
|
117
110
|
const tsConfigFileName = config.typescript.tsconfigPath || 'tsconfig.json';
|
|
118
111
|
const tsConfigPath = _path.default.join(dir, tsConfigFileName);
|
|
112
|
+
if (!useTypeScriptCli && typeScriptPackage && !typeScriptPackage.apiPath && !(0, _runTypeScriptCli.hasNativeTypeScriptPreview)(dir) && _fs.default.existsSync(tsConfigPath)) {
|
|
113
|
+
throw (0, _runTypeScriptCli.getTypeScriptApiMissingError)(typeScriptPackage.version);
|
|
114
|
+
}
|
|
119
115
|
const useTypeScript = Boolean(typeScriptPath && _fs.default.existsSync(tsConfigPath));
|
|
120
116
|
let implicitBaseurl;
|
|
121
117
|
let jsConfig;
|
|
@@ -125,11 +121,26 @@ async function loadJsConfig(dir, config) {
|
|
|
125
121
|
TSCONFIG_WARNED = true;
|
|
126
122
|
_log.info(`Using tsconfig file: ${tsConfigFileName}`);
|
|
127
123
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
if (useTypeScriptCli) {
|
|
125
|
+
const tsConfig = await (0, _runTypeScriptCli.getTypeScriptConfigurationCli)({
|
|
126
|
+
baseDir: dir,
|
|
127
|
+
tsConfigPath,
|
|
128
|
+
tscPath: typeScriptPath
|
|
129
|
+
});
|
|
130
|
+
const configOrigins = (0, _loadTsConfig.loadTsConfigOptions)(tsConfigPath);
|
|
131
|
+
jsConfig = {
|
|
132
|
+
compilerOptions: {
|
|
133
|
+
...tsConfig.compilerOptions,
|
|
134
|
+
pathsBasePath: configOrigins.pathsBasePath
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
const ts = await Promise.resolve(require(typeScriptPath));
|
|
139
|
+
const tsConfig = await (0, _getTypeScriptConfiguration.getTypeScriptConfiguration)(ts, tsConfigPath, true);
|
|
140
|
+
jsConfig = {
|
|
141
|
+
compilerOptions: tsConfig.options
|
|
142
|
+
};
|
|
143
|
+
}
|
|
133
144
|
implicitBaseurl = _path.default.dirname(tsConfigPath);
|
|
134
145
|
}
|
|
135
146
|
const jsConfigPath = _path.default.join(dir, 'jsconfig.json');
|
|
@@ -140,13 +151,22 @@ async function loadJsConfig(dir, config) {
|
|
|
140
151
|
let resolvedBaseUrl;
|
|
141
152
|
if (jsConfig == null ? void 0 : (_jsConfig_compilerOptions = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions.baseUrl) {
|
|
142
153
|
resolvedBaseUrl = {
|
|
143
|
-
baseUrl: _path.default.resolve(dir, jsConfig.compilerOptions.baseUrl),
|
|
154
|
+
baseUrl: _path.default.resolve(implicitBaseurl ?? dir, jsConfig.compilerOptions.baseUrl),
|
|
144
155
|
isImplicit: false
|
|
145
156
|
};
|
|
146
157
|
} else {
|
|
147
|
-
|
|
158
|
+
var _jsConfig_compilerOptions1;
|
|
159
|
+
// TypeScript 5.0+: `pathsBasePath` is the directory of the tsconfig that
|
|
160
|
+
// defines `paths`. For paths inherited from an extended base tsconfig (e.g.
|
|
161
|
+
// a workspace-root tsconfig.base.json for nx monorepo), this is the base
|
|
162
|
+
// config's directory — not the app tsconfig dir. Using it ensures JsConfigPathsPlugin
|
|
163
|
+
// joins path-mapping values against the correct base so `baseUrl` is not required
|
|
164
|
+
// for path aliases to work in webpack.
|
|
165
|
+
const pathsBasePath = jsConfig == null ? void 0 : (_jsConfig_compilerOptions1 = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions1.pathsBasePath;
|
|
166
|
+
const effectiveBaseUrl = pathsBasePath ?? implicitBaseurl;
|
|
167
|
+
if (effectiveBaseUrl) {
|
|
148
168
|
resolvedBaseUrl = {
|
|
149
|
-
baseUrl:
|
|
169
|
+
baseUrl: effectiveBaseUrl,
|
|
150
170
|
isImplicit: true
|
|
151
171
|
};
|
|
152
172
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/build/load-jsconfig.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport * as Log from './output/log'\nimport { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration'\nimport { readFileSync } from 'fs'\nimport isError from '../lib/is-error'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/build/load-jsconfig.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport * as Log from './output/log'\nimport { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration'\nimport { readFileSync } from 'fs'\nimport isError from '../lib/is-error'\nimport { codeFrameColumns } from '../shared/lib/errors/code-frame'\nimport {\n getTypeScriptApiMissingError,\n getTypeScriptConfigurationCli,\n getTypeScriptPackageInfo,\n hasNativeTypeScriptPreview,\n} from '../lib/typescript/runTypeScriptCli'\nimport { loadTsConfigOptions } from '../lib/typescript/loadTsConfig'\n\nlet TSCONFIG_WARNED = false\n\nexport function parseJsonFile(filePath: string) {\n const JSON5 =\n require('next/dist/compiled/json5') as typeof import('next/dist/compiled/json5')\n const contents = readFileSync(filePath, 'utf8')\n\n // Special case an empty file\n if (contents.trim() === '') {\n return {}\n }\n\n try {\n return JSON5.parse(contents)\n } catch (err) {\n if (!isError(err)) throw err\n const codeFrame = codeFrameColumns(\n String(contents),\n {\n start: {\n line: (err as Error & { lineNumber?: number }).lineNumber || 1,\n column:\n (err as Error & { columnNumber?: number }).columnNumber ||\n undefined,\n },\n },\n { message: err.message, color: true }\n )\n throw new Error(\n `Failed to parse \"${filePath}\":\\n${codeFrame ?? err.message}`\n )\n }\n}\n\nexport type ResolvedBaseUrl =\n | { baseUrl: string; isImplicit: boolean }\n | undefined\n\nexport type JsConfig = { compilerOptions: Record<string, any> } | undefined\n\nexport default async function loadJsConfig(\n dir: string,\n config: NextConfigComplete\n): Promise<{\n useTypeScript: boolean\n jsConfig: JsConfig\n jsConfigPath?: string\n resolvedBaseUrl: ResolvedBaseUrl\n}> {\n const useTypeScriptCli = Boolean(config.experimental.useTypeScriptCli)\n const typeScriptPackage = getTypeScriptPackageInfo(dir)\n const typeScriptPath = useTypeScriptCli\n ? typeScriptPackage?.tscPath\n : typeScriptPackage?.apiPath\n const tsConfigFileName = config.typescript.tsconfigPath || 'tsconfig.json'\n const tsConfigPath = path.join(dir, tsConfigFileName)\n\n if (\n !useTypeScriptCli &&\n typeScriptPackage &&\n !typeScriptPackage.apiPath &&\n !hasNativeTypeScriptPreview(dir) &&\n fs.existsSync(tsConfigPath)\n ) {\n throw getTypeScriptApiMissingError(typeScriptPackage.version)\n }\n\n const useTypeScript = Boolean(typeScriptPath && fs.existsSync(tsConfigPath))\n\n let implicitBaseurl\n let jsConfig: { compilerOptions: Record<string, any> } | undefined\n // jsconfig is a subset of tsconfig\n if (useTypeScript) {\n if (tsConfigFileName !== 'tsconfig.json' && TSCONFIG_WARNED === false) {\n TSCONFIG_WARNED = true\n Log.info(`Using tsconfig file: ${tsConfigFileName}`)\n }\n\n if (useTypeScriptCli) {\n const tsConfig = await getTypeScriptConfigurationCli({\n baseDir: dir,\n tsConfigPath,\n tscPath: typeScriptPath!,\n })\n const configOrigins = loadTsConfigOptions(tsConfigPath)\n jsConfig = {\n compilerOptions: {\n ...tsConfig.compilerOptions,\n pathsBasePath: configOrigins.pathsBasePath,\n },\n }\n } else {\n const ts = (await Promise.resolve(\n require(typeScriptPath!)\n )) as typeof import('typescript')\n const tsConfig = await getTypeScriptConfiguration(ts, tsConfigPath, true)\n jsConfig = { compilerOptions: tsConfig.options }\n }\n implicitBaseurl = path.dirname(tsConfigPath)\n }\n\n const jsConfigPath = path.join(dir, 'jsconfig.json')\n if (!useTypeScript && fs.existsSync(jsConfigPath)) {\n jsConfig = parseJsonFile(jsConfigPath)\n implicitBaseurl = path.dirname(jsConfigPath)\n }\n\n let resolvedBaseUrl: ResolvedBaseUrl\n if (jsConfig?.compilerOptions?.baseUrl) {\n resolvedBaseUrl = {\n baseUrl: path.resolve(\n implicitBaseurl ?? dir,\n jsConfig.compilerOptions.baseUrl\n ),\n isImplicit: false,\n }\n } else {\n // TypeScript 5.0+: `pathsBasePath` is the directory of the tsconfig that\n // defines `paths`. For paths inherited from an extended base tsconfig (e.g.\n // a workspace-root tsconfig.base.json for nx monorepo), this is the base\n // config's directory — not the app tsconfig dir. Using it ensures JsConfigPathsPlugin\n // joins path-mapping values against the correct base so `baseUrl` is not required\n // for path aliases to work in webpack.\n const pathsBasePath: string | undefined =\n jsConfig?.compilerOptions?.pathsBasePath\n const effectiveBaseUrl = pathsBasePath ?? implicitBaseurl\n if (effectiveBaseUrl) {\n resolvedBaseUrl = {\n baseUrl: effectiveBaseUrl,\n isImplicit: true,\n }\n }\n }\n\n return {\n useTypeScript,\n jsConfig,\n resolvedBaseUrl,\n jsConfigPath: useTypeScript\n ? tsConfigPath\n : fs.existsSync(jsConfigPath)\n ? jsConfigPath\n : undefined,\n }\n}\n"],"names":["loadJsConfig","parseJsonFile","TSCONFIG_WARNED","filePath","JSON5","require","contents","readFileSync","trim","parse","err","isError","codeFrame","codeFrameColumns","String","start","line","lineNumber","column","columnNumber","undefined","message","color","Error","dir","config","jsConfig","useTypeScriptCli","Boolean","experimental","typeScriptPackage","getTypeScriptPackageInfo","typeScriptPath","tscPath","apiPath","tsConfigFileName","typescript","tsconfigPath","tsConfigPath","path","join","hasNativeTypeScriptPreview","fs","existsSync","getTypeScriptApiMissingError","version","useTypeScript","implicitBaseurl","Log","info","tsConfig","getTypeScriptConfigurationCli","baseDir","configOrigins","loadTsConfigOptions","compilerOptions","pathsBasePath","ts","Promise","resolve","getTypeScriptConfiguration","options","dirname","jsConfigPath","resolvedBaseUrl","baseUrl","isImplicit","effectiveBaseUrl"],"mappings":";;;;;;;;;;;;;;;IAwDA,OAwGC;eAxG6BA;;IAtCdC,aAAa;eAAbA;;;6DAlBC;4DACF;6DAEM;4CACsB;gEAEvB;2BACa;kCAM1B;8BAC6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpC,IAAIC,kBAAkB;AAEf,SAASD,cAAcE,QAAgB;IAC5C,MAAMC,QACJC,QAAQ;IACV,MAAMC,WAAWC,IAAAA,gBAAY,EAACJ,UAAU;IAExC,6BAA6B;IAC7B,IAAIG,SAASE,IAAI,OAAO,IAAI;QAC1B,OAAO,CAAC;IACV;IAEA,IAAI;QACF,OAAOJ,M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OAAO;QACLpB;QACApB;QACAsC;QACAD,cAAcjB,gBACVR,eACAI,WAAE,CAACC,UAAU,CAACoB,gBACZA,eACA3C;IACR;AACF","ignoreList":[0]}
|
|
@@ -11,56 +11,15 @@ Object.defineProperty(exports, "transpileConfig", {
|
|
|
11
11
|
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
12
12
|
const _nodefs = require("node:fs");
|
|
13
13
|
const _nodeurl = require("node:url");
|
|
14
|
-
const _commentjson = /*#__PURE__*/ _interop_require_wildcard(require("next/dist/compiled/comment-json"));
|
|
15
14
|
const _requirehook = require("./require-hook");
|
|
16
15
|
const _log = require("../output/log");
|
|
17
16
|
const _utils = require("../../server/lib/utils");
|
|
17
|
+
const _loadTsConfig = require("../../lib/typescript/loadTsConfig");
|
|
18
18
|
function _interop_require_default(obj) {
|
|
19
19
|
return obj && obj.__esModule ? obj : {
|
|
20
20
|
default: obj
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
24
|
-
if (typeof WeakMap !== "function") return null;
|
|
25
|
-
var cacheBabelInterop = new WeakMap();
|
|
26
|
-
var cacheNodeInterop = new WeakMap();
|
|
27
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
28
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
29
|
-
})(nodeInterop);
|
|
30
|
-
}
|
|
31
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
32
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
33
|
-
return obj;
|
|
34
|
-
}
|
|
35
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
36
|
-
return {
|
|
37
|
-
default: obj
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
41
|
-
if (cache && cache.has(obj)) {
|
|
42
|
-
return cache.get(obj);
|
|
43
|
-
}
|
|
44
|
-
var newObj = {
|
|
45
|
-
__proto__: null
|
|
46
|
-
};
|
|
47
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
48
|
-
for(var key in obj){
|
|
49
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
50
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
51
|
-
if (desc && (desc.get || desc.set)) {
|
|
52
|
-
Object.defineProperty(newObj, key, desc);
|
|
53
|
-
} else {
|
|
54
|
-
newObj[key] = obj[key];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
newObj.default = obj;
|
|
59
|
-
if (cache) {
|
|
60
|
-
cache.set(obj, newObj);
|
|
61
|
-
}
|
|
62
|
-
return newObj;
|
|
63
|
-
}
|
|
64
23
|
function resolveSWCOptions(cwd, compilerOptions) {
|
|
65
24
|
var _process_versions, _process;
|
|
66
25
|
return {
|
|
@@ -74,7 +33,7 @@ function resolveSWCOptions(cwd, compilerOptions) {
|
|
|
74
33
|
...compilerOptions.baseUrl ? {
|
|
75
34
|
baseUrl: _nodepath.default.resolve(cwd, compilerOptions.baseUrl)
|
|
76
35
|
} : compilerOptions.paths ? {
|
|
77
|
-
baseUrl: cwd
|
|
36
|
+
baseUrl: compilerOptions.pathsBasePath ?? cwd
|
|
78
37
|
} : {}
|
|
79
38
|
},
|
|
80
39
|
module: {
|
|
@@ -89,76 +48,6 @@ function resolveSWCOptions(cwd, compilerOptions) {
|
|
|
89
48
|
}
|
|
90
49
|
};
|
|
91
50
|
}
|
|
92
|
-
function resolveExtends(extendsPath, currentConfigDir) {
|
|
93
|
-
// Relative paths are resolved relative to the current config's directory
|
|
94
|
-
if (extendsPath.startsWith('./') || extendsPath.startsWith('../') || _nodepath.default.isAbsolute(extendsPath)) {
|
|
95
|
-
const resolved = _nodepath.default.resolve(currentConfigDir, extendsPath);
|
|
96
|
-
// TypeScript allows omitting .json extension
|
|
97
|
-
if ((0, _nodefs.existsSync)(resolved)) {
|
|
98
|
-
return resolved;
|
|
99
|
-
}
|
|
100
|
-
if (!resolved.endsWith('.json') && (0, _nodefs.existsSync)(resolved + '.json')) {
|
|
101
|
-
return resolved + '.json';
|
|
102
|
-
}
|
|
103
|
-
return resolved;
|
|
104
|
-
}
|
|
105
|
-
// Package paths - use require.resolve to find the package
|
|
106
|
-
try {
|
|
107
|
-
// Try resolving as a direct path within the package
|
|
108
|
-
return require.resolve(extendsPath, {
|
|
109
|
-
paths: [
|
|
110
|
-
currentConfigDir
|
|
111
|
-
]
|
|
112
|
-
});
|
|
113
|
-
} catch {
|
|
114
|
-
// If that fails, try appending tsconfig.json for package names like "@tsconfig/node18"
|
|
115
|
-
try {
|
|
116
|
-
return require.resolve(extendsPath + '/tsconfig.json', {
|
|
117
|
-
paths: [
|
|
118
|
-
currentConfigDir
|
|
119
|
-
]
|
|
120
|
-
});
|
|
121
|
-
} catch {
|
|
122
|
-
// Return the original path and let it fail later with a clear error
|
|
123
|
-
return _nodepath.default.resolve(currentConfigDir, extendsPath);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function loadTsConfigFile(configPath, visited) {
|
|
128
|
-
const resolvedPath = _nodepath.default.resolve(configPath);
|
|
129
|
-
if (visited.has(resolvedPath)) {
|
|
130
|
-
return {};
|
|
131
|
-
}
|
|
132
|
-
visited.add(resolvedPath);
|
|
133
|
-
if (!(0, _nodefs.existsSync)(resolvedPath)) {
|
|
134
|
-
return {};
|
|
135
|
-
}
|
|
136
|
-
const configContent = (0, _nodefs.readFileSync)(resolvedPath, 'utf8');
|
|
137
|
-
const config = _commentjson.parse(configContent);
|
|
138
|
-
const configDir = _nodepath.default.dirname(resolvedPath);
|
|
139
|
-
let mergedOptions = {};
|
|
140
|
-
// Note that config options from `extends` should get overwritten, not merged
|
|
141
|
-
if (config.extends) {
|
|
142
|
-
const extendsList = Array.isArray(config.extends) ? config.extends : [
|
|
143
|
-
config.extends
|
|
144
|
-
];
|
|
145
|
-
for (const extendsPath of extendsList){
|
|
146
|
-
const parentConfigPath = resolveExtends(extendsPath, configDir);
|
|
147
|
-
const parentOptions = loadTsConfigFile(parentConfigPath, visited);
|
|
148
|
-
mergedOptions = {
|
|
149
|
-
...mergedOptions,
|
|
150
|
-
...parentOptions
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
const currentOptions = config.compilerOptions ?? {};
|
|
155
|
-
mergedOptions = {
|
|
156
|
-
...mergedOptions,
|
|
157
|
-
paths: currentOptions.paths ?? mergedOptions.paths,
|
|
158
|
-
baseUrl: currentOptions.baseUrl ?? mergedOptions.baseUrl
|
|
159
|
-
};
|
|
160
|
-
return mergedOptions;
|
|
161
|
-
}
|
|
162
51
|
async function loadTsConfig(dir) {
|
|
163
52
|
// NOTE: This doesn't fully cover the edge case for setting
|
|
164
53
|
// "typescript.tsconfigPath" in next config which is currently
|
|
@@ -169,7 +58,7 @@ async function loadTsConfig(dir) {
|
|
|
169
58
|
if (!(0, _nodefs.existsSync)(resolvedTsConfigPath)) {
|
|
170
59
|
return {};
|
|
171
60
|
}
|
|
172
|
-
return
|
|
61
|
+
return (0, _loadTsConfig.loadTsConfigOptions)(resolvedTsConfigPath);
|
|
173
62
|
}
|
|
174
63
|
async function transpileConfig({ nextConfigPath, dir }) {
|
|
175
64
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/build/next-config-ts/transpile-config.ts"],"sourcesContent":["import type { Options as SWCOptions } from '@swc/core'\nimport type { CompilerOptions } from 'typescript'\n\nimport path from 'node:path'\nimport { readFileSync, existsSync } from 'node:fs'\nimport { pathToFileURL } from 'node:url'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport { deregisterHook, registerHook, requireFromString } from './require-hook'\nimport { warn, warnOnce } from '../output/log'\nimport { getNodeOptionsArgs } from '../../server/lib/utils'\n\ntype RelevantCompilerOptions = Pick<CompilerOptions, 'paths' | 'baseUrl'>\n\nfunction resolveSWCOptions(\n cwd: string,\n compilerOptions: RelevantCompilerOptions\n): SWCOptions {\n return {\n jsc: {\n parser: {\n syntax: 'typescript',\n },\n ...(compilerOptions.paths ? { paths: compilerOptions.paths } : {}),\n ...(compilerOptions.baseUrl\n ? // Needs to be an absolute path.\n { baseUrl: path.resolve(cwd, compilerOptions.baseUrl) }\n : compilerOptions.paths\n ? // If paths is given, baseUrl is required.\n { baseUrl: cwd }\n : {}),\n },\n module: {\n type: 'commonjs',\n },\n isModule: 'unknown',\n env: {\n targets: {\n // Setting the Node.js version can reduce unnecessary code generation.\n node: process?.versions?.node ?? '20.19.0',\n },\n },\n } satisfies SWCOptions\n}\n\nfunction resolveExtends(extendsPath: string, currentConfigDir: string): string {\n // Relative paths are resolved relative to the current config's directory\n if (\n extendsPath.startsWith('./') ||\n extendsPath.startsWith('../') ||\n path.isAbsolute(extendsPath)\n ) {\n const resolved = path.resolve(currentConfigDir, extendsPath)\n // TypeScript allows omitting .json extension\n if (existsSync(resolved)) {\n return resolved\n }\n if (!resolved.endsWith('.json') && existsSync(resolved + '.json')) {\n return resolved + '.json'\n }\n return resolved\n }\n\n // Package paths - use require.resolve to find the package\n try {\n // Try resolving as a direct path within the package\n return require.resolve(extendsPath, { paths: [currentConfigDir] })\n } catch {\n // If that fails, try appending tsconfig.json for package names like \"@tsconfig/node18\"\n try {\n return require.resolve(extendsPath + '/tsconfig.json', {\n paths: [currentConfigDir],\n })\n } catch {\n // Return the original path and let it fail later with a clear error\n return path.resolve(currentConfigDir, extendsPath)\n }\n }\n}\n\nfunction loadTsConfigFile(\n configPath: string,\n visited: Set<string>\n): RelevantCompilerOptions {\n const resolvedPath = path.resolve(configPath)\n\n if (visited.has(resolvedPath)) {\n return {}\n }\n visited.add(resolvedPath)\n\n if (!existsSync(resolvedPath)) {\n return {}\n }\n\n const configContent = readFileSync(resolvedPath, 'utf8')\n const config = CommentJson.parse(configContent)\n const configDir = path.dirname(resolvedPath)\n\n let mergedOptions: RelevantCompilerOptions = {}\n\n // Note that config options from `extends` should get overwritten, not merged\n if (config.extends) {\n const extendsList = Array.isArray(config.extends)\n ? config.extends\n : [config.extends]\n\n for (const extendsPath of extendsList) {\n const parentConfigPath = resolveExtends(extendsPath, configDir)\n const parentOptions = loadTsConfigFile(parentConfigPath, visited)\n mergedOptions = { ...mergedOptions, ...parentOptions }\n }\n }\n\n const currentOptions = config.compilerOptions ?? {}\n mergedOptions = {\n ...mergedOptions,\n paths: currentOptions.paths ?? mergedOptions.paths,\n baseUrl: currentOptions.baseUrl ?? mergedOptions.baseUrl,\n }\n\n return mergedOptions\n}\n\nasync function loadTsConfig(dir: string): Promise<RelevantCompilerOptions> {\n // NOTE: This doesn't fully cover the edge case for setting\n // \"typescript.tsconfigPath\" in next config which is currently\n // a restriction.\n // It's a chicken-and-egg problem since we need to transpile\n // the next config to get that value.\n const resolvedTsConfigPath = path.join(dir, 'tsconfig.json')\n\n if (!existsSync(resolvedTsConfigPath)) {\n return {}\n }\n\n return loadTsConfigFile(resolvedTsConfigPath, new Set())\n}\n\nexport async function transpileConfig({\n nextConfigPath,\n dir,\n}: {\n nextConfigPath: string\n dir: string\n}) {\n try {\n // envs are passed to the workers and preserve the flag\n if (process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED === 'true') {\n try {\n // Node.js v22.10.0+\n // Value is 'strip' or 'transform' based on how the feature is enabled.\n // https://nodejs.org/api/process.html#processfeaturestypescript\n // TODO: Remove `as any` once we bump @types/node to v22.10.0+\n if ((process.features as any).typescript) {\n // Run import() here to catch errors and fallback to legacy resolution.\n return (await import(pathToFileURL(nextConfigPath).href)).default\n }\n\n if (\n getNodeOptionsArgs().includes('--no-experimental-strip-types') ||\n process.execArgv.includes('--no-experimental-strip-types')\n ) {\n warnOnce(\n `Skipped resolving \"${path.basename(nextConfigPath)}\" using Node.js native TypeScript resolution because it was disabled by the \"--no-experimental-strip-types\" flag.` +\n ' Falling back to legacy resolution.' +\n ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts'\n )\n }\n\n // Feature is not enabled, fallback to legacy resolution for current session.\n process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false'\n } catch (cause) {\n warnOnce(\n `Failed to import \"${path.basename(nextConfigPath)}\" using Node.js native TypeScript resolution.` +\n ' Falling back to legacy resolution.' +\n ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts',\n { cause }\n )\n // Once failed, fallback to legacy resolution for current session.\n process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false'\n }\n }\n\n const compilerOptions = await loadTsConfig(dir)\n return handleCJS({ dir, nextConfigPath, compilerOptions })\n } catch (cause) {\n throw new Error(`Failed to transpile \"${path.basename(nextConfigPath)}\".`, {\n cause,\n })\n }\n}\n\nasync function handleCJS({\n dir,\n nextConfigPath,\n compilerOptions,\n}: {\n dir: string\n nextConfigPath: string\n compilerOptions: RelevantCompilerOptions\n}) {\n const swcOptions = resolveSWCOptions(dir, compilerOptions)\n let hasRequire = false\n try {\n const nextConfigString = readFileSync(nextConfigPath, 'utf8')\n // lazy require swc since it loads React before even setting NODE_ENV\n // resulting loading Development React on Production\n const { loadBindings } = require('../swc') as typeof import('../swc')\n const bindings = await loadBindings()\n const { code } = await bindings.transform(nextConfigString, swcOptions)\n\n // register require hook only if require exists\n if (code.includes('require(')) {\n registerHook(swcOptions)\n hasRequire = true\n }\n\n // filename & extension don't matter here\n const config = requireFromString(\n code,\n path.resolve(dir, 'next.config.compiled.js')\n )\n // At this point we have already loaded the bindings without this configuration setting due to the `transform` call above.\n // Possibly we fell back to wasm in which case, it all works out but if not we need to warn\n // that the configuration was ignored.\n if (config?.experimental?.useWasmBinary && !bindings.isWasm) {\n warn(\n 'Using a next.config.ts file is incompatible with `experimental.useWasmBinary` unless ' +\n '`--experimental-next-config-strip-types` is also passed.\\nSetting `useWasmBinary` to `false'\n )\n config.experimental.useWasmBinary = false\n }\n return config\n } catch (error) {\n throw error\n } finally {\n if (hasRequire) {\n deregisterHook()\n }\n }\n}\n"],"names":["transpileConfig","resolveSWCOptions","cwd","compilerOptions","process","jsc","parser","syntax","paths","baseUrl","path","resolve","module","type","isModule","env","targets","node","versions","resolveExtends","extendsPath","currentConfigDir","startsWith","isAbsolute","resolved","existsSync","endsWith","require","loadTsConfigFile","configPath","visited","resolvedPath","has","add","configContent","readFileSync","config","CommentJson","parse","configDir","dirname","mergedOptions","extends","extendsList","Array","isArray","parentConfigPath","parentOptions","currentOptions","loadTsConfig","dir","resolvedTsConfigPath","join","Set","nextConfigPath","__NEXT_NODE_NATIVE_TS_LOADER_ENABLED","features","typescript","pathToFileURL","href","default","getNodeOptionsArgs","includes","execArgv","warnOnce","basename","cause","handleCJS","Error","swcOptions","hasRequire","nextConfigString","loadBindings","bindings","code","transform","registerHook","requireFromString","experimental","useWasmBinary","isWasm","warn","error","deregisterHook"],"mappings":";;;;+BA0IsBA;;;eAAAA;;;iEAvIL;wBACwB;yBACX;qEACD;6BACmC;qBACjC;uBACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAInC,SAASC,kBACPC,GAAW,EACXC,eAAwC;QAuB5BC,mBAAAA;IArBZ,OAAO;QACLC,KAAK;YACHC,QAAQ;gBACNC,QAAQ;YACV;YACA,GAAIJ,gBAAgBK,KAAK,GAAG;gBAAEA,OAAOL,gBAAgBK,KAAK;YAAC,IAAI,CAAC,CAAC;YACjE,GAAIL,gBAAgBM,OAAO,GAEvB;gBAAEA,SAASC,iBAAI,CAACC,OAAO,CAACT,KAAKC,gBAAgBM,OAAO;YAAE,IACtDN,gBAAgBK,KAAK,GAEnB;gBAAEC,SAASP;YAAI,IACf,CAAC,CAAC;QACV;QACAU,QAAQ;YACNC,MAAM;QACR;QACAC,UAAU;QACVC,KAAK;YACHC,SAAS;gBACP,sEAAsE;gBACtEC,MAAMb,EAAAA,WA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AIK,KAAKZ,QAAQ,CAAC,aAAa;YAC7Bc,IAAAA,yBAAY,EAACP;YACbC,aAAa;QACf;QAEA,yCAAyC;QACzC,MAAMlC,SAASyC,IAAAA,8BAAiB,EAC9BH,MACAhE,iBAAI,CAACC,OAAO,CAACuC,KAAK;QAEpB,0HAA0H;QAC1H,2FAA2F;QAC3F,sCAAsC;QACtC,IAAId,CAAAA,2BAAAA,uBAAAA,OAAQ0C,YAAY,qBAApB1C,qBAAsB2C,aAAa,KAAI,CAACN,SAASO,MAAM,EAAE;YAC3DC,IAAAA,SAAI,EACF,0FACE;YAEJ7C,OAAO0C,YAAY,CAACC,aAAa,GAAG;QACtC;QACA,OAAO3C;IACT,EAAE,OAAO8C,OAAO;QACd,MAAMA;IACR,SAAU;QACR,IAAIZ,YAAY;YACda,IAAAA,2BAAc;QAChB;IACF;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../src/build/next-config-ts/transpile-config.ts"],"sourcesContent":["import type { Options as SWCOptions } from '@swc/core'\n\nimport path from 'node:path'\nimport { readFileSync, existsSync } from 'node:fs'\nimport { pathToFileURL } from 'node:url'\nimport { deregisterHook, registerHook, requireFromString } from './require-hook'\nimport { warn, warnOnce } from '../output/log'\nimport { getNodeOptionsArgs } from '../../server/lib/utils'\nimport {\n loadTsConfigOptions,\n type RelevantCompilerOptions,\n} from '../../lib/typescript/loadTsConfig'\n\nfunction resolveSWCOptions(\n cwd: string,\n compilerOptions: RelevantCompilerOptions\n): SWCOptions {\n return {\n jsc: {\n parser: {\n syntax: 'typescript',\n },\n ...(compilerOptions.paths ? { paths: compilerOptions.paths } : {}),\n ...(compilerOptions.baseUrl\n ? // Needs to be an absolute path.\n { baseUrl: path.resolve(cwd, compilerOptions.baseUrl) }\n : compilerOptions.paths\n ? // If paths is given, baseUrl is required.\n { baseUrl: compilerOptions.pathsBasePath ?? cwd }\n : {}),\n },\n module: {\n type: 'commonjs',\n },\n isModule: 'unknown',\n env: {\n targets: {\n // Setting the Node.js version can reduce unnecessary code generation.\n node: process?.versions?.node ?? '20.19.0',\n },\n },\n } satisfies SWCOptions\n}\n\nasync function loadTsConfig(dir: string): Promise<RelevantCompilerOptions> {\n // NOTE: This doesn't fully cover the edge case for setting\n // \"typescript.tsconfigPath\" in next config which is currently\n // a restriction.\n // It's a chicken-and-egg problem since we need to transpile\n // the next config to get that value.\n const resolvedTsConfigPath = path.join(dir, 'tsconfig.json')\n\n if (!existsSync(resolvedTsConfigPath)) {\n return {}\n }\n\n return loadTsConfigOptions(resolvedTsConfigPath)\n}\n\nexport async function transpileConfig({\n nextConfigPath,\n dir,\n}: {\n nextConfigPath: string\n dir: string\n}) {\n try {\n // envs are passed to the workers and preserve the flag\n if (process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED === 'true') {\n try {\n // Node.js v22.10.0+\n // Value is 'strip' or 'transform' based on how the feature is enabled.\n // https://nodejs.org/api/process.html#processfeaturestypescript\n // TODO: Remove `as any` once we bump @types/node to v22.10.0+\n if ((process.features as any).typescript) {\n // Run import() here to catch errors and fallback to legacy resolution.\n return (await import(pathToFileURL(nextConfigPath).href)).default\n }\n\n if (\n getNodeOptionsArgs().includes('--no-experimental-strip-types') ||\n process.execArgv.includes('--no-experimental-strip-types')\n ) {\n warnOnce(\n `Skipped resolving \"${path.basename(nextConfigPath)}\" using Node.js native TypeScript resolution because it was disabled by the \"--no-experimental-strip-types\" flag.` +\n ' Falling back to legacy resolution.' +\n ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts'\n )\n }\n\n // Feature is not enabled, fallback to legacy resolution for current session.\n process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false'\n } catch (cause) {\n warnOnce(\n `Failed to import \"${path.basename(nextConfigPath)}\" using Node.js native TypeScript resolution.` +\n ' Falling back to legacy resolution.' +\n ' Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#using-nodejs-native-typescript-resolver-for-nextconfigts',\n { cause }\n )\n // Once failed, fallback to legacy resolution for current session.\n process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'false'\n }\n }\n\n const compilerOptions = await loadTsConfig(dir)\n return handleCJS({ dir, nextConfigPath, compilerOptions })\n } catch (cause) {\n throw new Error(`Failed to transpile \"${path.basename(nextConfigPath)}\".`, {\n cause,\n })\n }\n}\n\nasync function handleCJS({\n dir,\n nextConfigPath,\n compilerOptions,\n}: {\n dir: string\n nextConfigPath: string\n compilerOptions: RelevantCompilerOptions\n}) {\n const swcOptions = resolveSWCOptions(dir, compilerOptions)\n let hasRequire = false\n try {\n const nextConfigString = readFileSync(nextConfigPath, 'utf8')\n // lazy require swc since it loads React before even setting NODE_ENV\n // resulting loading Development React on Production\n const { loadBindings } = require('../swc') as typeof import('../swc')\n const bindings = await loadBindings()\n const { code } = await bindings.transform(nextConfigString, swcOptions)\n\n // register require hook only if require exists\n if (code.includes('require(')) {\n registerHook(swcOptions)\n hasRequire = true\n }\n\n // filename & extension don't matter here\n const config = requireFromString(\n code,\n path.resolve(dir, 'next.config.compiled.js')\n )\n // At this point we have already loaded the bindings without this configuration setting due to the `transform` call above.\n // Possibly we fell back to wasm in which case, it all works out but if not we need to warn\n // that the configuration was ignored.\n if (config?.experimental?.useWasmBinary && !bindings.isWasm) {\n warn(\n 'Using a next.config.ts file is incompatible with `experimental.useWasmBinary` unless ' +\n '`--experimental-next-config-strip-types` is also passed.\\nSetting `useWasmBinary` to `false'\n )\n config.experimental.useWasmBinary = false\n }\n return config\n } catch (error) {\n throw error\n } finally {\n if (hasRequire) {\n deregisterHook()\n }\n }\n}\n"],"names":["transpileConfig","resolveSWCOptions","cwd","compilerOptions","process","jsc","parser","syntax","paths","baseUrl","path","resolve","pathsBasePath","module","type","isModule","env","targets","node","versions","loadTsConfig","dir","resolvedTsConfigPath","join","existsSync","loadTsConfigOptions","nextConfigPath","__NEXT_NODE_NATIVE_TS_LOADER_ENABLED","features","typescript","pathToFileURL","href","default","getNodeOptionsArgs","includes","execArgv","warnOnce","basename","cause","handleCJS","Error","swcOptions","hasRequire","config","nextConfigString","readFileSync","loadBindings","require","bindings","code","transform","registerHook","requireFromString","experimental","useWasmBinary","isWasm","warn","error","deregisterHook"],"mappings":";;;;+BA2DsBA;;;eAAAA;;;iEAzDL;wBACwB;yBACX;6BACkC;qBACjC;uBACI;8BAI5B;;;;;;AAEP,SAASC,kBACPC,GAAW,EACXC,eAAwC;QAuB5BC,mBAAAA;IArBZ,OAAO;QACLC,KAAK;YACHC,QAAQ;gBACNC,QAAQ;YACV;YACA,GAAIJ,gBAAgBK,KAAK,GAAG;gBAAEA,OAAOL,gBAAgBK,KAAK;YAAC,IAAI,CAAC,CAAC;YACjE,GAAIL,gBAAgBM,OAAO,GAEvB;gBAAEA,SAASC,iBAAI,CAACC,OAAO,CAACT,KAAKC,gBAAgBM,OAAO;YAAE,IACtDN,gBAAgBK,KAAK,GAEnB;gBAAEC,SAASN,gBAAgBS,aAAa,IAAIV;YAAI,IAChD,CAAC,CAAC;QACV;QACAW,QAAQ;YACNC,MAAM;QACR;QACAC,UAAU;QACVC,KAAK;YACHC,SAAS;gBACP,sEAAsE;gBACtEC,MAAMd,EAAAA,WAAAA,6BAAAA,oBAAAA,SAASe,QAAQ,qBAAjBf,kBAAmBc,IAAI,KAAI;YACnC;QACF;IACF;AACF;AAEA,eAAeE,aAAaC,GAAW;IACrC,2DAA2D;IAC3D,8DAA8D;IAC9D,iBAAiB;IACjB,4DAA4D;IAC5D,qCAAqC;IACrC,MAAMC,uBAAuBZ,iBAAI,CAACa,IAAI,CAACF,KAAK;IAE5C,IAAI,CAACG,IAAAA,kBAAU,EAACF,uBAAuB;QACrC,OAAO,CAAC;IACV;IAEA,OAAOG,IAAAA,iCAAmB,EAACH;AAC7B;AAEO,eAAetB,gBAAgB,EACpC0B,cAAc,EACdL,GAAG,EAIJ;IACC,IAAI;QACF,uDAAuD;QACvD,IAAIjB,QAAQY,GAAG,CAACW,oCAAoC,KAAK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AAMC,mBAAmBC,IAAAA,oBAAY,EAACnB,gBAAgB;QACtD,qEAAqE;QACrE,oDAAoD;QACpD,MAAM,EAAEoB,YAAY,EAAE,GAAGC,QAAQ;QACjC,MAAMC,WAAW,MAAMF;QACvB,MAAM,EAAEG,IAAI,EAAE,GAAG,MAAMD,SAASE,SAAS,CAACN,kBAAkBH;QAE5D,+CAA+C;QAC/C,IAAIQ,KAAKf,QAAQ,CAAC,aAAa;YAC7BiB,IAAAA,yBAAY,EAACV;YACbC,aAAa;QACf;QAEA,yCAAyC;QACzC,MAAMC,SAASS,IAAAA,8BAAiB,EAC9BH,MACAvC,iBAAI,CAACC,OAAO,CAACU,KAAK;QAEpB,0HAA0H;QAC1H,2FAA2F;QAC3F,sCAAsC;QACtC,IAAIsB,CAAAA,2BAAAA,uBAAAA,OAAQU,YAAY,qBAApBV,qBAAsBW,aAAa,KAAI,CAACN,SAASO,MAAM,EAAE;YAC3DC,IAAAA,SAAI,EACF,0FACE;YAEJb,OAAOU,YAAY,CAACC,aAAa,GAAG;QACtC;QACA,OAAOX;IACT,EAAE,OAAOc,OAAO;QACd,MAAMA;IACR,SAAU;QACR,IAAIf,YAAY;YACdgB,IAAAA,2BAAc;QAChB;IACF;AACF","ignoreList":[0]}
|
package/dist/build/swc/index.js
CHANGED
|
@@ -134,7 +134,7 @@ var HmrTarget = /*#__PURE__*/ function(HmrTarget) {
|
|
|
134
134
|
HmrTarget["Server"] = "server";
|
|
135
135
|
return HmrTarget;
|
|
136
136
|
}({});
|
|
137
|
-
const nextVersion = "16.2.
|
|
137
|
+
const nextVersion = "16.2.12";
|
|
138
138
|
const ArchName = (0, _os.arch)();
|
|
139
139
|
const PlatformName = (0, _os.platform)();
|
|
140
140
|
function infoLog(...args) {
|
|
@@ -93,7 +93,7 @@ async function turbopackAnalyze(analyzeContext) {
|
|
|
93
93
|
writeRoutesHashesManifest: false,
|
|
94
94
|
currentNodeJsVersion,
|
|
95
95
|
isPersistentCachingEnabled: persistentCaching,
|
|
96
|
-
nextVersion: "16.2.
|
|
96
|
+
nextVersion: "16.2.12"
|
|
97
97
|
}, {
|
|
98
98
|
memoryLimit: (_config_experimental2 = config.experimental) == null ? void 0 : _config_experimental2.turbopackMemoryLimit,
|
|
99
99
|
dependencyTracking: persistentCaching,
|
|
@@ -114,7 +114,7 @@ async function turbopackBuild() {
|
|
|
114
114
|
currentNodeJsVersion,
|
|
115
115
|
isPersistentCachingEnabled: persistentCaching,
|
|
116
116
|
deferredEntries: config.experimental.deferredEntries,
|
|
117
|
-
nextVersion: "16.2.
|
|
117
|
+
nextVersion: "16.2.12"
|
|
118
118
|
};
|
|
119
119
|
const sharedTurboOptions = {
|
|
120
120
|
memoryLimit: (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackMemoryLimit,
|
package/dist/build/type-check.js
CHANGED
|
@@ -61,19 +61,19 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
61
61
|
return newObj;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* TypeScript setup and type checking run in a worker so the compiler's memory
|
|
65
|
+
* can be released before the rest of the build continues.
|
|
66
66
|
*
|
|
67
67
|
* Since it is impossible to pass a function from main thread to a worker,
|
|
68
68
|
* instead of running "next/lib/typescript/runTypeCheck" in a worker,
|
|
69
69
|
* we will run entire "next/lib/verify-typescript-setup" in a worker instead.
|
|
70
|
-
*/ function verifyAndRunTypeScript(dir, distDir, strictRouteTypes, shouldRunTypeCheck, tsconfigPath, typedRoutes, disableStaticImages, cacheDir, enableWorkerThreads, hasAppDir, hasPagesDir, appDir, pagesDir, debugBuildPaths) {
|
|
70
|
+
*/ function verifyAndRunTypeScript(dir, distDir, strictRouteTypes, shouldRunTypeCheck, tsconfigPath, typedRoutes, disableStaticImages, cacheDir, enableWorkerThreads, hasAppDir, hasPagesDir, appDir, pagesDir, debugBuildPaths, useTypeScriptCli, onFirstCliOutput) {
|
|
71
71
|
let impl;
|
|
72
72
|
let typeCheckWorker;
|
|
73
|
-
if (shouldRunTypeCheck) {
|
|
73
|
+
if (shouldRunTypeCheck && !useTypeScriptCli) {
|
|
74
74
|
typeCheckWorker = new _worker.Worker(require.resolve('../lib/verify-typescript-setup'), {
|
|
75
75
|
exposedMethods: [
|
|
76
|
-
'
|
|
76
|
+
'verifyAndRunTypeScriptInWorker'
|
|
77
77
|
],
|
|
78
78
|
debuggerPortOffset: -1,
|
|
79
79
|
isolatedMemory: false,
|
|
@@ -81,10 +81,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
81
81
|
enableWorkerThreads,
|
|
82
82
|
maxRetries: 0
|
|
83
83
|
});
|
|
84
|
-
impl = typeCheckWorker.
|
|
84
|
+
impl = typeCheckWorker.verifyAndRunTypeScriptInWorker;
|
|
85
85
|
} else {
|
|
86
|
-
//
|
|
87
|
-
//
|
|
86
|
+
// No worker: either we are not type-checking (just writing setup files), or
|
|
87
|
+
// the CLI checker runs `tsc` in-process. Avoid the worker overhead.
|
|
88
88
|
impl = require('../lib/verify-typescript-setup').verifyAndRunTypeScript;
|
|
89
89
|
}
|
|
90
90
|
return impl({
|
|
@@ -100,18 +100,23 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
100
100
|
hasPagesDir,
|
|
101
101
|
appDir,
|
|
102
102
|
pagesDir,
|
|
103
|
-
debugBuildPaths
|
|
103
|
+
debugBuildPaths,
|
|
104
|
+
useTypeScriptCli,
|
|
105
|
+
onFirstCliOutput
|
|
104
106
|
}).then((result)=>{
|
|
105
107
|
typeCheckWorker == null ? void 0 : typeCheckWorker.end();
|
|
106
108
|
return result;
|
|
107
109
|
}).catch(()=>{
|
|
108
|
-
// The error is already logged in the worker
|
|
109
|
-
//
|
|
110
|
+
// The error is already logged (in the worker for the API checker, or
|
|
111
|
+
// directly for the in-process CLI checker); we simply exit to prevent the
|
|
112
|
+
// `Jest worker encountered 1 child process exceptions, exceeding retry
|
|
113
|
+
// limit` message from showing up.
|
|
110
114
|
process.exit(1);
|
|
111
115
|
});
|
|
112
116
|
}
|
|
113
117
|
async function startTypeChecking({ cacheDir, config, dir, nextBuildSpan, pagesDir, telemetry, appDir, debugBuildPaths }) {
|
|
114
118
|
const ignoreTypeScriptErrors = Boolean(config.typescript.ignoreBuildErrors);
|
|
119
|
+
const useTypeScriptCli = Boolean(config.experimental.useTypeScriptCli);
|
|
115
120
|
if (ignoreTypeScriptErrors) {
|
|
116
121
|
_log.info('Skipping validation of types');
|
|
117
122
|
}
|
|
@@ -126,7 +131,8 @@ async function startTypeChecking({ cacheDir, config, dir, nextBuildSpan, pagesDi
|
|
|
126
131
|
const typeCheckAndLintStart = process.hrtime();
|
|
127
132
|
try {
|
|
128
133
|
var _createSpinner;
|
|
129
|
-
const [verifyResult, typeCheckEnd] = await nextBuildSpan.traceChild('run-typescript').traceAsyncFn(()=>verifyAndRunTypeScript(dir, config.distDir, Boolean(config.experimental.strictRouteTypes), !ignoreTypeScriptErrors, config.typescript.tsconfigPath, Boolean(config.typedRoutes), config.images.disableStaticImages, cacheDir, config.experimental.workerThreads, !!appDir, !!pagesDir, appDir, pagesDir, debugBuildPaths
|
|
134
|
+
const [verifyResult, typeCheckEnd] = await nextBuildSpan.traceChild('run-typescript').traceAsyncFn(()=>verifyAndRunTypeScript(dir, config.distDir, Boolean(config.experimental.strictRouteTypes), !ignoreTypeScriptErrors, config.typescript.tsconfigPath, Boolean(config.typedRoutes), config.images.disableStaticImages, cacheDir, config.experimental.workerThreads, !!appDir, !!pagesDir, appDir, pagesDir, debugBuildPaths, useTypeScriptCli, // Stop the spinner before as soon as the subprocess reports output.
|
|
135
|
+
useTypeScriptCli && typeCheckingSpinner ? ()=>typeCheckingSpinner.stop() : undefined).then((resolved)=>{
|
|
130
136
|
const checkEnd = process.hrtime(typeCheckAndLintStart);
|
|
131
137
|
return [
|
|
132
138
|
resolved,
|
|
@@ -144,7 +150,8 @@ async function startTypeChecking({ cacheDir, config, dir, nextBuildSpan, pagesDi
|
|
|
144
150
|
typescriptVersion: verifyResult.version,
|
|
145
151
|
inputFilesCount: (_verifyResult_result = verifyResult.result) == null ? void 0 : _verifyResult_result.inputFilesCount,
|
|
146
152
|
totalFilesCount: (_verifyResult_result1 = verifyResult.result) == null ? void 0 : _verifyResult_result1.totalFilesCount,
|
|
147
|
-
incremental: (_verifyResult_result2 = verifyResult.result) == null ? void 0 : _verifyResult_result2.incremental
|
|
153
|
+
incremental: (_verifyResult_result2 = verifyResult.result) == null ? void 0 : _verifyResult_result2.incremental,
|
|
154
|
+
typeCheckMode: verifyResult.typeCheckMode
|
|
148
155
|
}));
|
|
149
156
|
}
|
|
150
157
|
} catch (err) {
|
|
@@ -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 *
|
|
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 setup and type checking run in a worker so the compiler's memory\n * can be released before the rest of the build continues.\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 verifyAndRunTypeScript(\n dir: string,\n distDir: string,\n strictRouteTypes: boolean,\n shouldRunTypeCheck: 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 appDir: string | undefined,\n pagesDir: string | undefined,\n debugBuildPaths: { app: string[]; pages: string[] } | undefined,\n useTypeScriptCli: boolean,\n onFirstCliOutput?: () => void\n) {\n let impl: typeof import('../lib/verify-typescript-setup').verifyAndRunTypeScript\n let typeCheckWorker:\n | (Worker & {\n verifyAndRunTypeScriptInWorker: typeof impl\n })\n | undefined\n if (shouldRunTypeCheck && !useTypeScriptCli) {\n typeCheckWorker = new Worker(\n require.resolve('../lib/verify-typescript-setup'),\n {\n exposedMethods: ['verifyAndRunTypeScriptInWorker'],\n debuggerPortOffset: -1,\n isolatedMemory: false,\n numWorkers: 1,\n enableWorkerThreads,\n maxRetries: 0,\n }\n ) as typeof typeCheckWorker\n impl = typeCheckWorker!.verifyAndRunTypeScriptInWorker\n } else {\n // No worker: either we are not type-checking (just writing setup files), or\n // the CLI checker runs `tsc` in-process. Avoid the worker overhead.\n impl = (\n require('../lib/verify-typescript-setup') as typeof import('../lib/verify-typescript-setup')\n ).verifyAndRunTypeScript\n }\n\n return impl({\n dir,\n distDir,\n strictRouteTypes,\n shouldRunTypeCheck,\n tsconfigPath,\n typedRoutes,\n disableStaticImages,\n cacheDir,\n hasAppDir,\n hasPagesDir,\n appDir,\n pagesDir,\n debugBuildPaths,\n useTypeScriptCli,\n onFirstCliOutput,\n })\n .then((result) => {\n typeCheckWorker?.end()\n return result\n })\n .catch(() => {\n // The error is already logged (in the worker for the API checker, or\n // directly for the in-process CLI checker); we simply exit to prevent the\n // `Jest worker encountered 1 child process exceptions, exceeding retry\n // limit` message 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[] } | undefined\n}) {\n const ignoreTypeScriptErrors = Boolean(config.typescript.ignoreBuildErrors)\n const useTypeScriptCli = Boolean(config.experimental.useTypeScriptCli)\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 verifyAndRunTypeScript(\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 appDir,\n pagesDir,\n debugBuildPaths,\n useTypeScriptCli,\n // Stop the spinner before as soon as the subprocess reports output.\n useTypeScriptCli && typeCheckingSpinner\n ? () => typeCheckingSpinner.stop()\n : undefined\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 typeCheckMode: verifyResult.typeCheckMode,\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":["startTypeChecking","verifyAndRunTypeScript","dir","distDir","strictRouteTypes","shouldRunTypeCheck","tsconfigPath","typedRoutes","disableStaticImages","cacheDir","enableWorkerThreads","hasAppDir","hasPagesDir","appDir","pagesDir","debugBuildPaths","useTypeScriptCli","onFirstCliOutput","impl","typeCheckWorker","Worker","require","resolve","exposedMethods","debuggerPortOffset","isolatedMemory","numWorkers","maxRetries","verifyAndRunTypeScriptInWorker","then","result","end","catch","process","exit","config","nextBuildSpan","telemetry","ignoreTypeScriptErrors","Boolean","typescript","ignoreBuildErrors","experimental","Log","info","typeCheckingSpinnerPrefixText","typeCheckingSpinner","createSpinner","typeCheckAndLintStart","hrtime","verifyResult","typeCheckEnd","traceChild","traceAsyncFn","images","workerThreads","stop","undefined","resolved","checkEnd","hrtimeDurationToString","stopAndPersist","record","eventTypeCheckCompleted","durationInSeconds","typescriptVersion","version","inputFilesCount","totalFilesCount","incremental","typeCheckMode","err","isError","message","flush"],"mappings":";;;;+BA8FsBA;;;eAAAA;;;6DA1FD;wBACE;gEACG;wBACc;gEACpB;kCACmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvC;;;;;;;CAOC,GACD,SAASC,uBACPC,GAAW,EACXC,OAAe,EACfC,gBAAyB,EACzBC,kBAA2B,EAC3BC,YAAgC,EAChCC,WAAoB,EACpBC,mBAA4B,EAC5BC,QAA4B,EAC5BC,mBAAwC,EACxCC,SAAkB,EAClBC,WAAoB,EACpBC,MAA0B,EAC1BC,QAA4B,EAC5BC,eAA+D,EAC/DC,gBAAyB,EACzBC,gBAA6B;IAE7B,IAAIC;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,IAAIE,OAAO,KAAK,8BAA8B;YAChE,MAAMpC,UAAUqC,KAAK;YACrBzC,QAAQC,IAAI,CAAC;QACf;QACA,MAAMqC;IACR;AACF","ignoreList":[0]}
|
|
@@ -1734,7 +1734,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1734
1734
|
isClient && new _copyfileplugin.CopyFilePlugin({
|
|
1735
1735
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1736
1736
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1737
|
-
cacheKey: "16.2.
|
|
1737
|
+
cacheKey: "16.2.12",
|
|
1738
1738
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1739
1739
|
minimize: false,
|
|
1740
1740
|
info: {
|
|
@@ -1928,7 +1928,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1928
1928
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1929
1929
|
// - Next.js version
|
|
1930
1930
|
// - next.config.js keys that affect compilation
|
|
1931
|
-
version: `${__dirname}|${"16.2.
|
|
1931
|
+
version: `${__dirname}|${"16.2.12"}|${configVars}`,
|
|
1932
1932
|
cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
|
|
1933
1933
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1934
1934
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -1984,7 +1984,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1984
1984
|
type: 'filesystem',
|
|
1985
1985
|
directory: cache.cacheDirectory
|
|
1986
1986
|
},
|
|
1987
|
-
version: `${__dirname}|${"16.2.
|
|
1987
|
+
version: `${__dirname}|${"16.2.12"}|${configVars}`
|
|
1988
1988
|
};
|
|
1989
1989
|
}
|
|
1990
1990
|
if (process.env.NEXT_WEBPACK_LOGGING) {
|