@metamask-previews/platform-api-docs 0.0.0-preview-1275d0fda

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +6 -0
  3. package/LICENSE.APACHE2 +201 -0
  4. package/LICENSE.MIT +21 -0
  5. package/README.md +39 -0
  6. package/dist/cli.cjs +214 -0
  7. package/dist/cli.cjs.map +1 -0
  8. package/dist/cli.d.cts +3 -0
  9. package/dist/cli.d.cts.map +1 -0
  10. package/dist/cli.d.mts +3 -0
  11. package/dist/cli.d.mts.map +1 -0
  12. package/dist/cli.mjs +212 -0
  13. package/dist/cli.mjs.map +1 -0
  14. package/dist/discovery.cjs +53 -0
  15. package/dist/discovery.cjs.map +1 -0
  16. package/dist/discovery.d.cts +22 -0
  17. package/dist/discovery.d.cts.map +1 -0
  18. package/dist/discovery.d.mts +22 -0
  19. package/dist/discovery.d.mts.map +1 -0
  20. package/dist/discovery.mjs +48 -0
  21. package/dist/discovery.mjs.map +1 -0
  22. package/dist/extraction.cjs +745 -0
  23. package/dist/extraction.cjs.map +1 -0
  24. package/dist/extraction.d.cts +40 -0
  25. package/dist/extraction.d.cts.map +1 -0
  26. package/dist/extraction.d.mts +40 -0
  27. package/dist/extraction.d.mts.map +1 -0
  28. package/dist/extraction.mjs +716 -0
  29. package/dist/extraction.mjs.map +1 -0
  30. package/dist/generate.cjs +373 -0
  31. package/dist/generate.cjs.map +1 -0
  32. package/dist/generate.d.cts +37 -0
  33. package/dist/generate.d.cts.map +1 -0
  34. package/dist/generate.d.mts +37 -0
  35. package/dist/generate.d.mts.map +1 -0
  36. package/dist/generate.mjs +346 -0
  37. package/dist/generate.mjs.map +1 -0
  38. package/dist/markdown.cjs +239 -0
  39. package/dist/markdown.cjs.map +1 -0
  40. package/dist/markdown.d.cts +52 -0
  41. package/dist/markdown.d.cts.map +1 -0
  42. package/dist/markdown.d.mts +52 -0
  43. package/dist/markdown.d.mts.map +1 -0
  44. package/dist/markdown.mjs +232 -0
  45. package/dist/markdown.mjs.map +1 -0
  46. package/dist/types.cjs +3 -0
  47. package/dist/types.cjs.map +1 -0
  48. package/dist/types.d.cts +63 -0
  49. package/dist/types.d.cts.map +1 -0
  50. package/dist/types.d.mts +63 -0
  51. package/dist/types.d.mts.map +1 -0
  52. package/dist/types.mjs +2 -0
  53. package/dist/types.mjs.map +1 -0
  54. package/package.json +75 -0
  55. package/site/docusaurus.config.ts +103 -0
  56. package/site/src/css/custom.css +336 -0
  57. package/site/static/fonts/MM-Sans/MM_Sans_Mono-Regular.woff2 +0 -0
  58. package/site/static/img/favicons/favicon-96x96.png +0 -0
  59. package/site/static/img/metamask-fox.svg +12 -0
  60. package/site/static/img/metamask-logo-dark.svg +3 -0
  61. package/site/static/img/metamask-logo.svg +3 -0
  62. package/site/tsconfig.json +13 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.cjs","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CACxB,IAAY,EACZ,SAAiB,EACjB,UAA+B;IAE/B,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAC/D,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,MAAM,IAAI,OAAO,IAAI,GAAG,CAAC;QAClC,CAAC;QACD,6EAA6E;QAC7E,MAAM,QAAQ,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,QAAQ,EA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CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAlDD,8CAkDC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,UAA4B;IAC3D,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,EAAE,CAAC,SAAS;QACnB,KAAK,EAAE;YACL,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5D;KACF,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAG;QACd,gBAAgB,EAAE;YAChB;gBACE,IAAI,EAAE,KAAK;gBACX,EAAE,EAAE,OAAO;gBACX,KAAK,EAAE,UAAU;aAClB;YACD,GAAG,KAAK;SACT;KACF,CAAC;IAEF,OAAO,6GAA6G,IAAI,CAAC,SAAS,CAChI,OAAO,EACP,IAAI,EACJ,CAAC,CACF,+BAA+B,CAAC;AACnC,CAAC;AA1BD,4CA0BC","sourcesContent":["import type { ExtractedMessengerCapabilityType, NamespaceGroup } from './types';\n\n/**\n * Convert backtick-quoted action/event names in text into links when they\n * match a known item in the same namespace. For example, `` `setActiveNetwork` ``\n * becomes a link to `#networkcontrollersetactivenetwork` on the actions page.\n *\n * @param text - The markdown text to process.\n * @param namespace - The current namespace (e.g. \"NetworkController\").\n * @param knownNames - Map from short name (e.g. \"setActiveNetwork\") to the page-relative path and anchor.\n * @returns The text with backtick references replaced by links.\n */\nfunction linkifyReferences(\n text: string,\n namespace: string,\n knownNames: Map<string, string>,\n): string {\n return text.replace(/`([a-zA-Z]\\w*)`/gu, (match, name: string) => {\n const link = knownNames.get(name);\n if (link) {\n return `[\\`${name}\\`](${link})`;\n }\n // Also try with namespace prefix (e.g. \"NetworkController:setActiveNetwork\")\n const fullName = `${namespace}:${name}`;\n const anchor = fullName.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const linkFull = knownNames.get(fullName);\n if (linkFull) {\n return `[\\`${name}\\`](${linkFull})`;\n }\n // Check if the anchor matches exactly in known names values\n for (const [, href] of knownNames) {\n if (href.endsWith(`#${anchor}`)) {\n return `[\\`${name}\\`](${href})`;\n }\n }\n return match;\n });\n}\n\n/**\n * Generate markdown documentation for a single messenger item.\n *\n * @param item - The messenger item to document.\n * @param namespace - The current namespace.\n * @param knownNames - Map from short/full names to their link paths.\n * @param repoBaseUrl - Optional GitHub blob base URL (e.g. \"https://github.com/Owner/Repo/blob/sha/\").\n * @returns The generated markdown string.\n */\nexport function generateItemMarkdown(\n item: ExtractedMessengerCapabilityType,\n namespace: string,\n knownNames: Map<string, string>,\n repoBaseUrl: string | null,\n): string {\n const parts: string[] = [];\n\n parts.push(`### \\`${item.typeString}\\``);\n parts.push('');\n\n if (item.deprecated) {\n parts.push('> **Deprecated**');\n parts.push('');\n }\n\n // For sources scanned out of an @metamask/*/dist directory we render an\n // npm link, since the original .ts paths are not part of the repo we're\n // documenting. Other `node_modules/` paths fall through to the normal\n // source-link branches.\n const metamaskPkgMatch = item.sourceFile.match(\n /node_modules\\/(@metamask\\/[^/]+)/u,\n );\n if (metamaskPkgMatch) {\n const pkgName = metamaskPkgMatch[1];\n const npmUrl = `https://www.npmjs.com/package/${pkgName}`;\n parts.push(`**Package**: [\\`${pkgName}\\`](${npmUrl})`);\n } else if (repoBaseUrl) {\n const ghUrl = `${repoBaseUrl}${item.sourceFile}#L${item.line}`;\n parts.push(`**Source**: [${item.sourceFile}:${item.line}](${ghUrl})`);\n } else {\n parts.push(`**Source**: \\`${item.sourceFile}:${item.line}\\``);\n }\n parts.push('');\n\n if (item.jsDoc) {\n parts.push(linkifyReferences(item.jsDoc, namespace, knownNames));\n parts.push('');\n }\n\n // Only actions get a parameters table — events carry a positional tuple\n // payload, not named arguments, so a `@param` table doesn't fit.\n if (item.kind === 'action' && item.params.length > 0) {\n parts.push('**Parameters**:');\n parts.push('');\n parts.push('| Name | Description |');\n parts.push('|------|-------------|');\n for (const param of item.params) {\n const description = linkifyReferences(\n param.description,\n namespace,\n knownNames,\n );\n parts.push(`| \\`${param.name}\\` | ${description} |`);\n }\n parts.push('');\n }\n\n if (item.kind === 'action' && item.returns) {\n parts.push(\n `**Returns**: ${linkifyReferences(item.returns, namespace, knownNames)}`,\n );\n parts.push('');\n }\n\n const signatureLabel = item.kind === 'action' ? 'Handler' : 'Payload';\n parts.push(`**${signatureLabel} signature**:`);\n parts.push('');\n parts.push('```typescript');\n parts.push(item.handlerOrPayload);\n parts.push('```');\n parts.push('');\n\n return parts.join('\\n');\n}\n\n/**\n * Generate a full markdown page for a namespace's actions or events.\n *\n * @param ns - The namespace group to generate a page for.\n * @param kind - Whether to generate the actions or events page.\n * @param repoBaseUrl - Optional GitHub blob base URL for source links.\n * @returns The generated markdown string.\n */\nexport function generateNamespacePage(\n ns: NamespaceGroup,\n kind: 'action' | 'event',\n repoBaseUrl: string | null = null,\n): string {\n const items = kind === 'action' ? ns.actions : ns.events;\n const title = kind === 'action' ? 'Actions' : 'Events';\n const parts: string[] = [];\n\n parts.push('---');\n parts.push(`title: \"${ns.namespace} ${title}\"`);\n parts.push(`sidebar_label: \"${title}\"`);\n parts.push('---');\n parts.push('');\n parts.push(`# ${ns.namespace} ${title}`);\n parts.push('');\n\n if (items.length === 0) {\n parts.push(`_No ${kind}s found for this namespace._`);\n parts.push('');\n return parts.join('\\n');\n }\n\n parts.push(\n `${items.length} ${kind}${items.length === 1 ? '' : 's'} registered.`,\n );\n parts.push('');\n\n // Build a map of known names → link paths for cross-referencing.\n // Actions on same page get #anchor, actions/events on sibling page get relative path.\n const knownNames = new Map<string, string>();\n for (const action of ns.actions) {\n const shortName = action.typeString.split(':')[1];\n const anchor = action.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const href = kind === 'action' ? `#${anchor}` : `./actions#${anchor}`;\n knownNames.set(shortName, href);\n knownNames.set(action.typeString, href);\n }\n for (const event of ns.events) {\n const shortName = event.typeString.split(':')[1];\n const anchor = event.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const href = kind === 'event' ? `#${anchor}` : `./events#${anchor}`;\n knownNames.set(shortName, href);\n knownNames.set(event.typeString, href);\n }\n\n // Table of contents\n parts.push('| Name | Deprecated |');\n parts.push('|------|-----------|');\n for (const item of items) {\n const name = item.typeString.split(':')[1];\n // Docusaurus uses github-slugger: strips non-alphanumeric, lowercases, no dashes for special chars in code spans\n const anchor = item.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const dep = item.deprecated ? 'Yes' : '';\n parts.push(`| [\\`${name}\\`](#${anchor}) | ${dep} |`);\n }\n parts.push('');\n parts.push('---');\n parts.push('');\n\n for (const item of items) {\n parts.push(\n generateItemMarkdown(item, ns.namespace, knownNames, repoBaseUrl),\n );\n parts.push('---');\n parts.push('');\n }\n\n return parts.join('\\n');\n}\n\n/**\n * Options controlling how {@link generateIndexPage} renders the index header.\n */\nexport type IndexPageOptions = {\n /**\n * Short label identifying the project the docs were generated from (e.g.\n * \"Core\", \"Extension\"). When provided, the title is rendered as\n * `Platform API (Core)`.\n */\n projectLabel?: string | null;\n /**\n * Git commit SHA the docs were generated from. When provided, it's shown\n * in the intro so engineers know how current the site is.\n */\n commitSha?: string | null;\n};\n\n/**\n * Generate the index/overview page listing all namespaces.\n *\n * @param namespaces - All namespace groups sorted alphabetically.\n * @param options - Optional project label and commit SHA to stamp in the header.\n * @returns The generated markdown string.\n */\nexport function generateIndexPage(\n namespaces: NamespaceGroup[],\n options: IndexPageOptions = {},\n): string {\n const totalActions = namespaces.reduce(\n (sum, ns) => sum + ns.actions.length,\n 0,\n );\n const totalEvents = namespaces.reduce((sum, ns) => sum + ns.events.length, 0);\n const projectSuffix = options.projectLabel\n ? ` (${options.projectLabel})`\n : '';\n\n const parts: string[] = [];\n parts.push('---');\n parts.push(`title: \"Platform API${projectSuffix} Reference\"`);\n parts.push('slug: \"/\"');\n parts.push('---');\n parts.push('');\n parts.push(`# Platform API${projectSuffix}`);\n parts.push('');\n parts.push(\n 'This site documents every action and event registered on the Messenger — the type-safe message bus used across all controllers.',\n );\n parts.push('');\n if (options.commitSha) {\n parts.push(`Generated from commit \\`${options.commitSha}\\`.`);\n parts.push('');\n }\n parts.push(`- **${namespaces.length}** namespaces`);\n parts.push(`- **${totalActions}** actions`);\n parts.push(`- **${totalEvents}** events`);\n parts.push('');\n parts.push('## Namespaces');\n parts.push('');\n parts.push('| Namespace | Actions | Events |');\n parts.push('|-----------|---------|--------|');\n\n for (const ns of namespaces) {\n const firstLink =\n ns.actions.length > 0\n ? `${ns.namespace}/actions`\n : `${ns.namespace}/events`;\n parts.push(\n `| [${ns.namespace}](${firstLink}) | ${ns.actions.length} | ${ns.events.length} |`,\n );\n }\n\n parts.push('');\n return parts.join('\\n');\n}\n\n/**\n * Generate the sidebars.ts file content for Docusaurus.\n *\n * @param namespaces - All namespace groups sorted alphabetically.\n * @returns The generated TypeScript source string.\n */\nexport function generateSidebars(namespaces: NamespaceGroup[]): string {\n const items = namespaces.map((ns) => ({\n type: 'category',\n label: ns.namespace,\n items: [\n ...(ns.actions.length > 0 ? [`${ns.namespace}/actions`] : []),\n ...(ns.events.length > 0 ? [`${ns.namespace}/events`] : []),\n ],\n }));\n\n const sidebar = {\n messengerSidebar: [\n {\n type: 'doc',\n id: 'index',\n label: 'Overview',\n },\n ...items,\n ],\n };\n\n return `// This file is auto-generated by @metamask/platform-api-docs\\n// Do not edit manually.\\nconst sidebars = ${JSON.stringify(\n sidebar,\n null,\n 2,\n )};\\nexport default sidebars;\\n`;\n}\n"]}
@@ -0,0 +1,52 @@
1
+ import type { ExtractedMessengerCapabilityType, NamespaceGroup } from "./types.cjs";
2
+ /**
3
+ * Generate markdown documentation for a single messenger item.
4
+ *
5
+ * @param item - The messenger item to document.
6
+ * @param namespace - The current namespace.
7
+ * @param knownNames - Map from short/full names to their link paths.
8
+ * @param repoBaseUrl - Optional GitHub blob base URL (e.g. "https://github.com/Owner/Repo/blob/sha/").
9
+ * @returns The generated markdown string.
10
+ */
11
+ export declare function generateItemMarkdown(item: ExtractedMessengerCapabilityType, namespace: string, knownNames: Map<string, string>, repoBaseUrl: string | null): string;
12
+ /**
13
+ * Generate a full markdown page for a namespace's actions or events.
14
+ *
15
+ * @param ns - The namespace group to generate a page for.
16
+ * @param kind - Whether to generate the actions or events page.
17
+ * @param repoBaseUrl - Optional GitHub blob base URL for source links.
18
+ * @returns The generated markdown string.
19
+ */
20
+ export declare function generateNamespacePage(ns: NamespaceGroup, kind: 'action' | 'event', repoBaseUrl?: string | null): string;
21
+ /**
22
+ * Options controlling how {@link generateIndexPage} renders the index header.
23
+ */
24
+ export type IndexPageOptions = {
25
+ /**
26
+ * Short label identifying the project the docs were generated from (e.g.
27
+ * "Core", "Extension"). When provided, the title is rendered as
28
+ * `Platform API (Core)`.
29
+ */
30
+ projectLabel?: string | null;
31
+ /**
32
+ * Git commit SHA the docs were generated from. When provided, it's shown
33
+ * in the intro so engineers know how current the site is.
34
+ */
35
+ commitSha?: string | null;
36
+ };
37
+ /**
38
+ * Generate the index/overview page listing all namespaces.
39
+ *
40
+ * @param namespaces - All namespace groups sorted alphabetically.
41
+ * @param options - Optional project label and commit SHA to stamp in the header.
42
+ * @returns The generated markdown string.
43
+ */
44
+ export declare function generateIndexPage(namespaces: NamespaceGroup[], options?: IndexPageOptions): string;
45
+ /**
46
+ * Generate the sidebars.ts file content for Docusaurus.
47
+ *
48
+ * @param namespaces - All namespace groups sorted alphabetically.
49
+ * @returns The generated TypeScript source string.
50
+ */
51
+ export declare function generateSidebars(namespaces: NamespaceGroup[]): string;
52
+ //# sourceMappingURL=markdown.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.cts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,cAAc,EAAE,oBAAgB;AAuChF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gCAAgC,EACtC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,CAqER;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE,QAAQ,GAAG,OAAO,EACxB,WAAW,GAAE,MAAM,GAAG,IAAW,GAChC,MAAM,CAiER;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,cAAc,EAAE,EAC5B,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CA+CR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,MAAM,CA0BrE"}
@@ -0,0 +1,52 @@
1
+ import type { ExtractedMessengerCapabilityType, NamespaceGroup } from "./types.mjs";
2
+ /**
3
+ * Generate markdown documentation for a single messenger item.
4
+ *
5
+ * @param item - The messenger item to document.
6
+ * @param namespace - The current namespace.
7
+ * @param knownNames - Map from short/full names to their link paths.
8
+ * @param repoBaseUrl - Optional GitHub blob base URL (e.g. "https://github.com/Owner/Repo/blob/sha/").
9
+ * @returns The generated markdown string.
10
+ */
11
+ export declare function generateItemMarkdown(item: ExtractedMessengerCapabilityType, namespace: string, knownNames: Map<string, string>, repoBaseUrl: string | null): string;
12
+ /**
13
+ * Generate a full markdown page for a namespace's actions or events.
14
+ *
15
+ * @param ns - The namespace group to generate a page for.
16
+ * @param kind - Whether to generate the actions or events page.
17
+ * @param repoBaseUrl - Optional GitHub blob base URL for source links.
18
+ * @returns The generated markdown string.
19
+ */
20
+ export declare function generateNamespacePage(ns: NamespaceGroup, kind: 'action' | 'event', repoBaseUrl?: string | null): string;
21
+ /**
22
+ * Options controlling how {@link generateIndexPage} renders the index header.
23
+ */
24
+ export type IndexPageOptions = {
25
+ /**
26
+ * Short label identifying the project the docs were generated from (e.g.
27
+ * "Core", "Extension"). When provided, the title is rendered as
28
+ * `Platform API (Core)`.
29
+ */
30
+ projectLabel?: string | null;
31
+ /**
32
+ * Git commit SHA the docs were generated from. When provided, it's shown
33
+ * in the intro so engineers know how current the site is.
34
+ */
35
+ commitSha?: string | null;
36
+ };
37
+ /**
38
+ * Generate the index/overview page listing all namespaces.
39
+ *
40
+ * @param namespaces - All namespace groups sorted alphabetically.
41
+ * @param options - Optional project label and commit SHA to stamp in the header.
42
+ * @returns The generated markdown string.
43
+ */
44
+ export declare function generateIndexPage(namespaces: NamespaceGroup[], options?: IndexPageOptions): string;
45
+ /**
46
+ * Generate the sidebars.ts file content for Docusaurus.
47
+ *
48
+ * @param namespaces - All namespace groups sorted alphabetically.
49
+ * @returns The generated TypeScript source string.
50
+ */
51
+ export declare function generateSidebars(namespaces: NamespaceGroup[]): string;
52
+ //# sourceMappingURL=markdown.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.mts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,cAAc,EAAE,oBAAgB;AAuChF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gCAAgC,EACtC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,CAqER;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE,QAAQ,GAAG,OAAO,EACxB,WAAW,GAAE,MAAM,GAAG,IAAW,GAChC,MAAM,CAiER;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,cAAc,EAAE,EAC5B,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CA+CR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,MAAM,CA0BrE"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * Convert backtick-quoted action/event names in text into links when they
3
+ * match a known item in the same namespace. For example, `` `setActiveNetwork` ``
4
+ * becomes a link to `#networkcontrollersetactivenetwork` on the actions page.
5
+ *
6
+ * @param text - The markdown text to process.
7
+ * @param namespace - The current namespace (e.g. "NetworkController").
8
+ * @param knownNames - Map from short name (e.g. "setActiveNetwork") to the page-relative path and anchor.
9
+ * @returns The text with backtick references replaced by links.
10
+ */
11
+ function linkifyReferences(text, namespace, knownNames) {
12
+ return text.replace(/`([a-zA-Z]\w*)`/gu, (match, name) => {
13
+ const link = knownNames.get(name);
14
+ if (link) {
15
+ return `[\`${name}\`](${link})`;
16
+ }
17
+ // Also try with namespace prefix (e.g. "NetworkController:setActiveNetwork")
18
+ const fullName = `${namespace}:${name}`;
19
+ const anchor = fullName.toLowerCase().replace(/[^a-z0-9]/gu, '');
20
+ const linkFull = knownNames.get(fullName);
21
+ if (linkFull) {
22
+ return `[\`${name}\`](${linkFull})`;
23
+ }
24
+ // Check if the anchor matches exactly in known names values
25
+ for (const [, href] of knownNames) {
26
+ if (href.endsWith(`#${anchor}`)) {
27
+ return `[\`${name}\`](${href})`;
28
+ }
29
+ }
30
+ return match;
31
+ });
32
+ }
33
+ /**
34
+ * Generate markdown documentation for a single messenger item.
35
+ *
36
+ * @param item - The messenger item to document.
37
+ * @param namespace - The current namespace.
38
+ * @param knownNames - Map from short/full names to their link paths.
39
+ * @param repoBaseUrl - Optional GitHub blob base URL (e.g. "https://github.com/Owner/Repo/blob/sha/").
40
+ * @returns The generated markdown string.
41
+ */
42
+ export function generateItemMarkdown(item, namespace, knownNames, repoBaseUrl) {
43
+ const parts = [];
44
+ parts.push(`### \`${item.typeString}\``);
45
+ parts.push('');
46
+ if (item.deprecated) {
47
+ parts.push('> **Deprecated**');
48
+ parts.push('');
49
+ }
50
+ // For sources scanned out of an @metamask/*/dist directory we render an
51
+ // npm link, since the original .ts paths are not part of the repo we're
52
+ // documenting. Other `node_modules/` paths fall through to the normal
53
+ // source-link branches.
54
+ const metamaskPkgMatch = item.sourceFile.match(/node_modules\/(@metamask\/[^/]+)/u);
55
+ if (metamaskPkgMatch) {
56
+ const pkgName = metamaskPkgMatch[1];
57
+ const npmUrl = `https://www.npmjs.com/package/${pkgName}`;
58
+ parts.push(`**Package**: [\`${pkgName}\`](${npmUrl})`);
59
+ }
60
+ else if (repoBaseUrl) {
61
+ const ghUrl = `${repoBaseUrl}${item.sourceFile}#L${item.line}`;
62
+ parts.push(`**Source**: [${item.sourceFile}:${item.line}](${ghUrl})`);
63
+ }
64
+ else {
65
+ parts.push(`**Source**: \`${item.sourceFile}:${item.line}\``);
66
+ }
67
+ parts.push('');
68
+ if (item.jsDoc) {
69
+ parts.push(linkifyReferences(item.jsDoc, namespace, knownNames));
70
+ parts.push('');
71
+ }
72
+ // Only actions get a parameters table — events carry a positional tuple
73
+ // payload, not named arguments, so a `@param` table doesn't fit.
74
+ if (item.kind === 'action' && item.params.length > 0) {
75
+ parts.push('**Parameters**:');
76
+ parts.push('');
77
+ parts.push('| Name | Description |');
78
+ parts.push('|------|-------------|');
79
+ for (const param of item.params) {
80
+ const description = linkifyReferences(param.description, namespace, knownNames);
81
+ parts.push(`| \`${param.name}\` | ${description} |`);
82
+ }
83
+ parts.push('');
84
+ }
85
+ if (item.kind === 'action' && item.returns) {
86
+ parts.push(`**Returns**: ${linkifyReferences(item.returns, namespace, knownNames)}`);
87
+ parts.push('');
88
+ }
89
+ const signatureLabel = item.kind === 'action' ? 'Handler' : 'Payload';
90
+ parts.push(`**${signatureLabel} signature**:`);
91
+ parts.push('');
92
+ parts.push('```typescript');
93
+ parts.push(item.handlerOrPayload);
94
+ parts.push('```');
95
+ parts.push('');
96
+ return parts.join('\n');
97
+ }
98
+ /**
99
+ * Generate a full markdown page for a namespace's actions or events.
100
+ *
101
+ * @param ns - The namespace group to generate a page for.
102
+ * @param kind - Whether to generate the actions or events page.
103
+ * @param repoBaseUrl - Optional GitHub blob base URL for source links.
104
+ * @returns The generated markdown string.
105
+ */
106
+ export function generateNamespacePage(ns, kind, repoBaseUrl = null) {
107
+ const items = kind === 'action' ? ns.actions : ns.events;
108
+ const title = kind === 'action' ? 'Actions' : 'Events';
109
+ const parts = [];
110
+ parts.push('---');
111
+ parts.push(`title: "${ns.namespace} ${title}"`);
112
+ parts.push(`sidebar_label: "${title}"`);
113
+ parts.push('---');
114
+ parts.push('');
115
+ parts.push(`# ${ns.namespace} ${title}`);
116
+ parts.push('');
117
+ if (items.length === 0) {
118
+ parts.push(`_No ${kind}s found for this namespace._`);
119
+ parts.push('');
120
+ return parts.join('\n');
121
+ }
122
+ parts.push(`${items.length} ${kind}${items.length === 1 ? '' : 's'} registered.`);
123
+ parts.push('');
124
+ // Build a map of known names → link paths for cross-referencing.
125
+ // Actions on same page get #anchor, actions/events on sibling page get relative path.
126
+ const knownNames = new Map();
127
+ for (const action of ns.actions) {
128
+ const shortName = action.typeString.split(':')[1];
129
+ const anchor = action.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');
130
+ const href = kind === 'action' ? `#${anchor}` : `./actions#${anchor}`;
131
+ knownNames.set(shortName, href);
132
+ knownNames.set(action.typeString, href);
133
+ }
134
+ for (const event of ns.events) {
135
+ const shortName = event.typeString.split(':')[1];
136
+ const anchor = event.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');
137
+ const href = kind === 'event' ? `#${anchor}` : `./events#${anchor}`;
138
+ knownNames.set(shortName, href);
139
+ knownNames.set(event.typeString, href);
140
+ }
141
+ // Table of contents
142
+ parts.push('| Name | Deprecated |');
143
+ parts.push('|------|-----------|');
144
+ for (const item of items) {
145
+ const name = item.typeString.split(':')[1];
146
+ // Docusaurus uses github-slugger: strips non-alphanumeric, lowercases, no dashes for special chars in code spans
147
+ const anchor = item.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');
148
+ const dep = item.deprecated ? 'Yes' : '';
149
+ parts.push(`| [\`${name}\`](#${anchor}) | ${dep} |`);
150
+ }
151
+ parts.push('');
152
+ parts.push('---');
153
+ parts.push('');
154
+ for (const item of items) {
155
+ parts.push(generateItemMarkdown(item, ns.namespace, knownNames, repoBaseUrl));
156
+ parts.push('---');
157
+ parts.push('');
158
+ }
159
+ return parts.join('\n');
160
+ }
161
+ /**
162
+ * Generate the index/overview page listing all namespaces.
163
+ *
164
+ * @param namespaces - All namespace groups sorted alphabetically.
165
+ * @param options - Optional project label and commit SHA to stamp in the header.
166
+ * @returns The generated markdown string.
167
+ */
168
+ export function generateIndexPage(namespaces, options = {}) {
169
+ const totalActions = namespaces.reduce((sum, ns) => sum + ns.actions.length, 0);
170
+ const totalEvents = namespaces.reduce((sum, ns) => sum + ns.events.length, 0);
171
+ const projectSuffix = options.projectLabel
172
+ ? ` (${options.projectLabel})`
173
+ : '';
174
+ const parts = [];
175
+ parts.push('---');
176
+ parts.push(`title: "Platform API${projectSuffix} Reference"`);
177
+ parts.push('slug: "/"');
178
+ parts.push('---');
179
+ parts.push('');
180
+ parts.push(`# Platform API${projectSuffix}`);
181
+ parts.push('');
182
+ parts.push('This site documents every action and event registered on the Messenger — the type-safe message bus used across all controllers.');
183
+ parts.push('');
184
+ if (options.commitSha) {
185
+ parts.push(`Generated from commit \`${options.commitSha}\`.`);
186
+ parts.push('');
187
+ }
188
+ parts.push(`- **${namespaces.length}** namespaces`);
189
+ parts.push(`- **${totalActions}** actions`);
190
+ parts.push(`- **${totalEvents}** events`);
191
+ parts.push('');
192
+ parts.push('## Namespaces');
193
+ parts.push('');
194
+ parts.push('| Namespace | Actions | Events |');
195
+ parts.push('|-----------|---------|--------|');
196
+ for (const ns of namespaces) {
197
+ const firstLink = ns.actions.length > 0
198
+ ? `${ns.namespace}/actions`
199
+ : `${ns.namespace}/events`;
200
+ parts.push(`| [${ns.namespace}](${firstLink}) | ${ns.actions.length} | ${ns.events.length} |`);
201
+ }
202
+ parts.push('');
203
+ return parts.join('\n');
204
+ }
205
+ /**
206
+ * Generate the sidebars.ts file content for Docusaurus.
207
+ *
208
+ * @param namespaces - All namespace groups sorted alphabetically.
209
+ * @returns The generated TypeScript source string.
210
+ */
211
+ export function generateSidebars(namespaces) {
212
+ const items = namespaces.map((ns) => ({
213
+ type: 'category',
214
+ label: ns.namespace,
215
+ items: [
216
+ ...(ns.actions.length > 0 ? [`${ns.namespace}/actions`] : []),
217
+ ...(ns.events.length > 0 ? [`${ns.namespace}/events`] : []),
218
+ ],
219
+ }));
220
+ const sidebar = {
221
+ messengerSidebar: [
222
+ {
223
+ type: 'doc',
224
+ id: 'index',
225
+ label: 'Overview',
226
+ },
227
+ ...items,
228
+ ],
229
+ };
230
+ return `// This file is auto-generated by @metamask/platform-api-docs\n// Do not edit manually.\nconst sidebars = ${JSON.stringify(sidebar, null, 2)};\nexport default sidebars;\n`;
231
+ }
232
+ //# sourceMappingURL=markdown.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.mjs","sourceR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AEJ,MAAM,OAAO,GAAG;QACd,gBAAgB,EAAE;YAChB;gBACE,IAAI,EAAE,KAAK;gBACX,EAAE,EAAE,OAAO;gBACX,KAAK,EAAE,UAAU;aAClB;YACD,GAAG,KAAK;SACT;KACF,CAAC;IAEF,OAAO,6GAA6G,IAAI,CAAC,SAAS,CAChI,OAAO,EACP,IAAI,EACJ,CAAC,CACF,+BAA+B,CAAC;AACnC,CAAC","sourcesContent":["import type { ExtractedMessengerCapabilityType, NamespaceGroup } from './types';\n\n/**\n * Convert backtick-quoted action/event names in text into links when they\n * match a known item in the same namespace. For example, `` `setActiveNetwork` ``\n * becomes a link to `#networkcontrollersetactivenetwork` on the actions page.\n *\n * @param text - The markdown text to process.\n * @param namespace - The current namespace (e.g. \"NetworkController\").\n * @param knownNames - Map from short name (e.g. \"setActiveNetwork\") to the page-relative path and anchor.\n * @returns The text with backtick references replaced by links.\n */\nfunction linkifyReferences(\n text: string,\n namespace: string,\n knownNames: Map<string, string>,\n): string {\n return text.replace(/`([a-zA-Z]\\w*)`/gu, (match, name: string) => {\n const link = knownNames.get(name);\n if (link) {\n return `[\\`${name}\\`](${link})`;\n }\n // Also try with namespace prefix (e.g. \"NetworkController:setActiveNetwork\")\n const fullName = `${namespace}:${name}`;\n const anchor = fullName.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const linkFull = knownNames.get(fullName);\n if (linkFull) {\n return `[\\`${name}\\`](${linkFull})`;\n }\n // Check if the anchor matches exactly in known names values\n for (const [, href] of knownNames) {\n if (href.endsWith(`#${anchor}`)) {\n return `[\\`${name}\\`](${href})`;\n }\n }\n return match;\n });\n}\n\n/**\n * Generate markdown documentation for a single messenger item.\n *\n * @param item - The messenger item to document.\n * @param namespace - The current namespace.\n * @param knownNames - Map from short/full names to their link paths.\n * @param repoBaseUrl - Optional GitHub blob base URL (e.g. \"https://github.com/Owner/Repo/blob/sha/\").\n * @returns The generated markdown string.\n */\nexport function generateItemMarkdown(\n item: ExtractedMessengerCapabilityType,\n namespace: string,\n knownNames: Map<string, string>,\n repoBaseUrl: string | null,\n): string {\n const parts: string[] = [];\n\n parts.push(`### \\`${item.typeString}\\``);\n parts.push('');\n\n if (item.deprecated) {\n parts.push('> **Deprecated**');\n parts.push('');\n }\n\n // For sources scanned out of an @metamask/*/dist directory we render an\n // npm link, since the original .ts paths are not part of the repo we're\n // documenting. Other `node_modules/` paths fall through to the normal\n // source-link branches.\n const metamaskPkgMatch = item.sourceFile.match(\n /node_modules\\/(@metamask\\/[^/]+)/u,\n );\n if (metamaskPkgMatch) {\n const pkgName = metamaskPkgMatch[1];\n const npmUrl = `https://www.npmjs.com/package/${pkgName}`;\n parts.push(`**Package**: [\\`${pkgName}\\`](${npmUrl})`);\n } else if (repoBaseUrl) {\n const ghUrl = `${repoBaseUrl}${item.sourceFile}#L${item.line}`;\n parts.push(`**Source**: [${item.sourceFile}:${item.line}](${ghUrl})`);\n } else {\n parts.push(`**Source**: \\`${item.sourceFile}:${item.line}\\``);\n }\n parts.push('');\n\n if (item.jsDoc) {\n parts.push(linkifyReferences(item.jsDoc, namespace, knownNames));\n parts.push('');\n }\n\n // Only actions get a parameters table — events carry a positional tuple\n // payload, not named arguments, so a `@param` table doesn't fit.\n if (item.kind === 'action' && item.params.length > 0) {\n parts.push('**Parameters**:');\n parts.push('');\n parts.push('| Name | Description |');\n parts.push('|------|-------------|');\n for (const param of item.params) {\n const description = linkifyReferences(\n param.description,\n namespace,\n knownNames,\n );\n parts.push(`| \\`${param.name}\\` | ${description} |`);\n }\n parts.push('');\n }\n\n if (item.kind === 'action' && item.returns) {\n parts.push(\n `**Returns**: ${linkifyReferences(item.returns, namespace, knownNames)}`,\n );\n parts.push('');\n }\n\n const signatureLabel = item.kind === 'action' ? 'Handler' : 'Payload';\n parts.push(`**${signatureLabel} signature**:`);\n parts.push('');\n parts.push('```typescript');\n parts.push(item.handlerOrPayload);\n parts.push('```');\n parts.push('');\n\n return parts.join('\\n');\n}\n\n/**\n * Generate a full markdown page for a namespace's actions or events.\n *\n * @param ns - The namespace group to generate a page for.\n * @param kind - Whether to generate the actions or events page.\n * @param repoBaseUrl - Optional GitHub blob base URL for source links.\n * @returns The generated markdown string.\n */\nexport function generateNamespacePage(\n ns: NamespaceGroup,\n kind: 'action' | 'event',\n repoBaseUrl: string | null = null,\n): string {\n const items = kind === 'action' ? ns.actions : ns.events;\n const title = kind === 'action' ? 'Actions' : 'Events';\n const parts: string[] = [];\n\n parts.push('---');\n parts.push(`title: \"${ns.namespace} ${title}\"`);\n parts.push(`sidebar_label: \"${title}\"`);\n parts.push('---');\n parts.push('');\n parts.push(`# ${ns.namespace} ${title}`);\n parts.push('');\n\n if (items.length === 0) {\n parts.push(`_No ${kind}s found for this namespace._`);\n parts.push('');\n return parts.join('\\n');\n }\n\n parts.push(\n `${items.length} ${kind}${items.length === 1 ? '' : 's'} registered.`,\n );\n parts.push('');\n\n // Build a map of known names → link paths for cross-referencing.\n // Actions on same page get #anchor, actions/events on sibling page get relative path.\n const knownNames = new Map<string, string>();\n for (const action of ns.actions) {\n const shortName = action.typeString.split(':')[1];\n const anchor = action.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const href = kind === 'action' ? `#${anchor}` : `./actions#${anchor}`;\n knownNames.set(shortName, href);\n knownNames.set(action.typeString, href);\n }\n for (const event of ns.events) {\n const shortName = event.typeString.split(':')[1];\n const anchor = event.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const href = kind === 'event' ? `#${anchor}` : `./events#${anchor}`;\n knownNames.set(shortName, href);\n knownNames.set(event.typeString, href);\n }\n\n // Table of contents\n parts.push('| Name | Deprecated |');\n parts.push('|------|-----------|');\n for (const item of items) {\n const name = item.typeString.split(':')[1];\n // Docusaurus uses github-slugger: strips non-alphanumeric, lowercases, no dashes for special chars in code spans\n const anchor = item.typeString.toLowerCase().replace(/[^a-z0-9]/gu, '');\n const dep = item.deprecated ? 'Yes' : '';\n parts.push(`| [\\`${name}\\`](#${anchor}) | ${dep} |`);\n }\n parts.push('');\n parts.push('---');\n parts.push('');\n\n for (const item of items) {\n parts.push(\n generateItemMarkdown(item, ns.namespace, knownNames, repoBaseUrl),\n );\n parts.push('---');\n parts.push('');\n }\n\n return parts.join('\\n');\n}\n\n/**\n * Options controlling how {@link generateIndexPage} renders the index header.\n */\nexport type IndexPageOptions = {\n /**\n * Short label identifying the project the docs were generated from (e.g.\n * \"Core\", \"Extension\"). When provided, the title is rendered as\n * `Platform API (Core)`.\n */\n projectLabel?: string | null;\n /**\n * Git commit SHA the docs were generated from. When provided, it's shown\n * in the intro so engineers know how current the site is.\n */\n commitSha?: string | null;\n};\n\n/**\n * Generate the index/overview page listing all namespaces.\n *\n * @param namespaces - All namespace groups sorted alphabetically.\n * @param options - Optional project label and commit SHA to stamp in the header.\n * @returns The generated markdown string.\n */\nexport function generateIndexPage(\n namespaces: NamespaceGroup[],\n options: IndexPageOptions = {},\n): string {\n const totalActions = namespaces.reduce(\n (sum, ns) => sum + ns.actions.length,\n 0,\n );\n const totalEvents = namespaces.reduce((sum, ns) => sum + ns.events.length, 0);\n const projectSuffix = options.projectLabel\n ? ` (${options.projectLabel})`\n : '';\n\n const parts: string[] = [];\n parts.push('---');\n parts.push(`title: \"Platform API${projectSuffix} Reference\"`);\n parts.push('slug: \"/\"');\n parts.push('---');\n parts.push('');\n parts.push(`# Platform API${projectSuffix}`);\n parts.push('');\n parts.push(\n 'This site documents every action and event registered on the Messenger — the type-safe message bus used across all controllers.',\n );\n parts.push('');\n if (options.commitSha) {\n parts.push(`Generated from commit \\`${options.commitSha}\\`.`);\n parts.push('');\n }\n parts.push(`- **${namespaces.length}** namespaces`);\n parts.push(`- **${totalActions}** actions`);\n parts.push(`- **${totalEvents}** events`);\n parts.push('');\n parts.push('## Namespaces');\n parts.push('');\n parts.push('| Namespace | Actions | Events |');\n parts.push('|-----------|---------|--------|');\n\n for (const ns of namespaces) {\n const firstLink =\n ns.actions.length > 0\n ? `${ns.namespace}/actions`\n : `${ns.namespace}/events`;\n parts.push(\n `| [${ns.namespace}](${firstLink}) | ${ns.actions.length} | ${ns.events.length} |`,\n );\n }\n\n parts.push('');\n return parts.join('\\n');\n}\n\n/**\n * Generate the sidebars.ts file content for Docusaurus.\n *\n * @param namespaces - All namespace groups sorted alphabetically.\n * @returns The generated TypeScript source string.\n */\nexport function generateSidebars(namespaces: NamespaceGroup[]): string {\n const items = namespaces.map((ns) => ({\n type: 'category',\n label: ns.namespace,\n items: [\n ...(ns.actions.length > 0 ? [`${ns.namespace}/actions`] : []),\n ...(ns.events.length > 0 ? [`${ns.namespace}/events`] : []),\n ],\n }));\n\n const sidebar = {\n messengerSidebar: [\n {\n type: 'doc',\n id: 'index',\n label: 'Overview',\n },\n ...items,\n ],\n };\n\n return `// This file is auto-generated by @metamask/platform-api-docs\\n// Do not edit manually.\\nconst sidebars = ${JSON.stringify(\n sidebar,\n null,\n 2,\n )};\\nexport default sidebars;\\n`;\n}\n"]}
package/dist/types.cjs ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A documented parameter for an action handler or event payload — name from\n * the JSDoc `@param` tag, description from the tag's comment body.\n */\nexport type DocumentedParameter = {\n name: string;\n description: string;\n};\n\n/**\n * One messenger capability — an action or event registered with the platform\n * — distilled from its TypeScript definition.\n */\nexport type ExtractedMessengerCapabilityType = {\n /** The capability type's TypeScript identifier, e.g. `NetworkControllerGetStateAction`. */\n typeName: string;\n /** The capability's messenger key, e.g. `NetworkController:getState`. */\n typeString: string;\n /** Whether the capability is an action (request/response) or an event (broadcast). */\n kind: 'action' | 'event';\n /** Cleaned description body — content above the first JSDoc tag. */\n jsDoc: string;\n /**\n * Documented parameters — populated from `@param` tags, in source order.\n * For actions these describe the handler's arguments; for events they\n * describe the payload tuple's positional elements.\n */\n params: DocumentedParameter[];\n /** Documented return value — populated from a `@returns` tag, if any. */\n returns: string;\n /** Raw type text of the handler (action) or payload (event). */\n handlerOrPayload: string;\n /** Path to the file the capability was declared in, relative to the project root. */\n sourceFile: string;\n /** 1-based line number of the capability declaration. */\n line: number;\n /** Whether the capability is marked `@deprecated`. */\n deprecated: boolean;\n};\n\n/**\n * A namespace's actions and events, after dedup and sorting.\n */\nexport type NamespaceGroup = {\n namespace: string;\n actions: ExtractedMessengerCapabilityType[];\n events: ExtractedMessengerCapabilityType[];\n};\n\n/**\n * Info about a class method, used to resolve `ClassName['methodName']`\n * handlers — captures both the textual signature and the documented\n * parameters / return so the capability inherits the method's JSDoc when\n * the type alias itself has none.\n */\nexport type MethodInfo = {\n /** Cleaned description body — content above the first JSDoc tag. */\n jsDoc: string;\n /** Documented parameters from the method's `@param` tags. */\n params: DocumentedParameter[];\n /** Documented return value from the method's `@returns` tag, if any. */\n returns: string;\n /** Method signature in TypeScript syntax, e.g. `(fields: AddNetworkFields) => NetworkConfiguration`. */\n signature: string;\n};\n"]}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * A documented parameter for an action handler or event payload — name from
3
+ * the JSDoc `@param` tag, description from the tag's comment body.
4
+ */
5
+ export type DocumentedParameter = {
6
+ name: string;
7
+ description: string;
8
+ };
9
+ /**
10
+ * One messenger capability — an action or event registered with the platform
11
+ * — distilled from its TypeScript definition.
12
+ */
13
+ export type ExtractedMessengerCapabilityType = {
14
+ /** The capability type's TypeScript identifier, e.g. `NetworkControllerGetStateAction`. */
15
+ typeName: string;
16
+ /** The capability's messenger key, e.g. `NetworkController:getState`. */
17
+ typeString: string;
18
+ /** Whether the capability is an action (request/response) or an event (broadcast). */
19
+ kind: 'action' | 'event';
20
+ /** Cleaned description body — content above the first JSDoc tag. */
21
+ jsDoc: string;
22
+ /**
23
+ * Documented parameters — populated from `@param` tags, in source order.
24
+ * For actions these describe the handler's arguments; for events they
25
+ * describe the payload tuple's positional elements.
26
+ */
27
+ params: DocumentedParameter[];
28
+ /** Documented return value — populated from a `@returns` tag, if any. */
29
+ returns: string;
30
+ /** Raw type text of the handler (action) or payload (event). */
31
+ handlerOrPayload: string;
32
+ /** Path to the file the capability was declared in, relative to the project root. */
33
+ sourceFile: string;
34
+ /** 1-based line number of the capability declaration. */
35
+ line: number;
36
+ /** Whether the capability is marked `@deprecated`. */
37
+ deprecated: boolean;
38
+ };
39
+ /**
40
+ * A namespace's actions and events, after dedup and sorting.
41
+ */
42
+ export type NamespaceGroup = {
43
+ namespace: string;
44
+ actions: ExtractedMessengerCapabilityType[];
45
+ events: ExtractedMessengerCapabilityType[];
46
+ };
47
+ /**
48
+ * Info about a class method, used to resolve `ClassName['methodName']`
49
+ * handlers — captures both the textual signature and the documented
50
+ * parameters / return so the capability inherits the method's JSDoc when
51
+ * the type alias itself has none.
52
+ */
53
+ export type MethodInfo = {
54
+ /** Cleaned description body — content above the first JSDoc tag. */
55
+ jsDoc: string;
56
+ /** Documented parameters from the method's `@param` tags. */
57
+ params: DocumentedParameter[];
58
+ /** Documented return value from the method's `@returns` tag, if any. */
59
+ returns: string;
60
+ /** Method signature in TypeScript syntax, e.g. `(fields: AddNetworkFields) => NetworkConfiguration`. */
61
+ signature: string;
62
+ };
63
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,gBAAgB,EAAE,MAAM,CAAC;IACzB,qFAAqF;IACrF,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,gCAAgC,EAAE,CAAC;IAC5C,MAAM,EAAE,gCAAgC,EAAE,CAAC;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,wGAAwG;IACxG,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * A documented parameter for an action handler or event payload — name from
3
+ * the JSDoc `@param` tag, description from the tag's comment body.
4
+ */
5
+ export type DocumentedParameter = {
6
+ name: string;
7
+ description: string;
8
+ };
9
+ /**
10
+ * One messenger capability — an action or event registered with the platform
11
+ * — distilled from its TypeScript definition.
12
+ */
13
+ export type ExtractedMessengerCapabilityType = {
14
+ /** The capability type's TypeScript identifier, e.g. `NetworkControllerGetStateAction`. */
15
+ typeName: string;
16
+ /** The capability's messenger key, e.g. `NetworkController:getState`. */
17
+ typeString: string;
18
+ /** Whether the capability is an action (request/response) or an event (broadcast). */
19
+ kind: 'action' | 'event';
20
+ /** Cleaned description body — content above the first JSDoc tag. */
21
+ jsDoc: string;
22
+ /**
23
+ * Documented parameters — populated from `@param` tags, in source order.
24
+ * For actions these describe the handler's arguments; for events they
25
+ * describe the payload tuple's positional elements.
26
+ */
27
+ params: DocumentedParameter[];
28
+ /** Documented return value — populated from a `@returns` tag, if any. */
29
+ returns: string;
30
+ /** Raw type text of the handler (action) or payload (event). */
31
+ handlerOrPayload: string;
32
+ /** Path to the file the capability was declared in, relative to the project root. */
33
+ sourceFile: string;
34
+ /** 1-based line number of the capability declaration. */
35
+ line: number;
36
+ /** Whether the capability is marked `@deprecated`. */
37
+ deprecated: boolean;
38
+ };
39
+ /**
40
+ * A namespace's actions and events, after dedup and sorting.
41
+ */
42
+ export type NamespaceGroup = {
43
+ namespace: string;
44
+ actions: ExtractedMessengerCapabilityType[];
45
+ events: ExtractedMessengerCapabilityType[];
46
+ };
47
+ /**
48
+ * Info about a class method, used to resolve `ClassName['methodName']`
49
+ * handlers — captures both the textual signature and the documented
50
+ * parameters / return so the capability inherits the method's JSDoc when
51
+ * the type alias itself has none.
52
+ */
53
+ export type MethodInfo = {
54
+ /** Cleaned description body — content above the first JSDoc tag. */
55
+ jsDoc: string;
56
+ /** Documented parameters from the method's `@param` tags. */
57
+ params: DocumentedParameter[];
58
+ /** Documented return value from the method's `@returns` tag, if any. */
59
+ returns: string;
60
+ /** Method signature in TypeScript syntax, e.g. `(fields: AddNetworkFields) => NetworkConfiguration`. */
61
+ signature: string;
62
+ };
63
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,gBAAgB,EAAE,MAAM,CAAC;IACzB,qFAAqF;IACrF,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,gCAAgC,EAAE,CAAC;IAC5C,MAAM,EAAE,gCAAgC,EAAE,CAAC;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,wGAAwG;IACxG,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
package/dist/types.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A documented parameter for an action handler or event payload — name from\n * the JSDoc `@param` tag, description from the tag's comment body.\n */\nexport type DocumentedParameter = {\n name: string;\n description: string;\n};\n\n/**\n * One messenger capability — an action or event registered with the platform\n * — distilled from its TypeScript definition.\n */\nexport type ExtractedMessengerCapabilityType = {\n /** The capability type's TypeScript identifier, e.g. `NetworkControllerGetStateAction`. */\n typeName: string;\n /** The capability's messenger key, e.g. `NetworkController:getState`. */\n typeString: string;\n /** Whether the capability is an action (request/response) or an event (broadcast). */\n kind: 'action' | 'event';\n /** Cleaned description body — content above the first JSDoc tag. */\n jsDoc: string;\n /**\n * Documented parameters — populated from `@param` tags, in source order.\n * For actions these describe the handler's arguments; for events they\n * describe the payload tuple's positional elements.\n */\n params: DocumentedParameter[];\n /** Documented return value — populated from a `@returns` tag, if any. */\n returns: string;\n /** Raw type text of the handler (action) or payload (event). */\n handlerOrPayload: string;\n /** Path to the file the capability was declared in, relative to the project root. */\n sourceFile: string;\n /** 1-based line number of the capability declaration. */\n line: number;\n /** Whether the capability is marked `@deprecated`. */\n deprecated: boolean;\n};\n\n/**\n * A namespace's actions and events, after dedup and sorting.\n */\nexport type NamespaceGroup = {\n namespace: string;\n actions: ExtractedMessengerCapabilityType[];\n events: ExtractedMessengerCapabilityType[];\n};\n\n/**\n * Info about a class method, used to resolve `ClassName['methodName']`\n * handlers — captures both the textual signature and the documented\n * parameters / return so the capability inherits the method's JSDoc when\n * the type alias itself has none.\n */\nexport type MethodInfo = {\n /** Cleaned description body — content above the first JSDoc tag. */\n jsDoc: string;\n /** Documented parameters from the method's `@param` tags. */\n params: DocumentedParameter[];\n /** Documented return value from the method's `@returns` tag, if any. */\n returns: string;\n /** Method signature in TypeScript syntax, e.g. `(fields: AddNetworkFields) => NetworkConfiguration`. */\n signature: string;\n};\n"]}