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

runtime-required

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runtime-required

runtime-required

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.5K
decreased by-19.38%
Maintainers
1
Weekly downloads
 
Created
Source

runtime-required

travis score-codeclimate npm-downloads npm-version dm-david

Haven't you ever always needed to know what files are being required by your app? Okay, maybe not always, but once? No? Just me? Fine, move along then. But in case you need it, here's how it all works:

Install

It's in npm, of course:

npm install runtime-required

Usage

require('runtime-required')EventEmitter

Yup, you just include it in your project and it exposes an event emitter. There is only a single file event, and it has the following properties:

  • type {string}: one of
    • builtin (node's default modules)
    • module (ones that appear inside the node_modules directory)
    • file (from your own project... or I guess elsewhere on the filesystem)
  • id {string}: the identifier for this module. For module and file types, it will be a fully-resolved file path. For builtin types, it will be the name of the module.

Example

const required = require('runtime-required');

required.on('file', data => {
  console.log(`a ${data.type} module was required at "${data.id}"`);
});

Keywords

FAQs

Package last updated on 17 Aug 2021

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