node icon indicating copy to clipboard operation
node copied to clipboard

node-api: use WriteV2 in napi_get_value_string_utf16

Open tniessen opened this issue 7 months ago • 3 comments

Since String::Write() is deprecated, use String::Write2() instead. That requires us to compute the correct number of characters ahead of time but removes the need for dealing with the return value.

tniessen avatar May 04 '25 16:05 tniessen

Review requested:

  • [ ] @nodejs/node-api

nodejs-github-bot avatar May 04 '25 16:05 nodejs-github-bot

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.23%. Comparing base (6de55f7) to head (da6a60e). Report is 306 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58165      +/-   ##
==========================================
+ Coverage   90.17%   90.23%   +0.05%     
==========================================
  Files         630      633       +3     
  Lines      186503   186807     +304     
  Branches    36614    36665      +51     
==========================================
+ Hits       168187   168565     +378     
+ Misses      11124    11041      -83     
- Partials     7192     7201       +9     
Files with missing lines Coverage Δ
src/js_native_api_v8.cc 76.55% <100.00%> (+0.02%) :arrow_up:

... and 86 files with indirect coverage changes

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

codecov[bot] avatar May 04 '25 16:05 codecov[bot]

Could you also replace the other deprecated Write functions in this file - the WriteOneByte and WriteUtf8?

vmoroz avatar May 04 '25 18:05 vmoroz

CI: https://ci.nodejs.org/job/node-test-pull-request/66810/

nodejs-github-bot avatar May 15 '25 13:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66835/

nodejs-github-bot avatar May 16 '25 10:05 nodejs-github-bot

Landed in 971148c39a0eadaa3b4e2395d2574dee68648875

nodejs-github-bot avatar May 16 '25 16:05 nodejs-github-bot

Adding https://github.com/nodejs/node/labels/dont-land-on-v22%2Ex as it looks like WriteV2 is not available on 22.x.

aduh95 avatar Jun 10 '25 10:06 aduh95