Skip to content

Commit 47d4f45

Browse files
Add @tsconfig/node20, add node 20 to test matrix (#2003)
--------- Co-authored-by: Andrew Bradley <[email protected]>
1 parent 8f6f4e5 commit 47d4f45

File tree

8 files changed

+36
-7
lines changed

8 files changed

+36
-7
lines changed

.github/workflows/continuous-integration.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
matrix:
6464
os: [ubuntu, windows]
6565
# Don't forget to add all new flavors to this list!
66-
flavor: [1, 2, 3, 4, 5]
66+
flavor: [1, 2, 3, 4, 5, 6]
6767
include:
6868
# Node 16
6969
- flavor: 1
@@ -87,10 +87,16 @@ jobs:
8787
nodeFlag: 18
8888
typescript: next
8989
typescriptFlag: next
90-
# Node nightly
90+
# Node 20
9191
- flavor: 5
92-
node: 20-nightly
93-
nodeFlag: 20_nightly
92+
node: 20
93+
nodeFlag: 20
94+
typescript: latest
95+
typescriptFlag: latest
96+
# Node nightly
97+
- flavor: 6
98+
node: 21-nightly
99+
nodeFlag: 21_nightly
94100
typescript: latest
95101
typescriptFlag: latest
96102
steps:

node20/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@tsconfig/node20/tsconfig.json"
3+
}

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"./transpilers/swc-experimental": "./transpilers/swc-experimental.js",
3131
"./node14/tsconfig.json": "./node14/tsconfig.json",
3232
"./node16/tsconfig.json": "./node16/tsconfig.json",
33-
"./node18/tsconfig.json": "./node18/tsconfig.json"
33+
"./node18/tsconfig.json": "./node18/tsconfig.json",
34+
"./node20/tsconfig.json": "./node20/tsconfig.json"
3435
},
3536
"types": "dist/index.d.ts",
3637
"bin": {
@@ -55,7 +56,8 @@
5556
"/tsconfig.schemastore-schema.json",
5657
"/node14/",
5758
"/node16/",
58-
"/node18/"
59+
"/node18/",
60+
"/node20/"
5961
],
6062
"scripts": {
6163
"lint": "dprint check",
@@ -161,6 +163,7 @@
161163
"@tsconfig/node14": "*",
162164
"@tsconfig/node16": "*",
163165
"@tsconfig/node18": "*",
166+
"@tsconfig/node20": "*",
164167
"acorn": "^8.4.1",
165168
"acorn-walk": "^8.1.1",
166169
"arg": "^4.1.0",

src/test/package.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ test('should export all CJS entrypoints', () => {
4949
testsDirRequire.resolve('ts-node/node14/tsconfig.json');
5050
testsDirRequire.resolve('ts-node/node16/tsconfig.json');
5151
testsDirRequire.resolve('ts-node/node18/tsconfig.json');
52+
testsDirRequire.resolve('ts-node/node20/tsconfig.json');
5253
});

src/test/tsconfig-bases.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test.suite('should use implicit @tsconfig/bases config when one is not loaded fr
2727
lib = 'es2023';
2828
}
2929

30-
test('implicitly uses @tsconfig/node14, @tsconfig/node16, or @tsconfig/node18 compilerOptions when both TS and node versions support it', async (t) => {
30+
test('implicitly uses @tsconfig/node14, @tsconfig/node16, @tsconfig/node18, or @tsconfig/node20 compilerOptions when both TS and node versions support it', async (t) => {
3131
const r1 = await exec(`${BIN_PATH} --showConfig`, {
3232
cwd: t.context.tmpDir,
3333
});
@@ -94,4 +94,5 @@ test.suite('should bundle @tsconfig/bases to be used in your own tsconfigs', (te
9494
test(`ts-node/node14/tsconfig.json`, macro, 'node14');
9595
test(`ts-node/node16/tsconfig.json`, macro, 'node16');
9696
test(`ts-node/node18/tsconfig.json`, macro, 'node18');
97+
test(`ts-node/node20/tsconfig.json`, macro, 'node20');
9798
});

src/tsconfigs.ts

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ const nodeMajor = parseInt(process.versions.node.split('.')[0], 10);
88
*/
99
export function getDefaultTsconfigJsonForNodeVersion(ts: TSCommon): any {
1010
const tsInternal = ts as any as TSInternal;
11+
if (nodeMajor >= 20) {
12+
const config = require('@tsconfig/node20/tsconfig.json');
13+
if (configCompatible(config)) return config;
14+
}
1115
if (nodeMajor >= 18) {
1216
const config = require('@tsconfig/node18/tsconfig.json');
1317
if (configCompatible(config)) return config;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "ts-node/node20/tsconfig.json"
3+
}

yarn.lock

+8
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,13 @@ __metadata:
654654
languageName: node
655655
linkType: hard
656656

657+
"@tsconfig/node20@npm:*":
658+
version: 1.0.0
659+
resolution: "@tsconfig/node20@npm:1.0.0"
660+
checksum: bb2f9ffeb73d1317f3ebfb260109b5e382cab228da2bc8b6202979605820a771fa7cf7a8defc19c9c9ae9d91d6da7b586ca3d9a1e7e1547af6a5118c462bacef
661+
languageName: node
662+
linkType: hard
663+
657664
"@types/argparse@npm:1.0.38":
658665
version: 1.0.38
659666
resolution: "@types/argparse@npm:1.0.38"
@@ -3812,6 +3819,7 @@ __metadata:
38123819
"@tsconfig/node14": "*"
38133820
"@tsconfig/node16": "*"
38143821
"@tsconfig/node18": "*"
3822+
"@tsconfig/node20": "*"
38153823
"@types/diff": ^4.0.2
38163824
"@types/lodash": ^4.14.151
38173825
"@types/node": 13.13.5

0 commit comments

Comments
 (0)