@kensio/colophon 2.5.0 → 2.6.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 (622) hide show
  1. package/README.md +91 -13
  2. package/dist/astro/index.d.ts +49 -0
  3. package/dist/astro/index.d.ts.map +1 -0
  4. package/dist/astro/index.js +42 -0
  5. package/dist/astro/index.js.map +1 -0
  6. package/dist/cli/args/command.d.ts +13 -0
  7. package/dist/cli/args/command.d.ts.map +1 -0
  8. package/dist/cli/args/command.js +22 -0
  9. package/dist/cli/args/command.js.map +1 -0
  10. package/dist/cli/args/index.d.ts +28 -0
  11. package/dist/cli/args/index.d.ts.map +1 -0
  12. package/dist/cli/args/index.js +75 -0
  13. package/dist/cli/args/index.js.map +1 -0
  14. package/dist/cli/args/switches.d.ts +18 -0
  15. package/dist/cli/args/switches.d.ts.map +1 -0
  16. package/dist/cli/args/switches.js +42 -0
  17. package/dist/cli/args/switches.js.map +1 -0
  18. package/dist/cli/args/usage.d.ts +3 -0
  19. package/dist/cli/args/usage.d.ts.map +1 -0
  20. package/dist/cli/args/usage.js +34 -0
  21. package/dist/cli/args/usage.js.map +1 -0
  22. package/dist/cli/args/values.d.ts +11 -0
  23. package/dist/cli/args/values.d.ts.map +1 -0
  24. package/dist/cli/args/values.js +29 -0
  25. package/dist/cli/args/values.js.map +1 -0
  26. package/dist/cli/build.d.ts +10 -0
  27. package/dist/cli/build.d.ts.map +1 -0
  28. package/dist/cli/build.js +41 -0
  29. package/dist/cli/build.js.map +1 -0
  30. package/dist/cli/eject/adapters.d.ts +20 -0
  31. package/dist/cli/eject/adapters.d.ts.map +1 -0
  32. package/dist/cli/eject/adapters.js +29 -0
  33. package/dist/cli/eject/adapters.js.map +1 -0
  34. package/dist/cli/eject/astro.d.ts +13 -0
  35. package/dist/cli/eject/astro.d.ts.map +1 -0
  36. package/dist/cli/eject/astro.js +35 -0
  37. package/dist/cli/eject/astro.js.map +1 -0
  38. package/dist/cli/eject/hugo.d.ts +19 -0
  39. package/dist/cli/eject/hugo.d.ts.map +1 -0
  40. package/dist/cli/eject/hugo.js +127 -0
  41. package/dist/cli/eject/hugo.js.map +1 -0
  42. package/dist/cli/eject/index.d.ts +15 -0
  43. package/dist/cli/eject/index.d.ts.map +1 -0
  44. package/dist/cli/eject/index.js +46 -0
  45. package/dist/cli/eject/index.js.map +1 -0
  46. package/dist/cli/index.js +25 -20
  47. package/dist/cli/index.js.map +1 -1
  48. package/dist/cli/init/fs.d.ts +5 -0
  49. package/dist/cli/init/fs.d.ts.map +1 -0
  50. package/dist/cli/init/fs.js +19 -0
  51. package/dist/cli/init/fs.js.map +1 -0
  52. package/dist/cli/init/guess.d.ts +9 -0
  53. package/dist/cli/init/guess.d.ts.map +1 -0
  54. package/dist/cli/init/guess.js +27 -0
  55. package/dist/cli/init/guess.js.map +1 -0
  56. package/dist/cli/init/index.d.ts +11 -0
  57. package/dist/cli/init/index.d.ts.map +1 -0
  58. package/dist/cli/init/index.js +36 -0
  59. package/dist/cli/init/index.js.map +1 -0
  60. package/dist/cli/init/module.d.ts +12 -0
  61. package/dist/cli/init/module.d.ts.map +1 -0
  62. package/dist/cli/init/module.js +45 -0
  63. package/dist/cli/init/module.js.map +1 -0
  64. package/dist/cli/init/scaffold.d.ts +10 -0
  65. package/dist/cli/init/scaffold.d.ts.map +1 -0
  66. package/dist/cli/init/scaffold.js +52 -0
  67. package/dist/cli/init/scaffold.js.map +1 -0
  68. package/dist/cli/message.d.ts +7 -0
  69. package/dist/cli/message.d.ts.map +1 -0
  70. package/dist/cli/message.js +9 -0
  71. package/dist/cli/message.js.map +1 -0
  72. package/dist/cli/preview/index.d.ts +13 -0
  73. package/dist/cli/preview/index.d.ts.map +1 -0
  74. package/dist/cli/preview/index.js +27 -0
  75. package/dist/cli/preview/index.js.map +1 -0
  76. package/dist/cli/preview/open.d.ts +10 -0
  77. package/dist/cli/preview/open.d.ts.map +1 -0
  78. package/dist/cli/preview/open.js +32 -0
  79. package/dist/cli/preview/open.js.map +1 -0
  80. package/dist/cli/preview/render.d.ts +23 -0
  81. package/dist/cli/preview/render.d.ts.map +1 -0
  82. package/dist/cli/preview/render.js +40 -0
  83. package/dist/cli/preview/render.js.map +1 -0
  84. package/dist/cli/preview/root.d.ts +17 -0
  85. package/dist/cli/preview/root.d.ts.map +1 -0
  86. package/dist/cli/preview/root.js +22 -0
  87. package/dist/cli/preview/root.js.map +1 -0
  88. package/dist/cli/preview/size.d.ts +7 -0
  89. package/dist/cli/preview/size.d.ts.map +1 -0
  90. package/dist/cli/preview/size.js +13 -0
  91. package/dist/cli/preview/size.js.map +1 -0
  92. package/dist/cli/report.d.ts +6 -0
  93. package/dist/cli/report.d.ts.map +1 -0
  94. package/dist/cli/report.js +23 -0
  95. package/dist/cli/report.js.map +1 -0
  96. package/dist/cli/watch/filter.d.ts +14 -0
  97. package/dist/cli/watch/filter.d.ts.map +1 -0
  98. package/dist/cli/watch/filter.js +16 -0
  99. package/dist/cli/watch/filter.js.map +1 -0
  100. package/dist/cli/watch/index.d.ts +27 -0
  101. package/dist/cli/watch/index.d.ts.map +1 -0
  102. package/dist/cli/watch/index.js +38 -0
  103. package/dist/cli/watch/index.js.map +1 -0
  104. package/dist/cli/watch/queue.d.ts +24 -0
  105. package/dist/cli/watch/queue.d.ts.map +1 -0
  106. package/dist/cli/watch/queue.js +57 -0
  107. package/dist/cli/watch/queue.js.map +1 -0
  108. package/dist/config/defaults.d.ts +39 -1
  109. package/dist/config/defaults.d.ts.map +1 -1
  110. package/dist/config/defaults.js +38 -0
  111. package/dist/config/defaults.js.map +1 -1
  112. package/dist/config/index.d.ts +1 -1
  113. package/dist/config/index.d.ts.map +1 -1
  114. package/dist/config/index.js +18 -4
  115. package/dist/config/index.js.map +1 -1
  116. package/dist/config/output.d.ts +26 -0
  117. package/dist/config/output.d.ts.map +1 -0
  118. package/dist/config/output.js +45 -0
  119. package/dist/config/output.js.map +1 -0
  120. package/dist/config/resolve.d.ts +10 -0
  121. package/dist/config/resolve.d.ts.map +1 -1
  122. package/dist/config/resolve.js +20 -1
  123. package/dist/config/resolve.js.map +1 -1
  124. package/dist/content/index.d.ts +1 -0
  125. package/dist/content/index.d.ts.map +1 -1
  126. package/dist/content/index.js +1 -0
  127. package/dist/content/index.js.map +1 -1
  128. package/dist/content/read.d.ts +15 -0
  129. package/dist/content/read.d.ts.map +1 -0
  130. package/dist/content/read.js +36 -0
  131. package/dist/content/read.js.map +1 -0
  132. package/dist/content/walk.d.ts.map +1 -1
  133. package/dist/content/walk.js +4 -30
  134. package/dist/content/walk.js.map +1 -1
  135. package/dist/core/index.d.ts +37 -0
  136. package/dist/core/index.d.ts.map +1 -0
  137. package/dist/core/index.js +13 -0
  138. package/dist/core/index.js.map +1 -0
  139. package/dist/encode/fit.d.ts +16 -0
  140. package/dist/encode/fit.d.ts.map +1 -0
  141. package/dist/encode/fit.js +23 -0
  142. package/dist/encode/fit.js.map +1 -0
  143. package/dist/encode/format.d.ts +12 -0
  144. package/dist/encode/format.d.ts.map +1 -0
  145. package/dist/encode/format.js +40 -0
  146. package/dist/encode/format.js.map +1 -0
  147. package/dist/encode/index.d.ts +14 -0
  148. package/dist/encode/index.d.ts.map +1 -0
  149. package/dist/encode/index.js +52 -0
  150. package/dist/encode/index.js.map +1 -0
  151. package/dist/encode/sharp.d.ts +19 -0
  152. package/dist/encode/sharp.d.ts.map +1 -0
  153. package/dist/encode/sharp.js +57 -0
  154. package/dist/encode/sharp.js.map +1 -0
  155. package/dist/encode/warn.d.ts +10 -0
  156. package/dist/encode/warn.d.ts.map +1 -0
  157. package/dist/encode/warn.js +31 -0
  158. package/dist/encode/warn.js.map +1 -0
  159. package/dist/fonts/resolve.d.ts.map +1 -1
  160. package/dist/fonts/resolve.js +2 -8
  161. package/dist/fonts/resolve.js.map +1 -1
  162. package/dist/generate/index.d.ts +4 -0
  163. package/dist/generate/index.d.ts.map +1 -1
  164. package/dist/generate/index.js +10 -4
  165. package/dist/generate/index.js.map +1 -1
  166. package/dist/generate/options.d.ts +11 -1
  167. package/dist/generate/options.d.ts.map +1 -1
  168. package/dist/generate/options.js.map +1 -1
  169. package/dist/generate/output-path.d.ts +6 -2
  170. package/dist/generate/output-path.d.ts.map +1 -1
  171. package/dist/generate/output-path.js +7 -2
  172. package/dist/generate/output-path.js.map +1 -1
  173. package/dist/generate/plan.d.ts.map +1 -1
  174. package/dist/generate/plan.js +3 -3
  175. package/dist/generate/plan.js.map +1 -1
  176. package/dist/generate/render-image.d.ts +6 -0
  177. package/dist/generate/render-image.d.ts.map +1 -1
  178. package/dist/generate/render-image.js +14 -4
  179. package/dist/generate/render-image.js.map +1 -1
  180. package/dist/image/index.d.ts +3 -1
  181. package/dist/image/index.d.ts.map +1 -1
  182. package/dist/image/index.js +4 -3
  183. package/dist/image/index.js.map +1 -1
  184. package/dist/image/jpeg.d.ts +5 -4
  185. package/dist/image/jpeg.d.ts.map +1 -1
  186. package/dist/image/jpeg.js +13 -36
  187. package/dist/image/jpeg.js.map +1 -1
  188. package/dist/image/load.d.ts.map +1 -1
  189. package/dist/image/load.js +4 -15
  190. package/dist/image/load.js.map +1 -1
  191. package/dist/image/resolve.d.ts.map +1 -1
  192. package/dist/image/resolve.js +2 -8
  193. package/dist/image/resolve.js.map +1 -1
  194. package/dist/image/uri.d.ts.map +1 -1
  195. package/dist/image/uri.js +2 -3
  196. package/dist/image/uri.js.map +1 -1
  197. package/dist/index.d.ts +8 -4
  198. package/dist/index.d.ts.map +1 -1
  199. package/dist/index.js +10 -3
  200. package/dist/index.js.map +1 -1
  201. package/dist/jpeg/index.d.ts +10 -0
  202. package/dist/jpeg/index.d.ts.map +1 -0
  203. package/dist/jpeg/index.js +2 -0
  204. package/dist/jpeg/index.js.map +1 -0
  205. package/dist/jpeg/segments.d.ts +32 -0
  206. package/dist/jpeg/segments.d.ts.map +1 -0
  207. package/dist/jpeg/segments.js +66 -0
  208. package/dist/jpeg/segments.js.map +1 -0
  209. package/dist/layout/draw.d.ts +20 -0
  210. package/dist/layout/draw.d.ts.map +1 -0
  211. package/dist/layout/draw.js +32 -0
  212. package/dist/layout/draw.js.map +1 -0
  213. package/dist/layout/extent.d.ts +19 -0
  214. package/dist/layout/extent.d.ts.map +1 -0
  215. package/dist/layout/extent.js +24 -0
  216. package/dist/layout/extent.js.map +1 -0
  217. package/dist/layout/index.d.ts +7 -4
  218. package/dist/layout/index.d.ts.map +1 -1
  219. package/dist/layout/index.js +5 -3
  220. package/dist/layout/index.js.map +1 -1
  221. package/dist/layout/lines.d.ts +0 -17
  222. package/dist/layout/lines.d.ts.map +1 -1
  223. package/dist/layout/lines.js +2 -35
  224. package/dist/layout/lines.js.map +1 -1
  225. package/dist/measure/faces.d.ts.map +1 -1
  226. package/dist/measure/faces.js +8 -2
  227. package/dist/measure/faces.js.map +1 -1
  228. package/dist/meta/index.d.ts +1 -0
  229. package/dist/meta/index.d.ts.map +1 -1
  230. package/dist/meta/index.js +1 -0
  231. package/dist/meta/index.js.map +1 -1
  232. package/dist/meta/path.d.ts +24 -0
  233. package/dist/meta/path.d.ts.map +1 -0
  234. package/dist/meta/path.js +41 -0
  235. package/dist/meta/path.js.map +1 -0
  236. package/dist/meta/tags.d.ts.map +1 -1
  237. package/dist/meta/tags.js +6 -1
  238. package/dist/meta/tags.js.map +1 -1
  239. package/dist/placement/index.d.ts +7 -2
  240. package/dist/placement/index.d.ts.map +1 -1
  241. package/dist/placement/index.js +9 -3
  242. package/dist/placement/index.js.map +1 -1
  243. package/dist/placement/relative.d.ts +8 -3
  244. package/dist/placement/relative.d.ts.map +1 -1
  245. package/dist/placement/relative.js +12 -5
  246. package/dist/placement/relative.js.map +1 -1
  247. package/dist/platform/base64.d.ts +13 -0
  248. package/dist/platform/base64.d.ts.map +1 -0
  249. package/dist/platform/base64.js +35 -0
  250. package/dist/platform/base64.js.map +1 -0
  251. package/dist/platform/rasteriser.browser.d.ts +16 -0
  252. package/dist/platform/rasteriser.browser.d.ts.map +1 -0
  253. package/dist/platform/rasteriser.browser.js +20 -0
  254. package/dist/platform/rasteriser.browser.js.map +1 -0
  255. package/dist/platform/rasteriser.node.d.ts +2 -0
  256. package/dist/platform/rasteriser.node.d.ts.map +1 -0
  257. package/dist/platform/rasteriser.node.js +2 -0
  258. package/dist/platform/rasteriser.node.js.map +1 -0
  259. package/dist/platform/read-file.browser.d.ts +17 -0
  260. package/dist/platform/read-file.browser.d.ts.map +1 -0
  261. package/dist/platform/read-file.browser.js +23 -0
  262. package/dist/platform/read-file.browser.js.map +1 -0
  263. package/dist/platform/read-file.node.d.ts +19 -0
  264. package/dist/platform/read-file.node.d.ts.map +1 -0
  265. package/dist/platform/read-file.node.js +31 -0
  266. package/dist/platform/read-file.node.js.map +1 -0
  267. package/dist/png/chunk.d.ts +23 -0
  268. package/dist/png/chunk.d.ts.map +1 -0
  269. package/dist/png/chunk.js +48 -0
  270. package/dist/png/chunk.js.map +1 -0
  271. package/dist/png/index.d.ts +13 -0
  272. package/dist/png/index.d.ts.map +1 -0
  273. package/dist/png/index.js +3 -0
  274. package/dist/png/index.js.map +1 -0
  275. package/dist/png/recompress.d.ts +23 -0
  276. package/dist/png/recompress.d.ts.map +1 -0
  277. package/dist/png/recompress.js +81 -0
  278. package/dist/png/recompress.js.map +1 -0
  279. package/dist/props.d.ts +11 -0
  280. package/dist/props.d.ts.map +1 -1
  281. package/dist/props.js +16 -0
  282. package/dist/props.js.map +1 -1
  283. package/dist/render/image.d.ts +20 -0
  284. package/dist/render/image.d.ts.map +1 -0
  285. package/dist/render/image.js +29 -0
  286. package/dist/render/image.js.map +1 -0
  287. package/dist/render/index.d.ts +2 -1
  288. package/dist/render/index.d.ts.map +1 -1
  289. package/dist/render/index.js +5 -4
  290. package/dist/render/index.js.map +1 -1
  291. package/dist/render/png.d.ts +14 -4
  292. package/dist/render/png.d.ts.map +1 -1
  293. package/dist/render/png.js +22 -23
  294. package/dist/render/png.js.map +1 -1
  295. package/dist/render/rasterise.d.ts +15 -0
  296. package/dist/render/rasterise.d.ts.map +1 -0
  297. package/dist/render/rasterise.js +34 -0
  298. package/dist/render/rasterise.js.map +1 -0
  299. package/dist/render/svg.d.ts.map +1 -1
  300. package/dist/render/svg.js +1 -0
  301. package/dist/render/svg.js.map +1 -1
  302. package/dist/sign/base64url.d.ts +16 -0
  303. package/dist/sign/base64url.d.ts.map +1 -0
  304. package/dist/sign/base64url.js +24 -0
  305. package/dist/sign/base64url.js.map +1 -0
  306. package/dist/sign/index.d.ts +49 -0
  307. package/dist/sign/index.d.ts.map +1 -0
  308. package/dist/sign/index.js +133 -0
  309. package/dist/sign/index.js.map +1 -0
  310. package/dist/stamp/carrier/index.d.ts +7 -0
  311. package/dist/stamp/carrier/index.d.ts.map +1 -0
  312. package/dist/stamp/carrier/index.js +27 -0
  313. package/dist/stamp/carrier/index.js.map +1 -0
  314. package/dist/stamp/carrier/isobmff.d.ts +7 -0
  315. package/dist/stamp/carrier/isobmff.d.ts.map +1 -0
  316. package/dist/stamp/carrier/isobmff.js +55 -0
  317. package/dist/stamp/carrier/isobmff.js.map +1 -0
  318. package/dist/stamp/carrier/jpeg.d.ts +4 -0
  319. package/dist/stamp/carrier/jpeg.d.ts.map +1 -0
  320. package/dist/stamp/carrier/jpeg.js +76 -0
  321. package/dist/stamp/carrier/jpeg.js.map +1 -0
  322. package/dist/stamp/carrier/png.d.ts +7 -0
  323. package/dist/stamp/carrier/png.d.ts.map +1 -0
  324. package/dist/stamp/carrier/png.js +50 -0
  325. package/dist/stamp/carrier/png.js.map +1 -0
  326. package/dist/stamp/carrier/riff.d.ts +4 -0
  327. package/dist/stamp/carrier/riff.d.ts.map +1 -0
  328. package/dist/stamp/carrier/riff.js +54 -0
  329. package/dist/stamp/carrier/riff.js.map +1 -0
  330. package/dist/stamp/carrier/types.d.ts +25 -0
  331. package/dist/stamp/carrier/types.d.ts.map +1 -0
  332. package/dist/stamp/carrier/types.js +2 -0
  333. package/dist/stamp/carrier/types.js.map +1 -0
  334. package/dist/stamp/chunk.d.ts +0 -2
  335. package/dist/stamp/chunk.d.ts.map +1 -1
  336. package/dist/stamp/chunk.js +10 -18
  337. package/dist/stamp/chunk.js.map +1 -1
  338. package/dist/stamp/config-digest.d.ts +18 -0
  339. package/dist/stamp/config-digest.d.ts.map +1 -1
  340. package/dist/stamp/config-digest.js +24 -0
  341. package/dist/stamp/config-digest.js.map +1 -1
  342. package/dist/stamp/index.d.ts +2 -2
  343. package/dist/stamp/index.d.ts.map +1 -1
  344. package/dist/stamp/index.js +2 -2
  345. package/dist/stamp/index.js.map +1 -1
  346. package/dist/stamp/payload.d.ts +28 -0
  347. package/dist/stamp/payload.d.ts.map +1 -0
  348. package/dist/stamp/payload.js +42 -0
  349. package/dist/stamp/payload.js.map +1 -0
  350. package/dist/stamp/read.d.ts +5 -4
  351. package/dist/stamp/read.d.ts.map +1 -1
  352. package/dist/stamp/read.js +26 -43
  353. package/dist/stamp/read.js.map +1 -1
  354. package/dist/stamp/window.d.ts +11 -0
  355. package/dist/stamp/window.d.ts.map +1 -0
  356. package/dist/stamp/window.js +11 -0
  357. package/dist/stamp/window.js.map +1 -0
  358. package/dist/stamp/write.d.ts +21 -0
  359. package/dist/stamp/write.d.ts.map +1 -0
  360. package/dist/stamp/write.js +31 -0
  361. package/dist/stamp/write.js.map +1 -0
  362. package/dist/templates/article/bottom.d.ts +15 -0
  363. package/dist/templates/article/bottom.d.ts.map +1 -0
  364. package/dist/templates/article/bottom.js +61 -0
  365. package/dist/templates/article/bottom.js.map +1 -0
  366. package/dist/templates/article/index.d.ts +12 -0
  367. package/dist/templates/article/index.d.ts.map +1 -0
  368. package/dist/templates/article/index.js +42 -0
  369. package/dist/templates/article/index.js.map +1 -0
  370. package/dist/templates/article/lines.d.ts +27 -0
  371. package/dist/templates/article/lines.d.ts.map +1 -0
  372. package/dist/templates/article/lines.js +53 -0
  373. package/dist/templates/article/lines.js.map +1 -0
  374. package/dist/templates/article/tags.d.ts +25 -0
  375. package/dist/templates/article/tags.d.ts.map +1 -0
  376. package/dist/templates/article/tags.js +63 -0
  377. package/dist/templates/article/tags.js.map +1 -0
  378. package/dist/templates/attribution.d.ts +2 -6
  379. package/dist/templates/attribution.d.ts.map +1 -1
  380. package/dist/templates/attribution.js +8 -22
  381. package/dist/templates/attribution.js.map +1 -1
  382. package/dist/templates/banner/version.d.ts.map +1 -1
  383. package/dist/templates/banner/version.js +4 -4
  384. package/dist/templates/banner/version.js.map +1 -1
  385. package/dist/templates/bottom.d.ts +23 -0
  386. package/dist/templates/bottom.d.ts.map +1 -0
  387. package/dist/templates/bottom.js +37 -0
  388. package/dist/templates/bottom.js.map +1 -0
  389. package/dist/templates/byline.d.ts +19 -0
  390. package/dist/templates/byline.d.ts.map +1 -0
  391. package/dist/templates/byline.js +45 -0
  392. package/dist/templates/byline.js.map +1 -0
  393. package/dist/templates/code/clip.js +1 -1
  394. package/dist/templates/code/clip.js.map +1 -1
  395. package/dist/templates/code/fit.js +1 -1
  396. package/dist/templates/code/fit.js.map +1 -1
  397. package/dist/templates/code/warn.d.ts +1 -1
  398. package/dist/templates/code/warn.d.ts.map +1 -1
  399. package/dist/templates/code/warn.js +2 -2
  400. package/dist/templates/code/warn.js.map +1 -1
  401. package/dist/templates/docs/chrome.d.ts +17 -0
  402. package/dist/templates/docs/chrome.d.ts.map +1 -0
  403. package/dist/templates/docs/chrome.js +44 -0
  404. package/dist/templates/docs/chrome.js.map +1 -0
  405. package/dist/templates/docs/crumbs.d.ts +14 -0
  406. package/dist/templates/docs/crumbs.d.ts.map +1 -0
  407. package/dist/templates/docs/crumbs.js +32 -0
  408. package/dist/templates/docs/crumbs.js.map +1 -0
  409. package/dist/templates/docs/index.d.ts +13 -0
  410. package/dist/templates/docs/index.d.ts.map +1 -0
  411. package/dist/templates/docs/index.js +47 -0
  412. package/dist/templates/docs/index.js.map +1 -0
  413. package/dist/templates/docs/lines.d.ts +14 -0
  414. package/dist/templates/docs/lines.d.ts.map +1 -0
  415. package/dist/templates/docs/lines.js +29 -0
  416. package/dist/templates/docs/lines.js.map +1 -0
  417. package/dist/templates/event/index.d.ts +12 -0
  418. package/dist/templates/event/index.d.ts.map +1 -0
  419. package/dist/templates/event/index.js +59 -0
  420. package/dist/templates/event/index.js.map +1 -0
  421. package/dist/templates/event/lines.d.ts +14 -0
  422. package/dist/templates/event/lines.d.ts.map +1 -0
  423. package/dist/templates/event/lines.js +29 -0
  424. package/dist/templates/event/lines.js.map +1 -0
  425. package/dist/templates/event/plate.d.ts +16 -0
  426. package/dist/templates/event/plate.d.ts.map +1 -0
  427. package/dist/templates/event/plate.js +36 -0
  428. package/dist/templates/event/plate.js.map +1 -0
  429. package/dist/templates/frame.d.ts +68 -0
  430. package/dist/templates/frame.d.ts.map +1 -0
  431. package/dist/templates/frame.js +63 -0
  432. package/dist/templates/frame.js.map +1 -0
  433. package/dist/templates/index.d.ts +9 -0
  434. package/dist/templates/index.d.ts.map +1 -1
  435. package/dist/templates/index.js +27 -0
  436. package/dist/templates/index.js.map +1 -1
  437. package/dist/templates/photo/index.d.ts +17 -0
  438. package/dist/templates/photo/index.d.ts.map +1 -0
  439. package/dist/templates/photo/index.js +51 -0
  440. package/dist/templates/photo/index.js.map +1 -0
  441. package/dist/templates/photo/lines.d.ts +21 -0
  442. package/dist/templates/photo/lines.d.ts.map +1 -0
  443. package/dist/templates/photo/lines.js +36 -0
  444. package/dist/templates/photo/lines.js.map +1 -0
  445. package/dist/templates/pill.d.ts +33 -0
  446. package/dist/templates/pill.d.ts.map +1 -0
  447. package/dist/templates/pill.js +50 -0
  448. package/dist/templates/pill.js.map +1 -0
  449. package/dist/templates/portrait.d.ts +40 -0
  450. package/dist/templates/portrait.d.ts.map +1 -0
  451. package/dist/templates/portrait.js +56 -0
  452. package/dist/templates/portrait.js.map +1 -0
  453. package/dist/templates/quote/index.d.ts +11 -0
  454. package/dist/templates/quote/index.d.ts.map +1 -0
  455. package/dist/templates/quote/index.js +60 -0
  456. package/dist/templates/quote/index.js.map +1 -0
  457. package/dist/templates/quote/lines.d.ts +24 -0
  458. package/dist/templates/quote/lines.d.ts.map +1 -0
  459. package/dist/templates/quote/lines.js +35 -0
  460. package/dist/templates/quote/lines.js.map +1 -0
  461. package/dist/templates/quote/mark.d.ts +13 -0
  462. package/dist/templates/quote/mark.d.ts.map +1 -0
  463. package/dist/templates/quote/mark.js +39 -0
  464. package/dist/templates/quote/mark.js.map +1 -0
  465. package/dist/templates/quote/speaker.d.ts +18 -0
  466. package/dist/templates/quote/speaker.d.ts.map +1 -0
  467. package/dist/templates/quote/speaker.js +41 -0
  468. package/dist/templates/quote/speaker.js.map +1 -0
  469. package/dist/templates/release/block.d.ts +8 -0
  470. package/dist/templates/release/block.d.ts.map +1 -0
  471. package/dist/templates/release/block.js +16 -0
  472. package/dist/templates/release/block.js.map +1 -0
  473. package/dist/templates/release/changes.d.ts +23 -0
  474. package/dist/templates/release/changes.d.ts.map +1 -0
  475. package/dist/templates/release/changes.js +45 -0
  476. package/dist/templates/release/changes.js.map +1 -0
  477. package/dist/templates/release/index.d.ts +11 -0
  478. package/dist/templates/release/index.d.ts.map +1 -0
  479. package/dist/templates/release/index.js +55 -0
  480. package/dist/templates/release/index.js.map +1 -0
  481. package/dist/templates/release/lines.d.ts +21 -0
  482. package/dist/templates/release/lines.d.ts.map +1 -0
  483. package/dist/templates/release/lines.js +36 -0
  484. package/dist/templates/release/lines.js.map +1 -0
  485. package/dist/templates/stat/index.d.ts +11 -0
  486. package/dist/templates/stat/index.d.ts.map +1 -0
  487. package/dist/templates/stat/index.js +43 -0
  488. package/dist/templates/stat/index.js.map +1 -0
  489. package/dist/templates/stat/lines.d.ts +23 -0
  490. package/dist/templates/stat/lines.d.ts.map +1 -0
  491. package/dist/templates/stat/lines.js +47 -0
  492. package/dist/templates/stat/lines.js.map +1 -0
  493. package/dist/templates/terminal/index.d.ts +16 -0
  494. package/dist/templates/terminal/index.d.ts.map +1 -0
  495. package/dist/templates/terminal/index.js +62 -0
  496. package/dist/templates/terminal/index.js.map +1 -0
  497. package/dist/templates/terminal/session.d.ts +17 -0
  498. package/dist/templates/terminal/session.d.ts.map +1 -0
  499. package/dist/templates/terminal/session.js +86 -0
  500. package/dist/templates/terminal/session.js.map +1 -0
  501. package/dist/templates/terminal/window.d.ts +14 -0
  502. package/dist/templates/terminal/window.d.ts.map +1 -0
  503. package/dist/templates/terminal/window.js +84 -0
  504. package/dist/templates/terminal/window.js.map +1 -0
  505. package/dist/templates/version.d.ts +16 -0
  506. package/dist/templates/version.d.ts.map +1 -0
  507. package/dist/templates/version.js +23 -0
  508. package/dist/templates/version.js.map +1 -0
  509. package/dist/templates/wordmark/index.d.ts +13 -0
  510. package/dist/templates/wordmark/index.d.ts.map +1 -0
  511. package/dist/templates/wordmark/index.js +53 -0
  512. package/dist/templates/wordmark/index.js.map +1 -0
  513. package/dist/templates/wordmark/lines.d.ts +22 -0
  514. package/dist/templates/wordmark/lines.d.ts.map +1 -0
  515. package/dist/templates/wordmark/lines.js +61 -0
  516. package/dist/templates/wordmark/lines.js.map +1 -0
  517. package/dist/templates/wordmark/mark.d.ts +16 -0
  518. package/dist/templates/wordmark/mark.d.ts.map +1 -0
  519. package/dist/templates/wordmark/mark.js +30 -0
  520. package/dist/templates/wordmark/mark.js.map +1 -0
  521. package/dist/text/clamp.d.ts +12 -0
  522. package/dist/text/clamp.d.ts.map +1 -0
  523. package/dist/text/clamp.js +41 -0
  524. package/dist/text/clamp.js.map +1 -0
  525. package/dist/text/ellipsis.d.ts +3 -0
  526. package/dist/text/ellipsis.d.ts.map +1 -0
  527. package/dist/text/ellipsis.js +3 -0
  528. package/dist/text/ellipsis.js.map +1 -0
  529. package/dist/text/index.d.ts +2 -0
  530. package/dist/text/index.d.ts.map +1 -1
  531. package/dist/text/index.js +2 -0
  532. package/dist/text/index.js.map +1 -1
  533. package/dist/types.d.ts +158 -6
  534. package/dist/types.d.ts.map +1 -1
  535. package/dist/validate/collect.d.ts.map +1 -1
  536. package/dist/validate/collect.js +2 -1
  537. package/dist/validate/collect.js.map +1 -1
  538. package/dist/validate/keys.d.ts +6 -0
  539. package/dist/validate/keys.d.ts.map +1 -1
  540. package/dist/validate/keys.js +17 -0
  541. package/dist/validate/keys.js.map +1 -1
  542. package/dist/validate/values.d.ts +6 -0
  543. package/dist/validate/values.d.ts.map +1 -1
  544. package/dist/validate/values.js +12 -1
  545. package/dist/validate/values.js.map +1 -1
  546. package/package.json +16 -2
  547. package/dist/background.d.ts +0 -13
  548. package/dist/background.d.ts.map +0 -1
  549. package/dist/background.js +0 -65
  550. package/dist/background.js.map +0 -1
  551. package/dist/cli/args.d.ts +0 -14
  552. package/dist/cli/args.d.ts.map +0 -1
  553. package/dist/cli/args.js +0 -67
  554. package/dist/cli/args.js.map +0 -1
  555. package/dist/cli.d.ts +0 -3
  556. package/dist/cli.d.ts.map +0 -1
  557. package/dist/cli.js +0 -102
  558. package/dist/cli.js.map +0 -1
  559. package/dist/config.d.ts +0 -95
  560. package/dist/config.d.ts.map +0 -1
  561. package/dist/config.js +0 -208
  562. package/dist/config.js.map +0 -1
  563. package/dist/fonts.d.ts +0 -18
  564. package/dist/fonts.d.ts.map +0 -1
  565. package/dist/fonts.js +0 -102
  566. package/dist/fonts.js.map +0 -1
  567. package/dist/generate.d.ts +0 -63
  568. package/dist/generate.d.ts.map +0 -1
  569. package/dist/generate.js +0 -109
  570. package/dist/generate.js.map +0 -1
  571. package/dist/highlight.d.ts +0 -75
  572. package/dist/highlight.d.ts.map +0 -1
  573. package/dist/highlight.js +0 -137
  574. package/dist/highlight.js.map +0 -1
  575. package/dist/render.d.ts +0 -24
  576. package/dist/render.d.ts.map +0 -1
  577. package/dist/render.js +0 -77
  578. package/dist/render.js.map +0 -1
  579. package/dist/stamp.d.ts +0 -29
  580. package/dist/stamp.d.ts.map +0 -1
  581. package/dist/stamp.js +0 -198
  582. package/dist/stamp.js.map +0 -1
  583. package/dist/templates/banner.d.ts +0 -9
  584. package/dist/templates/banner.d.ts.map +0 -1
  585. package/dist/templates/banner.js +0 -115
  586. package/dist/templates/banner.js.map +0 -1
  587. package/dist/templates/card.d.ts +0 -7
  588. package/dist/templates/card.d.ts.map +0 -1
  589. package/dist/templates/card.js +0 -72
  590. package/dist/templates/card.js.map +0 -1
  591. package/dist/templates/code.d.ts +0 -12
  592. package/dist/templates/code.d.ts.map +0 -1
  593. package/dist/templates/code.js +0 -275
  594. package/dist/templates/code.js.map +0 -1
  595. package/dist/templates/measure.d.ts +0 -11
  596. package/dist/templates/measure.d.ts.map +0 -1
  597. package/dist/templates/measure.js +0 -11
  598. package/dist/templates/measure.js.map +0 -1
  599. package/dist/templates/props.d.ts +0 -7
  600. package/dist/templates/props.d.ts.map +0 -1
  601. package/dist/templates/props.js +0 -17
  602. package/dist/templates/props.js.map +0 -1
  603. package/dist/templates/text.d.ts +0 -37
  604. package/dist/templates/text.d.ts.map +0 -1
  605. package/dist/templates/text.js +0 -26
  606. package/dist/templates/text.js.map +0 -1
  607. package/dist/text/stack.d.ts +0 -24
  608. package/dist/text/stack.d.ts.map +0 -1
  609. package/dist/text/stack.js +0 -18
  610. package/dist/text/stack.js.map +0 -1
  611. package/dist/text.d.ts +0 -56
  612. package/dist/text.d.ts.map +0 -1
  613. package/dist/text.js +0 -78
  614. package/dist/text.js.map +0 -1
  615. package/dist/validate/sizes.d.ts +0 -9
  616. package/dist/validate/sizes.d.ts.map +0 -1
  617. package/dist/validate/sizes.js +0 -27
  618. package/dist/validate/sizes.js.map +0 -1
  619. package/dist/validate.d.ts +0 -15
  620. package/dist/validate.d.ts.map +0 -1
  621. package/dist/validate.js +0 -300
  622. package/dist/validate.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/cli/init/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC;;;;GAIG;AACH,MAAM,WAAW,GAAG;IAClB,oBAAoB;IACpB,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;CACtB,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW;IAC9C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAC7B,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAC7B,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CACxD,CACF,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;AAClD,CAAC;AAED,oEAAoE;AACpE,KAAK,UAAU,eAAe,CAAC,GAAW;IACxC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;QACnE,OAAQ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAuB,CAAC,IAAI,KAAK,QAAQ,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,wEAAwE;QACxE,wEAAwE;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW;IAC9C,OAAO,CAAC,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,qBAAqB,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The config module `colophon init` writes.
