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

Function emitUsingBuildInfo

test/fixtures/snapshot/typescript.js:110606–110697  ·  view source on GitHub ↗
(config, host, getCommandLine, customTransformers)

Source from the content-addressed store, hash-verified

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;
110608 var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110609 if (!buildInfoText)
110610 return buildInfoPath;
110611 var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110612 if (!jsFileText)
110613 return jsFilePath;
110614 var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110615 // error if no source map or for now if inline sourcemap
110616 if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110617 return sourceMapFilePath || "inline sourcemap decoding";
110618 // read declaration text
110619 var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110620 if (declarationFilePath && !declarationText)
110621 return declarationFilePath;
110622 var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110623 // error if no source map or for now if inline sourcemap
110624 if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110625 return declarationMapPath || "inline sourcemap decoding";
110626 var buildInfo = getBuildInfo(buildInfoText);
110627 if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110628 return buildInfoPath;
110629 var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110630 var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110631 /*onlyOwnText*/ true);
110632 var outputFiles = [];
110633 var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110634 var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110635 var emitHost = {
110636 getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110637 getCanonicalFileName: host.getCanonicalFileName,
110638 getCommonSourceDirectory: function () { return ts.getNormalizedAbsolutePath(buildInfo.bundle.commonSourceDirectory, buildInfoDirectory); },
110639 getCompilerOptions: function () { return config.options; },
110640 getCurrentDirectory: function () { return host.getCurrentDirectory(); },
110641 getNewLine: function () { return host.getNewLine(); },
110642 getSourceFile: ts.returnUndefined,
110643 getSourceFileByPath: ts.returnUndefined,
110644 getSourceFiles: function () { return sourceFilesForJsEmit; },
110645 getLibFileFromReference: ts.notImplemented,
110646 isSourceFileFromExternalLibrary: ts.returnFalse,
110647 getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110648 getProjectReferenceRedirect: ts.returnUndefined,
110649 isSourceOfProjectReferenceRedirect: ts.returnFalse,
110650 writeFile: function (name, text, writeByteOrderMark) {
110651 switch (name) {
110652 case jsFilePath:
110653 if (jsFileText === text)
110654 return;
110655 break;
110656 case sourceMapFilePath:
110657 if (sourceMapText === text)
110658 return;
110659 break;
110660 case buildInfoPath:
110661 var newBuildInfo = getBuildInfo(text);
110662 newBuildInfo.program = buildInfo.program;
110663 // Update sourceFileInfo

Callers

nothing calls this directly

Calls 9

getOutputPathsForBundleFunction · 0.85
getBuildInfoFunction · 0.85
getBuildInfoTextFunction · 0.85
emitFilesFunction · 0.85
concatMethod · 0.80
readFileMethod · 0.45
pushMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…