@visulima/tsconfig 1.1.6 → 1.1.8

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.
@@ -0,0 +1,460 @@
1
+ import { isAccessibleSync, findUpSync, readFileSync } from '@visulima/fs';
2
+ import { NotFoundError } from '@visulima/fs/error';
3
+ import { join, resolve, isAbsolute, dirname, relative, normalize, toNamespacedPath } from '@visulima/path';
4
+ import { isRelative } from '@visulima/path/utils';
5
+ import { parse } from 'jsonc-parser';
6
+ import { statSync } from 'node:fs';
7
+ import Module from 'node:module';
8
+ import { resolveExports } from 'resolve-pkg-maps';
9
+
10
+ var __defProp$1 = Object.defineProperty;
11
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
12
+ const readJsonc$1 = /* @__PURE__ */ __name$1((jsonPath) => parse(readFileSync(jsonPath, { buffer: false })), "readJsonc");
13
+ const getPnpApi = /* @__PURE__ */ __name$1(() => {
14
+ const { findPnpApi } = Module;
15
+ return findPnpApi?.(process.cwd());
16
+ }, "getPnpApi");
17
+ const resolveFromPackageJsonPath = /* @__PURE__ */ __name$1((packageJsonPath, subpath, ignoreExports, cache) => {
18
+ const cacheKey = "resolveFromPackageJsonPath:" + packageJsonPath + ":" + subpath + ":" + (ignoreExports ? "yes" : "no");
19
+ if (cache?.has(cacheKey)) {
20
+ return cache.get(cacheKey);
21
+ }
22
+ const packageJson = readJsonc$1(packageJsonPath);
23
+ if (!packageJson) {
24
+ return undefined;
25
+ }
26
+ let resolvedPath = subpath || "tsconfig.json";
27
+ if (!ignoreExports && packageJson.exports) {
28
+ try {
29
+ const [resolvedExport] = resolveExports(packageJson.exports, subpath, ["require", "types"]);
30
+ resolvedPath = resolvedExport;
31
+ } catch {
32
+ return false;
33
+ }
34
+ } else if (!subpath && packageJson.tsconfig) {
35
+ resolvedPath = packageJson.tsconfig;
36
+ }
37
+ resolvedPath = join(packageJsonPath, "..", resolvedPath);
38
+ cache?.set(cacheKey, resolvedPath);
39
+ return resolvedPath;
40
+ }, "resolveFromPackageJsonPath");
41
+ const PACKAGE_JSON = "package.json";
42
+ const TS_CONFIG_JSON = "tsconfig.json";
43
+ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPath, cache) => {
44
+ let filePath = requestedPath;
45
+ if (requestedPath === "..") {
46
+ filePath = join(filePath, TS_CONFIG_JSON);
47
+ }
48
+ if (requestedPath.startsWith(".")) {
49
+ filePath = resolve(directoryPath, filePath);
50
+ }
51
+ if (isAbsolute(filePath)) {
52
+ if (isAccessibleSync(filePath)) {
53
+ if (statSync(filePath).isFile()) {
54
+ return filePath;
55
+ }
56
+ } else if (!filePath.endsWith(".json")) {
57
+ const jsonPath = `${filePath}.json`;
58
+ if (isAccessibleSync(jsonPath)) {
59
+ return jsonPath;
60
+ }
61
+ }
62
+ return undefined;
63
+ }
64
+ const [orgOrName, ...remaining] = requestedPath.split("/");
65
+ const packageName = orgOrName.startsWith("@") ? orgOrName + "/" + remaining.shift() : orgOrName;
66
+ const subpath = remaining.join("/");
67
+ const pnpApi = getPnpApi();
68
+ if (pnpApi) {
69
+ const { resolveRequest: resolveWithPnp } = pnpApi;
70
+ try {
71
+ if (packageName === requestedPath) {
72
+ const packageJsonPath2 = resolveWithPnp(join(packageName, PACKAGE_JSON), directoryPath);
73
+ if (packageJsonPath2) {
74
+ const resolvedPath = resolveFromPackageJsonPath(packageJsonPath2, subpath, false, cache);
75
+ if (resolvedPath && isAccessibleSync(resolvedPath)) {
76
+ return resolvedPath;
77
+ }
78
+ }
79
+ } else {
80
+ let resolved;
81
+ try {
82
+ resolved = resolveWithPnp(requestedPath, directoryPath, { extensions: [".json"] });
83
+ } catch {
84
+ resolved = resolveWithPnp(join(requestedPath, TS_CONFIG_JSON), directoryPath);
85
+ }
86
+ if (resolved) {
87
+ return resolved;
88
+ }
89
+ }
90
+ } catch {
91
+ }
92
+ }
93
+ const packagePath = findUpSync(
94
+ (directory) => {
95
+ const path = join(resolve(directory), "node_modules", packageName);
96
+ if (isAccessibleSync(path)) {
97
+ return join("node_modules", packageName);
98
+ }
99
+ return undefined;
100
+ },
101
+ {
102
+ cwd: directoryPath,
103
+ type: "directory"
104
+ }
105
+ );
106
+ if (!packagePath || !statSync(packagePath).isDirectory()) {
107
+ return undefined;
108
+ }
109
+ const packageJsonPath = join(packagePath, PACKAGE_JSON);
110
+ if (isAccessibleSync(packageJsonPath)) {
111
+ const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);
112
+ if (resolvedPath === false) {
113
+ return undefined;
114
+ }
115
+ if (resolvedPath && isAccessibleSync(resolvedPath) && statSync(resolvedPath).isFile()) {
116
+ return resolvedPath;
117
+ }
118
+ }
119
+ const fullPackagePath = join(packagePath, subpath);
120
+ const jsonExtension = fullPackagePath.endsWith(".json");
121
+ if (!jsonExtension) {
122
+ const fullPackagePathWithJson = fullPackagePath + ".json";
123
+ if (isAccessibleSync(fullPackagePathWithJson)) {
124
+ return fullPackagePathWithJson;
125
+ }
126
+ }
127
+ if (!isAccessibleSync(fullPackagePath)) {
128
+ return undefined;
129
+ }
130
+ if (statSync(fullPackagePath).isDirectory()) {
131
+ const fullPackageJsonPath = join(fullPackagePath, PACKAGE_JSON);
132
+ if (isAccessibleSync(fullPackageJsonPath)) {
133
+ const resolvedPath = resolveFromPackageJsonPath(fullPackageJsonPath, "", true, cache);
134
+ if (resolvedPath && isAccessibleSync(resolvedPath)) {
135
+ return resolvedPath;
136
+ }
137
+ }
138
+ const tsconfigPath = join(fullPackagePath, TS_CONFIG_JSON);
139
+ if (isAccessibleSync(tsconfigPath)) {
140
+ return tsconfigPath;
141
+ }
142
+ } else if (jsonExtension) {
143
+ return fullPackagePath;
144
+ }
145
+ return undefined;
146
+ }, "resolveExtendsPath");
147
+
148
+ var __defProp = Object.defineProperty;
149
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
150
+ const readJsonc = /* @__PURE__ */ __name((jsonPath) => parse(readFileSync(jsonPath, { buffer: false })), "readJsonc");
151
+ const normalizePath = /* @__PURE__ */ __name((path) => {
152
+ const namespacedPath = toNamespacedPath(path);
153
+ return isRelative(namespacedPath) ? namespacedPath : "./" + namespacedPath;
154
+ }, "normalizePath");
155
+ const filesProperties = ["files", "include", "exclude"];
156
+ const resolveExtends = /* @__PURE__ */ __name((resolvedExtendsPath, fromDirectoryPath, circularExtendsTracker, options) => {
157
+ if (circularExtendsTracker.has(resolvedExtendsPath)) {
158
+ throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);
159
+ }
160
+ circularExtendsTracker.add(resolvedExtendsPath);
161
+ const extendsDirectoryPath = dirname(resolvedExtendsPath);
162
+ const extendsConfig = internalParseTsConfig(resolvedExtendsPath, options, circularExtendsTracker);
163
+ delete extendsConfig.references;
164
+ const { compilerOptions } = extendsConfig;
165
+ if (compilerOptions) {
166
+ const { baseUrl } = compilerOptions;
167
+ if (baseUrl && !baseUrl.startsWith(configDirectoryPlaceholder)) {
168
+ compilerOptions.baseUrl = normalize(relative(fromDirectoryPath, join(extendsDirectoryPath, baseUrl))) || "./";
169
+ }
170
+ let { outDir } = compilerOptions;
171
+ if (outDir) {
172
+ if (!outDir.startsWith(configDirectoryPlaceholder)) {
173
+ outDir = relative(fromDirectoryPath, join(extendsDirectoryPath, outDir));
174
+ }
175
+ compilerOptions.outDir = normalizePath(outDir.replace(configDirectoryPlaceholder + "/", "")) || "./";
176
+ }
177
+ }
178
+ for (const property of filesProperties) {
179
+ const filesList = extendsConfig[property];
180
+ if (filesList) {
181
+ extendsConfig[property] = filesList.map((file) => {
182
+ if (file.startsWith(configDirectoryPlaceholder)) {
183
+ return file;
184
+ }
185
+ if (isAbsolute(file)) {
186
+ return file;
187
+ }
188
+ return relative(fromDirectoryPath, join(extendsDirectoryPath, file));
189
+ });
190
+ }
191
+ }
192
+ return extendsConfig;
193
+ }, "resolveExtends");
194
+ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, circularExtendsTracker = /* @__PURE__ */ new Set()) => {
195
+ let config;
196
+ try {
197
+ config = readJsonc(tsconfigPath) || {};
198
+ } catch {
199
+ throw new Error(`Cannot resolve tsconfig at path: ${tsconfigPath}`);
200
+ }
201
+ if (typeof config !== "object") {
202
+ throw new SyntaxError(`Failed to parse tsconfig at: ${tsconfigPath}`);
203
+ }
204
+ const directoryPath = dirname(tsconfigPath);
205
+ if (config.compilerOptions) {
206
+ const { compilerOptions } = config;
207
+ if (compilerOptions.paths && !compilerOptions.baseUrl) {
208
+ compilerOptions[implicitBaseUrlSymbol] = directoryPath;
209
+ }
210
+ }
211
+ if (config.extends) {
212
+ const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];
213
+ delete config.extends;
214
+ for (const extendsPath of extendsPathList.reverse()) {
215
+ const resolvedExtendsPath = resolveExtendsPath(extendsPath, directoryPath);
216
+ if (!resolvedExtendsPath) {
217
+ throw new NotFoundError("No such file or directory, for '" + extendsPath + "' found.");
218
+ }
219
+ const extendsConfig = resolveExtends(resolvedExtendsPath, directoryPath, new Set(circularExtendsTracker), options);
220
+ if (extendsConfig.compilerOptions?.rootDir !== undefined && !extendsConfig.compilerOptions.rootDir.startsWith(configDirectoryPlaceholder)) {
221
+ extendsConfig.compilerOptions.rootDir = join(dirname(resolvedExtendsPath), extendsConfig.compilerOptions.rootDir);
222
+ }
223
+ const merged = {
224
+ ...extendsConfig,
225
+ ...config,
226
+ compilerOptions: {
227
+ ...extendsConfig.compilerOptions,
228
+ ...config.compilerOptions
229
+ }
230
+ };
231
+ if (extendsConfig.watchOptions) {
232
+ merged.watchOptions = {
233
+ ...extendsConfig.watchOptions,
234
+ ...config.watchOptions
235
+ };
236
+ }
237
+ config = merged;
238
+ }
239
+ }
240
+ if (config.compilerOptions) {
241
+ const { compilerOptions } = config;
242
+ for (const property of ["baseUrl", "rootDir"]) {
243
+ const unresolvedPath = compilerOptions[property];
244
+ if (unresolvedPath && !unresolvedPath.startsWith(configDirectoryPlaceholder)) {
245
+ const resolvedBaseUrl = resolve(directoryPath, unresolvedPath);
246
+ compilerOptions[property] = normalizePath(relative(directoryPath, resolvedBaseUrl));
247
+ }
248
+ }
249
+ for (const outputField of ["outDir", "declarationDir"]) {
250
+ let outputPath = compilerOptions[outputField];
251
+ if (outputPath) {
252
+ if (!Array.isArray(config.exclude)) {
253
+ config.exclude = [];
254
+ }
255
+ let excludePath = outputPath;
256
+ if (!isAbsolute(excludePath)) {
257
+ excludePath = join(directoryPath, excludePath);
258
+ }
259
+ excludePath = excludePath.replace(configDirectoryPlaceholder, "");
260
+ if (!config.exclude.includes(excludePath)) {
261
+ config.exclude.push(excludePath);
262
+ }
263
+ if (!outputPath.startsWith(configDirectoryPlaceholder)) {
264
+ outputPath = normalizePath(outputPath);
265
+ }
266
+ compilerOptions[outputField] = outputPath;
267
+ }
268
+ }
269
+ } else {
270
+ config.compilerOptions = {};
271
+ }
272
+ if (config.include) {
273
+ config.include = config.include.map((element) => normalize(element));
274
+ if (config.files) {
275
+ delete config.files;
276
+ }
277
+ } else if (config.files) {
278
+ config.files = config.files.map((file) => file.startsWith(configDirectoryPlaceholder) ? file : normalizePath(file));
279
+ }
280
+ if (config.watchOptions) {
281
+ const { watchOptions } = config;
282
+ if (watchOptions.excludeDirectories) {
283
+ watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => resolve(directoryPath, excludePath));
284
+ }
285
+ }
286
+ if (config.compilerOptions?.lib) {
287
+ config.compilerOptions.lib = config.compilerOptions.lib.map((library) => library.toLowerCase());
288
+ }
289
+ if (config.compilerOptions.module) {
290
+ config.compilerOptions.module = config.compilerOptions.module.toLowerCase();
291
+ }
292
+ if (config.compilerOptions.target) {
293
+ config.compilerOptions.target = config.compilerOptions.target.toLowerCase();
294
+ }
295
+ return config;
296
+ }, "internalParseTsConfig");
297
+ const interpolateConfigDirectory = /* @__PURE__ */ __name((filePath, configDirectory) => {
298
+ if (filePath.startsWith(configDirectoryPlaceholder)) {
299
+ return normalize(join(configDirectory, filePath.slice(configDirectoryPlaceholder.length)));
300
+ }
301
+ return undefined;
302
+ }, "interpolateConfigDirectory");
303
+ const compilerFieldsWithConfigDirectory = ["outDir", "declarationDir", "outFile", "rootDir", "baseUrl", "tsBuildInfoFile"];
304
+ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
305
+ if (config.compilerOptions === undefined) {
306
+ return config;
307
+ }
308
+ if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options?.tscCompatible))) {
309
+ if (config.compilerOptions.esModuleInterop === undefined && (config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "preserve")) {
310
+ config.compilerOptions.esModuleInterop = true;
311
+ }
312
+ if ((config.compilerOptions.esModuleInterop || config.compilerOptions.module === "system" || config.compilerOptions.moduleResolution === "bundler") && config.compilerOptions.allowSyntheticDefaultImports === undefined) {
313
+ config.compilerOptions.allowSyntheticDefaultImports = true;
314
+ }
315
+ if (config?.compilerOptions.moduleDetection === undefined && config.compilerOptions.module && ["node16", "nodenext"].includes(config.compilerOptions.module)) {
316
+ config.compilerOptions.moduleDetection = "force";
317
+ }
318
+ if (config.compilerOptions.moduleResolution === undefined) {
319
+ let moduleResolution = "classic";
320
+ if (config.compilerOptions.module !== undefined) {
321
+ switch ((config.compilerOptions?.module).toLocaleLowerCase()) {
322
+ case "commonjs": {
323
+ moduleResolution = "node10";
324
+ break;
325
+ }
326
+ case "node16": {
327
+ moduleResolution = "node16";
328
+ break;
329
+ }
330
+ case "nodenext": {
331
+ moduleResolution = "nodenext";
332
+ break;
333
+ }
334
+ case "preserve": {
335
+ moduleResolution = "bundler";
336
+ break;
337
+ }
338
+ }
339
+ }
340
+ if (moduleResolution !== "classic") {
341
+ config.compilerOptions.moduleResolution = moduleResolution;
342
+ }
343
+ }
344
+ if (["5.7", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.moduleResolution) {
345
+ let resolvePackageJson = false;
346
+ if (["bundler", "node16", "nodenext"].includes(config.compilerOptions.moduleResolution.toLocaleLowerCase())) {
347
+ resolvePackageJson = true;
348
+ }
349
+ if (config.compilerOptions.resolvePackageJsonExports === undefined && resolvePackageJson) {
350
+ config.compilerOptions.resolvePackageJsonExports = true;
351
+ }
352
+ if (config.compilerOptions.resolvePackageJsonImports === undefined && resolvePackageJson) {
353
+ config.compilerOptions.resolvePackageJsonImports = true;
354
+ }
355
+ }
356
+ if (config.compilerOptions.target === undefined) {
357
+ let target = "es5";
358
+ if (config.compilerOptions.module === "node16") {
359
+ target = "es2022";
360
+ } else if (config.compilerOptions.module === "nodenext") {
361
+ target = "esnext";
362
+ }
363
+ if (target !== "es5") {
364
+ config.compilerOptions.target = target;
365
+ }
366
+ }
367
+ if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target && (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext")) {
368
+ config.compilerOptions.useDefineForClassFields = true;
369
+ }
370
+ }
371
+ if (["5.6", "5.7", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.strict && config.compilerOptions.strictBuiltinIteratorReturn === undefined) {
372
+ config.compilerOptions.strictBuiltinIteratorReturn = true;
373
+ }
374
+ if (["5.4", "5.5", "5.6", "5.7", "true"].includes(String(options?.tscCompatible))) {
375
+ if (config.compilerOptions.strict) {
376
+ config.compilerOptions.noImplicitAny = config.compilerOptions.noImplicitAny ?? true;
377
+ config.compilerOptions.noImplicitThis = config.compilerOptions.noImplicitThis ?? true;
378
+ config.compilerOptions.strictNullChecks = config.compilerOptions.strictNullChecks ?? true;
379
+ config.compilerOptions.strictFunctionTypes = config.compilerOptions.strictFunctionTypes ?? true;
380
+ config.compilerOptions.strictBindCallApply = config.compilerOptions.strictBindCallApply ?? true;
381
+ config.compilerOptions.strictPropertyInitialization = config.compilerOptions.strictPropertyInitialization ?? true;
382
+ config.compilerOptions.alwaysStrict = config.compilerOptions.alwaysStrict ?? true;
383
+ }
384
+ if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target) {
385
+ let useDefineForClassFields = false;
386
+ if (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext") {
387
+ useDefineForClassFields = true;
388
+ }
389
+ if (useDefineForClassFields) {
390
+ config.compilerOptions.useDefineForClassFields = true;
391
+ }
392
+ }
393
+ if (config.compilerOptions.strict && config.compilerOptions.useUnknownInCatchVariables === undefined) {
394
+ config.compilerOptions.useUnknownInCatchVariables = true;
395
+ }
396
+ if (config.compilerOptions.isolatedModules) {
397
+ config.compilerOptions.preserveConstEnums = config.compilerOptions.preserveConstEnums ?? true;
398
+ }
399
+ }
400
+ if (config.compileOnSave === false) {
401
+ delete config.compileOnSave;
402
+ }
403
+ return config;
404
+ }, "tsCompatibleWrapper");
405
+ const configDirectoryPlaceholder = "${configDir}";
406
+ const implicitBaseUrlSymbol = Symbol("implicitBaseUrl");
407
+ const readTsConfig = /* @__PURE__ */ __name((tsconfigPath, options) => {
408
+ const resolvedTsconfigPath = resolve(tsconfigPath);
409
+ const config = internalParseTsConfig(resolvedTsconfigPath, options);
410
+ const configDirectory = dirname(resolvedTsconfigPath);
411
+ const { compilerOptions } = config;
412
+ if (compilerOptions) {
413
+ for (const property of compilerFieldsWithConfigDirectory) {
414
+ const value = compilerOptions[property];
415
+ if (value) {
416
+ const resolvedPath = interpolateConfigDirectory(value, configDirectory);
417
+ compilerOptions[property] = resolvedPath ? normalizePath(relative(configDirectory, resolvedPath)) : value;
418
+ }
419
+ }
420
+ for (const property of ["rootDirs", "typeRoots"]) {
421
+ const value = compilerOptions[property];
422
+ if (value) {
423
+ compilerOptions[property] = value.map((v) => {
424
+ const resolvedPath = interpolateConfigDirectory(v, configDirectory);
425
+ return resolvedPath ? normalizePath(relative(configDirectory, resolvedPath)) : v;
426
+ });
427
+ }
428
+ }
429
+ const { paths } = compilerOptions;
430
+ if (paths) {
431
+ for (const name of Object.keys(paths)) {
432
+ paths[name] = paths[name].map((filePath) => interpolateConfigDirectory(filePath, configDirectory) ?? filePath);
433
+ }
434
+ }
435
+ if (compilerOptions.outDir) {
436
+ compilerOptions.outDir = compilerOptions.outDir.replace(configDirectoryPlaceholder, "");
437
+ }
438
+ }
439
+ for (const property of filesProperties) {
440
+ const value = config[property];
441
+ if (value) {
442
+ config[property] = value.map((filePath) => {
443
+ const interpolate = interpolateConfigDirectory(filePath, configDirectory);
444
+ if (interpolate) {
445
+ return interpolate;
446
+ }
447
+ if (property === "files" && isRelative(filePath)) {
448
+ return filePath;
449
+ }
450
+ if (property === "include" && isRelative(filePath)) {
451
+ return join(configDirectory, filePath);
452
+ }
453
+ return normalize(filePath);
454
+ });
455
+ }
456
+ }
457
+ return tsCompatibleWrapper(config, options);
458
+ }, "readTsConfig");
459
+
460
+ export { configDirectoryPlaceholder, implicitBaseUrlSymbol, readTsConfig };
@@ -0,0 +1,18 @@
1
+ import { writeJson, writeJsonSync } from '@visulima/fs';
2
+ import { toPath } from '@visulima/fs/utils';
3
+ import { join } from '@visulima/path';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ const writeTsConfig = /* @__PURE__ */ __name(async (tsConfig, options = {}) => {
8
+ const { cwd, ...writeOptions } = options;
9
+ const directory = toPath(cwd ?? process.cwd());
10
+ await writeJson(join(directory, "tsconfig.json"), tsConfig, writeOptions);
11
+ }, "writeTsConfig");
12
+ const writeTsConfigSync = /* @__PURE__ */ __name((tsConfig, options = {}) => {
13
+ const { cwd, ...writeOptions } = options;
14
+ const directory = toPath(cwd ?? process.cwd());
15
+ writeJsonSync(join(directory, "tsconfig.json"), tsConfig, writeOptions);
16
+ }, "writeTsConfigSync");
17
+
18
+ export { writeTsConfig, writeTsConfigSync };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const fs = require('@visulima/fs');
6
+ const utils = require('@visulima/fs/utils');
7
+ const path = require('@visulima/path');
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
+ const writeTsConfig = /* @__PURE__ */ __name(async (tsConfig, options = {}) => {
12
+ const { cwd, ...writeOptions } = options;
13
+ const directory = utils.toPath(cwd ?? process.cwd());
14
+ await fs.writeJson(path.join(directory, "tsconfig.json"), tsConfig, writeOptions);
15
+ }, "writeTsConfig");
16
+ const writeTsConfigSync = /* @__PURE__ */ __name((tsConfig, options = {}) => {
17
+ const { cwd, ...writeOptions } = options;
18
+ const directory = utils.toPath(cwd ?? process.cwd());
19
+ fs.writeJsonSync(path.join(directory, "tsconfig.json"), tsConfig, writeOptions);
20
+ }, "writeTsConfigSync");
21
+
22
+ exports.writeTsConfig = writeTsConfig;
23
+ exports.writeTsConfigSync = writeTsConfigSync;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/tsconfig",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Find and/or parse the tsconfig.json file from a directory path.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -67,29 +67,28 @@
67
67
  "CHANGELOG.md"
