@visulima/tsconfig 1.1.21 → 1.1.22
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 +11 -0
- package/README.md +13 -13
- package/dist/index.cjs +1 -16
- package/dist/index.mjs +1 -3
- package/dist/packem_shared/findTsConfig-BBvqkZJ6.cjs +1 -0
- package/dist/packem_shared/findTsConfig-BxbLTzwF.mjs +1 -0
- package/dist/packem_shared/implicitBaseUrlSymbol-CP1i_A8H.mjs +1 -0
- package/dist/packem_shared/implicitBaseUrlSymbol-DMcyudm3.cjs +1 -0
- package/dist/packem_shared/writeTsConfig-0IO4xPZJ.mjs +1 -0
- package/dist/packem_shared/writeTsConfig-C99ubsh6.cjs +1 -0
- package/package.json +2 -2
- package/dist/packem_shared/findTsConfig-B5QKwx1b.cjs +0 -74
- package/dist/packem_shared/findTsConfig-CPPNXDV7.mjs +0 -69
- package/dist/packem_shared/implicitBaseUrlSymbol-ClUn71e4.cjs +0 -470
- package/dist/packem_shared/implicitBaseUrlSymbol-CqmKQyEp.mjs +0 -460
- package/dist/packem_shared/writeTsConfig-CcokKUZl.mjs +0 -18
- package/dist/packem_shared/writeTsConfig-DJa7JuZ_.cjs +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## @visulima/tsconfig [1.1.22](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.1.21...@visulima/tsconfig@1.1.22) (2025-09-19)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* **deps:** update build scripts and remove cross-env dependency ([7510e82](https://github.com/visulima/visulima/commit/7510e826b9235a0013fe61c82a7eb333bc4cbb78))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/fs:** upgraded to 3.1.8
|
|
11
|
+
|
|
1
12
|
## @visulima/tsconfig [1.1.21](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.1.20...@visulima/tsconfig@1.1.21) (2025-09-12)
|
|
2
13
|
|
|
3
14
|
### Miscellaneous Chores
|
package/README.md
CHANGED
|
@@ -209,7 +209,7 @@ Instructs the TypeScript compiler how to watch files.
|
|
|
209
209
|
function findTsConfig(cwd?, options?): Promise<TsConfigResult>;
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
Defined in: [packages/tsconfig/src/find-tsconfig.ts:30](https://github.com/visulima/visulima/blob/
|
|
212
|
+
Defined in: [packages/tsconfig/src/find-tsconfig.ts:30](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/find-tsconfig.ts#L30)
|
|
213
213
|
|
|
214
214
|
An asynchronous function that retrieves the TSConfig by searching for the "tsconfig.json" first,
|
|
215
215
|
second attempt is to look for the "jsconfig.json" file from a given current working directory.
|
|
@@ -246,7 +246,7 @@ An `Error` when the "tsconfig.json" file is not found.
|
|
|
246
246
|
function findTsConfigSync(cwd?, options?): TsConfigResult;
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
Defined in: [packages/tsconfig/src/find-tsconfig.ts:69](https://github.com/visulima/visulima/blob/
|
|
249
|
+
Defined in: [packages/tsconfig/src/find-tsconfig.ts:69](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/find-tsconfig.ts#L69)
|
|
250
250
|
|
|
251
251
|
#### Parameters
|
|
252
252
|
|
|
@@ -270,7 +270,7 @@ Defined in: [packages/tsconfig/src/find-tsconfig.ts:69](https://github.com/visul
|
|
|
270
270
|
function readTsConfig(tsconfigPath, options?): object;
|
|
271
271
|
```
|
|
272
272
|
|
|
273
|
-
Defined in: [packages/tsconfig/src/read-tsconfig.ts:460](https://github.com/visulima/visulima/blob/
|
|
273
|
+
Defined in: [packages/tsconfig/src/read-tsconfig.ts:460](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/read-tsconfig.ts#L460)
|
|
274
274
|
|
|
275
275
|
#### Parameters
|
|
276
276
|
|
|
@@ -360,7 +360,7 @@ Instructs the TypeScript compiler how to watch files.
|
|
|
360
360
|
function writeTsConfig(tsConfig, options): Promise<void>;
|
|
361
361
|
```
|
|
362
362
|
|
|
363
|
-
Defined in: [packages/tsconfig/src/write-tsconfig.ts:17](https://github.com/visulima/visulima/blob/
|
|
363
|
+
Defined in: [packages/tsconfig/src/write-tsconfig.ts:17](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/write-tsconfig.ts#L17)
|
|
364
364
|
|
|
365
365
|
An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
366
366
|
|
|
@@ -394,7 +394,7 @@ The return type of function is `Promise<void>`.
|
|
|
394
394
|
function writeTsConfigSync(tsConfig, options): void;
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
Defined in: [packages/tsconfig/src/write-tsconfig.ts:35](https://github.com/visulima/visulima/blob/
|
|
397
|
+
Defined in: [packages/tsconfig/src/write-tsconfig.ts:35](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/write-tsconfig.ts#L35)
|
|
398
398
|
|
|
399
399
|
A function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
400
400
|
|
|
@@ -428,7 +428,7 @@ The return type of function is `Promise<void>`.
|
|
|
428
428
|
const implicitBaseUrlSymbol: typeof implicitBaseUrlSymbol;
|
|
429
429
|
```
|
|
430
430
|
|
|
431
|
-
Defined in: [packages/tsconfig/src/read-tsconfig.ts:457](https://github.com/visulima/visulima/blob/
|
|
431
|
+
Defined in: [packages/tsconfig/src/read-tsconfig.ts:457](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/read-tsconfig.ts#L457)
|
|
432
432
|
|
|
433
433
|
***
|
|
434
434
|
|
|
@@ -438,7 +438,7 @@ Defined in: [packages/tsconfig/src/read-tsconfig.ts:457](https://github.com/visu
|
|
|
438
438
|
type FindTsConfigOptions = ReadTsConfigOptions & object;
|
|
439
439
|
```
|
|
440
440
|
|
|
441
|
-
Defined in: [packages/tsconfig/src/find-tsconfig.ts:10](https://github.com/visulima/visulima/blob/
|
|
441
|
+
Defined in: [packages/tsconfig/src/find-tsconfig.ts:10](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/find-tsconfig.ts#L10)
|
|
442
442
|
|
|
443
443
|
#### Type declaration
|
|
444
444
|
|
|
@@ -464,7 +464,7 @@ optional configFileName: string;
|
|
|
464
464
|
type ReadTsConfigOptions = object;
|
|
465
465
|
```
|
|
466
466
|
|
|
467
|
-
Defined in: [packages/tsconfig/src/read-tsconfig.ts:444](https://github.com/visulima/visulima/blob/
|
|
467
|
+
Defined in: [packages/tsconfig/src/read-tsconfig.ts:444](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/read-tsconfig.ts#L444)
|
|
468
468
|
|
|
469
469
|
#### Properties
|
|
470
470
|
|
|
@@ -474,7 +474,7 @@ Defined in: [packages/tsconfig/src/read-tsconfig.ts:444](https://github.com/visu
|
|
|
474
474
|
optional tscCompatible: "5.3" | "5.4" | "5.5" | "5.6" | true;
|
|
475
475
|
```
|
|
476
476
|
|
|
477
|
-
Defined in: [packages/tsconfig/src/read-tsconfig.ts:452](https://github.com/visulima/visulima/blob/
|
|
477
|
+
Defined in: [packages/tsconfig/src/read-tsconfig.ts:452](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/read-tsconfig.ts#L452)
|
|
478
478
|
|
|
479
479
|
Make the configuration compatible with the specified TypeScript version.
|
|
480
480
|
|
|
@@ -494,7 +494,7 @@ undefined
|
|
|
494
494
|
type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
|
|
495
495
|
```
|
|
496
496
|
|
|
497
|
-
Defined in: [packages/tsconfig/src/types.ts:3](https://github.com/visulima/visulima/blob/
|
|
497
|
+
Defined in: [packages/tsconfig/src/types.ts:3](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/types.ts#L3)
|
|
498
498
|
|
|
499
499
|
***
|
|
500
500
|
|
|
@@ -504,7 +504,7 @@ Defined in: [packages/tsconfig/src/types.ts:3](https://github.com/visulima/visul
|
|
|
504
504
|
type TsConfigResult = object;
|
|
505
505
|
```
|
|
506
506
|
|
|
507
|
-
Defined in: [packages/tsconfig/src/find-tsconfig.ts:15](https://github.com/visulima/visulima/blob/
|
|
507
|
+
Defined in: [packages/tsconfig/src/find-tsconfig.ts:15](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/find-tsconfig.ts#L15)
|
|
508
508
|
|
|
509
509
|
#### Properties
|
|
510
510
|
|
|
@@ -514,7 +514,7 @@ Defined in: [packages/tsconfig/src/find-tsconfig.ts:15](https://github.com/visul
|
|
|
514
514
|
config: TsConfigJsonResolved;
|
|
515
515
|
```
|
|
516
516
|
|
|
517
|
-
Defined in: [packages/tsconfig/src/find-tsconfig.ts:16](https://github.com/visulima/visulima/blob/
|
|
517
|
+
Defined in: [packages/tsconfig/src/find-tsconfig.ts:16](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/find-tsconfig.ts#L16)
|
|
518
518
|
|
|
519
519
|
##### path
|
|
520
520
|
|
|
@@ -522,7 +522,7 @@ Defined in: [packages/tsconfig/src/find-tsconfig.ts:16](https://github.com/visul
|
|
|
522
522
|
path: string;
|
|
523
523
|
```
|
|
524
524
|
|
|
525
|
-
Defined in: [packages/tsconfig/src/find-tsconfig.ts:17](https://github.com/visulima/visulima/blob/
|
|
525
|
+
Defined in: [packages/tsconfig/src/find-tsconfig.ts:17](https://github.com/visulima/visulima/blob/2ba2196cfa1aecc6ede047ef10ca5785def47ef1/packages/tsconfig/src/find-tsconfig.ts#L17)
|
|
526
526
|
|
|
527
527
|
<!-- /TYPEDOC -->
|
|
528
528
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const findTsConfig = require('./packem_shared/findTsConfig-B5QKwx1b.cjs');
|
|
6
|
-
const implicitBaseUrlSymbol = require('./packem_shared/implicitBaseUrlSymbol-ClUn71e4.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;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./packem_shared/findTsConfig-BBvqkZJ6.cjs"),e=require("./packem_shared/implicitBaseUrlSymbol-DMcyudm3.cjs"),n=require("./packem_shared/writeTsConfig-C99ubsh6.cjs");exports.findTsConfig=i.findTsConfig;exports.findTsConfigSync=i.findTsConfigSync;exports.implicitBaseUrlSymbol=e.implicitBaseUrlSymbol;exports.readTsConfig=e.readTsConfig;exports.writeTsConfig=n.writeTsConfig;exports.writeTsConfigSync=n.writeTsConfigSync;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { implicitBaseUrlSymbol, readTsConfig } from './packem_shared/implicitBaseUrlSymbol-CqmKQyEp.mjs';
|
|
3
|
-
export { writeTsConfig, writeTsConfigSync } from './packem_shared/writeTsConfig-CcokKUZl.mjs';
|
|
1
|
+
import{findTsConfig as f,findTsConfigSync as r}from"./packem_shared/findTsConfig-BxbLTzwF.mjs";import{implicitBaseUrlSymbol as e,readTsConfig as s}from"./packem_shared/implicitBaseUrlSymbol-CP1i_A8H.mjs";import{writeTsConfig as g,writeTsConfigSync as m}from"./packem_shared/writeTsConfig-0IO4xPZJ.mjs";export{f as findTsConfig,r as findTsConfigSync,e as implicitBaseUrlSymbol,s as readTsConfig,g as writeTsConfig,m as writeTsConfigSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var r=(e,o)=>g(e,"name",{value:o,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@visulima/fs"),s=require("@visulima/fs/error"),a=require("./implicitBaseUrlSymbol-DMcyudm3.cjs");var u=Object.defineProperty,l=r((e,o)=>u(e,"name",{value:o,configurable:!0}),"f");const d=new Map,p=l(async(e,o={})=>{const i=o.configFileName??"tsconfig.json";let n=await f.findUp(i,{...e&&{cwd:e},type:"file"});if(n||(n=await f.findUp("jsconfig.json",{...e&&{cwd:e},type:"file"})),!n)throw new s.NotFoundError("No such file or directory, for '"+i+"' or 'jsconfig.json' found.");const c=o.cache&&typeof o.cache!="boolean"?o.cache:d;if(o.cache&&c.has(n))return c.get(n);const t={config:a.readTsConfig(n,{tscCompatible:o.tscCompatible}),path:n};return o.cache&&c.set(n,t),t},"findTsConfig"),h=l((e,o={})=>{const i=o.configFileName??"tsconfig.json";let n=f.findUpSync(i,{...e&&{cwd:e},type:"file"});if(n||(n=f.findUpSync("jsconfig.json",{...e&&{cwd:e},type:"file"})),!n)throw new s.NotFoundError("No such file or directory, for '"+i+"' or 'jsconfig.json' found.");const c=o.cache&&typeof o.cache!="boolean"?o.cache:d;if(o.cache&&c.has(n))return c.get(n);const t={config:a.readTsConfig(n,{tscCompatible:o.tscCompatible}),path:n};return o.cache&&c.set(n,t),t},"findTsConfigSync");exports.findTsConfig=p;exports.findTsConfigSync=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.defineProperty;var f=(n,o)=>h(n,"name",{value:o,configurable:!0});import{findUp as s,findUpSync as r}from"@visulima/fs";import{NotFoundError as a}from"@visulima/fs/error";import{readTsConfig as p}from"./implicitBaseUrlSymbol-CP1i_A8H.mjs";var d=Object.defineProperty,l=f((n,o)=>d(n,"name",{value:o,configurable:!0}),"f");const g=new Map,w=l(async(n,o={})=>{const e=o.configFileName??"tsconfig.json";let c=await s(e,{...n&&{cwd:n},type:"file"});if(c||(c=await s("jsconfig.json",{...n&&{cwd:n},type:"file"})),!c)throw new a("No such file or directory, for '"+e+"' or 'jsconfig.json' found.");const i=o.cache&&typeof o.cache!="boolean"?o.cache:g;if(o.cache&&i.has(c))return i.get(c);const t={config:p(c,{tscCompatible:o.tscCompatible}),path:c};return o.cache&&i.set(c,t),t},"findTsConfig"),C=l((n,o={})=>{const e=o.configFileName??"tsconfig.json";let c=r(e,{...n&&{cwd:n},type:"file"});if(c||(c=r("jsconfig.json",{...n&&{cwd:n},type:"file"})),!c)throw new a("No such file or directory, for '"+e+"' or 'jsconfig.json' found.");const i=o.cache&&typeof o.cache!="boolean"?o.cache:g;if(o.cache&&i.has(c))return i.get(c);const t={config:p(c,{tscCompatible:o.tscCompatible}),path:c};return o.cache&&i.set(c,t),t},"findTsConfigSync");export{w as findTsConfig,C as findTsConfigSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var B=Object.defineProperty;var S=(o,n)=>B(o,"name",{value:n,configurable:!0});import{readFileSync as R,isAccessibleSync as f,findUpSync as L}from"@visulima/fs";import{NotFoundError as T}from"@visulima/fs/error";import{join as m,resolve as w,isAbsolute as A,toNamespacedPath as N,dirname as C,normalize as F,relative as y}from"@visulima/path";import{isRelative as W}from"@visulima/path/utils";import{parse as U}from"jsonc-parser";import{statSync as x}from"node:fs";import z from"node:module";import{resolveExports as M}from"resolve-pkg-maps";var q=Object.defineProperty,P=S((o,n)=>q(o,"name",{value:n,configurable:!0}),"d$1");const V=P(o=>U(R(o,{buffer:!1})),"readJsonc"),_=P(()=>{const{findPnpApi:o}=z;return o?.(process.cwd())},"getPnpApi"),k=P((o,n,l,t)=>{const c="resolveFromPackageJsonPath:"+o+":"+n+":"+(l?"yes":"no");if(t?.has(c))return t.get(c);const e=V(o);if(!e)return;let s=n||"tsconfig.json";if(!l&&e.exports)try{const[r]=M(e.exports,n,["require","types"]);s=r}catch{return!1}else!n&&e.tsconfig&&(s=e.tsconfig);return s=m(o,"..",s),t?.set(c,s),s},"resolveFromPackageJsonPath"),I="package.json",j="tsconfig.json",G=P((o,n,l)=>{let t=o;if(o===".."&&(t=m(t,j)),o.startsWith(".")&&(t=w(n,t)),A(t)){if(f(t)){if(x(t).isFile())return t}else if(!t.endsWith(".json")){const p=`${t}.json`;if(f(p))return p}return}const[c,...e]=o.split("/"),s=c.startsWith("@")?c+"/"+e.shift():c,r=e.join("/"),i=_();if(i){const{resolveRequest:p}=i;try{if(s===o){const u=p(m(s,I),n);if(u){const h=k(u,r,!1,l);if(h&&f(h))return h}}else{let u;try{u=p(o,n,{extensions:[".json"]})}catch{u=p(m(o,j),n)}if(u)return u}}catch{}}const a=L(p=>{const u=m(w(p),"node_modules",s);if(f(u))return m("node_modules",s)},{cwd:n,type:"directory"});if(!a||!x(a).isDirectory())return;const b=m(a,I);if(f(b)){const p=k(b,r,!1,l);if(p===!1)return;if(p&&f(p)&&x(p).isFile())return p}const O=m(a,r),E=O.endsWith(".json");if(!E){const p=O+".json";if(f(p))return p}if(f(O)){if(x(O).isDirectory()){const p=m(O,I);if(f(p)){const h=k(p,"",!0,l);if(h&&f(h))return h}const u=m(O,j);if(f(u))return u}else if(E)return O}},"resolveExtendsPath");var H=Object.defineProperty,v=S((o,n)=>H(o,"name",{value:n,configurable:!0}),"m");const K=v(o=>U(R(o,{buffer:!1})),"readJsonc"),g=v(o=>{const n=N(o);return W(n)?n:"./"+n},"normalizePath"),J=["files","include","exclude"],Q=v((o,n,l,t)=>{if(l.has(o))throw new Error(`Circularity detected while resolving configuration: ${o}`);l.add(o);const c=C(o),e=$(o,t,l);delete e.references;const{compilerOptions:s}=e;if(s){const{baseUrl:r}=s;r&&!r.startsWith(d)&&(s.baseUrl=F(y(n,m(c,r)))||"./");let{outDir:i}=s;i&&(i.startsWith(d)||(i=y(n,m(c,i))),s.outDir=g(i.replace(d+"/",""))||"./")}for(const r of J){const i=e[r];i&&(e[r]=i.map(a=>a.startsWith(d)||A(a)?a:y(n,m(c,a))))}return e},"resolveExtends"),$=v((o,n,l=new Set)=>{let t;try{t=K(o)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${o}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${o}`);const c=C(o);if(t.compilerOptions){const{compilerOptions:e}=t;e.paths&&!e.baseUrl&&(e[Z]=c)}if(t.extends){const e=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;for(const s of e.reverse()){const r=G(s,c);if(!r)throw new T("No such file or directory, for '"+s+"' found.");const i=Q(r,c,new Set(l),n);i.compilerOptions?.rootDir!==void 0&&!i.compilerOptions.rootDir.startsWith(d)&&(i.compilerOptions.rootDir=m(C(r),i.compilerOptions.rootDir));const a={...i,...t,compilerOptions:{...i.compilerOptions,...t.compilerOptions}};i.watchOptions&&(a.watchOptions={...i.watchOptions,...t.watchOptions}),t=a}}if(t.compilerOptions){const{compilerOptions:e}=t;for(const s of["baseUrl","rootDir"]){const r=e[s];if(r&&!r.startsWith(d)){const i=w(c,r);e[s]=g(y(c,i))}}for(const s of["outDir","declarationDir"]){let r=e[s];if(r){Array.isArray(t.exclude)||(t.exclude=[]);let i=r;A(i)||(i=m(c,i)),i=i.replace(d,""),t.exclude.includes(i)||t.exclude.push(i),r.startsWith(d)||(r=g(r)),e[s]=r}}}else t.compilerOptions={};if(t.include?(t.include=t.include.map(e=>F(e)),t.files&&delete t.files):t.files&&(t.files=t.files.map(e=>e.startsWith(d)?e:g(e))),t.watchOptions){const{watchOptions:e}=t;e.excludeDirectories&&(e.excludeDirectories=e.excludeDirectories.map(s=>w(c,s)))}return t.compilerOptions?.lib&&(t.compilerOptions.lib=t.compilerOptions.lib.map(e=>e.toLowerCase())),t.compilerOptions.module&&(t.compilerOptions.module=t.compilerOptions.module.toLowerCase()),t.compilerOptions.target&&(t.compilerOptions.target=t.compilerOptions.target.toLowerCase()),t},"internalParseTsConfig"),D=v((o,n)=>{if(o.startsWith(d))return F(m(n,o.slice(d.length)))},"interpolateConfigDirectory"),X=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],Y=v((o,n)=>{if(o.compilerOptions===void 0)return o;if(["5.4","5.5","5.6","5.7","5.8","true"].includes(String(n?.tscCompatible))){if(o.compilerOptions.esModuleInterop===void 0&&(o.compilerOptions.module==="node16"||o.compilerOptions.module==="nodenext"||o.compilerOptions.module==="preserve")&&(o.compilerOptions.esModuleInterop=!0),(o.compilerOptions.esModuleInterop||o.compilerOptions.module==="system"||o.compilerOptions.moduleResolution==="bundler")&&o.compilerOptions.allowSyntheticDefaultImports===void 0&&(o.compilerOptions.allowSyntheticDefaultImports=!0),o?.compilerOptions.moduleDetection===void 0&&o.compilerOptions.module&&["node16","nodenext"].includes(o.compilerOptions.module)&&(o.compilerOptions.moduleDetection="force"),o.compilerOptions.moduleResolution===void 0){let l="classic";if(o.compilerOptions.module!==void 0)switch((o.compilerOptions?.module).toLocaleLowerCase()){case"commonjs":{l="node10";break}case"node16":{l="node16";break}case"nodenext":{l="nodenext";break}case"preserve":{l="bundler";break}}l!=="classic"&&(o.compilerOptions.moduleResolution=l)}if(["5.7","5.8","true"].includes(String(n?.tscCompatible))&&o.compilerOptions.moduleResolution){let l=!1;["bundler","node16","nodenext"].includes(o.compilerOptions.moduleResolution.toLocaleLowerCase())&&(l=!0),o.compilerOptions.resolvePackageJsonExports===void 0&&l&&(o.compilerOptions.resolvePackageJsonExports=!0),o.compilerOptions.resolvePackageJsonImports===void 0&&l&&(o.compilerOptions.resolvePackageJsonImports=!0)}if(o.compilerOptions.target===void 0){let l="es5";o.compilerOptions.module==="node16"?l="es2022":o.compilerOptions.module==="nodenext"&&(l="esnext"),l!=="es5"&&(o.compilerOptions.target=l)}o.compilerOptions.useDefineForClassFields===void 0&&o.compilerOptions.target&&(o.compilerOptions.target.includes("es202")||o.compilerOptions.target==="esnext")&&(o.compilerOptions.useDefineForClassFields=!0)}if(["5.6","5.7","5.8","true"].includes(String(n?.tscCompatible))&&o.compilerOptions.strict&&o.compilerOptions.strictBuiltinIteratorReturn===void 0&&(o.compilerOptions.strictBuiltinIteratorReturn=!0),["5.4","5.5","5.6","5.7","5.8","true"].includes(String(n?.tscCompatible))){if(o.compilerOptions.strict&&(o.compilerOptions.noImplicitAny=o.compilerOptions.noImplicitAny??!0,o.compilerOptions.noImplicitThis=o.compilerOptions.noImplicitThis??!0,o.compilerOptions.strictNullChecks=o.compilerOptions.strictNullChecks??!0,o.compilerOptions.strictFunctionTypes=o.compilerOptions.strictFunctionTypes??!0,o.compilerOptions.strictBindCallApply=o.compilerOptions.strictBindCallApply??!0,o.compilerOptions.strictPropertyInitialization=o.compilerOptions.strictPropertyInitialization??!0,o.compilerOptions.alwaysStrict=o.compilerOptions.alwaysStrict??!0),o.compilerOptions.useDefineForClassFields===void 0&&o.compilerOptions.target){let l=!1;(o.compilerOptions.target.includes("es202")||o.compilerOptions.target==="esnext")&&(l=!0),l&&(o.compilerOptions.useDefineForClassFields=!0)}o.compilerOptions.strict&&o.compilerOptions.useUnknownInCatchVariables===void 0&&(o.compilerOptions.useUnknownInCatchVariables=!0),o.compilerOptions.isolatedModules&&(o.compilerOptions.preserveConstEnums=o.compilerOptions.preserveConstEnums??!0)}return o.compileOnSave===!1&&delete o.compileOnSave,o},"tsCompatibleWrapper"),d="${configDir}",Z=Symbol("implicitBaseUrl"),po=v((o,n)=>{const l=w(o),t=$(l,n),c=C(l),{compilerOptions:e}=t;if(e){for(const r of X){const i=e[r];if(i){const a=D(i,c);e[r]=a?g(y(c,a)):i}}for(const r of["rootDirs","typeRoots"]){const i=e[r];i&&(e[r]=i.map(a=>{const b=D(a,c);return b?g(y(c,b)):a}))}const{paths:s}=e;if(s)for(const r of Object.keys(s))s[r]=s[r].map(i=>D(i,c)??i);e.outDir&&(e.outDir=e.outDir.replace(d,""))}for(const s of J){const r=t[s];r&&(t[s]=r.map(i=>D(i,c)||(s==="files"&&W(i)?i:s==="include"&&W(i)?m(c,i):F(i))))}return Y(t,n)},"readTsConfig");export{d as configDirectoryPlaceholder,Z as implicitBaseUrlSymbol,po as readTsConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var R=Object.defineProperty;var g=(e,c)=>R(e,"name",{value:c,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@visulima/fs"),E=require("@visulima/fs/error"),r=require("@visulima/path"),A=require("@visulima/path/utils"),F=require("jsonc-parser"),S=require("node:fs"),U=require("node:module"),q=require("resolve-pkg-maps"),J=g(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),T=J(U);var $=Object.defineProperty,D=g((e,c)=>$(e,"name",{value:c,configurable:!0}),"d$1");const B=D(e=>F.parse(m.readFileSync(e,{buffer:!1})),"readJsonc"),_=D(()=>{const{findPnpApi:e}=T;return e?.(process.cwd())},"getPnpApi"),w=D((e,c,l,o)=>{const p="resolveFromPackageJsonPath:"+e+":"+c+":"+(l?"yes":"no");if(o?.has(p))return o.get(p);const i=B(e);if(!i)return;let n=c||"tsconfig.json";if(!l&&i.exports)try{const[s]=q.resolveExports(i.exports,c,["require","types"]);n=s}catch{return!1}else!c&&i.tsconfig&&(n=i.tsconfig);return n=r.join(e,"..",n),o?.set(p,n),n},"resolveFromPackageJsonPath"),x="package.json",C="tsconfig.json",z=D((e,c,l)=>{let o=e;if(e===".."&&(o=r.join(o,C)),e.startsWith(".")&&(o=r.resolve(c,o)),r.isAbsolute(o)){if(m.isAccessibleSync(o)){if(S.statSync(o).isFile())return o}else if(!o.endsWith(".json")){const a=`${o}.json`;if(m.isAccessibleSync(a))return a}return}const[p,...i]=e.split("/"),n=p.startsWith("@")?p+"/"+i.shift():p,s=i.join("/"),t=_();if(t){const{resolveRequest:a}=t;try{if(n===e){const f=a(r.join(n,x),c);if(f){const y=w(f,s,!1,l);if(y&&m.isAccessibleSync(y))return y}}else{let f;try{f=a(e,c,{extensions:[".json"]})}catch{f=a(r.join(e,C),c)}if(f)return f}}catch{}}const u=m.findUpSync(a=>{const f=r.join(r.resolve(a),"node_modules",n);if(m.isAccessibleSync(f))return r.join("node_modules",n)},{cwd:c,type:"directory"});if(!u||!S.statSync(u).isDirectory())return;const b=r.join(u,x);if(m.isAccessibleSync(b)){const a=w(b,s,!1,l);if(a===!1)return;if(a&&m.isAccessibleSync(a)&&S.statSync(a).isFile())return a}const O=r.join(u,s),P=O.endsWith(".json");if(!P){const a=O+".json";if(m.isAccessibleSync(a))return a}if(m.isAccessibleSync(O)){if(S.statSync(O).isDirectory()){const a=r.join(O,x);if(m.isAccessibleSync(a)){const y=w(a,"",!0,l);if(y&&m.isAccessibleSync(y))return y}const f=r.join(O,C);if(m.isAccessibleSync(f))return f}else if(P)return O}},"resolveExtendsPath");var L=Object.defineProperty,v=g((e,c)=>L(e,"name",{value:c,configurable:!0}),"m");const M=v(e=>F.parse(m.readFileSync(e,{buffer:!1})),"readJsonc"),h=v(e=>{const c=r.toNamespacedPath(e);return A.isRelative(c)?c:"./"+c},"normalizePath"),k=["files","include","exclude"],N=v((e,c,l,o)=>{if(l.has(e))throw new Error(`Circularity detected while resolving configuration: ${e}`);l.add(e);const p=r.dirname(e),i=I(e,o,l);delete i.references;const{compilerOptions:n}=i;if(n){const{baseUrl:s}=n;s&&!s.startsWith(d)&&(n.baseUrl=r.normalize(r.relative(c,r.join(p,s)))||"./");let{outDir:t}=n;t&&(t.startsWith(d)||(t=r.relative(c,r.join(p,t))),n.outDir=h(t.replace(d+"/",""))||"./")}for(const s of k){const t=i[s];t&&(i[s]=t.map(u=>u.startsWith(d)||r.isAbsolute(u)?u:r.relative(c,r.join(p,u))))}return i},"resolveExtends"),I=v((e,c,l=new Set)=>{let o;try{o=M(e)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${e}`)}if(typeof o!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);const p=r.dirname(e);if(o.compilerOptions){const{compilerOptions:i}=o;i.paths&&!i.baseUrl&&(i[W]=p)}if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends];delete o.extends;for(const n of i.reverse()){const s=z(n,p);if(!s)throw new E.NotFoundError("No such file or directory, for '"+n+"' found.");const t=N(s,p,new Set(l),c);t.compilerOptions?.rootDir!==void 0&&!t.compilerOptions.rootDir.startsWith(d)&&(t.compilerOptions.rootDir=r.join(r.dirname(s),t.compilerOptions.rootDir));const u={...t,...o,compilerOptions:{...t.compilerOptions,...o.compilerOptions}};t.watchOptions&&(u.watchOptions={...t.watchOptions,...o.watchOptions}),o=u}}if(o.compilerOptions){const{compilerOptions:i}=o;for(const n of["baseUrl","rootDir"]){const s=i[n];if(s&&!s.startsWith(d)){const t=r.resolve(p,s);i[n]=h(r.relative(p,t))}}for(const n of["outDir","declarationDir"]){let s=i[n];if(s){Array.isArray(o.exclude)||(o.exclude=[]);let t=s;r.isAbsolute(t)||(t=r.join(p,t)),t=t.replace(d,""),o.exclude.includes(t)||o.exclude.push(t),s.startsWith(d)||(s=h(s)),i[n]=s}}}else o.compilerOptions={};if(o.include?(o.include=o.include.map(i=>r.normalize(i)),o.files&&delete o.files):o.files&&(o.files=o.files.map(i=>i.startsWith(d)?i:h(i))),o.watchOptions){const{watchOptions:i}=o;i.excludeDirectories&&(i.excludeDirectories=i.excludeDirectories.map(n=>r.resolve(p,n)))}return o.compilerOptions?.lib&&(o.compilerOptions.lib=o.compilerOptions.lib.map(i=>i.toLowerCase())),o.compilerOptions.module&&(o.compilerOptions.module=o.compilerOptions.module.toLowerCase()),o.compilerOptions.target&&(o.compilerOptions.target=o.compilerOptions.target.toLowerCase()),o},"internalParseTsConfig"),j=v((e,c)=>{if(e.startsWith(d))return r.normalize(r.join(c,e.slice(d.length)))},"interpolateConfigDirectory"),V=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],G=v((e,c)=>{if(e.compilerOptions===void 0)return e;if(["5.4","5.5","5.6","5.7","5.8","true"].includes(String(c?.tscCompatible))){if(e.compilerOptions.esModuleInterop===void 0&&(e.compilerOptions.module==="node16"||e.compilerOptions.module==="nodenext"||e.compilerOptions.module==="preserve")&&(e.compilerOptions.esModuleInterop=!0),(e.compilerOptions.esModuleInterop||e.compilerOptions.module==="system"||e.compilerOptions.moduleResolution==="bundler")&&e.compilerOptions.allowSyntheticDefaultImports===void 0&&(e.compilerOptions.allowSyntheticDefaultImports=!0),e?.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0){let l="classic";if(e.compilerOptions.module!==void 0)switch((e.compilerOptions?.module).toLocaleLowerCase()){case"commonjs":{l="node10";break}case"node16":{l="node16";break}case"nodenext":{l="nodenext";break}case"preserve":{l="bundler";break}}l!=="classic"&&(e.compilerOptions.moduleResolution=l)}if(["5.7","5.8","true"].includes(String(c?.tscCompatible))&&e.compilerOptions.moduleResolution){let l=!1;["bundler","node16","nodenext"].includes(e.compilerOptions.moduleResolution.toLocaleLowerCase())&&(l=!0),e.compilerOptions.resolvePackageJsonExports===void 0&&l&&(e.compilerOptions.resolvePackageJsonExports=!0),e.compilerOptions.resolvePackageJsonImports===void 0&&l&&(e.compilerOptions.resolvePackageJsonImports=!0)}if(e.compilerOptions.target===void 0){let l="es5";e.compilerOptions.module==="node16"?l="es2022":e.compilerOptions.module==="nodenext"&&(l="esnext"),l!=="es5"&&(e.compilerOptions.target=l)}e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.target&&(e.compilerOptions.target.includes("es202")||e.compilerOptions.target==="esnext")&&(e.compilerOptions.useDefineForClassFields=!0)}if(["5.6","5.7","5.8","true"].includes(String(c?.tscCompatible))&&e.compilerOptions.strict&&e.compilerOptions.strictBuiltinIteratorReturn===void 0&&(e.compilerOptions.strictBuiltinIteratorReturn=!0),["5.4","5.5","5.6","5.7","5.8","true"].includes(String(c?.tscCompatible))){if(e.compilerOptions.strict&&(e.compilerOptions.noImplicitAny=e.compilerOptions.noImplicitAny??!0,e.compilerOptions.noImplicitThis=e.compilerOptions.noImplicitThis??!0,e.compilerOptions.strictNullChecks=e.compilerOptions.strictNullChecks??!0,e.compilerOptions.strictFunctionTypes=e.compilerOptions.strictFunctionTypes??!0,e.compilerOptions.strictBindCallApply=e.compilerOptions.strictBindCallApply??!0,e.compilerOptions.strictPropertyInitialization=e.compilerOptions.strictPropertyInitialization??!0,e.compilerOptions.alwaysStrict=e.compilerOptions.alwaysStrict??!0),e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.target){let l=!1;(e.compilerOptions.target.includes("es202")||e.compilerOptions.target==="esnext")&&(l=!0),l&&(e.compilerOptions.useDefineForClassFields=!0)}e.compilerOptions.strict&&e.compilerOptions.useUnknownInCatchVariables===void 0&&(e.compilerOptions.useUnknownInCatchVariables=!0),e.compilerOptions.isolatedModules&&(e.compilerOptions.preserveConstEnums=e.compilerOptions.preserveConstEnums??!0)}return e.compileOnSave===!1&&delete e.compileOnSave,e},"tsCompatibleWrapper"),d="${configDir}",W=Symbol("implicitBaseUrl"),H=v((e,c)=>{const l=r.resolve(e),o=I(l,c),p=r.dirname(l),{compilerOptions:i}=o;if(i){for(const s of V){const t=i[s];if(t){const u=j(t,p);i[s]=u?h(r.relative(p,u)):t}}for(const s of["rootDirs","typeRoots"]){const t=i[s];t&&(i[s]=t.map(u=>{const b=j(u,p);return b?h(r.relative(p,b)):u}))}const{paths:n}=i;if(n)for(const s of Object.keys(n))n[s]=n[s].map(t=>j(t,p)??t);i.outDir&&(i.outDir=i.outDir.replace(d,""))}for(const n of k){const s=o[n];s&&(o[n]=s.map(t=>j(t,p)||(n==="files"&&A.isRelative(t)?t:n==="include"&&A.isRelative(t)?r.join(p,t):r.normalize(t))))}return G(o,c)},"readTsConfig");exports.configDirectoryPlaceholder=d;exports.implicitBaseUrlSymbol=W;exports.readTsConfig=H;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var w=Object.defineProperty;var s=(o,n)=>w(o,"name",{value:n,configurable:!0});import{writeJson as a,writeJsonSync as p}from"@visulima/fs";import{toPath as c}from"@visulima/fs/utils";import{join as e}from"@visulima/path";var g=Object.defineProperty,f=s((o,n)=>g(o,"name",{value:n,configurable:!0}),"r");const C=f(async(o,n={})=>{const{cwd:r,...i}=n,t=c(r??process.cwd());await a(e(t,"tsconfig.json"),o,i)},"writeTsConfig"),T=f((o,n={})=>{const{cwd:r,...i}=n,t=c(r??process.cwd());p(e(t,"tsconfig.json"),o,i)},"writeTsConfigSync");export{C as writeTsConfig,T as writeTsConfigSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var w=Object.defineProperty;var s=(e,i)=>w(e,"name",{value:i,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@visulima/fs"),c=require("@visulima/fs/utils"),a=require("@visulima/path");var f=Object.defineProperty,u=s((e,i)=>f(e,"name",{value:i,configurable:!0}),"r");const g=u(async(e,i={})=>{const{cwd:t,...n}=i,o=c.toPath(t??process.cwd());await r.writeJson(a.join(o,"tsconfig.json"),e,n)},"writeTsConfig"),d=u((e,i={})=>{const{cwd:t,...n}=i,o=c.toPath(t??process.cwd());r.writeJsonSync(a.join(o,"tsconfig.json"),e,n)},"writeTsConfigSync");exports.writeTsConfig=g;exports.writeTsConfigSync=d;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/tsconfig",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "Find and/or parse the tsconfig.json file from a directory path.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"CHANGELOG.md"
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@visulima/fs": "3.1.
|
|
70
|
+
"@visulima/fs": "3.1.8",
|
|
71
71
|
"@visulima/path": "1.4.0",
|
|
72
72
|
"jsonc-parser": "^3.3.1",
|
|
73
73
|
"resolve-pkg-maps": "^1.0.0"
|
|
@@ -1,74 +0,0 @@
|
|
|
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-ClUn71e4.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
|
-
tscCompatible: options.tscCompatible
|
|
34
|
-
}),
|
|
35
|
-
path: filePath
|
|
36
|
-
};
|
|
37
|
-
if (options.cache) {
|
|
38
|
-
cache.set(filePath, output);
|
|
39
|
-
}
|
|
40
|
-
return output;
|
|
41
|
-
}, "findTsConfig");
|
|
42
|
-
const findTsConfigSync = /* @__PURE__ */ __name((cwd, options = {}) => {
|
|
43
|
-
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
44
|
-
let filePath = fs.findUpSync(configFileName, {
|
|
45
|
-
...cwd && { cwd },
|
|
46
|
-
type: "file"
|
|
47
|
-
});
|
|
48
|
-
if (!filePath) {
|
|
49
|
-
filePath = fs.findUpSync("jsconfig.json", {
|
|
50
|
-
...cwd && { cwd },
|
|
51
|
-
type: "file"
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
if (!filePath) {
|
|
55
|
-
throw new error.NotFoundError("No such file or directory, for '" + configFileName + "' or 'jsconfig.json' found.");
|
|
56
|
-
}
|
|
57
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
58
|
-
if (options.cache && cache.has(filePath)) {
|
|
59
|
-
return cache.get(filePath);
|
|
60
|
-
}
|
|
61
|
-
const output = {
|
|
62
|
-
config: implicitBaseUrlSymbol.readTsConfig(filePath, {
|
|
63
|
-
tscCompatible: options.tscCompatible
|
|
64
|
-
}),
|
|
65
|
-
path: filePath
|
|
66
|
-
};
|
|
67
|
-
if (options.cache) {
|
|
68
|
-
cache.set(filePath, output);
|
|
69
|
-
}
|
|
70
|
-
return output;
|
|
71
|
-
}, "findTsConfigSync");
|
|
72
|
-
|
|
73
|
-
exports.findTsConfig = findTsConfig;
|
|
74
|
-
exports.findTsConfigSync = findTsConfigSync;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { findUpSync, findUp } from '@visulima/fs';
|
|
2
|
-
import { NotFoundError } from '@visulima/fs/error';
|
|
3
|
-
import { readTsConfig } from './implicitBaseUrlSymbol-CqmKQyEp.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
|
-
tscCompatible: options.tscCompatible
|
|
30
|
-
}),
|
|
31
|
-
path: filePath
|
|
32
|
-
};
|
|
33
|
-
if (options.cache) {
|
|
34
|
-
cache.set(filePath, output);
|
|
35
|
-
}
|
|
36
|
-
return output;
|
|
37
|
-
}, "findTsConfig");
|
|
38
|
-
const findTsConfigSync = /* @__PURE__ */ __name((cwd, options = {}) => {
|
|
39
|
-
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
40
|
-
let filePath = findUpSync(configFileName, {
|
|
41
|
-
...cwd && { cwd },
|
|
42
|
-
type: "file"
|
|
43
|
-
});
|
|
44
|
-
if (!filePath) {
|
|
45
|
-
filePath = findUpSync("jsconfig.json", {
|
|
46
|
-
...cwd && { cwd },
|
|
47
|
-
type: "file"
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (!filePath) {
|
|
51
|
-
throw new NotFoundError("No such file or directory, for '" + configFileName + "' or 'jsconfig.json' found.");
|
|
52
|
-
}
|
|
53
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
54
|
-
if (options.cache && cache.has(filePath)) {
|
|
55
|
-
return cache.get(filePath);
|
|
56
|
-
}
|
|
57
|
-
const output = {
|
|
58
|
-
config: readTsConfig(filePath, {
|
|
59
|
-
tscCompatible: options.tscCompatible
|
|
60
|
-
}),
|
|
61
|
-
path: filePath
|
|
62
|
-
};
|
|
63
|
-
if (options.cache) {
|
|
64
|
-
cache.set(filePath, output);
|
|
65
|
-
}
|
|
66
|
-
return output;
|
|
67
|
-
}, "findTsConfigSync");
|
|
68
|
-
|
|
69
|
-
export { findTsConfig, findTsConfigSync };
|