Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

ngast

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngast

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

latest
Source
npmnpm
Version
0.6.2
Version published
Weekly downloads
1.9K
32.52%
Maintainers
2
Weekly downloads
 
Created
Source

Build Status

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 :

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 :

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.

Example

Projects using ngast:

  • ngrev - Tool for reverse engineering of Angular applications.
  • codelyzer - Static code analysis for Angular projects.
  • ngworld - Visualization of Angular projects.
  • ng-app-counter - Counter for Angular applications.
  • ng-pathfinder - Show a list of all routes in an angular application.
  • ngx-translate-all - Tool for automate i18n Angular projects.
  • ngx-translate-migrate - Tool for migrate from ngx-translate to Angular i18n.

License

MIT

Keywords

AST

FAQs

Package last updated on 18 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts