Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function write (row, enc, next) {
if (first) {
// stream.push(Buffer('console.time("scriptLoad");'));
if (opts.standalone) {
var pre = umd.prelude(opts.standalone).trim();
stream.push(Buffer(pre + 'return '));
}
else if (stream.hasExports) {
pre = opts.externalRequireName || 'require';
stream.push(Buffer(pre + '='));
}
stream.push(Buffer(prelude + '({'));
}
var wrappedModule;
var wrappedSource;
if (evalInline) {
var key = row.sourceFile + '::' + row.nomap + '::' + shasum(row.source);
if (key in cache) {
wrappedModule = cache[key];
} else {
} else {
outro += '\n' + rows.exposeName + '.m[' + JSON.stringify(rows[i].id) + '] = ' + rows[i][kExportsName] + ';'
}
}
var isEntryModule = rows[i].entry && rows[i].hasExports && opts.standalone
// Need this for:
// https://github.com/browserify/browserify/blob/0305b703b226878f3acb5b8f2ff9451c87cd3991/test/debug_standalone.js#L44-L64
var isStandaloneModule = opts.standalone && rows[i].id === stream.standaloneModule
if (isEntryModule || isStandaloneModule) {
outro += '\nreturn ' + rows[i][kExportsName] + ';\n'
}
}
if (opts.standalone) {
intro += umd.prelude(opts.standalone)
outro += umd.postlude(opts.standalone)
} else if (exposesModules) {
intro += dedent`
require = (function (require) {
var ${rows.exposeName} = ${exposedRequireCode};
${rows.exposeName}.m = {};
${rows.exposeName}.r = require;
`
outro += '\n' + dedent`
return ${rows.exposeName};
}(typeof require === 'function' ? require : void 0));
`
} else if (opts.iife || opts.iife == undefined) {
intro += '(function(){\n'
outro += '\n}());'
}
function write (row, enc, next) {
if (first && opts.standalone) {
var pre = umd.prelude(opts.standalone).trim();
stream.push(new Buffer(pre + 'return '));
}
else if (first && stream.hasExports) {
var pre = opts.externalRequireName || 'require';
stream.push(new Buffer(pre + '='));
}
if (first) stream.push(new Buffer(prelude + '({'));
if (row.sourceFile && !row.nomap) {
if (!sourcemap) {
sourcemap = combineSourceMap.create();
sourcemap.addFile(
{ sourceFile: preludePath, source: prelude },
{ line: 0 }
);
}
function write (row, enc, next) {
if (first && opts.standalone) {
var pre = umd.prelude(opts.standalone).trim();
stream.push(Buffer(pre + 'return '));
}
else if (first && stream.hasExports) {
var pre = opts.externalRequireName || 'require';
stream.push(Buffer(pre + '='));
}
if (first) stream.push(Buffer(prelude + '({'));
if (row.sourceFile && !row.nomap) {
if (!sourcemap) {
sourcemap = combineSourceMap.create();
sourcemap.addFile(
{ sourceFile: preludePath, source: prelude },
{ line: 0 }
);
}
function write (row, enc, next) {
if (first && opts.standalone) {
var pre = umd.prelude(opts.standalone).trim();
stream.push(Buffer.from(pre + 'return ', 'utf8'));
}
else if (first && stream.hasExports) {
var pre = opts.externalRequireName || 'require';
stream.push(Buffer.from(pre + '=', 'utf8'));
}
if (first) stream.push(Buffer.from(prelude + '({', 'utf8'));
if (row.sourceFile && !row.nomap) {
if (!sourcemap) {
sourcemap = combineSourceMap.create(null, opts.sourceRoot);
sourcemap.addFile(
{ sourceFile: preludePath, source: prelude },
{ line: 0 }
);
}
function writePrelude () {
if (!first) return;
if (standalone) {
return this.queue(umd.prelude(standalone) + 'return ');
}
if (!hasExports) return this.queue(';');
this.queue('require=');
}
function write (row, enc, next) {
if (first && opts.standalone) {
var pre = umd.prelude(opts.standalone).trim();
stream.push(Buffer.from(pre + 'return ', 'utf8'));
}
else if (first && stream.hasExports) {
var pre = opts.externalRequireName || 'require';
stream.push(Buffer.from(pre + '=', 'utf8'));
}
if (first) stream.push(Buffer.from(prelude + '({', 'utf8'));
if (row.sourceFile && !row.nomap) {
if (!sourcemap) {
sourcemap = combineSourceMap.create(null, opts.sourceRoot);
sourcemap.addFile(
{ sourceFile: preludePath, source: prelude },
{ line: 0 }
);
}
function write (row, enc, next) {
if (first && opts.standalone) {
var pre = umd.prelude(opts.standalone).trim();
stream.push(Buffer(pre + 'return '));
}
else if (first && stream.hasExports) {
var pre = opts.externalRequireName || 'require';
stream.push(Buffer(pre + '='));
}
if (first) stream.push(Buffer(prelude + '({'));
if (row.sourceFile && !row.nomap) {
if (!sourcemap) {
sourcemap = combineSourceMap.create();
sourcemap.addFile(
{ sourceFile: preludePath, source: prelude },
{ line: 0 }
);
}
function writePrelude () {
if (!first) return;
if (opts.standalone) {
return this.queue(umd.prelude(opts.standalone).trim() + 'return ');
}
if (hasExports) this.queue(
(opts.externalRequireName || 'require') + '='
);
}