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

@wessberg/di-compiler

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wessberg/di-compiler

The compiler for https://www.npmjs.com/package/@wessberg/di

  • 1.0.72
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
438
increased by138.04%
Maintainers
1
Weekly downloads
 
Created
Source

DI-Compiler (The compiler for DI)

NPM version License-mit

Installation

Simply do: npm install @wessberg/di-compiler.

Usage

import {DiCompilerBase} from "@wessberg/di-compiler";

// Instantiate the compiler
const compiler = new DiCompilerBase();

// The 'compile' method will upgrade all 'registerSingleton', 'registerTransient', 'get' and 'has' calls throughout the code
// and resolve the constructor arguments of all classes that matches the provided services
const compiled = compiler.compile({
  file: "a_file.ts",
  code: `class Foo implements IFoo {}
         DIContainer.registerSingleton<IFoo, Foo>();`
});
compiled.code; // The updated code
compiled.hasChanged; // is true if the source code was upgraded
compiled.map // Holds a SourceMap reflecting the changes

If you are using Rollup, then use rollup-plugin-di to compile your code automatically as part of your bundle, rather than using this compiler.

Keywords

FAQs

Package last updated on 13 Jun 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