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

Function emitJsFileOrBundle

test/fixtures/snapshot/typescript.js:110306–110345  ·  view source on GitHub ↗
(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo)

Source from the content-addressed store, hash-verified

110304 ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110305 }
110306 function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110307 if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
110308 return;
110309 }
110310 // Make sure not to write js file and source map file if any of them cannot be written
110311 if ((jsFilePath && host.isEmitBlocked(jsFilePath)) || compilerOptions.noEmit) {
110312 emitSkipped = true;
110313 return;
110314 }
110315 // Transform the source files
110316 var transform = ts.transformNodes(resolver, host, ts.factory, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false);
110317 var printerOptions = {
110318 removeComments: compilerOptions.removeComments,
110319 newLine: compilerOptions.newLine,
110320 noEmitHelpers: compilerOptions.noEmitHelpers,
110321 module: compilerOptions.module,
110322 target: compilerOptions.target,
110323 sourceMap: compilerOptions.sourceMap,
110324 inlineSourceMap: compilerOptions.inlineSourceMap,
110325 inlineSources: compilerOptions.inlineSources,
110326 extendedDiagnostics: compilerOptions.extendedDiagnostics,
110327 writeBundleFileInfo: !!bundleBuildInfo,
110328 relativeToBuildInfo: relativeToBuildInfo
110329 };
110330 // Create a printer to print the nodes
110331 var printer = createPrinter(printerOptions, {
110332 // resolver hooks
110333 hasGlobalName: resolver.hasGlobalName,
110334 // transform hooks
110335 onEmitNode: transform.emitNodeWithNotification,
110336 isEmitNotificationEnabled: transform.isEmitNotificationEnabled,
110337 substituteNode: transform.substituteNode,
110338 });
110339 ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
110340 printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
110341 // Clean up emit nodes on parse tree
110342 transform.dispose();
110343 if (bundleBuildInfo)
110344 bundleBuildInfo.js = printer.bundleFileInfo;
110345 }
110346 function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
110347 if (!sourceFileOrBundle)
110348 return;

Callers 1

emitSourceFileOrBundleFunction · 0.85

Calls 4

createPrinterFunction · 0.85
printSourceFileOrBundleFunction · 0.85
assertMethod · 0.80
disposeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…