browserify
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -8,2 +8,3 @@ var detective = require('detective'); | ||
var wrappers = require('./wrappers'); | ||
var commondir = require('commondir'); | ||
var nub = require('nub'); | ||
@@ -103,4 +104,6 @@ | ||
Wrap.prototype.addEntry = function (file) { | ||
var body = this.readFile(file); | ||
Wrap.prototype.addEntry = function (file, opts) { | ||
var self = this; | ||
var body = self.readFile(file); | ||
if (!opts) opts = {}; | ||
@@ -117,9 +120,10 @@ var required = detective.find(body); | ||
var dir = path.dirname(path.resolve(process.cwd(), file)); | ||
if (!opts.root) { | ||
opts.root = commondir(dir, required.strings.concat(file)); | ||
} | ||
this.require(required.strings.map(function (r) { | ||
if (r.match(/^(\.\.?)?\//)) { | ||
return path.resolve(dir, r); | ||
} | ||
else return r; | ||
})); | ||
required.strings.forEach(function (r) { | ||
var x = r.match(/^(\.\.?)?\//) ? path.resolve(opts.root, r) : r; | ||
self.require(x, { root : opts.root }); | ||
}); | ||
@@ -126,0 +130,0 @@ this.entries[file] = this.appends.length; |
{ | ||
"name" : "browserify", | ||
"version" : "1.2.3", | ||
"version" : "1.2.4", | ||
"description" : "Browser-side require() for js directories and npm modules", | ||
@@ -27,2 +27,3 @@ "main" : "./index.js", | ||
"nub" : "0.0.x", | ||
"commondir" : "0.0.x", | ||
"coffee-script" : ">=1.1.1 <1.2" | ||
@@ -29,0 +30,0 @@ }, |
@@ -23,1 +23,19 @@ var assert = require('assert'); | ||
}; | ||
exports.coffeeEntry = function () { | ||
var b = browserify({ entry : __dirname + '/coffee/entry.coffee' }); | ||
var src = b.bundle(); | ||
var to = setTimeout(function () { | ||
assert.fail('never called done'); | ||
}, 5000); | ||
var c = { | ||
setTimeout : setTimeout, | ||
done : function (fn) { | ||
clearTimeout(to); | ||
assert.equal(fn(10), 100); | ||
} | ||
}; | ||
vm.runInNewContext(src, c); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63888
85
1563
5
+ Addedcommondir@0.0.x
+ Addedcommondir@0.0.2(transitive)