68
68
  ],
69
69
  "dependencies": {
70
- "@visulima/fs": "2.3.5",
71
- "@visulima/path": "1.3.1",
70
+ "@visulima/fs": "2.3.7",
71
+ "@visulima/path": "1.3.3",
72
72
  "jsonc-parser": "^3.3.1",
73
73
  "resolve-pkg-maps": "^1.0.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@anolilab/eslint-config": "^15.0.3",
77
77
  "@anolilab/prettier-config": "^5.0.14",
78
- "@anolilab/semantic-release-pnpm": "1.1.3",
78
+ "@anolilab/semantic-release-pnpm": "1.1.6",
79
79
  "@anolilab/semantic-release-preset": "^9.0.3",
80
80
  "@arethetypeswrong/cli": "^0.17.2",
81
81
  "@babel/core": "^7.26.0",
82
- "@ckeditor/typedoc-plugins": "43.0.0",
83
82
  "@rushstack/eslint-plugin-security": "^0.8.3",
84
83
  "@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
85
84
  "@total-typescript/ts-reset": "^0.6.1",
86
85
  "@types/node": "18.18.14",
87
- "@visulima/packem": "1.1.0",
86
+ "@visulima/packem": "1.10.7",
88
87
  "@vitest/coverage-v8": "^2.1.8",
89
88
  "@vitest/ui": "^2.1.8",
90
89
  "conventional-changelog-conventionalcommits": "8.0.0",
91
90
  "cross-env": "^7.0.3",
92
- "esbuild": "0.24.0",
91
+ "esbuild": "0.24.2",
93
92
  "eslint": "8.57.0",
94
93
  "eslint-plugin-deprecation": "^3.0.0",
95
94
  "eslint-plugin-etc": "^2.0.3",
@@ -101,13 +100,13 @@
101
100
  "prettier": "^3.4.2",
102
101
  "rimraf": "6.0.1",
103
102
  "secretlint": "9.0.0",
104
- "semantic-release": "^24.2.0",
103
+ "semantic-release": "^24.2.1",
105
104
  "tempy": "^3.1.0",
106
- "type-fest": "^4.31.0",
107
- "typedoc": "0.26.10",
108
- "typedoc-plugin-markdown": "4.2.9",
109
- "typedoc-plugin-rename-defaults": "0.7.1",
110
- "typescript": "5.6.3",
105
+ "type-fest": "^4.32.0",
106
+ "typedoc": "0.27.6",
107
+ "typedoc-plugin-markdown": "4.4.1",
108
+ "typedoc-plugin-rename-defaults": "0.7.2",
109
+ "typescript": "5.7.3",
111
110
  "vitest": "^2.1.8"
112
111
  },
113
112
  "engines": {
@@ -1 +0,0 @@
1
- "use strict";var l=Object.defineProperty;var r=(c,e)=>l(c,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@visulima/fs"),s=require("@visulima/fs/error"),a=require("./implicitBaseUrlSymbol-Bfg9VyQS.cjs");var h=Object.defineProperty,d=r((c,e)=>h(c,"name",{value:e,configurable:!0}),"s");const g=new Map,u=d(async(c,e={})=>{const i=e.configFileName??"tsconfig.json";let n=await t.findUp(i,{...c&&{cwd:c},type:"file"});if(n||(n=await t.findUp("jsconfig.json",{...c&&{cwd:c},type:"file"})),!n)throw new s.NotFoundError(`No such file or directory, for ${i} or jsconfig.json found.`);const o=e.cache&&typeof e.cache!="boolean"?e.cache:g;if(e.cache&&o.has(n))return o.get(n);const f={config:a.readTsConfig(n),path:n};return e.cache&&o.set(n,f),f},"findTsConfig"),y=d((c,e={})=>{const i=e.configFileName??"tsconfig.json";let n=t.findUpSync(i,{...c&&{cwd:c},type:"file"});if(n||(n=t.findUpSync("jsconfig.json",{...c&&{cwd:c},type:"file"})),!n)throw new s.NotFoundError(`No such file or directory, for ${i} or jsconfig.json found.`);const o=e.cache&&typeof e.cache!="boolean"?e.cache:g;if(e.cache&&o.has(n))return o.get(n);const f={config:a.readTsConfig(n),path:n};return e.cache&&o.set(n,f),f},"findTsConfigSync");exports.findTsConfig=u;exports.findTsConfigSync=y;
@@ -1 +0,0 @@
1
- var p=Object.defineProperty;var t=(o,e)=>p(o,"name",{value:e,configurable:!0});import{findUp as r,findUpSync as s}from"@visulima/fs";import{NotFoundError as a}from"@visulima/fs/error";import{readTsConfig as h}from"./implicitBaseUrlSymbol-BMiB-zfM.mjs";var l=Object.defineProperty,g=t((o,e)=>l(o,"name",{value:e,configurable:!0}),"s");const d=new Map,m=g(async(o,e={})=>{const f=e.configFileName??"tsconfig.json";let c=await r(f,{...o&&{cwd:o},type:"file"});if(c||(c=await r("jsconfig.json",{...o&&{cwd:o},type:"file"})),!c)throw new a(`No such file or directory, for ${f} or jsconfig.json found.`);const n=e.cache&&typeof e.cache!="boolean"?e.cache:d;if(e.cache&&n.has(c))return n.get(c);const i={config:h(c),path:c};return e.cache&&n.set(c,i),i},"findTsConfig"),C=g((o,e={})=>{const f=e.configFileName??"tsconfig.json";let c=s(f,{...o&&{cwd:o},type:"file"});if(c||(c=s("jsconfig.json",{...o&&{cwd:o},type:"file"})),!c)throw new a(`No such file or directory, for ${f} or jsconfig.json found.`);const n=e.cache&&typeof e.cache!="boolean"?e.cache:d;if(e.cache&&n.has(c))return n.get(c);const i={config:h(c),path:c};return e.cache&&n.set(c,i),i},"findTsConfigSync");export{m as findTsConfig,C as findTsConfigSync};
@@ -1 +0,0 @@
1
- var R=Object.defineProperty;var I=(i,r)=>R(i,"name",{value:r,configurable:!0});import{readFileSync as k,isAccessibleSync as d,findUpSync as J}from"@visulima/fs";import{NotFoundError as N}from"@visulima/fs/error";import{join as f,resolve as C,isAbsolute as W,toNamespacedPath as z,dirname as E,normalize as O,relative as D}from"@visulima/path";import{isRelative as A}from"@visulima/path/utils";import{parse as $}from"jsonc-parser";import{statSync as x}from"node:fs";import M from"node:module";import{resolveExports as q}from"resolve-pkg-maps";var V=Object.defineProperty,F=I((i,r)=>V(i,"name",{value:r,configurable:!0}),"d");const _=F(i=>$(k(i,{buffer:!1})),"readJsonc"),G=F(()=>{const{findPnpApi:i}=M;return i?.(process.cwd())},"getPnpApi"),S=F((i,r,u,e)=>{const c="resolveFromPackageJsonPath:"+i+":"+r+":"+(u?"yes":"no");if(e?.has(c))return e.get(c);const t=_(i);if(!t)return;let n=r||"tsconfig.json";if(!u&&t.exports)try{const[o]=q(t.exports,r,["require","types"]);n=o}catch{return!1}else!r&&t.tsconfig&&(n=t.tsconfig);return n=f(i,"..",n),e?.set(c,n),n},"resolveFromPackageJsonPath"),j="package.json",P="tsconfig.json",H=F((i,r,u)=>{let e=i;if(i===".."&&(e=f(e,P)),i.startsWith(".")&&(e=C(r,e)),W(e)){if(d(e)){if(x(e).isFile())return e}else if(!e.endsWith(".json")){const a=`${e}.json`;if(d(a))return a}return}const[c,...t]=i.split("/"),n=c.startsWith("@")?c+"/"+t.shift():c,o=t.join("/"),s=G();if(s){const{resolveRequest:a}=s;try{if(n===i){const p=a(f(n,j),r);if(p){const g=S(p,o,!1,u);if(g&&d(g))return g}}else{let p;try{p=a(i,r,{extensions:[".json"]})}catch{p=a(f(i,P),r)}if(p)return p}}catch{}}const l=J(a=>{const p=f(C(a),"node_modules",n);if(d(p))return f("node_modules",n)},{cwd:r,type:"directory"});if(!l||!x(l).isDirectory())return;const h=f(l,j);if(d(h)){const a=S(h,o,!1,u);if(a===!1)return;if(a&&d(a)&&x(a).isFile())return a}const y=f(l,o),U=y.endsWith(".json");if(!U){const a=y+".json";if(d(a))return a}if(d(y)){if(x(y).isDirectory()){const a=f(y,j);if(d(a)){const g=S(a,"",!0,u);if(g&&d(g))return g}const p=f(y,P);if(d(p))return p}else if(U)return y}},"resolveExtendsPath");var K=Object.defineProperty,w=I((i,r)=>K(i,"name",{value:r,configurable:!0}),"u");const L=w(i=>$(k(i,{buffer:!1})),"readJsonc"),b=w(i=>{const r=z(i);return A(r)?r:`./${r}`},"normalizePath"),B=["files","include","exclude"],Q=w((i,r,u,e)=>{const c=H(i,r);if(!c)throw new N(`No such file or directory, for '${i}' found.`);if(u.has(c))throw new Error(`Circularity detected while resolving configuration: ${c}`);u.add(c);const t=E(c),n=T(c,e,u);delete n.references;const{compilerOptions:o}=n;if(o){const{baseUrl:s}=o;s&&!s.startsWith(m)&&(o.baseUrl=O(D(r,f(t,s)))||"./");let{outDir:l}=o;l&&(l.startsWith(m)||(l=D(r,f(t,l))),o.outDir=b(l.replace(m+"/",""))||"./")}for(const s of B){const l=n[s];l&&(n[s]=l.map(h=>h.startsWith(m)||W(h)?h:D(r,f(t,h))))}return n},"resolveExtends"),T=w((i,r,u=new Set)=>{let e;try{e=L(i)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${i}`)}if(typeof e!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${i}`);const c=E(i);if(e.compilerOptions){const{compilerOptions:t}=e;t.paths&&!t.baseUrl&&(t[Y]=c)}if(e.extends){const t=Array.isArray(e.extends)?e.extends:[e.extends];delete e.extends;for(const n of t.reverse()){const o=Q(n,c,new Set(u),r),s={...o,...e,compilerOptions:{...o.compilerOptions,...e.compilerOptions}};o.watchOptions&&(s.watchOptions={...o.watchOptions,...e.watchOptions}),e=s}}if(e.compilerOptions){const{compilerOptions:t}=e;for(const n of["baseUrl","rootDir"]){const o=t[n];if(o&&!o.startsWith(m)){const s=C(c,o);t[n]=b(D(c,s))}}for(const n of["outDir","declarationDir"]){let o=t[n];if(o){Array.isArray(e.exclude)||(e.exclude=[]);let s=o;W(s)||(s=f(c,s)),s=s.replace(m,""),e.exclude.includes(s)||e.exclude.push(s),o.startsWith(m)||(o=b(o)),t[n]=o}}r?.tscCompatible&&t.module==="node16"&&["5.4","5.5","5.6","true"].includes(String(r.tscCompatible))&&(t.allowSyntheticDefaultImports=t.allowSyntheticDefaultImports??!0,t.esModuleInterop=t.esModuleInterop??!0,t.moduleDetection=t.moduleDetection??"force",t.moduleResolution=t.moduleResolution??"node16",t.target=t.target??"es2022",t.useDefineForClassFields=t.useDefineForClassFields??!0),r?.tscCompatible&&t.strict&&(["5.6","true"].includes(String(r.tscCompatible))&&(t.strictBuiltinIteratorReturn=t.strictBuiltinIteratorReturn??!0),["5.4","5.5","5.6","true"].includes(String(r.tscCompatible))&&(t.noImplicitAny=t.noImplicitAny??!0,t.noImplicitThis=t.noImplicitThis??!0,t.strictNullChecks=t.strictNullChecks??!0,t.strictFunctionTypes=t.strictFunctionTypes??!0,t.strictBindCallApply=t.strictBindCallApply??!0,t.strictPropertyInitialization=t.strictPropertyInitialization??!0,t.alwaysStrict=t.alwaysStrict??!0,t.useUnknownInCatchVariables=t.useUnknownInCatchVariables??!0)),r?.tscCompatible&&t.isolatedModules&&(t.preserveConstEnums=t.preserveConstEnums??!0),r?.tscCompatible&&t.esModuleInterop&&(t.allowSyntheticDefaultImports=t.allowSyntheticDefaultImports??!0),r?.tscCompatible&&t.target==="esnext"&&(t.useDefineForClassFields=t.useDefineForClassFields??!0)}else e.compilerOptions={};if(e.include?(e.include=e.include.map(t=>O(t)),e.files&&delete e.files):e.files&&(e.files=e.files.map(t=>t.startsWith(m)?t:b(t))),e.watchOptions){const{watchOptions:t}=e;t.excludeDirectories&&(t.excludeDirectories=t.excludeDirectories.map(n=>C(c,n)))}return e},"internalParseTsConfig"),v=w((i,r)=>{if(i.startsWith(m))return O(f(r,i.slice(m.length)))},"interpolateConfigDirectory"),X=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],m="${configDir}",Y=Symbol("implicitBaseUrl"),lt=w((i,r)=>{const u=C(i),e=T(u,r),c=E(u),{compilerOptions:t}=e;if(t){for(const o of X){const s=t[o];if(s){const l=v(s,c);t[o]=l?b(D(c,l)):s}}for(const o of["rootDirs","typeRoots"]){const s=t[o];s&&(t[o]=s.map(l=>{const h=v(l,c);return h?b(D(c,h)):l}))}const{paths:n}=t;if(n)for(const o of Object.keys(n))n[o]=n[o].map(s=>v(s,c)??s);t.outDir&&(t.outDir=t.outDir.replace(m,""))}for(const n of B){const o=e[n];o&&(e[n]=o.map(s=>v(s,c)||(n==="files"&&A(s)?s:n==="include"&&A(s)?f(c,s):O(s))))}return e},"readTsConfig");export{m as configDirectoryPlaceholder,Y as implicitBaseUrlSymbol,lt as readTsConfig};
@@ -1 +0,0 @@
1
- "use strict";var k=Object.defineProperty;var v=(s,i)=>k(s,"name",{value:i,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@visulima/fs"),q=require("@visulima/fs/error"),n=require("@visulima/path"),O=require("@visulima/path/utils"),P=require("jsonc-parser"),j=require("node:fs"),E=require("node:module"),T=require("resolve-pkg-maps"),B=v(s=>s&&typeof s=="object"&&"default"in s?s.default:s,"_interopDefaultCompat"),R=B(E);var $=Object.defineProperty,C=v((s,i)=>$(s,"name",{value:i,configurable:!0}),"d");const z=C(s=>P.parse(p.readFileSync(s,{buffer:!1})),"readJsonc"),M=C(()=>{const{findPnpApi:s}=R;return s?.(process.cwd())},"getPnpApi"),w=C((s,i,f,t)=>{const l="resolveFromPackageJsonPath:"+s+":"+i+":"+(f?"yes":"no");if(t?.has(l))return t.get(l);const e=z(s);if(!e)return;let c=i||"tsconfig.json";if(!f&&e.exports)try{const[o]=T.resolveExports(e.exports,i,["require","types"]);c=o}catch{return!1}else!i&&e.tsconfig&&(c=e.tsconfig);return c=n.join(s,"..",c),t?.set(l,c),c},"resolveFromPackageJsonPath"),A="package.json",x="tsconfig.json",_=C((s,i,f)=>{let t=s;if(s===".."&&(t=n.join(t,x)),s.startsWith(".")&&(t=n.resolve(i,t)),n.isAbsolute(t)){if(p.isAccessibleSync(t)){if(j.statSync(t).isFile())return t}else if(!t.endsWith(".json")){const u=`${t}.json`;if(p.isAccessibleSync(u))return u}return}const[l,...e]=s.split("/"),c=l.startsWith("@")?l+"/"+e.shift():l,o=e.join("/"),r=M();if(r){const{resolveRequest:u}=r;try{if(c===s){const d=u(n.join(c,A),i);if(d){const b=w(d,o,!1,f);if(b&&p.isAccessibleSync(b))return b}}else{let d;try{d=u(s,i,{extensions:[".json"]})}catch{d=u(n.join(s,x),i)}if(d)return d}}catch{}}const a=p.findUpSync(u=>{const d=n.join(n.resolve(u),"node_modules",c);if(p.isAccessibleSync(d))return n.join("node_modules",c)},{cwd:i,type:"directory"});if(!a||!j.statSync(a).isDirectory())return;const y=n.join(a,A);if(p.isAccessibleSync(y)){const u=w(y,o,!1,f);if(u===!1)return;if(u&&p.isAccessibleSync(u)&&j.statSync(u).isFile())return u}const h=n.join(a,o),F=h.endsWith(".json");if(!F){const u=h+".json";if(p.isAccessibleSync(u))return u}if(p.isAccessibleSync(h)){if(j.statSync(h).isDirectory()){const u=n.join(h,A);if(p.isAccessibleSync(u)){const b=w(u,"",!0,f);if(b&&p.isAccessibleSync(b))return b}const d=n.join(h,x);if(p.isAccessibleSync(d))return d}else if(F)return h}},"resolveExtendsPath");var J=Object.defineProperty,S=v((s,i)=>J(s,"name",{value:i,configurable:!0}),"u");const N=S(s=>P.parse(p.readFileSync(s,{buffer:!1})),"readJsonc"),g=S(s=>{const i=n.toNamespacedPath(s);return O.isRelative(i)?i:`./${i}`},"normalizePath"),I=["files","include","exclude"],V=S((s,i,f,t)=>{const l=_(s,i);if(!l)throw new q.NotFoundError(`No such file or directory, for '${s}' found.`);if(f.has(l))throw new Error(`Circularity detected while resolving configuration: ${l}`);f.add(l);const e=n.dirname(l),c=W(l,t,f);delete c.references;const{compilerOptions:o}=c;if(o){const{baseUrl:r}=o;r&&!r.startsWith(m)&&(o.baseUrl=n.normalize(n.relative(i,n.join(e,r)))||"./");let{outDir:a}=o;a&&(a.startsWith(m)||(a=n.relative(i,n.join(e,a))),o.outDir=g(a.replace(m+"/",""))||"./")}for(const r of I){const a=c[r];a&&(c[r]=a.map(y=>y.startsWith(m)||n.isAbsolute(y)?y:n.relative(i,n.join(e,y))))}return c},"resolveExtends"),W=S((s,i,f=new Set)=>{let t;try{t=N(s)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${s}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${s}`);const l=n.dirname(s);if(t.compilerOptions){const{compilerOptions:e}=t;e.paths&&!e.baseUrl&&(e[U]=l)}if(t.extends){const e=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;for(const c of e.reverse()){const o=V(c,l,new Set(f),i),r={...o,...t,compilerOptions:{...o.compilerOptions,...t.compilerOptions}};o.watchOptions&&(r.watchOptions={...o.watchOptions,...t.watchOptions}),t=r}}if(t.compilerOptions){const{compilerOptions:e}=t;for(const c of["baseUrl","rootDir"]){const o=e[c];if(o&&!o.startsWith(m)){const r=n.resolve(l,o);e[c]=g(n.relative(l,r))}}for(const c of["outDir","declarationDir"]){let o=e[c];if(o){Array.isArray(t.exclude)||(t.exclude=[]);let r=o;n.isAbsolute(r)||(r=n.join(l,r)),r=r.replace(m,""),t.exclude.includes(r)||t.exclude.push(r),o.startsWith(m)||(o=g(o)),e[c]=o}}i?.tscCompatible&&e.module==="node16"&&["5.4","5.5","5.6","true"].includes(String(i.tscCompatible))&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0,e.esModuleInterop=e.esModuleInterop??!0,e.moduleDetection=e.moduleDetection??"force",e.moduleResolution=e.moduleResolution??"node16",e.target=e.target??"es2022",e.useDefineForClassFields=e.useDefineForClassFields??!0),i?.tscCompatible&&e.strict&&(["5.6","true"].includes(String(i.tscCompatible))&&(e.strictBuiltinIteratorReturn=e.strictBuiltinIteratorReturn??!0),["5.4","5.5","5.6","true"].includes(String(i.tscCompatible))&&(e.noImplicitAny=e.noImplicitAny??!0,e.noImplicitThis=e.noImplicitThis??!0,e.strictNullChecks=e.strictNullChecks??!0,e.strictFunctionTypes=e.strictFunctionTypes??!0,e.strictBindCallApply=e.strictBindCallApply??!0,e.strictPropertyInitialization=e.strictPropertyInitialization??!0,e.alwaysStrict=e.alwaysStrict??!0,e.useUnknownInCatchVariables=e.useUnknownInCatchVariables??!0)),i?.tscCompatible&&e.isolatedModules&&(e.preserveConstEnums=e.preserveConstEnums??!0),i?.tscCompatible&&e.esModuleInterop&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0),i?.tscCompatible&&e.target==="esnext"&&(e.useDefineForClassFields=e.useDefineForClassFields??!0)}else t.compilerOptions={};if(t.include?(t.include=t.include.map(e=>n.normalize(e)),t.files&&delete t.files):t.files&&(t.files=t.files.map(e=>e.startsWith(m)?e:g(e))),t.watchOptions){const{watchOptions:e}=t;e.excludeDirectories&&(e.excludeDirectories=e.excludeDirectories.map(c=>n.resolve(l,c)))}return t},"internalParseTsConfig"),D=S((s,i)=>{if(s.startsWith(m))return n.normalize(n.join(i,s.slice(m.length)))},"interpolateConfigDirectory"),G=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],m="${configDir}",U=Symbol("implicitBaseUrl"),H=S((s,i)=>{const f=n.resolve(s),t=W(f,i),l=n.dirname(f),{compilerOptions:e}=t;if(e){for(const o of G){const r=e[o];if(r){const a=D(r,l);e[o]=a?g(n.relative(l,a)):r}}for(const o of["rootDirs","typeRoots"]){const r=e[o];r&&(e[o]=r.map(a=>{const y=D(a,l);return y?g(n.relative(l,y)):a}))}const{paths:c}=e;if(c)for(const o of Object.keys(c))c[o]=c[o].map(r=>D(r,l)??r);e.outDir&&(e.outDir=e.outDir.replace(m,""))}for(const c of I){const o=t[c];o&&(t[c]=o.map(r=>D(r,l)||(c==="files"&&O.isRelative(r)?r:c==="include"&&O.isRelative(r)?n.join(l,r):n.normalize(r))))}return t},"readTsConfig");exports.configDirectoryPlaceholder=m;exports.implicitBaseUrlSymbol=U;exports.readTsConfig=H;
@@ -1 +0,0 @@
1
- "use strict";var f=Object.defineProperty;var s=(n,t)=>f(n,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@visulima/fs"),c=require("@visulima/fs/utils"),a=require("@visulima/path");var g=Object.defineProperty,w=s((n,t)=>g(n,"name",{value:t,configurable:!0}),"r");const u=w(async(n,t={})=>{const{cwd:e,...i}=t,o=c.toPath(e??process.cwd());await r.writeJson(a.join(o,"tsconfig.json"),n,i)},"writeTsConfig"),y=w((n,t={})=>{const{cwd:e,...i}=t,o=c.toPath(e??process.cwd());r.writeJsonSync(a.join(o,"tsconfig.json"),n,i)},"writeTsConfigSync");exports.writeTsConfig=u;exports.writeTsConfigSync=y;
@@ -1 +0,0 @@
1
- var w=Object.defineProperty;var t=(o,n)=>w(o,"name",{value:n,configurable:!0});import{writeJson as a,writeJsonSync as p}from"@visulima/fs";import{toPath as c}from"@visulima/fs/utils";import{join as e}from"@visulima/path";var g=Object.defineProperty,f=t((o,n)=>g(o,"name",{value:n,configurable:!0}),"r");const C=f(async(o,n={})=>{const{cwd:i,...r}=n,s=c(i??process.cwd());await a(e(s,"tsconfig.json"),o,r)},"writeTsConfig"),T=f((o,n={})=>{const{cwd:i,...r}=n,s=c(i??process.cwd());p(e(s,"tsconfig.json"),o,r)},"writeTsConfigSync");export{C as writeTsConfig,T as writeTsConfigSync};