@visulima/tsconfig
Advanced tools
Comparing version 1.0.16 to 1.1.0
@@ -0,1 +1,11 @@ | ||
## @visulima/tsconfig [1.1.0](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.0.16...@visulima/tsconfig@1.1.0) (2024-10-25) | ||
### Features | ||
* **tsconfig:** adding support ${configDir} ([#476](https://github.com/visulima/visulima/issues/476)) ([d54c47b](https://github.com/visulima/visulima/commit/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3)) | ||
### Bug Fixes | ||
* **tsconfig:** handle relative tsconfig.json paths ([abf51b1](https://github.com/visulima/visulima/commit/abf51b1d2efa9b9ca5991a2272c824098cc968ba)) | ||
## @visulima/tsconfig [1.0.16](https://github.com/visulima/visulima/compare/@visulima/tsconfig@1.0.15...@visulima/tsconfig@1.0.16) (2024-10-05) | ||
@@ -2,0 +12,0 @@ |
@@ -1331,3 +1331,3 @@ import { WriteJsonOptions } from '@visulima/fs'; | ||
type Options = { | ||
tscCompatible?: boolean; | ||
tscCompatible?: "5.3" | "5.4" | "5.5" | "5.6" | true; | ||
}; | ||
@@ -1334,0 +1334,0 @@ declare const implicitBaseUrlSymbol: unique symbol; |
{ | ||
"name": "@visulima/tsconfig", | ||
"version": "1.0.16", | ||
"version": "1.1.0", | ||
"description": "Find and/or parse the tsconfig.json file from a directory path.", | ||
@@ -81,10 +81,11 @@ "keywords": [ | ||
"@arethetypeswrong/cli": "^0.16.4", | ||
"@babel/core": "^7.25.7", | ||
"@babel/core": "^7.25.9", | ||
"@ckeditor/typedoc-plugins": "43.0.0", | ||
"@rushstack/eslint-plugin-security": "^0.8.3", | ||
"@secretlint/secretlint-rule-preset-recommend": "^8.3.0", | ||
"@secretlint/secretlint-rule-preset-recommend": "^9.0.0", | ||
"@total-typescript/ts-reset": "^0.6.1", | ||
"@types/node": "18.18.14", | ||
"@visulima/packem": "1.0.7", | ||
"@vitest/coverage-v8": "^2.1.2", | ||
"@vitest/ui": "^2.1.2", | ||
"@visulima/packem": "1.1.0", | ||
"@vitest/coverage-v8": "^2.1.3", | ||
"@vitest/ui": "^2.1.3", | ||
"conventional-changelog-conventionalcommits": "8.0.0", | ||
@@ -100,11 +101,14 @@ "cross-env": "^7.0.3", | ||
"eslint-plugin-vitest-globals": "^1.5.0", | ||
"execa": "^9.4.0", | ||
"execa": "^9.4.1", | ||
"prettier": "^3.3.3", | ||
"rimraf": "5.0.9", | ||
"secretlint": "8.2.4", | ||
"semantic-release": "^24.1.2", | ||
"rimraf": "6.0.1", | ||
"secretlint": "9.0.0", | ||
"semantic-release": "^24.1.3", | ||
"tempy": "^3.1.0", | ||
"type-fest": "^4.26.1", | ||
"typescript": "5.4.5", | ||
"vitest": "^2.1.2" | ||
"typedoc": "0.26.10", | ||
"typedoc-plugin-markdown": "4.2.9", | ||
"typedoc-plugin-rename-defaults": "0.7.1", | ||
"typescript": "5.6.3", | ||
"vitest": "^2.1.3" | ||
}, | ||
@@ -111,0 +115,0 @@ "engines": { |
385
README.md
@@ -34,2 +34,10 @@ <div align="center"> | ||
## Features | ||
- Tested against TypeScript for correctness | ||
- Supports comments & dangling commas in tsconfig.json | ||
- Resolves extends | ||
- Fully typed tsconfig.json | ||
- Validates and throws parsing errors | ||
## Install | ||
@@ -83,2 +91,379 @@ | ||
## Api Docs | ||
<!-- TYPEDOC --> | ||
# @visulima/tsconfig | ||
## File | ||
### TsConfigJson | ||
```ts | ||
type TsConfigJson: object; | ||
``` | ||
Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7). | ||
#### Type declaration | ||
##### compileOnSave? | ||
```ts | ||
optional compileOnSave: boolean; | ||
``` | ||
Enable Compile-on-Save for this project. | ||
##### compilerOptions? | ||
```ts | ||
optional compilerOptions: CompilerOptions; | ||
``` | ||
Instructs the TypeScript compiler how to compile `.ts` files. | ||
##### exclude? | ||
```ts | ||
optional exclude: string[]; | ||
``` | ||
Specifies a list of files to be excluded from compilation. The `exclude` property only affects the files included via the `include` property and not the `files` property. | ||
Glob patterns require TypeScript version 2.0 or later. | ||
##### extends? | ||
```ts | ||
optional extends: string | string[]; | ||
``` | ||
Path to base configuration file to inherit from. | ||
##### files? | ||
```ts | ||
optional files: string[]; | ||
``` | ||
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. When a `files` property is specified, only those files and those specified by `include` are included. | ||
##### include? | ||
```ts | ||
optional include: string[]; | ||
``` | ||
Specifies a list of glob patterns that match files to be included in compilation. | ||
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. | ||
##### references? | ||
```ts | ||
optional references: References[]; | ||
``` | ||
Referenced projects. | ||
##### typeAcquisition? | ||
```ts | ||
optional typeAcquisition: TypeAcquisition; | ||
``` | ||
Auto type (.d.ts) acquisition options for this project. | ||
##### watchOptions? | ||
```ts | ||
optional watchOptions: WatchOptions; | ||
``` | ||
Instructs the TypeScript compiler how to watch files. | ||
#### Defined in | ||
node\_modules/.pnpm/type-fest@4.26.1/node\_modules/type-fest/source/tsconfig-json.d.ts:1 | ||
## Other | ||
### findTsConfig() | ||
```ts | ||
function findTsConfig(cwd?, options?): Promise<TsConfigResult> | ||
``` | ||
An asynchronous function that retrieves the TSConfig by searching for the "tsconfig.json" first, | ||
second attempt is to look for the "jsconfig.json" file from a given current working directory. | ||
#### Parameters | ||
• **cwd?**: `string` \| `URL` | ||
Optional. The current working directory from which to search for the "tsconfig.json" file. | ||
The type of `cwd` is `string`. | ||
• **options?**: `Options` = `{}` | ||
#### Returns | ||
`Promise`\<[`TsConfigResult`](README.md#tsconfigresult)\> | ||
A `Promise` that resolves to the TSConfig result object. | ||
The return type of the function is `Promise<TsConfigResult>`. | ||
#### Throws | ||
An `Error` when the "tsconfig.json" file is not found. | ||
#### Defined in | ||
[packages/tsconfig/src/find-tsconfig.ts:29](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/find-tsconfig.ts#L29) | ||
*** | ||
### findTsConfigSync() | ||
```ts | ||
function findTsConfigSync(cwd?, options?): TsConfigResult | ||
``` | ||
#### Parameters | ||
• **cwd?**: `string` \| `URL` | ||
• **options?**: `Options` = `{}` | ||
#### Returns | ||
[`TsConfigResult`](README.md#tsconfigresult) | ||
#### Defined in | ||
[packages/tsconfig/src/find-tsconfig.ts:66](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/find-tsconfig.ts#L66) | ||
*** | ||
### readTsConfig() | ||
```ts | ||
function readTsConfig(tsconfigPath, options?): object | ||
``` | ||
#### Parameters | ||
• **tsconfigPath**: `string` | ||
• **options?**: `Options` | ||
#### Returns | ||
`object` | ||
##### compileOnSave? | ||
```ts | ||
optional compileOnSave: boolean; | ||
``` | ||
Enable Compile-on-Save for this project. | ||
##### compilerOptions? | ||
```ts | ||
optional compilerOptions: CompilerOptions; | ||
``` | ||
Instructs the TypeScript compiler how to compile `.ts` files. | ||
##### exclude? | ||
```ts | ||
optional exclude: string[]; | ||
``` | ||
Specifies a list of files to be excluded from compilation. The `exclude` property only affects the files included via the `include` property and not the `files` property. | ||
Glob patterns require TypeScript version 2.0 or later. | ||
##### files? | ||
```ts | ||
optional files: string[]; | ||
``` | ||
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. When a `files` property is specified, only those files and those specified by `include` are included. | ||
##### include? | ||
```ts | ||
optional include: string[]; | ||
``` | ||
Specifies a list of glob patterns that match files to be included in compilation. | ||
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. | ||
##### references? | ||
```ts | ||
optional references: References[]; | ||
``` | ||
Referenced projects. | ||
##### typeAcquisition? | ||
```ts | ||
optional typeAcquisition: TypeAcquisition; | ||
``` | ||
Auto type (.d.ts) acquisition options for this project. | ||
##### watchOptions? | ||
```ts | ||
optional watchOptions: WatchOptions; | ||
``` | ||
Instructs the TypeScript compiler how to watch files. | ||
#### Defined in | ||
[packages/tsconfig/src/read-tsconfig.ts:308](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/read-tsconfig.ts#L308) | ||
*** | ||
### writeTsConfig() | ||
```ts | ||
function writeTsConfig(tsConfig, options): Promise<void> | ||
``` | ||
An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file. | ||
#### Parameters | ||
• **tsConfig**: [`TsConfigJson`](README.md#tsconfigjson) | ||
The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`. | ||
• **options**: `WriteFileOptions` & `object` & `object` = `{}` | ||
Optional. The write options and the current working directory. The type of `options` is an | ||
intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`. | ||
#### Returns | ||
`Promise`\<`void`\> | ||
A `Promise` that resolves when the tsconfig.json file has been written. | ||
The return type of function is `Promise<void>`. | ||
#### Defined in | ||
[packages/tsconfig/src/write-tsconfig.ts:17](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/write-tsconfig.ts#L17) | ||
*** | ||
### writeTsConfigSync() | ||
```ts | ||
function writeTsConfigSync(tsConfig, options): void | ||
``` | ||
A function that writes the provided TypeScript configuration object to a tsconfig.json file. | ||
#### Parameters | ||
• **tsConfig**: [`TsConfigJson`](README.md#tsconfigjson) | ||
The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`. | ||
• **options**: `WriteFileOptions` & `object` & `object` = `{}` | ||
Optional. The write options and the current working directory. The type of `options` is an | ||
intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`. | ||
#### Returns | ||
`void` | ||
A `Promise` that resolves when the tsconfig.json file has been written. | ||
The return type of function is `Promise<void>`. | ||
#### Defined in | ||
[packages/tsconfig/src/write-tsconfig.ts:35](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/write-tsconfig.ts#L35) | ||
*** | ||
### implicitBaseUrlSymbol | ||
```ts | ||
const implicitBaseUrlSymbol: typeof implicitBaseUrlSymbol; | ||
``` | ||
#### Defined in | ||
[packages/tsconfig/src/read-tsconfig.ts:305](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/read-tsconfig.ts#L305) | ||
*** | ||
### TsConfigJsonResolved | ||
```ts | ||
type TsConfigJsonResolved: Except<TsConfigJson, "extends">; | ||
``` | ||
#### Defined in | ||
[packages/tsconfig/src/types.ts:3](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/types.ts#L3) | ||
*** | ||
### TsConfigResult | ||
```ts | ||
type TsConfigResult: object; | ||
``` | ||
#### Type declaration | ||
##### config | ||
```ts | ||
config: TsConfigJsonResolved; | ||
``` | ||
##### path | ||
```ts | ||
path: string; | ||
``` | ||
#### Defined in | ||
[packages/tsconfig/src/find-tsconfig.ts:14](https://github.com/visulima/visulima/blob/d54c47b780b293e33d2d6d3bcce8dc32a3a101c3/packages/tsconfig/src/find-tsconfig.ts#L14) | ||
## File | ||
- [TsConfigJson](README.md#tsconfigjson) | ||
## Other | ||
- [findTsConfig](README.md#findtsconfig) | ||
- [findTsConfigSync](README.md#findtsconfigsync) | ||
- [readTsConfig](README.md#readtsconfig) | ||
- [writeTsConfig](README.md#writetsconfig) | ||
- [writeTsConfigSync](README.md#writetsconfigsync) | ||
- [TsConfigJson](namespaces/TsConfigJson/README.md) | ||
- [implicitBaseUrlSymbol](README.md#implicitbaseurlsymbol) | ||
- [TsConfigJsonResolved](README.md#tsconfigjsonresolved) | ||
- [TsConfigResult](README.md#tsconfigresult) | ||
<!-- /TYPEDOC --> | ||
## Related | ||
@@ -85,0 +470,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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
132003
1127
497
36