@ankhorage/paradox 0.0.8 → 0.0.10

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 (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +63 -1
  3. package/dist/analyze/analyze.js +44 -2
  4. package/dist/analyze/components.d.ts +4 -1
  5. package/dist/analyze/components.js +13 -2
  6. package/dist/analyze/exports.js +8 -1
  7. package/dist/analyze/semantic/analyzeProject.d.ts +10 -0
  8. package/dist/analyze/semantic/analyzeProject.js +62 -0
  9. package/dist/analyze/semantic/associateDocBlocksWithSymbols.d.ts +5 -0
  10. package/dist/analyze/semantic/associateDocBlocksWithSymbols.js +51 -0
  11. package/dist/analyze/semantic/collectSourceFiles.d.ts +5 -0
  12. package/dist/analyze/semantic/collectSourceFiles.js +22 -0
  13. package/dist/analyze/semantic/createTypeScriptProgram.d.ts +13 -0
  14. package/dist/analyze/semantic/createTypeScriptProgram.js +23 -0
  15. package/dist/analyze/semantic/docBlocks.d.ts +10 -0
  16. package/dist/analyze/semantic/docBlocks.js +102 -0
  17. package/dist/analyze/semantic/exports.d.ts +29 -0
  18. package/dist/analyze/semantic/exports.js +399 -0
  19. package/dist/analyze/semantic/graphs.d.ts +13 -0
  20. package/dist/analyze/semantic/graphs.js +151 -0
  21. package/dist/analyze/semantic/isReactComponent.d.ts +5 -0
  22. package/dist/analyze/semantic/isReactComponent.js +30 -0
  23. package/dist/analyze/semantic/model.d.ts +109 -0
  24. package/dist/analyze/semantic/model.js +1 -0
  25. package/dist/analyze/semantic/paradoxComment.d.ts +16 -0
  26. package/dist/analyze/semantic/paradoxComment.js +64 -0
  27. package/dist/analyze/semantic/tagRegistry.d.ts +2 -0
  28. package/dist/analyze/semantic/tagRegistry.js +1 -0
  29. package/dist/analyze/semantic/utils.d.ts +4 -0
  30. package/dist/analyze/semantic/utils.js +13 -0
  31. package/dist/analyze/types.d.ts +44 -1
  32. package/dist/analyze/utils/getExportMetadata.js +30 -12
  33. package/dist/analyze/utils/getParadoxComment.d.ts +1 -1
  34. package/dist/analyze/utils/getParadoxComment.js +2 -0
  35. package/dist/model/buildModel.d.ts +45 -7
  36. package/dist/model/buildModel.js +10 -0
  37. package/dist/model/types.d.ts +51 -8
  38. package/dist/paths/policy.d.ts +0 -15
  39. package/dist/paths/policy.js +0 -9
  40. package/dist/render/renderers/diagrams.js +11 -0
  41. package/dist/render/renderers/markdown.js +31 -7
  42. package/package.json +15 -6
@@ -26,27 +26,37 @@ function renderReadme(model, outputDir, badges, diagrams) {
26
26
  }
27
27
  lines.push('```', '');
28
28
  }
