@kensio/colophon 2.5.0 → 2.7.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.
- package/README.md +91 -13
- package/dist/astro/index.d.ts +49 -0
- package/dist/astro/index.d.ts.map +1 -0
- package/dist/astro/index.js +42 -0
- package/dist/astro/index.js.map +1 -0
- package/dist/cli/args/command.d.ts +13 -0
- package/dist/cli/args/command.d.ts.map +1 -0
- package/dist/cli/args/command.js +22 -0
- package/dist/cli/args/command.js.map +1 -0
- package/dist/cli/args/index.d.ts +28 -0
- package/dist/cli/args/index.d.ts.map +1 -0
- package/dist/cli/args/index.js +75 -0
- package/dist/cli/args/index.js.map +1 -0
- package/dist/cli/args/switches.d.ts +18 -0
- package/dist/cli/args/switches.d.ts.map +1 -0
- package/dist/cli/args/switches.js +42 -0
- package/dist/cli/args/switches.js.map +1 -0
- package/dist/cli/args/usage.d.ts +3 -0
- package/dist/cli/args/usage.d.ts.map +1 -0
- package/dist/cli/args/usage.js +34 -0
- package/dist/cli/args/usage.js.map +1 -0
- package/dist/cli/args/values.d.ts +11 -0
- package/dist/cli/args/values.d.ts.map +1 -0
- package/dist/cli/args/values.js +29 -0
- package/dist/cli/args/values.js.map +1 -0
- package/dist/cli/build.d.ts +10 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +41 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/eject/adapters.d.ts +20 -0
- package/dist/cli/eject/adapters.d.ts.map +1 -0
- package/dist/cli/eject/adapters.js +29 -0
- package/dist/cli/eject/adapters.js.map +1 -0
- package/dist/cli/eject/astro.d.ts +13 -0
- package/dist/cli/eject/astro.d.ts.map +1 -0
- package/dist/cli/eject/astro.js +35 -0
- package/dist/cli/eject/astro.js.map +1 -0
- package/dist/cli/eject/hugo.d.ts +19 -0
- package/dist/cli/eject/hugo.d.ts.map +1 -0
- package/dist/cli/eject/hugo.js +127 -0
- package/dist/cli/eject/hugo.js.map +1 -0
- package/dist/cli/eject/index.d.ts +15 -0
- package/dist/cli/eject/index.d.ts.map +1 -0
- package/dist/cli/eject/index.js +46 -0
- package/dist/cli/eject/index.js.map +1 -0
- package/dist/cli/index.js +25 -20
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/fs.d.ts +5 -0
- package/dist/cli/init/fs.d.ts.map +1 -0
- package/dist/cli/init/fs.js +19 -0
- package/dist/cli/init/fs.js.map +1 -0
- package/dist/cli/init/guess.d.ts +9 -0
- package/dist/cli/init/guess.d.ts.map +1 -0
- package/dist/cli/init/guess.js +27 -0
- package/dist/cli/init/guess.js.map +1 -0
- package/dist/cli/init/index.d.ts +11 -0
- package/dist/cli/init/index.d.ts.map +1 -0
- package/dist/cli/init/index.js +36 -0
- package/dist/cli/init/index.js.map +1 -0
- package/dist/cli/init/module.d.ts +12 -0
- package/dist/cli/init/module.d.ts.map +1 -0
- package/dist/cli/init/module.js +45 -0
- package/dist/cli/init/module.js.map +1 -0
- package/dist/cli/init/scaffold.d.ts +10 -0
- package/dist/cli/init/scaffold.d.ts.map +1 -0
- package/dist/cli/init/scaffold.js +52 -0
- package/dist/cli/init/scaffold.js.map +1 -0
- package/dist/cli/message.d.ts +7 -0
- package/dist/cli/message.d.ts.map +1 -0
- package/dist/cli/message.js +9 -0
- package/dist/cli/message.js.map +1 -0
- package/dist/cli/preview/index.d.ts +13 -0
- package/dist/cli/preview/index.d.ts.map +1 -0
- package/dist/cli/preview/index.js +27 -0
- package/dist/cli/preview/index.js.map +1 -0
- package/dist/cli/preview/open.d.ts +10 -0
- package/dist/cli/preview/open.d.ts.map +1 -0
- package/dist/cli/preview/open.js +32 -0
- package/dist/cli/preview/open.js.map +1 -0
- package/dist/cli/preview/render.d.ts +23 -0
- package/dist/cli/preview/render.d.ts.map +1 -0
- package/dist/cli/preview/render.js +40 -0
- package/dist/cli/preview/render.js.map +1 -0
- package/dist/cli/preview/root.d.ts +17 -0
- package/dist/cli/preview/root.d.ts.map +1 -0
- package/dist/cli/preview/root.js +22 -0
- package/dist/cli/preview/root.js.map +1 -0
- package/dist/cli/preview/size.d.ts +7 -0
- package/dist/cli/preview/size.d.ts.map +1 -0
- package/dist/cli/preview/size.js +13 -0
- package/dist/cli/preview/size.js.map +1 -0
- package/dist/cli/report.d.ts +6 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +23 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/watch/filter.d.ts +14 -0
- package/dist/cli/watch/filter.d.ts.map +1 -0
- package/dist/cli/watch/filter.js +16 -0
- package/dist/cli/watch/filter.js.map +1 -0
- package/dist/cli/watch/index.d.ts +27 -0
- package/dist/cli/watch/index.d.ts.map +1 -0
- package/dist/cli/watch/index.js +38 -0
- package/dist/cli/watch/index.js.map +1 -0
- package/dist/cli/watch/queue.d.ts +24 -0
- package/dist/cli/watch/queue.d.ts.map +1 -0
- package/dist/cli/watch/queue.js +57 -0
- package/dist/cli/watch/queue.js.map +1 -0
- package/dist/config/defaults.d.ts +39 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +38 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +18 -4
- package/dist/config/index.js.map +1 -1
- package/dist/config/output.d.ts +26 -0
- package/dist/config/output.d.ts.map +1 -0
- package/dist/config/output.js +45 -0
- package/dist/config/output.js.map +1 -0
- package/dist/config/resolve.d.ts +10 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +20 -1
- package/dist/config/resolve.js.map +1 -1
- package/dist/content/index.d.ts +1 -0
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +1 -0
- package/dist/content/index.js.map +1 -1
- package/dist/content/read.d.ts +15 -0
- package/dist/content/read.d.ts.map +1 -0
- package/dist/content/read.js +36 -0
- package/dist/content/read.js.map +1 -0
- package/dist/content/walk.d.ts.map +1 -1
- package/dist/content/walk.js +4 -30
- package/dist/content/walk.js.map +1 -1
- package/dist/core/index.d.ts +39 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +20 -0
- package/dist/core/index.js.map +1 -0
- package/dist/encode/fit.d.ts +16 -0
- package/dist/encode/fit.d.ts.map +1 -0
- package/dist/encode/fit.js +23 -0
- package/dist/encode/fit.js.map +1 -0
- package/dist/encode/format.d.ts +12 -0
- package/dist/encode/format.d.ts.map +1 -0
- package/dist/encode/format.js +40 -0
- package/dist/encode/format.js.map +1 -0
- package/dist/encode/index.d.ts +14 -0
- package/dist/encode/index.d.ts.map +1 -0
- package/dist/encode/index.js +52 -0
- package/dist/encode/index.js.map +1 -0
- package/dist/encode/sharp.d.ts +19 -0
- package/dist/encode/sharp.d.ts.map +1 -0
- package/dist/encode/sharp.js +57 -0
- package/dist/encode/sharp.js.map +1 -0
- package/dist/encode/warn.d.ts +10 -0
- package/dist/encode/warn.d.ts.map +1 -0
- package/dist/encode/warn.js +31 -0
- package/dist/encode/warn.js.map +1 -0
- package/dist/fonts/resolve.d.ts.map +1 -1
- package/dist/fonts/resolve.js +2 -8
- package/dist/fonts/resolve.js.map +1 -1
- package/dist/generate/index.d.ts +4 -0
- package/dist/generate/index.d.ts.map +1 -1
- package/dist/generate/index.js +10 -4
- package/dist/generate/index.js.map +1 -1
- package/dist/generate/options.d.ts +11 -1
- package/dist/generate/options.d.ts.map +1 -1
- package/dist/generate/options.js.map +1 -1
- package/dist/generate/output-path.d.ts +6 -2
- package/dist/generate/output-path.d.ts.map +1 -1
- package/dist/generate/output-path.js +7 -2
- package/dist/generate/output-path.js.map +1 -1
- package/dist/generate/plan.d.ts.map +1 -1
- package/dist/generate/plan.js +3 -3
- package/dist/generate/plan.js.map +1 -1
- package/dist/generate/render-image.d.ts +6 -0
- package/dist/generate/render-image.d.ts.map +1 -1
- package/dist/generate/render-image.js +14 -4
- package/dist/generate/render-image.js.map +1 -1
- package/dist/image/index.d.ts +3 -1
- package/dist/image/index.d.ts.map +1 -1
- package/dist/image/index.js +4 -3
- package/dist/image/index.js.map +1 -1
- package/dist/image/jpeg.d.ts +5 -4
- package/dist/image/jpeg.d.ts.map +1 -1
- package/dist/image/jpeg.js +13 -36
- package/dist/image/jpeg.js.map +1 -1
- package/dist/image/load.d.ts.map +1 -1
- package/dist/image/load.js +4 -15
- package/dist/image/load.js.map +1 -1
- package/dist/image/resolve.d.ts.map +1 -1
- package/dist/image/resolve.js +2 -8
- package/dist/image/resolve.js.map +1 -1
- package/dist/image/uri.d.ts.map +1 -1
- package/dist/image/uri.js +2 -3
- package/dist/image/uri.js.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/jpeg/index.d.ts +10 -0
- package/dist/jpeg/index.d.ts.map +1 -0
- package/dist/jpeg/index.js +2 -0
- package/dist/jpeg/index.js.map +1 -0
- package/dist/jpeg/segments.d.ts +32 -0
- package/dist/jpeg/segments.d.ts.map +1 -0
- package/dist/jpeg/segments.js +66 -0
- package/dist/jpeg/segments.js.map +1 -0
- package/dist/layout/draw.d.ts +20 -0
- package/dist/layout/draw.d.ts.map +1 -0
- package/dist/layout/draw.js +32 -0
- package/dist/layout/draw.js.map +1 -0
- package/dist/layout/extent.d.ts +19 -0
- package/dist/layout/extent.d.ts.map +1 -0
- package/dist/layout/extent.js +24 -0
- package/dist/layout/extent.js.map +1 -0
- package/dist/layout/index.d.ts +7 -4
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +5 -3
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/lines.d.ts +0 -17
- package/dist/layout/lines.d.ts.map +1 -1
- package/dist/layout/lines.js +2 -35
- package/dist/layout/lines.js.map +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js +8 -2
- package/dist/measure/faces.js.map +1 -1
- package/dist/meta/index.d.ts +1 -0
- package/dist/meta/index.d.ts.map +1 -1
- package/dist/meta/index.js +1 -0
- package/dist/meta/index.js.map +1 -1
- package/dist/meta/path.d.ts +24 -0
- package/dist/meta/path.d.ts.map +1 -0
- package/dist/meta/path.js +41 -0
- package/dist/meta/path.js.map +1 -0
- package/dist/meta/tags.d.ts.map +1 -1
- package/dist/meta/tags.js +6 -1
- package/dist/meta/tags.js.map +1 -1
- package/dist/placement/index.d.ts +7 -2
- package/dist/placement/index.d.ts.map +1 -1
- package/dist/placement/index.js +9 -3
- package/dist/placement/index.js.map +1 -1
- package/dist/placement/relative.d.ts +8 -3
- package/dist/placement/relative.d.ts.map +1 -1
- package/dist/placement/relative.js +12 -5
- package/dist/placement/relative.js.map +1 -1
- package/dist/platform/base64.d.ts +13 -0
- package/dist/platform/base64.d.ts.map +1 -0
- package/dist/platform/base64.js +35 -0
- package/dist/platform/base64.js.map +1 -0
- package/dist/platform/rasteriser.browser.d.ts +16 -0
- package/dist/platform/rasteriser.browser.d.ts.map +1 -0
- package/dist/platform/rasteriser.browser.js +20 -0
- package/dist/platform/rasteriser.browser.js.map +1 -0
- package/dist/platform/rasteriser.node.d.ts +2 -0
- package/dist/platform/rasteriser.node.d.ts.map +1 -0
- package/dist/platform/rasteriser.node.js +2 -0
- package/dist/platform/rasteriser.node.js.map +1 -0
- package/dist/platform/read-file.browser.d.ts +17 -0
- package/dist/platform/read-file.browser.d.ts.map +1 -0
- package/dist/platform/read-file.browser.js +23 -0
- package/dist/platform/read-file.browser.js.map +1 -0
- package/dist/platform/read-file.node.d.ts +19 -0
- package/dist/platform/read-file.node.d.ts.map +1 -0
- package/dist/platform/read-file.node.js +31 -0
- package/dist/platform/read-file.node.js.map +1 -0
- package/dist/png/chunk.d.ts +23 -0
- package/dist/png/chunk.d.ts.map +1 -0
- package/dist/png/chunk.js +48 -0
- package/dist/png/chunk.js.map +1 -0
- package/dist/png/index.d.ts +13 -0
- package/dist/png/index.d.ts.map +1 -0
- package/dist/png/index.js +3 -0
- package/dist/png/index.js.map +1 -0
- package/dist/png/recompress.d.ts +23 -0
- package/dist/png/recompress.d.ts.map +1 -0
- package/dist/png/recompress.js +81 -0
- package/dist/png/recompress.js.map +1 -0
- package/dist/props.d.ts +11 -0
- package/dist/props.d.ts.map +1 -1
- package/dist/props.js +16 -0
- package/dist/props.js.map +1 -1
- package/dist/render/image.d.ts +20 -0
- package/dist/render/image.d.ts.map +1 -0
- package/dist/render/image.js +29 -0
- package/dist/render/image.js.map +1 -0
- package/dist/render/index.d.ts +2 -1
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +5 -4
- package/dist/render/index.js.map +1 -1
- package/dist/render/png.d.ts +14 -4
- package/dist/render/png.d.ts.map +1 -1
- package/dist/render/png.js +22 -23
- package/dist/render/png.js.map +1 -1
- package/dist/render/rasterise.d.ts +15 -0
- package/dist/render/rasterise.d.ts.map +1 -0
- package/dist/render/rasterise.js +34 -0
- package/dist/render/rasterise.js.map +1 -0
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render/svg.js +1 -0
- package/dist/render/svg.js.map +1 -1
- package/dist/sign/base64url.d.ts +16 -0
- package/dist/sign/base64url.d.ts.map +1 -0
- package/dist/sign/base64url.js +24 -0
- package/dist/sign/base64url.js.map +1 -0
- package/dist/sign/index.d.ts +49 -0
- package/dist/sign/index.d.ts.map +1 -0
- package/dist/sign/index.js +133 -0
- package/dist/sign/index.js.map +1 -0
- package/dist/stamp/carrier/index.d.ts +7 -0
- package/dist/stamp/carrier/index.d.ts.map +1 -0
- package/dist/stamp/carrier/index.js +27 -0
- package/dist/stamp/carrier/index.js.map +1 -0
- package/dist/stamp/carrier/isobmff.d.ts +7 -0
- package/dist/stamp/carrier/isobmff.d.ts.map +1 -0
- package/dist/stamp/carrier/isobmff.js +55 -0
- package/dist/stamp/carrier/isobmff.js.map +1 -0
- package/dist/stamp/carrier/jpeg.d.ts +4 -0
- package/dist/stamp/carrier/jpeg.d.ts.map +1 -0
- package/dist/stamp/carrier/jpeg.js +76 -0
- package/dist/stamp/carrier/jpeg.js.map +1 -0
- package/dist/stamp/carrier/png.d.ts +7 -0
- package/dist/stamp/carrier/png.d.ts.map +1 -0
- package/dist/stamp/carrier/png.js +50 -0
- package/dist/stamp/carrier/png.js.map +1 -0
- package/dist/stamp/carrier/riff.d.ts +4 -0
- package/dist/stamp/carrier/riff.d.ts.map +1 -0
- package/dist/stamp/carrier/riff.js +54 -0
- package/dist/stamp/carrier/riff.js.map +1 -0
- package/dist/stamp/carrier/types.d.ts +25 -0
- package/dist/stamp/carrier/types.d.ts.map +1 -0
- package/dist/stamp/carrier/types.js +2 -0
- package/dist/stamp/carrier/types.js.map +1 -0
- package/dist/stamp/chunk.d.ts +0 -2
- package/dist/stamp/chunk.d.ts.map +1 -1
- package/dist/stamp/chunk.js +10 -18
- package/dist/stamp/chunk.js.map +1 -1
- package/dist/stamp/config-digest.d.ts +18 -0
- package/dist/stamp/config-digest.d.ts.map +1 -1
- package/dist/stamp/config-digest.js +24 -0
- package/dist/stamp/config-digest.js.map +1 -1
- package/dist/stamp/index.d.ts +2 -2
- package/dist/stamp/index.d.ts.map +1 -1
- package/dist/stamp/index.js +2 -2
- package/dist/stamp/index.js.map +1 -1
- package/dist/stamp/payload.d.ts +28 -0
- package/dist/stamp/payload.d.ts.map +1 -0
- package/dist/stamp/payload.js +42 -0
- package/dist/stamp/payload.js.map +1 -0
- package/dist/stamp/read.d.ts +5 -4
- package/dist/stamp/read.d.ts.map +1 -1
- package/dist/stamp/read.js +26 -43
- package/dist/stamp/read.js.map +1 -1
- package/dist/stamp/window.d.ts +11 -0
- package/dist/stamp/window.d.ts.map +1 -0
- package/dist/stamp/window.js +11 -0
- package/dist/stamp/window.js.map +1 -0
- package/dist/stamp/write.d.ts +21 -0
- package/dist/stamp/write.d.ts.map +1 -0
- package/dist/stamp/write.js +31 -0
- package/dist/stamp/write.js.map +1 -0
- package/dist/templates/article/bottom.d.ts +15 -0
- package/dist/templates/article/bottom.d.ts.map +1 -0
- package/dist/templates/article/bottom.js +61 -0
- package/dist/templates/article/bottom.js.map +1 -0
- package/dist/templates/article/index.d.ts +12 -0
- package/dist/templates/article/index.d.ts.map +1 -0
- package/dist/templates/article/index.js +42 -0
- package/dist/templates/article/index.js.map +1 -0
- package/dist/templates/article/lines.d.ts +27 -0
- package/dist/templates/article/lines.d.ts.map +1 -0
- package/dist/templates/article/lines.js +53 -0
- package/dist/templates/article/lines.js.map +1 -0
- package/dist/templates/article/tags.d.ts +25 -0
- package/dist/templates/article/tags.d.ts.map +1 -0
- package/dist/templates/article/tags.js +63 -0
- package/dist/templates/article/tags.js.map +1 -0
- package/dist/templates/attribution.d.ts +2 -6
- package/dist/templates/attribution.d.ts.map +1 -1
- package/dist/templates/attribution.js +8 -22
- package/dist/templates/attribution.js.map +1 -1
- package/dist/templates/banner/version.d.ts.map +1 -1
- package/dist/templates/banner/version.js +4 -4
- package/dist/templates/banner/version.js.map +1 -1
- package/dist/templates/bottom.d.ts +23 -0
- package/dist/templates/bottom.d.ts.map +1 -0
- package/dist/templates/bottom.js +37 -0
- package/dist/templates/bottom.js.map +1 -0
- package/dist/templates/byline.d.ts +19 -0
- package/dist/templates/byline.d.ts.map +1 -0
- package/dist/templates/byline.js +45 -0
- package/dist/templates/byline.js.map +1 -0
- package/dist/templates/code/clip.js +1 -1
- package/dist/templates/code/clip.js.map +1 -1
- package/dist/templates/code/fit.js +1 -1
- package/dist/templates/code/fit.js.map +1 -1
- package/dist/templates/code/warn.d.ts +1 -1
- package/dist/templates/code/warn.d.ts.map +1 -1
- package/dist/templates/code/warn.js +2 -2
- package/dist/templates/code/warn.js.map +1 -1
- package/dist/templates/docs/chrome.d.ts +17 -0
- package/dist/templates/docs/chrome.d.ts.map +1 -0
- package/dist/templates/docs/chrome.js +44 -0
- package/dist/templates/docs/chrome.js.map +1 -0
- package/dist/templates/docs/crumbs.d.ts +14 -0
- package/dist/templates/docs/crumbs.d.ts.map +1 -0
- package/dist/templates/docs/crumbs.js +32 -0
- package/dist/templates/docs/crumbs.js.map +1 -0
- package/dist/templates/docs/index.d.ts +13 -0
- package/dist/templates/docs/index.d.ts.map +1 -0
- package/dist/templates/docs/index.js +47 -0
- package/dist/templates/docs/index.js.map +1 -0
- package/dist/templates/docs/lines.d.ts +14 -0
- package/dist/templates/docs/lines.d.ts.map +1 -0
- package/dist/templates/docs/lines.js +29 -0
- package/dist/templates/docs/lines.js.map +1 -0
- package/dist/templates/event/index.d.ts +12 -0
- package/dist/templates/event/index.d.ts.map +1 -0
- package/dist/templates/event/index.js +59 -0
- package/dist/templates/event/index.js.map +1 -0
- package/dist/templates/event/lines.d.ts +14 -0
- package/dist/templates/event/lines.d.ts.map +1 -0
- package/dist/templates/event/lines.js +29 -0
- package/dist/templates/event/lines.js.map +1 -0
- package/dist/templates/event/plate.d.ts +16 -0
- package/dist/templates/event/plate.d.ts.map +1 -0
- package/dist/templates/event/plate.js +36 -0
- package/dist/templates/event/plate.js.map +1 -0
- package/dist/templates/frame.d.ts +68 -0
- package/dist/templates/frame.d.ts.map +1 -0
- package/dist/templates/frame.js +63 -0
- package/dist/templates/frame.js.map +1 -0
- package/dist/templates/index.d.ts +9 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +27 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/photo/index.d.ts +17 -0
- package/dist/templates/photo/index.d.ts.map +1 -0
- package/dist/templates/photo/index.js +51 -0
- package/dist/templates/photo/index.js.map +1 -0
- package/dist/templates/photo/lines.d.ts +21 -0
- package/dist/templates/photo/lines.d.ts.map +1 -0
- package/dist/templates/photo/lines.js +36 -0
- package/dist/templates/photo/lines.js.map +1 -0
- package/dist/templates/pill.d.ts +33 -0
- package/dist/templates/pill.d.ts.map +1 -0
- package/dist/templates/pill.js +50 -0
- package/dist/templates/pill.js.map +1 -0
- package/dist/templates/portrait.d.ts +40 -0
- package/dist/templates/portrait.d.ts.map +1 -0
- package/dist/templates/portrait.js +56 -0
- package/dist/templates/portrait.js.map +1 -0
- package/dist/templates/quote/index.d.ts +11 -0
- package/dist/templates/quote/index.d.ts.map +1 -0
- package/dist/templates/quote/index.js +60 -0
- package/dist/templates/quote/index.js.map +1 -0
- package/dist/templates/quote/lines.d.ts +24 -0
- package/dist/templates/quote/lines.d.ts.map +1 -0
- package/dist/templates/quote/lines.js +35 -0
- package/dist/templates/quote/lines.js.map +1 -0
- package/dist/templates/quote/mark.d.ts +13 -0
- package/dist/templates/quote/mark.d.ts.map +1 -0
- package/dist/templates/quote/mark.js +39 -0
- package/dist/templates/quote/mark.js.map +1 -0
- package/dist/templates/quote/speaker.d.ts +18 -0
- package/dist/templates/quote/speaker.d.ts.map +1 -0
- package/dist/templates/quote/speaker.js +41 -0
- package/dist/templates/quote/speaker.js.map +1 -0
- package/dist/templates/release/block.d.ts +8 -0
- package/dist/templates/release/block.d.ts.map +1 -0
- package/dist/templates/release/block.js +16 -0
- package/dist/templates/release/block.js.map +1 -0
- package/dist/templates/release/changes.d.ts +23 -0
- package/dist/templates/release/changes.d.ts.map +1 -0
- package/dist/templates/release/changes.js +45 -0
- package/dist/templates/release/changes.js.map +1 -0
- package/dist/templates/release/index.d.ts +11 -0
- package/dist/templates/release/index.d.ts.map +1 -0
- package/dist/templates/release/index.js +55 -0
- package/dist/templates/release/index.js.map +1 -0
- package/dist/templates/release/lines.d.ts +21 -0
- package/dist/templates/release/lines.d.ts.map +1 -0
- package/dist/templates/release/lines.js +36 -0
- package/dist/templates/release/lines.js.map +1 -0
- package/dist/templates/stat/index.d.ts +11 -0
- package/dist/templates/stat/index.d.ts.map +1 -0
- package/dist/templates/stat/index.js +43 -0
- package/dist/templates/stat/index.js.map +1 -0
- package/dist/templates/stat/lines.d.ts +23 -0
- package/dist/templates/stat/lines.d.ts.map +1 -0
- package/dist/templates/stat/lines.js +47 -0
- package/dist/templates/stat/lines.js.map +1 -0
- package/dist/templates/terminal/index.d.ts +16 -0
- package/dist/templates/terminal/index.d.ts.map +1 -0
- package/dist/templates/terminal/index.js +62 -0
- package/dist/templates/terminal/index.js.map +1 -0
- package/dist/templates/terminal/session.d.ts +17 -0
- package/dist/templates/terminal/session.d.ts.map +1 -0
- package/dist/templates/terminal/session.js +86 -0
- package/dist/templates/terminal/session.js.map +1 -0
- package/dist/templates/terminal/window.d.ts +14 -0
- package/dist/templates/terminal/window.d.ts.map +1 -0
- package/dist/templates/terminal/window.js +84 -0
- package/dist/templates/terminal/window.js.map +1 -0
- package/dist/templates/version.d.ts +16 -0
- package/dist/templates/version.d.ts.map +1 -0
- package/dist/templates/version.js +23 -0
- package/dist/templates/version.js.map +1 -0
- package/dist/templates/wordmark/index.d.ts +13 -0
- package/dist/templates/wordmark/index.d.ts.map +1 -0
- package/dist/templates/wordmark/index.js +53 -0
- package/dist/templates/wordmark/index.js.map +1 -0
- package/dist/templates/wordmark/lines.d.ts +22 -0
- package/dist/templates/wordmark/lines.d.ts.map +1 -0
- package/dist/templates/wordmark/lines.js +61 -0
- package/dist/templates/wordmark/lines.js.map +1 -0
- package/dist/templates/wordmark/mark.d.ts +16 -0
- package/dist/templates/wordmark/mark.d.ts.map +1 -0
- package/dist/templates/wordmark/mark.js +30 -0
- package/dist/templates/wordmark/mark.js.map +1 -0
- package/dist/text/clamp.d.ts +12 -0
- package/dist/text/clamp.d.ts.map +1 -0
- package/dist/text/clamp.js +41 -0
- package/dist/text/clamp.js.map +1 -0
- package/dist/text/ellipsis.d.ts +3 -0
- package/dist/text/ellipsis.d.ts.map +1 -0
- package/dist/text/ellipsis.js +3 -0
- package/dist/text/ellipsis.js.map +1 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +2 -0
- package/dist/text/index.js.map +1 -1
- package/dist/types.d.ts +158 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/collect.d.ts +6 -1
- package/dist/validate/collect.d.ts.map +1 -1
- package/dist/validate/collect.js +8 -2
- package/dist/validate/collect.js.map +1 -1
- package/dist/validate/index.d.ts +1 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +3 -2
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/keys.d.ts +6 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +17 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/values.d.ts +6 -0
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +12 -1
- package/dist/validate/values.js.map +1 -1
- package/package.json +16 -2
- package/dist/background.d.ts +0 -13
- package/dist/background.d.ts.map +0 -1
- package/dist/background.js +0 -65
- package/dist/background.js.map +0 -1
- package/dist/cli/args.d.ts +0 -14
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -67
- package/dist/cli/args.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -102
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts +0 -95
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -208
- package/dist/config.js.map +0 -1
- package/dist/fonts.d.ts +0 -18
- package/dist/fonts.d.ts.map +0 -1
- package/dist/fonts.js +0 -102
- package/dist/fonts.js.map +0 -1
- package/dist/generate.d.ts +0 -63
- package/dist/generate.d.ts.map +0 -1
- package/dist/generate.js +0 -109
- package/dist/generate.js.map +0 -1
- package/dist/highlight.d.ts +0 -75
- package/dist/highlight.d.ts.map +0 -1
- package/dist/highlight.js +0 -137
- package/dist/highlight.js.map +0 -1
- package/dist/render.d.ts +0 -24
- package/dist/render.d.ts.map +0 -1
- package/dist/render.js +0 -77
- package/dist/render.js.map +0 -1
- package/dist/stamp.d.ts +0 -29
- package/dist/stamp.d.ts.map +0 -1
- package/dist/stamp.js +0 -198
- package/dist/stamp.js.map +0 -1
- package/dist/templates/banner.d.ts +0 -9
- package/dist/templates/banner.d.ts.map +0 -1
- package/dist/templates/banner.js +0 -115
- package/dist/templates/banner.js.map +0 -1
- package/dist/templates/card.d.ts +0 -7
- package/dist/templates/card.d.ts.map +0 -1
- package/dist/templates/card.js +0 -72
- package/dist/templates/card.js.map +0 -1
- package/dist/templates/code.d.ts +0 -12
- package/dist/templates/code.d.ts.map +0 -1
- package/dist/templates/code.js +0 -275
- package/dist/templates/code.js.map +0 -1
- package/dist/templates/measure.d.ts +0 -11
- package/dist/templates/measure.d.ts.map +0 -1
- package/dist/templates/measure.js +0 -11
- package/dist/templates/measure.js.map +0 -1
- package/dist/templates/props.d.ts +0 -7
- package/dist/templates/props.d.ts.map +0 -1
- package/dist/templates/props.js +0 -17
- package/dist/templates/props.js.map +0 -1
- package/dist/templates/text.d.ts +0 -37
- package/dist/templates/text.d.ts.map +0 -1
- package/dist/templates/text.js +0 -26
- package/dist/templates/text.js.map +0 -1
- package/dist/text/stack.d.ts +0 -24
- package/dist/text/stack.d.ts.map +0 -1
- package/dist/text/stack.js +0 -18
- package/dist/text/stack.js.map +0 -1
- package/dist/text.d.ts +0 -56
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -78
- package/dist/text.js.map +0 -1
- package/dist/validate/sizes.d.ts +0 -9
- package/dist/validate/sizes.d.ts.map +0 -1
- package/dist/validate/sizes.js +0 -27
- package/dist/validate/sizes.js.map +0 -1
- package/dist/validate.d.ts +0 -15
- package/dist/validate.d.ts.map +0 -1
- package/dist/validate.js +0 -300
- package/dist/validate.js.map +0 -1
package/README.md
CHANGED
|
@@ -72,6 +72,8 @@ export default defineConfig({
|
|
|
72
72
|
});
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
`colophon init` writes that file for you, guessing where your content lives.
|
|
76
|
+
|
|
75
77
|
Run it over a content tree:
|
|
76
78
|
|
|
77
79
|
```bash
|
|
@@ -80,7 +82,12 @@ colophon content --config colophon.config.ts
|
|
|
80
82
|
|
|
81
83
|
For every file that declares `meta_img_props`, Colophon writes one PNG per
|
|
82
84
|
output size next to it, named `<slug>-<size>.png`, so `post/index.md` produces
|
|
83
|
-
`post/post-og.png` and `post/post-square.png`.
|
|
85
|
+
`post/post-og.png` and `post/post-square.png`. Set `format` to `webp`, `jpeg` or
|
|
86
|
+
`avif` for a quarter of the bytes.
|
|
87
|
+
|
|
88
|
+
While tuning a template, `colophon preview <file>` renders one post and opens
|
|
89
|
+
it, `--watch` rebuilds on every change, and `--dry-run` reports what would
|
|
90
|
+
change without writing anything.
|
|
84
91
|
|
|
85
92
|
There is also a programmatic API. `renderMetaImages` takes props and config and
|
|
86
93
|
returns rendered bytes, and `generate` ties walking, rendering and writing
|
|
@@ -91,21 +98,27 @@ together.
|
|
|
91
98
|
Full documentation is in [`docs/`](./docs/).
|
|
92
99
|
|
|
93
100
|
- [Getting started](./docs/getting-started/ "Install, frontmatter, config and the CLI")
|
|
101
|
+
- [The command line](./docs/cli/ "Every command and flag, including init, preview, eject, dry runs and watching")
|
|
94
102
|
- [Templates](./docs/templates/ "The built-in layouts and how to register your own")
|
|
95
103
|
- [The code template](./docs/code-template/ "Syntax-highlighted code images")
|
|
104
|
+
- [Astro](./docs/astro/ "The integration and the meta tags component")
|
|
105
|
+
- [The browser-safe core](./docs/core/ "Running the template layer outside Node")
|
|
96
106
|
- [The layout toolkit](./docs/layout/ "The primitives templates are built from")
|
|
97
107
|
- [Themes and background treatments](./docs/configuration/themes/ "Named looks, meshes, grain, dots and rules")
|
|
98
108
|
- [Logos and photographs](./docs/configuration/images/ "Branding an image with a logo, avatar or background photo")
|
|
99
109
|
- [Configuration](./docs/configuration/ "Every option, and what happens to an unknown one")
|
|
110
|
+
- [Output formats](./docs/configuration/formats/ "WebP, JPEG and AVIF, quality, size caps and the SVG source")
|
|
111
|
+
- [File size](./docs/configuration/compression/ "How hard the rendered PNGs are compressed, and what it costs")
|
|
100
112
|
- [Rebuilds](./docs/rebuilds/ "How Colophon decides what to render again")
|
|
101
113
|
- [Programmatic use](./docs/programmatic-use/ "The API behind the CLI")
|
|
102
114
|
- [Upgrading](./docs/upgrading/ "The breaking changes in 2.0 and 3.0")
|
|
103
115
|
|
|
104
116
|
## Sample output
|
|
105
117
|
|
|
106
|
-
These are generated by [`scripts/gen-samples.ts`](scripts/gen-samples.ts)
|
|
107
|
-
|
|
108
|
-
updated PNGs so this
|
|
118
|
+
These are generated by [`scripts/gen-samples.ts`](scripts/gen-samples.ts) from
|
|
119
|
+
the sample list in [`test/samples.ts`](test/samples.ts). Run `pnpm samples` to
|
|
120
|
+
regenerate them after changing a template, then commit the updated PNGs so this
|
|
121
|
+
gallery stays in sync.
|
|
109
122
|
|
|
110
123
|
<table>
|
|
111
124
|
<tr>
|
|
@@ -138,6 +151,53 @@ updated PNGs so this gallery stays in sync.
|
|
|
138
151
|
<sub><code>code</code> · 1200×630 · TypeScript, <code>night-owl</code></sub>
|
|
139
152
|
</td>
|
|
140
153
|
</tr>
|
|
154
|
+
<tr>
|
|
155
|
+
<td>
|
|
156
|
+
<img src="docs/samples/article-wide.png" alt="article template, landscape" width="100%" /><br />
|
|
157
|
+
<sub><code>article</code> · 1200×630 · tags, headline, byline and avatar</sub>
|
|
158
|
+
</td>
|
|
159
|
+
<td>
|
|
160
|
+
<img src="docs/samples/terminal-wide.png" alt="terminal template, landscape" width="100%" /><br />
|
|
161
|
+
<sub><code>terminal</code> · 1200×630 · a command and its output</sub>
|
|
162
|
+
</td>
|
|
163
|
+
</tr>
|
|
164
|
+
<tr>
|
|
165
|
+
<td>
|
|
166
|
+
<img src="docs/samples/quote-square.png" alt="quote template, square" width="100%" /><br />
|
|
167
|
+
<sub><code>quote</code> · 1200×1200 · pull quote with attribution</sub>
|
|
168
|
+
</td>
|
|
169
|
+
<td>
|
|
170
|
+
<img src="docs/samples/release-square.png" alt="release template, square" width="100%" /><br />
|
|
171
|
+
<sub><code>release</code> · 1200×1200 · version and headline changes</sub>
|
|
172
|
+
</td>
|
|
173
|
+
</tr>
|
|
174
|
+
<tr>
|
|
175
|
+
<td>
|
|
176
|
+
<img src="docs/samples/stat-square.png" alt="stat template, square" width="100%" /><br />
|
|
177
|
+
<sub><code>stat</code> · 1200×1200 · one figure and a caption</sub>
|
|
178
|
+
</td>
|
|
179
|
+
<td>
|
|
180
|
+
<img src="docs/samples/event-square.png" alt="event template, square" width="100%" /><br />
|
|
181
|
+
<sub><code>event</code> · 1200×1200 · date, title and location</sub>
|
|
182
|
+
</td>
|
|
183
|
+
</tr>
|
|
184
|
+
<tr>
|
|
185
|
+
<td>
|
|
186
|
+
<img src="docs/samples/photo-wide.png" alt="photo template, landscape" width="100%" /><br />
|
|
187
|
+
<sub><code>photo</code> · 1200×630 · the post's own photograph, scrimmed</sub>
|
|
188
|
+
</td>
|
|
189
|
+
<td>
|
|
190
|
+
<img src="docs/samples/wordmark-wide.png" alt="wordmark template, landscape" width="100%" /><br />
|
|
191
|
+
<sub><code>wordmark</code> · 1200×630 · logo, name and tagline</sub>
|
|
192
|
+
</td>
|
|
193
|
+
</tr>
|
|
194
|
+
<tr>
|
|
195
|
+
<td>
|
|
196
|
+
<img src="docs/samples/docs-wide.png" alt="docs template, landscape" width="100%" /><br />
|
|
197
|
+
<sub><code>docs</code> · 1200×630 · breadcrumb, title and summary</sub>
|
|
198
|
+
</td>
|
|
199
|
+
<td></td>
|
|
200
|
+
</tr>
|
|
141
201
|
</table>
|
|
142
202
|
|
|
143
203
|
### Themes
|
|
@@ -187,15 +247,33 @@ theme sets and how to override part of one.
|
|
|
187
247
|
|
|
188
248
|
## Development
|
|
189
249
|
|
|
190
|
-
| Script | What it does
|
|
191
|
-
| --------------------------------- |
|
|
192
|
-
| `pnpm build` | Compile to `dist/`.
|
|
193
|
-
| `pnpm test`, `pnpm test:coverage` | Run Vitest.
|
|
194
|
-
| `pnpm lint` | ESLint and Prettier check.
|
|
195
|
-
| `pnpm fmt` | Auto-fix.
|
|
196
|
-
| `pnpm samples` | Regenerate the sample images into `docs/samples/`.
|
|
197
|
-
| `pnpm
|
|
198
|
-
| `pnpm
|
|
250
|
+
| Script | What it does |
|
|
251
|
+
| --------------------------------- | ---------------------------------------------------------------------------- |
|
|
252
|
+
| `pnpm build` | Compile to `dist/`. |
|
|
253
|
+
| `pnpm test`, `pnpm test:coverage` | Run Vitest. |
|
|
254
|
+
| `pnpm lint` | ESLint and Prettier check. |
|
|
255
|
+
| `pnpm fmt` | Auto-fix. |
|
|
256
|
+
| `pnpm samples` | Regenerate the sample images into `docs/samples/`. |
|
|
257
|
+
| `pnpm baselines` | Re-record the visual regression baselines in `test/baselines/`. |
|
|
258
|
+
| `pnpm fta` | [FTA](https://ftaproject.dev) scores, failing on any file 50 or above. |
|
|
259
|
+
| `pnpm check` | Format, FTA, typecheck, build and test with coverage. Run before committing. |
|
|
260
|
+
|
|
261
|
+
### Visual regression
|
|
262
|
+
|
|
263
|
+
Templates are pictures, so `pnpm test` renders every sample and compares it
|
|
264
|
+
against a committed baseline in `test/baselines/`. A change to a template shows
|
|
265
|
+
up as a failure naming how far the image moved, and writes what it rendered to
|
|
266
|
+
`test/.visual/` so you can open the two side by side. CI uploads the same
|
|
267
|
+
images as an artifact when the check fails.
|
|
268
|
+
|
|
269
|
+
When the change was the point, run `pnpm baselines` and commit the new PNGs with
|
|
270
|
+
it. The diff is then the before and after, which is the review the check exists
|
|
271
|
+
to make possible.
|
|
272
|
+
|
|
273
|
+
The baselines are rendered with font files rather than whatever the machine has
|
|
274
|
+
installed, and at a fraction of the width they are laid out at, which keeps them
|
|
275
|
+
reproducible anywhere and small enough to live in the repository. The gallery
|
|
276
|
+
above is rendered separately, as a project would render it.
|
|
199
277
|
|
|
200
278
|
## License
|
|
201
279
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { GenerateOptions } from "../generate/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The shape Astro wants an integration to be.
|
|
4
|
+
*
|
|
5
|
+
* Declared here rather than imported from `astro`, so that installing Colophon
|
|
6
|
+
* does not drag a framework in and a project on any Astro version can use this
|
|
7
|
+
* one. It is structural: what matters is that the object fits where an
|
|
8
|
+
* integration goes, and a zero-argument hook fits a slot expecting one that
|
|
9
|
+
* takes the build's context.
|
|
10
|
+
*/
|
|
11
|
+
export interface AstroIntegration {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly hooks: {
|
|
14
|
+
readonly "astro:config:setup": () => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** What the integration needs, which is what `generate` needs. */
|
|
18
|
+
export type ColophonIntegrationOptions = GenerateOptions;
|
|
19
|
+
/**
|
|
20
|
+
* Render the site's meta images as part of an Astro build.
|
|
21
|
+
*
|
|
22
|
+
* ```js
|
|
23
|
+
* // astro.config.mjs
|
|
24
|
+
* import colophon from "@kensio/colophon/astro";
|
|
25
|
+
*
|
|
26
|
+
* export default defineConfig({
|
|
27
|
+
* integrations: [
|
|
28
|
+
* colophon({
|
|
29
|
+
* contentDir: "src/content",
|
|
30
|
+
* config: { manifest: "src/data/colophon.json", footer: "example.com" },
|
|
31
|
+
* }),
|
|
32
|
+
* ],
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* It runs on `astro:config:setup`, which is the one hook that fires for
|
|
37
|
+
* `astro dev` as well as `astro build`, and which runs before anything is
|
|
38
|
+
* rendered. Both matter: the manifest has to be on disk before a page that
|
|
39
|
+
* reads it is built, and a dev server should show the images the build will
|
|
40
|
+
* produce rather than whatever the last build left behind.
|
|
41
|
+
*
|
|
42
|
+
* Running on every dev start sounds expensive and is not, because of the
|
|
43
|
+
* rebuild stamps: a second run reads the content tree, compares digests and
|
|
44
|
+
* renders nothing. The manifest is rewritten either way, being a small file
|
|
45
|
+
* describing images that are already there. Only the first run in a session
|
|
46
|
+
* pays for rendering, and only for the images that changed.
|
|
47
|
+
*/
|
|
48
|
+
export default function colophon(options: ColophonIntegrationOptions): AstroIntegration;
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE;QAGd,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KACpD,CAAC;CACH;AAED,kEAAkE;AAClE,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CAUlB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { generate } from "../generate/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Render the site's meta images as part of an Astro build.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* // astro.config.mjs
|
|
7
|
+
* import colophon from "@kensio/colophon/astro";
|
|
8
|
+
*
|
|
9
|
+
* export default defineConfig({
|
|
10
|
+
* integrations: [
|
|
11
|
+
* colophon({
|
|
12
|
+
* contentDir: "src/content",
|
|
13
|
+
* config: { manifest: "src/data/colophon.json", footer: "example.com" },
|
|
14
|
+
* }),
|
|
15
|
+
* ],
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* It runs on `astro:config:setup`, which is the one hook that fires for
|
|
20
|
+
* `astro dev` as well as `astro build`, and which runs before anything is
|
|
21
|
+
* rendered. Both matter: the manifest has to be on disk before a page that
|
|
22
|
+
* reads it is built, and a dev server should show the images the build will
|
|
23
|
+
* produce rather than whatever the last build left behind.
|
|
24
|
+
*
|
|
25
|
+
* Running on every dev start sounds expensive and is not, because of the
|
|
26
|
+
* rebuild stamps: a second run reads the content tree, compares digests and
|
|
27
|
+
* renders nothing. The manifest is rewritten either way, being a small file
|
|
28
|
+
* describing images that are already there. Only the first run in a session
|
|
29
|
+
* pays for rendering, and only for the images that changed.
|
|
30
|
+
*/
|
|
31
|
+
export default function colophon(options) {
|
|
32
|
+
return {
|
|
33
|
+
name: "@kensio/colophon",
|
|
34
|
+
hooks: {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
36
|
+
"astro:config:setup": async () => {
|
|
37
|
+
await generate(options);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAwBhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE;YACL,gEAAgE;YAChE,oBAAoB,EAAE,KAAK,IAAmB,EAAE;gBAC9C,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** What the CLI has been asked to do. */
|
|
2
|
+
export type CliCommand = "generate" | "init" | "preview" | "eject";
|
|
3
|
+
/**
|
|
4
|
+
* Read the command out of the first argument.
|
|
5
|
+
*
|
|
6
|
+
* It is a command only where it names one: `colophon content` has always meant
|
|
7
|
+
* "build this tree", so a bare positional stays the content directory, and a
|
|
8
|
+
* subcommand is an addition to that rather than a replacement for it. The cost
|
|
9
|
+
* is that a content directory called `init` or `preview` has to be written as
|
|
10
|
+
* `./init`, which is worth saying in the help text and no more.
|
|
11
|
+
*/
|
|
12
|
+
export declare function commandOf(first: string | undefined): CliCommand;
|
|
13
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/cli/args/command.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAYnE;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAE/D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commands that are named on the command line. `generate` is not among
|
|
3
|
+
* them because it is what a run with no command does.
|
|
4
|
+
*/
|
|
5
|
+
const named = {
|
|
6
|
+
init: "init",
|
|
7
|
+
preview: "preview",
|
|
8
|
+
eject: "eject",
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Read the command out of the first argument.
|
|
12
|
+
*
|
|
13
|
+
* It is a command only where it names one: `colophon content` has always meant
|
|
14
|
+
* "build this tree", so a bare positional stays the content directory, and a
|
|
15
|
+
* subcommand is an addition to that rather than a replacement for it. The cost
|
|
16
|
+
* is that a content directory called `init` or `preview` has to be written as
|
|
17
|
+
* `./init`, which is worth saying in the help text and no more.
|
|
18
|
+
*/
|
|
19
|
+
export function commandOf(first) {
|
|
20
|
+
return (first === undefined ? undefined : named[first]) ?? "generate";
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/cli/args/command.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,KAAK,GAAyC;IAClD,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,KAAyB;IACjD,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CliCommand } from "./command.js";
|
|
2
|
+
export type { CliCommand } from "./command.js";
|
|
3
|
+
export { usage } from "./usage.js";
|
|
4
|
+
/**
|
|
5
|
+
* The parsed command line.
|
|
6
|
+
*/
|
|
7
|
+
export interface CliArgs {
|
|
8
|
+
readonly command: CliCommand;
|
|
9
|
+
/**
|
|
10
|
+
* The content tree to build. `undefined` where the run named none, which
|
|
11
|
+
* `generate` reads as the default and `init` as an invitation to guess.
|
|
12
|
+
*/
|
|
13
|
+
readonly contentDir: string | undefined;
|
|
14
|
+
/** The post `preview` renders. */
|
|
15
|
+
readonly file: string | undefined;
|
|
16
|
+
/** What `eject` writes, naming the generator it is for. */
|
|
17
|
+
readonly adapter: string | undefined;
|
|
18
|
+
readonly configPath: string | undefined;
|
|
19
|
+
readonly overwrite: boolean;
|
|
20
|
+
readonly dryRun: boolean;
|
|
21
|
+
readonly watch: boolean;
|
|
22
|
+
readonly concurrency: number | undefined;
|
|
23
|
+
/** Which configured size `preview` renders. */
|
|
24
|
+
readonly size: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** Read the command line into the options each command takes. */
|
|
27
|
+
export declare function parseCliArgs(argv: readonly string[]): CliArgs;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/args/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM/C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AA2CD,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAyC7D"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { commandOf } from "./command.js";
|
|
2
|
+
import { assertKnownFlag, switchesFrom } from "./switches.js";
|
|
3
|
+
import { valueFlags, valueOf } from "./values.js";
|
|
4
|
+
export { usage } from "./usage.js";
|
|
5
|
+
/** Where each command's one positional goes: a path, or a generator's name. */
|
|
6
|
+
function target(command, positionals) {
|
|
7
|
+
const extra = positionals[1];
|
|
8
|
+
// Two positionals is a mistake worth naming rather than quietly resolving:
|
|
9
|
+
// taking the last would build a tree the run did not mean to name.
|
|
10
|
+
if (extra !== undefined) {
|
|
11
|
+
throw new Error(`Unexpected argument "${extra}".`);
|
|
12
|
+
}
|
|
13
|
+
const first = positionals[0];
|
|
14
|
+
const empty = { contentDir: undefined, file: undefined, adapter: undefined };
|
|
15
|
+
switch (command) {
|
|
16
|
+
case "preview": {
|
|
17
|
+
return { ...empty, file: first };
|
|
18
|
+
}
|
|
19
|
+
case "eject": {
|
|
20
|
+
return { ...empty, adapter: first };
|
|
21
|
+
}
|
|
22
|
+
case "generate":
|
|
23
|
+
case "init": {
|
|
24
|
+
return { ...empty, contentDir: first };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One argument split at its first `=`, so that `--config=x` and `--config x`
|
|
30
|
+
* are the same thing. A path is free to contain an `=` because the split is
|
|
31
|
+
* only believed where the part before it is a flag that takes a value.
|
|
32
|
+
*/
|
|
33
|
+
function splitInline(arg) {
|
|
34
|
+
const at = arg.indexOf("=");
|
|
35
|
+
return at === -1 ? [arg, undefined] : [arg.slice(0, at), arg.slice(at + 1)];
|
|
36
|
+
}
|
|
37
|
+
/** Read the command line into the options each command takes. */
|
|
38
|
+
export function parseCliArgs(argv) {
|
|
39
|
+
const command = commandOf(argv[0]);
|
|
40
|
+
const rest = command === "generate" ? argv : argv.slice(1);
|
|
41
|
+
const positionals = [];
|
|
42
|
+
const flags = new Set();
|
|
43
|
+
let values = {};
|
|
44
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
45
|
+
const arg = rest[index] ?? "";
|
|
46
|
+
const [flag, inline] = splitInline(arg);
|
|
47
|
+
if (valueFlags.has(flag)) {
|
|
48
|
+
let value = inline;
|
|
49
|
+
if (value === undefined) {
|
|
50
|
+
index += 1;
|
|
51
|
+
value = rest[index];
|
|
52
|
+
}
|
|
53
|
+
if (value === undefined) {
|
|
54
|
+
throw new Error(`Missing value for ${flag}`);
|
|
55
|
+
}
|
|
56
|
+
values = { ...values, ...valueOf(flag, value) };
|
|
57
|
+
}
|
|
58
|
+
else if (arg.startsWith("-")) {
|
|
59
|
+
assertKnownFlag(flag);
|
|
60
|
+
flags.add(flag);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
positionals.push(arg);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
command,
|
|
68
|
+
...target(command, positionals),
|
|
69
|
+
configPath: values.configPath,
|
|
70
|
+
concurrency: values.concurrency,
|
|
71
|
+
size: values.size,
|
|
72
|
+
...switchesFrom(flags),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/args/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAyBnC,+EAA+E;AAC/E,SAAS,MAAM,CACb,OAAmB,EACnB,WAA8B;IAE9B,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAE7B,2EAA2E;IAC3E,mEAAmE;IACnE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAE7E,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,SAAS,EAAE,CAAC;YACf,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACnC,CAAC;QACD,KAAK,OAAO,EAAE,CAAC;YACb,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACtC,CAAC;QACD,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM,EAAE,CAAC;YACZ,OAAO,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QACzC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE5B,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,YAAY,CAAC,IAAuB;IAClD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE3D,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,IAAI,MAAM,GAAe,EAAE,CAAC;IAE5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAExC,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,IAAI,KAAK,GAAG,MAAM,CAAC;YAEnB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,KAAK,IAAI,CAAC,CAAC;gBACX,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;YAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;YAC/C,CAAC;YAED,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QAClD,CAAC;aAAM,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/B,eAAe,CAAC,IAAI,CAAC,CAAC;YACtB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,YAAY,CAAC,KAAK,CAAC;KACvB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The flags that carry no value, each of which sets one boolean. */
|
|
2
|
+
export interface Switches {
|
|
3
|
+
readonly overwrite: boolean;
|
|
4
|
+
readonly dryRun: boolean;
|
|
5
|
+
readonly watch: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Reject an option the CLI does not have, suggesting what it looks like.
|
|
9
|
+
*
|
|
10
|
+
* Ignoring it silently is worse than it sounds: `--dry-runs` would then render
|
|
11
|
+
* and write a whole tree, which is the one thing the run was asking it not to
|
|
12
|
+
* do. The suggestion comes from the same edit distance the config validation
|
|
13
|
+
* uses, since a mistyped flag is the same slip as a mistyped option.
|
|
14
|
+
*/
|
|
15
|
+
export declare function assertKnownFlag(flag: string): void;
|
|
16
|
+
/** Read the switches out of the flags a command line carried. */
|
|
17
|
+
export declare function switchesFrom(flags: ReadonlySet<string>): Switches;
|
|
18
|
+
//# sourceMappingURL=switches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switches.d.ts","sourceRoot":"","sources":["../../../src/cli/args/switches.ts"],"names":[],"mappings":"AAGA,qEAAqE;AACrE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAgBD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAYlD;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,QAAQ,CASjE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { nearestName } from "../../validate/suggest.js";
|
|
2
|
+
import { valueFlags } from "./values.js";
|
|
3
|
+
/** `--overwrite` is kept as an alias so existing build scripts keep working. */
|
|
4
|
+
const forceFlags = ["-f", "--force", "-o", "--overwrite"];
|
|
5
|
+
const dryRunFlags = ["-n", "--dry-run"];
|
|
6
|
+
const watchFlags = ["-w", "--watch"];
|
|
7
|
+
const helpFlags = ["-h", "--help"];
|
|
8
|
+
const knownFlags = new Set([
|
|
9
|
+
...forceFlags,
|
|
10
|
+
...dryRunFlags,
|
|
11
|
+
...watchFlags,
|
|
12
|
+
...helpFlags,
|
|
13
|
+
...valueFlags,
|
|
14
|
+
]);
|
|
15
|
+
/**
|
|
16
|
+
* Reject an option the CLI does not have, suggesting what it looks like.
|
|
17
|
+
*
|
|
18
|
+
* Ignoring it silently is worse than it sounds: `--dry-runs` would then render
|
|
19
|
+
* and write a whole tree, which is the one thing the run was asking it not to
|
|
20
|
+
* do. The suggestion comes from the same edit distance the config validation
|
|
21
|
+
* uses, since a mistyped flag is the same slip as a mistyped option.
|
|
22
|
+
*/
|
|
23
|
+
export function assertKnownFlag(flag) {
|
|
24
|
+
if (knownFlags.has(flag)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const suggestion = nearestName(flag, [...knownFlags]);
|
|
28
|
+
const advice = suggestion === undefined
|
|
29
|
+
? "Run colophon --help for the options."
|
|
30
|
+
: `Did you mean "${suggestion}"?`;
|
|
31
|
+
throw new Error(`Unknown option "${flag}". ${advice}`);
|
|
32
|
+
}
|
|
33
|
+
/** Read the switches out of the flags a command line carried. */
|
|
34
|
+
export function switchesFrom(flags) {
|
|
35
|
+
const hasAnyOf = (group) => group.some((flag) => flags.has(flag));
|
|
36
|
+
return {
|
|
37
|
+
overwrite: hasAnyOf(forceFlags),
|
|
38
|
+
dryRun: hasAnyOf(dryRunFlags),
|
|
39
|
+
watch: hasAnyOf(watchFlags),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=switches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switches.js","sourceRoot":"","sources":["../../../src/cli/args/switches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASzC,gFAAgF;AAChF,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AACxC,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACrC,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAEnC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,GAAG,UAAU;IACb,GAAG,WAAW;IACd,GAAG,UAAU;IACb,GAAG,SAAS;IACZ,GAAG,UAAU;CACd,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IACtD,MAAM,MAAM,GACV,UAAU,KAAK,SAAS;QACtB,CAAC,CAAC,sCAAsC;QACxC,CAAC,CAAC,iBAAiB,UAAU,IAAI,CAAC;IAEtC,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC;AACzD,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,YAAY,CAAC,KAA0B;IACrD,MAAM,QAAQ,GAAG,CAAC,KAAwB,EAAW,EAAE,CACrD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAExC,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC;QAC/B,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC7B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Help text for `--help`, and for a run that asks for nothing else. */
|
|
2
|
+
export declare const usage = "colophon: generate social meta images from frontmatter\n\nUsage:\n colophon [contentDir] [options] Render the images for a content tree\n colophon init [contentDir] Write a starter config module\n colophon preview <file> [options] Render one post and open it\n colophon eject hugo Write a Hugo partial that reads the\n manifest and emits the meta tags\n\nImages carry a stamp of the props, config and size they came from, so a rebuild\nrenders only the ones that have actually changed.\n\nOptions:\n -c, --config <path> Load a config module. Its default export is either a\n ColophonConfig or a function (async or not) returning\n one, for a config that has to compute something.\n -f, --force Re-render every image, ignoring the stamps. For init\n and eject, overwrite a file that is already there\n -o, --overwrite Alias for --force\n -n, --dry-run Report what would change and write nothing\n -w, --watch Rebuild whenever a content file changes\n --concurrency <n> How many images to render at once\n --size <name> Which configured size preview renders\n -h, --help Show this help\n\nDefaults:\n contentDir content\n --concurrency one per available CPU\n --size the first configured size\n\nThe first argument is a command where it names one, so a content directory\ncalled init, preview or eject has to be written as ./init.";
|
|
3
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/args/usage.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,KAAK,qiDA+ByC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Help text for `--help`, and for a run that asks for nothing else. */
|
|
2
|
+
export const usage = `colophon: generate social meta images from frontmatter
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
colophon [contentDir] [options] Render the images for a content tree
|
|
6
|
+
colophon init [contentDir] Write a starter config module
|
|
7
|
+
colophon preview <file> [options] Render one post and open it
|
|
8
|
+
colophon eject hugo Write a Hugo partial that reads the
|
|
9
|
+
manifest and emits the meta tags
|
|
10
|
+
|
|
11
|
+
Images carry a stamp of the props, config and size they came from, so a rebuild
|
|
12
|
+
renders only the ones that have actually changed.
|
|
13
|
+
|
|
14
|
+
Options:
|
|
15
|
+
-c, --config <path> Load a config module. Its default export is either a
|
|
16
|
+
ColophonConfig or a function (async or not) returning
|
|
17
|
+
one, for a config that has to compute something.
|
|
18
|
+
-f, --force Re-render every image, ignoring the stamps. For init
|
|
19
|
+
and eject, overwrite a file that is already there
|
|
20
|
+
-o, --overwrite Alias for --force
|
|
21
|
+
-n, --dry-run Report what would change and write nothing
|
|
22
|
+
-w, --watch Rebuild whenever a content file changes
|
|
23
|
+
--concurrency <n> How many images to render at once
|
|
24
|
+
--size <name> Which configured size preview renders
|
|
25
|
+
-h, --help Show this help
|
|
26
|
+
|
|
27
|
+
Defaults:
|
|
28
|
+
contentDir content
|
|
29
|
+
--concurrency one per available CPU
|
|
30
|
+
--size the first configured size
|
|
31
|
+
|
|
32
|
+
The first argument is a command where it names one, so a content directory
|
|
33
|
+
called init, preview or eject has to be written as ./init.`;
|
|
34
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/cli/args/usage.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DA+BsC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The options whose value is the argument after them. */
|
|
2
|
+
export interface FlagValues {
|
|
3
|
+
readonly configPath?: string;
|
|
4
|
+
readonly concurrency?: number;
|
|
5
|
+
readonly size?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Flags that take the next argument as their value. */
|
|
8
|
+
export declare const valueFlags: Set<string>;
|
|
9
|
+
/** The one field a value flag sets, ready to be folded into the rest. */
|
|
10
|
+
export declare function valueOf(flag: string, value: string): FlagValues;
|
|
11
|
+
//# sourceMappingURL=values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../src/cli/args/values.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wDAAwD;AACxD,eAAO,MAAM,UAAU,aAKrB,CAAC;AAkBH,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAU/D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Flags that take the next argument as their value. */
|
|
2
|
+
export const valueFlags = new Set([
|
|
3
|
+
"-c",
|
|
4
|
+
"--config",
|
|
5
|
+
"--concurrency",
|
|
6
|
+
"--size",
|
|
7
|
+
]);
|
|
8
|
+
/**
|
|
9
|
+
* A mistyped count would otherwise reach `generate` as `NaN` and be reported
|
|
10
|
+
* without naming the flag it came from, so it is rejected here instead.
|
|
11
|
+
*/
|
|
12
|
+
function parseConcurrency(value) {
|
|
13
|
+
const parsed = Number(value);
|
|
14
|
+
if (!Number.isSafeInteger(parsed) || parsed < 1) {
|
|
15
|
+
throw new Error(`Invalid value for --concurrency: "${value}"; expected a positive integer.`);
|
|
16
|
+
}
|
|
17
|
+
return parsed;
|
|
18
|
+
}
|
|
19
|
+
/** The one field a value flag sets, ready to be folded into the rest. */
|
|
20
|
+
export function valueOf(flag, value) {
|
|
21
|
+
if (flag === "--concurrency") {
|
|
22
|
+
return { concurrency: parseConcurrency(value) };
|
|
23
|
+
}
|
|
24
|
+
if (flag === "--size") {
|
|
25
|
+
return { size: value };
|
|
26
|
+
}
|
|
27
|
+
return { configPath: value };
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/cli/args/values.ts"],"names":[],"mappings":"AAOA,wDAAwD;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IAChC,IAAI;IACJ,UAAU;IACV,eAAe;IACf,QAAQ;CACT,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE7B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CACb,qCAAqC,KAAK,iCAAiC,CAC5E,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,KAAa;IACjD,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC7B,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;IAClD,CAAC;IAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CliArgs } from "./args/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Render the images for a content tree: the CLI's original and usual job.
|
|
4
|
+
*
|
|
5
|
+
* Under `--watch` the same build runs again on every content change. The config
|
|
6
|
+
* is loaded once, outside the loop, since a watch does not pick up changes to it
|
|
7
|
+
* in any case.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runBuild(args: CliArgs): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAQ/C;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B3D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defaultContentExtensions } from "../content/index.js";
|
|
2
|
+
import { generate } from "../generate/index.js";
|
|
3
|
+
import { loadConfig } from "./config.js";
|
|
4
|
+
import { reportImage, reportSummary } from "./report.js";
|
|
5
|
+
import { watchContent } from "./watch/index.js";
|
|
6
|
+
/** Where a run with no content directory named looks for one. */
|
|
7
|
+
const defaultContentDir = "content";
|
|
8
|
+
/**
|
|
9
|
+
* Render the images for a content tree: the CLI's original and usual job.
|
|
10
|
+
*
|
|
11
|
+
* Under `--watch` the same build runs again on every content change. The config
|
|
12
|
+
* is loaded once, outside the loop, since a watch does not pick up changes to it
|
|
13
|
+
* in any case.
|
|
14
|
+
*/
|
|
15
|
+
export async function runBuild(args) {
|
|
16
|
+
const config = await loadConfig(args.configPath);
|
|
17
|
+
const contentDir = args.contentDir ?? defaultContentDir;
|
|
18
|
+
const build = async () => {
|
|
19
|
+
const results = await generate({
|
|
20
|
+
contentDir,
|
|
21
|
+
overwrite: args.overwrite,
|
|
22
|
+
dryRun: args.dryRun,
|
|
23
|
+
...(config !== undefined && { config }),
|
|
24
|
+
...(args.concurrency !== undefined && { concurrency: args.concurrency }),
|
|
25
|
+
onResult: (result) => {
|
|
26
|
+
reportImage(result, args.dryRun);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
reportSummary(results, args.dryRun);
|
|
30
|
+
};
|
|
31
|
+
if (!args.watch) {
|
|
32
|
+
await build();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
await watchContent({
|
|
36
|
+
dir: contentDir,
|
|
37
|
+
extensions: config?.content?.extensions ?? defaultContentExtensions,
|
|
38
|
+
build,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=build.js.map
|