@textmode/docs 0.4.3 → 0.5.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.
Files changed (210) hide show
  1. package/LICENSE +21 -121
  2. package/README.md +24 -33
  3. package/dist/cli/textmode-docs.d.ts +3 -0
  4. package/dist/cli/textmode-docs.d.ts.map +1 -0
  5. package/dist/cli/textmode-docs.js +227 -0
  6. package/dist/cli/textmode-docs.js.map +1 -0
  7. package/dist/example-quality.d.ts +59 -0
  8. package/dist/example-quality.d.ts.map +1 -0
  9. package/dist/example-quality.js +256 -0
  10. package/dist/example-quality.js.map +1 -0
  11. package/dist/index.d.ts +33 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +43 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/internal/check-api-documentation.d.ts +5 -0
  16. package/dist/internal/check-api-documentation.d.ts.map +1 -0
  17. package/dist/internal/check-api-documentation.js +74 -0
  18. package/dist/internal/check-api-documentation.js.map +1 -0
  19. package/dist/internal/check-example-sketches.d.ts +3 -0
  20. package/dist/internal/check-example-sketches.d.ts.map +1 -0
  21. package/dist/internal/check-example-sketches.js +76 -0
  22. package/dist/internal/check-example-sketches.js.map +1 -0
  23. package/dist/internal/config.d.ts +104 -0
  24. package/dist/internal/config.d.ts.map +1 -0
  25. package/dist/internal/config.js +324 -0
  26. package/dist/internal/config.js.map +1 -0
  27. package/dist/internal/documentation-commands.d.ts +24 -0
  28. package/dist/internal/documentation-commands.d.ts.map +1 -0
  29. package/dist/internal/documentation-commands.js +43 -0
  30. package/dist/internal/documentation-commands.js.map +1 -0
  31. package/dist/internal/lib/api-doc-checks.d.ts +46 -0
  32. package/dist/internal/lib/api-doc-checks.d.ts.map +1 -0
  33. package/dist/internal/lib/api-doc-checks.js +111 -0
  34. package/dist/internal/lib/api-doc-checks.js.map +1 -0
  35. package/dist/internal/lib/api-doc-routes.d.ts +7 -0
  36. package/dist/internal/lib/api-doc-routes.d.ts.map +1 -0
  37. package/dist/internal/lib/api-doc-routes.js +74 -0
  38. package/dist/internal/lib/api-doc-routes.js.map +1 -0
  39. package/dist/internal/lib/example-checks.d.ts +58 -0
  40. package/dist/internal/lib/example-checks.d.ts.map +1 -0
  41. package/dist/internal/lib/example-checks.js +230 -0
  42. package/dist/internal/lib/example-checks.js.map +1 -0
  43. package/dist/internal/lib/jsdoc-comments.d.ts +8 -0
  44. package/dist/internal/lib/jsdoc-comments.d.ts.map +1 -0
  45. package/dist/internal/lib/jsdoc-comments.js +67 -0
  46. package/dist/internal/lib/jsdoc-comments.js.map +1 -0
  47. package/dist/internal/lib/label-schema.d.ts +18 -0
  48. package/dist/internal/lib/label-schema.d.ts.map +1 -0
  49. package/dist/internal/lib/label-schema.js +17 -0
  50. package/dist/internal/lib/label-schema.js.map +1 -0
  51. package/dist/internal/lib/reflection-policy.d.ts +21 -0
  52. package/dist/internal/lib/reflection-policy.d.ts.map +1 -0
  53. package/dist/internal/lib/reflection-policy.js +96 -0
  54. package/dist/internal/lib/reflection-policy.js.map +1 -0
  55. package/dist/internal/lib/reporting.d.ts +8 -0
  56. package/dist/internal/lib/reporting.d.ts.map +1 -0
  57. package/dist/internal/lib/reporting.js +21 -0
  58. package/dist/internal/lib/reporting.js.map +1 -0
  59. package/dist/internal/lib/sketch-title.d.ts +14 -0
  60. package/dist/internal/lib/sketch-title.d.ts.map +1 -0
  61. package/dist/internal/lib/sketch-title.js +13 -0
  62. package/dist/internal/lib/sketch-title.js.map +1 -0
  63. package/dist/internal/reconcile-dates.d.ts +19 -0
  64. package/dist/internal/reconcile-dates.d.ts.map +1 -0
  65. package/dist/internal/reconcile-dates.js +77 -0
  66. package/dist/internal/reconcile-dates.js.map +1 -0
  67. package/dist/internal/reflection-kinds.d.ts +12 -0
  68. package/dist/internal/reflection-kinds.d.ts.map +1 -0
  69. package/dist/internal/reflection-kinds.js +19 -0
  70. package/dist/internal/reflection-kinds.js.map +1 -0
  71. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.d.ts +10 -0
  72. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.d.ts.map +1 -0
  73. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.js +31 -0
  74. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.js.map +1 -0
  75. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.d.ts +3 -0
  76. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.d.ts.map +1 -0
  77. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.js +16 -0
  78. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/index.js.map +1 -0
  79. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.d.ts +9 -0
  80. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.d.ts.map +1 -0
  81. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.js +85 -0
  82. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.js.map +1 -0
  83. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.d.ts +7 -0
  84. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.d.ts.map +1 -0
  85. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.js +16 -0
  86. package/dist/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.js.map +1 -0
  87. package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.d.ts +16 -0
  88. package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.d.ts.map +1 -0
  89. package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.js +33 -0
  90. package/dist/internal/typedoc-plugins/all-member-pages-router/child-pages.js.map +1 -0
  91. package/dist/internal/typedoc-plugins/all-member-pages-router/constants.d.ts +9 -0
  92. package/dist/internal/typedoc-plugins/all-member-pages-router/constants.d.ts.map +1 -0
  93. package/dist/internal/typedoc-plugins/all-member-pages-router/constants.js +44 -0
  94. package/dist/internal/typedoc-plugins/all-member-pages-router/constants.js.map +1 -0
  95. package/dist/internal/typedoc-plugins/all-member-pages-router/index.d.ts +2 -0
  96. package/dist/internal/typedoc-plugins/all-member-pages-router/index.d.ts.map +1 -0
  97. package/dist/internal/typedoc-plugins/all-member-pages-router/index.js +2 -0
  98. package/dist/internal/typedoc-plugins/all-member-pages-router/index.js.map +1 -0
  99. package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.d.ts +11 -0
  100. package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.d.ts.map +1 -0
  101. package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.js +12 -0
  102. package/dist/internal/typedoc-plugins/all-member-pages-router/member-paths.js.map +1 -0
  103. package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.d.ts +8 -0
  104. package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.d.ts.map +1 -0
  105. package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.js +78 -0
  106. package/dist/internal/typedoc-plugins/all-member-pages-router/member-reflections.js.map +1 -0
  107. package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.d.ts +8 -0
  108. package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.d.ts.map +1 -0
  109. package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.js +22 -0
  110. package/dist/internal/typedoc-plugins/all-member-pages-router/namespace-paths.js.map +1 -0
  111. package/dist/internal/typedoc-plugins/all-member-pages-router/router.d.ts +22 -0
  112. package/dist/internal/typedoc-plugins/all-member-pages-router/router.d.ts.map +1 -0
  113. package/dist/internal/typedoc-plugins/all-member-pages-router/router.js +44 -0
  114. package/dist/internal/typedoc-plugins/all-member-pages-router/router.js.map +1 -0
  115. package/dist/internal/typedoc-plugins/api-frontmatter/constants.d.ts +11 -0
  116. package/dist/internal/typedoc-plugins/api-frontmatter/constants.d.ts.map +1 -0
  117. package/dist/internal/typedoc-plugins/api-frontmatter/constants.js +38 -0
  118. package/dist/internal/typedoc-plugins/api-frontmatter/constants.js.map +1 -0
  119. package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.d.ts +18 -0
  120. package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.d.ts.map +1 -0
  121. package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.js +43 -0
  122. package/dist/internal/typedoc-plugins/api-frontmatter/descriptions.js.map +1 -0
  123. package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.d.ts +5 -0
  124. package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.d.ts.map +1 -0
  125. package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.js +29 -0
  126. package/dist/internal/typedoc-plugins/api-frontmatter/frontmatter.js.map +1 -0
  127. package/dist/internal/typedoc-plugins/api-frontmatter/index.d.ts +6 -0
  128. package/dist/internal/typedoc-plugins/api-frontmatter/index.d.ts.map +1 -0
  129. package/dist/internal/typedoc-plugins/api-frontmatter/index.js +19 -0
  130. package/dist/internal/typedoc-plugins/api-frontmatter/index.js.map +1 -0
  131. package/dist/internal/typedoc-plugins/api-frontmatter/library-context.d.ts +9 -0
  132. package/dist/internal/typedoc-plugins/api-frontmatter/library-context.d.ts.map +1 -0
  133. package/dist/internal/typedoc-plugins/api-frontmatter/library-context.js +11 -0
  134. package/dist/internal/typedoc-plugins/api-frontmatter/library-context.js.map +1 -0
  135. package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.d.ts +15 -0
  136. package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.d.ts.map +1 -0
  137. package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.js +46 -0
  138. package/dist/internal/typedoc-plugins/api-frontmatter/reflection-metadata.js.map +1 -0
  139. package/dist/internal/typedoc-plugins/include-code-examples/code-fences.d.ts +7 -0
  140. package/dist/internal/typedoc-plugins/include-code-examples/code-fences.d.ts.map +1 -0
  141. package/dist/internal/typedoc-plugins/include-code-examples/code-fences.js +23 -0
  142. package/dist/internal/typedoc-plugins/include-code-examples/code-fences.js.map +1 -0
  143. package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.d.ts +7 -0
  144. package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.d.ts.map +1 -0
  145. package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.js +18 -0
  146. package/dist/internal/typedoc-plugins/include-code-examples/example-metadata.js.map +1 -0
  147. package/dist/internal/typedoc-plugins/include-code-examples/index.d.ts +4 -0
  148. package/dist/internal/typedoc-plugins/include-code-examples/index.d.ts.map +1 -0
  149. package/dist/internal/typedoc-plugins/include-code-examples/index.js +12 -0
  150. package/dist/internal/typedoc-plugins/include-code-examples/index.js.map +1 -0
  151. package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.d.ts +2 -0
  152. package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.d.ts.map +1 -0
  153. package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.js +17 -0
  154. package/dist/internal/typedoc-plugins/include-code-examples/transform-markdown.js.map +1 -0
  155. package/dist/internal/typedoc-plugins/strip-api-self-links/index.d.ts +8 -0
  156. package/dist/internal/typedoc-plugins/strip-api-self-links/index.d.ts.map +1 -0
  157. package/dist/internal/typedoc-plugins/strip-api-self-links/index.js +62 -0
  158. package/dist/internal/typedoc-plugins/strip-api-self-links/index.js.map +1 -0
  159. package/dist/internal/typedoc-runner.d.ts +31 -0
  160. package/dist/internal/typedoc-runner.d.ts.map +1 -0
  161. package/dist/internal/typedoc-runner.js +179 -0
  162. package/dist/internal/typedoc-runner.js.map +1 -0
  163. package/dist/internal/update-api-links.d.ts +7 -0
  164. package/dist/internal/update-api-links.d.ts.map +1 -0
  165. package/dist/internal/update-api-links.js +65 -0
  166. package/dist/internal/update-api-links.js.map +1 -0
  167. package/package.json +57 -59
  168. package/index.d.ts +0 -64
  169. package/src/cli/textmode-docs.mjs +0 -219
  170. package/src/example-quality.mjs +0 -227
  171. package/src/index.js +0 -27
  172. package/src/internal/config.js +0 -387
  173. package/src/internal/lib/api-doc-checks.mjs +0 -147
  174. package/src/internal/lib/api-doc-routes.mjs +0 -93
  175. package/src/internal/lib/example-checks.mjs +0 -315
  176. package/src/internal/lib/jsdoc-comments.mjs +0 -78
  177. package/src/internal/lib/label-schema.mjs +0 -13
  178. package/src/internal/lib/reflection-policy.mjs +0 -113
  179. package/src/internal/lib/reporting.mjs +0 -23
  180. package/src/internal/lib/sketch-title.mjs +0 -8
  181. package/src/internal/operations.js +0 -282
  182. package/src/internal/reconcile-dates.js +0 -72
  183. package/src/internal/reflection-kinds.js +0 -21
  184. package/src/internal/typedoc-plugins/accessor-docs-normalizer/README.md +0 -45
  185. package/src/internal/typedoc-plugins/accessor-docs-normalizer/accessor-comments.js +0 -53
  186. package/src/internal/typedoc-plugins/accessor-docs-normalizer/index.js +0 -32
  187. package/src/internal/typedoc-plugins/accessor-docs-normalizer/render-accessor.js +0 -144
  188. package/src/internal/typedoc-plugins/accessor-docs-normalizer/theme-patch.js +0 -28
  189. package/src/internal/typedoc-plugins/all-member-pages-router/README.md +0 -57
  190. package/src/internal/typedoc-plugins/all-member-pages-router/child-pages.js +0 -65
  191. package/src/internal/typedoc-plugins/all-member-pages-router/constants.js +0 -58
  192. package/src/internal/typedoc-plugins/all-member-pages-router/index.js +0 -18
  193. package/src/internal/typedoc-plugins/all-member-pages-router/member-paths.js +0 -48
  194. package/src/internal/typedoc-plugins/all-member-pages-router/member-reflections.js +0 -164
  195. package/src/internal/typedoc-plugins/all-member-pages-router/namespace-paths.js +0 -44
  196. package/src/internal/typedoc-plugins/all-member-pages-router/router.js +0 -58
  197. package/src/internal/typedoc-plugins/api-frontmatter/README.md +0 -66
  198. package/src/internal/typedoc-plugins/api-frontmatter/constants.js +0 -52
  199. package/src/internal/typedoc-plugins/api-frontmatter/descriptions.js +0 -87
  200. package/src/internal/typedoc-plugins/api-frontmatter/frontmatter.js +0 -57
  201. package/src/internal/typedoc-plugins/api-frontmatter/index.js +0 -39
  202. package/src/internal/typedoc-plugins/api-frontmatter/library-context.js +0 -38
  203. package/src/internal/typedoc-plugins/api-frontmatter/reflection-metadata.js +0 -95
  204. package/src/internal/typedoc-plugins/include-code-examples/README.md +0 -40
  205. package/src/internal/typedoc-plugins/include-code-examples/code-fences.js +0 -55
  206. package/src/internal/typedoc-plugins/include-code-examples/example-metadata.js +0 -41
  207. package/src/internal/typedoc-plugins/include-code-examples/index.js +0 -23
  208. package/src/internal/typedoc-plugins/include-code-examples/transform-markdown.js +0 -33
  209. package/src/internal/typedoc-plugins/strip-api-self-links/index.js +0 -117
  210. package/src/internal/typedoc-runner.js +0 -200
@@ -0,0 +1,65 @@
1
+ import fs from 'node:fs';
2
+ import { createApiLinkTargets } from './lib/api-doc-checks.js';
3
+ import { findJsdocBeforeLine, getLineStartOffsets, upsertSeeLine } from './lib/jsdoc-comments.js';
4
+ import { getIncludedReflections, shouldProcessEntryPointReflection, sourceIsInRoots } from './lib/reflection-policy.js';
5
+ import { reflectionKindsMask } from './reflection-kinds.js';
6
+ import { loadEntryPointProject } from './typedoc-runner.js';
7
+ async function collectApiLinkEdits(config, routes) {
8
+ const editsByFile = new Map();
9
+ const targetKinds = reflectionKindsMask(config.checks.apiLinks);
10
+ for (const entryPoint of config.linkEntryPoints) {
11
+ const project = await loadEntryPointProject({
12
+ entryPoint: entryPoint.path,
13
+ tsconfig: entryPoint.tsconfig,
14
+ packageName: config.packageName,
15
+ projectRoot: config.projectRoot,
16
+ });
17
+ const reflections = getIncludedReflections(project, targetKinds);
18
+ for (const reflection of reflections) {
19
+ if (!shouldProcessEntryPointReflection(entryPoint, reflection)) {
20
+ continue;
21
+ }
22
+ for (const target of createApiLinkTargets(reflection, routes, config.apiBaseUrl)) {
23
+ if (!target.source?.line || !sourceIsInRoots(target.source, config.sourceRoots)) {
24
+ continue;
25
+ }
26
+ const entries = editsByFile.get(target.source.fullFileName) ?? [];
27
+ entries.push({ line: target.source.line, seeLine: target.seeLine });
28
+ editsByFile.set(target.source.fullFileName, entries);
29
+ }
30
+ }
31
+ }
32
+ return editsByFile;
33
+ }
34
+ function writeApiLinkEdits(config, editsByFile) {
35
+ let changedFiles = 0;
36
+ let insertedLinks = 0;
37
+ for (const [fileName, entries] of editsByFile) {
38
+ const originalText = fs.readFileSync(fileName, 'utf8');
39
+ let text = originalText;
40
+ const uniqueEntries = Array.from(new Map(entries.map((entry) => [`${entry.line}\0${entry.seeLine}`, entry])).values());
41
+ // Edit from the end of the file so earlier source line numbers stay valid.
42
+ for (const entry of uniqueEntries.sort((left, right) => right.line - left.line)) {
43
+ const before = text;
44
+ const lineStarts = getLineStartOffsets(text);
45
+ const comment = findJsdocBeforeLine(text, lineStarts, entry.line);
46
+ if (!comment) {
47
+ continue;
48
+ }
49
+ text = upsertSeeLine(text, comment, entry.seeLine, config.apiBaseUrl);
50
+ if (text !== before) {
51
+ insertedLinks += 1;
52
+ }
53
+ }
54
+ if (text !== originalText) {
55
+ fs.writeFileSync(fileName, text);
56
+ changedFiles += 1;
57
+ }
58
+ }
59
+ return { changedFiles, insertedLinks };
60
+ }
61
+ /** Update JSDoc links inside the configured source roots using the generated API routes. */
62
+ export async function updateApiLinks(config, routes) {
63
+ return writeApiLinkEdits(config, await collectApiLinkEdits(config, routes));
64
+ }
65
+ //# sourceMappingURL=update-api-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-api-links.js","sourceRoot":"","sources":["../../src/internal/update-api-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,sBAAsB,EAAE,iCAAiC,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MA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BACrB,aAAa,IAAI,CAAC,CAAC;YACpB,CAAC;QACF,CAAC;QACD,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;YAC3B,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACjC,YAAY,IAAI,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AACxC,CAAC;AAED,4FAA4F;AAC5F,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAA0B,EAAE,MAA2B;IAC3F,OAAO,iBAAiB,CAAC,MAAM,EAAE,MAAM,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,60 +1,58 @@
1
1
  {
2
- "name": "@textmode/docs",
3
- "version": "0.4.3",
4
- "type": "module",
5
- "license": "CC0-1.0",
6
- "description": "Shared documentation generation and validation for the textmode.js ecosystem",
7
- "keywords": [
8
- "textmode",
9
- "typedoc",
10
- "documentation",
11
- "validation"
12
- ],
13
- "author": "humanbydefinition <hello@textmode.art> (https://code.textmode.art)",
14
- "homepage": "https://code.textmode.art",
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/textmode-art/tooling.git",
18
- "directory": "packages/docs"
19
- },
20
- "engines": {
21
- "node": ">=24 <25"
22
- },
23
- "exports": {
24
- ".": {
25
- "types": "./index.d.ts",
26
- "import": "./src/index.js"
27
- }
28
- },
29
- "bin": {
30
- "textmode-docs": "src/cli/textmode-docs.mjs"
31
- },
32
- "files": [
33
- "src",
34
- "index.d.ts",
35
- "README.md"
36
- ],
37
- "dependencies": {
38
- "typedoc": "^0.28.20",
39
- "typedoc-plugin-frontmatter": "^1.3.3",
40
- "typedoc-plugin-markdown": "^4.14.1",
41
- "typedoc-vitepress-theme": "^1.1.4"
42
- },
43
- "peerDependencies": {
44
- "typescript": ">=5.9 <7"
45
- },
46
- "devDependencies": {
47
- "typescript": "^6.0.3"
48
- },
49
- "scripts": {
50
- "check": "pnpm run check:format && pnpm run lint && pnpm run test && pnpm run check:package && pnpm run check:pack",
51
- "check:format": "prettier --check .",
52
- "check:package": "node scripts/check-package.mjs",
53
- "check:pack": "node scripts/pack-smoke.mjs",
54
- "lint": "node --check src/index.js && node --check src/cli/textmode-docs.mjs && node --check src/internal/*.js && node --check src/internal/lib/*.mjs",
55
- "test": "vitest run"
56
- },
57
- "publishConfig": {
58
- "access": "public"
59
- }
60
- }
2
+ "name": "@textmode/docs",
3
+ "version": "0.5.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "Shared documentation generation and validation for the textmode.js ecosystem.",
7
+ "keywords": [
8
+ "textmode",
9
+ "typedoc",
10
+ "documentation",
11
+ "validation"
12
+ ],
13
+ "author": "humanbydefinition <hello@textmode.art> (https://code.textmode.art)",
14
+ "homepage": "https://code.textmode.art",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/textmode-art/tooling.git",
18
+ "directory": "packages/docs"
19
+ },
20
+ "engines": {
21
+ "node": "^24.15.0 || >=26.0.0"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
+ },
28
+ "./package.json": "./package.json"
29
+ },
30
+ "bin": {
31
+ "textmode-docs": "dist/cli/textmode-docs.js"
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md"
36
+ ],
37
+ "dependencies": {
38
+ "typedoc": "^0.28.20",
39
+ "typedoc-plugin-frontmatter": "^1.3.3",
40
+ "typedoc-plugin-markdown": "^4.14.1",
41
+ "typedoc-vitepress-theme": "^1.1.4"
42
+ },
43
+ "peerDependencies": {
44
+ "typescript": ">=5.9 <7"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^24.0.0",
48
+ "typescript": "^6.0.3",
49
+ "vitest": "^5.1.0"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "scripts": {
55
+ "build": "tsc -b",
56
+ "test": "vitest run"
57
+ }
58
+ }
package/index.d.ts DELETED
@@ -1,64 +0,0 @@
1
- export type ReflectionKindName =
2
- 'class' | 'interface' | 'typeAlias' | 'enum' | 'variable' | 'function' | 'method' | 'accessor' | 'property';
3
-
4
- export type MemberPageKind = 'method' | 'property' | 'accessor';
5
-
6
- export interface LinkEntryPoint {
7
- path: string;
8
- tsconfig?: string;
9
- namespaceExportsOnly?: boolean;
10
- }
11
-
12
- export interface DocsChecks {
13
- apiLinks?: ReflectionKindName[];
14
- docstrings?: ReflectionKindName[];
15
- examples?: ReflectionKindName[];
16
- }
17
-
18
- export interface ExamplesPolicy {
19
- forbidGallerySourceBase?: boolean;
20
- }
21
-
22
- export interface TextmodeDocsConfig {
23
- entryPoints?: string[];
24
- linkEntryPoints?: LinkEntryPoint[];
25
- sourceRoots?: string[];
26
- outputDir?: string;
27
- apiBaseUrl?: string;
28
- tsconfig?: string;
29
- memberPageKinds?: MemberPageKind[];
30
- stripApiSelfLinks?: 'minimal' | 'full';
31
- editLink?: boolean;
32
- checks?: DocsChecks;
33
- examples?: false | ExamplesPolicy;
34
- typedoc?: Record<string, unknown>;
35
- }
36
-
37
- export declare function defineDocs<const T extends TextmodeDocsConfig>(config: T): T;
38
-
39
- export interface ExampleQualityResult {
40
- lineCount: number;
41
- issues: string[];
42
- review: string[];
43
- recognizedDefaults: string[];
44
- }
45
-
46
- export interface ExampleSourceAnalysis extends ExampleQualityResult {
47
- labelDeclaration: { end: number; layer: string; instance: string } | null;
48
- }
49
-
50
- export declare function displayedRowLength(value: string, markup?: boolean): number;
51
- export declare const exampleLabelSchema: Readonly<{
52
- rowLimit: number;
53
- dividerLength: number;
54
- panelColor: string;
55
- palette: Readonly<Record<string, string>>;
56
- }>;
57
- export declare function analyzeExampleSource(
58
- content: string,
59
- options?: { title?: string; fileName?: string }
60
- ): ExampleSourceAnalysis;
61
- export declare function validateExamplesManifest(
62
- manifest: unknown,
63
- options: { projectRoot: string; examplesDir?: string; examplesManifest?: string; sourceDir?: string }
64
- ): string[];
@@ -1,219 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import fs from 'node:fs';
4
- import process from 'node:process';
5
- import { parseArgs } from 'node:util';
6
-
7
- import { reconcileDates } from '../internal/reconcile-dates.js';
8
- import { formatResolvedConfig, resolveDocsConfig } from '../internal/config.js';
9
- import {
10
- addApiLinks,
11
- checkApiDocumentation,
12
- checkDocumentation,
13
- generateDocumentation,
14
- watchDocumentation,
15
- } from '../internal/operations.js';
16
-
17
- const PACKAGE_JSON = JSON.parse(fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));
18
- const COMMANDS = new Set(['check', 'build', 'watch', 'api-check']);
19
-
20
- function printGeneralHelp() {
21
- console.log(`@textmode/docs ${PACKAGE_JSON.version}`);
22
- console.log('');
23
- console.log('Usage: textmode-docs <command> [options]');
24
- console.log('');
25
- console.log('Commands:');
26
- console.log(' check Validate generated docs, public API docs, and examples');
27
- console.log(' build [--out <directory>] Generate documentation');
28
- console.log(' watch [--out <directory>] Generate documentation and watch for changes');
29
- console.log(' dates reconcile --baseline <directory> --target <directory> [--date YYYY-MM-DD]');
30
- console.log(' links add Insert or update public API links in source JSDoc');
31
- console.log(' api-check [--include-accessors]');
32
- console.log(' Run the focused public API documentation check');
33
- console.log('');
34
- console.log('Common options:');
35
- console.log(' --cwd <directory> Project root containing package.json');
36
- console.log(' --config <file> Config path relative to the project root');
37
- console.log(' --show-config Print resolved configuration and exit');
38
- console.log(' --help, -h Show help');
39
- console.log(' --version Show version');
40
- }
41
-
42
- function printCommandHelp(command) {
43
- const usage = {
44
- check: 'textmode-docs check [--cwd <directory>] [--config <file>] [--show-config]',
45
- build: 'textmode-docs build [--out <directory>] [--cwd <directory>] [--config <file>] [--show-config]',
46
- watch: 'textmode-docs watch [--out <directory>] [--cwd <directory>] [--config <file>] [--show-config]',
47
- 'api-check':
48
- 'textmode-docs api-check [--include-accessors] [--cwd <directory>] [--config <file>] [--show-config]',
49
- 'links add': 'textmode-docs links add [--cwd <directory>] [--config <file>] [--show-config]',
50
- };
51
- console.log(`Usage: ${usage[command]}`);
52
- }
53
-
54
- function parseCli(argv) {
55
- const parsed = parseArgs({
56
- args: argv,
57
- allowPositionals: true,
58
- strict: true,
59
- options: {
60
- cwd: { type: 'string' },
61
- config: { type: 'string' },
62
- out: { type: 'string' },
63
- 'show-config': { type: 'boolean' },
64
- 'include-accessors': { type: 'boolean' },
65
- help: { type: 'boolean', short: 'h' },
66
- version: { type: 'boolean' },
67
- },
68
- });
69
-
70
- if (parsed.values.version) {
71
- if (parsed.positionals.length > 0) {
72
- throw new Error('--version does not accept a command.');
73
- }
74
- return { action: 'version' };
75
- }
76
-
77
- if (parsed.positionals.length === 0) {
78
- if (parsed.values.help) {
79
- return { action: 'help' };
80
- }
81
- throw new Error('Missing command. Run textmode-docs --help for usage.');
82
- }
83
-
84
- let command = parsed.positionals[0];
85
- let expectedPositionals = 1;
86
- if (command === 'links') {
87
- if (parsed.positionals[1] !== 'add') {
88
- throw new Error('The links command requires the "add" subcommand.');
89
- }
90
- command = 'links add';
91
- expectedPositionals = 2;
92
- } else if (!COMMANDS.has(command)) {
93
- throw new Error(`Unknown command "${command}".`);
94
- }
95
- if (parsed.positionals.length !== expectedPositionals) {
96
- throw new Error(`Unexpected positional argument "${parsed.positionals[expectedPositionals]}".`);
97
- }
98
-
99
- if (parsed.values.out !== undefined && command !== 'build' && command !== 'watch') {
100
- throw new Error('--out is supported only by build and watch.');
101
- }
102
- if (parsed.values['include-accessors'] && command !== 'api-check') {
103
- throw new Error('--include-accessors is supported only by api-check.');
104
- }
105
-
106
- return {
107
- action: parsed.values.help ? 'command-help' : 'run',
108
- command,
109
- values: parsed.values,
110
- };
111
- }
112
-
113
- function commandDetails(command) {
114
- return {
115
- name: command,
116
- emit: command === 'api-check' || command === 'links add' || command === 'check' ? 'temporary' : 'docs',
117
- strict: command === 'check',
118
- watch: command === 'watch',
119
- origins: {
120
- emit: `command:${command}`,
121
- strict: `command:${command}`,
122
- watch: `command:${command}`,
123
- },
124
- };
125
- }
126
-
127
- async function run(argv) {
128
- if (argv[0] === 'dates' && argv[1] === 'reconcile') {
129
- try {
130
- const { values, positionals } = parseArgs({
131
- args: argv.slice(2),
132
- strict: true,
133
- options: { baseline: { type: 'string' }, target: { type: 'string' }, date: { type: 'string' } },
134
- });
135
- if (positionals.length || !values.baseline || !values.target)
136
- throw new Error(
137
- 'Usage: textmode-docs dates reconcile --baseline <directory> --target <directory> [--date YYYY-MM-DD]'
138
- );
139
- const count = await reconcileDates(values);
140
- console.log(`Reconciled dates for ${count} pages.`);
141
- } catch (error) {
142
- console.error(error instanceof Error ? error.message : String(error));
143
- process.exitCode = 1;
144
- }
145
- return;
146
- }
147
- let cli;
148
- try {
149
- cli = parseCli(argv);
150
- } catch (error) {
151
- console.error(error instanceof Error ? error.message : String(error));
152
- process.exitCode = 2;
153
- return;
154
- }
155
-
156
- if (cli.action === 'help') {
157
- printGeneralHelp();
158
- return;
159
- }
160
- if (cli.action === 'version') {
161
- console.log(PACKAGE_JSON.version);
162
- return;
163
- }
164
- if (cli.action === 'command-help') {
165
- printCommandHelp(cli.command);
166
- return;
167
- }
168
-
169
- try {
170
- const config = await resolveDocsConfig({
171
- cwd: cli.values.cwd,
172
- configPath: cli.values.config,
173
- out: cli.values.out,
174
- });
175
- if (cli.values['show-config']) {
176
- console.log(
177
- JSON.stringify(
178
- {
179
- ...formatResolvedConfig(config),
180
- command: commandDetails(cli.command),
181
- },
182
- null,
183
- 2
184
- )
185
- );
186
- return;
187
- }
188
-
189
- let result;
190
- switch (cli.command) {
191
- case 'check':
192
- result = await checkDocumentation(config);
193
- break;
194
- case 'build':
195
- result = await generateDocumentation(config);
196
- break;
197
- case 'watch':
198
- result = await watchDocumentation(config);
199
- break;
200
- case 'api-check':
201
- result = await checkApiDocumentation(config, {
202
- includeAccessors: cli.values['include-accessors'],
203
- });
204
- break;
205
- case 'links add':
206
- result = await addApiLinks(config);
207
- break;
208
- }
209
-
210
- if (!result?.ok) {
211
- process.exitCode = 1;
212
- }
213
- } catch (error) {
214
- console.error(error instanceof Error ? (error.stack ?? error.message) : String(error));
215
- process.exitCode = 2;
216
- }
217
- }
218
-
219
- await run(process.argv.slice(2));