@jant/core 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/bin/commands/assets/prepare.js +3 -3
  2. package/bin/commands/db/export.js +115 -2
  3. package/bin/commands/deploy.js +11 -3
  4. package/bin/commands/{search-reindex.js → search/reindex.js} +5 -5
  5. package/bin/commands/site/export.js +48 -36
  6. package/bin/commands/site/import.js +3074 -2
  7. package/bin/commands/site/snapshot/import.js +2 -0
  8. package/bin/commands/telegram/register-webhooks.js +48 -23
  9. package/bin/jant.js +16 -11
  10. package/bin/lib/command-registry.js +120 -0
  11. package/bin/lib/migration-artifacts.js +19 -0
  12. package/bin/lib/renamed-arguments.js +56 -0
  13. package/bin/lib/site-snapshot.js +83 -1
  14. package/dist/{app-ZcaI1kPN.js → app-CFsmRVJN.js} +7916 -499
  15. package/dist/client/.vite/manifest.json +3 -3
  16. package/dist/client/_assets/{client-DAhoqPdr.css → client-BCumu1-D.css} +1 -1
  17. package/dist/client/_assets/{client-knSEyUJO.js → client-DTLBOHqD.js} +1 -1
  18. package/dist/client/_assets/{client-auth-CAMfTrKW.js → client-auth-D6Ix6SmE.js} +1 -1
  19. package/dist/index.js +2 -3
  20. package/dist/node.js +2 -3
  21. package/dist/url-CKlGzvdN.js +428 -0
  22. package/package.json +1 -5
  23. package/src/__tests__/cli-commands.test.ts +144 -0
  24. package/src/__tests__/config-docs.test.ts +148 -0
  25. package/src/__tests__/export-import-roundtrip.test.ts +1 -1
  26. package/src/__tests__/feed-docs.test.ts +36 -0
  27. package/src/__tests__/fixtures/releases/0.7.0/site-export/README.md +89 -0
  28. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/41q27/0x4nv/index.md +16 -0
  29. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/41q27/_index.md +41 -0
  30. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/41q27/faqyt/index.md +28 -0
  31. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/41q27/the-potting-mix-guide-i-keep-rereading/index.md +18 -0
  32. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/_index.md +4 -0
  33. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/a-night-heron-field-guide-for-my-walk-folder/_index.md +27 -0
  34. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/a-quiet-saturday-after-a-busy-week/_index.md +32 -0
  35. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/archive/_index.md +7 -0
  36. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/are-na-is-the-only-bookmark-pile-i-still-revisit/_index.md +27 -0
  37. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/bought-too-many-lemons-again/_index.md +34 -0
  38. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/city-walks/_index.md +11 -0
  39. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/collections/_index.md +4 -0
  40. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/current-tea-rotation/_index.md +31 -0
  41. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/derek-sivers-still-writes-the-kind-of-internet-i-want-more-of/_index.md +27 -0
  42. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/desk-but-better/_index.md +22 -0
  43. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/e0kcg/_index.md +19 -0
  44. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/featured/_index.md +7 -0
  45. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/from-basho/_index.md +22 -0
  46. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/from-epictetus/_index.md +22 -0
  47. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/from-marcus-aurelius/_index.md +22 -0
  48. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/from-seneca/_index.md +22 -0
  49. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/from-thoreau/_index.md +22 -0
  50. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/gkbvv/2cl6d/index.md +16 -0
  51. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/gkbvv/3zqv7/index.md +28 -0
  52. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/gkbvv/5oxsv/index.md +16 -0
  53. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/gkbvv/_index.md +36 -0
  54. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/home-cooking/_index.md +11 -0
  55. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/k5vh8/_index.md +29 -0
  56. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/k5vh8/a-reading-log-idea-i-might-steal/index.md +18 -0
  57. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/k5vh8/a83qu/index.md +16 -0
  58. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/k5vh8/from-seneca-5hibo/index.md +19 -0
  59. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/mynoise-for-rainy-afternoons/_index.md +27 -0
  60. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/nts-archives-are-good-cleaning-music/_index.md +27 -0
  61. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/qgfcu/_index.md +29 -0
  62. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/qgfcu/c91j0/index.md +16 -0
  63. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/qgfcu/qyucy/index.md +16 -0
  64. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/qgfcu/wsgck/index.md +16 -0
  65. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/rain-makes-my-neighborhood-look-better/_index.md +43 -0
  66. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/reading-notes/_index.md +11 -0
  67. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/serious-eats-on-tomato-and-egg-soup/_index.md +27 -0
  68. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/te812/_index.md +41 -0
  69. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/te812/cxiu6/index.md +16 -0
  70. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/te812/t77ms/index.md +16 -0
  71. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/te812/the-soup-trick-i-always-forget/index.md +18 -0
  72. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/telk3/_index.md +27 -0
  73. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/telk3/from-thoreau-pawt2/index.md +17 -0
  74. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/the-five-minute-reset-is-still-the-best-habit-i-have/_index.md +32 -0
  75. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/the-hallway-light-took-12-minutes-and-3-months/_index.md +29 -0
  76. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/the-recurse-center-manual-is-weirdly-calming/_index.md +27 -0
  77. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/tiny-projects/_index.md +11 -0
  78. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/useful-links/_index.md +11 -0
  79. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/weekend-notes/_index.md +11 -0
  80. package/src/__tests__/fixtures/releases/0.7.0/site-export/content/what-i-actually-use-my-notebook-for/_index.md +49 -0
  81. package/src/__tests__/fixtures/releases/0.7.0/site-export/data/jant.toml +119 -0
  82. package/src/__tests__/fixtures/releases/0.7.0/site-export/hugo.toml +43 -0
  83. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/021801c20ab3-med_01kn8jw26cenf98vc7k0ppz5k8.webp +0 -0
  84. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/0f868ce9ac84-med_01kn8jtx8qenf98tm9ahxr48sw.webp +0 -0
  85. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/50c2ad911bad-med_01kn8jvb16enf98txp7p0pf5ge.webp +0 -0
  86. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/7a91f0960491-med_01kn8jvq58enf98v538w5vsqp4.webp +0 -0
  87. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/8714116d3c8e-med_01kn8jve5nenf98tzap11gpxzr.webp +0 -0
  88. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/8a0b4277443f-med_01kn8jv0jdenf98tp6qr9zgjjc.webp +0 -0
  89. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/a7d1c8a1afd9-med_01kn8jv452enf98trbkwrvhvgd.webp +0 -0
  90. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/e25570b405f5-med_01kn8jvsaeenf98v6ct4gjzppc.webp +0 -0
  91. package/src/__tests__/fixtures/releases/0.7.0/site-export/static/media/e89ea4eabf01-med_01kn8jtq3penf98tfq4gzmh9g9.png +0 -0
  92. package/src/__tests__/fixtures/releases/0.7.0/site-export/themes/jant/static/apple-touch-icon.png +0 -0
  93. package/src/__tests__/fixtures/releases/0.7.0/site-export/themes/jant/static/custom.css +0 -0
  94. package/src/__tests__/fixtures/releases/0.7.0/site-export/themes/jant/static/favicon.ico +0 -0
  95. package/src/__tests__/fixtures/releases/0.7.0/snapshot/db.sql +218 -0
  96. package/src/__tests__/fixtures/releases/0.7.0/snapshot/meta.json +9 -0
  97. package/src/__tests__/fixtures/releases/0.7.1/site-export/README.md +89 -0
  98. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/41q27/0x4nv/index.md +16 -0
  99. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/41q27/_index.md +41 -0
  100. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/41q27/faqyt/index.md +28 -0
  101. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/41q27/the-potting-mix-guide-i-keep-rereading/index.md +18 -0
  102. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/_index.md +4 -0
  103. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/a-night-heron-field-guide-for-my-walk-folder/_index.md +27 -0
  104. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/a-quiet-saturday-after-a-busy-week/_index.md +32 -0
  105. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/archive/_index.md +7 -0
  106. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/are-na-is-the-only-bookmark-pile-i-still-revisit/_index.md +27 -0
  107. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/bought-too-many-lemons-again/_index.md +34 -0
  108. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/city-walks/_index.md +11 -0
  109. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/collections/_index.md +4 -0
  110. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/current-tea-rotation/_index.md +31 -0
  111. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/derek-sivers-still-writes-the-kind-of-internet-i-want-more-of/_index.md +27 -0
  112. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/desk-but-better/_index.md +22 -0
  113. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/e0kcg/_index.md +19 -0
  114. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/featured/_index.md +7 -0
  115. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/from-basho/_index.md +22 -0
  116. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/from-epictetus/_index.md +22 -0
  117. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/from-marcus-aurelius/_index.md +22 -0
  118. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/from-seneca/_index.md +22 -0
  119. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/from-thoreau/_index.md +22 -0
  120. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/gkbvv/2cl6d/index.md +16 -0
  121. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/gkbvv/3zqv7/index.md +28 -0
  122. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/gkbvv/5oxsv/index.md +16 -0
  123. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/gkbvv/_index.md +36 -0
  124. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/home-cooking/_index.md +11 -0
  125. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/k5vh8/_index.md +29 -0
  126. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/k5vh8/a-reading-log-idea-i-might-steal/index.md +18 -0
  127. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/k5vh8/a83qu/index.md +16 -0
  128. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/k5vh8/from-seneca-5hibo/index.md +19 -0
  129. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/mynoise-for-rainy-afternoons/_index.md +27 -0
  130. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/nts-archives-are-good-cleaning-music/_index.md +27 -0
  131. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/qgfcu/_index.md +29 -0
  132. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/qgfcu/c91j0/index.md +16 -0
  133. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/qgfcu/qyucy/index.md +16 -0
  134. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/qgfcu/wsgck/index.md +16 -0
  135. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/rain-makes-my-neighborhood-look-better/_index.md +43 -0
  136. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/reading-notes/_index.md +11 -0
  137. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/serious-eats-on-tomato-and-egg-soup/_index.md +27 -0
  138. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/te812/_index.md +41 -0
  139. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/te812/cxiu6/index.md +16 -0
  140. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/te812/t77ms/index.md +16 -0
  141. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/te812/the-soup-trick-i-always-forget/index.md +18 -0
  142. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/telk3/_index.md +27 -0
  143. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/telk3/from-thoreau-pawt2/index.md +17 -0
  144. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/the-five-minute-reset-is-still-the-best-habit-i-have/_index.md +32 -0
  145. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/the-hallway-light-took-12-minutes-and-3-months/_index.md +29 -0
  146. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/the-recurse-center-manual-is-weirdly-calming/_index.md +27 -0
  147. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/tiny-projects/_index.md +11 -0
  148. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/useful-links/_index.md +11 -0
  149. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/weekend-notes/_index.md +11 -0
  150. package/src/__tests__/fixtures/releases/0.7.1/site-export/content/what-i-actually-use-my-notebook-for/_index.md +49 -0
  151. package/src/__tests__/fixtures/releases/0.7.1/site-export/data/jant.toml +119 -0
  152. package/src/__tests__/fixtures/releases/0.7.1/site-export/hugo.toml +43 -0
  153. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/021801c20ab3-med_01kn8jw26cenf98vc7k0ppz5k8.webp +0 -0
  154. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/0f868ce9ac84-med_01kn8jtx8qenf98tm9ahxr48sw.webp +0 -0
  155. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/50c2ad911bad-med_01kn8jvb16enf98txp7p0pf5ge.webp +0 -0
  156. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/7a91f0960491-med_01kn8jvq58enf98v538w5vsqp4.webp +0 -0
  157. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/8714116d3c8e-med_01kn8jve5nenf98tzap11gpxzr.webp +0 -0
  158. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/8a0b4277443f-med_01kn8jv0jdenf98tp6qr9zgjjc.webp +0 -0
  159. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/a7d1c8a1afd9-med_01kn8jv452enf98trbkwrvhvgd.webp +0 -0
  160. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/e25570b405f5-med_01kn8jvsaeenf98v6ct4gjzppc.webp +0 -0
  161. package/src/__tests__/fixtures/releases/0.7.1/site-export/static/media/e89ea4eabf01-med_01kn8jtq3penf98tfq4gzmh9g9.png +0 -0
  162. package/src/__tests__/fixtures/releases/0.7.1/site-export/themes/jant/static/apple-touch-icon.png +0 -0
  163. package/src/__tests__/fixtures/releases/0.7.1/site-export/themes/jant/static/custom.css +0 -0
  164. package/src/__tests__/fixtures/releases/0.7.1/site-export/themes/jant/static/favicon.ico +0 -0
  165. package/src/__tests__/fixtures/releases/0.7.1/snapshot/db.sql +322 -0
  166. package/src/__tests__/fixtures/releases/0.7.1/snapshot/meta.json +9 -0
  167. package/src/__tests__/helpers/site-export-import.ts +97 -0
  168. package/src/__tests__/import-site-command.test.ts +27 -1
  169. package/src/__tests__/release-fixtures.test.ts +132 -0
  170. package/src/__tests__/site-export-canonical-import.test.ts +11 -47
  171. package/src/__tests__/theme-docs.test.ts +109 -0
  172. package/src/app.tsx +1 -5
  173. package/src/db/rehearsal-fixtures/pg-demo-current.json +55 -0
  174. package/src/db/rehearsal-fixtures/pg-demo-current.sql +431 -0
  175. package/src/i18n/locales/public/en.po +0 -2
  176. package/src/i18n/locales/public/zh-Hans.po +0 -2
  177. package/src/i18n/locales/public/zh-Hant.po +0 -2
  178. package/src/index.ts +6 -77
  179. package/src/lib/__tests__/view.test.ts +0 -46
  180. package/src/lib/feed.ts +0 -6
  181. package/src/lib/view.ts +0 -27
  182. package/src/node/__tests__/cli-export.test.ts +2 -2
  183. package/src/node/__tests__/cli-site-snapshot.test.ts +6 -0
  184. package/src/node/__tests__/cli-site-token-env.test.ts +4 -1
  185. package/src/node/__tests__/cli-snapshot-meta.test.ts +64 -0
  186. package/src/routes/api/internal/search-reindex.ts +1 -1
  187. package/src/services/__tests__/media.test.ts +0 -271
  188. package/src/services/export.ts +13 -5
  189. package/src/services/media.ts +1 -219
  190. package/src/styles/ui.css +0 -118
  191. package/bin/commands/export.js +0 -120
  192. package/bin/commands/import-site.js +0 -3034
  193. package/bin/commands/migrate-text-attachments.js +0 -181
  194. package/dist/github-sync-Gw4orAHk.js +0 -8398
  195. package/src/client/multipart-upload.ts +0 -206
  196. package/src/routes/api/__tests__/upload-multipart.test.ts +0 -739
  197. package/src/routes/api/internal/text-attachments.ts +0 -60
  198. package/src/routes/api/upload-multipart.ts +0 -366
@@ -292,4 +292,4 @@ ${c}`:c;break;case`event`:r.event=c;break;case`id`:e(r.id=c);break;case`retry`:{
292
292
  </div>`}
293
293
  </div>
294
294
  </dialog>
295
- `:t}};customElements.define(`jant-text-preview`,gn);function _n(e){return e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey}function vn(e,t){t&&(e.textContent=t)}function yn(e){let t=e.target;if(!(t instanceof globalThis.Element))return;let n=t.closest(`a[data-note-expand]`);if(!n||_n(e))return;let r=n.closest(`article[data-post]`),i=r?.querySelector(`[data-post-body]`);if(r&&i&&i.querySelector(`[data-note-break]`)){if(e.preventDefault(),i.hasAttribute(`data-note-clamp`)){i.removeAttribute(`data-note-clamp`),n.setAttribute(`aria-expanded`,`true`),vn(n,n.dataset.labelLess);return}i.setAttribute(`data-note-clamp`,``),n.setAttribute(`aria-expanded`,`false`),vn(n,n.dataset.labelMore),r.getBoundingClientRect().top<0&&typeof r.scrollIntoView==`function`&&r.scrollIntoView({block:`start`})}}document.addEventListener(`click`,yn),document.querySelectorAll(`.archive-chip-dropdown`).forEach(e=>{let t=e.querySelector(`:scope > button`),n=e.querySelector(`:scope > [data-popover]`),r=n?n.querySelector(`[role="listbox"]`):null;if(!t||!n||!r)return;let i=Array.from(r.querySelectorAll(`[role="option"]`)),a=e.classList.contains(`archive-chip-media`),o=e.dataset.filterKey,s=new Set;a&&i.forEach(e=>{!e.dataset.navigate&&e.getAttribute(`aria-selected`)===`true`&&s.add(e.dataset.value)});let c=new Set(s),l=()=>{document.dispatchEvent(new CustomEvent(`basecoat:popover`,{detail:{source:e}})),n.setAttribute(`aria-hidden`,`false`),t.setAttribute(`aria-expanded`,`true`),a&&(c=new Set(s))},u=(e=!0)=>{if(n.getAttribute(`aria-hidden`)!==`true`&&(n.setAttribute(`aria-hidden`,`true`),t.setAttribute(`aria-expanded`,`false`),e&&t.focus(),a&&o&&(s.size!==c.size||[...s].some(e=>!c.has(e))))){let e=new URL(window.location.href),t=[...s];t.length>0?e.searchParams.set(o,t.join(`,`)):e.searchParams.delete(o),e.searchParams.delete(`hasMedia`),e.searchParams.delete(`page`),window.location.href=e.pathname+(e.search||``)}};t.addEventListener(`click`,e=>{e.target.closest(`.archive-chip-clear`)||(t.getAttribute(`aria-expanded`)===`true`?u():l())}),document.addEventListener(`click`,t=>{e.contains(t.target)||u(!1)}),document.addEventListener(`basecoat:popover`,t=>{t.detail.source!==e&&u(!1)}),r.addEventListener(`click`,e=>{let t=e.target.closest(`[role="option"]`);if(t){if(t.dataset.navigate){let e=t.dataset.value;typeof e==`string`&&e.startsWith(`/`)&&(window.location.href=e);return}if(a){let e=t.dataset.value;s.has(e)?(s.delete(e),t.removeAttribute(`aria-selected`)):(s.add(e),t.setAttribute(`aria-selected`,`true`))}else{let e=t.dataset.value;typeof e==`string`&&e.startsWith(`/`)&&(window.location.href=e)}}});let d=-1,f=e=>{d>-1&&i[d]&&i[d].classList.remove(`active`),d=e,d>-1&&i[d]&&(i[d].classList.add(`active`),i[d].scrollIntoView({block:`nearest`}))};r.addEventListener(`mousemove`,e=>{let t=e.target.closest(`[role="option"]`);if(t){let e=i.indexOf(t);e!==-1&&e!==d&&f(e)}}),r.addEventListener(`mouseleave`,()=>{f(-1)}),t.addEventListener(`keydown`,e=>{let t=n.getAttribute(`aria-hidden`)===`false`;if(e.key===`Escape`){t&&(e.preventDefault(),u());return}if(!t&&[`ArrowDown`,`ArrowUp`].includes(e.key)){e.preventDefault(),l();return}t&&(e.preventDefault(),e.key===`ArrowDown`?f(Math.min(d+1,i.length-1)):e.key===`ArrowUp`?f(Math.max(d-1,0)):e.key===`Enter`&&d>-1&&(i[d].click(),!a&&!i[d].dataset.navigate&&u()))})});function bn(e=document){e.querySelectorAll(`.collection-sort-menu`).forEach(e=>{if(e.dataset.collectionSortMenuInitialized===`true`)return;let t=e.querySelector(`:scope > .collection-sort-trigger`),n=e.querySelector(`:scope > [data-popover]`),r=n?.querySelector(`[data-collection-sort-options]`);if(!(t instanceof HTMLButtonElement)||!n||!r)return;let i=(e=!1)=>{n.getAttribute(`aria-hidden`)!==`true`&&(n.setAttribute(`aria-hidden`,`true`),t.setAttribute(`aria-expanded`,`false`),e&&t.focus())},a=()=>{document.dispatchEvent(new CustomEvent(`basecoat:popover`,{detail:{source:e}})),n.setAttribute(`aria-hidden`,`false`),t.setAttribute(`aria-expanded`,`true`)};t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t.getAttribute(`aria-expanded`)===`true`?i(!1):a()}),t.addEventListener(`keydown`,e=>{if(e.key===`Escape`){e.preventDefault(),i(!0);return}if(e.key===`ArrowDown`){e.preventDefault(),t.getAttribute(`aria-expanded`)!==`true`&&a();let n=r.querySelector(`a[href]`);n instanceof HTMLElement&&n.focus()}}),n.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),i(!0))}),document.addEventListener(`click`,t=>{t.target instanceof Node&&(e.contains(t.target)||i(!1))}),document.addEventListener(`basecoat:popover`,t=>{t.detail?.source!==e&&i(!1)}),e.dataset.collectionSortMenuInitialized=`true`})}bn(),r(),document.documentElement.dataset.jantVersion=`0.7.1-380517d00e9b9119`;
295
+ `:t}};customElements.define(`jant-text-preview`,gn);function _n(e){return e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey}function vn(e,t){t&&(e.textContent=t)}function yn(e){let t=e.target;if(!(t instanceof globalThis.Element))return;let n=t.closest(`a[data-note-expand]`);if(!n||_n(e))return;let r=n.closest(`article[data-post]`),i=r?.querySelector(`[data-post-body]`);if(r&&i&&i.querySelector(`[data-note-break]`)){if(e.preventDefault(),i.hasAttribute(`data-note-clamp`)){i.removeAttribute(`data-note-clamp`),n.setAttribute(`aria-expanded`,`true`),vn(n,n.dataset.labelLess);return}i.setAttribute(`data-note-clamp`,``),n.setAttribute(`aria-expanded`,`false`),vn(n,n.dataset.labelMore),r.getBoundingClientRect().top<0&&typeof r.scrollIntoView==`function`&&r.scrollIntoView({block:`start`})}}document.addEventListener(`click`,yn),document.querySelectorAll(`.archive-chip-dropdown`).forEach(e=>{let t=e.querySelector(`:scope > button`),n=e.querySelector(`:scope > [data-popover]`),r=n?n.querySelector(`[role="listbox"]`):null;if(!t||!n||!r)return;let i=Array.from(r.querySelectorAll(`[role="option"]`)),a=e.classList.contains(`archive-chip-media`),o=e.dataset.filterKey,s=new Set;a&&i.forEach(e=>{!e.dataset.navigate&&e.getAttribute(`aria-selected`)===`true`&&s.add(e.dataset.value)});let c=new Set(s),l=()=>{document.dispatchEvent(new CustomEvent(`basecoat:popover`,{detail:{source:e}})),n.setAttribute(`aria-hidden`,`false`),t.setAttribute(`aria-expanded`,`true`),a&&(c=new Set(s))},u=(e=!0)=>{if(n.getAttribute(`aria-hidden`)!==`true`&&(n.setAttribute(`aria-hidden`,`true`),t.setAttribute(`aria-expanded`,`false`),e&&t.focus(),a&&o&&(s.size!==c.size||[...s].some(e=>!c.has(e))))){let e=new URL(window.location.href),t=[...s];t.length>0?e.searchParams.set(o,t.join(`,`)):e.searchParams.delete(o),e.searchParams.delete(`hasMedia`),e.searchParams.delete(`page`),window.location.href=e.pathname+(e.search||``)}};t.addEventListener(`click`,e=>{e.target.closest(`.archive-chip-clear`)||(t.getAttribute(`aria-expanded`)===`true`?u():l())}),document.addEventListener(`click`,t=>{e.contains(t.target)||u(!1)}),document.addEventListener(`basecoat:popover`,t=>{t.detail.source!==e&&u(!1)}),r.addEventListener(`click`,e=>{let t=e.target.closest(`[role="option"]`);if(t){if(t.dataset.navigate){let e=t.dataset.value;typeof e==`string`&&e.startsWith(`/`)&&(window.location.href=e);return}if(a){let e=t.dataset.value;s.has(e)?(s.delete(e),t.removeAttribute(`aria-selected`)):(s.add(e),t.setAttribute(`aria-selected`,`true`))}else{let e=t.dataset.value;typeof e==`string`&&e.startsWith(`/`)&&(window.location.href=e)}}});let d=-1,f=e=>{d>-1&&i[d]&&i[d].classList.remove(`active`),d=e,d>-1&&i[d]&&(i[d].classList.add(`active`),i[d].scrollIntoView({block:`nearest`}))};r.addEventListener(`mousemove`,e=>{let t=e.target.closest(`[role="option"]`);if(t){let e=i.indexOf(t);e!==-1&&e!==d&&f(e)}}),r.addEventListener(`mouseleave`,()=>{f(-1)}),t.addEventListener(`keydown`,e=>{let t=n.getAttribute(`aria-hidden`)===`false`;if(e.key===`Escape`){t&&(e.preventDefault(),u());return}if(!t&&[`ArrowDown`,`ArrowUp`].includes(e.key)){e.preventDefault(),l();return}t&&(e.preventDefault(),e.key===`ArrowDown`?f(Math.min(d+1,i.length-1)):e.key===`ArrowUp`?f(Math.max(d-1,0)):e.key===`Enter`&&d>-1&&(i[d].click(),!a&&!i[d].dataset.navigate&&u()))})});function bn(e=document){e.querySelectorAll(`.collection-sort-menu`).forEach(e=>{if(e.dataset.collectionSortMenuInitialized===`true`)return;let t=e.querySelector(`:scope > .collection-sort-trigger`),n=e.querySelector(`:scope > [data-popover]`),r=n?.querySelector(`[data-collection-sort-options]`);if(!(t instanceof HTMLButtonElement)||!n||!r)return;let i=(e=!1)=>{n.getAttribute(`aria-hidden`)!==`true`&&(n.setAttribute(`aria-hidden`,`true`),t.setAttribute(`aria-expanded`,`false`),e&&t.focus())},a=()=>{document.dispatchEvent(new CustomEvent(`basecoat:popover`,{detail:{source:e}})),n.setAttribute(`aria-hidden`,`false`),t.setAttribute(`aria-expanded`,`true`)};t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t.getAttribute(`aria-expanded`)===`true`?i(!1):a()}),t.addEventListener(`keydown`,e=>{if(e.key===`Escape`){e.preventDefault(),i(!0);return}if(e.key===`ArrowDown`){e.preventDefault(),t.getAttribute(`aria-expanded`)!==`true`&&a();let n=r.querySelector(`a[href]`);n instanceof HTMLElement&&n.focus()}}),n.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),i(!0))}),document.addEventListener(`click`,t=>{t.target instanceof Node&&(e.contains(t.target)||i(!1))}),document.addEventListener(`basecoat:popover`,t=>{t.detail?.source!==e&&i(!1)}),e.dataset.collectionSortMenuInitialized=`true`})}bn(),r(),document.documentElement.dataset.jantVersion=`0.8.0-5df7f503450f7a72`;
@@ -1,4 +1,4 @@
1
- import{T as e,g as t,h as n,i as r,m as i,n as a,t as o,u as s,x as ee,y as te}from"./chunks/lit-DW8VmJAT.js";import"./client-knSEyUJO.js";import{n as c,t as ne}from"./chunks/confirm-D7GrwsCN.js";import{_ as l,a as re,d as u,f as d,g as f,h as p,i as ie,l as m,m as ae,n as oe,p as se,r as ce,t as h,u as g,v as _,y as le}from"./chunks/unsafe-svg-BkscJx69.js";import{r as v}from"./chunks/slug-format-CRXO1AL5.js";import{h as y,l as ue,u as b}from"./chunks/types-D5iF3H1a.js";import{t as de}from"./chunks/settings-paths-BcdySNx6.js";var x=`M12 3 10.1 10.1 3 12l7.1 1.9L12 21l1.9-7.1L21 12l-7.1-1.9Z`,fe=`M4 4 20 20`,pe=200,me=class extends o{static properties={_open:{state:!0},_query:{state:!0},_items:{state:!0},_note:{state:!0},_loading:{state:!0},_searched:{state:!0}};#e=null;#t=null;#n=0;createRenderRoot(){return this.innerHTML=``,this}constructor(){super(),this._open=!1,this._query=``,this._items=[],this._note=``,this._loading=!1,this._searched=!1}disconnectedCallback(){super.disconnectedCallback();let e=this.#e;this.#e=null,e?.resolve(null)}pick(e){return this.#e?.resolve(null),this._query=``,this._items=[],this._note=``,this._loading=!1,this._searched=!1,this._open=!0,new Promise(t=>{this.#e={...e,resolve:t},this.updateComplete.then(()=>{let e=this.querySelector(`.picker-dialog`);e&&!e.open&&e.showModal(),this.querySelector(`.picker-dialog-input`)?.focus()})})}#r(e){this.#t&&clearTimeout(this.#t),this.#t=null,this.#n+=1;let t=this.querySelector(`.picker-dialog`);t?.open&&t.close();let n=this.#e;this.#e=null,this._open=!1,n?.resolve(e)}#i(e){let t=this.#e;if(!t)return;let n=e.target.value;this._query=n,this.#t&&clearTimeout(this.#t);let r=t.minQueryLength??2;if(n.trim().length<r){this.#n+=1,this._items=[],this._note=``,this._loading=!1,this._searched=!1;return}this._loading=!0,this.#t=setTimeout(()=>{this.#a(n,t)},pe)}async#a(e,t){let n=++this.#n;try{let r=await t.search(e);if(n!==this.#n)return;this._items=r.items,this._note=r.note??``}catch{if(n!==this.#n)return;this._items=[],this._note=``}finally{n===this.#n&&(this._loading=!1,this._searched=!0)}}#o(e){if(e.key===`Escape`){e.preventDefault(),this.#r(null);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(this.querySelectorAll(`.picker-dialog-option`));if(t.length===0)return;e.preventDefault();let n=document.activeElement,r=t.findIndex(e=>e===n),i=e.key===`ArrowDown`?r<0?0:Math.min(r+1,t.length-1):r<=0?-1:r-1;if(i<0){this.querySelector(`.picker-dialog-input`)?.focus();return}t[i]?.focus()}#s(e){e.target===e.currentTarget&&this.#r(null)}render(){let e=this.#e;if(!this._open||!e)return a;let t=e.minQueryLength??2,n=this._query.trim().length<t;return r`
1
+ import{T as e,g as t,h as n,i as r,m as i,n as a,t as o,u as s,x as ee,y as te}from"./chunks/lit-DW8VmJAT.js";import"./client-DTLBOHqD.js";import{n as c,t as ne}from"./chunks/confirm-D7GrwsCN.js";import{_ as l,a as re,d as u,f as d,g as f,h as p,i as ie,l as m,m as ae,n as oe,p as se,r as ce,t as h,u as g,v as _,y as le}from"./chunks/unsafe-svg-BkscJx69.js";import{r as v}from"./chunks/slug-format-CRXO1AL5.js";import{h as y,l as ue,u as b}from"./chunks/types-D5iF3H1a.js";import{t as de}from"./chunks/settings-paths-BcdySNx6.js";var x=`M12 3 10.1 10.1 3 12l7.1 1.9L12 21l1.9-7.1L21 12l-7.1-1.9Z`,fe=`M4 4 20 20`,pe=200,me=class extends o{static properties={_open:{state:!0},_query:{state:!0},_items:{state:!0},_note:{state:!0},_loading:{state:!0},_searched:{state:!0}};#e=null;#t=null;#n=0;createRenderRoot(){return this.innerHTML=``,this}constructor(){super(),this._open=!1,this._query=``,this._items=[],this._note=``,this._loading=!1,this._searched=!1}disconnectedCallback(){super.disconnectedCallback();let e=this.#e;this.#e=null,e?.resolve(null)}pick(e){return this.#e?.resolve(null),this._query=``,this._items=[],this._note=``,this._loading=!1,this._searched=!1,this._open=!0,new Promise(t=>{this.#e={...e,resolve:t},this.updateComplete.then(()=>{let e=this.querySelector(`.picker-dialog`);e&&!e.open&&e.showModal(),this.querySelector(`.picker-dialog-input`)?.focus()})})}#r(e){this.#t&&clearTimeout(this.#t),this.#t=null,this.#n+=1;let t=this.querySelector(`.picker-dialog`);t?.open&&t.close();let n=this.#e;this.#e=null,this._open=!1,n?.resolve(e)}#i(e){let t=this.#e;if(!t)return;let n=e.target.value;this._query=n,this.#t&&clearTimeout(this.#t);let r=t.minQueryLength??2;if(n.trim().length<r){this.#n+=1,this._items=[],this._note=``,this._loading=!1,this._searched=!1;return}this._loading=!0,this.#t=setTimeout(()=>{this.#a(n,t)},pe)}async#a(e,t){let n=++this.#n;try{let r=await t.search(e);if(n!==this.#n)return;this._items=r.items,this._note=r.note??``}catch{if(n!==this.#n)return;this._items=[],this._note=``}finally{n===this.#n&&(this._loading=!1,this._searched=!0)}}#o(e){if(e.key===`Escape`){e.preventDefault(),this.#r(null);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(this.querySelectorAll(`.picker-dialog-option`));if(t.length===0)return;e.preventDefault();let n=document.activeElement,r=t.findIndex(e=>e===n),i=e.key===`ArrowDown`?r<0?0:Math.min(r+1,t.length-1):r<=0?-1:r-1;if(i<0){this.querySelector(`.picker-dialog-input`)?.focus();return}t[i]?.focus()}#s(e){e.target===e.currentTarget&&this.#r(null)}render(){let e=this.#e;if(!this._open||!e)return a;let t=e.minQueryLength??2,n=this._query.trim().length<t;return r`
2
2
  <dialog
3
3
  class="dialog picker-dialog"
4
4
  @cancel=${e=>{e.preventDefault(),this.#r(null)}}
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
- import { At as MAX_PINNED_POSTS, Ft as NAV_ITEM_TYPES, Ht as SORT_ORDERS, Ln as url_exports, Nt as MEDIA_KINDS, Tt as FORMATS, Ut as STATUSES, kt as MAX_MEDIA_ATTACHMENTS, qt as TEXT_ATTACHMENT_CONTENT_FORMATS, v as markdown_exports, z as time_exports } from "./github-sync-Gw4orAHk.js";
2
- import { C as toNavItemView, D as toSearchResultView, E as toPostViews, S as toMediaView, T as toPostView, b as toArchiveGroups, n as createApp, v as defaultFeedRenderer, w as toNavItemViews, x as toArchiveGroupsWithMedia, y as createMediaContext } from "./app-ZcaI1kPN.js";
3
- export { FORMATS, MAX_MEDIA_ATTACHMENTS, MAX_PINNED_POSTS, MEDIA_KINDS, NAV_ITEM_TYPES, SORT_ORDERS, STATUSES, TEXT_ATTACHMENT_CONTENT_FORMATS, createApp, createMediaContext, defaultFeedRenderer, markdown_exports as markdown, time_exports as time, toArchiveGroups, toArchiveGroupsWithMedia, toMediaView, toNavItemView, toNavItemViews, toPostView, toPostViews, toSearchResultView, url_exports as url };
1
+ import { n as createApp } from "./app-CFsmRVJN.js";
2
+ export { createApp };
package/dist/node.js CHANGED
@@ -1,5 +1,4 @@
1
- import { K as getConfiguredStorageDriver, Q as getEnvString, R as now, U as getConfiguredSingleSiteOrigin, W as getConfiguredSingleSitePathPrefix, ct as getPort, dt as getTelegramWebhookSecret, et as getHostedControlPlaneBaseUrl, ft as shouldTrustProxy, lt as getSiteResolutionMode, s as createExportService, ut as getTelegramBotPool } from "./github-sync-Gw4orAHk.js";
2
- import { A as getFontThemeCssVariables, F as isAssetPath, M as buildThemeStyle, N as BUILTIN_COLOR_THEMES, O as BUILTIN_FONT_THEMES, P as getPublicAssetBasePath, _ as schema_exports, a as setUpNodeInstance, c as resolveDatabaseDialect, d as setMyCommands, f as setWebhook, g as createNodeDatabase, h as sqliteSchemaBundle, i as createNodeRequestRuntime, j as resolveCjkFontProfile, k as getCjkFontCssVariables, l as resolveConfig, m as pgSchemaBundle, n as createApp, o as createSiteService, p as createStorageDriver, r as createNodeCliRuntime, s as getHostBasedStartupConfigurationIssues, u as getWebhookUrl } from "./app-ZcaI1kPN.js";
1
+ import { A as BUILTIN_FONT_THEMES, C as getEnvString, D as getTelegramBotPool, E as getSiteResolutionMode, F as BUILTIN_COLOR_THEMES, I as getPublicAssetBasePath, L as isAssetPath, M as getFontThemeCssVariables, N as resolveCjkFontProfile, O as getTelegramWebhookSecret, P as buildThemeStyle, S as getConfiguredStorageDriver, T as getPort, _ as createNodeDatabase, a as setUpNodeInstance, b as getConfiguredSingleSiteOrigin, c as resolveDatabaseDialect, d as getWebhookUrl, f as setMyCommands, g as sqliteSchemaBundle, h as pgSchemaBundle, i as createNodeRequestRuntime, j as getCjkFontCssVariables, k as shouldTrustProxy, l as createExportService, m as createStorageDriver, n as createApp, o as createSiteService, p as setWebhook, r as createNodeCliRuntime, s as getHostBasedStartupConfigurationIssues, u as resolveConfig, v as schema_exports, w as getHostedControlPlaneBaseUrl, x as getConfiguredSingleSitePathPrefix, y as now } from "./app-CFsmRVJN.js";
3
2
  import { drizzle } from "drizzle-orm/better-sqlite3";
4
3
  import { serve } from "@hono/node-server";
5
4
  import Database from "better-sqlite3";
@@ -531,7 +530,7 @@ async function createNodeRequestHandler(options) {
531
530
  async function start(env = process.env, app) {
532
531
  const handler = await createNodeRequestHandler({
533
532
  env,
534
- app: async () => app ?? (await import("./app-ZcaI1kPN.js").then((n) => n.t)).createApp()
533
+ app: async () => app ?? (await import("./app-CFsmRVJN.js").then((n) => n.t)).createApp()
535
534
  });
536
535
  const hostname = resolveHost(env);
537
536
  const port = resolvePort(env);
@@ -0,0 +1,428 @@
1
+ //#region src/lib/url.ts
2
+ /**
3
+ * URL Utilities
4
+ */ function normalizeSitePathname(pathname) {
5
+ if (pathname === "/" || pathname === "") return "";
6
+ const trimmed = pathname.replace(/\/+$/, "");
7
+ return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
8
+ }
9
+ /**
10
+ * Normalize a configured public site path prefix.
11
+ *
12
+ * @param sitePathPrefix - Prefix such as `/blog` or `blog`
13
+ * @returns Normalized prefix like `/blog`, or an empty string when rooted
14
+ */ function normalizeSitePathPrefix(sitePathPrefix) {
15
+ return normalizeSitePathname(sitePathPrefix);
16
+ }
17
+ /**
18
+ * Extracts the hostname (domain) from a URL string.
19
+ *
20
+ * Parses a full URL and returns just the hostname portion (e.g., "example.com" from
21
+ * "https://example.com/path"). Returns `null` if the URL is malformed or cannot be parsed.
22
+ *
23
+ * @param url - The full URL string to extract the domain from
24
+ * @returns The hostname/domain if valid, or `null` if parsing fails
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const domain = extractDomain("https://www.example.com/path");
29
+ * // Returns: "www.example.com"
30
+ *
31
+ * const invalid = extractDomain("not-a-url");
32
+ * // Returns: null
33
+ * ```
34
+ */ function extractDomain(url) {
35
+ try {
36
+ return new URL(url).hostname;
37
+ } catch {
38
+ return null;
39
+ }
40
+ }
41
+ /**
42
+ * Normalizes a path by removing slashes and converting to lowercase.
43
+ *
44
+ * Trims whitespace, converts to lowercase, removes leading and trailing slashes,
45
+ * and collapses multiple consecutive slashes into single slashes. Used to create
46
+ * consistent path representations for routing and storage.
47
+ *
48
+ * @param path - The path string to normalize
49
+ * @returns The normalized path string
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const normalized = normalizePath(" /About/Contact// ");
54
+ * // Returns: "about/contact"
55
+ * ```
56
+ */ function normalizePath(path) {
57
+ return path.trim().toLowerCase().replace(/^\/+|\/+$/g, "").replace(/\/+/g, "/");
58
+ }
59
+ /**
60
+ * Checks if a string is a full URL with HTTP or HTTPS protocol.
61
+ *
62
+ * Validates whether a string starts with "http://" or "https://", indicating it's
63
+ * a full URL rather than a relative path. Useful for distinguishing between internal
64
+ * paths and external URLs.
65
+ *
66
+ * @param str - The string to check
67
+ * @returns `true` if the string starts with http:// or https://, `false` otherwise
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * isFullUrl("https://example.com"); // Returns: true
72
+ * isFullUrl("/about"); // Returns: false
73
+ * isFullUrl("example.com"); // Returns: false
74
+ * ```
75
+ */ function isFullUrl(str) {
76
+ return str.startsWith("http://") || str.startsWith("https://");
77
+ }
78
+ /**
79
+ * If a full URL points at the site's own host, return its same-site path
80
+ * (`pathname` + `search` + `hash`). Returns `null` when the input is not a full
81
+ * URL, is unparseable, or points at a different host.
82
+ *
83
+ * Self-referential absolute links — e.g. a nav item set to
84
+ * `https://example.com/about` on `example.com` — should behave like the
85
+ * internal path `/about`: no external-link icon, no `target="_blank"`.
86
+ *
87
+ * Matching is by **hostname**, not full origin: scheme and port differences are
88
+ * treated as same-site. This keeps the check intuitive ("same domain") and
89
+ * robust in dev, where the site is often served over `http://host:<port>` while
90
+ * a nav link stores the canonical `https://host` URL. In production (canonical
91
+ * https + default port) hostname match is equivalent to origin match.
92
+ *
93
+ * @param url - Candidate URL (full URL or relative path)
94
+ * @param siteOrigin - The site's own origin, e.g. `https://example.com`
95
+ * @returns The same-site path, or `null` when the URL is external/non-absolute
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * toSameSitePath("https://example.com/about", "https://example.com"); // "/about"
100
+ * toSameSitePath("https://example.com/about", "http://example.com:8787"); // "/about"
101
+ * toSameSitePath("https://other.com/about", "https://example.com"); // null
102
+ * toSameSitePath("/about", "https://example.com"); // null
103
+ * ```
104
+ */ function toSameSitePath(url, siteOrigin) {
105
+ if (!siteOrigin || !isFullUrl(url)) return null;
106
+ let parsed;
107
+ let reference;
108
+ try {
109
+ parsed = new URL(url);
110
+ reference = new URL(siteOrigin);
111
+ } catch {
112
+ return null;
113
+ }
114
+ if (parsed.hostname !== reference.hostname) return null;
115
+ return `${parsed.pathname}${parsed.search}${parsed.hash}` || "/";
116
+ }
117
+ /**
118
+ * Any `scheme:` at the start. `mailto:` and `tel:` address something real but
119
+ * never a page here, and an unrecognized scheme must not be read as a path.
120
+ */ var ANY_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
121
+ /**
122
+ * Convert an address the author pasted into an internal app path.
123
+ *
124
+ * Accepts what a browser address bar would produce — a full URL on one of the
125
+ * site's own origins, or a path — and returns the path the router resolves
126
+ * against: no site path prefix, no language prefix, rooted at `/`. Returns
127
+ * `null` for anything that is not a page on this site, so callers can tell an
128
+ * external link apart from a bad one.
129
+ *
130
+ * Case is left alone; storage-level normalization belongs to the path
131
+ * registry, which lowercases on its own terms.
132
+ *
133
+ * A full URL has to sit inside the deployment to count. A typed path does not:
134
+ * `/about` on a site served from `/blog` is the About page, because that is
135
+ * what someone typing it means.
136
+ *
137
+ * @param input - A full URL, or a path
138
+ * @param options - The site's origins, prefixes, and what to keep
139
+ * @returns Internal path rooted at `/`, or `null` when the address is not ours
140
+ * @example
141
+ * toInternalPath("https://example.com/blog/en/about", {
142
+ * siteOrigins: ["https://example.com"],
143
+ * sitePathPrefix: "/blog",
144
+ * languagePrefixes: ["en"],
145
+ * }); // "/about"
146
+ * toInternalPath("https://other.com/about", { siteOrigins: ["https://example.com"] }); // null
147
+ */ function toInternalPath(input, options = {}) {
148
+ const value = input.trim();
149
+ if (!value) return null;
150
+ const { siteOrigins = [], sitePathPrefix = "", languagePrefixes = [], keepQuery = false } = options;
151
+ const isFull = isFullUrl(value);
152
+ let candidate = null;
153
+ if (isFull) {
154
+ for (const origin of siteOrigins) {
155
+ const path = toSameSitePath(value, origin);
156
+ if (path !== null) {
157
+ candidate = path;
158
+ break;
159
+ }
160
+ }
161
+ if (candidate === null) return null;
162
+ } else if (value.startsWith("//") || ANY_SCHEME_RE.test(value) || value.startsWith("#")) return null;
163
+ else candidate = value;
164
+ let url;
165
+ try {
166
+ url = new URL(candidate, "https://jant.invalid");
167
+ } catch {
168
+ return null;
169
+ }
170
+ const withoutSite = stripSitePathPrefix(url.pathname, normalizeSitePathPrefix(sitePathPrefix));
171
+ if (withoutSite === null && isFull) return null;
172
+ const internal = stripLanguagePrefix(withoutSite ?? url.pathname, languagePrefixes);
173
+ const trimmed = internal.length > 1 ? internal.replace(/\/+$/, "") || "/" : internal;
174
+ return keepQuery ? `${trimmed}${url.search}${url.hash}` : trimmed;
175
+ }
176
+ /** Drop a leading `/en`-style segment when the site serves that language. */ function stripLanguagePrefix(pathname, languagePrefixes) {
177
+ if (languagePrefixes.length === 0) return pathname;
178
+ const rest = pathname.startsWith("/") ? pathname.slice(1) : pathname;
179
+ const slash = rest.indexOf("/");
180
+ const first = (slash === -1 ? rest : rest.slice(0, slash)).toLowerCase();
181
+ if (!first) return pathname;
182
+ if (!languagePrefixes.some((prefix) => prefix.toLowerCase() === first)) return pathname;
183
+ return slash === -1 ? "/" : rest.slice(slash);
184
+ }
185
+ /**
186
+ * Extracts a human-friendly domain name from a URL for display purposes.
187
+ *
188
+ * Parses the URL, strips common prefixes (`www.`, `m.`, `mobile.`), and returns
189
+ * a clean domain. Returns `null` if the URL is malformed.
190
+ *
191
+ * @param url - The full URL string
192
+ * @returns A display-friendly domain string, or `null` if parsing fails
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * extractDisplayDomain("https://www.example.com/path");
197
+ * // Returns: "example.com"
198
+ *
199
+ * extractDisplayDomain("https://m.wikipedia.org/wiki/Test");
200
+ * // Returns: "wikipedia.org"
201
+ *
202
+ * extractDisplayDomain("https://blog.example.com");
203
+ * // Returns: "blog.example.com"
204
+ * ```
205
+ */ function extractDisplayDomain(url) {
206
+ const hostname = extractDomain(url);
207
+ if (!hostname) return null;
208
+ return hostname.replace(/^(?:www|m|mobile)\./, "");
209
+ }
210
+ var SAFE_URL_PROTOCOLS = /* @__PURE__ */ new Set([
211
+ "http:",
212
+ "https:",
213
+ "mailto:"
214
+ ]);
215
+ var SAFE_RICH_TEXT_HREF_PROTOCOLS = /* @__PURE__ */ new Set([
216
+ ...SAFE_URL_PROTOCOLS,
217
+ "tel:",
218
+ "sms:"
219
+ ]);
220
+ function sanitizeUrlWithProtocols(url, protocols) {
221
+ try {
222
+ const parsed = new URL(url, "https://placeholder.invalid");
223
+ if (protocols.has(parsed.protocol)) return url;
224
+ return "";
225
+ } catch {
226
+ return "";
227
+ }
228
+ }
229
+ /**
230
+ * Sanitizes a URL by ensuring it uses a safe protocol.
231
+ *
232
+ * Returns the URL unchanged if it uses an allowed protocol (http:, https:, mailto:)
233
+ * or is a relative path. Returns an empty string for dangerous protocols like
234
+ * `javascript:`, `data:`, or `vbscript:`.
235
+ *
236
+ * @param url - The URL string to sanitize
237
+ * @returns The original URL if safe, or an empty string if the protocol is disallowed
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * sanitizeUrl("https://example.com"); // "https://example.com"
242
+ * sanitizeUrl("/about"); // "/about"
243
+ * sanitizeUrl("javascript:alert(1)"); // ""
244
+ * sanitizeUrl("data:text/html,<h1>Hi</h1>"); // ""
245
+ * ```
246
+ */ function sanitizeUrl(url) {
247
+ return sanitizeUrlWithProtocols(url, SAFE_URL_PROTOCOLS);
248
+ }
249
+ /**
250
+ * Sanitizes a rich-text link destination.
251
+ *
252
+ * In addition to safe web and email URLs, rich-text links may launch the
253
+ * device's phone or messaging app through `tel:` and `sms:`. Relative links
254
+ * remain valid, while executable and resource-only protocols are rejected.
255
+ *
256
+ * @param url - The link destination to sanitize
257
+ * @returns The original URL if safe for an anchor, or an empty string otherwise
258
+ *
259
+ * @example
260
+ * ```ts
261
+ * sanitizeRichTextHref("sms:+15551234567"); // "sms:+15551234567"
262
+ * sanitizeRichTextHref("javascript:alert(1)"); // ""
263
+ * ```
264
+ */ function sanitizeRichTextHref(url) {
265
+ return sanitizeUrlWithProtocols(url, SAFE_RICH_TEXT_HREF_PROTOCOLS);
266
+ }
267
+ /**
268
+ * Normalize a public site URL by stripping any trailing slash from the path.
269
+ *
270
+ * @param siteUrl - Full site URL, optionally with a path prefix
271
+ * @returns Normalized site URL, or an empty string when not configured
272
+ */ function normalizeSiteUrl(siteUrl) {
273
+ const trimmed = siteUrl.trim();
274
+ if (!trimmed) return "";
275
+ const parsed = new URL(trimmed);
276
+ parsed.pathname = normalizeSitePathname(parsed.pathname) || "/";
277
+ if (parsed.pathname !== "/") parsed.pathname = parsed.pathname.replace(/\/+$/, "");
278
+ return parsed.toString().replace(/\/$/, parsed.pathname === "/" ? "/" : "");
279
+ }
280
+ /**
281
+ * Extract the public path prefix from a full site URL.
282
+ *
283
+ * @param siteUrl - Full site URL
284
+ * @returns Prefix like `/blog`, or an empty string when the site is rooted
285
+ */ function getSitePathPrefix(siteUrl) {
286
+ if (!siteUrl.trim()) return "";
287
+ return normalizeSitePathname(new URL(siteUrl).pathname);
288
+ }
289
+ /**
290
+ * Extract the origin from a full site URL.
291
+ *
292
+ * @param siteUrl - Full site URL
293
+ * @returns Origin like `https://example.com`, or an empty string when missing
294
+ */ function getSiteOrigin(siteUrl) {
295
+ if (!siteUrl.trim()) return "";
296
+ return new URL(siteUrl).origin;
297
+ }
298
+ /**
299
+ * Build a normalized public site URL from an origin and optional path prefix.
300
+ *
301
+ * @param siteOrigin - Public site origin, such as `https://example.com`
302
+ * @param sitePathPrefix - Public site path prefix, such as `/blog`
303
+ * @returns Normalized site URL, or an empty string when no origin is configured
304
+ */ function buildSiteUrl(siteOrigin, sitePathPrefix = "") {
305
+ const trimmedOrigin = siteOrigin.trim();
306
+ if (!trimmedOrigin) return "";
307
+ const origin = new URL(trimmedOrigin).origin;
308
+ return normalizeSiteUrl(`${origin}${normalizeSitePathPrefix(sitePathPrefix) || "/"}`);
309
+ }
310
+ /**
311
+ * Prefix an internal app path with the public site path prefix.
312
+ *
313
+ * Internal paths are always rooted at `/` and never include the deployment
314
+ * prefix. This helper converts them to public-facing paths.
315
+ *
316
+ * @param path - Internal app path, such as `/settings`
317
+ * @param sitePathPrefix - Public site path prefix, such as `/blog`
318
+ * @returns Public path
319
+ */ function toPublicPath(path, sitePathPrefix = "") {
320
+ if (!path) return sitePathPrefix || "/";
321
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
322
+ if (!sitePathPrefix) return normalizedPath;
323
+ if (normalizedPath === sitePathPrefix || normalizedPath.startsWith(`${sitePathPrefix}/`)) return normalizedPath;
324
+ if (normalizedPath === "/") return sitePathPrefix;
325
+ return `${sitePathPrefix}${normalizedPath}`;
326
+ }
327
+ /**
328
+ * The internal path a Post is served at: its oldest custom path when it has
329
+ * one, else its slug.
330
+ *
331
+ * This is the Post's permalink before the site path prefix, and so the `<id>`
332
+ * of its Atom entry. The Hugo export writes that `<id>` into front matter so
333
+ * an exported feed keeps it, which is why the rule lives here rather than
334
+ * inside `toPostView`.
335
+ *
336
+ * @param slug - The Post's current slug
337
+ * @param aliasPath - Its oldest custom path, `paths.getPostAliases()`'s first
338
+ * @returns Internal path rooted at `/`
339
+ * @example
340
+ * getPostPath("xta29"); // "/xta29"
341
+ * getPostPath("links-4", "/blog/links/4"); // "/blog/links/4"
342
+ */ function getPostPath(slug, aliasPath) {
343
+ return aliasPath ?? `/${slug}`;
344
+ }
345
+ /**
346
+ * Convert an app-local href to its public path while leaving external URLs
347
+ * unchanged.
348
+ *
349
+ * @param href - Internal app path or external URL
350
+ * @param sitePathPrefix - Public site path prefix
351
+ * @returns Public-facing href
352
+ */ function toPublicHref(href, sitePathPrefix = "") {
353
+ if (href.startsWith("http://") || href.startsWith("https://") || href.startsWith("//") || href.startsWith("mailto:") || href.startsWith("tel:") || href.startsWith("#")) return href;
354
+ return toPublicPath(href, sitePathPrefix);
355
+ }
356
+ /**
357
+ * Check whether a path is a safe same-origin redirect target.
358
+ *
359
+ * Accepts only paths that start with a single `/` (no protocol-relative
360
+ * `//host`, no scheme, no control characters). Callers should use this to
361
+ * validate user-supplied `redirect` query parameters before issuing a
362
+ * `Location` header.
363
+ *
364
+ * @param path - Candidate redirect path
365
+ * @returns `true` when the path is safe to use as an internal redirect
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * isSafeInternalRedirect("/settings") // true
370
+ * isSafeInternalRedirect("//evil.example") // false
371
+ * isSafeInternalRedirect("https://evil.example") // false
372
+ * ```
373
+ */ function isSafeInternalRedirect(path) {
374
+ if (typeof path !== "string") return false;
375
+ if (!path.startsWith("/")) return false;
376
+ if (path.startsWith("//")) return false;
377
+ if (path.startsWith("/\\")) return false;
378
+ for (let i = 0; i < path.length; i += 1) {
379
+ const code = path.charCodeAt(i);
380
+ if (code < 32 || code === 127) return false;
381
+ }
382
+ return true;
383
+ }
384
+ /**
385
+ * Remove the site path prefix from a public request pathname.
386
+ *
387
+ * @param pathname - Public request pathname
388
+ * @param sitePathPrefix - Configured public site path prefix
389
+ * @returns Internal pathname, or `null` when the request is outside the site
390
+ */ function stripSitePathPrefix(pathname, sitePathPrefix) {
391
+ if (!sitePathPrefix) return pathname || "/";
392
+ if (pathname === sitePathPrefix) return "/";
393
+ if (pathname.startsWith(`${sitePathPrefix}/`)) return pathname.slice(sitePathPrefix.length) || "/";
394
+ return null;
395
+ }
396
+ /**
397
+ * Convert an internal or public path into an absolute site URL.
398
+ *
399
+ * @param path - Internal app path or already-public path
400
+ * @param siteUrl - Normalized site URL
401
+ * @param sitePathPrefix - Public site path prefix
402
+ * @returns Absolute URL when siteUrl is configured, otherwise the original path
403
+ */ function toAbsoluteSiteUrl(path, siteUrl, sitePathPrefix = "") {
404
+ if (!siteUrl) return toPublicPath(path, sitePathPrefix);
405
+ return new URL(toPublicPath(path, sitePathPrefix), siteUrl).toString();
406
+ }
407
+ /**
408
+ * Resolve a possibly-relative asset URL to an absolute URL, leaving
409
+ * already-absolute (`http(s):`) and protocol-relative (`//host`) URLs
410
+ * untouched. Use for assets — like media — whose stored URL may be either an
411
+ * app-local path or a full CDN URL.
412
+ *
413
+ * @param url - Asset URL: an internal path or an already-absolute URL
414
+ * @param siteUrl - Normalized site URL
415
+ * @param sitePathPrefix - Public site path prefix
416
+ * @returns Absolute URL, or the original value when it is already absolute
417
+ *
418
+ * @example
419
+ * ```ts
420
+ * toAbsoluteAssetUrl("/m/a.png", "https://site.com"); // "https://site.com/m/a.png"
421
+ * toAbsoluteAssetUrl("https://cdn.example/a.png", "x"); // "https://cdn.example/a.png"
422
+ * ```
423
+ */ function toAbsoluteAssetUrl(url, siteUrl, sitePathPrefix = "") {
424
+ if (isFullUrl(url) || url.startsWith("//")) return url;
425
+ return toAbsoluteSiteUrl(url, siteUrl, sitePathPrefix);
426
+ }
427
+ //#endregion
428
+ export { toInternalPath as _, getSiteOrigin as a, toSameSitePath as b, isSafeInternalRedirect as c, normalizeSiteUrl as d, sanitizeRichTextHref as f, toAbsoluteSiteUrl as g, toAbsoluteAssetUrl as h, getPostPath as i, normalizePath as l, stripSitePathPrefix as m, extractDisplayDomain as n, getSitePathPrefix as o, sanitizeUrl as p, extractDomain as r, isFullUrl as s, buildSiteUrl as t, normalizeSitePathPrefix as u, toPublicHref as v, toPublicPath as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,10 +8,6 @@
8
8
  "types": "./src/index.ts",
9
9
  "default": "./dist/index.js"
10
10
  },
11
- "./node": {
12
- "types": "./src/node/index.ts",
13
- "default": "./dist/node.js"
14
- },
15
11
  "./i18n": "./src/i18n/index.ts"
16
12
  },
17
13
  "bin": {
@@ -0,0 +1,144 @@
1
+ /**
2
+ * The `jant` CLI's public surface matches its registry, its help, and its
3
+ * documentation.
4
+ *
5
+ * `bin/lib/command-registry.js` sorts every command into public (part of the
6
+ * compatibility promise, documented in `docs/cli.md`) or internal (build and
7
+ * operations tooling, left out of help). The CLI dispatches whatever file
8
+ * exists under `bin/commands/`, so without this test a new command would ship
9
+ * unclassified, and a renamed option would leave the documentation describing
10
+ * one that no longer parses.
11
+ *
12
+ * Options are compared as help prints them: a line of `jant <command> --help`
13
+ * that opens with an option defines it. In `docs/cli.md`, the first cell of an
14
+ * option table row lists the options it describes.
15
+ */
16
+
17
+ import { execFileSync } from "node:child_process";
18
+ import { readdirSync, readFileSync } from "node:fs";
19
+ import { join, relative, resolve } from "node:path";
20
+ import { beforeAll, describe, expect, it } from "vitest";
21
+ import {
22
+ INTERNAL_COMMANDS,
23
+ listPublicCommandNames,
24
+ } from "../../bin/lib/command-registry.js";
25
+
26
+ const CORE_DIR = resolve(import.meta.dirname, "../..");
27
+ const REPO_ROOT = resolve(CORE_DIR, "../..");
28
+ const COMMANDS_DIR = join(CORE_DIR, "bin/commands");
29
+ const CLI_DOCS = ["docs/cli.md", "docs/zh-Hans/cli.md"];
30
+
31
+ function listCommandFiles(dir: string): string[] {
32
+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
33
+ const fullPath = join(dir, entry.name);
34
+ if (entry.isDirectory()) return listCommandFiles(fullPath);
35
+ if (!entry.isFile() || !entry.name.endsWith(".js")) return [];
36
+ return [
37
+ relative(COMMANDS_DIR, fullPath)
38
+ .replace(/\\/g, "/")
39
+ .replace(/\.js$/, "")
40
+ .split("/")
41
+ .join(" "),
42
+ ];
43
+ });
44
+ }
45
+
46
+ function readHelp(command: string): string {
47
+ return execFileSync(
48
+ "node",
49
+ ["bin/jant.js", ...command.split(" "), "--help"],
50
+ {
51
+ cwd: CORE_DIR,
52
+ encoding: "utf8",
53
+ env: { ...process.env, JANT_ENV_FILE: "" },
54
+ },
55
+ );
56
+ }
57
+
58
+ function optionsInHelp(help: string): string[] {
59
+ const options = new Set<string>();
60
+ for (const line of help.split("\n")) {
61
+ const match = /^\s+(?:-[a-zA-Z], )?(--[a-z][a-z-]*)/.exec(line);
62
+ if (match?.[1] && match[1] !== "--help") options.add(match[1]);
63
+ }
64
+ return [...options].sort();
65
+ }
66
+
67
+ /** Documented options per command, keyed by the name in its `### jant …` heading. */
68
+ function readDocumentedCommands(path: string): Map<string, string[]> {
69
+ const commands = new Map<string, Set<string>>();
70
+ let current: Set<string> | null = null;
71
+ for (const line of readFileSync(join(REPO_ROOT, path), "utf8").split("\n")) {
72
+ const heading = /^#{2,3} /.test(line);
73
+ if (heading) {
74
+ const match = /^### `jant (.+)`$/.exec(line);
75
+ current = match?.[1] ? new Set() : null;
76
+ if (match?.[1]) commands.set(match[1], current as Set<string>);
77
+ continue;
78
+ }
79
+ if (!current || !line.startsWith("|")) continue;
80
+ const firstCell = line.split("|")[1] ?? "";
81
+ for (const option of firstCell.matchAll(/`(--[a-z][a-z-]*)`/g)) {
82
+ if (option[1]) current.add(option[1]);
83
+ }
84
+ }
85
+ return new Map(
86
+ [...commands].map(([name, options]) => [name, [...options].sort()]),
87
+ );
88
+ }
89
+
90
+ describe("jant CLI surface", () => {
91
+ const publicCommands = listPublicCommandNames();
92
+ const helpByCommand = new Map<string, string>();
93
+
94
+ beforeAll(() => {
95
+ for (const command of publicCommands) {
96
+ helpByCommand.set(command, readHelp(command));
97
+ }
98
+ });
99
+
100
+ it("classifies every command file as public or internal, once", () => {
101
+ const classified = [...publicCommands, ...INTERNAL_COMMANDS];
102
+ expect(new Set(classified).size).toBe(classified.length);
103
+ expect(listCommandFiles(COMMANDS_DIR).sort()).toEqual(
104
+ [...classified].sort(),
105
+ );
106
+ });
107
+
108
+ it("prints each public command's usage under its own name", () => {
109
+ for (const command of publicCommands) {
110
+ expect(helpByCommand.get(command)?.split("\n")[0]).toMatch(
111
+ new RegExp(`^Usage: jant ${command}( |$)`),
112
+ );
113
+ }
114
+ });
115
+
116
+ it("lists only public commands in jant --help", () => {
117
+ const help = execFileSync("node", ["bin/jant.js", "--help"], {
118
+ cwd: CORE_DIR,
119
+ encoding: "utf8",
120
+ });
121
+ for (const command of publicCommands) {
122
+ expect(help).toContain(` ${command} `);
123
+ }
124
+ for (const command of INTERNAL_COMMANDS) {
125
+ expect(help).not.toContain(` ${command} `);
126
+ }
127
+ });
128
+
129
+ for (const path of CLI_DOCS) {
130
+ it(`${path} documents each public command with the options its help lists`, () => {
131
+ const documented = readDocumentedCommands(path);
132
+ expect([...documented.keys()]).toEqual(publicCommands);
133
+ for (const command of publicCommands) {
134
+ expect(
135
+ { command, options: documented.get(command) },
136
+ `${path}: jant ${command}`,
137
+ ).toEqual({
138
+ command,
139
+ options: optionsInHelp(helpByCommand.get(command) ?? ""),
140
+ });
141
+ }
142
+ });
143
+ }
144
+ });