373 Commits

Author SHA1 Message Date
LongYinan
bcf5e14aa8
feat(napi): add from_napi_value for Ref<T: FromNapiValue> (#2603) 2025-05-05 23:38:46 +08:00
LongYinan
55bed7e3fb
test(example): join all threads before return (#2600) 2025-05-05 14:30:53 +08:00
LongYinan
674d7c7b56
refactor!(napi): add lifetime to Array (#2599) 2025-05-05 14:16:53 +08:00
renovate[bot]
407a400ca0
chore(deps): update dependency @oxc-node/core to ^0.0.27 (#2595)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-03 16:17:48 +00:00
renovate[bot]
4baae8dfb2
chore(deps): update dependency @oxc-node/core to ^0.0.25 (#2588)
* chore(deps): update dependency @oxc-node/core to ^0.0.25

* Update oxnode

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-05-03 08:55:22 +00:00
renovate[bot]
69a092eb43
chore(deps): update dependency electron to v36 (#2577)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-03 15:51:53 +08:00
renovate[bot]
a495e55e84
chore(deps): update dependency @oxc-node/core to ^0.0.24 (#2576)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-28 17:00:37 +00:00
Cong-Cong Pan
0ce726d9c7
feat(napi): serde value ref to napi_value (#2550)
* perf: convert serde value ref to napi_value

* chore: add test case

* fix: snapshot
2025-04-10 16:17:59 +08:00
renovate[bot]
9edd39a037
chore(deps): update dependency @oxc-node/core to ^0.0.23 (#2552)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-10 03:13:17 +00:00
LongYinan
ff2c64b35d
chore: clippy fix (#2545) 2025-04-04 13:52:49 +08:00
renovate[bot]
c9c49973c1
chore(deps): update dependency @oxc-node/core to ^0.0.22 (#2543)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-02 11:43:39 +00:00
LongYinan
5554c663ac
chore(cli): update deps (#2542) 2025-04-01 23:49:56 +08:00
LongYinan
59b31b389f
chore(cli): excludeNetwork on getting report (#2531)
* chore(cli): excludeNetwork on getting report

* Update cli/src/api/templates/js-binding.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* format

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-29 23:26:35 +08:00
renovate[bot]
06215529d8
chore(deps): update dependency sinon to v20 (#2526)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-26 21:32:30 +08:00
LongYinan
3dd9143630
fix(napi): re-create async runtime (#2519) 2025-03-17 12:22:39 +08:00
LongYinan
c62acd2bfe
chore: upgrade npm dependencies (#2516) 2025-03-16 22:29:04 +08:00
renovate[bot]
c57ac0cc79
chore(deps): update dependency @oxc-node/core to ^0.0.21 (#2515)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-16 14:07:53 +00:00
Cong-Cong Pan
cc9989f4ac
fix(napi): js callback in threadsafefunction should not be Send (#2510) 2025-03-16 21:56:29 +08:00
LongYinan
1fe6ad0430
feat(napi): tokio multi-thread mode on wasi (#2501)
* feat(napi): tokio multi-thread mode on wasi

* tokio_unstable flag

* snapshot

* ensure runtime

* oncelock combine lazylock

* noop feature
2025-03-13 23:53:19 +08:00
renovate[bot]
a25504a577
chore(deps): update dependency @oxc-node/core to ^0.0.20 (#2498)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-05 12:12:04 +00:00
renovate[bot]
26d89a6f25
chore(deps): update dependency electron to v35 (#2495)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-05 04:17:24 +00:00
LongYinan
68bf0c7561
chore(example): add extends JavaScript Error (#2497) 2025-03-05 11:28:26 +08:00
LongYinan
ee75b119cd
refactor!(napi): link crt1-reactor.o as poor man's wasi-exec-model=reactor (#2480) 2025-02-25 21:45:38 +08:00
LongYinan
ed6da2b741
fix(napi): compile error on noop feature (#2478) 2025-02-24 23:19:47 +08:00
LongYinan
86548570f2
fix(napi): compatible with Rust 1.85 (#2477)
Ref: https://github.com/rust-lang/rust/issues/137510
2025-02-24 20:14:12 +08:00
LongYinan
d96bd288de
fix!(napi): upgrade to ctor 0.3.6 (#2472) 2025-02-20 12:22:29 +08:00
LongYinan
0ce8fab19c
chore(napi): merge thread cleanup (#2469) 2025-02-16 16:55:16 +08:00
LongYinan
8d8ccdfc77
refactor!(napi): TypedArray API surfaces (#2462) 2025-02-11 13:35:43 +08:00
lghuahua
8ea8e9ebfc
feat(napi-derive): impl #[napi(array)] (#2459) 2025-02-11 13:35:27 +08:00
lghuahua
cc4d8bfa84
fix(napi-derive): enable tuple fields to support js_name attribute (#2439)
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-01-22 12:10:26 +08:00
renovate[bot]
98e16fad8b
chore(deps): update dependency @oxc-node/core to ^0.0.19 (#2438)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-20 04:23:42 +00:00
renovate[bot]
1b24837445
chore(deps): update dependency @oxc-node/core to ^0.0.18 (#2434)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-20 02:57:22 +00:00
renovate[bot]
8ce7f77e5d
chore(deps): update dependency electron to v34 (#2428)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-20 09:48:41 +08:00
renovate[bot]
63b8ace192
chore(deps): update dependency vite-plugin-node-polyfills to ^0.23.0 (#2431)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-19 07:33:06 +00:00
renovate[bot]
e8d48e14d4
chore(deps): update vitest monorepo to v3 (#2429)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-17 15:19:49 +08:00
renovate[bot]
f03807e465
chore(deps): update dependency @oxc-node/core to ^0.0.17 (#2427)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-13 04:59:26 +00:00
LongYinan
ea05ad3845
fix(napi-derive): hide the lifetime recursively in codegen (#2426) 2025-01-12 22:36:14 +08:00
LongYinan
24e6bd38f3
chore: remove ts-node in examples/napi test (#2425) 2025-01-12 19:22:37 +08:00
LongYinan
05572bf1d4
feat(napi): allow create ReadableStream from polyfill (#2424) 2025-01-12 15:32:12 +08:00
LongYinan
73d5c1d803
fix(napi): add back Buffer/TypedArray custom gc on wasi (#2421) 2025-01-12 11:45:50 +08:00
LongYinan
98cb7671d3
feat(napi): impl ReadableStream and AsyncGenerator (#2418)
* feat(napi): impl ReadableStream and AsyncGenerator

* clippy fix

* Into<Vec<u8>> trait

* Skip node18 stream test due to Node.js bug

* Cleanup

* Also skip wasi test

* Merge test

* Skip wasi

* Useless expect-error
2025-01-03 17:09:42 +08:00
lghuahua
31cd07c8c2
feat(napi-derive): support type on #[napi] (#2416)
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-01-02 17:15:07 +08:00
richerfu
5f7415c1fe
fix(napi): Function call with empty tuple should generate empty arguments (#2407)
Co-authored-by: LongYinan <lynweklm@gmail.com>
2025-01-02 17:10:53 +08:00
Stanisław Czech
b4b74d6f1f
refactor!(napi): arguments tuple behavior (#2401)
* Implement FromNapiValue trait as macro

Code behavior should remain the same, with much less copy-pasting of the same code.
Additionally, this commit adds a unit tests for test for FromNapiValue
for tuple trait which appears to be currently missing.

* Simplify macro arr_get

Rewrite the macro to reduce the size of expanded code of the macro
(from 4088 to 2429 lines). Although this is a minor change,
this may help reduce the size of compiled library.

* Refactor typegen Type::Path

Removes the need for keeping mutable variable, as its only assigned once.

* [API BREAKING] Update api for calling functions.

This commit introduces new type FnArgs,
that is created with the goal of distinguishing between
calling JS function from rust with tuple as argument
and calling with multiple arguments.

Currently there is no possibility to add ToNapiValue value,
as tuple is used to call callback functions with more than one
argument from rust.

With this change, callbacks with multiple arguments,
should be called, with converting tuple of argument
into FnArgs struct, either by calling into() on such
tuple, or by creating FnArgs struct directly.

* Add support for FnArgs when generating TS types

Updated the macro for generating typescript types,
to correctly handle FnArgs struct. This is now treated
as passthrough type and generates the output from the
type inside of FnArgs struct.

* Implement ToNapiValue trait for tuple

With the changes to callback calling API, it's now possible
to safely add this change. This change allows to pass tuple
from rust code to JS to match the existing FromNapiValue trait
currently existing in the library.
2025-01-02 16:58:58 +08:00
LongYinan
8fffa49282
fix(napi): resuse threads worker on Node.js (#2399) 2024-12-18 23:48:30 +08:00
underfin
533635619e
fix(napi): delete error reference with raw Error (#2388)
* fix: delete error reference at drop

* fix: ci

* fix: ci

* fix: ci

* fix: ci

* fix: avoid using drop
2024-12-09 19:17:16 +08:00
renovate[bot]
77fe9757fc
chore(deps): lock file maintenance (#2380)
* chore(deps): lock file maintenance

* Fix typecheck

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: LongYinan <lynweklm@gmail.com>
2024-12-03 15:28:37 +08:00
Hiroshi Ogawa
61543c0f45
fix(napi): handle nul byte in object key (#2385)
* fix: fix to_napi_value

* test: add test

* fix: fix from_napi_value

* fix: fix object.get/set

* test: test plain object

* test: snapshot
2024-12-03 14:17:18 +08:00
翠 / green
6a4ce688c4
fix(napi-derive): generate correct types for HashMap with RandomState argument (#2384)
* fix(napi-derive): generate correct types for HashMap with RandomState argument

* chore: update snapshot
2024-12-02 22:37:00 +08:00
LongYinan
4c7a3d3264
chore: Rust 1.83.0 clippy fix (#2378) 2024-11-30 10:49:01 +08:00