(
files: ReadonlyArray<JSDocModelFile>,
apis: ReadonlyArray<JSDocApi>,
context: {
readonly sourceFilesByFile: ReadonlyMap<string, ts.SourceFile>
readonly checker: ts.TypeChecker
readonly entry: ProgramCacheEntry
readonly cwd: string
}
)
| 2456 | } |
| 2457 | |
| 2458 | function appendModulePublicSeeDiagnostics( |
| 2459 | files: ReadonlyArray<JSDocModelFile>, |
| 2460 | apis: ReadonlyArray<JSDocApi>, |
| 2461 | context: { |
| 2462 | readonly sourceFilesByFile: ReadonlyMap<string, ts.SourceFile> |
| 2463 | readonly checker: ts.TypeChecker |
| 2464 | readonly entry: ProgramCacheEntry |
| 2465 | readonly cwd: string |
| 2466 | } |
| 2467 | ): { readonly files: ReadonlyArray<JSDocModelFile>; readonly added: boolean } { |
| 2468 | const diagnosticsByFile = new Map(files.map((file) => [file.file, [...file.diagnostics]])) |
| 2469 | const resolve = createJSDocApiSeeLinkResolver(apis) |
| 2470 | let added = false |
| 2471 | for (const file of files) { |
| 2472 | if (file.imports === undefined || file.moduleJSDoc === undefined) continue |
| 2473 | const sourceFile = context.sourceFilesByFile.get(file.file) |
| 2474 | const diagnostics = diagnosticsByFile.get(file.file) |
| 2475 | if (sourceFile === undefined || diagnostics === undefined) continue |
| 2476 | for (const tag of moduleSeeTags(file, sourceFile, context)) { |
| 2477 | for (const link of tag.links) { |
| 2478 | const item = unresolvedPublicSeeDiagnostic({ |
| 2479 | ...link, |
| 2480 | resolution: resolve({ moduleName: file.imports.module, namespacePath: [] }, link) |
| 2481 | }) |
| 2482 | if (item === undefined || diagnostics.some((diagnostic) => sameDiagnostic(diagnostic, item))) continue |
| 2483 | diagnostics.push(item) |
| 2484 | added = true |
| 2485 | } |
| 2486 | } |
| 2487 | } |
| 2488 | if (!added) return { files, added } |
| 2489 | return { |
| 2490 | added, |
| 2491 | files: files.map((file) => ({ |
| 2492 | ...file, |
| 2493 | diagnostics: diagnosticsByFile.get(file.file) ?? file.diagnostics |
| 2494 | })) |
| 2495 | } |
| 2496 | } |
| 2497 | |
| 2498 | function buildJSDocApisWithPublicSeeDiagnostics( |
| 2499 | files: ReadonlyArray<JSDocModelFile>, |
no test coverage detected