Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@danmarshall/ts-extractor

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danmarshall/ts-extractor

TypeScript AST extractor to useful JSON structure.

  • 4.0.1-rc.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-79.17%
Maintainers
1
Weekly downloads
 
Created
Source

ts-extractor

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

TypeScript AST extractor to a useful JSON structure.

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

After extraction, it can be used for documentation generation tool, easier code analysis without compiler, etc.

Relation to API Extractor

The library is inspired by API Extractor created by Microsoft.

ts-extractor does everything api-extractor was supposed to do and supports ALL things that latest TypeScript has, compared to a limited support in api-extractor.

In essence, it is an evolution of what api-extractor does, though outputs are not interchangable directly.

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 04 Oct 2019

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