MCPcopy Create free account
hub / github.com/Effect-TS/effect / appendModulePublicSeeDiagnostics

Function appendModulePublicSeeDiagnostics

packages/tools/jsdocs/src/Jsdocs.ts:2405–2443  ·  view source on GitHub ↗
(
  files: ReadonlyArray<JSDocModelFile>,
  apis: ReadonlyArray<JSDocApi>,
  context: {
    readonly sourceFilesByFile: ReadonlyMap<string, ts.SourceFile>
    readonly checker: ts.TypeChecker
    readonly entry: ProgramCacheEntry
    readonly cwd: string
  }
)

Source from the content-addressed store, hash-verified

2403}
2404
2405function appendModulePublicSeeDiagnostics(
2406 files: ReadonlyArray<JSDocModelFile>,
2407 apis: ReadonlyArray<JSDocApi>,
2408 context: {
2409 readonly sourceFilesByFile: ReadonlyMap<string, ts.SourceFile>
2410 readonly checker: ts.TypeChecker
2411 readonly entry: ProgramCacheEntry
2412 readonly cwd: string
2413 }
2414): { readonly files: ReadonlyArray<JSDocModelFile>; readonly added: boolean } {
2415 const diagnosticsByFile = new Map(files.map((file) => [file.file, [...file.diagnostics]]))
2416 const resolve = createJSDocApiSeeLinkResolver(apis)
2417 let added = false
2418 for (const file of files) {
2419 if (file.imports === undefined || file.moduleJSDoc === undefined) continue
2420 const sourceFile = context.sourceFilesByFile.get(file.file)
2421 const diagnostics = diagnosticsByFile.get(file.file)
2422 if (sourceFile === undefined || diagnostics === undefined) continue
2423 for (const tag of moduleSeeTags(file, sourceFile, context)) {
2424 for (const link of tag.links) {
2425 const item = unresolvedPublicSeeDiagnostic({
2426 ...link,
2427 resolution: resolve({ moduleName: file.imports.module, namespacePath: [] }, link)
2428 })
2429 if (item === undefined || diagnostics.some((diagnostic) => sameDiagnostic(diagnostic, item))) continue
2430 diagnostics.push(item)
2431 added = true
2432 }
2433 }
2434 }
2435 if (!added) return { files, added }
2436 return {
2437 added,
2438 files: files.map((file) => ({
2439 ...file,
2440 diagnostics: diagnosticsByFile.get(file.file) ?? file.diagnostics
2441 }))
2442 }
2443}
2444
2445function buildJSDocApisWithPublicSeeDiagnostics(
2446 files: ReadonlyArray<JSDocModelFile>,

Calls 9

moduleSeeTagsFunction · 0.85
sameDiagnosticFunction · 0.85
someMethod · 0.80
pushMethod · 0.80
getMethod · 0.65
resolveFunction · 0.50
mapMethod · 0.45

Tested by

no test coverage detected