# typescript-parser

> Parser for typescript (and javascript) files, that compiles those files and generates a human understandable AST.

Latest version **2.6.1** (published 2018-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install typescript-parser
pnpm add typescript-parser
yarn add typescript-parser
bun add typescript-parser
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.6.1 |
| Published | 2018-08-31 |
| First published | 2017-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 168.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 149 |
| Author | Christoph Bühler |
| Maintainers | cbuehler |
| Keywords | typescript, parser, AST, parsing |

## Links

- npm: https://www.npmjs.com/package/typescript-parser
- Repository: https://github.com/TypeScript-Heroes/node-typescript-parser
- Homepage: https://github.com/TypeScript-Heroes/node-typescript-parser#readme
- Issues: https://github.com/TypeScript-Heroes/node-typescript-parser/issues
- npm.io page: https://npm.io/package/typescript-parser

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) ^1.9.3
- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.10
- [typescript](https://npm.io/package/typescript.md) ^3.0.3

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.6.1 (latest) — 2018-08-31
- 2.6.0 — 2018-08-31
- 2.5.0 — 2018-07-05
- 2.4.0 — 2018-04-04
- 2.3.1 — 2018-03-06
- 2.3.0 — 2018-03-05
- 2.2.2 — 2017-10-30
- 2.2.1 — 2017-10-29
- 2.2.0 — 2017-10-28
- 2.1.0 — 2017-10-26
- 2.0.1 — 2017-10-03
- 2.0.0 — 2017-10-03
- 1.3.3 — 2017-09-19
- 1.3.2 — 2017-09-18
- 1.3.1 — 2017-09-08
- … 9 more at https://npm.io/package/typescript-parser/versions

## README

# node typescript parser

This package is a TypeScript and ECMAScript parser. It uses the underlying typescript parser to generate
a more or less human readable AST out of .js or .ts files.

[![Build Status](https://travis-ci.org/buehler/node-typescript-parser.svg)](https://travis-ci.org/buehler/node-typescript-parser)
[![Build Status Windows](https://ci.appveyor.com/api/projects/status/j06bqjc4tkdt7sej?svg=true)](https://ci.appveyor.com/project/buehler/node-typescript-parser)
[![npm](https://img.shields.io/npm/v/typescript-parser.svg?maxAge=3600)](https://www.npmjs.com/package/typescript-parser)
[![codecov](https://codecov.io/gh/buehler/node-typescript-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/buehler/node-typescript-parser)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Greenkeeper badge](https://badges.greenkeeper.io/buehler/node-typescript-parser.svg)](https://greenkeeper.io/)
[![Gitter](https://img.shields.io/gitter/room/node-typescript-parser/Lobby.svg)](https://gitter.im/node-typescript-parser/Lobby)

## How to use

After you install the package via:

[![NPM](https://nodei.co/npm/typescript-parser.png?downloads=true&stars=true)](https://nodei.co/npm/typescript-parser/)

### [View Source Docs](https://buehler.github.io/node-typescript-parser/)

You can use the parser with:

```typescript
const parser = new TypescriptParser();

// either:
const parsed = await parser.parseSource(/* typescript source code as string */);

// or a filepath
const parsed = await parser.parseFile('/user/myfile.ts', 'workspace root');
```

You can also parse multiple files at ones.

To use the declaration index (which is basically a list of symbols for your files)
instantiate an index first and throw him some files.

After the parsing is done, you'll get an index with resolved
exports and declarations.

Keep in mind, that the index'll only contain exported declarations.

## Changelog

The changelog is generated by [semantic release](https://github.com/semantic-release/semantic-release) and is located under the
[release section](https://github.com/buehler/node-typescript-parser/releases).

## Licence

This software is licenced under the [MIT](LICENSE) licence.

---
_Source: https://npm.io/package/typescript-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
