Socket
Socket
Sign inDemoInstall

browserify-extract-registry

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-extract-registry

Browserify plugin to extract a bundle's module-deps registry to a file.


Version published
Weekly downloads
1.7K
increased by8.9%
Maintainers
1
Weekly downloads
 
Created
Source

browserify-extract-registry

Export a Browserify bundle's "dependency registry," a mapping of modules to their dependencies.

Installation

npm install browserify-extract-registry --save

Usage

// main.js
require('./a');
require('./b');
// a.js
require('c');
// b.js
console.log('do nothing!');
// c.js
console.log('do nothing!');
const extractRegistry = require('browserify-extract-registry');

browserify()
  .add('./main.js')
  .plugin(extractRegistry, {
    outputFile: './registry.json'
  });

This will result in a registry.json like the following. (Note: Browserify assigns modules numeric IDs.)

{
  "1": [2, 3], // "main" requires "a" and "b"
  "2": [4] // "a" requires "c"
  "3": [] // "b" has no deps
  "4": [] // "c" has no deps
}

Plugin configuration

  • outputFile - Write the registy to the specified file path.
  • callback - Callback. First argument is an error, and the second is the registry object.
  • validateRegistry - Boolean. Default: false. Check that each module's dependency is in the registry. If not and outputFile is set, throws error. If not and callback is set, passes error as first argument.
  • sortDeps - Boolean. Default: false. Sort each module's dependency array in the registry, allowing deterministic registries.

Why does this exist?

This plugin is designed for scenarios in which you need outside access to a bundle's dependencies.

It can be used alongside browserify-splitter to compute dependencies and generate dynamic bundles at runtime.

Keywords

FAQs

Package last updated on 12 Apr 2017

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