3
+ *
4
+ * Most of it is commented out on purpose. What is left renders something
5
+ * recognisable straight away, and the comments say where the next decision goes
6
+ * rather than making every decision for the project up front. It is valid
7
+ * TypeScript as well as JavaScript, so it can be written to either extension.
8
+ */
9
+ export declare const scaffold = "// Colophon config. Every field is optional.\n// Full documentation: https://colophonjs.dev/\nimport { defineConfig } from \"@kensio/colophon\";\n\nexport default defineConfig({\n // Brand colours. The default background is a gradient built from these.\n colors: {\n brand: \"#4f46e5\",\n brandDark: \"#3730a3\",\n brandWarm: \"#db2777\",\n },\n\n // Or start from a named look, which brings its own colours, background and\n // texture: aurora, bloom, ember, forest, midnight, paper, sandstone, slate.\n // theme: \"midnight\",\n\n // Drawn along the bottom of every image.\n footer: \"example.com\",\n\n // A small label above the title, on the banner template.\n // badge: { text: \"npm\" },\n\n // The sizes rendered for each post. This is the default pair.\n // sizes: [\n // { name: \"og\", width: 1200, height: 630 },\n // { name: \"square\", width: 1200, height: 1200 },\n // ],\n\n // Handing the renderer font files, rather than hoping the machine has the\n // family installed, is what makes a build render the same image everywhere.\n // fonts: [{ family: \"Inter\", path: \"fonts/Inter-Bold.ttf\" }],\n\n // Build image props from the frontmatter your posts already carry, so there\n // is no props block to add to every file.\n // content: {\n // defaultTemplate: \"banner\",\n // props: (frontmatter) => ({\n // title: frontmatter.title,\n // subtitle: frontmatter.description,\n // }),\n // },\n});\n";
10
+ //# sourceMappingURL=scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/cli/init/scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,m8CA0CpB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The config module `colophon init` writes.
3
+ *
4
+ * Most of it is commented out on purpose. What is left renders something
5
+ * recognisable straight away, and the comments say where the next decision goes
6
+ * rather than making every decision for the project up front. It is valid
7
+ * TypeScript as well as JavaScript, so it can be written to either extension.
8
+ */
9
+ export const scaffold = `// Colophon config. Every field is optional.
10
+ // Full documentation: https://colophonjs.dev/
11
+ import { defineConfig } from "@kensio/colophon";
12
+
13
+ export default defineConfig({
14
+ // Brand colours. The default background is a gradient built from these.
15
+ colors: {
16
+ brand: "#4f46e5",
17
+ brandDark: "#3730a3",
18
+ brandWarm: "#db2777",
19
+ },
20
+
21
+ // Or start from a named look, which brings its own colours, background and
22
+ // texture: aurora, bloom, ember, forest, midnight, paper, sandstone, slate.
23
+ // theme: "midnight",
24
+
25
+ // Drawn along the bottom of every image.
26
+ footer: "example.com",
27
+
28
+ // A small label above the title, on the banner template.
29
+ // badge: { text: "npm" },
30
+
31
+ // The sizes rendered for each post. This is the default pair.
32
+ // sizes: [
33
+ // { name: "og", width: 1200, height: 630 },
34
+ // { name: "square", width: 1200, height: 1200 },
35
+ // ],
36
+
37
+ // Handing the renderer font files, rather than hoping the machine has the
38
+ // family installed, is what makes a build render the same image everywhere.
39
+ // fonts: [{ family: "Inter", path: "fonts/Inter-Bold.ttf" }],
40
+
41
+ // Build image props from the frontmatter your posts already carry, so there
42
+ // is no props block to add to every file.
43
+ // content: {
44
+ // defaultTemplate: "banner",
45
+ // props: (frontmatter) => ({
46
+ // title: frontmatter.title,
47
+ // subtitle: frontmatter.description,
48
+ // }),
49
+ // },
50
+ });
51
+ `;
52
+ //# sourceMappingURL=scaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../../src/cli/init/scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CvB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * What to print when something has gone wrong. A stack trace is noise for the
3
+ * mistakes this CLI reports, which are nearly all a bad path, a bad flag or a
4
+ * config that does not add up.
5
+ */
6
+ export declare function messageOf(error: unknown): string;
7
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/cli/message.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * What to print when something has gone wrong. A stack trace is noise for the
3
+ * mistakes this CLI reports, which are nearly all a bad path, a bad flag or a
4
+ * config that does not add up.
5
+ */
6
+ export function messageOf(error) {
7
+ return error instanceof Error ? error.message : String(error);
8
+ }
9
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/cli/message.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { CliArgs } from "../args/index.js";
2
+ export { previewImage } from "./render.js";
3
+ export type { PreviewOptions } from "./render.js";
4
+ /**
5
+ * Render one post and open the image.
6
+ *
7
+ * Tuning a template, a palette or a snippet otherwise means running the whole
8
+ * build and finding the one image it produced that was the point. The path is
9
+ * printed as well as opened, so a shell that would rather do its own thing with
10
+ * the file can.
11
+ */
12
+ export declare function runPreview(args: CliArgs): Promise<void>;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7D"}
@@ -0,0 +1,27 @@
1
+ import { loadConfig } from "../config.js";
2
+ import { openFile } from "./open.js";
3
+ import { previewImage } from "./render.js";
4
+ export { previewImage } from "./render.js";
5
+ /**
6
+ * Render one post and open the image.
7
+ *
8
+ * Tuning a template, a palette or a snippet otherwise means running the whole
9
+ * build and finding the one image it produced that was the point. The path is
10
+ * printed as well as opened, so a shell that would rather do its own thing with
11
+ * the file can.
12
+ */
13
+ export async function runPreview(args) {
14
+ if (args.file === undefined) {
15
+ throw new Error("colophon preview needs a content file, as in" +
16
+ " `colophon preview content/post/index.md`.");
17
+ }
18
+ const config = await loadConfig(args.configPath);
19
+ const output = await previewImage({
20
+ file: args.file,
21
+ config,
22
+ size: args.size,
23
+ });
24
+ console.log(output);
25
+ openFile(output);
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/preview/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAa;IAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,8CAA8C;YAC5C,4CAA4C,CAC/C,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,QAAQ,CAAC,MAAM,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Open a file in whatever the desktop uses for it, detached so that the CLI
3
+ * exits rather than waiting for a picture viewer to be closed.
4
+ *
5
+ * A failure is reported and no more. The path has already been printed, and a
6
+ * machine with nothing to open an image with, such as a build server, is not a
7
+ * mistake worth failing the command over.
8
+ */
9
+ export declare function openFile(file: string): void;
10
+ //# sourceMappingURL=open.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/open.ts"],"names":[],"mappings":"AAsBA;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAY3C"}
@@ -0,0 +1,32 @@
1
+ import { spawn } from "node:child_process";
2
+ function opener() {
3
+ if (process.platform === "darwin") {
4
+ return { command: "open", args: [] };
5
+ }
6
+ if (process.platform === "win32") {
7
+ // `start` takes a window title first, and an empty one keeps a path with
8
+ // spaces in it from being read as the title.
9
+ return { command: "cmd", args: ["/c", "start", ""] };
10
+ }
11
+ return { command: "xdg-open", args: [] };
12
+ }
13
+ /**
14
+ * Open a file in whatever the desktop uses for it, detached so that the CLI
15
+ * exits rather than waiting for a picture viewer to be closed.
16
+ *
17
+ * A failure is reported and no more. The path has already been printed, and a
18
+ * machine with nothing to open an image with, such as a build server, is not a
19
+ * mistake worth failing the command over.
20
+ */
21
+ export function openFile(file) {
22
+ const { command, args } = opener();
23
+ const child = spawn(command, [...args, file], {
24
+ detached: true,
25
+ stdio: "ignore",
26
+ });
27
+ child.on("error", () => {
28
+ console.log(`Could not open ${file}; open it yourself.`);
29
+ });
30
+ child.unref();
31
+ }
32
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/cli/preview/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAQ3C,SAAS,MAAM;IACb,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,yEAAyE;QACzE,6CAA6C;QAC7C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE;QAC5C,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;IAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,qBAAqB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ColophonConfig } from "../../types.js";
2
+ /** What a preview renders: one post, at one size, with one config. */
3
+ export interface PreviewOptions {
4
+ readonly file: string;
5
+ readonly config: ColophonConfig | undefined;
6
+ /** Which configured size, or the first of them. */
7
+ readonly size: string | undefined;
8
+ }
9
+ /**
10
+ * Render one post to a temporary image and return where it landed.
11
+ *
12
+ * The image goes to the system temp directory rather than into the tree,
13
+ * because a preview is not a build output. Beside the post it would land on the
14
+ * real image, which the next build would then find unstamped and render again,
15
+ * so tuning a template would quietly invalidate the tree it was tuned against.
16
+ * Nothing is stamped either, for the matching reason: a preview was asked for,
17
+ * so there is never anything to skip.
18
+ *
19
+ * Only one image is rendered, since the point is to look at it. Every other
20
+ * size the config declares is a `--size` away.
21
+ */
22
+ export declare function previewImage(options: PreviewOptions): Promise<string>;
23
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/render.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IAC5C,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B3E"}
@@ -0,0 +1,40 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { tmpdir } from "node:os";
3
+ import path from "node:path";
4
+ import { resolveConfig } from "../../config/index.js";
5
+ import { resolveConfigForSize } from "../../config/size.js";
6
+ import { readContentFile } from "../../content/index.js";
7
+ import { extensionFor } from "../../encode/index.js";
8
+ import { buildSvg, renderSvgToImage } from "../../render/index.js";
9
+ import { contentRootFor } from "./root.js";
10
+ import { pickSize } from "./size.js";
11
+ /**
12
+ * Render one post to a temporary image and return where it landed.
13
+ *
14
+ * The image goes to the system temp directory rather than into the tree,
15
+ * because a preview is not a build output. Beside the post it would land on the
16
+ * real image, which the next build would then find unstamped and render again,
17
+ * so tuning a template would quietly invalidate the tree it was tuned against.
18
+ * Nothing is stamped either, for the matching reason: a preview was asked for,
19
+ * so there is never anything to skip.
20
+ *
21
+ * Only one image is rendered, since the point is to look at it. Every other
22
+ * size the config declares is a `--size` away.
23
+ */
24
+ export async function previewImage(options) {
25
+ const resolved = resolveConfig(options.config);
26
+ const size = pickSize(resolved.sizes, options.size);
27
+ const file = await readContentFile(options.file, contentRootFor(options.file), options.config?.content);
28
+ if (file === undefined) {
29
+ throw new Error(`${options.file} declares no image props, so there is nothing to preview.`);
30
+ }
31
+ const config = resolveConfigForSize(options.config, size);
32
+ const dimensions = { width: size.width, height: size.height };
33
+ const svg = await buildSvg(file.props, config, dimensions);
34
+ const image = await renderSvgToImage(svg, dimensions, config);
35
+ const output = path.join(tmpdir(), "colophon-preview", `${file.slug}-${size.name}${extensionFor(config.format)}`);
36
+ await mkdir(path.dirname(output), { recursive: true });
37
+ await writeFile(output, image);
38
+ return output;
39
+ }
40
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/cli/preview/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAUrC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAuB;IACxD,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD,MAAM,IAAI,GAAG,MAAM,eAAe,CAChC,OAAO,CAAC,IAAI,EACZ,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAC5B,OAAO,CAAC,MAAM,EAAE,OAAO,CACxB,CAAC;IAEF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,GAAG,OAAO,CAAC,IAAI,2DAA2D,CAC3E,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC9D,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CACtB,MAAM,EAAE,EACR,kBAAkB,EAClB,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAC1D,CAAC;IACF,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The content root to read a previewed post against, which is what its slug is
3
+ * derived from, and so what the preview file ends up called.
4
+ *
5
+ * The working directory, for a file underneath it: that is what the path on the
6
+ * command line was relative to, and it keeps the page-bundle convention
7
+ * working, where `hello/index.md` is named after its directory instead of being
8
+ * one more `index`. A file from somewhere else falls back to its own directory,
9
+ * since a root it is not under cannot describe it, and a relative path full of
10
+ * `..` segments is not a slug at all.
11
+ *
12
+ * The slug only ever names a file in the temp directory here, so the point is
13
+ * that two posts do not collide, rather than matching what a build would call
14
+ * the real image.
15
+ */
16
+ export declare function contentRootFor(file: string): string;
17
+ //# sourceMappingURL=root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/root.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD"}
@@ -0,0 +1,22 @@
1
+ import path from "node:path";
2
+ /**
3
+ * The content root to read a previewed post against, which is what its slug is
4
+ * derived from, and so what the preview file ends up called.
5
+ *
6
+ * The working directory, for a file underneath it: that is what the path on the
7
+ * command line was relative to, and it keeps the page-bundle convention
8
+ * working, where `hello/index.md` is named after its directory instead of being
9
+ * one more `index`. A file from somewhere else falls back to its own directory,
10
+ * since a root it is not under cannot describe it, and a relative path full of
11
+ * `..` segments is not a slug at all.
12
+ *
13
+ * The slug only ever names a file in the temp directory here, so the point is
14
+ * that two posts do not collide, rather than matching what a build would call
15
+ * the real image.
16
+ */
17
+ export function contentRootFor(file) {
18
+ const absolute = path.resolve(file);
19
+ const cwd = process.cwd();
20
+ return absolute.startsWith(cwd + path.sep) ? cwd : path.dirname(absolute);
21
+ }
22
+ //# sourceMappingURL=root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/cli/preview/root.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { OutputSize } from "../../types.js";
2
+ /**
3
+ * Which size to preview: the one `--size` names, or the first configured one,
4
+ * which is what an `extra` image already defaults to.
5
+ */
6
+ export declare function pickSize(sizes: readonly OutputSize[], name: string | undefined): OutputSize;
7
+ //# sourceMappingURL=size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,UAAU,CAWZ"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Which size to preview: the one `--size` names, or the first configured one,
3
+ * which is what an `extra` image already defaults to.
4
+ */
5
+ export function pickSize(sizes, name) {
6
+ const names = sizes.map((size) => size.name);
7
+ const wanted = sizes.find((size) => size.name === (name ?? names[0]));
8
+ if (wanted === undefined) {
9
+ throw new Error(`Unknown size "${String(name)}". Configured sizes: ${names.join(", ")}.`);
10
+ }
11
+ return wanted;
12
+ }
13
+ //# sourceMappingURL=size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size.js","sourceRoot":"","sources":["../../../src/cli/preview/size.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,KAA4B,EAC5B,IAAwB;IAExB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,iBAAiB,MAAM,CAAC,IAAI,CAAC,wBAAwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACzE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { GeneratedImage } from "../generate/index.js";
2
+ /** Report one image as it is written, or as it is left alone. */
3
+ export declare function reportImage(result: GeneratedImage, isDryRun: boolean): void;
4
+ /** Report what a whole run came to. */
5
+ export declare function reportSummary(results: readonly GeneratedImage[], isDryRun: boolean): void;
6
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/cli/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAW3D,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAQ3E;AAED,uCAAuC;AACvC,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,QAAQ,EAAE,OAAO,GAChB,IAAI,CASN"}
@@ -0,0 +1,23 @@
1
+ /** What this run did, or would have done, to one image. */
2
+ function verbFor(result, isDryRun) {
3
+ if (result.skipped) {
4
+ return "skip";
5
+ }
6
+ return isDryRun ? "write" : "wrote";
7
+ }
8
+ /** Report one image as it is written, or as it is left alone. */
9
+ export function reportImage(result, isDryRun) {
10
+ // The URL is the half of a placement nothing else on the command line
11
+ // would show, and the quickest way to see a `urlBase` is wrong.
12
+ const served = result.url === undefined ? "" : ` -> ${result.url}`;
13
+ console.log(`${verbFor(result, isDryRun).padEnd(5)} ${result.outputPath}${served}`);
14
+ }
15
+ /** Report what a whole run came to. */
16
+ export function reportSummary(results, isDryRun) {
17
+ const written = results.filter((result) => !result.skipped).length;
18
+ const skipped = String(results.length - written);
19
+ console.log(isDryRun
20
+ ? `Dry run: ${String(written)} would be written, ${skipped} already up to date. Nothing was written.`
21
+ : `Done: ${String(written)} written, ${skipped} skipped.`);
22
+ }
23
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/cli/report.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,SAAS,OAAO,CAAC,MAAsB,EAAE,QAAiB;IACxD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACtC,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,WAAW,CAAC,MAAsB,EAAE,QAAiB;IACnE,sEAAsE;IACtE,gEAAgE;IAChE,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,GAAG,EAAE,CAAC;IAEnE,OAAO,CAAC,GAAG,CACT,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,UAAU,GAAG,MAAM,EAAE,CACvE,CAAC;AACJ,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,aAAa,CAC3B,OAAkC,EAClC,QAAiB;IAEjB,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IACnE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;IAEjD,OAAO,CAAC,GAAG,CACT,QAAQ;QACN,CAAC,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,sBAAsB,OAAO,2CAA2C;QACrG,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,CAAC,aAAa,OAAO,WAAW,CAC5D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Whether a change under the content root is one worth rebuilding for.
3
+ *
4
+ * Two kinds of change arrive that are not content. The images themselves: the
5
+ * default placement writes a PNG next to the post it came from, so every build
6
+ * changes the tree it is watching. And an editor's own files, such as
7
+ * `post.md~` or `.post.md.swp`, which come and go around the real write.
8
+ *
9
+ * Both are ruled out by the extensions a walk would read, which is the same
10
+ * list that decides what a build looks at. So the watcher and the build agree
11
+ * on what content is, rather than keeping two ideas of it.
12
+ */
13
+ export declare function isContentChange(filename: string, extensions: readonly string[]): boolean;
14
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/cli/watch/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAET"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Whether a change under the content root is one worth rebuilding for.
3
+ *
4
+ * Two kinds of change arrive that are not content. The images themselves: the
5
+ * default placement writes a PNG next to the post it came from, so every build
6
+ * changes the tree it is watching. And an editor's own files, such as
7
+ * `post.md~` or `.post.md.swp`, which come and go around the real write.
8
+ *
9
+ * Both are ruled out by the extensions a walk would read, which is the same
10
+ * list that decides what a build looks at. So the watcher and the build agree
11
+ * on what content is, rather than keeping two ideas of it.
12
+ */
13
+ export function isContentChange(filename, extensions) {
14
+ return extensions.some((extension) => filename.endsWith(extension));
15
+ }
16
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/cli/watch/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,UAA6B;IAE7B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,27 @@
1
+ /** What a watch run needs: where to look, what counts, and what to run. */
2
+ export interface WatchOptions {
3
+ readonly dir: string;
4
+ /** File extensions the build reads, which is what a change has to be. */
5
+ readonly extensions: readonly string[];
6
+ readonly build: () => Promise<void>;
7
+ /** Coalescing window, for tests that would rather not wait for it. */
8
+ readonly delayMs?: number;
9
+ /** Stop watching. The CLI watches until the process ends; tests do not. */
10
+ readonly signal?: AbortSignal;
11
+ }
12
+ /**
13
+ * Build the tree, then rebuild it whenever a content file changes, until the
14
+ * process is stopped.
15
+ *
16
+ * The returned promise settles when the watcher stops or fails, which is what
17
+ * keeps the process alive: there is nothing else to await once the first build
18
+ * is done. The watcher is registered before that build starts, so an edit made
19
+ * while it runs is not lost.
20
+ *
21
+ * Only the content tree is watched. A change to the config module is not picked
22
+ * up, because reloading it would mean importing it again under a fresh URL and
23
+ * leaving the old copy behind, and the modules it imports could not be
24
+ * invalidated at all. Restart the watch after editing a config.
25
+ */
26
+ export declare function watchContent(options: WatchOptions): Promise<void>;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/watch/index.ts"],"names":[],"mappings":"AAKA,2EAA2E;AAC3E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BvE"}
@@ -0,0 +1,38 @@
1
+ import { watch } from "node:fs";
2
+ import { isContentChange } from "./filter.js";
3
+ import { createRebuildQueue } from "./queue.js";
4
+ /**
5
+ * Build the tree, then rebuild it whenever a content file changes, until the
6
+ * process is stopped.
7
+ *
8
+ * The returned promise settles when the watcher stops or fails, which is what
9
+ * keeps the process alive: there is nothing else to await once the first build
10
+ * is done. The watcher is registered before that build starts, so an edit made
11
+ * while it runs is not lost.
12
+ *
13
+ * Only the content tree is watched. A change to the config module is not picked
14
+ * up, because reloading it would mean importing it again under a fresh URL and
15
+ * leaving the old copy behind, and the modules it imports could not be
16
+ * invalidated at all. Restart the watch after editing a config.
17
+ */
18
+ export async function watchContent(options) {
19
+ const queue = createRebuildQueue({
20
+ run: options.build,
21
+ ...(options.delayMs !== undefined && { delayMs: options.delayMs }),
22
+ });
23
+ const watcher = watch(options.dir, {
24
+ recursive: true,
25
+ ...(options.signal !== undefined && { signal: options.signal }),
26
+ }, (_event, filename) => {
27
+ if (filename !== null && isContentChange(filename, options.extensions)) {
28
+ queue.touch();
29
+ }
30
+ });
31
+ console.log(`Watching ${options.dir} for changes. Press Ctrl+C to stop.`);
32
+ queue.touch();
33
+ return new Promise((resolve, reject) => {
34
+ watcher.on("close", resolve);
35
+ watcher.on("error", reject);
36
+ });
37
+ }
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/watch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAchD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAqB;IACtD,MAAM,KAAK,GAAG,kBAAkB,CAAC;QAC/B,GAAG,EAAE,OAAO,CAAC,KAAK;QAClB,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;KACnE,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,KAAK,CACnB,OAAO,CAAC,GAAG,EACX;QACE,SAAS,EAAE,IAAI;QACf,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;KAChE,EACD,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;QACnB,IAAI,QAAQ,KAAK,IAAI,IAAI,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YACvE,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC,GAAG,qCAAqC,CAAC,CAAC;IAC1E,KAAK,CAAC,KAAK,EAAE,CAAC;IAEd,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,24 @@
1
+ /** A rebuild waiting to happen, or happening. */
2
+ export interface RebuildQueue {
3
+ /** Note that something changed, and rebuild once the changes stop. */
4
+ touch(): void;
5
+ }
6
+ /** How a queue is driven. */
7
+ export interface QueueOptions {
8
+ readonly run: () => Promise<void>;
9
+ /** How long to wait for a burst of changes to finish. */
10
+ readonly delayMs?: number;
11
+ readonly onError?: (error: unknown) => void;
12
+ }
13
+ /**
14
+ * Coalesce change events into rebuilds.
15
+ *
16
+ * Two things have to hold for a watch loop to behave. Saving a file produces
17
+ * more than one event, since editors write, rename and touch mtimes in their
18
+ * own order, so events are held for `delayMs` and the wait restarts while they
19
+ * keep arriving. And a build takes longer than the edit that triggered it, so a
20
+ * change arriving mid-build queues one more run rather than starting a second
21
+ * build alongside the first.
22
+ */
23
+ export declare function createRebuildQueue(options: QueueOptions): RebuildQueue;
24
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/cli/watch/queue.ts"],"names":[],"mappings":"AAEA,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,6BAA6B;AAC7B,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C;AAQD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CA8CtE"}
@@ -0,0 +1,57 @@
1
+ import { messageOf } from "../message.js";
2
+ /**
3
+ * Long enough to swallow the several events one save produces, short enough
4
+ * that the rebuild still feels like a consequence of hitting save.
5
+ */
6
+ const defaultDelayMs = 80;
7
+ /**
8
+ * Coalesce change events into rebuilds.
9
+ *
10
+ * Two things have to hold for a watch loop to behave. Saving a file produces
11
+ * more than one event, since editors write, rename and touch mtimes in their
12
+ * own order, so events are held for `delayMs` and the wait restarts while they
13
+ * keep arriving. And a build takes longer than the edit that triggered it, so a
14
+ * change arriving mid-build queues one more run rather than starting a second
15
+ * build alongside the first.
16
+ */
17
+ export function createRebuildQueue(options) {
18
+ const delayMs = options.delayMs ?? defaultDelayMs;
19
+ const report = options.onError ??
20
+ ((error) => {
21
+ console.error(messageOf(error));
22
+ });
23
+ let timer;
24
+ let isRunning = false;
25
+ let isPending = false;
26
+ async function drain() {
27
+ isRunning = true;
28
+ try {
29
+ await options.run();
30
+ }
31
+ catch (error) {
32
+ // A failed build must not take the watcher with it. The mistake is
33
+ // usually in the file that was just saved, so the fix is the next save.
34
+ report(error);
35
+ }
36
+ isRunning = false;
37
+ if (isPending) {
38
+ isPending = false;
39
+ // Called rather than awaited, so `drain` does not recurse into a chain
40
+ // of promises that a long watch session would hold open.
41
+ void drain();
42
+ }
43
+ }
44
+ return {
45
+ touch() {
46
+ if (isRunning) {
47
+ isPending = true;
48
+ return;
49
+ }
50
+ clearTimeout(timer);
51
+ timer = setTimeout(() => {
52
+ void drain();
53
+ }, delayMs);
54
+ },
55
+ };
56
+ }
57
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../src/cli/watch/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAgB1C;;;GAGG;AACH,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAqB;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC;IAClD,MAAM,MAAM,GACV,OAAO,CAAC,OAAO;QACf,CAAC,CAAC,KAAc,EAAQ,EAAE;YACxB,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IAEL,IAAI,KAAiC,CAAC;IACtC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,KAAK,UAAU,KAAK;QAClB,SAAS,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mEAAmE;YACnE,wEAAwE;YACxE,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;QAED,SAAS,GAAG,KAAK,CAAC;QAElB,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,GAAG,KAAK,CAAC;YAClB,uEAAuE;YACvE,yDAAyD;YACzD,KAAK,KAAK,EAAE,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK;YACH,IAAI,SAAS,EAAE,CAAC;gBACd,SAAS,GAAG,IAAI,CAAC;gBACjB,OAAO;YACT,CAAC;YAED,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBACtB,KAAK,KAAK,EAAE,CAAC;YACf,CAAC,EAAE,OAAO,CAAC,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}