@geekity/cms 0.42.0 → 0.42.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 (728) hide show
  1. package/dist/admin/admin-bar.d.ts +2 -3
  2. package/dist/admin/admin-bar.d.ts.map +1 -1
  3. package/dist/admin/admin-bar.js +4 -5
  4. package/dist/admin/admin-bar.js.map +1 -1
  5. package/dist/admin/app-activity.d.ts +1 -1
  6. package/dist/admin/appearance.d.ts +5 -5
  7. package/dist/admin/appearance.js +5 -5
  8. package/dist/admin/comments.d.ts +3 -3
  9. package/dist/admin/comments.js +2 -2
  10. package/dist/admin/comments.js.map +1 -1
  11. package/dist/admin/connected-apps.d.ts +1 -1
  12. package/dist/admin/connected-apps.js +1 -1
  13. package/dist/admin/credentials.d.ts +3 -3
  14. package/dist/admin/credentials.js +3 -3
  15. package/dist/admin/dashboard.js +2 -2
  16. package/dist/admin/dashboard.js.map +1 -1
  17. package/dist/admin/documents.d.ts +4 -4
  18. package/dist/admin/documents.d.ts.map +1 -1
  19. package/dist/admin/documents.js +150 -144
  20. package/dist/admin/documents.js.map +1 -1
  21. package/dist/admin/editor-actions.d.ts +1 -1
  22. package/dist/admin/editor-actions.js +1 -1
  23. package/dist/admin/federation.d.ts +11 -11
  24. package/dist/admin/federation.d.ts.map +1 -1
  25. package/dist/admin/federation.js +10 -10
  26. package/dist/admin/flash.d.ts +8 -0
  27. package/dist/admin/flash.d.ts.map +1 -1
  28. package/dist/admin/flash.js +11 -0
  29. package/dist/admin/flash.js.map +1 -1
  30. package/dist/admin/indieauth-consent.d.ts +1 -1
  31. package/dist/admin/indieauth-consent.js +1 -1
  32. package/dist/admin/legacy-migrations.d.ts +20 -19
  33. package/dist/admin/legacy-migrations.d.ts.map +1 -1
  34. package/dist/admin/legacy-migrations.js +14 -13
  35. package/dist/admin/legacy-migrations.js.map +1 -1
  36. package/dist/admin/media.js +1 -1
  37. package/dist/admin/menu.d.ts +1 -1
  38. package/dist/admin/menu.js +4 -4
  39. package/dist/admin/menu.js.map +1 -1
  40. package/dist/admin/messages.d.ts +2 -2
  41. package/dist/admin/messages.js +2 -2
  42. package/dist/admin/navigation.d.ts +3 -3
  43. package/dist/admin/navigation.js +3 -3
  44. package/dist/admin/personal-data.d.ts +1 -1
  45. package/dist/admin/personal-data.js +1 -1
  46. package/dist/admin/plugins.d.ts +1 -1
  47. package/dist/admin/plugins.js +1 -1
  48. package/dist/admin/preview.js +3 -3
  49. package/dist/admin/preview.js.map +1 -1
  50. package/dist/admin/recovery.d.ts +1 -1
  51. package/dist/admin/recovery.js +1 -1
  52. package/dist/admin/routes.d.ts +3 -3
  53. package/dist/admin/routes.js +14 -14
  54. package/dist/admin/routes.js.map +1 -1
  55. package/dist/admin/settings-discussion.d.ts +3 -3
  56. package/dist/admin/settings-discussion.js +3 -3
  57. package/dist/admin/settings-federation.d.ts +2 -2
  58. package/dist/admin/settings-federation.js +5 -5
  59. package/dist/admin/settings-federation.js.map +1 -1
  60. package/dist/admin/settings-general.d.ts +1 -1
  61. package/dist/admin/settings-general.js +2 -2
  62. package/dist/admin/settings-general.js.map +1 -1
  63. package/dist/admin/settings-page.d.ts +2 -2
  64. package/dist/admin/settings-page.js +1 -1
  65. package/dist/admin/settings-pages.d.ts +1 -1
  66. package/dist/admin/settings-pages.js +1 -1
  67. package/dist/admin/settings-reading.d.ts +2 -2
  68. package/dist/admin/settings-reading.js +2 -2
  69. package/dist/admin/syndication-targets.d.ts +2 -2
  70. package/dist/admin/syndication-targets.js +2 -2
  71. package/dist/admin/taxonomy.d.ts +4 -4
  72. package/dist/admin/taxonomy.js +4 -4
  73. package/dist/admin/templates.d.ts +2 -2
  74. package/dist/admin/templates.js +2 -2
  75. package/dist/admin/tools.d.ts +1 -1
  76. package/dist/admin/tools.js +1 -1
  77. package/dist/admin/users.d.ts +0 -159
  78. package/dist/admin/users.d.ts.map +1 -1
  79. package/dist/admin/users.js +204 -498
  80. package/dist/admin/users.js.map +1 -1
  81. package/dist/avatars/avatars.d.ts +2 -2
  82. package/dist/avatars/avatars.js +2 -2
  83. package/dist/cache.d.ts +1 -1
  84. package/dist/cache.js +1 -1
  85. package/dist/cli/args.d.ts +20 -0
  86. package/dist/cli/args.d.ts.map +1 -0
  87. package/dist/cli/args.js +138 -0
  88. package/dist/cli/args.js.map +1 -0
  89. package/dist/cli/commands.d.ts +10 -0
  90. package/dist/cli/commands.d.ts.map +1 -0
  91. package/dist/cli/commands.js +261 -0
  92. package/dist/cli/commands.js.map +1 -0
  93. package/dist/cli/database-in-use.d.ts +9 -0
  94. package/dist/cli/database-in-use.d.ts.map +1 -0
  95. package/dist/cli/database-in-use.js +38 -0
  96. package/dist/cli/database-in-use.js.map +1 -0
  97. package/dist/cli/dev-mode.d.ts +3 -0
  98. package/dist/cli/dev-mode.d.ts.map +1 -0
  99. package/dist/cli/dev-mode.js +31 -0
  100. package/dist/cli/dev-mode.js.map +1 -0
  101. package/dist/cli/export.d.ts +3 -0
  102. package/dist/cli/export.d.ts.map +1 -0
  103. package/dist/cli/export.js +53 -0
  104. package/dist/cli/export.js.map +1 -0
  105. package/dist/cli/format.d.ts +3 -0
  106. package/dist/cli/format.d.ts.map +1 -0
  107. package/dist/cli/format.js +10 -0
  108. package/dist/cli/format.js.map +1 -0
  109. package/dist/cli/gemini.d.ts +3 -0
  110. package/dist/cli/gemini.d.ts.map +1 -0
  111. package/dist/cli/gemini.js +34 -0
  112. package/dist/cli/gemini.js.map +1 -0
  113. package/dist/cli/help.d.ts +2 -0
  114. package/dist/cli/help.d.ts.map +1 -0
  115. package/dist/cli/help.js +111 -0
  116. package/dist/cli/help.js.map +1 -0
  117. package/dist/cli/import.d.ts +3 -0
  118. package/dist/cli/import.d.ts.map +1 -0
  119. package/dist/cli/import.js +84 -0
  120. package/dist/cli/import.js.map +1 -0
  121. package/dist/cli/init.d.ts +3 -0
  122. package/dist/cli/init.d.ts.map +1 -0
  123. package/dist/cli/init.js +21 -0
  124. package/dist/cli/init.js.map +1 -0
  125. package/dist/cli/maintenance.d.ts +3 -0
  126. package/dist/cli/maintenance.d.ts.map +1 -0
  127. package/dist/cli/maintenance.js +57 -0
  128. package/dist/cli/maintenance.js.map +1 -0
  129. package/dist/cli/options.d.ts +16 -0
  130. package/dist/cli/options.d.ts.map +1 -0
  131. package/dist/cli/options.js +27 -0
  132. package/dist/cli/options.js.map +1 -0
  133. package/dist/cli/password.d.ts +21 -0
  134. package/dist/cli/password.d.ts.map +1 -0
  135. package/dist/cli/password.js +52 -0
  136. package/dist/cli/password.js.map +1 -0
  137. package/dist/cli/plugin-commands.d.ts +11 -0
  138. package/dist/cli/plugin-commands.d.ts.map +1 -0
  139. package/dist/cli/plugin-commands.js +79 -0
  140. package/dist/cli/plugin-commands.js.map +1 -0
  141. package/dist/cli/plugin-folder.d.ts +3 -0
  142. package/dist/cli/plugin-folder.d.ts.map +1 -0
  143. package/dist/cli/plugin-folder.js +93 -0
  144. package/dist/cli/plugin-folder.js.map +1 -0
  145. package/dist/cli/rebuild.d.ts +5 -0
  146. package/dist/cli/rebuild.d.ts.map +1 -0
  147. package/dist/cli/rebuild.js +44 -0
  148. package/dist/cli/rebuild.js.map +1 -0
  149. package/dist/cli/resend.d.ts +3 -0
  150. package/dist/cli/resend.d.ts.map +1 -0
  151. package/dist/cli/resend.js +36 -0
  152. package/dist/cli/resend.js.map +1 -0
  153. package/dist/cli/run-job.d.ts +5 -0
  154. package/dist/cli/run-job.d.ts.map +1 -0
  155. package/dist/cli/run-job.js +29 -0
  156. package/dist/cli/run-job.js.map +1 -0
  157. package/dist/cli/serve.d.ts +3 -0
  158. package/dist/cli/serve.d.ts.map +1 -0
  159. package/dist/cli/serve.js +65 -0
  160. package/dist/cli/serve.js.map +1 -0
  161. package/dist/cli/settings.d.ts +5 -0
  162. package/dist/cli/settings.d.ts.map +1 -0
  163. package/dist/cli/settings.js +144 -0
  164. package/dist/cli/settings.js.map +1 -0
  165. package/dist/cli/site-plugins.d.ts +5 -0
  166. package/dist/cli/site-plugins.d.ts.map +1 -0
  167. package/dist/cli/site-plugins.js +7 -0
  168. package/dist/cli/site-plugins.js.map +1 -0
  169. package/dist/cli/strip-metadata.d.ts +3 -0
  170. package/dist/cli/strip-metadata.d.ts.map +1 -0
  171. package/dist/cli/strip-metadata.js +20 -0
  172. package/dist/cli/strip-metadata.js.map +1 -0
  173. package/dist/cli/sync.d.ts +3 -0
  174. package/dist/cli/sync.d.ts.map +1 -0
  175. package/dist/cli/sync.js +22 -0
  176. package/dist/cli/sync.js.map +1 -0
  177. package/dist/cli/user.d.ts +3 -0
  178. package/dist/cli/user.d.ts.map +1 -0
  179. package/dist/cli/user.js +54 -0
  180. package/dist/cli/user.js.map +1 -0
  181. package/dist/cli.d.ts +0 -62
  182. package/dist/cli.d.ts.map +1 -1
  183. package/dist/cli.js +6 -1566
  184. package/dist/cli.js.map +1 -1
  185. package/dist/cms/app.js +10 -10
  186. package/dist/cms/app.js.map +1 -1
  187. package/dist/cms/boot.js +5 -5
  188. package/dist/cms/boot.js.map +1 -1
  189. package/dist/cms/create.d.ts +17 -17
  190. package/dist/cms/create.d.ts.map +1 -1
  191. package/dist/cms/create.js +1 -1
  192. package/dist/cms/create.js.map +1 -1
  193. package/dist/cms/server-error.d.ts +1 -1
  194. package/dist/cms/server-error.js +1 -1
  195. package/dist/cms/services.js +14 -14
  196. package/dist/cms/services.js.map +1 -1
  197. package/dist/comments/akismet.d.ts +4 -4
  198. package/dist/comments/akismet.js +6 -6
  199. package/dist/comments/akismet.js.map +1 -1
  200. package/dist/comments/conversation.d.ts +29 -29
  201. package/dist/comments/conversation.d.ts.map +1 -1
  202. package/dist/comments/conversation.js +2 -2
  203. package/dist/comments/conversation.js.map +1 -1
  204. package/dist/comments/form.d.ts +3 -3
  205. package/dist/comments/form.d.ts.map +1 -1
  206. package/dist/comments/intake.d.ts +4 -4
  207. package/dist/comments/intake.d.ts.map +1 -1
  208. package/dist/comments/intake.js +1 -1
  209. package/dist/comments/migrations.d.ts +3 -3
  210. package/dist/comments/migrations.js +3 -3
  211. package/dist/comments/moderate.d.ts +2 -2
  212. package/dist/comments/moderate.js +2 -2
  213. package/dist/comments/page-form.d.ts +1 -1
  214. package/dist/comments/page-form.js +1 -1
  215. package/dist/comments/records.d.ts +9 -9
  216. package/dist/comments/records.d.ts.map +1 -1
  217. package/dist/comments/records.js +11 -10
  218. package/dist/comments/records.js.map +1 -1
  219. package/dist/comments/reply-notices.d.ts +2 -2
  220. package/dist/comments/reply-post.d.ts +2 -2
  221. package/dist/comments/submission.d.ts +8 -8
  222. package/dist/comments/submission.d.ts.map +1 -1
  223. package/dist/comments/submission.js +9 -9
  224. package/dist/comments/submission.js.map +1 -1
  225. package/dist/config.d.ts +27 -27
  226. package/dist/config.js +3 -3
  227. package/dist/contact/index.d.ts +1 -1
  228. package/dist/contact/index.js +1 -1
  229. package/dist/contact/records.d.ts +7 -7
  230. package/dist/contact/records.js +7 -7
  231. package/dist/content/alt-text.d.ts +2 -2
  232. package/dist/content/alt-text.js +2 -2
  233. package/dist/content/authors.d.ts +6 -6
  234. package/dist/content/authors.d.ts.map +1 -1
  235. package/dist/content/authors.js +6 -6
  236. package/dist/content/authors.js.map +1 -1
  237. package/dist/content/citation.d.ts +1 -1
  238. package/dist/content/content-tree.d.ts +5 -0
  239. package/dist/content/content-tree.d.ts.map +1 -0
  240. package/dist/content/content-tree.js +54 -0
  241. package/dist/content/content-tree.js.map +1 -0
  242. package/dist/content/content-watcher.d.ts +15 -0
  243. package/dist/content/content-watcher.d.ts.map +1 -0
  244. package/dist/content/content-watcher.js +104 -0
  245. package/dist/content/content-watcher.js.map +1 -0
  246. package/dist/content/document-form.d.ts +25 -24
  247. package/dist/content/document-form.d.ts.map +1 -1
  248. package/dist/content/document-form.js +7 -7
  249. package/dist/content/document-form.js.map +1 -1
  250. package/dist/content/document-kind.d.ts +6 -6
  251. package/dist/content/document.d.ts +1 -1
  252. package/dist/content/enclosure-form.js +1 -1
  253. package/dist/content/enclosure.js +1 -1
  254. package/dist/content/event-form.d.ts +2 -2
  255. package/dist/content/event.d.ts +3 -3
  256. package/dist/content/event.js +3 -3
  257. package/dist/content/guids.d.ts +6 -6
  258. package/dist/content/guids.d.ts.map +1 -1
  259. package/dist/content/guids.js +7 -7
  260. package/dist/content/guids.js.map +1 -1
  261. package/dist/content/handles.d.ts +1 -1
  262. package/dist/content/handles.js +1 -1
  263. package/dist/content/html-to-markdown.js +2 -2
  264. package/dist/content/language.d.ts +1 -1
  265. package/dist/content/language.js +1 -1
  266. package/dist/content/locale.d.ts +1 -1
  267. package/dist/content/locale.js +1 -1
  268. package/dist/content/markdown.d.ts +1 -1
  269. package/dist/content/markdown.js +1 -1
  270. package/dist/content/parser.d.ts +1 -1
  271. package/dist/content/parser.d.ts.map +1 -1
  272. package/dist/content/permalinks.d.ts +4 -4
  273. package/dist/content/permalinks.js +4 -4
  274. package/dist/content/photo-form.js +2 -2
  275. package/dist/content/photo.d.ts +2 -2
  276. package/dist/content/photo.js +1 -1
  277. package/dist/content/pinned.d.ts +3 -3
  278. package/dist/content/pinned.js +3 -3
  279. package/dist/content/post-fields.js +2 -2
  280. package/dist/content/post-fields.js.map +1 -1
  281. package/dist/content/post-type.d.ts +4 -4
  282. package/dist/content/post-type.js +1 -1
  283. package/dist/content/reconcile.d.ts +15 -0
  284. package/dist/content/reconcile.d.ts.map +1 -0
  285. package/dist/content/reconcile.js +106 -0
  286. package/dist/content/reconcile.js.map +1 -0
  287. package/dist/content/redirects.d.ts +2 -3
  288. package/dist/content/redirects.d.ts.map +1 -1
  289. package/dist/content/redirects.js +2 -3
  290. package/dist/content/redirects.js.map +1 -1
  291. package/dist/content/rsvp.d.ts +1 -1
  292. package/dist/content/rsvp.js +1 -1
  293. package/dist/content/sanitize.js +1 -1
  294. package/dist/content/save.d.ts +3 -3
  295. package/dist/content/save.js +4 -4
  296. package/dist/content/scan.d.ts +12 -0
  297. package/dist/content/scan.d.ts.map +1 -0
  298. package/dist/content/scan.js +58 -0
  299. package/dist/content/scan.js.map +1 -0
  300. package/dist/content/search.d.ts +3 -3
  301. package/dist/content/search.js +3 -3
  302. package/dist/content/served.d.ts +5 -5
  303. package/dist/content/served.js +4 -4
  304. package/dist/content/site-links.d.ts +3 -4
  305. package/dist/content/site-links.d.ts.map +1 -1
  306. package/dist/content/site-links.js +1 -2
  307. package/dist/content/site-links.js.map +1 -1
  308. package/dist/content/sqlite/clauses.d.ts +1 -1
  309. package/dist/content/sqlite/clauses.js +1 -1
  310. package/dist/content/sqlite/rows.d.ts +1 -1
  311. package/dist/content/sqlite/rows.js +1 -1
  312. package/dist/content/store.d.ts +26 -26
  313. package/dist/content/sync.d.ts +3 -3
  314. package/dist/content/sync.d.ts.map +1 -1
  315. package/dist/content/sync.js +65 -382
  316. package/dist/content/sync.js.map +1 -1
  317. package/dist/content/taxonomy.d.ts +9 -8
  318. package/dist/content/taxonomy.d.ts.map +1 -1
  319. package/dist/content/taxonomy.js +9 -8
  320. package/dist/content/taxonomy.js.map +1 -1
  321. package/dist/content/time.d.ts +1 -1
  322. package/dist/content/time.js +1 -1
  323. package/dist/content/trash.d.ts +4 -5
  324. package/dist/content/trash.d.ts.map +1 -1
  325. package/dist/content/trash.js +4 -5
  326. package/dist/content/trash.js.map +1 -1
  327. package/dist/content/write.d.ts +4 -4
  328. package/dist/content/write.js +19 -19
  329. package/dist/content/write.js.map +1 -1
  330. package/dist/drain.d.ts +1 -1
  331. package/dist/drain.js +1 -1
  332. package/dist/federation/actor.d.ts +9 -9
  333. package/dist/federation/actor.js +10 -10
  334. package/dist/federation/article.d.ts +14 -14
  335. package/dist/federation/article.js +27 -27
  336. package/dist/federation/article.js.map +1 -1
  337. package/dist/federation/backfill.d.ts +2 -2
  338. package/dist/federation/backfill.js +2 -2
  339. package/dist/federation/citations.d.ts +1 -1
  340. package/dist/federation/citations.js +1 -1
  341. package/dist/federation/cited-post.d.ts +1 -1
  342. package/dist/federation/cited-post.js +1 -1
  343. package/dist/federation/delivery-plan.d.ts +1 -1
  344. package/dist/federation/delivery.d.ts +3 -3
  345. package/dist/federation/delivery.d.ts.map +1 -1
  346. package/dist/federation/delivery.js +11 -12
  347. package/dist/federation/delivery.js.map +1 -1
  348. package/dist/federation/federation.d.ts +3 -3
  349. package/dist/federation/federation.d.ts.map +1 -1
  350. package/dist/federation/federation.js +7 -8
  351. package/dist/federation/federation.js.map +1 -1
  352. package/dist/federation/handles.d.ts +1 -1
  353. package/dist/federation/handles.js +1 -1
  354. package/dist/federation/inbox.d.ts +6 -6
  355. package/dist/federation/inbox.js +9 -9
  356. package/dist/federation/keys.d.ts +3 -3
  357. package/dist/federation/keys.js +3 -3
  358. package/dist/federation/object-ids.d.ts +1 -1
  359. package/dist/federation/paths.d.ts +8 -8
  360. package/dist/federation/paths.js +8 -8
  361. package/dist/federation/profiles.d.ts +2 -3
  362. package/dist/federation/profiles.d.ts.map +1 -1
  363. package/dist/federation/profiles.js +2 -3
  364. package/dist/federation/profiles.js.map +1 -1
  365. package/dist/federation/quotes.d.ts +1 -1
  366. package/dist/federation/records.d.ts +24 -24
  367. package/dist/federation/records.js +23 -23
  368. package/dist/federation/records.js.map +1 -1
  369. package/dist/federation/refusals.d.ts +1 -1
  370. package/dist/federation/relays.d.ts +1 -1
  371. package/dist/federation/relays.js +6 -6
  372. package/dist/federation/webfinger.d.ts +2 -2
  373. package/dist/federation/webfinger.js +2 -2
  374. package/dist/files/atomic.d.ts +2 -2
  375. package/dist/files/atomic.js +1 -1
  376. package/dist/forms/checker.d.ts +2 -2
  377. package/dist/forms/checker.d.ts.map +1 -1
  378. package/dist/forms/protection.d.ts +1 -1
  379. package/dist/forms/protection.js +1 -1
  380. package/dist/gemini/certificate.js +1 -1
  381. package/dist/images/markup.d.ts +2 -2
  382. package/dist/images/variants.d.ts +8 -8
  383. package/dist/images/variants.js +1 -1
  384. package/dist/indexnow.d.ts +1 -1
  385. package/dist/indieauth/grants.d.ts +2 -2
  386. package/dist/indieauth/identity.d.ts +3 -5
  387. package/dist/indieauth/identity.d.ts.map +1 -1
  388. package/dist/indieauth/identity.js +3 -5
  389. package/dist/indieauth/identity.js.map +1 -1
  390. package/dist/indieauth/redeem.d.ts +2 -2
  391. package/dist/indieauth/redeem.js +2 -2
  392. package/dist/indieauth/request.d.ts +2 -2
  393. package/dist/indieauth/request.js +2 -2
  394. package/dist/indieauth/tokens.d.ts +3 -5
  395. package/dist/indieauth/tokens.d.ts.map +1 -1
  396. package/dist/indieauth/tokens.js +3 -5
  397. package/dist/indieauth/tokens.js.map +1 -1
  398. package/dist/jobs/file-records.d.ts +1 -1
  399. package/dist/jobs/file-records.js +1 -1
  400. package/dist/jobs/in-process.d.ts +1 -1
  401. package/dist/jobs/in-process.js +1 -1
  402. package/dist/jobs/queue.d.ts +1 -1
  403. package/dist/jobs/queue.js +1 -1
  404. package/dist/mail/provider.d.ts +2 -2
  405. package/dist/mail/provider.js +2 -2
  406. package/dist/media/library.d.ts +2 -2
  407. package/dist/media/uploads.js +2 -2
  408. package/dist/media/uploads.js.map +1 -1
  409. package/dist/micropub/create.d.ts +1 -1
  410. package/dist/micropub/endpoint.d.ts +7 -7
  411. package/dist/micropub/endpoint.js +8 -8
  412. package/dist/micropub/endpoint.js.map +1 -1
  413. package/dist/micropub/media.d.ts +4 -4
  414. package/dist/micropub/media.js +4 -4
  415. package/dist/micropub/update.d.ts +1 -1
  416. package/dist/micropub/update.js +1 -1
  417. package/dist/notifications/comments.d.ts +1 -1
  418. package/dist/notifications/comments.js +2 -2
  419. package/dist/notifications/comments.js.map +1 -1
  420. package/dist/notifications/digest.d.ts +7 -7
  421. package/dist/notifications/digest.js +7 -7
  422. package/dist/notifications/mail-service.d.ts +4 -4
  423. package/dist/notifications/mail-service.d.ts.map +1 -1
  424. package/dist/notifications/mail-service.js +3 -3
  425. package/dist/notifications/mail-templates.d.ts +3 -3
  426. package/dist/notifications/optouts.d.ts +1 -1
  427. package/dist/notifications/optouts.js +1 -1
  428. package/dist/notifications/tokens.d.ts +2 -2
  429. package/dist/plugin.d.ts +5 -5
  430. package/dist/plugin.js +5 -5
  431. package/dist/plugins/changes.js +2 -2
  432. package/dist/plugins/folder.d.ts +2 -2
  433. package/dist/plugins/folder.js +2 -2
  434. package/dist/plugins/install.d.ts +1 -1
  435. package/dist/plugins/install.js +1 -1
  436. package/dist/plugins/registry.d.ts +1 -1
  437. package/dist/plugins/registry.js +1 -1
  438. package/dist/plugins/site.d.ts +1 -1
  439. package/dist/plugins/site.js +1 -1
  440. package/dist/privacy/erase.d.ts +1 -1
  441. package/dist/privacy/erase.js +1 -1
  442. package/dist/privacy/retention.d.ts +2 -2
  443. package/dist/privacy/retention.js +2 -2
  444. package/dist/site/admin-paths.d.ts +2 -2
  445. package/dist/site/admin-paths.js +2 -2
  446. package/dist/site/authors.d.ts +6 -6
  447. package/dist/site/authors.js +5 -5
  448. package/dist/site/dashboard-layout.d.ts +1 -1
  449. package/dist/site/indexnow-key.js +1 -1
  450. package/dist/site/namespace.d.ts +1 -1
  451. package/dist/site/namespace.js +1 -1
  452. package/dist/site/navigation.d.ts +10 -10
  453. package/dist/site/navigation.js +10 -10
  454. package/dist/site/notification-preferences.d.ts +3 -3
  455. package/dist/site/notification-preferences.js +2 -2
  456. package/dist/site/retention-policy.d.ts +1 -1
  457. package/dist/site/retention-policy.js +1 -1
  458. package/dist/site/users.d.ts +23 -24
  459. package/dist/site/users.d.ts.map +1 -1
  460. package/dist/site/users.js +6 -6
  461. package/dist/site/users.js.map +1 -1
  462. package/dist/store/admin-store.d.ts +2 -2
  463. package/dist/store/comments.d.ts +17 -17
  464. package/dist/store/comments.d.ts.map +1 -1
  465. package/dist/store/comments.js +14 -21
  466. package/dist/store/comments.js.map +1 -1
  467. package/dist/store/conversation.d.ts +2 -2
  468. package/dist/store/deliveries.d.ts +1 -1
  469. package/dist/store/deliveries.d.ts.map +1 -1
  470. package/dist/store/deliveries.js +10 -15
  471. package/dist/store/deliveries.js.map +1 -1
  472. package/dist/store/followers.d.ts +5 -5
  473. package/dist/store/followers.d.ts.map +1 -1
  474. package/dist/store/followers.js +7 -10
  475. package/dist/store/followers.js.map +1 -1
  476. package/dist/store/inbox-replies.d.ts +4 -4
  477. package/dist/store/inbox-replies.js +4 -4
  478. package/dist/store/inbox.d.ts +5 -5
  479. package/dist/store/inbox.d.ts.map +1 -1
  480. package/dist/store/inbox.js +21 -34
  481. package/dist/store/inbox.js.map +1 -1
  482. package/dist/store/profiles.d.ts +5 -5
  483. package/dist/store/profiles.d.ts.map +1 -1
  484. package/dist/store/profiles.js +4 -5
  485. package/dist/store/profiles.js.map +1 -1
  486. package/dist/store/relays.d.ts.map +1 -1
  487. package/dist/store/relays.js +7 -9
  488. package/dist/store/relays.js.map +1 -1
  489. package/dist/store/rows.d.ts +6 -20
  490. package/dist/store/rows.d.ts.map +1 -1
  491. package/dist/store/rows.js +10 -15
  492. package/dist/store/rows.js.map +1 -1
  493. package/dist/store/schema.js +35 -35
  494. package/dist/store/schema.js.map +1 -1
  495. package/dist/store/sessions.d.ts +1 -1
  496. package/dist/store/sessions.d.ts.map +1 -1
  497. package/dist/store/sessions.js +10 -10
  498. package/dist/store/sessions.js.map +1 -1
  499. package/dist/store/state.d.ts.map +1 -1
  500. package/dist/store/state.js +2 -2
  501. package/dist/store/state.js.map +1 -1
  502. package/dist/store/tokens.d.ts +1 -1
  503. package/dist/store/tokens.d.ts.map +1 -1
  504. package/dist/store/tokens.js +5 -5
  505. package/dist/store/tokens.js.map +1 -1
  506. package/dist/store/webmentions.d.ts +2 -2
  507. package/dist/store/webmentions.d.ts.map +1 -1
  508. package/dist/store/webmentions.js +11 -11
  509. package/dist/store/webmentions.js.map +1 -1
  510. package/dist/supervisor/plugin-watcher.d.ts +26 -0
  511. package/dist/supervisor/plugin-watcher.d.ts.map +1 -0
  512. package/dist/supervisor/plugin-watcher.js +90 -0
  513. package/dist/supervisor/plugin-watcher.js.map +1 -0
  514. package/dist/supervisor/primary.d.ts +4 -7
  515. package/dist/supervisor/primary.d.ts.map +1 -1
  516. package/dist/supervisor/primary.js +37 -94
  517. package/dist/supervisor/primary.js.map +1 -1
  518. package/dist/supervisor/protocol.d.ts +1 -1
  519. package/dist/supervisor/protocol.js +1 -1
  520. package/dist/supervisor/reload-queue.d.ts +10 -0
  521. package/dist/supervisor/reload-queue.d.ts.map +1 -0
  522. package/dist/supervisor/reload-queue.js +28 -0
  523. package/dist/supervisor/reload-queue.js.map +1 -0
  524. package/dist/supervisor/supervision.d.ts +2 -2
  525. package/dist/supervisor/supervision.js +2 -2
  526. package/dist/supervisor/worker.d.ts +1 -1
  527. package/dist/supervisor/worker.js +1 -1
  528. package/dist/theme/site-data.d.ts +3 -3
  529. package/dist/theme/site-data.js +2 -2
  530. package/dist/theme/templates.d.ts +3 -3
  531. package/dist/theme/templates.js +16 -16
  532. package/dist/theme/templates.js.map +1 -1
  533. package/dist/theme/themes.d.ts +11 -13
  534. package/dist/theme/themes.d.ts.map +1 -1
  535. package/dist/theme/themes.js +8 -9
  536. package/dist/theme/themes.js.map +1 -1
  537. package/dist/web/activity-folding.d.ts +33 -0
  538. package/dist/web/activity-folding.d.ts.map +1 -0
  539. package/dist/web/activity-folding.js +238 -0
  540. package/dist/web/activity-folding.js.map +1 -0
  541. package/dist/web/archive.d.ts +2 -3
  542. package/dist/web/archive.d.ts.map +1 -1
  543. package/dist/web/archive.js +2 -3
  544. package/dist/web/archive.js.map +1 -1
  545. package/dist/web/asset-routes.d.ts +1 -1
  546. package/dist/web/asset-routes.js +1 -1
  547. package/dist/web/comment-routes.js +2 -2
  548. package/dist/web/comment-routes.js.map +1 -1
  549. package/dist/web/compression.d.ts +1 -1
  550. package/dist/web/compression.js +1 -1
  551. package/dist/web/context.d.ts +21 -21
  552. package/dist/web/context.d.ts.map +1 -1
  553. package/dist/web/context.js +7 -7
  554. package/dist/web/conversation-context.d.ts +15 -0
  555. package/dist/web/conversation-context.d.ts.map +1 -0
  556. package/dist/web/conversation-context.js +2 -0
  557. package/dist/web/conversation-context.js.map +1 -0
  558. package/dist/web/conversation-feed.d.ts +18 -0
  559. package/dist/web/conversation-feed.d.ts.map +1 -0
  560. package/dist/web/conversation-feed.js +53 -0
  561. package/dist/web/conversation-feed.js.map +1 -0
  562. package/dist/web/conversation-gather.d.ts +12 -0
  563. package/dist/web/conversation-gather.d.ts.map +1 -0
  564. package/dist/web/conversation-gather.js +189 -0
  565. package/dist/web/conversation-gather.js.map +1 -0
  566. package/dist/web/conversation-lookup.d.ts +15 -0
  567. package/dist/web/conversation-lookup.d.ts.map +1 -0
  568. package/dist/web/conversation-lookup.js +101 -0
  569. package/dist/web/conversation-lookup.js.map +1 -0
  570. package/dist/web/conversation-threads.d.ts +12 -0
  571. package/dist/web/conversation-threads.d.ts.map +1 -0
  572. package/dist/web/conversation-threads.js +144 -0
  573. package/dist/web/conversation-threads.js.map +1 -0
  574. package/dist/web/conversation.d.ts +25 -61
  575. package/dist/web/conversation.d.ts.map +1 -1
  576. package/dist/web/conversation.js +14 -854
  577. package/dist/web/conversation.js.map +1 -1
  578. package/dist/web/document-page.js +4 -4
  579. package/dist/web/document-page.js.map +1 -1
  580. package/dist/web/document-render.d.ts +9 -0
  581. package/dist/web/document-render.d.ts.map +1 -0
  582. package/dist/web/document-render.js +130 -0
  583. package/dist/web/document-render.js.map +1 -0
  584. package/dist/web/document-site.d.ts +1 -1
  585. package/dist/web/document-site.d.ts.map +1 -1
  586. package/dist/web/document-site.js +1 -1
  587. package/dist/web/document-site.js.map +1 -1
  588. package/dist/web/env.d.ts +19 -19
  589. package/dist/web/env.d.ts.map +1 -1
  590. package/dist/web/federation-routes.d.ts +2 -2
  591. package/dist/web/federation-routes.d.ts.map +1 -1
  592. package/dist/web/federation-routes.js +22 -21
  593. package/dist/web/federation-routes.js.map +1 -1
  594. package/dist/web/feed-atom.d.ts +3 -3
  595. package/dist/web/feed-atom.js +3 -3
  596. package/dist/web/feed-item.d.ts +15 -16
  597. package/dist/web/feed-item.d.ts.map +1 -1
  598. package/dist/web/feed-item.js +1 -1
  599. package/dist/web/feed-item.js.map +1 -1
  600. package/dist/web/feed-json.d.ts +4 -4
  601. package/dist/web/feed-json.d.ts.map +1 -1
  602. package/dist/web/feed-json.js +2 -2
  603. package/dist/web/feed-routes.d.ts +3 -3
  604. package/dist/web/feed-routes.js +4 -4
  605. package/dist/web/feed-routes.js.map +1 -1
  606. package/dist/web/feed-rss.d.ts +2 -2
  607. package/dist/web/feed-rss.js +4 -4
  608. package/dist/web/feed-rss.js.map +1 -1
  609. package/dist/web/feed-source.d.ts +5 -5
  610. package/dist/web/feed-source.d.ts.map +1 -1
  611. package/dist/web/feed-source.js +2 -2
  612. package/dist/web/feed-source.js.map +1 -1
  613. package/dist/web/feed-xml.d.ts +4 -4
  614. package/dist/web/feed-xml.d.ts.map +1 -1
  615. package/dist/web/feed-xml.js +4 -4
  616. package/dist/web/feed-xml.js.map +1 -1
  617. package/dist/web/font-routes.d.ts +1 -1
  618. package/dist/web/font-routes.js +1 -1
  619. package/dist/web/health.d.ts +1 -1
  620. package/dist/web/index.d.ts +5 -3
  621. package/dist/web/index.d.ts.map +1 -1
  622. package/dist/web/index.js +4 -2
  623. package/dist/web/index.js.map +1 -1
  624. package/dist/web/indieauth-activity-log.js +1 -1
  625. package/dist/web/indieauth-bearer.d.ts +2 -2
  626. package/dist/web/indieauth-discovery.d.ts +12 -12
  627. package/dist/web/indieauth-discovery.d.ts.map +1 -1
  628. package/dist/web/indieauth-discovery.js +12 -12
  629. package/dist/web/indieauth-discovery.js.map +1 -1
  630. package/dist/web/indieauth-token.d.ts +2 -2
  631. package/dist/web/indieauth-token.js +2 -2
  632. package/dist/web/listing-render.d.ts +11 -0
  633. package/dist/web/listing-render.d.ts.map +1 -0
  634. package/dist/web/listing-render.js +76 -0
  635. package/dist/web/listing-render.js.map +1 -0
  636. package/dist/web/listing-subject.js +1 -1
  637. package/dist/web/listing-subject.js.map +1 -1
  638. package/dist/web/llms.d.ts +1 -1
  639. package/dist/web/llms.js +1 -1
  640. package/dist/web/maintenance.d.ts +1 -1
  641. package/dist/web/maintenance.js +1 -1
  642. package/dist/web/manifest.d.ts +1 -1
  643. package/dist/web/manifest.js +1 -1
  644. package/dist/web/markdown-chrome.d.ts +11 -0
  645. package/dist/web/markdown-chrome.d.ts.map +1 -0
  646. package/dist/web/markdown-chrome.js +178 -0
  647. package/dist/web/markdown-chrome.js.map +1 -0
  648. package/dist/web/markdown-conversation.d.ts +1 -1
  649. package/dist/web/markdown-conversation.d.ts.map +1 -1
  650. package/dist/web/markdown-environment.d.ts +10 -0
  651. package/dist/web/markdown-environment.d.ts.map +1 -0
  652. package/dist/web/markdown-environment.js +56 -0
  653. package/dist/web/markdown-environment.js.map +1 -0
  654. package/dist/web/markdown-representation.d.ts +1 -1
  655. package/dist/web/markdown-representation.d.ts.map +1 -1
  656. package/dist/web/markdown-representation.js +2 -2
  657. package/dist/web/markdown-representation.js.map +1 -1
  658. package/dist/web/negotiate.d.ts +9 -6
  659. package/dist/web/negotiate.d.ts.map +1 -1
  660. package/dist/web/negotiate.js +17 -13
  661. package/dist/web/negotiate.js.map +1 -1
  662. package/dist/web/oembed.d.ts +3 -3
  663. package/dist/web/oembed.js +3 -3
  664. package/dist/web/opensearch.d.ts +1 -1
  665. package/dist/web/opensearch.js +1 -1
  666. package/dist/web/page-context.d.ts +29 -0
  667. package/dist/web/page-context.d.ts.map +1 -0
  668. package/dist/web/page-context.js +126 -0
  669. package/dist/web/page-context.js.map +1 -0
  670. package/dist/web/page-tags.js +1 -1
  671. package/dist/web/page-tags.js.map +1 -1
  672. package/dist/web/paths.d.ts +1 -1
  673. package/dist/web/paths.js +3 -3
  674. package/dist/web/plugin-federation.d.ts +1 -1
  675. package/dist/web/plugin-federation.js +1 -1
  676. package/dist/web/render-scope.d.ts +20 -0
  677. package/dist/web/render-scope.d.ts.map +1 -0
  678. package/dist/web/render-scope.js +36 -0
  679. package/dist/web/render-scope.js.map +1 -0
  680. package/dist/web/render.d.ts +21 -363
  681. package/dist/web/render.d.ts.map +1 -1
  682. package/dist/web/render.js +46 -899
  683. package/dist/web/render.js.map +1 -1
  684. package/dist/web/request.d.ts +1 -1
  685. package/dist/web/request.js +1 -1
  686. package/dist/web/robots.d.ts +1 -1
  687. package/dist/web/robots.js +1 -1
  688. package/dist/web/routes.js +19 -19
  689. package/dist/web/routes.js.map +1 -1
  690. package/dist/web/search.d.ts +1 -1
  691. package/dist/web/search.js +1 -1
  692. package/dist/web/session.d.ts +8 -8
  693. package/dist/web/session.js +8 -8
  694. package/dist/web/share-image.d.ts +2 -3
  695. package/dist/web/share-image.d.ts.map +1 -1
  696. package/dist/web/share-image.js +1 -1
  697. package/dist/web/share-image.js.map +1 -1
  698. package/dist/web/site-view.d.ts +2 -2
  699. package/dist/web/status-pages.d.ts +1 -1
  700. package/dist/web/status-pages.d.ts.map +1 -1
  701. package/dist/web/theme-environment.d.ts +14 -0
  702. package/dist/web/theme-environment.d.ts.map +1 -0
  703. package/dist/web/theme-environment.js +112 -0
  704. package/dist/web/theme-environment.js.map +1 -0
  705. package/dist/web/theme-templates.d.ts +67 -0
  706. package/dist/web/theme-templates.d.ts.map +1 -0
  707. package/dist/web/theme-templates.js +65 -0
  708. package/dist/web/theme-templates.js.map +1 -0
  709. package/dist/webmention/microformats.d.ts +5 -5
  710. package/dist/webmention/microformats.d.ts.map +1 -1
  711. package/dist/webmention/receive.d.ts +7 -7
  712. package/dist/webmention/receive.d.ts.map +1 -1
  713. package/dist/webmention/receive.js +4 -4
  714. package/dist/webmention/receive.js.map +1 -1
  715. package/dist/webmention/reply-context/oembed.js +1 -1
  716. package/dist/webmention/reply-context.d.ts +10 -10
  717. package/dist/webmention/reply-context.d.ts.map +1 -1
  718. package/dist/webmention/reply-context.js +5 -5
  719. package/dist/webmention/reply-contexts.d.ts +6 -6
  720. package/dist/webmention/reply-contexts.d.ts.map +1 -1
  721. package/dist/webmention/reply-contexts.js +2 -2
  722. package/dist/webmention/service.d.ts +13 -13
  723. package/dist/webmention/service.js +9 -9
  724. package/dist/webmention/syndication.d.ts +6 -6
  725. package/dist/webmention/syndication.d.ts.map +1 -1
  726. package/dist/webmention/syndication.js +6 -6
  727. package/dist/webmention/syndication.js.map +1 -1
  728. package/package.json +2 -2
