<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/node-new.git/lib/console.js, branch Ninja.py-StringIO</title>
<subtitle>github.com: nodejs/node.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/'/>
<entry>
<title>console: split console into global.js and constructor.js</title>
<updated>2018-12-01T20:51:18+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2018-11-28T22:17:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=cfc2559ee0807e4c01ad882211792e917c6dba17'/>
<id>cfc2559ee0807e4c01ad882211792e917c6dba17</id>
<content type='text'>
Since we do not actually use the Console constructor to
instantiate the global console, move the two piece of
code into two different JS files for clarity, and make
console.js a mere re-export of the global console.
The hope is to make the global console, a namespace, more
web-compatible while keeping the Console constructor
available for backwards compatibility.

PR-URL: https://github.com/nodejs/node/pull/24709
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since we do not actually use the Console constructor to
instantiate the global console, move the two piece of
code into two different JS files for clarity, and make
console.js a mere re-export of the global console.
The hope is to make the global console, a namespace, more
web-compatible while keeping the Console constructor
available for backwards compatibility.

PR-URL: https://github.com/nodejs/node/pull/24709
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: move lib/console.js to lib/internal/console/constructor.js</title>
<updated>2018-12-01T20:51:17+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2018-11-28T22:14:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=ce8b0e196eca6816d77dda43f28e7da6b3784e6b'/>
<id>ce8b0e196eca6816d77dda43f28e7da6b3784e6b</id>
<content type='text'>
This is a broken commit: it's here so that git interpret this
as a file move and preserve most of the history of the Console
constructor.

PR-URL: https://github.com/nodejs/node/pull/24709
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a broken commit: it's here so that git interpret this
as a file move and preserve most of the history of the Console
constructor.

PR-URL: https://github.com/nodejs/node/pull/24709
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>console: lazy load process.stderr and process.stdout</title>
<updated>2018-11-28T17:52:54+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2018-11-20T23:31:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=333783643e71aeef3940fae215e7cf52ef00d5f0'/>
<id>333783643e71aeef3940fae215e7cf52ef00d5f0</id>
<content type='text'>
This patch:

- Refactors the Console constructor: moves the property binding code
  into and the writable streams binding code into two methods defined
  on the Console.prototype with symbols.
- Refactors the global console creation: we only need to share the
  property binding code from the Console constructor. To bind the
  streams we can lazy load `process.stdio` and `process.stderr`
  so that we don't create these streams when they are not used.
  This significantly reduces the number of modules loaded during
  bootstrap. Also, by calling the refactored-out method directly
  we can skip the unnecessary typechecks when creating the global
  console and there is no need to create a temporary Console
  anymore.
- Refactors the error handler creation and the `write` method:
  use a `kUseStdout` symbol to tell the internals which stream
  should be loaded from the console instance. Also put the
  `write` method on the Console prototype so it just loads
  other properties directly off the console instance which simplifies
  the call sites.

Also leaves a few TODOs for further refactoring of the console
bootstrap.

PR-URL: https://github.com/nodejs/node/pull/24534
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch:

- Refactors the Console constructor: moves the property binding code
  into and the writable streams binding code into two methods defined
  on the Console.prototype with symbols.
- Refactors the global console creation: we only need to share the
  property binding code from the Console constructor. To bind the
  streams we can lazy load `process.stdio` and `process.stderr`
  so that we don't create these streams when they are not used.
  This significantly reduces the number of modules loaded during
  bootstrap. Also, by calling the refactored-out method directly
  we can skip the unnecessary typechecks when creating the global
  console and there is no need to create a temporary Console
  anymore.
- Refactors the error handler creation and the `write` method:
  use a `kUseStdout` symbol to tell the internals which stream
  should be loaded from the console instance. Also put the
  `write` method on the Console prototype so it just loads
  other properties directly off the console instance which simplifies
  the call sites.

Also leaves a few TODOs for further refactoring of the console
bootstrap.

PR-URL: https://github.com/nodejs/node/pull/24534
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>console: improve code readability</title>
<updated>2018-11-20T19:46:38+00:00</updated>
<author>
<name>gengjiawen</name>
<email>technicalcute@gmail.com</email>
</author>
<published>2018-11-15T15:40:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=08c14d98cdb029c72549a6709c2fd0befda5a463'/>
<id>08c14d98cdb029c72549a6709c2fd0befda5a463</id>
<content type='text'>
use object spread to make console code more readable

PR-URL: https://github.com/nodejs/node/pull/24412
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
use object spread to make console code more readable

