get-tsconfig
Advanced tools
Comparing version 4.3.0 to 4.4.0
{ | ||
"name": "get-tsconfig", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "Find and parse the tsconfig.json file from a directory path", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -100,2 +100,43 @@ # get-tsconfig [![Latest version](https://badgen.net/npm/v/get-tsconfig)](https://npm.im/get-tsconfig) | ||
### createFileMatcher(tsconfig: TsconfigResult, caseSensitivePaths?: boolean) | ||
Given a `tsconfig.json` file, it returns a file-matcher function that determines whether it should apply to a file path. | ||
```ts | ||
type FileMatcher = (filePath: string) => TsconfigResult['config'] | undefined | ||
``` | ||
#### tsconfig | ||
Type: `TsconfigResult` | ||
Pass in the return value from `getTsconfig`, or a `TsconfigResult` object. | ||
#### caseSensitivePaths | ||
Type: `boolean` | ||
By default, it uses [`is-fs-case-sensitive`](https://github.com/privatenumber/is-fs-case-sensitive) to detect whether the file-system is case-sensitive. | ||
Pass in `true` to make it case-sensitive. | ||
#### Example | ||
For example, if it's called with a `tsconfig.json` file that has `include`/`exclude`/`files` defined, the file-matcher will return the config for files that match `include`/`files`, and return `undefined` for files that don't match or match `exclude`. | ||
```ts | ||
const tsconfig = getTsconfig() | ||
const fileMatcher = tsconfig && createFileMatcher(tsconfig) | ||
/* | ||
* Returns tsconfig.json if it matches the file, | ||
* undefined if not | ||
*/ | ||
const configForFile = fileMatcher?.('/path/to/file.ts') | ||
const distCode = compileTypescript({ | ||
code: sourceCode, | ||
tsconfig: configForFile | ||
}) | ||
``` | ||
--- | ||
### createPathsMatcher(tsconfig: TsconfigResult) | ||
@@ -102,0 +143,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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
92687
121
197
0