@@ -1,914 +1,61 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
2
- import { randomUUID } from 'node:crypto';
3
- import nunjucks from 'nunjucks';
4
- import { CITATION_VERBS, citationsOf, citedPageName, citesAnImage, previewShown, } from '../content/citation.js';
5
- import { NO_PAGE_TAGS } from '../plugins/page-tags.js';
6
- import { DEFAULT_SITE_SETTINGS } from '../site/settings.js';
7
- import { postLabel, replyTarget } from '../content/post-type.js';
8
- import { reviewWords } from '../content/review.js';
9
- import { RSVP_PHRASES } from '../content/rsvp.js';
10
- import { visibilityOf } from '../content/visibility.js';
11
- import { MAXIMUM_FORM_AGE_SECONDS } from '../forms/protection.js';
12
- import { iconSetting, siteIcons } from '../images/icons.js';
13
- import { LLMS_TXT_PATH } from './llms.js';
14
- import { archiveMonths, archiveOpen } from './archive.js';
15
- import { authorContext, siteAuthorContext } from '../site/authors.js';
16
- import { backlinkContext, citedPhotoContext, citedPictureContext, documentContext, locationContext, syndicationLinks, } from './context.js';
17
- import { createSiteDataSource, frontPageSlugs, postsPerPage, siteColors, siteLocale, siteTimezone, taxonomyBases, termRedirects, themeName, } from '../theme/site-data.js';
18
- import { commentAnchor } from '../comments/conversation.js';
19
- import { commentPageHref } from '../content/guids.js';
20
- import { activityStreamsId } from '../content/permalinks.js';
21
- import { currentObjectId, readObjectIds } from '../federation/object-ids.js';
22
- import { isServed } from '../content/served.js';
23
- import { calendarDayIn } from '../content/time.js';
24
- import { commentsFeedPath } from './feeds.js';
25
- import { markdownConversation } from './markdown-conversation.js';
26
- import { bioOf, escapeMarkdown, HOME_LINK, oneLine } from './markdown-page.js';
27
- import { navigationLinks, navigationMenus } from '../site/navigation.js';
28
- import { resolveLicense } from '../content/license.js';
29
- import { shareImage } from './share-image.js';
30
- import { snippetHtml } from './search.js';
31
- import { termHref } from '../content/taxonomy.js';
32
- import { createTemplateEnvironment, useThemeDirs } from '../theme/templates.js';
33
- import { createThemeSource, findThemeFile } from '../theme/themes.js';
34
- import { representationHref } from './negotiate.js';
35
- import { schemeTokens } from '../theme/scheme-tokens.js';
36
- import { formatFileSize } from '../util/file-size.js';
37
- import { absoluteUrl } from '../util/url.js';
38
- import { capsuleUrl } from '../gemini/capsule.js';
39
- import { citedPictureAlt } from '../webmention/cited-picture.js';
40
- import { readCitedStart } from '../webmention/cited-start.js';
41
- import { handSyndicationOf } from '../webmention/syndication.js';
42
- import { pingbackEndpointFor } from '../webmention/pingback.js';
43
- import { webmentionEndpointFor } from '../webmention/endpoint.js';
44
- /** Templates the default theme ships and the public routes ask for by name. */
45
- export const TEMPLATES = {
46
- home: 'layouts/home.njk',
47
- post: 'layouts/post.njk',
48
- page: 'layouts/page.njk',
49
- tag: 'layouts/tag.njk',
50
- category: 'layouts/category.njk',
51
- author: 'layouts/author.njk',
52
- search: 'layouts/search.njk',
53
- comment: 'layouts/comment.njk',
54
- notFound: 'layouts/404.njk',
55
- gone: 'layouts/410.njk',
56
- serverError: 'layouts/500.njk',
57
- maintenance: 'layouts/503.njk',
58
- };
59
- /**
60
- * The two templates named for the Reading choice, which a theme may write and
61
- * which fall back to an ordinary layout when it has not.
62
- *
63
- * They are WordPress's own `front-page.php` and `home.php`, and they exist for
64
- * the same reason: a front page is often the one page of a site that looks
65
- * like nothing else, and saying so should not mean overriding the layout every
66
- * other page uses. The default theme ships `front-page.njk` (TASK-85) and no
67
- * posts page layout, so a site that sets a posts page gets the listing layout
68
- * until it writes one.
69
- */
70
- export const OPTIONAL_TEMPLATES = {
71
- /**
72
- * The front page alone. The default theme ships one (TASK-85), so the
73
- * fallback is only reached by a theme that replaced it with nothing.
74
- */
75
- frontPage: 'layouts/front-page.njk',
76
- /** The listing on the posts page. Falls back to {@link TEMPLATES.home}. */
77
- postsPage: 'layouts/posts-page.njk',
78
- };
79
- const CHROME_TEMPLATES = {
80
- header: { markdown: 'partials/markdown-header.md.njk', gemini: 'partials/gemini-header.gmi.njk' },
81
- footer: { markdown: 'partials/markdown-footer.md.njk', gemini: 'partials/gemini-footer.gmi.njk' },
82
- };
83
- const signedInReader = new AsyncLocalStorage();
84
- /** Run `draw` as the request of a signed-in reader, so its pages say `signedIn`. */
85
- export function drawnForSignedInReader(draw) {
86
- return signedInReader.run(true, draw);
87
- }
88
- const requestInputs = new AsyncLocalStorage();
89
- export function drawnWith(inputs, draw) {
90
- return requestInputs.run(inputs, draw);
91
- }
92
- const pageTags = new AsyncLocalStorage();
93
- export function drawnWithPageTags(tags, draw) {
94
- return pageTags.run(tags, draw);
95
- }
96
- function pluginTagsContext() {
97
- const { headEnd, bodyEnd } = pageTags.getStore() ?? NO_PAGE_TAGS;
98
- return {
99
- headEnd: new nunjucks.runtime.SafeString(headEnd),
100
- bodyEnd: new nunjucks.runtime.SafeString(bodyEnd),
101
- };
102
- }
103
- function requestSite() {
104
- return requestInputs.getStore()?.site ?? DEFAULT_SITE_SETTINGS;
105
- }
106
- function pageFontsContext(fonts) {
107
- return {
108
- stylesheets: [...new Set(fonts.map((font) => font.href))],
109
- properties: fonts.map((font) => ({ property: font.font.property, value: font.value })),
110
- };
111
- }
112
- /** Half the time a form stays submittable: the oldest stamp a 304 hands back. */
113
- const STAMP_WINDOW_MS = (MAXIMUM_FORM_AGE_SECONDS * 1000) / 2;
1
+ import { createSiteDataSource, frontPageSlugs, postsPerPage, taxonomyBases, termRedirects, themeName, } from '../theme/site-data.js';
2
+ import { createThemeSource } from '../theme/themes.js';
3
+ import { createDocumentPages } from './document-render.js';
4
+ import { createListingPages } from './listing-render.js';
5
+ import { createMarkdownChrome } from './markdown-chrome.js';
6
+ import { createMarkdownEnvironment } from './markdown-environment.js';
7
+ import { createPageContexts } from './page-context.js';
8
+ import { requestSite } from './render-scope.js';
9
+ import { createThemeEnvironment, siteColorsWithTokens } from './theme-environment.js';
10
+ import { STATUS_PAGES, untilContext } from './theme-templates.js';
114
11
  export function createRenderer(options) {
115
- const { config } = options;
116
- const siteData = createSiteDataSource(config);
117
- const { replyContext } = options;
118
- const citedPage = replyContext === undefined
119
- ? undefined
120
- : (url) => replyContext(url, requestSite());
121
- // What a form's loaded-at stamp is drawn as while its page is fingerprinted.
122
- // Random per renderer so no post, reply or theme text can spell it.
123
- const stampMark = `geekity-stamp-${randomUUID()}`;
124
- // Which theme every render below reads from. Built here when the caller did
125
- // not bring one so that a renderer made on its own — a test over one
126
- // template, a site rendering a fragment of its own — still follows the
127
- // `theme` in `site.json`; `createCms` hands in the one the mail templates
128
- // and the `/theme/` assets share, so a site has a single answer and logs a
129
- // bad choice once.
130
- const themes = options.themes ??
131
- createThemeSource({ themesDir: config.themesDir, chosen: () => themeName(siteData.read()) });
132
- const environment = createTemplateEnvironment({
133
- themeDirs: themes.current().dirs,
134
- baseUrl: config.baseUrl,
135
- now: config.now,
136
- noCache: config.watch,
137
- });
138
- const markdownEnvironment = createTemplateEnvironment({
139
- themeDirs: themes.current().dirs,
140
- baseUrl: config.baseUrl,
141
- now: config.now,
142
- noCache: config.watch,
143
- autoescape: false,
144
- });
145
- markdownEnvironment.addFilter('escapeMarkdown', (value) => escapeMarkdown(filterText(value)));
146
- markdownEnvironment.addFilter('fileSize', (value) => typeof value === 'number' ? formatFileSize(value) : '');
147
- markdownEnvironment.addFilter('nest', (value, width) => nest(value instanceof nunjucks.runtime.SafeString ? value.toString() : filterText(value), typeof width === 'number' ? width : 2));
148
- markdownEnvironment.addFilter('quote', (value) => quote(filterText(value)));
149
- for (const name of ['markdownUrl', 'geminiUrl']) {
150
- markdownEnvironment.addFilter(name, function (value) {
151
- const url = filterText(value);
152
- const lookup = this?.lookup;
153
- const write = typeof lookup === 'function' ? lookup.call(this, name) : undefined;
154
- return typeof write === 'function' ? write(url) : url;
155
- });
156
- }
157
- const pages = options.pages ?? (() => []);
158
- const users = options.users ?? (() => []);
159
- function render(template, context = {}) {
160
- const site = siteData.read();
161
- // Before anything is looked up: a theme chosen on the Appearance screen, or
162
- // written into `site.json` by hand, decides this very render rather than
163
- // the next boot. It costs a comparison of two short arrays when nothing
164
- // has changed, which is every render of a site that is not being rethemed.
165
- const chosen = themes.current();
166
- useThemeDirs(environment, chosen.dirs);
167
- // The menus are built here rather than by each caller because every page
168
- // of the site carries them: a listing, a document, the 404 and the
169
- // editor's preview all go through here, and a menu that appeared on some
170
- // of them and not others would be a worse contract than one that is
171
- // simply always there. It is `menus` rather than `menus` read off `site`
172
- // because these items know which one the reader is on; a template reading
173
- // `site.menus` would be reading the raw lists.
174
- //
175
- // Every menu the site stores is here, keyed by name, not only the ones the
176
- // theme declares an area for: a name nothing loops over is rendered
177
- // nowhere and kept (TASK-107), and the declaration in `theme.json` is for
178
- // the screen that edits menus rather than a filter on the render.
179
- const menus = navigationMenus({ site, url: currentUrl(context) });
180
- // Who the page is by, for the bio, the `rel="me"` links and the structured
181
- // data (decision-16). It is here rather than in each caller because every
182
- // page of the site carries it, for the reason the menus do — and it is
183
- // the site's own author only when the page is about nobody in particular:
184
- // a document's byline and an author archive's person are put on the
185
- // context by the callers below, and win by going on last.
186
- const siteOwner = siteAuthorContext(users(), site.author);
187
- const owner = context['siteAuthor'] === undefined ? siteOwner : undefined;
188
- // The site's icons, as the links a head carries (TASK-81, TASK-147). They
189
- // are computed here rather than in the layout because only this side knows
190
- // where a derived file is served and whether the site can derive one at
191
- // all: a theme that was handed the icon's path would have to build the URL
192
- // itself and would link 404s on a site with image optimization off.
193
- const icons = siteIcons(config, iconSetting(site));
194
- // The icon a header prints before the title, when the site asks for one
195
- // (TASK-486): the SVG itself if it is one, which is sharp at any size.
196
- const headerIcon = site['headerIcon'] === true ? svgElseTouchIconHref(icons) : undefined;
197
- // The picture a shared link shows (TASK-146), here for the reason the
198
- // icons are: its alt text and its size are in files only this side reads.
199
- const title = [context['title'], context['label']].find((value) => typeof value === 'string' && value !== '');
200
- const by = (context['siteAuthor'] ?? siteOwner);
201
- // A photo post is shown by its first photo (TASK-166).
202
- const [photo] = (context['photos'] ?? []);
203
- const image = shareImage({
204
- config,
205
- image: context['image'],
206
- imageAlt: context['imageAlt'],
207
- title: title ?? site.title,
208
- fallbacks: [
209
- ...(photo === undefined
210
- ? []
211
- : [{ url: photo.url, describedAs: photo.alt || (title ?? site.title) }]),
212
- { url: site.avatar, describedAs: siteOwner?.name ?? site.title },
213
- { url: by?.avatar, describedAs: by?.name ?? site.title },
214
- { url: iconSetting(site), describedAs: site.title },
215
- ],
216
- });
217
- const fonts = options.fonts?.(site, chosen.fonts) ?? [];
218
- return environment.render(template, {
219
- site,
220
- menus,
221
- icons,
222
- ...(fonts.length === 0 ? {} : { fonts: pageFontsContext(fonts) }),
223
- theme: { ...chosen.colors, ...siteColors(site, chosen.schemes) },
224
- // Where the index for language models is (TASK-149), while the site
225
- // serves one, so a theme asks `{% if llmsTxt %}`.
226
- ...(site['llmsTxt'] === false ? {} : { llmsTxt: LLMS_TXT_PATH }),
227
- ...(headerIcon === undefined ? {} : { headerIcon }),
228
- ...(image === undefined ? {} : { shareImage: image }),
229
- ...(owner === undefined ? {} : { siteAuthor: owner }),
230
- // Who the homepage speaks for, on a site whose author is a user (TASK-180,
231
- // TASK-192): the bio on the homepage and the `rel="me"` claims between
232
- // it and their archive. Every page carries it, because the archive is
233
- // where the claim back is printed. A site with several authors has none.
234
- ...(siteOwner === undefined ? {} : { soloAuthor: siteOwner }),
235
- ...context,
236
- ...licenseContext(site, context),
237
- devMode: requestInputs.getStore()?.devMode === true,
238
- signedIn: signedInReader.getStore() === true,
239
- pluginTags: pluginTagsContext(),
240
- });
241
- }
242
- /**
243
- * What the pages a post cites say about themselves, as a theme reads them,
244
- * when they were fetched. `replyContext` is what a reply answers (TASK-123),
245
- * on the context only when it is known, so a theme draws the bare link from
246
- * `inReplyTo` and fills it in from it. `citations` is what it reposts, likes
247
- * or bookmarks, each with its `context` when that is known (TASK-244).
248
- */
249
- function citedBy(document) {
250
- const shown = previewShown(document.extra);
251
- const contextOf = (target, property) => {
252
- const cited = citedPage?.(target);
253
- if (cited === undefined)
254
- return undefined;
255
- const { picture, author, ...rest } = cited;
256
- const image = citesAnImage(cited);
257
- const alt = citedPictureAlt(property, cited, document);
258
- const { photo, ...named } = author ?? { name: '' };
259
- return {
260
- ...replyContextFor(rest),
261
- ...(author === undefined
262
- ? {}
263
- : {
264
- author: {
265
- ...named,
266
- ...(photo === undefined || !shown
267
- ? {}
268
- : { photo: citedPhotoContext(photo, config) }),
269
- },
270
- }),
271
- ...(image ? { image } : {}),
272
- ...(picture === undefined || !shown
273
- ? {}
274
- : { picture: citedPictureContext(picture, property, alt, config) }),
275
- };
276
- };
277
- const target = replyTarget(document);
278
- const replyContext = target === undefined ? undefined : contextOf(target, 'in-reply-to');
279
- return {
280
- ...(replyContext === undefined ? {} : { replyContext }),
281
- citations: citationsOf(document.extra).map((citation) => {
282
- const context = contextOf(citation.url, citation.property);
283
- return context === undefined ? citation : { ...citation, context };
284
- }),
285
- };
286
- }
287
- /**
288
- * One entry of a listing: the document as a template sees it, and what it
289
- * answers when it is a reply, so a feed cites a reply's target the way the
290
- * reply's own page does (doc-9).
291
- */
292
- function entryContext(document, people, loading) {
293
- const context = documentContext(document, config, authorContext(people, document.author), loading, citedPage);
294
- return { ...context, ...citedBy(document) };
295
- }
296
- function newestPostsContext(page) {
297
- const source = options.newestPosts;
298
- if (source === undefined)
299
- return {};
300
- const pageLeads = page.html.includes('<img');
301
- return {
302
- newestPosts: (count) => {
303
- if (typeof count !== 'number' || !Number.isInteger(count) || count < 1) {
304
- throw new RangeError(`newestPosts(count) takes a whole number of posts, at least 1, not ${String(count)}`);
305
- }
306
- const people = users();
307
- return source(count).map((document, index) => entryContext(document, people, { lead: !pageLeads && index === 0 }));
308
- },
309
- };
310
- }
311
- /**
312
- * The whole archive as the months an archive page heads, or nothing at all
313
- * for every other document.
314
- *
315
- * The front matter key decides, so the list is on the context of exactly the
316
- * page that asked for it and a layout writes `{% if archiveMonths %}` rather
317
- * than reading front matter for itself — the way `contactForm` works.
318
- */
319
- function archiveContext(document) {
320
- const months = archiveOf(document);
321
- return months === undefined ? {} : { archiveMonths: months };
322
- }
323
- function archiveOf(document) {
324
- if (!archiveOpen(document))
325
- return undefined;
326
- const posts = options.archivePosts?.();
327
- if (posts === undefined)
328
- return undefined;
329
- const site = siteData.read();
330
- return archiveMonths(posts, siteTimezone(site), siteLocale(site), citedPage);
331
- }
332
- function markdownArchiveContext(document, gemfeed) {
333
- const months = document === undefined ? undefined : archiveOf(document);
334
- if (months === undefined)
335
- return {};
336
- const timezone = siteTimezone(siteData.read());
337
- const markdownMonths = months.map(({ month, posts }) => ({
338
- month,
339
- posts: posts.map((entry) => ({
340
- label: entry.title,
341
- url: entry.url,
342
- date: calendarDayIn(entry.date, timezone),
343
- description: gemfeed || entry.description === undefined ? undefined : oneLine(entry.description),
344
- })),
345
- }));
346
- return { archiveMonths: markdownMonths };
347
- }
348
- function markdownLinksContext(document) {
349
- if (document === undefined)
350
- return {};
351
- const site = siteData.read();
352
- const bases = taxonomyBases(site);
353
- const timezone = siteTimezone(site);
354
- const terms = (taxonomy, names) => document.type === 'post'
355
- ? names.map((term) => ({ label: term, url: termHref({ taxonomy, term }, 0, bases) }))
356
- : [];
357
- const backlinks = (options.backlinks?.(document) ?? []).map((linking) => ({
358
- label: postLabel(linking, citedPage),
359
- url: linking.permalink,
360
- date: linking.date === undefined ? undefined : calendarDayIn(linking.date, timezone),
361
- }));
362
- return {
363
- categories: terms('category', document.categories),
364
- tags: terms('tag', document.tags),
365
- backlinks,
366
- };
367
- }
368
- function markdownKindContext(document) {
369
- if (document?.type !== 'post')
370
- return {};
371
- const { postType, lang, rsvp, event, review, enclosure, photos } = documentContext(document, config, undefined, undefined, citedPage);
372
- const cite = (verb, target) => {
373
- const context = citedPage?.(target);
374
- const url = context?.original ?? target;
375
- const name = citedPageName(url, context);
376
- const author = context?.author?.name.trim();
377
- const named = author !== undefined &&
378
- author !== '' &&
379
- name.trim().toLowerCase().endsWith(` by ${author.toLowerCase()}`);
380
- const { startDate, startZone, published } = replyContextFor(context ?? { url });
381
- return {
382
- verb,
383
- url,
384
- name,
385
- ...(author === undefined || named ? {} : { author }),
386
- ...(author === undefined && context?.site !== undefined ? { site: context.site } : {}),
387
- ...(startDate instanceof Date
388
- ? { startDate, ...(typeof startZone === 'string' ? { startZone } : {}) }
389
- : published instanceof Date
390
- ? { published }
391
- : {}),
392
- ...(context?.location === undefined ? {} : { location: context.location }),
393
- ...(context?.original === undefined ? {} : { copy: target }),
394
- };
395
- };
396
- const target = replyTarget(document);
397
- const cites = [
398
- ...(target === undefined
399
- ? []
400
- : [cite(rsvp === undefined ? 'In reply to' : RSVP_PHRASES[rsvp.value], target)]),
401
- ...citationsOf(document.extra).map((citation) => cite(CITATION_VERBS[citation.property], citation.url)),
402
- ];
403
- const shared = options.location?.(document, requestSite());
404
- return {
405
- postType,
406
- ...(lang === undefined ? {} : { lang }),
407
- cites,
408
- photos: photos.map(({ url, alt }) => ({ url, alt })),
409
- ...(enclosure === undefined ? {} : { enclosure }),
410
- ...(rsvp === undefined ? {} : { rsvp: { value: rsvp.value, label: rsvp.label } }),
411
- ...(event === undefined ? {} : { event }),
412
- ...(review === undefined
413
- ? {}
414
- : {
415
- review: {
416
- item: review.item,
417
- kindLabel: review.kindLabel,
418
- ...(review.rating === undefined ? {} : { rating: review.rating }),
419
- best: review.best,
420
- ...reviewWords(review),
421
- },
422
- }),
423
- ...(shared === undefined ? {} : { location: locationContext(shared) }),
424
- };
425
- }
426
- function strangerCommentForm(document) {
427
- const signedOut = undefined;
428
- const offersNotifications = false;
429
- return options.commentForm?.(document, signedOut, offersNotifications);
430
- }
431
- function markdownConversationContext(document, url) {
432
- if (document === undefined)
433
- return {};
434
- const said = options.conversation?.(document, requestSite());
435
- const page = absoluteUrl(url, config.baseUrl);
436
- const takesComments = strangerCommentForm(document) !== undefined;
437
- const webmention = webmentionEndpointFor(siteData.read());
438
- return {
439
- ...(said === undefined || said.counts.total === 0
440
- ? {}
441
- : { conversation: markdownConversation(said) }),
442
- ...(takesComments ? { commentForm: { url: `${page}#respond` } } : {}),
443
- ...(options.contactForm?.(document) === undefined
444
- ? {}
445
- : { contactForm: { url: `${page}#contact` } }),
446
- ...(webmention === undefined ? {} : { webmention }),
447
- };
448
- }
449
- /**
450
- * The page whose own URL carries the listing, as the link a front page draws
451
- * to it, or nothing at all when the site names none.
452
- *
453
- * Resolved here rather than by the route because the renderer already holds
454
- * both halves — the setting and the published pages — and because the link
455
- * is the front page's alone: everywhere else the posts page is an ordinary
456
- * item of the site menu.
457
- */
458
- function postsPageContext() {
459
- const slug = frontPageSlugs(siteData.read()).postsPage;
460
- if (slug === '')
461
- return {};
462
- const found = pages().find((document) => document.slug === slug);
463
- return found === undefined
464
- ? {}
465
- : { postsPage: { title: postLabel(found), url: found.permalink } };
466
- }
467
- /**
468
- * Which template one listing renders through: whatever it named, the posts
469
- * page's own template when it is one and the theme ships one, and the home
470
- * layout otherwise.
471
- */
472
- function listingTemplate(listing) {
473
- if (listing.template !== undefined)
474
- return listing.template;
475
- if (listing.document === undefined)
476
- return TEMPLATES.home;
477
- return themeTemplate(themes.current().dirs, OPTIONAL_TEMPLATES.postsPage, TEMPLATES.home);
478
- }
479
- /**
480
- * One document through one template, with everything a page of the theme is
481
- * given: its own context, its ActivityStreams id, its conversation, its
482
- * forms and its webmention endpoint.
483
- *
484
- * The template and the URL are arguments because the front page is the same
485
- * page rendered somewhere else: `renderDocument` and `renderFrontPage` are
486
- * this with two different answers to "which layout, and at which URL".
487
- */
488
- function documentPage(document, options_) {
489
- const { template, extra } = options_;
490
- // The profile behind the document's `author`, resolved here rather than in
491
- // `documentContext` for the reason the object id is: it needs the site's
492
- // users, which a document on its own does not carry.
493
- const writer = authorContext(users(), document.author);
494
- const context = documentContext(document, config, writer, { lead: true }, citedPage);
495
- // The URL it is being served at, which is its own permalink everywhere but
496
- // the front page.
497
- const url = options_.url ?? context.url;
498
- // `activityStreams` is the object id the base layout advertises. It is
499
- // added here rather than in `documentContext` because it needs the
500
- // site's base URL, which a document on its own does not carry.
501
- const now = config.now();
502
- const naturalId = activityStreamsId(document, config.baseUrl, now);
503
- const objectId = naturalId === undefined
504
- ? undefined
505
- : currentObjectId(readObjectIds(config.contentDir), naturalId);
506
- // `conversation` is what was said back. It is on the context only when
507
- // there is something in it, so a theme can ask `{% if conversation %}`
508
- // and a post nobody has answered renders no empty section (TASK-49).
509
- // `commentsFeed` is where it is syndicated, for a served document, and
510
- // is set here rather than in a layout so that a site which
511
- // overrides `post.njk` or `page.njk` keeps the link.
512
- const site = siteData.read();
513
- const settings = requestSite();
514
- const said = options.conversation?.(document, settings);
515
- const feedsIt = isServed(document, now);
516
- // `commentForm` is on the context only when the post is open, so the
517
- // theme asks `{% if commentForm %}` rather than working the rules out
518
- // for itself — and a closed post shows the thread with no form.
519
- const stamps = [];
520
- const form = heldStamp(options.commentForm?.(document, options_.viewer, requestInputs.getStore()?.mailConfigured === true), 'comment', stamps);
521
- // And the contact form, when the page's front matter asked for one
522
- // (TASK-56). Nothing about where a message would go is on the context:
523
- // the address is read when a submission arrives, so a theme cannot
524
- // print it however it is written.
525
- const contact = heldStamp(options.contactForm?.(document), 'contact', stamps);
526
- // Where a webmention about this page is sent (TASK-51). On the context
527
- // only when the site takes them, so a theme asks `{% if webmention %}`
528
- // and a site that has turned them off advertises nothing.
529
- const webmention = webmentionEndpointFor(site);
530
- const pingback = pingbackEndpointFor(site);
531
- // The posts either side of this one, as the two links a theme draws under
532
- // an entry (TASK-79). Each is on the context only when there is one, so a
533
- // theme asks `{% if previous %}` and the ends of the archive draw nothing.
534
- const either = options.neighbours?.(document) ?? {};
535
- const cited = citedBy(document);
536
- // The targets this post links to and the copies they made of it
537
- // (TASK-155): the links a target verifies sit inside the h-entry, so they
538
- // are on the post's own page, which is the page a target fetches.
539
- const syndicated = options.syndication?.(document, settings);
540
- const shared = options.location?.(document, settings);
541
- const drawn = render(template, {
542
- ...context,
543
- // This page's own person, which is the site's author everywhere else:
544
- // the byline and the identity a theme prints are one object, so what a
545
- // reader sees and what the structured data says cannot drift.
546
- ...(writer === undefined ? {} : { siteAuthor: writer }),
547
- ...neighbourContext('previous', either.previous, citedPage),
548
- ...neighbourContext('next', either.next, citedPage),
549
- backlinks: (options.backlinks?.(document) ?? []).map((linking) => backlinkContext(linking, citedPage)),
550
- url,
551
- page: { ...context.page, url },
552
- ...capsuleContext(url),
553
- ...(objectId === undefined ? {} : { activityStreams: objectId }),
554
- ...(feedsIt ? { commentsFeed: commentsFeedPath(document.permalink) } : {}),
555
- // And the whole archive, for a page whose front matter asked for it
556
- // (TASK-85). On the context only for that page, so a theme asks
557
- // `{% if archiveMonths %}` exactly as it asks about the contact form.
558
- ...archiveContext(document),
559
- ...(said === undefined || said.counts.total === 0 ? {} : { conversation: said }),
560
- ...(form === undefined ? {} : { commentForm: form }),
561
- ...(contact === undefined ? {} : { contactForm: contact }),
562
- ...(webmention === undefined ? {} : { webmention }),
563
- ...(pingback === undefined ? {} : { pingback }),
564
- ...cited,
565
- syndicateTo: syndicated?.targets ?? [],
566
- syndication: syndicationLinks([
567
- ...handSyndicationOf(document.extra),
568
- ...(syndicated?.copies ?? []),
569
- ]),
570
- ...(shared === undefined ? {} : { location: locationContext(shared) }),
571
- ...(visibilityOf(document) === 'unlisted' ? { noindex: true } : {}),
572
- ...extra,
573
- });
574
- // Only a stamp the theme printed can go stale in a reader's browser.
575
- const printed = stamps.filter(([mark]) => drawn.includes(mark));
576
- return {
577
- html: printed.reduce((html, [mark, loaded]) => html.replaceAll(mark, loaded), drawn),
578
- fingerprint: [
579
- // The mark is random per renderer; a restart must not change every ETag.
580
- drawn.replaceAll(stampMark, 'geekity-stamp'),
581
- ...printed.map(([, loaded]) => String(Math.floor(Number(loaded) / STAMP_WINDOW_MS))),
582
- ].join('\n'),
583
- };
584
- }
585
- /** One document's page and its fingerprint, as {@link Renderer.renderPage} says. */
586
- function renderPage(document, { frontPage = false, extra = {}, viewer }) {
587
- if (!frontPage) {
588
- return documentPage(document, {
589
- template: document.type === 'post' ? TEMPLATES.post : TEMPLATES.page,
590
- extra,
591
- viewer,
592
- });
593
- }
594
- return documentPage(document, {
595
- // A theme's own front page if it has written one, and the layout every
596
- // other page uses if it has not.
597
- template: themeTemplate(themes.current().dirs, OPTIONAL_TEMPLATES.frontPage, TEMPLATES.page),
598
- // At `/`, which is where it is being read: the canonical link, the
599
- // menu's current item and anything else a theme takes off `page.url`
600
- // should say the URL this is served at rather than the one that
601
- // redirects here.
602
- url: '/',
603
- extra: { ...newestPostsContext(document), ...postsPageContext(), ...extra },
604
- viewer,
605
- });
606
- }
607
- /** A form with its loaded-at stamp swapped for a mark, noted for putting back. */
608
- function heldStamp(form, key, stamps) {
609
- if (form === undefined)
610
- return undefined;
611
- const mark = `${stampMark}-${key}`;
612
- stamps.push([mark, form.loaded]);
613
- return { ...form, loaded: mark };
614
- }
615
- function capsuleContext(url) {
616
- const { pathname, search } = new URL(absoluteUrl(url, config.baseUrl));
617
- const capsule = capsuleUrl(config, requestSite(), representationHref(`${pathname}${search}`, 'gemini'));
618
- return capsule === undefined ? {} : { capsuleUrl: capsule };
619
- }
12
+ const deps = renderDeps(options);
13
+ const { siteData, themes } = deps;
14
+ const theme = createThemeEnvironment(deps);
15
+ const { render } = theme;
16
+ const markdown = createMarkdownEnvironment(deps);
17
+ const contexts = createPageContexts(deps);
18
+ const { renderPage } = createDocumentPages(deps, render, contexts);
620
19
  function statusPage({ template, title }, url, extra = {}) {
621
20
  return render(template, { title, url, page: { url }, ...extra });
622
21
  }
623
- function renderMarkdownChrome(chrome, { markdownUrl, frontPage, document, format }) {
624
- const site = siteData.read();
625
- const soloAuthor = siteAuthorContext(users(), site.author);
626
- const context = {
627
- site,
628
- menus: navigationMenus({ site, url: chrome.url }),
629
- navigation: navigationLinks(site),
630
- ...(soloAuthor === undefined ? {} : { soloAuthor }),
631
- ...(frontPage === undefined ? {} : newestPostsContext(frontPage)),
632
- ...markdownArchiveContext(document, format === 'gemini'),
633
- ...markdownLinksContext(document),
634
- ...markdownKindContext(document),
635
- ...markdownConversationContext(document, chrome.url),
636
- home: HOME_LINK,
637
- ...chrome,
638
- bio: chrome.bio ?? (chrome.url === '/' ? bioOf(soloAuthor) : undefined),
639
- staticFrontPage: frontPage !== undefined,
640
- markdownUrl,
641
- ...(format === 'gemini' ? { geminiUrl: markdownUrl } : {}),
642
- ...(format === 'markdown' && chrome.type !== 'status' ? capsuleContext(chrome.url) : {}),
643
- };
644
- return {
645
- header: renderText(CHROME_TEMPLATES.header, format, context),
646
- footer: renderText(CHROME_TEMPLATES.footer, format, context),
647
- };
648
- }
649
- function renderText(templates, format, context) {
650
- const { dirs } = themes.current();
651
- useThemeDirs(markdownEnvironment, dirs);
652
- const written = format === 'gemini' && writesGemtext(dirs, templates) ? 'gemini' : 'markdown';
653
- return { format: written, text: markdownEnvironment.render(templates[written], context) };
654
- }
655
22
  return {
656
- environment,
657
- markdownEnvironment,
658
- renderMarkdownChrome,
659
- site() {
660
- return siteData.read();
661
- },
662
- themeDirs() {
663
- return themes.current().dirs;
664
- },
665
- themeColors() {
666
- return themes.current().colors;
667
- },
668
- siteColors() {
669
- const chosen = themes.current();
670
- const colors = siteColors(siteData.read(), chosen.schemes);
671
- if (colors === undefined)
672
- return undefined;
673
- const stylesheet = findThemeFile(chosen.dirs, 'static/style.css');
674
- const tokens = stylesheet === undefined
675
- ? { light: new Map(), dark: new Map() }
676
- : schemeTokens(stylesheet, colors.scheme.name);
677
- return { ...colors, tokens };
678
- },
679
- pageSize() {
680
- return postsPerPage(siteData.read());
681
- },
682
- taxonomyBases() {
683
- return taxonomyBases(siteData.read());
684
- },
685
- termRedirects() {
686
- return termRedirects(siteData.read());
687
- },
688
- frontPageSlugs() {
689
- return frontPageSlugs(siteData.read());
690
- },
23
+ environment: theme.environment,
24
+ markdownEnvironment: markdown.environment,
25
+ ...createMarkdownChrome(deps, markdown, contexts),
26
+ ...createListingPages(deps, render, contexts),
27
+ site: () => siteData.read(),
28
+ themeDirs: () => themes.current().dirs,
29
+ themeColors: () => themes.current().colors,
30
+ siteColors: () => siteColorsWithTokens(deps),
31
+ pageSize: () => postsPerPage(siteData.read()),
32
+ taxonomyBases: () => taxonomyBases(siteData.read()),
33
+ termRedirects: () => termRedirects(siteData.read()),
34
+ frontPageSlugs: () => frontPageSlugs(siteData.read()),
691
35
  renderPage,
692
- renderDocument(document, extra = {}, viewer = undefined) {
693
- return renderPage(document, { extra, viewer }).html;
694
- },
695
- renderFrontPage(document, extra = {}, viewer = undefined) {
696
- return renderPage(document, { frontPage: true, extra, viewer }).html;
697
- },
698
- renderListing(listing) {
699
- // One read of the users file for the whole page, however many posts are
700
- // on it: every byline on a listing resolves against the same list.
701
- const people = users();
702
- // The first image on the page is fetched at once: the posts page's own
703
- // when its body has one, since it is printed above the list, else the
704
- // first entry's.
705
- const bodyLeads = listing.document?.html.includes('<img') === true;
706
- const items = listing.documents.map((document, index) => entryContext(document, people, { lead: !bodyLeads && index === 0 }));
707
- // The posts page's own front matter and rendered body, under the
708
- // listing's title, URL and posts: a theme prints `{{ content | safe }}`
709
- // above the list and a site without a posts page has nothing there. The
710
- // listing's own keys go on after it, because this page of the listing is
711
- // what is being served — page two of it is not the page's own URL.
712
- const document = listing.document === undefined
713
- ? undefined
714
- : documentContext(listing.document, config, authorContext(people, listing.document.author), { lead: bodyLeads }, citedPage);
715
- return render(listingTemplate(listing), {
716
- ...document,
717
- title: listing.title,
718
- url: listing.url,
719
- page: { ...document?.page, url: listing.url },
720
- ...capsuleContext(listing.url),
721
- // `posts` is the friendly name a theme loops over; `pagination.items`
722
- // is the same array under the name Eleventy gives it.
723
- posts: items,
724
- pagination: { ...listing.pagination, items },
725
- ...(listing.tag === undefined ? {} : { tag: listing.tag }),
726
- ...(listing.category === undefined ? {} : { category: listing.category }),
727
- // On an author archive this is the person the archive is of, and it
728
- // goes on last so it wins over the posts page's own `author`, which is
729
- // the page's writer rather than whose archive this is. They are also
730
- // whose page this is, so the identity a theme prints is theirs rather
731
- // than the site's.
732
- ...(listing.author === undefined
733
- ? {}
734
- : { author: listing.author, siteAuthor: listing.author }),
735
- });
736
- },
737
- renderSearch(search) {
738
- const people = users();
739
- const items = search.hits.map((hit) => ({
740
- ...documentContext(hit.document, config, authorContext(people, hit.document.author), undefined, citedPage),
741
- // Escaped here and marked up here, so a theme prints it with `safe`
742
- // and cannot get the order of the two wrong.
743
- snippet: snippetHtml(hit.snippet),
744
- }));
745
- return render(TEMPLATES.search, {
746
- title: search.query === '' ? 'Search' : `Search results for “${search.query}”`,
747
- url: search.url,
748
- page: { url: search.url },
749
- ...capsuleContext(search.url),
750
- // The words as the reader typed them, for the form to put back in the
751
- // box and the heading to repeat. Autoescaped like any other string.
752
- query: search.query,
753
- posts: items,
754
- pagination: { ...search.pagination, items },
755
- });
756
- },
757
- renderComment({ post, comment, ancestors }) {
758
- const url = commentPageHref(comment.id);
759
- const on = entryContext(post, users(), { lead: false });
760
- return render(TEMPLATES.comment, {
761
- title: `${comment.author.name} on ${on.label}`,
762
- url,
763
- page: { url },
764
- ...capsuleContext(url),
765
- noindex: true,
766
- comment,
767
- ancestors,
768
- post: on,
769
- threadUrl: `${post.permalink}#${commentAnchor(comment.id)}`,
770
- });
771
- },
36
+ renderDocument: (document, extra = {}, viewer = undefined) => renderPage(document, { extra, viewer }).html,
37
+ renderFrontPage: (document, extra = {}, viewer = undefined) => renderPage(document, { frontPage: true, extra, viewer }).html,
772
38
  renderNotFound: (url) => statusPage(STATUS_PAGES.notFound, url),
773
39
  renderGone: (url) => statusPage(STATUS_PAGES.gone, url),
774
40
  renderServerError: (url) => statusPage(STATUS_PAGES.serverError, url),
775
41
  renderMaintenance: (url, until) => statusPage(STATUS_PAGES.maintenance, url, untilContext(until)),
776
- renderStatusMarkdown(page, { url, markdownUrl, until, format }) {
777
- const templates = STATUS_PAGES[page];
778
- return renderText(templates, format, {
779
- site: siteData.read(),
780
- url,
781
- title: templates.title,
782
- markdownUrl,
783
- ...(format === 'gemini' ? { geminiUrl: markdownUrl } : {}),
784
- ...untilContext(until),
785
- });
786
- },
787
42
  render,
788
43
  };
789
44
  }
