@vellum-docs/extractor-typescript 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -157,27 +157,34 @@ function getLeadingJSDoc(node, sourceFile) {
157
157
  return "";
158
158
  }
159
159
  /**
160
- * Pretty-print the declaration header (without body) for a given node.
160
+ * Canonical declaration text for a node — JSDoc stripped, bodies removed,
161
+ * printer-normalized. Mirrors what `tsc --declaration` would emit for the
162
+ * surface of the symbol.
161
163
  */
162
164
  const RE_TRAILING_SEMI$1 = /;$/;
165
+ const declarationPrinter = ts.createPrinter({
166
+ removeComments: true,
167
+ omitTrailingSemicolon: false
168
+ });
169
+ function stripBodies(context) {
170
+ const visit = (node) => {
171
+ if (ts.isFunctionDeclaration(node)) return ts.factory.updateFunctionDeclaration(node, node.modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, void 0);
172
+ if (ts.isMethodDeclaration(node)) return ts.factory.updateMethodDeclaration(node, node.modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, void 0);
173
+ if (ts.isConstructorDeclaration(node)) return ts.factory.updateConstructorDeclaration(node, node.modifiers, node.parameters, void 0);
174
+ if (ts.isGetAccessor(node)) return ts.factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, node.parameters, node.type, void 0);
175
+ if (ts.isSetAccessor(node)) return ts.factory.updateSetAccessorDeclaration(node, node.modifiers, node.name, node.parameters, void 0);
176
+ return ts.visitEachChild(node, visit, context);
177
+ };
178
+ return visit;
179
+ }
163
180
  function formatSignature(node, sourceFile) {
164
- if (ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node)) {
165
- const name = node.name?.getText(sourceFile) ?? "";
166
- const tps = node.typeParameters?.map((t) => t.getText(sourceFile)).join(", ");
167
- const tpStr = tps ? `<${tps}>` : "";
168
- const params = node.parameters.map((p) => p.getText(sourceFile)).join(", ");
169
- const ret = node.type ? `: ${node.type.getText(sourceFile)}` : "";
170
- return `${ts.isFunctionDeclaration(node) ? "function " : ""}${name}${tpStr}(${params})${ret}`;
171
- }
172
181
  if (ts.isVariableStatement(node)) return node.getText(sourceFile).replace(RE_TRAILING_SEMI$1, "");
173
- if (ts.isClassDeclaration(node)) {
174
- const name = node.name?.getText(sourceFile) ?? "";
175
- const tps = node.typeParameters?.map((t) => t.getText(sourceFile)).join(", ");
176
- const tpStr = tps ? `<${tps}>` : "";
177
- const heritage = (node.heritageClauses ?? []).map((h) => h.getText(sourceFile)).join(" ");
178
- return `class ${name}${tpStr}${heritage ? ` ${heritage}` : ""}`;
179
- }
180
- return node.getText(sourceFile);
182
+ const synth = ts.getSynthesizedDeepClone(node);
183
+ const result = ts.transform(synth, [(ctx) => (n) => ts.visitNode(n, stripBodies(ctx))]);
184
+ const stripped = result.transformed[0];
185
+ const text = declarationPrinter.printNode(ts.EmitHint.Unspecified, stripped, sourceFile);
186
+ result.dispose();
187
+ return text;
181
188
  }
182
189
  //#endregion
183
190
  //#region src/walk.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["RE_TRAILING_SEMI"],"sources":["../src/tsdoc.ts","../src/util.ts","../src/walk.ts","../src/extractor.ts"],"sourcesContent":["import type {\n DocBlock,\n DocComment,\n DocNode,\n} from '@microsoft/tsdoc'\nimport type { Example, DocComment as VellumDoc } from '@vellum-docs/core'\n\nimport {\n DocCodeSpan,\n DocExcerpt,\n DocFencedCode,\n DocLinkTag,\n DocNodeKind,\n DocParagraph,\n DocPlainText,\n DocSection,\n DocSoftBreak,\n TSDocConfiguration,\n TSDocParser,\n TSDocTagDefinition,\n TSDocTagSyntaxKind,\n} from '@microsoft/tsdoc'\nimport { emptyDocComment } from '@vellum-docs/core'\n\nconst RE_TRAILING_WHITESPACE = /\\s*$/\n\n// Start from the default TSDoc config (which already knows @example, @internal,\n// @beta, @public, @deprecated, @param, @returns, @remarks, @see, etc.) and add\n// any missing custom tags we want to tolerate without emitting warnings.\nconst tsdocConfig = new TSDocConfiguration()\nconst definedTagNames = new Set(\n tsdocConfig.tagDefinitions.map(t => t.tagName.toLowerCase()),\n)\nfor (const name of ['@category']) {\n if (definedTagNames.has(name.toLowerCase()))\n continue\n tsdocConfig.addTagDefinition(\n new TSDocTagDefinition({\n tagName: name,\n syntaxKind: TSDocTagSyntaxKind.ModifierTag,\n }),\n )\n}\n\nconst parser = new TSDocParser(tsdocConfig)\n\n/** Recursively collect plain text from a TSDoc DocNode tree. */\nfunction nodeText(node: DocNode): string {\n if (node instanceof DocExcerpt) {\n return node.content.toString()\n }\n let out = ''\n for (const child of node.getChildNodes()) {\n out += nodeText(child)\n }\n return out\n}\n\n/** Render a DocNode subtree as markdown (preserving paragraph breaks). */\nfunction nodeMarkdown(node: DocNode): string {\n if (node instanceof DocPlainText)\n return node.text\n if (node instanceof DocSoftBreak)\n return ' '\n if (node instanceof DocCodeSpan)\n return `\\`${node.code}\\``\n if (node instanceof DocLinkTag) {\n // {@link Foo} or {@link Foo | alt text}\n if (node.codeDestination) {\n const parts = node.codeDestination.memberReferences.map(r =>\n r.memberIdentifier ? r.memberIdentifier.identifier : '',\n )\n const target = parts.filter(Boolean).join('.')\n return `\\`${node.linkText || target}\\``\n }\n if (node.urlDestination) {\n return `[${node.linkText || node.urlDestination}](${node.urlDestination})`\n }\n return node.linkText ?? ''\n }\n if (node instanceof DocFencedCode) {\n return `\\`\\`\\`${node.language || ''}\\n${node.code.replace(RE_TRAILING_WHITESPACE, '')}\\n\\`\\`\\``\n }\n if (node instanceof DocParagraph) {\n let out = ''\n for (const child of node.getChildNodes()) out += nodeMarkdown(child)\n return out.trim()\n }\n if (node instanceof DocSection) {\n const parts: string[] = []\n for (const child of node.getChildNodes()) {\n const rendered = nodeMarkdown(child)\n if (rendered)\n parts.push(rendered)\n }\n return parts.join('\\n\\n')\n }\n let out = ''\n for (const child of node.getChildNodes()) out += nodeMarkdown(child)\n return out\n}\n\n/** Recursively find the first DocFencedCode in a subtree. */\nfunction findFencedCode(node: DocNode): DocFencedCode | null {\n if (node instanceof DocFencedCode)\n return node\n for (const child of node.getChildNodes()) {\n const found = findFencedCode(child)\n if (found)\n return found\n }\n return null\n}\n\nfunction blockMarkdown(block: DocBlock | undefined): string {\n if (!block)\n return ''\n return nodeMarkdown(block.content).trim()\n}\n\nfunction parseExampleBlock(block: DocBlock): Example {\n const fenced = findFencedCode(block.content)\n if (fenced) {\n return {\n title: null,\n lang: fenced.language || 'ts',\n code: fenced.code.replace(RE_TRAILING_WHITESPACE, ''),\n description: null,\n }\n }\n // No fenced code — treat the whole block as the code body.\n return {\n title: null,\n lang: 'ts',\n code: blockMarkdown(block),\n description: null,\n }\n}\n\nexport function parseTSDoc(raw: string): VellumDoc {\n if (!raw.trim())\n return emptyDocComment()\n\n const ctx = parser.parseString(raw)\n const comment: DocComment = ctx.docComment\n\n const result: VellumDoc = emptyDocComment()\n result.raw = raw\n\n // Summary = first paragraph of summary section; description = remainder.\n const summaryChildren = comment.summarySection.getChildNodes()\n const summaryParts: string[] = []\n const descriptionParts: string[] = []\n let seenFirst = false\n for (const child of summaryChildren) {\n const md = nodeMarkdown(child)\n if (!md)\n continue\n if (!seenFirst) {\n summaryParts.push(md)\n seenFirst = true\n }\n else {\n descriptionParts.push(md)\n }\n }\n result.summary = summaryParts.join('\\n\\n').trim()\n\n // @remarks block (if present) becomes part of description.\n const remarks = blockMarkdown(comment.remarksBlock)\n if (remarks)\n descriptionParts.push(remarks)\n result.description = descriptionParts.join('\\n\\n').trim()\n\n // @param blocks.\n for (const p of comment.params.blocks) {\n result.params[p.parameterName] = blockMarkdown(p)\n }\n\n // @returns\n if (comment.returnsBlock) {\n result.returns = blockMarkdown(comment.returnsBlock)\n }\n\n // @deprecated\n if (comment.deprecatedBlock) {\n result.deprecated = { reason: blockMarkdown(comment.deprecatedBlock) }\n }\n\n // @see blocks — take plain text of each.\n for (const block of comment.seeBlocks) {\n const txt = blockMarkdown(block)\n if (txt)\n result.see.push(txt)\n }\n\n // Custom blocks: @example and others.\n for (const block of comment.customBlocks) {\n const name = block.blockTag.tagName\n if (name === '@example') {\n result.examples.push(parseExampleBlock(block))\n }\n else {\n const key = name\n const list = result.customTags[key] ?? []\n list.push(blockMarkdown(block))\n result.customTags[key] = list\n }\n }\n\n // Modifier tags: @beta, @internal, @public, etc. — record as customTags keys.\n for (const tag of comment.modifierTagSet.nodes) {\n const name = tag.tagName\n if (!(name in result.customTags))\n result.customTags[name] = []\n }\n\n return result\n}\n\nexport { DocNodeKind, nodeText }\n","import { relative } from 'node:path'\nimport ts from 'typescript'\n\nexport function moduleOf(root: string, fileName: string): string {\n return relative(root, fileName).replace(/\\\\/g, '/')\n}\n\nexport function makeId(modulePath: string, qualifiedName: string): string {\n return `ts:${modulePath}#${qualifiedName}`\n}\n\nexport function isExported(node: ts.Node): boolean {\n const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined\n return modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword) ?? false\n}\n\nexport function locationOf(node: ts.Node, sourceFile: ts.SourceFile, root: string) {\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile))\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd())\n return {\n file: relative(root, sourceFile.fileName).replace(/\\\\/g, '/'),\n line: start.line + 1,\n column: start.character + 1,\n endLine: end.line + 1,\n endColumn: end.character + 1,\n }\n}\n\n/**\n * Get the leading `/** ... *\\/` JSDoc comment text for a node, if any.\n * Returns the raw comment including delimiters.\n */\nexport function getLeadingJSDoc(node: ts.Node, sourceFile: ts.SourceFile): string {\n const text = sourceFile.text\n const ranges = ts.getLeadingCommentRanges(text, node.getFullStart())\n if (!ranges)\n return ''\n for (let i = ranges.length - 1; i >= 0; i--) {\n const r = ranges[i]!\n if (r.kind !== ts.SyntaxKind.MultiLineCommentTrivia)\n continue\n const slice = text.slice(r.pos, r.end)\n if (slice.startsWith('/**'))\n return slice\n }\n return ''\n}\n\n/**\n * Pretty-print the declaration header (without body) for a given node.\n */\nconst RE_TRAILING_SEMI = /;$/\n\nexport function formatSignature(node: ts.Node, sourceFile: ts.SourceFile): string {\n if (ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node)) {\n const name = node.name?.getText(sourceFile) ?? ''\n const tps = node.typeParameters?.map(t => t.getText(sourceFile)).join(', ')\n const tpStr = tps ? `<${tps}>` : ''\n const params = node.parameters.map(p => p.getText(sourceFile)).join(', ')\n const ret = node.type ? `: ${node.type.getText(sourceFile)}` : ''\n const prefix = ts.isFunctionDeclaration(node) ? 'function ' : ''\n return `${prefix}${name}${tpStr}(${params})${ret}`\n }\n if (ts.isVariableStatement(node)) {\n return node.getText(sourceFile).replace(RE_TRAILING_SEMI, '')\n }\n if (ts.isClassDeclaration(node)) {\n // Header only: `class Name<T> extends A implements B`\n const name = node.name?.getText(sourceFile) ?? ''\n const tps = node.typeParameters?.map(t => t.getText(sourceFile)).join(', ')\n const tpStr = tps ? `<${tps}>` : ''\n const heritage = (node.heritageClauses ?? [])\n .map(h => h.getText(sourceFile))\n .join(' ')\n return `class ${name}${tpStr}${heritage ? ` ${heritage}` : ''}`\n }\n // Interfaces, type aliases, enums — full text is a reasonable signature.\n return node.getText(sourceFile)\n}\n","import type {\n DocComment,\n EnumVariant,\n Literal,\n Member,\n Parameter,\n TypeRef,\n TypeString,\n Symbol as VSymbol,\n} from '@vellum-docs/core'\n\nimport { emptyDocComment } from '@vellum-docs/core'\nimport ts from 'typescript'\n\nimport { parseTSDoc } from './tsdoc'\nimport {\n formatSignature,\n getLeadingJSDoc,\n isExported,\n locationOf,\n makeId,\n moduleOf,\n} from './util'\n\n// Module-level regex constants (eslint: e18e/prefer-static-regex)\nconst RE_STRING_LITERAL = /^\".*\"$|^'.*'$|^`.*`$/\nconst RE_NUMBER_LITERAL = /^-?\\d+(?:\\.\\d+)?$/\nconst RE_TRAILING_SEMI = /;$/\nconst RE_LEADING_AT = /^@/\n\ninterface WalkContext {\n checker: ts.TypeChecker\n sourceFile: ts.SourceFile\n modulePath: string\n root: string\n /** Map of qualified name → id, populated in a first pass for cross-ref resolution. */\n knownNames: Map<string, string>\n /** When true, all symbols are treated as exported (package extraction mode). */\n forceExported?: boolean\n}\n\nfunction isSymExported(node: ts.Node, ctx: WalkContext): boolean {\n return ctx.forceExported || isExported(node)\n}\n\nfunction docOrEmpty(node: ts.Node, sourceFile: ts.SourceFile): DocComment {\n const raw = getLeadingJSDoc(node, sourceFile)\n return raw ? parseTSDoc(raw) : emptyDocComment()\n}\n\nfunction literalFromText(text: string): Literal {\n const trimmed = text.trim()\n if (RE_STRING_LITERAL.test(trimmed)) {\n return { kind: 'string', text: trimmed, value: trimmed.slice(1, -1) }\n }\n if (RE_NUMBER_LITERAL.test(trimmed)) {\n return { kind: 'number', text: trimmed, value: Number(trimmed) }\n }\n if (trimmed === 'true' || trimmed === 'false') {\n return { kind: 'boolean', text: trimmed, value: trimmed === 'true' }\n }\n if (trimmed === 'null')\n return { kind: 'null', text: trimmed }\n if (trimmed === 'undefined')\n return { kind: 'undefined', text: trimmed }\n if (trimmed.startsWith('{'))\n return { kind: 'object', text: trimmed }\n if (trimmed.startsWith('['))\n return { kind: 'array', text: trimmed }\n return { kind: 'expression', text: trimmed }\n}\n\n/**\n * Build a TypeString from a type node, collecting identifier positions\n * whose symbols are declared in files we're extracting.\n */\nfunction typeStringFrom(typeNode: ts.TypeNode | undefined, ctx: WalkContext): TypeString {\n if (!typeNode)\n return { text: '', refs: [] }\n const text = typeNode.getText(ctx.sourceFile)\n const refs: TypeRef[] = []\n const baseOffset = typeNode.getStart(ctx.sourceFile)\n\n const visit = (node: ts.Node): void => {\n if (ts.isIdentifier(node)) {\n const name = node.text\n const refId = ctx.knownNames.get(name)\n if (refId) {\n const start = node.getStart(ctx.sourceFile) - baseOffset\n const end = node.getEnd() - baseOffset\n refs.push({ start, end, symbolId: refId })\n }\n }\n ts.forEachChild(node, visit)\n }\n visit(typeNode)\n\n return { text, refs }\n}\n\nfunction extractParameter(param: ts.ParameterDeclaration, ctx: WalkContext, paramDocs: Record<string, string>): Parameter {\n return {\n name: param.name.getText(ctx.sourceFile),\n type: typeStringFrom(param.type, ctx),\n optional: !!param.questionToken || !!param.initializer,\n rest: !!param.dotDotDotToken,\n defaultValue: param.initializer\n ? literalFromText(param.initializer.getText(ctx.sourceFile))\n : null,\n doc: paramDocs[param.name.getText(ctx.sourceFile)] ?? '',\n }\n}\n\nfunction extractFunction(node: ts.FunctionDeclaration, ctx: WalkContext): VSymbol | null {\n if (!node.name)\n return null\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'function',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n parameters: node.parameters.map(p => extractParameter(p, ctx, doc.params)),\n returnType: typeStringFrom(node.type, ctx),\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\nfunction extractInterfaceMembers(node: ts.InterfaceDeclaration, ctx: WalkContext): Member[] {\n return node.members.map((m): Member => {\n const name = m.name && ts.isIdentifier(m.name) ? m.name.text : m.name?.getText(ctx.sourceFile) ?? ''\n const doc = docOrEmpty(m, ctx.sourceFile)\n\n if (ts.isMethodSignature(m)) {\n return {\n name,\n kind: 'method',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: { text: m.type?.getText(ctx.sourceFile) ?? '', refs: [] },\n optional: !!m.questionToken,\n readonly: false,\n visibility: 'public',\n static: false,\n doc,\n }\n }\n if (ts.isPropertySignature(m)) {\n return {\n name,\n kind: 'property',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: typeStringFrom(m.type, ctx),\n optional: !!m.questionToken,\n readonly: !!(ts.getModifiers(m)?.some(mod => mod.kind === ts.SyntaxKind.ReadonlyKeyword)),\n visibility: 'public',\n static: false,\n doc,\n }\n }\n return {\n name,\n kind: 'property',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: { text: '', refs: [] },\n optional: false,\n readonly: false,\n visibility: 'public',\n static: false,\n doc,\n }\n })\n}\n\nfunction extractInterface(node: ts.InterfaceDeclaration, ctx: WalkContext): VSymbol {\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'interface',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n members: extractInterfaceMembers(node, ctx),\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\nfunction extractTypeAlias(node: ts.TypeAliasDeclaration, ctx: WalkContext): VSymbol {\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'type',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n aliasOf: typeStringFrom(node.type, ctx),\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\nfunction extractVariable(statement: ts.VariableStatement, decl: ts.VariableDeclaration, ctx: WalkContext): VSymbol | null {\n if (!ts.isIdentifier(decl.name))\n return null\n const name = decl.name.text\n const isConst\n = (statement.declarationList.flags & ts.NodeFlags.Const) === ts.NodeFlags.Const\n const doc = docOrEmpty(statement, ctx.sourceFile)\n\n const initText = decl.initializer?.getText(ctx.sourceFile)\n const value = initText ? literalFromText(initText) : null\n\n // If no annotation, try to ask the checker for the inferred type.\n let valueType: TypeString\n if (decl.type) {\n valueType = typeStringFrom(decl.type, ctx)\n }\n else {\n try {\n const t = ctx.checker.getTypeAtLocation(decl)\n valueType = {\n text: ctx.checker.typeToString(t, decl, ts.TypeFormatFlags.NoTruncation),\n refs: [],\n }\n }\n catch {\n valueType = { text: '', refs: [] }\n }\n }\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: isConst ? 'const' : 'variable',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(decl, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(statement, ctx),\n signature: `${isConst ? 'const' : 'let'} ${name}${valueType.text ? `: ${valueType.text}` : ''}${\n value ? ` = ${value.text}` : ''\n }`,\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n mutable: !isConst,\n valueType,\n value,\n }\n}\n\nfunction extractEnum(node: ts.EnumDeclaration, ctx: WalkContext): VSymbol {\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n const variants: EnumVariant[] = node.members.map(m => ({\n name: m.name.getText(ctx.sourceFile),\n value: m.initializer ? literalFromText(m.initializer.getText(ctx.sourceFile)) : null,\n doc: docOrEmpty(m, ctx.sourceFile),\n }))\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'enum',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n variants,\n }\n}\n\nfunction extractClass(node: ts.ClassDeclaration, ctx: WalkContext): VSymbol | null {\n if (!node.name)\n return null\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n\n const members: Member[] = node.members\n .map((m): Member | null => {\n const memberName\n = m.name && ts.isIdentifier(m.name)\n ? m.name.text\n : m.name?.getText(ctx.sourceFile) ?? ''\n const memberDoc = docOrEmpty(m, ctx.sourceFile)\n const mods = ts.canHaveModifiers(m) ? ts.getModifiers(m) : undefined\n const visibility\n = mods?.some(mod => mod.kind === ts.SyntaxKind.PrivateKeyword)\n ? 'private'\n : mods?.some(mod => mod.kind === ts.SyntaxKind.ProtectedKeyword)\n ? 'protected'\n : 'public'\n const isStatic\n = mods?.some(mod => mod.kind === ts.SyntaxKind.StaticKeyword) ?? false\n\n if (ts.isMethodDeclaration(m)) {\n return {\n name: memberName,\n kind: 'method',\n signature: formatSignature(m, ctx.sourceFile),\n type: typeStringFrom(m.type, ctx),\n optional: !!m.questionToken,\n readonly: false,\n visibility,\n static: isStatic,\n doc: memberDoc,\n }\n }\n if (ts.isPropertyDeclaration(m)) {\n return {\n name: memberName,\n kind: 'property',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: typeStringFrom(m.type, ctx),\n optional: !!m.questionToken,\n readonly:\n mods?.some(mod => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ?? false,\n visibility,\n static: isStatic,\n doc: memberDoc,\n }\n }\n if (ts.isConstructorDeclaration(m)) {\n return {\n name: 'constructor',\n kind: 'constructor',\n signature: `(${m.parameters.map(p => p.getText(ctx.sourceFile)).join(', ')})`,\n type: { text: '', refs: [] },\n optional: false,\n readonly: false,\n visibility,\n static: false,\n doc: memberDoc,\n }\n }\n return null\n })\n .filter((m): m is Member => m !== null)\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'class',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n members,\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\n/**\n * First pass: collect names that will become SymbolIds, so that typeStringFrom\n * can linkify identifiers referencing them.\n */\nexport function collectNames(sourceFile: ts.SourceFile, root: string, moduleOverride?: string): Map<string, string> {\n const modulePath = moduleOverride ?? moduleOf(root, sourceFile.fileName)\n const names = new Map<string, string>()\n for (const stmt of sourceFile.statements) {\n if (ts.isInterfaceDeclaration(stmt) || ts.isTypeAliasDeclaration(stmt) || ts.isClassDeclaration(stmt) || ts.isEnumDeclaration(stmt)) {\n if (stmt.name)\n names.set(stmt.name.text, makeId(modulePath, stmt.name.text))\n }\n else if (ts.isFunctionDeclaration(stmt) && stmt.name) {\n names.set(stmt.name.text, makeId(modulePath, stmt.name.text))\n }\n else if (ts.isVariableStatement(stmt)) {\n for (const d of stmt.declarationList.declarations) {\n if (ts.isIdentifier(d.name)) {\n names.set(d.name.text, makeId(modulePath, d.name.text))\n }\n }\n }\n }\n return names\n}\n\nexport function extractFromFile(sourceFile: ts.SourceFile, checker: ts.TypeChecker, root: string, knownNames: Map<string, string>, moduleOverride?: string): VSymbol[] {\n const modulePath = moduleOverride ?? moduleOf(root, sourceFile.fileName)\n const ctx: WalkContext = {\n checker,\n sourceFile,\n modulePath,\n root,\n knownNames,\n }\n\n // For package files (moduleOverride set), use the checker to resolve all\n // exports — this follows re-exports through barrel files.\n if (moduleOverride) {\n return extractFromModuleExports(sourceFile, checker, ctx)\n }\n\n const results: VSymbol[] = []\n for (const stmt of sourceFile.statements) {\n if (ts.isInterfaceDeclaration(stmt)) {\n results.push(extractInterface(stmt, ctx))\n }\n else if (ts.isTypeAliasDeclaration(stmt)) {\n results.push(extractTypeAlias(stmt, ctx))\n }\n else if (ts.isFunctionDeclaration(stmt)) {\n const s = extractFunction(stmt, ctx)\n if (s)\n results.push(s)\n }\n else if (ts.isVariableStatement(stmt)) {\n for (const decl of stmt.declarationList.declarations) {\n const s = extractVariable(stmt, decl, ctx)\n if (s)\n results.push(s)\n }\n }\n else if (ts.isEnumDeclaration(stmt)) {\n results.push(extractEnum(stmt, ctx))\n }\n else if (ts.isClassDeclaration(stmt)) {\n const s = extractClass(stmt, ctx)\n if (s)\n results.push(s)\n }\n }\n return results\n}\n\n/**\n * Extract symbols by resolving a module's exports through the type checker.\n * This follows re-exports, barrel files, and `export * from` chains —\n * the right strategy for package .d.ts files.\n */\nfunction extractFromModuleExports(sourceFile: ts.SourceFile, checker: ts.TypeChecker, ctx: WalkContext): VSymbol[] {\n const fileSymbol = checker.getSymbolAtLocation(sourceFile)\n if (!fileSymbol)\n return []\n\n const exports = checker.getExportsOfModule(fileSymbol)\n const results: VSymbol[] = []\n\n for (const sym of exports) {\n // The public export name — may differ from the declaration name\n // when re-exported with an alias (e.g. `export { Foo$1 as Foo }`).\n const exportName = sym.name\n\n // Resolve aliases (re-exports).\n const resolved\n = sym.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(sym) : sym\n const decls = resolved.getDeclarations()\n if (!decls || decls.length === 0)\n continue\n const decl = decls[0]!\n const declSourceFile = decl.getSourceFile()\n\n // Build a context for the declaration's actual source file (may differ\n // from the barrel file). Force exported=true since the checker told us\n // this symbol is in the module's public exports.\n const declCtx: WalkContext = {\n ...ctx,\n sourceFile: declSourceFile,\n forceExported: true,\n }\n\n let extracted: VSymbol | null = null\n\n if (ts.isInterfaceDeclaration(decl)) {\n extracted = extractInterface(decl, declCtx)\n }\n else if (ts.isTypeAliasDeclaration(decl)) {\n extracted = extractTypeAlias(decl, declCtx)\n }\n else if (ts.isFunctionDeclaration(decl)) {\n extracted = extractFunction(decl, declCtx)\n }\n else if (ts.isVariableDeclaration(decl)) {\n const stmt = decl.parent?.parent\n if (stmt && ts.isVariableStatement(stmt))\n extracted = extractVariable(stmt, decl, declCtx)\n }\n else if (ts.isEnumDeclaration(decl)) {\n extracted = extractEnum(decl, declCtx)\n }\n else if (ts.isClassDeclaration(decl)) {\n extracted = extractClass(decl, declCtx)\n }\n\n // Override name and id with the public export name, which may\n // differ from the declaration name due to re-export aliasing.\n if (extracted) {\n if (extracted.name !== exportName) {\n extracted.name = exportName\n extracted.id = makeId(ctx.modulePath, exportName)\n }\n results.push(extracted)\n }\n }\n return results\n}\n","import type { ExtractInput, Extractor, Symbol as VSymbol } from '@vellum-docs/core'\n\nimport { realpathSync } from 'node:fs'\nimport ts from 'typescript'\n\nimport { collectNames, extractFromFile } from './walk'\n\nexport interface TypeScriptExtractorOptions {\n /** Compiler options applied to the in-memory Program. */\n compilerOptions?: ts.CompilerOptions\n}\n\nconst defaultCompilerOptions: ts.CompilerOptions = {\n target: ts.ScriptTarget.ES2022,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n allowJs: true,\n strict: false,\n noEmit: true,\n skipLibCheck: true,\n esModuleInterop: true,\n allowImportingTsExtensions: false,\n declaration: false,\n}\n\nexport class TypeScriptExtractor implements Extractor {\n readonly language = 'ts'\n readonly extensions = ['.ts', '.tsx', '.mts', '.cts'] as const\n\n private readonly options: TypeScriptExtractorOptions\n\n constructor(options: TypeScriptExtractorOptions = {}) {\n this.options = options\n }\n\n async extract(input: ExtractInput): Promise<VSymbol[]> {\n const packageFiles = input.packageFiles ?? []\n const allRootNames = [\n ...input.files,\n ...packageFiles.map(pf => pf.file),\n ]\n if (allRootNames.length === 0)\n return []\n\n const compilerOptions: ts.CompilerOptions = {\n ...defaultCompilerOptions,\n ...this.options.compilerOptions,\n }\n\n const program = ts.createProgram({\n rootNames: allRootNames,\n options: compilerOptions,\n })\n const checker = program.getTypeChecker()\n\n // Build a map of resolved file path → package name for package files.\n const packageModuleMap = new Map<string, string>()\n for (const pf of packageFiles) {\n packageModuleMap.set(pf.file, pf.packageName)\n }\n\n // First pass: collect names across all files for cross-ref resolution.\n const allNames = new Map<string, string>()\n for (const rootName of allRootNames) {\n let sf = program.getSourceFile(rootName)\n if (!sf) {\n try {\n sf = program.getSourceFile(realpathSync(rootName))\n }\n catch {}\n }\n if (!sf)\n continue\n const moduleOverride = packageModuleMap.get(rootName)\n const names = collectNames(sf, input.root, moduleOverride)\n for (const [k, v] of names) allNames.set(k, v)\n }\n\n // Second pass: extract symbols.\n const results: VSymbol[] = []\n\n // Project files — skip .d.ts (those are ambient, not user-authored).\n for (const file of input.files) {\n const sf = program.getSourceFile(file)\n if (!sf || sf.isDeclarationFile)\n continue\n const symbols = extractFromFile(sf, checker, input.root, allNames)\n results.push(...symbols)\n }\n\n // Package .d.ts files — these ARE declaration files, extract them.\n // Use realpathSync because pnpm symlinks workspace packages and the\n // TS compiler resolves symlinks internally, so getSourceFile() with\n // the symlink path may return undefined.\n for (const pf of packageFiles) {\n let sf = program.getSourceFile(pf.file)\n if (!sf) {\n try {\n sf = program.getSourceFile(realpathSync(pf.file))\n }\n catch {}\n }\n if (!sf)\n continue\n const symbols = extractFromFile(sf, checker, input.root, allNames, pf.packageName)\n results.push(...symbols)\n }\n\n return results\n }\n}\n"],"mappings":";;;;;;AAwBA,MAAM,yBAAyB;AAK/B,MAAM,cAAc,IAAI,oBAAoB;AAC5C,MAAM,kBAAkB,IAAI,IAC1B,YAAY,eAAe,KAAI,MAAK,EAAE,QAAQ,aAAa,CAAC,CAC7D;AACD,KAAK,MAAM,QAAQ,CAAC,YAAY,EAAE;AAChC,KAAI,gBAAgB,IAAI,KAAK,aAAa,CAAC,CACzC;AACF,aAAY,iBACV,IAA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mB,IAAI,KAAqB;AAClD,OAAK,MAAM,MAAM,aACf,kBAAiB,IAAI,GAAG,MAAM,GAAG,YAAY;EAI/C,MAAM,2BAAW,IAAI,KAAqB;AAC1C,OAAK,MAAM,YAAY,cAAc;GACnC,IAAI,KAAK,QAAQ,cAAc,SAAS;AACxC,OAAI,CAAC,GACH,KAAI;AACF,SAAK,QAAQ,cAAc,aAAa,SAAS,CAAC;WAE9C;AAER,OAAI,CAAC,GACH;GACF,MAAM,iBAAiB,iBAAiB,IAAI,SAAS;GACrD,MAAM,QAAQ,aAAa,IAAI,MAAM,MAAM,eAAe;AAC1D,QAAK,MAAM,CAAC,GAAG,MAAM,MAAO,UAAS,IAAI,GAAG,EAAE;;EAIhD,MAAM,UAAqB,EAAE;AAG7B,OAAK,MAAM,QAAQ,MAAM,OAAO;GAC9B,MAAM,KAAK,QAAQ,cAAc,KAAK;AACtC,OAAI,CAAC,MAAM,GAAG,kBACZ;GACF,MAAM,UAAU,gBAAgB,IAAI,SAAS,MAAM,MAAM,SAAS;AAClE,WAAQ,KAAK,GAAG,QAAQ;;AAO1B,OAAK,MAAM,MAAM,cAAc;GAC7B,IAAI,KAAK,QAAQ,cAAc,GAAG,KAAK;AACvC,OAAI,CAAC,GACH,KAAI;AACF,SAAK,QAAQ,cAAc,aAAa,GAAG,KAAK,CAAC;WAE7C;AAER,OAAI,CAAC,GACH;GACF,MAAM,UAAU,gBAAgB,IAAI,SAAS,MAAM,MAAM,UAAU,GAAG,YAAY;AAClF,WAAQ,KAAK,GAAG,QAAQ;;AAG1B,SAAO"}
