@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
package/dist/stamp/chunk.js
CHANGED
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { chunkBytes, pngSignature } from "../png/chunk.js";
|
|
2
2
|
/**
|
|
3
3
|
* PNG `tEXt` keyword the stamp is stored under. Keeping it in the image means
|
|
4
4
|
* there is no sidecar file to fall out of sync, and deleting an image deletes
|
|
5
5
|
* its stamp with it.
|
|
6
6
|
*/
|
|
7
7
|
export const stampKeyword = "colophon";
|
|
8
|
-
/** The eight bytes every PNG file starts with. */
|
|
9
|
-
export const pngSignature = Buffer.from([
|
|
10
|
-
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
|
|
11
|
-
]);
|
|
12
8
|
/** Signature + the whole `IHDR` chunk: length, type, 13 bytes of data, CRC. */
|
|
13
9
|
export const afterHeader = pngSignature.length + 4 + 4 + 13 + 4;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function textChunk(keyword, text) {
|
|
18
|
-
const data = Buffer.concat([
|
|
10
|
+
/** What a `tEXt` chunk carries: `keyword\0text`. */
|
|
11
|
+
function textData(keyword, text) {
|
|
12
|
+
return Buffer.concat([
|
|
19
13
|
Buffer.from(keyword, "latin1"),
|
|
20
14
|
Buffer.from([0]),
|
|
21
15
|
Buffer.from(text, "latin1"),
|
|
22
16
|
]);
|
|
23
|
-
const chunk = Buffer.alloc(4 + 4 + data.length + 4);
|
|
24
|
-
chunk.writeUInt32BE(data.length, 0);
|
|
25
|
-
chunk.write("tEXt", 4, "latin1");
|
|
26
|
-
data.copy(chunk, 8);
|
|
27
|
-
chunk.writeUInt32BE(crc32(chunk.subarray(4, 8 + data.length)), 8 + data.length);
|
|
28
|
-
return chunk;
|
|
29
17
|
}
|
|
30
18
|
/**
|
|
31
19
|
* Return `png` with the stamp embedded as a `tEXt` chunk, inserted straight
|
|
@@ -35,11 +23,15 @@ export function stampPng(png, stamp) {
|
|
|
35
23
|
if (png.length < afterHeader ||
|
|
36
24
|
!png.subarray(0, pngSignature.length).equals(pngSignature) ||
|
|
37
25
|
png.toString("latin1", 12, 16) !== "IHDR") {
|
|
38
|
-
|
|
26
|
+
// Reachable in practice only through a configured rasteriser, since resvg
|
|
27
|
+
// writes nothing else. Saying why beats leaving someone to work out that
|
|
28
|
+
// the stamp is the reason their WebP backend cannot be used yet.
|
|
29
|
+
throw new Error("Cannot stamp: not a PNG image. The rebuild stamp is a PNG chunk, so a" +
|
|
30
|
+
" rasteriser has to produce PNG for a build to be able to skip it.");
|
|
39
31
|
}
|
|
40
32
|
return Buffer.concat([
|
|
41
33
|
png.subarray(0, afterHeader),
|
|
42
|
-
|
|
34
|
+
chunkBytes("tEXt", textData(stampKeyword, stamp)),
|
|
43
35
|
png.subarray(afterHeader),
|
|
44
36
|
]);
|
|
45
37
|
}
|
package/dist/stamp/chunk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../src/stamp/chunk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../src/stamp/chunk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEvC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEhE,oDAAoD;AACpD,SAAS,QAAQ,CAAC,OAAe,EAAE,IAAY;IAC7C,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,KAAa;IACjD,IACE,GAAG,CAAC,MAAM,GAAG,WAAW;QACxB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QAC1D,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,MAAM,EACzC,CAAC;QACD,0EAA0E;QAC1E,yEAAyE;QACzE,iEAAiE;QACjE,MAAM,IAAI,KAAK,CACb,uEAAuE;YACrE,mEAAmE,CACtE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC;QAC5B,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QACjD,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC;KAC1B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -6,6 +6,24 @@ import type { ResolvedConfig } from "../types.js";
|
|
|
6
6
|
* `templates`: the one size and the one template an image actually uses go into
|
|
7
7
|
* its own stamp, so adding a third size or an unrelated custom template does
|
|
8
8
|
* not invalidate everything already on disk.
|
|
9
|
+
*
|
|
10
|
+
* `compressionLevel` is in even though it cannot change a pixel, which is the
|
|
11
|
+
* rule `onWarning` is left out under. What it changes is every byte of every
|
|
12
|
+
* file, and a project turning it up wants the images it already has rewritten:
|
|
13
|
+
* without this the setting would appear to do nothing until each post next
|
|
14
|
+
* changed, which is the sort of gap that gets reported as a bug.
|
|
15
|
+
*
|
|
16
|
+
* `format`, `quality` and `maxBytes` are in for the same reason, and `emitSvg`
|
|
17
|
+
* for a version of it: turning it on has to write the documents for images that
|
|
18
|
+
* are already on disk, and without this it would write them only for the posts
|
|
19
|
+
* that happened to change next.
|
|
20
|
+
*
|
|
21
|
+
* The rasteriser is in, by its source, since swapping the backend is one of the
|
|
22
|
+
* few config changes that alters every pixel of every image. It is hashed the
|
|
23
|
+
* way a custom template is, with the same gap: source text cannot see a value
|
|
24
|
+
* the function closed over, so a rasteriser configured by something outside
|
|
25
|
+
* itself needs `--force`. For the default it adds nothing the package version
|
|
26
|
+
* was not already saying, which is why there is no special case for it.
|
|
9
27
|
*/
|
|
10
28
|
export declare function configDigest(config: ResolvedConfig): Promise<string>;
|
|
11
29
|
//# sourceMappingURL=config-digest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-digest.d.ts","sourceRoot":"","sources":["../../src/stamp/config-digest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,aAAa,CAAC;AA6CrB
|
|
1
|
+
{"version":3,"file":"config-digest.d.ts","sourceRoot":"","sources":["../../src/stamp/config-digest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,aAAa,CAAC;AA6CrB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA4B1E"}
|
|
@@ -42,6 +42,24 @@ async function backgroundDigest(background) {
|
|
|
42
42
|
* `templates`: the one size and the one template an image actually uses go into
|
|
43
43
|
* its own stamp, so adding a third size or an unrelated custom template does
|
|
44
44
|
* not invalidate everything already on disk.
|
|
45
|
+
*
|
|
46
|
+
* `compressionLevel` is in even though it cannot change a pixel, which is the
|
|
47
|
+
* rule `onWarning` is left out under. What it changes is every byte of every
|
|
48
|
+
* file, and a project turning it up wants the images it already has rewritten:
|
|
49
|
+
* without this the setting would appear to do nothing until each post next
|
|
50
|
+
* changed, which is the sort of gap that gets reported as a bug.
|
|
51
|
+
*
|
|
52
|
+
* `format`, `quality` and `maxBytes` are in for the same reason, and `emitSvg`
|
|
53
|
+
* for a version of it: turning it on has to write the documents for images that
|
|
54
|
+
* are already on disk, and without this it would write them only for the posts
|
|
55
|
+
* that happened to change next.
|
|
56
|
+
*
|
|
57
|
+
* The rasteriser is in, by its source, since swapping the backend is one of the
|
|
58
|
+
* few config changes that alters every pixel of every image. It is hashed the
|
|
59
|
+
* way a custom template is, with the same gap: source text cannot see a value
|
|
60
|
+
* the function closed over, so a rasteriser configured by something outside
|
|
61
|
+
* itself needs `--force`. For the default it adds nothing the package version
|
|
62
|
+
* was not already saying, which is why there is no special case for it.
|
|
45
63
|
*/
|
|
46
64
|
export async function configDigest(config) {
|
|
47
65
|
const fonts = await Promise.all(config.fonts.map(async (font) => fontDigest(font)));
|
|
@@ -50,6 +68,7 @@ export async function configDigest(config) {
|
|
|
50
68
|
version: await packageVersion(),
|
|
51
69
|
colors: config.colors,
|
|
52
70
|
background: await backgroundDigest(config.background),
|
|
71
|
+
texture: config.texture,
|
|
53
72
|
fonts,
|
|
54
73
|
logo,
|
|
55
74
|
systemFonts: config.systemFonts,
|
|
@@ -57,6 +76,12 @@ export async function configDigest(config) {
|
|
|
57
76
|
footer: config.footer,
|
|
58
77
|
badge: config.badge,
|
|
59
78
|
code: config.code,
|
|
79
|
+
rasteriser: config.rasteriser.toString(),
|
|
80
|
+
compressionLevel: config.compressionLevel,
|
|
81
|
+
format: config.format,
|
|
82
|
+
quality: config.quality,
|
|
83
|
+
maxBytes: config.maxBytes,
|
|
84
|
+
emitSvg: config.emitSvg,
|
|
60
85
|
}));
|
|
61
86
|
}
|
|
62
87
|
//# sourceMappingURL=config-digest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-digest.js","sourceRoot":"","sources":["../../src/stamp/config-digest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQ5C,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;GAKG;AACH,KAAK,UAAU,cAAc;IAC3B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAC7B,I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,CAAC,CACnD,CAAC;IACF,MAAM,IAAI,GACR,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzE,OAAO,MAAM,CACX,eAAe,CAAC;QACd,OAAO,EAAE,MAAM,cAAc,EAAE;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,UAAU,EAAE,MAAM,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC;QACrD,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK;QACL,IAAI;QACJ,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE;QACxC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/stamp/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MetaImageProps, OutputSize, ResolvedConfig } from "../types.js";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { stampImage } from "./write.js";
|
|
3
|
+
export { readImageStamp } from "./read.js";
|
|
4
4
|
/**
|
|
5
5
|
* Computes stamps for the images rendered from one resolved config.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stamp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI9E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stamp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI9E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;CACxD;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAqC5E"}
|
package/dist/stamp/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { configDigest } from "./config-digest.js";
|
|
2
2
|
import { sha256, stableStringify } from "./digest.js";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { stampImage } from "./write.js";
|
|
4
|
+
export { readImageStamp } from "./read.js";
|
|
5
5
|
/**
|
|
6
6
|
* Build a {@link Stamper} for a resolved config. Asynchronous because it reads
|
|
7
7
|
* the configured font files; do it once per run rather than once per image.
|
package/dist/stamp/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stamp/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stamp/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE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|
|
|
1
|
+
/**
|
|
2
|
+
* Keyword the stamp is stored under, in whichever container it goes into.
|
|
3
|
+
* Keeping the stamp in the image means there is no sidecar file to fall out of
|
|
4
|
+
* sync, and deleting an image deletes its stamp with it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const stampKeyword = "colophon";
|
|
7
|
+
/**
|
|
8
|
+
* What a carrier stores: `keyword\0text`.
|
|
9
|
+
*
|
|
10
|
+
* That is the shape of a PNG `tEXt` chunk, which is where the stamp started,
|
|
11
|
+
* and the other containers reuse it rather than each inventing one. The keyword
|
|
12
|
+
* is what tells Colophon's own note from somebody else's, and where a container
|
|
13
|
+
* has the stamp appended to it, it is also what finds it again.
|
|
14
|
+
*/
|
|
15
|
+
export declare function stampPayload(stamp: string): Buffer;
|
|
16
|
+
/** The stamp in `payload`, or `undefined` where the note is somebody else's. */
|
|
17
|
+
export declare function stampFromPayload(payload: Buffer): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Where the payload starts in a window taken from the end of a file, or `-1`.
|
|
20
|
+
*
|
|
21
|
+
* Searched backwards because the stamp is the last thing an appending carrier
|
|
22
|
+
* writes, so the last match is Colophon's own and anything earlier is the same
|
|
23
|
+
* eight letters happening to turn up in compressed image data. The header in
|
|
24
|
+
* front of it is then checked, which is what turns a likely match into a
|
|
25
|
+
* certain one.
|
|
26
|
+
*/
|
|
27
|
+
export declare function findPayload(window: Buffer): number;
|
|
28
|
+
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/stamp/payload.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyword the stamp is stored under, in whichever container it goes into.
|
|
3
|
+
* Keeping the stamp in the image means there is no sidecar file to fall out of
|
|
4
|
+
* sync, and deleting an image deletes its stamp with it.
|
|
5
|
+
*/
|
|
6
|
+
export const stampKeyword = "colophon";
|
|
7
|
+
/**
|
|
8
|
+
* What a carrier stores: `keyword\0text`.
|
|
9
|
+
*
|
|
10
|
+
* That is the shape of a PNG `tEXt` chunk, which is where the stamp started,
|
|
11
|
+
* and the other containers reuse it rather than each inventing one. The keyword
|
|
12
|
+
* is what tells Colophon's own note from somebody else's, and where a container
|
|
13
|
+
* has the stamp appended to it, it is also what finds it again.
|
|
14
|
+
*/
|
|
15
|
+
export function stampPayload(stamp) {
|
|
16
|
+
return Buffer.concat([
|
|
17
|
+
Buffer.from(stampKeyword, "latin1"),
|
|
18
|
+
Buffer.from([0]),
|
|
19
|
+
Buffer.from(stamp, "latin1"),
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
/** The stamp in `payload`, or `undefined` where the note is somebody else's. */
|
|
23
|
+
export function stampFromPayload(payload) {
|
|
24
|
+
const separator = payload.indexOf(0);
|
|
25
|
+
return separator !== -1 &&
|
|
26
|
+
payload.toString("latin1", 0, separator) === stampKeyword
|
|
27
|
+
? payload.toString("latin1", separator + 1)
|
|
28
|
+
: undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Where the payload starts in a window taken from the end of a file, or `-1`.
|
|
32
|
+
*
|
|
33
|
+
* Searched backwards because the stamp is the last thing an appending carrier
|
|
34
|
+
* writes, so the last match is Colophon's own and anything earlier is the same
|
|
35
|
+
* eight letters happening to turn up in compressed image data. The header in
|
|
36
|
+
* front of it is then checked, which is what turns a likely match into a
|
|
37
|
+
* certain one.
|
|
38
|
+
*/
|
|
39
|
+
export function findPayload(window) {
|
|
40
|
+
return window.lastIndexOf(Buffer.from(stampKeyword, "latin1"));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../src/stamp/payload.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;KAC7B,CAAC,CAAC;AACL,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAErC,OAAO,SAAS,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,KAAK,YAAY;QACzD,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC;QAC3C,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/stamp/read.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Read the stamp out of
|
|
3
|
-
* missing, unreadable,
|
|
4
|
-
* image cannot be shown to be up to date, so it should be
|
|
2
|
+
* Read the stamp out of an image file. Returns `undefined` when the file is
|
|
3
|
+
* missing, unreadable, in a format no carrier knows, or carries no stamp, all
|
|
4
|
+
* of which mean the image cannot be shown to be up to date, so it should be
|
|
5
|
+
* rendered again.
|
|
5
6
|
*/
|
|
6
|
-
export declare function
|
|
7
|
+
export declare function readImageStamp(file: string): Promise<string | undefined>;
|
|
7
8
|
//# sourceMappingURL=read.d.ts.map
|
package/dist/stamp/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/stamp/read.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/stamp/read.ts"],"names":[],"mappings":"AAwCA;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAc7B"}
|
package/dist/stamp/read.js
CHANGED
|
@@ -1,48 +1,33 @@
|
|
|
1
1
|
import { open } from "node:fs/promises";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
function findStamp(head) {
|
|
15
|
-
if (!head.subarray(0, pngSignature.length).equals(pngSignature)) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
let offset = pngSignature.length;
|
|
19
|
-
while (offset + 8 <= head.length) {
|
|
20
|
-
const length = head.readUInt32BE(offset);
|
|
21
|
-
const type = head.toString("latin1", offset + 4, offset + 8);
|
|
22
|
-
const start = offset + 8;
|
|
23
|
-
const end = start + length;
|
|
24
|
-
// Image data starts here; anything past it is not worth reading for a hash.
|
|
25
|
-
if (type === "IDAT" || type === "IEND" || end > head.length) {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
if (type === "tEXt") {
|
|
29
|
-
const data = head.subarray(start, end);
|
|
30
|
-
const separator = data.indexOf(0);
|
|
31
|
-
if (separator !== -1 &&
|
|
32
|
-
data.toString("latin1", 0, separator) === stampKeyword) {
|
|
33
|
-
return data.toString("latin1", separator + 1);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
offset = end + 4;
|
|
2
|
+
import { carrierFor } from "./carrier/index.js";
|
|
3
|
+
import { stampWindow } from "./window.js";
|
|
4
|
+
async function readAt(handle, position, length) {
|
|
5
|
+
const buffer = Buffer.alloc(length);
|
|
6
|
+
const { bytesRead } = await handle.read(buffer, 0, length, position);
|
|
7
|
+
return buffer.subarray(0, bytesRead);
|
|
8
|
+
}
|
|
9
|
+
/** The window a carrier reads from; for a short file that is the whole of it. */
|
|
10
|
+
async function windowFor(carrier, handle, head) {
|
|
11
|
+
if (carrier.end === "head" || head.length < stampWindow) {
|
|
12
|
+
return head;
|
|
37
13
|
}
|
|
38
|
-
|
|
14
|
+
const { size } = await handle.stat();
|
|
15
|
+
return readAt(handle, size - stampWindow, stampWindow);
|
|
16
|
+
}
|
|
17
|
+
async function stampIn(handle) {
|
|
18
|
+
const head = await readAt(handle, 0, stampWindow);
|
|
19
|
+
const carrier = carrierFor(head);
|
|
20
|
+
return carrier === undefined
|
|
21
|
+
? undefined
|
|
22
|
+
: carrier.read(await windowFor(carrier, handle, head));
|
|
39
23
|
}
|
|
40
24
|
/**
|
|
41
|
-
* Read the stamp out of
|
|
42
|
-
* missing, unreadable,
|
|
43
|
-
* image cannot be shown to be up to date, so it should be
|
|
25
|
+
* Read the stamp out of an image file. Returns `undefined` when the file is
|
|
26
|
+
* missing, unreadable, in a format no carrier knows, or carries no stamp, all
|
|
27
|
+
* of which mean the image cannot be shown to be up to date, so it should be
|
|
28
|
+
* rendered again.
|
|
44
29
|
*/
|
|
45
|
-
export async function
|
|
30
|
+
export async function readImageStamp(file) {
|
|
46
31
|
let handle;
|
|
47
32
|
try {
|
|
48
33
|
handle = await open(file, "r");
|
|
@@ -51,9 +36,7 @@ export async function readPngStamp(file) {
|
|
|
51
36
|
return undefined;
|
|
52
37
|
}
|
|
53
38
|
try {
|
|
54
|
-
|
|
55
|
-
const { bytesRead } = await handle.read(buffer, 0, headBytes, 0);
|
|
56
|
-
return findStamp(buffer.subarray(0, bytesRead));
|
|
39
|
+
return await stampIn(handle);
|
|
57
40
|
}
|
|
58
41
|
finally {
|
|
59
42
|
await handle.close();
|
package/dist/stamp/read.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/stamp/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/stamp/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,UAAU,MAAM,CACnB,MAAkB,EAClB,QAAgB,EAChB,MAAc;IAEd,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AACvC,CAAC;AAED,iFAAiF;AACjF,KAAK,UAAU,SAAS,CACtB,OAAqB,EACrB,MAAkB,EAClB,IAAY;IAEZ,IAAI,OAAO,CAAC,GAAG,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,WAAW,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACrC,OAAO,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,WAAW,EAAE,WAAW,CAAC,CAAC;AACzD,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,MAAkB;IACvC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAEjC,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY;IAEZ,IAAI,MAAkB,CAAC;IAEvB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How close to one end of a file a stamp has to sit.
|
|
3
|
+
*
|
|
4
|
+
* A build reads this much and stops, at the front for a carrier that writes
|
|
5
|
+
* near the header and at the back for one that appends, so deciding to skip an
|
|
6
|
+
* image never means reading the whole of it. Both halves need the number: the
|
|
7
|
+
* reader to know how much to take, and a carrier that chooses where to write to
|
|
8
|
+
* keep inside it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const stampWindow = 4096;
|
|
11
|
+
//# sourceMappingURL=window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/stamp/window.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,OAAO,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How close to one end of a file a stamp has to sit.
|
|
3
|
+
*
|
|
4
|
+
* A build reads this much and stops, at the front for a carrier that writes
|
|
5
|
+
* near the header and at the back for one that appends, so deciding to skip an
|
|
6
|
+
* image never means reading the whole of it. Both halves need the number: the
|
|
7
|
+
* reader to know how much to take, and a carrier that chooses where to write to
|
|
8
|
+
* keep inside it.
|
|
9
|
+
*/
|
|
10
|
+
export const stampWindow = 4096;
|
|
11
|
+
//# sourceMappingURL=window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../src/stamp/window.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return `image` with `stamp` embedded, so that the build after this one can
|
|
3
|
+
* read it back and leave the file alone.
|
|
4
|
+
*
|
|
5
|
+
* The stamp goes inside the image rather than into a file beside it, which is
|
|
6
|
+
* what keeps the two from parting company: an image carries its stamp when it
|
|
7
|
+
* is copied, and loses it when it is deleted or rewritten by something else,
|
|
8
|
+
* both of which are the answer a build wants.
|
|
9
|
+
*
|
|
10
|
+
* Nothing about the picture changes. A PNG gains a `tEXt` chunk and a JPEG a
|
|
11
|
+
* `COM` segment, both among the metadata before the image data; a WebP gains a
|
|
12
|
+
* chunk and an AVIF a `uuid` box, both on the end, since those two locate their
|
|
13
|
+
* picture by an offset that inserting bytes earlier would move.
|
|
14
|
+
*
|
|
15
|
+
* A format none of the carriers knows throws rather than being written
|
|
16
|
+
* unstamped, because an image no build can ever skip is a worse thing to hand
|
|
17
|
+
* back quietly than an error naming what went wrong. Reachable only through a
|
|
18
|
+
* configured rasteriser, since resvg writes PNG and nothing else.
|
|
19
|
+
*/
|
|
20
|
+
export declare function stampImage(image: Buffer, stamp: string): Buffer;
|
|
21
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/stamp/write.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAY/D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { carrierFor, carrierFormats } from "./carrier/index.js";
|
|
2
|
+
import { stampPayload } from "./payload.js";
|
|
3
|
+
/**
|
|
4
|
+
* Return `image` with `stamp` embedded, so that the build after this one can
|
|
5
|
+
* read it back and leave the file alone.
|
|
6
|
+
*
|
|
7
|
+
* The stamp goes inside the image rather than into a file beside it, which is
|
|
8
|
+
* what keeps the two from parting company: an image carries its stamp when it
|
|
9
|
+
* is copied, and loses it when it is deleted or rewritten by something else,
|
|
10
|
+
* both of which are the answer a build wants.
|
|
11
|
+
*
|
|
12
|
+
* Nothing about the picture changes. A PNG gains a `tEXt` chunk and a JPEG a
|
|
13
|
+
* `COM` segment, both among the metadata before the image data; a WebP gains a
|
|
14
|
+
* chunk and an AVIF a `uuid` box, both on the end, since those two locate their
|
|
15
|
+
* picture by an offset that inserting bytes earlier would move.
|
|
16
|
+
*
|
|
17
|
+
* A format none of the carriers knows throws rather than being written
|
|
18
|
+
* unstamped, because an image no build can ever skip is a worse thing to hand
|
|
19
|
+
* back quietly than an error naming what went wrong. Reachable only through a
|
|
20
|
+
* configured rasteriser, since resvg writes PNG and nothing else.
|
|
21
|
+
*/
|
|
22
|
+
export function stampImage(image, stamp) {
|
|
23
|
+
const carrier = carrierFor(image);
|
|
24
|
+
if (carrier === undefined) {
|
|
25
|
+
throw new Error("Cannot stamp: unrecognised image format. The rebuild stamp goes inside" +
|
|
26
|
+
" the image, so a rasteriser has to produce one of" +
|
|
27
|
+
` ${carrierFormats()} for a build to be able to skip it.`);
|
|
28
|
+
}
|
|
29
|
+
return carrier.write(image, stampPayload(stamp));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/stamp/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,KAAa;IACrD,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAElC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,wEAAwE;YACtE,mDAAmD;YACnD,IAAI,cAAc,EAAE,qCAAqC,CAC5D,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ImageAsset, MeasureText, ResolvedConfig } from "../../types.js";
|
|
2
|
+
import type { Frame } from "../frame.js";
|
|
3
|
+
/**
|
|
4
|
+
* The bottom line: who wrote the post at the left, whose site it is at the
|
|
5
|
+
* right.
|
|
6
|
+
*
|
|
7
|
+
* The two are measured against each other rather than drawn and hoped for. A
|
|
8
|
+
* byline is a person's name and a date, a footer is a domain, and both are as
|
|
9
|
+
* long as they are, so on a landscape image they meet in the middle and
|
|
10
|
+
* overlap. The site's footer keeps its room, since it is the same on every
|
|
11
|
+
* image and a build can be sure it fits, and the byline takes what is left and
|
|
12
|
+
* is cut to it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function articleBottom(said: readonly string[], config: ResolvedConfig, frame: Frame, imageWidth: number, avatar: ImageAsset | undefined, measure: MeasureText): string;
|
|
15
|
+
//# sourceMappingURL=bottom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../../src/templates/article/bottom.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAyBzC;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,OAAO,EAAE,WAAW,GACnB,MAAM,CA+CR"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { clampLine, measureIn } from "../../layout/index.js";
|
|
2
|
+
import { byline } from "../byline.js";
|
|
3
|
+
import { footerElement, hasFooter } from "../footer.js";
|
|
4
|
+
import { portraitAdvance } from "../portrait.js";
|
|
5
|
+
/** Clear space between the byline and the footer at the other end. */
|
|
6
|
+
const gapScale = 1.2;
|
|
7
|
+
/**
|
|
8
|
+
* The longest form of the byline that fits the room it has, cut only when even
|
|
9
|
+
* the shortest of them does not.
|
|
10
|
+
*/
|
|
11
|
+
function fitByline(parts, room, measure, fontSize) {
|
|
12
|
+
for (const part of parts) {
|
|
13
|
+
if (measure(part, fontSize) <= room) {
|
|
14
|
+
return part;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return clampLine(parts.at(-1) ?? "", room, measure, fontSize);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The bottom line: who wrote the post at the left, whose site it is at the
|
|
21
|
+
* right.
|
|
22
|
+
*
|
|
23
|
+
* The two are measured against each other rather than drawn and hoped for. A
|
|
24
|
+
* byline is a person's name and a date, a footer is a domain, and both are as
|
|
25
|
+
* long as they are, so on a landscape image they meet in the middle and
|
|
26
|
+
* overlap. The site's footer keeps its room, since it is the same on every
|
|
27
|
+
* image and a build can be sure it fits, and the byline takes what is left and
|
|
28
|
+
* is cut to it.
|
|
29
|
+
*/
|
|
30
|
+
export function articleBottom(said, config, frame, imageWidth, avatar, measure) {
|
|
31
|
+
const { pad, footerFontSize: fontSize } = frame;
|
|
32
|
+
const footer = hasFooter(config) ? (config.footer ?? "") : "";
|
|
33
|
+
const footerWidth = footer === ""
|
|
34
|
+
? 0
|
|
35
|
+
: measureIn(measure, config.fontFamily, 500)(footer, fontSize) +
|
|
36
|
+
fontSize * gapScale;
|
|
37
|
+
const room = imageWidth -
|
|
38
|
+
pad * 2 -
|
|
39
|
+
Math.round(footerWidth) -
|
|
40
|
+
(avatar === undefined ? 0 : portraitAdvance(fontSize));
|
|
41
|
+
return (byline(fitByline(said, room, measureIn(measure, config.fontFamily, 600), fontSize), {
|
|
42
|
+
x: pad,
|
|
43
|
+
y: frame.footerY,
|
|
44
|
+
fontSize,
|
|
45
|
+
opacity: 0.9,
|
|
46
|
+
left: pad,
|
|
47
|
+
width: imageWidth - pad * 2,
|
|
48
|
+
}, {
|
|
49
|
+
fontFamily: config.fontFamily,
|
|
50
|
+
fontWeight: 600,
|
|
51
|
+
fill: config.colors.foreground,
|
|
52
|
+
}, avatar, measure) +
|
|
53
|
+
footerElement(config, {
|
|
54
|
+
x: imageWidth - pad,
|
|
55
|
+
y: frame.footerY,
|
|
56
|
+
fontSize,
|
|
57
|
+
opacity: 0.7,
|
|
58
|
+
anchor: "end",
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
//# sourceMapping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M,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC;YAC5D,QAAQ,GAAG,QAAQ,CAAC;IAE1B,MAAM,IAAI,GACR,UAAU;QACV,GAAG,GAAG,CAAC;QACP,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QACvB,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEzD,OAAO,CACL,MAAM,CACJ,SAAS,CACP,IAAI,EACJ,IAAI,EACJ,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,EAC1C,QAAQ,CACT,EACD;QACE,CAAC,EAAE,GAAG;QACN,CAAC,EAAE,KAAK,CAAC,OAAO;QAChB,QAAQ;QACR,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,UAAU,GAAG,GAAG,GAAG,CAAC;KAC5B,EACD;QACE,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;KAC/B,EACD,MAAM,EACN,OAAO,CACR;QACD,aAAa,CAAC,MAAM,EAAE;YACpB,CAAC,EAAE,UAAU,GAAG,GAAG;YACnB,CAAC,EAAE,KAAK,CAAC,OAAO;YAChB,QAAQ;YACR,OAAO,EAAE,GAAG;YACZ,MAAM,EAAE,KAAK;SACd,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Template } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The default blog card: tags along the top, the headline and its standfirst
|
|
4
|
+
* in the middle, and who wrote it and when along the bottom.
|
|
5
|
+
*
|
|
6
|
+
* It reads `tags`, `author` and `date` on top of the usual `title` and
|
|
7
|
+
* `subtitle`, and draws the `avatar` prop beside the byline rather than beside
|
|
8
|
+
* the footer. That leaves the two ends of the bottom line saying different
|
|
9
|
+
* things: who wrote this post at the left, and whose site it is at the right.
|
|
10
|
+
*/
|
|
11
|
+
export declare const articleTemplate: Template;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/article/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAOhE;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,QAmD7B,CAAC"}
|