-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
lib,src: isInsideNodeModules should test on the first non-internal frame #60991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Review requested:
|
16df4ce to
780517c
Compare
|
Not for this PR, though it seems useful to have a helper specifically for deprecations and other one-off warnings that skips the check if it's disabled/already emitted/checked enough times. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60991 +/- ##
==========================================
- Coverage 88.52% 88.52% -0.01%
==========================================
Files 703 703
Lines 208430 208424 -6
Branches 40206 40197 -9
==========================================
- Hits 184513 184501 -12
+ Misses 15947 15937 -10
- Partials 7970 7986 +16
🚀 New features to boost your workflow:
|
| result = true; | ||
| break; | ||
| } | ||
| result = script_name_str.find("/node_modules/") != std::string::npos || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just use std::string::contains here I believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's C++23 for the string classes.
Commit Queue failed- Loading data for nodejs/node/pull/60991 ✔ Done loading data for nodejs/node/pull/60991 ----------------------------------- PR info ------------------------------------ Title lib,src: isInsideNodeModules should test on the first non-internal frame (#60991) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch legendecas:benchmark-isinsidenodemodules -> nodejs:main Labels c++, lib / src, author ready, needs-ci, lts-watch-v20.x, lts-watch-v22.x Commits 2 - benchmark: add microbench on isInsideNodeModules - lib,src: isInsideNodeModules should test on the first non-internal frame Committers 1 - Chengzhong Wu <legendecas@gmail.com> PR-URL: https://github.com/nodejs/node/pull/60991 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/60991 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Mon, 08 Dec 2025 12:55:51 GMT ✔ Approvals: 4 ✔ - Joyee Cheung (@joyeecheung) (TSC): https://github.com/nodejs/node/pull/60991#pullrequestreview-3552088477 ✔ - Marco Ippolito (@marco-ippolito) (TSC): https://github.com/nodejs/node/pull/60991#pullrequestreview-3552116038 ✔ - Daniel Lemire (@lemire): https://github.com/nodejs/node/pull/60991#pullrequestreview-3552297116 ✔ - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/60991#pullrequestreview-3552456556 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2025-12-08T20:51:07Z: https://ci.nodejs.org/job/node-test-pull-request/70440/ - Querying data for job/node-test-pull-request/70440/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 60991 From https://github.com/nodejs/node * branch refs/pull/60991/merge -> FETCH_HEAD ✔ Fetched commits as 83ba6b107a06..780517cbdf8d -------------------------------------------------------------------------------- [main 7e6314c3be] benchmark: add microbench on isInsideNodeModules Author: Chengzhong Wu <legendecas@gmail.com> Date: Mon Dec 8 12:19:55 2025 +0000 1 file changed, 52 insertions(+) create mode 100644 benchmark/internal/util_isinsidenodemodules.js Auto-merging lib/internal/modules/cjs/loader.js [main cebd76f992] lib,src: isInsideNodeModules should test on the first non-internal frame Author: Chengzhong Wu <legendecas@gmail.com> Date: Mon Dec 8 12:36:38 2025 +0000 8 files changed, 58 insertions(+), 29 deletions(-) create mode 100644 test/parallel/test-internal-util-isinsidenodemodules.js ✔ Patches applied There are 2 commits in the PR. Attempting autorebase. (node:2398) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated. (Use `node --trace-deprecation ...` to show where the warning was created) Rebasing (2/4) Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- benchmark: add microbench on isInsideNodeModuleshttps://github.com/nodejs/node/actions/runs/20099802384 |
PR-URL: #60991 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
|
Landed in 83ba6b1...32ea48d |
PR-URL: #60991 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Avoid checking up to 100 frames every time on functions like
require('node:url').parse, when the user application never invokes them with--disable-deprecation=DEP0169is present (sourlParseWarnedwill never be true).Before #55286,
isInsideNodeModulesonly checks the topmost non-internal frame. This restores the original behavior.node/lib/url.js
Line 135 in 6e474c0