Socket
Socket
Sign inDemoInstall

browsify

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    browsify

Batch convert CommonJS modules into browser compatible ones


Version published
Weekly downloads
83
increased by102.44%
Maintainers
1
Install size
140 kB
Created
Weekly downloads
 

Readme

Source

Browsify

NPM version

Dependency Status

Batch convert CommonJS modules into a browser compatible package.

Installation

npm install -g browsify

CLI Examples

browsify path/file.js >> modules.js
browsify path/to/files/ >> modules.js
browsify ../../relative/path/lib --truncate-prefix ../../relative/path/ >> modules.js
browsify path/to/files/ --namespace objname >> modules.js

For more options.

browsify -h

Using In Code

npm install browsify

then require the processor module..

var processor = require('browsify').processor,
    opts = {}; // ex: {namespae: "foo"}

processor.compile(["file.js", "file2.js"], opts,  function (str) {
    process.stdout.write(str);
});

Before Running Locally

./configure

Use Case Example

browsify lib/foo.js >> modules.js

modules.js looks like:

// browser-require

// for each module
require.define('lib/foo', function (require, module, exports) {
   // actual code defined in lib/foo.js
   module.exports = {
       bar: function () {}
   };
});

..and in the browser you would require the module as expected.

var foo = require('lib/foo');

..or if there was a --namespace ns specified, you would require it as so.

var foo = ns.require('lib/foo');

Versioning

This project ascribes to semantic versioning.

FAQs

Last updated on 16 Aug 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc