Skip to content
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

bootstrap: expose process._rawDebug as a global function #55907

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jsumners
Copy link
Contributor

The process._rawDebug function is very helpful when triaging bugs that cross asynchronous boundaries. It is also quite cumbersome to write out process._rawDebug everywhere such a line is needed. So this change exposes it as a global function to facilitate an improved
developer experience.

If we think that a naming collision is possible, maybe it could be named nodeDebug or similar.

The `process._rawDebug` function is very helpful when
triaging bugs that cross asynchronous boundaries. It
is also quite cumbersome to write out `process._rawDebug`
everywhere such a line is needed. So this change exposes
it as a global function to facilitate an improved
developer experience.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added 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 Nov 18, 2024
@mcollina mcollina added the semver-major PRs that contain breaking changes and should be released in the next major version. label Nov 18, 2024
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.98%. Comparing base (746b17e) to head (12839f9).
Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55907      +/-   ##
==========================================
- Coverage   88.41%   87.98%   -0.44%     
==========================================
  Files         654      653       -1     
  Lines      188036   187868     -168     
  Branches    36187    35890     -297     
==========================================
- Hits       166260   165293     -967     
- Misses      14989    15738     +749     
- Partials     6787     6837      +50     
Files with missing lines Coverage Δ
lib/internal/bootstrap/node.js 99.58% <100.00%> (+0.01%) ⬆️

... and 103 files with indirect coverage changes

---- 🚨 Try these New Features:

@jasnell
Copy link
Member

jasnell commented Nov 23, 2024

Hmmm... I'm not a big fan of adding new Node.js specific globals, and given that process already a global I'm not convinced this really adds much value. I'm willing to be convinced those and won't block this if others find value in it.

@jsumners
Copy link
Contributor Author

given that process already a global I'm not convinced this really adds much value

In my experience, when someone wants to use this function they are likely going to be writing it in multiple places. I hope we can agree that it is easier, and less annoying, to type out rawDebug than it is to type out process._rawDebug.

Regarding adding Node.js specific globals: isn't that the point of having a specific runtime? To be able to design it such that it provides an environment that is specific to the use cases of the developers that are using it? As an example, at least in Vivaldi and Safari, all Window properties and methods are available without needing to prefix them with window.; i.e. browser runtimes make useful utilities available to users just as being suggested here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants