@visulima/tsconfig 3.0.0-alpha.3 → 3.0.0-alpha.30

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,314 @@
1
+ ## @visulima/tsconfig [3.0.0-alpha.30](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.29...@visulima/tsconfig@3.0.0-alpha.30) (2026-06-04)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.31
7
+
8
+ ## @visulima/tsconfig [3.0.0-alpha.29](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.28...@visulima/tsconfig@3.0.0-alpha.29) (2026-06-04)
9
+
10
+ ### Bug Fixes
11
+
12
+ * **tsconfig:** 2 bug fixes ([efc52ce](https://github.com/visulima/visulima/commit/efc52ce63e5cbe9a3b18a98c5cba2886deec6404))
13
+
14
+
15
+ ### Dependencies
16
+
17
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.30
18
+ * **@visulima/path:** upgraded to 3.0.0-alpha.12
19
+
20
+ ## @visulima/tsconfig [3.0.0-alpha.28](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.27...@visulima/tsconfig@3.0.0-alpha.28) (2026-06-02)
21
+
22
+
23
+ ### Dependencies
24
+
25
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.29
26
+
27
+ ## @visulima/tsconfig [3.0.0-alpha.27](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.26...@visulima/tsconfig@3.0.0-alpha.27) (2026-05-27)
28
+
29
+ ### Bug Fixes
30
+
31
+ * **storage-client:** percent-encode user fields in defaultFingerprint ([7c78a0f](https://github.com/visulima/visulima/commit/7c78a0f9512e2a673b941d80839e9f1e86b7b5d0))
32
+
33
+ ### Miscellaneous Chores
34
+
35
+ * sorted package.json ([b47c545](https://github.com/visulima/visulima/commit/b47c545591600fdab17d5cd3a3fbc68b61e199da))
36
+
37
+
38
+ ### Dependencies
39
+
40
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.28
41
+ * **@visulima/path:** upgraded to 3.0.0-alpha.11
42
+
43
+ ## @visulima/tsconfig [3.0.0-alpha.26](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.25...@visulima/tsconfig@3.0.0-alpha.26) (2026-05-26)
44
+
45
+ ### Miscellaneous Chores
46
+
47
+ * **ci-stability:** green CI across vis, native, lint, tests, attw ([#651](https://github.com/visulima/visulima/issues/651)) ([d4eb684](https://github.com/visulima/visulima/commit/d4eb684b5f75c818c9251048c605a0ed54a268e3))
48
+ * **repo:** sort package.json keys across all packages ([e1fd9ab](https://github.com/visulima/visulima/commit/e1fd9ab467ef96a98c777da1572ff6a50fcf7e71))
49
+
50
+ ### Tests
51
+
52
+ * **repo:** add dist runtime + types integration tests ([32ee300](https://github.com/visulima/visulima/commit/32ee300b7184117a0ddf9f9d390f75f8932d5ed9))
53
+
54
+
55
+ ### Dependencies
56
+
57
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.26
58
+
59
+ ## @visulima/tsconfig [3.0.0-alpha.25](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.24...@visulima/tsconfig@3.0.0-alpha.25) (2026-05-20)
60
+
61
+
62
+ ### Dependencies
63
+
64
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.25
65
+
66
+ ## @visulima/tsconfig [3.0.0-alpha.24](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.23...@visulima/tsconfig@3.0.0-alpha.24) (2026-05-19)
67
+
68
+
69
+ ### Dependencies
70
+
71
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.24
72
+
73
+ ## @visulima/tsconfig [3.0.0-alpha.23](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.22...@visulima/tsconfig@3.0.0-alpha.23) (2026-05-16)
74
+
75
+
76
+ ### Dependencies
77
+
78
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.23
79
+
80
+ ## @visulima/tsconfig [3.0.0-alpha.22](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.21...@visulima/tsconfig@3.0.0-alpha.22) (2026-05-14)
81
+
82
+ ### Features
83
+
84
+ * **tsconfig:** clear lint findings in tsc helper ([d9a99bc](https://github.com/visulima/visulima/commit/d9a99bc860e26bcdcdda8cf2e98528a746c3b05a))
85
+
86
+ ### Miscellaneous Chores
87
+
88
+ * **tooling:** apply prettier and eslint formatting sweep ([c2c641d](https://github.com/visulima/visulima/commit/c2c641d40242e99030cb990fa01039db5e267667))
89
+
90
+
91
+ ### Dependencies
92
+
93
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.22
94
+
95
+ ## @visulima/tsconfig [3.0.0-alpha.21](https://github.com/visulima/visulima/compare/@visulima/tsconfig@3.0.0-alpha.20...@visulima/tsconfig@3.0.0-alpha.21) (2026-05-11)
96
+
97
+
98
+ ### Dependencies
99
+
100
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.21
101
+
102
+ ## @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)
103
+
104
+
105
+ ### Dependencies
106
+
107
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.20
108
+
109
+ ## @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)
110
+
111
+
112
+ ### Dependencies
113
+
114
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.19
115
+
116
+ ## @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)
117
+
118
+ ### Code Refactoring
119
+
120
+ * replace execa with tinyexec ([56ec776](https://github.com/visulima/visulima/commit/56ec776908fe0c068c54542f3885cb29f061fea7))
121
+
122
+
123
+ ### Dependencies
124
+
125
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.18
126
+
127
+ ## @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)
128
+
129
+
130
+ ### Dependencies
131
+
132
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.17
133
+
134
+ ## @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)
135
+
136
+
137
+ ### Dependencies
138
+
139
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.16
140
+
141
+ ## @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)
142
+
143
+
144
+ ### Dependencies
145
+
146
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.15
147
+
148
+ ## @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)
149
+
150
+ ### Miscellaneous Chores
151
+
152
+ * **tsconfig:** apply prettier and eslint quote-style auto-fix ([e184ae4](https://github.com/visulima/visulima/commit/e184ae4c162360c743428361d9be977bad555854))
153
+ * **tsconfig:** housekeeping cleanup ([081acf1](https://github.com/visulima/visulima/commit/081acf12b3853d85b233412493b48061d4f0dbf3))
154
+
155
+
156
+ ### Dependencies
157
+
158
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.14
159
+
160
+ ## @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)
161
+
162
+
163
+ ### Dependencies
164
+
165
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.13
166
+
167
+ ## @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)
168
+
169
+ ### Features
170
+
171
+ * **tsconfig:** typescript-version-aware compiler defaults ([1a4236b](https://github.com/visulima/visulima/commit/1a4236bfe0dabb769a88a052a1c9e7511daf6e6d))
172
+
173
+ ### Miscellaneous Chores
174
+
175
+ * added missing version key ([3b55253](https://github.com/visulima/visulima/commit/3b55253728af652a0bcaf230d93d2f9e9f2d8806))
176
+ * re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
177
+ * **tsconfig:** upgrade packem to 2.0.0-alpha.76 ([4f08e20](https://github.com/visulima/visulima/commit/4f08e204f3a82f5da7346ad910cf39cb2c13de51))
178
+
179
+ ## @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)
180
+
181
+ ### Bug Fixes
182
+
183
+ * 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))
184
+
185
+
186
+ ### Dependencies
187
+
188
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.12
189
+ * **@visulima/path:** upgraded to 3.0.0-alpha.10
190
+
191
+ ## @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)
192
+
193
+ ### Miscellaneous Chores
194
+
195
+ * jsr.json update and lock file ([73fce38](https://github.com/visulima/visulima/commit/73fce38c7cb4603f3fffb88609b1b18e2feb4937))
196
+
197
+
198
+ ### Dependencies
199
+
200
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.11
201
+
202
+ ## @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)
203
+
204
+ ### Miscellaneous Chores
205
+
206
+ * update the jsr.json ([864ab7e](https://github.com/visulima/visulima/commit/864ab7e71c4b5ae82f64792d1ae8debfea2c539b))
207
+
208
+
209
+ ### Dependencies
210
+
211
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.10
212
+
213
+ ## @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)
214
+
215
+ ### Bug Fixes
216
+
217
+ * **tooling:** resolve eslint and formatting issues ([399d292](https://github.com/visulima/visulima/commit/399d29282be5b29bb26b4e5b24d45e2a6cdeeca3))
218
+ * **tsconfig:** relax no-unsafe-* for tests and untyped external deps ([1e63952](https://github.com/visulima/visulima/commit/1e63952c41ff76e450ba4ca5aba6ddf7229c65b3))
219
+ * **tsconfig:** suppress sonarjs/deprecation for baseUrl handling ([431ae96](https://github.com/visulima/visulima/commit/431ae96bdd025a052bde8291918b1593f972efa1))
220
+
221
+ ### Miscellaneous Chores
222
+
223
+ * bump engines.node to ^22.14.0 || >=24.10.0 ([c3d0931](https://github.com/visulima/visulima/commit/c3d0931d1504e4f21ebf50ea680cfa7ce4ba15ce))
224
+ * fixed jsr.json ([5d85e51](https://github.com/visulima/visulima/commit/5d85e5179de38e284ec433b14d77c71a1619c8d6))
225
+ * **tsconfig:** apply pending changes ([d7ddb14](https://github.com/visulima/visulima/commit/d7ddb14293c1a140e818dd1b314caeba68db66da))
226
+
227
+
228
+ ### Dependencies
229
+
230
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.9
231
+
232
+ ## @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)
233
+
234
+ ### Bug Fixes
235
+
236
+ * **tsconfig:** add node types and fix implicit any parameter ([1744d82](https://github.com/visulima/visulima/commit/1744d82a07fca03f2e6ff660b918e9b2623acf69))
237
+ * **tsconfig:** add TypeScript 6.0 compatibility for implicit compiler defaults ([19de98f](https://github.com/visulima/visulima/commit/19de98f2640c143c6f5e84eda214c84584cf980c))
238
+ * **tsconfig:** align parsing with get-tsconfig for files/include, path inheritance, and TS 6.0 ([0c9d4be](https://github.com/visulima/visulima/commit/0c9d4be347f6ee4212dbe98026a7cd1d465bc2de))
239
+ * **tsconfig:** properly fix eslint errors in code ([95a2142](https://github.com/visulima/visulima/commit/95a2142f816f9ae0d50caaf235a71f9d03ab71cf))
240
+ * **tsconfig:** remove remaining eslint suppressions with proper code fixes ([57a45bb](https://github.com/visulima/visulima/commit/57a45bbc4e00e1c688a12367dc734c1553a17a6a))
241
+ * **tsconfig:** resolve eslint errors ([5848320](https://github.com/visulima/visulima/commit/5848320dc88a6080cf507eda724f57f9a6800434))
242
+
243
+ ### Miscellaneous Chores
244
+
245
+ * **tooling:** remove empty dependency objects from package.json ([dc52a23](https://github.com/visulima/visulima/commit/dc52a23bc1e2d36f4ec71ca67506bf6861a02929))
246
+ * **tsconfig:** add tsconfig.eslint.json for type-aware linting ([2c01b30](https://github.com/visulima/visulima/commit/2c01b30e740cdbf75f96317053fd78a56fb2ccc9))
247
+ * **tsconfig:** apply prettier formatting ([85f32f5](https://github.com/visulima/visulima/commit/85f32f5f072edef750a4ff41d8b25918d26a4641))
248
+ * **tsconfig:** migrate .prettierrc.cjs to prettier.config.js ([bbf2a3b](https://github.com/visulima/visulima/commit/bbf2a3b0f6e23ea39dfeb583b0d100a407c8adaf))
249
+ * **tsconfig:** sort fixture package.json fields ([370c336](https://github.com/visulima/visulima/commit/370c336d2e1331fe05d2231d92a2b3b456c77620))
250
+
251
+
252
+ ### Dependencies
253
+
254
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.7
255
+ * **@visulima/path:** upgraded to 3.0.0-alpha.8
256
+
257
+ ## @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)
258
+
259
+ ### Features
260
+
261
+ * **web:** auto-generate packages page from workspace metadata ([623e520](https://github.com/visulima/visulima/commit/623e5207693a7fe720f5f2f179593a3654c880e3))
262
+
263
+
264
+ ### Dependencies
265
+
266
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.6
267
+ * **@visulima/path:** upgraded to 3.0.0-alpha.7
268
+
269
+ ## @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)
270
+
271
+ ### Bug Fixes
272
+
273
+ * **tsconfig:** use workspace:* for internal [@visulima](https://github.com/visulima) deps ([420ce4a](https://github.com/visulima/visulima/commit/420ce4a0c075f78520fb9434ea83c9b6e301b571))
274
+ * **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
275
+
276
+ ### Miscellaneous Chores
277
+
278
+ * **tsconfig:** migrate deps to pnpm catalogs ([ab6e375](https://github.com/visulima/visulima/commit/ab6e37535ba3a575d0d0ddeee72560d8e560bccc))
279
+ * **tsconfig:** update dependencies ([bf73f34](https://github.com/visulima/visulima/commit/bf73f340b2059d0bf74d836154d7e3a65a8e2c0a))
280
+ * visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
281
+
282
+
283
+ ### Dependencies
284
+
285
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.5
286
+ * **@visulima/path:** upgraded to 3.0.0-alpha.6
287
+
288
+ ## @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)
289
+
290
+ ### Bug Fixes
291
+
292
+ * **tsconfig:** update packem to 2.0.0-alpha.54 ([2f9b2ae](https://github.com/visulima/visulima/commit/2f9b2aea84a455f65ec6d682231876d5c5070159))
293
+
294
+ ### Documentation
295
+
296
+ * **humanizer,html,iso-locale,package,tsconfig:** add comprehensive Fumadocs documentation ([19781ce](https://github.com/visulima/visulima/commit/19781ce5d27605971a9f2fdf0a99863effd98091))
297
+
298
+ ### Miscellaneous Chores
299
+
300
+ * **tooling:** update dependencies ([7f6f9d3](https://github.com/visulima/visulima/commit/7f6f9d3c41b170c53659ab34b79ceb23e4e9660a))
301
+ * **tsconfig:** update dependencies ([3388495](https://github.com/visulima/visulima/commit/3388495a99235637506dc8b2958e26b625db36f1))
302
+ * **tsconfig:** update dependencies ([7697d4b](https://github.com/visulima/visulima/commit/7697d4b4fa7153ab4a6bb93af68e35da7946df89))
303
+ * update lock file maintenance ([d83e716](https://github.com/visulima/visulima/commit/d83e71697b75d24704185b66bb521a934d2db02d))
304
+ * year update ([47f4105](https://github.com/visulima/visulima/commit/47f410596ce7190cfea36a073db32e0cec50bbcd))
305
+
306
+
307
+ ### Dependencies
308
+
309
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.4
310
+ * **@visulima/path:** upgraded to 3.0.0-alpha.5
311
+
1
312
  ## @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)
2
313
 
3
314
  ### 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
@@ -449,7 +449,7 @@ Defined in: [packages/tsconfig/src/find-tsconfig.ts:10](https://github.com/visul
449
449
 
450
450
  ```ts
451
451
  optional cache:
452
- | Map<string, TsConfigJsonResolved>
452
+ | Map<string, TsConfigResult>
453
453
  | boolean;
454
454
  ```
455
455
 
@@ -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, TsConfigResult> | 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-C2Rhk1nd.js";import{implicitBaseUrlSymbol as e,readTsConfig as s}from"./packem_shared/implicitBaseUrlSymbol-BmYUUOd7.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 y=Object.defineProperty;var s=(c,o)=>y(c,"name",{value:o,configurable:!0});import{findUp as f,findUpSync as a}from"@visulima/fs";import{NotFoundError as p}from"@visulima/fs/error";import{readTsConfig as g}from"./implicitBaseUrlSymbol-BmYUUOd7.js";var d=Object.defineProperty,l=s((c,o)=>d(c,"name",{value:o,configurable:!0}),"r");const h=new Map,C=l(async(c,o={})=>{const r=o.configFileName??"tsconfig.json";let i=await f(r,{...c&&{cwd:c},type:"file"});if(i??=await f("jsconfig.json",{...c&&{cwd:c},type:"file"}),!i)throw new p(`No such file or directory, for '${r}' or 'jsconfig.json' found.`);const n=o.cache&&typeof o.cache!="boolean"?o.cache:h,t=`${i}::${String(o.tscCompatible)}::${String(o.typescriptVersion)}`;if(o.cache&&n.has(t))return n.get(t);const e={config:g(i,{tscCompatible:o.tscCompatible,typescriptVersion:o.typescriptVersion}),path:i};return o.cache&&n.set(t,e),e},"findTsConfig"),b=l((c,o={})=>{const r=o.configFileName??"tsconfig.json";let i=a(r,{...c&&{cwd:c},type:"file"});if(i??=a("jsconfig.json",{...c&&{cwd:c},type:"file"}),!i)throw new p(`No such file or directory, for '${r}' or 'jsconfig.json' found.`);const n=o.cache&&typeof o.cache!="boolean"?o.cache:h,t=`${i}::${String(o.tscCompatible)}::${String(o.typescriptVersion)}`;if(o.cache&&n.has(t))return n.get(t);const e={config:g(i,{tscCompatible:o.tscCompatible,typescriptVersion:o.typescriptVersion}),path:i};return o.cache&&n.set(t,e),e},"findTsConfigSync");export{C as findTsConfig,b 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 E,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 V,toNamespacedPath as K,relative as C,normalize as k,dirname as R}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),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=v(e=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[o,s]=D.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return D.getBuiltinModule(e)}return G(e)},"__cjs_getBuiltinModule"),{statSync:P}=U("node:fs"),_=U("node:module");var Y=Object.defineProperty,S=v((e,o)=>Y(e,"name",{value:o,configurable:!0}),"d$1");const Z=S(e=>J(E(e,{buffer:!1})),"readJsonc"),ee=S(()=>{const{findPnpApi:e}=_;return e?.(process.cwd())},"getPnpApi"),F=S((e,o,s,r)=>{const t=`resolveFromPackageJsonPath:${e}:${o}:${s?"yes":"no"}`;if(r?.has(t))return r.get(t);const a=Z(e);if(!a)return;let i=o||"tsconfig.json";if(!s&&a.exports)try{const[l]=X(a.exports,o,["require","types"]);i=l}catch{return!1}else!o&&a.tsconfig&&(i=a.tsconfig);return i=d(e,"..",i),r?.set(t,i),i},"resolveFromPackageJsonPath"),$="package.json",I="tsconfig.json",oe=S((e,o,s)=>{let r=e;if(e===".."&&(r=d(r,I)),e.startsWith(".")&&(r=b(o,r)),V(r)){if(h(r)){if(P(r).isFile())return r}else if(!r.endsWith(".json")){const u=`${r}.json`;if(h(u))return u}return}const[t="",...a]=e.split("/"),i=t.startsWith("@")?`${t}/${String(a.shift())}`:t,l=a.join("/"),n=ee();if(n){const{resolveRequest:u}=n;try{if(i===e){const f=u(d(i,$),o);if(f){const g=F(f,l,!1,s);if(g&&h(g))return g}}else{let f;try{f=u(e,o,{extensions:[".json"]})}catch{f=u(d(e,I),o)}if(f)return f}}catch{}}const c=W(u=>{const f=d(b(u),"node_modules",i);if(h(f))return d("node_modules",i)},{cwd:o,type:"directory"});if(!c||!P(c).isDirectory())return;const p=d(c,$);if(h(p)){const u=F(p,l,!1,s);if(u===!1)return;if(u&&h(u)&&P(u).isFile())return u}const m=d(c,l),w=m.endsWith(".json");if(!w){const u=`${m}.json`;if(h(u))return u}if(h(m)){if(P(m).isDirectory()){const u=d(m,$);if(h(u)){const g=F(u,"",!0,s);if(g&&h(g))return g}const f=d(m,I);if(h(f))return f}else if(w)return m}},"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 r=se(o);if(r)try{s=r.resolveRequest("typescript/package.json",o)??void 0}catch{}if(s??=W(t=>d(t,"node_modules","typescript","package.json"),{cwd:o,type:"file"}),!!s)try{const t=J(E(s,{buffer:!1}));if(typeof t?.version=="string")return t.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 r=new Set(Object.keys(e));for(const[t,a]of we)t<=s&&a(e,r)},"applyVersionDefaults");var Pe=Object.defineProperty,O=v((e,o)=>Pe(e,"name",{value:o,configurable:!0}),"d");const je=O(e=>J(E(e,{buffer:!1})),"readJsonc"),ke=O(e=>e.replaceAll("\\","/"),"slash"),x=O(e=>{const o=K(e);return Q(o)?o:`./${o}`},"normalizePath"),A=["files","include","exclude"],T=O((e,o,s)=>{const r=d(o,s),t=C(e,r);return k(t)||"./"},"resolveAndRelativize"),Re=O((e,o,s)=>{const r=C(e,o);if(!r)return s;const t=s.startsWith("./")?s.slice(2):s;return`${r}/${t}`},"prefixPattern"),Se=O((e,o,s,r,t)=>{if(s.has(e))throw new Error(`Circularity detected while resolving configuration: ${e}`);s.add(e);const a=R(e),i=N(e,r,s,t);delete i.references;const{compilerOptions:l}=i;if(l){const{baseUrl:n}=l;n&&!n.startsWith(y)&&(l.baseUrl=T(o,a,n));const{outDir:c}=l;c&&!c.startsWith(y)&&(l.outDir=T(o,a,c))}for(const n of A){const c=i[n];c&&(i[n]=c.map(p=>p.startsWith(y)||V(p)?p:Re(o,a,p)))}return i},"resolveExtends"),N=O((e,o,s=new Set,r=new Map)=>{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 a=R(e);if(t.compilerOptions){const{compilerOptions:i}=t;i.paths&&!i.baseUrl&&(i[Le]=a)}if(t.extends){const i=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;const l=i.toReversed();for(let n=0;n<l.length;n++){const c=l[n],p=oe(c,a,r);if(!p)throw new H(`No such file or directory, for '${c}' found.`);const m=Se(p,a,new Set(s),o,r);m.compilerOptions?.rootDir!==void 0&&!m.compilerOptions.rootDir.startsWith(y)&&(m.compilerOptions.rootDir=d(R(p),m.compilerOptions.rootDir));const w={...m,...t,compilerOptions:{...m.compilerOptions,...t.compilerOptions}};m.watchOptions&&(w.watchOptions={...m.watchOptions,...t.watchOptions}),t=w}}if(t.compilerOptions){const{compilerOptions:i}=t;for(const l of["baseUrl","rootDir"]){const n=i[l];if(n&&!n.startsWith(y)){const c=b(a,n);i[l]=x(C(a,c))}}for(const l of["outDir","declarationDir"]){let n=i[l];n&&(Array.isArray(t.exclude)||(t.exclude=["outDir","declarationDir"].map(c=>{const p=i[c];if(p)return p.startsWith(y)||V(p)?p:d(a,p)}).filter(Boolean)),n.startsWith(y)||(n=x(n)),i[l]=n)}}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:x(i))),t.watchOptions){const{watchOptions:i}=t;i.excludeDirectories&&(i.excludeDirectories=i.excludeDirectories.map(l=>k(b(a,l)))),i.excludeFiles&&(i.excludeFiles=i.excludeFiles.map(l=>k(b(a,l)))),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"),j=O((e,o)=>{if(e.startsWith(y))return k(d(o,e.slice(y.length)))},"interpolateConfigDirectory"),Fe=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],L=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&&L(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&&L(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&&!L(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,r=e.compilerOptions.moduleResolution?.toLocaleLowerCase();!(s!==void 0&&["node20","nodenext"].includes(s)||r==="bundler")&&r&&(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),r=N(s,o),t=R(s),a=Ie(o,t);a&&r.compilerOptions&&Ce(r.compilerOptions,a);const{compilerOptions:i}=r;if(i){for(const n of Fe){const c=i[n];if(c){const p=j(c,t);i[n]=p?x(C(t,p)):c}}for(const n of["rootDirs","typeRoots"]){const c=i[n];c&&(i[n]=c.map(p=>{const m=j(p,t);return m?x(C(t,m)):p}))}const{paths:l}=i;if(l){const n=Object.keys(l);for(let c=0;c<n.length;c++){const p=n[c];l[p]=l[p].map(m=>j(m,t)??m)}}i.outDir&&(i.outDir=i.outDir.replace(y,""))}for(let l=0;l<A.length;l++){const n=A[l],c=r[n];c&&(r[n]=c.map(p=>j(p,t)??p))}return $e(r,o)},"readTsConfig");export{y as configDirectoryPlaceholder,Le as implicitBaseUrlSymbol,Me as readTsConfig};
package/package.json CHANGED
@@ -1,20 +1,18 @@
1
1
  {
2
2
  "name": "@visulima/tsconfig",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.30",
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
- "bugs": {
16
- "url": "https://github.com/visulima/visulima/issues"
17
- },
15
+ "bugs": "https://github.com/visulima/visulima/issues",
18
16
  "repository": {
19
17
  "type": "git",
20
18
  "url": "git+https://github.com/visulima/visulima.git",
@@ -50,14 +48,13 @@
50
48
  "CHANGELOG.md"
51
49
  ],
52
50
  "dependencies": {
53
- "@visulima/fs": "5.0.0-alpha.3",
54
- "@visulima/path": "3.0.0-alpha.4",
51
+ "@visulima/fs": "5.0.0-alpha.31",
52
+ "@visulima/path": "3.0.0-alpha.12",
55
53
  "jsonc-parser": "^3.3.1",
56
- "resolve-pkg-maps": "^1.0.0",
57
- "type-fest": "^5.3.1"
54
+ "resolve-pkg-maps": "^1.0.0"
58
55
  },
59
56
  "engines": {
60
- "node": ">=22.13 <=25.x"
57
+ "node": "^22.14.0 || >=24.10.0"
61
58
  },
62
59
  "publishConfig": {
63
60
  "access": "public",
@@ -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;