Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
307 commits
Select commit Hold shift + click to select a range
f670597
feat: Add strict types and TSDocs to `ImageScript.d.ts` (#43)
acdvorak Jun 1, 2025
066f4cb
1.3.1
matmen Jun 1, 2025
5d2a96f
fix: update gh actions to use active node releases
matmen May 23, 2025
ae72350
replace png.wasm with a pure js png decoder
matmen Oct 13, 2026
e08324f
pure js gif encoder and decoder
matmen Oct 13, 2026
a6c2065
pure js jpeg encoder and decoder
matmen Oct 13, 2026
e044c2a
pure js tiff decoder
matmen Oct 13, 2026
e398ac5
pure js font rendering
matmen Oct 13, 2026
169b4aa
pure js svg renderer
matmen Oct 13, 2026
c99a60f
remove all wasm and native binaries
matmen Oct 13, 2026
f237855
fix rotation, compositing and cropCircle
matmen Oct 13, 2026
0bd42d0
remove v2, png and bench
matmen Oct 13, 2026
0ab17b4
fix api bugs and invalid type definitions
matmen Oct 13, 2026
1ca9970
use 0-based coordinates everywhere
matmen Oct 13, 2026
63f3f5b
port to typescript, esm only, node 22.12+
matmen Oct 13, 2026
c6bfeec
speed up the gif quantizer
matmen Oct 13, 2026
37fd47a
fix rounding, input mutation and svg entity expansion
matmen Oct 13, 2026
02d1778
filtered resizing, antialiased shapes, kerning, better dominantColor …
matmen Oct 13, 2026
7578bfa
filter png rows adaptively for non-palette images
matmen Oct 13, 2026
9568f11
native zlib, faster pixel ops, api naming cleanup
matmen Oct 13, 2026
af4a260
make invertValue invert the hsv value
matmen Oct 13, 2026
4b26bce
apply exif orientation, clamp colors, api consistency for 3.0
matmen Oct 13, 2026
8f18b83
blur, sharpen, rgb adjustments, blend modes and outlined text
matmen Oct 13, 2026
5d82290
readme: install, commonjs usage, v3 upgrade notes
matmen Oct 14, 2026
fbdd15e
typedoc documentation, published to github pages on release
matmen Oct 14, 2026
fcf7b1c
publish github releases to npm
matmen Oct 14, 2026
aabd324
sync src/version.ts on npm version
matmen Oct 14, 2026
895aa6a
run the tests on every branch
matmen Oct 14, 2026
63a0474
update github actions to their node 24 versions
matmen Oct 14, 2026
dc9db9f
smaller package: no comments in the built js, no internals in the dec…
matmen Oct 14, 2026
c76c9f5
slice-by-16 crc32 (#12)
matmen Oct 14, 2026
beba5a5
orient PNGs by their eXIf chunk, ImageMagick's Exif text or XMP
matmen Oct 14, 2026
671564e
publish to JSR alongside npm (#33, #38)
matmen Oct 14, 2026
ea5fbbf
credit third party code
matmen Oct 14, 2026
c50cc03
fix JSR publishing: single license, runnable by hand
matmen Oct 14, 2026
92f0b8e
apng decoding and encoding, Animation class (#6)
matmen Oct 15, 2026
4eda0a7
deprecate GIF in favor of Animation
matmen Oct 15, 2026
428a1bb
reference the APNG specification
matmen Oct 15, 2026
362575c
webp decoding and lossless encoding (#19, #20)
matmen Oct 15, 2026
b855aea
credit RFC 9649 for the WebP container and lossless codec
matmen Oct 15, 2026
8c1ba5d
tga decoding and encoding (#21)
matmen Oct 15, 2026
46f7fc1
changelog: no "(unreleased)" after the version
matmen Oct 15, 2026
35ab788
colorToAlpha (#39)
matmen Oct 15, 2026
8314d37
document that colorToAlpha removes the color everywhere
matmen Oct 15, 2026
511cd5d
truetype hinting (#31)
matmen Oct 15, 2026
a605966
credit FreeType for the hinting interpreter
matmen Oct 15, 2026
c0694b8
take the release version from the tag
matmen Oct 15, 2026
165d534
fix the JSR publish of releases, set version 3.1.0
matmen Oct 15, 2026
f37a538
hide ImageType's constructor
matmen Oct 15, 2026
60485b8
end TGA run length packets with the row
matmen Oct 15, 2026
a0f1e0f
changelog: both changes go into 3.2.0
matmen Oct 15, 2026
9d7c5e4
metadata for every format
matmen Oct 15, 2026
bbeab78
use TextEncoder/TextDecoder for UTF-8
matmen Oct 15, 2026
6609abe
options objects
matmen Oct 15, 2026
978b136
options objects for roundCorners and fisheye
matmen Oct 15, 2026
4d16ab7
smaller animations
matmen Oct 15, 2026
c4a3971
smaller animations: fix cleared frames, weigh transparency, faster
matmen Oct 15, 2026
d96cdde
smaller animations: keep GIF frames lossless, faster APNG decision
matmen Oct 15, 2026
b203cea
smaller animations: files every decoder reads the same
matmen Oct 15, 2026
5670af0
optimize option for the animation encoders
matmen Oct 15, 2026
6e8730e
Animation.frames, deprecate animations as arrays
matmen Oct 15, 2026
4cb4753
benchmark against other image libraries
matmen Oct 15, 2026
6b80937
faster GIF decoding
matmen Oct 15, 2026
6e1e182
faster SVG rendering
matmen Oct 15, 2026
3e26325
faster PNG decoding and encoding
matmen Oct 15, 2026
8fa8efd
faster lossless WebP encoding
matmen Oct 15, 2026
8b8da51
faster resizing
matmen Oct 15, 2026
d641dbe
trim
matmen Oct 15, 2026
2a0feda
package without declarations of internal modules
matmen Oct 16, 2026
233ef08
README, keywords, issue template, example with options objects
matmen Oct 16, 2026
c398bac
release 3.2.0
github-actions[bot] Oct 16, 2026
e157cf4
bench: install the released version past npm's metadata cache
matmen Oct 16, 2026
c5d4a3c
bench: collect Photon's images between iterations
matmen Oct 16, 2026
bae2d54
benchmark ImageScript 3.2.0
github-actions[bot] Oct 16, 2026
7a84f55
integer resampling, vertical pass first
matmen Oct 16, 2026
3a9fb0d
faster blur: box blurs on 32-bit words
matmen Oct 16, 2026
80100ca
faster GIF animation decoding
matmen Oct 16, 2026
45003c8
release 3.2.1
github-actions[bot] Oct 16, 2026
6360109
benchmark ImageScript 3.2.1
github-actions[bot] Oct 16, 2026
f40963b
fast resizing by default: 8-bit SWAR in both passes
matmen Oct 16, 2026
87af62c
fast resizing of transparent images: 8-bit premultiplied SWAR
matmen Oct 16, 2026
ecb3317
one fast resampling path, shared 8-bit alpha helpers
matmen Oct 16, 2026
1a56e22
faster lossless WebP: predictors per mode, cost table, hashes once
matmen Oct 16, 2026
0923dda
fast rotation: 8-bit SWAR bilinear sampling
matmen Oct 16, 2026
69d8304
renderText: fallback fonts and color glyphs (COLR v0, CBDT)
matmen Oct 16, 2026
2aafe8e
renderText: GSUB shaping, emoji sequences, lazy fallbacks, glyph cache
matmen Oct 16, 2026
7b94bf8
renderText: the outline doesn't show through translucent text
matmen Oct 16, 2026
3d28ae4
renderText: smooth outlines along the antialiased glyph edge
matmen Oct 16, 2026
2813bf1
renderText: COLR version 1 color glyphs
matmen Oct 16, 2026
16df8e8
COLR v1: render at 4x, layers only as large as what they draw
matmen Oct 16, 2026
a193c86
renderText: robustness against damaged fonts, normalization, sbix (WIP)
matmen Oct 16, 2026
0fdc98e
renderText: tests for damaged fonts, sbix, empty text and normalization
matmen Oct 16, 2026
e511d22
decoding: pixel limit against decompression bombs, robustness fixes
matmen Oct 16, 2026
f57120d
renderSVG: limits against denial of service
matmen Oct 16, 2026
f40ec28
credit Pillow's resampling coefficients and filters, the box blur for…
matmen Oct 16, 2026
ba86a52
text: Unicode data, bidirectional algorithm and line breaking
matmen Oct 16, 2026
6ebf2f1
Use the runtime's base64, CRC-32 and deflate where they are faster
matmen Oct 16, 2026
1ca9177
renderText: shape text in every script, bidirectional text, UAX #14 w…
matmen Oct 17, 2026
6e92127
shapers: build the syllable scanners when first used
matmen Oct 17, 2026
8820219
Throw a RangeError for NaN and infinite arguments
matmen Oct 17, 2026
e3720ba
tests: Unicode conformance files with any line endings
matmen Oct 17, 2026
0861eda
Clean up: shared glyf and byte writer code, faster shaping
matmen Oct 17, 2026
a6c9ab2
Remove dead code found by static analysis
matmen Oct 17, 2026
85e19ce
Fix ReDoS in the SVG parser, clean up ESLint and SonarJS findings
matmen Oct 17, 2026
4cc3384
Hide internal members from the JSR docs, document the rest
matmen Oct 17, 2026
93015d9
Test in Deno and Bun in CI
matmen Oct 17, 2026
c0dbb90
release 3.3.0
github-actions[bot] Oct 17, 2026
e914bbf
benchmark ImageScript 3.3.0
github-actions[bot] Oct 17, 2026
0b3cc27
README: drop the note about the skipped 2.x version
matmen Oct 23, 2026
742353b
bench: compare with PureJsImage
matmen Oct 23, 2026
1595177
Lint with ESLint in CI
matmen Oct 23, 2026
46108dd
benchmark ImageScript 3.3.0
github-actions[bot] Oct 23, 2026
bed235c
Measure test coverage in CI
matmen Oct 23, 2026
f2fc48b
Test the untested paths, fix what the references disagree with
matmen Oct 23, 2026
fe3e9a2
Decode BMP, ICO/CUR, QOI, Netpbm and Radiance HDR; encode BMP, QOI, PNM
matmen Oct 23, 2026
209cdfc
Decode AVIF: AV1 ported from dav1d, RGB like libavif
matmen Oct 24, 2026
5eccfae
Encode lossy WebP: VP8 ported from libwebp, byte for byte like cwebp
matmen Oct 24, 2026
dad4a48
Decode JPEG XL: ported from jxl-oxide and libjxl, within 1 of djxl
matmen Oct 24, 2026
41e4280
JPEG XL: faster large DCTs, blending and Modular; lighter tests
matmen Oct 24, 2026
eea9f40
Add JPEG XL to the package keywords
matmen Oct 24, 2026
82e56cc
JPEG XL: CMYK images as their colors times black
matmen Oct 24, 2026
52368d8
Fix what JSR's type check (Deno's TypeScript) rejects
matmen Oct 25, 2026
8f68652
CI: type check the JSR package (deno publish --dry-run)
matmen Oct 25, 2026
fc55752
release 3.4.0
github-actions[bot] Oct 25, 2026
3bacbcd
benchmark ImageScript 3.4.0
github-actions[bot] Oct 25, 2026
fa52f06
JPEG XL: faster weighted predictor, sRGB encoding and Gaborish
matmen Oct 25, 2026
8df7364
JPEG XL: faster EPF, RGBA output, 2D DCTs and LZ77 reads
matmen Oct 25, 2026
eaf5221
Encode lossless JPEG XL: libjxl's fast lossless encoder, like cjxl -e 1
matmen Oct 25, 2026
35be9bf
Encode AVIF: an AV1 intra encoder mirroring the decoder
matmen Oct 25, 2026
d5b9af2
AVIF encoder: faster searches
matmen Oct 25, 2026
2e7ed8c
AVIF encoder: unrolled forward DCTs, fewer trials
matmen Oct 25, 2026
8329bd6
AVIF encoder: quantize small coefficients without the rate trials
matmen Oct 25, 2026
71e0e7b
AVIF encoder: palettes, angle deltas, monochrome, transparent pixels
matmen Oct 25, 2026
2902be0
release 3.5.0
github-actions[bot] Oct 25, 2026
fee7e69
benchmark ImageScript 3.5.0
github-actions[bot] Oct 25, 2026
14e111a
AVIF encoder: transform depth at effort 2
matmen Oct 25, 2026
2b1dc38
AVIF encoder: horizontal and vertical partitions
matmen Oct 25, 2026
ee517f2
AVIF and JPEG XL encoders: metadata as Exif
matmen Oct 25, 2026
343825d
Lossy WebP encoder: skip modes that can't win earlier
matmen Oct 25, 2026
d09456f
PNG encoder: leave rows unfiltered where that compresses better
matmen Oct 25, 2026
9269bf2
Lossy WebP encoder: default to effort 2
matmen Oct 25, 2026
11d8183
changelog: JPEG XL container by default, WebP default effort
matmen Oct 25, 2026
4fc8981
release 3.6.0
github-actions[bot] Oct 25, 2026
48c4e37
benchmark ImageScript 3.6.0
github-actions[bot] Oct 25, 2026
8e0950f
bench workflow: wait up to 10 minutes for a new version on npm
matmen Oct 25, 2026
ebb0742
Lossy JPEG XL encoder (VarDCT)
matmen Oct 25, 2026
60a1f7e
Lossy JPEG XL encoder: varblock search, chroma from luma, effort
matmen Oct 25, 2026
a2f5a51
AVIF encoder: about 8% faster
matmen Oct 26, 2026
1adf0d3
JPEG XL decoder: lossy images about 15% faster
matmen Oct 26, 2026
2ce4eae
WebP lossless encoder: prefix groups, color cache size, lazy matches
matmen Oct 26, 2026
082d63c
release 3.7.0
github-actions[bot] Oct 26, 2026
c8c1b0b
benchmark ImageScript 3.7.0
github-actions[bot] Oct 26, 2026
8d7578a
WebP lossless encoder: single symbol codes >= 256 take zero bits
matmen Oct 27, 2026
bee98d1
Lossy WebP animations: unchanged pixels within a tolerance, in 8x8 bl…
matmen Oct 27, 2026
862e52f
composite: the fast path for normal mode with an opacity too
matmen Oct 27, 2026
55733e1
changelog: composite with an opacity, the fixes heading
matmen Oct 27, 2026
604450c
Image#region: a region as a new image, the image unchanged
matmen Oct 27, 2026
86410a7
README: shorter, formats as a table
matmen Oct 27, 2026
16af0cc
README image: a weather card instead of the profile card
matmen Oct 27, 2026
0bf69b3
tests: a photo of smartphones instead of the old photo
matmen Oct 27, 2026
dd0a23f
SVG: patterns
matmen Oct 28, 2026
25ff4a6
notices: resvg (pattern rendering, test cases)
matmen Oct 28, 2026
02ec220
SVG: markers
matmen Oct 28, 2026
c3ccdf2
SVG: images in data URIs
matmen Oct 28, 2026
373822f
SVG: filters
matmen Oct 28, 2026
a627082
SVG filters: turbulence, lighting, feImage, displacement maps
matmen Oct 28, 2026
35a54ac
renderText: OpenType features
matmen Oct 28, 2026
538b5d2
Animation encoders a frame at a time
matmen Oct 28, 2026
ca81ecb
WebP: sharpYuv
matmen Oct 28, 2026
14abb97
Changelog: 3.8.0
matmen Oct 28, 2026
2146c47
release 3.8.0
github-actions[bot] Oct 28, 2026
c6a5e58
benchmark ImageScript 3.8.0
github-actions[bot] Oct 28, 2026
b8dcd7b
Faster JPEG, PNG, GIF and WebP decoding, JPEG encoding
matmen Oct 28, 2026
24d1572
release 3.8.1
github-actions[bot] Oct 28, 2026
874127b
benchmark ImageScript 3.8.1
github-actions[bot] Oct 28, 2026
d18d4db
SVG: mix-blend-mode, isolation, transform-origin, paint-order, contex…
matmen Oct 29, 2026
4a4d6c8
WebP: alphaQuality for lossy images and animations
matmen Oct 29, 2026
986a85d
SVG: text
matmen Oct 29, 2026
a7c9e84
SVG: normalize line ends like XML parsers
matmen Oct 29, 2026
fab901b
Hinting: FreeType's integer arithmetic
matmen Oct 29, 2026
7016bcc
Decoding: apply embedded ICC profiles
matmen Oct 29, 2026
afdd2a5
ICC: don't apply gray profiles to color images
matmen Oct 29, 2026
2070a89
JXL: patches at effort 2
matmen Oct 29, 2026
a356022
release 3.9.0
github-actions[bot] Oct 29, 2026
12015be
benchmark ImageScript 3.9.0
github-actions[bot] Oct 29, 2026
d0642f4
AVIF: encode in worker threads
matmen Oct 29, 2026
1827e49
Test edge runtimes and Chromium in CI
matmen Oct 29, 2026
c09009f
JXL: varblock search in worker threads
matmen Oct 29, 2026
907216c
JXL: decode in worker threads
matmen Oct 29, 2026
5467d0e
Fix CI: Deno type check, AVIF thread test time
matmen Oct 29, 2026
c968009
JXL: encode the remaining stages in worker threads
matmen Oct 29, 2026
e8888eb
JXL: lossless frames straight to bytes, in threads
matmen Oct 29, 2026
4bf2c55
AVIF: decode in worker threads
matmen Oct 29, 2026
5955b04
JXL: faster patch search
matmen Oct 29, 2026
25e9cdb
WebP: lossless encoding in worker threads; measured thresholds
matmen Oct 29, 2026
fc1dcfc
bench: sharp with as many threads as ImageScript
matmen Oct 29, 2026
eae6c43
bench: AVIF and JPEG XL
matmen Oct 29, 2026
7804990
JXL: lossless decoding in threads from 512 KiB on
matmen Oct 29, 2026
a935e54
Fix flaky WebP alphaQuality test
matmen Oct 29, 2026
f5dd224
SVG: faster rasterizer, the same pixels
matmen Oct 30, 2026
f6bcd0f
README: clearer wording, threads for decoding too
matmen Oct 30, 2026
200d446
CHANGELOG: lossless JPEG XL threads from 512 KiB
matmen Oct 30, 2026
7381c94
release 3.10.0
github-actions[bot] Oct 30, 2026
dc518c4
JXL: apply embedded ICC profiles
matmen Oct 30, 2026
a4db5dd
Fix JSR publishing: no global type declarations
matmen Oct 30, 2026
ae7cf3e
benchmark ImageScript 3.10.0
github-actions[bot] Oct 30, 2026
fb000bb
release 3.11.0
github-actions[bot] Oct 30, 2026
9f1a011
AVIF: convert nclx color primaries to sRGB
matmen Oct 30, 2026
012276b
benchmark ImageScript 3.11.0
github-actions[bot] Oct 30, 2026
b9f7596
Fonts: instances of variable fonts
matmen Oct 30, 2026
f916304
Variable fonts in renderText and renderSVG
matmen Oct 30, 2026
6dc81c7
release 3.12.0
github-actions[bot] Oct 30, 2026
1305d3f
WebP: choose lossless transforms by libwebp's entropy analysis
matmen Oct 30, 2026
268ab9a
benchmark ImageScript 3.12.0
github-actions[bot] Oct 30, 2026
60d768d
WebP: color transform after the predictor in lossless encoding
matmen Oct 30, 2026
0fe17af
Docs: move to imagescript.dev
matmen Oct 30, 2026
a394302
Changelog: 3.12.1
matmen Oct 30, 2026
5c723b2
release 3.12.1
github-actions[bot] Oct 30, 2026
fe2b0ef
JPEG: faster encoding, same output
matmen Oct 30, 2026
03d8c56
JPEG: upsample chroma a row at a time when decoding
matmen Oct 30, 2026
5787124
benchmark ImageScript 3.12.1
github-actions[bot] Oct 30, 2026
723cd2d
JPEG: encode like libjpeg-turbo, byte for byte
matmen Oct 31, 2026
ab216b2
package.json: keywords for runtimes and TypeScript
matmen Oct 31, 2026
6786914
package.json: new description
matmen Oct 31, 2026
036f840
Logo: README header, docs favicon, toolbar icon and link previews
matmen Oct 31, 2026
78dcc5e
Changelog: JPEG size changes in 3.12.2
matmen Oct 31, 2026
ffdc18d
release 3.12.2
github-actions[bot] Oct 31, 2026
4730f65
benchmark ImageScript 3.12.2
github-actions[bot] Oct 31, 2026
8d5436e
WebP: lossy decoding ~45% faster, same pixels
matmen Oct 31, 2026
e6d2af0
PNG: default compression level 4
matmen Oct 31, 2026
c357b2f
Changelog: where the PNG default applies
matmen Oct 31, 2026
cf0bae2
Fonts: accept WOFF everywhere
matmen Oct 31, 2026
1d758e1
bench: follow-redirects 1.16.2 (Dependabot alert 6)
matmen Oct 31, 2026
c542fb5
Release: post the notes to Discord
matmen Oct 31, 2026
ba9b044
Hinting: scale the control values like FreeType
matmen Oct 31, 2026
4e7ba21
JPEG XL: drop the unused prefix code writer
matmen Oct 31, 2026
e13b6e8
Tests: the code paths for big endian machines
matmen Oct 31, 2026
5ea1847
Tests: the decoders' and the font parser's rarer paths
matmen Oct 31, 2026
6d757fd
release 3.13.0
github-actions[bot] Oct 31, 2026
7f1febe
benchmark ImageScript 3.13.0
github-actions[bot] Oct 31, 2026
0793e7e
move repo to imagescript/ImageScript
matmen Oct 31, 2026
ec222b7
fix: shorten default creation software tag
matmen Oct 31, 2026
f69d06b
Update changelog for version 3.13.1
matmen Oct 31, 2026
61124b9
release 3.13.1
github-actions[bot] Oct 31, 2026
ddbe3a0
benchmark ImageScript 3.13.1
github-actions[bot] Oct 31, 2026
26e1576
update issue templates
matmen Nov 1, 2026
cdd2008
readme: add playground link
matmen Nov 1, 2026
76e401c
fix playground cta url
matmen Nov 1, 2026
548e6ad
JPEG XL: convert enumerated color spaces to sRGB
matmen Nov 4, 2026
ee09534
Update changelog for version 3.13.2
matmen Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"include": ["dist/**", "src/**"],
"reporter": ["text-summary", "json-summary", "html"],
"report-dir": "coverage"
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/unicode/*.txt text eol=lf
76 changes: 76 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Bug report
description: Something doesn't behave as expected
type: Bug
body:
- type: markdown
attributes:
value: |
Thanks for reporting this! A short script that shows the problem helps us a lot. For questions about using ImageScript, our [Discord](https://discord.gg/8hPrwAH) is a great place.

- type: dropdown
id: area
attributes:
label: What is affected?
options:
- Decoding or encoding an image format
- Image manipulation (resize, crop, rotate, filters, color)
- Compositing or drawing
- Animation (GIF, APNG, WebP)
- Text rendering
- SVG rendering
- Performance or memory usage
- Something else
validations:
required: true

- type: input
id: version
attributes:
label: ImageScript version
placeholder: "3.13.1"
validations:
required: true

- type: input
id: runtime
attributes:
label: Runtime and version
placeholder: "Node.js 22.13, Deno 2.1, Bun 1.2, Chrome 130, Cloudflare Workers, ..."
validations:
required: true

- type: textarea
id: what-happened
attributes:
label: What happened, and what did you expect?
description: Screenshots of the result are welcome.
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Code to reproduce
render: javascript
placeholder: |
import { Image } from 'imagescript';

const image = new Image(64, 64);
// ...
validations:
required: true

- type: textarea
id: files
attributes:
label: Files
description: |
Input images, fonts or SVGs that are needed to reproduce the problem. You can drag and drop them here.
GitHub doesn't accept every format (for example AVIF, JPEG XL or TIFF), so those work best inside a `.zip`.

- type: textarea
id: logs
attributes:
label: Error output
description: Stack trace or console output, if there is any.
render: shell
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Questions and help
url: https://discord.gg/8hPrwAH
about: Ask about using ImageScript in our Discord server.
- name: Security vulnerability
url: https://github.com/imagescript/ImageScript/security/advisories/new
about: Report security issues privately through a GitHub security advisory.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Feature request
description: Suggest a new function, option or format
type: Feature
body:
- type: markdown
attributes:
value: |
Thanks for sharing your idea! Knowing what you're trying to build helps us find the best way to support it.

- type: textarea
id: use-case
attributes:
label: What are you trying to do?
description: Describe your use case and where ImageScript doesn't cover it yet.
validations:
required: true

- type: textarea
id: proposal
attributes:
label: What could the solution look like?
description: A short code sketch of the API you have in mind is perfect, but a description works too.
render: typescript

- type: textarea
id: alternatives
attributes:
label: What do you do today?
description: Workarounds or other libraries you've used for this.
69 changes: 69 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: bench

# runs the library comparison in bench/ and commits the results (results.json, installs.json, charts, README) to the
# default branch. release.yml runs it after a regular release reached npm, measuring the released version; can also
# be run by hand from the Actions tab, measuring the version bench/package.json has (or the one given)
on:
workflow_call:
inputs:
version:
description: ImageScript version to measure (release.yml passes the released one)
type: string
default: ''
workflow_dispatch:
inputs:
version:
description: ImageScript version to measure (empty keeps bench/package.json's)
type: string
default: ''

permissions:
contents: write

concurrency:
group: bench
cancel-in-progress: false

jobs:
bench:
runs-on: ubuntu-latest
defaults:
run:
working-directory: bench
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.repository.default_branch }}
- uses: actions/setup-node@v7
with:
node-version: 24.x

- run: npm ci --no-audit --no-fund
# a version that was just published can take some minutes to show up on the registry (3.6.0 took more than 2.5);
# npm ci cached the package's versions from before, which --prefer-online skips
- if: inputs.version != ''
run: |
for attempt in $(seq 20); do
npm install --save-exact --prefer-online --no-audit --no-fund "imagescript@$VERSION" && exit 0
sleep 30
done
exit 1
env:
VERSION: ${{ inputs.version }}

- run: node run.js
- run: node installs.js
- run: node report.js

# pushes with GITHUB_TOKEN don't trigger other workflows; rebases onto anything pushed meanwhile
- run: |
git add -A .
if git diff --cached --quiet; then echo "nothing changed"; exit 0; fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "benchmark ImageScript $(node -p "require('./node_modules/imagescript/package.json').version")"
for attempt in 1 2 3; do
git push && exit 0
git pull --rebase
done
exit 1
84 changes: 84 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: coverage

# measures the test coverage (npm run coverage) of every pushed branch and pull requests from forks, and how it
# changed: compared with the commit before the push on master, else with where the branch (or pull request) left
# master, measured in the same job. The job summary shows it; pushes to master get it as a commit comment, pushes to a
# branch with a pull request as a comment on it (one, updated by later pushes). Pull requests from forks have no
# write access: only the job summary
on:
push:
branches: ['**']
pull_request:

concurrency:
group: coverage-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-node@v7
with:
node-version: 24.x

- run: npm install
- run: npm run coverage

# the base, measured in a second checkout: skipped without one (a new branch, a force push that dropped it, a
# base from before npm run coverage existed), and a base whose tests fail just gives no comparison
- id: base
continue-on-error: true
run: |
if [ "$EVENT" = pull_request ]; then base=$(git merge-base "$PR_BASE" HEAD); name="the pull request's base"
elif [ "$REF" = refs/heads/master ]; then base=$BEFORE; name="the previous commit on master"
else base=$(git merge-base origin/master HEAD); name="master where the branch left it"; fi
if [ -z "$base" ] || ! git cat-file -e "$base^{commit}" 2>/dev/null || [ "$base" = "$(git rev-parse HEAD)" ]; then
echo "no base to compare with"; exit 0
fi
git worktree add -q ../base "$base"
cd ../base
if ! node -e "process.exit(require('./package.json').scripts?.coverage ? 0 : 1)"; then echo "the base has no npm run coverage"; exit 0; fi
npm install && npm run coverage
echo "summary=$PWD/coverage/coverage-summary.json" >> "$GITHUB_OUTPUT"
echo "root=$PWD" >> "$GITHUB_OUTPUT"
echo "name=$name (${base:0:7})" >> "$GITHUB_OUTPUT"
env:
EVENT: ${{ github.event_name }}
REF: ${{ github.ref }}
BEFORE: ${{ github.event.before }}
PR_BASE: ${{ github.event.pull_request.base.sha }}
- if: steps.base.outputs.summary
run: node scripts/coverage-report.js "$SUMMARY" "$ROOT"
env:
SUMMARY: ${{ steps.base.outputs.summary }}
ROOT: ${{ steps.base.outputs.root }}
BASE_NAME: ${{ steps.base.outputs.name }}
- run: cat coverage/report.md >> "$GITHUB_STEP_SUMMARY"

- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: gh api "repos/$REPOSITORY/commits/$SHA/comments" -F body=@coverage/report.md
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
SHA: ${{ github.sha }}

# the pull request of the pushed branch, if any: its coverage comment is updated, or posted the first time
- if: github.event_name == 'push' && github.ref != 'refs/heads/master'
run: |
pr=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')
if [ -z "$pr" ]; then echo "no pull request"; exit 0; fi
comment=$(gh api "repos/$REPOSITORY/issues/$pr/comments" --paginate --jq '.[] | select(.body | startswith("<!-- coverage -->")) | .id' | head -1)
if [ -n "$comment" ]; then gh api -X PATCH "repos/$REPOSITORY/issues/comments/$comment" -F body=@coverage/report.md
else gh api "repos/$REPOSITORY/issues/$pr/comments" -F body=@coverage/report.md; fi
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
BRANCH: ${{ github.ref_name }}
52 changes: 52 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: docs

# publishes the documentation to GitHub Pages (imagescript.dev). release.yml runs it after a release reached
# npm, so the site documents what is on npm; can also be run by hand from the Actions tab
on:
workflow_call:
inputs:
version:
description: version to document (release.yml passes the released one; empty keeps package.json's)
type: string
default: ''
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24.x

- run: npm install
- if: inputs.version != ''
run: node scripts/version.js "$VERSION"
env:
VERSION: ${{ inputs.version }}
- run: npm run docs

- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: docs

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5
43 changes: 43 additions & 0 deletions .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: jsr

# publishes the TypeScript sources to JSR (@matmen/imagescript), authenticated through GitHub OIDC (the package is
# linked to this repository on jsr.io). release.yml runs it after npm; can also be run by hand from the Actions tab
on:
workflow_call:
inputs:
version:
description: version to publish (release.yml passes the released one; empty keeps jsr.json's)
type: string
default: ''
workflow_dispatch:
inputs:
version:
description: version to publish (empty keeps jsr.json's)
type: string
default: ''

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: jsr
url: https://jsr.io/@matmen/imagescript/versions
steps:
- uses: actions/checkout@v7
- if: inputs.version != ''
uses: actions/setup-node@v7
with:
node-version: 24.x
- if: inputs.version != ''
run: node scripts/version.js "$VERSION"
env:
VERSION: ${{ inputs.version }}
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
# setting the version changes files, which deno publish otherwise refuses
- run: deno publish --allow-dirty
Loading