diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f54553da4..a1d7fb7d6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -63,7 +63,7 @@ jobs: matrix: os: [ubuntu, windows] # Don't forget to add all new flavors to this list! - flavor: [1, 2, 3, 4, 5] + flavor: [1, 2, 3, 4, 5, 6] include: # Node 16 - flavor: 1 @@ -87,10 +87,16 @@ jobs: nodeFlag: 18 typescript: next typescriptFlag: next - # Node nightly + # Node 20 - flavor: 5 - node: 20-nightly - nodeFlag: 20_nightly + node: 20 + nodeFlag: 20 + typescript: latest + typescriptFlag: latest + # Node nightly + - flavor: 6 + node: 21-nightly + nodeFlag: 21_nightly typescript: latest typescriptFlag: latest steps: diff --git a/node20/tsconfig.json b/node20/tsconfig.json new file mode 100644 index 000000000..b99454516 --- /dev/null +++ b/node20/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "@tsconfig/node20/tsconfig.json" +} diff --git a/package.json b/package.json index dc0ea0d92..c55deb400 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "./transpilers/swc-experimental": "./transpilers/swc-experimental.js", "./node14/tsconfig.json": "./node14/tsconfig.json", "./node16/tsconfig.json": "./node16/tsconfig.json", - "./node18/tsconfig.json": "./node18/tsconfig.json" + "./node18/tsconfig.json": "./node18/tsconfig.json", + "./node20/tsconfig.json": "./node20/tsconfig.json" }, "types": "dist/index.d.ts", "bin": { @@ -55,7 +56,8 @@ "/tsconfig.schemastore-schema.json", "/node14/", "/node16/", - "/node18/" + "/node18/", + "/node20/" ], "scripts": { "lint": "dprint check", @@ -161,6 +163,7 @@ "@tsconfig/node14": "*", "@tsconfig/node16": "*", "@tsconfig/node18": "*", + "@tsconfig/node20": "*", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", diff --git a/src/test/package.spec.ts b/src/test/package.spec.ts index 5b1835e17..f3ab07e6f 100644 --- a/src/test/package.spec.ts +++ b/src/test/package.spec.ts @@ -49,4 +49,5 @@ test('should export all CJS entrypoints', () => { testsDirRequire.resolve('ts-node/node14/tsconfig.json'); testsDirRequire.resolve('ts-node/node16/tsconfig.json'); testsDirRequire.resolve('ts-node/node18/tsconfig.json'); + testsDirRequire.resolve('ts-node/node20/tsconfig.json'); }); diff --git a/src/test/tsconfig-bases.spec.ts b/src/test/tsconfig-bases.spec.ts index 29b4edc67..4ec8e8b61 100644 --- a/src/test/tsconfig-bases.spec.ts +++ b/src/test/tsconfig-bases.spec.ts @@ -27,7 +27,7 @@ test.suite('should use implicit @tsconfig/bases config when one is not loaded fr lib = 'es2023'; } - test('implicitly uses @tsconfig/node14, @tsconfig/node16, or @tsconfig/node18 compilerOptions when both TS and node versions support it', async (t) => { + test('implicitly uses @tsconfig/node14, @tsconfig/node16, @tsconfig/node18, or @tsconfig/node20 compilerOptions when both TS and node versions support it', async (t) => { const r1 = await exec(`${BIN_PATH} --showConfig`, { cwd: t.context.tmpDir, }); @@ -94,4 +94,5 @@ test.suite('should bundle @tsconfig/bases to be used in your own tsconfigs', (te test(`ts-node/node14/tsconfig.json`, macro, 'node14'); test(`ts-node/node16/tsconfig.json`, macro, 'node16'); test(`ts-node/node18/tsconfig.json`, macro, 'node18'); + test(`ts-node/node20/tsconfig.json`, macro, 'node20'); }); diff --git a/src/tsconfigs.ts b/src/tsconfigs.ts index 691cce7b6..5248befb9 100644 --- a/src/tsconfigs.ts +++ b/src/tsconfigs.ts @@ -8,6 +8,10 @@ const nodeMajor = parseInt(process.versions.node.split('.')[0], 10); */ export function getDefaultTsconfigJsonForNodeVersion(ts: TSCommon): any { const tsInternal = ts as any as TSInternal; + if (nodeMajor >= 20) { + const config = require('@tsconfig/node20/tsconfig.json'); + if (configCompatible(config)) return config; + } if (nodeMajor >= 18) { const config = require('@tsconfig/node18/tsconfig.json'); if (configCompatible(config)) return config; diff --git a/tests/tsconfig-bases/node20/tsconfig.json b/tests/tsconfig-bases/node20/tsconfig.json new file mode 100644 index 000000000..dd64cc1e4 --- /dev/null +++ b/tests/tsconfig-bases/node20/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "ts-node/node20/tsconfig.json" +} diff --git a/yarn.lock b/yarn.lock index 22468f8f5..035ecbe33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -654,6 +654,13 @@ __metadata: languageName: node linkType: hard +"@tsconfig/node20@npm:*": + version: 1.0.0 + resolution: "@tsconfig/node20@npm:1.0.0" + checksum: bb2f9ffeb73d1317f3ebfb260109b5e382cab228da2bc8b6202979605820a771fa7cf7a8defc19c9c9ae9d91d6da7b586ca3d9a1e7e1547af6a5118c462bacef + languageName: node + linkType: hard + "@types/argparse@npm:1.0.38": version: 1.0.38 resolution: "@types/argparse@npm:1.0.38" @@ -3812,6 +3819,7 @@ __metadata: "@tsconfig/node14": "*" "@tsconfig/node16": "*" "@tsconfig/node18": "*" + "@tsconfig/node20": "*" "@types/diff": ^4.0.2 "@types/lodash": ^4.14.151 "@types/node": 13.13.5