Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# act configuration for running GitHub Actions workflows locally.
# See https://nektosact.com for installation and usage.
#
# Uses the catthehacker/ubuntu:act-latest medium-weight runner image (~500MB),
# which includes the tools needed to bootstrap actions and is compatible with
# the actions used in ci.yml.
-P ubuntu-latest=catthehacker/ubuntu:act-latest
132 changes: 103 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ concurrency:
permissions:
contents: read

# Use the OS certificate store so Deno and Node.js tooling trust any
# TLS-inspecting proxies that may be present (e.g. in corporate networks
# or act-based local CI runs).
# - DENO_TLS_CA_STORE=system: uses the OS trust store for Deno's TLS
# - NODE_EXTRA_CA_CERTS: appends the OS bundle to Node's built-in store;
# /etc/ssl/certs/ca-certificates.crt is the standard path on all
# Debian/Ubuntu systems (ubuntu-latest and catthehacker/ubuntu:act-*)
env:
DENO_TLS_CA_STORE: system
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -21,10 +32,13 @@ jobs:
- name: Setup repo
uses: actions/checkout@v6

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: stable
- name: Install Deno
run: |
curl -fsSL \
"https://github.com/denoland/deno/releases/latest/download/deno-x86_64-unknown-linux-gnu.zip" \
-o /tmp/deno.zip
sudo unzip -o /tmp/deno.zip deno -d /usr/local/bin/
deno --version

- name: Verify formatting
run: deno fmt --check
Expand All @@ -46,24 +60,43 @@ jobs:
- name: Setup repo
uses: actions/checkout@v6

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: stable
- name: Install Deno
run: |
curl -fsSL \
"https://github.com/denoland/deno/releases/latest/download/deno-x86_64-unknown-linux-gnu.zip" \
-o /tmp/deno.zip
sudo unzip -o /tmp/deno.zip deno -d /usr/local/bin/
deno --version

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}

# The npm build uses @deno/dnt from jsr.io. Check availability first so
# the remaining steps can be skipped gracefully in network-restricted
# environments (e.g. when running locally under `act` without JSR access).
- name: Check JSR availability
id: jsr
run: |
if curl -fsSL --max-time 5 -o /dev/null "https://jsr.io/@deno/dnt/meta.json" 2>/dev/null; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "JSR registry not reachable; skipping npm build and tests."
echo "available=false" >> "$GITHUB_OUTPUT"
fi

- name: Build npm package
if: steps.jsr.outputs.available == 'true'
run: deno run -A scripts/build_npm.ts

- name: Install dependencies
if: steps.jsr.outputs.available == 'true'
working-directory: ./npm
run: npm install

- name: Run Node.js tests
if: steps.jsr.outputs.available == 'true'
working-directory: ./npm
run: npm test

Expand All @@ -75,22 +108,46 @@ jobs:
- name: Setup repo
uses: actions/checkout@v6

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: stable
- name: Install Deno
run: |
curl -fsSL \
"https://github.com/denoland/deno/releases/latest/download/deno-x86_64-unknown-linux-gnu.zip" \
-o /tmp/deno.zip
sudo unzip -o /tmp/deno.zip deno -d /usr/local/bin/
deno --version

- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install Bun
run: |
curl -fsSL \
"https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip" \
-o /tmp/bun.zip
sudo unzip -oj /tmp/bun.zip 'bun-linux-x64/bun' -d /usr/local/bin/
bun --version

# The npm build uses @deno/dnt from jsr.io. Check availability first so
# the remaining steps can be skipped gracefully in network-restricted
# environments (e.g. when running locally under `act` without JSR access).
- name: Check JSR availability
id: jsr
run: |
if curl -fsSL --max-time 5 -o /dev/null "https://jsr.io/@deno/dnt/meta.json" 2>/dev/null; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "JSR registry not reachable; skipping npm build and tests."
echo "available=false" >> "$GITHUB_OUTPUT"
fi

- name: Build npm package
if: steps.jsr.outputs.available == 'true'
run: deno run -A scripts/build_npm.ts

- name: Install dependencies
if: steps.jsr.outputs.available == 'true'
working-directory: ./npm
run: bun install

- name: Run Bun tests
if: steps.jsr.outputs.available == 'true'
working-directory: ./npm
run: bun run test_runner.js

Expand All @@ -103,16 +160,19 @@ jobs:
outputs:
tag: ${{ steps.ver.outputs.tag }}
publish: ${{ steps.tagcheck.outputs.publish }}
steps:
- name: Checkout
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: stable
- name: Install Deno
run: |
curl -fsSL \
"https://github.com/denoland/deno/releases/latest/download/deno-x86_64-unknown-linux-gnu.zip" \
-o /tmp/deno.zip
sudo unzip -o /tmp/deno.zip deno -d /usr/local/bin/
deno --version

