LongYinan
bcef141990
fix(napi-derive): comments idents regression ( #2857 )
2025-08-09 23:02:07 +08:00
LongYinan
dca00683d8
fix(napi): handle the return_if_invalid for Array param ( #2846 )
...
* fix(napi): handle the return_if_invalid for Array param
* Update crates/backend/src/codegen/fn.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update crates/backend/src/codegen/fn.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-08 15:10:43 +08:00
Mikaël Francoeur
88fca29e3b
feat: make generator an iterator ( #2784 )
...
* make the generator an iterator
* add JSDoc for generators
* prevent naming conflicts
* add JSDoc struct
* update snapshot
* clippy
* Update typedef
* update fmt
* Apply code review
* test compatible
---------
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-08-07 08:03:37 +00:00
翠
bde407ddab
fix(napi-derive): generate types for threadsafe_function with WEAK=true correctly ( #2813 )
2025-07-30 00:24:15 +08:00
LongYinan
bb9883ab09
fix(napi-derive): lifetime codegen issue ( #2794 )
2025-07-22 17:54:18 +08:00
LongYinan
7e34e30b66
feat!(napi): create function from #[napi] fn ( #2757 )
2025-07-02 16:54:31 +08:00
Cong-Cong Pan
6222b39f5a
perf(napi): use Cell<bool> to replace AtomicBool ( #2506 )
...
* perf: use Cell<bool> to replace AtomicBool
* cargo fmt
---------
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-07-02 09:29:07 +08:00
LongYinan
99f4c089d4
feat(napi): add napi_ref impl for Object Symbol and External ( #2754 )
2025-07-01 00:45:32 -07:00
LongYinan
092f887f39
fix(napi-derive): generate object key types properly ( #2752 )
2025-06-30 17:10:17 +08:00
LongYinan
b5e9c41d14
fix(napi): remove DerefMut impl for all TypedArray types ( #2750 )
2025-06-29 08:49:29 -07:00
LongYinan
8c3db48686
style: run clippy on nightly Rust ( #2744 )
2025-06-25 13:55:11 +08:00
Cameron
562bb698d6
fix(napi-derive): single parentheses arg is provided in ThreadsafeFunction ( #2742 )
...
* test: add repro for #2726
* fix
---------
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-06-24 16:09:47 +00:00
LongYinan
54935e34fa
fix(napi-derive): panic while creating type definition when Rust comment contains escape syntax ( #2701 )
2025-06-08 18:25:09 +08:00
liuyi
5a17b88636
fix: revalidate shared libs if type def not found ( #2689 )
2025-06-04 15:05:24 +08:00
liuyi
d874a46647
fix: type generation for shared libs ( #2684 )
2025-06-03 19:19:29 +08:00
LongYinan
d5a16483c5
fix(napi-derive): Either<f64, u32> should generate number ts type ( #2683 )
2025-06-02 23:53:14 +08:00
Cong-Cong Pan
9173e8eb28
feat!(napi): define propertes support symbol as name ( #2673 )
...
* feat: define properties support symbol as name
* fix
* fix
2025-05-30 23:37:19 +08:00
LongYinan
5d360e89fc
chore(cli): remove outdated WASI_REGISTER_TMP_PATH ( #2633 )
2025-05-14 15:24:33 +08:00
LongYinan
8cd752db86
feat(napi): support #[napi(module_exports)] ( #2631 )
2025-05-13 17:47:52 +08:00
LongYinan
653212ac7a
fix(napi): unused warning on JsString::from_raw ( #2622 )
...
* fix(napi): unused warning on JsString::from_raw
* Fix compile
2025-05-11 22:18:47 +08:00
LongYinan
9de545e7a2
refactor!(napi): add lifetime to Object ( #2619 )
2025-05-11 19:51:29 +08:00
LongYinan
ebcf0ea88e
fix(napi-derive): make_ref with Vec<&S> cases ( #2589 )
...
- Close https://github.com/napi-rs/napi-rs/issues/2571
2025-05-02 23:13:46 +08:00
LongYinan
ff2c64b35d
chore: clippy fix ( #2545 )
2025-04-04 13:52:49 +08:00
CPunisher
511b0da174
fix(napi-derive): add object_from_js and object_to_js support for enum ( #2489 )
2025-03-03 15:06:20 +08:00
LongYinan
d96bd288de
fix!(napi): upgrade to ctor 0.3.6 ( #2472 )
2025-02-20 12:22:29 +08:00
LongYinan
8d8ccdfc77
refactor!(napi): TypedArray API surfaces ( #2462 )
2025-02-11 13:35:43 +08:00
lghuahua
8ea8e9ebfc
feat(napi-derive): impl #[napi(array)] ( #2459 )
2025-02-11 13:35:27 +08:00
LongYinan
ea05ad3845
fix(napi-derive): hide the lifetime recursively in codegen ( #2426 )
2025-01-12 22:36:14 +08:00
LongYinan
98cb7671d3
feat(napi): impl ReadableStream and AsyncGenerator ( #2418 )
...
* feat(napi): impl ReadableStream and AsyncGenerator
* clippy fix
* Into<Vec<u8>> trait
* Skip node18 stream test due to Node.js bug
* Cleanup
* Also skip wasi test
* Merge test
* Skip wasi
* Useless expect-error
2025-01-03 17:09:42 +08:00
lghuahua
31cd07c8c2
feat(napi-derive): support type on #[napi] ( #2416 )
...
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-01-02 17:15:07 +08:00
Stanisław Czech
b4b74d6f1f
refactor!(napi): arguments tuple behavior ( #2401 )
...
* Implement FromNapiValue trait as macro
Code behavior should remain the same, with much less copy-pasting of the same code.
Additionally, this commit adds a unit tests for test for FromNapiValue
for tuple trait which appears to be currently missing.
* Simplify macro arr_get
Rewrite the macro to reduce the size of expanded code of the macro
(from 4088 to 2429 lines). Although this is a minor change,
this may help reduce the size of compiled library.
* Refactor typegen Type::Path
Removes the need for keeping mutable variable, as its only assigned once.
* [API BREAKING] Update api for calling functions.
This commit introduces new type FnArgs,
that is created with the goal of distinguishing between
calling JS function from rust with tuple as argument
and calling with multiple arguments.
Currently there is no possibility to add ToNapiValue value,
as tuple is used to call callback functions with more than one
argument from rust.
With this change, callbacks with multiple arguments,
should be called, with converting tuple of argument
into FnArgs struct, either by calling into() on such
tuple, or by creating FnArgs struct directly.
* Add support for FnArgs when generating TS types
Updated the macro for generating typescript types,
to correctly handle FnArgs struct. This is now treated
as passthrough type and generates the output from the
type inside of FnArgs struct.
* Implement ToNapiValue trait for tuple
With the changes to callback calling API, it's now possible
to safely add this change. This change allows to pass tuple
from rust code to JS to match the existing FromNapiValue trait
currently existing in the library.
2025-01-02 16:58:58 +08:00
LongYinan
8fffa49282
fix(napi): resuse threads worker on Node.js ( #2399 )
2024-12-18 23:48:30 +08:00
翠 / green
74faafeafe
fix(napi-derive): object_from_js / object_to_js for transparent was swapped ( #2382 )
2024-12-02 22:37:33 +08:00
翠 / green
6a4ce688c4
fix(napi-derive): generate correct types for HashMap with RandomState argument ( #2384 )
...
* fix(napi-derive): generate correct types for HashMap with RandomState argument
* chore: update snapshot
2024-12-02 22:37:00 +08:00
翠 / green
521aefe420
feat(napi-derive): implement #[napi(transparent)] ( #2376 )
2024-11-30 10:28:40 +08:00
frankwang
8b474f929d
feat(napi-derive): allow ts_type in napi fn attrs ( #2362 )
...
* feat: allow ts_type in fn attrs
* chore: add override fn type example
2024-11-22 15:44:16 +08:00
Richer
c1b07a82c1
fix(backend): fix type when function as object field ( #2359 )
2024-11-18 14:39:49 +08:00
LongYinan
49ed2ddf71
fix(napi-derive): object lifetime compile issue ( #2351 )
2024-11-11 20:19:41 +08:00
LongYinan
f705454029
feat(napi): introduce AsyncBlock to let user dispose resources after future done ( #2338 )
2024-10-31 09:24:30 +08:00
LongYinan
c91456d84a
feat(napi): support return *const c_char to JavaScript directly ( #2332 )
2024-10-28 23:48:33 +08:00
LongYinan
79cbb9170e
fix!(sys): Node-API accpet NAPI_AUTO_LENGTH parameter type should be isize rather than usize ( #2331 )
2024-10-28 23:45:32 +08:00
LongYinan
f707f36c5a
feat(napi): implmenet Set ( #2330 )
2024-10-26 20:11:58 +08:00
LongYinan
3d95fcffdf
fix(napi-derive): ra warning on Rust 1.82 ( #2329 )
2024-10-25 11:15:13 +08:00
LongYinan
aff84674b2
refactor!(napi): remove &str FromNapiValue ( #2323 )
2024-10-21 16:43:30 +08:00
LongYinan
afd081d003
feat(napi,napi-derive): allow lifetime in Class ( #2298 )
2024-10-10 05:59:14 +02:00
LongYinan
eba0b52c59
chore(napi): env doesn't need to be mut ( #2292 )
2024-10-07 19:20:21 +02:00
LongYinan
69cd73d71c
refactor!(napi,napi-derive): add lifetime to ClassInstance ( #2286 )
2024-10-02 10:42:34 +02:00
Richer
d3cf9cb143
fix(napi-derive-backend): should respect origin name for class factory ( #2280 )
2024-09-30 17:06:58 +02:00
LongYinan
a4a8d31a42
chore(napi): remove once_cell ( #2271 )
2024-09-23 16:57:14 +08:00
LongYinan
f704b4ac0f
feat(napi-derive): add async_runtime attribute ( #2270 )
2024-09-23 16:21:13 +08:00