1.1.1 • Published 9 years ago

rewrite-js-dependencies v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

rewrite-js-dependencies

NPM version Build status Test coverage Dependency Status License Downloads Gittip

Rewrite your JS dependencies using es6-module-crosspiler. Supports rewriting both ES6 modules as well as CommonJS modules. You may optionally run everything in a separate child process to avoid killing your event queue with crazy AST stuff!

API

rewrite(string, renames).then( out => )

var rewrite = require('rewrite-js-dependencies')

rewrite('import "a";', {
  a: 'b'
}).then(function (val) {
  assert.equal(val, 'import "b";')
})

Using child processes

Child processes are supported via slave. To use child processes:

// run all the logic in a different process
var rewrite = require('rewrite-js-dependencies/master')
// spin up a second child process
rewrite.fork()
// spin up a third
rewrite.fork()

rewrite('import "a";', {
  a: 'b'
}).then(function (val) {
  assert.equal(val, 'import "b";')
})