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
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
getTypeScriptApiMissingError: null,
|
|
7
|
+
getTypeScriptConfigurationCli: null,
|
|
8
|
+
getTypeScriptPackageInfo: null,
|
|
9
|
+
hasNativeTypeScriptPreview: null,
|
|
10
|
+
runTypeScriptCli: null
|
|
11
|
+
});
|
|
12
|
+
function _export(target, all) {
|
|
13
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: all[name]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
_export(exports, {
|
|
19
|
+
getTypeScriptApiMissingError: function() {
|
|
20
|
+
return getTypeScriptApiMissingError;
|
|
21
|
+
},
|
|
22
|
+
getTypeScriptConfigurationCli: function() {
|
|
23
|
+
return getTypeScriptConfigurationCli;
|
|
24
|
+
},
|
|
25
|
+
getTypeScriptPackageInfo: function() {
|
|
26
|
+
return getTypeScriptPackageInfo;
|
|
27
|
+
},
|
|
28
|
+
hasNativeTypeScriptPreview: function() {
|
|
29
|
+
return hasNativeTypeScriptPreview;
|
|
30
|
+
},
|
|
31
|
+
runTypeScriptCli: function() {
|
|
32
|
+
return runTypeScriptCli;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const _nodefs = require("node:fs");
|
|
36
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
37
|
+
const _nodechild_process = require("node:child_process");
|
|
38
|
+
const _crossspawn = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cross-spawn"));
|
|
39
|
+
const _picocolors = require("../picocolors");
|
|
40
|
+
const _resolvefrom = require("../resolve-from");
|
|
41
|
+
function _interop_require_default(obj) {
|
|
42
|
+
return obj && obj.__esModule ? obj : {
|
|
43
|
+
default: obj
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function getTypeScriptPackageInfo(baseDir) {
|
|
47
|
+
var _packageJson_bin;
|
|
48
|
+
let packageJsonPath;
|
|
49
|
+
try {
|
|
50
|
+
packageJsonPath = (0, _resolvefrom.resolveFrom)(baseDir, 'typescript/package.json');
|
|
51
|
+
} catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const packageJson = JSON.parse((0, _nodefs.readFileSync)(packageJsonPath, 'utf8'));
|
|
55
|
+
const packageDir = _nodepath.default.dirname(packageJsonPath);
|
|
56
|
+
const apiPath = _nodepath.default.join(packageDir, 'lib', 'typescript.js');
|
|
57
|
+
const tscBin = typeof packageJson.bin === 'string' ? packageJson.bin : (_packageJson_bin = packageJson.bin) == null ? void 0 : _packageJson_bin.tsc;
|
|
58
|
+
const tscBinPath = tscBin ? _nodepath.default.resolve(packageDir, tscBin) : undefined;
|
|
59
|
+
let tscPath = tscBinPath;
|
|
60
|
+
if (tscBinPath && (0, _nodefs.existsSync)(tscBinPath) && packageJson.type === 'module' && _nodepath.default.extname(tscBinPath) === '') {
|
|
61
|
+
// TypeScript 7's extensionless ESM bin wrapper cannot be used as Node's
|
|
62
|
+
// main entry point on Node.js 20.9. Its imported JS entry is the same CLI
|
|
63
|
+
// wrapper and works across all supported Node.js versions.
|
|
64
|
+
const tscJsPath = _nodepath.default.join(packageDir, 'lib', 'tsc.js');
|
|
65
|
+
if ((0, _nodefs.existsSync)(tscJsPath)) {
|
|
66
|
+
tscPath = tscJsPath;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
packageJsonPath,
|
|
71
|
+
packageDir,
|
|
72
|
+
version: packageJson.version,
|
|
73
|
+
apiPath: (0, _nodefs.existsSync)(apiPath) ? apiPath : undefined,
|
|
74
|
+
tscPath: tscPath && (0, _nodefs.existsSync)(tscPath) ? tscPath : undefined
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function hasNativeTypeScriptPreview(baseDir) {
|
|
78
|
+
try {
|
|
79
|
+
(0, _resolvefrom.resolveFrom)(baseDir, '@typescript/native-preview/package.json');
|
|
80
|
+
return true;
|
|
81
|
+
} catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function getTypeScriptApiMissingError(version) {
|
|
86
|
+
return Object.defineProperty(new Error(`TypeScript ${version} does not provide the compiler API required by Next.js. ` + `Enable ${(0, _picocolors.bold)('experimental.useTypeScriptCli')} in your Next.js config to use the TypeScript CLI, ` + `or install TypeScript 6 instead.`), "__NEXT_ERROR_CODE", {
|
|
87
|
+
value: "E1150",
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const terminationSignals = [
|
|
93
|
+
'SIGINT',
|
|
94
|
+
'SIGTERM',
|
|
95
|
+
'SIGHUP'
|
|
96
|
+
];
|
|
97
|
+
function runTypeScriptCli({ cwd, tscPath, args, captureOutput = false, onFirstOutput }) {
|
|
98
|
+
return new Promise((resolve, reject)=>{
|
|
99
|
+
var _child_stdout, _child_stderr;
|
|
100
|
+
const child = (0, _crossspawn.default)(process.execPath, [
|
|
101
|
+
tscPath,
|
|
102
|
+
...args
|
|
103
|
+
], {
|
|
104
|
+
cwd,
|
|
105
|
+
// TypeScript 7's Node wrapper starts the native compiler synchronously
|
|
106
|
+
// on older Node.js releases. A separate process group lets termination
|
|
107
|
+
// reach both processes instead of orphaning the native compiler.
|
|
108
|
+
detached: process.platform !== 'win32',
|
|
109
|
+
shell: false,
|
|
110
|
+
stdio: [
|
|
111
|
+
'ignore',
|
|
112
|
+
'pipe',
|
|
113
|
+
'pipe'
|
|
114
|
+
],
|
|
115
|
+
env: {
|
|
116
|
+
...process.env,
|
|
117
|
+
// Piping stdio makes `tsc` disable colored/pretty diagnostics. Restore
|
|
118
|
+
// them when we are forwarding output to a TTY (not capturing it for
|
|
119
|
+
// parsing, e.g. `--showConfig`).
|
|
120
|
+
...!captureOutput && process.stdout.isTTY ? {
|
|
121
|
+
FORCE_COLOR: '1'
|
|
122
|
+
} : undefined
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
let stdout = '';
|
|
126
|
+
let stderr = '';
|
|
127
|
+
(_child_stdout = child.stdout) == null ? void 0 : _child_stdout.setEncoding('utf8');
|
|
128
|
+
(_child_stderr = child.stderr) == null ? void 0 : _child_stderr.setEncoding('utf8');
|
|
129
|
+
if (captureOutput) {
|
|
130
|
+
var _child_stdout1, _child_stderr1;
|
|
131
|
+
(_child_stdout1 = child.stdout) == null ? void 0 : _child_stdout1.on('data', (chunk)=>{
|
|
132
|
+
stdout += chunk;
|
|
133
|
+
});
|
|
134
|
+
(_child_stderr1 = child.stderr) == null ? void 0 : _child_stderr1.on('data', (chunk)=>{
|
|
135
|
+
stderr += chunk;
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
var _child_stdout2, _child_stderr2;
|
|
139
|
+
const forward = (dest, chunk)=>{
|
|
140
|
+
onFirstOutput == null ? void 0 : onFirstOutput();
|
|
141
|
+
onFirstOutput = undefined // ensure we don't call it again
|
|
142
|
+
;
|
|
143
|
+
dest.write(chunk);
|
|
144
|
+
};
|
|
145
|
+
(_child_stdout2 = child.stdout) == null ? void 0 : _child_stdout2.on('data', (chunk)=>{
|
|
146
|
+
forward(process.stdout, chunk);
|
|
147
|
+
});
|
|
148
|
+
(_child_stderr2 = child.stderr) == null ? void 0 : _child_stderr2.on('data', (chunk)=>{
|
|
149
|
+
forward(process.stderr, chunk);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
let terminationRequested = false;
|
|
153
|
+
const terminateChild = ()=>{
|
|
154
|
+
if (terminationRequested || child.killed || child.pid === undefined) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
terminationRequested = true;
|
|
158
|
+
// The native compiler ignores SIGTERM and SIGINT, so send a kill signal.
|
|
159
|
+
// Target the whole process group so the signal reaches the native compiler whether
|
|
160
|
+
// it is a grandchild or a direct child.
|
|
161
|
+
// https://github.com/microsoft/typescript-go/pull/4592 should improve this in the long run
|
|
162
|
+
if (process.platform === 'win32') {
|
|
163
|
+
(0, _nodechild_process.spawnSync)('taskkill', [
|
|
164
|
+
'/pid',
|
|
165
|
+
String(child.pid),
|
|
166
|
+
'/T',
|
|
167
|
+
'/F'
|
|
168
|
+
], {
|
|
169
|
+
stdio: 'ignore',
|
|
170
|
+
windowsHide: true
|
|
171
|
+
});
|
|
172
|
+
} else {
|
|
173
|
+
try {
|
|
174
|
+
// https://www.youtube.com/watch?v=Fow7iUaKrq4
|
|
175
|
+
process.kill(-child.pid, 'SIGKILL');
|
|
176
|
+
} catch {
|
|
177
|
+
// The process may have exited between the lifecycle event and kill.
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const terminateOnExit = ()=>terminateChild();
|
|
182
|
+
process.once('exit', terminateOnExit);
|
|
183
|
+
const handler = ()=>{
|
|
184
|
+
terminateChild();
|
|
185
|
+
process.exit(1);
|
|
186
|
+
};
|
|
187
|
+
for (const signal of terminationSignals){
|
|
188
|
+
process.once(signal, handler);
|
|
189
|
+
}
|
|
190
|
+
const cleanup = ()=>{
|
|
191
|
+
process.off('exit', terminateOnExit);
|
|
192
|
+
for (const signal of terminationSignals){
|
|
193
|
+
process.off(signal, handler);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
let settled = false;
|
|
197
|
+
const finish = (settle)=>{
|
|
198
|
+
if (settled) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
settled = true;
|
|
202
|
+
cleanup();
|
|
203
|
+
settle();
|
|
204
|
+
};
|
|
205
|
+
child.on('error', (error)=>{
|
|
206
|
+
finish(()=>reject(error));
|
|
207
|
+
});
|
|
208
|
+
child.on('close', (code, signal)=>{
|
|
209
|
+
finish(()=>{
|
|
210
|
+
resolve({
|
|
211
|
+
exitCode: code ?? 1,
|
|
212
|
+
signal,
|
|
213
|
+
stdout,
|
|
214
|
+
stderr
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
async function getTypeScriptConfigurationCli({ baseDir, tsConfigPath, tscPath }) {
|
|
221
|
+
const result = await runTypeScriptCli({
|
|
222
|
+
cwd: baseDir,
|
|
223
|
+
tscPath,
|
|
224
|
+
args: [
|
|
225
|
+
'--showConfig',
|
|
226
|
+
'--project',
|
|
227
|
+
tsConfigPath,
|
|
228
|
+
'--pretty',
|
|
229
|
+
'false'
|
|
230
|
+
],
|
|
231
|
+
captureOutput: true
|
|
232
|
+
});
|
|
233
|
+
if (result.exitCode !== 0) {
|
|
234
|
+
throw Object.defineProperty(new Error([
|
|
235
|
+
result.stdout,
|
|
236
|
+
result.stderr
|
|
237
|
+
].filter(Boolean).join('\n').trim()), "__NEXT_ERROR_CODE", {
|
|
238
|
+
value: "E394",
|
|
239
|
+
enumerable: false,
|
|
240
|
+
configurable: true
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
return JSON.parse(result.stdout);
|
|
245
|
+
} catch (cause) {
|
|
246
|
+
throw Object.defineProperty(new Error(`Could not parse output from TypeScript's --showConfig.`, {
|
|
247
|
+
cause
|
|
248
|
+
}), "__NEXT_ERROR_CODE", {
|
|
249
|
+
value: "E1149",
|
|
250
|
+
enumerable: false,
|
|
251
|
+
configurable: true
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
//# sourceMappingURL=runTypeScriptCli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/typescript/runTypeScriptCli.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs'\nimport path from 'node:path'\nimport { spawnSync } from 'node:child_process'\n\nimport spawn from 'next/dist/compiled/cross-spawn'\n\nimport { bold } from '../picocolors'\nimport { resolveFrom } from '../resolve-from'\n\nexport interface TypeScriptPackageInfo {\n packageJsonPath: string\n packageDir: string\n version: string\n apiPath?: string\n tscPath?: string\n}\n\nexport function getTypeScriptPackageInfo(\n baseDir: string\n): TypeScriptPackageInfo | null {\n let packageJsonPath: string\n try {\n packageJsonPath = resolveFrom(baseDir, 'typescript/package.json')\n } catch {\n return null\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n version: string\n type?: string\n bin?: string | Record<string, string>\n }\n const packageDir = path.dirname(packageJsonPath)\n const apiPath = path.join(packageDir, 'lib', 'typescript.js')\n const tscBin =\n typeof packageJson.bin === 'string' ? packageJson.bin : packageJson.bin?.tsc\n const tscBinPath = tscBin ? path.resolve(packageDir, tscBin) : undefined\n let tscPath = tscBinPath\n\n if (\n tscBinPath &&\n existsSync(tscBinPath) &&\n packageJson.type === 'module' &&\n path.extname(tscBinPath) === ''\n ) {\n // TypeScript 7's extensionless ESM bin wrapper cannot be used as Node's\n // main entry point on Node.js 20.9. Its imported JS entry is the same CLI\n // wrapper and works across all supported Node.js versions.\n const tscJsPath = path.join(packageDir, 'lib', 'tsc.js')\n if (existsSync(tscJsPath)) {\n tscPath = tscJsPath\n }\n }\n\n return {\n packageJsonPath,\n packageDir,\n version: packageJson.version,\n apiPath: existsSync(apiPath) ? apiPath : undefined,\n tscPath: tscPath && existsSync(tscPath) ? tscPath : undefined,\n }\n}\n\nexport function hasNativeTypeScriptPreview(baseDir: string): boolean {\n try {\n resolveFrom(baseDir, '@typescript/native-preview/package.json')\n return true\n } catch {\n return false\n }\n}\n\nexport function getTypeScriptApiMissingError(version: string): Error {\n return new Error(\n `TypeScript ${version} does not provide the compiler API required by Next.js. ` +\n `Enable ${bold('experimental.useTypeScriptCli')} in your Next.js config to use the TypeScript CLI, ` +\n `or install TypeScript 6 instead.`\n )\n}\n\nexport interface TypeScriptCliResult {\n exitCode: number\n signal: NodeJS.Signals | null\n stdout: string\n stderr: string\n}\n\nconst terminationSignals: NodeJS.Signals[] = ['SIGINT', 'SIGTERM', 'SIGHUP']\n\nexport function runTypeScriptCli({\n cwd,\n tscPath,\n args,\n captureOutput = false,\n onFirstOutput,\n}: {\n cwd: string\n tscPath: string\n args: string[]\n /**\n * Accumulate stdout/stderr into the resolved result instead of forwarding it\n * to this process's stdout/stderr (for e.g. parsing `--showConfig` output).\n */\n captureOutput?: boolean\n /**\n * Called once, on the first chunk of forwarded output. Used to stop the build\n * spinner before `tsc`'s diagnostics appear. Not called when capturing.\n */\n onFirstOutput?: () => void\n}): Promise<TypeScriptCliResult> {\n return new Promise((resolve, reject) => {\n const child = spawn(process.execPath, [tscPath, ...args], {\n cwd,\n // TypeScript 7's Node wrapper starts the native compiler synchronously\n // on older Node.js releases. A separate process group lets termination\n // reach both processes instead of orphaning the native compiler.\n detached: process.platform !== 'win32',\n shell: false,\n stdio: ['ignore', 'pipe', 'pipe'],\n env: {\n ...process.env,\n // Piping stdio makes `tsc` disable colored/pretty diagnostics. Restore\n // them when we are forwarding output to a TTY (not capturing it for\n // parsing, e.g. `--showConfig`).\n ...(!captureOutput && process.stdout.isTTY\n ? { FORCE_COLOR: '1' }\n : undefined),\n },\n })\n\n let stdout = ''\n let stderr = ''\n\n child.stdout?.setEncoding('utf8')\n child.stderr?.setEncoding('utf8')\n\n if (captureOutput) {\n child.stdout?.on('data', (chunk: string) => {\n stdout += chunk\n })\n child.stderr?.on('data', (chunk: string) => {\n stderr += chunk\n })\n } else {\n const forward = (dest: NodeJS.WriteStream, chunk: string) => {\n onFirstOutput?.()\n onFirstOutput = undefined // ensure we don't call it again\n dest.write(chunk)\n }\n\n child.stdout?.on('data', (chunk: string) => {\n forward(process.stdout, chunk)\n })\n child.stderr?.on('data', (chunk: string) => {\n forward(process.stderr, chunk)\n })\n }\n\n let terminationRequested = false\n const terminateChild = () => {\n if (terminationRequested || child.killed || child.pid === undefined) {\n return\n }\n terminationRequested = true\n\n // The native compiler ignores SIGTERM and SIGINT, so send a kill signal.\n // Target the whole process group so the signal reaches the native compiler whether\n // it is a grandchild or a direct child.\n // https://github.com/microsoft/typescript-go/pull/4592 should improve this in the long run\n if (process.platform === 'win32') {\n spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], {\n stdio: 'ignore',\n windowsHide: true,\n })\n } else {\n try {\n // https://www.youtube.com/watch?v=Fow7iUaKrq4\n process.kill(-child.pid, 'SIGKILL')\n } catch {\n // The process may have exited between the lifecycle event and kill.\n }\n }\n }\n const terminateOnExit = () => terminateChild()\n process.once('exit', terminateOnExit)\n\n const handler = () => {\n terminateChild()\n process.exit(1)\n }\n for (const signal of terminationSignals) {\n process.once(signal, handler)\n }\n\n const cleanup = () => {\n process.off('exit', terminateOnExit)\n for (const signal of terminationSignals) {\n process.off(signal, handler)\n }\n }\n\n let settled = false\n const finish = (settle: () => void) => {\n if (settled) {\n return\n }\n settled = true\n cleanup()\n settle()\n }\n\n child.on('error', (error) => {\n finish(() => reject(error))\n })\n child.on('close', (code, signal) => {\n finish(() => {\n resolve({\n exitCode: code ?? 1,\n signal,\n stdout,\n stderr,\n })\n })\n })\n })\n}\n\nexport async function getTypeScriptConfigurationCli({\n baseDir,\n tsConfigPath,\n tscPath,\n}: {\n baseDir: string\n tsConfigPath: string\n tscPath: string\n}): Promise<{ compilerOptions: Record<string, any> }> {\n const result = await runTypeScriptCli({\n cwd: baseDir,\n tscPath,\n args: ['--showConfig', '--project', tsConfigPath, '--pretty', 'false'],\n captureOutput: true,\n })\n\n if (result.exitCode !== 0) {\n throw new Error(\n [result.stdout, result.stderr].filter(Boolean).join('\\n').trim()\n )\n }\n\n try {\n return JSON.parse(result.stdout)\n } catch (cause) {\n throw new Error(`Could not parse output from TypeScript's --showConfig.`, {\n cause,\n })\n }\n}\n"],"names":["getTypeScriptApiMissingError","getTypeScriptConfigurationCli","getTypeScriptPackageInfo","hasNativeTypeScriptPreview","runTypeScriptCli","baseDir","packageJson","packageJsonPath","resolveFrom","JSON","parse","readFileSync","packageDir","path","dirname","apiPath","join","tscBin","bin","tsc","tscBinPath","resolve","undefined","tscPath","existsSync","type","extname","tscJsPath","version","Error","bold","terminationSignals","cwd","args","captureOutput","onFirstOutput","Promise","reject","child","spawn","process","execPath","detached","platform","shell","stdio","env","stdout","isTTY","FORCE_COLOR","stderr","setEncoding","on","chunk","forward","dest","write","terminationRequested","terminateChild","killed","pid","spawnSync","String","windowsHide","kill","terminateOnExit","once","handler","exit","signal","cleanup","off","settled","finish","settle","error","code","exitCode","tsConfigPath","result","filter","Boolean","trim","cause"],"mappings":";;;;;;;;;;;;;;;;;;IAwEgBA,4BAA4B;eAA5BA;;IA2JMC,6BAA6B;eAA7BA;;IAlNNC,wBA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AG,CAACF,QAAQF;YACtB;QACF;QAEA,IAAIK,UAAU;QACd,MAAMC,SAAS,CAACC;YACd,IAAIF,SAAS;gBACX;YACF;YACAA,UAAU;YACVF;YACAI;QACF;QAEApC,MAAMc,EAAE,CAAC,SAAS,CAACuB;YACjBF,OAAO,IAAMpC,OAAOsC;QACtB;QACArC,MAAMc,EAAE,CAAC,SAAS,CAACwB,MAAMP;YACvBI,OAAO;gBACLpD,QAAQ;oBACNwD,UAAUD,QAAQ;oBAClBP;oBACAtB;oBACAG;gBACF;YACF;QACF;IACF;AACF;AAEO,eAAejD,8BAA8B,EAClDI,OAAO,EACPyE,YAAY,EACZvD,OAAO,EAKR;IACC,MAAMwD,SAAS,MAAM3E,iBAAiB;QACpC4B,KAAK3B;QACLkB;QACAU,MAAM;YAAC;YAAgB;YAAa6C;YAAc;YAAY;SAAQ;QACtE5C,eAAe;IACjB;IAEA,IAAI6C,OAAOF,QAAQ,KAAK,GAAG;QACzB,MAAM,qBAEL,CAFK,IAAIhD,MACR;YAACkD,OAAOhC,MAAM;YAAEgC,OAAO7B,MAAM;SAAC,CAAC8B,MAAM,CAACC,SAASjE,IAAI,CAAC,MAAMkE,IAAI,KAD1D,qBAAA;mBAAA;wBAAA;0BAAA;QAEN;IACF;IAEA,IAAI;QACF,OAAOzE,KAAKC,KAAK,CAACqE,OAAOhC,MAAM;IACjC,EAAE,OAAOoC,OAAO;QACd,MAAM,qBAEJ,CAFI,IAAItD,MAAM,CAAC,sDAAsD,CAAC,EAAE;YACxEsD;QACF,IAFM,qBAAA;mBAAA;wBAAA;0BAAA;QAEL;IACH;AACF","ignoreList":[0]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TypeCheckResult } from './typescript/runTypeCheck';
|
|
2
|
-
export declare function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes, tsconfigPath, shouldRunTypeCheck, typedRoutes, disableStaticImages, hasAppDir, hasPagesDir, appDir, pagesDir, debugBuildPaths, }: {
|
|
2
|
+
export declare function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes, tsconfigPath, shouldRunTypeCheck, typedRoutes, disableStaticImages, hasAppDir, hasPagesDir, appDir, pagesDir, debugBuildPaths, useTypeScriptCli, onFirstCliOutput, }: {
|
|
3
3
|
dir: string;
|
|
4
4
|
distDir: string;
|
|
5
5
|
cacheDir?: string;
|
|
@@ -16,7 +16,22 @@ export declare function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictR
|
|
|
16
16
|
app?: string[];
|
|
17
17
|
pages?: string[];
|
|
18
18
|
};
|
|
19
|
+
useTypeScriptCli?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Called once when the CLI checker first produces output, so the caller can
|
|
22
|
+
* stop the build spinner. Only used on the in-process CLI path.
|
|
23
|
+
*/
|
|
24
|
+
onFirstCliOutput?: () => void;
|
|
19
25
|
}): Promise<{
|
|
20
26
|
result?: TypeCheckResult;
|
|
21
27
|
version: string | null;
|
|
28
|
+
typeCheckMode: 'typescript-api' | 'typescript-cli';
|
|
22
29
|
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Worker entrypoint used by `next build` for the TypeScript-API type-check.
|
|
32
|
+
* `verifyAndRunTypeScript` has already printed any error, so on failure we exit
|
|
33
|
+
* the worker directly rather than rethrowing: a thrown error would be retried by
|
|
34
|
+
* jest-worker and surface in the parent as the unhelpful
|
|
35
|
+
* `Jest worker encountered 1 child process exceptions, exceeding retry limit`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function verifyAndRunTypeScriptInWorker(options: Parameters<typeof verifyAndRunTypeScript>[0]): ReturnType<typeof verifyAndRunTypeScript>;
|
|
@@ -2,14 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
verifyAndRunTypeScript: null,
|
|
7
|
+
verifyAndRunTypeScriptInWorker: null
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: all[name]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
verifyAndRunTypeScript: function() {
|
|
8
17
|
return verifyAndRunTypeScript;
|
|
18
|
+
},
|
|
19
|
+
verifyAndRunTypeScriptInWorker: function() {
|
|
20
|
+
return verifyAndRunTypeScriptInWorker;
|
|
9
21
|
}
|
|
10
22
|
});
|
|
11
23
|
const _picocolors = require("./picocolors");
|
|
12
|
-
const _path = /*#__PURE__*/
|
|
24
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
25
|
const _hasnecessarydependencies = require("./has-necessary-dependencies");
|
|
14
26
|
const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver"));
|
|
15
27
|
const _compileerror = require("./compile-error");
|
|
@@ -20,7 +32,7 @@ const _writeConfigurationDefaults = require("./typescript/writeConfigurationDefa
|
|
|
20
32
|
const _installdependencies = require("./install-dependencies");
|
|
21
33
|
const _ciinfo = require("../server/ci-info");
|
|
22
34
|
const _missingDependencyError = require("./typescript/missingDependencyError");
|
|
23
|
-
const
|
|
35
|
+
const _runTypeScriptCli = require("./typescript/runTypeScriptCli");
|
|
24
36
|
function _interop_require_default(obj) {
|
|
25
37
|
return obj && obj.__esModule ? obj : {
|
|
26
38
|
default: obj
|
|
@@ -67,13 +79,18 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
67
79
|
}
|
|
68
80
|
return newObj;
|
|
69
81
|
}
|
|
70
|
-
const
|
|
82
|
+
const typescriptApiPackage = {
|
|
71
83
|
file: 'typescript/lib/typescript.js',
|
|
72
84
|
pkg: 'typescript',
|
|
85
|
+
install: 'typescript@^6.0.0',
|
|
73
86
|
exportsRestrict: true
|
|
74
87
|
};
|
|
75
|
-
const
|
|
76
|
-
|
|
88
|
+
const typescriptCliPackage = {
|
|
89
|
+
file: 'typescript/bin/tsc',
|
|
90
|
+
pkg: 'typescript',
|
|
91
|
+
exportsRestrict: true
|
|
92
|
+
};
|
|
93
|
+
const requiredTypePackages = [
|
|
77
94
|
{
|
|
78
95
|
file: '@types/react/index.d.ts',
|
|
79
96
|
pkg: '@types/react',
|
|
@@ -85,21 +102,10 @@ const requiredPackages = [
|
|
|
85
102
|
exportsRestrict: true
|
|
86
103
|
}
|
|
87
104
|
];
|
|
88
|
-
|
|
89
|
-
* Check if @typescript/native-preview is installed as an alternative TypeScript compiler.
|
|
90
|
-
* This is a Go-based native TypeScript compiler that can be used instead of the standard
|
|
91
|
-
* TypeScript package for faster compilation.
|
|
92
|
-
*/ function hasNativeTypeScriptPreview(dir) {
|
|
93
|
-
try {
|
|
94
|
-
(0, _resolvefrom.resolveFrom)(dir, '@typescript/native-preview/package.json');
|
|
95
|
-
return true;
|
|
96
|
-
} catch {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes, tsconfigPath, shouldRunTypeCheck, typedRoutes, disableStaticImages, hasAppDir, hasPagesDir, appDir, pagesDir, debugBuildPaths }) {
|
|
105
|
+
async function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes, tsconfigPath, shouldRunTypeCheck, typedRoutes, disableStaticImages, hasAppDir, hasPagesDir, appDir, pagesDir, debugBuildPaths, useTypeScriptCli = false, onFirstCliOutput }) {
|
|
101
106
|
const tsConfigFileName = tsconfigPath || 'tsconfig.json';
|
|
102
107
|
const resolvedTsConfigPath = _path.default.join(dir, tsConfigFileName);
|
|
108
|
+
const typeCheckMode = useTypeScriptCli ? 'typescript-cli' : 'typescript-api';
|
|
103
109
|
// Construct intentDirs from appDir and pagesDir for getTypeScriptIntent
|
|
104
110
|
const intentDirs = [
|
|
105
111
|
pagesDir,
|
|
@@ -111,17 +117,26 @@ async function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes
|
|
|
111
117
|
const intent = await (0, _getTypeScriptIntent.getTypeScriptIntent)(dir, intentDirs, tsConfigFileName);
|
|
112
118
|
if (!intent) {
|
|
113
119
|
return {
|
|
114
|
-
version: null
|
|
120
|
+
version: null,
|
|
121
|
+
typeCheckMode
|
|
115
122
|
};
|
|
116
123
|
}
|
|
117
124
|
// Check if @typescript/native-preview is installed as an alternative
|
|
118
|
-
const hasNativePreview = hasNativeTypeScriptPreview(dir);
|
|
125
|
+
const hasNativePreview = (0, _runTypeScriptCli.hasNativeTypeScriptPreview)(dir);
|
|
126
|
+
const installedTypeScript = (0, _runTypeScriptCli.getTypeScriptPackageInfo)(dir);
|
|
127
|
+
if (!useTypeScriptCli && !hasNativePreview && installedTypeScript && !installedTypeScript.apiPath) {
|
|
128
|
+
throw (0, _runTypeScriptCli.getTypeScriptApiMissingError)(installedTypeScript.version);
|
|
129
|
+
}
|
|
130
|
+
const requiredPackages = [
|
|
131
|
+
useTypeScriptCli ? typescriptCliPackage : typescriptApiPackage,
|
|
132
|
+
...requiredTypePackages
|
|
133
|
+
];
|
|
119
134
|
// Ensure TypeScript and necessary `@types/*` are installed:
|
|
120
135
|
let deps = (0, _hasnecessarydependencies.hasNecessaryDependencies)(dir, requiredPackages);
|
|
121
136
|
// If @typescript/native-preview is installed and only the typescript package is missing,
|
|
122
137
|
// we can skip auto-installing typescript since the native preview provides TS compilation.
|
|
123
138
|
// However, we still need @types/react and @types/node for type checking.
|
|
124
|
-
if (hasNativePreview && ((_deps_missing = deps.missing) == null ? void 0 : _deps_missing.length) > 0) {
|
|
139
|
+
if (!useTypeScriptCli && hasNativePreview && ((_deps_missing = deps.missing) == null ? void 0 : _deps_missing.length) > 0) {
|
|
125
140
|
const missingWithoutTypescript = deps.missing.filter((dep)=>dep.pkg !== 'typescript');
|
|
126
141
|
const onlyTypescriptMissing = deps.missing.length === 1 && deps.missing[0].pkg === 'typescript';
|
|
127
142
|
if (onlyTypescriptMissing) {
|
|
@@ -139,7 +154,8 @@ async function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes
|
|
|
139
154
|
typedRoutes
|
|
140
155
|
});
|
|
141
156
|
return {
|
|
142
|
-
version: null
|
|
157
|
+
version: null,
|
|
158
|
+
typeCheckMode
|
|
143
159
|
};
|
|
144
160
|
}
|
|
145
161
|
// If there are other missing deps besides typescript, only install those
|
|
@@ -162,10 +178,14 @@ async function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes
|
|
|
162
178
|
});
|
|
163
179
|
deps = (0, _hasnecessarydependencies.hasNecessaryDependencies)(dir, requiredPackages);
|
|
164
180
|
}
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
181
|
+
const typeScriptPackage = (0, _runTypeScriptCli.getTypeScriptPackageInfo)(dir);
|
|
182
|
+
const typeScriptPath = useTypeScriptCli ? typeScriptPackage == null ? void 0 : typeScriptPackage.tscPath : typeScriptPackage == null ? void 0 : typeScriptPackage.apiPath;
|
|
183
|
+
if (!typeScriptPackage || !typeScriptPath) {
|
|
184
|
+
(0, _missingDependencyError.missingDepsError)(dir, deps.missing.length > 0 ? deps.missing : [
|
|
185
|
+
useTypeScriptCli ? typescriptCliPackage : typescriptApiPackage
|
|
186
|
+
]);
|
|
187
|
+
}
|
|
188
|
+
const typescriptVersion = typeScriptPackage.version;
|
|
169
189
|
if (_semver.default.lt(typescriptVersion, '5.1.0')) {
|
|
170
190
|
_log.warn(`Minimum recommended TypeScript version is v5.1.0, older versions can potentially be incompatible with Next.js. Detected: ${typescriptVersion}`);
|
|
171
191
|
}
|
|
@@ -184,45 +204,66 @@ async function verifyAndRunTypeScript({ dir, distDir, cacheDir, strictRouteTypes
|
|
|
184
204
|
});
|
|
185
205
|
let result;
|
|
186
206
|
if (shouldRunTypeCheck) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
207
|
+
if (useTypeScriptCli) {
|
|
208
|
+
if (debugBuildPaths) {
|
|
209
|
+
_log.warn('`experimental.useTypeScriptCli` checks the complete TypeScript project; `--debug-build-paths` does not limit type checking.');
|
|
210
|
+
}
|
|
211
|
+
const { runTypeCheckCli } = require('./typescript/runTypeCheckCli');
|
|
212
|
+
result = await runTypeCheckCli({
|
|
213
|
+
baseDir: dir,
|
|
214
|
+
tsConfigPath: resolvedTsConfigPath,
|
|
215
|
+
tscPath: typeScriptPath,
|
|
216
|
+
cacheDir,
|
|
217
|
+
onFirstOutput: onFirstCliOutput
|
|
218
|
+
});
|
|
219
|
+
} else {
|
|
220
|
+
const { runTypeCheck } = require('./typescript/runTypeCheck');
|
|
221
|
+
// Install native bindings so that code frame rendering works in the worker
|
|
222
|
+
const { installBindings } = require('../build/swc/install-bindings');
|
|
223
|
+
await installBindings();
|
|
224
|
+
const typescript = await Promise.resolve(require(typeScriptPath));
|
|
225
|
+
// Verify the project passes type-checking before we go to webpack phase:
|
|
226
|
+
result = await runTypeCheck(typescript, dir, distDir, resolvedTsConfigPath, cacheDir, hasAppDir, {
|
|
227
|
+
app: appDir,
|
|
228
|
+
pages: pagesDir
|
|
229
|
+
}, debugBuildPaths);
|
|
230
|
+
}
|
|
198
231
|
}
|
|
199
232
|
return {
|
|
200
233
|
result,
|
|
201
|
-
version: typescriptVersion
|
|
234
|
+
version: typescriptVersion,
|
|
235
|
+
typeCheckMode
|
|
202
236
|
};
|
|
203
237
|
} catch (err) {
|
|
204
|
-
//
|
|
238
|
+
// Print the user-facing message here and rethrow. This function runs both
|
|
239
|
+
// in-process (next dev / next test / next typegen, and the CLI type-check
|
|
240
|
+
// during build) and inside a jest worker (the TypeScript-API type-check
|
|
241
|
+
// during build). A thrown error does not survive the worker boundary — the
|
|
242
|
+
// parent only sees `Call retries were exceeded` — so the message must be
|
|
243
|
+
// printed on this side. The caller decides what to do with the throw (exit,
|
|
244
|
+
// or tolerate it as `next dev` does on re-verification).
|
|
205
245
|
if (err instanceof _compileerror.CompileError) {
|
|
246
|
+
// The checker already printed its diagnostics.
|
|
206
247
|
console.error((0, _picocolors.red)('Failed to type check.\n'));
|
|
207
|
-
|
|
208
|
-
process.exit(1);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* verifyAndRunTypeScript can be either invoked directly in the main thread (during next dev / next lint)
|
|
212
|
-
* or run in a worker (during next build). In the latter case, we need to print the error message, as the
|
|
213
|
-
* parent process will only receive an `Jest worker encountered 1 child process exceptions, exceeding retry limit`.
|
|
214
|
-
*/ // we are in a worker, print the error message and exit the process
|
|
215
|
-
if (process.env.IS_NEXT_WORKER) {
|
|
216
|
-
if (err instanceof Error) {
|
|
248
|
+
if (err.message) {
|
|
217
249
|
console.error(err.message);
|
|
218
|
-
} else {
|
|
219
|
-
console.error(err);
|
|
220
250
|
}
|
|
221
|
-
|
|
251
|
+
} else if (err instanceof Error) {
|
|
252
|
+
console.error(err.message);
|
|
253
|
+
} else {
|
|
254
|
+
console.error(err);
|
|
222
255
|
}
|
|
223
|
-
// we are in the main thread, throw the error and it will be handled by the caller
|
|
224
256
|
throw err;
|
|
225
257
|
}
|
|
226
258
|
}
|
|
259
|
+
async function verifyAndRunTypeScriptInWorker(options) {
|
|
260
|
+
try {
|
|
261
|
+
return await verifyAndRunTypeScript(options);
|
|
262
|
+
} catch {
|
|
263
|
+
// The error was already printed by `verifyAndRunTypeScript`.
|
|
264
|
+
// Kill the worker with a non-zero exit code.
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
227
268
|
|
|
228
269
|
//# sourceMappingURL=verify-typescript-setup.js.map
|
|
@@ -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 {\n MissingDependency,\n NecessaryDependencies,\n} 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'\nimport { resolveFrom } from './resolve-from'\n\nconst typescriptPackage: MissingDependency = {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n exportsRestrict: true,\n}\n\nconst requiredPackages: MissingDependency[] = [\n typescriptPackage,\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\n/**\n * Check if @typescript/native-preview is installed as an alternative TypeScript compiler.\n * This is a Go-based native TypeScript compiler that can be used instead of the standard\n * TypeScript package for faster compilation.\n */\nfunction hasNativeTypeScriptPreview(dir: string): boolean {\n try {\n resolveFrom(dir, '@typescript/native-preview/package.json')\n return true\n } catch {\n return false\n }\n}\n\nexport async function verifyAndRunTypeScript({\n dir,\n distDir,\n cacheDir,\n strictRouteTypes,\n tsconfigPath,\n shouldRunTypeCheck,\n typedRoutes,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n appDir,\n pagesDir,\n debugBuildPaths,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n strictRouteTypes: boolean\n tsconfigPath: string | undefined\n shouldRunTypeCheck: boolean\n typedRoutes: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\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 // Check if @typescript/native-preview is installed as an alternative\n const hasNativePreview = hasNativeTypeScriptPreview(dir)\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n // If @typescript/native-preview is installed and only the typescript package is missing,\n // we can skip auto-installing typescript since the native preview provides TS compilation.\n // However, we still need @types/react and @types/node for type checking.\n if (hasNativePreview && deps.missing?.length > 0) {\n const missingWithoutTypescript = deps.missing.filter(\n (dep) => dep.pkg !== 'typescript'\n )\n const onlyTypescriptMissing =\n deps.missing.length === 1 && deps.missing[0].pkg === 'typescript'\n\n if (onlyTypescriptMissing) {\n // @typescript/native-preview is installed and only typescript is missing\n // Skip installation and return early - the project can use the native preview\n log.info(\n `Detected ${bold('@typescript/native-preview')} as TypeScript compiler. ` +\n `Some Next.js TypeScript features (like type checking during build) require the standard ${bold('typescript')} package.`\n )\n\n // Still write type declarations since they don't require the typescript package\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n strictRouteTypes,\n typedRoutes,\n })\n\n return { version: null }\n }\n\n // If there are other missing deps besides typescript, only install those\n if (\n missingWithoutTypescript.length > 0 &&\n missingWithoutTypescript.length < deps.missing.length\n ) {\n deps.missing = missingWithoutTypescript\n }\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 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 (shouldRunTypeCheck) {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n // Install native bindings so that code frame rendering works in the worker\n const { installBindings } =\n require('../build/swc/install-bindings') as typeof import('../build/swc/install-bindings')\n await installBindings()\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 { 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 type check.\\n'))\n console.error(err.message)\n process.exit(1)\n }\n\n /**\n * verifyAndRunTypeScript 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":["verifyAndRunTypeScript","typescriptPackage","file","pkg","exportsRestrict","requiredPackages","hasNativeTypeScriptPreview","dir","resolveFrom","distDir","cacheDir","strictRouteTypes","tsconfigPath","shouldRunTypeCheck","typedRoutes","disableStaticImages","hasAppDir","hasPagesDir","appDir","pagesDir","debugBuildPaths","tsConfigFileName","resolvedTsConfigPath","path","join","intentDirs","filter","Boolean","deps","intent","getTypeScriptIntent","version","hasNativePreview","hasNecessaryDependencies","missing","length","missingWithoutTypescript","dep","onlyTypescriptMissing","log","info","bold","writeAppTypeDeclarations","baseDir","imageImportsEnabled","isCI","missingDepsError","console","yellow","cyan","installDependencies","catch","err","error","command","tsPackageJsonPath","resolved","get","typescriptPackageJson","require","typescriptVersion","semver","lt","warn","writeConfigurationDefaults","firstTimeSetup","result","runTypeCheck","installBindings","tsPath","typescript","Promise","resolve","app","pages","CompileError","red","message","process","exit","env","IS_NEXT_WORKER","Error"],"mappings":";;;;+BAuDsBA;;;eAAAA;;;4BAvDkB;8DACb;0CAEc;+DAKtB;8BACU;6DACR;qCAEe;0CAEK;4CACE;qCACP;wBACf;wCACY;6BACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAACD,IAAIyB,OAAO;YACzBC,QAAQC,IAAI,CAAC;QACf;QAEA;;;;KAIC,GAED,mEAAmE;QACnE,IAAID,QAAQE,GAAG,CAACC,cAAc,EAAE;YAC9B,IAAI7B,eAAe8B,OAAO;gBACxBnC,QAAQM,KAAK,CAACD,IAAIyB,OAAO;YAC3B,OAAO;gBACL9B,QAAQM,KAAK,CAACD;YAChB;YACA0B,QAAQC,IAAI,CAAC;QACf;QACA,kFAAkF;QAClF,MAAM3B;IACR;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/verify-typescript-setup.ts"],"sourcesContent":["import { bold, cyan, red, yellow } from './picocolors'\nimport path from 'path'\n\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type {\n MissingDependency,\n NecessaryDependencies,\n} 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'\nimport {\n getTypeScriptApiMissingError,\n getTypeScriptPackageInfo,\n hasNativeTypeScriptPreview,\n} from './typescript/runTypeScriptCli'\n\nconst typescriptApiPackage: MissingDependency = {\n file: 'typescript/lib/typescript.js',\n pkg: 'typescript',\n install: 'typescript@^6.0.0',\n exportsRestrict: true,\n}\n\nconst typescriptCliPackage: MissingDependency = {\n file: 'typescript/bin/tsc',\n pkg: 'typescript',\n exportsRestrict: true,\n}\n\nconst requiredTypePackages: MissingDependency[] = [\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 verifyAndRunTypeScript({\n dir,\n distDir,\n cacheDir,\n strictRouteTypes,\n tsconfigPath,\n shouldRunTypeCheck,\n typedRoutes,\n disableStaticImages,\n hasAppDir,\n hasPagesDir,\n appDir,\n pagesDir,\n debugBuildPaths,\n useTypeScriptCli = false,\n onFirstCliOutput,\n}: {\n dir: string\n distDir: string\n cacheDir?: string\n strictRouteTypes: boolean\n tsconfigPath: string | undefined\n shouldRunTypeCheck: boolean\n typedRoutes: boolean\n disableStaticImages: boolean\n hasAppDir: boolean\n hasPagesDir: boolean\n appDir?: string\n pagesDir?: string\n debugBuildPaths?: { app?: string[]; pages?: string[] }\n useTypeScriptCli?: boolean\n /**\n * Called once when the CLI checker first produces output, so the caller can\n * stop the build spinner. Only used on the in-process CLI path.\n */\n onFirstCliOutput?: () => void\n}): Promise<{\n result?: TypeCheckResult\n version: string | null\n typeCheckMode: 'typescript-api' | 'typescript-cli'\n}> {\n const tsConfigFileName = tsconfigPath || 'tsconfig.json'\n const resolvedTsConfigPath = path.join(dir, tsConfigFileName)\n const typeCheckMode = useTypeScriptCli ? 'typescript-cli' : 'typescript-api'\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, typeCheckMode }\n }\n\n // Check if @typescript/native-preview is installed as an alternative\n const hasNativePreview = hasNativeTypeScriptPreview(dir)\n const installedTypeScript = getTypeScriptPackageInfo(dir)\n\n if (\n !useTypeScriptCli &&\n !hasNativePreview &&\n installedTypeScript &&\n !installedTypeScript.apiPath\n ) {\n throw getTypeScriptApiMissingError(installedTypeScript.version)\n }\n\n const requiredPackages: MissingDependency[] = [\n useTypeScriptCli ? typescriptCliPackage : typescriptApiPackage,\n ...requiredTypePackages,\n ]\n\n // Ensure TypeScript and necessary `@types/*` are installed:\n let deps: NecessaryDependencies = hasNecessaryDependencies(\n dir,\n requiredPackages\n )\n\n // If @typescript/native-preview is installed and only the typescript package is missing,\n // we can skip auto-installing typescript since the native preview provides TS compilation.\n // However, we still need @types/react and @types/node for type checking.\n if (!useTypeScriptCli && hasNativePreview && deps.missing?.length > 0) {\n const missingWithoutTypescript = deps.missing.filter(\n (dep) => dep.pkg !== 'typescript'\n )\n const onlyTypescriptMissing =\n deps.missing.length === 1 && deps.missing[0].pkg === 'typescript'\n\n if (onlyTypescriptMissing) {\n // @typescript/native-preview is installed and only typescript is missing\n // Skip installation and return early - the project can use the native preview\n log.info(\n `Detected ${bold('@typescript/native-preview')} as TypeScript compiler. ` +\n `Some Next.js TypeScript features (like type checking during build) require the standard ${bold('typescript')} package.`\n )\n\n // Still write type declarations since they don't require the typescript package\n await writeAppTypeDeclarations({\n baseDir: dir,\n distDir,\n imageImportsEnabled: !disableStaticImages,\n hasPagesDir,\n hasAppDir,\n strictRouteTypes,\n typedRoutes,\n })\n\n return { version: null, typeCheckMode }\n }\n\n // If there are other missing deps besides typescript, only install those\n if (\n missingWithoutTypescript.length > 0 &&\n missingWithoutTypescript.length < deps.missing.length\n ) {\n deps.missing = missingWithoutTypescript\n }\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 const typeScriptPackage = getTypeScriptPackageInfo(dir)\n const typeScriptPath = useTypeScriptCli\n ? typeScriptPackage?.tscPath\n : typeScriptPackage?.apiPath\n\n if (!typeScriptPackage || !typeScriptPath) {\n missingDepsError(\n dir,\n deps.missing.length > 0\n ? deps.missing\n : [useTypeScriptCli ? typescriptCliPackage : typescriptApiPackage]\n )\n }\n\n const typescriptVersion = typeScriptPackage.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 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 (shouldRunTypeCheck) {\n if (useTypeScriptCli) {\n if (debugBuildPaths) {\n log.warn(\n '`experimental.useTypeScriptCli` checks the complete TypeScript project; `--debug-build-paths` does not limit type checking.'\n )\n }\n\n const { runTypeCheckCli } =\n require('./typescript/runTypeCheckCli') as typeof import('./typescript/runTypeCheckCli')\n result = await runTypeCheckCli({\n baseDir: dir,\n tsConfigPath: resolvedTsConfigPath,\n tscPath: typeScriptPath,\n cacheDir,\n onFirstOutput: onFirstCliOutput,\n })\n } else {\n const { runTypeCheck } =\n require('./typescript/runTypeCheck') as typeof import('./typescript/runTypeCheck')\n // Install native bindings so that code frame rendering works in the worker\n const { installBindings } =\n require('../build/swc/install-bindings') as typeof import('../build/swc/install-bindings')\n await installBindings()\n\n const typescript = (await Promise.resolve(\n require(typeScriptPath)\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 { app: appDir, pages: pagesDir },\n debugBuildPaths\n )\n }\n }\n return { result, version: typescriptVersion, typeCheckMode }\n } catch (err) {\n // Print the user-facing message here and rethrow. This function runs both\n // in-process (next dev / next test / next typegen, and the CLI type-check\n // during build) and inside a jest worker (the TypeScript-API type-check\n // during build). A thrown error does not survive the worker boundary — the\n // parent only sees `Call retries were exceeded` — so the message must be\n // printed on this side. The caller decides what to do with the throw (exit,\n // or tolerate it as `next dev` does on re-verification).\n if (err instanceof CompileError) {\n // The checker already printed its diagnostics.\n console.error(red('Failed to type check.\\n'))\n if (err.message) {\n console.error(err.message)\n }\n } else if (err instanceof Error) {\n console.error(err.message)\n } else {\n console.error(err)\n }\n throw err\n }\n}\n\n/**\n * Worker entrypoint used by `next build` for the TypeScript-API type-check.\n * `verifyAndRunTypeScript` has already printed any error, so on failure we exit\n * the worker directly rather than rethrowing: a thrown error would be retried by\n * jest-worker and surface in the parent as the unhelpful\n * `Jest worker encountered 1 child process exceptions, exceeding retry limit`.\n */\nexport async function verifyAndRunTypeScriptInWorker(\n options: Parameters<typeof verifyAndRunTypeScript>[0]\n): ReturnType<typeof verifyAndRunTypeScript> {\n try {\n return await verifyAndRunTypeScript(options)\n } catch {\n // The error was already printed by `verifyAndRunTypeScript`.\n // Kill the worker with a non-zero exit code.\n process.exit(1)\n }\n}\n"],"names":["verifyAndRunTypeScript","verifyAndRunTypeScriptInWorker","typescriptApiPackage","file","pkg","install","exportsRestrict","typescriptCliPackage","requiredTypePackages","dir","distDir","cacheDir","strictRouteTypes","tsconfigPath","shouldRunTypeCheck","typedRoutes","disableStaticImages","hasAppDir","hasPagesDir","appDir","pagesDir","debugBuildPaths","useTypeScriptCli","onFirstCliOutput","tsConfigFileName","resolvedTsConfigPath","path","join","typeCheckMode","intentDirs","filter","Boolean","deps","intent","getTypeScriptIntent","version","hasNativePreview","hasNativeTypeScriptPreview","installedTypeScript","getTypeScriptPackageInfo","apiPath","getTypeScriptApiMissingError","requiredPackages","hasNecessaryDependencies","missing","length","missingWithoutTypescript","dep","onlyTypescriptMissing","log","info","bold","writeAppTypeDeclarations","baseDir","imageImportsEnabled","isCI","missingDepsError","console","yellow","cyan","installDependencies","catch","err","error","command","typeScriptPackage","typeScriptPath","tscPath","typescriptVersion","semver","lt","warn","writeConfigurationDefaults","firstTimeSetup","result","runTypeCheckCli","require","tsConfigPath","onFirstOutput","runTypeCheck","installBindings","typescript","Promise","resolve","app","pages","CompileError","red","message","Error","options","process","exit"],"mappings":";;;;;;;;;;;;;;;IAmDsBA,sBAAsB;eAAtBA;;IAiRAC,8BAA8B;eAA9BA;;;4BApUkB;6DACvB;0CAEwB;+DAKtB;8BACU;6DACR;qCAEe;0CAEK;4CACE;qCACP;wBACf;wCACY;kCAK1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEP,MAAMC,uBAA0C;IAC9CC,MAAM;IACNC,KAAK;IACLC,SAAS;IACTC,iBAAiB;AACnB;AAEA,MAAMC,uBAA0C;IAC9CJ,MAAM;IACNC,KAAK;IACLE,iBAAiB;AACnB;AAEA,MAAME,uBAA4C;IAChD;QACEL,MAAM;QACNC,KAAK;QACLE,iBAAiB;IACnB;IACA;QACEH,MAAM;QACNC,KAAK;QACLE,iBAAiB;IACnB;CACD;AAEM,eAAeN,uBAAuB,EAC3CS,GAAG,EACHC,OAAO,EACPC,QAAQ,EACRC,gBAAgB,EAChBC,YAAY,EACZC,kBAAkB,EAClBC,WAAW,EACXC,mBAAmB,EACnBC,SAAS,EACTC,WAAW,EACXC,MAAM,EACNC,QAAQ,EACRC,eAAe,EACfC,mBAAmB,KAAK,EACxBC,gBAAgB,EAqBjB;IAKC,MAAMC,mBAAmBX,gBAAgB;IACzC,MAAMY,uBAAuBC,aAAI,CAACC,IAAI,CAAClB,KAAKe;IAC5C,M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ACxE,2EAA2E;QAC3E,yEAAyE;QACzE,4EAA4E;QAC5E,yDAAyD;QACzD,IAAIA,eAAewB,0BAAY,EAAE;YAC/B,+CAA+C;YAC/C7B,QAAQM,KAAK,CAACwB,IAAAA,eAAG,EAAC;YAClB,IAAIzB,IAAI0B,OAAO,EAAE;gBACf/B,QAAQM,KAAK,CAACD,IAAI0B,OAAO;YAC3B;QACF,OAAO,IAAI1B,eAAe2B,OAAO;YAC/BhC,QAAQM,KAAK,CAACD,IAAI0B,OAAO;QAC3B,OAAO;YACL/B,QAAQM,KAAK,CAACD;QAChB;QACA,MAAMA;IACR;AACF;AASO,eAAe7D,+BACpByF,OAAqD;IAErD,IAAI;QACF,OAAO,MAAM1F,uBAAuB0F;IACtC,EAAE,OAAM;QACN,6DAA6D;QAC7D,6CAA6C;QAC7CC,QAAQC,IAAI,CAAC;IACf;AACF","ignoreList":[0]}
|
|
@@ -172,6 +172,7 @@ export declare const experimentalSchema: {
|
|
|
172
172
|
optimizePackageImports: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
173
173
|
optimizeServerReact: z.ZodOptional<z.ZodBoolean>;
|
|
174
174
|
strictRouteTypes: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
useTypeScriptCli: z.ZodOptional<z.ZodBoolean>;
|
|
175
176
|
clientTraceMetadata: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
176
177
|
serverMinification: z.ZodOptional<z.ZodBoolean>;
|
|
177
178
|
serverSourceMaps: z.ZodOptional<z.ZodBoolean>;
|