LongYinan
0698bb1d80
feat(napi-derive): allow napi fn with lifetime ( #2266 )
2024-09-21 12:26:41 +08:00
LongYinan
fc4b6a632d
refactor(napi-derive): expand order ( #2265 )
2024-09-20 22:44:34 +08:00
LongYinan
521ef58f59
refactor(napi): allow create BufferSlice from external data ( #2263 )
...
- also refactor the enum codegen, now we will not emit #[derive(Copy,
Clone)] for the original enums.
- also refacotr the fn codegen, now #[napi] fn can accept env: &Env as
argument, this is useful when the return type contains lifetime
2024-09-19 22:22:33 +08:00
LongYinan
16386638c2
fix(napi-derive): Result type in async fn ( #2169 )
2024-07-06 23:46:24 +08:00
Jade-fu
2265ca3e1a
fix(napi): asynchronous functions can return any errors ( #2165 )
...
* feat(napi): asynchronous functions can return any errors as long as they implement the Into<Error> trait.
* chore: use impl Into<Error>
2024-07-04 14:47:32 +08:00
Jade-fu
c2bda9a900
fix(napi-derive): class constructor and factory should support custom error status ( #2161 )
2024-06-30 16:12:00 +08:00
LongYinan
3e187151a6
fix(napi-derive): HashMap/IndexMap and slice generated types ( #1977 )
2024-02-25 00:56:30 +08:00
Louis
43415251b8
feat(napi): allow Reference as a class method param ( #1966 )
...
As of before this commit, there was a lock in the codegen preventing Reference
from being used as a function argument outside of a Reference<Self>.
This changes it, allowing Reference of any class to be added as a class method
argument anywhere. It has the same limitations as reference, as in it requires
the class to have been created with a factory or constructor. This change
implements FromNapiValue on Reference, which will unwrap the class and call the
existing from_value_ptr method. It also updated typegen so that we only emit
the reference type if we're in an impl block that doesn't match the Reference
we're getting. This ensures that typegen works as expected with the previous
behaviour.
2024-02-22 22:37:50 +08:00
LongYinan
c49309fdc2
fix(napi): memory leak while using Reference ( #1954 )
...
- Close https://github.com/napi-rs/napi-rs/issues/1952
2024-02-17 22:14:27 +08:00
LongYinan
20e0983288
style: apply clippy fix ( #1953 )
2024-02-17 14:12:24 +08:00
LongYinan
5ac153388f
feat(napi): accept slice as TypedArray ( #1951 )
2024-02-15 23:40:45 +08:00
LongYinan
02dd4c3fd3
fix(napi-derive): catch_unwind on constructor ( #1869 )
...
- Close https://github.com/napi-rs/napi-rs/issues/1852
2023-12-27 12:49:10 +08:00
LongYinan
dab4ce7fe0
fix(napi-derive,cli): register function cross crates ( #1848 )
2023-12-11 00:36:26 +08:00
LongYinan
8a9c42a985
fix(napi): compile error for wasm32-unknown-unknown target
...
- Close https://github.com/napi-rs/napi-rs/issues/1816
2023-11-20 17:10:58 +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
LongYinan
0dc1ef738b
fix(napi): asan caught memory safety issue
2023-11-04 15:26:07 +08:00
LongYinan
d184d503d5
fix(napi-derive): increase initial ref count in async fn ( #1577 )
2023-04-26 15:18:00 +08:00
LongYinan
550ef7c3cc
feat: export registers in wasm32 target ( #1529 )
2023-03-20 18:42:27 +08:00
LongYinan
96959e6425
chore(napi): remove thread_local from dependenies ( #1506 )
2023-03-05 19:49:52 +08:00
LongYinan
ab81f4126b
chore(napi-derive): allow unsafe async &mut self ( #1453 )
2023-01-24 20:41:57 +08:00
Simon Vandel Sillesen
00b09bca6e
fix(napi): better error message for #[napi(catch_unwind)] ( #1383 )
...
Before, the JS error would only have `Any { .. }`
2022-12-09 18:37:10 +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
LongYinan
b7a3103f0c
feat(napi-derive): catch_unwind attribute ( #1280 )
2022-08-19 23:36:36 +08:00
LongYinan
1cd4fda01e
feat(napi): add get and get_mut method on WeakReference
2022-08-17 21:29:03 +08:00
LongYinan
0ef482c6ca
feat(napi-derive): support inject This<Value> into raw function
2022-08-17 18:16:00 +08:00
Ivan Enderlin
6a9fdba8b6
feat(napi-derive) Support #[napi(strict)] on &T and &mut T. ( #1238 )
2022-08-06 21:55:35 +08:00
Jacob Kiesel
94e8e54b38
feat(napi): call sync functions within tokio runtime ( #1242 )
2022-08-04 00:12:35 +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
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
LongYinan
47fcc8501a
fix(napi): missing iterator implementation from class factory
2022-05-10 21:50:20 +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
LongYinan
6eec0f93c1
feat(napi): redesign the Reference API ( #1118 )
...
- Reference now is inject by #[napi] macro
- Class Reference and underlaying data now have the same lifetime
2022-04-13 13:24:53 +08:00
LongYinan
18afd86a2e
fix(napi): missing ValidateNapiValue trait for types
2022-03-06 14:20:36 +08:00
LongYinan
9f3fbaa8e0
fix(napi): race issues with Node.js worker_thread ( #1081 )
...
Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
2022-03-05 14:14:32 +08:00
LongYinan
16f808276d
feat(napi): implement get_js_function
2022-01-23 23:04:31 +08:00
LongYinan
556ace8f33
fix(napi-derive,cli): export type alias for original name
2021-12-25 17:36:12 +08:00
LongYinan
f76a12eb5a
fix(napi-derive): ignore warnings on generated fn
...
Close https://github.com/napi-rs/napi-rs/issues/968
2021-12-25 01:24:58 +08:00
LongYinan
b2e71b5e03
feat(napi-derive): add noop feature to skip napi function register
2021-12-08 11:30:43 +08:00
LongYinan
27c4790e7b
fix(napi-derive): disable register logic in rust test
2021-12-06 12:58:58 +08:00
LongYinan
c365c15639
style: clippy fix
2021-11-25 23:35:50 +08:00
LongYinan
9a0de8e485
feat(napi): allow return self as this
2021-11-25 22:31:11 +08:00
LongYinan
1fe39ff66d
feat(napi): support export rust mod as ts namespace
2021-11-25 17:53:43 +08:00
LongYinan
43c1aff738
refactor(napi): use CStr instread of CString while creating lit variable
2021-11-25 17:53:41 +08:00
Tim Fish
a14cbbb836
Full qualify types
2021-11-14 23:34:44 +00:00
LongYinan
413a55545f
fix(napi-derive-backend): wrong restrict on Result return type
2021-11-10 13:15:54 +08:00
LongYinan
785388ae40
fix(napi-derive): missing move in async fn
2021-11-06 22:19:42 +08:00