@openpkg-ts/extract 0.16.0 → 0.16.1

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/bin/tspec.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  extract
4
- } from "../shared/chunk-2v40ecks.js";
4
+ } from "../shared/chunk-bgnmsw8f.js";
5
5
 
6
6
  // src/cli/spec.ts
7
7
  import * as fs from "node:fs";
@@ -661,12 +661,33 @@ function parseExamplesFromTags(tags) {
661
661
  }
662
662
  return examples;
663
663
  }
664
+ function stripParamSeparator(text) {
665
+ if (!text)
666
+ return;
667
+ const stripped = text.replace(/^-\s*/, "").trim();
668
+ return stripped || undefined;
669
+ }
670
+ function stripTypeParamSeparator(text) {
671
+ if (!text)
672
+ return;
673
+ const match = text.match(/^\w+\s+-\s*(.*)$/s);
674
+ if (match) {
675
+ return match[1].trim() || undefined;
676
+ }
677
+ return text.trim() || undefined;
678
+ }
664
679
  function getJSDocComment(node) {
665
680
  const jsDocTags = ts3.getJSDocTags(node);
666
- const tags = jsDocTags.map((tag) => ({
667
- name: tag.tagName.text,
668
- text: typeof tag.comment === "string" ? tag.comment : ts3.getTextOfJSDocComment(tag.comment) ?? ""
669
- }));
681
+ const tags = jsDocTags.map((tag) => {
682
+ const rawText = typeof tag.comment === "string" ? tag.comment : ts3.getTextOfJSDocComment(tag.comment) ?? "";
683
+ let text = rawText;
684
+ if (tag.tagName.text === "param") {
685
+ text = stripParamSeparator(rawText) ?? "";
686
+ } else if (tag.tagName.text === "typeParam") {
687
+ text = stripTypeParamSeparator(rawText) ?? "";
688
+ }
689
+ return { name: tag.tagName.text, text };
690
+ });
670
691
  const jsDocComments = node.jsDoc;
671
692
  let description;
672
693
  if (jsDocComments && jsDocComments.length > 0) {
@@ -694,7 +715,7 @@ function getParamDescription(propertyName, jsdocTags, inferredAlias) {
694
715
  const isMatch = tagParamName === propertyName || inferredAlias && tagParamName === `${inferredAlias}.${propertyName}` || tagParamName.endsWith(`.${propertyName}`);
695
716
  if (isMatch) {
696
717
  const comment = typeof tag.comment === "string" ? tag.comment : ts3.getTextOfJSDocComment(tag.comment);
697
- return comment?.trim() || undefined;
718
+ return stripParamSeparator(comment);
698
719
  }
699
720
  }
700
721
  return;
package/dist/src/index.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  serializeTypeAlias,
27
27
  serializeVariable,
28
28
  withDescription
29
- } from "../shared/chunk-2v40ecks.js";
29
+ } from "../shared/chunk-bgnmsw8f.js";
30
30
  // src/schema/registry.ts
31
31
  function isTypeReference(type) {
32
32
  return !!(type.flags & 524288 && type.objectFlags && type.objectFlags & 4);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/extract",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "TypeScript export extraction to OpenPkg spec",
5
5
  "keywords": [
6
6
  "openpkg",