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

@travetto/transformer

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/transformer

Functionality for AST transformations, with transformer registration, and general utils

  • 1.0.0-rc.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-80.56%
Maintainers
1
Weekly downloads
 
Created
Source

travetto: Transform

Install: primary

$ npm install @travetto/transformer

This module provides support for enhanced AST transformations, and transformer registration, with support for common AST transformation patterns to facilitate all the transformers used throughout the framework. Transformations are defined by support/transformer.<name>.ts as the filename. The schema for a transformer is:

Code: Sample transformer, registration and execution

  export class CustomerTransformer {
    after: ['base'],
    phase: 'before'|'after', // The phase as defined by Typescript's AST processing
    transformer: (context: ts.TransformationContext) => {
       return (file: ts.SourceFile) => {
         ... modify source file ...
         return file;
       }
    }
  }

Advanced

When dealing with transformers, logging is somewhat tricky as the compiler executes before the code is loaded. To that end, a file compiler.log is created in the cache directory during the compilation process. This is a location that transformers should be free to log to, for debugging, and any additional feedback.

Keywords

FAQs

Package last updated on 14 Jun 2020

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