Skip to content

Commit 6b6e30b

Browse files
committed
chore(javascript): Update napi to 3
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent ec8d22e commit 6b6e30b

File tree

8 files changed

+3548
-1921
lines changed

8 files changed

+3548
-1921
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,21 +241,28 @@ jobs:
241241
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
242242
build: |-
243243
set -e &&
244-
rustup toolchain install 1.83 &&
245-
rustup default 1.83 &&
244+
npm install -g n && n 22 &&
245+
rustup toolchain install stable &&
246+
rustup default stable &&
246247
yarn build --target x86_64-unknown-linux-gnu &&
247248
strip *.node
248249
- host: ubuntu-22.04
249250
target: x86_64-unknown-linux-musl
250251
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
251-
build: set -e && yarn build && strip *.node
252+
build: |-
253+
set -e &&
254+
wget -qO- https://unofficial-builds.nodejs.org/download/release/v22.16.0/node-v22.16.0-linux-x64-musl.tar.gz | tar -xz -C /usr/local --strip-components=1 &&
255+
rustup toolchain install stable &&
256+
rustup default stable &&
257+
yarn build && strip *.node
252258
- host: ubuntu-22.04
253259
target: aarch64-unknown-linux-gnu
254260
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
255261
build: |-
256262
set -e &&
257-
rustup toolchain install 1.83 &&
258-
rustup default 1.83 &&
263+
npm install -g n && n 22 &&
264+
rustup toolchain install stable &&
265+
rustup default stable &&
259266
rustup target add aarch64-unknown-linux-gnu &&
260267
yarn build --target aarch64-unknown-linux-gnu &&
261268
aarch64-unknown-linux-gnu-strip *.node
@@ -272,6 +279,9 @@ jobs:
272279
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
273280
build: |-
274281
set -e &&
282+
wget -qO- https://unofficial-builds.nodejs.org/download/release/v22.16.0/node-v22.16.0-linux-x64-musl.tar.gz | tar -xz -C /usr/local --strip-components=1 &&
283+
rustup toolchain install stable &&
284+
rustup default stable &&
275285
rustup target add aarch64-unknown-linux-musl &&
276286
yarn build --target aarch64-unknown-linux-musl &&
277287
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
@@ -286,8 +296,8 @@ jobs:
286296
yarn build --target armv7-linux-androideabi
287297
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
288298
node:
289-
- "18"
290299
- "20"
300+
- "22"
291301

292302
name: NodeJS ${{ matrix.node }} on ${{ matrix.settings.target }}
293303
runs-on: ${{ matrix.settings.host }}
@@ -456,7 +466,7 @@ jobs:
456466
if: matrix.settings.target == 'armv7-unknown-linux-gnueabihf'
457467
uses: addnab/docker-run-action@v3
458468
with:
459-
image: node:${{ matrix.node }}-bullseye-slim
469+
image: node:${{ matrix.node }}-bookworm-slim
460470
options: "--platform linux/arm/v7 --network host -v ${{ github.workspace }}:/build -w /build/bindings/javascript"
461471
run: |
462472
set -e

bindings/javascript/.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
linker = "aarch64-linux-musl-gcc"
33
rustflags = ["-C", "target-feature=-crt-static"]
44

5+
[target.armv7-unknown-linux-gnueabihf]
6+
linker = "arm-linux-gnueabihf-gcc"
7+
58
[target.wasm32-unknown-unknown]
69
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]

bindings/javascript/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
### Changed
66

7+
- Update `napi` to `3`.
78
- Update `cssparser` to `0.36`.
89
- Update `html5ever` to `0.36`.
910
- Update `selectors` to `0.33`.
11+
- Bump MSRV to `1.88`.
12+
- Drop Node.js 18 support.
1013

1114
### Performance
1215

bindings/javascript/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/Stranger6667/css-inline"
99
keywords = ["css", "html", "email", "stylesheet", "inlining"]
1010
categories = ["web-programming"]
1111
license = "MIT"
12-
rust-version = "1.80"
12+
rust-version = "1.88"
1313
include = ["src/*.rs", "LICENSE", "README.md", "CHANGELOG.md"]
1414

1515
[lib]
@@ -22,8 +22,8 @@ mimalloc = "0.1"
2222
mimalloc = { version = "0.1", features = ["local_dynamic_tls"] }
2323

2424
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
25-
napi = { version = "2.16.0", default-features = false, features = ["napi4"] }
26-
napi-derive = "2.16.0"
25+
napi = { version = "3", default-features = false, features = ["napi4"] }
26+
napi-derive = "3"
2727

2828
[target.'cfg(target_arch = "wasm32")'.dependencies]
2929
wasm-bindgen = "=0.2.106"
@@ -43,7 +43,7 @@ version = "*"
4343
default-features = false
4444

4545
[build-dependencies]
46-
napi-build = ">=2.1.0, <2.3"
46+
napi-build = "2"
4747

4848
[profile.release]
4949
lto = true

bindings/javascript/js-binding.d.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
/* tslint:disable */
1+
/* auto-generated by NAPI-RS */
22
/* eslint-disable */
3+
/** Inline CSS styles from <style> tags to matching elements in the HTML tree and return a string. */
4+
export declare function inline(html: string, options?: Options | undefined | null): string
35

4-
/* auto-generated by NAPI-RS */
6+
/** Inline CSS styles into an HTML fragment. */
7+
export declare function inlineFragment(html: string, css: string, options?: Options | undefined | null): string
58

6-
export interface StylesheetCache {
7-
/** Cache size. */
8-
size: number
9-
}
109
export interface Options {
1110
/**
1211
* Whether to inline CSS from "style" tags.
@@ -37,9 +36,11 @@ export interface Options {
3736
*/
3837
preallocateNodeCapacity?: number
3938
}
40-
/** Inline CSS styles from <style> tags to matching elements in the HTML tree and return a string. */
41-
export declare function inline(html: string, options?: Options | undefined | null): string
42-
/** Inline CSS styles into an HTML fragment. */
43-
export declare function inlineFragment(html: string, css: string, options?: Options | undefined | null): string
39+
40+
export interface StylesheetCache {
41+
/** Cache size. */
42+
size: number
43+
}
44+
4445
/** Get the package version. */
4546
export declare function version(): string

0 commit comments

Comments
 (0)