bin/roll.js in snowball-0.1.4 vs bin/roll.js in snowball-0.1.5
- old
+ new
@@ -88,18 +88,22 @@
// Using the browserify internal bundle.entries array - (yup, asking for trouble).
// Todo: file a feature request for setting env variables in __browserify_process
bundle.entries['/__browserify_process__setenv'] = {
body: ''+
'var __browserify_process = require("__browserify_process"),' +
- ' env = '+JSON.stringify(argv.env)+';' +
- 'Object.keys(env).forEach(function(varname) {'+
- ' if (!(varname in __browserify_process.env)) {'+
- ' __browserify_process.env[varname] = env[varname];'+
- ' }' +
- ' else {' +
- ' console.log("Environment variable already set in browserify environment: %s", varname);' +
+ ' env = '+JSON.stringify(argv.env)+',' +
+ ' hasProp = Object.prototype.hasOwnProperty;' +
+ 'for (var key in env) {'+
+ ' if (!hasProp.call(env, key)) { continue; }'+
+ ' if (hasProp.call(__browserify_process.env, key)) {'+
+ ' if ((typeof console) != "undefined" && (typeof console.log) == "function") {'+
+ ' console.log("Environment variable already set in browserify environment: %s", key);' +
+ ' }' +
+ ' continue;' +
' }'+
- '})'};
+ ' __browserify_process.env[key] = env[key];'+
+ '}'
+ };
}
([].concat(argv.require || [])).forEach(function (req) {
bundle.require(req);
});