MCPcopy Index your code
hub / github.com/nodejs/node / writeBundle

Function writeBundle

test/fixtures/snapshot/typescript.js:110865–110925  ·  view source on GitHub ↗
(bundle, output, sourceMapGenerator)

Source from the content-addressed store, hash-verified

110863 return false;
110864 }
110865 function writeBundle(bundle, output, sourceMapGenerator) {
110866 var _a;
110867 isOwnFileEmit = false;
110868 var previousWriter = writer;
110869 setWriter(output, sourceMapGenerator);
110870 emitShebangIfNeeded(bundle);
110871 emitPrologueDirectivesIfNeeded(bundle);
110872 emitHelpers(bundle);
110873 emitSyntheticTripleSlashReferencesIfNeeded(bundle);
110874 for (var _b = 0, _c = bundle.prepends; _b < _c.length; _b++) {
110875 var prepend = _c[_b];
110876 writeLine();
110877 var pos = writer.getTextPos();
110878 var savedSections = bundleFileInfo && bundleFileInfo.sections;
110879 if (savedSections)
110880 bundleFileInfo.sections = [];
110881 print(4 /* EmitHint.Unspecified */, prepend, /*sourceFile*/ undefined);
110882 if (bundleFileInfo) {
110883 var newSections = bundleFileInfo.sections;
110884 bundleFileInfo.sections = savedSections;
110885 if (prepend.oldFileOfCurrentEmit)
110886 (_a = bundleFileInfo.sections).push.apply(_a, newSections);
110887 else {
110888 newSections.forEach(function (section) { return ts.Debug.assert(ts.isBundleFileTextLike(section)); });
110889 bundleFileInfo.sections.push({
110890 pos: pos,
110891 end: writer.getTextPos(),
110892 kind: "prepend" /* BundleFileSectionKind.Prepend */,
110893 data: relativeToBuildInfo(prepend.fileName),
110894 texts: newSections
110895 });
110896 }
110897 }
110898 }
110899 sourceFileTextPos = getTextPosWithWriteLine();
110900 for (var _d = 0, _e = bundle.sourceFiles; _d < _e.length; _d++) {
110901 var sourceFile = _e[_d];
110902 print(0 /* EmitHint.SourceFile */, sourceFile, sourceFile);
110903 }
110904 if (bundleFileInfo && bundle.sourceFiles.length) {
110905 var end = writer.getTextPos();
110906 if (recordBundleFileTextLikeSection(end)) {
110907 // Store prologues
110908 var prologues = getPrologueDirectivesFromBundledSourceFiles(bundle);
110909 if (prologues) {
110910 if (!bundleFileInfo.sources)
110911 bundleFileInfo.sources = {};
110912 bundleFileInfo.sources.prologues = prologues;
110913 }
110914 // Store helpes
110915 var helpers = getHelpersFromBundledSourceFiles(bundle);
110916 if (helpers) {
110917 if (!bundleFileInfo.sources)
110918 bundleFileInfo.sources = {};
110919 bundleFileInfo.sources.helpers = helpers;
110920 }
110921 }
110922 }

Callers 1

printBundleFunction · 0.85

Calls 15

setWriterFunction · 0.85
emitShebangIfNeededFunction · 0.85
emitHelpersFunction · 0.85
relativeToBuildInfoFunction · 0.85
getTextPosWithWriteLineFunction · 0.85
assertMethod · 0.80
writeLineFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…