browserify
Advanced tools
Comparing version 16.0.0 to 16.1.0
@@ -67,15 +67,3 @@ var browserify = require('../'); | ||
}); | ||
if (argv.node) { | ||
argv.bare = true; | ||
argv.browserField = false; | ||
} | ||
if (argv.bare) { | ||
argv.builtins = false; | ||
argv.commondir = false; | ||
if (argv.igv === undefined) { | ||
argv.igv = '__filename,__dirname'; | ||
} | ||
} | ||
if (argv.igv) { | ||
@@ -93,2 +81,4 @@ var insertGlobalVars = {}; | ||
var b = browserify(xtend({ | ||
node: argv.node, | ||
bare: argv.bare, | ||
noParse: Array.isArray(argv.noParse) ? argv.noParse : [argv.noParse], | ||
@@ -95,0 +85,0 @@ extensions: [].concat(argv.extension).filter(Boolean).map(function (extension) { |
17
index.js
@@ -47,2 +47,19 @@ var path = require('path'); | ||
else opts = xtend(files, opts); | ||
if (opts.node) { | ||
opts.bare = true; | ||
opts.browserField = false; | ||
} | ||
if (opts.bare) { | ||
opts.builtins = false; | ||
opts.commondir = false; | ||
if (opts.insertGlobalVars === undefined) { | ||
opts.insertGlobalVars = {} | ||
Object.keys(insertGlobals.vars).forEach(function (name) { | ||
if (name !== '__dirname' && name !== '__filename') { | ||
opts.insertGlobalVars[name] = undefined; | ||
} | ||
}) | ||
} | ||
} | ||
@@ -49,0 +66,0 @@ self._options = opts; |
{ | ||
"name": "browserify", | ||
"version": "16.0.0", | ||
"version": "16.1.0", | ||
"description": "browser-side require() the node way", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var test = require('tap').test; | ||
var spawn = require('child_process').spawn; | ||
var browserify = require('../'); | ||
var path = require('path'); | ||
@@ -7,2 +8,3 @@ var concat = require('concat-stream'); | ||
var fs = require('fs'); | ||
var through = require('through2'); | ||
var temp = require('temp'); | ||
@@ -46,2 +48,27 @@ temp.track(); | ||
test('bare api', function (t) { | ||
t.plan(3); | ||
var input = through(); | ||
var b = browserify(input, { bare: true }); | ||
b.bundle().pipe(concat(function (body) { | ||
vm.runInNewContext(body, { | ||
Buffer: function (s) { return s.toLowerCase() }, | ||
console: { | ||
log: function (msg) { t.equal(msg, 'abc') } | ||
} | ||
}); | ||
vm.runInNewContext(body, { | ||
Buffer: Buffer, | ||
console: { | ||
log: function (msg) { | ||
t.ok(Buffer.isBuffer(msg)); | ||
t.equal(msg.toString('utf8'), 'ABC') | ||
} | ||
} | ||
}); | ||
})); | ||
input.end('console.log(Buffer("ABC"))'); | ||
}); | ||
test('bare inserts __filename,__dirname but not process,global,Buffer', function (t) { | ||
@@ -48,0 +75,0 @@ t.plan(2); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
454766
6763
828