790
- export const STATUS_PAGES = {
791
- notFound: {
792
- template: TEMPLATES.notFound,
793
- markdown: 'layouts/404.md.njk',
794
- gemini: 'layouts/404.gmi.njk',
795
- title: 'Not found',
796
- },
797
- gone: {
798
- template: TEMPLATES.gone,
799
- markdown: 'layouts/410.md.njk',
800
- gemini: 'layouts/410.gmi.njk',
801
- title: 'Deleted',
802
- },
803
- serverError: {
804
- template: TEMPLATES.serverError,
805
- markdown: 'layouts/500.md.njk',
806
- gemini: 'layouts/500.gmi.njk',
807
- title: 'Something went wrong',
808
- },
809
- maintenance: {
810
- template: TEMPLATES.maintenance,
811
- markdown: 'layouts/503.md.njk',
812
- gemini: 'layouts/503.gmi.njk',
813
- title: 'Down for maintenance',
814
- },
815
- };
816
- function writesGemtext(dirs, templates) {
817
- for (const dir of dirs) {
818
- if (findThemeFile([dir], templates.gemini) !== undefined)
819
- return true;
820
- if (findThemeFile([dir], templates.markdown) !== undefined)
821
- return false;
822
- }
823
- return false;
824
- }
825
- function untilContext(until) {
826
- return until === undefined ? {} : { until: until.toISOString(), untilText: until.toUTCString() };
827
- }
828
- /**
829
- * One neighbour under the name a theme reads it by, or nothing at all when
830
- * there is no post on that side.
831
- *
832
- * The title and the URL and no more: a link is what it says and where it goes,
833
- * and handing a theme a second document context would be handing it a second
834
- * post to print by accident.
835
- */
836
- function neighbourContext(key, document, cited) {
837
- if (document === undefined)
838
- return {};
839
- return { [key]: { title: postLabel(document, cited), url: document.permalink } };
840
- }
841
- /** Every line after the first indented by `width` spaces, blank lines left blank. */
842
- function nest(text, width) {
843
- const indent = ' '.repeat(width);
844
- return text.replace(/\n(?=[^\n])/g, `\n${indent}`);
845
- }
846
- /** Markdown as a blockquote: every line after `> `, a blank line as `>`. */
847
- function quote(text) {
848
- return text
849
- .trim()
850
- .split('\n')
851
- .map((line) => (line.trim() === '' ? '>' : `> ${line}`))
852
- .join('\n');
853
- }
854
- /** A filter's input as text: a string, number or boolean as written, anything else empty. */
855
- function filterText(value) {
856
- return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'
857
- ? String(value)
858
- : '';
859
- }
860
- /**
861
- * `preferred` when a theme in the search path ships it, and `fallback`
862
- * otherwise.
863
- *
864
- * Asked per render rather than at boot, so adding `front-page.njk` to a theme
865
- * shows on the next request exactly as editing one does. It costs one `stat`
866
- * per theme directory, and only on the two pages that have an override point
867
- * at all.
868
- */
869
- function themeTemplate(themeDirs, preferred, fallback) {
870
- return findThemeFile(themeDirs, preferred) === undefined ? fallback : preferred;
871
- }
872
- function svgElseTouchIconHref(icons) {
873
- return (icons.find((icon) => icon.type === 'image/svg+xml') ??
874
- icons.find((icon) => icon.rel === 'apple-touch-icon'))?.href;
875
- }
876
- /**
877
- * The path a render is of, for marking the current menu item.
878
- *
879
- * Read off `page.url` and then `url`, the two names every caller here already
880
- * sets, so nothing has to pass the path a third time. A template rendered with
881
- * neither — a site calling `render` for a fragment of its own — is treated as
882
- * the home page's, which marks nothing that a page of the site would not.
883
- */
884
- function currentUrl(context) {
885
- const page = context['page'];
886
- if (typeof page === 'object' && page !== null) {
887
- const url = page['url'];
888
- if (typeof url === 'string')
889
- return url;
890
- }
891
- return typeof context['url'] === 'string' ? context['url'] : '/';
892
- }
893
- /**
894
- * A stored reply context as a theme reads it: the published instant as a
895
- * `Date`, so the `date` filter prints it in the site's zone like any other.
896
- */
897
- function replyContextFor(context) {
898
- const published = context.published === undefined ? undefined : new Date(context.published);
899
- const { published: _published, ...rest } = context;
900
- const dated = published === undefined || Number.isNaN(published.getTime()) ? rest : { ...rest, published };
901
- return { ...dated, ...eventStartFor(context.start) };
902
- }
903
- function eventStartFor(written) {
904
- const start = readCitedStart(written ?? '');
905
- if (start === undefined)
906
- return {};
907
- return start.kind === 'wall-clock'
908
- ? { startDate: start.asUtc, startZone: 'UTC' }
909
- : { startDate: start.at };
910
- }
911
- function licenseContext(site, context) {
912
- return { license: resolveLicense(site, context), siteLicense: resolveLicense(site) };
45
+ function renderDeps(options) {
46
+ const { config, replyContext } = options;
47
+ const siteData = createSiteDataSource(config);
48
+ return {
49
+ options,
50
+ config,
51
+ siteData,
52
+ themes: options.themes ??
53
+ createThemeSource({ themesDir: config.themesDir, chosen: () => themeName(siteData.read()) }),
54
+ pages: options.pages ?? (() => []),
55
+ users: options.users ?? (() => []),
56
+ citedPage: replyContext === undefined
57
+ ? undefined
58
+ : (url) => replyContext(url, requestSite()),
59
+ };
913
60
  }
914
61
  //# sourceMappingURL=render.js.map