Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@ts-morph/common
Advanced tools
@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.
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());
The official TypeScript package provides the TypeScript compiler API, which allows you to work with TypeScript AST and perform code manipulations. While it offers a comprehensive set of features, it is more low-level compared to @ts-morph/common, which provides higher-level abstractions and utilities.
ts-simple-ast is a library that simplifies working with the TypeScript compiler API. It provides a more user-friendly API for manipulating TypeScript code. However, it has been deprecated in favor of ts-morph, which includes @ts-morph/common.
Babel is a JavaScript compiler that can also parse and transform TypeScript code. While it is not specifically designed for TypeScript, it provides powerful tools for code transformations and AST manipulations. It is more general-purpose compared to @ts-morph/common.
Common functionality for ts-morph and @ts-morph/bootstrap.
Please do not depend on this library!
FAQs
Common functionality for ts-morph packages.
The npm package @ts-morph/common receives a total of 3,248,258 weekly downloads. As such, @ts-morph/common popularity was classified as popular.
We found that @ts-morph/common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.