848 Commits

Author SHA1 Message Date
LongYinan
668b53e849
Release independent packages
- napi@3.0.0-beta.8
- napi-derive@3.0.0-beta.8
2025-06-08 21:44:17 +08: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
LongYinan
814bc79412
fix(napi-derive): using js_name generating wrong type defs (#2700)
This commit introduces two main changes:

1.  Refactors the variable names used during the creation of
    `NapiStruct` in `crates/macro/src/parser/mod.rs`. The goal is to
    make the source of `NapiStruct.name` (the Rust identifier) and
    `NapiStruct.js_name` (the JavaScript name, potentially from a
    `#[napi(js_name = "...")]` attribute) more explicit. This change
    is primarily for code readability and maintainability. The core
    logic remains the same.

2.  Adds a new test case to `examples/napi` to specifically verify
    the behavior of `#[napi(js_name = "...")]` on structs. This
    includes:
    - A new Rust struct `OriginalRustNameForJsNamedStruct` in
      `examples/napi/src/class.rs` decorated with
      `#[napi(js_name = "MyJsNamedClass")]`.
    - Corresponding tests in `examples/napi/__tests__/values.spec.ts`
      that check for correct class instantiation, method calls, and
      type alias generation (`OriginalRustNameForJsNamedStruct` as an
      alias for `MyJsNamedClass`).

Note: I encountered some issues running the full build and tests for the example due to pre-commit hooks in the testing environment that I couldn't bypass. However, I believe the changes are correct based on static analysis and focused checks.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-08 17:14:57 +08:00
LongYinan
3f4338a907
fix(napi): memory leak in Object Property (#2699) 2025-06-07 22:24:05 +08:00
Hana
e31b898a35
feat(napi): support setting error_status of ThreadsafeFunctionBuilder (#2695) 2025-06-06 16:27:52 +08:00
Hana
0a90c8a8f2
feat(napi): support build_threadsafe_function variant with error status (#2694) 2025-06-05 21:35:18 +08:00
LongYinan
19146503ff
Release independent packages
- napi@3.0.0-beta.7
- napi-build@2.2.1
2025-06-04 20:25:05 +08:00
LongYinan
3450c7af43
fix(napi-build): compatible with v2 2025-06-04 20:24:02 +08:00
LongYinan
8256b9515e
Release independent packages
- napi@3.0.0-beta.6
- napi-derive@3.0.0-beta.6
- napi-build@3.0.0-beta.0
2025-06-04 18:24:11 +08:00
LongYinan
a8d39e98df
Release independent packages
- napi@3.0.0-beta.5
- napi-derive@3.0.0-beta.5
2025-06-04 17:07:12 +08:00
liuyi
5a17b88636
fix: revalidate shared libs if type def not found (#2689) 2025-06-04 15:05:24 +08:00
Cong-Cong Pan
a6f133cf7f
perf(napi): PersistedPerInstanceHashMap can be thread local (#2681)
* perf: PersistedPerInstanceHashMap can be thread local

* fix

* fix

* fix cargo clippy
2025-06-04 11:46:36 +08:00
LongYinan
375b32b2b1
chore: clippy fix 2025-06-03 20:18:57 +08:00
LongYinan
9dd929db4a
chore: update napi-derive-backend version in napi-derive 2025-06-03 19:41:59 +08:00
LongYinan
2f64f200da
Release independent packages
- napi@3.0.0-beta.4
- napi-derive@3.0.0-beta.4
2025-06-03 19:25:47 +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
LongYinan
b8d6e7bcee
fix(sys): napi10 types (#2682) 2025-06-02 23:37:16 +08:00
Hana
f4731bb566
feat!(napi): support custom tsfn result error code (#2672) 2025-06-02 22:47:50 +08:00
LongYinan
b93bdfd3eb
test: stress test on aarch64 linux gnu platform (#2662)
* test: stress test on aarch64 linux gnu platform

* remove configs in yarnrc

* clippy
2025-06-02 22:45:01 +08:00
Cong-Cong Pan
6bbf25a3f3
perf(napi): hash map (#2671) 2025-05-30 23:38:17 +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
6fd2f0d962
Release independent packages
- napi@3.0.0-beta.3
- napi-sys@3.0.0-alpha.2
- napi-derive@3.0.0-beta.3
2025-05-29 23:14:41 +08:00
LongYinan
a4cc0f58b4
feat(napi): add into_unknown on ToNapiValue (#2669) 2025-05-29 19:35:04 +08:00
LongYinan
29ae3ab604
fix(napi): use Arc in Reference because it is Send (#2668) 2025-05-29 09:12:02 +08:00
LongYinan
3a720f09cf
feat(sys): sync Node-API version changes (#2661)
* feat(sys): sync Node-API version changes

* upgrade electron

* move node_api_create_buffer_from_arraybuffer to experimental
2025-05-25 00:48:56 +08:00
LongYinan
9cccc46790
docs: update example in README (#2660) 2025-05-24 23:29:24 +08:00
LongYinan
f8fab45de7
feat(napi): serialize BigInt to serde::Value (#2659) 2025-05-24 23:18:40 +08:00
LongYinan
abf041542c
Release independent packages
- napi@3.0.0-beta.2
- napi-derive@3.0.0-beta.2
2025-05-22 20:04:41 +08:00
LongYinan
c51008c4eb
feat(napi): set Error::reason to error message and stack in async context (#2657) 2025-05-22 19:42:45 +08:00
LongYinan
3c5f22001b
fix(napi): wrong error status in ThreadsafeFunction callback (#2656) 2025-05-22 17:24:46 +08:00
Cong-Cong Pan
6ef5e6e5cc
fix(napi): ClassInstance as_object lifecycle (#2655) 2025-05-21 14:21:03 +08:00
LongYinan
62a1051589
Release independent packages
- napi@3.0.0-beta.1
- napi-derive@3.0.0-beta.1
2025-05-19 19:53:20 +08:00
LongYinan
7182db3a81
feat(napi): EscapableHandleScope API (#2652) 2025-05-19 19:52:21 +08:00
LongYinan
92b094e487
feat(napi): new handle scope API (#2650) 2025-05-18 23:16:40 +08:00
LongYinan
18816c710c
refactor!(napi): move JsObjectValue into bindgen_runtime (#2649) 2025-05-18 22:29:45 +08:00
LongYinan
a9c8ae0f99
fix(napi-derive): disallow JsValue assign to napi class as a field (#2648) 2025-05-18 21:04:30 +08:00
LongYinan
0dd473d52b
style(napi-derive): clippy fix (#2647) 2025-05-18 16:08:28 +08:00
LongYinan
74f349c180
fix(napi): reuse issue on AbortSignal (#2646)
- Close https://github.com/napi-rs/napi-rs/issues/2141
2025-05-18 15:57:10 +08:00
LongYinan
229128c3a7
chore(napi): make Object::from_raw pub (#2645)
- Close https://github.com/napi-rs/napi-rs/issues/2641
2025-05-17 22:47:23 +08:00
LongYinan
b1fb82dade
fix!(napi): unsound issues in Error (#2644)
- Close https://github.com/napi-rs/napi-rs/issues/1640
2025-05-17 22:44:24 +08:00
LongYinan
fddf6109b0
fix(napi): cleanup inner Stream when complete (#2643)
- Close https://github.com/napi-rs/napi-rs/issues/2604
2025-05-17 22:41:22 +08:00
LongYinan
4407678a25
fix(napi-derive): #[cfg_attr(feature = "xxx", napi)] (#2640) 2025-05-17 20:37:36 +08:00
LongYinan
bbe3666233
Release independent packages
- napi@3.0.0-beta.0
- napi-derive@3.0.0-beta.0
- napi-build@2.2.0
2025-05-16 22:51:58 +08:00
LongYinan
21982a1508
feat(napi-derive): auto invalid type gen (#2638) 2025-05-16 22:30:27 +08:00
LongYinan
8e481c1eba
style: clippy fix (#2639) 2025-05-16 22:24:11 +08:00
LongYinan
5d360e89fc
chore(cli): remove outdated WASI_REGISTER_TMP_PATH (#2633) 2025-05-14 15:24:33 +08:00
LongYinan
ce990542b9
fix(napi): module_exports binding (#2632) 2025-05-13 19:54:25 +08:00
LongYinan
8cd752db86
feat(napi): support #[napi(module_exports)] (#2631) 2025-05-13 17:47:52 +08:00
LongYinan
0a9980bad5
fix(napi): JsObjectValue::get_property signature (#2628)
* fix(napi): JsObjectValue::get_property signature

* debug
2025-05-12 12:20:06 +08:00