LongYinan
e274cf7ae6
feat(napi-derive): enhance the error messages in object validator ( #2034 )
2024-04-10 16:52:23 +08:00
LongYinan
3e187151a6
fix(napi-derive): HashMap/IndexMap and slice generated types ( #1977 )
2024-02-25 00:56:30 +08:00
ebe97257a6
feat(napi-derive): add use_nullable attribute ( #1971 )
...
* feat(napi-derive): add use_nullable attribute
Co-authored-by: naskya <m@naskya.net>
* chore(napi-derive): update tests
Co-authored-by: naskya <m@naskya.net>
---------
Co-authored-by: naskya <m@naskya.net>
2024-02-24 21:49:54 +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
5be7ab0f6b
feat(napi): new Function/FunctionRef API
2024-01-26 02:27:46 +00: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
Jez
afd3395bb4
fix(napi-derive): import FromNapiValue
and ToNapiValue
from napi::bindgen_prelude
when generating enum ( #1713 )
2023-11-02 23:05:16 +08:00
LongYinan
05b4be4d80
style: clippy fix ( #1711 )
2023-08-30 16:41:13 +08: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
LongYinan
d184d503d5
fix(napi-derive): increase initial ref count in async fn ( #1577 )
2023-04-26 15:18:00 +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
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
LongYinan
c8352a1fb0
feat(napi-derive): allow partial implement From/To Napivalue for Object ( #1448 )
2023-01-24 14:51:16 +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
525d881590
fix(napi): remove previous reference if value_ref existed
...
Usually happens while using ZST
2022-08-25 21:51:06 +08:00
LongYinan
b7a3103f0c
feat(napi-derive): catch_unwind attribute ( #1280 )
2022-08-19 23:36:36 +08:00
Fy
bc69e15efb
fix(napi-derive): fix macro expansion naming shadow ( #1278 )
...
Co-authored-by: fengyu <fengyu.shelby@bytedance.com>
2022-08-19 11:05:09 +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
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
Ivan Enderlin
6a9fdba8b6
feat(napi-derive) Support #[napi(strict)]
on &T
and &mut T
. ( #1238 )
2022-08-06 21:55:35 +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
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
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
878b843f29
feat(napi): support return Reference on class instance
2022-04-26 18:21:55 +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
5c3d1b2144
feat(napi): experimental class reference API
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