Commit graph

2165 commits

Author SHA1 Message Date
LongYinan
f058614ee3
chore: publish
- @napi-rs/cli@2.13.0
2022-11-20 23:01:34 +08:00
LongYinan
329c81f742
chore: upgrade yarn version 2022-11-20 23:00:28 +08:00
LongYinan
28be7e256b
chore(cli): upgrade Node.js dependencies (#1368) 2022-11-20 22:59:35 +08:00
LongYinan
696c2ddcd8
feat(cli): auto choose the tooling for cross compiling (#1367) 2022-11-20 22:24:02 +08:00
Simon Laux
035def0600
fix(napi): return the join handle when spawning a tokio task. (#1351)
we need this to be able to safely drop an struct,
that makes use of an async task.
the drop function needs to be able to call `.abort()`
on the join handle to avoid memory corruption and undefined bahviour.
2022-11-15 11:50:25 +08:00
Simon Laux
b0c248ad7e
chore(napi): expose tokio runtime's block_on function (#1352) 2022-11-15 11:49:46 +08:00
Horu
d48d106588
ci: remove unused ci condition (#1363) 2022-11-14 12:11:15 +08:00
LongYinan
9816a77729
Release independent packages
napi@2.10.1
2022-11-12 13:39:04 +08:00
LongYinan
62fddaca9f
chore: publish
- @napi-rs/cli@2.12.1
2022-11-12 13:34:33 +08:00
LongYinan
ec2c932189
Merge pull request #1364 from SASUKE40/fix/cli-version 2022-11-11 22:09:01 +08:00
Edward Elric
caeef4a675
fix(cli): incorrent version without npm folder 2022-11-10 23:44:39 +08:00
LongYinan
69f043c8eb
Merge pull request #1360 from napi-rs/zig-0.10
ci: test for zig 0.10
2022-11-06 23:53:56 +08:00
LongYinan
32cf02e633
fix(cli): compatible with zig 0.10.0 2022-11-05 00:11:23 +08:00
LongYinan
0731e00217
ci: test for zig 0.10 2022-11-04 23:39:24 +08:00
阿豪
7f82c95525
fix(cli): support help command (#1355) 2022-11-02 10:56:34 +08:00
LongYinan
b5cfa93789
chore: skip worker_thread test on Linux aarch64 (#1354) 2022-10-31 21:13:11 +08:00
LongYinan
c328d8ece5
ci: update docker image monthly 2022-10-24 12:08:58 +08:00
LongYinan
3dde26bcef
chore(napi): including type message in error message (#1350) 2022-10-24 00:16:30 +08:00
LongYinan
1037e6f14d
chore: upgrade dependencies (#1349) 2022-10-23 23:03:18 +08:00
Wodann
77060adb3d
fix(napi): BigInt::get_u64 lossless check (#1348) 2022-10-22 11:16:08 +08:00
LongYinan
a12bdc4359
Release independent packages
- napi@2.10.0
2022-10-04 17:17:13 +08:00
LongYinan
a353402a69
chore: publish
- @napi-rs/cli@2.12.0
2022-10-04 17:16:29 +08:00
Devon Govett
5541d650a9
feat(napi): add threadsafe deferred values (#1306) 2022-10-03 13:00:48 +08:00
LongYinan
5561502fd5
Merge pull request #1332 from napi-rs/array-buffer-send
fix(napi): make Buffer/ArrayBuffer truely Send/Sync safe
2022-10-03 12:55:55 +08:00
LongYinan
a5a04a4e54
fix(napi): make Buffer/ArrayBuffer truely Send/Sync safe 2022-10-03 11:34:46 +08:00
LongYinan
a0522986b3
Merge pull request #1331 from napi-rs/pass-in-buffer-leak
fix(napi): should also delete the reference while dropping the Buffer
2022-10-02 12:50:33 +08:00
LongYinan
6ff69a1dab
test(memory-testing): adjust buffer tests 2022-10-02 12:28:56 +08:00
LongYinan
c76be2f1e0
ci: do not throw if docker container stop failed 2022-10-02 11:14:52 +08:00
LongYinan
d3fc689269
ci: remove clear cargo cache in MSRV job 2022-10-02 10:31:36 +08:00
LongYinan
47de6301ee
fix(napi): should also delete the reference while dropping the Buffer 2022-10-02 10:14:25 +08:00
messense
4279291f4b
feat(cli): parse Cargo.toml using cargo metadata (#1330) 2022-10-01 22:06:14 +08:00
user.tax
e54c37a0b1
feat(napi): add support for Vec<(std::string::String, u16)> and some other small change (#1320) 2022-09-20 12:13:07 +08:00
user.tax
0d49b45ea9
feat(napi): add impl<T: Into<Vec<u8>>> From<T> for Uint8Array (#1317)
Co-authored-by: any <any@user.tax>
2022-09-16 23:15:29 +08:00
LongYinan
ea18170779
fix(napi): propagation error in function call (#1315) 2022-09-14 19:30:43 +08:00
Devon Govett
5ba70b0e1a
fix(napi): improve error propagation (#1303) 2022-09-14 17:03:11 +08:00
LongYinan
d5a6445bee
chore(cli): increase ava timeout (#1314) 2022-09-14 17:01:53 +08:00
messense
30accad110
Add arm64 macOS CI (#1313) 2022-09-14 10:34:04 +08:00
Wodann
f7c26cccbf
fix(cli): custom Cargo (build) target directories (#1300) 2022-09-09 18:54:53 +08:00
Hana
22adc885d6
chore: fix ci for forked repo (#1302) 2022-09-09 18:54:23 +08:00
LongYinan
f3c203d46e
Release independent packages
napi@2.9.1
napi-derive@2.9.1
2022-09-08 17:27:35 +08:00
Dennis Duda
fc63ba8b52
fix(napi): some of the unsoundness in Buffer (#1294)
* fix leaked napi refcount in `Buffer` when cloning

Cloning unconditionally increased the refcount in `Buffer::clone`, but only called `napi_reference_unref` on dropping the last Buffer (the one with `strong_count == 1`). This means that the refcount will never drop back to zero after cloning, leaking the Buffer.

This commit changes it to also unconditionally unref the buffer.

* fix multiple sources of UB in `Buffer`

- `slice::from_raw_parts` may never be created with a null pointer, but `napi_get_buffer_info` was not sufficiently checked → UB when passing an empty Buffer
- `&'static mut [u8],` is invalid, as it certainly doesn't live for `'static`

Switching to `NonNull<u8>` and a `len` field fixes both of these.

- I also don't really understand how the `impl ToNapiValue for &mut Buffer` could have been sound. It creates an entirely new `Arc`, but reuses the same `Vec` allocation, leading to... a double free of the `Vec` on drop? I have replaced it with a simple call to `clone` instead.

* remove overcomplicated bool and drop impl

As far as I can tell, by just removing the bool and letting the drop code do its thing we clean up correctly in all cases. Because `napi_create_external_buffer` gets an owned `Buffer` attached to it via the Box, we can rely on `from_raw` retrieving it in the `drop_buffer` function.
2022-09-05 13:04:43 +08:00
mat-if
26f6c926d3
chore(napi-derive): pin minimum usable version of dependency syn (#1293) 2022-09-01 10:50:48 +08:00
LongYinan
76fd7b7526
Merge pull request #1291 from napi-rs/fix-this-types
fix(napi-derive): should not generate this types for Constructor/Getter/Setter
2022-08-30 17:04:23 +08:00
LongYinan
32a039aad0
fix(napi-derive): should not generate this types for Constructor/Getter/Setter 2022-08-30 16:39:51 +08:00
LongYinan
7e3b1ef330
Merge pull request #1290 from napi-rs/zst
fix(napi): remove previous reference if value_ref existed
2022-08-25 22:17:47 +08:00
LongYinan
525d881590
fix(napi): remove previous reference if value_ref existed
Usually happens while using ZST
2022-08-25 21:51:06 +08:00
LongYinan
767c040d94
Release independent packages
- napi@2.9.0
- napi-derive@2.9.0
2022-08-23 22:27:53 +08:00
LongYinan
58f0d82554
Merge pull request #1287 from napi-rs/upgrade-dependencies
chore: upgrade npm dependencies
2022-08-23 21:00:46 +08:00
LongYinan
184c4af588
chore: upgrade npm dependencies 2022-08-23 20:18:25 +08:00
LongYinan
4153c03a9f
Merge pull request #1286 from napi-rs/f32-to-napi-value
feat(napi): implement ToNapiValue for f32
2022-08-23 17:03:01 +08:00