@visulima/tsconfig 3.0.0-alpha.2 → 3.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,229 @@
1
+ ## @visulima/tsconfig [3.0.0-alpha.20](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.19...@visulima/tsconfig@3.0.0-alpha.20) (2026-05-11)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.20
7
+
8
+ ## @visulima/tsconfig [3.0.0-alpha.19](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.18...@visulima/tsconfig@3.0.0-alpha.19) (2026-05-10)
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.19
14
+
15
+ ## @visulima/tsconfig [3.0.0-alpha.18](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.17...@visulima/tsconfig@3.0.0-alpha.18) (2026-05-10)
16
+
17
+ ### Code Refactoring
18
+
19
+ * replace execa with tinyexec ([56ec776](https://github.com/visulima/visulima/commit/56ec776908fe0c068c54542f3885cb29f061fea7))
20
+
21
+
22
+ ### Dependencies
23
+
24
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.18
25
+
26
+ ## @visulima/tsconfig [3.0.0-alpha.17](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.16...@visulima/tsconfig@3.0.0-alpha.17) (2026-05-07)
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.17
32
+
33
+ ## @visulima/tsconfig [3.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.15...@visulima/tsconfig@3.0.0-alpha.16) (2026-05-07)
34
+
35
+
36
+ ### Dependencies
37
+
38
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.16
39
+
40
+ ## @visulima/tsconfig [3.0.0-alpha.15](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.14...@visulima/tsconfig@3.0.0-alpha.15) (2026-05-06)
41
+
42
+
43
+ ### Dependencies
44
+
45
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.15
46
+
47
+ ## @visulima/tsconfig [3.0.0-alpha.14](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.13...@visulima/tsconfig@3.0.0-alpha.14) (2026-05-06)
48
+
49
+ ### Miscellaneous Chores
50
+
51
+ * **tsconfig:** apply prettier and eslint quote-style auto-fix ([e184ae4](https://github.com/visulima/visulima/commit/e184ae4c162360c743428361d9be977bad555854))
52
+ * **tsconfig:** housekeeping cleanup ([081acf1](https://github.com/visulima/visulima/commit/081acf12b3853d85b233412493b48061d4f0dbf3))
53
+
54
+
55
+ ### Dependencies
56
+
57
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.14
58
+
59
+ ## @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)
60
+
61
+
62
+ ### Dependencies
63
+
64
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.13
65
+
66
+ ## @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)
67
+
68
+ ### Features
69
+
70
+ * **tsconfig:** typescript-version-aware compiler defaults ([1a4236b](https://github.com/visulima/visulima/commit/1a4236bfe0dabb769a88a052a1c9e7511daf6e6d))
71
+
72
+ ### Miscellaneous Chores
73
+
74
+ * added missing version key ([3b55253](https://github.com/visulima/visulima/commit/3b55253728af652a0bcaf230d93d2f9e9f2d8806))
75
+ * re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
76
+ * **tsconfig:** upgrade packem to 2.0.0-alpha.76 ([4f08e20](https://github.com/visulima/visulima/commit/4f08e204f3a82f5da7346ad910cf39cb2c13de51))
77
+
78
+ ## @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)
79
+
80
+ ### Bug Fixes
81
+
82
+ * Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
83
+
84
+
85
+ ### Dependencies
86
+
87
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.12
88
+ * **@visulima/path:** upgraded to 3.0.0-alpha.10
89
+
90
+ ## @visulima/tsconfig [3.0.0-alpha.10](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.9...@visulima/tsconfig@3.0.0-alpha.10) (2026-04-21)
91
+
92
+ ### Miscellaneous Chores
93
+
94
+ * jsr.json update and lock file ([73fce38](https://github.com/visulima/visulima/commit/73fce38c7cb4603f3fffb88609b1b18e2feb4937))
95
+
96
+
97
+ ### Dependencies
98
+
99
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.11
100
+
101
+ ## @visulima/tsconfig [3.0.0-alpha.9](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.8...@visulima/tsconfig@3.0.0-alpha.9) (2026-04-21)
102
+
103
+ ### Miscellaneous Chores
104
+
105
+ * update the jsr.json ([864ab7e](https://github.com/visulima/visulima/commit/864ab7e71c4b5ae82f64792d1ae8debfea2c539b))
106
+
107
+
108
+ ### Dependencies
109
+
110
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.10
111
+
112
+ ## @visulima/tsconfig [3.0.0-alpha.8](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.7...@visulima/tsconfig@3.0.0-alpha.8) (2026-04-21)
113
+
114
+ ### Bug Fixes
115
+
116
+ * **tooling:** resolve eslint and formatting issues ([399d292](https://github.com/visulima/visulima/commit/399d29282be5b29bb26b4e5b24d45e2a6cdeeca3))
117
+ * **tsconfig:** relax no-unsafe-* for tests and untyped external deps ([1e63952](https://github.com/visulima/visulima/commit/1e63952c41ff76e450ba4ca5aba6ddf7229c65b3))
118
+ * **tsconfig:** suppress sonarjs/deprecation for baseUrl handling ([431ae96](https://github.com/visulima/visulima/commit/431ae96bdd025a052bde8291918b1593f972efa1))
119
+
120
+ ### Miscellaneous Chores
121
+
122
+ * bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
123
+ * fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
124
+ * **tsconfig:** apply pending changes ([d7ddb14](https://github.com/visulima/visulima/commit/d7ddb14293c1a140e818dd1b314caeba68db66da))
125
+
126
+
127
+ ### Dependencies
128
+
129
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.9
130
+
131
+ ## @visulima/tsconfig [3.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.6...@visulima/tsconfig@3.0.0-alpha.7) (2026-04-08)
132
+
133
+ ### Bug Fixes
134
+
135
+ * **tsconfig:** add node types and fix implicit any parameter ([1744d82](https://github.com/visulima/visulima/commit/1744d82a07fca03f2e6ff660b918e9b2623acf69))
136
+ * **tsconfig:** add TypeScript 6.0 compatibility for implicit compiler defaults ([19de98f](https://github.com/visulima/visulima/commit/19de98f2640c143c6f5e84eda214c84584cf980c))
137
+ * **tsconfig:** align parsing with get-tsconfig for files/include, path inheritance, and TS 6.0 ([0c9d4be](https://github.com/visulima/visulima/commit/0c9d4be347f6ee4212dbe98026a7cd1d465bc2de))
138
+ * **tsconfig:** properly fix eslint errors in code ([95a2142](https://github.com/visulima/visulima/commit/95a2142f816f9ae0d50caaf235a71f9d03ab71cf))
139
+ * **tsconfig:** remove remaining eslint suppressions with proper code fixes ([57a45bb](https://github.com/visulima/visulima/commit/57a45bbc4e00e1c688a12367dc734c1553a17a6a))
140
+ * **tsconfig:** resolve eslint errors ([5848320](https://github.com/visulima/visulima/commit/5848320dc88a6080cf507eda724f57f9a6800434))
141
+
142
+ ### Miscellaneous Chores
143
+
144
+ * **tooling:** remove empty dependency objects from package.json ([dc52a23](https://github.com/visulima/visulima/commit/dc52a23bc1e2d36f4ec71ca67506bf6861a02929))
145
+ * **tsconfig:** add tsconfig.eslint.json for type-aware linting ([2c01b30](https://github.com/visulima/visulima/commit/2c01b30e740cdbf75f96317053fd78a56fb2ccc9))
146
+ * **tsconfig:** apply prettier formatting ([85f32f5](https://github.com/visulima/visulima/commit/85f32f5f072edef750a4ff41d8b25918d26a4641))
147
+ * **tsconfig:** migrate .prettierrc.cjs to prettier.config.js ([bbf2a3b](https://github.com/visulima/visulima/commit/bbf2a3b0f6e23ea39dfeb583b0d100a407c8adaf))
148
+ * **tsconfig:** sort fixture package.json fields ([370c336](https://github.com/visulima/visulima/commit/370c336d2e1331fe05d2231d92a2b3b456c77620))
149
+
150
+
151
+ ### Dependencies
152
+
153
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.7
154
+ * **@visulima/path:** upgraded to 3.0.0-alpha.8
155
+
156
+ ## @visulima/tsconfig [3.0.0-alpha.6](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.5...@visulima/tsconfig@3.0.0-alpha.6) (2026-03-26)
157
+
158
+ ### Features
159
+
160
+ * **web:** auto-generate packages page from workspace metadata ([623e520](https://github.com/visulima/visulima/commit/623e5207693a7fe720f5f2f179593a3654c880e3))
161
+
162
+
163
+ ### Dependencies
164
+
165
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.6
166
+ * **@visulima/path:** upgraded to 3.0.0-alpha.7
167
+
168
+ ## @visulima/tsconfig [3.0.0-alpha.5](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.4...@visulima/tsconfig@3.0.0-alpha.5) (2026-03-26)
169
+
170
+ ### Bug Fixes
171
+
172
+ * **tsconfig:** use workspace:* for internal [@visulima](https://github.com/visulima) deps ([420ce4a](https://github.com/visulima/visulima/commit/420ce4a0c075f78520fb9434ea83c9b6e301b571))
173
+ * **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
174
+
175
+ ### Miscellaneous Chores
176
+
177
+ * **tsconfig:** migrate deps to pnpm catalogs ([ab6e375](https://github.com/visulima/visulima/commit/ab6e37535ba3a575d0d0ddeee72560d8e560bccc))
178
+ * **tsconfig:** update dependencies ([bf73f34](https://github.com/visulima/visulima/commit/bf73f340b2059d0bf74d836154d7e3a65a8e2c0a))
179
+ * visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
180
+
181
+
182
+ ### Dependencies
183
+
184
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.5
185
+ * **@visulima/path:** upgraded to 3.0.0-alpha.6
186
+
187
+ ## @visulima/tsconfig [3.0.0-alpha.4](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.3...@visulima/tsconfig@3.0.0-alpha.4) (2026-03-06)
188
+
189
+ ### Bug Fixes
190
+
191
+ * **tsconfig:** update packem to 2.0.0-alpha.54 ([2f9b2ae](https://github.com/visulima/visulima/commit/2f9b2aea84a455f65ec6d682231876d5c5070159))
192
+
193
+ ### Documentation
194
+
195
+ * **humanizer,html,iso-locale,package,tsconfig:** add comprehensive Fumadocs documentation ([19781ce](https://github.com/visulima/visulima/commit/19781ce5d27605971a9f2fdf0a99863effd98091))
196
+
197
+ ### Miscellaneous Chores
198
+
199
+ * **tooling:** update dependencies ([7f6f9d3](https://github.com/visulima/visulima/commit/7f6f9d3c41b170c53659ab34b79ceb23e4e9660a))
200
+ * **tsconfig:** update dependencies ([3388495](https://github.com/visulima/visulima/commit/3388495a99235637506dc8b2958e26b625db36f1))
201
+ * **tsconfig:** update dependencies ([7697d4b](https://github.com/visulima/visulima/commit/7697d4b4fa7153ab4a6bb93af68e35da7946df89))
202
+ * update lock file maintenance ([d83e716](https://github.com/visulima/visulima/commit/d83e71697b75d24704185b66bb521a934d2db02d))
203
+ * year update ([47f4105](https://github.com/visulima/visulima/commit/47f410596ce7190cfea36a073db32e0cec50bbcd))
204
+
205
+
206
+ ### Dependencies
207
+
208
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.4
209
+ * **@visulima/path:** upgraded to 3.0.0-alpha.5
210
+
211
+ ## @visulima/tsconfig [3.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.2...@visulima/tsconfig@3.0.0-alpha.3) (2025-12-27)
212
+
213
+ ### Bug Fixes
214
+
215
+ * **tsconfig:** update package files ([f1bb598](https://github.com/visulima/visulima/commit/f1bb5982e370fac9caffd76a73645e51c6ab1704))
216
+
217
+ ### Miscellaneous Chores
218
+
219
+ * fixed project.json names and schema path ([964722f](https://github.com/visulima/visulima/commit/964722f691db205c7edb9aa6db29e849a647500b))
220
+
221
+
222
+ ### Dependencies
223
+
224
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.3
225
+ * **@visulima/path:** upgraded to 3.0.0-alpha.4
226
+
1
227
  ## @visulima/tsconfig [3.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.1...@visulima/tsconfig@3.0.0-alpha.2) (2025-12-11)
2
228
 
3
229
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 visulima
3
+ Copyright (c) 2026 visulima
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -557,7 +557,6 @@ This is an open source project and will always remain free to use. If you think
557
557
 
558
558
  The visulima tsconfig is open-sourced software licensed under the [MIT][license]
559
559
 
560
-
561
560
  <!-- badges -->
562
561
 
563
562
  [license-badge]: https://img.shields.io/npm/l/@visulima/tsconfig?style=for-the-badge
package/dist/index.d.ts CHANGED
@@ -1,7 +1,74 @@
1
- export type { Options as FindTsConfigOptions, TsConfigResult } from "./find-tsconfig.d.ts";
2
- export { findTsConfig, findTsConfigSync } from "./find-tsconfig.d.ts";
3
- export type { Options as ReadTsConfigOptions } from "./read-tsconfig.d.ts";
4
- export { implicitBaseUrlSymbol, readTsConfig } from "./read-tsconfig.d.ts";
5
- export type { TsConfigJsonResolved } from "./types.d.ts";
6
- export { writeTsConfig, writeTsConfigSync } from "./write-tsconfig.d.ts";
7
- export type { TsConfigJson } from "type-fest";
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&lt;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&lt;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&lt;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-CIJKFGq0.js";import{implicitBaseUrlSymbol as e,readTsConfig as s}from"./packem_shared/implicitBaseUrlSymbol-CMaKZ6En.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
+ 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};
@@ -0,0 +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-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,20 +1,25 @@
1
1
  {
2
2
  "name": "@visulima/tsconfig",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.20",
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": {
16
16
  "url": "https://github.com/visulima/visulima/issues"
17
17
  },
18
+ "license": "MIT",
19
+ "author": {
20
+ "name": "Daniel Bannert",
21
+ "email": "d.bannert@anolilab.de"
22
+ },
18
23
  "repository": {
19
24
  "type": "git",
20
25
  "url": "git+https://github.com/visulima/visulima.git",
@@ -30,13 +35,13 @@
30
35
  "url": "https://anolilab.com/support"
31
36
  }
32
37
  ],
33
- "license": "MIT",
34
- "author": {
35
- "name": "Daniel Bannert",
36
- "email": "d.bannert@anolilab.de"
37
- },
38
- "sideEffects": false,
38
+ "files": [
39
+ "dist",
40
+ "README.md",
41
+ "CHANGELOG.md"
42
+ ],
39
43
  "type": "module",
44
+ "sideEffects": false,
40
45
  "exports": {
41
46
  ".": {
42
47
  "types": "./dist/index.d.ts",
@@ -44,23 +49,17 @@
44
49
  },
45
50
  "./package.json": "./package.json"
46
51
  },
47
- "files": [
48
- "dist",
49
- "README.md",
50
- "CHANGELOG.md"
51
- ],
52
+ "publishConfig": {
53
+ "access": "public",
54
+ "provenance": true
55
+ },
52
56
  "dependencies": {
53
- "@visulima/fs": "5.0.0-alpha.2",
54
- "@visulima/path": "3.0.0-alpha.3",
57
+ "@visulima/fs": "5.0.0-alpha.20",
58
+ "@visulima/path": "3.0.0-alpha.10",
55
59
  "jsonc-parser": "^3.3.1",
56
- "resolve-pkg-maps": "^1.0.0",
57
- "type-fest": "^5.3.0"
60
+ "resolve-pkg-maps": "^1.0.0"
58
61
  },
59
62
  "engines": {
60
- "node": ">=22.13 <=25.x"
61
- },
62
- "publishConfig": {
63
- "access": "public",
64
- "provenance": true
63
+ "node": "^22.14.0 || >=24.10.0"
65
64
  }
66
65
  }
@@ -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&lt;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 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-CMaKZ6En.js";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};
@@ -1 +0,0 @@
1
- var B=Object.defineProperty;var D=(o,r)=>B(o,"name",{value:r,configurable:!0});import{createRequire as L}from"node:module";import{readFileSync as A,isAccessibleSync as f,findUpSync as N}from"@visulima/fs";import{NotFoundError as q}from"@visulima/fs/error";import{join as m,resolve as w,isAbsolute as _,toNamespacedPath as z,dirname as I,normalize as P,relative as v}from"@visulima/path";import{isRelative as R}from"@visulima/path/utils";import{parse as T}from"jsonc-parser";import{resolveExports as G}from"resolve-pkg-maps";const M=L(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,W=D(o=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[r,l]=x.versions.node.split(".").map(Number);if(r>22||r===22&&l>=3||r===20&&l>=16)return x.getBuiltinModule(o)}return M(o)},"__cjs_getBuiltinModule"),{statSync:C}=W("node:fs"),V=W("node:module");var H=Object.defineProperty,S=D((o,r)=>H(o,"name",{value:r,configurable:!0}),"d$1");const K=S(o=>T(A(o,{buffer:!1})),"readJsonc"),Q=S(()=>{const{findPnpApi:o}=V;return o?.(process.cwd())},"getPnpApi"),F=S((o,r,l,e)=>{const c=`resolveFromPackageJsonPath:${o}:${r}:${l?"yes":"no"}`;if(e?.has(c))return e.get(c);const t=K(o);if(!t)return;let n=r||"tsconfig.json";if(!l&&t.exports)try{const[s]=G(t.exports,r,["require","types"]);n=s}catch{return!1}else!r&&t.tsconfig&&(n=t.tsconfig);return n=m(o,"..",n),e?.set(c,n),n},"resolveFromPackageJsonPath"),k="package.json",$="tsconfig.json",X=S((o,r,l)=>{let e=o;if(o===".."&&(e=m(e,$)),o.startsWith(".")&&(e=w(r,e)),_(e)){if(f(e)){if(C(e).isFile())return e}else if(!e.endsWith(".json")){const p=`${e}.json`;if(f(p))return p}return}const[c,...t]=o.split("/"),n=c.startsWith("@")?`${c}/${t.shift()}`:c,s=t.join("/"),i=Q();if(i){const{resolveRequest:p}=i;try{if(n===o){const u=p(m(n,k),r);if(u){const h=F(u,s,!1,l);if(h&&f(h))return h}}else{let u;try{u=p(o,r,{extensions:[".json"]})}catch{u=p(m(o,$),r)}if(u)return u}}catch{}}const a=N(p=>{const u=m(w(p),"node_modules",n);if(f(u))return m("node_modules",n)},{cwd:r,type:"directory"});if(!a||!C(a).isDirectory())return;const b=m(a,k);if(f(b)){const p=F(b,s,!1,l);if(p===!1)return;if(p&&f(p)&&C(p).isFile())return p}const O=m(a,s),E=O.endsWith(".json");if(!E){const p=`${O}.json`;if(f(p))return p}if(f(O)){if(C(O).isDirectory()){const p=m(O,k);if(f(p)){const h=F(p,"",!0,l);if(h&&f(h))return h}const u=m(O,$);if(f(u))return u}else if(E)return O}},"resolveExtendsPath");var Y=Object.defineProperty,g=D((o,r)=>Y(o,"name",{value:r,configurable:!0}),"m");const Z=g(o=>T(A(o,{buffer:!1})),"readJsonc"),y=g(o=>{const r=z(o);return R(r)?r:`./${r}`},"normalizePath"),U=["files","include","exclude"],oo=g((o,r,l,e)=>{if(l.has(o))throw new Error(`Circularity detected while resolving configuration: ${o}`);l.add(o);const c=I(o),t=J(o,e,l);delete t.references;const{compilerOptions:n}=t;if(n){const{baseUrl:s}=n;s&&!s.startsWith(d)&&(n.baseUrl=P(v(r,m(c,s)))||"./");let{outDir:i}=n;i&&(i.startsWith(d)||(i=v(r,m(c,i))),n.outDir=y(i.replace(`${d}/`,""))||"./")}for(const s of U){const i=t[s];i&&(t[s]=i.map(a=>a.startsWith(d)||_(a)?a:v(r,m(c,a))))}return t},"resolveExtends"),J=g((o,r,l=new Set)=>{let e;try{e=Z(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 c=I(o);if(e.compilerOptions){const{compilerOptions:t}=e;t.paths&&!t.baseUrl&&(t[io]=c)}if(e.extends){const t=Array.isArray(e.extends)?e.extends:[e.extends];delete e.extends;for(const n of t.toReversed()){const s=X(n,c);if(!s)throw new q(`No such file or directory, for '${n}' found.`);const i=oo(s,c,new Set(l),r);i.compilerOptions?.rootDir!==void 0&&!i.compilerOptions.rootDir.startsWith(d)&&(i.compilerOptions.rootDir=m(I(s),i.compilerOptions.rootDir));const a={...i,...e,compilerOptions:{...i.compilerOptions,...e.compilerOptions}};i.watchOptions&&(a.watchOptions={...i.watchOptions,...e.watchOptions}),e=a}}if(e.compilerOptions){const{compilerOptions:t}=e;for(const n of["baseUrl","rootDir"]){const s=t[n];if(s&&!s.startsWith(d)){const i=w(c,s);t[n]=y(v(c,i))}}for(const n of["outDir","declarationDir"]){let s=t[n];if(s){Array.isArray(e.exclude)||(e.exclude=[]);let i=s;_(i)||(i=m(c,i)),i=i.replace(d,""),e.exclude.includes(i)||e.exclude.push(i),s.startsWith(d)||(s=y(s)),t[n]=s}}}else e.compilerOptions={};if(e.include?(e.include=e.include.map(t=>P(t)),e.files&&delete e.files):e.files&&(e.files=e.files.map(t=>t.startsWith(d)?t:y(t))),e.watchOptions){const{watchOptions:t}=e;t.excludeDirectories&&(t.excludeDirectories=t.excludeDirectories.map(n=>w(c,n)))}return e.compilerOptions?.lib&&(e.compilerOptions.lib=e.compilerOptions.lib.map(t=>t.toLowerCase())),e.compilerOptions.module&&(e.compilerOptions.module=e.compilerOptions.module.toLowerCase()),e.compilerOptions.target&&(e.compilerOptions.target=e.compilerOptions.target.toLowerCase()),e},"internalParseTsConfig"),j=g((o,r)=>{if(o.startsWith(d))return P(m(r,o.slice(d.length)))},"interpolateConfigDirectory"),eo=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],to=g((o,r)=>{if(o.compilerOptions===void 0)return o;if(o.compilerOptions.rewriteRelativeImportExtensions&&(o.compilerOptions.allowImportingTsExtensions??=!0),["5.4","5.5","5.6","5.7","5.8","5.9","true"].includes(String(r?.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.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(o.compilerOptions.moduleResolution==="bundler"&&(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(r?.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","5.9","true"].includes(String(r?.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(r?.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}",io=Symbol("implicitBaseUrl"),uo=g((o,r)=>{const l=w(o),e=J(l,r),c=I(l),{compilerOptions:t}=e;if(t){for(const s of eo){const i=t[s];if(i){const a=j(i,c);t[s]=a?y(v(c,a)):i}}for(const s of["rootDirs","typeRoots"]){const i=t[s];i&&(t[s]=i.map(a=>{const b=j(a,c);return b?y(v(c,b)):a}))}const{paths:n}=t;if(n)for(const s of Object.keys(n))n[s]=n[s].map(i=>j(i,c)??i);t.outDir&&(t.outDir=t.outDir.replace(d,""))}for(const n of U){const s=e[n];s&&(e[n]=s.map(i=>j(i,c)||(n==="files"&&R(i)?i:n==="include"&&R(i)?m(c,i):P(i))))}return to(e,r)},"readTsConfig");export{d as configDirectoryPlaceholder,io as implicitBaseUrlSymbol,uo as readTsConfig};
@@ -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" | 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
@@ -1,3 +0,0 @@
1
- import type { Except, TsConfigJson } from "type-fest";
2
- export type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
3
- export type Cache<T = any> = Map<string, T>;
@@ -1,3 +0,0 @@
1
- import type { Cache } from "../types.d.ts";
2
- declare const resolveExtendsPath: (requestedPath: string, directoryPath: string, cache?: Cache<string>) => string | undefined;
3
- export default resolveExtendsPath;
@@ -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&lt;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&lt;void>`.
21
- */
22
- export declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
23
- cwd?: URL | string;
24
- }) => void;