Skip to content

Commit 37a9ca4

Browse files
authored
Add BigInt support and more nj-core support for N-API v7. (#97)
* Update to N-API v7 and add BigInt support. * Updated to N-API v7 in nj-sys. * Updated CHANGELOG. * Added detach buffer calls in JsEnv. * Added BigInt for going to-from rust and JS. * Re-export the rust bigint exports. * Update from comment
1 parent e81c419 commit 37a9ca4

File tree

19 files changed

+292
-9
lines changed

19 files changed

+292
-9
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## Unreleased
4+
- Support for converting to/from [Rust BigInt][rust-bigint] to/from [JavaScript BigInt][js-bigint] ([#97][]).
5+
- Support for converting Rust `u64` to BigInt in JavaScript. ([#97][])
6+
- Updated to N-API v7 in `js-sys`. ([#97][])
7+
8+
[rust-bigint]: https://crates.io/crates/num-bigint
9+
[js-bigint]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
10+
[#97]: https://github.com/infinyon/node-bindgen/pull/97
11+
312
## [3.0.0] - 2020-10-14-2000
413
- Support for Passing Buffer to Rust
514
- Support for Env cleanup
@@ -11,7 +20,7 @@
1120
- Support for Array [#26](https://github.com/infinyon/node-bindgen/pull/26)
1221

1322
## Fixed
14-
- Fixed conversion of () [#31](https://github.com/infinyon/node-bindgen/pull/31)
23+
- Fixed conversion of `()` [#31](https://github.com/infinyon/node-bindgen/pull/31)
1524

1625
# [2.0.0] - 2020-05-011
1726

@@ -21,4 +30,4 @@
2130

2231
## Fixed
2332

24-
- Proper support for boolean [#19](https://github.com/infinyon/node-bindgen/pull/19)
33+
- Proper support for boolean [#19](https://github.com/infinyon/node-bindgen/pull/19)

Cargo.lock

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

examples/Cargo.lock

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

examples/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ members = [
1414
"buffer",
1515
"array",
1616
"electron",
17-
"cleanup"
17+
"cleanup",
18+
"bigint",
1819
]
1920

2021
#[patch.crates-io]
21-
#flv-future-aio = { path = "../../flv-future/src/future-aio"}
22+
#flv-future-aio = { path = "../../flv-future/src/future-aio"}

examples/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ clean:
1111
make -C class-async clean
1212
make -C param clean
1313
make -C electron clean
14+
make -C bigint clean
1415
make -C cleanup clean
1516

1617

1718
test: test-function test-cb test-async-cb test-promise test-json test-class-simple \
18-
test-class-wrapper test-class-async test-stream test-buffer test-array test-cleanup
19+
test-class-wrapper test-class-async test-stream test-buffer test-array test-bigint \
20+
test-cleanup
1921

2022
test-function:
2123
make -C function test
@@ -56,5 +58,8 @@ test-array:
5658
test-electron:
5759
make -C electron test
5860

61+
test-bigint:
62+
make -C bigint test
63+
5964
test-cleanup:
60-
make -C cleanup test
65+
make -C cleanup test

examples/bigint/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

examples/bigint/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "nj-example-bigint"
3+
version = "0.1.0"
4+
authors = ["fluvio.io"]
5+
edition = "2018"
6+
7+
8+
[lib]
9+
crate-type = ["cdylib"]
10+
11+
12+
[dependencies]
13+
node-bindgen = { path = "../.."}
14+
15+
16+
[build-dependencies]
17+
node-bindgen = { path = "../../", features = ["build"] }

examples/bigint/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
all: build
2+
3+
build:
4+
nj-cli build
5+
6+
test: build
7+
node test.js
8+
9+
10+
clean:
11+
rm -rf dist
12+

examples/bigint/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
manual JS callback

examples/bigint/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
node_bindgen::build::configure();
3+
}

0 commit comments

Comments
 (0)