PR-URL: https://github.com/nodejs/node/pull/24412
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>console: console.timeLog() using the default label</title>
<updated>2018-11-13T04:32:56+00:00</updated>
<author>
<name>Marie Terrier</name>
<email>marie.terrier1@gmail.com</email>
</author>
<published>2018-11-10T15:50:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=733278b81bdb2c6fb35c5146fa94d9727edc6adc'/>
<id>733278b81bdb2c6fb35c5146fa94d9727edc6adc</id>
<content type='text'>
PR-URL: https://github.com/nodejs/node/pull/24286
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Michaël Zasso &lt;targos@protonmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PR-URL: https://github.com/nodejs/node/pull/24286
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Michaël Zasso &lt;targos@protonmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>console: bind methods from the prototype chain in Console</title>
<updated>2018-11-06T04:53:59+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2018-11-02T19:20:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=04a291abec3b86ed902c5e9919b2a8adf1e07d14'/>
<id>04a291abec3b86ed902c5e9919b2a8adf1e07d14</id>
<content type='text'>
In 62232361 we made the console.Console function construct an object
with methods from Console.prototype bound to the instance, instead of
with methods found on the prototype chain to be bound on the instances,
thus breaking users overriding these methods when subclassing Console
because they are not expecting this function to construct a
namespace whose methods are not looked up from the prototype
chain.

This patch restores the previous behavior since it does not affect
the characteristics of the global console anyway. So after this patch,
the Console function still constructs normal objects with function
properties looked up from the prototype chain but bound to the
instances always.

PR-URL: https://github.com/nodejs/node/pull/24047
Reviewed-By: John-David Dalton &lt;john.david.dalton@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In 62232361 we made the console.Console function construct an object
with methods from Console.prototype bound to the instance, instead of
with methods found on the prototype chain to be bound on the instances,
thus breaking users overriding these methods when subclassing Console
because they are not expecting this function to construct a
namespace whose methods are not looked up from the prototype
chain.

This patch restores the previous behavior since it does not affect
the characteristics of the global console anyway. So after this patch,
the Console function still constructs normal objects with function
properties looked up from the prototype chain but bound to the
instances always.

PR-URL: https://github.com/nodejs/node/pull/24047
Reviewed-By: John-David Dalton &lt;john.david.dalton@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: make the global console [[Prototype]] an empty object</title>
<updated>2018-10-26T03:33:43+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2018-10-12T15:38:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=6223236151f25975e380eef8470243ff8cf3f61d'/>
<id>6223236151f25975e380eef8470243ff8cf3f61d</id>
<content type='text'>
From the WHATWG console spec:

&gt; For historical web-compatibility reasons, the namespace object for
&gt; console must have as its [[Prototype]] an empty object, created as
&gt; if by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%.

Since in Node.js, the Console constructor has been exposed through
require('console'), we need to keep the Console constructor but
we cannot actually use `new Console` to construct the global console.

This patch changes the prototype chain of the global console object,
so the console.Console.prototype is not in the global console prototype
chain anymore.

```
const proto = Object.getPrototypeOf(global.console);
// Before this patch
proto.constructor === global.console.Console
// After this patch
proto.constructor === Object
```

But, we still maintain that

```
global.console instanceof global.console.Console
```

through a custom Symbol.hasInstance function of Console that tests
for a special symbol kIsConsole for backwards compatibility.

This fixes a case in the console Web Platform Test that we commented
out.

PR-URL: https://github.com/nodejs/node/pull/23509
Refs: https://github.com/whatwg/console/issues/3
Refs: https://console.spec.whatwg.org/#console-namespace
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Matteo Collina &lt;matteo.collina@gmail.com&gt;
Reviewed-By: Tiancheng "Timothy" Gu &lt;timothygu99@gmail.com&gt;
Reviewed-By: Denys Otrishko &lt;shishugi@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Sakthipriyan Vairamani &lt;thechargingvolcano@gmail.com&gt;
Reviewed-By: John-David Dalton &lt;john.david.dalton@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
From the WHATWG console spec:

&gt; For historical web-compatibility reasons, the namespace object for
&gt; console must have as its [[Prototype]] an empty object, created as
&gt; if by ObjectCreate(%ObjectPrototype%), instead of %ObjectPrototype%.

Since in Node.js, the Console constructor has been exposed through
require('console'), we need to keep the Console constructor but
we cannot actually use `new Console` to construct the global console.

This patch changes the prototype chain of the global console object,
so the console.Console.prototype is not in the global console prototype
chain anymore.

