How to use the ngast.ProjectSymbols function in ngast

To help you get started, we’ve selected a few ngast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github irustm / ng-app-counter / src / counter.ts View on Github external
` ${count1 ? chalk.default.blue(count1) : ''}` +
        ` ${count2 ? '/ ' + chalk.default.yellowBright(count2) : ''}`
    );
  };

  let projectPath = (minimist(process.argv.slice(2)) as any).p;
  if (!projectPath) {
    projectPath = './tsconfig.json';
  }
  if (!existsSync(projectPath)) {
    error('Cannot find tsconfig at "' + projectPath + '".');
    process.exit(1);
  }
  console.log('Parsing...');
  let parseError: any = null;
  const projectSymbols = new ProjectSymbols(
    projectPath,
    resourceResolver,
    e => (parseError = e)
  );

  const allModules: ModuleSymbol[] = projectSymbols.getModules();
  const allPipes: PipeSymbol[] = projectSymbols.getPipes();
  const allProviders: ProviderSymbol[] = projectSymbols.getProviders();
  const allDirectives: DirectiveSymbol[] = projectSymbols.getDirectives();
  const treeMod = new ModuleTree();

  if (!parseError) {
    console.log('');
    console.log('Results:');
    console.log('');
    // Count modules
github mgechev / ngworld / parser / index.ts View on Github external
export const parse = (projectPath: string) => {
  const project = new ProjectSymbols(
    createProgramFromTsConfig(projectPath),
    {
      getSync: (path: string) => readFileSync(path).toString(),
      get: (path: string) =>
        new Promise((resolve, reject) =>
          readFile(path, (error, content) => (error ? reject(error) : resolve(content.toString())))
        )
    },
    (error: string, path: string) => console.error(error, path)
  );

  return formatContext(project);
};
github mgechev / ngrev / app / processor.js View on Github external
Project.prototype.load = function (tsconfig, reporter) {
        this.projectSymbols = new ngast.ProjectSymbols(tsconfig, {
            get: function (name) {
                return new Promise(function (resolve, reject) {
                    fs.readFile(name, function (e, data) {
                        if (e)
                            reject(e);
                        else
                            resolve(data.toString());
                    });
                });
            },
            getSync: function (name) {
                return fs.readFileSync(name, { encoding: 'utf-8' });
            }
        }, reporter);
        return Promise.resolve(this.projectSymbols);
    };
github mgechev / ngrev / src / background / model / project.ts View on Github external
load(tsconfig: string, reporter: ErrorReporter) {
    this.projectSymbols = new ProjectSymbols(
      tsconfig,
      {
        get(name: string) {
          return new Promise((resolve: any, reject: any) => {
            readFile(name, (e, data) => {
              if (e) reject(e);
              else resolve(data.toString());
            });
          });
        },
        getSync(name: string) {
          return readFileSync(name, { encoding: 'utf-8' });
        }
      },
      reporter
    );

ngast

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

MIT
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis