@forsakringskassan/docs-generator 2.35.1 → 2.35.3

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
@@ -4,8 +4,8 @@ const require = $createRequire(import.meta.url);
4
4
 
5
5
  import fs from 'node:fs/promises';
6
6
  import path from 'node:path/posix';
7
- import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, b as closest, e as distance, f as fm, i as isCI, h as glob, j as moduleImporter, k as cliProgress, t as tinylr, w as watch, l as createInstance, n as fse, o as inter } from './vendor-DMxJoCDS.mjs';
8
- import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-DFcfpmL3.mjs';
7
+ import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, b as closest, e as distance, f as fm, i as isCI, h as glob, j as moduleImporter, k as cliProgress, t as tinylr, w as watch, l as createInstance, n as fse, o as inter } from './vendor-BtGCZQy4.mjs';
8
+ import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-gWhxglZr.mjs';
9
9
  import sp__default from 'node:path';
10
10
  import require$$1 from 'crypto';
11
11
  import 'node:crypto';
@@ -1597,6 +1597,36 @@ function getEventDeprecated(event) {
1597
1597
  return tag.content;
1598
1598
  }
1599
1599
  }
1600
+ function isSimpleName(name) {
1601
+ return /^[a-z0-9]+$/i.test(name);
1602
+ }
1603
+ function getPropType(prop) {
1604
+ const { type } = prop;
1605
+ if (!type) {
1606
+ return null;
1607
+ }
1608
+ if (type.name === "Array") {
1609
+ const param = type;
1610
+ const element = param.elements?.[0];
1611
+ if (!element) {
1612
+ return "any[]";
1613
+ }
1614
+ if (isSimpleName(element.name)) {
1615
+ return `${element.name}[]`;
1616
+ } else {
1617
+ return `Array<${element.name}>`;
1618
+ }
1619
+ }
1620
+ if (type.name === "tuple") {
1621
+ const param = type;
1622
+ if (!param.elements) {
1623
+ return type.name;
1624
+ }
1625
+ const constituents = param.elements.map((it) => it.name).join(", ");
1626
+ return `[${constituents}]`;
1627
+ }
1628
+ return type.name;
1629
+ }
1600
1630
  function translateProps(props) {
1601
1631
  const isRelevant = (prop) => {
1602
1632
  return prop.tags?.ignore === void 0;
@@ -1606,7 +1636,7 @@ function translateProps(props) {
1606
1636
  return {
1607
1637
  name: prop.name,
1608
1638
  description: prop.description ?? null,
1609
- type: prop.type?.name ?? null,
1639
+ type: getPropType(prop),
1610
1640
  required: Boolean(prop.required),
1611
1641
  default: defaultValue,
1612
1642
  deprecated: getPropSlotDeprecated(prop)