ts-unused-exports
Advanced tools
Comparing version 9.0.1 to 9.0.2
@@ -0,1 +1,7 @@ | ||
## [9.0.2] - 15 Jan 2023 | ||
### Added | ||
- Added better examples of how to use as a library, via TypeScript or JavaScript. No code was changed. | ||
## [9.0.1] - 4 Jan 2023 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "ts-unused-exports", | ||
"version": "9.0.1", | ||
"version": "9.0.2", | ||
"description": "ts-unused-exports finds unused exported symbols in your Typescript project", | ||
@@ -5,0 +5,0 @@ "main": "lib/app.js", |
@@ -39,20 +39,4 @@ # ts-unused-exports | ||
or, as a library: | ||
## Usage Options | ||
```ts | ||
import analyzeTsConfig from 'ts-unused-exports'; | ||
const result = analyzeTsConfig('path/to/tsconfig.json'); | ||
// or const result = analyzeTsConfig('path/to/tsconfig.json', ['file1.ts']); | ||
// or const result = analyzeTsConfig('path/to/tsconfig.json', ['file1.ts', '--excludePathsFromReport=math']); | ||
// result : { [index:string] : ExportNameAndLocation[] } | ||
// where the keys are file paths and the values are a structure descibing unused symbols: | ||
// interface ExportNameAndLocation { | ||
// exportName: string; | ||
// location: LocationInFile; | ||
// } | ||
``` | ||
Options: | ||
| Option name | Description | Example | | ||
@@ -81,2 +65,34 @@ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------- | | ||
### Usage as a library | ||
#### Usage as a library - From TypeScript (was built with ES5 + commonjs) | ||
```ts | ||
import analyzeTsConfig from 'ts-unused-exports'; | ||
const result = analyzeTsConfig('path/to/tsconfig.json'); | ||
// or const result = analyzeTsConfig('path/to/tsconfig.json', ['file1.ts']); | ||
// or const result = analyzeTsConfig('path/to/tsconfig.json', ['file1.ts', '--excludePathsFromReport=math']); | ||
// result : { [index:string] : ExportNameAndLocation[] } | ||
// where the keys are file paths and the values are a structure descibing unused symbols: | ||
// interface ExportNameAndLocation { | ||
// exportName: string; | ||
// location: LocationInFile; | ||
// } | ||
``` | ||
For an example see `./example/library-usage-via-TypeScript/`. | ||
#### Usage as a library - From JavaScript | ||
From JavaScript - depending on your environment, you may need to navigate to reach the analyzeTsConfig() function. | ||
```js | ||
import analyzeTsConfig from "ts-unused-exports"; | ||
const result = analyzeTsConfig.default('path/to/tsconfig.json'); | ||
``` | ||
For an example see `./example/library-usage-via-JavaScript/`. | ||
## Why should I use this? | ||
@@ -83,0 +99,0 @@ |
131615
199