(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo)
| 110344 | bundleBuildInfo.js = printer.bundleFileInfo; |
| 110345 | } |
| 110346 | function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) { |
| 110347 | if (!sourceFileOrBundle) |
| 110348 | return; |
| 110349 | if (!declarationFilePath) { |
| 110350 | if (emitOnlyDtsFiles || compilerOptions.emitDeclarationOnly) |
| 110351 | emitSkipped = true; |
| 110352 | return; |
| 110353 | } |
| 110354 | var sourceFiles = ts.isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles; |
| 110355 | var filesForEmit = forceDtsEmit ? sourceFiles : ts.filter(sourceFiles, ts.isSourceFileNotJson); |
| 110356 | // Setup and perform the transformation to retrieve declarations from the input files |
| 110357 | var inputListOrBundle = ts.outFile(compilerOptions) ? [ts.factory.createBundle(filesForEmit, !ts.isSourceFile(sourceFileOrBundle) ? sourceFileOrBundle.prepends : undefined)] : filesForEmit; |
| 110358 | if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) { |
| 110359 | // Checker wont collect the linked aliases since thats only done when declaration is enabled. |
| 110360 | // Do that here when emitting only dts files |
| 110361 | filesForEmit.forEach(collectLinkedAliases); |
| 110362 | } |
| 110363 | var declarationTransform = ts.transformNodes(resolver, host, ts.factory, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false); |
| 110364 | if (ts.length(declarationTransform.diagnostics)) { |
| 110365 | for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) { |
| 110366 | var diagnostic = _b[_a]; |
| 110367 | emitterDiagnostics.add(diagnostic); |
| 110368 | } |
| 110369 | } |
| 110370 | var printerOptions = { |
| 110371 | removeComments: compilerOptions.removeComments, |
| 110372 | newLine: compilerOptions.newLine, |
| 110373 | noEmitHelpers: true, |
| 110374 | module: compilerOptions.module, |
| 110375 | target: compilerOptions.target, |
| 110376 | sourceMap: compilerOptions.sourceMap, |
| 110377 | inlineSourceMap: compilerOptions.inlineSourceMap, |
| 110378 | extendedDiagnostics: compilerOptions.extendedDiagnostics, |
| 110379 | onlyPrintJsDocStyle: true, |
| 110380 | writeBundleFileInfo: !!bundleBuildInfo, |
| 110381 | recordInternalSection: !!bundleBuildInfo, |
| 110382 | relativeToBuildInfo: relativeToBuildInfo |
| 110383 | }; |
| 110384 | var declarationPrinter = createPrinter(printerOptions, { |
| 110385 | // resolver hooks |
| 110386 | hasGlobalName: resolver.hasGlobalName, |
| 110387 | // transform hooks |
| 110388 | onEmitNode: declarationTransform.emitNodeWithNotification, |
| 110389 | isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled, |
| 110390 | substituteNode: declarationTransform.substituteNode, |
| 110391 | }); |
| 110392 | var declBlocked = (!!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length) || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit; |
| 110393 | emitSkipped = emitSkipped || declBlocked; |
| 110394 | if (!declBlocked || forceDtsEmit) { |
| 110395 | ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform"); |
| 110396 | printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, { |
| 110397 | sourceMap: !forceDtsEmit && compilerOptions.declarationMap, |
| 110398 | sourceRoot: compilerOptions.sourceRoot, |
| 110399 | mapRoot: compilerOptions.mapRoot, |
| 110400 | extendedDiagnostics: compilerOptions.extendedDiagnostics, |
| 110401 | // Explicitly do not passthru either `inline` option |
| 110402 | }); |
| 110403 | if (forceDtsEmit && declarationTransform.transformed[0].kind === 305 /* SyntaxKind.SourceFile */) { |
no test coverage detected
searching dependent graphs…