29
- if (model.config !== null) {
29
+ const { config } = model;
30
+ if (config !== null) {
30
31
  lines.push('## Configuration', '');
31
- lines.push(`Create a \`${model.config.configFile}\` file:`, '');
32
+ lines.push(`Create a \`${config.configFile}\` file:`, '');
32
33
  lines.push('```ts');
33
- if (model.config.factoryName !== null) {
34
- lines.push(`import { ${model.config.factoryName} } from '${model.packageId}';`);
34
+ if (config.factoryName !== null) {
35
+ lines.push(`import { ${config.factoryName} } from '${model.packageId}';`);
35
36
  lines.push('');
36
- lines.push(`export default ${model.config.factoryName}({`);
37
+ lines.push(`export default ${config.factoryName}({`);
37
38
  lines.push(' // ...');
38
39
  lines.push('});');
39
40
  }
40
41
  else {
41
- lines.push(`import type { ${model.config.exportName} } from '${model.packageId}';`);
42
+ lines.push(`import type { ${config.exportName} } from '${model.packageId}';`);
42
43
  lines.push('');
43
44
  lines.push('const config = {');
44
45
  lines.push(' // ...');
45
- lines.push(`} satisfies ${model.config.exportName};`);
46
+ lines.push(`} satisfies ${config.exportName};`);
46
47
  lines.push('');
47
48
  lines.push('export default config;');
48
49
  }
49
50
  lines.push('```', '');
51
+ if (config.members.length > 0) {
52
+ lines.push('### Configuration options', '');
53
+ lines.push('| Field | Type | Required | Default | Description |');
54
+ lines.push('| --- | --- | --- | --- | --- |');
55
+ for (const configMember of flattenConfigMembers(config.members)) {
56
+ lines.push(`| ${escapeTableCell(configMember.path)} | \`${escapeTableCell(configMember.type)}\` | ${configMember.required ? 'yes' : 'no'} | ${escapeTableCell(configMember.defaultValue ?? '')} | ${escapeTableCell(configMember.description ?? '')} |`);
57
+ }
58
+ lines.push('');
59
+ }
50
60
  }
51
61
  lines.push('## Generated documentation', '');
52
62
  lines.push(`- [Interactive documentation app](./${outputDir}/index.html)`);
@@ -144,6 +154,20 @@ function renderComponents(model) {
144
154
  function escapeTableCell(value) {
145
155
  return value.replaceAll('|', '\\|');
146
156
  }
157
+ function flattenConfigMembers(members, prefix = '') {
158
+ return members.flatMap((member) => {
159
+ const path = prefix ? `${prefix}.${member.name}` : member.name;
160
+ const current = {
161
+ path,
162
+ type: member.type,
163
+ required: member.required,
164
+ description: member.description,
165
+ defaultValue: member.defaultValue,
166
+ };
167
+ const children = member.children ? flattenConfigMembers(member.children, path) : [];
168
+ return [current, ...children];
169
+ });
170
+ }
147
171
  function badgeLabel(model, badgePath) {
148
172
  const fileName = badgePath.split('/').pop();
149
173
  if (!fileName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/paradox",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Deterministic documentation generator for TypeScript packages.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -14,6 +14,14 @@
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/ankhorage/paradox.git"
16
16
  },
17
+ "keywords": [
18
+ "typescript",
19
+ "documentation",
20
+ "readme-generator",
21
+ "static-analysis",
22
+ "ts-morph",
23
+ "developer-tools"
24
+ ],
17
25
  "type": "module",
18
26
  "main": "./dist/index.js",
19
27
  "types": "./dist/index.d.ts",
@@ -39,10 +47,11 @@
39
47
  "changeset:status": "changeset status --since=origin/main",
40
48
  "docs": "bun src/cli.ts",
41
49
  "docs:bunx": "bunx @ankhorage/paradox",
42
- "format": "prettier --write .",
43
- "format:check": "prettier --check .",
44
- "lint": "eslint . --max-warnings=0",
45
- "lint:fix": "eslint . --fix --max-warnings=0",
50
+ "format": "ankhorage-prettier --write .",
51
+ "format:check": "ankhorage-prettier --check .",
52
+ "knip": "ankhorage-knip",
53
+ "lint": "ankhorage-eslint . --max-warnings=0",
54
+ "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
46
55
  "prepack": "bun run build",
47
56
  "test": "bun test",
48
57
  "typecheck": "bun x tsc --noEmit -p tsconfig.json",
@@ -52,7 +61,7 @@
52
61
  "ts-morph": "^24.0.0"
53
62
  },
54
63
  "devDependencies": {
55
- "@ankhorage/devtools": "^1.0.0",
64
+ "@ankhorage/devtools": "^1.0.5",
56
65
  "@changesets/cli": "^2.31.0",
57
66
  "@types/bun": "^1.3.13",
58
67
  "typescript": "^5.6.3"