1
+ {"version":3,"file":"index.mjs","names":["RE_TRAILING_SEMI"],"sources":["../src/tsdoc.ts","../src/util.ts","../src/walk.ts","../src/extractor.ts"],"sourcesContent":["import type {\n DocBlock,\n DocComment,\n DocNode,\n} from '@microsoft/tsdoc'\nimport type { Example, DocComment as VellumDoc } from '@vellum-docs/core'\n\nimport {\n DocCodeSpan,\n DocExcerpt,\n DocFencedCode,\n DocLinkTag,\n DocNodeKind,\n DocParagraph,\n DocPlainText,\n DocSection,\n DocSoftBreak,\n TSDocConfiguration,\n TSDocParser,\n TSDocTagDefinition,\n TSDocTagSyntaxKind,\n} from '@microsoft/tsdoc'\nimport { emptyDocComment } from '@vellum-docs/core'\n\nconst RE_TRAILING_WHITESPACE = /\\s*$/\n\n// Start from the default TSDoc config (which already knows @example, @internal,\n// @beta, @public, @deprecated, @param, @returns, @remarks, @see, etc.) and add\n// any missing custom tags we want to tolerate without emitting warnings.\nconst tsdocConfig = new TSDocConfiguration()\nconst definedTagNames = new Set(\n tsdocConfig.tagDefinitions.map(t => t.tagName.toLowerCase()),\n)\nfor (const name of ['@category']) {\n if (definedTagNames.has(name.toLowerCase()))\n continue\n tsdocConfig.addTagDefinition(\n new TSDocTagDefinition({\n tagName: name,\n syntaxKind: TSDocTagSyntaxKind.ModifierTag,\n }),\n )\n}\n\nconst parser = new TSDocParser(tsdocConfig)\n\n/** Recursively collect plain text from a TSDoc DocNode tree. */\nfunction nodeText(node: DocNode): string {\n if (node instanceof DocExcerpt) {\n return node.content.toString()\n }\n let out = ''\n for (const child of node.getChildNodes()) {\n out += nodeText(child)\n }\n return out\n}\n\n/** Render a DocNode subtree as markdown (preserving paragraph breaks). */\nfunction nodeMarkdown(node: DocNode): string {\n if (node instanceof DocPlainText)\n return node.text\n if (node instanceof DocSoftBreak)\n return ' '\n if (node instanceof DocCodeSpan)\n return `\\`${node.code}\\``\n if (node instanceof DocLinkTag) {\n // {@link Foo} or {@link Foo | alt text}\n if (node.codeDestination) {\n const parts = node.codeDestination.memberReferences.map(r =>\n r.memberIdentifier ? r.memberIdentifier.identifier : '',\n )\n const target = parts.filter(Boolean).join('.')\n return `\\`${node.linkText || target}\\``\n }\n if (node.urlDestination) {\n return `[${node.linkText || node.urlDestination}](${node.urlDestination})`\n }\n return node.linkText ?? ''\n }\n if (node instanceof DocFencedCode) {\n return `\\`\\`\\`${node.language || ''}\\n${node.code.replace(RE_TRAILING_WHITESPACE, '')}\\n\\`\\`\\``\n }\n if (node instanceof DocParagraph) {\n let out = ''\n for (const child of node.getChildNodes()) out += nodeMarkdown(child)\n return out.trim()\n }\n if (node instanceof DocSection) {\n const parts: string[] = []\n for (const child of node.getChildNodes()) {\n const rendered = nodeMarkdown(child)\n if (rendered)\n parts.push(rendered)\n }\n return parts.join('\\n\\n')\n }\n let out = ''\n for (const child of node.getChildNodes()) out += nodeMarkdown(child)\n return out\n}\n\n/** Recursively find the first DocFencedCode in a subtree. */\nfunction findFencedCode(node: DocNode): DocFencedCode | null {\n if (node instanceof DocFencedCode)\n return node\n for (const child of node.getChildNodes()) {\n const found = findFencedCode(child)\n if (found)\n return found\n }\n return null\n}\n\nfunction blockMarkdown(block: DocBlock | undefined): string {\n if (!block)\n return ''\n return nodeMarkdown(block.content).trim()\n}\n\nfunction parseExampleBlock(block: DocBlock): Example {\n const fenced = findFencedCode(block.content)\n if (fenced) {\n return {\n title: null,\n lang: fenced.language || 'ts',\n code: fenced.code.replace(RE_TRAILING_WHITESPACE, ''),\n description: null,\n }\n }\n // No fenced code — treat the whole block as the code body.\n return {\n title: null,\n lang: 'ts',\n code: blockMarkdown(block),\n description: null,\n }\n}\n\nexport function parseTSDoc(raw: string): VellumDoc {\n if (!raw.trim())\n return emptyDocComment()\n\n const ctx = parser.parseString(raw)\n const comment: DocComment = ctx.docComment\n\n const result: VellumDoc = emptyDocComment()\n result.raw = raw\n\n // Summary = first paragraph of summary section; description = remainder.\n const summaryChildren = comment.summarySection.getChildNodes()\n const summaryParts: string[] = []\n const descriptionParts: string[] = []\n let seenFirst = false\n for (const child of summaryChildren) {\n const md = nodeMarkdown(child)\n if (!md)\n continue\n if (!seenFirst) {\n summaryParts.push(md)\n seenFirst = true\n }\n else {\n descriptionParts.push(md)\n }\n }\n result.summary = summaryParts.join('\\n\\n').trim()\n\n // @remarks block (if present) becomes part of description.\n const remarks = blockMarkdown(comment.remarksBlock)\n if (remarks)\n descriptionParts.push(remarks)\n result.description = descriptionParts.join('\\n\\n').trim()\n\n // @param blocks.\n for (const p of comment.params.blocks) {\n result.params[p.parameterName] = blockMarkdown(p)\n }\n\n // @returns\n if (comment.returnsBlock) {\n result.returns = blockMarkdown(comment.returnsBlock)\n }\n\n // @deprecated\n if (comment.deprecatedBlock) {\n result.deprecated = { reason: blockMarkdown(comment.deprecatedBlock) }\n }\n\n // @see blocks — take plain text of each.\n for (const block of comment.seeBlocks) {\n const txt = blockMarkdown(block)\n if (txt)\n result.see.push(txt)\n }\n\n // Custom blocks: @example and others.\n for (const block of comment.customBlocks) {\n const name = block.blockTag.tagName\n if (name === '@example') {\n result.examples.push(parseExampleBlock(block))\n }\n else {\n const key = name\n const list = result.customTags[key] ?? []\n list.push(blockMarkdown(block))\n result.customTags[key] = list\n }\n }\n\n // Modifier tags: @beta, @internal, @public, etc. — record as customTags keys.\n for (const tag of comment.modifierTagSet.nodes) {\n const name = tag.tagName\n if (!(name in result.customTags))\n result.customTags[name] = []\n }\n\n return result\n}\n\nexport { DocNodeKind, nodeText }\n","import { relative } from 'node:path'\nimport ts from 'typescript'\n\nexport function moduleOf(root: string, fileName: string): string {\n return relative(root, fileName).replace(/\\\\/g, '/')\n}\n\nexport function makeId(modulePath: string, qualifiedName: string): string {\n return `ts:${modulePath}#${qualifiedName}`\n}\n\nexport function isExported(node: ts.Node): boolean {\n const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined\n return modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword) ?? false\n}\n\nexport function locationOf(node: ts.Node, sourceFile: ts.SourceFile, root: string) {\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile))\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd())\n return {\n file: relative(root, sourceFile.fileName).replace(/\\\\/g, '/'),\n line: start.line + 1,\n column: start.character + 1,\n endLine: end.line + 1,\n endColumn: end.character + 1,\n }\n}\n\n/**\n * Get the leading `/** ... *\\/` JSDoc comment text for a node, if any.\n * Returns the raw comment including delimiters.\n */\nexport function getLeadingJSDoc(node: ts.Node, sourceFile: ts.SourceFile): string {\n const text = sourceFile.text\n const ranges = ts.getLeadingCommentRanges(text, node.getFullStart())\n if (!ranges)\n return ''\n for (let i = ranges.length - 1; i >= 0; i--) {\n const r = ranges[i]!\n if (r.kind !== ts.SyntaxKind.MultiLineCommentTrivia)\n continue\n const slice = text.slice(r.pos, r.end)\n if (slice.startsWith('/**'))\n return slice\n }\n return ''\n}\n\n/**\n * Canonical declaration text for a node — JSDoc stripped, bodies removed,\n * printer-normalized. Mirrors what `tsc --declaration` would emit for the\n * surface of the symbol.\n */\nconst RE_TRAILING_SEMI = /;$/\n\nconst declarationPrinter = ts.createPrinter({\n removeComments: true,\n omitTrailingSemicolon: false,\n})\n\nfunction stripBodies(context: ts.TransformationContext): ts.Visitor {\n const visit: ts.Visitor = (node) => {\n if (ts.isFunctionDeclaration(node)) {\n return ts.factory.updateFunctionDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n node.name,\n node.typeParameters,\n node.parameters,\n node.type,\n undefined,\n )\n }\n if (ts.isMethodDeclaration(node)) {\n return ts.factory.updateMethodDeclaration(\n node,\n node.modifiers,\n node.asteriskToken,\n node.name,\n node.questionToken,\n node.typeParameters,\n node.parameters,\n node.type,\n undefined,\n )\n }\n if (ts.isConstructorDeclaration(node)) {\n return ts.factory.updateConstructorDeclaration(\n node,\n node.modifiers,\n node.parameters,\n undefined,\n )\n }\n if (ts.isGetAccessor(node)) {\n return ts.factory.updateGetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n node.type,\n undefined,\n )\n }\n if (ts.isSetAccessor(node)) {\n return ts.factory.updateSetAccessorDeclaration(\n node,\n node.modifiers,\n node.name,\n node.parameters,\n undefined,\n )\n }\n return ts.visitEachChild(node, visit, context)\n }\n return visit\n}\n\nexport function formatSignature(node: ts.Node, sourceFile: ts.SourceFile): string {\n if (ts.isVariableStatement(node))\n return node.getText(sourceFile).replace(RE_TRAILING_SEMI, '')\n\n // Detach from source positions so leading JSDoc trivia isn't re-emitted by\n // the printer.\n const synth = (ts as unknown as {\n getSynthesizedDeepClone: <T extends ts.Node>(n: T) => T\n }).getSynthesizedDeepClone(node)\n\n const result = ts.transform(synth, [\n ctx => n => ts.visitNode(n, stripBodies(ctx)) as ts.Node,\n ])\n const stripped = result.transformed[0] as ts.Node\n const text = declarationPrinter.printNode(ts.EmitHint.Unspecified, stripped, sourceFile)\n result.dispose()\n return text\n}\n","import type {\n DocComment,\n EnumVariant,\n Literal,\n Member,\n Parameter,\n TypeRef,\n TypeString,\n Symbol as VSymbol,\n} from '@vellum-docs/core'\n\nimport { emptyDocComment } from '@vellum-docs/core'\nimport ts from 'typescript'\n\nimport { parseTSDoc } from './tsdoc'\nimport {\n formatSignature,\n getLeadingJSDoc,\n isExported,\n locationOf,\n makeId,\n moduleOf,\n} from './util'\n\n// Module-level regex constants (eslint: e18e/prefer-static-regex)\nconst RE_STRING_LITERAL = /^\".*\"$|^'.*'$|^`.*`$/\nconst RE_NUMBER_LITERAL = /^-?\\d+(?:\\.\\d+)?$/\nconst RE_TRAILING_SEMI = /;$/\nconst RE_LEADING_AT = /^@/\n\ninterface WalkContext {\n checker: ts.TypeChecker\n sourceFile: ts.SourceFile\n modulePath: string\n root: string\n /** Map of qualified name → id, populated in a first pass for cross-ref resolution. */\n knownNames: Map<string, string>\n /** When true, all symbols are treated as exported (package extraction mode). */\n forceExported?: boolean\n}\n\nfunction isSymExported(node: ts.Node, ctx: WalkContext): boolean {\n return ctx.forceExported || isExported(node)\n}\n\nfunction docOrEmpty(node: ts.Node, sourceFile: ts.SourceFile): DocComment {\n const raw = getLeadingJSDoc(node, sourceFile)\n return raw ? parseTSDoc(raw) : emptyDocComment()\n}\n\nfunction literalFromText(text: string): Literal {\n const trimmed = text.trim()\n if (RE_STRING_LITERAL.test(trimmed)) {\n return { kind: 'string', text: trimmed, value: trimmed.slice(1, -1) }\n }\n if (RE_NUMBER_LITERAL.test(trimmed)) {\n return { kind: 'number', text: trimmed, value: Number(trimmed) }\n }\n if (trimmed === 'true' || trimmed === 'false') {\n return { kind: 'boolean', text: trimmed, value: trimmed === 'true' }\n }\n if (trimmed === 'null')\n return { kind: 'null', text: trimmed }\n if (trimmed === 'undefined')\n return { kind: 'undefined', text: trimmed }\n if (trimmed.startsWith('{'))\n return { kind: 'object', text: trimmed }\n if (trimmed.startsWith('['))\n return { kind: 'array', text: trimmed }\n return { kind: 'expression', text: trimmed }\n}\n\n/**\n * Build a TypeString from a type node, collecting identifier positions\n * whose symbols are declared in files we're extracting.\n */\nfunction typeStringFrom(typeNode: ts.TypeNode | undefined, ctx: WalkContext): TypeString {\n if (!typeNode)\n return { text: '', refs: [] }\n const text = typeNode.getText(ctx.sourceFile)\n const refs: TypeRef[] = []\n const baseOffset = typeNode.getStart(ctx.sourceFile)\n\n const visit = (node: ts.Node): void => {\n if (ts.isIdentifier(node)) {\n const name = node.text\n const refId = ctx.knownNames.get(name)\n if (refId) {\n const start = node.getStart(ctx.sourceFile) - baseOffset\n const end = node.getEnd() - baseOffset\n refs.push({ start, end, symbolId: refId })\n }\n }\n ts.forEachChild(node, visit)\n }\n visit(typeNode)\n\n return { text, refs }\n}\n\nfunction extractParameter(param: ts.ParameterDeclaration, ctx: WalkContext, paramDocs: Record<string, string>): Parameter {\n return {\n name: param.name.getText(ctx.sourceFile),\n type: typeStringFrom(param.type, ctx),\n optional: !!param.questionToken || !!param.initializer,\n rest: !!param.dotDotDotToken,\n defaultValue: param.initializer\n ? literalFromText(param.initializer.getText(ctx.sourceFile))\n : null,\n doc: paramDocs[param.name.getText(ctx.sourceFile)] ?? '',\n }\n}\n\nfunction extractFunction(node: ts.FunctionDeclaration, ctx: WalkContext): VSymbol | null {\n if (!node.name)\n return null\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'function',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n parameters: node.parameters.map(p => extractParameter(p, ctx, doc.params)),\n returnType: typeStringFrom(node.type, ctx),\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\nfunction extractInterfaceMembers(node: ts.InterfaceDeclaration, ctx: WalkContext): Member[] {\n return node.members.map((m): Member => {\n const name = m.name && ts.isIdentifier(m.name) ? m.name.text : m.name?.getText(ctx.sourceFile) ?? ''\n const doc = docOrEmpty(m, ctx.sourceFile)\n\n if (ts.isMethodSignature(m)) {\n return {\n name,\n kind: 'method',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: { text: m.type?.getText(ctx.sourceFile) ?? '', refs: [] },\n optional: !!m.questionToken,\n readonly: false,\n visibility: 'public',\n static: false,\n doc,\n }\n }\n if (ts.isPropertySignature(m)) {\n return {\n name,\n kind: 'property',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: typeStringFrom(m.type, ctx),\n optional: !!m.questionToken,\n readonly: !!(ts.getModifiers(m)?.some(mod => mod.kind === ts.SyntaxKind.ReadonlyKeyword)),\n visibility: 'public',\n static: false,\n doc,\n }\n }\n return {\n name,\n kind: 'property',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: { text: '', refs: [] },\n optional: false,\n readonly: false,\n visibility: 'public',\n static: false,\n doc,\n }\n })\n}\n\nfunction extractInterface(node: ts.InterfaceDeclaration, ctx: WalkContext): VSymbol {\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'interface',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n members: extractInterfaceMembers(node, ctx),\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\nfunction extractTypeAlias(node: ts.TypeAliasDeclaration, ctx: WalkContext): VSymbol {\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'type',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n aliasOf: typeStringFrom(node.type, ctx),\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\nfunction extractVariable(statement: ts.VariableStatement, decl: ts.VariableDeclaration, ctx: WalkContext): VSymbol | null {\n if (!ts.isIdentifier(decl.name))\n return null\n const name = decl.name.text\n const isConst\n = (statement.declarationList.flags & ts.NodeFlags.Const) === ts.NodeFlags.Const\n const doc = docOrEmpty(statement, ctx.sourceFile)\n\n const initText = decl.initializer?.getText(ctx.sourceFile)\n const value = initText ? literalFromText(initText) : null\n\n // If no annotation, try to ask the checker for the inferred type.\n let valueType: TypeString\n if (decl.type) {\n valueType = typeStringFrom(decl.type, ctx)\n }\n else {\n try {\n const t = ctx.checker.getTypeAtLocation(decl)\n valueType = {\n text: ctx.checker.typeToString(t, decl, ts.TypeFormatFlags.NoTruncation),\n refs: [],\n }\n }\n catch {\n valueType = { text: '', refs: [] }\n }\n }\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: isConst ? 'const' : 'variable',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(decl, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(statement, ctx),\n signature: `${isConst ? 'const' : 'let'} ${name}${valueType.text ? `: ${valueType.text}` : ''}${\n value ? ` = ${value.text}` : ''\n }`,\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n mutable: !isConst,\n valueType,\n value,\n }\n}\n\nfunction extractEnum(node: ts.EnumDeclaration, ctx: WalkContext): VSymbol {\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n const variants: EnumVariant[] = node.members.map(m => ({\n name: m.name.getText(ctx.sourceFile),\n value: m.initializer ? literalFromText(m.initializer.getText(ctx.sourceFile)) : null,\n doc: docOrEmpty(m, ctx.sourceFile),\n }))\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'enum',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n variants,\n }\n}\n\nfunction extractClass(node: ts.ClassDeclaration, ctx: WalkContext): VSymbol | null {\n if (!node.name)\n return null\n const name = node.name.text\n const doc = docOrEmpty(node, ctx.sourceFile)\n\n const members: Member[] = node.members\n .map((m): Member | null => {\n const memberName\n = m.name && ts.isIdentifier(m.name)\n ? m.name.text\n : m.name?.getText(ctx.sourceFile) ?? ''\n const memberDoc = docOrEmpty(m, ctx.sourceFile)\n const mods = ts.canHaveModifiers(m) ? ts.getModifiers(m) : undefined\n const visibility\n = mods?.some(mod => mod.kind === ts.SyntaxKind.PrivateKeyword)\n ? 'private'\n : mods?.some(mod => mod.kind === ts.SyntaxKind.ProtectedKeyword)\n ? 'protected'\n : 'public'\n const isStatic\n = mods?.some(mod => mod.kind === ts.SyntaxKind.StaticKeyword) ?? false\n\n if (ts.isMethodDeclaration(m)) {\n return {\n name: memberName,\n kind: 'method',\n signature: formatSignature(m, ctx.sourceFile),\n type: typeStringFrom(m.type, ctx),\n optional: !!m.questionToken,\n readonly: false,\n visibility,\n static: isStatic,\n doc: memberDoc,\n }\n }\n if (ts.isPropertyDeclaration(m)) {\n return {\n name: memberName,\n kind: 'property',\n signature: m.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: typeStringFrom(m.type, ctx),\n optional: !!m.questionToken,\n readonly:\n mods?.some(mod => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ?? false,\n visibility,\n static: isStatic,\n doc: memberDoc,\n }\n }\n if (ts.isConstructorDeclaration(m)) {\n return {\n name: 'constructor',\n kind: 'constructor',\n signature: `(${m.parameters.map(p => p.getText(ctx.sourceFile)).join(', ')})`,\n type: { text: '', refs: [] },\n optional: false,\n readonly: false,\n visibility,\n static: false,\n doc: memberDoc,\n }\n }\n return null\n })\n .filter((m): m is Member => m !== null)\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: 'class',\n language: 'ts',\n module: ctx.modulePath,\n source: locationOf(node, ctx.sourceFile, ctx.root),\n visibility: 'public',\n exported: isSymExported(node, ctx),\n signature: formatSignature(node, ctx.sourceFile),\n typeRefs: [],\n doc,\n tags: Object.keys(doc.customTags).map(t => t.replace(RE_LEADING_AT, '')),\n members,\n typeParameters: (node.typeParameters ?? []).map(tp => ({\n name: tp.name.text,\n constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,\n default: tp.default ? typeStringFrom(tp.default, ctx) : null,\n })),\n }\n}\n\n/**\n * First pass: collect names that will become SymbolIds, so that typeStringFrom\n * can linkify identifiers referencing them.\n */\nexport function collectNames(sourceFile: ts.SourceFile, root: string, moduleOverride?: string): Map<string, string> {\n const modulePath = moduleOverride ?? moduleOf(root, sourceFile.fileName)\n const names = new Map<string, string>()\n for (const stmt of sourceFile.statements) {\n if (ts.isInterfaceDeclaration(stmt) || ts.isTypeAliasDeclaration(stmt) || ts.isClassDeclaration(stmt) || ts.isEnumDeclaration(stmt)) {\n if (stmt.name)\n names.set(stmt.name.text, makeId(modulePath, stmt.name.text))\n }\n else if (ts.isFunctionDeclaration(stmt) && stmt.name) {\n names.set(stmt.name.text, makeId(modulePath, stmt.name.text))\n }\n else if (ts.isVariableStatement(stmt)) {\n for (const d of stmt.declarationList.declarations) {\n if (ts.isIdentifier(d.name)) {\n names.set(d.name.text, makeId(modulePath, d.name.text))\n }\n }\n }\n }\n return names\n}\n\nexport function extractFromFile(sourceFile: ts.SourceFile, checker: ts.TypeChecker, root: string, knownNames: Map<string, string>, moduleOverride?: string): VSymbol[] {\n const modulePath = moduleOverride ?? moduleOf(root, sourceFile.fileName)\n const ctx: WalkContext = {\n checker,\n sourceFile,\n modulePath,\n root,\n knownNames,\n }\n\n // For package files (moduleOverride set), use the checker to resolve all\n // exports — this follows re-exports through barrel files.\n if (moduleOverride) {\n return extractFromModuleExports(sourceFile, checker, ctx)\n }\n\n const results: VSymbol[] = []\n for (const stmt of sourceFile.statements) {\n if (ts.isInterfaceDeclaration(stmt)) {\n results.push(extractInterface(stmt, ctx))\n }\n else if (ts.isTypeAliasDeclaration(stmt)) {\n results.push(extractTypeAlias(stmt, ctx))\n }\n else if (ts.isFunctionDeclaration(stmt)) {\n const s = extractFunction(stmt, ctx)\n if (s)\n results.push(s)\n }\n else if (ts.isVariableStatement(stmt)) {\n for (const decl of stmt.declarationList.declarations) {\n const s = extractVariable(stmt, decl, ctx)\n if (s)\n results.push(s)\n }\n }\n else if (ts.isEnumDeclaration(stmt)) {\n results.push(extractEnum(stmt, ctx))\n }\n else if (ts.isClassDeclaration(stmt)) {\n const s = extractClass(stmt, ctx)\n if (s)\n results.push(s)\n }\n }\n return results\n}\n\n/**\n * Extract symbols by resolving a module's exports through the type checker.\n * This follows re-exports, barrel files, and `export * from` chains —\n * the right strategy for package .d.ts files.\n */\nfunction extractFromModuleExports(sourceFile: ts.SourceFile, checker: ts.TypeChecker, ctx: WalkContext): VSymbol[] {\n const fileSymbol = checker.getSymbolAtLocation(sourceFile)\n if (!fileSymbol)\n return []\n\n const exports = checker.getExportsOfModule(fileSymbol)\n const results: VSymbol[] = []\n\n for (const sym of exports) {\n // The public export name — may differ from the declaration name\n // when re-exported with an alias (e.g. `export { Foo$1 as Foo }`).\n const exportName = sym.name\n\n // Resolve aliases (re-exports).\n const resolved\n = sym.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(sym) : sym\n const decls = resolved.getDeclarations()\n if (!decls || decls.length === 0)\n continue\n const decl = decls[0]!\n const declSourceFile = decl.getSourceFile()\n\n // Build a context for the declaration's actual source file (may differ\n // from the barrel file). Force exported=true since the checker told us\n // this symbol is in the module's public exports.\n const declCtx: WalkContext = {\n ...ctx,\n sourceFile: declSourceFile,\n forceExported: true,\n }\n\n let extracted: VSymbol | null = null\n\n if (ts.isInterfaceDeclaration(decl)) {\n extracted = extractInterface(decl, declCtx)\n }\n else if (ts.isTypeAliasDeclaration(decl)) {\n extracted = extractTypeAlias(decl, declCtx)\n }\n else if (ts.isFunctionDeclaration(decl)) {\n extracted = extractFunction(decl, declCtx)\n }\n else if (ts.isVariableDeclaration(decl)) {\n const stmt = decl.parent?.parent\n if (stmt && ts.isVariableStatement(stmt))\n extracted = extractVariable(stmt, decl, declCtx)\n }\n else if (ts.isEnumDeclaration(decl)) {\n extracted = extractEnum(decl, declCtx)\n }\n else if (ts.isClassDeclaration(decl)) {\n extracted = extractClass(decl, declCtx)\n }\n\n // Override name and id with the public export name, which may\n // differ from the declaration name due to re-export aliasing.\n if (extracted) {\n if (extracted.name !== exportName) {\n extracted.name = exportName\n extracted.id = makeId(ctx.modulePath, exportName)\n }\n results.push(extracted)\n }\n }\n return results\n}\n","import type { ExtractInput, Extractor, Symbol as VSymbol } from '@vellum-docs/core'\n\nimport { realpathSync } from 'node:fs'\nimport ts from 'typescript'\n\nimport { collectNames, extractFromFile } from './walk'\n\nexport interface TypeScriptExtractorOptions {\n /** Compiler options applied to the in-memory Program. */\n compilerOptions?: ts.CompilerOptions\n}\n\nconst defaultCompilerOptions: ts.CompilerOptions = {\n target: ts.ScriptTarget.ES2022,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n allowJs: true,\n strict: false,\n noEmit: true,\n skipLibCheck: true,\n esModuleInterop: true,\n allowImportingTsExtensions: false,\n declaration: false,\n}\n\nexport class TypeScriptExtractor implements Extractor {\n readonly language = 'ts'\n readonly extensions = ['.ts', '.tsx', '.mts', '.cts'] as const\n\n private readonly options: TypeScriptExtractorOptions\n\n constructor(options: TypeScriptExtractorOptions = {}) {\n this.options = options\n }\n\n async extract(input: ExtractInput): Promise<VSymbol[]> {\n const packageFiles = input.packageFiles ?? []\n const allRootNames = [\n ...input.files,\n ...packageFiles.map(pf => pf.file),\n ]\n if (allRootNames.length === 0)\n return []\n\n const compilerOptions: ts.CompilerOptions = {\n ...defaultCompilerOptions,\n ...this.options.compilerOptions,\n }\n\n const program = ts.createProgram({\n rootNames: allRootNames,\n options: compilerOptions,\n })\n const checker = program.getTypeChecker()\n\n // Build a map of resolved file path → package name for package files.\n const packageModuleMap = new Map<string, string>()\n for (const pf of packageFiles) {\n packageModuleMap.set(pf.file, pf.packageName)\n }\n\n // First pass: collect names across all files for cross-ref resolution.\n const allNames = new Map<string, string>()\n for (const rootName of allRootNames) {\n let sf = program.getSourceFile(rootName)\n if (!sf) {\n try {\n sf = program.getSourceFile(realpathSync(rootName))\n }\n catch {}\n }\n if (!sf)\n continue\n const moduleOverride = packageModuleMap.get(rootName)\n const names = collectNames(sf, input.root, moduleOverride)\n for (const [k, v] of names) allNames.set(k, v)\n }\n\n // Second pass: extract symbols.\n const results: VSymbol[] = []\n\n // Project files — skip .d.ts (those are ambient, not user-authored).\n for (const file of input.files) {\n const sf = program.getSourceFile(file)\n if (!sf || sf.isDeclarationFile)\n continue\n const symbols = extractFromFile(sf, checker, input.root, allNames)\n results.push(...symbols)\n }\n\n // Package .d.ts files — these ARE declaration files, extract them.\n // Use realpathSync because pnpm symlinks workspace packages and the\n // TS compiler resolves symlinks internally, so getSourceFile() with\n // the symlink path may return undefined.\n for (const pf of packageFiles) {\n let sf = program.getSourceFile(pf.file)\n if (!sf) {\n try {\n sf = program.getSourceFile(realpathSync(pf.file))\n }\n catch {}\n }\n if (!sf)\n continue\n const symbols = extractFromFile(sf, checker, input.root, allNames, pf.packageName)\n results.push(...symbols)\n }\n\n return results\n }\n}\n"],"mappings":";;;;;;AAwBA,MAAM,yBAAyB;AAK/B,MAAM,cAAc,IAAI,oBAAoB;AAC5C,MAAM,kBAAkB,IAAI,IAC1B,YAAY,eAAe,KAAI,MAAK,EAAE,QAAQ,aAAa,CAAC,CAC7D;AACD,KAAK,MAAM,QAAQ,CAAC,YAAY,EAAE;AAChC,KAAI,gBAAgB,IAAI,KAAK,aAAa,CAAC,CACzC;AACF,aAAY,iBACV,IAAI,mBAAmB;EACrB,SAAS;EACT,YAAY,mBAAmB;EAChC,CAAC,CACH;;AAGH,MAAM,SAAS,IAAI,YAAY,YAAY;;AAe3C,SAAS,aAAa,MAAuB;AAC3C,KAAI,gBAAgB,aAClB,QAAO,KAAK;AACd,KAAI,gBAAgB,aAClB,QAAO;AACT,KAAI,gBAAgB,YAClB,QAAO,KAAK,KAAK,KAAK;AACxB,KAAI,gBAAgB,YAAY;AAE9B,MAAI,KAAK,iBAAiB;GAIxB,MAAM,SAHQ,KAAK,gBAAgB,iBAAiB,KAAI,MACtD,EAAE,mBAAmB,EAAE,iBAAiB,aAAa,GACtD,CACoB,OAAO,QAAQ,CAAC,KAAK,IAAI;AAC9C,UAAO,KAAK,KAAK,YAAY,OA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I,CAAC,GACH;GACF,MAAM,iBAAiB,iBAAiB,IAAI,SAAS;GACrD,MAAM,QAAQ,aAAa,IAAI,MAAM,MAAM,eAAe;AAC1D,QAAK,MAAM,CAAC,GAAG,MAAM,MAAO,UAAS,IAAI,GAAG,EAAE;;EAIhD,MAAM,UAAqB,EAAE;AAG7B,OAAK,MAAM,QAAQ,MAAM,OAAO;GAC9B,MAAM,KAAK,QAAQ,cAAc,KAAK;AACtC,OAAI,CAAC,MAAM,GAAG,kBACZ;GACF,MAAM,UAAU,gBAAgB,IAAI,SAAS,MAAM,MAAM,SAAS;AAClE,WAAQ,KAAK,GAAG,QAAQ;;AAO1B,OAAK,MAAM,MAAM,cAAc;GAC7B,IAAI,KAAK,QAAQ,cAAc,GAAG,KAAK;AACvC,OAAI,CAAC,GACH,KAAI;AACF,SAAK,QAAQ,cAAc,aAAa,GAAG,KAAK,CAAC;WAE7C;AAER,OAAI,CAAC,GACH;GACF,MAAM,UAAU,gBAAgB,IAAI,SAAS,MAAM,MAAM,UAAU,GAAG,YAAY;AAClF,WAAQ,KAAK,GAAG,QAAQ;;AAG1B,SAAO"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vellum-docs/extractor-typescript",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/photon-hq/vellum.git",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@microsoft/tsdoc": "^0.15.1",
23
23
  "typescript": "^5.6.3",
24
- "@vellum-docs/core": "0.2.1"
24
+ "@vellum-docs/core": "0.2.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "typescript": "^5.6.3"