-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
inspector: introduce inspector/promises API #44250
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
inspector: introduce inspector/promises API #44250
Conversation
cdfdc2c to
b1947d2
Compare
This comment was marked as resolved.
This comment was marked as resolved.
I thought about it, but the only function that makes sense using promises is the post function. When looking at the module there’re a lot of dependencies needed to be rewritten in case we wanna expose it as /promises |
c204202 to
2efebf3
Compare
|
@nodejs/inspector |
|
Overall big +1 on the idea
Why? It can even live in the same file it'd just have to be exported as I'm not sure why this should be the one and only API that works with "omit callback to get promise back" in Node.js (this specific approach was rejected for fs for example). Namely this would mean that someone forgetting to pass a callback would now stop getting an error and would get an unhandled rejection if the |
I struggled a bit but I was able to do it o/ |
|
I think I'll need a deep review of the docs as I'm not sure if I'm on the right path. I copied and pasted the whole API, changed the topics, and added sections for callbacks and promises APIs following the example seeing on fs |
benjamingr
left a comment
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.
Good progress!
MoLow
left a comment
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.
LGTM, nice addition
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
ovflowd
left a comment
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.
Just adding a blocker for docs 👀 as it doesn't follow the correct standard.
| It can be accessed using: | ||
|
|
||
| ```js | ||
| ```mjs |
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.
Doc-wise, this should be somewhere else, And marked with `> Stability 1 Experimental.
E.g.:
## Promises
<!-- introduced_in=v19.0.0 -->
> Stability: 1 - Experimental
<!-- source_link=lib/inspector/promises.js -->
[...] Description.IMHO this is a doc-blocker.
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 is marked as experimental, see https://github.com/nodejs/node/pull/44250/files#diff-d6da7e100224e744520fde97ca99f743ad9eafc83d50ed92ed2b7870f0589f68R34
<!-- introduced_in=v19.0.0 --> would not be appropriate here, those are to reference the first version that included the markdown document in the docs – which is v8.0.0 for inspector.md. This PR does contain a YAML comment block that indicates when the promise API was (will be) introduced: https://github.com/nodejs/node/pull/44250/files#diff-d6da7e100224e744520fde97ca99f743ad9eafc83d50ed92ed2b7870f0589f68R37.
I disagree this is a doc blocker, also doc can always be fixed in a semver patch, while the module can only land in a semver-major.
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.
Not saying this is a PR blocker, but felt for me like a doc blocker, if you disagree that's fine, I don't want to block this PR too much 👀
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.
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.
If we push one more commit to that branch, the PR is extremely unlikely to land on v19.x and would need to wait for 20.x, so I'd say it's probably not completely ready, but that's fine because we land it as experimental.
I'm planing on landing it as soon as we get a passing CI.
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.
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.
Hmm, @ErickWendel not sure, but I was just making suggestions to the API docs you were writing xD
But it's all fine and this landed 🎉
|
Landed in 0324529 |
This PR introduces the new
inspector/promisesAPI with thesession.postfunction.Before with Callbacks API:
After with Promises: