New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ts-extractor

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-extractor

TypeScript AST extractor to useful JSON structure.

  • 3.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

ts-extractor

NPM version Build Status Coverage Status dependencies Status devDependencies Status devDependencies Status

TypeScript AST extractor to useful JSON structure.

The purpose of this package is to extract AST into flat JSON structures.

Later on, it can be used for documentation generation tool, easier code analysis with without compiler, etc.

Usage example

import * as path from "path";
import * as process from "process";
import { Extractor, GetCompilerOptions } from "ts-extractor";

async function Main(): Promise<void> {
    // Absolute path to projectDirectory
    const projectDirectory = process.cwd();
    const pathToTsconfig = path.join(projectDirectory, "./tsconfig.json");

    const compilerOptions = await GetCompilerOptions(pathToTsconfig);

    const extractor = new Extractor({
        CompilerOptions: compilerOptions,
        ProjectDirectory: projectDirectory
    });

    const extractedOutput = extractor.Extract(["./src/index.ts", "./src/another-entry-file.ts"]);
    console.log(extractedOutput);
}

Main();

Keywords

FAQs

Package last updated on 09 Jan 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc