docmedown 0.1.0 → 0.1.2

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 (233) hide show
  1. package/README.md +69 -20
  2. package/dist/abnfDiagram-VCTEODGH-CtQBp0Qv.mjs +89 -0
  3. package/dist/abnfDiagram-VCTEODGH-mccrzlD_.js +1 -0
  4. package/dist/arc-DgPKXEdT.mjs +82 -0
  5. package/dist/arc-n7TW7Bis.js +1 -0
  6. package/dist/architecture-7GRP2DOG-B7myQ46f.js +1 -0
  7. package/dist/architecture-7GRP2DOG-Cxj1ussQ.mjs +3 -0
  8. package/dist/architectureDiagram-5GKGNRK7-BdTCu5T3.js +36 -0
  9. package/dist/architectureDiagram-5GKGNRK7-CkgZa-G1.mjs +4154 -0
  10. package/dist/array-CApNbSU9.mjs +6 -0
  11. package/dist/array-DZSRzHA_.js +1 -0
  12. package/dist/blockDiagram-I7D4REHJ-CSYvpxQw.js +129 -0
  13. package/dist/blockDiagram-I7D4REHJ-CYngfPD9.mjs +1922 -0
  14. package/dist/c4Diagram-7LVT6UL2-B-sz5MUK.js +38 -0
  15. package/dist/c4Diagram-7LVT6UL2-DEzxFf2b.mjs +3010 -0
  16. package/dist/channel-LgHproiI.mjs +5 -0
  17. package/dist/channel-yqu0m4cl.js +1 -0
  18. package/dist/chunk-2E4U76K2-BOyeRQsI.js +1 -0
  19. package/dist/chunk-2E4U76K2-CoTrgtfg.mjs +348 -0
  20. package/dist/chunk-2Q5K7J3B-D4EgYPOq.mjs +15 -0
  21. package/dist/chunk-2Q5K7J3B-DhjCNjaM.js +1 -0
  22. package/dist/chunk-4HAMMTFA-GFyfmcSO.js +62 -0
  23. package/dist/chunk-4HAMMTFA-VgWPe1ng.mjs +4188 -0
  24. package/dist/chunk-5VM5RSS4-GINalzIv.js +15 -0
  25. package/dist/chunk-5VM5RSS4-TqxtqrwE.mjs +5 -0
  26. package/dist/chunk-75Z2AOVW-DYouz5MZ.js +2 -0
  27. package/dist/chunk-75Z2AOVW-Dz0Sko9Y.mjs +1330 -0
  28. package/dist/chunk-CLGD4ZFX-C5J-e2io.js +1 -0
  29. package/dist/chunk-CLGD4ZFX-DBkwyMMv.mjs +14 -0
  30. package/dist/chunk-DU6HZSFF-BEQZSmUu.mjs +3836 -0
  31. package/dist/chunk-DU6HZSFF-CWc5ewtb.js +127 -0
  32. package/dist/chunk-F27PBJKO-8jvY_jJK.js +1 -0
  33. package/dist/chunk-F27PBJKO-DFH3sRZG.mjs +61 -0
  34. package/dist/chunk-FOHPRMQF-LRqOLsSw.mjs +21456 -0
  35. package/dist/chunk-FOHPRMQF-tmTlwTeH.js +161 -0
  36. package/dist/chunk-GMAD6QVW-BZeZ4fdb.mjs +1863 -0
  37. package/dist/chunk-GMAD6QVW-DEQiTa0c.js +72 -0
  38. package/dist/chunk-GVQU2GXP-B1D3J05J.mjs +37 -0
  39. package/dist/chunk-GVQU2GXP-CdJIWN41.js +1 -0
  40. package/dist/chunk-IMKFNOWR-BmZb9U1f.mjs +2042 -0
  41. package/dist/chunk-IMKFNOWR-CPJsszGN.js +231 -0
  42. package/dist/chunk-JWPE2WC7-DIKiF5cm.mjs +8 -0
  43. package/dist/chunk-JWPE2WC7-p1fYVdYc.js +1 -0
  44. package/dist/chunk-L3NEJ4N5-TzDiVs78.js +1 -0
  45. package/dist/chunk-L3NEJ4N5-lal8wUID.mjs +245 -0
  46. package/dist/chunk-LNGE3PJU-BQX75wkM.js +34 -0
  47. package/dist/chunk-LNGE3PJU-DJ9JuXV6.mjs +1521 -0
  48. package/dist/chunk-OSK3NFVY-9AWK88m1.mjs +672 -0
  49. package/dist/chunk-OSK3NFVY-CHzvVe8m.js +10 -0
  50. package/dist/chunk-P2QGCYS3-6q3AXPt5.mjs +67 -0
  51. package/dist/chunk-P2QGCYS3-DKZzpRQW.js +1 -0
  52. package/dist/chunk-POPQ4Y6H-Dd7J9tx3.mjs +26 -0
  53. package/dist/chunk-POPQ4Y6H-T5C7wpjf.js +1 -0
  54. package/dist/chunk-PWAF6VOD-BYG76tEe.mjs +275 -0
  55. package/dist/chunk-PWAF6VOD-DxZLuCEw.js +1 -0
  56. package/dist/chunk-SHT3W25Y-B2Wes8jn.mjs +4183 -0
  57. package/dist/chunk-SHT3W25Y-BQjHSn5K.js +168 -0
  58. package/dist/chunk-SVP7TREG-BFMd615E.js +88 -0
  59. package/dist/chunk-SVP7TREG-CynckzeF.mjs +490 -0
  60. package/dist/chunk-TICWLB2K-BfCuoR1V.mjs +3357 -0
  61. package/dist/chunk-TICWLB2K-agcyBfUp.js +206 -0
  62. package/dist/chunk-TLUHSLCS-CUrWaKDG.mjs +59 -0
  63. package/dist/chunk-TLUHSLCS-Drx_a7am.js +1 -0
  64. package/dist/chunk-XXDRQBXY-AAk1-Cyg.js +1 -0
  65. package/dist/chunk-XXDRQBXY-DpR8eYzz.mjs +9 -0
  66. package/dist/chunk-Y2CYZVJY-CnmLqFtv.js +1 -0
  67. package/dist/chunk-Y2CYZVJY-i11wjrBe.mjs +12 -0
  68. package/dist/classDiagram-ZZMXUADV-B7IN9zcX.js +1 -0
  69. package/dist/classDiagram-ZZMXUADV-tcy6gxSB.mjs +30 -0
  70. package/dist/classDiagram-v2-VYDZK3BY-B7IN9zcX.js +1 -0
  71. package/dist/classDiagram-v2-VYDZK3BY-D5wM6Acp.mjs +30 -0
  72. package/dist/cli.js +719 -532
  73. package/dist/cose-bilkent-JH36ORCC-DBUPO3qJ.js +1 -0
  74. package/dist/cose-bilkent-JH36ORCC-Slpx4WIt.mjs +2253 -0
  75. package/dist/cynefin-OW5HDTMX--QVnfGi1.mjs +3 -0
  76. package/dist/cynefin-OW5HDTMX-lNKysi7S.js +1 -0
  77. package/dist/cynefinDiagram-5FMLGOSQ-CsFONYqx.js +62 -0
  78. package/dist/cynefinDiagram-5FMLGOSQ-DsrxYBcg.mjs +355 -0
  79. package/dist/cytoscape.esm-C5TvPYYm.mjs +18148 -0
  80. package/dist/cytoscape.esm-CBmWJr5M.js +321 -0
  81. package/dist/dagre-CZ6P9L_h.js +1 -0
  82. package/dist/dagre-GXQ25YYZ-CQszk-7P.js +4 -0
  83. package/dist/dagre-GXQ25YYZ-ecYByRSn.mjs +425 -0
  84. package/dist/dagre-J_1oH0eY.mjs +1934 -0
  85. package/dist/defaultLocale-N-0uLSyg.mjs +198 -0
  86. package/dist/defaultLocale-ybN1Vtvg.js +1 -0
  87. package/dist/diagram-S7CK7UJ4-CTMvxX__.js +30 -0
  88. package/dist/diagram-S7CK7UJ4-DxCghfa-.mjs +301 -0
  89. package/dist/diagram-UQ7AKVKN-1viEkqlG.js +41 -0
  90. package/dist/diagram-UQ7AKVKN-BA7Z_oB7.mjs +214 -0
  91. package/dist/diagram-VSXAHHWV-DgVT19mq.js +3 -0
  92. package/dist/diagram-VSXAHHWV-Dtqo03M5.mjs +432 -0
  93. package/dist/diagram-VX7I27RA-CNw0pOX_.js +24 -0
  94. package/dist/diagram-VX7I27RA-GMPRt8Zh.mjs +527 -0
  95. package/dist/diagram-Z3DM3KII-C6XdQK_Q.mjs +134 -0
  96. package/dist/diagram-Z3DM3KII-CPkBr3FT.js +24 -0
  97. package/dist/dist-CXWJafG_.js +1 -0
  98. package/dist/dist-DNdLIC8h.mjs +59 -0
  99. package/dist/docmedown.cjs +125 -44
  100. package/dist/docmedown.iife.js +3477 -72
  101. package/dist/docmedown.mjs +10003 -4807
  102. package/dist/ebnfDiagram-PWID7BFC-CseVsyL3.js +1 -0
  103. package/dist/ebnfDiagram-PWID7BFC-D_dBDXWC.mjs +100 -0
  104. package/dist/erDiagram-RLTQ6QDP-DFwfQTRS.js +99 -0
  105. package/dist/erDiagram-RLTQ6QDP-DP7ddGMH.mjs +1966 -0
  106. package/dist/eventmodeling-NTZA5JFV-CzxVg0l5.js +1 -0
  107. package/dist/eventmodeling-NTZA5JFV-Djsy__5n.mjs +3 -0
  108. package/dist/flowDiagram-HODETNUW-7hSJfI3W.js +1 -0
  109. package/dist/flowDiagram-HODETNUW-Dqu5Lr19.mjs +17 -0
  110. package/dist/ganttDiagram-EL5Y4UJY-KNL3tzTD.mjs +3072 -0
  111. package/dist/ganttDiagram-EL5Y4UJY-aiLqNWgi.js +292 -0
  112. package/dist/gitGraph-4MIJSDKK-DnElfqX7.js +1 -0
  113. package/dist/gitGraph-4MIJSDKK-xuKJBT2e.mjs +3 -0
  114. package/dist/gitGraphDiagram-WWUBYQGX-D4gSo_-e.js +106 -0
  115. package/dist/gitGraphDiagram-WWUBYQGX-Dooss5fG.mjs +733 -0
  116. package/dist/graphlib-BaETKKSa.js +1 -0
  117. package/dist/graphlib-XW-Jr8pF.mjs +1267 -0
  118. package/dist/info-A6RAGUB7-ClYskpn6.mjs +3 -0
  119. package/dist/info-A6RAGUB7-DDvvt-fW.js +1 -0
  120. package/dist/infoDiagram-27XIBGKW-B2-y2mdQ.mjs +20 -0
  121. package/dist/infoDiagram-27XIBGKW-DYQ9NzfL.js +2 -0
  122. package/dist/init-BJdqMO10.js +1 -0
  123. package/dist/init-CsQUQz36.mjs +13 -0
  124. package/dist/ishikawaDiagram-5VMMS53U-ULIhoYO5.js +70 -0
  125. package/dist/ishikawaDiagram-5VMMS53U-xAArNh-1.mjs +719 -0
  126. package/dist/journeyDiagram-3NMN7TZE-BBMYNZRL.js +139 -0
  127. package/dist/journeyDiagram-3NMN7TZE-BH-uKqP7.mjs +884 -0
  128. package/dist/kanban-definition-UXKFOSKX-Be49llXr.mjs +976 -0
  129. package/dist/kanban-definition-UXKFOSKX-CDL5yJkq.js +89 -0
  130. package/dist/line-BEwhHSLl.js +1 -0
  131. package/dist/line-CiXRog8O.mjs +34 -0
  132. package/dist/linear-75tfjrny.js +1 -0
  133. package/dist/linear-Ncx_RuON.mjs +288 -0
  134. package/dist/mermaid-parser.core-BBApyu_y.js +6 -0
  135. package/dist/mermaid-parser.core-BRHibdUE.mjs +638 -0
  136. package/dist/mindmap-definition-YA3MSWOX-Chy7XP_5.mjs +1006 -0
  137. package/dist/mindmap-definition-YA3MSWOX-DOda-fkL.js +96 -0
  138. package/dist/ordinal-B1BNQwUR.mjs +65 -0
  139. package/dist/ordinal-B9aFWmF9.js +1 -0
  140. package/dist/packet-AYTQ26CC-CorIy9Ul.js +1 -0
  141. package/dist/packet-AYTQ26CC-DWH8gXJK.mjs +3 -0
  142. package/dist/path-CnWkkRiY.mjs +84 -0
  143. package/dist/path-DIS6ck99.js +1 -0
  144. package/dist/pegDiagram-XKGWAZYB-Cdw6MeON.js +1 -0
  145. package/dist/pegDiagram-XKGWAZYB-uNfxRaq1.mjs +94 -0
  146. package/dist/pie-WAS4IAKB-Cn5eK-5P.mjs +3 -0
  147. package/dist/pie-WAS4IAKB-D84xrSoY.js +1 -0
  148. package/dist/pieDiagram-E7YTZNPT-Bd6mvpJw.js +39 -0
  149. package/dist/pieDiagram-E7YTZNPT-Cczo96a2.mjs +203 -0
  150. package/dist/quadrantDiagram-AXDQQJYC-BPfgvMsS.js +7 -0
  151. package/dist/quadrantDiagram-AXDQQJYC-eqRNtVRl.mjs +2001 -0
  152. package/dist/radar-RG4KPBEZ-DvkxGdO6.mjs +3 -0
  153. package/dist/radar-RG4KPBEZ-R2sQOLL9.js +1 -0
  154. package/dist/railroad-74A4TZTK-BOZIf6ts.js +1 -0
  155. package/dist/railroad-74A4TZTK-CrQzn8Nm.mjs +3 -0
  156. package/dist/railroad-abnf-HS5TGJTU-BZYetxLz.mjs +3 -0
  157. package/dist/railroad-abnf-HS5TGJTU-CXU1aC4B.js +1 -0
  158. package/dist/railroad-ebnf-LZEXJU2U-D29kI3YW.js +1 -0
  159. package/dist/railroad-ebnf-LZEXJU2U-qgzTOmN6.mjs +3 -0
  160. package/dist/railroad-peg-WCYAUIDC-Bjs9Ws3P.mjs +3 -0
  161. package/dist/railroad-peg-WCYAUIDC-CXviP0hz.js +1 -0
  162. package/dist/railroadDiagram-O6MQD6OU-58kvwt7H.mjs +76 -0
  163. package/dist/railroadDiagram-O6MQD6OU-CKY3uzTc.js +1 -0
  164. package/dist/requirementDiagram-BXWQKSXE-0hZ04Q6h.js +84 -0
  165. package/dist/requirementDiagram-BXWQKSXE-CS673B5n.mjs +2224 -0
  166. package/dist/rough.esm-ChRLLRha.js +1 -0
  167. package/dist/rough.esm-DXYGHN3m.mjs +1361 -0
  168. package/dist/sankeyDiagram-P5KCCOFB-D1D6HfAM.mjs +972 -0
  169. package/dist/sankeyDiagram-P5KCCOFB-ciJb9Zr8.js +40 -0
  170. package/dist/sequenceDiagram-WJ2MYXX4-BXEznuI6.js +162 -0
  171. package/dist/sequenceDiagram-WJ2MYXX4-CI1VT8AG.mjs +4156 -0
  172. package/dist/sizeCapture-INFHLROL-BihkCH-7.js +1 -0
  173. package/dist/sizeCapture-INFHLROL-BmxqyOLj.mjs +46 -0
  174. package/dist/src-B4mN2BMl.js +1 -0
  175. package/dist/src-D_hsMyeP.mjs +2154 -0
  176. package/dist/stateDiagram-D77RDMKH-BQrSs72W.mjs +220 -0
  177. package/dist/stateDiagram-D77RDMKH-D2PtkW2U.js +1 -0
  178. package/dist/stateDiagram-v2-MP3YSRHH-CCbvNfk-.mjs +30 -0
  179. package/dist/stateDiagram-v2-MP3YSRHH-Dq1QuPeN.js +1 -0
  180. package/dist/swimlanes-42K2YHIH-CA316NPm.mjs +4979 -0
  181. package/dist/swimlanes-42K2YHIH-DlggBCTy.js +1 -0
  182. package/dist/swimlanesDiagram-VR7AAH4N-BV9PEIoG.js +8 -0
  183. package/dist/swimlanesDiagram-VR7AAH4N-BfrOCfdf.mjs +31 -0
  184. package/dist/timeline-definition-24CTP7MA-Bkd8rWNJ.js +120 -0
  185. package/dist/timeline-definition-24CTP7MA-BvkqNYt1.mjs +1069 -0
  186. package/dist/treeView-Q6P3EWNA-Aof3Cp1M.mjs +3 -0
  187. package/dist/treeView-Q6P3EWNA-BTzvdwbb.js +1 -0
  188. package/dist/treemap-WGGIJYW6-BNXGg99p.mjs +3 -0
  189. package/dist/treemap-WGGIJYW6-DfR4P2Hh.js +1 -0
  190. package/dist/types/runtime/app.d.ts +3 -3
  191. package/dist/types/runtime/components/AppearanceMenu.d.ts +2 -0
  192. package/dist/types/runtime/components/Builtins.d.ts +3 -3
  193. package/dist/types/runtime/components/Content.d.ts +1 -1
  194. package/dist/types/runtime/components/DmdRegistry.d.ts +4 -2
  195. package/dist/types/runtime/components/Layout.d.ts +1 -1
  196. package/dist/types/runtime/components/MermaidDiagram.d.ts +16 -0
  197. package/dist/types/runtime/components/Navbar.d.ts +1 -1
  198. package/dist/types/runtime/components/OfflineDownloadButton.d.ts +2 -0
  199. package/dist/types/runtime/components/Sidebar.d.ts +1 -1
  200. package/dist/types/runtime/components/TableOfContents.d.ts +2 -2
  201. package/dist/types/runtime/config-schema.d.ts +386 -0
  202. package/dist/types/runtime/config.d.ts +10 -3
  203. package/dist/types/runtime/index.d.ts +7 -5
  204. package/dist/types/runtime/loader/auto-indexer.d.ts +1 -1
  205. package/dist/types/runtime/loader/local-loader.d.ts +1 -1
  206. package/dist/types/runtime/loader/remote-github.d.ts +2 -2
  207. package/dist/types/runtime/loader/remote-gitlab.d.ts +2 -2
  208. package/dist/types/runtime/markdown/callouts.d.ts +1 -1
  209. package/dist/types/runtime/markdown/highlighter.d.ts +16 -16
  210. package/dist/types/runtime/markdown/mermaid.d.ts +82 -1
  211. package/dist/types/runtime/markdown/parser.d.ts +1 -1
  212. package/dist/types/runtime/markdown/renderer.d.ts +1 -1
  213. package/dist/types/runtime/offline-export.d.ts +26 -0
  214. package/dist/types/runtime/provider/DocProvider.d.ts +5 -5
  215. package/dist/types/runtime/provider/ThemeProvider.d.ts +13 -6
  216. package/dist/types/runtime/search/SearchModal.d.ts +2 -2
  217. package/dist/types/runtime/search/search-index.d.ts +1 -1
  218. package/dist/types/runtime/types.d.ts +28 -99
  219. package/dist/vennDiagram-4TSXK5OY-BOUFXjso.js +34 -0
  220. package/dist/vennDiagram-4TSXK5OY-CeOg3-hU.mjs +1880 -0
  221. package/dist/wardley-WFR3VGLG-BOYcSLd1.mjs +3 -0
  222. package/dist/wardley-WFR3VGLG-DWDqJSgm.js +1 -0
  223. package/dist/wardleyDiagram-VM6X3IG4-BhWgMjFr.js +78 -0
  224. package/dist/wardleyDiagram-VM6X3IG4-C31KoRmF.mjs +645 -0
  225. package/dist/xychartDiagram-S5SC5T6Z-1yU8zz6I.js +7 -0
  226. package/dist/xychartDiagram-S5SC5T6Z-BK7upFom.mjs +2210 -0
  227. package/package.json +15 -4
  228. package/schemas/docs.schema.json +166 -0
  229. package/templates/README.md +4 -4
  230. package/templates/docs.json +5 -2
  231. package/templates/getting-started.md +1 -1
  232. package/templates/guides/custom-components.md +2 -0
  233. package/templates/index.html +2 -4
package/dist/cli.js CHANGED
@@ -24,34 +24,354 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
 
26
26
  // src/cli/index.ts
27
+ var import_node_fs7 = __toESM(require("fs"));
28
+ var import_node_path7 = __toESM(require("path"));
27
29
  var import_commander = require("commander");
28
- var import_fs7 = __toESM(require("fs"));
29
- var import_path7 = __toESM(require("path"));
30
30
 
31
- // src/cli/commands/init.ts
32
- var import_fs4 = __toESM(require("fs"));
33
- var import_path4 = __toESM(require("path"));
34
- var import_chalk3 = __toESM(require("chalk"));
35
- var import_prompts = __toESM(require("prompts"));
36
-
37
- // src/cli/utils/server.ts
38
- var import_http = __toESM(require("http"));
39
- var import_fs3 = __toESM(require("fs"));
40
- var import_path3 = __toESM(require("path"));
41
- var import_mime_types = __toESM(require("mime-types"));
42
- var import_ws = require("ws");
43
- var import_chokidar2 = __toESM(require("chokidar"));
44
- var import_chalk2 = __toESM(require("chalk"));
31
+ // package.json
32
+ var package_default = {
33
+ name: "docmedown",
34
+ version: "0.1.2",
35
+ description: "The simplest MarkDown documenter yet. CLI & Web Script React SPA documentation engine.",
36
+ main: "./dist/docmedown.cjs",
37
+ module: "./dist/docmedown.mjs",
38
+ types: "./dist/types/runtime/index.d.ts",
39
+ exports: {
40
+ ".": {
41
+ types: "./dist/types/runtime/index.d.ts",
42
+ import: "./dist/docmedown.mjs",
43
+ require: "./dist/docmedown.cjs"
44
+ },
45
+ "./iife": "./dist/docmedown.iife.js"
46
+ },
47
+ unpkg: "./dist/docmedown.iife.js",
48
+ jsdelivr: "./dist/docmedown.iife.js",
49
+ bin: {
50
+ docmedown: "bin/docmedown.js",
51
+ dmd: "bin/docmedown.js"
52
+ },
53
+ files: [
54
+ "dist",
55
+ "bin",
56
+ "templates",
57
+ "schemas",
58
+ "README.md",
59
+ "LICENSE"
60
+ ],
61
+ scripts: {
62
+ "dev:runtime": "vite build --watch",
63
+ "build:runtime": "vite build",
64
+ "build:cli": "tsup",
65
+ typecheck: "tsc --noEmit",
66
+ lint: "biome check .",
67
+ "lint:fix": "biome check --write .",
68
+ format: "biome format --write .",
69
+ "build:types": "tsc -p tsconfig.runtime.json",
70
+ build: "npm run build:runtime && npm run build:cli && npm run build:types",
71
+ docmedown: "node ./bin/docmedown.js",
72
+ dmd: "node ./bin/docmedown.js",
73
+ "init:docs": "node ./bin/docmedown.js init",
74
+ serve: "node ./bin/docmedown.js serve ./docs",
75
+ dev: "node ./bin/docmedown.js serve ./docs",
76
+ "build:docs": "node ./bin/docmedown.js build ./docs",
77
+ "build:docs:watch": "node ./bin/docmedown.js build ./docs --watch",
78
+ "build:offline": "node ./bin/docmedown.js build ./docs",
79
+ "config:docs": "node ./bin/docmedown.js config ./docs/docs.json",
80
+ test: "npx tsx --test tests/parser.test.ts tests/scanner.test.ts tests/theme-schema.test.ts tests/runtime-integration.test.ts tests/package-smoke.test.ts tests/hosting.test.ts",
81
+ "test:artifacts": "npx tsx --test tests/offline-artifact.test.ts",
82
+ "test:release": "npm run typecheck && npm run lint && npm run test && npm run build && npm run build:docs && npm run test:artifacts && npm pack --dry-run",
83
+ deploy: "node ./scripts/deploy.mjs",
84
+ "deploy:dry-run": "npm run deploy -- --dry-run",
85
+ prepublishOnly: "npm run test:release"
86
+ },
87
+ keywords: [
88
+ "markdown",
89
+ "documentation",
90
+ "docs",
91
+ "docusaurus",
92
+ "docsify",
93
+ "react",
94
+ "spa",
95
+ "cli",
96
+ "offline-docs",
97
+ "github-docs"
98
+ ],
99
+ author: "Gabriel M. Silva",
100
+ license: "MIT",
101
+ engines: {
102
+ node: ">=20.19.0"
103
+ },
104
+ repository: {
105
+ type: "git",
106
+ url: "git+https://github.com/gabrielmsilva00/docmedown.git"
107
+ },
108
+ bugs: {
109
+ url: "https://github.com/gabrielmsilva00/docmedown/issues"
110
+ },
111
+ homepage: "https://github.com/gabrielmsilva00/docmedown#readme",
112
+ packageManager: "npm@11.16.0",
113
+ overrides: {
114
+ tsup: {
115
+ esbuild: "0.28.2"
116
+ }
117
+ },
118
+ dependencies: {
119
+ chalk: "^4.1.2",
120
+ chokidar: "^3.6.0",
121
+ commander: "^12.1.0",
122
+ esbuild: "^0.28.2",
123
+ "gray-matter": "^4.0.3",
124
+ "mime-types": "^2.1.35",
125
+ open: "^10.1.0",
126
+ prompts: "^2.4.2",
127
+ ws: "^8.18.0",
128
+ zod: "^4.4.3"
129
+ },
130
+ devDependencies: {
131
+ "@biomejs/biome": "^2.5.10",
132
+ "@types/node": "^22.5.0",
133
+ "@types/prismjs": "^1.26.6",
134
+ "@types/prompts": "^2.4.9",
135
+ "@types/react": "^18.3.5",
136
+ "@types/react-dom": "^18.3.0",
137
+ "@types/ws": "^8.5.12",
138
+ "@vitejs/plugin-react": "^6.1.0",
139
+ katex: "^0.16.11",
140
+ marked: "^14.1.1",
141
+ mermaid: "^11.17.2",
142
+ minisearch: "^7.1.0",
143
+ prismjs: "^1.29.0",
144
+ react: "^18.3.1",
145
+ "react-dom": "^18.3.1",
146
+ tsup: "^8.2.4",
147
+ tsx: "^4.19.0",
148
+ typescript: "^5.5.4",
149
+ vite: "^8.2.2",
150
+ "vite-plugin-css-injected-by-js": "^5.0.2"
151
+ }
152
+ };
45
153
 
46
154
  // src/cli/commands/build.ts
47
- var import_fs2 = __toESM(require("fs"));
48
- var import_path2 = __toESM(require("path"));
155
+ var import_node_fs2 = __toESM(require("fs"));
156
+ var import_node_path2 = __toESM(require("path"));
157
+ var import_node_zlib = require("zlib");
49
158
  var import_chalk = __toESM(require("chalk"));
50
159
  var import_chokidar = __toESM(require("chokidar"));
160
+ var import_esbuild = require("esbuild");
161
+
162
+ // src/runtime/config-schema.ts
163
+ var import_zod = require("zod");
164
+ var nonEmptyString = import_zod.z.string().trim().min(1, "Must not be empty.");
165
+ var themePresetSchema = import_zod.z.enum(["indigo", "emerald", "sunset", "violet", "rose", "slate", "cyberpunk"]);
166
+ var themeFamilySchema = import_zod.z.enum(["atlas", "blueprint", "terminal", "editorial"]);
167
+ var themeDensitySchema = import_zod.z.enum(["comfortable", "compact"]);
168
+ var colorModeSchema = import_zod.z.enum(["light", "dark", "auto"]);
169
+ var socialTypeSchema = import_zod.z.enum(["github", "gitlab", "twitter", "x", "discord", "custom"]);
170
+ var badgeTypeSchema = import_zod.z.enum(["info", "success", "warning", "new"]);
171
+ var navLinkSchema = import_zod.z.object({
172
+ label: nonEmptyString,
173
+ href: nonEmptyString,
174
+ external: import_zod.z.boolean().optional(),
175
+ icon: import_zod.z.string().optional()
176
+ }).strict();
177
+ var socialLinkSchema = import_zod.z.object({
178
+ type: socialTypeSchema,
179
+ url: import_zod.z.string().url("Must be an absolute URL."),
180
+ label: import_zod.z.string().optional(),
181
+ icon: import_zod.z.string().optional()
182
+ }).strict();
183
+ var remoteSourceSchema = import_zod.z.discriminatedUnion("type", [
184
+ import_zod.z.object({
185
+ type: import_zod.z.literal("github"),
186
+ repo: nonEmptyString.regex(/^[^/\s]+\/[^/\s]+$/, "Use the owner/repository format."),
187
+ branch: nonEmptyString.optional(),
188
+ docsDir: import_zod.z.string().optional(),
189
+ token: import_zod.z.string().optional(),
190
+ baseUrl: import_zod.z.string().url("Must be an absolute URL.").optional()
191
+ }).strict(),
192
+ import_zod.z.object({
193
+ type: import_zod.z.literal("gitlab"),
194
+ repo: nonEmptyString.regex(/^[^/\s]+\/[^/\s]+$/, "Use the namespace/repository format."),
195
+ branch: nonEmptyString.optional(),
196
+ docsDir: import_zod.z.string().optional(),
197
+ token: import_zod.z.string().optional(),
198
+ baseUrl: import_zod.z.string().url("Must be an absolute URL.").optional()
199
+ }).strict(),
200
+ import_zod.z.object({
201
+ type: import_zod.z.literal("raw"),
202
+ baseUrl: import_zod.z.string().url("Must be an absolute URL."),
203
+ branch: nonEmptyString.optional(),
204
+ docsDir: import_zod.z.string().optional(),
205
+ token: import_zod.z.string().optional()
206
+ }).strict()
207
+ ]);
208
+ var sidebarItemSchema = import_zod.z.lazy(
209
+ () => import_zod.z.object({
210
+ title: import_zod.z.string().optional(),
211
+ path: import_zod.z.string().optional(),
212
+ slug: import_zod.z.string().optional(),
213
+ icon: import_zod.z.string().optional(),
214
+ badge: import_zod.z.string().optional(),
215
+ badgeType: badgeTypeSchema.optional(),
216
+ collapsed: import_zod.z.boolean().optional(),
217
+ children: import_zod.z.array(sidebarItemSchema).optional()
218
+ }).strict()
219
+ );
220
+ var docThemeConfigSchema = import_zod.z.object({
221
+ family: themeFamilySchema.optional(),
222
+ density: themeDensitySchema.optional(),
223
+ /** @deprecated Use `family`. Preserved to migrate existing docs.json files. */
224
+ preset: themePresetSchema.optional(),
225
+ defaultMode: colorModeSchema.optional(),
226
+ accentColor: import_zod.z.string().optional(),
227
+ accentColorDark: import_zod.z.string().optional(),
228
+ fontFamily: import_zod.z.string().optional(),
229
+ codeTheme: import_zod.z.enum(["github", "dracula", "one-dark", "synthwave"]).optional(),
230
+ logo: import_zod.z.object({
231
+ light: import_zod.z.string().optional(),
232
+ dark: import_zod.z.string().optional(),
233
+ alt: import_zod.z.string().optional(),
234
+ text: import_zod.z.string().optional()
235
+ }).strict().optional(),
236
+ favicon: import_zod.z.string().optional()
237
+ }).strict();
238
+ var docSearchConfigSchema = import_zod.z.object({
239
+ enabled: import_zod.z.boolean().optional(),
240
+ placeholder: import_zod.z.string().optional(),
241
+ maxResults: import_zod.z.number().int().positive().max(100).optional()
242
+ }).strict();
243
+ var docConfigSchema = import_zod.z.object({
244
+ $schema: import_zod.z.string().url("Must be an absolute URL.").optional(),
245
+ name: nonEmptyString.optional(),
246
+ tagline: import_zod.z.string().optional(),
247
+ description: import_zod.z.string().optional(),
248
+ version: import_zod.z.string().optional(),
249
+ rootDoc: nonEmptyString.optional(),
250
+ source: remoteSourceSchema.optional(),
251
+ theme: docThemeConfigSchema.optional(),
252
+ nav: import_zod.z.array(navLinkSchema).optional(),
253
+ socials: import_zod.z.array(socialLinkSchema).optional(),
254
+ sidebar: import_zod.z.array(sidebarItemSchema).optional(),
255
+ autoIndex: import_zod.z.object({
256
+ enabled: import_zod.z.boolean().optional(),
257
+ exclude: import_zod.z.array(nonEmptyString).optional(),
258
+ sort: import_zod.z.enum(["alphabetical", "frontmatter", "natural"]).optional(),
259
+ defaultCollapsed: import_zod.z.boolean().optional()
260
+ }).strict().optional(),
261
+ search: docSearchConfigSchema.optional(),
262
+ footer: import_zod.z.object({
263
+ copyright: import_zod.z.string().optional(),
264
+ links: import_zod.z.array(navLinkSchema).optional(),
265
+ showBuiltWith: import_zod.z.boolean().optional()
266
+ }).strict().optional(),
267
+ componentsUrl: import_zod.z.string().optional(),
268
+ editUrl: import_zod.z.string().optional()
269
+ }).strict();
270
+ var normalizedDocConfigSchema = docConfigSchema.extend({
271
+ name: nonEmptyString
272
+ });
273
+ function formatConfigIssues(error) {
274
+ return error.issues.map((issue) => `${issue.path.length > 0 ? issue.path.join(".") : "config"}: ${issue.message}`).join("\n");
275
+ }
276
+ function parseDocConfig(input) {
277
+ const result = docConfigSchema.safeParse(input);
278
+ if (result.success) return result.data;
279
+ throw new Error(`Invalid DocMeDown configuration:
280
+ ${formatConfigIssues(result.error)}`);
281
+ }
282
+
283
+ // src/runtime/config.ts
284
+ var LEGACY_PRESET_FAMILIES = {
285
+ indigo: "atlas",
286
+ emerald: "atlas",
287
+ sunset: "editorial",
288
+ violet: "atlas",
289
+ rose: "editorial",
290
+ slate: "blueprint",
291
+ cyberpunk: "terminal"
292
+ };
293
+ var DEFAULT_CONFIG = {
294
+ name: "DocMeDown",
295
+ tagline: "The simplest Markdown documenter yet",
296
+ description: "Instant documentation site powered by DocMeDown",
297
+ version: "1.0.0",
298
+ rootDoc: "README.md",
299
+ theme: {
300
+ family: "atlas",
301
+ density: "comfortable",
302
+ defaultMode: "auto",
303
+ codeTheme: "github"
304
+ },
305
+ autoIndex: {
306
+ enabled: true,
307
+ sort: "natural",
308
+ defaultCollapsed: false,
309
+ exclude: ["node_modules", ".git", ".dmd", "dist", "bin", "package.json", "tsconfig.json"]
310
+ },
311
+ search: {
312
+ enabled: true,
313
+ placeholder: "Search documentation...",
314
+ maxResults: 10
315
+ },
316
+ footer: {
317
+ copyright: `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} DocMeDown. All rights reserved.`,
318
+ showBuiltWith: true
319
+ }
320
+ };
321
+ function normalizeConfig(userConfig = {}) {
322
+ const parsedConfig = parseDocConfig(userConfig);
323
+ const legacyPreset = parsedConfig.theme?.preset;
324
+ const family = parsedConfig.theme?.family || (legacyPreset ? LEGACY_PRESET_FAMILIES[legacyPreset] : DEFAULT_CONFIG.theme?.family);
325
+ const { preset: _legacyPreset, ...resolvedTheme } = parsedConfig.theme ?? {};
326
+ void _legacyPreset;
327
+ const mergedConfig = {
328
+ ...DEFAULT_CONFIG,
329
+ ...parsedConfig,
330
+ theme: {
331
+ ...DEFAULT_CONFIG.theme,
332
+ ...resolvedTheme,
333
+ family,
334
+ logo: {
335
+ ...DEFAULT_CONFIG.theme?.logo,
336
+ ...parsedConfig.theme?.logo
337
+ }
338
+ },
339
+ autoIndex: {
340
+ ...DEFAULT_CONFIG.autoIndex,
341
+ ...parsedConfig.autoIndex
342
+ },
343
+ search: {
344
+ ...DEFAULT_CONFIG.search,
345
+ ...parsedConfig.search
346
+ },
347
+ footer: {
348
+ ...DEFAULT_CONFIG.footer,
349
+ ...parsedConfig.footer
350
+ }
351
+ };
352
+ return normalizedDocConfigSchema.parse(mergedConfig);
353
+ }
354
+ function parseDocConfigJson(json, source) {
355
+ try {
356
+ return parseDocConfig(JSON.parse(json));
357
+ } catch (error) {
358
+ throw new Error(`${source}: ${error instanceof Error ? error.message : String(error)}`);
359
+ }
360
+ }
361
+
362
+ // src/runtime/offline-export.ts
363
+ var OFFLINE_FORMAT_VERSION = 1;
364
+ function escapeHtml(value) {
365
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
366
+ }
367
+ function createCompressedOfflineHtml(encodedGzip, title) {
368
+ const bootstrap = `(async()=>{try{const b=Uint8Array.from(atob(document.getElementById("d").textContent.trim()),c=>c.charCodeAt(0)),s=await new Response(new Blob([b]).stream().pipeThrough(new DecompressionStream("gzip"))).text(),e=JSON.parse(s);if(e.version!==${OFFLINE_FORMAT_VERSION})throw new Error("Unsupported offline format");window.__DOCMEDOWN_OFFLINE__=true;window.__DOCMEDOWN_DATA__=e.data;window.__DOCMEDOWN_CONFIG__=e.data.manifest.config;const u=URL.createObjectURL(new Blob([e.runtime],{type:"text/javascript"})),j=document.createElement("script");j.src=u;j.onload=()=>URL.revokeObjectURL(u);j.onerror=()=>{URL.revokeObjectURL(u);throw new Error("Runtime bootstrap failed")};document.head.appendChild(j)}catch(e){document.getElementById("dmd-app").textContent="Could not open this offline documentation copy: "+e.message}})();`;
369
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="data:,"><title>${escapeHtml(title)}</title></head><body><div id="dmd-app">Opening offline documentation\u2026</div><script id="d" type="application/octet-stream">${encodedGzip}</script><script>${bootstrap}</script></body></html>`;
370
+ }
51
371
 
52
372
  // src/cli/utils/scanner.ts
53
- var import_fs = __toESM(require("fs"));
54
- var import_path = __toESM(require("path"));
373
+ var import_node_fs = __toESM(require("fs"));
374
+ var import_node_path = __toESM(require("path"));
55
375
  var import_gray_matter = __toESM(require("gray-matter"));
56
376
 
57
377
  // src/runtime/loader/auto-indexer.ts
@@ -181,16 +501,16 @@ function extractHeadings(content) {
181
501
  }
182
502
  function scanDirectory(dir, baseDir = dir, excludeList = ["node_modules", ".git", ".dmd", "dist", "bin"], stopAtNestedDocsRoots = true) {
183
503
  const results = [];
184
- if (!import_fs.default.existsSync(dir)) return results;
185
- const entries = import_fs.default.readdirSync(dir, { withFileTypes: true });
504
+ if (!import_node_fs.default.existsSync(dir)) return results;
505
+ const entries = import_node_fs.default.readdirSync(dir, { withFileTypes: true });
186
506
  for (const entry of entries) {
187
507
  if (excludeList.includes(entry.name) || entry.name.startsWith(".")) {
188
508
  continue;
189
509
  }
190
- const fullPath = import_path.default.join(dir, entry.name);
191
- const relPath = import_path.default.relative(baseDir, fullPath).replace(/\\/g, "/");
510
+ const fullPath = import_node_path.default.join(dir, entry.name);
511
+ const relPath = import_node_path.default.relative(baseDir, fullPath).replace(/\\/g, "/");
192
512
  if (entry.isDirectory()) {
193
- const isNestedDocsRoot = stopAtNestedDocsRoots && fullPath !== baseDir && import_fs.default.existsSync(import_path.default.join(fullPath, "docs.json"));
513
+ const isNestedDocsRoot = stopAtNestedDocsRoots && fullPath !== baseDir && import_node_fs.default.existsSync(import_node_path.default.join(fullPath, "docs.json"));
194
514
  if (!isNestedDocsRoot) {
195
515
  results.push(...scanDirectory(fullPath, baseDir, excludeList, stopAtNestedDocsRoots));
196
516
  }
@@ -205,13 +525,13 @@ function generateManifest(docDir, config) {
205
525
  const docItems = [];
206
526
  const frontmatters = {};
207
527
  for (const relFile of files) {
208
- const fullPath = import_path.default.join(docDir, relFile);
209
- const raw = import_fs.default.readFileSync(fullPath, "utf-8");
528
+ const fullPath = import_node_path.default.join(docDir, relFile);
529
+ const raw = import_node_fs.default.readFileSync(fullPath, "utf-8");
210
530
  const { data: fm, content } = (0, import_gray_matter.default)(raw);
211
531
  const cleanSlug = relFile.replace(/\.(md|mdx)$/i, "");
212
532
  const isOverview = cleanSlug.toLowerCase() === "readme" || cleanSlug.toLowerCase() === "index";
213
533
  const slug = isOverview ? "README" : cleanSlug;
214
- const title = fm.title || fm.sidebar_label || formatTitleFromFilename(import_path.default.basename(relFile));
534
+ const title = fm.title || fm.sidebar_label || formatTitleFromFilename(import_node_path.default.basename(relFile));
215
535
  frontmatters[relFile] = fm;
216
536
  const headings = extractHeadings(content);
217
537
  const words = content.trim().split(/\s+/).length;
@@ -225,7 +545,7 @@ function generateManifest(docDir, config) {
225
545
  headings,
226
546
  content,
227
547
  readingTimeMinutes,
228
- lastModified: import_fs.default.statSync(fullPath).mtime.toISOString()
548
+ lastModified: import_node_fs.default.statSync(fullPath).mtime.toISOString()
229
549
  });
230
550
  }
231
551
  const tree = buildSidebarTree(files, frontmatters, config.sidebar);
@@ -238,63 +558,52 @@ function generateManifest(docDir, config) {
238
558
  };
239
559
  }
240
560
 
241
- // src/runtime/config.ts
242
- var DEFAULT_CONFIG = {
243
- name: "DocMeDown",
244
- tagline: "The simplest Markdown documenter yet",
245
- description: "Instant documentation site powered by DocMeDown",
246
- version: "1.0.0",
247
- rootDoc: "README.md",
248
- theme: {
249
- preset: "indigo",
250
- defaultMode: "auto",
251
- codeTheme: "github"
252
- },
253
- autoIndex: {
254
- enabled: true,
255
- sort: "natural",
256
- defaultCollapsed: false,
257
- exclude: ["node_modules", ".git", ".dmd", "dist", "bin", "package.json", "tsconfig.json"]
258
- },
259
- search: {
260
- enabled: true,
261
- placeholder: "Search documentation...",
262
- maxResults: 10
263
- },
264
- footer: {
265
- copyright: `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} DocMeDown. All rights reserved.`,
266
- showBuiltWith: true
267
- }
268
- };
269
-
270
561
  // src/cli/commands/build.ts
271
562
  var DEFAULT_OFFLINE_OUTPUT_DIRECTORY = ".dist";
272
563
  function getBuildOutputPaths(targetDir, offlineOutDir) {
273
564
  return {
274
565
  onlineDir: targetDir,
275
- offlineDir: offlineOutDir ? import_path2.default.resolve(process.cwd(), offlineOutDir) : import_path2.default.join(targetDir, DEFAULT_OFFLINE_OUTPUT_DIRECTORY)
566
+ offlineDir: offlineOutDir ? import_node_path2.default.resolve(process.cwd(), offlineOutDir) : import_node_path2.default.join(targetDir, DEFAULT_OFFLINE_OUTPUT_DIRECTORY)
276
567
  };
277
568
  }
278
- function encodeOfflinePayload(value) {
279
- return Buffer.from(JSON.stringify(value), "utf-8").toString("base64");
569
+ function encodeCompressedOfflineEnvelope(envelope) {
570
+ return (0, import_node_zlib.gzipSync)(Buffer.from(JSON.stringify(envelope), "utf-8"), { level: 9 }).toString("base64");
280
571
  }
281
- function escapeInlineScriptContent(value) {
282
- return value.replace(/<\/script/gi, "<\\/script");
283
- }
284
- function escapeHtml(value) {
285
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
572
+ function bundleCustomComponents(componentsPath) {
573
+ if (!import_node_fs2.default.existsSync(componentsPath)) return void 0;
574
+ try {
575
+ const result = (0, import_esbuild.buildSync)({
576
+ entryPoints: [componentsPath],
577
+ bundle: true,
578
+ format: "esm",
579
+ platform: "browser",
580
+ target: "es2022",
581
+ write: false,
582
+ minify: true,
583
+ legalComments: "none"
584
+ });
585
+ const bundledSource = result.outputFiles[0]?.text;
586
+ if (!bundledSource) {
587
+ throw new Error("esbuild did not produce an output module.");
588
+ }
589
+ return bundledSource;
590
+ } catch (error) {
591
+ throw new Error(
592
+ `Could not bundle custom components from ${componentsPath}: ${error instanceof Error ? error.message : String(error)}`
593
+ );
594
+ }
286
595
  }
287
596
  var GENERATED_DOC_OUTPUTS = ["_manifest.json", "_docs.js", "docmedown.iife.js"];
288
597
  function findNestedDocumentationRoots(targetDir) {
289
598
  const roots = [];
290
599
  function visit(directory) {
291
- if (!import_fs2.default.existsSync(directory)) return;
292
- for (const entry of import_fs2.default.readdirSync(directory, { withFileTypes: true })) {
600
+ if (!import_node_fs2.default.existsSync(directory)) return;
601
+ for (const entry of import_node_fs2.default.readdirSync(directory, { withFileTypes: true })) {
293
602
  if (!entry.isDirectory() || entry.name.startsWith(".") || ["node_modules", ".git", "dist", "bin"].includes(entry.name)) {
294
603
  continue;
295
604
  }
296
- const fullPath = import_path2.default.join(directory, entry.name);
297
- if (import_fs2.default.existsSync(import_path2.default.join(fullPath, "docs.json"))) {
605
+ const fullPath = import_node_path2.default.join(directory, entry.name);
606
+ if (import_node_fs2.default.existsSync(import_node_path2.default.join(fullPath, "docs.json"))) {
298
607
  roots.push(fullPath);
299
608
  visit(fullPath);
300
609
  } else {
@@ -306,132 +615,113 @@ function findNestedDocumentationRoots(targetDir) {
306
615
  return roots;
307
616
  }
308
617
  function shouldWatchDocumentationSource(rootDir, changedPath) {
309
- const relativePath = import_path2.default.relative(rootDir, changedPath).replace(/\\/g, "/");
618
+ const relativePath = import_node_path2.default.relative(rootDir, changedPath).replace(/\\/g, "/");
310
619
  const firstSegment = relativePath.split("/")[0];
311
620
  const isCustomComponentModule = /(^|\/)\.dmd\/(components|index)\.js$/i.test(relativePath);
312
621
  return Boolean(relativePath) && !relativePath.startsWith("..") && (!relativePath.startsWith(".") || isCustomComponentModule) && !GENERATED_DOC_OUTPUTS.includes(relativePath) && firstSegment !== "node_modules" && firstSegment !== "dist";
313
622
  }
314
623
  async function buildCommand(targetDirArg = "./docs", options = {}) {
315
- const targetDir = import_path2.default.resolve(process.cwd(), targetDirArg);
624
+ const targetDir = import_node_path2.default.resolve(process.cwd(), targetDirArg);
316
625
  const { onlineDir, offlineDir } = getBuildOutputPaths(targetDir, options.outDir);
317
626
  const buildOfflineBundle = options.singleFile !== false;
318
627
  console.log(import_chalk.default.bold.magenta("\n\u26A1 DocMeDown Build\n"));
319
- if (!import_fs2.default.existsSync(targetDir)) {
628
+ if (!import_node_fs2.default.existsSync(targetDir)) {
320
629
  console.error(import_chalk.default.red(`\u2716 Directory not found: ${targetDir}`));
321
630
  process.exit(1);
322
631
  }
323
- if (!import_fs2.default.existsSync(onlineDir)) {
324
- import_fs2.default.mkdirSync(onlineDir, { recursive: true });
632
+ if (!import_node_fs2.default.existsSync(onlineDir)) {
633
+ import_node_fs2.default.mkdirSync(onlineDir, { recursive: true });
325
634
  }
326
- if (buildOfflineBundle && !import_fs2.default.existsSync(offlineDir)) {
327
- import_fs2.default.mkdirSync(offlineDir, { recursive: true });
635
+ import_node_fs2.default.writeFileSync(import_node_path2.default.join(onlineDir, ".nojekyll"), "", "utf-8");
636
+ if (buildOfflineBundle && !import_node_fs2.default.existsSync(offlineDir)) {
637
+ import_node_fs2.default.mkdirSync(offlineDir, { recursive: true });
328
638
  }
329
- let config = DEFAULT_CONFIG;
330
- const configPath = import_path2.default.join(targetDir, "docs.json");
331
- if (import_fs2.default.existsSync(configPath)) {
639
+ let config = normalizeConfig();
640
+ const configPath = import_node_path2.default.join(targetDir, "docs.json");
641
+ if (import_node_fs2.default.existsSync(configPath)) {
332
642
  try {
333
- config = { ...DEFAULT_CONFIG, ...JSON.parse(import_fs2.default.readFileSync(configPath, "utf-8")) };
334
- } catch (err) {
335
- console.warn(import_chalk.default.yellow(`\u26A0 Could not parse docs.json, using defaults.`));
643
+ config = normalizeConfig(parseDocConfigJson(import_node_fs2.default.readFileSync(configPath, "utf-8"), configPath));
644
+ } catch (error) {
645
+ throw new Error(`Could not validate ${configPath}: ${error instanceof Error ? error.message : String(error)}`);
336
646
  }
337
647
  }
338
648
  console.log(import_chalk.default.cyan(" Indexing documentation pages..."));
339
649
  const manifest = generateManifest(targetDir, config);
340
- const manifestPath = import_path2.default.join(onlineDir, "_manifest.json");
341
- import_fs2.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
650
+ const manifestPath = import_node_path2.default.join(onlineDir, "_manifest.json");
651
+ import_node_fs2.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
342
652
  console.log(import_chalk.default.green(` \u2714 Generated _manifest.json (${manifest.docs.length} pages indexed)`));
343
653
  const docsMap = {};
344
654
  const files = scanDirectory(targetDir);
345
655
  for (const file of files) {
346
- const full = import_path2.default.join(targetDir, file);
347
- const raw = import_fs2.default.readFileSync(full, "utf-8");
656
+ const full = import_node_path2.default.join(targetDir, file);
657
+ const raw = import_node_fs2.default.readFileSync(full, "utf-8");
348
658
  const slug = file.replace(/\.(md|mdx)$/i, "");
349
659
  const cleanSlug = slug.toLowerCase() === "readme" || slug.toLowerCase() === "index" ? "README" : slug;
350
660
  docsMap[cleanSlug] = raw;
351
661
  docsMap[file] = raw;
352
662
  }
353
- const componentsPath = import_path2.default.join(targetDir, ".dmd", "components.js");
354
- const componentsSource = import_fs2.default.existsSync(componentsPath) ? import_fs2.default.readFileSync(componentsPath, "utf-8") : void 0;
663
+ const componentsPath = import_node_path2.default.join(targetDir, ".dmd", "components.js");
664
+ const componentsSource = bundleCustomComponents(componentsPath);
355
665
  const docsJsContent = `window.__DOCMEDOWN_DATA__ = ${JSON.stringify({ manifest, docs: docsMap, componentsSource }, null, 2)};
356
666
  `;
357
- const docsJsPath = import_path2.default.join(onlineDir, "_docs.js");
358
- import_fs2.default.writeFileSync(docsJsPath, docsJsContent, "utf-8");
667
+ const docsJsPath = import_node_path2.default.join(onlineDir, "_docs.js");
668
+ import_node_fs2.default.writeFileSync(docsJsPath, docsJsContent, "utf-8");
359
669
  console.log(import_chalk.default.green(` \u2714 Generated _docs.js for offline file:/// double-click usage`));
360
670
  if (buildOfflineBundle) {
361
671
  console.log(import_chalk.default.cyan("\n Compiling standalone single-file offline index.html..."));
362
672
  const candidates2 = [
363
- import_path2.default.resolve(__dirname, "docmedown.iife.js"),
364
- import_path2.default.resolve(__dirname, "../dist/docmedown.iife.js"),
365
- import_path2.default.resolve(__dirname, "../docmedown.iife.js")
673
+ import_node_path2.default.resolve(__dirname, "docmedown.iife.js"),
674
+ import_node_path2.default.resolve(__dirname, "../dist/docmedown.iife.js"),
675
+ import_node_path2.default.resolve(__dirname, "../docmedown.iife.js")
366
676
  ];
367
- const distIifePath2 = candidates2.find((p) => import_fs2.default.existsSync(p));
677
+ const distIifePath2 = candidates2.find((p) => import_node_fs2.default.existsSync(p));
368
678
  let bundleJs = "";
369
679
  if (distIifePath2) {
370
- bundleJs = import_fs2.default.readFileSync(distIifePath2, "utf-8");
680
+ bundleJs = import_node_fs2.default.readFileSync(distIifePath2, "utf-8");
371
681
  } else {
372
682
  console.warn(import_chalk.default.yellow(" \u26A0 Local runtime bundle not found, linking CDN script."));
373
683
  }
374
- const offlinePayload = encodeOfflinePayload({ manifest, docs: docsMap, componentsSource });
375
- const safeBundleJs = escapeInlineScriptContent(bundleJs);
376
- const singleFileHtml = `<!DOCTYPE html>
377
- <html lang="en">
378
- <head>
379
- <meta charset="UTF-8" />
380
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
381
- <title>${escapeHtml(config.name || "Documentation")}</title>
382
- </head>
383
- <body>
384
- <div id="dmd-app"></div>
385
- <script>
386
- (function () {
387
- const encoded = '${offlinePayload}';
388
- const bytes = Uint8Array.from(atob(encoded), (character) => character.charCodeAt(0));
389
- const data = JSON.parse(new TextDecoder().decode(bytes));
390
- window.__DOCMEDOWN_DATA__ = data;
391
- window.__DOCMEDOWN_CONFIG__ = data.manifest.config;
392
- if (data.componentsSource) {
393
- const componentModule = new Blob([data.componentsSource], { type: 'text/javascript' });
394
- const componentModuleUrl = URL.createObjectURL(componentModule);
395
- window.__DOCMEDOWN_COMPONENTS_READY__ = import(componentModuleUrl)
396
- .then((module) => module.default || module)
397
- .finally(() => URL.revokeObjectURL(componentModuleUrl));
398
- }
399
- })();
400
- </script>
401
- <script>
402
- ${safeBundleJs}
403
- </script>
404
- </body>
405
- </html>`;
406
- const singleFilePath = import_path2.default.join(offlineDir, "index.html");
407
- import_fs2.default.writeFileSync(singleFilePath, singleFileHtml, "utf-8");
684
+ const envelope = {
685
+ version: OFFLINE_FORMAT_VERSION,
686
+ data: { manifest, docs: docsMap, componentsSource },
687
+ runtime: bundleJs
688
+ };
689
+ const encodedEnvelope = encodeCompressedOfflineEnvelope(envelope);
690
+ const singleFileHtml = createCompressedOfflineHtml(encodedEnvelope, config.name || "Documentation");
691
+ const singleFilePath = import_node_path2.default.join(offlineDir, "index.html");
692
+ import_node_fs2.default.writeFileSync(singleFilePath, singleFileHtml, "utf-8");
408
693
  console.log(import_chalk.default.bold.green(` \u2714 Built self-contained offline bundle: ${singleFilePath}`));
694
+ console.log(
695
+ import_chalk.default.dim(
696
+ ` Compressed ${Buffer.byteLength(JSON.stringify(envelope), "utf-8").toLocaleString()} bytes to ${Buffer.byteLength(singleFileHtml, "utf-8").toLocaleString()} bytes.`
697
+ )
698
+ );
409
699
  console.log(import_chalk.default.dim(` You can now double-click index.html to view offline without any server!
410
700
  `));
411
701
  }
412
702
  const candidates = [
413
- import_path2.default.resolve(__dirname, "docmedown.iife.js"),
414
- import_path2.default.resolve(__dirname, "../dist/docmedown.iife.js"),
415
- import_path2.default.resolve(__dirname, "../docmedown.iife.js")
703
+ import_node_path2.default.resolve(__dirname, "docmedown.iife.js"),
704
+ import_node_path2.default.resolve(__dirname, "../dist/docmedown.iife.js"),
705
+ import_node_path2.default.resolve(__dirname, "../docmedown.iife.js")
416
706
  ];
417
- const distIifePath = candidates.find((p) => import_fs2.default.existsSync(p));
418
- const targetBundlePath = import_path2.default.join(onlineDir, "docmedown.iife.js");
707
+ const distIifePath = candidates.find((p) => import_node_fs2.default.existsSync(p));
708
+ const targetBundlePath = import_node_path2.default.join(onlineDir, "docmedown.iife.js");
419
709
  if (distIifePath) {
420
- import_fs2.default.copyFileSync(distIifePath, targetBundlePath);
710
+ import_node_fs2.default.copyFileSync(distIifePath, targetBundlePath);
421
711
  console.log(import_chalk.default.green(` \u2714 Updated serveable runtime: ${targetBundlePath}`));
422
712
  }
423
713
  if (options.buildNested !== false) {
424
714
  const nestedRoots = findNestedDocumentationRoots(targetDir);
425
715
  for (const nestedRoot of nestedRoots) {
426
716
  console.log(import_chalk.default.cyan(`
427
- Building nested documentation site: ${import_path2.default.relative(targetDir, nestedRoot)}...`));
717
+ Building nested documentation site: ${import_node_path2.default.relative(targetDir, nestedRoot)}...`));
428
718
  await buildCommand(nestedRoot, { buildNested: false });
429
719
  }
430
720
  }
431
721
  console.log(import_chalk.default.bold.green("\u2728 Build completed successfully!\n"));
432
722
  }
433
723
  async function watchBuildCommand(targetDirArg = "./docs", options = {}) {
434
- const targetDir = import_path2.default.resolve(process.cwd(), targetDirArg);
724
+ const targetDir = import_node_path2.default.resolve(process.cwd(), targetDirArg);
435
725
  await buildCommand(targetDir, { ...options, watch: false });
436
726
  console.log(import_chalk.default.dim(` Watching source files in: ${targetDir}`));
437
727
  console.log(import_chalk.default.dim(" Source changes rebuild serveable files and .dist/index.html. Press Ctrl+C to stop.\n"));
@@ -452,7 +742,7 @@ async function watchBuildCommand(targetDirArg = "./docs", options = {}) {
452
742
  if (!shouldWatchDocumentationSource(targetDir, changedPath)) return;
453
743
  if (rebuildTimeout) clearTimeout(rebuildTimeout);
454
744
  rebuildTimeout = setTimeout(async () => {
455
- const relativePath = import_path2.default.relative(targetDir, changedPath);
745
+ const relativePath = import_node_path2.default.relative(targetDir, changedPath);
456
746
  console.log(import_chalk.default.cyan(`[DocMeDown] Changed: ${relativePath} -> Rebuilding documentation...`));
457
747
  try {
458
748
  await buildCommand(targetDir, { ...options, watch: false });
@@ -464,54 +754,211 @@ async function watchBuildCommand(targetDirArg = "./docs", options = {}) {
464
754
  return new Promise(() => void 0);
465
755
  }
466
756
 
467
- // src/cli/utils/server.ts
468
- function shouldRebuildDocumentation(rootDir, changedPath) {
469
- return shouldWatchDocumentationSource(rootDir, changedPath);
470
- }
471
- function startDevServer(options) {
472
- const { rootDir, host = "localhost", port: initialPort = 3e3, onSourceChange } = options;
473
- return new Promise((resolve, reject) => {
474
- let port = initialPort;
475
- const liveReloadScript = `
476
- <script>
477
- (function() {
478
- const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
479
- let ws = null;
480
- function connect() {
481
- ws = new WebSocket(protocol + '//' + window.location.host + '/__dmd_reload');
482
- ws.onmessage = function(e) {
483
- if (e.data === 'reload') {
484
- console.log('[DocMeDown] File changed, reloading...');
485
- window.location.reload();
486
- }
487
- };
488
- ws.onclose = function() {
489
- setTimeout(connect, 1500);
490
- };
757
+ // src/cli/commands/config-tui.ts
758
+ var import_node_fs3 = __toESM(require("fs"));
759
+ var import_node_path3 = __toESM(require("path"));
760
+ var import_chalk2 = __toESM(require("chalk"));
761
+ var import_prompts = __toESM(require("prompts"));
762
+ async function configTuiCommand(configPathArg) {
763
+ console.log(import_chalk2.default.bold.magenta("\n\u26A1 DocMeDown - Interactive Configuration Wizard\n"));
764
+ let configPath = "";
765
+ if (configPathArg) {
766
+ configPath = import_node_path3.default.resolve(process.cwd(), configPathArg);
767
+ if (import_node_fs3.default.existsSync(configPath) && import_node_fs3.default.statSync(configPath).isDirectory()) {
768
+ configPath = import_node_path3.default.join(configPath, "docs.json");
769
+ }
770
+ } else {
771
+ const candidates = [
772
+ import_node_path3.default.resolve(process.cwd(), "docs.json"),
773
+ import_node_path3.default.resolve(process.cwd(), "docs/docs.json"),
774
+ import_node_path3.default.resolve(process.cwd(), "dmd.json")
775
+ ];
776
+ configPath = candidates.find((p) => import_node_fs3.default.existsSync(p)) || import_node_path3.default.resolve(process.cwd(), "docs/docs.json");
491
777
  }
492
- connect();
493
- })();
494
- </script>
495
- `;
496
- const server = import_http.default.createServer((req, res) => {
497
- res.setHeader("Access-Control-Allow-Origin", "*");
498
- res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
499
- if (req.method === "OPTIONS") {
500
- res.writeHead(204);
501
- res.end();
502
- return;
503
- }
504
- let reqPath = decodeURIComponent(req.url?.split("?")[0] || "/");
505
- if (reqPath === "/" || reqPath === "") {
506
- reqPath = "/index.html";
507
- }
508
- let filePath = import_path3.default.join(rootDir, reqPath);
509
- if (!import_fs3.default.existsSync(filePath) || import_fs3.default.statSync(filePath).isDirectory()) {
510
- const potentialIndex = import_path3.default.join(rootDir, "index.html");
511
- if (import_fs3.default.existsSync(potentialIndex)) {
512
- filePath = potentialIndex;
513
- } else {
514
- res.writeHead(200, { "Content-Type": "text/html" });
778
+ let existingConfig = normalizeConfig();
779
+ if (import_node_fs3.default.existsSync(configPath)) {
780
+ try {
781
+ existingConfig = normalizeConfig(parseDocConfigJson(import_node_fs3.default.readFileSync(configPath, "utf-8"), configPath));
782
+ console.log(import_chalk2.default.dim(` Loaded existing configuration from: ${configPath}
783
+ `));
784
+ } catch (error) {
785
+ console.warn(import_chalk2.default.yellow(` \u26A0 ${error instanceof Error ? error.message : String(error)}
786
+ `));
787
+ }
788
+ } else {
789
+ console.log(import_chalk2.default.dim(` Creating new configuration at: ${configPath}
790
+ `));
791
+ }
792
+ const response = await (0, import_prompts.default)([
793
+ {
794
+ type: "text",
795
+ name: "name",
796
+ message: "Project Name:",
797
+ initial: existingConfig.name || "My Project Docs"
798
+ },
799
+ {
800
+ type: "text",
801
+ name: "tagline",
802
+ message: "Tagline / Short description:",
803
+ initial: existingConfig.tagline || "The simplest Markdown documenter yet"
804
+ },
805
+ {
806
+ type: "select",
807
+ name: "family",
808
+ message: "Select Documentation Theme Family:",
809
+ choices: [
810
+ { title: "Atlas (Editorial technical reference)", value: "atlas" },
811
+ { title: "Blueprint (Structured and schematic)", value: "blueprint" },
812
+ { title: "Terminal (Compact operational console)", value: "terminal" },
813
+ { title: "Editorial (Spacious publication reading)", value: "editorial" }
814
+ ],
815
+ initial: ["atlas", "blueprint", "terminal", "editorial"].indexOf(existingConfig.theme?.family || "atlas")
816
+ },
817
+ {
818
+ type: "select",
819
+ name: "defaultMode",
820
+ message: "Default Color Mode:",
821
+ choices: [
822
+ { title: "Auto (Follows OS system preference)", value: "auto" },
823
+ { title: "Dark (Default dark theme)", value: "dark" },
824
+ { title: "Light (Default light theme)", value: "light" }
825
+ ],
826
+ initial: ["auto", "dark", "light"].indexOf(existingConfig.theme?.defaultMode || "auto")
827
+ },
828
+ {
829
+ type: "select",
830
+ name: "sourceType",
831
+ message: "Documentation Source Mode:",
832
+ choices: [
833
+ { title: "Local Markdown Files (hosted together in folder)", value: "local" },
834
+ { title: "Remote GitHub Repository (live dynamic fetch)", value: "github" },
835
+ { title: "Remote GitLab Repository (live dynamic fetch)", value: "gitlab" }
836
+ ],
837
+ initial: existingConfig.source?.type ? existingConfig.source.type === "github" ? 1 : 2 : 0
838
+ },
839
+ {
840
+ type: (prev) => prev === "github" ? "text" : null,
841
+ name: "githubRepo",
842
+ message: "GitHub Repository (owner/repo):",
843
+ initial: existingConfig.source?.type === "raw" ? "facebook/react" : existingConfig.source?.repo || "facebook/react"
844
+ },
845
+ {
846
+ type: (_prev, values) => values.sourceType === "github" ? "text" : null,
847
+ name: "githubBranch",
848
+ message: "GitHub Branch:",
849
+ initial: existingConfig.source?.branch || "main"
850
+ },
851
+ {
852
+ type: (_prev, values) => values.sourceType === "github" ? "text" : null,
853
+ name: "githubDocsDir",
854
+ message: "GitHub Docs Subfolder (leave empty for root):",
855
+ initial: existingConfig.source?.docsDir || "docs"
856
+ },
857
+ {
858
+ type: "text",
859
+ name: "githubSocial",
860
+ message: "GitHub Repository URL for Navbar link (optional):",
861
+ initial: existingConfig.socials?.find((s) => s.type === "github")?.url || ""
862
+ }
863
+ ]);
864
+ if (!response.name) {
865
+ console.log(import_chalk2.default.yellow("\nConfiguration cancelled."));
866
+ return;
867
+ }
868
+ const updatedConfig = normalizeConfig({
869
+ ...existingConfig,
870
+ name: response.name,
871
+ tagline: response.tagline,
872
+ theme: {
873
+ ...existingConfig.theme,
874
+ family: response.family,
875
+ defaultMode: response.defaultMode
876
+ },
877
+ socials: response.githubSocial ? [{ type: "github", url: response.githubSocial }] : existingConfig.socials
878
+ });
879
+ if (response.sourceType === "github") {
880
+ updatedConfig.source = {
881
+ type: "github",
882
+ repo: response.githubRepo,
883
+ branch: response.githubBranch,
884
+ docsDir: response.githubDocsDir
885
+ };
886
+ } else if (response.sourceType === "local") {
887
+ delete updatedConfig.source;
888
+ }
889
+ const dir = import_node_path3.default.dirname(configPath);
890
+ if (!import_node_fs3.default.existsSync(dir)) {
891
+ import_node_fs3.default.mkdirSync(dir, { recursive: true });
892
+ }
893
+ const validatedConfig = normalizeConfig(updatedConfig);
894
+ import_node_fs3.default.writeFileSync(configPath, JSON.stringify(validatedConfig, null, 2), "utf-8");
895
+ console.log(import_chalk2.default.bold.green(`
896
+ \u2714 Configuration successfully saved to: ${configPath}
897
+ `));
898
+ }
899
+
900
+ // src/cli/commands/init.ts
901
+ var import_node_fs5 = __toESM(require("fs"));
902
+ var import_node_path5 = __toESM(require("path"));
903
+ var import_chalk4 = __toESM(require("chalk"));
904
+ var import_open = __toESM(require("open"));
905
+ var import_prompts2 = __toESM(require("prompts"));
906
+
907
+ // src/cli/utils/server.ts
908
+ var import_node_fs4 = __toESM(require("fs"));
909
+ var import_node_http = __toESM(require("http"));
910
+ var import_node_path4 = __toESM(require("path"));
911
+ var import_chalk3 = __toESM(require("chalk"));
912
+ var import_chokidar2 = __toESM(require("chokidar"));
913
+ var import_mime_types = __toESM(require("mime-types"));
914
+ var import_ws = require("ws");
915
+ function shouldRebuildDocumentation(rootDir, changedPath) {
916
+ return shouldWatchDocumentationSource(rootDir, changedPath);
917
+ }
918
+ function startDevServer(options) {
919
+ const { rootDir, host = "localhost", port: initialPort = 3e3, onSourceChange } = options;
920
+ return new Promise((resolve, reject) => {
921
+ let port = initialPort;
922
+ const liveReloadScript = `
923
+ <script>
924
+ (function() {
925
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
926
+ let ws = null;
927
+ function connect() {
928
+ ws = new WebSocket(protocol + '//' + window.location.host + '/__dmd_reload');
929
+ ws.onmessage = function(e) {
930
+ if (e.data === 'reload') {
931
+ console.log('[DocMeDown] File changed, reloading...');
932
+ window.location.reload();
933
+ }
934
+ };
935
+ ws.onclose = function() {
936
+ setTimeout(connect, 1500);
937
+ };
938
+ }
939
+ connect();
940
+ })();
941
+ </script>
942
+ `;
943
+ const server = import_node_http.default.createServer((req, res) => {
944
+ res.setHeader("Access-Control-Allow-Origin", "*");
945
+ res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
946
+ if (req.method === "OPTIONS") {
947
+ res.writeHead(204);
948
+ res.end();
949
+ return;
950
+ }
951
+ let reqPath = decodeURIComponent(req.url?.split("?")[0] || "/");
952
+ if (reqPath === "/" || reqPath === "") {
953
+ reqPath = "/index.html";
954
+ }
955
+ let filePath = import_node_path4.default.join(rootDir, reqPath);
956
+ if (!import_node_fs4.default.existsSync(filePath) || import_node_fs4.default.statSync(filePath).isDirectory()) {
957
+ const potentialIndex = import_node_path4.default.join(rootDir, "index.html");
958
+ if (import_node_fs4.default.existsSync(potentialIndex)) {
959
+ filePath = potentialIndex;
960
+ } else {
961
+ res.writeHead(200, { "Content-Type": "text/html" });
515
962
  res.end(`
516
963
  <!DOCTYPE html>
517
964
  <html>
@@ -526,37 +973,37 @@ function startDevServer(options) {
526
973
  return;
527
974
  }
528
975
  }
529
- if (reqPath === "/docmedown.iife.js" && !import_fs3.default.existsSync(filePath)) {
976
+ if (reqPath === "/docmedown.iife.js" && !import_node_fs4.default.existsSync(filePath)) {
530
977
  const bundleCandidates = [
531
- import_path3.default.resolve(__dirname, "docmedown.iife.js"),
532
- import_path3.default.resolve(__dirname, "../dist/docmedown.iife.js"),
533
- import_path3.default.resolve(__dirname, "../docmedown.iife.js")
978
+ import_node_path4.default.resolve(__dirname, "docmedown.iife.js"),
979
+ import_node_path4.default.resolve(__dirname, "../dist/docmedown.iife.js"),
980
+ import_node_path4.default.resolve(__dirname, "../docmedown.iife.js")
534
981
  ];
535
- const distFile = bundleCandidates.find((p) => import_fs3.default.existsSync(p));
982
+ const distFile = bundleCandidates.find((p) => import_node_fs4.default.existsSync(p));
536
983
  if (distFile) {
537
984
  filePath = distFile;
538
985
  }
539
986
  }
540
987
  try {
541
- const stat = import_fs3.default.statSync(filePath);
988
+ const stat = import_node_fs4.default.statSync(filePath);
542
989
  if (stat.isDirectory()) {
543
- filePath = import_path3.default.join(filePath, "index.html");
990
+ filePath = import_node_path4.default.join(filePath, "index.html");
544
991
  }
545
992
  const mimeType = import_mime_types.default.lookup(filePath) || "application/octet-stream";
546
993
  res.setHeader("Content-Type", mimeType);
547
994
  if (mimeType.includes("html")) {
548
- let content = import_fs3.default.readFileSync(filePath, "utf-8");
995
+ let content = import_node_fs4.default.readFileSync(filePath, "utf-8");
549
996
  if (!content.includes("/__dmd_reload")) {
550
997
  content = content.replace("</body>", `${liveReloadScript}</body>`);
551
998
  }
552
999
  res.writeHead(200);
553
1000
  res.end(content);
554
1001
  } else {
555
- const stream = import_fs3.default.createReadStream(filePath);
1002
+ const stream = import_node_fs4.default.createReadStream(filePath);
556
1003
  res.writeHead(200);
557
1004
  stream.pipe(res);
558
1005
  }
559
- } catch (err) {
1006
+ } catch (_err) {
560
1007
  res.writeHead(404, { "Content-Type": "text/plain" });
561
1008
  res.end("404 Not Found");
562
1009
  }
@@ -590,16 +1037,16 @@ function startDevServer(options) {
590
1037
  if (!shouldRebuildDocumentation(rootDir, changedPath)) return;
591
1038
  if (reloadTimeout) clearTimeout(reloadTimeout);
592
1039
  reloadTimeout = setTimeout(async () => {
593
- const rel = import_path3.default.relative(rootDir, changedPath);
1040
+ const rel = import_node_path4.default.relative(rootDir, changedPath);
594
1041
  try {
595
1042
  if (onSourceChange) {
596
- console.log(import_chalk2.default.cyan(`[DocMeDown] Changed: ${rel} -> Rebuilding documentation...`));
1043
+ console.log(import_chalk3.default.cyan(`[DocMeDown] Changed: ${rel} -> Rebuilding documentation...`));
597
1044
  await onSourceChange(event, changedPath);
598
1045
  } else {
599
- console.log(import_chalk2.default.cyan(`[DocMeDown] Changed: ${rel} -> Reloading preview...`));
1046
+ console.log(import_chalk3.default.cyan(`[DocMeDown] Changed: ${rel} -> Reloading preview...`));
600
1047
  }
601
1048
  } catch (err) {
602
- console.error(import_chalk2.default.red(`[DocMeDown] Rebuild failed: ${err.message}`));
1049
+ console.error(import_chalk3.default.red(`[DocMeDown] Rebuild failed: ${err.message}`));
603
1050
  }
604
1051
  clients.forEach((ws) => {
605
1052
  if (ws.readyState === import_ws.WebSocket.OPEN) {
@@ -634,108 +1081,107 @@ function startDevServer(options) {
634
1081
  }
635
1082
 
636
1083
  // src/cli/commands/init.ts
637
- var import_open = __toESM(require("open"));
638
1084
  async function initCommand(targetDirArg = "./docs", options = {}) {
639
- const targetDir = import_path4.default.resolve(process.cwd(), targetDirArg);
640
- console.log(import_chalk3.default.bold.magenta("\n\u26A1 DocMeDown - Instant Documentation Initializer\n"));
641
- if (!import_fs4.default.existsSync(targetDir)) {
642
- import_fs4.default.mkdirSync(targetDir, { recursive: true });
1085
+ const targetDir = import_node_path5.default.resolve(process.cwd(), targetDirArg);
1086
+ console.log(import_chalk4.default.bold.magenta("\n\u26A1 DocMeDown - Instant Documentation Initializer\n"));
1087
+ if (!import_node_fs5.default.existsSync(targetDir)) {
1088
+ import_node_fs5.default.mkdirSync(targetDir, { recursive: true });
643
1089
  }
644
- const templatesDir = import_path4.default.resolve(__dirname, "../../templates");
645
- const fallbackTemplatesDir = import_path4.default.resolve(__dirname, "../templates");
646
- const activeTemplateDir = import_fs4.default.existsSync(templatesDir) ? templatesDir : fallbackTemplatesDir;
647
- const indexPath = import_path4.default.join(targetDir, "index.html");
648
- if (!import_fs4.default.existsSync(indexPath)) {
649
- const templateHtml = import_fs4.default.readFileSync(import_path4.default.join(activeTemplateDir, "index.html"), "utf-8");
650
- import_fs4.default.writeFileSync(indexPath, templateHtml, "utf-8");
651
- console.log(import_chalk3.default.green(" \u2714 Created index.html"));
1090
+ const templatesDir = import_node_path5.default.resolve(__dirname, "../../templates");
1091
+ const fallbackTemplatesDir = import_node_path5.default.resolve(__dirname, "../templates");
1092
+ const activeTemplateDir = import_node_fs5.default.existsSync(templatesDir) ? templatesDir : fallbackTemplatesDir;
1093
+ const indexPath = import_node_path5.default.join(targetDir, "index.html");
1094
+ if (!import_node_fs5.default.existsSync(indexPath)) {
1095
+ const templateHtml = import_node_fs5.default.readFileSync(import_node_path5.default.join(activeTemplateDir, "index.html"), "utf-8");
1096
+ import_node_fs5.default.writeFileSync(indexPath, templateHtml, "utf-8");
1097
+ console.log(import_chalk4.default.green(" \u2714 Created index.html"));
652
1098
  }
653
- const configPath = import_path4.default.join(targetDir, "docs.json");
654
- if (!import_fs4.default.existsSync(configPath)) {
655
- const templateConfig = import_fs4.default.readFileSync(import_path4.default.join(activeTemplateDir, "docs.json"), "utf-8");
656
- import_fs4.default.writeFileSync(configPath, templateConfig, "utf-8");
657
- console.log(import_chalk3.default.green(" \u2714 Created docs.json"));
1099
+ const configPath = import_node_path5.default.join(targetDir, "docs.json");
1100
+ if (!import_node_fs5.default.existsSync(configPath)) {
1101
+ const templateConfig = import_node_fs5.default.readFileSync(import_node_path5.default.join(activeTemplateDir, "docs.json"), "utf-8");
1102
+ import_node_fs5.default.writeFileSync(configPath, templateConfig, "utf-8");
1103
+ console.log(import_chalk4.default.green(" \u2714 Created docs.json"));
658
1104
  }
659
- const readmePath = import_path4.default.join(targetDir, "README.md");
660
- if (!import_fs4.default.existsSync(readmePath)) {
661
- const templateReadme = import_fs4.default.readFileSync(import_path4.default.join(activeTemplateDir, "README.md"), "utf-8");
662
- import_fs4.default.writeFileSync(readmePath, templateReadme, "utf-8");
663
- console.log(import_chalk3.default.green(" \u2714 Created README.md"));
1105
+ const readmePath = import_node_path5.default.join(targetDir, "README.md");
1106
+ if (!import_node_fs5.default.existsSync(readmePath)) {
1107
+ const templateReadme = import_node_fs5.default.readFileSync(import_node_path5.default.join(activeTemplateDir, "README.md"), "utf-8");
1108
+ import_node_fs5.default.writeFileSync(readmePath, templateReadme, "utf-8");
1109
+ console.log(import_chalk4.default.green(" \u2714 Created README.md"));
664
1110
  }
665
- const gsPath = import_path4.default.join(targetDir, "getting-started.md");
666
- if (!import_fs4.default.existsSync(gsPath)) {
667
- const templateGs = import_fs4.default.readFileSync(import_path4.default.join(activeTemplateDir, "getting-started.md"), "utf-8");
668
- import_fs4.default.writeFileSync(gsPath, templateGs, "utf-8");
669
- console.log(import_chalk3.default.green(" \u2714 Created getting-started.md"));
1111
+ const gsPath = import_node_path5.default.join(targetDir, "getting-started.md");
1112
+ if (!import_node_fs5.default.existsSync(gsPath)) {
1113
+ const templateGs = import_node_fs5.default.readFileSync(import_node_path5.default.join(activeTemplateDir, "getting-started.md"), "utf-8");
1114
+ import_node_fs5.default.writeFileSync(gsPath, templateGs, "utf-8");
1115
+ console.log(import_chalk4.default.green(" \u2714 Created getting-started.md"));
670
1116
  }
671
- const guidesDir = import_path4.default.join(targetDir, "guides");
672
- if (!import_fs4.default.existsSync(guidesDir)) {
673
- import_fs4.default.mkdirSync(guidesDir, { recursive: true });
1117
+ const guidesDir = import_node_path5.default.join(targetDir, "guides");
1118
+ if (!import_node_fs5.default.existsSync(guidesDir)) {
1119
+ import_node_fs5.default.mkdirSync(guidesDir, { recursive: true });
674
1120
  }
675
- const guidePath = import_path4.default.join(guidesDir, "custom-components.md");
676
- if (!import_fs4.default.existsSync(guidePath)) {
677
- const templateGuide = import_fs4.default.readFileSync(import_path4.default.join(activeTemplateDir, "guides/custom-components.md"), "utf-8");
678
- import_fs4.default.writeFileSync(guidePath, templateGuide, "utf-8");
679
- console.log(import_chalk3.default.green(" \u2714 Created guides/custom-components.md"));
1121
+ const guidePath = import_node_path5.default.join(guidesDir, "custom-components.md");
1122
+ if (!import_node_fs5.default.existsSync(guidePath)) {
1123
+ const templateGuide = import_node_fs5.default.readFileSync(import_node_path5.default.join(activeTemplateDir, "guides/custom-components.md"), "utf-8");
1124
+ import_node_fs5.default.writeFileSync(guidePath, templateGuide, "utf-8");
1125
+ console.log(import_chalk4.default.green(" \u2714 Created guides/custom-components.md"));
680
1126
  }
681
- const dmdDir = import_path4.default.join(targetDir, ".dmd");
682
- if (!import_fs4.default.existsSync(dmdDir)) {
683
- import_fs4.default.mkdirSync(dmdDir, { recursive: true });
1127
+ const dmdDir = import_node_path5.default.join(targetDir, ".dmd");
1128
+ if (!import_node_fs5.default.existsSync(dmdDir)) {
1129
+ import_node_fs5.default.mkdirSync(dmdDir, { recursive: true });
684
1130
  }
685
- const dmdComponentPath = import_path4.default.join(dmdDir, "components.js");
686
- if (!import_fs4.default.existsSync(dmdComponentPath)) {
687
- const templateDmd = import_fs4.default.readFileSync(import_path4.default.join(activeTemplateDir, ".dmd/components.js"), "utf-8");
688
- import_fs4.default.writeFileSync(dmdComponentPath, templateDmd, "utf-8");
689
- console.log(import_chalk3.default.green(" \u2714 Created .dmd/components.js"));
1131
+ const dmdComponentPath = import_node_path5.default.join(dmdDir, "components.js");
1132
+ if (!import_node_fs5.default.existsSync(dmdComponentPath)) {
1133
+ const templateDmd = import_node_fs5.default.readFileSync(import_node_path5.default.join(activeTemplateDir, ".dmd/components.js"), "utf-8");
1134
+ import_node_fs5.default.writeFileSync(dmdComponentPath, templateDmd, "utf-8");
1135
+ console.log(import_chalk4.default.green(" \u2714 Created .dmd/components.js"));
690
1136
  }
691
1137
  await buildCommand(targetDir);
692
- console.log(import_chalk3.default.bold.green("\n\u2728 DocMeDown site successfully initialized!\n"));
693
- console.log(import_chalk3.default.dim(` Location: ${targetDir}
1138
+ console.log(import_chalk4.default.bold.green("\n\u2728 DocMeDown site successfully initialized!\n"));
1139
+ console.log(import_chalk4.default.dim(` Location: ${targetDir}
694
1140
  `));
695
- console.log(import_chalk3.default.cyan(" To preview your docs:"));
696
- console.log(import_chalk3.default.white(` npx docmedown serve ${targetDirArg}
1141
+ console.log(import_chalk4.default.cyan(" To preview your docs:"));
1142
+ console.log(import_chalk4.default.white(` npx docmedown serve ${targetDirArg}
697
1143
  `));
698
- console.log(import_chalk3.default.cyan(" To customize settings:"));
699
- console.log(import_chalk3.default.white(` npx docmedown config ${targetDirArg}/docs.json
1144
+ console.log(import_chalk4.default.cyan(" To customize settings:"));
1145
+ console.log(import_chalk4.default.white(` npx docmedown config ${targetDirArg}/docs.json
700
1146
  `));
701
1147
  if (options.start !== false && process.stdout.isTTY) {
702
- const response = await (0, import_prompts.default)({
1148
+ const response = await (0, import_prompts2.default)({
703
1149
  type: "confirm",
704
1150
  name: "startServer",
705
1151
  message: "Would you like to start the local preview server now?",
706
1152
  initial: true
707
1153
  });
708
1154
  if (response.startServer) {
709
- console.log(import_chalk3.default.cyan("\n\u{1F680} Starting local live preview server..."));
1155
+ console.log(import_chalk4.default.cyan("\n\u{1F680} Starting local live preview server..."));
710
1156
  const devServer = await startDevServer({ rootDir: targetDir, port: 3e3 });
711
1157
  const url = `http://localhost:${devServer.port}`;
712
- console.log(import_chalk3.default.bold.green(`
713
- \u2714 Documentation live at: ${import_chalk3.default.underline(url)}
1158
+ console.log(import_chalk4.default.bold.green(`
1159
+ \u2714 Documentation live at: ${import_chalk4.default.underline(url)}
714
1160
  `));
715
- console.log(import_chalk3.default.dim(" Press Ctrl+C to stop the server\n"));
1161
+ console.log(import_chalk4.default.dim(" Press Ctrl+C to stop the server\n"));
716
1162
  await (0, import_open.default)(url);
717
1163
  }
718
1164
  }
719
1165
  }
720
1166
 
721
1167
  // src/cli/commands/serve.ts
722
- var import_path5 = __toESM(require("path"));
723
- var import_fs5 = __toESM(require("fs"));
724
- var import_chalk4 = __toESM(require("chalk"));
1168
+ var import_node_fs6 = __toESM(require("fs"));
1169
+ var import_node_path6 = __toESM(require("path"));
1170
+ var import_chalk5 = __toESM(require("chalk"));
725
1171
  var import_open2 = __toESM(require("open"));
726
1172
  async function serveCommand(targetDirArg = "./docs", options = {}) {
727
- let targetDir = import_path5.default.resolve(process.cwd(), targetDirArg);
728
- if (!import_fs5.default.existsSync(targetDir)) {
729
- if (import_fs5.default.existsSync(import_path5.default.resolve(process.cwd(), "docs"))) {
730
- targetDir = import_path5.default.resolve(process.cwd(), "docs");
1173
+ let targetDir = import_node_path6.default.resolve(process.cwd(), targetDirArg);
1174
+ if (!import_node_fs6.default.existsSync(targetDir)) {
1175
+ if (import_node_fs6.default.existsSync(import_node_path6.default.resolve(process.cwd(), "docs"))) {
1176
+ targetDir = import_node_path6.default.resolve(process.cwd(), "docs");
731
1177
  } else {
732
1178
  targetDir = process.cwd();
733
1179
  }
734
1180
  }
735
- console.log(import_chalk4.default.bold.magenta("\n\u26A1 DocMeDown Dev Server\n"));
736
- console.log(import_chalk4.default.dim(` Serving directory: ${targetDir}`));
1181
+ console.log(import_chalk5.default.bold.magenta("\n\u26A1 DocMeDown Dev Server\n"));
1182
+ console.log(import_chalk5.default.dim(` Serving directory: ${targetDir}`));
737
1183
  try {
738
- console.log(import_chalk4.default.dim(" Building serveable and offline documentation artifacts..."));
1184
+ console.log(import_chalk5.default.dim(" Building serveable and offline documentation artifacts..."));
739
1185
  await buildCommand(targetDir);
740
1186
  const devServer = await startDevServer({
741
1187
  rootDir: targetDir,
@@ -744,290 +1190,31 @@ async function serveCommand(targetDirArg = "./docs", options = {}) {
744
1190
  onSourceChange: () => buildCommand(targetDir)
745
1191
  });
746
1192
  const url = `http://${options.host || "localhost"}:${devServer.port}`;
747
- console.log(import_chalk4.default.bold.green(`
1193
+ console.log(import_chalk5.default.bold.green(`
748
1194
  \u2714 Live Documentation Server running at:`));
749
- console.log(import_chalk4.default.bold.cyan(` \u279C Local: ${import_chalk4.default.underline(url)}`));
750
- console.log(import_chalk4.default.dim(` \u279C Watch: Source changes rebuild preview and .dist/index.html`));
751
- console.log(import_chalk4.default.dim(`
1195
+ console.log(import_chalk5.default.bold.cyan(` \u279C Local: ${import_chalk5.default.underline(url)}`));
1196
+ console.log(import_chalk5.default.dim(` \u279C Watch: Source changes rebuild preview and .dist/index.html`));
1197
+ console.log(import_chalk5.default.dim(`
752
1198
  Press Ctrl+C to stop.
753
1199
  `));
754
1200
  if (options.open !== false) {
755
1201
  await (0, import_open2.default)(url);
756
1202
  }
757
1203
  } catch (err) {
758
- console.error(import_chalk4.default.red(`
1204
+ console.error(import_chalk5.default.red(`
759
1205
  \u2716 Error starting server: ${err.message}
760
1206
  `));
761
1207
  process.exit(1);
762
1208
  }
763
1209
  }
764
1210
 
765
- // src/cli/commands/config-tui.ts
766
- var import_fs6 = __toESM(require("fs"));
767
- var import_path6 = __toESM(require("path"));
768
- var import_chalk5 = __toESM(require("chalk"));
769
- var import_prompts2 = __toESM(require("prompts"));
770
- async function configTuiCommand(configPathArg) {
771
- console.log(import_chalk5.default.bold.magenta("\n\u26A1 DocMeDown - Interactive Configuration Wizard\n"));
772
- let configPath = "";
773
- if (configPathArg) {
774
- configPath = import_path6.default.resolve(process.cwd(), configPathArg);
775
- if (import_fs6.default.existsSync(configPath) && import_fs6.default.statSync(configPath).isDirectory()) {
776
- configPath = import_path6.default.join(configPath, "docs.json");
777
- }
778
- } else {
779
- const candidates = [
780
- import_path6.default.resolve(process.cwd(), "docs.json"),
781
- import_path6.default.resolve(process.cwd(), "docs/docs.json"),
782
- import_path6.default.resolve(process.cwd(), "dmd.json")
783
- ];
784
- configPath = candidates.find((p) => import_fs6.default.existsSync(p)) || import_path6.default.resolve(process.cwd(), "docs/docs.json");
785
- }
786
- let existingConfig = DEFAULT_CONFIG;
787
- if (import_fs6.default.existsSync(configPath)) {
788
- try {
789
- existingConfig = { ...DEFAULT_CONFIG, ...JSON.parse(import_fs6.default.readFileSync(configPath, "utf-8")) };
790
- console.log(import_chalk5.default.dim(` Loaded existing configuration from: ${configPath}
791
- `));
792
- } catch {
793
- console.warn(import_chalk5.default.yellow(` \u26A0 Error reading ${configPath}, starting fresh.
794
- `));
795
- }
796
- } else {
797
- console.log(import_chalk5.default.dim(` Creating new configuration at: ${configPath}
798
- `));
799
- }
800
- const response = await (0, import_prompts2.default)([
801
- {
802
- type: "text",
803
- name: "name",
804
- message: "Project Name:",
805
- initial: existingConfig.name || "My Project Docs"
806
- },
807
- {
808
- type: "text",
809
- name: "tagline",
810
- message: "Tagline / Short description:",
811
- initial: existingConfig.tagline || "The simplest Markdown documenter yet"
812
- },
813
- {
814
- type: "select",
815
- name: "preset",
816
- message: "Select Theme Color Palette:",
817
- choices: [
818
- { title: "Indigo (Modern & Clean)", value: "indigo" },
819
- { title: "Emerald (Fresh & Tech)", value: "emerald" },
820
- { title: "Sunset (Warm Amber)", value: "sunset" },
821
- { title: "Violet (Vibrant Purple)", value: "violet" },
822
- { title: "Rose (Bold Quartz)", value: "rose" },
823
- { title: "Slate (Minimalist Monochrome)", value: "slate" },
824
- { title: "Cyberpunk (Neon Glow)", value: "cyberpunk" }
825
- ],
826
- initial: ["indigo", "emerald", "sunset", "violet", "rose", "slate", "cyberpunk"].indexOf(
827
- existingConfig.theme?.preset || "indigo"
828
- )
829
- },
830
- {
831
- type: "select",
832
- name: "defaultMode",
833
- message: "Default Color Mode:",
834
- choices: [
835
- { title: "Auto (Follows OS system preference)", value: "auto" },
836
- { title: "Dark (Default dark theme)", value: "dark" },
837
- { title: "Light (Default light theme)", value: "light" }
838
- ],
839
- initial: ["auto", "dark", "light"].indexOf(existingConfig.theme?.defaultMode || "auto")
840
- },
841
- {
842
- type: "select",
843
- name: "sourceType",
844
- message: "Documentation Source Mode:",
845
- choices: [
846
- { title: "Local Markdown Files (hosted together in folder)", value: "local" },
847
- { title: "Remote GitHub Repository (live dynamic fetch)", value: "github" },
848
- { title: "Remote GitLab Repository (live dynamic fetch)", value: "gitlab" }
849
- ],
850
- initial: existingConfig.source?.type ? existingConfig.source.type === "github" ? 1 : 2 : 0
851
- },
852
- {
853
- type: (prev) => prev === "github" ? "text" : null,
854
- name: "githubRepo",
855
- message: "GitHub Repository (owner/repo):",
856
- initial: existingConfig.source?.repo || "facebook/react"
857
- },
858
- {
859
- type: (prev, values) => values.sourceType === "github" ? "text" : null,
860
- name: "githubBranch",
861
- message: "GitHub Branch:",
862
- initial: existingConfig.source?.branch || "main"
863
- },
864
- {
865
- type: (prev, values) => values.sourceType === "github" ? "text" : null,
866
- name: "githubDocsDir",
867
- message: "GitHub Docs Subfolder (leave empty for root):",
868
- initial: existingConfig.source?.docsDir || "docs"
869
- },
870
- {
871
- type: "text",
872
- name: "githubSocial",
873
- message: "GitHub Repository URL for Navbar link (optional):",
874
- initial: existingConfig.socials?.find((s) => s.type === "github")?.url || ""
875
- }
876
- ]);
877
- if (!response.name) {
878
- console.log(import_chalk5.default.yellow("\nConfiguration cancelled."));
879
- return;
880
- }
881
- const updatedConfig = {
882
- ...existingConfig,
883
- name: response.name,
884
- tagline: response.tagline,
885
- theme: {
886
- ...existingConfig.theme,
887
- preset: response.preset,
888
- defaultMode: response.defaultMode
889
- },
890
- socials: response.githubSocial ? [{ type: "github", url: response.githubSocial }] : existingConfig.socials
891
- };
892
- if (response.sourceType === "github") {
893
- updatedConfig.source = {
894
- type: "github",
895
- repo: response.githubRepo,
896
- branch: response.githubBranch,
897
- docsDir: response.githubDocsDir
898
- };
899
- } else if (response.sourceType === "local") {
900
- delete updatedConfig.source;
901
- }
902
- const dir = import_path6.default.dirname(configPath);
903
- if (!import_fs6.default.existsSync(dir)) {
904
- import_fs6.default.mkdirSync(dir, { recursive: true });
905
- }
906
- import_fs6.default.writeFileSync(configPath, JSON.stringify(updatedConfig, null, 2), "utf-8");
907
- console.log(import_chalk5.default.bold.green(`
908
- \u2714 Configuration successfully saved to: ${configPath}
909
- `));
910
- }
911
-
912
- // package.json
913
- var package_default = {
914
- name: "docmedown",
915
- version: "0.1.0",
916
- description: "The simplest MarkDown documenter yet. CLI & Web Script React SPA documentation engine.",
917
- main: "./dist/docmedown.cjs",
918
- module: "./dist/docmedown.mjs",
919
- types: "./dist/types/runtime/index.d.ts",
920
- exports: {
921
- ".": {
922
- types: "./dist/types/runtime/index.d.ts",
923
- import: "./dist/docmedown.mjs",
924
- require: "./dist/docmedown.cjs"
925
- },
926
- "./iife": "./dist/docmedown.iife.js"
927
- },
928
- unpkg: "./dist/docmedown.iife.js",
929
- jsdelivr: "./dist/docmedown.iife.js",
930
- bin: {
931
- docmedown: "bin/docmedown.js",
932
- dmd: "bin/docmedown.js"
933
- },
934
- files: [
935
- "dist",
936
- "bin",
937
- "templates",
938
- "README.md",
939
- "LICENSE"
940
- ],
941
- scripts: {
942
- "dev:runtime": "vite build --watch",
943
- "build:runtime": "vite build",
944
- "build:cli": "tsup",
945
- typecheck: "tsc --noEmit",
946
- "build:types": "tsc -p tsconfig.runtime.json",
947
- build: "npm run build:runtime && npm run build:cli && npm run build:types",
948
- docmedown: "node ./bin/docmedown.js",
949
- dmd: "node ./bin/docmedown.js",
950
- "init:docs": "node ./bin/docmedown.js init",
951
- serve: "node ./bin/docmedown.js serve ./docs",
952
- dev: "node ./bin/docmedown.js serve ./docs",
953
- "build:docs": "node ./bin/docmedown.js build ./docs",
954
- "build:docs:watch": "node ./bin/docmedown.js build ./docs --watch",
955
- "build:offline": "node ./bin/docmedown.js build ./docs",
956
- "config:docs": "node ./bin/docmedown.js config ./docs/docs.json",
957
- test: "npx tsx --test tests/parser.test.ts tests/scanner.test.ts tests/runtime-integration.test.ts tests/package-smoke.test.ts",
958
- "test:release": "npm run typecheck && npm run test && npm run build && npm run build:docs && npm pack --dry-run",
959
- prepublishOnly: "npm run test:release"
960
- },
961
- keywords: [
962
- "markdown",
963
- "documentation",
964
- "docs",
965
- "docusaurus",
966
- "docsify",
967
- "react",
968
- "spa",
969
- "cli",
970
- "offline-docs",
971
- "github-docs"
972
- ],
973
- author: "Gabriel M. Silva",
974
- license: "MIT",
975
- engines: {
976
- node: ">=20.19.0"
977
- },
978
- repository: {
979
- type: "git",
980
- url: "git+https://github.com/gabrielmsilva00/docmedown.git"
981
- },
982
- bugs: {
983
- url: "https://github.com/gabrielmsilva00/docmedown/issues"
984
- },
985
- homepage: "https://github.com/gabrielmsilva00/docmedown#readme",
986
- packageManager: "npm@11.16.0",
987
- overrides: {
988
- tsup: {
989
- esbuild: "0.28.2"
990
- }
991
- },
992
- dependencies: {
993
- chalk: "^4.1.2",
994
- chokidar: "^3.6.0",
995
- commander: "^12.1.0",
996
- "gray-matter": "^4.0.3",
997
- "mime-types": "^2.1.35",
998
- open: "^10.1.0",
999
- prompts: "^2.4.2",
1000
- ws: "^8.18.0"
1001
- },
1002
- devDependencies: {
1003
- "@types/node": "^22.5.0",
1004
- "@types/prismjs": "^1.26.6",
1005
- "@types/prompts": "^2.4.9",
1006
- "@types/react": "^18.3.5",
1007
- "@types/react-dom": "^18.3.0",
1008
- "@types/ws": "^8.5.12",
1009
- "@vitejs/plugin-react": "^6.1.0",
1010
- katex: "^0.16.11",
1011
- marked: "^14.1.1",
1012
- minisearch: "^7.1.0",
1013
- prismjs: "^1.29.0",
1014
- react: "^18.3.1",
1015
- "react-dom": "^18.3.1",
1016
- tsup: "^8.2.4",
1017
- tsx: "^4.19.0",
1018
- typescript: "^5.5.4",
1019
- vite: "^8.2.2",
1020
- "vite-plugin-css-injected-by-js": "^5.0.2"
1021
- }
1022
- };
1023
-
1024
1211
  // src/cli/index.ts
1025
1212
  var program = new import_commander.Command();
1026
1213
  program.name("docmedown").description("DocMeDown - The simplest MarkDown documenter yet. CLI & Web Script React SPA.").version(package_default.version);
1027
1214
  program.argument("[dir]", "Documentation directory to initialize or serve", "./docs").option("-p, --port <number>", "Port for local dev server", "3000").option("--no-open", "Do not automatically open the browser").action(async (dir, options) => {
1028
- const targetDir = import_path7.default.resolve(process.cwd(), dir);
1029
- const hasIndex = import_fs7.default.existsSync(import_path7.default.join(targetDir, "index.html"));
1030
- const hasDocs = import_fs7.default.existsSync(import_path7.default.join(targetDir, "README.md")) || import_fs7.default.existsSync(import_path7.default.join(targetDir, "docs.json"));
1215
+ const targetDir = import_node_path7.default.resolve(process.cwd(), dir);
1216
+ const hasIndex = import_node_fs7.default.existsSync(import_node_path7.default.join(targetDir, "index.html"));
1217
+ const hasDocs = import_node_fs7.default.existsSync(import_node_path7.default.join(targetDir, "README.md")) || import_node_fs7.default.existsSync(import_node_path7.default.join(targetDir, "docs.json"));
1031
1218
  if (!hasIndex && !hasDocs) {
1032
1219
  await initCommand(dir, { start: options.open });
1033
1220
  } else {