Skip to content

Commit dc7b1b0

Browse files
authored
chore: bump napi-rs to v3 (#485)
This commit migrates the code base to napi.rs v3, drops `linux-riscv64-gnu` and `darwin-universal` binaries and removes node 16 from the testing matrix. BREAKING CHANGE: dropped `linux-riscv64-gnu` and `darwin-universal` binaries
1 parent 3e5cf55 commit dc7b1b0

File tree

41 files changed

+2491
-820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2491
-820
lines changed

.github/workflows/build-and-test.yml

Lines changed: 62 additions & 243 deletions
Large diffs are not rendered by default.

Cargo.lock

Lines changed: 53 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ chrono = "0.4.41"
1212
chrono-tz = "0.10.4"
1313
indexmap = "2.10.0"
1414
itertools = "0.14.0"
15-
# Default enable napi5 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
16-
napi = { version = "2.16.17", default-features = false, features = ["napi5"] }
17-
napi-derive = "2.16.13"
15+
napi = "3.2.3"
16+
napi-derive = "3.2.3"
1817
replace_with = "0.1.8"
1918
rrule = { version = "0.14.0", features = ["exrule"] }
2019

2120
[build-dependencies]
22-
napi-build = "2.2.2"
21+
napi-build = "2.2.3"
2322

2423
[profile.release]
2524
lto = true

benchmark/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ function suite(tzid: string) {
6464
}
6565

6666
Promise.all([
67-
b.suite('UTC TZ', ...suite('UTC')).then(console.log),
67+
b.suite('UTC TZ', ...suite('UTC')),
6868
b.suite('Other TZ', ...suite('Pacific/Kiritimati')),
6969
]).catch(console.error);

lib/js/rrule_set.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ impl RRuleSet {
171171
return Ok(iter.take(limit as usize).collect());
172172
}
173173

174+
// TODO: use array instead
174175
Ok(iter.collect())
175176
}
176177

@@ -199,13 +200,13 @@ impl RRuleSet {
199200
}
200201

201202
#[napi(ts_return_type = "number[]")]
202-
pub fn between(
203-
&self,
204-
env: Env,
203+
pub fn between<'a>(
204+
&'a self,
205+
env: &'a Env,
205206
after_datetime: i64,
206207
before_datetime: i64,
207208
inclusive: Option<bool>,
208-
) -> napi::Result<Array> {
209+
) -> napi::Result<Array<'a>> {
209210
let mut arr = env.create_array(0).unwrap();
210211
let timezone = self.rrule_set.dtstart().timezone();
211212
let after_timestamp = DateTime::from(after_datetime)

npm/android-arm-eabi/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# `rrule-rust-android-arm-eabi`
1+
# `@rrule-rust/lib-android-arm-eabi`
22

3-
This is the **armv7-linux-androideabi** binary for `rrule-rust`
3+
This is the **armv7-linux-androideabi** binary for `@rrule-rust/lib`

npm/android-arm-eabi/package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
{
22
"name": "@rrule-rust/lib-android-arm-eabi",
33
"version": "0.0.0",
4-
"os": [
5-
"android"
6-
],
74
"cpu": [
85
"arm"
96
],
107
"main": "rrule-rust.android-arm-eabi.node",
118
"files": [
129
"rrule-rust.android-arm-eabi.node"
1310
],
11+
"description": "RRule implementation for Node.js written in Rust",
12+
"keywords": [
13+
"rrule",
14+
"icalendar",
15+
"rust",
16+
"rs"
17+
],
18+
"author": {
19+
"name": "lsndr",
20+
"email": "[email protected]",
21+
"url": "https://lsndr.me"
22+
},
1423
"license": "MIT",
1524
"engines": {
1625
"node": ">= 10"
1726
},
27+
"repository": "lsndr/rrule-rust",
28+
"os": [
29+
"android"
30+
],
1831
"publishConfig": {
1932
"access": "public"
2033
}

npm/android-arm64/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# `rrule-rust-android-arm64`
1+
# `@rrule-rust/lib-android-arm64`
22

3-
This is the **aarch64-linux-android** binary for `rrule-rust`
3+
This is the **aarch64-linux-android** binary for `@rrule-rust/lib`

npm/android-arm64/package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
{
22
"name": "@rrule-rust/lib-android-arm64",
33
"version": "0.0.0",
4-
"os": [
5-
"android"
6-
],
74
"cpu": [
85
"arm64"
96
],
107
"main": "rrule-rust.android-arm64.node",
118
"files": [
129
"rrule-rust.android-arm64.node"
1310
],
11+
"description": "RRule implementation for Node.js written in Rust",
12+
"keywords": [
13+
"rrule",
14+
"icalendar",
15+
"rust",
16+
"rs"
17+
],
18+
"author": {
19+
"name": "lsndr",
20+
"email": "[email protected]",
21+
"url": "https://lsndr.me"
22+
},
1423
"license": "MIT",
1524
"engines": {
1625
"node": ">= 10"
1726
},
27+
"repository": "lsndr/rrule-rust",
28+
"os": [
29+
"android"
30+
],
1831
"publishConfig": {
1932
"access": "public"
2033
}

npm/darwin-arm64/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# `rrule-rust-darwin-arm64`
1+
# `@rrule-rust/lib-darwin-arm64`
22

3-
This is the **aarch64-apple-darwin** binary for `rrule-rust`
3+
This is the **aarch64-apple-darwin** binary for `@rrule-rust/lib`

0 commit comments

Comments
 (0)