Skip to content

Commit 2bd8740

Browse files
rauhryancowboydjboldanatemoo-reghostdevv
authored
Update transitions branch with upstream changes (#53)
* ✨ add snapshot() for pre-packing directive subtrees Introduces a new `snapshot(ops)` constructor that pre-packs a directive array into its transfer encoding. The returned opaque `Op` can be spliced into any directive array, and during packing its bytes are copied directly into the command buffer without re-encoding. This enables higher-level frameworks to implement dirty tracking: unchanged component subtrees can reuse a cached snapshot, skipping the per-frame packing cost entirely. * docs: add maintainer build guide * 💄 format build docs * 🐛 improve pack string overflow errors * os matrix test in ci (#36) * 🧼 optimize build * 🧼 compress bundled wasm * 🧼 optimize wcwidth.c size * ⚙️ update npm settings * 🐛 install wasm-opt in ci * ⚡ use brotli-11 + z85 wasm encoding * 📌 pin @types/node to v22 * 🧼 apply @ghostdevv review suggestions from PR #35 Co-Authored-By: ghostdevv <git@willow.sh> * 🔨 add type to bundle-wasm * 💌 signed, sealed, delivered * chore: use hashes for versions * chore: don't save git credentials * chore: use array syntax for some reason the schema for the actions wants it to be an array * perf: set concurrency limits to reduce cost and improve dx Without this it means that, for example, if I push a change to a PR then shortly push again this workflow will be running twice. This change will cancel the old run before starting the new one, which reduces the overall actions cost and DX as you don't have extra runs * chore: use hashes for versions * chore: update node version * perf: set concurrency limits to reduce cost and improve dx Without this it means that, for example, if I push a change to a PR then shortly push again this workflow will be running twice. This change will cancel the old run before starting the new one, which reduces the overall actions cost and DX as you don't have extra runs * chore: don't save git credentials * chore: mitigate potential template injection See https://docs.zizmor.sh/audits/#template-injection * chore: update ::set-output command to new syntax https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * chore: use hashes for versions * chore: don't save git credentials * chore: limit id-token permission to the publishing steps * chore: explicitly disable npm cache to mitigate cache poisoning attacks * chore: mitigate potential template injection See https://docs.zizmor.sh/audits/#template-injection * chore: use oidc This should be using OIDC for publishing * chore: update ::set-output command to new syntax https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * 🙅 revert aggressive optimization experiments pending benchmark Reverts three changes that need benchmarks before landing: - -Oz / wasm-opt - brotli+Z85 wasm compression - wcwidth.c rewrite * Add CodSpeed performance benchmarks * 🔨 use deno * 🧼 deno fmt * ⚙️ vitest -> tinybench * 🧼 remove codspeed assets * 🔨 fix ci * add type module * fmt * chore: update github url (#38) * downgrade to tinybench@5 * move to examples folder with readme * 🔧 export animating from wasm build * 🧪 cover transitions in snapshots and validation * ✅ enforce nonnegative transition duration --------- Co-authored-by: Charles Lowell <cowboyd@frontside.com> Co-authored-by: Jacob Bolda <me@jacobbolda.com> Co-authored-by: Nate Moore <nate@natemoo.re> Co-authored-by: ghostdevv <git@willow.sh> Co-authored-by: Nate Moore <git@natemoo.re> Co-authored-by: codspeed-hq[bot] <117304815+codspeed-hq[bot]@users.noreply.github.com> Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
1 parent 949dea5 commit 2bd8740

31 files changed

Lines changed: 1478 additions & 91 deletions

.github/workflows/benchmark.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Benchmark
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
# `workflow_dispatch` allows CodSpeed to trigger backtest
9+
# performance analysis in order to generate initial data.
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
jobs:
17+
benchmarks:
18+
name: Run benchmarks
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: true
26+
27+
- name: Setup Deno
28+
uses: denoland/setup-deno@v2
29+
with:
30+
deno-version: v2.x
31+
32+
- name: Setup Node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
37+
- name: Build WASM
38+
run: make
39+
40+
- name: Install dependencies
41+
run: deno install
42+
43+
- name: Run benchmarks
44+
uses: CodSpeedHQ/action@v4
45+
with:
46+
mode: simulation
47+
# IMPORTANT! deno task bench fails in CI due to incompatible V8 bindings
48+
run: node bench/mod.ts

.github/workflows/preview.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@ on: [pull_request]
55
permissions:
66
contents: read
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
preview:
1014
runs-on: ubuntu-latest
1115
timeout-minutes: 10
1216
steps:
1317
- name: checkout
14-
uses: actions/checkout@v4
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1519
with:
1620
fetch-depth: 0
1721
submodules: true
22+
persist-credentials: false
1823

1924
- name: setup deno
20-
uses: denoland/setup-deno@v2
25+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
2126
with:
2227
deno-version: v2.x
2328

@@ -26,16 +31,17 @@ jobs:
2631

2732
- name: Get Version
2833
id: vars
29-
run: echo ::set-output name=version::$(git describe --abbrev=0 --tags | sed 's/^v//')-pr+$(git rev-parse HEAD)
34+
run: echo "version=$(git describe --abbrev=0 --tags | sed 's/^v//')-pr+$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
3035

3136
- name: Setup Node
32-
uses: actions/setup-node@v4
37+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3338
with:
34-
node-version: 20.x
35-
registry-url: https://registry.npmjs.com
39+
node-version: 24
3640

3741
- name: Build NPM
38-
run: deno task build:npm ${{steps.vars.outputs.version}}
42+
run: deno task build:npm "${STEPS_VARS_OUTPUTS_VERSION}"
43+
env:
44+
STEPS_VARS_OUTPUTS_VERSION: ${{steps.vars.outputs.version}}
3945

4046
- name: Publish Preview Versions
4147
run: npx pkg-pr-new publish './build/npm'

.github/workflows/publish.yml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ on:
77

88
permissions:
99
contents: read
10-
id-token: write
1110

1211
jobs:
1312
verify-jsr:
1413
runs-on: ubuntu-latest
1514
steps:
1615
- name: checkout
17-
uses: actions/checkout@v4
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1817
with:
1918
submodules: true
19+
persist-credentials: false
2020

2121
- name: setup deno
22-
uses: denoland/setup-deno@v2
22+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
2323
with:
2424
deno-version: v2.x
2525

@@ -28,10 +28,12 @@ jobs:
2828

2929
- name: Get Version
3030
id: vars
31-
run: echo ::set-output name=version::$(echo ${{github.ref_name}} | sed 's/^v//')
31+
run: echo "version=$(echo "${GITHUB_REF_NAME}" | sed 's/^v//')" >> $GITHUB_OUTPUT
3232

3333
- name: Build JSR
34-
run: deno task build:jsr ${{steps.vars.outputs.version}}
34+
run: deno task build:jsr "${STEPS_VARS_OUTPUTS_VERSION}"
35+
env:
36+
STEPS_VARS_OUTPUTS_VERSION: ${{steps.vars.outputs.version}}
3537

3638
- name: dry run publish
3739
run: deno publish --dry-run --allow-dirty
@@ -40,12 +42,13 @@ jobs:
4042
runs-on: ubuntu-latest
4143
steps:
4244
- name: checkout
43-
uses: actions/checkout@v4
45+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4446
with:
4547
submodules: true
48+
persist-credentials: false
4649

4750
- name: setup deno
48-
uses: denoland/setup-deno@v2
51+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
4952
with:
5053
deno-version: v2.x
5154

@@ -54,38 +57,47 @@ jobs:
5457

5558
- name: Get Version
5659
id: vars
57-
run: echo ::set-output name=version::$(echo ${{github.ref_name}} | sed 's/^v//')
60+
run: echo "version=$(echo "${GITHUB_REF_NAME}" | sed 's/^v//')" >> $GITHUB_OUTPUT
5861

5962
- name: Setup Node
60-
uses: actions/setup-node@v6
63+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
6164
with:
6265
node-version: 24
66+
package-manager-cache: false
67+
cache: ""
6368

6469
- name: Build NPM
65-
run: deno task build:npm ${{steps.vars.outputs.version}}
70+
run: deno task build:npm "${STEPS_VARS_OUTPUTS_VERSION}"
71+
env:
72+
STEPS_VARS_OUTPUTS_VERSION: ${{steps.vars.outputs.version}}
6673

6774
- name: dry run publish
6875
run: npm publish --dry-run --tag=verify
6976
working-directory: ./build/npm
7077

7178
- name: upload build
72-
uses: actions/upload-artifact@v4
79+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
7380
with:
7481
name: npm-build
7582
path: ./build/npm
7683

7784
publish-npm:
7885
needs: [verify-jsr, verify-npm]
7986
runs-on: ubuntu-latest
87+
permissions:
88+
contents: read
89+
id-token: write
8090

8191
steps:
8292
- name: Setup Node
83-
uses: actions/setup-node@v6
93+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
8494
with:
8595
node-version: 24
96+
package-manager-cache: false
97+
cache: ""
8698

8799
- name: download build
88-
uses: actions/download-artifact@v4
100+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
89101
with:
90102
name: npm-build
91103
path: ./build/npm
@@ -97,15 +109,19 @@ jobs:
97109
publish-jsr:
98110
needs: [verify-jsr, verify-npm]
99111
runs-on: ubuntu-latest
112+
permissions:
113+
contents: read
114+
id-token: write
100115

101116
steps:
102117
- name: checkout
103-
uses: actions/checkout@v4
118+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104119
with:
105120
submodules: true
121+
persist-credentials: false
106122

107123
- name: setup deno
108-
uses: denoland/setup-deno@v2
124+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
109125
with:
110126
deno-version: v2.x
111127

@@ -114,10 +130,12 @@ jobs:
114130

115131
- name: Get Version
116132
id: vars
117-
run: echo ::set-output name=version::$(echo ${{github.ref_name}} | sed 's/^v//')
133+
run: echo "version=$(echo "${GITHUB_REF_NAME}" | sed 's/^v//')" >> $GITHUB_OUTPUT
118134

119135
- name: Build JSR
120-
run: deno task build:jsr ${{steps.vars.outputs.version}}
136+
run: deno task build:jsr "${STEPS_VARS_OUTPUTS_VERSION}"
137+
env:
138+
STEPS_VARS_OUTPUTS_VERSION: ${{steps.vars.outputs.version}}
121139

122140
- name: Publish JSR
123-
run: deno publish --allow-dirty --token=${{ secrets.JSR_TOKEN }}
141+
run: deno publish --allow-dirty

.github/workflows/verify.yaml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,32 @@ name: Verify
22

33
on:
44
push:
5-
branches: main
5+
branches:
6+
- main
67
pull_request:
7-
branches: main
8+
branches:
9+
- main
810

911
permissions:
1012
contents: read
1113

14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
1218
jobs:
1319
test:
1420
runs-on: ubuntu-latest
1521

1622
steps:
1723
- name: checkout
18-
uses: actions/checkout@v4
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1925
with:
2026
submodules: true
27+
persist-credentials: false
2128

2229
- name: setup deno
23-
uses: denoland/setup-deno@v2
30+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
2431
with:
2532
deno-version: v2.x
2633

@@ -33,6 +40,45 @@ jobs:
3340
- name: build wasm
3441
run: make
3542

43+
- name: upload wasm artifact
44+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
45+
with:
46+
name: clayterm-wasm
47+
path: |
48+
clayterm.wasm
49+
wasm.ts
50+
51+
test-alt-os:
52+
needs: test
53+
strategy:
54+
matrix:
55+
os:
56+
- name: macos
57+
value: macos-latest
58+
- name: windows
59+
value: windows-latest
60+
fail-fast: false
61+
runs-on: ${{ matrix.os.value }}
62+
name: test ${{ matrix.os.name }}
63+
64+
steps:
65+
- name: checkout
66+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
67+
with:
68+
submodules: true
69+
persist-credentials: false
70+
71+
- name: setup deno
72+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
73+
with:
74+
deno-version: v2.x
75+
76+
- name: download wasm artifact
77+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
78+
with:
79+
name: clayterm-wasm
80+
path: .
81+
3682
- name: test
3783
run: deno task test
3884

@@ -41,12 +87,13 @@ jobs:
4187
runs-on: ubuntu-latest
4288
steps:
4389
- name: checkout
44-
uses: actions/checkout@v4
90+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4591
with:
4692
submodules: true
93+
persist-credentials: false
4794

4895
- name: setup deno
49-
uses: denoland/setup-deno@v2
96+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
5097
with:
5198
deno-version: v2.x
5299

@@ -64,17 +111,18 @@ jobs:
64111
runs-on: ubuntu-latest
65112
steps:
66113
- name: checkout
67-
uses: actions/checkout@v4
114+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
68115
with:
69116
submodules: true
117+
persist-credentials: false
70118

71119
- name: setup deno
72-
uses: denoland/setup-deno@v2
120+
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
73121
with:
74122
deno-version: v2.x
75123

76124
- name: Setup Node
77-
uses: actions/setup-node@v4
125+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
78126
with:
79127
node-version: 24
80128

0 commit comments

Comments
 (0)