Comparing version 1.1.1 to 1.1.2
@@ -173,3 +173,3 @@ var __defProp = Object.defineProperty; | ||
var NATIVE_SEP_RE = new RegExp("\\" + path2.sep, "g"); | ||
var PATTERN_REGEX_CACHE = new Map(); | ||
var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map(); | ||
var GLOB_ALL_PATTERN = `**/*`; | ||
@@ -188,4 +188,3 @@ var DEFAULT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"]; | ||
async function resolveTSConfig(filename) { | ||
const basename = path2.basename(filename); | ||
if (basename !== "tsconfig.json") { | ||
if (path2.extname(filename) !== ".json") { | ||
return; | ||
@@ -673,2 +672,2 @@ } | ||
}; | ||
//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "tsconfck", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A utility to work with tsconfig.json without typescript", | ||
@@ -49,14 +49,14 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@commitlint/cli": "^13.2.1", | ||
"@commitlint/config-conventional": "^13.2.0", | ||
"@commitlint/cli": "^16.1.0", | ||
"@commitlint/config-conventional": "^16.0.0", | ||
"@tsconfig/node12": "^1.0.9", | ||
"@types/node": "^16.11.6", | ||
"@typescript-eslint/eslint-plugin": "^5.2.0", | ||
"@typescript-eslint/parser": "^5.2.0", | ||
"c8": "^7.10.0", | ||
"chalk": "^4.1.2", | ||
"conventional-changelog-cli": "^2.1.1", | ||
"@types/node": "^16.11.21", | ||
"@typescript-eslint/eslint-plugin": "^5.10.0", | ||
"@typescript-eslint/parser": "^5.10.0", | ||
"c8": "^7.11.0", | ||
"chalk": "^5.0.0", | ||
"conventional-changelog-cli": "^2.2.2", | ||
"enquirer": "^2.3.6", | ||
"esbuild": "^0.13.12", | ||
"eslint": "^8.1.0", | ||
"esbuild": "^0.14.13", | ||
"eslint": "^8.7.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
@@ -66,15 +66,15 @@ "eslint-plugin-markdown": "^2.2.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"execa": "^5.1.1", | ||
"execa": "^6.0.0", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^11.2.6", | ||
"lint-staged": "^12.3.1", | ||
"minimist": "^1.2.5", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.4.1", | ||
"prettier": "^2.5.1", | ||
"rimraf": "^3.0.2", | ||
"semver": "^7.3.5", | ||
"tiny-glob": "^0.2.9", | ||
"tsm": "^2.1.4", | ||
"tsup": "^5.5.0", | ||
"typescript": "^4.4.4", | ||
"uvu": "^0.5.2", | ||
"tsm": "^2.2.1", | ||
"tsup": "^5.11.11", | ||
"typescript": "^4.5.5", | ||
"uvu": "^0.5.3", | ||
"watchlist": "^0.3.1" | ||
@@ -88,4 +88,4 @@ }, | ||
}, | ||
"packageManager": "pnpm@6", | ||
"engines": { | ||
"pnpm": ">=6.7.0", | ||
"node": "^12.20 || ^14.13.1 || >= 16" | ||
@@ -109,3 +109,4 @@ }, | ||
"release:dry": "pnpm run release -- --dry" | ||
} | ||
}, | ||
"readme": "# tsconfck\n\n[![npm version](https://img.shields.io/npm/v/tsconfck)](https://www.npmjs.com/package/tsconfck)\n[![CI](https://github.com/dominikg/tsconfck/actions/workflows/test.yml/badge.svg)](https://github.com/dominikg/tsconfck/actions/workflows/test.yml)\n\nA utility to find and parse tsconfig files without depending on typescript\n\n# Why\n\nBecause no simple official api exists and tsconfig.json isn't actual json.\n\n# Features\n\n- [x] find closest tsconfig.json\n- [x] convert tsconfig.json to actual json and parse it\n- [x] resolve \"extends\"\n- [x] resolve \"references\" of solution-style tsconfig\n- [x] optional findNative and parseNative to use official typescript api\n- [x] zero dependencies (typescript optional)\n- [x] extensive testsuite\n\n# Install\n\n```shell\nnpm install --save-dev tsconfck # or pnpm, yarn\n```\n\n# Usage\n\n## without typescript installed\n\n```js\nimport { parse } from 'tsconfck';\nconst {\n\ttsconfigFile, // full path to found tsconfig\n\ttsconfig, // tsconfig object including merged values from extended configs\n\textended, // separate unmerged results of all tsconfig files that contributed to tsconfig\n\tsolution, // solution result if tsconfig is part of a solution\n\treferenced // referenced tsconfig results if tsconfig is a solution\n} = await parse('foo/bar.ts');\n```\n\n## with typescript\n\n```js\nimport { parseNative } from 'tsconfck';\nconst {\n\ttsconfigFile, // full path to found tsconfig\n\ttsconfig, // tsconfig object including merged values from extended configs, normalized\n\tresult, // output of ts.parseJsonConfigFileContent\n\tsolution, // solution result if tsconfig is part of a solution\n\treferenced // referenced tsconfig results if tsconfig is a solution\n} = await parseNative('foo/bar.ts');\n```\n\n## API\n\nsee [API-DOCS](docs/api.md)\n\n## Advanced\n\n### caching\n\nYou can use a map to cache results and avoid reparsing if you process multiple ts files that share few tsconfig files\n\n```js\nimport { parse } from 'tsconfck';\n// 1. create cache instance\nconst cache = new Map();\n// 2. pass cache instance in options\nconst fooResult = await parse('src/foo.ts', { cache });\n// 3. profit (if they share the same tsconfig.json, it is not parsed again)\nconst barResult = await parse('src/bar.ts', { cache });\n```\n\n> You are responsible for clearing the cache if tsconfig files change on disk during its lifetime.\n>\n> Always clear the whole cache if anything changes as objects in the cache can ref each other\n\n> Returned results are direct cache objects.\n>\n> If you want to modify them, deep-clone first.\n\n### error handling\n\nfind and parse reject for all errors they encounter.\n\nFor parse, you can choose to resolve with an empty result instead if no tsconfig file was found\n\n```js\nimport { parse } from 'tsconfck';\nconst result = await parse('some/path/without/tsconfig/foo.ts', {\n\tresolveWithEmptyIfConfigNotFound: true\n});\n// result = { tsconfigFile: 'no_tsconfig_file_found',tsconfig: {} }\n```\n\n### TSConfig type (optional, requires typescript as devDependency)\n\n```ts\nimport type { TSConfig } from 'pkg-types';\n```\n\nCheck out https://github.com/unjs/pkg-types\n\n### cli\n\nA simple cli wrapper is included, you can use it like this\n\n#### find\n\n```shell\n# prints /path/to/tsconfig.json on stdout\ntsconfck find src/index.ts\n```\n\n#### parse\n\n```shell\n# print content of ParseResult.tsconfig on stdout\ntsconfck parse src/index.ts\n\n# print to file\ntsconfck parse src/index.ts > output.json\n```\n\n#### parse-result\n\n```shell\n# print content of ParseResult on stdout\ntsconfck parse-result src/index.ts\n\n# print to file\ntsconfck parse-result src/index.ts > output.json\n```\n\n#### help\n\n```shell\n# print usage\ntsconfck -h # or --help, -?, help\n```\n\n# Links\n\n- [changelog](CHANGELOG.md)\n\n# Develop\n\nThis repo uses\n\n- [pnpm](https://pnpm.io)\n- [conventional-changelog/commitlint](https://github.com/conventional-changelog/commitlint#what-is-commitlint)\n\nIn addition to default commit-msg prefixes you can use 'wip: ' for commit messages in branches.\nPRs are going to be squash-merged\n\n```shell\n# install dependencies\npnpm install\n# run tests\npnpm test\n#run tests in watch mode (doesn't require dev in parallel)\npnpm test:watch\n```\n\n# License\n\n[MIT](./LICENSE)\n" | ||
} |
@@ -27,4 +27,3 @@ import path from 'path'; | ||
export async function resolveTSConfig(filename: string): Promise<string | void> { | ||
const basename = path.basename(filename); | ||
if (basename !== 'tsconfig.json') { | ||
if (path.extname(filename) !== '.json') { | ||
return; | ||
@@ -31,0 +30,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
194082
2605