205 Commits

Author SHA1 Message Date
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
Richer
814188f1ad
fix(derive): fix clippy warning with newer rust version (#2262) 2024-09-19 21:55:48 +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
Richer
58bcb64c19
fix(napi-derive): call flush on the BufWriter (#2242) 2024-09-02 14:16:00 +08:00
Richer
b9c884e788
fix(macro): constructor don't support asynchronous function (#2239) 2024-08-31 10:40:49 +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
CPunisher
e02ec1e87c
Replace self for Result<T> (#2224) 2024-08-22 14:59:00 +08:00
LongYinan
2e5bf773e3
fix(napi-derive): warning in empty enum codegen (#2214) 2024-08-10 22:30:50 +08:00
LongYinan
22dba74813
Release independent packages
- napi-derive@3.0.0-alpha.7
2024-07-23 22:07:15 +08:00
Louis
f88b90f71e
fix(napi-derive): call flush on the BufWriter (#2195)
This is mandated by the Rust doc of the BufWriter. We've also seen bugs where
the data doesn't seem to be flushed properly, and thus the CLI fails to parse
JSONs emitted by napi-derive. This might be it, or not, but flushing shouldn't
hurt.
2024-07-23 21:08:13 +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
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
1228e918e9
Release independent packages
- napi-derive@3.0.0-alpha.3
2024-07-01 13:28:46 +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
Ranger
a3b01870a3
feat(napi): support External for compact mode and add JsExternal as deprecated (#2125) 2024-05-26 14:43:33 +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
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
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
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
Andrew Toth
6b1058a268
feat(napi-derive): add optional enum_string case conversion (#1995) 2024-03-11 20:10:00 +08:00
LongYinan
e3e8a0fb39
Release independent packages
napi@2.16.0

napi-derive@2.16.0
2024-02-28 15:06:11 +08:00
サポミク
ebe97257a6
feat(napi-derive): add use_nullable attribute (#1971)
* feat(napi-derive): add use_nullable attribute

Co-authored-by: naskya <m@naskya.net>

* chore(napi-derive): update tests

Co-authored-by: naskya <m@naskya.net>

---------

Co-authored-by: naskya <m@naskya.net>
2024-02-24 21:49:54 +08:00
LongYinan
9e44fd635b
fix(napi-derive): napi-derive-backend version 2024-02-20 15:17:43 +08:00
LongYinan
97039b2f08
Release independent packages
- napi@2.15.2
- napi-derive@2.15.2
2024-02-17 22:58:31 +08:00
LongYinan
b6adf8ae5c
Release independent packages
napi-derive@2.15.1
2024-02-08 20:41:49 +08:00
LongYinan
a6aaa94e7d
Release independent packages
- napi@2.15.0
- napi-derive@2.15.0
2024-01-26 14:32:24 +08:00
LongYinan
5825dcc3a6
Release independent packages
- napi-derive@2.14.6
2023-12-27 22:10:41 +08:00
LongYinan
84f3092d70
fix(napi-derive): proc-macro crash on enum (#1870) 2023-12-27 21:18:02 +08:00
LongYinan
85807ad790
Release independent packages
- napi-derive@2.14.5
2023-12-27 12:53:10 +08:00
liuyi
6f40f94d09
fix(napi-derive): more accurate napi expanding error (#1854) 2023-12-13 15:23:00 +08:00
LongYinan
af248435ac
Release independent packages
- napi-derive@2.14.4
2023-12-13 13:27:53 +08:00
liuyi
e32c105a26
fix(napi-derive): upgrade syn (#1849) 2023-12-13 12:40:01 +08:00
LongYinan
1dda26e6cd
Release independent packages
napi-derive@2.14.3
2023-12-11 10:52:55 +08:00
LongYinan
dab4ce7fe0
fix(napi-derive,cli): register function cross crates (#1848) 2023-12-11 00:36:26 +08:00
LongYinan
e4ac44e560
Release independent packages
- napi@2.14.1
- napi-derive@2.14.2
2023-11-20 17:18:35 +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
7c3f8b514e
fix(napi-derive): compile warning (#1820) 2023-11-20 14:20:25 +08:00
LongYinan
529317b5ef
Release independent packages
- napi-derive@2.14.1
2023-11-08 20:58:25 +08:00
LongYinan
938f4df83d
fix(napi-derive): async task void output type (#1795) 2023-11-08 20:05:09 +08:00
LongYinan
688ee04247
Release independent packages
- napi-build@2.1.0
- napi-derive@2.14.0
- napi@2.14.0
- napi-sys@2.3.0
2023-11-07 14:18:36 +08:00
LongYinan
0dc1ef738b fix(napi): asan caught memory safety issue 2023-11-04 15:26:07 +08:00
LongYinan
9db4581d7f
feat: bump msrv to 1.65 (#1755) 2023-10-17 20:18:29 +08:00
LongYinan
07d03c9435
chore: MSRV 1.63.0 2023-08-10 10:44:55 +08:00
LongYinan
433e5b13bf
Release independent packages
napi@2.13.0

napi-derive@2.13.0
2023-05-27 12:28:43 +08:00
LongYinan
1f0edfa6f2
Release independent packages
napi-derive@2.12.5
2023-04-26 15:19:52 +08:00
LongYinan
9a220bd1c2
Release independent packages
napi@2.12.6

napi-derive@2.12.4
2023-04-25 13:27:53 +08:00