Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 end () {
if (first) stream.push(Buffer(prelude + '({'));
entries = entries.filter(function (x) { return x !== undefined });
stream.push(Buffer('},{},' + JSON.stringify(entries) + ')'));
if (opts.standalone && !first) {
stream.push(Buffer(
'(' + JSON.stringify(stream.standaloneModule) + ')'
+ umd.postlude(opts.standalone)
));
}
if (sourcemap) {
var comment = sourcemap.comment();
if (opts.sourceMapPrefix) {
comment = comment.replace(
/^\/\/#/, function () { return opts.sourceMapPrefix }
)
}
stream.push(Buffer('\n' + comment + '\n'));
}
if (!sourcemap && !opts.standalone) stream.push(Buffer(';\n'));
stream.push(null);
}
function end () {
if (first) stream.push(Buffer(prelude + '({'));
entries = entries.filter(function (x) { return x !== undefined });
stream.push(Buffer('},{},' + JSON.stringify(entries) + ')'));
if (opts.standalone) {
stream.push(Buffer(
'(' + JSON.stringify(stream.standaloneModule) + ')'
+ umd.postlude(opts.standalone)
));
}
if (sourcemap) {
var comment = sourcemap.comment();
if (opts.sourceMapPrefix) {
comment = comment.replace(
/^\/\/#/, function () { return opts.sourceMapPrefix }
)
}
stream.push(Buffer('\n' + comment + '\n'));
}
if (!sourcemap && !opts.standalone) stream.push(Buffer(';\n'));
stream.push(null);
}
function end () {
if (first) writePrelude.call(this);
if (standalone) {
this.queue('\n(' + mainModule + ')' + umd.postlude(standalone));
}
this.queue('\n;');
this.queue(null);
}
function end () {
if (first) writePrelude.call(this);
if (opts.standalone) {
this.queue(
'\n(' + mainModule + ')'
+ umd.postlude(opts.standalone)
);
}
if (opts.debug) this.queue('\n');
this.queue(null);
}
function end () {
if (first) stream.push(Buffer.from(prelude + '({', 'utf8'));
entries = entries.filter(function (x) { return x !== undefined });
stream.push(
Buffer.from('},{},' + JSON.stringify(entries) + ')', 'utf8')
);
if (opts.standalone && !first) {
stream.push(Buffer.from(
'(' + JSON.stringify(stream.standaloneModule) + ')'
+ umd.postlude(opts.standalone),
'utf8'
));
}
if (sourcemap) {
var comment = sourcemap.comment();
if (opts.sourceMapPrefix) {
comment = comment.replace(
/^\/\/#/, function () { return opts.sourceMapPrefix }
)
}
stream.push(Buffer.from('\n' + comment + '\n', 'utf8'));
}
if (!sourcemap && !opts.standalone) {
stream.push(Buffer.from(';\n', 'utf8'));
}
function end () {
if (first) writePrelude.call(this);
if (standalone) {
this.queue('\n(' + mainModule + ')' + umd.postlude(standalone));
}
this.queue('\n;');
this.queue(null);
}
function end () {
if (first) stream.push(Buffer.from(prelude + '({', 'utf8'));
entries = entries.filter(function (x) { return x !== undefined });
stream.push(
Buffer.from('},{},' + JSON.stringify(entries) + ')', 'utf8')
);
if (opts.standalone && !first) {
stream.push(Buffer.from(
'(' + JSON.stringify(stream.standaloneModule) + ')'
+ umd.postlude(opts.standalone),
'utf8'
));
}
if (sourcemap) {
var comment = sourcemap.comment();
if (opts.sourceMapPrefix) {
comment = comment.replace(
/^\/\/#/, function () { return opts.sourceMapPrefix }
)
}
stream.push(Buffer.from('\n' + comment + '\n', 'utf8'));
}
if (!sourcemap && !opts.standalone) {
stream.push(Buffer.from(';\n', 'utf8'));
}
function end () {
if (first) writePrelude.call(this);
if (opts.standalone) {
this.queue(
'\n(' + mainModule + ')'
+ umd.postlude(opts.standalone)
);
}
if (opts.debug) this.queue('\n');
this.queue(null);
}
WrapCJS.prototype._flush = function(done) {
if (this.first) {
this.writePrelude();
}
if (this.opts.standalone) {
this.push(
'\n(' + JSON.stringify(this.opts.mainModule) + ')'
);
}
if (this.opts.debug) {
this.push('\n');
}
if (this.opts.standalone) {
this.push(umd.postlude(this.opts.standalone));
}
done();
};