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

Function emitTripleSlashDirectives

test/fixtures/snapshot/typescript.js:113492–113543  ·  view source on GitHub ↗
(hasNoDefaultLib, files, types, libs)

Source from the content-addressed store, hash-verified

113490 emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives);
113491 }
113492 function emitTripleSlashDirectives(hasNoDefaultLib, files, types, libs) {
113493 if (hasNoDefaultLib) {
113494 var pos = writer.getTextPos();
113495 writeComment("/// <reference no-default-lib=\"true\"/>");
113496 if (bundleFileInfo)
113497 bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "no-default-lib" /* BundleFileSectionKind.NoDefaultLib */ });
113498 writeLine();
113499 }
113500 if (currentSourceFile && currentSourceFile.moduleName) {
113501 writeComment("/// <amd-module name=\"".concat(currentSourceFile.moduleName, "\" />"));
113502 writeLine();
113503 }
113504 if (currentSourceFile && currentSourceFile.amdDependencies) {
113505 for (var _a = 0, _b = currentSourceFile.amdDependencies; _a < _b.length; _a++) {
113506 var dep = _b[_a];
113507 if (dep.name) {
113508 writeComment("/// <amd-dependency name=\"".concat(dep.name, "\" path=\"").concat(dep.path, "\" />"));
113509 }
113510 else {
113511 writeComment("/// <amd-dependency path=\"".concat(dep.path, "\" />"));
113512 }
113513 writeLine();
113514 }
113515 }
113516 for (var _c = 0, files_2 = files; _c < files_2.length; _c++) {
113517 var directive = files_2[_c];
113518 var pos = writer.getTextPos();
113519 writeComment("/// <reference path=\"".concat(directive.fileName, "\" />"));
113520 if (bundleFileInfo)
113521 bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* BundleFileSectionKind.Reference */, data: directive.fileName });
113522 writeLine();
113523 }
113524 for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
113525 var directive = types_24[_d];
113526 var pos = writer.getTextPos();
113527 var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
113528 ? "resolution-mode=\"".concat(directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require", "\"")
113529 : "";
113530 writeComment("/// <reference types=\"".concat(directive.fileName, "\" ").concat(resolutionMode, "/>"));
113531 if (bundleFileInfo)
113532 bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: !directive.resolutionMode ? "type" /* BundleFileSectionKind.Type */ : directive.resolutionMode === ts.ModuleKind.ESNext ? "type-import" /* BundleFileSectionKind.TypeResolutionModeImport */ : "type-require" /* BundleFileSectionKind.TypeResolutionModeRequire */, data: directive.fileName });
113533 writeLine();
113534 }
113535 for (var _e = 0, libs_1 = libs; _e < libs_1.length; _e++) {
113536 var directive = libs_1[_e];
113537 var pos = writer.getTextPos();
113538 writeComment("/// <reference lib=\"".concat(directive.fileName, "\" />"));
113539 if (bundleFileInfo)
113540 bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "lib" /* BundleFileSectionKind.Lib */, data: directive.fileName });
113541 writeLine();
113542 }
113543 }
113544 function emitSourceFileWorker(node) {
113545 var statements = node.statements;
113546 pushNameGenerationScope(node);

Calls 4

writeCommentFunction · 0.85
concatMethod · 0.80
writeLineFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected