|
1 | 1 | # node typescript parser
|
2 | 2 |
|
| 3 | +This package is a TypeScript and ECMAScript parser. It uses the underlying typescript parser to generate |
| 4 | +a more or less human readable AST out of .js or .ts files. |
| 5 | + |
| 6 | +[](https://travis-ci.org/TypeScript-Heroes/node-typescript-parser) |
| 7 | +[](https://www.npmjs.com/package/typescript-parser) |
| 8 | +[](https://coveralls.io/github/TypeScript-Heroes/node-typescript-parser) |
| 9 | +[](https://github.com/semantic-release/semantic-release) |
| 10 | + |
3 | 11 | ## How to use
|
| 12 | + |
| 13 | +After you install the package via: |
| 14 | + |
| 15 | +[](https://nodei.co/npm/typescript-parser/) |
| 16 | + |
| 17 | +You can use the parser with: |
| 18 | + |
| 19 | +```typescript |
| 20 | +const parser = new TypescriptParser(); |
| 21 | + |
| 22 | +// either: |
| 23 | +const parsed = await parser.parseSource(/* typescript source code as string */); |
| 24 | + |
| 25 | +// or a filepath |
| 26 | +const parsed = await parser.parseSource('/user/myfile.ts', 'workspace root'); |
| 27 | +``` |
| 28 | + |
| 29 | +You can also parse multiple files at ones. |
| 30 | + |
| 31 | +To use the declaration index (which is basically a list of symbols for your files) |
| 32 | +instantiate an index first and throw him some files. |
| 33 | + |
| 34 | +After the parsing is done, you'll get an index with resolved |
| 35 | +exports and declarations. |
| 36 | + |
| 37 | +Keep in mind, that the index'll only contain exported declarations. |
| 38 | + |
| 39 | +## Changelog |
| 40 | + |
| 41 | +The changelog is generated by [semantic release](https://github.com/semantic-release/semantic-release) and is located under the |
| 42 | +[release section](https://github.com/TypeScript-Heroes/node-typescript-parser/releases). |
| 43 | + |
| 44 | +## Licence |
| 45 | + |
| 46 | +This software is licenced under the [MIT](LICENSE) licence. |
0 commit comments