Commit graph

132 commits

Author SHA1 Message Date
LongYinan
e930a6aab3
fix(napi-derive): async task optional output type (#1796) 2023-11-08 20:06:27 +08:00
LongYinan
938f4df83d
fix(napi-derive): async task void output type (#1795) 2023-11-08 20:05:09 +08:00
LongYinan
feabcd7f16
test(napi): add tests for napi9 features (#1784) 2023-11-06 11:03:44 +08:00
LongYinan
546b108a5b
feat(napi): support async class factory (#1779)
- Close https://github.com/napi-rs/napi-rs/issues/1777
2023-11-06 10:58:23 +08:00
Tom Sherman
3418fd3e8f
feat(napi,sys): implement Symbol.for (#1721)
Co-authored-by: LongYinan <lynweklm@gmail.com>
2023-09-13 15:45:14 -07:00
yoogo
4259e85e0e fix(backend): attribute of a struct marked as #[napi(constructor)] contain Rust keywords, causing to throw is not a valid identifier when generating getters and setters 2023-08-17 20:48:54 +08:00
Markus
73a704a19e
feat(napi): keep stack traces in a deferred context (#1637)
* feat(napi): keep stack traces in deferred context

* chore: reformat code

Signed-off-by: Markus <28785953+MarkusJx@users.noreply.github.com>

* chore: use napi wrappers

Signed-off-by: Markus <28785953+MarkusJx@users.noreply.github.com>

* test(napi): add test for deferred trace

Signed-off-by: Markus <28785953+MarkusJx@users.noreply.github.com>

* chore: fix format

Signed-off-by: Markus <28785953+MarkusJx@users.noreply.github.com>

---------

Signed-off-by: Markus <28785953+MarkusJx@users.noreply.github.com>
2023-07-15 12:07:14 +08:00
LongYinan
c6258cf633
feat(napi): support chrono::NaiveDateTime (#1601) 2023-05-26 18:28:34 +08:00
LongYinan
5bc098144c
chore(example): add callback return promise (#1590) 2023-05-16 11:05:37 +08:00
LongYinan
88773a7a8e
fix(napi): re-throw error in ThreadsafeFunction callback if we could 2023-04-10 17:02:13 +08:00
forehal
a781a4f27e feat(cli): brand new cli tool with both cli and programmatical usage (#1492)
BREAKING CHANGE: requires node >= 16 and some cli options have been renamed
2023-04-06 11:04:53 +08:00
Francesco Benedetto
7c4dc2a2bd
feat(napi-derive-backend, napi-derive): add support for string enums (#1551) 2023-04-03 14:10:58 +08:00
Bo
0a0aa36c28
test(napi): update test case for checking electron renderer crash (#1547)
(cherry picked from commit d22598dbb1082de8ac712de954cd5616c838a48d)
2023-03-29 12:53:57 +08:00
Gabriel Francisco
3983be23f5
fix(napi): big numbers losing precision on serde_json::Value (#1538)
* fix(napi): big numbers losing precision on serde_json::Value

* fix(napi): add feature flags for bigint on number conversion

* chore(napi): change MAX_SAFE_INT to constant and convert big numbers to string when bigint is not available

* chore(napi): change how the check for safe integer range is made
2023-03-23 13:34:34 +08:00
LongYinan
3d48d4464b
fix(cli,napi-derive): re-export types from shared crate (#1531)
* fix(cli,napi-derive): re-export types from shared crate

* chore: publish

 - @napi-rs/cli@2.15.1-alpha.0

* Clippy fix

* Fix memory testing
2023-03-21 18:12:52 +08:00
Victor Teo
aee742f185
feat(napi): property getter and setter with closure (#1526)
* getter with closure with segment fault

* fix getter closure pointer

* add setter

* Cleanup API

* Add test for `create_function_from_closure`

* Fix compile error

* Fix flaky test title

---------

Co-authored-by: LongYinan <lynweklm@gmail.com>
2023-03-21 11:22:07 +08:00
Alberto Pose
ffc4980d52
fix(napi): panic when Promise callbacks trigger after Promise is dropped (#1469) (#1516)
Co-authored-by: Alberto Pose <albepose@amazon.com>
2023-03-14 15:32:17 +08:00
LongYinan
8e3eb6204b
fix(napi): support custom status in Error (#1486) 2023-02-09 23:18:57 +08:00
Hana
90cc0a6abe
feat(napi): convert ToNapiValue tuple to variadic tsfn (#1475)
* refactor: convert ToNapiValue tuple to variadic tsfn

* chore: resolve conflicts

* fix: typo

* chore: use into instead of to

* chore: syntax compat
2023-02-08 22:30:43 +08:00
LongYinan
7613d669fb
chore(napi): enhance the error messages while converting types failed (#1473) 2023-02-06 00:52:59 +08:00
LongYinan
3bd2bf40b1
fix(napi): run_script return type (#1467) 2023-01-31 20:36:59 +08:00
LongYinan
e3adf5dac4
fix(napi): unhandled promise rejection while using EitherN<Promise<..>> (#1452) 2023-01-24 19:07:33 +08:00
LongYinan
c8352a1fb0
feat(napi-derive): allow partial implement From/To Napivalue for Object (#1448) 2023-01-24 14:51:16 +08:00
LongYinan
e79eb34118
feat(napi-derive): generate ThreadsafeFunction types (#1449) 2023-01-24 14:25:05 +08:00
LongYinan
46f08ee6dd
fix(napi): missing From implementation for Bigint (#1440) 2023-01-17 00:05:19 +08:00
Hana
78b6e1574a
fix(napi-derive): fix union type generation for ts function notation (#1439)
* fix(backend): fix union type generation for ts function notation

* chore: update snapshot

* fix: naming
2023-01-14 18:27:46 +08:00
LongYinan
dc3a4c9f25
feat(napi): refactor ThreadsafeFunction to allow get return value of it (#1427) 2023-01-11 18:54:45 +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
ea18170779
fix(napi): propagation error in function call (#1315) 2022-09-14 19:30:43 +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
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 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