🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

get-tsconfig

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-tsconfig - npm Package Compare versions

Comparing version

to
4.4.0

2

package.json
{
"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