Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
values.splice(3, 0,
'arguments[3]','arguments[4]',
'arguments[5]','arguments[6]'
);
wrappedSource = '(function (' + names.join(',') + '){\n'
+ src + '\n}).call(this,' + values.join(',') + ')';
}
// Generate source maps if wanted. Including the right offset for
// the wrapped source.
if (!opts.debug) {
return wrappedSource;
}
var sourceFile = path.relative(opts.basedir, file)
.replace(/\\/g, '/');
var sourceMap = combineSourceMap.create().addFile(
{ sourceFile: sourceFile, source: src},
{ line: 1 });
return combineSourceMap.removeComments(wrappedSource) + "\n"
+ sourceMap.comment();
}
values.splice(3, 0,
'arguments[3]','arguments[4]',
'arguments[5]','arguments[6]'
);
wrappedSource = '(function (' + names.join(',') + '){\n'
+ src + '\n}).call(this,' + values.join(',') + ')';
}
// Generate source maps if wanted. Including the right offset for
// the wrapped source.
if (!opts.debug) {
return wrappedSource;
}
var sourceFile = path.relative(opts.basedir, file)
.replace(/\\/g, '/');
var sourceMap = combineSourceMap.create().addFile(
{ sourceFile: sourceFile, source: src},
{ line: 1 });
return combineSourceMap.removeComments(wrappedSource) + "\n"
+ sourceMap.comment();
}
values.splice(3, 0,
'arguments[3]','arguments[4]',
'arguments[5]','arguments[6]'
);
wrappedSource = '(function (' + names.join(',') + '){\n'
+ src + '\n}).call(this,' + values.join(',') + ')';
}
// Generate source maps if wanted. Including the right offset for
// the wrapped source.
if (!opts.debug) {
return wrappedSource;
}
var sourceFile = path.relative(opts.basedir, file)
.replace(/\\/g, '/');
var sourceMap = combineSourceMap.create().addFile(
{ sourceFile: sourceFile, source: src},
{ line: 1 });
return combineSourceMap.removeComments(wrappedSource) + "\n"
+ sourceMap.comment();
}
].join('\n');
hasComment = true; // now we have base64 comment
} catch (err) {
// Don't attempt to handle source maps for this file,
// it is most likely a comment about source maps and not
// a *real* source map comment!
}
}
var wrapScript = moduleWrap(script);
// do not make any more alterations to the source maps
if (hasComment || hasMapFile) return wrapScript;
// Otherwise, if no source maps exist, we can generate a new one
var sourceMap = combineSourceMap.create(sourceFileName, basedir)
.addFile({ sourceFile: sourceFile, source: original });
return [
combineSourceMap.removeComments(wrapScript),
sourceMap.comment()
].join('\n');
};
source: "function b()\n{\n\tconsole.log(\"b1\");\n\tconsole.log(\"b2\");\n\tconsole.log(\"b3\");\n}" + "\n" + bComment
, sourceFile: "b.js"
};
var cFile = {
source: "function c()\n{\n\tconsole.log(\"c1\");\n\tconsole.log(\"c2\");\n\tconsole.log(\"c3\");\n}" + "\n" + cComment
, sourceFile: "c.js"
};
var dFile = {
source: "function d()\n{\n\tconsole.log(\"d1\");\n\tconsole.log(\"d2\");\n\tconsole.log(\"d3\");\n}" + "\n" + dComment
, sourceFile: "d.js"
};
var offset = { line: 2 };
var base64 = combine
.create("bundle.js")
.addFile(aFile, offset)
.addFile(bFile, { line: offset.line + 8 })
//.addFile(cFile, { line: offset.line + 16 })
//.addFile(dFile, { line: offset.line + 24 })
.base64();
console.log(base64);
//var sm = convert.fromBase64(base64).toObject();
//console.log("Combined source maps:\n", sm);
//console.log("\nMappings:\n", sm.mappings);
cache[key] = wrappedModule;
}
wrappedSource = sourceWrapper(first, wrappedModule, row.id, row.deps);
sourcemap = null;
} else if (evalSourceUrl) {
if (row.sourceFile && !row.nomap) {
wrappedModule = wrapEval(row.source,
'//# sourceURL=' + row.sourceRoot + '/' + row.sourceFile);
} else {
wrappedModule = wrapEval(row.source);
}
wrappedSource = sourceWrapper(first, wrappedModule, row.id, row.deps);
} else {
if (row.sourceFile && !row.nomap) {
if (!sourcemap) {
sourcemap = combineSourceMap.create();
sourcemap.addFile(
{ sourceFile: preludePath, source: prelude },
{ line: 0 }
);
}
sourcemap.addFile(
{ sourceFile: row.sourceFile, source: row.source },
{ line: lineno }
);
}
wrappedModule = wrapSimple(row.source);
wrappedSource = sourceWrapper(first, wrappedModule, row.id, row.deps);
lineno += newlinesIn(wrappedSource);
}
stream.push(Buffer(wrappedSource));
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 {
if (row.sourceFile && !row.nomap) {
sourcemap = combineSourceMap.create();
sourcemap.addFile(
{ sourceFile: row.sourceFile, source: row.source },
{ line: 1 }
);
wrappedModule = wrapEval(row.source, sourcemap.comment());
} else {
wrappedModule = wrapEval(row.source);
}
cache[key] = wrappedModule;
}
wrappedSource = sourceWrapper(first, wrappedModule, row.id, row.deps);
sourcemap = null;
} else if (evalSourceUrl) {
if (row.sourceFile && !row.nomap) {
wrappedModule = wrapEval(row.source,
'//# sourceURL=' + row.sourceRoot + '/' + row.sourceFile);
function flatten (rows, opts, stream) {
rows.byId = Object.create(null)
rows.forEach(function (row) { rows.byId[row.id] = row })
var containsCycles = detectCycles(rows)
var combiner = opts.debug ? combineSourceMap.create() : null
var intro = ''
var outro = ''
rows.usedGlobalVariables = new Set()
rows.exposeName = generateName(rows, 'exposedRequire')
rows.createModuleFactoryName = generateName(rows, 'createModuleFactory')
rows.forEach(function (row, index, rows) {
parseModule(row, index, rows, opts)
})
sortModules(rows)
rows.forEach(identifyGlobals)
rows.forEach(markDuplicateVariableNames)
rows.forEach(rewriteModule)
moveOnDemandModulesToStart(rows)
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 }
);
}
sourcemap.addFile(
{ sourceFile: row.sourceFile, source: row.source },
{ line: lineno }
);
}
var wrappedSource = [
(first ? '' : ','),
JSON.stringify(row.id),
':[',
'function(require,module,exports){\n',