Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

src: port defineLazyProperties to native code #57081

Merged
merged 12 commits into from
Feb 18, 2025

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Feb 15, 2025

This allows us to have getters not observable from JS side, getting our implementation closer to the other runtimes.

This allows us to have getters not observable from JS side.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup
  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Feb 15, 2025
@panva panva added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Feb 16, 2025
Isolate* isolate = args.GetIsolate();
auto target = args[0].As<Object>();

if (target
Copy link
Member

Choose a reason for hiding this comment

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

I think instead of doing it in JS -> C++, we might as well just do it in BootstrapRealm() implementations directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try to do it in a follow up if no one beats me to it

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 72.97297% with 20 lines in your changes missing coverage. Please review.

Project coverage is 89.06%. Comparing base (579fc67) to head (55cf9bb).
Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
src/node_util.cc 70.21% 4 Missing and 10 partials ⚠️
src/node_messaging.cc 75.00% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57081      +/-   ##
==========================================
- Coverage   89.08%   89.06%   -0.02%     
==========================================
  Files         665      665              
  Lines      193248   193273      +25     
  Branches    37229    37235       +6     
==========================================
- Hits       172157   172141      -16     
- Misses      13806    13815       +9     
- Partials     7285     7317      +32     
Files with missing lines Coverage Δ
lib/internal/bootstrap/web/exposed-wildcard.js 100.00% <100.00%> (+0.86%) ⬆️
lib/internal/util.js 95.80% <100.00%> (-1.13%) ⬇️
src/node_messaging.cc 83.46% <75.00%> (-0.47%) ⬇️
src/node_util.cc 83.65% <70.21%> (-2.39%) ⬇️

... and 26 files with indirect coverage changes

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Feb 18, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 18, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

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

LGTM with a suggestion, can be done in a follow up though

auto context = isolate->GetCurrentContext();
Local<Value> arg = info.Data();
Local<Value> require_result;
if (!realm->builtin_module_require()
Copy link
Member

Choose a reason for hiding this comment

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

It might be worth to cache the modules in C++ or just pass the BuiltinModule.map to C++ land so that multiple exports from the same module do not lead to repeated call backs into the JS require.

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 18, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 18, 2025
@nodejs-github-bot nodejs-github-bot merged commit 2086877 into nodejs:main Feb 18, 2025
61 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 2086877

@aduh95 aduh95 deleted the define-lazy-properties branch February 18, 2025 21:24
acidiney pushed a commit to acidiney/node that referenced this pull request Feb 23, 2025
This allows us to have getters not observable from JS side.

PR-URL: nodejs#57081
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
targos pushed a commit that referenced this pull request Feb 24, 2025
This allows us to have getters not observable from JS side.

PR-URL: #57081
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
targos pushed a commit that referenced this pull request Feb 25, 2025
This allows us to have getters not observable from JS side.

PR-URL: #57081
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # 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. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants