MCPcopy Create free account
hub / github.com/nodejs/node / emitSourceFileOrBundle

Function emitSourceFileOrBundle

test/fixtures/snapshot/typescript.js:110252–110293  ·  view source on GitHub ↗
(_a, sourceFileOrBundle)

Source from the content-addressed store, hash-verified

110250 exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
110251 };
110252 function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
110253 var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
110254 var buildInfoDirectory;
110255 if (buildInfoPath && sourceFileOrBundle && ts.isBundle(sourceFileOrBundle)) {
110256 buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110257 bundleBuildInfo = {
110258 commonSourceDirectory: relativeToBuildInfo(host.getCommonSourceDirectory()),
110259 sourceFiles: sourceFileOrBundle.sourceFiles.map(function (file) { return relativeToBuildInfo(ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory())); })
110260 };
110261 }
110262 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "emitJsFileOrBundle", { jsFilePath: jsFilePath });
110263 emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo);
110264 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
110265 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "emitDeclarationFileOrBundle", { declarationFilePath: declarationFilePath });
110266 emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo);
110267 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
110268 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "emitBuildInfo", { buildInfoPath: buildInfoPath });
110269 emitBuildInfo(bundleBuildInfo, buildInfoPath);
110270 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
110271 if (!emitSkipped && emittedFilesList) {
110272 if (!emitOnlyDtsFiles) {
110273 if (jsFilePath) {
110274 emittedFilesList.push(jsFilePath);
110275 }
110276 if (sourceMapFilePath) {
110277 emittedFilesList.push(sourceMapFilePath);
110278 }
110279 if (buildInfoPath) {
110280 emittedFilesList.push(buildInfoPath);
110281 }
110282 }
110283 if (declarationFilePath) {
110284 emittedFilesList.push(declarationFilePath);
110285 }
110286 if (declarationMapPath) {
110287 emittedFilesList.push(declarationMapPath);
110288 }
110289 }
110290 function relativeToBuildInfo(path) {
110291 return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
110292 }
110293 }
110294 function emitBuildInfo(bundle, buildInfoPath) {
110295 // Write build information if applicable
110296 if (!buildInfoPath || targetSourceFile || emitSkipped)

Callers

nothing calls this directly

Calls 7

relativeToBuildInfoFunction · 0.85
emitJsFileOrBundleFunction · 0.85
emitBuildInfoFunction · 0.85
popMethod · 0.80
mapMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected