@vellum-docs/extractor-typescript 0.2.3 → 0.3.0

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,7 +157,7 @@ function getLeadingJSDoc(node, sourceFile) {
157
157
  return "";
158
158
  }
159
159
  /**
160
- * Canonical declaration text for a node JSDoc stripped, bodies removed,
160
+ * Canonical declaration text for a node - JSDoc stripped, bodies removed,
161
161
  * printer-normalized. Mirrors what `tsc --declaration` would emit for the
162
162
  * surface of the symbol.
163
163
  */
@@ -192,6 +192,7 @@ const RE_STRING_LITERAL = /^".*"$|^'.*'$|^`.*`$/;
192
192
  const RE_NUMBER_LITERAL = /^-?\d+(?:\.\d+)?$/;
193
193
  const RE_TRAILING_SEMI = /;$/;
194
194
  const RE_LEADING_AT = /^@/;
195
+ const RE_WHITESPACE_RUNS = /\s+/g;
195
196
  function isSymExported(node, ctx) {
196
197
  return ctx.forceExported || isExported(node);
197
198
  }
@@ -266,9 +267,11 @@ function typeStringFrom(typeNode, ctx) {
266
267
  ts.forEachChild(node, visit);
267
268
  };
268
269
  visit(typeNode);
270
+ const collapsed = text.replace(RE_WHITESPACE_RUNS, " ").trim();
269
271
  return {
270
272
  text,
271
- refs
273
+ refs,
274
+ ...collapsed !== text ? { oneline: collapsed } : {}
272
275
  };
273
276
  }
274
277
  function extractParameter(param, ctx, paramDocs) {
@@ -379,10 +382,11 @@ function extractInterface(node, ctx) {
379
382
  function extractTypeAlias(node, ctx) {
380
383
  const name = node.name.text;
381
384
  const doc = docOrEmpty(node, ctx.sourceFile);
385
+ const detected = detectDiscriminatedUnion(node, ctx);
382
386
  return {
383
387
  id: makeId(ctx.modulePath, name),
384
388
  name,
385
- kind: "type",
389
+ kind: detected ? "enum" : "type",
386
390
  language: "ts",
387
391
  module: ctx.modulePath,
388
392
  source: locationOf(node, ctx.sourceFile, ctx.root),
@@ -397,7 +401,135 @@ function extractTypeAlias(node, ctx) {
397
401
  name: tp.name.text,
398
402
  constraint: tp.constraint ? typeStringFrom(tp.constraint, ctx) : null,
399
403
  default: tp.default ? typeStringFrom(tp.default, ctx) : null
400
- }))
404
+ })),
405
+ ...detected ? {
406
+ variants: detected.variants,
407
+ discriminator: detected.discriminator
408
+ } : {}
409
+ };
410
+ }
411
+ /**
412
+ * Detect a well-formed discriminated union:
413
+ *
414
+ * type X =
415
+ * | { type: 'a'; ...fields }
416
+ * | { type: 'b'; ...fields }
417
+ *
418
+ * Returns the promoted variants and the discriminator key name, or null
419
+ * when the alias isn't a union, any arm isn't an inline object type, or
420
+ * no shared property is literal-typed on every arm.
421
+ *
422
+ * Detection picks the candidate property with the most distinct literal
423
+ * values across arms; ties break on source order. Falls through on
424
+ * ambiguity - named-reference arms, primitives mixed with objects, or
425
+ * non-literal discriminators all hit the null path and the symbol stays
426
+ * `kind: 'type'`.
427
+ */
428
+ function detectDiscriminatedUnion(node, ctx) {
429
+ if (!ts.isUnionTypeNode(node.type)) return null;
430
+ const arms = [];
431
+ for (const t of node.type.types) {
432
+ if (!ts.isTypeLiteralNode(t)) return null;
433
+ arms.push(t);
434
+ }
435
+ if (arms.length < 2) return null;
436
+ const candidates = [];
437
+ const firstArmProps = arms[0].members.filter(ts.isPropertySignature);
438
+ for (const prop of firstArmProps) {
439
+ if (!prop.name || !ts.isIdentifier(prop.name)) continue;
440
+ const key = prop.name.text;
441
+ const literals = collectDiscriminatorLiterals(key, arms);
442
+ if (literals) candidates.push({
443
+ key,
444
+ literals
445
+ });
446
+ }
447
+ if (candidates.length === 0) return null;
448
+ let best = candidates[0];
449
+ let bestDistinct = new Set(best.literals.map((l) => l.text)).size;
450
+ for (const c of candidates.slice(1)) {
451
+ const distinct = new Set(c.literals.map((l) => l.text)).size;
452
+ if (distinct > bestDistinct) {
453
+ best = c;
454
+ bestDistinct = distinct;
455
+ }
456
+ }
457
+ return {
458
+ variants: arms.map((arm, i) => {
459
+ const tag = best.literals[i];
460
+ const fields = [];
461
+ for (const m of arm.members) {
462
+ if (!ts.isPropertySignature(m) || !m.name || !ts.isIdentifier(m.name)) continue;
463
+ if (m.name.text === best.key) continue;
464
+ fields.push(memberFromPropertySignature(m, ctx));
465
+ }
466
+ return {
467
+ name: String(tag.value ?? tag.text),
468
+ value: tag,
469
+ doc: docOrEmpty(arm, ctx.sourceFile),
470
+ ...fields.length > 0 ? { fields } : {}
471
+ };
472
+ }),
473
+ discriminator: best.key
474
+ };
475
+ }
476
+ /**
477
+ * Walk every arm looking for a property named `key` with a literal type.
478
+ * Returns the per-arm literals in arm order, or null if any arm is
479
+ * missing the property or carries a non-literal type for it.
480
+ */
481
+ function collectDiscriminatorLiterals(key, arms) {
482
+ const literals = [];
483
+ for (const arm of arms) {
484
+ const match = arm.members.find((m) => ts.isPropertySignature(m) && !!m.name && ts.isIdentifier(m.name) && m.name.text === key);
485
+ if (!match) return null;
486
+ const lit = literalFromPropertySignature(match);
487
+ if (!lit) return null;
488
+ literals.push(lit);
489
+ }
490
+ return literals;
491
+ }
492
+ function literalFromPropertySignature(prop) {
493
+ if (!prop.type || !ts.isLiteralTypeNode(prop.type)) return null;
494
+ const lit = prop.type.literal;
495
+ if (ts.isStringLiteral(lit)) return {
496
+ kind: "string",
497
+ text: JSON.stringify(lit.text),
498
+ value: lit.text
499
+ };
500
+ if (ts.isNumericLiteral(lit)) {
501
+ const n = Number(lit.text);
502
+ return {
503
+ kind: "number",
504
+ text: lit.text,
505
+ value: n
506
+ };
507
+ }
508
+ if (lit.kind === ts.SyntaxKind.TrueKeyword) return {
509
+ kind: "boolean",
510
+ text: "true",
511
+ value: true
512
+ };
513
+ if (lit.kind === ts.SyntaxKind.FalseKeyword) return {
514
+ kind: "boolean",
515
+ text: "false",
516
+ value: false
517
+ };
518
+ return null;
519
+ }
520
+ function memberFromPropertySignature(prop, ctx) {
521
+ const name = prop.name && ts.isIdentifier(prop.name) ? prop.name.text : prop.name?.getText(ctx.sourceFile) ?? "";
522
+ const readonly = !!ts.getModifiers(prop)?.some((m) => m.kind === ts.SyntaxKind.ReadonlyKeyword);
523
+ return {
524
+ name,
525
+ kind: "property",
526
+ signature: prop.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ""),
527
+ type: typeStringFrom(prop.type, ctx),
528
+ optional: !!prop.questionToken,
529
+ readonly,
530
+ visibility: "public",
531
+ static: false,
532
+ doc: docOrEmpty(prop, ctx.sourceFile)
401
533
  };
402
534
  }
403
535
  /**
@@ -409,7 +541,7 @@ function extractTypeAlias(node, ctx) {
409
541
  * Both forms produce an object whose property *types* are literals
410
542
  * (string/number/boolean). From a docs consumer's perspective this is
411
543
  * interchangeable with a real `enum`, so we promote it and populate
412
- * `variants` templates can render both source forms identically.
544
+ * `variants` - templates can render both source forms identically.
413
545
  *
414
546
  * Returns the variant list on match, or `null` when any property isn't
415
547
  * literal-typed (regular configs, functions, nested objects all fall
@@ -644,7 +776,7 @@ function extractFromFile(sourceFile, checker, root, knownNames, moduleOverride)
644
776
  /**
645
777
  * When `extractVariable` promotes an `as-const-enum` const to `kind: 'enum'`,
646
778
  * the common sibling `type X = (typeof X)[keyof typeof X]` becomes redundant
647
- * it exists purely to re-export the object's value type as a type name.
779
+ * - it exists purely to re-export the object's value type as a type name.
648
780
  * Suppress it so doc authors don't see a duplicate entry for `X`.
649
781
  */
650
782
  function suppressSelfReferentialAliases(symbols) {
@@ -657,7 +789,7 @@ function suppressSelfReferentialAliases(symbols) {
657
789
  }
658
790
  /**
659
791
  * Extract symbols by resolving a module's exports through the type checker.
660
- * This follows re-exports, barrel files, and `export * from` chains
792
+ * This follows re-exports, barrel files, and `export * from` chains -
661
793
  * the right strategy for package .d.ts files.
662
794
  */
663
795
  function extractFromModuleExports(sourceFile, checker, ctx) {
@@ -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 * 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\n/**\n * Detect the \"as-const enum\" pattern:\n *\n * const X = { a: \"foo\", b: \"bar\" } as const\n * declare const X: { readonly a: \"foo\"; readonly b: \"bar\" }\n *\n * Both forms produce an object whose property *types* are literals\n * (string/number/boolean). From a docs consumer's perspective this is\n * interchangeable with a real `enum`, so we promote it and populate\n * `variants` — templates can render both source forms identically.\n *\n * Returns the variant list on match, or `null` when any property isn't\n * literal-typed (regular configs, functions, nested objects all fall\n * through to the normal const extraction path).\n */\nfunction detectAsConstEnum(decl: ts.VariableDeclaration, ctx: WalkContext): EnumVariant[] | null {\n let type: ts.Type\n try {\n type = ctx.checker.getTypeAtLocation(decl)\n }\n catch {\n return null\n }\n const props = type.getProperties()\n if (props.length === 0)\n return null\n\n const variants: EnumVariant[] = []\n for (const prop of props) {\n const propType = ctx.checker.getTypeOfSymbolAtLocation(prop, decl)\n const literal = literalFromType(propType)\n if (!literal)\n return null\n\n const propDecls = prop.getDeclarations()\n const propDecl = propDecls?.[0]\n const propDoc = propDecl\n ? docOrEmpty(propDecl, propDecl.getSourceFile())\n : emptyDocComment()\n\n variants.push({ name: prop.name, value: literal, doc: propDoc })\n }\n return variants\n}\n\nfunction literalFromType(t: ts.Type): Literal | null {\n if (t.isStringLiteral()) {\n const v = (t as ts.StringLiteralType).value\n return { kind: 'string', text: JSON.stringify(v), value: v }\n }\n if (t.isNumberLiteral()) {\n const v = (t as ts.NumberLiteralType).value\n return { kind: 'number', text: String(v), value: v }\n }\n if (t.flags & ts.TypeFlags.BooleanLiteral) {\n // `intrinsicName` is `\"true\"` or `\"false\"` on boolean literal types —\n // not in the public ts typings.\n const v = (t as unknown as { intrinsicName?: string }).intrinsicName === 'true'\n return { kind: 'boolean', text: String(v), value: v }\n }\n return null\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 // Promote the as-const-enum pattern to `kind: 'enum'`. `signature`, `value`,\n // and `valueType` stay as the source form (`declare const ...` / `{...} as\n // const`) — `kind` drives template choice; `signature` still matches tsc.\n const variants = isConst ? detectAsConstEnum(decl, ctx) : null\n const kind: VSymbol['kind'] = variants ? 'enum' : isConst ? 'const' : 'variable'\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind,\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 ...(variants ? { variants } : {}),\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 suppressSelfReferentialAliases(results)\n}\n\n/**\n * When `extractVariable` promotes an `as-const-enum` const to `kind: 'enum'`,\n * the common sibling `type X = (typeof X)[keyof typeof X]` becomes redundant\n * — it exists purely to re-export the object's value type as a type name.\n * Suppress it so doc authors don't see a duplicate entry for `X`.\n */\nfunction suppressSelfReferentialAliases(symbols: VSymbol[]): VSymbol[] {\n const promotedEnumNames = new Set(\n symbols.filter(s => s.kind === 'enum' && s.variants !== undefined).map(s => s.name),\n )\n if (promotedEnumNames.size === 0)\n return symbols\n\n return symbols.filter((s) => {\n if (s.kind !== 'type' || !promotedEnumNames.has(s.name))\n return true\n const alias = s.aliasOf?.text.replace(/\\s+/g, '')\n return alias !== `(typeof${s.name})[keyoftypeof${s.name}]`\n })\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 suppressSelfReferentialAliases(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,I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Q,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 = /^@/\nconst RE_WHITESPACE_RUNS = /\\s+/g\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 // `oneline`: `text` with whitespace runs collapsed, for cells/tooltips.\n // Omit when equal to `text` to save bytes in the cache for the common\n // single-line case. `refs` offsets are into `text`, not `oneline`.\n const collapsed = text.replace(RE_WHITESPACE_RUNS, ' ').trim()\n return {\n text,\n refs,\n ...(collapsed !== text ? { oneline: collapsed } : {}),\n }\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\n // Promote well-formed discriminated unions (e.g. `type X = {type:'a'; ...}\n // | {type:'b'; ...}`) to `kind: 'enum'` - same rule the `as const` path\n // follows: `kind` describes the shape, `signature` stays faithful to the\n // source, `aliasOf` is kept for backward compatibility.\n const detected = detectDiscriminatedUnion(node, ctx)\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind: detected ? 'enum' : '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 ...(detected ? { variants: detected.variants, discriminator: detected.discriminator } : {}),\n }\n}\n\n/**\n * Detect a well-formed discriminated union:\n *\n * type X =\n * | { type: 'a'; ...fields }\n * | { type: 'b'; ...fields }\n *\n * Returns the promoted variants and the discriminator key name, or null\n * when the alias isn't a union, any arm isn't an inline object type, or\n * no shared property is literal-typed on every arm.\n *\n * Detection picks the candidate property with the most distinct literal\n * values across arms; ties break on source order. Falls through on\n * ambiguity - named-reference arms, primitives mixed with objects, or\n * non-literal discriminators all hit the null path and the symbol stays\n * `kind: 'type'`.\n */\nfunction detectDiscriminatedUnion(\n node: ts.TypeAliasDeclaration,\n ctx: WalkContext,\n): { variants: EnumVariant[], discriminator: string } | null {\n if (!ts.isUnionTypeNode(node.type))\n return null\n const arms: ts.TypeLiteralNode[] = []\n for (const t of node.type.types) {\n if (!ts.isTypeLiteralNode(t))\n return null\n arms.push(t)\n }\n if (arms.length < 2)\n return null\n\n // Candidate discriminator: a property name present on every arm with a\n // literal type (string/number/boolean) on every arm.\n interface Candidate { key: string, literals: Literal[] }\n const candidates: Candidate[] = []\n const firstArmProps = arms[0]!.members.filter(ts.isPropertySignature)\n\n for (const prop of firstArmProps) {\n if (!prop.name || !ts.isIdentifier(prop.name))\n continue\n const key = prop.name.text\n const literals = collectDiscriminatorLiterals(key, arms)\n if (literals)\n candidates.push({ key, literals })\n }\n\n if (candidates.length === 0)\n return null\n\n // Pick the property with the most distinct literal values across arms.\n let best = candidates[0]!\n let bestDistinct = new Set(best.literals.map(l => l.text)).size\n for (const c of candidates.slice(1)) {\n const distinct = new Set(c.literals.map(l => l.text)).size\n if (distinct > bestDistinct) {\n best = c\n bestDistinct = distinct\n }\n }\n\n const variants: EnumVariant[] = arms.map((arm, i) => {\n const tag = best.literals[i]!\n const fields: Member[] = []\n for (const m of arm.members) {\n if (!ts.isPropertySignature(m) || !m.name || !ts.isIdentifier(m.name))\n continue\n if (m.name.text === best.key)\n continue\n fields.push(memberFromPropertySignature(m, ctx))\n }\n return {\n name: String(tag.value ?? tag.text),\n value: tag,\n doc: docOrEmpty(arm, ctx.sourceFile),\n ...(fields.length > 0 ? { fields } : {}),\n }\n })\n\n return { variants, discriminator: best.key }\n}\n\n/**\n * Walk every arm looking for a property named `key` with a literal type.\n * Returns the per-arm literals in arm order, or null if any arm is\n * missing the property or carries a non-literal type for it.\n */\nfunction collectDiscriminatorLiterals(\n key: string,\n arms: ts.TypeLiteralNode[],\n): Literal[] | null {\n const literals: Literal[] = []\n for (const arm of arms) {\n const match = arm.members.find(\n (m): m is ts.PropertySignature =>\n ts.isPropertySignature(m)\n && !!m.name\n && ts.isIdentifier(m.name)\n && m.name.text === key,\n )\n if (!match)\n return null\n const lit = literalFromPropertySignature(match)\n if (!lit)\n return null\n literals.push(lit)\n }\n return literals\n}\n\nfunction literalFromPropertySignature(prop: ts.PropertySignature): Literal | null {\n if (!prop.type || !ts.isLiteralTypeNode(prop.type))\n return null\n const lit = prop.type.literal\n if (ts.isStringLiteral(lit))\n return { kind: 'string', text: JSON.stringify(lit.text), value: lit.text }\n if (ts.isNumericLiteral(lit)) {\n const n = Number(lit.text)\n return { kind: 'number', text: lit.text, value: n }\n }\n if (lit.kind === ts.SyntaxKind.TrueKeyword)\n return { kind: 'boolean', text: 'true', value: true }\n if (lit.kind === ts.SyntaxKind.FalseKeyword)\n return { kind: 'boolean', text: 'false', value: false }\n return null\n}\n\nfunction memberFromPropertySignature(prop: ts.PropertySignature, ctx: WalkContext): Member {\n const name = prop.name && ts.isIdentifier(prop.name)\n ? prop.name.text\n : prop.name?.getText(ctx.sourceFile) ?? ''\n const readonly = !!ts.getModifiers(prop)?.some(\n m => m.kind === ts.SyntaxKind.ReadonlyKeyword,\n )\n return {\n name,\n kind: 'property',\n signature: prop.getText(ctx.sourceFile).replace(RE_TRAILING_SEMI, ''),\n type: typeStringFrom(prop.type, ctx),\n optional: !!prop.questionToken,\n readonly,\n visibility: 'public',\n static: false,\n doc: docOrEmpty(prop, ctx.sourceFile),\n }\n}\n\n/**\n * Detect the \"as-const enum\" pattern:\n *\n * const X = { a: \"foo\", b: \"bar\" } as const\n * declare const X: { readonly a: \"foo\"; readonly b: \"bar\" }\n *\n * Both forms produce an object whose property *types* are literals\n * (string/number/boolean). From a docs consumer's perspective this is\n * interchangeable with a real `enum`, so we promote it and populate\n * `variants` - templates can render both source forms identically.\n *\n * Returns the variant list on match, or `null` when any property isn't\n * literal-typed (regular configs, functions, nested objects all fall\n * through to the normal const extraction path).\n */\nfunction detectAsConstEnum(decl: ts.VariableDeclaration, ctx: WalkContext): EnumVariant[] | null {\n let type: ts.Type\n try {\n type = ctx.checker.getTypeAtLocation(decl)\n }\n catch {\n return null\n }\n const props = type.getProperties()\n if (props.length === 0)\n return null\n\n const variants: EnumVariant[] = []\n for (const prop of props) {\n const propType = ctx.checker.getTypeOfSymbolAtLocation(prop, decl)\n const literal = literalFromType(propType)\n if (!literal)\n return null\n\n const propDecls = prop.getDeclarations()\n const propDecl = propDecls?.[0]\n const propDoc = propDecl\n ? docOrEmpty(propDecl, propDecl.getSourceFile())\n : emptyDocComment()\n\n variants.push({ name: prop.name, value: literal, doc: propDoc })\n }\n return variants\n}\n\nfunction literalFromType(t: ts.Type): Literal | null {\n if (t.isStringLiteral()) {\n const v = (t as ts.StringLiteralType).value\n return { kind: 'string', text: JSON.stringify(v), value: v }\n }\n if (t.isNumberLiteral()) {\n const v = (t as ts.NumberLiteralType).value\n return { kind: 'number', text: String(v), value: v }\n }\n if (t.flags & ts.TypeFlags.BooleanLiteral) {\n // `intrinsicName` is `\"true\"` or `\"false\"` on boolean literal types -\n // not in the public ts typings.\n const v = (t as unknown as { intrinsicName?: string }).intrinsicName === 'true'\n return { kind: 'boolean', text: String(v), value: v }\n }\n return null\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 // Promote the as-const-enum pattern to `kind: 'enum'`. `signature`, `value`,\n // and `valueType` stay as the source form (`declare const ...` / `{...} as\n // const`) - `kind` drives template choice; `signature` still matches tsc.\n const variants = isConst ? detectAsConstEnum(decl, ctx) : null\n const kind: VSymbol['kind'] = variants ? 'enum' : isConst ? 'const' : 'variable'\n\n return {\n id: makeId(ctx.modulePath, name),\n name,\n kind,\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 ...(variants ? { variants } : {}),\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 suppressSelfReferentialAliases(results)\n}\n\n/**\n * When `extractVariable` promotes an `as-const-enum` const to `kind: 'enum'`,\n * the common sibling `type X = (typeof X)[keyof typeof X]` becomes redundant\n * - it exists purely to re-export the object's value type as a type name.\n * Suppress it so doc authors don't see a duplicate entry for `X`.\n */\nfunction suppressSelfReferentialAliases(symbols: VSymbol[]): VSymbol[] {\n const promotedEnumNames = new Set(\n symbols.filter(s => s.kind === 'enum' && s.variants !== undefined).map(s => s.name),\n )\n if (promotedEnumNames.size === 0)\n return symbols\n\n return symbols.filter((s) => {\n if (s.kind !== 'type' || !promotedEnumNames.has(s.name))\n return true\n const alias = s.aliasOf?.text.replace(/\\s+/g, '')\n return alias !== `(typeof${s.name})[keyoftypeof${s.name}]`\n })\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 suppressSelfReferentialAliases(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,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AW,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"}
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.3",
4
+ "version": "0.3.0",
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.3"
24
+ "@vellum-docs/core": "0.3.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "typescript": "^5.6.3"