tsconfck
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,21 +0,1 @@ | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
// src/find.ts | ||
@@ -214,3 +194,5 @@ import path from "path"; | ||
var DEFAULT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"]; | ||
var DEFAULT_EXTENSIONS_RE_GROUP = `\\.(?:${DEFAULT_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`; | ||
var DEFAULT_EXTENSIONS_RE_GROUP = `\\.(?:${DEFAULT_EXTENSIONS.map((ext) => ext.substring(1)).join( | ||
"|" | ||
)})`; | ||
var dynamicImportDefault = new Function("path", "return import(path).then(m => m.default)"); | ||
@@ -252,3 +234,5 @@ async function loadTS() { | ||
} | ||
return native2posix(dir ? path3.resolve(posix2native(dir), posix2native(filename)) : path3.resolve(posix2native(filename))); | ||
return native2posix( | ||
dir ? path3.resolve(posix2native(dir), posix2native(filename)) : path3.resolve(posix2native(filename)) | ||
); | ||
} | ||
@@ -264,7 +248,10 @@ function resolveReferencedTSConfigFiles(result) { | ||
if (result.referenced && DEFAULT_EXTENSIONS.some((ext) => filename.endsWith(ext)) && !isIncluded(filename, result)) { | ||
const solutionTSConfig = result.referenced.find((referenced) => isIncluded(filename, referenced)); | ||
const solutionTSConfig = result.referenced.find( | ||
(referenced) => isIncluded(filename, referenced) | ||
); | ||
if (solutionTSConfig) { | ||
return __spreadProps(__spreadValues({}, solutionTSConfig), { | ||
return { | ||
...solutionTSConfig, | ||
solution: result | ||
}); | ||
}; | ||
} | ||
@@ -281,3 +268,7 @@ } | ||
} | ||
const isIncluded2 = isGlobMatch(absoluteFilename, dir, result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN])); | ||
const isIncluded2 = isGlobMatch( | ||
absoluteFilename, | ||
dir, | ||
result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN]) | ||
); | ||
if (isIncluded2) { | ||
@@ -408,3 +399,8 @@ const isExcluded = isGlobMatch(absoluteFilename, dir, result.tsconfig.exclude || []); | ||
} catch (e) { | ||
throw new TSConfckParseError(`parsing ${tsconfigFile} failed: ${e}`, "PARSE_FILE", tsconfigFile, e); | ||
throw new TSConfckParseError( | ||
`parsing ${tsconfigFile} failed: ${e}`, | ||
"PARSE_FILE", | ||
tsconfigFile, | ||
e | ||
); | ||
} | ||
@@ -440,3 +436,7 @@ } | ||
const circle = extended.concat({ tsconfigFile: extendedTSConfigFile, tsconfig: null }).map((e) => e.tsconfigFile).join(" -> "); | ||
throw new TSConfckParseError(`Circular dependency in "extends": ${circle}`, "EXTENDS_CIRCULAR", result.tsconfigFile); | ||
throw new TSConfckParseError( | ||
`Circular dependency in "extends": ${circle}`, | ||
"EXTENDS_CIRCULAR", | ||
result.tsconfigFile | ||
); | ||
} | ||
@@ -465,3 +465,8 @@ extended.push(await parseFile(extendedTSConfigFile, cache)); | ||
} | ||
throw new TSConfckParseError(`failed to resolve "extends":"${extended}" in ${from}`, "EXTENDS_RESOLVE", from, error); | ||
throw new TSConfckParseError( | ||
`failed to resolve "extends":"${extended}" in ${from}`, | ||
"EXTENDS_RESOLVE", | ||
from, | ||
error | ||
); | ||
} | ||
@@ -481,3 +486,5 @@ var EXTENDABLE_KEYS = [ | ||
const extendedConfig = extended.tsconfig; | ||
const relativePath = native2posix(path4.relative(path4.dirname(extending.tsconfigFile), path4.dirname(extended.tsconfigFile))); | ||
const relativePath = native2posix( | ||
path4.relative(path4.dirname(extending.tsconfigFile), path4.dirname(extended.tsconfigFile)) | ||
); | ||
for (const key of Object.keys(extendedConfig).filter((key2) => EXTENDABLE_KEYS.includes(key2))) { | ||
@@ -492,3 +499,7 @@ if (key === "compilerOptions") { | ||
} | ||
extendingConfig.compilerOptions[option] = rebaseRelative(option, extendedConfig.compilerOptions[option], relativePath); | ||
extendingConfig.compilerOptions[option] = rebaseRelative( | ||
option, | ||
extendedConfig.compilerOptions[option], | ||
relativePath | ||
); | ||
} | ||
@@ -499,3 +510,7 @@ } else if (extendingConfig[key] === void 0) { | ||
for (const option of Object.keys(extendedConfig.watchOptions)) { | ||
extendingConfig.watchOptions[option] = rebaseRelative(option, extendedConfig.watchOptions[option], relativePath); | ||
extendingConfig.watchOptions[option] = rebaseRelative( | ||
option, | ||
extendedConfig.watchOptions[option], | ||
relativePath | ||
); | ||
} | ||
@@ -625,3 +640,9 @@ } else { | ||
} | ||
const nativeResult = parseJsonConfigFileContent(config, host, path6.dirname(posixTSConfigFile), void 0, posixTSConfigFile); | ||
const nativeResult = parseJsonConfigFileContent( | ||
config, | ||
host, | ||
path6.dirname(posixTSConfigFile), | ||
void 0, | ||
posixTSConfigFile | ||
); | ||
checkErrors(nativeResult, tsconfigFile); | ||
@@ -641,3 +662,5 @@ const result = { | ||
const referencedFiles = resolveReferencedTSConfigFiles(result); | ||
result.referenced = await Promise.all(referencedFiles.map((file) => parseFile2(file, ts, options))); | ||
result.referenced = await Promise.all( | ||
referencedFiles.map((file) => parseFile2(file, ts, options)) | ||
); | ||
} | ||
@@ -650,3 +673,5 @@ function checkErrors(nativeResult, tsconfigFile) { | ||
]; | ||
const criticalError = (_a = nativeResult.errors) == null ? void 0 : _a.find((error) => error.category === 1 && !ignoredErrorCodes.includes(error.code)); | ||
const criticalError = (_a = nativeResult.errors) == null ? void 0 : _a.find( | ||
(error) => error.category === 1 && !ignoredErrorCodes.includes(error.code) | ||
); | ||
if (criticalError) { | ||
@@ -660,3 +685,5 @@ throw new TSConfckParseNativeError(criticalError, tsconfigFile, nativeResult); | ||
if (result.options && Object.keys(result.options).some((o) => !ignoredOptions.includes(o))) { | ||
tsconfig.compilerOptions = __spreadValues({}, result.options); | ||
tsconfig.compilerOptions = { | ||
...result.options | ||
}; | ||
for (const ignored of ignoredOptions) { | ||
@@ -669,3 +696,5 @@ delete tsconfig.compilerOptions[ignored]; | ||
if (compilerOptions.lib != null) { | ||
compilerOptions.lib = compilerOptions.lib.map((x) => x.replace(/^lib\./, "").replace(/\.d\.ts$/, "")); | ||
compilerOptions.lib = compilerOptions.lib.map( | ||
(x) => x.replace(/^lib\./, "").replace(/\.d\.ts$/, "") | ||
); | ||
} | ||
@@ -677,3 +706,8 @@ const enumProperties = [ | ||
name: "moduleResolution", | ||
enumeration: { 1: "classic", 2: "node" } | ||
enumeration: { | ||
1: "classic", | ||
2: "node", | ||
3: "node16", | ||
99: "nodenext" | ||
} | ||
}, | ||
@@ -696,3 +730,5 @@ { | ||
if (result.watchOptions) { | ||
tsconfig.watchOptions = __spreadValues({}, result.watchOptions); | ||
tsconfig.watchOptions = { | ||
...result.watchOptions | ||
}; | ||
} | ||
@@ -699,0 +735,0 @@ const watchOptions = tsconfig.watchOptions; |
{ | ||
"name": "tsconfck", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A utility to work with tsconfig.json without typescript", | ||
@@ -50,31 +50,31 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.0.1", | ||
"@commitlint/config-conventional": "^17.0.0", | ||
"@tsconfig/node14": "^1.0.1", | ||
"@types/node": "^17.0.35", | ||
"@typescript-eslint/eslint-plugin": "^5.26.0", | ||
"@typescript-eslint/parser": "^5.26.0", | ||
"c8": "^7.11.3", | ||
"chalk": "^5.0.1", | ||
"@commitlint/cli": "^17.3.0", | ||
"@commitlint/config-conventional": "^17.3.0", | ||
"@tsconfig/node14": "^1.0.3", | ||
"@types/node": "^18.11.10", | ||
"@typescript-eslint/eslint-plugin": "^5.45.0", | ||
"@typescript-eslint/parser": "^5.45.0", | ||
"c8": "^7.12.0", | ||
"chalk": "^5.1.2", | ||
"conventional-changelog-cli": "^2.2.2", | ||
"enquirer": "^2.3.6", | ||
"esbuild": "^0.14.39", | ||
"eslint": "^8.16.0", | ||
"esbuild": "^0.15.17", | ||
"eslint": "^8.29.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-markdown": "^2.2.1", | ||
"eslint-plugin-markdown": "^3.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"execa": "^6.1.0", | ||
"husky": "^8.0.1", | ||
"lint-staged": "^12.4.2", | ||
"minimist": "^1.2.6", | ||
"husky": "^8.0.2", | ||
"lint-staged": "^13.1.0", | ||
"minimist": "^1.2.7", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.6.2", | ||
"prettier": "^2.8.0", | ||
"rimraf": "^3.0.2", | ||
"semver": "^7.3.7", | ||
"semver": "^7.3.8", | ||
"tiny-glob": "^0.2.9", | ||
"tsm": "^2.2.1", | ||
"tsup": "^6.0.1", | ||
"typescript": "^4.7.2", | ||
"uvu": "^0.5.3", | ||
"tsm": "^2.3.0", | ||
"tsup": "^6.5.0", | ||
"typescript": "^4.9.3", | ||
"uvu": "^0.5.6", | ||
"watchlist": "^0.3.1" | ||
@@ -88,6 +88,6 @@ }, | ||
}, | ||
"packageManager": "pnpm@7.1.5", | ||
"packageManager": "pnpm@7.18.0", | ||
"engines": { | ||
"node": "^14.13.1 || ^16 || >=18", | ||
"pnpm": "^7.0.1" | ||
"pnpm": "^7.18.0" | ||
}, | ||
@@ -94,0 +94,0 @@ "scripts": { |
@@ -191,3 +191,8 @@ import path from 'path'; | ||
name: 'moduleResolution', | ||
enumeration: { 1: 'classic', 2: 'node' } /*ts.ModuleResolutionKind uses different names*/ | ||
enumeration: { | ||
1: 'classic', | ||
2: 'node', | ||
3: 'node16', | ||
99: 'nodenext' | ||
} /*ts.ModuleResolutionKind uses different names*/ | ||
}, | ||
@@ -194,0 +199,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
211616
2908