@visulima/tsconfig 3.0.0-alpha.11 → 3.0.0-alpha.13
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 +19 -0
- package/dist/index.d.ts +74 -7
- package/dist/index.js +1 -1
- package/dist/packem_shared/{findTsConfig-QzVKvyBN.js → findTsConfig-C8YGYiav.js} +1 -1
- package/dist/packem_shared/implicitBaseUrlSymbol-D2xG5nio.js +1 -0
- package/package.json +6 -7
- package/dist/find-tsconfig.d.ts +0 -21
- package/dist/packem_shared/implicitBaseUrlSymbol-CI4Y92iF.js +0 -1
- package/dist/read-tsconfig.d.ts +0 -13
- package/dist/types.d.ts +0 -3
- package/dist/utils/resolve-extends-path.d.ts +0 -3
- package/dist/write-tsconfig.d.ts +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## @visulima/tsconfig [3.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.12...@visulima/tsconfig@3.0.0-alpha.13) (2026-05-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Dependencies
|
|
5
|
+
|
|
6
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.13
|
|
7
|
+
|
|
8
|
+
## @visulima/tsconfig [3.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.11...@visulima/tsconfig@3.0.0-alpha.12) (2026-04-30)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **tsconfig:** typescript-version-aware compiler defaults ([1a4236b](https://github.com/visulima/visulima/commit/1a4236bfe0dabb769a88a052a1c9e7511daf6e6d))
|
|
13
|
+
|
|
14
|
+
### Miscellaneous Chores
|
|
15
|
+
|
|
16
|
+
* added missing version key ([3b55253](https://github.com/visulima/visulima/commit/3b55253728af652a0bcaf230d93d2f9e9f2d8806))
|
|
17
|
+
* re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
|
|
18
|
+
* **tsconfig:** upgrade packem to 2.0.0-alpha.76 ([4f08e20](https://github.com/visulima/visulima/commit/4f08e204f3a82f5da7346ad910cf39cb2c13de51))
|
|
19
|
+
|
|
1
20
|
## @visulima/tsconfig [3.0.0-alpha.11](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.10...@visulima/tsconfig@3.0.0-alpha.11) (2026-04-22)
|
|
2
21
|
|
|
3
22
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { TsConfigJson, Except } from 'type-fest';
|
|
2
|
+
export { type TsConfigJson } from 'type-fest';
|
|
3
|
+
import { WriteJsonOptions } from '@visulima/fs';
|
|
4
|
+
type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
|
|
5
|
+
type Options$1 = {
|
|
6
|
+
/**
|
|
7
|
+
* Make the configuration compatible with the specified TypeScript version.
|
|
8
|
+
*
|
|
9
|
+
* Controls *derived* defaults — fields TypeScript synthesizes when other
|
|
10
|
+
* fields are set (e.g. `module: nodenext` ⇒ `moduleResolution: nodenext`).
|
|
11
|
+
*
|
|
12
|
+
* When `true`, it will make the configuration compatible with the latest TypeScript version.
|
|
13
|
+
* @default undefined
|
|
14
|
+
*/
|
|
15
|
+
tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | "5.7" | "5.8" | "5.9" | "6.0" | true;
|
|
16
|
+
/**
|
|
17
|
+
* Apply the *unconditional* compiler-option defaults TypeScript would
|
|
18
|
+
* synthesize for the given version (e.g. TS 6.0's `strict: true`,
|
|
19
|
+
* `target: 'es2025'`, `moduleResolution: 'bundler'`).
|
|
20
|
+
* - `'auto'` — auto-detect the installed TypeScript version by walking up
|
|
21
|
+
* from the tsconfig directory (and consulting Yarn Berry pnp).
|
|
22
|
+
* - `string` — pin to an explicit version (e.g. `'6.0.0'`, `'5.4'`).
|
|
23
|
+
* - `false` (default) — do not apply unconditional defaults; preserves
|
|
24
|
+
* prior behaviour where the parsed config matches `tsc --showConfig`.
|
|
25
|
+
* Distinct from `tscCompatible`, which only governs derived defaults.
|
|
26
|
+
* Both can be combined.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
typescriptVersion?: "auto" | false | (Record<never, never> & string);
|
|
30
|
+
};
|
|
31
|
+
declare const implicitBaseUrlSymbol: symbol;
|
|
32
|
+
declare const readTsConfig: (tsconfigPath: string, options?: Options$1) => TsConfigJsonResolved;
|
|
33
|
+
type Options = Options$1 & {
|
|
34
|
+
cache?: Map<string, TsConfigJsonResolved> | boolean;
|
|
35
|
+
configFileName?: string;
|
|
36
|
+
};
|
|
37
|
+
type TsConfigResult = {
|
|
38
|
+
config: TsConfigJsonResolved;
|
|
39
|
+
path: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* An asynchronous function that retrieves the TSConfig by searching for the "tsconfig.json" first,
|
|
43
|
+
* second attempt is to look for the "jsconfig.json" file from a given current working directory.
|
|
44
|
+
* @param cwd Optional. The current working directory from which to search for the "tsconfig.json" file.
|
|
45
|
+
* The type of `cwd` is `string`.
|
|
46
|
+
* @returns A `Promise` that resolves to the TSConfig result object.
|
|
47
|
+
* The return type of the function is `Promise<TsConfigResult>`.
|
|
48
|
+
* @throws An `Error` when the "tsconfig.json" file is not found.
|
|
49
|
+
*/
|
|
50
|
+
declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
|
|
51
|
+
declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
|
|
52
|
+
/**
|
|
53
|
+
* An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
54
|
+
* @param tsConfig The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.
|
|
55
|
+
* @param options Optional. The write options and the current working directory. The type of `options` is an
|
|
56
|
+
* intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.
|
|
57
|
+
* @returns A `Promise` that resolves when the tsconfig.json file has been written.
|
|
58
|
+
* The return type of function is `Promise<void>`.
|
|
59
|
+
*/
|
|
60
|
+
declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
61
|
+
cwd?: URL | string;
|
|
62
|
+
}) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* A function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
65
|
+
* @param tsConfig The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.
|
|
66
|
+
* @param options Optional. The write options and the current working directory. The type of `options` is an
|
|
67
|
+
* intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.
|
|
68
|
+
* @returns A `Promise` that resolves when the tsconfig.json file has been written.
|
|
69
|
+
* The return type of function is `Promise<void>`.
|
|
70
|
+
*/
|
|
71
|
+
declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
72
|
+
cwd?: URL | string;
|
|
73
|
+
}) => void;
|
|
74
|
+
export { type Options as FindTsConfigOptions, type Options$1 as ReadTsConfigOptions, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{findTsConfig as f,findTsConfigSync as r}from"./packem_shared/findTsConfig-
|
|
1
|
+
import{findTsConfig as f,findTsConfigSync as r}from"./packem_shared/findTsConfig-C8YGYiav.js";import{implicitBaseUrlSymbol as e,readTsConfig as s}from"./packem_shared/implicitBaseUrlSymbol-D2xG5nio.js";import{writeTsConfig as g,writeTsConfigSync as m}from"./packem_shared/writeTsConfig-0IO4xPZJ.js";export{f as findTsConfig,r as findTsConfigSync,e as implicitBaseUrlSymbol,s as readTsConfig,g as writeTsConfig,m as writeTsConfigSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var f=(t,o)=>h(t,"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-
|
|
1
|
+
var h=Object.defineProperty;var f=(t,o)=>h(t,"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-D2xG5nio.js";var d=Object.defineProperty,l=f((t,o)=>d(t,"name",{value:o,configurable:!0}),"f");const g=new Map,w=l(async(t,o={})=>{const n=o.configFileName??"tsconfig.json";let c=await s(n,{...t&&{cwd:t},type:"file"});if(c??=await s("jsconfig.json",{...t&&{cwd:t},type:"file"}),!c)throw new a(`No such file or directory, for '${n}' 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 e={config:p(c,{tscCompatible:o.tscCompatible}),path:c};return o.cache&&i.set(c,e),e},"findTsConfig"),C=l((t,o={})=>{const n=o.configFileName??"tsconfig.json";let c=r(n,{...t&&{cwd:t},type:"file"});if(c??=r("jsconfig.json",{...t&&{cwd:t},type:"file"}),!c)throw new a(`No such file or directory, for '${n}' 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 e={config:p(c,{tscCompatible:o.tscCompatible}),path:c};return o.cache&&i.set(c,e),e},"findTsConfigSync");export{w as findTsConfig,C as findTsConfigSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var q=Object.defineProperty;var v=(e,o)=>q(e,"name",{value:o,configurable:!0});import{createRequire as z}from"node:module";import{readFileSync as A,isAccessibleSync as h,findUpSync as W}from"@visulima/fs";import{NotFoundError as H}from"@visulima/fs/error";import{join as d,resolve as b,isAbsolute as E,toNamespacedPath as K,relative as x,normalize as j,dirname as k}from"@visulima/path";import{isRelative as Q}from"@visulima/path/utils";import{parse as J}from"jsonc-parser";import{resolveExports as X}from"resolve-pkg-maps";const G=z(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=v(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[o,s]=w.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return w.getBuiltinModule(e)}return G(e)},"__cjs_getBuiltinModule"),{statSync:C}=U("node:fs"),_=U("node:module");var Y=Object.defineProperty,S=v((e,o)=>Y(e,"name",{value:o,configurable:!0}),"d");const Z=S(e=>J(A(e,{buffer:!1})),"readJsonc"),ee=S(()=>{const{findPnpApi:e}=_;return e?.(process.cwd())},"getPnpApi"),F=S((e,o,s,t)=>{const n=`resolveFromPackageJsonPath:${e}:${o}:${s?"yes":"no"}`;if(t?.has(n))return t.get(n);const i=Z(e);if(!i)return;let r=o||"tsconfig.json";if(!s&&i.exports)try{const[l]=X(i.exports,o,["require","types"]);r=l}catch{return!1}else!o&&i.tsconfig&&(r=i.tsconfig);return r=d(e,"..",r),t?.set(n,r),r},"resolveFromPackageJsonPath"),R="package.json",$="tsconfig.json",oe=S((e,o,s)=>{let t=e;if(e===".."&&(t=d(t,$)),e.startsWith(".")&&(t=b(o,t)),E(t)){if(h(t)){if(C(t).isFile())return t}else if(!t.endsWith(".json")){const m=`${t}.json`;if(h(m))return m}return}const[n="",...i]=e.split("/"),r=n.startsWith("@")?`${n}/${String(i.shift())}`:n,l=i.join("/"),p=ee();if(p){const{resolveRequest:m}=p;try{if(r===e){const f=m(d(r,R),o);if(f){const g=F(f,l,!1,s);if(g&&h(g))return g}}else{let f;try{f=m(e,o,{extensions:[".json"]})}catch{f=m(d(e,$),o)}if(f)return f}}catch{}}const c=W(m=>{const f=d(b(m),"node_modules",r);if(h(f))return d("node_modules",r)},{cwd:o,type:"directory"});if(!c||!C(c).isDirectory())return;const a=d(c,R);if(h(a)){const m=F(a,l,!1,s);if(m===!1)return;if(m&&h(m)&&C(m).isFile())return m}const u=d(c,l),V=u.endsWith(".json");if(!V){const m=`${u}.json`;if(h(m))return m}if(h(u)){if(C(u).isDirectory()){const m=d(u,R);if(h(m)){const g=F(m,"",!0,s);if(g&&h(g))return g}const f=d(u,$);if(h(f))return f}else if(V)return u}},"resolveExtendsPath");var te=Object.defineProperty,ie=v((e,o)=>te(e,"name",{value:o,configurable:!0}),"i");const se=ie((e=process.cwd())=>{const{findPnpApi:o}=_;return o?o(e):void 0},"getPnpApi");var re=Object.defineProperty,ne=v((e,o)=>re(e,"name",{value:o,configurable:!0}),"o$2");const le=ne(e=>{const o=b(e);let s;const t=se(o);if(t)try{s=t.resolveRequest("typescript/package.json",o)??void 0}catch{}if(s??=W(n=>d(n,"node_modules","typescript","package.json"),{cwd:o,type:"file"}),!!s)try{const n=J(A(s,{buffer:!1}));if(typeof n?.version=="string")return n.version}catch{}},"detectTypeScriptVersion");var ce=Object.defineProperty,pe=v((e,o)=>ce(e,"name",{value:o,configurable:!0}),"n$1");const ae=new Set(["node16","node18","node20","nodenext"]),M=pe(e=>e!==void 0&&ae.has(e),"moduleDictatesTarget");var me=Object.defineProperty,ue=v((e,o)=>me(e,"name",{value:o,configurable:!0}),"o$1");const de=ue((e,o)=>{!o.has("target")&&!M(e.module)&&(e.target="es3")},"applyV4Defaults");var fe=Object.defineProperty,Oe=v((e,o)=>fe(e,"name",{value:o,configurable:!0}),"o");const ve=Oe((e,o)=>{!o.has("target")&&!M(e.module)&&(e.target="es5")},"applyV5Defaults");var he=Object.defineProperty,ye=v((e,o)=>he(e,"name",{value:o,configurable:!0}),"e");const ge=ye((e,o)=>{o.has("strict")||(e.strict=!0),o.has("target")||(e.target="es2025"),o.has("module")||(e.module="es2022"),o.has("moduleResolution")||(e.moduleResolution="bundler"),o.has("rootDir")||(e.rootDir="."),o.has("types")||(e.types=[]),o.has("noUncheckedSideEffectImports")||(e.noUncheckedSideEffectImports=!0),o.has("libReplacement")||(e.libReplacement=!1),o.has("alwaysStrict")||(e.alwaysStrict=!0)},"applyV6Defaults");var be=Object.defineProperty,B=v((e,o)=>be(e,"name",{value:o,configurable:!0}),"n");const we=[[4,de],[5,ve],[6,ge]],De=/^v?(\d+)/,xe=B(e=>{const o=De.exec(e);return o?Number(o[1]):void 0},"parseMajor"),Ce=B((e,o)=>{const s=xe(o);if(s===void 0)return;const t=new Set(Object.keys(e));for(const[n,i]of we)n<=s&&i(e,t)},"applyVersionDefaults");var Pe=Object.defineProperty,O=v((e,o)=>Pe(e,"name",{value:o,configurable:!0}),"a");const je=O(e=>J(A(e,{buffer:!1})),"readJsonc"),ke=O(e=>e.replaceAll("\\","/"),"slash"),D=O(e=>{const o=K(e);return Q(o)?o:`./${o}`},"normalizePath"),L=["files","include","exclude"],T=O((e,o,s)=>{const t=d(o,s),n=x(e,t);return j(n)||"./"},"resolveAndRelativize"),Se=O((e,o,s)=>{const t=x(e,o);if(!t)return s;const n=s.startsWith("./")?s.slice(2):s;return`${t}/${n}`},"prefixPattern"),Fe=O((e,o,s,t)=>{if(s.has(e))throw new Error(`Circularity detected while resolving configuration: ${e}`);s.add(e);const n=k(e),i=N(e,t,s);delete i.references;const{compilerOptions:r}=i;if(r){const{baseUrl:l}=r;l&&!l.startsWith(y)&&(r.baseUrl=T(o,n,l));const{outDir:p}=r;p&&!p.startsWith(y)&&(r.outDir=T(o,n,p))}for(const l of L){const p=i[l];p&&(i[l]=p.map(c=>c.startsWith(y)||E(c)?c:Se(o,n,c)))}return i},"resolveExtends"),N=O((e,o,s=new Set)=>{let t;try{t=je(e)??{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${e}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);const n=k(e);if(t.compilerOptions){const{compilerOptions:i}=t;i.paths&&!i.baseUrl&&(i[Le]=n)}if(t.extends){const i=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;const r=i.toReversed();for(let l=0;l<r.length;l++){const p=r[l],c=oe(p,n);if(!c)throw new H(`No such file or directory, for '${p}' found.`);const a=Fe(c,n,new Set(s),o);a.compilerOptions?.rootDir!==void 0&&!a.compilerOptions.rootDir.startsWith(y)&&(a.compilerOptions.rootDir=d(k(c),a.compilerOptions.rootDir));const u={...a,...t,compilerOptions:{...a.compilerOptions,...t.compilerOptions}};a.watchOptions&&(u.watchOptions={...a.watchOptions,...t.watchOptions}),t=u}}if(t.compilerOptions){const{compilerOptions:i}=t;for(const r of["baseUrl","rootDir"]){const l=i[r];if(l&&!l.startsWith(y)){const p=b(n,l);i[r]=D(x(n,p))}}for(const r of["outDir","declarationDir"]){let l=i[r];l&&(Array.isArray(t.exclude)||(t.exclude=["outDir","declarationDir"].map(p=>{const c=i[p];if(c)return c.startsWith(y)||E(c)?c:d(n,c)}).filter(Boolean)),l.startsWith(y)||(l=D(l)),i[r]=l)}}else t.compilerOptions={};if(t.include&&(t.include=t.include.map(i=>ke(i))),t.files&&(t.files=t.files.map(i=>i.startsWith(y)?i:D(i))),t.watchOptions){const{watchOptions:i}=t;i.excludeDirectories&&(i.excludeDirectories=i.excludeDirectories.map(r=>j(b(n,r)))),i.excludeFiles&&(i.excludeFiles=i.excludeFiles.map(r=>j(b(n,r)))),i.watchFile&&(i.watchFile=i.watchFile.toLowerCase()),i.watchDirectory&&(i.watchDirectory=i.watchDirectory.toLowerCase()),i.fallbackPolling&&(i.fallbackPolling=i.fallbackPolling.toLowerCase())}if(t.compilerOptions.lib&&(t.compilerOptions.lib=t.compilerOptions.lib.map(i=>i.toLowerCase())),t.compilerOptions.module){let i=t.compilerOptions.module.toLowerCase();i==="es2015"&&(i="es6"),t.compilerOptions.module=i}if(t.compilerOptions.target){let i=t.compilerOptions.target.toLowerCase();i==="es2015"&&(i="es6"),t.compilerOptions.target=i}if(t.compilerOptions.moduleResolution){let i=t.compilerOptions.moduleResolution.toLowerCase();i==="node"&&(i="node10"),t.compilerOptions.moduleResolution=i}return t.compilerOptions.jsx&&(t.compilerOptions.jsx=t.compilerOptions.jsx.toLowerCase()),t.compilerOptions.moduleDetection&&(t.compilerOptions.moduleDetection=t.compilerOptions.moduleDetection.toLowerCase()),t.compilerOptions.importsNotUsedAsValues&&(t.compilerOptions.importsNotUsedAsValues=t.compilerOptions.importsNotUsedAsValues.toLowerCase()),t.compilerOptions.newLine&&(t.compilerOptions.newLine=t.compilerOptions.newLine.toLowerCase()),t},"internalParseTsConfig"),P=O((e,o)=>{if(e.startsWith(y))return j(d(o,e.slice(y.length)))},"interpolateConfigDirectory"),Re=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],I=O(e=>e==="es2022"||e==="es2023"||e==="es2024"||e==="es2025"||e==="esnext","targetImpliesUseDefineForClassFields"),$e=O((e,o)=>{if(e.compilerOptions===void 0)return e;if(e.compilerOptions.rewriteRelativeImportExtensions&&(e.compilerOptions.allowImportingTsExtensions??=!0),e.compilerOptions.composite&&(e.compilerOptions.declaration??=!0,e.compilerOptions.incremental??=!0),e.compilerOptions.checkJs&&(e.compilerOptions.allowJs??=!0),e.compilerOptions.verbatimModuleSyntax&&(e.compilerOptions.isolatedModules??=!0,e.compilerOptions.preserveConstEnums??=!0),["5.4","5.5","5.6","5.7","5.8","5.9","true"].includes(String(o?.tscCompatible))){if(e.compilerOptions.esModuleInterop===void 0&&(e.compilerOptions.module==="node16"||e.compilerOptions.module==="node18"||e.compilerOptions.module==="node20"||e.compilerOptions.module==="nodenext"||e.compilerOptions.module==="preserve")&&(e.compilerOptions.esModuleInterop=!0),e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0){let s="classic";if(e.compilerOptions.module!==void 0)switch(e.compilerOptions.module.toLocaleLowerCase()){case"commonjs":{s="node10";break}case"node16":case"node18":{s="node16";break}case"node20":{s="node16";break}case"nodenext":{s="nodenext";break}case"preserve":{s="bundler";break}}s!=="classic"&&(e.compilerOptions.moduleResolution=s)}if(e.compilerOptions.moduleResolution==="bundler"&&(e.compilerOptions.resolveJsonModule??=!0),e.compilerOptions.module&&["node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.resolveJsonModule??=!0),(e.compilerOptions.esModuleInterop||e.compilerOptions.module==="system"||e.compilerOptions.moduleResolution==="bundler")&&e.compilerOptions.allowSyntheticDefaultImports===void 0&&(e.compilerOptions.allowSyntheticDefaultImports=!0),["5.7","5.8","5.9","true"].includes(String(o?.tscCompatible))&&e.compilerOptions.moduleResolution){let s=!1;["bundler","node16","nodenext"].includes(e.compilerOptions.moduleResolution.toLocaleLowerCase())&&(s=!0),e.compilerOptions.resolvePackageJsonExports===void 0&&s&&(e.compilerOptions.resolvePackageJsonExports=!0),e.compilerOptions.resolvePackageJsonImports===void 0&&s&&(e.compilerOptions.resolvePackageJsonImports=!0)}if(e.compilerOptions.target===void 0){let s="es5";switch(e.compilerOptions.module){case"node16":case"node18":{s="es2022";break}case"node20":{s="es2023";break}case"nodenext":{s="esnext";break}}s!=="es5"&&(e.compilerOptions.target=s)}e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.target&&I(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!0)}if(["5.6","5.7","5.8","5.9","true"].includes(String(o?.tscCompatible))&&e.compilerOptions.strict&&e.compilerOptions.strictBuiltinIteratorReturn===void 0&&(e.compilerOptions.strictBuiltinIteratorReturn=!0),["5.4","5.5","5.6","5.7","5.8","5.9","true"].includes(String(o?.tscCompatible))&&(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&&I(e.compilerOptions.target)&&(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)),String(o?.tscCompatible)==="6.0"){if(e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0&&e.compilerOptions.module){const s=e.compilerOptions.module.toLocaleLowerCase();s==="node16"||s==="node18"||s==="node20"?e.compilerOptions.moduleResolution="node16":s==="nodenext"&&(e.compilerOptions.moduleResolution="nodenext")}if(e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&e.compilerOptions.target&&!I(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!1),e.compilerOptions.isolatedModules&&e.compilerOptions.preserveConstEnums===void 0&&(e.compilerOptions.preserveConstEnums=!0),e.compilerOptions.resolveJsonModule===void 0){const s=e.compilerOptions.module,t=e.compilerOptions.moduleResolution?.toLocaleLowerCase();!(s!==void 0&&["node20","nodenext"].includes(s)||t==="bundler")&&t&&(e.compilerOptions.resolveJsonModule=!1)}if(e.compilerOptions.moduleResolution){const s=e.compilerOptions.moduleResolution.toLocaleLowerCase();["bundler","node16","nodenext"].includes(s)||(e.compilerOptions.resolvePackageJsonExports??=!1,e.compilerOptions.resolvePackageJsonImports??=!1)}}return e.compileOnSave===!1&&delete e.compileOnSave,e},"tsCompatibleWrapper"),Ie=O((e,o)=>{const s=e?.typescriptVersion;if(!(s===!1||s===void 0))return s==="auto"?le(o):s},"resolveTypeScriptVersion"),y="${configDir}",Le=Symbol("implicitBaseUrl"),Me=O((e,o)=>{const s=b(e),t=N(s,o),n=k(s),i=Ie(o,n);i&&t.compilerOptions&&Ce(t.compilerOptions,i);const{compilerOptions:r}=t;if(r){for(const p of Re){const c=r[p];if(c){const a=P(c,n);r[p]=a?D(x(n,a)):c}}for(const p of["rootDirs","typeRoots"]){const c=r[p];c&&(r[p]=c.map(a=>{const u=P(a,n);return u?D(x(n,u)):a}))}const{paths:l}=r;if(l){const p=Object.keys(l);for(let c=0;c<p.length;c++){const a=p[c];l[a]=l[a].map(u=>P(u,n)??u)}}r.outDir&&(r.outDir=r.outDir.replace(y,""))}for(let l=0;l<L.length;l++){const p=L[l],c=t[p];c&&(t[p]=c.map(a=>P(a,n)??a))}return $e(t,o)},"readTsConfig");export{y as configDirectoryPlaceholder,Le as implicitBaseUrlSymbol,Me as readTsConfig};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/tsconfig",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.13",
|
|
4
4
|
"description": "Find and/or parse the tsconfig.json file from a directory path.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
7
|
-
"visulima",
|
|
8
|
-
"ts-config",
|
|
9
7
|
"get-tsconfig",
|
|
10
8
|
"read-tsconfig",
|
|
9
|
+
"ts-config",
|
|
11
10
|
"tsconfig",
|
|
12
|
-
"tsconfig.json"
|
|
11
|
+
"tsconfig.json",
|
|
12
|
+
"visulima"
|
|
13
13
|
],
|
|
14
14
|
"homepage": "https://visulima.com/packages/tsconfig",
|
|
15
15
|
"bugs": {
|
|
@@ -50,11 +50,10 @@
|
|
|
50
50
|
"CHANGELOG.md"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@visulima/fs": "5.0.0-alpha.
|
|
53
|
+
"@visulima/fs": "5.0.0-alpha.13",
|
|
54
54
|
"@visulima/path": "3.0.0-alpha.10",
|
|
55
55
|
"jsonc-parser": "^3.3.1",
|
|
56
|
-
"resolve-pkg-maps": "^1.0.0"
|
|
57
|
-
"type-fest": "5.6.0"
|
|
56
|
+
"resolve-pkg-maps": "^1.0.0"
|
|
58
57
|
},
|
|
59
58
|
"engines": {
|
|
60
59
|
"node": "^22.14.0 || >=24.10.0"
|
package/dist/find-tsconfig.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Options as ReadTsConfigOptions } from "./read-tsconfig.d.ts";
|
|
2
|
-
import type { TsConfigJsonResolved } from "./types.d.ts";
|
|
3
|
-
export type Options = ReadTsConfigOptions & {
|
|
4
|
-
cache?: Map<string, TsConfigJsonResolved> | boolean;
|
|
5
|
-
configFileName?: string;
|
|
6
|
-
};
|
|
7
|
-
export type TsConfigResult = {
|
|
8
|
-
config: TsConfigJsonResolved;
|
|
9
|
-
path: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* An asynchronous function that retrieves the TSConfig by searching for the "tsconfig.json" first,
|
|
13
|
-
* second attempt is to look for the "jsconfig.json" file from a given current working directory.
|
|
14
|
-
* @param cwd Optional. The current working directory from which to search for the "tsconfig.json" file.
|
|
15
|
-
* The type of `cwd` is `string`.
|
|
16
|
-
* @returns A `Promise` that resolves to the TSConfig result object.
|
|
17
|
-
* The return type of the function is `Promise<TsConfigResult>`.
|
|
18
|
-
* @throws An `Error` when the "tsconfig.json" file is not found.
|
|
19
|
-
*/
|
|
20
|
-
export declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
|
|
21
|
-
export declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var U=Object.defineProperty;var C=(o,s)=>U(o,"name",{value:s,configurable:!0});import{createRequire as T}from"node:module";import{readFileSync as W,isAccessibleSync as O,findUpSync as N}from"@visulima/fs";import{NotFoundError as q}from"@visulima/fs/error";import{join as u,resolve as w,isAbsolute as A,toNamespacedPath as z,relative as x,normalize as k,dirname as P}from"@visulima/path";import{isRelative as V}from"@visulima/path/utils";import{parse as _}from"jsonc-parser";import{resolveExports as H}from"resolve-pkg-maps";const B=T(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=C(o=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[s,i]=y.versions.node.split(".").map(Number);if(s>22||s===22&&i>=3||s===20&&i>=16)return y.getBuiltinModule(o)}return B(o)},"__cjs_getBuiltinModule"),{statSync:D}=E("node:fs"),G=E("node:module");var K=Object.defineProperty,R=C((o,s)=>K(o,"name",{value:s,configurable:!0}),"d");const Q=R(o=>_(W(o,{buffer:!1})),"readJsonc"),X=R(()=>{const{findPnpApi:o}=G;return o?.(process.cwd())},"getPnpApi"),j=R((o,s,i,e)=>{const l=`resolveFromPackageJsonPath:${o}:${s}:${i?"yes":"no"}`;if(e?.has(l))return e.get(l);const t=Q(o);if(!t)return;let r=s||"tsconfig.json";if(!i&&t.exports)try{const[n]=H(t.exports,s,["require","types"]);r=n}catch{return!1}else!s&&t.tsconfig&&(r=t.tsconfig);return r=u(o,"..",r),e?.set(l,r),r},"resolveFromPackageJsonPath"),L="package.json",S="tsconfig.json",Y=R((o,s,i)=>{let e=o;if(o===".."&&(e=u(e,S)),o.startsWith(".")&&(e=w(s,e)),A(e)){if(O(e)){if(D(e).isFile())return e}else if(!e.endsWith(".json")){const m=`${e}.json`;if(O(m))return m}return}const[l="",...t]=o.split("/"),r=l.startsWith("@")?`${l}/${String(t.shift())}`:l,n=t.join("/"),p=X();if(p){const{resolveRequest:m}=p;try{if(r===o){const d=m(u(r,L),s);if(d){const g=j(d,n,!1,i);if(g&&O(g))return g}}else{let d;try{d=m(o,s,{extensions:[".json"]})}catch{d=m(u(o,S),s)}if(d)return d}}catch{}}const c=N(m=>{const d=u(w(m),"node_modules",r);if(O(d))return u("node_modules",r)},{cwd:s,type:"directory"});if(!c||!D(c).isDirectory())return;const a=u(c,L);if(O(a)){const m=j(a,n,!1,i);if(m===!1)return;if(m&&O(m)&&D(m).isFile())return m}const h=u(c,n),J=h.endsWith(".json");if(!J){const m=`${h}.json`;if(O(m))return m}if(O(h)){if(D(h).isDirectory()){const m=u(h,L);if(O(m)){const g=j(m,"",!0,i);if(g&&O(g))return g}const d=u(h,S);if(O(d))return d}else if(J)return h}},"resolveExtendsPath");var Z=Object.defineProperty,v=C((o,s)=>Z(o,"name",{value:s,configurable:!0}),"c");const oo=v(o=>_(W(o,{buffer:!1})),"readJsonc"),eo=v(o=>o.replaceAll("\\","/"),"slash"),b=v(o=>{const s=z(o);return V(s)?s:`./${s}`},"normalizePath"),I=["files","include","exclude"],$=v((o,s,i)=>{const e=u(s,i),l=x(o,e);return k(l)||"./"},"resolveAndRelativize"),to=v((o,s,i)=>{const e=x(o,s);if(!e)return i;const l=i.startsWith("./")?i.slice(2):i;return`${e}/${l}`},"prefixPattern"),io=v((o,s,i,e)=>{if(i.has(o))throw new Error(`Circularity detected while resolving configuration: ${o}`);i.add(o);const l=P(o),t=M(o,e,i);delete t.references;const{compilerOptions:r}=t;if(r){const{baseUrl:n}=r;n&&!n.startsWith(f)&&(r.baseUrl=$(s,l,n));const{outDir:p}=r;p&&!p.startsWith(f)&&(r.outDir=$(s,l,p))}for(const n of I){const p=t[n];p&&(t[n]=p.map(c=>c.startsWith(f)||A(c)?c:to(s,l,c)))}return t},"resolveExtends"),M=v((o,s,i=new Set)=>{let e;try{e=oo(o)??{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${o}`)}if(typeof e!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${o}`);const l=P(o);if(e.compilerOptions){const{compilerOptions:t}=e;t.paths&&!t.baseUrl&&(t[no]=l)}if(e.extends){const t=Array.isArray(e.extends)?e.extends:[e.extends];delete e.extends;const r=t.toReversed();for(let n=0;n<r.length;n++){const p=r[n],c=Y(p,l);if(!c)throw new q(`No such file or directory, for '${p}' found.`);const a=io(c,l,new Set(i),s);a.compilerOptions?.rootDir!==void 0&&!a.compilerOptions.rootDir.startsWith(f)&&(a.compilerOptions.rootDir=u(P(c),a.compilerOptions.rootDir));const h={...a,...e,compilerOptions:{...a.compilerOptions,...e.compilerOptions}};a.watchOptions&&(h.watchOptions={...a.watchOptions,...e.watchOptions}),e=h}}if(e.compilerOptions){const{compilerOptions:t}=e;for(const r of["baseUrl","rootDir"]){const n=t[r];if(n&&!n.startsWith(f)){const p=w(l,n);t[r]=b(x(l,p))}}for(const r of["outDir","declarationDir"]){let n=t[r];n&&(Array.isArray(e.exclude)||(e.exclude=["outDir","declarationDir"].map(p=>{const c=t[p];if(c)return c.startsWith(f)||A(c)?c:u(l,c)}).filter(Boolean)),n.startsWith(f)||(n=b(n)),t[r]=n)}}else e.compilerOptions={};if(e.include&&(e.include=e.include.map(t=>eo(t))),e.files&&(e.files=e.files.map(t=>t.startsWith(f)?t:b(t))),e.watchOptions){const{watchOptions:t}=e;t.excludeDirectories&&(t.excludeDirectories=t.excludeDirectories.map(r=>k(w(l,r)))),t.excludeFiles&&(t.excludeFiles=t.excludeFiles.map(r=>k(w(l,r)))),t.watchFile&&(t.watchFile=t.watchFile.toLowerCase()),t.watchDirectory&&(t.watchDirectory=t.watchDirectory.toLowerCase()),t.fallbackPolling&&(t.fallbackPolling=t.fallbackPolling.toLowerCase())}if(e.compilerOptions.lib&&(e.compilerOptions.lib=e.compilerOptions.lib.map(t=>t.toLowerCase())),e.compilerOptions.module){let t=e.compilerOptions.module.toLowerCase();t==="es2015"&&(t="es6"),e.compilerOptions.module=t}if(e.compilerOptions.target){let t=e.compilerOptions.target.toLowerCase();t==="es2015"&&(t="es6"),e.compilerOptions.target=t}if(e.compilerOptions.moduleResolution){let t=e.compilerOptions.moduleResolution.toLowerCase();t==="node"&&(t="node10"),e.compilerOptions.moduleResolution=t}return e.compilerOptions.jsx&&(e.compilerOptions.jsx=e.compilerOptions.jsx.toLowerCase()),e.compilerOptions.moduleDetection&&(e.compilerOptions.moduleDetection=e.compilerOptions.moduleDetection.toLowerCase()),e.compilerOptions.importsNotUsedAsValues&&(e.compilerOptions.importsNotUsedAsValues=e.compilerOptions.importsNotUsedAsValues.toLowerCase()),e.compilerOptions.newLine&&(e.compilerOptions.newLine=e.compilerOptions.newLine.toLowerCase()),e},"internalParseTsConfig"),F=v((o,s)=>{if(o.startsWith(f))return k(u(s,o.slice(f.length)))},"interpolateConfigDirectory"),so=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],ro=v((o,s)=>{if(o.compilerOptions===void 0)return o;if(o.compilerOptions.rewriteRelativeImportExtensions&&(o.compilerOptions.allowImportingTsExtensions??=!0),o.compilerOptions.composite&&(o.compilerOptions.declaration??=!0,o.compilerOptions.incremental??=!0),o.compilerOptions.checkJs&&(o.compilerOptions.allowJs??=!0),o.compilerOptions.verbatimModuleSyntax&&(o.compilerOptions.isolatedModules??=!0,o.compilerOptions.preserveConstEnums??=!0),["5.4","5.5","5.6","5.7","5.8","5.9","true"].includes(String(s?.tscCompatible))){if(o.compilerOptions.esModuleInterop===void 0&&(o.compilerOptions.module==="node16"||o.compilerOptions.module==="node18"||o.compilerOptions.module==="node20"||o.compilerOptions.module==="nodenext"||o.compilerOptions.module==="preserve")&&(o.compilerOptions.esModuleInterop=!0),o.compilerOptions.moduleDetection===void 0&&o.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(o.compilerOptions.module)&&(o.compilerOptions.moduleDetection="force"),o.compilerOptions.moduleResolution===void 0){let i="classic";if(o.compilerOptions.module!==void 0)switch(o.compilerOptions.module.toLocaleLowerCase()){case"commonjs":{i="node10";break}case"node16":case"node18":{i="node16";break}case"node20":{i="node16";break}case"nodenext":{i="nodenext";break}case"preserve":{i="bundler";break}}i!=="classic"&&(o.compilerOptions.moduleResolution=i)}if(o.compilerOptions.moduleResolution==="bundler"&&(o.compilerOptions.resolveJsonModule??=!0),o.compilerOptions.module&&["node20","nodenext"].includes(o.compilerOptions.module)&&(o.compilerOptions.resolveJsonModule??=!0),(o.compilerOptions.esModuleInterop||o.compilerOptions.module==="system"||o.compilerOptions.moduleResolution==="bundler")&&o.compilerOptions.allowSyntheticDefaultImports===void 0&&(o.compilerOptions.allowSyntheticDefaultImports=!0),["5.7","5.8","5.9","true"].includes(String(s?.tscCompatible))&&o.compilerOptions.moduleResolution){let i=!1;["bundler","node16","nodenext"].includes(o.compilerOptions.moduleResolution.toLocaleLowerCase())&&(i=!0),o.compilerOptions.resolvePackageJsonExports===void 0&&i&&(o.compilerOptions.resolvePackageJsonExports=!0),o.compilerOptions.resolvePackageJsonImports===void 0&&i&&(o.compilerOptions.resolvePackageJsonImports=!0)}if(o.compilerOptions.target===void 0){let i="es5";switch(o.compilerOptions.module){case"node16":case"node18":{i="es2022";break}case"node20":{i="es2023";break}case"nodenext":{i="esnext";break}}i!=="es5"&&(o.compilerOptions.target=i)}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","5.9","true"].includes(String(s?.tscCompatible))&&o.compilerOptions.strict&&o.compilerOptions.strictBuiltinIteratorReturn===void 0&&(o.compilerOptions.strictBuiltinIteratorReturn=!0),["5.4","5.5","5.6","5.7","5.8","5.9","true"].includes(String(s?.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 i=!1;(o.compilerOptions.target.includes("es202")||o.compilerOptions.target==="esnext")&&(i=!0),i&&(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)}if(String(s?.tscCompatible)==="6.0"){if(o.compilerOptions.moduleDetection===void 0&&o.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(o.compilerOptions.module)&&(o.compilerOptions.moduleDetection="force"),o.compilerOptions.moduleResolution===void 0&&o.compilerOptions.module){const i=o.compilerOptions.module.toLocaleLowerCase();i==="node16"||i==="node18"||i==="node20"?o.compilerOptions.moduleResolution="node16":i==="nodenext"&&(o.compilerOptions.moduleResolution="nodenext")}if(o.compilerOptions.useDefineForClassFields===void 0&&o.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(o.compilerOptions.module)&&o.compilerOptions.target&&!o.compilerOptions.target.includes("es202")&&o.compilerOptions.target!=="esnext"&&(o.compilerOptions.useDefineForClassFields=!1),o.compilerOptions.isolatedModules&&o.compilerOptions.preserveConstEnums===void 0&&(o.compilerOptions.preserveConstEnums=!0),o.compilerOptions.resolveJsonModule===void 0){const i=o.compilerOptions.module,e=o.compilerOptions.moduleResolution?.toLocaleLowerCase();!(i!==void 0&&["node20","nodenext"].includes(i)||e==="bundler")&&e&&(o.compilerOptions.resolveJsonModule=!1)}if(o.compilerOptions.moduleResolution){const i=o.compilerOptions.moduleResolution.toLocaleLowerCase();["bundler","node16","nodenext"].includes(i)||(o.compilerOptions.resolvePackageJsonExports??=!1,o.compilerOptions.resolvePackageJsonImports??=!1)}}return o.compileOnSave===!1&&delete o.compileOnSave,o},"tsCompatibleWrapper"),f="${configDir}",no=Symbol("implicitBaseUrl"),ho=v((o,s)=>{const i=w(o),e=M(i,s),l=P(i),{compilerOptions:t}=e;if(t){for(const n of so){const p=t[n];if(p){const c=F(p,l);t[n]=c?b(x(l,c)):p}}for(const n of["rootDirs","typeRoots"]){const p=t[n];p&&(t[n]=p.map(c=>{const a=F(c,l);return a?b(x(l,a)):c}))}const{paths:r}=t;if(r){const n=Object.keys(r);for(let p=0;p<n.length;p++){const c=n[p];r[c]=r[c].map(a=>F(a,l)??a)}}t.outDir&&(t.outDir=t.outDir.replace(f,""))}for(let r=0;r<I.length;r++){const n=I[r],p=e[n];p&&(e[n]=p.map(c=>F(c,l)??c))}return ro(e,s)},"readTsConfig");export{f as configDirectoryPlaceholder,no as implicitBaseUrlSymbol,ho as readTsConfig};
|
package/dist/read-tsconfig.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { TsConfigJsonResolved } from "./types.d.ts";
|
|
2
|
-
export type Options = {
|
|
3
|
-
/**
|
|
4
|
-
* Make the configuration compatible with the specified TypeScript version.
|
|
5
|
-
*
|
|
6
|
-
* When `true`, it will make the configuration compatible with the latest TypeScript version.
|
|
7
|
-
* @default undefined
|
|
8
|
-
*/
|
|
9
|
-
tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | "5.7" | "5.8" | "5.9" | "6.0" | true;
|
|
10
|
-
};
|
|
11
|
-
export declare const configDirectoryPlaceholder: string;
|
|
12
|
-
export declare const implicitBaseUrlSymbol: symbol;
|
|
13
|
-
export declare const readTsConfig: (tsconfigPath: string, options?: Options) => TsConfigJsonResolved;
|
package/dist/types.d.ts
DELETED
package/dist/write-tsconfig.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { WriteJsonOptions } from "@visulima/fs";
|
|
2
|
-
import type { TsConfigJson } from "type-fest";
|
|
3
|
-
/**
|
|
4
|
-
* An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
5
|
-
* @param tsConfig The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.
|
|
6
|
-
* @param options Optional. The write options and the current working directory. The type of `options` is an
|
|
7
|
-
* intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.
|
|
8
|
-
* @returns A `Promise` that resolves when the tsconfig.json file has been written.
|
|
9
|
-
* The return type of function is `Promise<void>`.
|
|
10
|
-
*/
|
|
11
|
-
export declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
12
|
-
cwd?: URL | string;
|
|
13
|
-
}) => Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* A function that writes the provided TypeScript configuration object to a tsconfig.json file.
|
|
16
|
-
* @param tsConfig The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.
|
|
17
|
-
* @param options Optional. The write options and the current working directory. The type of `options` is an
|
|
18
|
-
* intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.
|
|
19
|
-
* @returns A `Promise` that resolves when the tsconfig.json file has been written.
|
|
20
|
-
* The return type of function is `Promise<void>`.
|
|
21
|
-
*/
|
|
22
|
-
export declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
23
|
-
cwd?: URL | string;
|
|
24
|
-
}) => void;
|