@visulima/tsconfig 1.1.5 → 1.1.7
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 +20 -0
- package/README.md +49 -47
- package/dist/index.cjs +16 -1
- package/dist/index.mjs +3 -1
- package/dist/packem_shared/findTsConfig-CdifbnQv.mjs +65 -0
- package/dist/packem_shared/findTsConfig-qT51EoCR.cjs +70 -0
- package/dist/packem_shared/implicitBaseUrlSymbol-BBZsxGbd.cjs +431 -0
- package/dist/packem_shared/implicitBaseUrlSymbol-CEKMlQ_X.mjs +421 -0
- package/dist/packem_shared/writeTsConfig-BImVv2Ba.mjs +18 -0
- package/dist/packem_shared/writeTsConfig-DJa7JuZ_.cjs +23 -0
- package/package.json +12 -13
- package/dist/packem_shared/findTsConfig-C77rAonk.cjs +0 -1
- package/dist/packem_shared/findTsConfig-CvOobjQ5.mjs +0 -1
- package/dist/packem_shared/implicitBaseUrlSymbol-BMiB-zfM.mjs +0 -1
- package/dist/packem_shared/implicitBaseUrlSymbol-Bfg9VyQS.cjs +0 -1
- package/dist/packem_shared/writeTsConfig-D_MA7_Uu.cjs +0 -1
- package/dist/packem_shared/writeTsConfig-Dwba2y0l.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## @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
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **tsconfig:** added support for ts 5.7, fixed compatible wrapper output, updated deps ([3110f7b](https://github.com/visulima/visulima/commit/3110f7bda8e868fa1661e0eb84a721727a8e5f04))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/fs:** upgraded to 2.3.6
|
|
11
|
+
* **@visulima/path:** upgraded to 1.3.2
|
|
12
|
+
|
|
13
|
+
## @visulima/tsconfig [1.1.6](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.1.5...@visulima/tsconfig@1.1.6) (2025-01-08)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* **@visulima/fs:** upgraded to 2.3.5
|
|
19
|
+
* **@visulima/path:** upgraded to 1.3.1
|
|
20
|
+
|
|
1
21
|
## @visulima/tsconfig [1.1.5](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.1.4...@visulima/tsconfig@1.1.5) (2025-01-08)
|
|
2
22
|
|
|
3
23
|
|
package/README.md
CHANGED
|
@@ -98,9 +98,11 @@ const tsconfig = await readTsConfig("/Users/../Projects/visulima/packages/tsconf
|
|
|
98
98
|
### TsConfigJson
|
|
99
99
|
|
|
100
100
|
```ts
|
|
101
|
-
type TsConfigJson
|
|
101
|
+
type TsConfigJson = object;
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
Defined in: node\_modules/.pnpm/type-fest@4.32.0/node\_modules/type-fest/source/tsconfig-json.d.ts:1
|
|
105
|
+
|
|
104
106
|
Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
|
|
105
107
|
|
|
106
108
|
#### Type declaration
|
|
@@ -181,10 +183,6 @@ optional watchOptions: WatchOptions;
|
|
|
181
183
|
|
|
182
184
|
Instructs the TypeScript compiler how to watch files.
|
|
183
185
|
|
|
184
|
-
#### Defined in
|
|
185
|
-
|
|
186
|
-
node\_modules/.pnpm/type-fest@4.31.0/node\_modules/type-fest/source/tsconfig-json.d.ts:1
|
|
187
|
-
|
|
188
186
|
## Other
|
|
189
187
|
|
|
190
188
|
### findTsConfig()
|
|
@@ -193,17 +191,23 @@ node\_modules/.pnpm/type-fest@4.31.0/node\_modules/type-fest/source/tsconfig-jso
|
|
|
193
191
|
function findTsConfig(cwd?, options?): Promise<TsConfigResult>
|
|
194
192
|
```
|
|
195
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)
|
|
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.
|
|
198
198
|
|
|
199
199
|
#### Parameters
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
##### cwd?
|
|
202
202
|
|
|
203
203
|
Optional. The current working directory from which to search for the "tsconfig.json" file.
|
|
204
204
|
The type of `cwd` is `string`.
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
`string` | `URL`
|
|
207
|
+
|
|
208
|
+
##### options?
|
|
209
|
+
|
|
210
|
+
`Options` = `{}`
|
|
207
211
|
|
|
208
212
|
#### Returns
|
|
209
213
|
|
|
@@ -216,10 +220,6 @@ A `Promise` that resolves to the TSConfig result object.
|
|
|
216
220
|
|
|
217
221
|
An `Error` when the "tsconfig.json" file is not found.
|
|
218
222
|
|
|
219
|
-
#### Defined in
|
|
220
|
-
|
|
221
|
-
[packages/tsconfig/src/find-tsconfig.ts:29](https://github.com/visulima/visulima/blob/316301d1103f707953e7b4fc2df3d921d0120561/packages/tsconfig/src/find-tsconfig.ts#L29)
|
|
222
|
-
|
|
223
223
|
***
|
|
224
224
|
|
|
225
225
|
### findTsConfigSync()
|
|
@@ -228,19 +228,21 @@ 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)
|
|
232
|
+
|
|
231
233
|
#### Parameters
|
|
232
234
|
|
|
233
|
-
|
|
235
|
+
##### cwd?
|
|
234
236
|
|
|
235
|
-
|
|
237
|
+
`string` | `URL`
|
|
236
238
|
|
|
237
|
-
|
|
239
|
+
##### options?
|
|
238
240
|
|
|
239
|
-
|
|
241
|
+
`Options` = `{}`
|
|
240
242
|
|
|
241
|
-
####
|
|
243
|
+
#### Returns
|
|
242
244
|
|
|
243
|
-
[
|
|
245
|
+
[`TsConfigResult`](README.md#tsconfigresult)
|
|
244
246
|
|
|
245
247
|
***
|
|
246
248
|
|
|
@@ -250,11 +252,17 @@ function findTsConfigSync(cwd?, options?): TsConfigResult
|
|
|
250
252
|
function readTsConfig(tsconfigPath, options?): object
|
|
251
253
|
```
|
|
252
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)
|
|
256
|
+
|
|
253
257
|
#### Parameters
|
|
254
258
|
|
|
255
|
-
|
|
259
|
+
##### tsconfigPath
|
|
260
|
+
|
|
261
|
+
`string`
|
|
256
262
|
|
|
257
|
-
|
|
263
|
+
##### options?
|
|
264
|
+
|
|
265
|
+
`Options`
|
|
258
266
|
|
|
259
267
|
#### Returns
|
|
260
268
|
|
|
@@ -328,10 +336,6 @@ optional watchOptions: WatchOptions;
|
|
|
328
336
|
|
|
329
337
|
Instructs the TypeScript compiler how to watch files.
|
|
330
338
|
|
|
331
|
-
#### Defined in
|
|
332
|
-
|
|
333
|
-
[packages/tsconfig/src/read-tsconfig.ts:307](https://github.com/visulima/visulima/blob/316301d1103f707953e7b4fc2df3d921d0120561/packages/tsconfig/src/read-tsconfig.ts#L307)
|
|
334
|
-
|
|
335
339
|
***
|
|
336
340
|
|
|
337
341
|
### writeTsConfig()
|
|
@@ -340,15 +344,21 @@ Instructs the TypeScript compiler how to watch files.
|
|
|
340
344
|
function writeTsConfig(tsConfig, options): Promise<void>
|
|
341
345
|
```
|
|
342
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)
|
|
348
|
+
|
|
343
349
|
An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
344
350
|
|
|
345
351
|
#### Parameters
|
|
346
352
|
|
|
347
|
-
|
|
353
|
+
##### tsConfig
|
|
354
|
+
|
|
355
|
+
[`TsConfigJson`](README.md#tsconfigjson)
|
|
348
356
|
|
|
349
357
|
The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.
|
|
350
358
|
|
|
351
|
-
|
|
359
|
+
##### options
|
|
360
|
+
|
|
361
|
+
`WriteFileOptions` & `object` & `object` = `{}`
|
|
352
362
|
|
|
353
363
|
Optional. The write options and the current working directory. The type of `options` is an
|
|
354
364
|
intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.
|
|
@@ -360,10 +370,6 @@ intersection type of `WriteOptions` and a Record type with an optional `cwd` key
|
|
|
360
370
|
A `Promise` that resolves when the tsconfig.json file has been written.
|
|
361
371
|
The return type of function is `Promise<void>`.
|
|
362
372
|
|
|
363
|
-
#### Defined in
|
|
364
|
-
|
|
365
|
-
[packages/tsconfig/src/write-tsconfig.ts:17](https://github.com/visulima/visulima/blob/316301d1103f707953e7b4fc2df3d921d0120561/packages/tsconfig/src/write-tsconfig.ts#L17)
|
|
366
|
-
|
|
367
373
|
***
|
|
368
374
|
|
|
369
375
|
### writeTsConfigSync()
|
|
@@ -372,15 +378,21 @@ The return type of function is `Promise<void>`.
|
|
|
372
378
|
function writeTsConfigSync(tsConfig, options): void
|
|
373
379
|
```
|
|
374
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)
|
|
382
|
+
|
|
375
383
|
A function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
376
384
|
|
|
377
385
|
#### Parameters
|
|
378
386
|
|
|
379
|
-
|
|
387
|
+
##### tsConfig
|
|
388
|
+
|
|
389
|
+
[`TsConfigJson`](README.md#tsconfigjson)
|
|
380
390
|
|
|
381
391
|
The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.
|
|
382
392
|
|
|
383
|
-
|
|
393
|
+
##### options
|
|
394
|
+
|
|
395
|
+
`WriteFileOptions` & `object` & `object` = `{}`
|
|
384
396
|
|
|
385
397
|
Optional. The write options and the current working directory. The type of `options` is an
|
|
386
398
|
intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.
|
|
@@ -392,10 +404,6 @@ intersection type of `WriteOptions` and a Record type with an optional `cwd` key
|
|
|
392
404
|
A `Promise` that resolves when the tsconfig.json file has been written.
|
|
393
405
|
The return type of function is `Promise<void>`.
|
|
394
406
|
|
|
395
|
-
#### Defined in
|
|
396
|
-
|
|
397
|
-
[packages/tsconfig/src/write-tsconfig.ts:35](https://github.com/visulima/visulima/blob/316301d1103f707953e7b4fc2df3d921d0120561/packages/tsconfig/src/write-tsconfig.ts#L35)
|
|
398
|
-
|
|
399
407
|
***
|
|
400
408
|
|
|
401
409
|
### implicitBaseUrlSymbol
|
|
@@ -404,30 +412,28 @@ The return type of function is `Promise<void>`.
|
|
|
404
412
|
const implicitBaseUrlSymbol: typeof implicitBaseUrlSymbol;
|
|
405
413
|
```
|
|
406
414
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
[packages/tsconfig/src/read-tsconfig.ts:304](https://github.com/visulima/visulima/blob/316301d1103f707953e7b4fc2df3d921d0120561/packages/tsconfig/src/read-tsconfig.ts#L304)
|
|
415
|
+
Defined in: [packages/tsconfig/src/read-tsconfig.ts:382](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/read-tsconfig.ts#L382)
|
|
410
416
|
|
|
411
417
|
***
|
|
412
418
|
|
|
413
419
|
### TsConfigJsonResolved
|
|
414
420
|
|
|
415
421
|
```ts
|
|
416
|
-
type TsConfigJsonResolved
|
|
422
|
+
type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
|
|
417
423
|
```
|
|
418
424
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
[packages/tsconfig/src/types.ts:3](https://github.com/visulima/visulima/blob/316301d1103f707953e7b4fc2df3d921d0120561/packages/tsconfig/src/types.ts#L3)
|
|
425
|
+
Defined in: [packages/tsconfig/src/types.ts:3](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/types.ts#L3)
|
|
422
426
|
|
|
423
427
|
***
|
|
424
428
|
|
|
425
429
|
### TsConfigResult
|
|
426
430
|
|
|
427
431
|
```ts
|
|
428
|
-
type TsConfigResult
|
|
432
|
+
type TsConfigResult = object;
|
|
429
433
|
```
|
|
430
434
|
|
|
435
|
+
Defined in: [packages/tsconfig/src/find-tsconfig.ts:14](https://github.com/visulima/visulima/blob/7109f09ce8790dae1c6a683d6432ecc715d17e9f/packages/tsconfig/src/find-tsconfig.ts#L14)
|
|
436
|
+
|
|
431
437
|
#### Type declaration
|
|
432
438
|
|
|
433
439
|
##### config
|
|
@@ -442,10 +448,6 @@ config: TsConfigJsonResolved;
|
|
|
442
448
|
path: string;
|
|
443
449
|
```
|
|
444
450
|
|
|
445
|
-
#### Defined in
|
|
446
|
-
|
|
447
|
-
[packages/tsconfig/src/find-tsconfig.ts:14](https://github.com/visulima/visulima/blob/316301d1103f707953e7b4fc2df3d921d0120561/packages/tsconfig/src/find-tsconfig.ts#L14)
|
|
448
|
-
|
|
449
451
|
## File
|
|
450
452
|
|
|
451
453
|
- [TsConfigJson](README.md#tsconfigjson)
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const findTsConfig = require('./packem_shared/findTsConfig-qT51EoCR.cjs');
|
|
6
|
+
const implicitBaseUrlSymbol = require('./packem_shared/implicitBaseUrlSymbol-BBZsxGbd.cjs');
|
|
7
|
+
const writeTsConfig = require('./packem_shared/writeTsConfig-DJa7JuZ_.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.findTsConfig = findTsConfig.findTsConfig;
|
|
12
|
+
exports.findTsConfigSync = findTsConfig.findTsConfigSync;
|
|
13
|
+
exports.implicitBaseUrlSymbol = implicitBaseUrlSymbol.implicitBaseUrlSymbol;
|
|
14
|
+
exports.readTsConfig = implicitBaseUrlSymbol.readTsConfig;
|
|
15
|
+
exports.writeTsConfig = writeTsConfig.writeTsConfig;
|
|
16
|
+
exports.writeTsConfigSync = writeTsConfig.writeTsConfigSync;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { findTsConfig, findTsConfigSync } from './packem_shared/findTsConfig-CdifbnQv.mjs';
|
|
2
|
+
export { implicitBaseUrlSymbol, readTsConfig } from './packem_shared/implicitBaseUrlSymbol-CEKMlQ_X.mjs';
|
|
3
|
+
export { writeTsConfig, writeTsConfigSync } from './packem_shared/writeTsConfig-BImVv2Ba.mjs';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { findUp, findUpSync } from '@visulima/fs';
|
|
2
|
+
import { NotFoundError } from '@visulima/fs/error';
|
|
3
|
+
import { readTsConfig } from './implicitBaseUrlSymbol-CEKMlQ_X.mjs';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
const TsConfigFileCache = /* @__PURE__ */ new Map();
|
|
8
|
+
const findTsConfig = /* @__PURE__ */ __name(async (cwd, options = {}) => {
|
|
9
|
+
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
10
|
+
let filePath = await findUp(configFileName, {
|
|
11
|
+
...cwd && { cwd },
|
|
12
|
+
type: "file"
|
|
13
|
+
});
|
|
14
|
+
if (!filePath) {
|
|
15
|
+
filePath = await findUp("jsconfig.json", {
|
|
16
|
+
...cwd && { cwd },
|
|
17
|
+
type: "file"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (!filePath) {
|
|
21
|
+
throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
22
|
+
}
|
|
23
|
+
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
24
|
+
if (options.cache && cache.has(filePath)) {
|
|
25
|
+
return cache.get(filePath);
|
|
26
|
+
}
|
|
27
|
+
const output = {
|
|
28
|
+
config: readTsConfig(filePath),
|
|
29
|
+
path: filePath
|
|
30
|
+
};
|
|
31
|
+
if (options.cache) {
|
|
32
|
+
cache.set(filePath, output);
|
|
33
|
+
}
|
|
34
|
+
return output;
|
|
35
|
+
}, "findTsConfig");
|
|
36
|
+
const findTsConfigSync = /* @__PURE__ */ __name((cwd, options = {}) => {
|
|
37
|
+
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
38
|
+
let filePath = findUpSync(configFileName, {
|
|
39
|
+
...cwd && { cwd },
|
|
40
|
+
type: "file"
|
|
41
|
+
});
|
|
42
|
+
if (!filePath) {
|
|
43
|
+
filePath = findUpSync("jsconfig.json", {
|
|
44
|
+
...cwd && { cwd },
|
|
45
|
+
type: "file"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!filePath) {
|
|
49
|
+
throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
50
|
+
}
|
|
51
|
+
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
52
|
+
if (options.cache && cache.has(filePath)) {
|
|
53
|
+
return cache.get(filePath);
|
|
54
|
+
}
|
|
55
|
+
const output = {
|
|
56
|
+
config: readTsConfig(filePath),
|
|
57
|
+
path: filePath
|
|
58
|
+
};
|
|
59
|
+
if (options.cache) {
|
|
60
|
+
cache.set(filePath, output);
|
|
61
|
+
}
|
|
62
|
+
return output;
|
|
63
|
+
}, "findTsConfigSync");
|
|
64
|
+
|
|
65
|
+
export { findTsConfig, findTsConfigSync };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const fs = require('@visulima/fs');
|
|
6
|
+
const error = require('@visulima/fs/error');
|
|
7
|
+
const implicitBaseUrlSymbol = require('./implicitBaseUrlSymbol-BBZsxGbd.cjs');
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
+
const TsConfigFileCache = /* @__PURE__ */ new Map();
|
|
12
|
+
const findTsConfig = /* @__PURE__ */ __name(async (cwd, options = {}) => {
|
|
13
|
+
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
14
|
+
let filePath = await fs.findUp(configFileName, {
|
|
15
|
+
...cwd && { cwd },
|
|
16
|
+
type: "file"
|
|
17
|
+
});
|
|
18
|
+
if (!filePath) {
|
|
19
|
+
filePath = await fs.findUp("jsconfig.json", {
|
|
20
|
+
...cwd && { cwd },
|
|
21
|
+
type: "file"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (!filePath) {
|
|
25
|
+
throw new error.NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
26
|
+
}
|
|
27
|
+
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
28
|
+
if (options.cache && cache.has(filePath)) {
|
|
29
|
+
return cache.get(filePath);
|
|
30
|
+
}
|
|
31
|
+
const output = {
|
|
32
|
+
config: implicitBaseUrlSymbol.readTsConfig(filePath),
|
|
33
|
+
path: filePath
|
|
34
|
+
};
|
|
35
|
+
if (options.cache) {
|
|
36
|
+
cache.set(filePath, output);
|
|
37
|
+
}
|
|
38
|
+
return output;
|
|
39
|
+
}, "findTsConfig");
|
|
40
|
+
const findTsConfigSync = /* @__PURE__ */ __name((cwd, options = {}) => {
|
|
41
|
+
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
42
|
+
let filePath = fs.findUpSync(configFileName, {
|
|
43
|
+
...cwd && { cwd },
|
|
44
|
+
type: "file"
|
|
45
|
+
});
|
|
46
|
+
if (!filePath) {
|
|
47
|
+
filePath = fs.findUpSync("jsconfig.json", {
|
|
48
|
+
...cwd && { cwd },
|
|
49
|
+
type: "file"
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (!filePath) {
|
|
53
|
+
throw new error.NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
54
|
+
}
|
|
55
|
+
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
56
|
+
if (options.cache && cache.has(filePath)) {
|
|
57
|
+
return cache.get(filePath);
|
|
58
|
+
}
|
|
59
|
+
const output = {
|
|
60
|
+
config: implicitBaseUrlSymbol.readTsConfig(filePath),
|
|
61
|
+
path: filePath
|
|
62
|
+
};
|
|
63
|
+
if (options.cache) {
|
|
64
|
+
cache.set(filePath, output);
|
|
65
|
+
}
|
|
66
|
+
return output;
|
|
67
|
+
}, "findTsConfigSync");
|
|
68
|
+
|
|
69
|
+
exports.findTsConfig = findTsConfig;
|
|
70
|
+
exports.findTsConfigSync = findTsConfigSync;
|