@kensio/colophon 2.4.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.
- package/README.md +139 -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/background/gradient.d.ts +12 -0
- package/dist/background/gradient.d.ts.map +1 -0
- package/dist/background/gradient.js +21 -0
- package/dist/background/gradient.js.map +1 -0
- package/dist/background/image.d.ts +14 -0
- package/dist/background/image.d.ts.map +1 -0
- package/dist/background/image.js +36 -0
- package/dist/background/image.js.map +1 -0
- package/dist/{background.d.ts → background/index.d.ts} +5 -5
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +27 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/mesh.d.ts +12 -0
- package/dist/background/mesh.d.ts.map +1 -0
- package/dist/background/mesh.js +43 -0
- package/dist/background/mesh.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 +2 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +27 -6
- 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/config/size.d.ts +6 -0
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +20 -8
- package/dist/config/size.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 +37 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -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 +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- 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 +10 -2
- 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 +25 -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/badge-props.d.ts +16 -0
- package/dist/templates/banner/badge-props.d.ts.map +1 -0
- package/dist/templates/banner/badge-props.js +58 -0
- package/dist/templates/banner/badge-props.js.map +1 -0
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +6 -4
- package/dist/templates/banner/index.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/texture/grain.d.ts +17 -0
- package/dist/texture/grain.d.ts.map +1 -0
- package/dist/texture/grain.js +29 -0
- package/dist/texture/grain.js.map +1 -0
- package/dist/texture/index.d.ts +11 -0
- package/dist/texture/index.d.ts.map +1 -0
- package/dist/texture/index.js +20 -0
- package/dist/texture/index.js.map +1 -0
- package/dist/texture/pattern.d.ts +17 -0
- package/dist/texture/pattern.d.ts.map +1 -0
- package/dist/texture/pattern.js +45 -0
- package/dist/texture/pattern.js.map +1 -0
- package/dist/texture/resolve.d.ts +16 -0
- package/dist/texture/resolve.d.ts.map +1 -0
- package/dist/texture/resolve.js +20 -0
- package/dist/texture/resolve.js.map +1 -0
- package/dist/theme/index.d.ts +27 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +41 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/presets.d.ts +38 -0
- package/dist/theme/presets.d.ts.map +1 -0
- package/dist/theme/presets.js +150 -0
- package/dist/theme/presets.js.map +1 -0
- package/dist/types.d.ts +281 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/background.d.ts +12 -0
- package/dist/validate/background.d.ts.map +1 -0
- package/dist/validate/background.js +53 -0
- package/dist/validate/background.js.map +1 -0
- package/dist/validate/collect.d.ts +9 -0
- package/dist/validate/collect.d.ts.map +1 -0
- package/dist/validate/collect.js +35 -0
- package/dist/validate/collect.js.map +1 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +2 -20
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/keys.d.ts +22 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +69 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js +5 -1
- package/dist/validate/overrides.js.map +1 -1
- package/dist/validate/texture.d.ts +11 -0
- package/dist/validate/texture.d.ts.map +1 -0
- package/dist/validate/texture.js +34 -0
- package/dist/validate/texture.js.map +1 -0
- package/dist/validate/values.d.ts +16 -10
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +31 -44
- package/dist/validate/values.js.map +1 -1
- package/package.json +16 -2
- 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
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAa;IAC1C,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,iBAAiB,CAAC;IAExD,MAAM,KAAK,GAAG,KAAK,IAAmB,EAAE;QACtC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC;YAC7B,UAAU;YACV,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;YACvC,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;YACxE,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;gBACnB,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC;SACF,CAAC,CAAC;QAEH,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,KAAK,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,MAAM,YAAY,CAAC;QACjB,GAAG,EAAE,UAAU;QACf,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,IAAI,wBAAwB;QACnE,KAAK;KACN,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A template a site can have written into it, and where it goes. */
|
|
2
|
+
export interface Adapter {
|
|
3
|
+
/** Path the file is written to, relative to the site root. */
|
|
4
|
+
readonly file: string;
|
|
5
|
+
readonly contents: string;
|
|
6
|
+
/** What to do with it once it is there. */
|
|
7
|
+
readonly usage: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The adapters `colophon eject` knows about.
|
|
11
|
+
*
|
|
12
|
+
* One so far. It is a record rather than a special case for Hugo because the
|
|
13
|
+
* command has to name the ones it does know when asked for one it does not,
|
|
14
|
+
* and because the next generator is a second entry rather than a second
|
|
15
|
+
* command.
|
|
16
|
+
*/
|
|
17
|
+
export declare const adapters: Readonly<Record<string, Adapter>>;
|
|
18
|
+
/** The adapter names, for the help text and for a run that misspells one. */
|
|
19
|
+
export declare const adapterNames: readonly string[];
|
|
20
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../../src/cli/eject/adapters.ts"],"names":[],"mappings":"AAGA,qEAAqE;AACrE,MAAM,WAAW,OAAO;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBtD,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAA0B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { astroComponent } from "./astro.js";
|
|
2
|
+
import { hugoPartial } from "./hugo.js";
|
|
3
|
+
/**
|
|
4
|
+
* The adapters `colophon eject` knows about.
|
|
5
|
+
*
|
|
6
|
+
* One so far. It is a record rather than a special case for Hugo because the
|
|
7
|
+
* command has to name the ones it does know when asked for one it does not,
|
|
8
|
+
* and because the next generator is a second entry rather than a second
|
|
9
|
+
* command.
|
|
10
|
+
*/
|
|
11
|
+
export const adapters = {
|
|
12
|
+
astro: {
|
|
13
|
+
file: "src/components/ColophonMeta.astro",
|
|
14
|
+
contents: astroComponent,
|
|
15
|
+
usage: `Use it in your layout's head:\n` +
|
|
16
|
+
` <ColophonMeta />\n` +
|
|
17
|
+
`and point the config's manifest option at src/data/colophon.json.`,
|
|
18
|
+
},
|
|
19
|
+
hugo: {
|
|
20
|
+
file: "layouts/partials/colophon.html",
|
|
21
|
+
contents: hugoPartial,
|
|
22
|
+
usage: `Call it from your head:\n` +
|
|
23
|
+
` {{ partial "colophon.html" . }}\n` +
|
|
24
|
+
`and point the config's manifest option at data/colophon.json.`,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
/** The adapter names, for the help text and for a run that misspells one. */
|
|
28
|
+
export const adapterNames = Object.keys(adapters);
|
|
29
|
+
//# sourceMappingURL=adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../../src/cli/eject/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAWxC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAsC;IACzD,KAAK,EAAE;QACL,IAAI,EAAE,mCAAmC;QACzC,QAAQ,EAAE,cAAc;QACxB,KAAK,EACH,iCAAiC;YACjC,sBAAsB;YACtB,mEAAmE;KACtE;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,gCAAgC;QACtC,QAAQ,EAAE,WAAW;QACrB,KAAK,EACH,2BAA2B;YAC3B,qCAAqC;YACrC,+DAA+D;KAClE;CACF,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAsB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Astro component `colophon eject astro` writes.
|
|
3
|
+
*
|
|
4
|
+
* Ejected rather than exported, for the reason the Hugo partial is: a `<head>`
|
|
5
|
+
* is something a site owns. A shipped component would also be a `.astro` file
|
|
6
|
+
* in the published package, which nothing in this build compiles or typechecks,
|
|
7
|
+
* and which would then have to be kept working across Astro versions.
|
|
8
|
+
*
|
|
9
|
+
* The route is mapped to a manifest key by `metaTagsForPath`, which is in the
|
|
10
|
+
* package and tested there, so what is ejected stays small enough to read.
|
|
11
|
+
*/
|
|
12
|
+
export declare const astroComponent = "---\n/**\n * Social meta tags for the current route, from the images Colophon generated.\n *\n * Use it in your layout's <head>:\n *\n * <ColophonMeta />\n *\n * The manifest import path is where the config's `manifest` option points.\n * The cast is because a JSON import types \"version\" as number rather than as\n * the literal 1 the Manifest type asks for.\n */\nimport { metaTagsForPath } from \"@kensio/colophon/meta\";\nimport type { Manifest } from \"@kensio/colophon\";\nimport manifest from \"../data/colophon.json\";\n\nconst tags = metaTagsForPath(manifest as Manifest, Astro.url.pathname, {\n baseUrl: Astro.site?.href,\n});\n---\n\n{tags.map((tag) => <meta {...tag} />)}\n";
|
|
13
|
+
//# sourceMappingURL=astro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../../../src/cli/eject/astro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,yrBAsB1B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Astro component `colophon eject astro` writes.
|
|
3
|
+
*
|
|
4
|
+
* Ejected rather than exported, for the reason the Hugo partial is: a `<head>`
|
|
5
|
+
* is something a site owns. A shipped component would also be a `.astro` file
|
|
6
|
+
* in the published package, which nothing in this build compiles or typechecks,
|
|
7
|
+
* and which would then have to be kept working across Astro versions.
|
|
8
|
+
*
|
|
9
|
+
* The route is mapped to a manifest key by `metaTagsForPath`, which is in the
|
|
10
|
+
* package and tested there, so what is ejected stays small enough to read.
|
|
11
|
+
*/
|
|
12
|
+
export const astroComponent = `---
|
|
13
|
+
/**
|
|
14
|
+
* Social meta tags for the current route, from the images Colophon generated.
|
|
15
|
+
*
|
|
16
|
+
* Use it in your layout's <head>:
|
|
17
|
+
*
|
|
18
|
+
* <ColophonMeta />
|
|
19
|
+
*
|
|
20
|
+
* The manifest import path is where the config's \`manifest\` option points.
|
|
21
|
+
* The cast is because a JSON import types "version" as number rather than as
|
|
22
|
+
* the literal 1 the Manifest type asks for.
|
|
23
|
+
*/
|
|
24
|
+
import { metaTagsForPath } from "@kensio/colophon/meta";
|
|
25
|
+
import type { Manifest } from "@kensio/colophon";
|
|
26
|
+
import manifest from "../data/colophon.json";
|
|
27
|
+
|
|
28
|
+
const tags = metaTagsForPath(manifest as Manifest, Astro.url.pathname, {
|
|
29
|
+
baseUrl: Astro.site?.href,
|
|
30
|
+
});
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
{tags.map((tag) => <meta {...tag} />)}
|
|
34
|
+
`;
|
|
35
|
+
//# sourceMappingURL=astro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.js","sourceRoot":"","sources":["../../../src/cli/eject/astro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsB7B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Hugo partial `colophon eject hugo` writes.
|
|
3
|
+
*
|
|
4
|
+
* It is a lookup in the manifest a build wrote, which is the whole point: the
|
|
5
|
+
* two Hugo sites this was taken from spent 50 and 58 lines respectively globbing
|
|
6
|
+
* for `*-og.png` and hardcoding the dimensions, because nothing told them what
|
|
7
|
+
* had been generated.
|
|
8
|
+
*
|
|
9
|
+
* Ejected rather than imported. A partial shipped in `node_modules` would have
|
|
10
|
+
* to be mounted into the site's own `layouts`, and a site that wants to change
|
|
11
|
+
* the fallback chain, or emit one more tag, should be able to just edit it.
|
|
12
|
+
*
|
|
13
|
+
* Verified against Hugo 0.162 over a site covering each branch: a route key, a
|
|
14
|
+
* basename key, a frontmatter slug, a page bundle, a manifest entry with no
|
|
15
|
+
* URL, a page override, a page the manifest does not have, a page with no file
|
|
16
|
+
* at all, and a site with no manifest.
|
|
17
|
+
*/
|
|
18
|
+
export declare const hugoPartial = "{{- /*\n Colophon: social meta tags for the current page, from the image manifest.\n\n Call it from your <head>, passing the page:\n\n {{ partial \"colophon.html\" . }}\n\n It reads the manifest as site data, so point the config's `manifest` option\n at `data/colophon.json`.\n\n Needs Hugo 0.156 or newer for `hugo.Data`. On an older Hugo, change the two\n references below to `site.Data`.\n\n Colophon writes this file for you and then leaves it alone: it is yours to\n edit. Re-running `colophon eject hugo --force` replaces it.\n*/ -}}\n\n{{- $pages := dict -}}\n{{- with hugo.Data.colophon -}}\n {{- with .pages -}}\n {{- $pages = . -}}\n {{- end -}}\n{{- end -}}\n\n{{- /* The manifest is keyed by slug, and which slug depends on the\n `slugStrategy` the build used. The route key is tried first and the\n basename second, so one partial covers both without being told which. */ -}}\n{{- $keys := slice -}}\n{{- with .Params.colophon_key -}}\n {{- $keys = $keys | append . -}}\n{{- end -}}\n{{- with .Slug -}}\n {{- $keys = $keys | append . -}}\n{{- end -}}\n{{- $route := strings.TrimPrefix \"/\" .Path -}}\n{{- $keys = $keys | append (cond (eq $route \"\") \"index\" $route) -}}\n{{- with .File -}}\n {{- $keys = $keys | append .ContentBaseName -}}\n{{- end -}}\n\n{{- $entry := dict -}}\n{{- range $keys -}}\n {{- if not $entry -}}\n {{- with index $pages . -}}\n {{- $entry = . -}}\n {{- end -}}\n {{- end -}}\n{{- end -}}\n\n{{- /* The generated image, where the manifest has one with an address. A\n placement without `urlBase` records dimensions and no URL, which is\n nothing to point a crawler at. */ -}}\n{{- $image := false -}}\n{{- with $entry.images -}}\n {{- $widest := index . $entry.widest -}}\n {{- if $widest -}}\n {{- if $widest.url -}}\n {{- $image = $widest -}}\n {{- end -}}\n {{- end -}}\n{{- end -}}\n\n{{- /* An explicit page override wins, then the generated image, then whatever\n the site falls back to. Width, height and alt describe the generated\n image, so they go only with that one. */ -}}\n{{- $url := \"\" -}}\n{{- with .Params.images -}}\n {{- $url = index . 0 -}}\n {{- $image = false -}}\n{{- else -}}\n {{- with $image -}}\n {{- $url = .url -}}\n {{- else -}}\n {{- with site.Params.images -}}\n {{- $url = index . 0 -}}\n {{- end -}}\n {{- end -}}\n{{- end -}}\n\n{{- with $url -}}\n {{- $alt := \"\" -}}\n {{- if $image -}}\n {{- with $entry.alt -}}\n {{- $alt = . -}}\n {{- end -}}\n {{- end -}}\n {{- /* `summary_large_image` is specified for 2:1 and the Open Graph\n landscape is 1.91:1, so both clear this; a square is shown better by\n a plain summary card. Only a generated image has dimensions to judge\n by, so anything else is assumed to be a landscape share image. */ -}}\n {{- $large := true -}}\n {{- with $image -}}\n {{- $large = ge (div (float .width) (float .height)) 1.5 -}}\n {{- end -}}\n<meta property=\"og:image\" content=\"{{ . | absURL }}\" />\n {{- with $image }}\n<meta property=\"og:image:width\" content=\"{{ .width }}\" />\n<meta property=\"og:image:height\" content=\"{{ .height }}\" />\n {{- end }}\n {{- with $alt }}\n<meta property=\"og:image:alt\" content=\"{{ . }}\" />\n {{- end }}\n<meta name=\"twitter:card\" content=\"{{ cond $large \"summary_large_image\" \"summary\" }}\" />\n<meta name=\"twitter:image\" content=\"{{ $url | absURL }}\" />\n {{- with $alt }}\n<meta name=\"twitter:image:alt\" content=\"{{ . }}\" />\n {{- end }}\n{{- end -}}\n";
|
|
19
|
+
//# sourceMappingURL=hugo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hugo.d.ts","sourceRoot":"","sources":["../../../src/cli/eject/hugo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,sgHA4GvB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Hugo partial `colophon eject hugo` writes.
|
|
3
|
+
*
|
|
4
|
+
* It is a lookup in the manifest a build wrote, which is the whole point: the
|
|
5
|
+
* two Hugo sites this was taken from spent 50 and 58 lines respectively globbing
|
|
6
|
+
* for `*-og.png` and hardcoding the dimensions, because nothing told them what
|
|
7
|
+
* had been generated.
|
|
8
|
+
*
|
|
9
|
+
* Ejected rather than imported. A partial shipped in `node_modules` would have
|
|
10
|
+
* to be mounted into the site's own `layouts`, and a site that wants to change
|
|
11
|
+
* the fallback chain, or emit one more tag, should be able to just edit it.
|
|
12
|
+
*
|
|
13
|
+
* Verified against Hugo 0.162 over a site covering each branch: a route key, a
|
|
14
|
+
* basename key, a frontmatter slug, a page bundle, a manifest entry with no
|
|
15
|
+
* URL, a page override, a page the manifest does not have, a page with no file
|
|
16
|
+
* at all, and a site with no manifest.
|
|
17
|
+
*/
|
|
18
|
+
export const hugoPartial = `{{- /*
|
|
19
|
+
Colophon: social meta tags for the current page, from the image manifest.
|
|
20
|
+
|
|
21
|
+
Call it from your <head>, passing the page:
|
|
22
|
+
|
|
23
|
+
{{ partial "colophon.html" . }}
|
|
24
|
+
|
|
25
|
+
It reads the manifest as site data, so point the config's \`manifest\` option
|
|
26
|
+
at \`data/colophon.json\`.
|
|
27
|
+
|
|
28
|
+
Needs Hugo 0.156 or newer for \`hugo.Data\`. On an older Hugo, change the two
|
|
29
|
+
references below to \`site.Data\`.
|
|
30
|
+
|
|
31
|
+
Colophon writes this file for you and then leaves it alone: it is yours to
|
|
32
|
+
edit. Re-running \`colophon eject hugo --force\` replaces it.
|
|
33
|
+
*/ -}}
|
|
34
|
+
|
|
35
|
+
{{- $pages := dict -}}
|
|
36
|
+
{{- with hugo.Data.colophon -}}
|
|
37
|
+
{{- with .pages -}}
|
|
38
|
+
{{- $pages = . -}}
|
|
39
|
+
{{- end -}}
|
|
40
|
+
{{- end -}}
|
|
41
|
+
|
|
42
|
+
{{- /* The manifest is keyed by slug, and which slug depends on the
|
|
43
|
+
\`slugStrategy\` the build used. The route key is tried first and the
|
|
44
|
+
basename second, so one partial covers both without being told which. */ -}}
|
|
45
|
+
{{- $keys := slice -}}
|
|
46
|
+
{{- with .Params.colophon_key -}}
|
|
47
|
+
{{- $keys = $keys | append . -}}
|
|
48
|
+
{{- end -}}
|
|
49
|
+
{{- with .Slug -}}
|
|
50
|
+
{{- $keys = $keys | append . -}}
|
|
51
|
+
{{- end -}}
|
|
52
|
+
{{- $route := strings.TrimPrefix "/" .Path -}}
|
|
53
|
+
{{- $keys = $keys | append (cond (eq $route "") "index" $route) -}}
|
|
54
|
+
{{- with .File -}}
|
|
55
|
+
{{- $keys = $keys | append .ContentBaseName -}}
|
|
56
|
+
{{- end -}}
|
|
57
|
+
|
|
58
|
+
{{- $entry := dict -}}
|
|
59
|
+
{{- range $keys -}}
|
|
60
|
+
{{- if not $entry -}}
|
|
61
|
+
{{- with index $pages . -}}
|
|
62
|
+
{{- $entry = . -}}
|
|
63
|
+
{{- end -}}
|
|
64
|
+
{{- end -}}
|
|
65
|
+
{{- end -}}
|
|
66
|
+
|
|
67
|
+
{{- /* The generated image, where the manifest has one with an address. A
|
|
68
|
+
placement without \`urlBase\` records dimensions and no URL, which is
|
|
69
|
+
nothing to point a crawler at. */ -}}
|
|
70
|
+
{{- $image := false -}}
|
|
71
|
+
{{- with $entry.images -}}
|
|
72
|
+
{{- $widest := index . $entry.widest -}}
|
|
73
|
+
{{- if $widest -}}
|
|
74
|
+
{{- if $widest.url -}}
|
|
75
|
+
{{- $image = $widest -}}
|
|
76
|
+
{{- end -}}
|
|
77
|
+
{{- end -}}
|
|
78
|
+
{{- end -}}
|
|
79
|
+
|
|
80
|
+
{{- /* An explicit page override wins, then the generated image, then whatever
|
|
81
|
+
the site falls back to. Width, height and alt describe the generated
|
|
82
|
+
image, so they go only with that one. */ -}}
|
|
83
|
+
{{- $url := "" -}}
|
|
84
|
+
{{- with .Params.images -}}
|
|
85
|
+
{{- $url = index . 0 -}}
|
|
86
|
+
{{- $image = false -}}
|
|
87
|
+
{{- else -}}
|
|
88
|
+
{{- with $image -}}
|
|
89
|
+
{{- $url = .url -}}
|
|
90
|
+
{{- else -}}
|
|
91
|
+
{{- with site.Params.images -}}
|
|
92
|
+
{{- $url = index . 0 -}}
|
|
93
|
+
{{- end -}}
|
|
94
|
+
{{- end -}}
|
|
95
|
+
{{- end -}}
|
|
96
|
+
|
|
97
|
+
{{- with $url -}}
|
|
98
|
+
{{- $alt := "" -}}
|
|
99
|
+
{{- if $image -}}
|
|
100
|
+
{{- with $entry.alt -}}
|
|
101
|
+
{{- $alt = . -}}
|
|
102
|
+
{{- end -}}
|
|
103
|
+
{{- end -}}
|
|
104
|
+
{{- /* \`summary_large_image\` is specified for 2:1 and the Open Graph
|
|
105
|
+
landscape is 1.91:1, so both clear this; a square is shown better by
|
|
106
|
+
a plain summary card. Only a generated image has dimensions to judge
|
|
107
|
+
by, so anything else is assumed to be a landscape share image. */ -}}
|
|
108
|
+
{{- $large := true -}}
|
|
109
|
+
{{- with $image -}}
|
|
110
|
+
{{- $large = ge (div (float .width) (float .height)) 1.5 -}}
|
|
111
|
+
{{- end -}}
|
|
112
|
+
<meta property="og:image" content="{{ . | absURL }}" />
|
|
113
|
+
{{- with $image }}
|
|
114
|
+
<meta property="og:image:width" content="{{ .width }}" />
|
|
115
|
+
<meta property="og:image:height" content="{{ .height }}" />
|
|
116
|
+
{{- end }}
|
|
117
|
+
{{- with $alt }}
|
|
118
|
+
<meta property="og:image:alt" content="{{ . }}" />
|
|
119
|
+
{{- end }}
|
|
120
|
+
<meta name="twitter:card" content="{{ cond $large "summary_large_image" "summary" }}" />
|
|
121
|
+
<meta name="twitter:image" content="{{ $url | absURL }}" />
|
|
122
|
+
{{- with $alt }}
|
|
123
|
+
<meta name="twitter:image:alt" content="{{ . }}" />
|
|
124
|
+
{{- end }}
|
|
125
|
+
{{- end -}}
|
|
126
|
+
`;
|
|
127
|
+
//# sourceMappingURL=hugo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hugo.js","sourceRoot":"","sources":["../../../src/cli/eject/hugo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4G1B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CliArgs } from "../args/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Write a generator's template into the site, and say how to use it.
|
|
4
|
+
*
|
|
5
|
+
* Ejecting rather than importing is the point. The file lands in the site's own
|
|
6
|
+
* tree, where a project can read it, change the fallback chain and add a tag,
|
|
7
|
+
* without Colophon having to grow an option for every decision a site makes
|
|
8
|
+
* about its own head. What it replaces is 50-odd lines of globbing for images
|
|
9
|
+
* that the build already knew the names of.
|
|
10
|
+
*
|
|
11
|
+
* `dir` is the site root, the working directory by default, and a parameter
|
|
12
|
+
* because a test cannot `chdir`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runEject(args: CliArgs, dir?: string): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/eject/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA6BhD;;;;;;;;;;;GAWG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,OAAO,EACb,GAAG,SAAgB,GAClB,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|