@visulima/tsconfig 1.1.7 → 1.1.9

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/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## @visulima/tsconfig [1.1.9](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.1.8...@visulima/tsconfig@1.1.9) (2025-01-21)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **tsconfig:** added missing tscCompatible option on findTsConfig and findTsConfigSync ([9f56637](https://github.com/visulima/visulima/commit/9f56637b5158f6364fa3e1c215ec9e7f2022a161))
6
+ * **tsconfig:** fixed tscCompatible default on jsdoc ([fa80961](https://github.com/visulima/visulima/commit/fa809618aec6ec5f8777beb384509ed6c6794d43))
7
+
8
+ ## @visulima/tsconfig [1.1.8](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.1.7...@visulima/tsconfig@1.1.8) (2025-01-13)
9
+
10
+ ### Bug Fixes
11
+
12
+ * **tsconfig:** adjusted error messages and added check for config placeholder ([91304e1](https://github.com/visulima/visulima/commit/91304e1126993b7c002fd16a406185a908b64074))
13
+ * **tsconfig:** fixed resolution of rootDir and baseUrl, fixed correct behavior of tsCompatibleWrapper ([20d25d7](https://github.com/visulima/visulima/commit/20d25d79f41ab7a8946c50f8e31c1646a6032d4c))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * **@visulima/fs:** upgraded to 2.3.7
19
+ * **@visulima/path:** upgraded to 1.3.3
20
+
1
21
  ## @visulima/tsconfig [1.1.7](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.1.6...@visulima/tsconfig@1.1.7) (2025-01-12)
2
22
 
3
23
  ### Bug Fixes
package/README.md CHANGED
@@ -191,7 +191,7 @@ Instructs the TypeScript compiler how to watch files.
191
191
  function findTsConfig(cwd?, options?): Promise<TsConfigResult>
192
192
  ```
193
193
 
194
- Defined in: [packages/tsconfig/src/find-tsconfig.ts:29](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/find-tsconfig.ts#L29)
194
+ Defined in: [packages/tsconfig/src/find-tsconfig.ts:30](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/find-tsconfig.ts#L30)
195
195
 
196
196
  An asynchronous function that retrieves the TSConfig by searching for the "tsconfig.json" first,
197
197
  second attempt is to look for the "jsconfig.json" file from a given current working directory.
@@ -207,7 +207,7 @@ Optional. The current working directory from which to search for the "tsconfig.j
207
207
 
208
208
  ##### options?
209
209
 
210
- `Options` = `{}`
210
+ [`FindTsConfigOptions`](README.md#findtsconfigoptions) = `{}`
211
211
 
212
212
  #### Returns
213
213
 
@@ -228,7 +228,7 @@ An `Error` when the "tsconfig.json" file is not found.
228
228
  function findTsConfigSync(cwd?, options?): TsConfigResult
229
229
  ```
230
230
 
231
- Defined in: [packages/tsconfig/src/find-tsconfig.ts:66](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/find-tsconfig.ts#L66)
231
+ Defined in: [packages/tsconfig/src/find-tsconfig.ts:69](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/find-tsconfig.ts#L69)
232
232
 
233
233
  #### Parameters
234
234
 
@@ -238,7 +238,7 @@ Defined in: [packages/tsconfig/src/find-tsconfig.ts:66](https://github.com/visul
238
238
 
239
239
  ##### options?
240
240
 
241
- `Options` = `{}`
241
+ [`FindTsConfigOptions`](README.md#findtsconfigoptions) = `{}`
242
242
 
243
243
  #### Returns
244
244
 
@@ -252,7 +252,7 @@ Defined in: [packages/tsconfig/src/find-tsconfig.ts:66](https://github.com/visul
252
252
  function readTsConfig(tsconfigPath, options?): object
253
253
  ```
254
254
 
255
- Defined in: [packages/tsconfig/src/read-tsconfig.ts:385](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/read-tsconfig.ts#L385)
255
+ Defined in: [packages/tsconfig/src/read-tsconfig.ts:460](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/read-tsconfig.ts#L460)
256
256
 
257
257
  #### Parameters
258
258
 
@@ -262,7 +262,7 @@ Defined in: [packages/tsconfig/src/read-tsconfig.ts:385](https://github.com/visu
262
262
 
263
263
  ##### options?
264
264
 
265
- `Options`
265
+ [`ReadTsConfigOptions`](README.md#readtsconfigoptions)
266
266
 
267
267
  #### Returns
268
268
 
@@ -344,7 +344,7 @@ Instructs the TypeScript compiler how to watch files.
344
344
  function writeTsConfig(tsConfig, options): Promise<void>
345
345
  ```
346
346
 
347
- Defined in: [packages/tsconfig/src/write-tsconfig.ts:17](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/write-tsconfig.ts#L17)
347
+ Defined in: [packages/tsconfig/src/write-tsconfig.ts:17](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/write-tsconfig.ts#L17)
348
348
 
349
349
  An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.
350
350
 
@@ -378,7 +378,7 @@ The return type of function is `Promise<void>`.
378
378
  function writeTsConfigSync(tsConfig, options): void
379
379
  ```
380
380
 
381
- Defined in: [packages/tsconfig/src/write-tsconfig.ts:35](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/write-tsconfig.ts#L35)
381
+ Defined in: [packages/tsconfig/src/write-tsconfig.ts:35](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/write-tsconfig.ts#L35)
382
382
 
383
383
  A function that writes the provided TypeScript configuration object to a tsconfig.json file.
384
384
 
@@ -412,7 +412,61 @@ The return type of function is `Promise<void>`.
412
412
  const implicitBaseUrlSymbol: typeof implicitBaseUrlSymbol;
413
413
  ```
414
414
 
415
- Defined in: [packages/tsconfig/src/read-tsconfig.ts:382](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/read-tsconfig.ts#L382)
415
+ Defined in: [packages/tsconfig/src/read-tsconfig.ts:457](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/read-tsconfig.ts#L457)
416
+
417
+ ***
418
+
419
+ ### FindTsConfigOptions
420
+
421
+ ```ts
422
+ type FindTsConfigOptions = ReadTsConfigOptions & object;
423
+ ```
424
+
425
+ Defined in: [packages/tsconfig/src/find-tsconfig.ts:10](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/find-tsconfig.ts#L10)
426
+
427
+ #### Type declaration
428
+
429
+ ##### cache?
430
+
431
+ ```ts
432
+ optional cache:
433
+ | Map<string, TsConfigJsonResolved>
434
+ | boolean;
435
+ ```
436
+
437
+ ##### configFileName?
438
+
439
+ ```ts
440
+ optional configFileName: string;
441
+ ```
442
+
443
+ ***
444
+
445
+ ### ReadTsConfigOptions
446
+
447
+ ```ts
448
+ type ReadTsConfigOptions = object;
449
+ ```
450
+
451
+ Defined in: [packages/tsconfig/src/read-tsconfig.ts:444](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/read-tsconfig.ts#L444)
452
+
453
+ #### Type declaration
454
+
455
+ ##### tscCompatible?
456
+
457
+ ```ts
458
+ optional tscCompatible: "5.3" | "5.4" | "5.5" | "5.6" | true;
459
+ ```
460
+
461
+ Make the configuration compatible with the specified TypeScript version.
462
+
463
+ When `true`, it will make the configuration compatible with the latest TypeScript version.
464
+
465
+ ###### Default
466
+
467
+ ```ts
468
+ undefined
469
+ ```
416
470
 
417
471
  ***
418
472
 
@@ -422,7 +476,7 @@ Defined in: [packages/tsconfig/src/read-tsconfig.ts:382](https://github.com/visu
422
476
  type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
423
477
  ```
424
478
 
425
- Defined in: [packages/tsconfig/src/types.ts:3](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/types.ts#L3)
479
+ Defined in: [packages/tsconfig/src/types.ts:3](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/types.ts#L3)
426
480
 
427
481
  ***
428
482
 
@@ -432,7 +486,7 @@ Defined in: [packages/tsconfig/src/types.ts:3](https://github.com/visulima/visul
432
486
  type TsConfigResult = object;
433
487
  ```
434
488
 
435
- Defined in: [packages/tsconfig/src/find-tsconfig.ts:14](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/find-tsconfig.ts#L14)
489
+ Defined in: [packages/tsconfig/src/find-tsconfig.ts:15](https://github.com/visulima/visulima/blob/fa809618aec6ec5f8777beb384509ed6c6794d43/packages/tsconfig/src/find-tsconfig.ts#L15)
436
490
 
437
491
  #### Type declaration
438
492
 
@@ -461,6 +515,8 @@ path: string;
461
515
  - [writeTsConfigSync](README.md#writetsconfigsync)
462
516
  - [TsConfigJson](namespaces/TsConfigJson/README.md)
463
517
  - [implicitBaseUrlSymbol](README.md#implicitbaseurlsymbol)
518
+ - [FindTsConfigOptions](README.md#findtsconfigoptions)
519
+ - [ReadTsConfigOptions](README.md#readtsconfigoptions)
464
520
  - [TsConfigJsonResolved](README.md#tsconfigjsonresolved)
465
521
  - [TsConfigResult](README.md#tsconfigresult)
466
522
 
package/dist/index.cjs CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
4
 
5
- const findTsConfig = require('./packem_shared/findTsConfig-qT51EoCR.cjs');
6
- const implicitBaseUrlSymbol = require('./packem_shared/implicitBaseUrlSymbol-BBZsxGbd.cjs');
5
+ const findTsConfig = require('./packem_shared/findTsConfig-DeoHFadL.cjs');
6
+ const implicitBaseUrlSymbol = require('./packem_shared/implicitBaseUrlSymbol-COTDbERy.cjs');
7
7
  const writeTsConfig = require('./packem_shared/writeTsConfig-DJa7JuZ_.cjs');
8
8
 
9
9
 
package/dist/index.d.cts CHANGED
@@ -1397,6 +1397,12 @@ type TsConfigJson = {
1397
1397
  type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
1398
1398
 
1399
1399
  type Options$1 = {
1400
+ tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | true;
1401
+ };
1402
+ declare const implicitBaseUrlSymbol: unique symbol;
1403
+ declare const readTsConfig: (tsconfigPath: string, options?: Options$1) => TsConfigJsonResolved;
1404
+
1405
+ type Options = Options$1 & {
1400
1406
  cache?: Map<string, TsConfigJsonResolved> | boolean;
1401
1407
  configFileName?: string;
1402
1408
  };
@@ -1404,14 +1410,8 @@ type TsConfigResult = {
1404
1410
  config: TsConfigJsonResolved;
1405
1411
  path: string;
1406
1412
  };
1407
- declare const findTsConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
1408
- declare const findTsConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
1409
-
1410
- type Options = {
1411
- tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | true;
1412
- };
1413
- declare const implicitBaseUrlSymbol: unique symbol;
1414
- declare const readTsConfig: (tsconfigPath: string, options?: Options) => TsConfigJsonResolved;
1413
+ declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
1414
+ declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
1415
1415
 
1416
1416
  declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
1417
1417
  cwd?: URL | string;
@@ -1420,4 +1420,4 @@ declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOpt
1420
1420
  cwd?: URL | string;
1421
1421
  }) => void;
1422
1422
 
1423
- export { TsConfigJson, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
1423
+ export { type Options as FindTsConfigOptions, type Options$1 as ReadTsConfigOptions, TsConfigJson, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
package/dist/index.d.mts CHANGED
@@ -1397,6 +1397,12 @@ type TsConfigJson = {
1397
1397
  type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
1398
1398
 
1399
1399
  type Options$1 = {
1400
+ tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | true;
1401
+ };
1402
+ declare const implicitBaseUrlSymbol: unique symbol;
1403
+ declare const readTsConfig: (tsconfigPath: string, options?: Options$1) => TsConfigJsonResolved;
1404
+
1405
+ type Options = Options$1 & {
1400
1406
  cache?: Map<string, TsConfigJsonResolved> | boolean;
1401
1407
  configFileName?: string;
1402
1408
  };
@@ -1404,14 +1410,8 @@ type TsConfigResult = {
1404
1410
  config: TsConfigJsonResolved;
1405
1411
  path: string;
1406
1412
  };
1407
- declare const findTsConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
1408
- declare const findTsConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
1409
-
1410
- type Options = {
1411
- tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | true;
1412
- };
1413
- declare const implicitBaseUrlSymbol: unique symbol;
1414
- declare const readTsConfig: (tsconfigPath: string, options?: Options) => TsConfigJsonResolved;
1413
+ declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
1414
+ declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
1415
1415
 
1416
1416
  declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
1417
1417
  cwd?: URL | string;
@@ -1420,4 +1420,4 @@ declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOpt
1420
1420
  cwd?: URL | string;
1421
1421
  }) => void;
1422
1422
 
1423
- export { TsConfigJson, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
1423
+ export { type Options as FindTsConfigOptions, type Options$1 as ReadTsConfigOptions, TsConfigJson, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
package/dist/index.d.ts CHANGED
@@ -1397,6 +1397,12 @@ type TsConfigJson = {
1397
1397
  type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
1398
1398
 
1399
1399
  type Options$1 = {
1400
+ tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | true;
1401
+ };
1402
+ declare const implicitBaseUrlSymbol: unique symbol;
1403
+ declare const readTsConfig: (tsconfigPath: string, options?: Options$1) => TsConfigJsonResolved;
1404
+
1405
+ type Options = Options$1 & {
1400
1406
  cache?: Map<string, TsConfigJsonResolved> | boolean;
1401
1407
  configFileName?: string;
1402
1408
  };
@@ -1404,14 +1410,8 @@ type TsConfigResult = {
1404
1410
  config: TsConfigJsonResolved;
1405
1411
  path: string;
1406
1412
  };
1407
- declare const findTsConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
1408
- declare const findTsConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
1409
-
1410
- type Options = {
1411
- tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | true;
1412
- };
1413
- declare const implicitBaseUrlSymbol: unique symbol;
1414
- declare const readTsConfig: (tsconfigPath: string, options?: Options) => TsConfigJsonResolved;
1413
+ declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
1414
+ declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
1415
1415
 
1416
1416
  declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
1417
1417
  cwd?: URL | string;
@@ -1420,4 +1420,4 @@ declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOpt
1420
1420
  cwd?: URL | string;
1421
1421
  }) => void;
1422
1422
 
1423
- export { TsConfigJson, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
1423
+ export { type Options as FindTsConfigOptions, type Options$1 as ReadTsConfigOptions, TsConfigJson, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { findTsConfig, findTsConfigSync } from './packem_shared/findTsConfig-CdifbnQv.mjs';
2
- export { implicitBaseUrlSymbol, readTsConfig } from './packem_shared/implicitBaseUrlSymbol-CEKMlQ_X.mjs';
1
+ export { findTsConfig, findTsConfigSync } from './packem_shared/findTsConfig-C0Rp7UlA.mjs';
2
+ export { implicitBaseUrlSymbol, readTsConfig } from './packem_shared/implicitBaseUrlSymbol-QFe6oEcv.mjs';
3
3
  export { writeTsConfig, writeTsConfigSync } from './packem_shared/writeTsConfig-BImVv2Ba.mjs';
@@ -1,6 +1,6 @@
1
1
  import { findUp, findUpSync } from '@visulima/fs';
2
2
  import { NotFoundError } from '@visulima/fs/error';
3
- import { readTsConfig } from './implicitBaseUrlSymbol-CEKMlQ_X.mjs';
3
+ import { readTsConfig } from './implicitBaseUrlSymbol-QFe6oEcv.mjs';
4
4
 
5
5
  var __defProp = Object.defineProperty;
6
6
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
@@ -18,14 +18,16 @@ const findTsConfig = /* @__PURE__ */ __name(async (cwd, options = {}) => {
18
18
  });
19
19
  }
20
20
  if (!filePath) {
21
- throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
21
+ throw new NotFoundError("No such file or directory, for '" + configFileName + "' or 'jsconfig.json' found.");
22
22
  }
23
23
  const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
24
24
  if (options.cache && cache.has(filePath)) {
25
25
  return cache.get(filePath);
26
26
  }
27
27
  const output = {
28
- config: readTsConfig(filePath),
28
+ config: readTsConfig(filePath, {
29
+ tscCompatible: options.tscCompatible
30
+ }),
29
31
  path: filePath
30
32
  };
31
33
  if (options.cache) {
@@ -46,14 +48,16 @@ const findTsConfigSync = /* @__PURE__ */ __name((cwd, options = {}) => {
46
48
  });
47
49
  }
48
50
  if (!filePath) {
49
- throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
51
+ throw new NotFoundError("No such file or directory, for '" + configFileName + "' or 'jsconfig.json' found.");
50
52
  }
51
53
  const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
52
54
  if (options.cache && cache.has(filePath)) {
53
55
  return cache.get(filePath);
54
56
  }
55
57
  const output = {
56
- config: readTsConfig(filePath),
58
+ config: readTsConfig(filePath, {
59
+ tscCompatible: options.tscCompatible
60
+ }),
57
61
  path: filePath
58
62
  };
59
63
  if (options.cache) {
@@ -4,7 +4,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
4
4
 
5
5
  const fs = require('@visulima/fs');
6
6
  const error = require('@visulima/fs/error');
7
- const implicitBaseUrlSymbol = require('./implicitBaseUrlSymbol-BBZsxGbd.cjs');
7
+ const implicitBaseUrlSymbol = require('./implicitBaseUrlSymbol-COTDbERy.cjs');
8
8
 
9
9
  var __defProp = Object.defineProperty;
10
10
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
@@ -22,14 +22,16 @@ const findTsConfig = /* @__PURE__ */ __name(async (cwd, options = {}) => {
22
22
  });
23
23
  }
24
24
  if (!filePath) {
25
- throw new error.NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
25
+ throw new error.NotFoundError("No such file or directory, for '" + configFileName + "' or 'jsconfig.json' found.");
26
26
  }
27
27
  const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
28
28
  if (options.cache && cache.has(filePath)) {
29
29
  return cache.get(filePath);
30
30
  }
31
31
  const output = {
32
- config: implicitBaseUrlSymbol.readTsConfig(filePath),
32
+ config: implicitBaseUrlSymbol.readTsConfig(filePath, {
33
+ tscCompatible: options.tscCompatible
34
+ }),
33
35
  path: filePath
34
36
  };
35
37
  if (options.cache) {
@@ -50,14 +52,16 @@ const findTsConfigSync = /* @__PURE__ */ __name((cwd, options = {}) => {
50
52
  });
51
53
  }
52
54
  if (!filePath) {
53
- throw new error.NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
55
+ throw new error.NotFoundError("No such file or directory, for '" + configFileName + "' or 'jsconfig.json' found.");
54
56
  }
55
57
  const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
56
58
  if (options.cache && cache.has(filePath)) {
57
59
  return cache.get(filePath);
58
60
  }
59
61
  const output = {
60
- config: implicitBaseUrlSymbol.readTsConfig(filePath),
62
+ config: implicitBaseUrlSymbol.readTsConfig(filePath, {
63
+ tscCompatible: options.tscCompatible
64
+ }),
61
65
  path: filePath
62
66
  };
63
67
  if (options.cache) {
@@ -158,14 +158,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
158
158
  const readJsonc = /* @__PURE__ */ __name((jsonPath) => jsoncParser.parse(fs.readFileSync(jsonPath, { buffer: false })), "readJsonc");
159
159
  const normalizePath = /* @__PURE__ */ __name((path$1) => {
160
160
  const namespacedPath = path.toNamespacedPath(path$1);
161
- return utils.isRelative(namespacedPath) ? namespacedPath : `./${namespacedPath}`;
161
+ return utils.isRelative(namespacedPath) ? namespacedPath : "./" + namespacedPath;
162
162
  }, "normalizePath");
163
163
  const filesProperties = ["files", "include", "exclude"];
164
- const resolveExtends = /* @__PURE__ */ __name((extendsPath, fromDirectoryPath, circularExtendsTracker, options) => {
165
- const resolvedExtendsPath = resolveExtendsPath(extendsPath, fromDirectoryPath);
166
- if (!resolvedExtendsPath) {
167
- throw new error.NotFoundError(`No such file or directory, for '${extendsPath}' found.`);
168
- }
164
+ const resolveExtends = /* @__PURE__ */ __name((resolvedExtendsPath, fromDirectoryPath, circularExtendsTracker, options) => {
169
165
  if (circularExtendsTracker.has(resolvedExtendsPath)) {
170
166
  throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);
171
167
  }
@@ -224,7 +220,14 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
224
220
  const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];
225
221
  delete config.extends;
226
222
  for (const extendsPath of extendsPathList.reverse()) {
227
- const extendsConfig = resolveExtends(extendsPath, directoryPath, new Set(circularExtendsTracker), options);
223
+ const resolvedExtendsPath = resolveExtendsPath(extendsPath, directoryPath);
224
+ if (!resolvedExtendsPath) {
225
+ throw new error.NotFoundError("No such file or directory, for '" + extendsPath + "' found.");
226
+ }
227
+ const extendsConfig = resolveExtends(resolvedExtendsPath, directoryPath, new Set(circularExtendsTracker), options);
228
+ if (extendsConfig.compilerOptions?.rootDir !== undefined && !extendsConfig.compilerOptions.rootDir.startsWith(configDirectoryPlaceholder)) {
229
+ extendsConfig.compilerOptions.rootDir = path.join(path.dirname(resolvedExtendsPath), extendsConfig.compilerOptions.rootDir);
230
+ }
228
231
  const merged = {
229
232
  ...extendsConfig,
230
233
  ...config,
@@ -271,15 +274,6 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
271
274
  compilerOptions[outputField] = outputPath;
272
275
  }
273
276
  }
274
- if (options?.tscCompatible && compilerOptions.isolatedModules) {
275
- compilerOptions.preserveConstEnums = compilerOptions.preserveConstEnums ?? true;
276
- }
277
- if (options?.tscCompatible && compilerOptions.esModuleInterop) {
278
- compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;
279
- }
280
- if (options?.tscCompatible && compilerOptions.target === "esnext") {
281
- compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;
282
- }
283
277
  } else {
284
278
  config.compilerOptions = {};
285
279
  }
@@ -297,6 +291,15 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
297
291
  watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => path.resolve(directoryPath, excludePath));
298
292
  }
299
293
  }
294
+ if (config.compilerOptions?.lib) {
295
+ config.compilerOptions.lib = config.compilerOptions.lib.map((library) => library.toLowerCase());
296
+ }
297
+ if (config.compilerOptions.module) {
298
+ config.compilerOptions.module = config.compilerOptions.module.toLowerCase();
299
+ }
300
+ if (config.compilerOptions.target) {
301
+ config.compilerOptions.target = config.compilerOptions.target.toLowerCase();
302
+ }
300
303
  return config;
301
304
  }, "internalParseTsConfig");
302
305
  const interpolateConfigDirectory = /* @__PURE__ */ __name((filePath, configDirectory) => {
@@ -310,52 +313,74 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
310
313
  if (config.compilerOptions === undefined) {
311
314
  return config;
312
315
  }
313
- if (config.compilerOptions.module === "node16" && ["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options.tscCompatible))) {
314
- config.compilerOptions.allowSyntheticDefaultImports = config.compilerOptions.allowSyntheticDefaultImports ?? true;
315
- config.compilerOptions.esModuleInterop = config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "perserve" ? config.compilerOptions.esModuleInterop ?? true : config.compilerOptions.esModuleInterop ?? false;
316
- config.compilerOptions.moduleDetection = config?.compilerOptions.moduleDetection ?? (["node16", "nodenext"].includes(config.compilerOptions.module) ? "force" : "auto");
317
- let moduleResolution = "classic";
318
- switch ((config.compilerOptions?.module).toLocaleLowerCase()) {
319
- case "commonjs": {
320
- moduleResolution = "node10";
321
- break;
322
- }
323
- case "node16": {
324
- moduleResolution = "node16";
325
- break;
326
- }
327
- case "nodenext": {
328
- moduleResolution = "nodenext";
329
- break;
316
+ if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options?.tscCompatible))) {
317
+ if (config.compilerOptions.esModuleInterop === undefined && (config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "preserve")) {
318
+ config.compilerOptions.esModuleInterop = true;
319
+ }
320
+ if ((config.compilerOptions.esModuleInterop || config.compilerOptions.module === "system" || config.compilerOptions.moduleResolution === "bundler") && config.compilerOptions.allowSyntheticDefaultImports === undefined) {
321
+ config.compilerOptions.allowSyntheticDefaultImports = true;
322
+ }
323
+ if (config?.compilerOptions.moduleDetection === undefined && config.compilerOptions.module && ["node16", "nodenext"].includes(config.compilerOptions.module)) {
324
+ config.compilerOptions.moduleDetection = "force";
325
+ }
326
+ if (config.compilerOptions.moduleResolution === undefined) {
327
+ let moduleResolution = "classic";
328
+ if (config.compilerOptions.module !== undefined) {
329
+ switch ((config.compilerOptions?.module).toLocaleLowerCase()) {
330
+ case "commonjs": {
331
+ moduleResolution = "node10";
332
+ break;
333
+ }
334
+ case "node16": {
335
+ moduleResolution = "node16";
336
+ break;
337
+ }
338
+ case "nodenext": {
339
+ moduleResolution = "nodenext";
340
+ break;
341
+ }
342
+ case "preserve": {
343
+ moduleResolution = "bundler";
344
+ break;
345
+ }
346
+ }
330
347
  }
331
- case "preserve": {
332
- moduleResolution = "bundler";
333
- break;
348
+ if (moduleResolution !== "classic") {
349
+ config.compilerOptions.moduleResolution = moduleResolution;
334
350
  }
335
351
  }
336
- config.compilerOptions.moduleResolution = moduleResolution;
337
- if (["5.7"].includes(String(options.tscCompatible))) {
352
+ if (["5.7", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.moduleResolution) {
338
353
  let resolvePackageJson = false;
339
- if (config.compilerOptions.moduleResolution === "node16" || config.compilerOptions.moduleResolution === "nodenext" || config.compilerOptions.moduleResolution === "bundler") {
354
+ if (["bundler", "node16", "nodenext"].includes(config.compilerOptions.moduleResolution.toLocaleLowerCase())) {
340
355
  resolvePackageJson = true;
341
356
  }
342
- config.compilerOptions.resolvePackageJsonExports = config.compilerOptions.resolvePackageJsonExports ?? resolvePackageJson;
343
- config.compilerOptions.resolvePackageJsonImports = config.compilerOptions.resolvePackageJsonImports ?? resolvePackageJson;
357
+ if (config.compilerOptions.resolvePackageJsonExports === undefined && resolvePackageJson) {
358
+ config.compilerOptions.resolvePackageJsonExports = true;
359
+ }
360
+ if (config.compilerOptions.resolvePackageJsonImports === undefined && resolvePackageJson) {
361
+ config.compilerOptions.resolvePackageJsonImports = true;
362
+ }
344
363
  }
345
- let target = "es5";
346
- if (config.compilerOptions.module === "node16") {
347
- target = "es2022";
348
- } else if (config.compilerOptions.module === "nodenext") {
349
- target = "esnext";
364
+ if (config.compilerOptions.target === undefined) {
365
+ let target = "es5";
366
+ if (config.compilerOptions.module === "node16") {
367
+ target = "es2022";
368
+ } else if (config.compilerOptions.module === "nodenext") {
369
+ target = "esnext";
370
+ }
371
+ if (target !== "es5") {
372
+ config.compilerOptions.target = target;
373
+ }
350
374
  }
351
- config.compilerOptions.target = target;
352
- config.compilerOptions.useDefineForClassFields = config.compilerOptions.useDefineForClassFields ?? (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext");
353
- }
354
- if (config.compilerOptions.strict) {
355
- if (["5.6", "5.7", "true"].includes(String(options.tscCompatible))) {
356
- config.compilerOptions.strictBuiltinIteratorReturn = config.compilerOptions.strictBuiltinIteratorReturn ?? true;
375
+ if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target && (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext")) {
376
+ config.compilerOptions.useDefineForClassFields = true;
357
377
  }
358
- if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options.tscCompatible))) {
378
+ }
379
+ if (["5.6", "5.7", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.strict && config.compilerOptions.strictBuiltinIteratorReturn === undefined) {
380
+ config.compilerOptions.strictBuiltinIteratorReturn = true;
381
+ }
382
+ if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options?.tscCompatible))) {
383
+ if (config.compilerOptions.strict) {
359
384
  config.compilerOptions.noImplicitAny = config.compilerOptions.noImplicitAny ?? true;
360
385
  config.compilerOptions.noImplicitThis = config.compilerOptions.noImplicitThis ?? true;
361
386
  config.compilerOptions.strictNullChecks = config.compilerOptions.strictNullChecks ?? true;
@@ -363,8 +388,25 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
363
388
  config.compilerOptions.strictBindCallApply = config.compilerOptions.strictBindCallApply ?? true;
364
389
  config.compilerOptions.strictPropertyInitialization = config.compilerOptions.strictPropertyInitialization ?? true;
365
390
  config.compilerOptions.alwaysStrict = config.compilerOptions.alwaysStrict ?? true;
366
- config.compilerOptions.useUnknownInCatchVariables = config.compilerOptions.useUnknownInCatchVariables ?? true;
367
391
  }
392
+ if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target) {
393
+ let useDefineForClassFields = false;
394
+ if (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext") {
395
+ useDefineForClassFields = true;
396
+ }
397
+ if (useDefineForClassFields) {
398
+ config.compilerOptions.useDefineForClassFields = true;
399
+ }
400
+ }
401
+ if (config.compilerOptions.strict && config.compilerOptions.useUnknownInCatchVariables === undefined) {
402
+ config.compilerOptions.useUnknownInCatchVariables = true;
403
+ }
404
+ if (config.compilerOptions.isolatedModules) {
405
+ config.compilerOptions.preserveConstEnums = config.compilerOptions.preserveConstEnums ?? true;
406
+ }
407
+ }
408
+ if (config.compileOnSave === false) {
409
+ delete config.compileOnSave;
368
410
  }
369
411
  return config;
370
412
  }, "tsCompatibleWrapper");
@@ -420,10 +462,7 @@ const readTsConfig = /* @__PURE__ */ __name((tsconfigPath, options) => {
420
462
  });
421
463
  }
422
464
  }
423
- if (options?.tscCompatible) {
424
- tsCompatibleWrapper(config, options);
425
- }
426
- return config;
465
+ return tsCompatibleWrapper(config, options);
427
466
  }, "readTsConfig");
428
467
 
429
468
  exports.configDirectoryPlaceholder = configDirectoryPlaceholder;
@@ -150,14 +150,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
150
150
  const readJsonc = /* @__PURE__ */ __name((jsonPath) => parse(readFileSync(jsonPath, { buffer: false })), "readJsonc");
151
151
  const normalizePath = /* @__PURE__ */ __name((path) => {
152
152
  const namespacedPath = toNamespacedPath(path);
153
- return isRelative(namespacedPath) ? namespacedPath : `./${namespacedPath}`;
153
+ return isRelative(namespacedPath) ? namespacedPath : "./" + namespacedPath;
154
154
  }, "normalizePath");
155
155
  const filesProperties = ["files", "include", "exclude"];
156
- const resolveExtends = /* @__PURE__ */ __name((extendsPath, fromDirectoryPath, circularExtendsTracker, options) => {
157
- const resolvedExtendsPath = resolveExtendsPath(extendsPath, fromDirectoryPath);
158
- if (!resolvedExtendsPath) {
159
- throw new NotFoundError(`No such file or directory, for '${extendsPath}' found.`);
160
- }
156
+ const resolveExtends = /* @__PURE__ */ __name((resolvedExtendsPath, fromDirectoryPath, circularExtendsTracker, options) => {
161
157
  if (circularExtendsTracker.has(resolvedExtendsPath)) {
162
158
  throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);
163
159
  }
@@ -216,7 +212,14 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
216
212
  const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];
217
213
  delete config.extends;
218
214
  for (const extendsPath of extendsPathList.reverse()) {
219
- const extendsConfig = resolveExtends(extendsPath, directoryPath, new Set(circularExtendsTracker), options);
215
+ const resolvedExtendsPath = resolveExtendsPath(extendsPath, directoryPath);
216
+ if (!resolvedExtendsPath) {
217
+ throw new NotFoundError("No such file or directory, for '" + extendsPath + "' found.");
218
+ }
219
+ const extendsConfig = resolveExtends(resolvedExtendsPath, directoryPath, new Set(circularExtendsTracker), options);
220
+ if (extendsConfig.compilerOptions?.rootDir !== undefined && !extendsConfig.compilerOptions.rootDir.startsWith(configDirectoryPlaceholder)) {
221
+ extendsConfig.compilerOptions.rootDir = join(dirname(resolvedExtendsPath), extendsConfig.compilerOptions.rootDir);
222
+ }
220
223
  const merged = {
221
224
  ...extendsConfig,
222
225
  ...config,
@@ -263,15 +266,6 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
263
266
  compilerOptions[outputField] = outputPath;
264
267
  }
265
268
  }
266
- if (options?.tscCompatible && compilerOptions.isolatedModules) {
267
- compilerOptions.preserveConstEnums = compilerOptions.preserveConstEnums ?? true;
268
- }
269
- if (options?.tscCompatible && compilerOptions.esModuleInterop) {
270
- compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;
271
- }
272
- if (options?.tscCompatible && compilerOptions.target === "esnext") {
273
- compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;
274
- }
275
269
  } else {
276
270
  config.compilerOptions = {};
277
271
  }
@@ -289,6 +283,15 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
289
283
  watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => resolve(directoryPath, excludePath));
290
284
  }
291
285
  }
286
+ if (config.compilerOptions?.lib) {
287
+ config.compilerOptions.lib = config.compilerOptions.lib.map((library) => library.toLowerCase());
288
+ }
289
+ if (config.compilerOptions.module) {
290
+ config.compilerOptions.module = config.compilerOptions.module.toLowerCase();
291
+ }
292
+ if (config.compilerOptions.target) {
293
+ config.compilerOptions.target = config.compilerOptions.target.toLowerCase();
294
+ }
292
295
  return config;
293
296
  }, "internalParseTsConfig");
294
297
  const interpolateConfigDirectory = /* @__PURE__ */ __name((filePath, configDirectory) => {
@@ -302,52 +305,74 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
302
305
  if (config.compilerOptions === undefined) {
303
306
  return config;
304
307
  }
305
- if (config.compilerOptions.module === "node16" && ["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options.tscCompatible))) {
306
- config.compilerOptions.allowSyntheticDefaultImports = config.compilerOptions.allowSyntheticDefaultImports ?? true;
307
- config.compilerOptions.esModuleInterop = config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "perserve" ? config.compilerOptions.esModuleInterop ?? true : config.compilerOptions.esModuleInterop ?? false;
308
- config.compilerOptions.moduleDetection = config?.compilerOptions.moduleDetection ?? (["node16", "nodenext"].includes(config.compilerOptions.module) ? "force" : "auto");
309
- let moduleResolution = "classic";
310
- switch ((config.compilerOptions?.module).toLocaleLowerCase()) {
311
- case "commonjs": {
312
- moduleResolution = "node10";
313
- break;
314
- }
315
- case "node16": {
316
- moduleResolution = "node16";
317
- break;
318
- }
319
- case "nodenext": {
320
- moduleResolution = "nodenext";
321
- break;
308
+ if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options?.tscCompatible))) {
309
+ if (config.compilerOptions.esModuleInterop === undefined && (config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "preserve")) {
310
+ config.compilerOptions.esModuleInterop = true;
311
+ }
312
+ if ((config.compilerOptions.esModuleInterop || config.compilerOptions.module === "system" || config.compilerOptions.moduleResolution === "bundler") && config.compilerOptions.allowSyntheticDefaultImports === undefined) {
313
+ config.compilerOptions.allowSyntheticDefaultImports = true;
314
+ }
315
+ if (config?.compilerOptions.moduleDetection === undefined && config.compilerOptions.module && ["node16", "nodenext"].includes(config.compilerOptions.module)) {
316
+ config.compilerOptions.moduleDetection = "force";
317
+ }
318
+ if (config.compilerOptions.moduleResolution === undefined) {
319
+ let moduleResolution = "classic";
320
+ if (config.compilerOptions.module !== undefined) {
321
+ switch ((config.compilerOptions?.module).toLocaleLowerCase()) {
322
+ case "commonjs": {
323
+ moduleResolution = "node10";
324
+ break;
325
+ }
326
+ case "node16": {
327
+ moduleResolution = "node16";
328
+ break;
329
+ }
330
+ case "nodenext": {
331
+ moduleResolution = "nodenext";
332
+ break;
333
+ }
334
+ case "preserve": {
335
+ moduleResolution = "bundler";
336
+ break;
337
+ }
338
+ }
322
339
  }
323
- case "preserve": {
324
- moduleResolution = "bundler";
325
- break;
340
+ if (moduleResolution !== "classic") {
341
+ config.compilerOptions.moduleResolution = moduleResolution;
326
342
  }
327
343
  }
328
- config.compilerOptions.moduleResolution = moduleResolution;
329
- if (["5.7"].includes(String(options.tscCompatible))) {
344
+ if (["5.7", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.moduleResolution) {
330
345
  let resolvePackageJson = false;
331
- if (config.compilerOptions.moduleResolution === "node16" || config.compilerOptions.moduleResolution === "nodenext" || config.compilerOptions.moduleResolution === "bundler") {
346
+ if (["bundler", "node16", "nodenext"].includes(config.compilerOptions.moduleResolution.toLocaleLowerCase())) {
332
347
  resolvePackageJson = true;
333
348
  }
334
- config.compilerOptions.resolvePackageJsonExports = config.compilerOptions.resolvePackageJsonExports ?? resolvePackageJson;
335
- config.compilerOptions.resolvePackageJsonImports = config.compilerOptions.resolvePackageJsonImports ?? resolvePackageJson;
349
+ if (config.compilerOptions.resolvePackageJsonExports === undefined && resolvePackageJson) {
350
+ config.compilerOptions.resolvePackageJsonExports = true;
351
+ }
352
+ if (config.compilerOptions.resolvePackageJsonImports === undefined && resolvePackageJson) {
353
+ config.compilerOptions.resolvePackageJsonImports = true;
354
+ }
336
355
  }
337
- let target = "es5";
338
- if (config.compilerOptions.module === "node16") {
339
- target = "es2022";
340
- } else if (config.compilerOptions.module === "nodenext") {
341
- target = "esnext";
356
+ if (config.compilerOptions.target === undefined) {
357
+ let target = "es5";
358
+ if (config.compilerOptions.module === "node16") {
359
+ target = "es2022";
360
+ } else if (config.compilerOptions.module === "nodenext") {
361
+ target = "esnext";
362
+ }
363
+ if (target !== "es5") {
364
+ config.compilerOptions.target = target;
365
+ }
342
366
  }
343
- config.compilerOptions.target = target;
344
- config.compilerOptions.useDefineForClassFields = config.compilerOptions.useDefineForClassFields ?? (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext");
345
- }
346
- if (config.compilerOptions.strict) {
347
- if (["5.6", "5.7", "true"].includes(String(options.tscCompatible))) {
348
- config.compilerOptions.strictBuiltinIteratorReturn = config.compilerOptions.strictBuiltinIteratorReturn ?? true;
367
+ if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target && (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext")) {
368
+ config.compilerOptions.useDefineForClassFields = true;
349
369
  }
350
- if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options.tscCompatible))) {
370
+ }
371
+ if (["5.6", "5.7", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.strict && config.compilerOptions.strictBuiltinIteratorReturn === undefined) {
372
+ config.compilerOptions.strictBuiltinIteratorReturn = true;
373
+ }
374
+ if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options?.tscCompatible))) {
375
+ if (config.compilerOptions.strict) {
351
376
  config.compilerOptions.noImplicitAny = config.compilerOptions.noImplicitAny ?? true;
352
377
  config.compilerOptions.noImplicitThis = config.compilerOptions.noImplicitThis ?? true;
353
378
  config.compilerOptions.strictNullChecks = config.compilerOptions.strictNullChecks ?? true;
@@ -355,8 +380,25 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
355
380
  config.compilerOptions.strictBindCallApply = config.compilerOptions.strictBindCallApply ?? true;
356
381
  config.compilerOptions.strictPropertyInitialization = config.compilerOptions.strictPropertyInitialization ?? true;
357
382
  config.compilerOptions.alwaysStrict = config.compilerOptions.alwaysStrict ?? true;
358
- config.compilerOptions.useUnknownInCatchVariables = config.compilerOptions.useUnknownInCatchVariables ?? true;
359
383
  }
384
+ if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target) {
385
+ let useDefineForClassFields = false;
386
+ if (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext") {
387
+ useDefineForClassFields = true;
388
+ }
389
+ if (useDefineForClassFields) {
390
+ config.compilerOptions.useDefineForClassFields = true;
391
+ }
392
+ }
393
+ if (config.compilerOptions.strict && config.compilerOptions.useUnknownInCatchVariables === undefined) {
394
+ config.compilerOptions.useUnknownInCatchVariables = true;
395
+ }
396
+ if (config.compilerOptions.isolatedModules) {
397
+ config.compilerOptions.preserveConstEnums = config.compilerOptions.preserveConstEnums ?? true;
398
+ }
399
+ }
400
+ if (config.compileOnSave === false) {
401
+ delete config.compileOnSave;
360
402
  }
361
403
  return config;
362
404
  }, "tsCompatibleWrapper");
@@ -412,10 +454,7 @@ const readTsConfig = /* @__PURE__ */ __name((tsconfigPath, options) => {
412
454
  });
413
455
  }
414
456
  }
415
- if (options?.tscCompatible) {
416
- tsCompatibleWrapper(config, options);
417
- }
418
- return config;
457
+ return tsCompatibleWrapper(config, options);
419
458
  }, "readTsConfig");
420
459
 
421
460
  export { configDirectoryPlaceholder, implicitBaseUrlSymbol, readTsConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/tsconfig",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Find and/or parse the tsconfig.json file from a directory path.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -67,8 +67,8 @@
67
67
  "CHANGELOG.md"
68
68
  ],
69
69
  "dependencies": {
70
- "@visulima/fs": "2.3.6",
71
- "@visulima/path": "1.3.2",
70
+ "@visulima/fs": "2.3.7",
71
+ "@visulima/path": "1.3.3",
72
72
  "jsonc-parser": "^3.3.1",
73
73
  "resolve-pkg-maps": "^1.0.0"
74
74
  },