Skip to content

src: port defineLazyProperties to native code - #57081

Merged
nodejs-github-bot merged 12 commits into
nodejs:mainfrom
aduh95:define-lazy-properties
Feb 18, 2025
Merged

src: port defineLazyProperties to native code#57081
nodejs-github-bot merged 12 commits into
nodejs:mainfrom
aduh95:define-lazy-properties

Conversation

@aduh95

@aduh95aduh95 commented Feb 15, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

Review requested:

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

@nodejs-github-botnodejs-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
Comment threadsrc/node_messaging.cc Outdated
Comment threadsrc/node_messaging.cc Outdated
Comment threadsrc/node_util.cc Outdated
Comment threadsrc/node_util.cc Outdated
Comment threadsrc/node_util.cc Outdated
Comment threadsrc/node_util.cc Outdated
Comment threadsrc/node_util.cc Outdated
Comment threadsrc/node_util.cc Outdated
Comment threadsrc/node_messaging.cc Outdated
@panvapanva 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
Comment threadlib/internal/bootstrap/web/exposed-wildcard.js Outdated
Comment threadsrc/node_messaging.cc
Isolate* isolate = args.GetIsolate();
auto target = args[0].As<Object>();

if (target

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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

Comment threadlib/internal/util.js Outdated
@codecov

codecovBot commented Feb 17, 2025

Copy link
Copy Markdown

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 linesPatch %Lines
src/node_util.cc70.21%4 Missing and 10 partials ⚠️
src/node_messaging.cc75.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 linesCoverage Δ
lib/internal/bootstrap/web/exposed-wildcard.js100.00% <100.00%> (+0.86%)⬆️
lib/internal/util.js95.80% <100.00%> (-1.13%)⬇️
src/node_messaging.cc83.46% <75.00%> (-0.47%)⬇️
src/node_util.cc83.65% <70.21%> (-2.39%)⬇️

... and 26 files with indirect coverage changes

@aduh95aduh95 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-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 18, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@joyeecheungjoyeecheung left a comment

Copy link
Copy Markdown
Member

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

Comment threadsrc/node_util.cc
auto context = isolate->GetCurrentContext();
Local<Value> arg = info.Data();
Local<Value> require_result;
if (!realm->builtin_module_require()

Copy link
Copy Markdown
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.

@aduh95aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 18, 2025
@nodejs-github-botnodejs-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:mainFeb 18, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 2086877

@aduh95
aduh95 deleted the define-lazy-properties branch February 18, 2025 21:24
@aduh95aduh95 mentioned this pull request Feb 23, 2025
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>
aduh95 added a commit that referenced this pull request Apr 2, 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>
aduh95 added a commit that referenced this pull request Apr 3, 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>
RafaelGSS pushed a commit that referenced this pull request Apr 16, 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>
RafaelGSS pushed a commit that referenced this pull request Apr 17, 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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs 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-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@aduh95@nodejs-github-bot@jasnell@joyeecheung@legendecas@jazelly@panva