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

Function createSourceFilesFromBundleBuildInfo

test/fixtures/snapshot/typescript.js:110581–110604  ·  view source on GitHub ↗
(bundle, buildInfoDirectory, host)

Source from the content-addressed store, hash-verified

110579 isImportRequiredByAugmentation: ts.notImplemented,
110580 };
110581 function createSourceFilesFromBundleBuildInfo(bundle, buildInfoDirectory, host) {
110582 var _a;
110583 var jsBundle = ts.Debug.checkDefined(bundle.js);
110584 var prologueMap = ((_a = jsBundle.sources) === null || _a === void 0 ? void 0 : _a.prologues) && ts.arrayToMap(jsBundle.sources.prologues, function (prologueInfo) { return prologueInfo.file; });
110585 return bundle.sourceFiles.map(function (fileName, index) {
110586 var _a, _b;
110587 var prologueInfo = prologueMap === null || prologueMap === void 0 ? void 0 : prologueMap.get(index);
110588 var statements = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.directives.map(function (directive) {
110589 var literal = ts.setTextRange(ts.factory.createStringLiteral(directive.expression.text), directive.expression);
110590 var statement = ts.setTextRange(ts.factory.createExpressionStatement(literal), directive);
110591 ts.setParent(literal, statement);
110592 return statement;
110593 });
110594 var eofToken = ts.factory.createToken(1 /* SyntaxKind.EndOfFileToken */);
110595 var sourceFile = ts.factory.createSourceFile(statements !== null && statements !== void 0 ? statements : [], eofToken, 0 /* NodeFlags.None */);
110596 sourceFile.fileName = ts.getRelativePathFromDirectory(host.getCurrentDirectory(), ts.getNormalizedAbsolutePath(fileName, buildInfoDirectory), !host.useCaseSensitiveFileNames());
110597 sourceFile.text = (_a = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.text) !== null && _a !== void 0 ? _a : "";
110598 ts.setTextRangePosWidth(sourceFile, 0, (_b = prologueInfo === null || prologueInfo === void 0 ? void 0 : prologueInfo.text.length) !== null && _b !== void 0 ? _b : 0);
110599 ts.setEachParent(sourceFile.statements, sourceFile);
110600 ts.setTextRangePosWidth(eofToken, sourceFile.end, 0);
110601 ts.setParent(eofToken, sourceFile);
110602 return sourceFile;
110603 });
110604 }
110605 /*@internal*/
110606 function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110607 var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;

Callers 1

emitUsingBuildInfoFunction · 0.85

Calls 2

mapMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…