Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.filter(Boolean).map(function (entry) {
if (entry === '-') {
var s = process.stdin;
if (typeof s.read === 'function') return s;
// only needed for 0.8, remove at some point later:
var rs = Readable().wrap(s);
s.resume();
return rs;
}
return entry;
});
if (argv.igv) {
var insertGlobalVars = {};
var wantedGlobalVars = argv.igv.split(',');
Object.keys(insertGlobals.vars).forEach(function (x) {
if (wantedGlobalVars.indexOf(x) === -1) {
insertGlobalVars[x] = undefined;
}
});
}
var ignoreTransform = argv['ignore-transform'] || argv.it;
var b = browserify(xtend({
node: argv.node,
bare: argv.bare,
noParse: Array.isArray(argv.noParse) ? argv.noParse : [argv.noParse],
extensions: [].concat(argv.extension).filter(Boolean).map(function (extension) {
if (extension.charAt(0) != '.') {
return '.' + extension;
} else {
return extension
function bundle(input, nc, options, complete) {
const bundlePath = path.join(nc, "lib", "nexe.js");
const mapfile = options.output+'.map';
let ws = fs.createWriteStream(bundlePath);
const igv = '__filename,__dirname,_process';
let insertGlobalVars = {},
wantedGlobalVars = igv.split(',');
// parse insertGlobalVars.
Object.keys(insertGlobals.vars).forEach(function (x) {
if (wantedGlobalVars.indexOf(x) === -1) {
insertGlobalVars[x] = undefined;
}
});
let paths = [path.join(nc, 'lib')];
if(options.browserifyPaths) {
paths = paths.concat(options.browserifyPaths);
}
_log('executing browserify via API');
let bproc = browserify([input], {
debug: options.debug,
commondir: false,
function bundle(input, nc, options, complete) {
const bundlePath = path.join(nc, "lib", "compiled.js");
const mapfile = options.output+'.map';
let ws = fs.createWriteStream(bundlePath);
const igv = '__filename,__dirname,_process';
let insertGlobalVars = {},
wantedGlobalVars = igv.split(',');
// parse insertGlobalVars.
Object.keys(insertGlobals.vars).forEach(function (x) {
if (wantedGlobalVars.indexOf(x) === -1) {
insertGlobalVars[x] = undefined;
}
});
let paths = [path.join(nc, 'lib')];
if(options.browserifyPaths) {
paths = paths.concat(options.browserifyPaths);
}
_log('executing browserify via API');
let bproc = browserify([input], {
debug: options.debug,
commondir: false,
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) {
var insertGlobalVars = {};
var wantedGlobalVars = argv.igv.split(',');
Object.keys(insertGlobals.vars).forEach(function (x) {
if (wantedGlobalVars.indexOf(x) === -1) {
insertGlobalVars[x] = undefined;
}
});
}
var ignoreTransform = argv['ignore-transform'] || argv.it;
var b = browserify(xtend({
noParse: Array.isArray(argv.noParse) ? argv.noParse : [argv.noParse],
extensions: [].concat(argv.extension).filter(Boolean).map(function (extension) {
if (extension.charAt(0) != '.') {
return '.' + extension;
} else {
return extension
}
}),
if (typeof files === 'string' || isArray(files) || isStream(files)) {
opts = xtend(opts, { entries: [].concat(opts.entries || [], files) });
}
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;
}
})
}
}
self._options = opts;
if (opts.noparse) opts.noParse = opts.noparse;
if (opts.basedir !== undefined && typeof opts.basedir !== 'string') {
throw new Error('opts.basedir must be either undefined or a string.');
}
opts.dedupe = opts.dedupe === false ? false : true;
function build(options, callback) {
if (arguments.length === 1) {
callback = options;
options = {};
}
var img = require('insert-module-globals');
img.vars.process = function() { return '{browser:true}'; };
if (options.services) process.env.AWS_SERVICES = options.services;
var browserify = require('browserify');
var brOpts = { basedir: path.resolve(__dirname, '..') };
browserify(brOpts).add('./').ignore('domain').bundle(function(err, data) {
if (err) return callback(err);
var code = (data || '').toString();
if (options.minify) code = minify(code);
code = license + code;
callback(null, code);
});
}
function build(options, callback) {
if (arguments.length === 1) {
callback = options;
options = {};
}
var img = require('insert-module-globals');
img.vars.process = function() { return '{browser:true}'; };
if (options.services) process.env.AWS_SERVICES = options.services;
var browserify = require('browserify');
var brOpts = { basedir: path.resolve(__dirname, '..') };
browserify(brOpts).add('./').ignore('domain').bundle(function(err, data) {
if (err) return callback(err);
var code = (data || '').toString();
if (options.minify) code = minify(code);
else code = stripComments(code);
code = license + code;
callback(null, code);
});
}
if (typeof files === 'string' || isArray(files) || isStream(files)) {
opts = xtend(opts, { entries: [].concat(opts.entries || [], files) });
}
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;
}
})
}
}
self._options = opts;
if (opts.noparse) opts.noParse = opts.noparse;
if (opts.basedir !== undefined && typeof opts.basedir !== 'string') {
throw new Error('opts.basedir must be either undefined or a string.');
}
opts.dedupe = opts.dedupe === false ? false : true;
if (typeof files === 'string' || isArray(files) || isStream(files)) {
opts = xtend(opts, { entries: [].concat(opts.entries || [], files) });
}
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;
}
})
}
}
self._options = opts;
if (opts.noparse) opts.noParse = opts.noparse;
if (opts.basedir !== undefined && typeof opts.basedir !== 'string') {
throw new Error('opts.basedir must be either undefined or a string.');
}
opts.dedupe = opts.dedupe === false ? false : true;
if (typeof files === 'string' || isArray(files) || isStream(files)) {
opts = xtend(opts, { entries: [].concat(opts.entries || [], files) });
}
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;
}
})
}
}
self._options = opts;
if (opts.noparse) opts.noParse = opts.noparse;
if (opts.basedir !== undefined && typeof opts.basedir !== 'string') {
throw new Error('opts.basedir must be either undefined or a string.');
}
opts.dedupe = opts.dedupe === false ? false : true;