lib,src: isInsideNodeModules should test on the first non-internal frame
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=DEP0169 is present (so urlParseWarned will never be true).
Before https://github.com/nodejs/node/pull/55286, isInsideNodeModules only checks the topmost non-internal frame. This restores the original behavior.
https://github.com/nodejs/node/blob/6e474c024c85d9a93db40020dacd20a768c62369/lib/url.js#L135
Review requested:
- [ ] @nodejs/loaders
- [ ] @nodejs/performance
- [ ] @nodejs/url
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
:x: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 88.52%. Comparing base (6e474c0) to head (780517c).
:warning: Report is 14 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/node_util.cc | 71.42% | 0 Missing and 2 partials :warning: |
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
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| lib/buffer.js | 100.00% <100.00%> (ΓΈ) |
|
| lib/internal/modules/cjs/loader.js | 97.97% <100.00%> (-0.05%) |
:arrow_down: |
| lib/punycode.js | 94.72% <100.00%> (ΓΈ) |
|
| lib/url.js | 100.00% <100.00%> (ΓΈ) |
|
| src/node_util.cc | 80.95% <71.42%> (+0.95%) |
:arrow_up: |
: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.
CI: https://ci.nodejs.org/job/node-test-pull-request/70435/
CI: https://ci.nodejs.org/job/node-test-pull-request/70440/
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 <[email protected]> PR-URL: https://github.com/nodejs/node/pull/60991 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Daniel Lemire <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/60991 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Daniel Lemire <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> -------------------------------------------------------------------------------- βΉ 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 <[email protected]> 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 <[email protected]> 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/20099802384PR-URL: https://github.com/nodejs/node/pull/60991 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Daniel Lemire <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
[detached HEAD 1ceb3af622] benchmark: add microbench on isInsideNodeModules Author: Chengzhong Wu <[email protected]> Date: Mon Dec 8 12:19:55 2025 +0000 1 file changed, 52 insertions(+) create mode 100644 benchmark/internal/util_isinsidenodemodules.js Rebasing (3/4) Rebasing (4/4) Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- lib,src: isInsideNodeModules should test on the first non-internal frame
PR-URL: https://github.com/nodejs/node/pull/60991 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Daniel Lemire <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
[detached HEAD ae6a956b81] lib,src: isInsideNodeModules should test on the first non-internal frame Author: Chengzhong Wu <[email protected]> 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 Successfully rebased and updated refs/heads/main.
βΉ Add
commit-queue-squashlabel to land the PR as one commit, orcommit-queue-rebaseto land as separate commits.
Landed in 83ba6b107a067f5831b03ab69c787fcb35bdcb05...32ea48d74993c323664e9f62acafba3c8661ad37