```
const proto = Object.getPrototypeOf(global.console);
// Before this patch
proto.constructor === global.console.Console
// After this patch
proto.constructor === Object
```

But, we still maintain that

```
global.console instanceof global.console.Console
```

through a custom Symbol.hasInstance function of Console that tests
for a special symbol kIsConsole for backwards compatibility.

This fixes a case in the console Web Platform Test that we commented
out.

PR-URL: https://github.com/nodejs/node/pull/23509
Refs: https://github.com/whatwg/console/issues/3
Refs: https://console.spec.whatwg.org/#console-namespace
Reviewed-By: Gus Caplan &lt;me@gus.host&gt;
Reviewed-By: Matteo Collina &lt;matteo.collina@gmail.com&gt;
Reviewed-By: Tiancheng "Timothy" Gu &lt;timothygu99@gmail.com&gt;
Reviewed-By: Denys Otrishko &lt;shishugi@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Sakthipriyan Vairamani &lt;thechargingvolcano@gmail.com&gt;
Reviewed-By: John-David Dalton &lt;john.david.dalton@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>console: add trace-events for time and count</title>
<updated>2018-10-18T22:00:29+00:00</updated>
<author>
<name>James M Snell</name>
<email>jasnell@gmail.com</email>
</author>
<published>2018-10-16T20:57:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=9c82a1e7ba8d5ce7e743f99348cf992965594f0a'/>
<id>9c82a1e7ba8d5ce7e743f99348cf992965594f0a</id>
<content type='text'>
Add the `node.console` trace event category to capture
`console.count()`, `console.countReset()`, `console.time()`,
`console.timeLog()`, and `console.timeEnd()` to the trace
event log.

PR-URL: https://github.com/nodejs/node/pull/23703
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Richard Lau &lt;riclau@uk.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add the `node.console` trace event category to capture
`console.count()`, `console.countReset()`, `console.time()`,
`console.timeLog()`, and `console.timeEnd()` to the trace
event log.

PR-URL: https://github.com/nodejs/node/pull/23703
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Richard Lau &lt;riclau@uk.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bootstrapper: move internalBinding to NativeModule</title>
<updated>2018-10-04T09:55:34+00:00</updated>
<author>
<name>Gus Caplan</name>
<email>me@gus.host</email>
</author>
<published>2018-09-22T14:49:52+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=e7f710c1d4729890806610e5450d7a0edfb4ac11'/>
<id>e7f710c1d4729890806610e5450d7a0edfb4ac11</id>
<content type='text'>
internalBinding is used so often that it should just automatically be
available for usage in internals.

PR-URL: https://github.com/nodejs/node/pull/23025
Refs: https://github.com/nodejs/node/commit/2a9eb31
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michaël Zasso &lt;targos@protonmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
Reviewed-By: Refael Ackermann &lt;refack@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Sakthipriyan Vairamani &lt;thechargingvolcano@gmail.com&gt;
Reviewed-By: Trivikram Kamat &lt;trivikr.dev@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
internalBinding is used so often that it should just automatically be
available for usage in internals.

PR-URL: https://github.com/nodejs/node/pull/23025
Refs: https://github.com/nodejs/node/commit/2a9eb31
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michaël Zasso &lt;targos@protonmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Joyee Cheung &lt;joyeec9h3@gmail.com&gt;
Reviewed-By: Refael Ackermann &lt;refack@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Sakthipriyan Vairamani &lt;thechargingvolcano@gmail.com&gt;
Reviewed-By: Trivikram Kamat &lt;trivikr.dev@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: change abstract equal to strict equal</title>
<updated>2018-09-27T03:30:34+00:00</updated>
<author>
<name>ZYSzys</name>
<email>17367077526@163.com</email>
</author>
<published>2018-09-20T16:09:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/node-new.git/commit/?id=0f841208d2d89d91395536a3227c4b11e1bf2425'/>
<id>0f841208d2d89d91395536a3227c4b11e1bf2425</id>
<content type='text'>
PR-URL: https://github.com/nodejs/node/pull/22974
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: John-David Dalton &lt;john.david.dalton@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Trivikram Kamat &lt;trivikr.dev@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PR-URL: https://github.com/nodejs/node/pull/22974
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: John-David Dalton &lt;john.david.dalton@gmail.com&gt;
Reviewed-By: Ruben Bridgewater &lt;ruben@bridgewater.de&gt;
Reviewed-By: Trivikram Kamat &lt;trivikr.dev@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
