The current default formatting is not ideal and this improves
the situation by formatting the output more intuitiv.
1) All object keys are now indented by 2 characters instead of
sometimes 2 and sometimes 3 characters.
2) Each object key will now use an individual line instead of
sharing a line potentially with multiple object keys.
3) Long strings will now be split into multiple lines in case
they exceed the "lineBreak" option length (including the
current indentation).
4) Opening braces are now directly behind a object property
instead of using a new line.
5) Switch inspect "base" order. In case the compact option is set
to `false`, inspect will now print
"[Function: foo] {\n property: 'data'\n}"
instead of
"{ [Function: foo]\n property: 'data'\n}".
PR-URL: https://github.com/nodejs/node/pull/17576
Reviewed-By: Anna Henningsen <anna@addaleax.net>
From now on it is possible to use a validation object in throws
instead of the other possibilites.
PR-URL: https://github.com/nodejs/node/pull/17584
Refs: https://github.com/nodejs/node/pull/17557
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
This makes `Http2Stream`s and `Http2Session`s use actual Timeout
objects in a [kTimeout] symbol property, rather than making the
stream/session itself a timer and appending properties to it directly.
PR-URL: https://github.com/nodejs/node/pull/17704
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This should help keep everything consistent.
PR-URL: https://github.com/nodejs/node/pull/17704
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This makes `net.Sockets` use actual Timeout objects in a `[kTimeout]`
symbol property, rather than making the socket itself a timer and
appending properties to it directly.
This should make the code generally easier to understand, and might
also prevent some deopts from properties being changes on the socket
itself.
Also moves the Timeout constructor into an internal module.
PR-URL: https://github.com/nodejs/node/pull/17704
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
PR-URL: https://github.com/nodejs/node/pull/17735
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This should not be important anymore in newer docs. The change is
also documented in the "changed" part of the function.
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This lists all function aliases directly below the declared function.
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Fix and refactor the console benchmark. It did not test console
so it got renamed and mainly tests the different ways of passing
arguments through.
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Calling write could throw a maximum call stack size error. To make
sure this is not specific to a single engine (version), lazily
populate the correct error message by producing such a error on
demand.
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
`OnCallbackPadding` on the native side already clamps
the return value into the right range, so there’s not need
to also do that on the JS side.
Also, use `>>> 0` instead of `| 0` to get an uint32, since
the communication with C++ land happens through an Uint32Array.
PR-URL: https://github.com/nodejs/node/pull/17717
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
- Only finish outgoing `WriteWrap`s once data has actually been
passed to the underlying socket.
- This makes HTTP2 streams respect backpressure
- Use `DoTryWrite` as a shortcut for sending out as much of
the data synchronously without blocking as possible
- Use `NGHTTP2_DATA_FLAG_NO_COPY` to avoid copying DATA frame
contents into nghttp2’s buffers before sending them out.
PR-URL: https://github.com/nodejs/node/pull/17718
Reviewed-By: James M Snell <jasnell@gmail.com>
`nghttp2_stream_write_t` was not a necessary redirection layer
and came with the cost of one additional allocation per stream write.
Also, having both `nghttp2_stream_write` and `nghttp2_stream_write_t`
as identifiers did not help with readability.
PR-URL: https://github.com/nodejs/node/pull/17718
Reviewed-By: James M Snell <jasnell@gmail.com>
Previously the getter would mutate the kDefaultTriggerAsncId value. This
refactor changes the setter to bind the current kDefaultTriggerAsncId to
a scope, such that the getter doesn't have to mutate its own value.
PR-URL: https://github.com/nodejs/node/pull/17273
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
When context is missing the executionAsyncId will be zero. For the
default triggerAsyncId the zero value was used to default to the
executionAsyncId. While this was not technically wrong because the
functions are different themself, it poorly separated the two concepts.
PR-URL: https://github.com/nodejs/node/pull/17273
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
rename initTriggerId to defaultTriggerAsyncId such it matches the rest
of our naming.
PR-URL: https://github.com/nodejs/node/pull/17273
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
It was not clear why the error name is actually also tested for when
using a regular expression. This is now clarified.
PR-URL: https://github.com/nodejs/node/pull/17585
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Throw a TypeError in case a error message is provided in the second
argument and a third argument is present as well.
This is clearly a mistake and should not be done.
PR-URL: https://github.com/nodejs/node/pull/17585
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
A combination of try catch and common.expectsError is not necessary
as the latter already does everything on its own.
PR-URL: https://github.com/nodejs/node/pull/17703
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
The stack frames from .throws and .doesNotThrow got included
even though that was not intended.
PR-URL: https://github.com/nodejs/node/pull/17703
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit removes stdlib.h header as it does not seem to be used any
more.
PR-URL: https://github.com/nodejs/node/pull/17752
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/17727
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Causing the linter job to fail on CI right now.
PR-URL: https://github.com/nodejs/node/pull/17741
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Make the preamble to CONTRIBUTING.md more concise and focused.
PR-URL: https://github.com/nodejs/node/pull/17700
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Specify that $VERSION should include the `v` when replacing
REPLACEME in documentation.
PR-URL: https://github.com/nodejs/node/pull/17677
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/17692
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Separate FSReqWrap definition into a new node_file.h.
Add Reject and Resolve methods to encapsulate the callbacks and
make the constructor, destructor protected instead of private
in preparation to make FSReqWrap subclassable for the Promises
implementation.
Rework and simplify the After function slightly in preparation
for a refactor.
Introduce the node::fs namespace instead of using an anonymous
namespace for fs methods.
PR-URL: https://github.com/nodejs/node/pull/17689
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/17406
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This is a significant cleanup and refactoring of the
cleanup/close/destroy logic for Http2Stream and Http2Session.
There are significant changes here in the timing and ordering
of cleanup logic, JS apis. and various related necessary edits.
Also works on directories.
PR-URL: https://github.com/nodejs/node/pull/17702
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Currently, writeQueueSize is never used in C++ and barely used
within JS. Instead of constantly updating the value on the JS
object, create a getter that will retrieve the most up-to-date
value from C++.
For the vast majority of cases though, create a new prop on
Socket.prototype[kLastWriteQueueSize] using a Symbol. Use this
to track the current write size, entirely in JS land.
PR-URL: https://github.com/nodejs/node/pull/17650
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit adds a test to validate postmortem debugging metadata.
When this test runs, it can check for the presence of metadata
constants used by tools such as llnode and mdb and report if any
have accidentally been removed.
PR-URL: https://github.com/nodejs/node/pull/17685
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
As part of the readableState/writableState mega issue #445, this
removes all of the references to .length on those properties and
replaces them with a readableLength and writableLength getter.
See: https://github.com/nodejs/node/issues/445
PR-URL: https://github.com/nodejs/node/pull/12857
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>