MCPcopy Create free account
hub / github.com/effect-app/libs / computeJSDocInputHash

Function computeJSDocInputHash

repos/effect/packages/tools/jsdocs/src/Jsdocs.ts:1774–1824  ·  view source on GitHub ↗
(options: ExtractJSDocsOptions)

Source from the content-addressed store, hash-verified

1772 >()
1773 for (const link of collectJSDocLinks(sourceFile, block)) {
1774 const text = link.getText(sourceFile)
1775 const target = extractInlineLinkTarget(text)
1776 if (target === "" || urlRegex.test(target)) continue
1777 const symbol = resolveJSDocLinkSymbol(link, linkContext.checker)
1778 const info = symbol === undefined ? undefined : inlineLinkSymbol(symbol, linkContext.cwd, linkContext.checker)
1779 const items = resolved.get(text) ?? []
1780 items.push(info === undefined ? { range: [link.pos, link.end] } : { range: [link.pos, link.end], symbol: info })
1781 resolved.set(text, items)
1782 }
1783 return {
1784 ...tags,
1785 see: tags.see.map((tag) => ({
1786 ...tag,
1787 links: tag.links.map((link) => {
1788 const items = resolved.get(link.raw)
1789 const info = items?.shift()
1790 if (info === undefined) return link
1791 return info.symbol === undefined
1792 ? { ...link, range: info.range }
1793 : { ...link, range: info.range, symbol: info.symbol }
1794 })
1795 }))
1796 }
1797}
1798
1799function attachSeeLinkSymbols<T extends ParsedDeclarationTags | ParsedNamespaceTags | ParsedMemberTags>(
1800 tags: T,
1801 node: ts.Node,
1802 block: JSDocBlock,
1803 linkContext: { readonly checker: ts.TypeChecker; readonly entry: ProgramCacheEntry; readonly cwd: string }
1804): T {
1805 return attachSeeLinkSymbolsFromSourceFile(tags, node.getSourceFile(), block, linkContext)
1806}
1807
1808/**
1809 * JSDoc diagnostic paired with its source range.
1810 *
1811 * @category models
1812 * @since 4.0.0
1813 */
1814export interface JSDocModelDiagnostic extends JSDocDiagnostic {
1815 readonly range: readonly [number, number]
1816}
1817
1818/**
1819 * Parsed JSDoc and diagnostics for one source file in a model.
1820 *
1821 * @category models
1822 * @since 4.0.0
1823 */
1824export interface JSDocModelFile extends ParsedJSDocFile {
1825 readonly file: string
1826 readonly hash: string
1827 readonly diagnostics: ReadonlyArray<JSDocModelDiagnostic>

Callers 3

jsdocs.test.tsFile · 0.90
bin.tsFile · 0.90
extractJSDocsSyncFunction · 0.85

Calls 6

addInputFileFunction · 0.85
normalizeFileFunction · 0.85
hashSourceFunction · 0.85
joinMethod · 0.80
digestMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…