266 Commits

Author SHA1 Message Date
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
953f2e3553
Release independent packages
- napi@3.0.0-alpha.16
- napi@3.0.0-alpha.15
2024-10-21 16:46:26 +08:00
LongYinan
aff84674b2
refactor!(napi): remove &str FromNapiValue (#2323) 2024-10-21 16:43:30 +08:00
LongYinan
a38a24c359
Release independent packages
- napi@3.0.0-alpha.14
- napi-derive@3.0.0-alpha.14
2024-10-14 00:27:38 +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
9a6f01a20c
Release independent packages
- napi@3.0.0-alpha.13
- napi-derive@3.0.0-alpha.13
2024-10-03 00:01:16 +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
34829fb5f7
Release independent packages
- napi@3.0.0-alpha.12
- napi-derive@3.0.0-alpha.12
2024-09-23 17:01:31 +08: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
LongYinan
cfc88ee541
Release independent packages
- napi-derive@3.0.0-alpha.11
2024-09-21 14:21:38 +08:00
LongYinan
0698bb1d80
feat(napi-derive): allow napi fn with lifetime (#2266) 2024-09-21 12:26:41 +08:00
LongYinan
511340a52f
Release independent packages
- napi@3.0.0-alpha.11
- napi-derive@3.0.0-alpha.10
2024-09-20 23:08:34 +08:00
LongYinan
fc4b6a632d
refactor(napi-derive): expand order (#2265) 2024-09-20 22:44:34 +08:00
LongYinan
91af2c5961
Release independent packages
- napi@3.0.0-alpha.10
- napi-derive@3.0.0-alpha.9
2024-09-19 22:30:36 +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
a9690383c2
Release independent packages
- napi@3.0.0-alpha.9
- napi@3.0.0-alphq.8
2024-09-13 00:17:49 +08:00
CPunisher
249c27e06d
fix(napi-derive): tuple object and enum (#2227)
* Fix tuple struct

* Add testcase
2024-08-23 14:10:39 +08:00
CPunisher
c459f0acf6
feat: support structured enum with discriminated unions (#2222)
* Structured enum

* Type indent

* Add test example

* Remove trailing commas

* discriminant

* discriminant conflict

* more test

* typo
2024-08-22 14:59:50 +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
2e5bf773e3
fix(napi-derive): warning in empty enum codegen (#2214) 2024-08-10 22:30:50 +08:00
LongYinan
d84fc42832
fix(napi-derive): string enum validate logic (#2213) 2024-08-10 21:27:17 +08:00
CPunisher
a154612019
fix(napi-derive): add more cases for typegen of function args (#2210)
* Handle more arg pat

* Update testcase

* Revert
2024-08-08 11:07:21 +08:00
LongYinan
282ce1c00a
fix(napi): allow ThreadsafeFunction in Either (#2204) 2024-08-03 13:22:09 +08:00
Cong-Cong Pan
327998d0ac
fix(napi-derive): error for missing impl FromNapiValue since object_from_js = false (#2197) 2024-07-25 12:18:13 +08:00
LongYinan
22dba74813
Release independent packages
- napi-derive@3.0.0-alpha.7
2024-07-23 22:07:15 +08:00
LongYinan
0f7c40354f
Release independent packages
- napi-derive@3.0.0-alpha.6
2024-07-16 13:06:00 +08:00
Cong-Cong Pan
782d6ac5f8
fix(napi-derive): napi getter macros (#2188)
* fix: napi getter macros

* chore: cargo fmt
2024-07-16 12:48:38 +08:00
LongYinan
8891c43ef7
Release independent packages
- napi-derive@3.0.0-alpha.5
2024-07-07 21:03:40 +08:00
LongYinan
38d041569a
fix(napi-derive): PromiseRaw typegen 2024-07-07 21:03:14 +08:00
LongYinan
eb09a6f7f5
Release independent packages
- napi@3.0.0-alpha.5
- napi-derive@3.0.0-alpha.4
2024-07-06 23:48:30 +08:00
LongYinan
16386638c2
fix(napi-derive): Result type in async fn (#2169) 2024-07-06 23:46:24 +08:00
LongYinan
bc9e931a4e
feat(napi): provide PromiseRaw for non-await scenario (#2168) 2024-07-06 19:09:16 +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
LongYinan
1228e918e9
Release independent packages
- napi-derive@3.0.0-alpha.3
2024-07-01 13:28:46 +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
657fbfb113
Release independent packages
- napi@3.0.0-alpha.3
- napi-derive@3.0.0-alpha.2
2024-06-27 20:46:29 +08:00
magic-akari
734d74bd02
fix(typegen): add missing declare keyword (#2117) 2024-05-19 16:53:23 +08:00
LongYinan
4572ede9f5
refactor(napi): split T and CallJsBackArgs generic type (#2091) 2024-05-06 18:25:40 +08:00
LongYinan
3fc19fb2a3
style: fix clippy errors (#2090)
* style: fix clippy errors

* ci: rename wasip1 target name
2024-05-06 13:53:49 +08:00
inokawa
0adc36ce1c
feat(cli): support generation of literal union from string enum (#2054)
* feat(cli): support generation of literal union from enum

* Remove const

---------

Co-authored-by: LongYinan <lynweklm@gmail.com>
2024-04-22 14:28:04 +08:00
LongYinan
63c8ab3f20
Release independent packages
napi@3.0.0-alpha.1
napi-derive@3.0.0-alpha.1
napi-sys@2.4.0
2024-04-10 17:03:00 +08:00
LongYinan
e274cf7ae6
feat(napi-derive): enhance the error messages in object validator (#2034) 2024-04-10 16:52:23 +08:00
LongYinan
2a7c000275
Release independent packages
- napi@3.0.0-alpha.0
- napi-derive@3.0.0-alpha.0
2024-03-20 22:46:59 +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
LongYinan
e3e8a0fb39
Release independent packages
napi@2.16.0

napi-derive@2.16.0
2024-02-28 15:06:11 +08:00