@visulima/tsconfig 1.1.15 → 1.1.17

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.
@@ -29,7 +29,7 @@ const resolveFromPackageJsonPath = /* @__PURE__ */ __name$1((packageJsonPath, su
29
29
  }
30
30
  const packageJson = readJsonc$1(packageJsonPath);
31
31
  if (!packageJson) {
32
- return undefined;
32
+ return void 0;
33
33
  }
34
34
  let resolvedPath = subpath || "tsconfig.json";
35
35
  if (!ignoreExports && packageJson.exports) {
@@ -67,7 +67,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
67
67
  return jsonPath;
68
68
  }
69
69
  }
70
- return undefined;
70
+ return void 0;
71
71
  }
72
72
  const [orgOrName, ...remaining] = requestedPath.split("/");
73
73
  const packageName = orgOrName.startsWith("@") ? orgOrName + "/" + remaining.shift() : orgOrName;
@@ -104,7 +104,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
104
104
  if (fs.isAccessibleSync(path$1)) {
105
105
  return path.join("node_modules", packageName);
106
106
  }
107
- return undefined;
107
+ return void 0;
108
108
  },
109
109
  {
110
110
  cwd: directoryPath,
@@ -112,13 +112,13 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
112
112
  }
113
113
  );
114
114
  if (!packagePath || !node_fs.statSync(packagePath).isDirectory()) {
115
- return undefined;
115
+ return void 0;
116
116
  }
117
117
  const packageJsonPath = path.join(packagePath, PACKAGE_JSON);
118
118
  if (fs.isAccessibleSync(packageJsonPath)) {
119
119
  const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);
120
120
  if (resolvedPath === false) {
121
- return undefined;
121
+ return void 0;
122
122
  }
123
123
  if (resolvedPath && fs.isAccessibleSync(resolvedPath) && node_fs.statSync(resolvedPath).isFile()) {
124
124
  return resolvedPath;
@@ -133,7 +133,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
133
133
  }
134
134
  }
135
135
  if (!fs.isAccessibleSync(fullPackagePath)) {
136
- return undefined;
136
+ return void 0;
137
137
  }
138
138
  if (node_fs.statSync(fullPackagePath).isDirectory()) {
139
139
  const fullPackageJsonPath = path.join(fullPackagePath, PACKAGE_JSON);
@@ -150,7 +150,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
150
150
  } else if (jsonExtension) {
151
151
  return fullPackagePath;
152
152
  }
153
- return undefined;
153
+ return void 0;
154
154
  }, "resolveExtendsPath");
155
155
 
156
156
  var __defProp = Object.defineProperty;
@@ -225,7 +225,7 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
225
225
  throw new error.NotFoundError("No such file or directory, for '" + extendsPath + "' found.");
226
226
  }
227
227
  const extendsConfig = resolveExtends(resolvedExtendsPath, directoryPath, new Set(circularExtendsTracker), options);
