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

compile-hook

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compile-hook

a tiny, dummy way to add a hook to the Module.prototype._compile method

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

compile-hook Build Status

a tiny, dummy way to add a hook to the Module.prototype._compile method

#Install

$ npm i -S compile-hook

#Usage

const CompileHook = require('compile-hook');

// place the hook:
CompileHook.placeHook((content, filename, done) => {

    console.log(filename);
    done();
});

// remove the hook
CompileHook.removeHook();

// Place a hook that changes the code on the fly:
CompileHook.placeHook((content, filename, done) => {

    done(content.replace(1492, 622));
});

#GOTCHA

A module that has already been required once will not be hooked again because of the require's cache.

It is possible to remove a module from the cache (remove key in require.cache) and then require it again.

#LICENSE

MIT, see LICENSE file.

Keywords

FAQs

Package last updated on 29 May 2016

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