# ngast

> Parsing tools for Angular. The project is an abstraction over the Angular compiler which provides friendly interface.

Latest version **0.6.2** (published 2021-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngast
pnpm add ngast
yarn add ngast
bun add ngast
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2021-01-18 |
| First published | 2017-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 457 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 171 |
| Author | Minko Gechev |
| Maintainers | mgechev, grandschtroumpf |
| Keywords | AST, Angular, Parser, Compiler |

## Links

- npm: https://www.npmjs.com/package/ngast
- Repository: https://github.com/ng-ast/ngast
- npm.io page: https://npm.io/package/ngast

## Dependencies (3)

- [@angular/core](https://npm.io/package/@angular/core.md) 11.0.9
- [@angular/compiler](https://npm.io/package/@angular/compiler.md) 11.0.9
- [@angular/compiler-cli](https://npm.io/package/@angular/compiler-cli.md) 11.0.9

## 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

- 0.6.2 (latest) — 2021-01-18
- 0.6.1 — 2021-01-13
- 0.6.0 — 2020-12-04
- 0.5.0 — 2020-09-20
- 0.4.0 — 2020-04-03
- 0.3.0 — 2019-06-03
- 0.2.5 — 2019-04-28
- 0.2.4 — 2019-01-10
- 0.2.3 — 2019-01-09
- 0.2.2 — 2018-10-09
- 0.2.0 — 2018-10-05
- 0.1.4 — 2018-04-11
- 0.1.3 — 2018-02-25
- 0.1.2 — 2017-12-24
- 0.1.1 — 2017-12-24
- … 27 more at https://npm.io/package/ngast/versions

## README

[![Build Status](https://travis-ci.org/mgechev/ngast.svg?branch=master)](https://travis-ci.org/mgechev/ngast)

# ngast

This library provides user friendly API for parsing Angular projects.

# Getting started
```
$ npm i @angular/core @angular/compiler @angular/compiler-cli ngast --save
```

> `ngast` is built on top of Ivy (`ngtsc`), make sure to compile your project with `ngcc` (run `ng serve`, `ng build` or `npx ngcc`).

## Workspace
First you need connect the `WorkspaceSymbols` to the `tsconfig.json` root : 
```typescript
import { join } from 'path';
import { WorkspaceSymbols } from 'ngast';

const config = join(process.cwd(), 'tsconfig.json');
const workspace = new WorkspaceSymbols(config);
```

From there you can find all the decorated classes in your project : 
```typescript
const modules = workspace.getAllModules();
const components = workspace.getAllComponents();
const directives = workspace.getAllDirectives();
const injectables = workspace.getAllInjectable();
const pipes = workspace.getAllPipes();
```

The **first time** one of the method above is called, `ngast` will run the analysis of the workspace.

The analysis is currently quite long: **>10sec for a small project** can go **beyond 2min for a very large project**.


# Working without Ivy
Version 0.4.0 is built on top of the ViewEngine, you can take a look at the [documentation here](https://ng-ast.github.io/ngast/).

# Example

Projects using ngast:

- [ngrev](https://github.com/mgechev/ngrev) - Tool for reverse engineering of Angular applications.
- [codelyzer](https://github.com/mgechev/codelyzer) - Static code analysis for Angular projects.
- [ngworld](https://github.com/mgechev/ngworld) - Visualization of Angular projects.
- [ng-app-counter](https://github.com/irustm/ng-app-counter) - Counter for Angular applications.
- [ng-pathfinder](https://github.com/vakrilov/ng-pathfinder) - Show a list of all routes in an angular application.
- [ngx-translate-all](https://github.com/irustm/ngx-translate-all) - Tool for automate i18n Angular projects.
- [ngx-translate-migrate](https://github.com/irustm/ngx-translate-migrate) - Tool for migrate from ngx-translate to Angular i18n.

# License

MIT

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