https://github.com/flex-development/tsconfig-utils
Utilities for working with tsconfig files
https://github.com/flex-development/tsconfig-utils
programmatic tsconfig tsconfig-paths typescript typescript-compiler typescript-compiler-api
Last synced: about 2 months ago
JSON representation
Utilities for working with tsconfig files
- Host: GitHub
- URL: https://github.com/flex-development/tsconfig-utils
- Owner: flex-development
- License: bsd-3-clause
- Created: 2023-02-03T01:55:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-23T04:02:30.000Z (about 1 year ago)
- Last Synced: 2024-10-04T10:37:12.740Z (9 months ago)
- Topics: programmatic, tsconfig, tsconfig-paths, typescript, typescript-compiler, typescript-compiler-api
- Language: TypeScript
- Homepage: https://github.com/flex-development/tsconfig-utils
- Size: 2.79 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/funding.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# tsconfig-utils
[](https://github.com/flex-development/tsconfig-utils/releases/latest)
[](https://npmjs.com/package/@flex-development/tsconfig-utils)
[](https://codecov.io/gh/flex-development/tsconfig-utils)
[](https://github.com/voxpelli/badges-cjs-esm)
[](LICENSE.md)
[](https://conventionalcommits.org)
[](https://typescriptlang.org)
[](https://vitest.dev)
[](https://yarnpkg.com)Utilities for working with [`tsconfig`][tsconfig] files
## Contents
- [What is this?](#what-is-this)
- [When should I use this?](#when-should-i-use-this)
- [Install](#install)
- [Use](#use)
- [API](#api)
- [Types](#types)
- [`tsconfig-types`](#tsconfig-types)
- [Interfaces](#interfaces)
- [Types](#types)
- [Related](#related)
- [Contribute](#contribute)## What is this?
This package exports utilities for working with [TypeScript configuration files][tsconfig].
## When should I use this?
This package can be used to merge and load tsconfig files, as well resolve path aliases.
## Install
This package is [ESM only][esm].
In Node.js (version 18+) with [yarn][]:
```sh
yarn add @flex-development/tsconfig-utils
```
See Git - Protocols | Yarn
for details regarding installing from Git.
In Deno with [`esm.sh`][esmsh]:
```ts
import { loadTsconfig, resolvePath } from 'https://esm.sh/@flex-development/tsconfig-utils'
```In browsers with [`esm.sh`][esmsh]:
```html
import { loadTsconfig, resolvePath } from 'https://esm.sh/@flex-development/tsconfig-utils'
```
## Use
```js
import {
isResolvedTsconfig,
isTsconfigHost,
loadTsconfig,
mergeTsconfig,
readTsconfig,
resolvePath
} from '@flex-development/tsconfig-utils'
```## API
This package exports the following identifiers:
- [`createGetCanonicalFileName`](./src/lib/create-get-canonical-file-name.mts)
- [`createModuleResolutionHost`](./src/lib/create-module-resolution-host.mts)
- [`createParseConfigHost`](./src/lib/create-parse-config-host.mts)
- [`isResolvedTsconfig`](./src/lib/is-resolved-tsconfig.mts)
- [`isTsconfigHost`](./src/lib/is-tsconfig-host.mts)
- [`loadTsconfig`](./src/lib/load-tsconfig.mts)
- [`mergeTsconfig`](./src/lib/merge-tsconfig.mts)
- [`readTsconfig`](./src/lib/read-tsconfig.mts)
- [`resolvePath`](./src/lib/resolve-path.mts)There is no default export.
## Types
This package is fully typed with [TypeScript][].
### `tsconfig-types`
This package re-exports TypeScript definitions from [`tsconfig-types`][tsconfig-types]. This is primarily for the
convenience of TypeScript users who do not hoist packages, but may need to `import` definitions used in this package.### Interfaces
- [`Dirent`](./src/interfaces/dirent.mts)
- [`FileSystem`](./src/interfaces/file-system.mts)
- [`LoadTsconfigOptions`](./src/interfaces/options-load-tsconfig.mts)
- [`ModuleResolutionHostOptions`](./src/interfaces/options-module-resolution-host.mts)
- [`ModuleResolutionHost`](./src/interfaces/host-module-resolution.mts)
- [`ParseConfigHostOptions`](./src/interfaces/options-parse-config-host.mts)
- [`ParseConfigHost`](./src/interfaces/host-parse-config.mts)
- [`ReadTsconfigOptions`](./src/interfaces/options-read-tsconfig.mts)
- [`ResolvePathOptions`](./src/interfaces/options-resolve-path.mts)
- [`ResolvedTsconfig`](./src/interfaces/options-resolve-path.mts)
- [`TsconfigHost`](./src/interfaces/tsconfig-host.mts)### Types
- [`GetCanonicalFileName`](./src/types/get-canonical-file-name.mts)
- [`ReadDirectory`](./src/types/read-directory.mts)## Related
- [`mlly`][mlly] — [ECMAScript module][node-esm] utilities
- [`tsconfig-types`][tsconfig-types] — [TypeScript][] definitions for `tsconfig.json`## Contribute
See [`CONTRIBUTING.md`](CONTRIBUTING.md).
This project has a [code of conduct](./CODE_OF_CONDUCT.md). By interacting with this repository, organization, or
community you agree to abide by its terms.[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[mlly]: https://github.com/flex-development/mlly
[node-esm]: https://nodejs.org/api/esm.html
[tsconfig-types]: https://github.com/flex-development/tsconfig-types
[tsconfig]: https://www.typescriptlang.org/tsconfig
[typescript]: https://www.typescriptlang.org
[yarn]: https://yarnpkg.com