DailyJS

jspm.io

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

node modules npm

jspm.io

Posted by Alex R. Young on .
Featured

node modules npm

jspm.io

Posted by Alex R. Young on .

jspm.io

jspm.io (GitHub: jspm / jspm-cli, License: Apache 2.0, npm: jspm) by Guy Bedford is a browser package manager that supports the ES6, AMD, and CommonJS module formats. It uses SystemJS to load modules based on the ES6 module loader specification.

Loading modules in browsers looks like this:

// a specific module from the latest version of an npm package:
System.import('npm:lodash-node/modern/collections').then(function(collections) {  
  collections.max([1,2,3,4]); // 4
});

// a semver-compatible version of jquery:
System.import('github:components/jquery@^2.0.3').then(function($) {  
});

Notice that it allows modules to be loaded based on semantic version numbers -- you can use it to load modules from a CDN this way, or on the command-line: jspm install npm:lodash-node jquery@^2.0.3.

The design of the API means you can use ES6 modules now, but still get the benefits of a Node-powered command-line tool for quickly downloading and building local bundles.

It has its own registry, so naturally the author is looking for pull requests to get new modules listed. The current registries use SPDY, which has some advantages for a module loading system. Once you're ready to roll out projects to production, you can use the jspm command-line tool to inject package configuration and specific versions of the dependencies.