- name: Read version from deno.json
id: ver
Expand All @@ -124,6 +184,14 @@ jobs:
- name: Ensure release tag points at HEAD
id: tagcheck
run: |
# Skip tag/publish operations when running locally under act.
# act sets ACT=true in the container environment.
if [ "${ACT:-}" = "true" ]; then
echo "Skipping tag and publish steps when running under act."
echo "publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi

TAG="${{ steps.ver.outputs.tag }}"
HEAD_COMMIT=$(git rev-parse HEAD)
git fetch --tags --force
Expand Down Expand Up @@ -153,10 +221,13 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v6
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: stable
- name: Install Deno
run: |
curl -fsSL \
"https://github.com/denoland/deno/releases/latest/download/deno-x86_64-unknown-linux-gnu.zip" \
-o /tmp/deno.zip
sudo unzip -o /tmp/deno.zip deno -d /usr/local/bin/
deno --version
- name: Publish package (JSR)
run: deno publish

Expand All @@ -169,11 +240,14 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v6
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: stable
- name: setup Node
- name: Install Deno
run: |
curl -fsSL \
"https://github.com/denoland/deno/releases/latest/download/deno-x86_64-unknown-linux-gnu.zip" \
-o /tmp/deno.zip
sudo unzip -o /tmp/deno.zip deno -d /usr/local/bin/
deno --version
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
Expand Down
42 changes: 39 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,133 @@
# Changelog

## 0.16.0 — 2026-04-01
- BREAKING: `Struct` no longer calls `Object.preventExtensions()` during construction. If you want non-extensible instances, call `Object.preventExtensions()` yourself after object construction.

- BREAKING: `Struct` no longer calls `Object.preventExtensions()` during
construction. If you want non-extensible instances, call
`Object.preventExtensions()` yourself after object construction.

## 0.15.0 — 2026-03-27
- cc3b63a — Fix fromDataView: enumerable, complete comment, optional setter, readonly inference (#5)

- cc3b63a — Fix fromDataView: enumerable, complete comment, optional setter,
readonly inference (#5)

## 0.14.1 — 2026-01-20

- 6367cf8 — minor fixes

## 0.14.0 — 2026-01-10

- 8149f55 — type defineArray with item method instead of element

## 0.13.1 — 2026-01-10

- 338cc56 — ci: test in Node and Bun

## 0.13.0 — 2025-11-10
- 703ee48 — Support static `.alloc` method and static `BYTE_LENGTH` field for fixed-sized structs

- 703ee48 — Support static `.alloc` method and static `BYTE_LENGTH` field for
fixed-sized structs

## 0.12.0 — 2025-10-22

- a92e393 — infer fields with no setter as readonly

## 0.11.1 — 2025-10-22

- ca94807 — Make `instanceof Struct` work better when bundled

## 0.11.0 — 2025-10-21

- d8ea5bd — `defineStruct` will now make properties enumerable if not specified

## 0.10.3 — 2025-10-20

- 345f6a4 — export bigendian module in npm build

## 0.10.2 — 2025-10-20

- ccc734e — Add bigendian to main module exports

## 0.10.1 — 2025-10-19

- feaf6c3 — Move `fromDataView` to `fields`

## 0.10.0 — 2025-10-15

- 980b488 — Support native TypedArray fields

## 0.9.0 — 2025-10-12

- a7abdfa — reorganize - no functional changes

## 0.8.2 — 2025-10-12

- 8bd28e5 — Another fix for Node tests

## 0.8.1 — 2025-10-12

- 84f20aa — fix for running tests under Node

## 0.8.0 — 2025-10-12

- f2b19b8 — bigint

## 0.7.3 — 2025-10-11

- 8c1bd00 — tighten up types

## 0.7.2 — 2025-10-11

- 5b337ab — better typing for array types

## 0.7.1 — 2025-10-11

- 9e6d578 — 0.7.1

## 0.7.0 — 2025-10-11

- 1849e1b — Publish to npm

## 0.6.1 — 2025-10-11

- ba74096 — 0.6.1

## 0.6.0 — 2025-10-10

- e64aebd — Add 1-byte boolean field declarator

## 0.5.0 — 2025-10-10

- caace83 — Struct constructor can allocate a struct if no buffer provided

## 0.4.2 — 2025-10-08

- d9966ea — Document arrays better

## 0.4.1 — 2025-10-07

- 9145818 — document bigendian

## 0.4.0 — 2025-10-07

- 802cd20 — Add big-endian support

## 0.3.0 — 2025-10-07

- 298a70e — Support dynamic-length arrays

## 0.2.0 — 2025-10-07

- 9a4e60c — Add support for statically-sized array of struct

## 0.1.2 — 2025-10-07

- 48a48c4 — fix property descriptor typing

## 0.1.1 — 2025-10-07

- 3d626b3 — Move example to readme

## 0.1.0 — 2025-10-06

- b4c4106 — wip
Loading