summaryrefslogtreecommitdiff
path: root/ext/napi/lib.rs
AgeCommit message (Collapse)Author
2024-11-04refactor(runtime/permissions): use concrete error types (#26464)Leo Kettmeir
2024-10-29fix(ext/napi): export dynamic symbols list for {Free,Open}BSD (#26605)Volker Schlecht
The two BSD ports are reusing the Linux code here.
2024-10-24feat: support node-api in denort (#26389)snek
exposes node-api symbols in denort so that `deno compile` can run native addons.
2024-10-17refactor(ext/napi): use concrete error types (#26186)Leo Kettmeir
2024-09-16refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)David Sherret
This makes the permission system more versatile.
2024-08-28fix(napi): Fix worker threads importing already-loaded NAPI addon (#25245)Nathan Whitaker
Part of #20613. If a node addon is using the legacy `napi_module_register` on ctor approach to module registration, we have to store the registered module so that other threads can load the addon (because `napi_module_register` will only be called once per process).
2024-08-19feat: upgrade deno_core (#25042)snek
- Update ffi turbocall to use revised fast call api - Remove `v8_version` function calls - `*mut OwnedIsolate` is no longer stored in OpCtx gotham store
2024-07-23Revert "chore: move all node-api impl to ext (#24662)" (#24680)Bartek Iwańczuk
This reverts commit d00fbd70258a77a267fe20bdd2c4a028c799b693. Reverting because, it caused a failure during v1.45.3 publish: https://github.com/denoland/deno/actions/runs/10048730693/job/27773718095
2024-07-22chore: move all node-api impl to ext (#24662)snek
these symbols are re-exported from runtime/cli using `build.rs`, so we don't need them in the same crate.
2024-06-19fix: more node-api fixes (#24220)snek
- add fallback impls of external string apis which always copy. after upstream changes to rusty_v8 we can support non-copying api as well. - `napi_get_buffer_data` needs to work on all TypedArray instances. - Fixes: https://github.com/denoland/deno/issues/24209 - `target_defaults.default_configuration` is used by some modules to find the corresponding node file from node-gyp - `node_api_get_module_filename` expects the filename to be a `file:` url.
2024-06-11fix: clean up some node-api details (#24178)snek
- fix a few napi_* types - clean up env hooks - implement blocking queue in tsfn - reduce transmutes - use new `DataView::new` api from rusty_v8
2024-06-10fix: Rewrite Node-API (#24101)snek
Phase 1 node-api rewrite
2024-06-06refactor: remove `PermissionsContainer` in deno_runtime (#24119)David Sherret
Also removes permissions being passed in for node resolution. It was completely useless because we only checked it for reading package.json files, but Deno reading package.json files for resolution is perfectly fine. My guess is this is also a perf improvement because Deno is doing less work.
2024-04-10chore: update to Rust 1.77.2 (#23262)林炳权
update to Rust 1.77.2 --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-27fix(ext/node): limit OpState borrow in op_napi_open (#22151)Matt Mastracci
Fixes #22150
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-11perf(ext/napi): port NAPI to v8 tasks (#21406)Matt Mastracci
Part 2 of removing middleware. This is somewhat awkward because `V8CrossThreadTaskSpawner` requires tasks to be `Send`, but NAPI makes heavy use of `!Send` pointers. In addition, Rust causes a closure to be `!Send` if you pull a `!Send` value out of a struct. --------- Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-09-23refactor: rewrite ops to op2 macro (#20628)Bartek Iwańczuk
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-06-07fix(napi): don't panic if symbol can't be found (#19397)Bartek Iwańczuk
This should return an error to the caller to make it easier to track what went wrong. Should help with debugging https://github.com/denoland/deno/issues/19389
2023-05-26fix(napi): clear currently registering module slot (#19249)Bartek Iwańczuk
This commit fixes problem with loading N-API modules that use the "old" way of registration (using "napi_module_register" API). The slot was not cleared after loading modules, causing subsequent calls that use the new way of registration (using "napi_register_module_v1" API) to try and load the previous module. Ref https://github.com/denoland/deno/issues/16460 --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-05-18refactor(napi): simplify types (#19179)Bartek Iwańczuk
This commit removes "Error" and "Result" structs from "ext/napi". In turn all NAPI functions now return "napi_status" instead of "napi::Result".
2023-05-18fix(cli/napi): handle finalizers (#19168)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17325
2023-03-17feat(core) deno_core::extension! macro to simplify extension registration ↵Matt Mastracci
(#18210) This implements two macros to simplify extension registration and centralize a lot of the boilerplate as a base for future improvements: * `deno_core::ops!` registers a block of `#[op]`s, optionally with type parameters, useful for places where we share lists of ops * `deno_core::extension!` is used to register an extension, and creates two methods that can be used at runtime/snapshot generation time: `init_ops` and `init_ops_and_esm`. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-09fix: Split extension registration and snapshotting (#18098)Bartek Iwańczuk
This commit partially reverts changes from https://github.com/denoland/deno/pull/18095. Turns out I made a mistake that became apparent when working on removing "RuntimeOptions::extensions_with_js" in a follow up.
2023-03-07refactor(core): don't use Result in ExtensionBuilder::state (#18066)Bartek Iwańczuk
There's no point for this API to expect result. If something fails it should result in a panic during build time to signal to embedder that setup is wrong.
2023-02-14feat(node): stabilize Node-API (#17553)Bartek Iwańczuk
This commit stabilizes Node-API, the "--unstable" flag is no longer required to load native extensions. "--allow-ffi" permission is still required to load them.
2023-02-01fix(napi): return node globalThis from napi_get_global (#17613)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17587
2023-01-28fix(napi): guard threadsafe function counters behind a mutex (#17552)Bartek Iwańczuk
2023-01-23fix(napi): handle return value from initializer (#17502)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17349
2023-01-18fix(napi): don't hold on to borrow during iteration (#17461)Bartek Iwańczuk
I mistakenly held on to a RefCell's borrow for the whole time of iteration, but since these counters can be refed/unrefed from any thread that is a mistake.
2023-01-15fix(napi): functions related to errors (#17370)Bartek Iwańczuk
This commits fixes various NAPI functions related to creation and throwing of errors.
2023-01-13fix(napi): allow cleanup hook to remove itself (#17402)Bartek Iwańczuk
This commit fixes "cleanup hooks" in NAPI integration in two ways: - don't hold to RefCell's borrow while iterating over hooks - allow a hook to remove itself when being called
2023-01-12fix(napi): Implement `napi_threadsafe_function` ref and unref (#17304)Divy Srivastava
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-10fix(napi): support for env cleanup hooks (#17324)Bartek Iwańczuk
This commit adds support for "napi_add_env_cleanup_hook" and "napi_remove_env_cleanup_hook" function for Node-API.
2023-01-10fix(napi): handle static properties in classes (#17320)Bartek Iwańczuk
Adds support for static properties when using "napi_define_class".
2023-01-08feat(core): allow specifying name and dependencies of an Extension (#17301)Leo Kettmeir
2023-01-05refactor(cli,core,ext,rt): remove some unnecessary `clone` or `malloc` (#17274)Yiyu Lin
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-13feat(napi): improve napi coverage (#16198)Divy Srivastava
2022-10-07refactor(napi): simplify `napi_value` interface (#16170)Divy Srivastava
2022-10-05feat(npm): implement Node API (#13633)Divy Srivastava
This PR implements the NAPI for loading native modules into Deno. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org>