summaryrefslogtreecommitdiff
path: root/cli/napi/js_native_api.rs
AgeCommit message (Collapse)Author
2024-04-18fix(ext/node): remove unwraps from fallible conversions (#23447)Bartek Iwańczuk
Removes `.unwrap()` calls from fallible conversion and replaces with graceful error returns.
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-18fix(ext/napi): don't close handle scopes in NAPI as the pointers are invalid ↵Matt Mastracci
(#21629) `napi_open_handle_scope` was returning a bogus handle_scope and we were trying to close it in `napi_close_handle_scope`. This is a bit of a challenge to test, but the following testcase comes from #21601 and appears to be fixed by this. ``` import { decode } from "https://deno.land/std@0.209.0/encoding/base64.ts"; import sharp from "npm:sharp"; const img = 'iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEWq09/P7Lz1AAAAH0lEQVRoge3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAvg0hAAABmmDh1QAAAABJRU5ErkJggg=='; Deno.test("async", async () => { const id = setTimeout(() => Deno.exit(1), 1000); await sharp(decode(img)).toBuffer(); await sharp(decode(img)).toBuffer(); clearTimeout(id); }); ```
2023-08-26chore: update to Rust 1.72 (#20258)林炳权
<!-- Before submitting a PR, please read https://deno.com/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> As the title. --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-06-21fix(cli/napi): property with getter/setter always failed (#19562)Dj
with `napi_define_properties`.
2023-06-21fix(cli/napi): `napi_get_buffer_info` accepts `ArrayBufferView` … (#19551)Dj
... not just `Uint8Array`. This PR aligns behavior with Node.js Node-API implementation.
2023-05-26chore: upgrade rusty_v8 to 0.73.0 (#19278)Bartek Iwańczuk
2023-05-26fix(napi): properly handle arguments in napi_get_cb_info (#19269)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/17213
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-05-18fix(napi): BigInt related APIs (#19174)Bartek Iwańczuk
Doesn't make the API bullet-proof and there are some TODOs left, but greatly improves the situation. Tests were ported from Node.js. Closes https://github.com/denoland/deno/issues/18276.
2023-03-09chore: update Rust to 1.68.0 (#18102)Bartek Iwańczuk
2023-02-10fix(cli/napi): correct name handling in napi property descriptor (#17716)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17712
2023-02-10fix(cli/napi): handle all property variants in napi_define_properties (#17680)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17509 This fixes the bug that blocked loading `fsevents` in Deno.
2023-02-01fix(napi): remove wrong length check in napi_create_function (#17614)Divy Srivastava
This check is not needed. This PR + #17613 makes `npm:ref-napi` work with Deno.
2023-02-01fix(napi): return node globalThis from napi_get_global (#17613)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17587
2023-01-23fix(napi): improve napi_adjust_external_memory (#17501)Divy Srivastava
<!-- Before submitting a PR, please read http://deno.land/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. -->
2023-01-23fix(napi): improve napi_is_detached_arraybuffer (#17498)Divy Srivastava
2023-01-23fix(napi): improve napi_detach_arraybuffer (#17499)Divy Srivastava
2023-01-22fix(napi): correctly handle name in napi_create_function (#17489)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17472
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-14fix(napi): correct arguments for napi_get_typedarray_info (#17306)Bartek Iwańczuk
2023-01-13fix(napi): date and unwrap handling (#17369)Bartek Iwańczuk
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-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-17chore: update to Rust 1.66.0 (#17078)linbingquan
2022-12-13feat(napi): improve napi coverage (#16198)Divy Srivastava
2022-12-05napi: respect --quiet flag in unimplemented warnings (#16935)Bartek Iwańczuk
2022-11-30chore: upgrade rusty_v8 to 0.58.0 (#16879)Bartek Iwańczuk
2022-11-12chore: upgrade rusty_v8 to 0.55.0 (#16604)Bartek Iwańczuk
<!-- Before submitting a PR, please read http://deno.land/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. -->
2022-10-30fix(napi): fix is_detached_arraybuffer (#16478)Marcos Casagrande
2022-10-07perf(napi): optimize primitive napi functions (#16163)Divy Srivastava
This optimization applies on `napi_get_undefined`, `napi_get_null` & `napi_get_boolean`. ``` # main benchmark time (avg) (min … max) p75 p99 p995 ---------------------------------------------------------- ----------------------------- warmup 482.55 ps/iter (462.5 ps … 15.67 ns) 475 ps 525 ps 829.1 ps napi_get_undefined 25.07 ns/iter (24.03 ns … 36.87 ns) 25.37 ns 27.09 ns 34.85 ns ``` ``` # This patch benchmark time (avg) (min … max) p75 p99 p995 ---------------------------------------------------------- ----------------------------- warmup 484.78 ps/iter (462.5 ps … 14.4 ns) 475 ps 554.1 ps 583.3 ps napi_get_undefined 15.52 ns/iter (15.35 ns … 22.14 ns) 15.41 ns 17.18 ns 20.02 ns ```
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>