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

@ts-morph/common

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-morph/common

Common functionality for ts-morph packages.

  • 0.21.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9M
decreased by-43.49%
Maintainers
1
Weekly downloads
 
Created

What is @ts-morph/common?

@ts-morph/common is a library that provides common utilities and types for working with the TypeScript compiler API. It is part of the ts-morph project, which aims to make it easier to work with TypeScript AST (Abstract Syntax Tree) and perform code manipulations.

What are @ts-morph/common's main functionalities?

File System Operations

This feature allows you to create custom file system hosts to handle file operations. You can override methods like `readFileSync` and `writeFileSync` to provide custom implementations.

const { FileSystemHost } = require('@ts-morph/common');

class CustomFileSystemHost extends FileSystemHost {
  readFileSync(filePath) {
    // Custom implementation
  }

  writeFileSync(filePath, data) {
    // Custom implementation
  }
}

const fsHost = new CustomFileSystemHost();

Logging

This feature provides a logging utility that you can configure with different log levels and custom write functions. It helps in debugging and monitoring the operations performed by the library.

const { Logger } = require('@ts-morph/common');

const logger = new Logger({
  logLevel: 'info',
  write: (text) => console.log(text)
});

logger.info('This is an info message');

Compiler Options

This feature allows you to manage TypeScript compiler options in a structured way. You can set and get compiler options easily using the `CompilerOptionsContainer`.

const { CompilerOptionsContainer } = require('@ts-morph/common');

const compilerOptions = new CompilerOptionsContainer();
compilerOptions.set({
  target: 'ES6',
  module: 'commonjs'
});

console.log(compilerOptions.get());

Other packages similar to @ts-morph/common

FAQs

Package last updated on 21 Sep 2023

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