util: mark proxied objects as such when inspecting them#61029
util: mark proxied objects as such when inspecting them#61029nodejs-github-bot merged 2 commits intonodejs:mainfrom
Conversation
addaleax
left a comment
There was a problem hiding this comment.
Seems fine, but should this be semver-major out of an abundance of caution?
|
@addaleax I am fine with that. We do not have any guarantees about the output, while it is heavily used and this is definitely something I could imagine others might have had expectations upon. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61029 +/- ##
==========================================
- Coverage 88.53% 88.53% -0.01%
==========================================
Files 703 703
Lines 208222 208544 +322
Branches 40142 40219 +77
==========================================
+ Hits 184357 184639 +282
- Misses 15852 15910 +58
+ Partials 8013 7995 -18
🚀 New features to boost your workflow:
|
|
Does anybody else share my concern that the intention of the language is that it's not possible to determine if something's a Proxy? I realize node already exposes such a predicate, but this will make it much more visible. |
That seems fine, browsers already out |
|
@ljharb ... I think there's a balance needed here. Yes, the language intends proxies to be opaque but the requirements of debugging when things go wrong require us to at least know that something is a proxy or not. They are opposing requirements. I think this PR is at least a net improvement |
|
In the dev tools, and in console.log, and in the repl, is fine, because none of these are exposed to actual developer code. Why |
LiviaMedeiros
left a comment
There was a problem hiding this comment.
Given that util.types.isProxy(suspiciousObject) and util.inspect(suspiciousObject, { showProxy: true }) exist, already making proxies not fully opaque, this looks reasonable.
@ljharb ... really because https://nodejs.org/docs/latest/api/util.html#utilinspectobject-showhidden-depth-colors |
|
Landed in dc97b50 |
Fixes: nodejs#60964 PR-URL: nodejs#61029 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fixes: nodejs#60964 PR-URL: nodejs#61029 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fixes: #60964