420 Commits

Author SHA1 Message Date
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
Richer
fec8ff4704
chore(example): use BufferSlice to replace JsBuffer (#2269)
* chore(example): use BufferSlice to replace JsBuffer

* chore: use BufferSlice to replace env method
2024-09-22 22:53:15 +08:00
LongYinan
0698bb1d80
feat(napi-derive): allow napi fn with lifetime (#2266) 2024-09-21 12:26:41 +08:00
LongYinan
fc4b6a632d
refactor(napi-derive): expand order (#2265) 2024-09-20 22:44:34 +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
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
LongYinan
20b9de3ec7
fix(cli): extra line break in the tail of dts file (#2255) 2024-09-15 11:44:29 +08:00
renovate[bot]
382ed9442c
chore(deps): update dependency sinon to v19 (#2251) 2024-09-14 09:57:39 +08:00
LongYinan
bf8f568788
refactor!(napi): Ref should not hold the value ptr (#2243)
It's unsafe
2024-09-12 23:25:09 +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
renovate[bot]
650ce155e2
chore(deps): update dependency electron to v32 (#2221) 2024-08-20 19:42:26 +08:00
renovate[bot]
fa43fe13c9
chore(deps): update dependency webdriverio to v9 (#2218) 2024-08-19 09:40:15 +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
LongYinan
3f6822d9cd
test: skip unstable test in WASI env (#2196) 2024-07-24 12:09:08 +08:00
LongYinan
13c18388f5
fix(cli): worker files format (#2186) 2024-07-14 22:23:34 +08:00
LongYinan
727f5a831a
test: skip memory exhausting test in wasi env (#2185) 2024-07-13 02:34:04 +08:00
renovate[bot]
4d39940fa0
chore(deps): update vitest monorepo to v2 (major) (#2177)
* chore(deps): update vitest monorepo to v2

* Fix lockfile

* Add playwright

* Update snapshots

* Fix vitest

* Fix vitest

* Fix wasi test

* Fix worker test condition

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: LongYinan <lynweklm@gmail.com>
2024-07-11 14:58:46 +08:00
LongYinan
731dced1bb
fix(cli): update wasi js binding files on any builds (#2179) 2024-07-09 14:01:23 +08:00
LongYinan
45a404c30b
ci: use shell to run tests in Docker (#2175) 2024-07-08 15:18:50 +08:00
LongYinan
349996b699
test: update snapshots 2024-07-07 22:34:36 +08:00
LongYinan
38d041569a
fix(napi-derive): PromiseRaw typegen 2024-07-07 21:03:14 +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
bc9e931a4e
feat(napi): provide PromiseRaw for non-await scenario (#2168) 2024-07-06 19:09:16 +08:00
LongYinan
aef57fb196
feat(napi): impl from_string for Uint8Array (#2167) 2024-07-06 14:32:09 +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
d7a5a7e9a1
test(napi): spwan thread in thread (#2139) 2024-06-24 16:09:07 +08:00
LongYinan
ea623903d8
chore: clippy fix (#2144) 2024-06-18 13:20:43 +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
renovate[bot]
50b9110ea1
chore(deps): update dependency electron to v31 (#2136) 2024-06-11 12:50:00 +08:00
Ranger
80d9d87ef9
chore(example): remove JsFunction from example (#2123)
* chore(example): remove jsfunction

* feat(napi): implement ToNapiValue for Ref as required by TSFN

* fix(test): tsfn test build failed

* chore: lint code

* fix(test): fix tsfn unit test
2024-05-26 21:07:01 +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
renovate[bot]
34723ca005
chore(deps): update dependency vite-plugin-node-polyfills to ^0.22.0 (#2119)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [vite-plugin-node-polyfills](https://togithub.com/davidmyersdev/vite-plugin-node-polyfills) | [`^0.21.0` -> `^0.22.0`](https://renovatebot.com/diffs/npm/vite-plugin-node-polyfills/0.21.0/0.22.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/vite-plugin-node-polyfills/0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite-plugin-node-polyfills/0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite-plugin-node-polyfills/0.21.0/0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite-plugin-node-polyfills/0.21.0/0.22.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>davidmyersdev/vite-plugin-node-polyfills (vite-plugin-node-polyfills)</summary>

### [`v0.22.0`](https://togithub.com/davidmyersdev/vite-plugin-node-polyfills/releases/tag/v0.22.0)

[Compare Source](https://togithub.com/davidmyersdev/vite-plugin-node-polyfills/compare/v0.21.0...v0.22.0)

-   Stop defining globals when they are disabled

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/napi-rs/napi-rs).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjMuNSIsInVwZGF0ZWRJblZlciI6IjM3LjM2My41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2024-05-20 12:22:55 +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
renovate[bot]
04da0d9fd1
chore(deps): update dependency sinon to v18 (#2112)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-16 14:27:55 +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
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
renovate[bot]
da31e367e1
chore(deps): update dependency vite-plugin-node-polyfills to ^0.21.0 (#2066)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-23 12:54:22 +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
12aec3c135
fix(cli): pass fs to browser worker binding (#2062) 2024-04-22 14:44:37 +08:00
LongYinan
4ccbb61179
feat(cli): improve the browser binding (#2056) 2024-04-19 16:12:30 +08:00