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?
* 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>
* 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>
`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.
* Refactor js-binding to support bundling single-package artifacts
The existsSync check breaks the bundlers I've tested (esbuild, webpack,
ncc), so you cannot bundle napi-rs packages that have all binarys in a
single package.
I've tested this change with both single package and multi package
libraries.
* Update snapshots
* Update CI
* Fix electron test
---------
Co-authored-by: Caleb ツ Everett <calebev@amazon.com>
Co-authored-by: LongYinan <lynweklm@gmail.com>