591 Commits

Author SHA1 Message Date
LongYinan
6acd3b94fb
chore: add fail reason to assert (#2192) 2024-07-18 14:19:50 +08:00
Hana
ba345be957
perf(napi): reduce allocation for ToNapiValue of &str (#2191) 2024-07-18 13:08:02 +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
2fccedbaba
Release independent packages
- napi@3.0.0-alpha.7
2024-07-14 23:29:08 +08:00
LongYinan
54ec4897ea
fix(napi): PromiseRaw throw error logic (#2187) 2024-07-14 23:28:36 +08:00
Jade-fu
9e36daf559
fix(napi): reexport feature should be align (#2184) 2024-07-11 23:00:08 +08:00
LongYinan
a040416f9f
chore(napi): reduce Node-API call in AsyncTask (#2176) 2024-07-08 16:57:53 +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
70a5fce68d
Release independent packages
- napi@3.0.0-alpha.6
2024-07-07 20:55:20 +08:00
LongYinan
3a511bacee
fix(napi): Promise callbacks should require static lifetime (#2172) 2024-07-07 20:42:17 +08:00
LongYinan
27030c8dae
refactor(napi): simplify Promise implementation (#2171) 2024-07-07 14:59:03 +08:00
LongYinan
807b987a20
fix(napi): PromiseRaw does not require napi4 and tokio_rt 2024-07-06 23:59:26 +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
LongYinan
a4cd94ea30
Release independent packages
- napi@3.0.0-alpha.4
2024-07-06 14:34:06 +08:00
LongYinan
aef57fb196
feat(napi): impl from_string for Uint8Array (#2167) 2024-07-06 14:32:09 +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
Gentle
7c4072b237
let docs.rs generate all documentation (#2160)
without this, all-features = true has no effect

Co-authored-by: Gentle <ramon.klass@gmail.com>
2024-06-27 20:40:34 +08:00
LongYinan
04bd89b9a4
chore(napi): exclude libuv api on wasm targets (#2156) 2024-06-24 23:36:05 +08:00
LongYinan
a7d85b0549
chore(napi): remove stale tokio feature (#2155) 2024-06-24 17:41:58 +08:00
Dennis Duda
bd5b86e13b
chore(napi): reduce monomorphization load of various functions (#2143)
* refactor(napi): reduce monomorphization load of `JsObject::{get, set}`

Outside of `std::panicking::try` and `tokio`, these functions were the highest-up in `cargo-llvm-lines`.

Moves most of the logic out into non-generic functions.

* refactor(napi): reduce monomorphization load of `JsDeferred::new`

* refactor(napi): reduce monomorphization load of `call_js_cb`

---------

Co-authored-by: LongYinan <lynweklm@gmail.com>
2024-06-18 22:41:49 +08:00
LongYinan
ea623903d8
chore: clippy fix (#2144) 2024-06-18 13:20:43 +08:00
Özgür Akkurt
14d88997d7
chore(napi): print anyhow error in debug mode to show trace (#2140) 2024-06-17 11:45:10 +08:00
Ranger
19e3488efc
fix(napi): JsString should respect \0 character to align with String (#2138)
* fix(napi): JsString should respect \0 character to align with String

* chore(test): update snapshot
2024-06-12 15:20:27 +08:00
Kreijstal
ac47a92424
feat(build): add windows gnu target (#2026)
* squash  attempt number 2

* Add clang64

this adds clang64 compiler to the test suite

---------

Co-authored-by: LongYinan <lynweklm@gmail.com>
2024-06-09 00:54:59 +08:00
Gentle
2f21ba1872
chore(napi): make Ser and De public #2131
also adds helper functions needed to work with Ser and De

Co-authored-by: Gentle <ramon.klass@gmail.com>
2024-06-07 16:19:55 +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
Ranger
879008c4b6
feat(napi): implement ToNapiValue for Ref as required by TSFN (#2122) 2024-05-23 09:50:03 +08:00
magic-akari
734d74bd02
fix(typegen): add missing declare keyword (#2117) 2024-05-19 16:53:23 +08:00
Ranger
c52d2042a2
feat(napi): Function build_thfn support calledhandled mode (#2114)
* feat(napi): Function build_thfn support calledhandled mode

* test(example): add calleehandle example
2024-05-18 20:20:12 +08:00
Louis
c223954dc6
chore(napi): allow value attribute on enum variants (#2115)
This allows us to customize the enum value for string_enum. So far, only the case attribute was allowing us to customize the value of those variants, this is a next step in allowing the value to be different from the actual name.

This has a new test, and snapshots have been updated accordingly.

@Brooooooklyn - could we include that in napi v2 and tag after it?
2024-05-17 11:22:33 +08:00
Ranger
b2239fd880
fix(napi-macro): gengerate type file should align with type-def featrue (#2100)
* fix: make sure env without exception pending before throw error

* fix(napi-macro): gengerate type file should align with type-def featrue

* fix(napi-macro): gengerate type file should align with type-def featrue
2024-05-10 14:32:48 +08:00
LongYinan
1e781a589c
chore(napi): remove depracated get_js_function (#2101) 2024-05-09 15:13:44 +08:00
Niklas Mischkulnig
f3d665d5b1
fix(napi): panic when deserializing empty buffer with Rust 1.78 (#2094)
* Add test for #2083

* Add test for serde_byte with empty buffer

* Fix using serde_bytes with empty buffers

* skip wasi test

* fix test

* clippy fix

* avoid ub

* use safer impl

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
Co-authored-by: LongYinan <lynweklm@gmail.com>
2024-05-07 17:57:15 +08:00
LongYinan
4572ede9f5
refactor(napi): split T and CallJsBackArgs generic type (#2091) 2024-05-06 18:25:40 +08:00
Ranger
e9123e2c43
fix(napi): make sure env without exception pending before throw error (#2092) 2024-05-06 18:11:53 +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
Simon Hausmann
67ee2d085f
fix(napi): panic in JsArrayBufferValue as_ref/as_mut with Rust 1.78 (#2083)
In Rust 1.78, when debug assertions are enabled, slice::from_raw_parts panics if the provided data is a null pointer. This is possible through JsArrayBufferValue::new() as well as through
JsArrayBuffer::into_value, when napi_get_arraybuffer_info returns a null pointer
due to a zero length buffer.
2024-05-06 11:56:58 +08:00
naskya
68b5f2c587
feat(napi): support chrono datetime with timezones (#2074)
* feat(napi): implement From/ToNapiValue for chrono::DateTime<Local> and chrono::DateTime<FixedOffset> (#1902)

* chore(napi): update tests

Co-authored-by: sup39 <dev@sup39.dev>

---------

Co-authored-by: sup39 <dev@sup39.dev>
2024-04-30 22:51:40 +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
22c751ced0
fix(napi-derive): bail the unexpected factory directive (#2051)
- Close https://github.com/napi-rs/napi-rs/issues/2048
2024-04-18 00:14:00 +08:00
LongYinan
8f5d7e5274
fix(napi): handle panic in async block (#2050)
- Close https://github.com/napi-rs/napi-rs/issues/2047
2024-04-17 23:34:47 +08:00
LongYinan
dacfeac1f5
Release independent packages
napi@3.0.0-alpha.2
2024-04-15 23:59:37 +08:00
LongYinan
e3a403b441
feat(napi): allow user defined tokio runtime (#2040) 2024-04-15 23:58:28 +08:00