Comparing version 1.0.0-8 to 1.0.0-9
@@ -23,3 +23,3 @@ #!/usr/bin/env node | ||
>{ | ||
> ... ParseResult json | ||
> ... TSConfckParseResult json | ||
>} | ||
@@ -26,0 +26,0 @@ `; |
@@ -45,3 +45,3 @@ /** | ||
*/ | ||
filename: string; | ||
tsconfigFile: string; | ||
/** | ||
@@ -127,3 +127,3 @@ * parsed result, including merged values from extended | ||
*/ | ||
filename: string; | ||
tsconfigFile: string; | ||
/** | ||
@@ -130,0 +130,0 @@ * parsed result, including merged values from extended and normalized |
@@ -215,3 +215,3 @@ var __defProp = Object.defineProperty; | ||
function resolveReferencedTSConfigFiles(result) { | ||
const dir = path2.dirname(result.filename); | ||
const dir = path2.dirname(result.tsconfigFile); | ||
return result.tsconfig.references.map((ref) => { | ||
@@ -234,3 +234,3 @@ const refPath = ref.path.endsWith(".json") ? ref.path : path2.join(ref.path, "tsconfig.json"); | ||
function isIncluded(filename, result) { | ||
const dir = native2posix(path2.dirname(result.filename)); | ||
const dir = native2posix(path2.dirname(result.tsconfigFile)); | ||
const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file)); | ||
@@ -332,3 +332,3 @@ const absoluteFilename = resolve2posix(null, filename); | ||
const notFoundResult = { | ||
filename: "no_tsconfig_file_found", | ||
tsconfigFile: "no_tsconfig_file_found", | ||
tsconfig: {} | ||
@@ -362,3 +362,3 @@ }; | ||
const result = { | ||
filename: tsconfigFile, | ||
tsconfigFile, | ||
tsconfig: normalizeTSConfig(JSON.parse(json), path3.dirname(tsconfigFile)) | ||
@@ -393,9 +393,9 @@ }; | ||
const extended = [ | ||
{ filename: result.filename, tsconfig: JSON.parse(JSON.stringify(result.tsconfig)) } | ||
{ tsconfigFile: result.tsconfigFile, tsconfig: JSON.parse(JSON.stringify(result.tsconfig)) } | ||
]; | ||
while (extended[extended.length - 1].tsconfig.extends) { | ||
const extending = extended[extended.length - 1]; | ||
const extendedTSConfigFile = resolveExtends(extending.tsconfig.extends, extending.filename); | ||
if (extended.some((x) => x.filename === extendedTSConfigFile)) { | ||
const circle = extended.concat({ filename: extendedTSConfigFile, tsconfig: null }).map((e) => e.filename).join(" -> "); | ||
const extendedTSConfigFile = resolveExtends(extending.tsconfig.extends, extending.tsconfigFile); | ||
if (extended.some((x) => x.tsconfigFile === extendedTSConfigFile)) { | ||
const circle = extended.concat({ tsconfigFile: extendedTSConfigFile, tsconfig: null }).map((e) => e.tsconfigFile).join(" -> "); | ||
throw new TSConfckParseError(`Circular dependency in "extends": ${circle}`, "EXTENDS_CIRCULAR"); | ||
@@ -430,3 +430,3 @@ } | ||
const extendedConfig = extended.tsconfig; | ||
const relativePath = native2posix(path3.relative(path3.dirname(extending.filename), path3.dirname(extended.filename))); | ||
const relativePath = native2posix(path3.relative(path3.dirname(extending.tsconfigFile), path3.dirname(extended.tsconfigFile))); | ||
for (const key of Object.keys(extendedConfig).filter((key2) => EXTENDABLE_KEYS.includes(key2))) { | ||
@@ -524,3 +524,3 @@ if (key === "compilerOptions") { | ||
const notFoundResult = { | ||
filename: "no_tsconfig_file_found", | ||
tsconfigFile: "no_tsconfig_file_found", | ||
tsconfig: {}, | ||
@@ -575,3 +575,3 @@ result: null | ||
const result = { | ||
filename: tsconfigFile, | ||
tsconfigFile, | ||
tsconfig: result2tsconfig(nativeResult, ts), | ||
@@ -578,0 +578,0 @@ result: nativeResult |
{ | ||
"name": "tsconfck", | ||
"version": "1.0.0-8", | ||
"version": "1.0.0-9", | ||
"description": "A utility to work with tsconfig.json without typescript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -35,3 +35,3 @@ # tsconfck | ||
const { | ||
filename, // full path to found tsconfig | ||
tsconfigFile, // full path to found tsconfig | ||
tsconfig, // tsconfig object including merged values from extended configs | ||
@@ -49,3 +49,3 @@ extended, // separate unmerged results of all tsconfig files that contributed to tsconfig | ||
const { | ||
filename, // full path to found tsconfig | ||
tsconfigFile, // full path to found tsconfig | ||
tsconfig, // tsconfig object including merged values from extended configs, normalized | ||
@@ -97,3 +97,3 @@ result, // output of ts.parseJsonConfigFileContent | ||
}); | ||
// result = { filename: 'no_tsconfig_file_found',tsconfig: {} } | ||
// result = { tsconfigFile: 'no_tsconfig_file_found',tsconfig: {} } | ||
``` | ||
@@ -100,0 +100,0 @@ |
@@ -39,3 +39,3 @@ import path from 'path'; | ||
const notFoundResult = { | ||
filename: 'no_tsconfig_file_found', | ||
tsconfigFile: 'no_tsconfig_file_found', | ||
tsconfig: {}, | ||
@@ -108,3 +108,3 @@ result: null | ||
const result: TSConfckParseNativeResult = { | ||
filename: tsconfigFile, | ||
tsconfigFile, | ||
tsconfig: result2tsconfig(nativeResult, ts), | ||
@@ -268,3 +268,3 @@ result: nativeResult | ||
*/ | ||
filename: string; | ||
tsconfigFile: string; | ||
@@ -271,0 +271,0 @@ /** |
@@ -36,3 +36,3 @@ import path from 'path'; | ||
const notFoundResult = { | ||
filename: 'no_tsconfig_file_found', | ||
tsconfigFile: 'no_tsconfig_file_found', | ||
tsconfig: {} | ||
@@ -70,3 +70,3 @@ }; | ||
const result = { | ||
filename: tsconfigFile, | ||
tsconfigFile, | ||
tsconfig: normalizeTSConfig(JSON.parse(json), path.dirname(tsconfigFile)) | ||
@@ -114,3 +114,3 @@ }; | ||
const extended = [ | ||
{ filename: result.filename, tsconfig: JSON.parse(JSON.stringify(result.tsconfig)) } | ||
{ tsconfigFile: result.tsconfigFile, tsconfig: JSON.parse(JSON.stringify(result.tsconfig)) } | ||
]; | ||
@@ -120,7 +120,7 @@ | ||
const extending = extended[extended.length - 1]; | ||
const extendedTSConfigFile = resolveExtends(extending.tsconfig.extends, extending.filename); | ||
if (extended.some((x) => x.filename === extendedTSConfigFile)) { | ||
const extendedTSConfigFile = resolveExtends(extending.tsconfig.extends, extending.tsconfigFile); | ||
if (extended.some((x) => x.tsconfigFile === extendedTSConfigFile)) { | ||
const circle = extended | ||
.concat({ filename: extendedTSConfigFile, tsconfig: null }) | ||
.map((e) => e.filename) | ||
.concat({ tsconfigFile: extendedTSConfigFile, tsconfig: null }) | ||
.map((e) => e.tsconfigFile) | ||
.join(' -> '); | ||
@@ -168,3 +168,3 @@ throw new TSConfckParseError( | ||
const relativePath = native2posix( | ||
path.relative(path.dirname(extending.filename), path.dirname(extended.filename)) | ||
path.relative(path.dirname(extending.tsconfigFile), path.dirname(extended.tsconfigFile)) | ||
); | ||
@@ -264,3 +264,3 @@ for (const key of Object.keys(extendedConfig).filter((key) => EXTENDABLE_KEYS.includes(key))) { | ||
*/ | ||
filename: string; | ||
tsconfigFile: string; | ||
@@ -267,0 +267,0 @@ /** |
@@ -95,3 +95,3 @@ import path from 'path'; | ||
export function resolveReferencedTSConfigFiles(result: TSConfckParseResult): string[] { | ||
const dir = path.dirname(result.filename); | ||
const dir = path.dirname(result.tsconfigFile); | ||
return result.tsconfig.references.map((ref: { path: string }) => { | ||
@@ -126,3 +126,3 @@ const refPath = ref.path.endsWith('.json') ? ref.path : path.join(ref.path, 'tsconfig.json'); | ||
function isIncluded(filename: string, result: TSConfckParseResult): boolean { | ||
const dir = native2posix(path.dirname(result.filename)); | ||
const dir = native2posix(path.dirname(result.tsconfigFile)); | ||
const files = (result.tsconfig.files || []).map((file: string) => resolve2posix(dir, file)); | ||
@@ -129,0 +129,0 @@ const absoluteFilename = resolve2posix(null, filename); |
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
188192