npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bromote

v0.2.1

Published

Tool to setup and require remote scripts with browserify.

Downloads

213

Readme

bromote

Tool to setup and require remote scripts with browserify.

Server Side

var browserify  =  require('browserify');
var bromote     =  require('bromote');
var PassThrough =  require('stream').PassThrough;

var remote =
  { jquery:
    { exports: '$',
      url: 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' },
    backbone:
    { deps: { jquery: '$', underscore: '_' },
      exports: 'Backbone',
      url: 'http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js' },
    underscore: 
      { exports: '_',
        url: 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js' } };

var passThrough = new PassThrough();
var bify = browserify();

bromote(bify, remote, function (err) {
  if (err) return console.error(err);
  
  bify
    .require('./main.js', { entry: true })
    .bundle()
    .pipe(passThrough);
});
return passThrough;

Client Side

var bromote = require('bromote');

bromote.backbone(function (backbone) {
  console.log(backbone.$().jquery); // =>  '1.7.1'
});

bromote.jquery(function ($) {
  console.log($().jquery); // =>  '1.7.1'
})

Example derived from this test

For more examples see examples and tests.

JSONP support

Providing a url causes bromote to generate a JSONP callback function and wait for it to be invoked instead of calling back when the script is loaded.

var remote = 
  { jsonpfn: { 
        exports: 'jsonpfn'
      , url: 'http://url/to/jsonp-provider?callback=?' 
    }
  };

Disclaimer

Since you are already using browserify and thus can pull in modules via npm in a version controlled manner, you better have a damn good reason to load scripts from a url.

You loose versioning and are opening your app up to lots of unknowns. Bad things will happen!

If any of the scripts pulled in via a url has a bug, it could potentially crash your app. Since you are loading it dynamically, you have no control over when that happens, i.e. the script could change months after you deployed your app.

So in general please don't do this.

However if you pull in a very large and trusted library like jquery and want to do this via a cdn which hosts specific versions of it, it may be advisable to do so via a script tab or bromote

Why bromote then?

I created bromote to allow people to still use browserify, even if they find themselves in a situation where they are forced to load scripts from urls for whatever reason that is out of their control.

Installation

npm install bromote

Features

  • load dependencies from any url
  • you may use bromote to load external browserify bundles on demand
  • bromote properly resolves and loads nested dependencies in correct order (see example)

API

Server side: bromote(bify, remote, cb)

/**
 * Generates all remote loaders and adds them to browserify instance if it is given.
 * Calls back with paths to generated loaders.
 *
 * @name exports
 * @function
 * @param bify {Object} browserify instance (optional) but recommended
 * @param remote {Object} hashtable containing information about remote scripts for which to generate and add loaders
 * @param cb {Function} called back with paths to generated loaders
 */

Client side: bromote.foo(function (foo) { ... })

Assuming that foo was included as a remote server side, this will resolve it from the remote url and call back with its export once it is loaded.

License

MIT