(tocFiles)
| 92 | } |
| 93 | |
| 94 | function buildTocIndex(tocFiles) { |
| 95 | const tocToPages = new Map(); // tocFile -> Set(relPathWithoutLeadingSlash) |
| 96 | const anyTocPages = new Set(); |
| 97 | const pageToTocs = new Map(); // pageRel -> Set(tocFile) |
| 98 | |
| 99 | tocFiles.forEach((toc) => { |
| 100 | const tocAbs = path.join(ROOT, toc); |
| 101 | const pages = new Set(); |
| 102 | |
| 103 | extractInternalDocTargetsFromMarkdownFile(tocAbs).forEach((rel) => { |
| 104 | pages.add(rel); |
| 105 | anyTocPages.add(rel); |
| 106 | |
| 107 | const tocs = pageToTocs.get(rel) || new Set(); |
| 108 | tocs.add(toc); |
| 109 | pageToTocs.set(rel, tocs); |
| 110 | }); |
| 111 | |
| 112 | tocToPages.set(toc, pages); |
| 113 | }); |
| 114 | |
| 115 | const cloudTocPages = new Set( |
| 116 | CLOUD_TOC_FILES.flatMap((toc) => [...(tocToPages.get(toc) || new Set())]) |
| 117 | ); |
| 118 | |
| 119 | return { tocToPages, anyTocPages, pageToTocs, cloudTocPages }; |
| 120 | } |
| 121 | |
| 122 | function expectedSetForTarget(targetRel, tocToPages, anyTocPages, cloudTocPages) { |
| 123 | if ( |
no test coverage detected