228
- if (extendsConfig.compilerOptions?.rootDir !== undefined && !extendsConfig.compilerOptions.rootDir.startsWith(configDirectoryPlaceholder)) {
228
+ if (extendsConfig.compilerOptions?.rootDir !== void 0 && !extendsConfig.compilerOptions.rootDir.startsWith(configDirectoryPlaceholder)) {
229
229
  extendsConfig.compilerOptions.rootDir = path.join(path.dirname(resolvedExtendsPath), extendsConfig.compilerOptions.rootDir);
230
230
  }
231
231
  const merged = {
@@ -306,26 +306,26 @@ const interpolateConfigDirectory = /* @__PURE__ */ __name((filePath, configDirec
306
306
  if (filePath.startsWith(configDirectoryPlaceholder)) {
307
307
  return path.normalize(path.join(configDirectory, filePath.slice(configDirectoryPlaceholder.length)));
308
308
  }
309
- return undefined;
309
+ return void 0;
310
310
  }, "interpolateConfigDirectory");
311
311
  const compilerFieldsWithConfigDirectory = ["outDir", "declarationDir", "outFile", "rootDir", "baseUrl", "tsBuildInfoFile"];
312
312
  const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
313
- if (config.compilerOptions === undefined) {
313
+ if (config.compilerOptions === void 0) {
314
314
  return config;
315
315
  }
316
316
  if (["5.4", "5.5", "5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible))) {
317
- if (config.compilerOptions.esModuleInterop === undefined && (config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "preserve")) {
317
+ if (config.compilerOptions.esModuleInterop === void 0 && (config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "preserve")) {
318
318
  config.compilerOptions.esModuleInterop = true;
319
319
  }
320
- if ((config.compilerOptions.esModuleInterop || config.compilerOptions.module === "system" || config.compilerOptions.moduleResolution === "bundler") && config.compilerOptions.allowSyntheticDefaultImports === undefined) {
320
+ if ((config.compilerOptions.esModuleInterop || config.compilerOptions.module === "system" || config.compilerOptions.moduleResolution === "bundler") && config.compilerOptions.allowSyntheticDefaultImports === void 0) {
321
321
  config.compilerOptions.allowSyntheticDefaultImports = true;
322
322
  }
323
- if (config?.compilerOptions.moduleDetection === undefined && config.compilerOptions.module && ["node16", "nodenext"].includes(config.compilerOptions.module)) {
323
+ if (config?.compilerOptions.moduleDetection === void 0 && config.compilerOptions.module && ["node16", "nodenext"].includes(config.compilerOptions.module)) {
324
324
  config.compilerOptions.moduleDetection = "force";
325
325
  }
326
- if (config.compilerOptions.moduleResolution === undefined) {
326
+ if (config.compilerOptions.moduleResolution === void 0) {
327
327
  let moduleResolution = "classic";
328
- if (config.compilerOptions.module !== undefined) {
328
+ if (config.compilerOptions.module !== void 0) {
329
329
  switch ((config.compilerOptions?.module).toLocaleLowerCase()) {
330
330
  case "commonjs": {
331
331
  moduleResolution = "node10";
@@ -354,14 +354,14 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
354
354
  if (["bundler", "node16", "nodenext"].includes(config.compilerOptions.moduleResolution.toLocaleLowerCase())) {
355
355
  resolvePackageJson = true;
356
356
  }
357
- if (config.compilerOptions.resolvePackageJsonExports === undefined && resolvePackageJson) {
357
+ if (config.compilerOptions.resolvePackageJsonExports === void 0 && resolvePackageJson) {
358
358
  config.compilerOptions.resolvePackageJsonExports = true;
359
359
  }
360
- if (config.compilerOptions.resolvePackageJsonImports === undefined && resolvePackageJson) {
360
+ if (config.compilerOptions.resolvePackageJsonImports === void 0 && resolvePackageJson) {
361
361
  config.compilerOptions.resolvePackageJsonImports = true;
362
362
  }
363
363
  }
364
- if (config.compilerOptions.target === undefined) {
364
+ if (config.compilerOptions.target === void 0) {
365
365
  let target = "es5";
366
366
  if (config.compilerOptions.module === "node16") {
367
367
  target = "es2022";
@@ -372,11 +372,11 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
372
372
  config.compilerOptions.target = target;
373
373
  }
374
374
  }
375
- if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target && (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext")) {
375
+ if (config.compilerOptions.useDefineForClassFields === void 0 && config.compilerOptions.target && (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext")) {
376
376
  config.compilerOptions.useDefineForClassFields = true;
377
377
  }
378
378
  }
379
- if (["5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.strict && config.compilerOptions.strictBuiltinIteratorReturn === undefined) {
379
+ if (["5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.strict && config.compilerOptions.strictBuiltinIteratorReturn === void 0) {
380
380
  config.compilerOptions.strictBuiltinIteratorReturn = true;
381
381
  }
382
382
  if (["5.4", "5.5", "5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible))) {
@@ -389,7 +389,7 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
389
389
  config.compilerOptions.strictPropertyInitialization = config.compilerOptions.strictPropertyInitialization ?? true;
390
390
  config.compilerOptions.alwaysStrict = config.compilerOptions.alwaysStrict ?? true;
391
391
  }
392
- if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target) {
392
+ if (config.compilerOptions.useDefineForClassFields === void 0 && config.compilerOptions.target) {
393
393
  let useDefineForClassFields = false;
394
394
  if (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext") {
395
395
  useDefineForClassFields = true;
@@ -398,7 +398,7 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
398
398
  config.compilerOptions.useDefineForClassFields = true;
399
399
  }
400
400
  }
401
- if (config.compilerOptions.strict && config.compilerOptions.useUnknownInCatchVariables === undefined) {
401
+ if (config.compilerOptions.strict && config.compilerOptions.useUnknownInCatchVariables === void 0) {
402
402
  config.compilerOptions.useUnknownInCatchVariables = true;
403
403
  }
404
404
  if (config.compilerOptions.isolatedModules) {
@@ -21,7 +21,7 @@ const resolveFromPackageJsonPath = /* @__PURE__ */ __name$1((packageJsonPath, su
21
21
  }
22
22
  const packageJson = readJsonc$1(packageJsonPath);
23
23
  if (!packageJson) {
24
- return undefined;
24
+ return void 0;
25
25
  }
26
26
  let resolvedPath = subpath || "tsconfig.json";
27
27
  if (!ignoreExports && packageJson.exports) {
@@ -59,7 +59,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
59
59
  return jsonPath;
60
60
  }
61
61
  }
62
- return undefined;
62
+ return void 0;
63
63
  }
64
64
  const [orgOrName, ...remaining] = requestedPath.split("/");
65
65
  const packageName = orgOrName.startsWith("@") ? orgOrName + "/" + remaining.shift() : orgOrName;
@@ -96,7 +96,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
96
96
  if (isAccessibleSync(path)) {
97
97
  return join("node_modules", packageName);
98
98
  }
99
- return undefined;
99
+ return void 0;
100
100
  },
101
101
  {
102
102
  cwd: directoryPath,
@@ -104,13 +104,13 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
104
104
  }
105
105
  );
106
106
  if (!packagePath || !statSync(packagePath).isDirectory()) {
107
- return undefined;
107
+ return void 0;
108
108
  }
109
109
  const packageJsonPath = join(packagePath, PACKAGE_JSON);
110
110
  if (isAccessibleSync(packageJsonPath)) {
111
111
  const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);
112
112
  if (resolvedPath === false) {
113
- return undefined;
113
+ return void 0;
114
114
  }
115
115
  if (resolvedPath && isAccessibleSync(resolvedPath) && statSync(resolvedPath).isFile()) {
116
116
  return resolvedPath;
@@ -125,7 +125,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
125
125
  }
126
126
  }
127
127
  if (!isAccessibleSync(fullPackagePath)) {
128
- return undefined;
128
+ return void 0;
129
129
  }
130
130
  if (statSync(fullPackagePath).isDirectory()) {
131
131
  const fullPackageJsonPath = join(fullPackagePath, PACKAGE_JSON);
@@ -142,7 +142,7 @@ const resolveExtendsPath = /* @__PURE__ */ __name$1((requestedPath, directoryPat
142
142
  } else if (jsonExtension) {
143
143
  return fullPackagePath;
144
144
  }
145
- return undefined;
145
+ return void 0;
146
146
  }, "resolveExtendsPath");
147
147
 
148
148
  var __defProp = Object.defineProperty;
@@ -217,7 +217,7 @@ const internalParseTsConfig = /* @__PURE__ */ __name((tsconfigPath, options, cir
217
217
  throw new NotFoundError("No such file or directory, for '" + extendsPath + "' found.");
218
218
  }
219
219
  const extendsConfig = resolveExtends(resolvedExtendsPath, directoryPath, new Set(circularExtendsTracker), options);
220
- if (extendsConfig.compilerOptions?.rootDir !== undefined && !extendsConfig.compilerOptions.rootDir.startsWith(configDirectoryPlaceholder)) {
220
+ if (extendsConfig.compilerOptions?.rootDir !== void 0 && !extendsConfig.compilerOptions.rootDir.startsWith(configDirectoryPlaceholder)) {
221
221
  extendsConfig.compilerOptions.rootDir = join(dirname(resolvedExtendsPath), extendsConfig.compilerOptions.rootDir);
222
222
  }
223
223
  const merged = {
@@ -298,26 +298,26 @@ const interpolateConfigDirectory = /* @__PURE__ */ __name((filePath, configDirec
298
298
  if (filePath.startsWith(configDirectoryPlaceholder)) {
299
299
  return normalize(join(configDirectory, filePath.slice(configDirectoryPlaceholder.length)));
300
300
  }
301
- return undefined;
301
+ return void 0;
302
302
  }, "interpolateConfigDirectory");
303
303
  const compilerFieldsWithConfigDirectory = ["outDir", "declarationDir", "outFile", "rootDir", "baseUrl", "tsBuildInfoFile"];
304
304
  const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
305
- if (config.compilerOptions === undefined) {
305
+ if (config.compilerOptions === void 0) {
306
306
  return config;
307
307
  }
308
308
  if (["5.4", "5.5", "5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible))) {
309
- if (config.compilerOptions.esModuleInterop === undefined && (config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "preserve")) {
309
+ if (config.compilerOptions.esModuleInterop === void 0 && (config.compilerOptions.module === "node16" || config.compilerOptions.module === "nodenext" || config.compilerOptions.module === "preserve")) {
310
310
  config.compilerOptions.esModuleInterop = true;
311
311
  }
312
- if ((config.compilerOptions.esModuleInterop || config.compilerOptions.module === "system" || config.compilerOptions.moduleResolution === "bundler") && config.compilerOptions.allowSyntheticDefaultImports === undefined) {
312
+ if ((config.compilerOptions.esModuleInterop || config.compilerOptions.module === "system" || config.compilerOptions.moduleResolution === "bundler") && config.compilerOptions.allowSyntheticDefaultImports === void 0) {
313
313
  config.compilerOptions.allowSyntheticDefaultImports = true;
314
314
  }
315
- if (config?.compilerOptions.moduleDetection === undefined && config.compilerOptions.module && ["node16", "nodenext"].includes(config.compilerOptions.module)) {
315
+ if (config?.compilerOptions.moduleDetection === void 0 && config.compilerOptions.module && ["node16", "nodenext"].includes(config.compilerOptions.module)) {
316
316
  config.compilerOptions.moduleDetection = "force";
317
317
  }
318
- if (config.compilerOptions.moduleResolution === undefined) {
318
+ if (config.compilerOptions.moduleResolution === void 0) {
319
319
  let moduleResolution = "classic";
320
- if (config.compilerOptions.module !== undefined) {
320
+ if (config.compilerOptions.module !== void 0) {
321
321
  switch ((config.compilerOptions?.module).toLocaleLowerCase()) {
322
322
  case "commonjs": {
323
323
  moduleResolution = "node10";
@@ -346,14 +346,14 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
346
346
  if (["bundler", "node16", "nodenext"].includes(config.compilerOptions.moduleResolution.toLocaleLowerCase())) {
347
347
  resolvePackageJson = true;
348
348
  }
349
- if (config.compilerOptions.resolvePackageJsonExports === undefined && resolvePackageJson) {
349
+ if (config.compilerOptions.resolvePackageJsonExports === void 0 && resolvePackageJson) {
350
350
  config.compilerOptions.resolvePackageJsonExports = true;
351
351
  }
352
- if (config.compilerOptions.resolvePackageJsonImports === undefined && resolvePackageJson) {
352
+ if (config.compilerOptions.resolvePackageJsonImports === void 0 && resolvePackageJson) {
353
353
  config.compilerOptions.resolvePackageJsonImports = true;
354
354
  }
355
355
  }
356
- if (config.compilerOptions.target === undefined) {
356
+ if (config.compilerOptions.target === void 0) {
357
357
  let target = "es5";
358
358
  if (config.compilerOptions.module === "node16") {
359
359
  target = "es2022";
@@ -364,11 +364,11 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
364
364
  config.compilerOptions.target = target;
365
365
  }
366
366
  }
367
- if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target && (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext")) {
367
+ if (config.compilerOptions.useDefineForClassFields === void 0 && config.compilerOptions.target && (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext")) {
368
368
  config.compilerOptions.useDefineForClassFields = true;
369
369
  }
370
370
  }
371
- if (["5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.strict && config.compilerOptions.strictBuiltinIteratorReturn === undefined) {
371
+ if (["5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible)) && config.compilerOptions.strict && config.compilerOptions.strictBuiltinIteratorReturn === void 0) {
372
372
  config.compilerOptions.strictBuiltinIteratorReturn = true;
373
373
  }
374
374
  if (["5.4", "5.5", "5.6", "5.7", "5.8", "true"].includes(String(options?.tscCompatible))) {
@@ -381,7 +381,7 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
381
381
  config.compilerOptions.strictPropertyInitialization = config.compilerOptions.strictPropertyInitialization ?? true;
382
382
  config.compilerOptions.alwaysStrict = config.compilerOptions.alwaysStrict ?? true;
383
383
  }
384
- if (config.compilerOptions.useDefineForClassFields === undefined && config.compilerOptions.target) {
384
+ if (config.compilerOptions.useDefineForClassFields === void 0 && config.compilerOptions.target) {
385
385
  let useDefineForClassFields = false;
386
386
  if (config.compilerOptions.target.includes("es202") || config.compilerOptions.target === "esnext") {
387
387
  useDefineForClassFields = true;
@@ -390,7 +390,7 @@ const tsCompatibleWrapper = /* @__PURE__ */ __name((config, options) => {
390
390
  config.compilerOptions.useDefineForClassFields = true;
391
391
  }
392
392
  }
393
- if (config.compilerOptions.strict && config.compilerOptions.useUnknownInCatchVariables === undefined) {
393
+ if (config.compilerOptions.strict && config.compilerOptions.useUnknownInCatchVariables === void 0) {
394
394
  config.compilerOptions.useUnknownInCatchVariables = true;
395
395
  }
396
396
  if (config.compilerOptions.isolatedModules) {
@@ -1,4 +1,4 @@
1
- import { writeJson, writeJsonSync } from '@visulima/fs';
1
+ import { writeJsonSync, writeJson } from '@visulima/fs';
2
2
  import { toPath } from '@visulima/fs/utils';
3
3
  import { join } from '@visulima/path';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/tsconfig",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "Find and/or parse the tsconfig.json file from a directory path.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -67,8 +67,8 @@
67
67
  "CHANGELOG.md"
68
68
  ],
69
69
  "dependencies": {
70
- "@visulima/fs": "3.1.1",
71
- "@visulima/path": "1.3.4",
70
+ "@visulima/fs": "3.1.3",
71
+ "@visulima/path": "1.3.6",
72
72
  "jsonc-parser": "^3.3.1",
73
73
  "resolve-pkg-maps": "^1.0.0"
74
74
  },