Skip to content

Commit b01facc

Browse files
authored
feat: upgrade to NAPI-RS 3.0 stable (#84)
1 parent 3d6b07e commit b01facc

File tree

9 files changed

+947
-1609
lines changed

9 files changed

+947
-1609
lines changed

.github/workflows/CI.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
target: i686-pc-windows-msvc
6868
- host: ubuntu-latest
6969
target: x86_64-unknown-linux-gnu
70-
build: CC=clang yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
70+
build: TARGET_CC=clang yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
7171
- host: ubuntu-latest
7272
target: x86_64-unknown-linux-musl
7373
build: yarn build --target x86_64-unknown-linux-musl -x
@@ -76,10 +76,10 @@ jobs:
7676
build: yarn build --target aarch64-apple-darwin
7777
- host: ubuntu-latest
7878
target: aarch64-unknown-linux-gnu
79-
build: CC=clang yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
79+
build: TARGET_CC=clang yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
8080
- host: ubuntu-latest
8181
target: armv7-unknown-linux-gnueabihf
82-
build: CC=clang yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross
82+
build: TARGET_CC=clang yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross
8383
- host: ubuntu-latest
8484
target: aarch64-linux-android
8585
build: yarn build --target aarch64-linux-android
@@ -92,15 +92,16 @@ jobs:
9292
- host: ubuntu-latest
9393
target: powerpc64le-unknown-linux-gnu
9494
build: |
95-
sudo apt-get update
96-
sudo apt-get install -y gcc-powerpc64le-linux-gnu
97-
yarn build --target powerpc64le-unknown-linux-gnu
95+
export CC=clang
96+
export TARGET_CC=clang
97+
yarn build --target powerpc64le-unknown-linux-gnu --use-napi-cross
9898
- host: ubuntu-latest
9999
target: s390x-unknown-linux-gnu
100100
build: |
101-
sudo apt-get update
102-
sudo apt-get install -y gcc-s390x-linux-gnu
103-
yarn build --target s390x-unknown-linux-gnu
101+
export CC=clang
102+
export TARGET_CC=clang
103+
export CFLAGS="-fuse-ld=lld"
104+
yarn build --target s390x-unknown-linux-gnu --use-napi-cross
104105
- host: windows-latest
105106
target: aarch64-pc-windows-msvc
106107
build: yarn build --target aarch64-pc-windows-msvc
@@ -111,15 +112,15 @@ jobs:
111112
tar -xvf wasi-sdk-25.0-x86_64-linux.tar.gz
112113
export WASI_SDK_PATH="$(pwd)/wasi-sdk-25.0-x86_64-linux"
113114
yarn build --target wasm32-wasip1-threads
114-
name: stable - ${{ matrix.settings.target }} - node@20
115+
name: stable - ${{ matrix.settings.target }} - node@22
115116
runs-on: ${{ matrix.settings.host }}
116117
steps:
117118
- uses: actions/checkout@v4
118119
- name: Setup node
119120
uses: actions/setup-node@v4
120121
if: ${{ !matrix.settings.docker }}
121122
with:
122-
node-version: 20
123+
node-version: 22
123124
cache: yarn
124125
- name: Download tar.node
125126
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
@@ -140,7 +141,7 @@ jobs:
140141
- uses: goto-bus-stop/setup-zig@v2
141142
if: ${{ contains(matrix.settings.target, 'musl') }}
142143
with:
143-
version: 0.13.0
144+
version: 0.14.1
144145
- name: Install cargo-zigbuild
145146
uses: taiki-e/install-action@v2
146147
if: ${{ contains(matrix.settings.target, 'musl') }}
@@ -172,7 +173,7 @@ jobs:
172173
- uses: actions/checkout@v4
173174
- name: Build
174175
id: build
175-
uses: cross-platform-actions/action@v0.28.0
176+
uses: cross-platform-actions/action@v0.29.0
176177
env:
177178
DEBUG: napi:*
178179
RUSTUP_IO_THREADS: 1
@@ -184,7 +185,7 @@ jobs:
184185
environment_variables: DEBUG RUSTUP_IO_THREADS
185186
shell: bash
186187
run: |
187-
sudo pkg install -y -f curl node libnghttp2 npm
188+
sudo pkg install -y -f curl node libnghttp2 npm cmake
188189
sudo npm install -g yarn --ignore-scripts
189190
curl https://sh.rustup.rs -sSf --output rustup.sh
190191
sh rustup.sh -y --profile minimal --default-toolchain beta

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@ bzip2 = "0.6"
1515
flate2 = "1"
1616
infer = "0.19"
1717
lzma-rs = { version = "0.3", features = ["stream"] }
18-
napi = { version = "2", features = ["anyhow", "napi6"] }
19-
napi-derive = "2"
18+
napi = { version = "3", features = ["anyhow", "napi6"] }
19+
napi-derive = "3"
2020
tar = "0.4"
2121

2222
[target.'cfg(all(not(target_os = "linux"), not(target_os = "freebsd"), not(target_arch = "x86"), not(target_family = "wasm")))'.dependencies]
23-
mimalloc = "0.1"
23+
mimalloc-safe = "0.1"
2424

2525
[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies]
26-
mimalloc = { version = "0.1", features = ["local_dynamic_tls"] }
26+
mimalloc-safe = { version = "0.1", features = ["local_dynamic_tls"] }
2727

2828
[build-dependencies]
2929
napi-build = "2"
3030

3131
[profile.release]
3232
codegen-units = 1
3333
lto = true
34+
strip = "symbols"

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* eslint-disable */
33
export declare class Archive {
44
/** Create a new archive with the underlying path. */
5-
constructor(input: string | Buffer)
5+
constructor(input: string | Uint8Array)
66
entries(): Entries
77
/**
88
* Unpacks the contents tarball into the specified `dst`.

0 commit comments

Comments
 (0)