browserify-derequire
Advanced tools
Comparing version 0.9.3 to 0.9.4
23
index.js
@@ -25,3 +25,2 @@ /* | ||
var fs = require("fs"); | ||
var through = require("through2"); | ||
@@ -32,6 +31,6 @@ var derequire = require("derequire"); | ||
module.exports = function (browserify, opts) { | ||
/* hook into the bundle generation pipeline of Browserify */ | ||
browserify.on("bundle", function (pipeline) { | ||
/* create a transform stream */ | ||
var createStream = function () { | ||
var code = ""; | ||
pipeline.get("wrap").push(through.obj(function (buf, enc, next) { | ||
var stream = through.obj(function (buf, enc, next) { | ||
/* accumulate the code chunks */ | ||
@@ -43,9 +42,17 @@ code += buf.toString(); | ||
if (opts.derequire === undefined) | ||
opts.derequire = [ { from: "require", to: "_dereq_" } ] | ||
code = derequire(code, opts.derequire) | ||
this.push(new Buffer(code)) | ||
opts.derequire = [ { from: "require", to: "_dereq_" } ]; | ||
code = derequire(code, opts.derequire); | ||
this.push(new Buffer(code)); | ||
next(); | ||
})); | ||
}); | ||
stream.label = "derequire"; | ||
return stream; | ||
}; | ||
/* hook into the bundle generation pipeline of Browserify */ | ||
browserify.pipeline.get("wrap").push(createStream()); | ||
browserify.on("reset", function () { | ||
browserify.pipeline.get("wrap").push(createStream()); | ||
}); | ||
}; | ||
{ | ||
"name": "browserify-derequire", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"description": "Browserify Plugin for Renaming require() Calls", | ||
@@ -5,0 +5,0 @@ "keywords": [ "browserify-plugin", "browserify", "plugin", "derequire" ], |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
5770
51
0