Commit graph

158 commits

Author SHA1 Message Date
LongYinan
6e4b16fe5d
style: clippy fix 2022-12-16 20:19:39 +08:00
LongYinan
c01bcecb2b
chore(napi): reduce the complex about destroying tokio runtime 2022-12-16 14:32:32 +08:00
LongYinan
2abc94681e
fix(cli): zig cross armv7 (#1384) 2022-12-09 18:56:50 +08:00
nihohit
1cf32631bf
fix(napi): typed arrays ref shouldn't use offset. (#1376)
Notice from the n-api docs that the data returned from
`napi_get_typedarray_info` is already adjusted by the byte offset.
https://nodejs.org/api/n-api.html#napi_get_typedarray_info

This means that when `as_ref`/`as_mut` apply the byte offset, the
offset is in practice applied twice.
This wasn't caught in tests because no test tried to modify a typed
array with a byte offset, and the test didn't us the typed array
structs, only `JsTypedArray`. If you want, I can modify the rest of the
functions in examples/napi-compt-mode/src/arraybuffers.rs
and the matching tests, to test all typed arrays.

IMO the `byte_offset` field can be removed entirely from the struct,
but I wanted to submit a minimal PR.
2022-11-30 20:54:13 +08:00
LongYinan
573f67b90f
chore(napi-derive): make_ref tweaks (#1371) 2022-11-22 23:17:44 +08:00
Jacob Kiesel
618d0f8046
fix(napi-derive): unsound behavior while using reference and async together 2022-11-22 00:17:19 +08:00
LongYinan
28be7e256b
chore(cli): upgrade Node.js dependencies (#1368) 2022-11-20 22:59:35 +08:00
LongYinan
b5cfa93789
chore: skip worker_thread test on Linux aarch64 (#1354) 2022-10-31 21:13:11 +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
Devon Govett
5541d650a9
feat(napi): add threadsafe deferred values (#1306) 2022-10-03 13:00:48 +08:00
LongYinan
47de6301ee
fix(napi): should also delete the reference while dropping the Buffer 2022-10-02 10:14:25 +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
184c4af588
chore: upgrade npm dependencies 2022-08-23 20:18:25 +08:00
messense
99e17c7294
fix(napi): segfault when ThreadsafeFunction's callback closure captures data (#1281) 2022-08-20 22:40:26 +08:00
LongYinan
b7a3103f0c
feat(napi-derive): catch_unwind attribute (#1280) 2022-08-19 23:36:36 +08:00
LongYinan
528b1d21cb
style: clippy fix 2022-08-17 18:16:01 +08:00
LongYinan
0ef482c6ca
feat(napi-derive): support inject This<Value> into raw function 2022-08-17 18:16:00 +08:00
LongYinan
711372e175
feat(napi-derive): implement instance_of for Class 2022-08-17 15:18:43 +08:00
LongYinan
2385b52a72
feat(napi): allow implement custom finalize logic for Class 2022-08-17 13:24:40 +08:00
huzz
fd191a4586
feat(napi): support rust array to js array 2022-08-12 17:53:36 +08:00
LongYinan
cb9239d8dc
fix(napi): either for #[napi(object)] types (#1258) 2022-08-07 01:16:28 +08:00
LongYinan
0f14799776
feat(napi-derive): support set property attribute in napi macro (#1257) 2022-08-06 21:54:58 +08:00
Jacob Kiesel
94e8e54b38
feat(napi): call sync functions within tokio runtime (#1242) 2022-08-04 00:12:35 +08:00
LongYinan
1a7cff167e
feat(napi): clone reference for TypedArray/Buffer 2022-07-06 19:15:16 +08:00
LongYinan
cc3086d804
fix(napi): validate fn for Option<T> 2022-07-06 14:01:32 +08:00
LongYinan
87fd74cbb6
feat(napi-derive): allow injecting this in class method 2022-07-05 23:09:40 +08:00
LongYinan
2e53bf7f9a
feat(napi-derive): support return_if_invalid 2022-07-05 18:39:12 +08:00
LongYinan
53cab27bc4
refactor(napi): Either now perform ValidateNapiValue::validate rather than type_of 2022-07-05 17:01:21 +08:00
LongYinan
c1e07b3c12
feat(napi): support into_instance in class struct 2022-06-04 01:07:47 +08:00
Jose Acevedo
796ba363f5 test(napi-derive): add trybuild negative macro tests 2022-05-23 11:55:19 +08:00
Jose L
5be415d3d9
feat(napi-derive): add ts_arg_type attribute to override individual args on functions (#1192) 2022-05-22 13:43:11 +08:00
Devon Govett
d6c755c4eb
fix(napi-derive): js_name support for getters and setters (#1179) 2022-05-13 12:55:54 +08:00
LongYinan
a5c19ce1da
fix(napi): type constraint for either types 2022-05-12 15:12:32 +08:00
LongYinan
47fcc8501a
fix(napi): missing iterator implementation from class factory 2022-05-10 21:50:20 +08:00
Devon Govett
27402aee81
feat(napi): add support for weak references 2022-05-10 21:09:45 +08:00
LongYinan
65b4b34f40
test(napi): add electron tests 2022-05-10 18:39:37 +08:00
LongYinan
788a962137
fix(napi): drop all thread_local! usage 2022-05-10 18:39:36 +08:00
LongYinan
a3356264f2
feat(napi): experimental iterator support 2022-05-06 18:03:04 +08:00
Devon Govett
91c62c4616
fix(napi): handle the referenced object is finalized before Reference::drop 2022-05-03 21:59:42 +08:00
Ben Noordhuis
f301581445 feat(napi): make Error::from_reason() generic 2022-05-01 17:00:24 +02:00
LongYinan
44b4cc34e0
fix(napi-derive): invalid TypeScript return type 2022-04-27 18:23:45 +08:00
LongYinan
cf6b2c9241
chore: upgrade dependencies 2022-04-27 00:57:57 +08:00
LongYinan
878b843f29
feat(napi): support return Reference on class instance 2022-04-26 18:21:55 +08:00
LongYinan
c3a35a0704
fix(cli): generated type def on multi impl blocks 2022-04-26 18:04:37 +08:00
LongYinan
cc79c9794e fix(napi-derive): should transform struct case on Impl 2022-04-26 18:04:14 +08:00
LongYinan
5aa61c2142 fix(napi): use create_buffer/arrary_buffer if provided data is empty 2022-04-26 16:53:13 +08:00
Niklas Mischkulnig
0bdb722097
test(napi): add test for multiple empty buffers 2022-04-23 12:27:47 +02:00
Gabriel Francisco
d56c9c56a8
fix(napi-derive): simplify the optional values in generated declaration file (#1141) 2022-04-22 16:53:27 +08:00