1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.getDefaultTsconfigJsonForNodeVersion = void 0;
|
4 | const nodeMajor = parseInt(process.versions.node.split('.')[0], 10);
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | function getDefaultTsconfigJsonForNodeVersion(ts) {
|
11 | const tsInternal = ts;
|
12 | if (nodeMajor >= 16) {
|
13 | const config = require('@tsconfig/node16/tsconfig.json');
|
14 | if (configCompatible(config))
|
15 | return config;
|
16 | }
|
17 | if (nodeMajor >= 14) {
|
18 | const config = require('@tsconfig/node14/tsconfig.json');
|
19 | if (configCompatible(config))
|
20 | return config;
|
21 | }
|
22 | if (nodeMajor >= 12) {
|
23 | const config = require('@tsconfig/node12/tsconfig.json');
|
24 | if (configCompatible(config))
|
25 | return config;
|
26 | }
|
27 | return require('@tsconfig/node10/tsconfig.json');
|
28 |
|
29 | function configCompatible(config) {
|
30 | return (typeof ts.ScriptTarget[config.compilerOptions.target.toUpperCase()] === 'number' &&
|
31 | tsInternal.libs &&
|
32 | config.compilerOptions.lib.every((lib) => tsInternal.libs.includes(lib)));
|
33 | }
|
34 | }
|
35 | exports.getDefaultTsconfigJsonForNodeVersion = getDefaultTsconfigJsonForNodeVersion;
|
36 |
|
\ | No newline at end of file |