Comparing version 1.0.0-7 to 1.0.0-8
@@ -112,2 +112,11 @@ /** | ||
resolveWithEmptyIfConfigNotFound?: boolean; | ||
/** | ||
* Set this option to true to force typescript to ignore all source files. | ||
* | ||
* This is faster - especially for large projects - but comes with 2 caveats | ||
* | ||
* 1) output tsconfig always has `files: [],include: []` instead of any real values configured. | ||
* 2) as a result of 1), it won't be able to resolve solution-style references and always return the closest tsconfig | ||
*/ | ||
ignoreSourceFiles?: boolean; | ||
} | ||
@@ -114,0 +123,0 @@ interface TSConfckParseNativeResult { |
@@ -536,4 +536,4 @@ var __defProp = Object.defineProperty; | ||
const ts = await loadTS(); | ||
result = await parseFile2(tsconfigFile, ts, cache); | ||
await parseReferences2(result, ts, cache); | ||
result = await parseFile2(tsconfigFile, ts, options); | ||
await parseReferences2(result, ts, options); | ||
cache == null ? void 0 : cache.set(tsconfigFile, result); | ||
@@ -545,3 +545,4 @@ } | ||
} | ||
async function parseFile2(tsconfigFile, ts, cache) { | ||
async function parseFile2(tsconfigFile, ts, options) { | ||
const cache = options == null ? void 0 : options.cache; | ||
if (cache == null ? void 0 : cache.has(tsconfigFile)) { | ||
@@ -562,2 +563,6 @@ return cache.get(tsconfigFile); | ||
}; | ||
if (options == null ? void 0 : options.ignoreSourceFiles) { | ||
config.files = []; | ||
config.include = []; | ||
} | ||
const nativeResult = parseJsonConfigFileContent(config, host, path5.dirname(posixTSConfigFile), void 0, posixTSConfigFile); | ||
@@ -573,3 +578,3 @@ checkErrors(nativeResult); | ||
} | ||
async function parseReferences2(result, ts, cache) { | ||
async function parseReferences2(result, ts, options) { | ||
if (!result.tsconfig.references) { | ||
@@ -579,3 +584,3 @@ return; | ||
const referencedFiles = resolveReferencedTSConfigFiles(result); | ||
result.referenced = await Promise.all(referencedFiles.map((file) => parseFile2(file, ts, cache))); | ||
result.referenced = await Promise.all(referencedFiles.map((file) => parseFile2(file, ts, options))); | ||
} | ||
@@ -582,0 +587,0 @@ function checkErrors(nativeResult) { |
{ | ||
"name": "tsconfck", | ||
"version": "1.0.0-7", | ||
"version": "1.0.0-8", | ||
"description": "A utility to work with tsconfig.json without typescript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -58,4 +58,4 @@ import path from 'path'; | ||
const ts = await loadTS(); | ||
result = await parseFile(tsconfigFile, ts, cache); | ||
await parseReferences(result, ts, cache); | ||
result = await parseFile(tsconfigFile, ts, options); | ||
await parseReferences(result, ts, options); | ||
cache?.set(tsconfigFile, result); | ||
@@ -74,4 +74,5 @@ } | ||
ts: any, | ||
cache?: Map<string, TSConfckParseNativeResult> | ||
options?: TSConfckParseNativeOptions | ||
): Promise<TSConfckParseNativeResult> { | ||
const cache = options?.cache; | ||
if (cache?.has(tsconfigFile)) { | ||
@@ -94,2 +95,6 @@ return cache.get(tsconfigFile)!; | ||
if (options?.ignoreSourceFiles) { | ||
config.files = []; | ||
config.include = []; | ||
} | ||
const nativeResult = parseJsonConfigFileContent( | ||
@@ -103,2 +108,3 @@ config, | ||
checkErrors(nativeResult); | ||
const result: TSConfckParseNativeResult = { | ||
@@ -116,3 +122,3 @@ filename: tsconfigFile, | ||
ts: any, | ||
cache?: Map<string, TSConfckParseNativeResult> | ||
options?: TSConfckParseNativeOptions | ||
) { | ||
@@ -123,3 +129,5 @@ if (!result.tsconfig.references) { | ||
const referencedFiles = resolveReferencedTSConfigFiles(result); | ||
result.referenced = await Promise.all(referencedFiles.map((file) => parseFile(file, ts, cache))); | ||
result.referenced = await Promise.all( | ||
referencedFiles.map((file) => parseFile(file, ts, options)) | ||
); | ||
} | ||
@@ -248,2 +256,12 @@ | ||
resolveWithEmptyIfConfigNotFound?: boolean; | ||
/** | ||
* Set this option to true to force typescript to ignore all source files. | ||
* | ||
* This is faster - especially for large projects - but comes with 2 caveats | ||
* | ||
* 1) output tsconfig always has `files: [],include: []` instead of any real values configured. | ||
* 2) as a result of 1), it won't be able to resolve solution-style references and always return the closest tsconfig | ||
*/ | ||
ignoreSourceFiles?: boolean; | ||
} | ||
@@ -250,0 +268,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
188016
2574