LongYinan
8e481c1eba
style: clippy fix ( #2639 )
2025-05-16 22:24:11 +08:00
LongYinan
9de545e7a2
refactor!(napi): add lifetime to Object ( #2619 )
2025-05-11 19:51:29 +08:00
LongYinan
65fe29c854
refactor!(napi): add lifetime to JsString ( #2614 )
2025-05-08 13:20:09 +08:00
LongYinan
c808386a8f
refactor!(napi): move JsBigint behind compat-mode feature ( #2613 )
...
* refactor!(napi): move JsBigint behind compat-mode feature
* reduce asan flaky
2025-05-08 12:04:02 +08:00
LongYinan
813c51e16a
refactor!(napi): move depracated types behind compat-mode feature flag ( #2612 )
2025-05-07 22:34:26 +08:00
LongYinan
23e9de2caa
refactor!(napi): add lifetime to Unkonwn ( #2611 )
...
Remove JsUnknown
2025-05-07 22:32:24 +08:00
LongYinan
ed9ca20daa
refactor!(napi): add lifetime for JsSymbol ( #2610 )
2025-05-07 20:12:19 +08:00
LongYinan
a456fcdbc7
refactor!(napi): add lifetime for JsNumber ( #2609 )
2025-05-07 20:11:33 +08:00
LongYinan
bcf5e14aa8
feat(napi): add from_napi_value for Ref<T: FromNapiValue> ( #2603 )
2025-05-05 23:38:46 +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
LongYinan
8fffa49282
fix(napi): resuse threads worker on Node.js ( #2399 )
2024-12-18 23:48:30 +08:00
LongYinan
4c7a3d3264
chore: Rust 1.83.0 clippy fix ( #2378 )
2024-11-30 10:49:01 +08:00
Stanisław Czech
272334c69f
fix(napi): update logic for handling signed integers ( #2356 )
...
* Fix from functions for BigInt
Allow proper parsing of negative integers in those functions.
Fixes the pannic when calling:
BigInt::from(i128::MIN);
* Fix get_i128 and get_i64 for BigInt
Update the getter logic to take sign into account.
for get_i128 and get_u128 make lossless value consistent with the documentation
(documentation described different behavior then the code logic)
* Extend tests for BigInt types
Add more test cases for negative i64 and i128 to test the created changes
* Simplify the to napiValue logic for 128 bit types
Update the logic to handle negative values properly
Refactor to_napi_value and create_bigint_from_*128 to use the same logic
instead of copping mostly the same code 4 times
* Fix specification for deserialize object test
For unknown reason the binary specification was holding different value than spec file
2024-11-18 23:12:11 +08:00
LongYinan
cf2305517d
chore(napi): deprecate Env::create_reference ( #2347 )
2024-11-07 13:05:01 +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
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
Richer
daf4a80bdb
feat(napi): mark create_buffer as deprecated & use BufferSlice to replace JsBuffer for ser ( #2267 )
2024-09-22 11:22:05 +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
bf8f568788
refactor!(napi): Ref should not hold the value ptr ( #2243 )
...
It's unsafe
2024-09-12 23:25:09 +08:00
LongYinan
b0bf4f00d0
fix(napi): windows function registration timing ( #2248 )
...
* fix(napi): windows function registration timing
* fix clippy issue
* upgrade zig version
* pin rust version on zig cross compile ci
2024-09-12 23:18:05 +08:00
sjh
09a79edfb7
fix(napi,napi-derive): ffi lifetime and pointer sound issues ( #2216 )
...
* The ownership of the CString will be taken in map function
* for empty struct like `#[napi] struct A;`, the `value_ref` will be `0x1`, and it will be overwritten by the others instance of the same class
2024-08-18 18:21:13 +08:00
LongYinan
bc9e931a4e
feat(napi): provide PromiseRaw for non-await scenario ( #2168 )
2024-07-06 19:09:16 +08:00
LongYinan
04bd89b9a4
chore(napi): exclude libuv api on wasm targets ( #2156 )
2024-06-24 23:36:05 +08:00
Ranger
a3b01870a3
feat(napi): support External for compact mode and add JsExternal as deprecated ( #2125 )
2024-05-26 14:43:33 +08:00
LongYinan
4572ede9f5
refactor(napi): split T and CallJsBackArgs generic type ( #2091 )
2024-05-06 18:25:40 +08:00
Ranger
e86e3add2b
fix(napi): napi_adjust_external_memory should be hidden with wasm target ( #2031 )
2024-04-10 14:57:04 +08:00
翠 / green
2e0f983ccf
feat(target): add support for s390x-unknown-linux-gnu ( #2028 )
...
* feat(target): add support for s390x-unknown-linux-gnu
* chore: rerun CI
2024-04-09 14:16:09 +08:00
翠 / green
71a528535a
fix(napi): create_bigint_from_*128 returned incorrect word_count ( #2024 )
...
The value of `word_count` was inconsistent between the node side and rust side when calling `create_bigint_from_i128`/`create_bigint_from_u128`.
2024-04-08 10:43:23 +09:00
LongYinan
0550c56fcf
fix(napi): External should impl FromNapiRef rather than FromNapiValue ( #2013 )
...
- Close https://github.com/napi-rs/napi-rs/issues/1994
2024-03-25 15:11:11 +08:00
LongYinan
4719caa643
feat(napi): support Return generic of ThreadsafeFunction ( #1997 )
...
* feat(napi): support to use tuple with either (#1993 )
`Either` uses `ValidateNapiValue` + `TypeName` to validate and report error on value not being matched. So there's no way to remove these super traits from it. So I implemented these types to `Tuple` types.
* feat(napi): support `Return` generic of ThreadsafeFunction
* depracate JsFunction
* CalleeHandled tsfn should handle Result in callback
* Pass env to call_with_return_value callback
* Fix compile
* clippy fix
* Fix electron test
* Function args
---------
Co-authored-by: Hana <andywangsy@gmail.com>
2024-03-20 21:37:08 +08:00
Janrupf
ac3626a023
fix(napi): Fix buffer corruption and soundness issues ( #1923 )
...
* fix(napi): Fix buffer corruption and soundness issues
* test: fix tests to conform to buffer API
2024-01-29 18:32:28 +08:00
LongYinan
b9ba7c9d68
fix(napi): memory issue while creating external buffer on electron
2024-01-26 14:32:24 +08:00
LongYinan
aff95d0271
chore(napi): remove napi_val on Ref because it is unused
2024-01-26 03:29:52 +00:00
LongYinan
12503a8061
chore(napi): delete unwrap_from_ref API because it was never work
2024-01-26 02:58:53 +00:00
LongYinan
134707ef1d
fix(napi): callback in execute_tokio_future does not need to be Send ( #1917 )
...
The resolver does not need to be `Send` or `Sync`, because it's assumed to be called from the same thread that the JavaScript thread is running on.
2024-01-26 10:27:17 +08:00
LongYinan
43a080d52b
fix(napi): apply clippy suggestions ( #1878 )
2023-12-29 23:08:56 +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
65f57918fb
style(napi): as ptr => ptr::cast ( #1786 )
2023-11-06 11:22:30 +08:00
LongYinan
feabcd7f16
test(napi): add tests for napi9 features ( #1784 )
2023-11-06 11:03:44 +08:00
LongYinan
4e4d891ad8
feat: add experimental Env::get_module_file_name method ( #1783 )
2023-11-06 11:01:27 +08:00
LongYinan
2b0ddf4a21
feat(napi,sys): sync to napi9 ( #1781 )
...
- Close https://github.com/napi-rs/napi-rs/issues/1600
2023-11-06 11:00:27 +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
13d0ce075e
feat: integrate with emnapi ( #1669 )
...
* Integrate with emnapi
* resolve conflict
* ignore wasm
* generate wasi file
* Add wasi test to workflow
* Fix wasi template
* emnapi new initialize api
* Finish test
* Purne tsconfig
* Generate wasi worker
* Fix electron test
* Finalize check
* Noop adjust_external_memory
* Apply cr suggestions
2023-11-02 12:57:11 +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
LongYinan
05b4be4d80
style: clippy fix ( #1711 )
2023-08-30 16:41:13 +08:00
LongYinan
a7eeb0c31c
fix(napi): promise resolve error ( #1664 )
2023-07-24 00:36:24 +08:00
Markus
71e44be73d
fix(napi): access violation in property getter/setter closure ( #1552 )
...
Signed-off-by: Markus <28785953+MarkusJx@users.noreply.github.com>
2023-04-03 11:12:07 +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
LongYinan
550ef7c3cc
feat: export registers in wasm32 target ( #1529 )
2023-03-20 18:42:27 +08:00