18 Commits

Author SHA1 Message Date
Igor Matuszewski
cc21452f65
fix(napi): nullptr handling in TypedArrays (#2258)
* fix: Safely return empty slices if TypedArray buffer is null ptr

* fix: Only dispose of TypedArray if the data is not a nullptr

* test: Add a regression test for typed array null ptr deref
2024-09-19 13:38:19 +08:00
Richer
5934ecd2a9
feat(napi): mark JsArraybufferValue's value pub (#2226) 2024-08-23 22:25:52 +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
LongYinan
d84fc42832
fix(napi-derive): string enum validate logic (#2213) 2024-08-10 21:27:17 +08:00
LongYinan
282ce1c00a
fix(napi): allow ThreadsafeFunction in Either (#2204) 2024-08-03 13:22:09 +08:00
LongYinan
3f6822d9cd
test: skip unstable test in WASI env (#2196) 2024-07-24 12:09:08 +08:00
LongYinan
731dced1bb
fix(cli): update wasi js binding files on any builds (#2179) 2024-07-09 14:01:23 +08:00
LongYinan
d7a5a7e9a1
test(napi): spwan thread in thread (#2139) 2024-06-24 16:09:07 +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
46cbcf3ff1
feat(cli): allow sync fs operation between workers/mainThread (#2064)
* feat(cli): allow sync fs operation between workers/mainThread

* allow sync fs operation between workers/mainThread (#2065)

* Fix

* Update fixture

* flaky test

* Fix cross compile target

* Update zig

* macos-cross test was filtered

---------

Co-authored-by: Toyo Li <lifenglin314@outlook.com>
2024-04-23 12:14:06 +08:00
LongYinan
4ccbb61179
feat(cli): improve the browser binding (#2056) 2024-04-19 16:12:30 +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
7e33eb729f
feat(cli): optimize wasm output binary (#2049) 2024-04-17 20:13:02 +08:00
LongYinan
cc937e1dba
feat(cli): allow control the wasm Memory options via napi config (#2038) 2024-04-15 23:19:02 +08:00
LongYinan
16f0d49284
chore: increase wasi memory limits (#2035) 2024-04-13 18:35:08 +08:00
LongYinan
4c7d06fc72
feat(cli): support wasm32-wasipxx targets (#2030)
* chore(examples): update wasi binding template

* wasm32-wasip1
2024-04-10 09:08:57 +08:00
Caleb Everett
95dd6ef485
refactor(cli): refactor js-binding to support easier bundling. (#1957)
* 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>
2024-02-26 15:46:07 +08:00