@kensio/colophon 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -13
- package/dist/astro/index.d.ts +49 -0
- package/dist/astro/index.d.ts.map +1 -0
- package/dist/astro/index.js +42 -0
- package/dist/astro/index.js.map +1 -0
- package/dist/cli/args/command.d.ts +13 -0
- package/dist/cli/args/command.d.ts.map +1 -0
- package/dist/cli/args/command.js +22 -0
- package/dist/cli/args/command.js.map +1 -0
- package/dist/cli/args/index.d.ts +28 -0
- package/dist/cli/args/index.d.ts.map +1 -0
- package/dist/cli/args/index.js +75 -0
- package/dist/cli/args/index.js.map +1 -0
- package/dist/cli/args/switches.d.ts +18 -0
- package/dist/cli/args/switches.d.ts.map +1 -0
- package/dist/cli/args/switches.js +42 -0
- package/dist/cli/args/switches.js.map +1 -0
- package/dist/cli/args/usage.d.ts +3 -0
- package/dist/cli/args/usage.d.ts.map +1 -0
- package/dist/cli/args/usage.js +34 -0
- package/dist/cli/args/usage.js.map +1 -0
- package/dist/cli/args/values.d.ts +11 -0
- package/dist/cli/args/values.d.ts.map +1 -0
- package/dist/cli/args/values.js +29 -0
- package/dist/cli/args/values.js.map +1 -0
- package/dist/cli/build.d.ts +10 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +41 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/eject/adapters.d.ts +20 -0
- package/dist/cli/eject/adapters.d.ts.map +1 -0
- package/dist/cli/eject/adapters.js +29 -0
- package/dist/cli/eject/adapters.js.map +1 -0
- package/dist/cli/eject/astro.d.ts +13 -0
- package/dist/cli/eject/astro.d.ts.map +1 -0
- package/dist/cli/eject/astro.js +35 -0
- package/dist/cli/eject/astro.js.map +1 -0
- package/dist/cli/eject/hugo.d.ts +19 -0
- package/dist/cli/eject/hugo.d.ts.map +1 -0
- package/dist/cli/eject/hugo.js +127 -0
- package/dist/cli/eject/hugo.js.map +1 -0
- package/dist/cli/eject/index.d.ts +15 -0
- package/dist/cli/eject/index.d.ts.map +1 -0
- package/dist/cli/eject/index.js +46 -0
- package/dist/cli/eject/index.js.map +1 -0
- package/dist/cli/index.js +25 -20
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/fs.d.ts +5 -0
- package/dist/cli/init/fs.d.ts.map +1 -0
- package/dist/cli/init/fs.js +19 -0
- package/dist/cli/init/fs.js.map +1 -0
- package/dist/cli/init/guess.d.ts +9 -0
- package/dist/cli/init/guess.d.ts.map +1 -0
- package/dist/cli/init/guess.js +27 -0
- package/dist/cli/init/guess.js.map +1 -0
- package/dist/cli/init/index.d.ts +11 -0
- package/dist/cli/init/index.d.ts.map +1 -0
- package/dist/cli/init/index.js +36 -0
- package/dist/cli/init/index.js.map +1 -0
- package/dist/cli/init/module.d.ts +12 -0
- package/dist/cli/init/module.d.ts.map +1 -0
- package/dist/cli/init/module.js +45 -0
- package/dist/cli/init/module.js.map +1 -0
- package/dist/cli/init/scaffold.d.ts +10 -0
- package/dist/cli/init/scaffold.d.ts.map +1 -0
- package/dist/cli/init/scaffold.js +52 -0
- package/dist/cli/init/scaffold.js.map +1 -0
- package/dist/cli/message.d.ts +7 -0
- package/dist/cli/message.d.ts.map +1 -0
- package/dist/cli/message.js +9 -0
- package/dist/cli/message.js.map +1 -0
- package/dist/cli/preview/index.d.ts +13 -0
- package/dist/cli/preview/index.d.ts.map +1 -0
- package/dist/cli/preview/index.js +27 -0
- package/dist/cli/preview/index.js.map +1 -0
- package/dist/cli/preview/open.d.ts +10 -0
- package/dist/cli/preview/open.d.ts.map +1 -0
- package/dist/cli/preview/open.js +32 -0
- package/dist/cli/preview/open.js.map +1 -0
- package/dist/cli/preview/render.d.ts +23 -0
- package/dist/cli/preview/render.d.ts.map +1 -0
- package/dist/cli/preview/render.js +40 -0
- package/dist/cli/preview/render.js.map +1 -0
- package/dist/cli/preview/root.d.ts +17 -0
- package/dist/cli/preview/root.d.ts.map +1 -0
- package/dist/cli/preview/root.js +22 -0
- package/dist/cli/preview/root.js.map +1 -0
- package/dist/cli/preview/size.d.ts +7 -0
- package/dist/cli/preview/size.d.ts.map +1 -0
- package/dist/cli/preview/size.js +13 -0
- package/dist/cli/preview/size.js.map +1 -0
- package/dist/cli/report.d.ts +6 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +23 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/watch/filter.d.ts +14 -0
- package/dist/cli/watch/filter.d.ts.map +1 -0
- package/dist/cli/watch/filter.js +16 -0
- package/dist/cli/watch/filter.js.map +1 -0
- package/dist/cli/watch/index.d.ts +27 -0
- package/dist/cli/watch/index.d.ts.map +1 -0
- package/dist/cli/watch/index.js +38 -0
- package/dist/cli/watch/index.js.map +1 -0
- package/dist/cli/watch/queue.d.ts +24 -0
- package/dist/cli/watch/queue.d.ts.map +1 -0
- package/dist/cli/watch/queue.js +57 -0
- package/dist/cli/watch/queue.js.map +1 -0
- package/dist/config/defaults.d.ts +39 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +38 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +18 -4
- package/dist/config/index.js.map +1 -1
- package/dist/config/output.d.ts +26 -0
- package/dist/config/output.d.ts.map +1 -0
- package/dist/config/output.js +45 -0
- package/dist/config/output.js.map +1 -0
- package/dist/config/resolve.d.ts +10 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +20 -1
- package/dist/config/resolve.js.map +1 -1
- package/dist/content/index.d.ts +1 -0
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +1 -0
- package/dist/content/index.js.map +1 -1
- package/dist/content/read.d.ts +15 -0
- package/dist/content/read.d.ts.map +1 -0
- package/dist/content/read.js +36 -0
- package/dist/content/read.js.map +1 -0
- package/dist/content/walk.d.ts.map +1 -1
- package/dist/content/walk.js +4 -30
- package/dist/content/walk.js.map +1 -1
- package/dist/core/index.d.ts +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 +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/jpeg/index.d.ts +10 -0
- package/dist/jpeg/index.d.ts.map +1 -0
- package/dist/jpeg/index.js +2 -0
- package/dist/jpeg/index.js.map +1 -0
- package/dist/jpeg/segments.d.ts +32 -0
- package/dist/jpeg/segments.d.ts.map +1 -0
- package/dist/jpeg/segments.js +66 -0
- package/dist/jpeg/segments.js.map +1 -0
- package/dist/layout/draw.d.ts +20 -0
- package/dist/layout/draw.d.ts.map +1 -0
- package/dist/layout/draw.js +32 -0
- package/dist/layout/draw.js.map +1 -0
- package/dist/layout/extent.d.ts +19 -0
- package/dist/layout/extent.d.ts.map +1 -0
- package/dist/layout/extent.js +24 -0
- package/dist/layout/extent.js.map +1 -0
- package/dist/layout/index.d.ts +7 -4
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +5 -3
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/lines.d.ts +0 -17
- package/dist/layout/lines.d.ts.map +1 -1
- package/dist/layout/lines.js +2 -35
- package/dist/layout/lines.js.map +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js +8 -2
- package/dist/measure/faces.js.map +1 -1
- package/dist/meta/index.d.ts +1 -0
- package/dist/meta/index.d.ts.map +1 -1
- package/dist/meta/index.js +1 -0
- package/dist/meta/index.js.map +1 -1
- package/dist/meta/path.d.ts +24 -0
- package/dist/meta/path.d.ts.map +1 -0
- package/dist/meta/path.js +41 -0
- package/dist/meta/path.js.map +1 -0
- package/dist/meta/tags.d.ts.map +1 -1
- package/dist/meta/tags.js +6 -1
- package/dist/meta/tags.js.map +1 -1
- package/dist/placement/index.d.ts +7 -2
- package/dist/placement/index.d.ts.map +1 -1
- package/dist/placement/index.js +9 -3
- package/dist/placement/index.js.map +1 -1
- package/dist/placement/relative.d.ts +8 -3
- package/dist/placement/relative.d.ts.map +1 -1
- package/dist/placement/relative.js +12 -5
- package/dist/placement/relative.js.map +1 -1
- package/dist/platform/base64.d.ts +13 -0
- package/dist/platform/base64.d.ts.map +1 -0
- package/dist/platform/base64.js +35 -0
- package/dist/platform/base64.js.map +1 -0
- package/dist/platform/rasteriser.browser.d.ts +16 -0
- package/dist/platform/rasteriser.browser.d.ts.map +1 -0
- package/dist/platform/rasteriser.browser.js +20 -0
- package/dist/platform/rasteriser.browser.js.map +1 -0
- package/dist/platform/rasteriser.node.d.ts +2 -0
- package/dist/platform/rasteriser.node.d.ts.map +1 -0
- package/dist/platform/rasteriser.node.js +2 -0
- package/dist/platform/rasteriser.node.js.map +1 -0
- package/dist/platform/read-file.browser.d.ts +17 -0
- package/dist/platform/read-file.browser.d.ts.map +1 -0
- package/dist/platform/read-file.browser.js +23 -0
- package/dist/platform/read-file.browser.js.map +1 -0
- package/dist/platform/read-file.node.d.ts +19 -0
- package/dist/platform/read-file.node.d.ts.map +1 -0
- package/dist/platform/read-file.node.js +31 -0
- package/dist/platform/read-file.node.js.map +1 -0
- package/dist/png/chunk.d.ts +23 -0
- package/dist/png/chunk.d.ts.map +1 -0
- package/dist/png/chunk.js +48 -0
- package/dist/png/chunk.js.map +1 -0
- package/dist/png/index.d.ts +13 -0
- package/dist/png/index.d.ts.map +1 -0
- package/dist/png/index.js +3 -0
- package/dist/png/index.js.map +1 -0
- package/dist/png/recompress.d.ts +23 -0
- package/dist/png/recompress.d.ts.map +1 -0
- package/dist/png/recompress.js +81 -0
- package/dist/png/recompress.js.map +1 -0
- package/dist/props.d.ts +11 -0
- package/dist/props.d.ts.map +1 -1
- package/dist/props.js +16 -0
- package/dist/props.js.map +1 -1
- package/dist/render/image.d.ts +20 -0
- package/dist/render/image.d.ts.map +1 -0
- package/dist/render/image.js +29 -0
- package/dist/render/image.js.map +1 -0
- package/dist/render/index.d.ts +2 -1
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +5 -4
- package/dist/render/index.js.map +1 -1
- package/dist/render/png.d.ts +14 -4
- package/dist/render/png.d.ts.map +1 -1
- package/dist/render/png.js +22 -23
- package/dist/render/png.js.map +1 -1
- package/dist/render/rasterise.d.ts +15 -0
- package/dist/render/rasterise.d.ts.map +1 -0
- package/dist/render/rasterise.js +34 -0
- package/dist/render/rasterise.js.map +1 -0
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render/svg.js +1 -0
- package/dist/render/svg.js.map +1 -1
- package/dist/sign/base64url.d.ts +16 -0
- package/dist/sign/base64url.d.ts.map +1 -0
- package/dist/sign/base64url.js +24 -0
- package/dist/sign/base64url.js.map +1 -0
- package/dist/sign/index.d.ts +49 -0
- package/dist/sign/index.d.ts.map +1 -0
- package/dist/sign/index.js +133 -0
- package/dist/sign/index.js.map +1 -0
- package/dist/stamp/carrier/index.d.ts +7 -0
- package/dist/stamp/carrier/index.d.ts.map +1 -0
- package/dist/stamp/carrier/index.js +27 -0
- package/dist/stamp/carrier/index.js.map +1 -0
- package/dist/stamp/carrier/isobmff.d.ts +7 -0
- package/dist/stamp/carrier/isobmff.d.ts.map +1 -0
- package/dist/stamp/carrier/isobmff.js +55 -0
- package/dist/stamp/carrier/isobmff.js.map +1 -0
- package/dist/stamp/carrier/jpeg.d.ts +4 -0
- package/dist/stamp/carrier/jpeg.d.ts.map +1 -0
- package/dist/stamp/carrier/jpeg.js +76 -0
- package/dist/stamp/carrier/jpeg.js.map +1 -0
- package/dist/stamp/carrier/png.d.ts +7 -0
- package/dist/stamp/carrier/png.d.ts.map +1 -0
- package/dist/stamp/carrier/png.js +50 -0
- package/dist/stamp/carrier/png.js.map +1 -0
- package/dist/stamp/carrier/riff.d.ts +4 -0
- package/dist/stamp/carrier/riff.d.ts.map +1 -0
- package/dist/stamp/carrier/riff.js +54 -0
- package/dist/stamp/carrier/riff.js.map +1 -0
- package/dist/stamp/carrier/types.d.ts +25 -0
- package/dist/stamp/carrier/types.d.ts.map +1 -0
- package/dist/stamp/carrier/types.js +2 -0
- package/dist/stamp/carrier/types.js.map +1 -0
- package/dist/stamp/chunk.d.ts +0 -2
- package/dist/stamp/chunk.d.ts.map +1 -1
- package/dist/stamp/chunk.js +10 -18
- package/dist/stamp/chunk.js.map +1 -1
- package/dist/stamp/config-digest.d.ts +18 -0
- package/dist/stamp/config-digest.d.ts.map +1 -1
- package/dist/stamp/config-digest.js +24 -0
- package/dist/stamp/config-digest.js.map +1 -1
- package/dist/stamp/index.d.ts +2 -2
- package/dist/stamp/index.d.ts.map +1 -1
- package/dist/stamp/index.js +2 -2
- package/dist/stamp/index.js.map +1 -1
- package/dist/stamp/payload.d.ts +28 -0
- package/dist/stamp/payload.d.ts.map +1 -0
- package/dist/stamp/payload.js +42 -0
- package/dist/stamp/payload.js.map +1 -0
- package/dist/stamp/read.d.ts +5 -4
- package/dist/stamp/read.d.ts.map +1 -1
- package/dist/stamp/read.js +26 -43
- package/dist/stamp/read.js.map +1 -1
- package/dist/stamp/window.d.ts +11 -0
- package/dist/stamp/window.d.ts.map +1 -0
- package/dist/stamp/window.js +11 -0
- package/dist/stamp/window.js.map +1 -0
- package/dist/stamp/write.d.ts +21 -0
- package/dist/stamp/write.d.ts.map +1 -0
- package/dist/stamp/write.js +31 -0
- package/dist/stamp/write.js.map +1 -0
- package/dist/templates/article/bottom.d.ts +15 -0
- package/dist/templates/article/bottom.d.ts.map +1 -0
- package/dist/templates/article/bottom.js +61 -0
- package/dist/templates/article/bottom.js.map +1 -0
- package/dist/templates/article/index.d.ts +12 -0
- package/dist/templates/article/index.d.ts.map +1 -0
- package/dist/templates/article/index.js +42 -0
- package/dist/templates/article/index.js.map +1 -0
- package/dist/templates/article/lines.d.ts +27 -0
- package/dist/templates/article/lines.d.ts.map +1 -0
- package/dist/templates/article/lines.js +53 -0
- package/dist/templates/article/lines.js.map +1 -0
- package/dist/templates/article/tags.d.ts +25 -0
- package/dist/templates/article/tags.d.ts.map +1 -0
- package/dist/templates/article/tags.js +63 -0
- package/dist/templates/article/tags.js.map +1 -0
- package/dist/templates/attribution.d.ts +2 -6
- package/dist/templates/attribution.d.ts.map +1 -1
- package/dist/templates/attribution.js +8 -22
- package/dist/templates/attribution.js.map +1 -1
- package/dist/templates/banner/version.d.ts.map +1 -1
- package/dist/templates/banner/version.js +4 -4
- package/dist/templates/banner/version.js.map +1 -1
- package/dist/templates/bottom.d.ts +23 -0
- package/dist/templates/bottom.d.ts.map +1 -0
- package/dist/templates/bottom.js +37 -0
- package/dist/templates/bottom.js.map +1 -0
- package/dist/templates/byline.d.ts +19 -0
- package/dist/templates/byline.d.ts.map +1 -0
- package/dist/templates/byline.js +45 -0
- package/dist/templates/byline.js.map +1 -0
- package/dist/templates/code/clip.js +1 -1
- package/dist/templates/code/clip.js.map +1 -1
- package/dist/templates/code/fit.js +1 -1
- package/dist/templates/code/fit.js.map +1 -1
- package/dist/templates/code/warn.d.ts +1 -1
- package/dist/templates/code/warn.d.ts.map +1 -1
- package/dist/templates/code/warn.js +2 -2
- package/dist/templates/code/warn.js.map +1 -1
- package/dist/templates/docs/chrome.d.ts +17 -0
- package/dist/templates/docs/chrome.d.ts.map +1 -0
- package/dist/templates/docs/chrome.js +44 -0
- package/dist/templates/docs/chrome.js.map +1 -0
- package/dist/templates/docs/crumbs.d.ts +14 -0
- package/dist/templates/docs/crumbs.d.ts.map +1 -0
- package/dist/templates/docs/crumbs.js +32 -0
- package/dist/templates/docs/crumbs.js.map +1 -0
- package/dist/templates/docs/index.d.ts +13 -0
- package/dist/templates/docs/index.d.ts.map +1 -0
- package/dist/templates/docs/index.js +47 -0
- package/dist/templates/docs/index.js.map +1 -0
- package/dist/templates/docs/lines.d.ts +14 -0
- package/dist/templates/docs/lines.d.ts.map +1 -0
- package/dist/templates/docs/lines.js +29 -0
- package/dist/templates/docs/lines.js.map +1 -0
- package/dist/templates/event/index.d.ts +12 -0
- package/dist/templates/event/index.d.ts.map +1 -0
- package/dist/templates/event/index.js +59 -0
- package/dist/templates/event/index.js.map +1 -0
- package/dist/templates/event/lines.d.ts +14 -0
- package/dist/templates/event/lines.d.ts.map +1 -0
- package/dist/templates/event/lines.js +29 -0
- package/dist/templates/event/lines.js.map +1 -0
- package/dist/templates/event/plate.d.ts +16 -0
- package/dist/templates/event/plate.d.ts.map +1 -0
- package/dist/templates/event/plate.js +36 -0
- package/dist/templates/event/plate.js.map +1 -0
- package/dist/templates/frame.d.ts +68 -0
- package/dist/templates/frame.d.ts.map +1 -0
- package/dist/templates/frame.js +63 -0
- package/dist/templates/frame.js.map +1 -0
- package/dist/templates/index.d.ts +9 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +27 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/photo/index.d.ts +17 -0
- package/dist/templates/photo/index.d.ts.map +1 -0
- package/dist/templates/photo/index.js +51 -0
- package/dist/templates/photo/index.js.map +1 -0
- package/dist/templates/photo/lines.d.ts +21 -0
- package/dist/templates/photo/lines.d.ts.map +1 -0
- package/dist/templates/photo/lines.js +36 -0
- package/dist/templates/photo/lines.js.map +1 -0
- package/dist/templates/pill.d.ts +33 -0
- package/dist/templates/pill.d.ts.map +1 -0
- package/dist/templates/pill.js +50 -0
- package/dist/templates/pill.js.map +1 -0
- package/dist/templates/portrait.d.ts +40 -0
- package/dist/templates/portrait.d.ts.map +1 -0
- package/dist/templates/portrait.js +56 -0
- package/dist/templates/portrait.js.map +1 -0
- package/dist/templates/quote/index.d.ts +11 -0
- package/dist/templates/quote/index.d.ts.map +1 -0
- package/dist/templates/quote/index.js +60 -0
- package/dist/templates/quote/index.js.map +1 -0
- package/dist/templates/quote/lines.d.ts +24 -0
- package/dist/templates/quote/lines.d.ts.map +1 -0
- package/dist/templates/quote/lines.js +35 -0
- package/dist/templates/quote/lines.js.map +1 -0
- package/dist/templates/quote/mark.d.ts +13 -0
- package/dist/templates/quote/mark.d.ts.map +1 -0
- package/dist/templates/quote/mark.js +39 -0
- package/dist/templates/quote/mark.js.map +1 -0
- package/dist/templates/quote/speaker.d.ts +18 -0
- package/dist/templates/quote/speaker.d.ts.map +1 -0
- package/dist/templates/quote/speaker.js +41 -0
- package/dist/templates/quote/speaker.js.map +1 -0
- package/dist/templates/release/block.d.ts +8 -0
- package/dist/templates/release/block.d.ts.map +1 -0
- package/dist/templates/release/block.js +16 -0
- package/dist/templates/release/block.js.map +1 -0
- package/dist/templates/release/changes.d.ts +23 -0
- package/dist/templates/release/changes.d.ts.map +1 -0
- package/dist/templates/release/changes.js +45 -0
- package/dist/templates/release/changes.js.map +1 -0
- package/dist/templates/release/index.d.ts +11 -0
- package/dist/templates/release/index.d.ts.map +1 -0
- package/dist/templates/release/index.js +55 -0
- package/dist/templates/release/index.js.map +1 -0
- package/dist/templates/release/lines.d.ts +21 -0
- package/dist/templates/release/lines.d.ts.map +1 -0
- package/dist/templates/release/lines.js +36 -0
- package/dist/templates/release/lines.js.map +1 -0
- package/dist/templates/stat/index.d.ts +11 -0
- package/dist/templates/stat/index.d.ts.map +1 -0
- package/dist/templates/stat/index.js +43 -0
- package/dist/templates/stat/index.js.map +1 -0
- package/dist/templates/stat/lines.d.ts +23 -0
- package/dist/templates/stat/lines.d.ts.map +1 -0
- package/dist/templates/stat/lines.js +47 -0
- package/dist/templates/stat/lines.js.map +1 -0
- package/dist/templates/terminal/index.d.ts +16 -0
- package/dist/templates/terminal/index.d.ts.map +1 -0
- package/dist/templates/terminal/index.js +62 -0
- package/dist/templates/terminal/index.js.map +1 -0
- package/dist/templates/terminal/session.d.ts +17 -0
- package/dist/templates/terminal/session.d.ts.map +1 -0
- package/dist/templates/terminal/session.js +86 -0
- package/dist/templates/terminal/session.js.map +1 -0
- package/dist/templates/terminal/window.d.ts +14 -0
- package/dist/templates/terminal/window.d.ts.map +1 -0
- package/dist/templates/terminal/window.js +84 -0
- package/dist/templates/terminal/window.js.map +1 -0
- package/dist/templates/version.d.ts +16 -0
- package/dist/templates/version.d.ts.map +1 -0
- package/dist/templates/version.js +23 -0
- package/dist/templates/version.js.map +1 -0
- package/dist/templates/wordmark/index.d.ts +13 -0
- package/dist/templates/wordmark/index.d.ts.map +1 -0
- package/dist/templates/wordmark/index.js +53 -0
- package/dist/templates/wordmark/index.js.map +1 -0
- package/dist/templates/wordmark/lines.d.ts +22 -0
- package/dist/templates/wordmark/lines.d.ts.map +1 -0
- package/dist/templates/wordmark/lines.js +61 -0
- package/dist/templates/wordmark/lines.js.map +1 -0
- package/dist/templates/wordmark/mark.d.ts +16 -0
- package/dist/templates/wordmark/mark.d.ts.map +1 -0
- package/dist/templates/wordmark/mark.js +30 -0
- package/dist/templates/wordmark/mark.js.map +1 -0
- package/dist/text/clamp.d.ts +12 -0
- package/dist/text/clamp.d.ts.map +1 -0
- package/dist/text/clamp.js +41 -0
- package/dist/text/clamp.js.map +1 -0
- package/dist/text/ellipsis.d.ts +3 -0
- package/dist/text/ellipsis.d.ts.map +1 -0
- package/dist/text/ellipsis.js +3 -0
- package/dist/text/ellipsis.js.map +1 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +2 -0
- package/dist/text/index.js.map +1 -1
- package/dist/types.d.ts +158 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/collect.d.ts.map +1 -1
- package/dist/validate/collect.js +2 -1
- package/dist/validate/collect.js.map +1 -1
- package/dist/validate/keys.d.ts +6 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +17 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/values.d.ts +6 -0
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +12 -1
- package/dist/validate/values.js.map +1 -1
- package/package.json +16 -2
- package/dist/background.d.ts +0 -13
- package/dist/background.d.ts.map +0 -1
- package/dist/background.js +0 -65
- package/dist/background.js.map +0 -1
- package/dist/cli/args.d.ts +0 -14
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -67
- package/dist/cli/args.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -102
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts +0 -95
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -208
- package/dist/config.js.map +0 -1
- package/dist/fonts.d.ts +0 -18
- package/dist/fonts.d.ts.map +0 -1
- package/dist/fonts.js +0 -102
- package/dist/fonts.js.map +0 -1
- package/dist/generate.d.ts +0 -63
- package/dist/generate.d.ts.map +0 -1
- package/dist/generate.js +0 -109
- package/dist/generate.js.map +0 -1
- package/dist/highlight.d.ts +0 -75
- package/dist/highlight.d.ts.map +0 -1
- package/dist/highlight.js +0 -137
- package/dist/highlight.js.map +0 -1
- package/dist/render.d.ts +0 -24
- package/dist/render.d.ts.map +0 -1
- package/dist/render.js +0 -77
- package/dist/render.js.map +0 -1
- package/dist/stamp.d.ts +0 -29
- package/dist/stamp.d.ts.map +0 -1
- package/dist/stamp.js +0 -198
- package/dist/stamp.js.map +0 -1
- package/dist/templates/banner.d.ts +0 -9
- package/dist/templates/banner.d.ts.map +0 -1
- package/dist/templates/banner.js +0 -115
- package/dist/templates/banner.js.map +0 -1
- package/dist/templates/card.d.ts +0 -7
- package/dist/templates/card.d.ts.map +0 -1
- package/dist/templates/card.js +0 -72
- package/dist/templates/card.js.map +0 -1
- package/dist/templates/code.d.ts +0 -12
- package/dist/templates/code.d.ts.map +0 -1
- package/dist/templates/code.js +0 -275
- package/dist/templates/code.js.map +0 -1
- package/dist/templates/measure.d.ts +0 -11
- package/dist/templates/measure.d.ts.map +0 -1
- package/dist/templates/measure.js +0 -11
- package/dist/templates/measure.js.map +0 -1
- package/dist/templates/props.d.ts +0 -7
- package/dist/templates/props.d.ts.map +0 -1
- package/dist/templates/props.js +0 -17
- package/dist/templates/props.js.map +0 -1
- package/dist/templates/text.d.ts +0 -37
- package/dist/templates/text.d.ts.map +0 -1
- package/dist/templates/text.js +0 -26
- package/dist/templates/text.js.map +0 -1
- package/dist/text/stack.d.ts +0 -24
- package/dist/text/stack.d.ts.map +0 -1
- package/dist/text/stack.js +0 -18
- package/dist/text/stack.js.map +0 -1
- package/dist/text.d.ts +0 -56
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -78
- package/dist/text.js.map +0 -1
- package/dist/validate/sizes.d.ts +0 -9
- package/dist/validate/sizes.d.ts.map +0 -1
- package/dist/validate/sizes.js +0 -27
- package/dist/validate/sizes.js.map +0 -1
- package/dist/validate.d.ts +0 -15
- package/dist/validate.d.ts.map +0 -1
- package/dist/validate.js +0 -300
- package/dist/validate.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rasteriser.node.d.ts","sourceRoot":"","sources":["../../src/platform/rasteriser.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rasteriser.node.js","sourceRoot":"","sources":["../../src/platform/rasteriser.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser and edge stand-in for reading a file, which is to say there is no
|
|
3
|
+
* reading a file.
|
|
4
|
+
*
|
|
5
|
+
* A bundler picks this up through `package.json`'s `browser` field. Supplying
|
|
6
|
+
* a font or an image as a path is the one thing the core cannot do, since there
|
|
7
|
+
* is no filesystem to resolve it against, so it says so rather than failing
|
|
8
|
+
* later as a missing glyph or a blank image.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readFileBytes(path: string): Promise<Uint8Array>;
|
|
11
|
+
/**
|
|
12
|
+
* The same, and the same answer: a path names a file, and there are none here.
|
|
13
|
+
* Refused when the config is resolved rather than when the image is drawn, so
|
|
14
|
+
* that a config which cannot work here says so before anything renders.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveReadablePath(given: string, label: string, kind: string): string;
|
|
17
|
+
//# sourceMappingURL=read-file.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.browser.d.ts","sourceRoot":"","sources":["../../src/platform/read-file.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAO/D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM,CAKR"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser and edge stand-in for reading a file, which is to say there is no
|
|
3
|
+
* reading a file.
|
|
4
|
+
*
|
|
5
|
+
* A bundler picks this up through `package.json`'s `browser` field. Supplying
|
|
6
|
+
* a font or an image as a path is the one thing the core cannot do, since there
|
|
7
|
+
* is no filesystem to resolve it against, so it says so rather than failing
|
|
8
|
+
* later as a missing glyph or a blank image.
|
|
9
|
+
*/
|
|
10
|
+
export function readFileBytes(path) {
|
|
11
|
+
return Promise.reject(new Error(`Cannot read "${path}": there is no filesystem here. Supply fonts and` +
|
|
12
|
+
` images as bytes ({ data }) rather than as paths ({ path }).`));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The same, and the same answer: a path names a file, and there are none here.
|
|
16
|
+
* Refused when the config is resolved rather than when the image is drawn, so
|
|
17
|
+
* that a config which cannot work here says so before anything renders.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveReadablePath(given, label, kind) {
|
|
20
|
+
throw new Error(`${label}: cannot read the ${kind} at "${given}" here, since there is no` +
|
|
21
|
+
` filesystem. Supply the bytes as "data" instead.`);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=read-file.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.browser.js","sourceRoot":"","sources":["../../src/platform/read-file.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,gBAAgB,IAAI,kDAAkD;QACpE,8DAA8D,CACjE,CACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,KAAa,EACb,IAAY;IAEZ,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,qBAAqB,IAAI,QAAQ,KAAK,2BAA2B;QACvE,kDAAkD,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a file named by a path.
|
|
3
|
+
*
|
|
4
|
+
* It is a module of its own so that a bundler can swap it: `package.json`'s
|
|
5
|
+
* `browser` field points at the sibling that cannot, which is what keeps
|
|
6
|
+
* `node:fs` out of the browser build's import graph. Everything that reads a
|
|
7
|
+
* path goes through here, so there is one thing to swap rather than a check in
|
|
8
|
+
* each caller.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readFileBytes(path: string): Promise<Uint8Array>;
|
|
11
|
+
/**
|
|
12
|
+
* Make a configured path absolute and check something is there to read.
|
|
13
|
+
*
|
|
14
|
+
* Checked when the config is resolved rather than when the file is opened,
|
|
15
|
+
* because a font or an image that cannot be read shows up as a blank corner on
|
|
16
|
+
* every generated image, and a blank corner does not say which path was wrong.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveReadablePath(given: string, label: string, kind: string): string;
|
|
19
|
+
//# sourceMappingURL=read-file.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.node.d.ts","sourceRoot":"","sources":["../../src/platform/read-file.node.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAErE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,MAAM,CAWR"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* Read a file named by a path.
|
|
6
|
+
*
|
|
7
|
+
* It is a module of its own so that a bundler can swap it: `package.json`'s
|
|
8
|
+
* `browser` field points at the sibling that cannot, which is what keeps
|
|
9
|
+
* `node:fs` out of the browser build's import graph. Everything that reads a
|
|
10
|
+
* path goes through here, so there is one thing to swap rather than a check in
|
|
11
|
+
* each caller.
|
|
12
|
+
*/
|
|
13
|
+
export async function readFileBytes(path) {
|
|
14
|
+
return new Uint8Array(await readFile(path));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Make a configured path absolute and check something is there to read.
|
|
18
|
+
*
|
|
19
|
+
* Checked when the config is resolved rather than when the file is opened,
|
|
20
|
+
* because a font or an image that cannot be read shows up as a blank corner on
|
|
21
|
+
* every generated image, and a blank corner does not say which path was wrong.
|
|
22
|
+
*/
|
|
23
|
+
export function resolveReadablePath(given, label, kind) {
|
|
24
|
+
const absolute = path.resolve(given);
|
|
25
|
+
if (!existsSync(absolute) || !statSync(absolute).isFile()) {
|
|
26
|
+
throw new Error(`${label}: ${kind} not found at ${absolute} (from "${given}").` +
|
|
27
|
+
` Relative paths resolve from the working directory.`);
|
|
28
|
+
}
|
|
29
|
+
return absolute;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=read-file.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.node.js","sourceRoot":"","sources":["../../src/platform/read-file.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY;IAC9C,OAAO,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,KAAa,EACb,IAAY;IAEZ,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAErC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,KAAK,IAAI,iBAAiB,QAAQ,WAAW,KAAK,KAAK;YAC7D,qDAAqD,CACxD,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The eight bytes every PNG file starts with. */
|
|
2
|
+
export declare const pngSignature: Buffer<ArrayBuffer>;
|
|
3
|
+
/** One chunk of a PNG: its four-character type and the data it carries. */
|
|
4
|
+
export interface PngChunk {
|
|
5
|
+
readonly type: string;
|
|
6
|
+
readonly data: Buffer;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A whole PNG chunk as bytes: its length, its type, its data, and the CRC over
|
|
10
|
+
* the type and data together.
|
|
11
|
+
*/
|
|
12
|
+
export declare function chunkBytes(type: string, data: Buffer): Buffer;
|
|
13
|
+
/**
|
|
14
|
+
* The chunks of a PNG, in the order the file declares them.
|
|
15
|
+
*
|
|
16
|
+
* `undefined` where the bytes are not a PNG at all, or where a chunk runs past
|
|
17
|
+
* the end of them, which between them cover everything a caller can do about
|
|
18
|
+
* it: whatever this is, it is not a file to take apart and put back together.
|
|
19
|
+
* The CRCs are not checked, since nothing here is deciding whether to trust the
|
|
20
|
+
* image, only where one chunk ends and the next begins.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readChunks(png: Buffer): PngChunk[] | undefined;
|
|
23
|
+
//# sourceMappingURL=chunk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../src/png/chunk.ts"],"names":[],"mappings":"AAEA,kDAAkD;AAClD,eAAO,MAAM,YAAY,qBAEvB,CAAC;AAEH,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAY7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,GAAG,SAAS,CAyB9D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { crc32 } from "node:zlib";
|
|
2
|
+
/** The eight bytes every PNG file starts with. */
|
|
3
|
+
export const pngSignature = Buffer.from([
|
|
4
|
+
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
|
|
5
|
+
]);
|
|
6
|
+
/**
|
|
7
|
+
* A whole PNG chunk as bytes: its length, its type, its data, and the CRC over
|
|
8
|
+
* the type and data together.
|
|
9
|
+
*/
|
|
10
|
+
export function chunkBytes(type, data) {
|
|
11
|
+
const chunk = Buffer.alloc(4 + 4 + data.length + 4);
|
|
12
|
+
chunk.writeUInt32BE(data.length, 0);
|
|
13
|
+
chunk.write(type, 4, "latin1");
|
|
14
|
+
data.copy(chunk, 8);
|
|
15
|
+
chunk.writeUInt32BE(crc32(chunk.subarray(4, 8 + data.length)), 8 + data.length);
|
|
16
|
+
return chunk;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The chunks of a PNG, in the order the file declares them.
|
|
20
|
+
*
|
|
21
|
+
* `undefined` where the bytes are not a PNG at all, or where a chunk runs past
|
|
22
|
+
* the end of them, which between them cover everything a caller can do about
|
|
23
|
+
* it: whatever this is, it is not a file to take apart and put back together.
|
|
24
|
+
* The CRCs are not checked, since nothing here is deciding whether to trust the
|
|
25
|
+
* image, only where one chunk ends and the next begins.
|
|
26
|
+
*/
|
|
27
|
+
export function readChunks(png) {
|
|
28
|
+
if (!png.subarray(0, pngSignature.length).equals(pngSignature)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const chunks = [];
|
|
32
|
+
let offset = pngSignature.length;
|
|
33
|
+
while (offset + 12 <= png.length) {
|
|
34
|
+
const length = png.readUInt32BE(offset);
|
|
35
|
+
const end = offset + 12 + length;
|
|
36
|
+
if (end > png.length) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
chunks.push({
|
|
40
|
+
type: png.toString("latin1", offset + 4, offset + 8),
|
|
41
|
+
data: png.subarray(offset + 8, offset + 8 + length),
|
|
42
|
+
});
|
|
43
|
+
offset = end;
|
|
44
|
+
}
|
|
45
|
+
// Trailing bytes that are not a chunk mean this was read wrong somewhere.
|
|
46
|
+
return offset === png.length ? chunks : undefined;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../src/png/chunk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC;IACtC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CAC/C,CAAC,CAAC;AAQH;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAAY;IACnD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEpD,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACpC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpB,KAAK,CAAC,aAAa,CACjB,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EACzC,CAAC,GAAG,IAAI,CAAC,MAAM,CAChB,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QAC/D,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,IAAI,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IAEjC,OAAO,MAAM,GAAG,EAAE,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC;QAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;YACpD,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;SACpD,CAAC,CAAC;QACH,MAAM,GAAG,GAAG,CAAC;IACf,CAAC;IAED,0EAA0E;IAC1E,OAAO,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading and rewriting the PNG container itself, as against the picture in it.
|
|
3
|
+
*
|
|
4
|
+
* Two things in the package have to open a finished PNG: the rebuild stamp,
|
|
5
|
+
* which puts a `tEXt` chunk in the header, and the recompressor, which replaces
|
|
6
|
+
* the image data with a smaller encoding of the same bytes. Both need the same
|
|
7
|
+
* chunk arithmetic, and writing a CRC in two places is how the two would come
|
|
8
|
+
* to disagree.
|
|
9
|
+
*/
|
|
10
|
+
export type { PngChunk } from "./chunk.js";
|
|
11
|
+
export { chunkBytes, pngSignature, readChunks } from "./chunk.js";
|
|
12
|
+
export { recompressPng } from "./recompress.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-encode a PNG's image data at zlib level `level`, returning the smaller of
|
|
3
|
+
* what that produced and what came in.
|
|
4
|
+
*
|
|
5
|
+
* This is lossless in the strongest sense available: the filtered scanlines are
|
|
6
|
+
* inflated and deflated again untouched, so not a pixel moves and not even a
|
|
7
|
+
* row filter changes. All that differs is how hard the deflater looked for
|
|
8
|
+
* matches. resvg encodes for speed, which on a 1200x1200 gradient costs about
|
|
9
|
+
* three times the file size, and these are images a site commits and then
|
|
10
|
+
* serves to everyone who shares a link.
|
|
11
|
+
*
|
|
12
|
+
* Re-filtering the rows adaptively rather than keeping resvg's fixed `Sub` was
|
|
13
|
+
* measured too, and bought about another 5% for more time again and a filter
|
|
14
|
+
* implementation to maintain, so it is not done.
|
|
15
|
+
*
|
|
16
|
+
* A `level` of `0` means leave the bytes alone, as does anything that is not a
|
|
17
|
+
* PNG this can take apart: a rasteriser other than the default may return a
|
|
18
|
+
* format with nothing in common with this, and refusing it here would be
|
|
19
|
+
* refusing it for the wrong reason. Bytes that claim to be a PNG and then fail
|
|
20
|
+
* to inflate are a broken image, and that does throw.
|
|
21
|
+
*/
|
|
22
|
+
export declare function recompressPng(png: Buffer, level: number): Promise<Buffer>;
|
|
23
|
+
//# sourceMappingURL=recompress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recompress.d.ts","sourceRoot":"","sources":["../../src/png/recompress.ts"],"names":[],"mappings":"AAuDA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { promisify } from "node:util";
|
|
2
|
+
import { deflate, inflate } from "node:zlib";
|
|
3
|
+
import { chunkBytes, pngSignature, readChunks } from "./chunk.js";
|
|
4
|
+
const inflateAsync = promisify(inflate);
|
|
5
|
+
const deflateAsync = promisify(deflate);
|
|
6
|
+
/**
|
|
7
|
+
* Where the compression method sits in `IHDR`, after the width, the height,
|
|
8
|
+
* the bit depth and the colour type.
|
|
9
|
+
*/
|
|
10
|
+
const compressionMethodOffset = 10;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the image data is a plain zlib stream, which is the only compression
|
|
13
|
+
* method PNG defines and so the only one there is anything here to re-encode.
|
|
14
|
+
* A file whose header says otherwise is left as it is rather than guessed at.
|
|
15
|
+
*/
|
|
16
|
+
function isDeflated(chunks) {
|
|
17
|
+
const header = chunks[0];
|
|
18
|
+
return (header?.type === "IHDR" &&
|
|
19
|
+
header.data.length >= 13 &&
|
|
20
|
+
header.data[compressionMethodOffset] === 0);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The file put back together with `idat` in place of the image data it held.
|
|
24
|
+
*
|
|
25
|
+
* Every other chunk is kept, in its original order and at its original place:
|
|
26
|
+
* a rasteriser may have written a `pHYs` or a `gAMA` that says how the image is
|
|
27
|
+
* meant to be shown, and dropping one to save a few bytes would change what the
|
|
28
|
+
* image is. The new data goes where the first `IDAT` was, since the ones after
|
|
29
|
+
* it were the same stream split up.
|
|
30
|
+
*/
|
|
31
|
+
function rebuild(chunks, idat) {
|
|
32
|
+
const parts = [pngSignature];
|
|
33
|
+
let isWritten = false;
|
|
34
|
+
for (const chunk of chunks) {
|
|
35
|
+
if (chunk.type !== "IDAT") {
|
|
36
|
+
parts.push(chunkBytes(chunk.type, chunk.data));
|
|
37
|
+
}
|
|
38
|
+
else if (!isWritten) {
|
|
39
|
+
isWritten = true;
|
|
40
|
+
parts.push(chunkBytes("IDAT", idat));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Buffer.concat(parts);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Re-encode a PNG's image data at zlib level `level`, returning the smaller of
|
|
47
|
+
* what that produced and what came in.
|
|
48
|
+
*
|
|
49
|
+
* This is lossless in the strongest sense available: the filtered scanlines are
|
|
50
|
+
* inflated and deflated again untouched, so not a pixel moves and not even a
|
|
51
|
+
* row filter changes. All that differs is how hard the deflater looked for
|
|
52
|
+
* matches. resvg encodes for speed, which on a 1200x1200 gradient costs about
|
|
53
|
+
* three times the file size, and these are images a site commits and then
|
|
54
|
+
* serves to everyone who shares a link.
|
|
55
|
+
*
|
|
56
|
+
* Re-filtering the rows adaptively rather than keeping resvg's fixed `Sub` was
|
|
57
|
+
* measured too, and bought about another 5% for more time again and a filter
|
|
58
|
+
* implementation to maintain, so it is not done.
|
|
59
|
+
*
|
|
60
|
+
* A `level` of `0` means leave the bytes alone, as does anything that is not a
|
|
61
|
+
* PNG this can take apart: a rasteriser other than the default may return a
|
|
62
|
+
* format with nothing in common with this, and refusing it here would be
|
|
63
|
+
* refusing it for the wrong reason. Bytes that claim to be a PNG and then fail
|
|
64
|
+
* to inflate are a broken image, and that does throw.
|
|
65
|
+
*/
|
|
66
|
+
export async function recompressPng(png, level) {
|
|
67
|
+
const chunks = level === 0 ? undefined : readChunks(png);
|
|
68
|
+
if (chunks === undefined || !isDeflated(chunks)) {
|
|
69
|
+
return png;
|
|
70
|
+
}
|
|
71
|
+
const image = chunks.filter((chunk) => chunk.type === "IDAT");
|
|
72
|
+
if (image.length === 0) {
|
|
73
|
+
return png;
|
|
74
|
+
}
|
|
75
|
+
const data = await inflateAsync(Buffer.concat(image.map(({ data }) => data)));
|
|
76
|
+
const rebuilt = rebuild(chunks, await deflateAsync(data, { level }));
|
|
77
|
+
// A rasteriser that already compresses well would otherwise be undone by a
|
|
78
|
+
// level that happens to suit it less than the one it chose for itself.
|
|
79
|
+
return rebuilt.length < png.length ? rebuilt : png;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=recompress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recompress.js","sourceRoot":"","sources":["../../src/png/recompress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AACxC,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AAExC;;;GAGG;AACH,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC;;;;GAIG;AACH,SAAS,UAAU,CAAC,MAA2B;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,MAAM,EAAE,IAAI,KAAK,MAAM;QACvB,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAC3C,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,OAAO,CAAC,MAA2B,EAAE,IAAY;IACxD,MAAM,KAAK,GAAa,CAAC,YAAY,CAAC,CAAC;IACvC,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,CAAC;aAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACtB,SAAS,GAAG,IAAI,CAAC;YACjB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAW,EACX,KAAa;IAEb,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAEzD,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IAE9D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAErE,2EAA2E;IAC3E,uEAAuE;IACvE,OAAO,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACrD,CAAC"}
|
package/dist/props.d.ts
CHANGED
|
@@ -4,4 +4,15 @@
|
|
|
4
4
|
* templates treat "not a usable string" and "absent" the same way.
|
|
5
5
|
*/
|
|
6
6
|
export declare function optionalString(value: unknown): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Read a prop as a list of strings: a YAML sequence as it stands, and a single
|
|
9
|
+
* value as a list of one.
|
|
10
|
+
*
|
|
11
|
+
* Taking the scalar too is what stops `tags: release` being a post with no
|
|
12
|
+
* tags. Frontmatter is hand-written, the two forms are both ordinary YAML, and
|
|
13
|
+
* a template asking for a list has nothing useful to do with the difference.
|
|
14
|
+
* Entries that are not usable strings are dropped rather than rendered as
|
|
15
|
+
* holes, which is {@link optionalString}'s rule applied item by item.
|
|
16
|
+
*/
|
|
17
|
+
export declare function stringList(value: unknown): readonly string[];
|
|
7
18
|
//# sourceMappingURL=props.d.ts.map
|
package/dist/props.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAcjE"}
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAcjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAM5D"}
|
package/dist/props.js
CHANGED
|
@@ -14,4 +14,20 @@ export function optionalString(value) {
|
|
|
14
14
|
}
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Read a prop as a list of strings: a YAML sequence as it stands, and a single
|
|
19
|
+
* value as a list of one.
|
|
20
|
+
*
|
|
21
|
+
* Taking the scalar too is what stops `tags: release` being a post with no
|
|
22
|
+
* tags. Frontmatter is hand-written, the two forms are both ordinary YAML, and
|
|
23
|
+
* a template asking for a list has nothing useful to do with the difference.
|
|
24
|
+
* Entries that are not usable strings are dropped rather than rendered as
|
|
25
|
+
* holes, which is {@link optionalString}'s rule applied item by item.
|
|
26
|
+
*/
|
|
27
|
+
export function stringList(value) {
|
|
28
|
+
const items = Array.isArray(value) ? value : [value];
|
|
29
|
+
return items
|
|
30
|
+
.map((item) => optionalString(item))
|
|
31
|
+
.filter((item) => item !== undefined && item !== "");
|
|
32
|
+
}
|
|
17
33
|
//# sourceMappingURL=props.js.map
|
package/dist/props.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAErD,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SACnC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Dimensions, ResolvedConfig } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Rasterise an SVG string to image bytes at `dimensions`.
|
|
4
|
+
*
|
|
5
|
+
* Every path that produces an image goes through here, so this is the one place
|
|
6
|
+
* the configured rasteriser has to be chosen. A project that supplies its own
|
|
7
|
+
* gets it used by `renderMetaImages`, by `generate` and by `colophon preview`
|
|
8
|
+
* alike, none of which knows there was a choice to make.
|
|
9
|
+
*
|
|
10
|
+
* It is also where the bytes are encoded as `config.format`, for the same
|
|
11
|
+
* reason and on the same terms: which format a build writes is the project's
|
|
12
|
+
* decision rather than the rasteriser's, and a caller taking the bytes away to
|
|
13
|
+
* write them itself should not have to encode them again to get what it asked
|
|
14
|
+
* for.
|
|
15
|
+
*
|
|
16
|
+
* It was `renderSvgToPng` while PNG was the only thing it could return. Now
|
|
17
|
+
* that a config chooses, that name would be wrong three times in four.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderSvgToImage(svg: string, dimensions: Dimensions, config?: ResolvedConfig): Promise<Buffer>;
|
|
20
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/render/image.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,UAAU,EACtB,MAAM,GAAE,cAAgC,GACvC,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { resolveConfig } from "../config/index.js";
|
|
2
|
+
import { encodeImage } from "../encode/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Rasterise an SVG string to image bytes at `dimensions`.
|
|
5
|
+
*
|
|
6
|
+
* Every path that produces an image goes through here, so this is the one place
|
|
7
|
+
* the configured rasteriser has to be chosen. A project that supplies its own
|
|
8
|
+
* gets it used by `renderMetaImages`, by `generate` and by `colophon preview`
|
|
9
|
+
* alike, none of which knows there was a choice to make.
|
|
10
|
+
*
|
|
11
|
+
* It is also where the bytes are encoded as `config.format`, for the same
|
|
12
|
+
* reason and on the same terms: which format a build writes is the project's
|
|
13
|
+
* decision rather than the rasteriser's, and a caller taking the bytes away to
|
|
14
|
+
* write them itself should not have to encode them again to get what it asked
|
|
15
|
+
* for.
|
|
16
|
+
*
|
|
17
|
+
* It was `renderSvgToPng` while PNG was the only thing it could return. Now
|
|
18
|
+
* that a config chooses, that name would be wrong three times in four.
|
|
19
|
+
*/
|
|
20
|
+
export async function renderSvgToImage(svg, dimensions, config = resolveConfig()) {
|
|
21
|
+
const bytes = await config.rasteriser(svg, dimensions, config);
|
|
22
|
+
// A rasteriser returns bytes, since not every one of them has a `Buffer` to
|
|
23
|
+
// return. Everything downstream of here is Node, and the stamp reads the
|
|
24
|
+
// image with `Buffer`'s own methods, so this is where the two meet. A
|
|
25
|
+
// `Buffer` arrives as itself rather than being copied.
|
|
26
|
+
const raster = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes);
|
|
27
|
+
return encodeImage(raster, config);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/render/image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAW,EACX,UAAsB,EACtB,MAAM,GAAmB,aAAa,EAAE;IAExC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAE/D,4EAA4E;IAC5E,yEAAyE;IACzE,sEAAsE;IACtE,uDAAuD;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEnE,OAAO,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/render/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ColophonConfig, MetaImageProps, RenderedMetaImage } from "../types.js";
|
|
2
2
|
export { buildSvg } from "./svg.js";
|
|
3
|
-
export {
|
|
3
|
+
export { renderSvgToImage } from "./image.js";
|
|
4
|
+
export { resvgRasteriser } from "./rasterise.js";
|
|
4
5
|
/**
|
|
5
6
|
* Render an image for every configured output size from a single set of props.
|
|
6
7
|
* This is the reusable core: it takes props and config and returns rendered
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,cAAc,EACrB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAiB9B"}
|
package/dist/render/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { resolveConfig } from "../config/index.js";
|
|
2
2
|
import { resolveConfigForSize } from "../config/size.js";
|
|
3
|
-
import {
|
|
3
|
+
import { renderSvgToImage } from "./image.js";
|
|
4
4
|
import { buildSvg } from "./svg.js";
|
|
5
5
|
import { selectTemplate } from "./template.js";
|
|
6
6
|
export { buildSvg } from "./svg.js";
|
|
7
|
-
export {
|
|
7
|
+
export { renderSvgToImage } from "./image.js";
|
|
8
|
+
export { resvgRasteriser } from "./rasterise.js";
|
|
8
9
|
/**
|
|
9
10
|
* Render an image for every configured output size from a single set of props.
|
|
10
11
|
* This is the reusable core: it takes props and config and returns rendered
|
|
@@ -20,8 +21,8 @@ export async function renderMetaImages(props, config) {
|
|
|
20
21
|
const sizeConfig = resolveConfigForSize(config, size);
|
|
21
22
|
const dimensions = { width: size.width, height: size.height };
|
|
22
23
|
const svg = await buildSvg(props, sizeConfig, dimensions);
|
|
23
|
-
const
|
|
24
|
-
return { name: size.name, dimensions, svg,
|
|
24
|
+
const bytes = await renderSvgToImage(svg, dimensions, sizeConfig);
|
|
25
|
+
return { name: size.name, dimensions, svg, bytes };
|
|
25
26
|
}));
|
|
26
27
|
}
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/render/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAMzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAMzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAqB,EACrB,MAAuB;IAEvB,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAEvC,gEAAgE;IAChE,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEzC,OAAO,OAAO,CAAC,GAAG,CAChB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAChC,0EAA0E;QAC1E,sEAAsE;QACtE,MAAM,UAAU,GAAG,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAC9D,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAC1D,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACrD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/render/png.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import type { Dimensions, ResolvedConfig } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Rasterise an SVG string to
|
|
3
|
+
* Rasterise an SVG string to image bytes at `dimensions`.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Every path that produces an image goes through here, so this is the one place
|
|
6
|
+
* the configured rasteriser has to be chosen. A project that supplies its own
|
|
7
|
+
* gets it used by `renderMetaImages`, by `generate` and by `colophon preview`
|
|
8
|
+
* alike, none of which knows there was a choice to make.
|
|
9
|
+
*
|
|
10
|
+
* It is also where the bytes are compressed again, for the same reason and on
|
|
11
|
+
* the same terms: an image is worth shrinking whoever asked for it, and a
|
|
12
|
+
* caller taking the bytes away to write itself should not have to know that the
|
|
13
|
+
* rasteriser left three quarters of the saving on the table.
|
|
14
|
+
*
|
|
15
|
+
* The name is what it was before the backend became configurable. PNG is still
|
|
16
|
+
* what comes back by default, and renaming this would break every caller to say
|
|
17
|
+
* something the config already says.
|
|
8
18
|
*/
|
|
9
19
|
export declare function renderSvgToPng(svg: string, dimensions: Dimensions, config?: ResolvedConfig): Promise<Buffer>;
|
|
10
20
|
//# sourceMappingURL=png.d.ts.map
|
package/dist/render/png.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../src/render/png.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../src/render/png.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,UAAU,EACtB,MAAM,GAAE,cAAgC,GACvC,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
package/dist/render/png.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { renderAsync } from "@resvg/resvg-js";
|
|
2
1
|
import { resolveConfig } from "../config/index.js";
|
|
3
|
-
import {
|
|
2
|
+
import { recompressPng } from "../png/recompress.js";
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Rasterise an SVG string to a PNG buffer, scaled to `dimensions.width`.
|
|
4
|
+
* Rasterise an SVG string to image bytes at `dimensions`.
|
|
5
|
+
*
|
|
6
|
+
* Every path that produces an image goes through here, so this is the one place
|
|
7
|
+
* the configured rasteriser has to be chosen. A project that supplies its own
|
|
8
|
+
* gets it used by `renderMetaImages`, by `generate` and by `colophon preview`
|
|
9
|
+
* alike, none of which knows there was a choice to make.
|
|
10
|
+
*
|
|
11
|
+
* It is also where the bytes are compressed again, for the same reason and on
|
|
12
|
+
* the same terms: an image is worth shrinking whoever asked for it, and a
|
|
13
|
+
* caller taking the bytes away to write itself should not have to know that the
|
|
14
|
+
* rasteriser left three quarters of the saving on the table.
|
|
18
15
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* The name is what it was before the backend became configurable. PNG is still
|
|
17
|
+
* what comes back by default, and renaming this would break every caller to say
|
|
18
|
+
* something the config already says.
|
|
22
19
|
*/
|
|
23
20
|
export async function renderSvgToPng(svg, dimensions, config = resolveConfig()) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const bytes = await config.rasteriser(svg, dimensions, config);
|
|
22
|
+
// A rasteriser returns bytes, since not every one of them has a `Buffer` to
|
|
23
|
+
// return. Everything downstream of here is Node, and the stamp reads the PNG
|
|
24
|
+
// with `Buffer`'s own methods, so this is where the two meet. A `Buffer`
|
|
25
|
+
// arrives as itself rather than being copied.
|
|
26
|
+
const png = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes);
|
|
27
|
+
return recompressPng(png, config.compressionLevel);
|
|
29
28
|
}
|
|
30
29
|
//# sourceMappingURL=png.js.map
|
package/dist/render/png.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"png.js","sourceRoot":"","sources":["../../src/render/png.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"png.js","sourceRoot":"","sources":["../../src/render/png.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,UAAsB,EACtB,MAAM,GAAmB,aAAa,EAAE;IAExC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAE/D,4EAA4E;IAC5E,6EAA6E;IAC7E,yEAAyE;IACzE,8CAA8C;IAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEhE,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACrD,CAAC"}
|