Skip to content

node-api: support SharedArrayBuffer in napi_create_typedarray#62710

Merged
nodejs-github-bot merged 4 commits into
nodejs:mainfrom
umuoy1:feat/napi-typedarray-sharedarraybuffer
May 13, 2026
Merged

node-api: support SharedArrayBuffer in napi_create_typedarray#62710
nodejs-github-bot merged 4 commits into
nodejs:mainfrom
umuoy1:feat/napi-typedarray-sharedarraybuffer

Conversation

@umuoy1
Copy link
Copy Markdown
Contributor

@umuoy1 umuoy1 commented Apr 12, 2026

This PR updates napi_create_typedarray() to accept SharedArrayBuffer in addition to ArrayBuffer.

Today, napi_create_dataview() already accepts both ArrayBuffer and SharedArrayBuffer, but napi_create_typedarray() still only accepts ArrayBuffer. This creates an inconsistency in Node-API behavior and does not align with JavaScript semantics, where TypedArrays can be backed by SharedArrayBuffer.

Signed-off-by: umuoy1 <burningdian@gmail.com>
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/node-api

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API. labels Apr 12, 2026
Signed-off-by: umuoy1 <burningdian@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 12, 2026

Codecov Report

❌ Patch coverage is 67.64706% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.64%. Comparing base (dfe438d) to head (2bbc868).
⚠️ Report is 311 commits behind head on main.

Files with missing lines Patch % Lines
src/js_native_api_v8.cc 67.64% 0 Missing and 11 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62710      +/-   ##
==========================================
- Coverage   89.81%   89.64%   -0.17%     
==========================================
  Files         699      708       +9     
  Lines      216379   220381    +4002     
  Branches    41366    42270     +904     
==========================================
+ Hits       194340   197569    +3229     
- Misses      14139    14676     +537     
- Partials     7900     8136     +236     
Files with missing lines Coverage Δ
src/js_native_api_v8.cc 76.63% <67.64%> (+0.14%) ⬆️

... and 121 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@umuoy1 umuoy1 marked this pull request as draft April 13, 2026 09:15
Signed-off-by: umuoy1 <burningdian@gmail.com>
@umuoy1 umuoy1 changed the title src,doc,test: accept SharedArrayBuffer in napi_create_typedarray node-api: support SharedArrayBuffer in napi_create_typedarray Apr 13, 2026
@umuoy1 umuoy1 marked this pull request as ready for review April 13, 2026 10:34
@legendecas legendecas moved this from Need Triage to In Progress in Node-API Team Project Apr 24, 2026
Comment thread test/js-native-api/test_typedarray_sharedarraybuffer/binding.gyp Outdated
Copy link
Copy Markdown
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM. Thanks for the PR!

@umuoy1
Copy link
Copy Markdown
Contributor Author

umuoy1 commented Apr 28, 2026

Thanks! I have addressed the suggestion.

@umuoy1 umuoy1 requested a review from legendecas April 28, 2026 17:08
@legendecas legendecas added request-ci Add this label to start a Jenkins CI on a PR. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Apr 28, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 28, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@umuoy1
Copy link
Copy Markdown
Contributor Author

umuoy1 commented May 13, 2026

Hi @legendecas @vmoroz , just checking in on this PR.

It has two approvals now, and CI has run after the latest commit. Is there anything else I should do, or could it be added to the commit queue if everything looks good?

Thanks!

@legendecas legendecas added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 13, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@legendecas legendecas added the commit-queue Add this label to land a pull request using GitHub Actions. label May 13, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 13, 2026
@nodejs-github-bot nodejs-github-bot merged commit c24e552 into nodejs:main May 13, 2026
92 of 95 checks passed
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in c24e552

@github-project-automation github-project-automation Bot moved this from In Progress to Done in Node-API Team Project May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API.

Projects

Development

Successfully merging this pull request may close these issues.

4 participants