-9.7.0
+9.8.0
+9.7.1
+9.7.0 9.6.1 9.6.0 9.5.0
diff --git a/Makefile b/Makefile
index 35ce00a043065f..e9afdc87e72758 100644
--- a/Makefile
+++ b/Makefile
@@ -172,13 +172,13 @@ coverage-build: all
$(NODE) ./deps/npm install istanbul-merge --no-save --no-package-lock; fi
if [ ! -d node_modules/nyc ]; then \
$(NODE) ./deps/npm install nyc --no-save --no-package-lock; fi
- if [ ! -d gcovr ]; then git clone --depth=1 \
+ if [ ! -d gcovr ]; then git clone -b 3.4 --depth=1 \
--single-branch git://github.com/gcovr/gcovr.git; fi
if [ ! -d build ]; then git clone --depth=1 \
--single-branch https://github.com/nodejs/build.git; fi
if [ ! -f gcovr/scripts/gcovr.orig ]; then \
(cd gcovr && patch -N -p1 < \
- "$(CURDIR)/build/jenkins/scripts/coverage/gcovr-patches.diff"); fi
+ "$(CURDIR)/build/jenkins/scripts/coverage/gcovr-patches-3.4.diff"); fi
if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
mv lib lib_
$(NODE) ./node_modules/.bin/nyc instrument --extension .js --extension .mjs lib_/ lib/
@@ -1056,15 +1056,18 @@ lint-md-clean:
$(RM) -r tools/remark-preset-lint-node/node_modules
$(RM) tools/.*mdlintstamp
-.PHONY: lint-md-build
-lint-md-build:
- @if [ ! -d tools/remark-cli/node_modules ]; then \
- echo "Markdown linter: installing remark-cli into tools/"; \
- cd tools/remark-cli && $(call available-node,$(run-npm-install)) fi
- @if [ ! -d tools/remark-preset-lint-node/node_modules ]; then \
- echo "Markdown linter: installing remark-preset-lint-node into tools/"; \
- cd tools/remark-preset-lint-node && $(call available-node,$(run-npm-install)) fi
+tools/remark-cli/node_modules: tools/remark-cli/package.json
+ @echo "Markdown linter: installing remark-cli into tools/"
+ @cd tools/remark-cli && $(call available-node,$(run-npm-install))
+
+tools/remark-preset-lint-node/node_modules: \
+ tools/remark-preset-lint-node/package.json
+ @echo "Markdown linter: installing remark-preset-lint-node into tools/"
+ @cd tools/remark-preset-lint-node && $(call available-node,$(run-npm-install))
+.PHONY: lint-md-build
+lint-md-build: tools/remark-cli/node_modules \
+ tools/remark-preset-lint-node/node_modules
.PHONY: lint-md
ifneq ("","$(wildcard tools/remark-cli/node_modules/)")
diff --git a/README.md b/README.md
index 9dda47e821fc68..1e6be9a38cbe1b 100644
--- a/README.md
+++ b/README.md
@@ -425,6 +425,8 @@ For more information about the governance of the Node.js project, see
**Julien Gilli** <jgilli@nodejs.org>
* [mmarchini](https://github.com/mmarchini) -
**Matheus Marchini** <matheus@sthima.com>
+* [MoonBall](https://github.com/MoonBall) -
+**Chen Gang** <gangc.cxy@foxmail.com>
* [mscdex](https://github.com/mscdex) -
**Brian White** <mscdex@mscdex.net>
* [MylesBorins](https://github.com/MylesBorins) -
diff --git a/benchmark/streams/pipe.js b/benchmark/streams/pipe.js
index a7d67b7d6908c8..4baeeb2d2e7706 100644
--- a/benchmark/streams/pipe.js
+++ b/benchmark/streams/pipe.js
@@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
});
function main({ n }) {
- const b = new Buffer(1024);
+ const b = Buffer.alloc(1024);
const r = new Readable();
const w = new Writable();
diff --git a/benchmark/streams/readable-bigread.js b/benchmark/streams/readable-bigread.js
index 99213afaeb8f28..62d1af874fb22a 100644
--- a/benchmark/streams/readable-bigread.js
+++ b/benchmark/streams/readable-bigread.js
@@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
});
function main({ n }) {
- const b = new Buffer(32);
+ const b = Buffer.alloc(32);
const s = new Readable();
function noop() {}
s._read = noop;
diff --git a/benchmark/streams/readable-bigunevenread.js b/benchmark/streams/readable-bigunevenread.js
index e2f2c1406a1da0..e13769189a69da 100644
--- a/benchmark/streams/readable-bigunevenread.js
+++ b/benchmark/streams/readable-bigunevenread.js
@@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
});
function main({ n }) {
- const b = new Buffer(32);
+ const b = Buffer.alloc(32);
const s = new Readable();
function noop() {}
s._read = noop;
diff --git a/benchmark/streams/readable-readall.js b/benchmark/streams/readable-readall.js
index 5715e42017c795..3c177ec4c39988 100644
--- a/benchmark/streams/readable-readall.js
+++ b/benchmark/streams/readable-readall.js
@@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
});
function main({ n }) {
- const b = new Buffer(32);
+ const b = Buffer.alloc(32);
const s = new Readable();
function noop() {}
s._read = noop;
diff --git a/benchmark/streams/readable-unevenread.js b/benchmark/streams/readable-unevenread.js
index d7a408b1c56a31..f8b501ab4729ec 100644
--- a/benchmark/streams/readable-unevenread.js
+++ b/benchmark/streams/readable-unevenread.js
@@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
});
function main({ n }) {
- const b = new Buffer(32);
+ const b = Buffer.alloc(32);
const s = new Readable();
function noop() {}
s._read = noop;
diff --git a/common.gypi b/common.gypi
index 5752c17168d50a..aaae133e1ac188 100644
--- a/common.gypi
+++ b/common.gypi
@@ -27,7 +27,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.20',
+ 'v8_embedder_string': '-node.21',
# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp
index 88994a12b22097..170e5fb68bb503 100644
--- a/deps/openssl/openssl.gyp
+++ b/deps/openssl/openssl.gyp
@@ -157,6 +157,9 @@
}, {
'defines': ['<@(openssl_default_defines_not_win)'],
'cflags': ['-Wno-missing-field-initializers'],
+ 'xcode_settings': {
+ 'WARNING_CFLAGS': ['-Wno-missing-field-initializers'],
+ },
'conditions': [
['OS=="mac"', {
'defines': ['<@(openssl_default_defines_mac)'],
diff --git a/deps/v8/src/bootstrapper.cc b/deps/v8/src/bootstrapper.cc
index dc211962685b77..950436493caa04 100644
--- a/deps/v8/src/bootstrapper.cc
+++ b/deps/v8/src/bootstrapper.cc
@@ -5299,6 +5299,11 @@ Genesis::Genesis(
if (!InstallDebuggerNatives()) return;
}
+ if (FLAG_disallow_code_generation_from_strings) {
+ native_context()->set_allow_code_gen_from_strings(
+ isolate->heap()->false_value());
+ }
+
ConfigureUtilsObject(context_type);
// Check that the script context table is empty except for the 'this' binding.
diff --git a/deps/v8/src/flag-definitions.h b/deps/v8/src/flag-definitions.h
index bcb5a2c982b5a7..fe175c706accb3 100644
--- a/deps/v8/src/flag-definitions.h
+++ b/deps/v8/src/flag-definitions.h
@@ -732,6 +732,8 @@ DEFINE_BOOL(expose_trigger_failure, false, "expose trigger-failure extension")
DEFINE_INT(stack_trace_limit, 10, "number of stack frames to capture")
DEFINE_BOOL(builtins_in_stack_traces, false,
"show built-in functions in stack traces")
+DEFINE_BOOL(disallow_code_generation_from_strings, false,
+ "disallow eval and friends")
// builtins.cc
DEFINE_BOOL(allow_unsafe_function_constructor, false,
diff --git a/deps/v8/test/mjsunit/disallow-codegen-from-strings.js b/deps/v8/test/mjsunit/disallow-codegen-from-strings.js
new file mode 100644
index 00000000000000..30d1b967d5f128
--- /dev/null
+++ b/deps/v8/test/mjsunit/disallow-codegen-from-strings.js
@@ -0,0 +1,9 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --disallow-code-generation-from-strings
+
+assertThrows("1 + 1", EvalError);
+assertThrows(() => eval("1 + 1"), EvalError);
+assertThrows(() => Function("x", "return x + 1"), EvalError);
diff --git a/doc/api/_toc.md b/doc/api/_toc.md
index 420fb362fa537a..b8002fb78163ac 100644
--- a/doc/api/_toc.md
+++ b/doc/api/_toc.md
@@ -1,5 +1,9 @@
@// NB(chrisdickinson): if you move this file, be sure to update tools/doc/html.js to
@// point at the new location.
+@// tools/doc/html.js to point at the new location.
+
+
+
* [About these Docs](documentation.html)
* [Usage & Example](synopsis.html)
diff --git a/doc/api/addons.md b/doc/api/addons.md
index 3641a2d6ba224a..7b7f780a74822d 100644
--- a/doc/api/addons.md
+++ b/doc/api/addons.md
@@ -34,8 +34,9 @@ involving knowledge of several components and APIs :
- Node.js includes a number of other statically linked libraries including
OpenSSL. These other libraries are located in the `deps/` directory in the
- Node.js source tree. Only the V8 and OpenSSL symbols are purposefully
- re-exported by Node.js and may be used to various extents by Addons.
+ Node.js source tree. Only the libuv, OpenSSL, V8 and zlib symbols are
+ purposefully re-exported by Node.js and may be used to various extents by
+ Addons.
See [Linking to Node.js' own dependencies][] for additional information.
All of the following examples are available for [download][] and may
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 6bae0a67c3d101..e76fa057c2472d 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -235,6 +235,14 @@ added: v7.7.0
A comma separated list of categories that should be traced when trace event
tracing is enabled using `--trace-events-enabled`.
+### `--trace-event-file-pattern`
+
+
+Template string specifying the filepath for the trace event data, it
+supports `${rotation}` and `${pid}`.
+
### `--zero-fill-buffers`
* `path` {string|Buffer|URL}
+* Returns: {boolean}
Synchronous version of [`fs.exists()`][].
Returns `true` if the path exists, `false` otherwise.
@@ -1546,6 +1549,7 @@ added: v0.1.95
-->
* `fd` {integer}
+* Returns: {fs.Stats}
Synchronous fstat(2). Returns an instance of [`fs.Stats`][].
@@ -1820,6 +1824,7 @@ changes:
-->
* `path` {string|Buffer|URL}
+* Returns: {fs.Stats}
Synchronous lstat(2). Returns an instance of [`fs.Stats`][].
@@ -1945,6 +1950,7 @@ added: v5.10.0
* `prefix` {string}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
+* Returns: {string}
The synchronous version of [`fs.mkdtemp()`][]. Returns the created
folder path.
@@ -2069,6 +2075,7 @@ changes:
* `path` {string|Buffer|URL}
* `flags` {string|number}
* `mode` {integer} **Default:** `0o666`
+* Returns: {number}
Synchronous version of [`fs.open()`][]. Returns an integer representing the file
descriptor.
@@ -2159,6 +2166,7 @@ changes:
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
+* Returns: {Array} An array of filenames
Synchronous readdir(3). Returns an array of filenames excluding `'.'` and
`'..'`.
@@ -2260,6 +2268,7 @@ changes:
* `options` {Object|string}
* `encoding` {string|null} **Default:** `null`
* `flag` {string} **Default:** `'r'`
+* Returns: {string|Buffer}
Synchronous version of [`fs.readFile()`][]. Returns the contents of the `path`.
@@ -2320,6 +2329,7 @@ changes:
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
+* Returns: {string|Buffer}
Synchronous readlink(2). Returns the symbolic link's string value.
@@ -2342,6 +2352,7 @@ changes:
* `offset` {integer}
* `length` {integer}
* `position` {integer}
+* Returns: {number}
Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`.
@@ -2452,6 +2463,7 @@ changes:
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
+* Returns: {string|Buffer}
Synchronously computes the canonical pathname by resolving `.`, `..` and
symbolic links.
@@ -2482,6 +2494,7 @@ added: v9.2.0
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
+* Returns: {string|Buffer}
Synchronous realpath(3).
@@ -2516,8 +2529,19 @@ changes:
* `callback` {Function}
* `err` {Error}
-Asynchronous rename(2). No arguments other than a possible exception are given
-to the completion callback.
+Asynchronously rename file at `oldPath` to the pathname provided
+as `newPath`. In the case that `newPath` already exists, it will
+be overwritten. No arguments other than a possible exception are
+given to the completion callback.
+
+See also: rename(2).
+
+```js
+fs.rename('oldFile.txt', 'newFile.txt', (err) => {
+ if (err) throw err;
+ console.log('Rename complete!');
+});
+```
## fs.renameSync(oldPath, newPath)
* `path` {string|Buffer|URL}
+* Returns: {fs.Stats}
Synchronous stat(2). Returns an instance of [`fs.Stats`][].
@@ -3197,6 +3222,7 @@ changes:
* `offset` {integer}
* `length` {integer}
* `position` {integer}
+* Returns: {number}
## fs.writeSync(fd, string[, position[, encoding]])
The default evaluator will, by default, assign the result of the most recently
evaluated expression to the special variable `_` (underscore).
@@ -162,6 +168,17 @@ Expression assignment to _ now disabled.
4
```
+Similarly, `_error` will refer to the last seen error, if there was any.
+Explicitly setting `_error` to a value will disable this behavior.
+
+
+```js
+> throw new Error('foo');
+Error: foo
+> _error.message
+'foo'
+```
+
### Custom Evaluation Functions
When a new `repl.REPLServer` is created, a custom evaluation function may be
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 424f3cfc33924c..b15d4745266588 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -323,6 +323,9 @@ The `'unpipe'` event is emitted when the [`stream.unpipe()`][] method is called
on a [Readable][] stream, removing this [Writable][] from its set of
destinations.
+This is also emitted in case this [Writable][] stream emits an error when a
+[Readable][] stream pipes into it.
+
```js
const writer = getWritableStreamSomehow();
const reader = getReadableStreamSomehow();
@@ -1496,6 +1499,9 @@ the callback and passing the error as the first argument. This will cause an
on how the stream is being used. Using the callback ensures consistent and
predictable handling of errors.
+If a Readable stream pipes into a Writable stream when Writable emits an
+error, the Readable stream will be unpiped.
+
```js
const { Writable } = require('stream');
diff --git a/doc/api/tracing.md b/doc/api/tracing.md
index e03477b1adf20c..13caa2a509bf74 100644
--- a/doc/api/tracing.md
+++ b/doc/api/tracing.md
@@ -19,3 +19,16 @@ node --trace-events-enabled --trace-event-categories v8,node,node.async_hooks se
Running Node.js with tracing enabled will produce log files that can be opened
in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
tab of Chrome.
+
+The logging file is by default called `node_trace.${rotation}.log`, where
+`${rotation}` is an incrementing log-rotation id. The filepath pattern can
+be specified with `--trace-event-file-pattern` that accepts a template
+string that supports `${rotation}` and `${pid}`. For example:
+
+```txt
+node --trace-events-enabled --trace-event-file-pattern '${pid}-${rotation}.log' server.js
+```
+
+Starting with Node 10.0.0, the tracing system uses the same time source as the
+one used by `process.hrtime()` however the trace-event timestamps are expressed
+in microseconds, unlike `process.hrtime()` which returns nanoseconds.
diff --git a/doc/api/url.md b/doc/api/url.md
index 38cb95d6097ae9..a423061f7b2945 100644
--- a/doc/api/url.md
+++ b/doc/api/url.md
@@ -971,6 +971,20 @@ changes:
The `url.format()` method returns a formatted URL string derived from
`urlObject`.
+```js
+url.format({
+ protocol: 'https',
+ hostname: 'example.com',
+ pathname: '/some/path',
+ query: {
+ page: 1,
+ format: 'json'
+ }
+});
+
+// => 'https://example.com/some/path?page=1&format=json'
+```
+
If `urlObject` is not an object or a string, `url.format()` will throw a
[`TypeError`][].
diff --git a/doc/api/util.md b/doc/api/util.md
index 7475e36f1c2013..976621ddb383e3 100644
--- a/doc/api/util.md
+++ b/doc/api/util.md
@@ -190,6 +190,7 @@ contains circular references.
Similar to `util.inspect()` without options.
This will show the full object not including non-enumerable symbols and properties.
* `%%` - single percent sign (`'%'`). This does not consume an argument.
+* Returns: {string} The formatted string
If the placeholder does not have a corresponding argument, the placeholder is
not replaced.
@@ -491,7 +492,7 @@ added: v9.0.0
* `val2` {any}
* Returns: {boolean}
-Returns `true` if there is deep strict equality between `val` and `val2`.
+Returns `true` if there is deep strict equality between `val1` and `val2`.
Otherwise, returns `false`.
See [`assert.deepStrictEqual()`][] for more information about deep strict
@@ -806,6 +807,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Internal alias for [`Array.isArray`][].
@@ -831,6 +833,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
@@ -854,6 +857,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated: Use [`Buffer.isBuffer()`][] instead.
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
@@ -877,6 +881,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
@@ -900,6 +905,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is an [`Error`][]. Otherwise, returns
`false`.
@@ -939,6 +945,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `Function`. Otherwise, returns
`false`.
@@ -966,6 +973,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is strictly `null`. Otherwise, returns
`false`.
@@ -990,6 +998,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
returns `false`.
@@ -1014,6 +1023,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
@@ -1039,6 +1049,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is strictly an `Object` **and** not a
`Function`. Otherwise, returns `false`.
@@ -1065,6 +1076,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a primitive type. Otherwise, returns
`false`.
@@ -1101,6 +1113,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
@@ -1124,6 +1137,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
@@ -1149,6 +1163,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
@@ -1172,6 +1187,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
+* Returns: {boolean}
Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
diff --git a/doc/changelogs/CHANGELOG_V9.md b/doc/changelogs/CHANGELOG_V9.md
index f30a722abd655b..35107dc996d63f 100644
--- a/doc/changelogs/CHANGELOG_V9.md
+++ b/doc/changelogs/CHANGELOG_V9.md
@@ -8,6 +8,7 @@
+9.8.0 9.7.1 9.7.0 9.6.1
@@ -34,6 +35,99 @@
* [io.js](CHANGELOG_IOJS.md)
* [Archive](CHANGELOG_ARCHIVE.md)
+
+## 2018-03-07, Version 9.8.0 (Current), @MylesBorins
+
+### Notable Changes
+
+* **crypto**:
+ - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson) [#17690](https://github.com/nodejs/node/pull/17690)
+* **http2**:
+ - Fixed issues with aborted connections in the HTTP/2 implementation (Anna Henningsen) [#18987](https://github.com/nodejs/node/pull/18987) [#19002](https://github.com/nodejs/node/pull/19002)
+* **loader**:
+ - --inspect-brk now works properly for esmodules (Gus Caplan) [#18949](https://github.com/nodejs/node/pull/18949)
+* **src**:
+ - make process.dlopen() load well-known symbol (Ben Noordhuis) [#18934](https://github.com/nodejs/node/pull/18934)
+* **trace_events**:
+ - add file pattern cli option (Andreas Madsen) [#18480](https://github.com/nodejs/node/pull/18480)
+* **Added new collaborators**
+ - [MoonBall](https://github.com/MoonBall) Chen Gang
+
+### Commits
+
+* [[`6ae2cafde3`](https://github.com/nodejs/node/commit/6ae2cafde3)] - **buffer**: coerce offset to integer (Ruben Bridgewater) [#18215](https://github.com/nodejs/node/pull/18215)
+* [[`6d17383041`](https://github.com/nodejs/node/commit/6d17383041)] - **buffer**: fix typo in lib/buffer.js (Ujjwal Sharma) [#19126](https://github.com/nodejs/node/pull/19126)
+* [[`4b34b2e185`](https://github.com/nodejs/node/commit/4b34b2e185)] - **build**: fix gocvr version used for coverage (Michael Dawson) [#19094](https://github.com/nodejs/node/pull/19094)
+* [[`a938e52ffe`](https://github.com/nodejs/node/commit/a938e52ffe)] - **build**: disable openssl build warnings on macos (Ben Noordhuis) [#19046](https://github.com/nodejs/node/pull/19046)
+* [[`44d80c5620`](https://github.com/nodejs/node/commit/44d80c5620)] - **build**: fix coverage after gcovr update (killagu) [#18958](https://github.com/nodejs/node/pull/18958)
+* [[`28a5362e83`](https://github.com/nodejs/node/commit/28a5362e83)] - **build**: fix lint-md-build dependency (Joyee Cheung) [#18981](https://github.com/nodejs/node/pull/18981)
+* [[`e74e422a53`](https://github.com/nodejs/node/commit/e74e422a53)] - **(SEMVER-MINOR)** **crypto**: add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson) [#17690](https://github.com/nodejs/node/pull/17690)
+* [[`056001dc8f`](https://github.com/nodejs/node/commit/056001dc8f)] - **(SEMVER-MINOR)** **deps**: cherry-pick 0bcb1d6f from upstream V8 (Jakob Kummerow) [#18212](https://github.com/nodejs/node/pull/18212)
+* [[`1fadb2edb4`](https://github.com/nodejs/node/commit/1fadb2edb4)] - **doc**: fix/add link to Android info (Vse Mozhet Byt) [#19004](https://github.com/nodejs/node/pull/19004)
+* [[`68524610f2`](https://github.com/nodejs/node/commit/68524610f2)] - **doc**: remove subsystem from pull request template (Rich Trott) [#19125](https://github.com/nodejs/node/pull/19125)
+* [[`d3a70e9cd4`](https://github.com/nodejs/node/commit/d3a70e9cd4)] - **doc**: remove tentativeness in pull-requests.md (Rich Trott) [#19123](https://github.com/nodejs/node/pull/19123)
+* [[`f03079fce6`](https://github.com/nodejs/node/commit/f03079fce6)] - **doc**: update cc list (Ruben Bridgewater) [#19099](https://github.com/nodejs/node/pull/19099)
+* [[`9d2de16b13`](https://github.com/nodejs/node/commit/9d2de16b13)] - **doc**: add introduced\_in metadata to \_toc.md (Rich Trott) [#19113](https://github.com/nodejs/node/pull/19113)
+* [[`ae2dabb8fc`](https://github.com/nodejs/node/commit/ae2dabb8fc)] - **doc**: new team for bundlers or delivery of Node.js (Michael Dawson) [#19098](https://github.com/nodejs/node/pull/19098)
+* [[`0e4f4266a1`](https://github.com/nodejs/node/commit/0e4f4266a1)] - **doc**: add simple example to rename function (punteek) [#18812](https://github.com/nodejs/node/pull/18812)
+* [[`e42600fc4b`](https://github.com/nodejs/node/commit/e42600fc4b)] - **doc**: add missing `Returns` in fs & util (Sho Miyamoto) [#18775](https://github.com/nodejs/node/pull/18775)
+* [[`4ecf5bbe74`](https://github.com/nodejs/node/commit/4ecf5bbe74)] - **doc**: fix a typo in util.isDeepStrictEqual (Sho Miyamoto) [#18775](https://github.com/nodejs/node/pull/18775)
+* [[`cab6c8e95c`](https://github.com/nodejs/node/commit/cab6c8e95c)] - **doc**: add URL.format() example (Zeke Sikelianos) [#18888](https://github.com/nodejs/node/pull/18888)
+* [[`a4462b7944`](https://github.com/nodejs/node/commit/a4462b7944)] - **doc**: fix n-api asynchronous threading docs (Eric Bickle) [#19073](https://github.com/nodejs/node/pull/19073)
+* [[`bfa894cf37`](https://github.com/nodejs/node/commit/bfa894cf37)] - **doc**: add MoonBall to collaborators (Chen Gang) [#19109](https://github.com/nodejs/node/pull/19109)
+* [[`77154cd65d`](https://github.com/nodejs/node/commit/77154cd65d)] - **doc**: update list of re-exported symbols (Richard Lau) [#19013](https://github.com/nodejs/node/pull/19013)
+* [[`459f2095a1`](https://github.com/nodejs/node/commit/459f2095a1)] - **doc**: Readable unpipe on Writable error event (George Sapkin) [#18080](https://github.com/nodejs/node/pull/18080)
+* [[`68c1337819`](https://github.com/nodejs/node/commit/68c1337819)] - **doc**: add RegExp Unicode Property Escapes to intl (Vse Mozhet Byt) [#19052](https://github.com/nodejs/node/pull/19052)
+* [[`71d09ecbf1`](https://github.com/nodejs/node/commit/71d09ecbf1)] - **doc**: make the background section concise and improve its formality (Wilson) [#18928](https://github.com/nodejs/node/pull/18928)
+* [[`951054004d`](https://github.com/nodejs/node/commit/951054004d)] - **doc**: lowercase primitives in test/common/README.md (Vse Mozhet Byt) [#18875](https://github.com/nodejs/node/pull/18875)
+* [[`5b8c97f6bc`](https://github.com/nodejs/node/commit/5b8c97f6bc)] - **events**: show throw stack trace for uncaught exception (Anna Henningsen) [#19003](https://github.com/nodejs/node/pull/19003)
+* [[`0789eeceb6`](https://github.com/nodejs/node/commit/0789eeceb6)] - **http**: prevent aborted event when already completed (Andrew Johnston) [#18999](https://github.com/nodejs/node/pull/18999)
+* [[`ae4d83facf`](https://github.com/nodejs/node/commit/ae4d83facf)] - **http**: prevent aborted event when already completed (Andrew Johnston) [#18999](https://github.com/nodejs/node/pull/18999)
+* [[`50d1233935`](https://github.com/nodejs/node/commit/50d1233935)] - **http2**: no stream destroy while its data is on the wire (Anna Henningsen) [#19002](https://github.com/nodejs/node/pull/19002)
+* [[`551d9752c8`](https://github.com/nodejs/node/commit/551d9752c8)] - **http2**: fix flaky test-http2-https-fallback (Matteo Collina) [#19093](https://github.com/nodejs/node/pull/19093)
+* [[`8bc930c269`](https://github.com/nodejs/node/commit/8bc930c269)] - **http2**: fix endless loop when writing empty string (Anna Henningsen) [#18924](https://github.com/nodejs/node/pull/18924)
+* [[`aa0fca9426`](https://github.com/nodejs/node/commit/aa0fca9426)] - **http2**: use original error for cancelling pending streams (Anna Henningsen) [#18988](https://github.com/nodejs/node/pull/18988)
+* [[`447136999d`](https://github.com/nodejs/node/commit/447136999d)] - **http2**: send error text in case of ALPN mismatch (Anna Henningsen) [#18986](https://github.com/nodejs/node/pull/18986)
+* [[`ef8f90f34e`](https://github.com/nodejs/node/commit/ef8f90f34e)] - **http2**: fix condition where data is lost (Matteo Collina) [#18895](https://github.com/nodejs/node/pull/18895)
+* [[`e584113b66`](https://github.com/nodejs/node/commit/e584113b66)] - **lib**: re-fix v8\_prof\_processor (Anna Henningsen) [#19059](https://github.com/nodejs/node/pull/19059)
+* [[`12856b0dd2`](https://github.com/nodejs/node/commit/12856b0dd2)] - **lib**: change hook -\> hooks in code comment (Daniel Bevenius) [#19053](https://github.com/nodejs/node/pull/19053)
+* [[`db8d197e79`](https://github.com/nodejs/node/commit/db8d197e79)] - **lib,test**: remove yoda statements (Ruben Bridgewater) [#18746](https://github.com/nodejs/node/pull/18746)
+* [[`59547cc438`](https://github.com/nodejs/node/commit/59547cc438)] - **loader**: fix --inspect-brk (Gus Caplan) [#18949](https://github.com/nodejs/node/pull/18949)
+* [[`39e032fe86`](https://github.com/nodejs/node/commit/39e032fe86)] - **module**: fix main lookup regression from #18728 (Guy Bedford) [#18788](https://github.com/nodejs/node/pull/18788)
+* [[`f3e3429296`](https://github.com/nodejs/node/commit/f3e3429296)] - **module**: support main w/o extension, pjson cache (Guy Bedford) [#18728](https://github.com/nodejs/node/pull/18728)
+* [[`95f6467ffd`](https://github.com/nodejs/node/commit/95f6467ffd)] - **module**: fix cyclical dynamic import (Bradley Farias) [#18965](https://github.com/nodejs/node/pull/18965)
+* [[`5c4f703607`](https://github.com/nodejs/node/commit/5c4f703607)] - **n-api**: update reference test (Gabriel Schulhof) [#19086](https://github.com/nodejs/node/pull/19086)
+* [[`1b32fc3276`](https://github.com/nodejs/node/commit/1b32fc3276)] - **n-api**: fix object test (Gabriel Schulhof) [#19039](https://github.com/nodejs/node/pull/19039)
+* [[`ef4714c2b6`](https://github.com/nodejs/node/commit/ef4714c2b6)] - **net**: inline and simplify onSocketEnd (Anna Henningsen) [#18607](https://github.com/nodejs/node/pull/18607)
+* [[`28880cf89d`](https://github.com/nodejs/node/commit/28880cf89d)] - **perf_hooks**: fix timing (Timothy Gu) [#18993](https://github.com/nodejs/node/pull/18993)
+* [[`96f0bec48b`](https://github.com/nodejs/node/commit/96f0bec48b)] - **repl**: make last error available as `\_error` (Anna Henningsen) [#18919](https://github.com/nodejs/node/pull/18919)
+* [[`420d56c2ea`](https://github.com/nodejs/node/commit/420d56c2ea)] - **src**: don't touch js object in Http2Session dtor (Ben Noordhuis) [#18656](https://github.com/nodejs/node/pull/18656)
+* [[`f89f659dcf`](https://github.com/nodejs/node/commit/f89f659dcf)] - **src**: remove unnecessary Reset() calls (Ben Noordhuis) [#18656](https://github.com/nodejs/node/pull/18656)
+* [[`67a9742aed`](https://github.com/nodejs/node/commit/67a9742aed)] - **src**: prevent persistent handle resource leaks (Ben Noordhuis) [#18656](https://github.com/nodejs/node/pull/18656)
+* [[`08bcdde888`](https://github.com/nodejs/node/commit/08bcdde888)] - **(SEMVER-MINOR)** **src**: handle exceptions in env-\>SetImmediates (James M Snell) [#18297](https://github.com/nodejs/node/pull/18297)
+* [[`cc52dae7c4`](https://github.com/nodejs/node/commit/cc52dae7c4)] - **src**: #include \" to iculslocs (Steven R. Loomis) [#19150](https://github.com/nodejs/node/pull/19150)
+* [[`2f17c52674`](https://github.com/nodejs/node/commit/2f17c52674)] - **src**: use std::unique\_ptr for STACK\_OF(X509) (Ben Noordhuis) [#19087](https://github.com/nodejs/node/pull/19087)
+* [[`f10470ce2d`](https://github.com/nodejs/node/commit/f10470ce2d)] - **src**: refactor GetPeerCertificate (Daniel Bevenius) [#19087](https://github.com/nodejs/node/pull/19087)
+* [[`4fae6e3904`](https://github.com/nodejs/node/commit/4fae6e3904)] - **(SEMVER-MINOR)** **src**: make process.dlopen() load well-known symbol (Ben Noordhuis) [#18934](https://github.com/nodejs/node/pull/18934)
+* [[`89edbae7ab`](https://github.com/nodejs/node/commit/89edbae7ab)] - **(SEMVER-MINOR)** **src**: clean up process.dlopen() (Ben Noordhuis) [#18934](https://github.com/nodejs/node/pull/18934)
+* [[`08b83ee27a`](https://github.com/nodejs/node/commit/08b83ee27a)] - **src**: refactor setting JS properties on WriteWrap (Anna Henningsen) [#18963](https://github.com/nodejs/node/pull/18963)
+* [[`4d5cd5c6c5`](https://github.com/nodejs/node/commit/4d5cd5c6c5)] - **src**: fix error message in async\_hooks constructor (Daniel Bevenius) [#19000](https://github.com/nodejs/node/pull/19000)
+* [[`6787913a68`](https://github.com/nodejs/node/commit/6787913a68)] - **test**: add more information to assert.strictEqual (Ujjwal Sharma) [#19162](https://github.com/nodejs/node/pull/19162)
+* [[`ee653ecd09`](https://github.com/nodejs/node/commit/ee653ecd09)] - **test**: move require http2 to after crypto check (Daniel Bevenius) [#19111](https://github.com/nodejs/node/pull/19111)
+* [[`5bbf009c1d`](https://github.com/nodejs/node/commit/5bbf009c1d)] - **test**: check symbols in shared lib (Yihong Wang) [#18806](https://github.com/nodejs/node/pull/18806)
+* [[`d8833762cb`](https://github.com/nodejs/node/commit/d8833762cb)] - **test**: refactor test-async-wrap-getasyncid (Santiago Gimeno) [#18727](https://github.com/nodejs/node/pull/18727)
+* [[`23107ba7b1`](https://github.com/nodejs/node/commit/23107ba7b1)] - **test**: remove assert message and add block scope (wuweiweiwu) [#19054](https://github.com/nodejs/node/pull/19054)
+* [[`cc90bbd0f4`](https://github.com/nodejs/node/commit/cc90bbd0f4)] - **test**: fix flaky inspector-stop-profile-after-done (Rich Trott) [#18126](https://github.com/nodejs/node/pull/18126)
+* [[`8d595bb25c`](https://github.com/nodejs/node/commit/8d595bb25c)] - **test**: check endless loop while writing empty string (XadillaX) [#18924](https://github.com/nodejs/node/pull/18924)
+* [[`a4550069ca`](https://github.com/nodejs/node/commit/a4550069ca)] - **test**: allow running with `NODE\_PENDING\_DEPRECATION` (Anna Henningsen) [#18991](https://github.com/nodejs/node/pull/18991)
+* [[`fd27165f73`](https://github.com/nodejs/node/commit/fd27165f73)] - **test**: specify 'dir' for directory symlinks (Kyle Farnung) [#19049](https://github.com/nodejs/node/pull/19049)
+* [[`eca333a6e8`](https://github.com/nodejs/node/commit/eca333a6e8)] - **test**: refactor test after review (Andrew Johnston) [#18999](https://github.com/nodejs/node/pull/18999)
+* [[`c943cd09a7`](https://github.com/nodejs/node/commit/c943cd09a7)] - **test**: fix repl-tab-complete --without-ssl (Daniel Bevenius) [#17867](https://github.com/nodejs/node/pull/17867)
+* [[`f864509991`](https://github.com/nodejs/node/commit/f864509991)] - **test,benchmark**: use new Buffer API where appropriate (Сковорода Никита Андреевич) [#18980](https://github.com/nodejs/node/pull/18980)
+* [[`479b622e49`](https://github.com/nodejs/node/commit/479b622e49)] - **tls,http2**: handle writes after SSL destroy more gracefully (Anna Henningsen) [#18987](https://github.com/nodejs/node/pull/18987)
+* [[`3d4cda3a7d`](https://github.com/nodejs/node/commit/3d4cda3a7d)] - **(SEMVER-MINOR)** **trace_events**: add file pattern cli option (Andreas Madsen) [#18480](https://github.com/nodejs/node/pull/18480)
+* [[`3e8e1524ac`](https://github.com/nodejs/node/commit/3e8e1524ac)] - **util**: use blue on non-windows systems for number (Gus Caplan) [#18925](https://github.com/nodejs/node/pull/18925)
+
## 2018-03-02, Version 9.7.1 (Current), @rvagg
diff --git a/doc/guides/contributing/pull-requests.md b/doc/guides/contributing/pull-requests.md
index 4fd2de923a0e48..7ac8389e313349 100644
--- a/doc/guides/contributing/pull-requests.md
+++ b/doc/guides/contributing/pull-requests.md
@@ -401,10 +401,10 @@ seem unfamiliar, refer to this
All Pull Requests require "sign off" in order to land. Whenever a contributor
reviews a Pull Request they may find specific details that they would like to
see changed or fixed. These may be as simple as fixing a typo, or may involve
-substantive changes to the code you have written. In general, such requests
-are intended to be helpful, but at times may come across as abrupt or unhelpful,
-especially requests to change things that do not include concrete suggestions
-on *how* to change them.
+substantive changes to the code you have written. While such requests are
+intended to be helpful, they may come across as abrupt or unhelpful, especially
+requests to change things that do not include concrete suggestions on *how* to
+change them.
Try not to be discouraged. If you feel that a particular review is unfair,
say so, or contact one of the other contributors in the project and seek their
@@ -610,8 +610,8 @@ however, will stay intact on the Pull Request page.
For the size of "one logical change",
[0b5191f](https://github.com/nodejs/node/commit/0b5191f15d0f311c804d542b67e2e922d98834f8)
can be a good example. It touches the implementation, the documentation,
-and the tests, but is still one logical change. In general, the tests should
-always pass when each individual commit lands on the master branch.
+and the tests, but is still one logical change. All tests should always pass
+when each individual commit lands on the master branch.
### Getting Approvals for Your Pull Request
diff --git a/doc/guides/maintaining-V8.md b/doc/guides/maintaining-V8.md
index 04bc155660105b..0ede3ac5f5e332 100644
--- a/doc/guides/maintaining-V8.md
+++ b/doc/guides/maintaining-V8.md
@@ -3,15 +3,14 @@
## Background
V8 follows the Chromium release schedule. The support horizon for Chromium is
-very different from the support horizon that Node.js needs to provide to its
-users. As a result Node.js needs to support a version of V8 for quite a bit
-longer than what upstream needs to support. Since V8 doesn't have an LTS
-supported branch, there is no official process around how the V8 branches in
-Node.js are maintained.
-
-This document attempts to document the current processes and proposes a workflow
-for maintaining the V8 branches in Node.js LTS and Current releases and how the
-Node.js and V8 teams at Google can help.
+different compared to the support horizon for Node.js. As a result, Node.js
+needs to support multiple versions of V8 longer than what upstream needs
+to support. V8 branches in Node.js lack of an official maintenance process due
+to a missing LTS supported branch.
+
+This document attempts to outline the current maintenance processes, proposes
+a workflow for maintaining the V8 branches in both Node.js LTS and current
+releases, and discusses how the Node.js and V8 teams at Google can help.
## V8 Release Schedule
diff --git a/doc/node.1 b/doc/node.1
index 26092d26520247..d543d9fa0355f2 100644
--- a/doc/node.1
+++ b/doc/node.1
@@ -156,6 +156,10 @@ Enable the collection of trace event tracing information.
A comma-separated list of categories that should be traced when trace event tracing is enabled using
.Fl -trace-events-enabled .
.
+.It Fl -trace-event-file-pattern Ar pattern
+Template string specifying the filepath for the trace event data, it
+supports \fB${rotation}\fR and \fB${pid}\fR.
+.
.It Fl -zero-fill-buffers
Automatically zero-fills all newly allocated Buffer and SlowBuffer instances.
.
diff --git a/doc/onboarding-extras.md b/doc/onboarding-extras.md
index 30e0e7579f36aa..fa2d1ae02d9b60 100644
--- a/doc/onboarding-extras.md
+++ b/doc/onboarding-extras.md
@@ -5,42 +5,43 @@
| Subsystem | Maintainers |
| --- | --- |
| `benchmark/*` | @nodejs/benchmarking, @mscdex |
-| `bootstrap_node.js` | @fishrock123 |
+| `bootstrap_node.js` | @nodejs/process |
| `doc/*`, `*.md` | @nodejs/documentation |
| `lib/assert` | @nodejs/testing |
| `lib/async_hooks` | @nodejs/async\_hooks for bugs/reviews (+ @nodejs/diagnostics for API) |
| `lib/buffer` | @nodejs/buffer |
-| `lib/child_process` | @bnoordhuis, @cjihrig |
-| `lib/cluster` | @bnoordhuis, @cjihrig, @mcollina |
+| `lib/child_process` | @nodejs/child\_process |
+| `lib/cluster` | @nodejs/cluster |
| `lib/{crypto,tls,https}` | @nodejs/crypto |
-| `lib/dgram` | @cjihrig, @mcollina |
-| `lib/domains` | @misterdjules |
+| `lib/dgram` | @nodejs/dgram |
+| `lib/domains` | @nodejs/domains |
| `lib/fs`, `src/{fs,file}` | @nodejs/fs |
| `lib/{_}http{*}` | @nodejs/http |
| `lib/inspector.js`, `src/inspector_*` | @nodejs/v8-inspector |
| `lib/internal/url`, `src/node_url` | @nodejs/url |
| `lib/net` | @bnoordhuis, @indutny, @nodejs/streams |
-| `lib/repl` | @addaleax, @fishrock123 |
+| `lib/repl` | @nodejs/repl |
| `lib/{_}stream{*}` | @nodejs/streams |
-| `lib/timers` | @fishrock123, @misterdjules |
-| `lib/util` | @bnoordhuis, @cjihrig, @evanlucas |
-| `lib/zlib` | @addaleax, @bnoordhuis, @indutny |
+| `lib/timers` | @nodejs/timers |
+| `lib/util` | @nodejs/util |
+| `lib/zlib` | @nodejs/zlib |
| `src/async-wrap.*` | @nodejs/async\_hooks |
| `src/node_api.*` | @nodejs/n-api |
| `src/node_crypto.*` | @nodejs/crypto |
| `test/*` | @nodejs/testing |
-| `tools/node_modules/eslint`, `.eslintrc` | @not-an-aardvark, @silverwind, @trott |
+| `tools/node_modules/eslint`, `.eslintrc` | @nodejs/linting |
| build | @nodejs/build |
| `src/module_wrap.*`, `lib/internal/loader/*`, `lib/internal/vm/Module.js` | @nodejs/modules |
| GYP | @nodejs/gyp |
| performance | @nodejs/performance |
| platform specific | @nodejs/platform-{aix,arm,freebsd,macos,ppc,smartos,s390,windows} |
| python code | @nodejs/python |
-| upgrading c-ares | @jbergstroem |
-| upgrading http-parser | @jbergstroem, @nodejs/http |
-| upgrading libuv | @saghul |
+| upgrading c-ares | @rvagg |
+| upgrading http-parser | @nodejs/http, @nodejs/http2 |
+| upgrading libuv | @nodejs/libuv |
| upgrading npm | @fishrock123, @MylesBorins |
| upgrading V8 | @nodejs/v8, @nodejs/post-mortem |
+| Embedded use or delivery of Node.js | @nodejs/delivery-channels |
When things need extra attention, are controversial, or `semver-major`:
@nodejs/tsc
diff --git a/lib/_http_client.js b/lib/_http_client.js
index 63efb06b8f7f9c..71d81cd64dd58c 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -353,7 +353,7 @@ function socketCloseListener() {
var parser = socket.parser;
if (req.res && req.res.readable) {
// Socket closed before we emitted 'end' below.
- req.res.emit('aborted');
+ if (!req.res.complete) req.res.emit('aborted');
var res = req.res;
res.on('end', function() {
res.emit('close');
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 9713224bd7fb83..c8116811ba5dbd 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -839,7 +839,7 @@ function resume_(stream, state) {
Readable.prototype.pause = function() {
debug('call pause flowing=%j', this._readableState.flowing);
- if (false !== this._readableState.flowing) {
+ if (this._readableState.flowing !== false) {
debug('pause');
this._readableState.flowing = false;
this.emit('pause');
diff --git a/lib/async_hooks.js b/lib/async_hooks.js
index 8711755b25079b..19e7886360c13f 100644
--- a/lib/async_hooks.js
+++ b/lib/async_hooks.js
@@ -48,15 +48,15 @@ const {
class AsyncHook {
constructor({ init, before, after, destroy, promiseResolve }) {
if (init !== undefined && typeof init !== 'function')
- throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'init');
+ throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.init');
if (before !== undefined && typeof before !== 'function')
- throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'before');
+ throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.before');
if (after !== undefined && typeof after !== 'function')
- throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'before');
+ throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.after');
if (destroy !== undefined && typeof destroy !== 'function')
- throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'before');
+ throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.destroy');
if (promiseResolve !== undefined && typeof promiseResolve !== 'function')
- throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'promiseResolve');
+ throw new errors.TypeError('ERR_ASYNC_CALLBACK', 'hook.promiseResolve');
this[init_symbol] = init;
this[before_symbol] = before;
diff --git a/lib/buffer.js b/lib/buffer.js
index c8e3f05d5c268a..ddbdbb6d03e531 100644
--- a/lib/buffer.js
+++ b/lib/buffer.js
@@ -742,7 +742,7 @@ Buffer.prototype.compare = function compare(target,
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
-// - encoding - an optional encoding, relevant is val is a string
+// - encoding - an optional encoding, relevant if val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
if (typeof byteOffset === 'string') {
@@ -1242,6 +1242,7 @@ function toFloat(x) {
Buffer.prototype.readDoubleBE = function(offset, noAssert) {
+ offset = offset >>> 0;
const x1 = this.readUInt32BE(offset + 0, noAssert);
const x0 = this.readUInt32BE(offset + 4, noAssert);
return toDouble(x0, x1);
@@ -1249,6 +1250,7 @@ Buffer.prototype.readDoubleBE = function(offset, noAssert) {
Buffer.prototype.readDoubleLE = function(offset, noAssert) {
+ offset = offset >>> 0;
const x0 = this.readUInt32LE(offset + 0, noAssert);
const x1 = this.readUInt32LE(offset + 4, noAssert);
return toDouble(x0, x1);
@@ -1256,11 +1258,13 @@ Buffer.prototype.readDoubleLE = function(offset, noAssert) {
Buffer.prototype.readFloatBE = function(offset, noAssert) {
+ offset = offset >>> 0;
return toFloat(this.readUInt32BE(offset, noAssert));
};
Buffer.prototype.readFloatLE = function(offset, noAssert) {
+ offset = offset >>> 0;
return toFloat(this.readUInt32LE(offset, noAssert));
};
diff --git a/lib/events.js b/lib/events.js
index 07fa6484363116..799f8b4309d4c3 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -94,6 +94,47 @@ EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
return $getMaxListeners(this);
};
+// Returns the longest sequence of `a` that fully appears in `b`,
+// of length at least 3.
+// This is a lazy approach but should work well enough, given that stack
+// frames are usually unequal or otherwise appear in groups, and that
+// we only run this code in case of an unhandled exception.
+function longestSeqContainedIn(a, b) {
+ for (var len = a.length; len >= 3; --len) {
+ for (var i = 0; i < a.length - len; ++i) {
+ // Attempt to find a[i:i+len] in b
+ for (var j = 0; j < b.length - len; ++j) {
+ let matches = true;
+ for (var k = 0; k < len; ++k) {
+ if (a[i + k] !== b[j + k]) {
+ matches = false;
+ break;
+ }
+ }
+ if (matches)
+ return [ len, i, j ];
+ }
+ }
+ }
+
+ return [ 0, 0, 0 ];
+}
+
+function enhanceStackTrace(err, own) {
+ const sep = '\nEmitted \'error\' event at:\n';
+
+ const errStack = err.stack.split('\n').slice(1);
+ const ownStack = own.stack.split('\n').slice(1);
+
+ const [ len, off ] = longestSeqContainedIn(ownStack, errStack);
+ if (len > 0) {
+ ownStack.splice(off + 1, len - 1,
+ ' [... lines matching original stack trace ...]');
+ }
+ // Do this last, because it is the only operation with side effects.
+ err.stack = err.stack + sep + ownStack.join('\n');
+}
+
EventEmitter.prototype.emit = function emit(type, ...args) {
let doError = (type === 'error');
@@ -109,13 +150,25 @@ EventEmitter.prototype.emit = function emit(type, ...args) {
if (args.length > 0)
er = args[0];
if (er instanceof Error) {
+ try {
+ const { kExpandStackSymbol } = require('internal/util');
+ const capture = {};
+ Error.captureStackTrace(capture, EventEmitter.prototype.emit);
+ Object.defineProperty(er, kExpandStackSymbol, {
+ value: enhanceStackTrace.bind(null, er, capture),
+ configurable: true
+ });
+ } catch (e) {}
+
+ // Note: The comments on the `throw` lines are intentional, they show
+ // up in Node's output if this results in an unhandled exception.
throw er; // Unhandled 'error' event
}
// At least give some kind of context to the user
const errors = lazyErrors();
const err = new errors.Error('ERR_UNHANDLED_ERROR', er);
err.context = er;
- throw err;
+ throw err; // Unhandled 'error' event
}
const handler = events[type];
diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js
index ea49239a6178bb..6f9b5b0a93eee5 100644
--- a/lib/internal/async_hooks.js
+++ b/lib/internal/async_hooks.js
@@ -124,7 +124,7 @@ function validateAsyncId(asyncId, type) {
// emitInitScript.
function emitInitNative(asyncId, type, triggerAsyncId, resource) {
active_hooks.call_depth += 1;
- // Use a single try/catch for all hook to avoid setting up one per iteration.
+ // Use a single try/catch for all hooks to avoid setting up one per iteration.
try {
for (var i = 0; i < active_hooks.array.length; i++) {
if (typeof active_hooks.array[i][init_symbol] === 'function') {
diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
index 06bed3faaa4870..d8096f90e172ea 100644
--- a/lib/internal/bootstrap_node.js
+++ b/lib/internal/bootstrap_node.js
@@ -105,6 +105,7 @@
process.emitWarning(
'The ESM module loader is experimental.',
'ExperimentalWarning', undefined);
+ NativeModule.require('internal/process/modules').setup();
}
@@ -438,6 +439,11 @@
} catch (er) {
// nothing to be done about it at this point.
}
+ try {
+ const { kExpandStackSymbol } = NativeModule.require('internal/util');
+ if (typeof er[kExpandStackSymbol] === 'function')
+ er[kExpandStackSymbol]();
+ } catch (er) {}
return false;
}
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index 9247292ff47fce..93b76588db03b2 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -306,8 +306,23 @@ function onStreamClose(code) {
if (state.fd !== undefined)
tryClose(state.fd);
- stream.push(null);
- stream[kMaybeDestroy](null, code);
+
+ // Defer destroy we actually emit end.
+ if (stream._readableState.endEmitted || code !== NGHTTP2_NO_ERROR) {
+ // If errored or ended, we can destroy immediately.
+ stream[kMaybeDestroy](null, code);
+ } else {
+ // Wait for end to destroy.
+ stream.on('end', stream[kMaybeDestroy]);
+ // Push a null so the stream can end whenever the client consumes
+ // it completely.
+ stream.push(null);
+
+ // Same as net.
+ if (stream.readableLength === 0) {
+ stream.read(0);
+ }
+ }
}
// Receives a chunk of data for a given stream and forwards it on
@@ -325,11 +340,19 @@ function onStreamRead(nread, buf) {
}
return;
}
+
// Last chunk was received. End the readable side.
debug(`Http2Stream ${stream[kID]} [Http2Session ` +
`${sessionName(stream[kSession][kType])}]: ending readable.`);
- stream.push(null);
- stream[kMaybeDestroy]();
+
+ // defer this until we actually emit end
+ if (stream._readableState.endEmitted) {
+ stream[kMaybeDestroy]();
+ } else {
+ stream.on('end', stream[kMaybeDestroy]);
+ stream.push(null);
+ stream.read(0);
+ }
}
// Called when the remote peer settings have been updated.
@@ -1106,6 +1129,11 @@ class Http2Session extends EventEmitter {
// Destroy any pending and open streams
const cancel = new errors.Error('ERR_HTTP2_STREAM_CANCEL');
+ if (error) {
+ cancel.cause = error;
+ if (typeof error.message === 'string')
+ cancel.message += ` (caused by: ${error.message})`;
+ }
state.pendingStreams.forEach((stream) => stream.destroy(cancel));
state.streams.forEach((stream) => stream.destroy(error));
@@ -1825,21 +1853,25 @@ class Http2Stream extends Duplex {
session[kMaybeDestroy]();
process.nextTick(emit, this, 'close', code);
callback(err);
- }
+ }
// The Http2Stream can be destroyed if it has closed and if the readable
// side has received the final chunk.
[kMaybeDestroy](error, code = NGHTTP2_NO_ERROR) {
- if (error == null) {
- if (code === NGHTTP2_NO_ERROR &&
- (!this._readableState.ended ||
- !this._writableState.ended ||
- this._writableState.pendingcb > 0 ||
- !this.closed)) {
- return;
- }
+ if (error || code !== NGHTTP2_NO_ERROR) {
+ this.destroy(error);
+ return;
+ }
+
+ // TODO(mcollina): remove usage of _*State properties
+ if (this._readableState.ended &&
+ this._writableState.ended &&
+ this._writableState.pendingcb === 0 &&
+ this.closed) {
+ this.destroy();
+ // This should return, but eslint complains.
+ // return
}
- this.destroy(error);
}
}
@@ -2461,8 +2493,17 @@ function connectionListener(socket) {
return httpConnectionListener.call(this, socket);
}
// Let event handler deal with the socket
- if (!this.emit('unknownProtocol', socket))
- socket.destroy();
+ debug(`Unknown protocol from ${socket.remoteAddress}:${socket.remotePort}`);
+ if (!this.emit('unknownProtocol', socket)) {
+ // We don't know what to do, so let's just tell the other side what's
+ // going on in a format that they *might* understand.
+ socket.end('HTTP/1.0 403 Forbidden\r\n' +
+ 'Content-Type: text/plain\r\n\r\n' +
+ 'Unknown ALPN Protocol, expected `h2` to be available.\n' +
+ 'If this is a HTTP request: The server was not ' +
+ 'configured with the `allowHTTP1` option or a ' +
+ 'listener for the `unknownProtocol` event.\n');
+ }
return;
}
diff --git a/lib/internal/loader/DefaultResolve.js b/lib/internal/loader/DefaultResolve.js
index 69dd9537c18c2d..d815be87dd8954 100644
--- a/lib/internal/loader/DefaultResolve.js
+++ b/lib/internal/loader/DefaultResolve.js
@@ -2,7 +2,6 @@
const { URL } = require('url');
const CJSmodule = require('module');
-const internalURLModule = require('internal/url');
const internalFS = require('internal/fs');
const NativeModule = require('native_module');
const { extname } = require('path');
@@ -11,6 +10,7 @@ const preserveSymlinks = !!process.binding('config').preserveSymlinks;
const errors = require('internal/errors');
const { resolve: moduleWrapResolve } = internalBinding('module_wrap');
const StringStartsWith = Function.call.bind(String.prototype.startsWith);
+const { getURLFromFilePath, getPathFromURL } = require('internal/url');
const realpathCache = new Map();
@@ -57,7 +57,8 @@ function resolve(specifier, parentURL) {
let url;
try {
- url = search(specifier, parentURL);
+ url = search(specifier,
+ parentURL || getURLFromFilePath(`${process.cwd()}/`).href);
} catch (e) {
if (typeof e.message === 'string' &&
StringStartsWith(e.message, 'Cannot find module'))
@@ -66,17 +67,27 @@ function resolve(specifier, parentURL) {
}
if (!preserveSymlinks) {
- const real = realpathSync(internalURLModule.getPathFromURL(url), {
+ const real = realpathSync(getPathFromURL(url), {
[internalFS.realpathCacheKey]: realpathCache
});
const old = url;
- url = internalURLModule.getURLFromFilePath(real);
+ url = getURLFromFilePath(real);
url.search = old.search;
url.hash = old.hash;
}
const ext = extname(url.pathname);
- return { url: `${url}`, format: extensionFormatMap[ext] || ext };
+
+ let format = extensionFormatMap[ext];
+ if (!format) {
+ const isMain = parentURL === undefined;
+ if (isMain)
+ format = 'cjs';
+ else
+ throw new errors.Error('ERR_UNKNOWN_FILE_EXTENSION', url.pathname);
+ }
+
+ return { url: `${url}`, format };
}
module.exports = resolve;
diff --git a/lib/internal/loader/Loader.js b/lib/internal/loader/Loader.js
index eda42645f170f6..f0edbbf921f40f 100644
--- a/lib/internal/loader/Loader.js
+++ b/lib/internal/loader/Loader.js
@@ -1,51 +1,21 @@
'use strict';
-const path = require('path');
-const { getURLFromFilePath, URL } = require('internal/url');
const errors = require('internal/errors');
-
const ModuleMap = require('internal/loader/ModuleMap');
const ModuleJob = require('internal/loader/ModuleJob');
const defaultResolve = require('internal/loader/DefaultResolve');
const createDynamicModule = require('internal/loader/CreateDynamicModule');
const translators = require('internal/loader/Translators');
-const { setImportModuleDynamicallyCallback } = internalBinding('module_wrap');
+
const FunctionBind = Function.call.bind(Function.prototype.bind);
const debug = require('util').debuglog('esm');
-// Returns a file URL for the current working directory.
-function getURLStringForCwd() {
- try {
- return getURLFromFilePath(`${process.cwd()}/`).href;
- } catch (e) {
- e.stack;
- // If the current working directory no longer exists.
- if (e.code === 'ENOENT') {
- return undefined;
- }
- throw e;
- }
-}
-
-function normalizeReferrerURL(referrer) {
- if (typeof referrer === 'string' && path.isAbsolute(referrer)) {
- return getURLFromFilePath(referrer).href;
- }
- return new URL(referrer).href;
-}
-
/* A Loader instance is used as the main entry point for loading ES modules.
* Currently, this is a singleton -- there is only one used for loading
* the main module and everything in its dependency graph. */
class Loader {
- constructor(base = getURLStringForCwd()) {
- if (typeof base !== 'string')
- throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'base', 'string');
-
- this.base = base;
- this.isMain = true;
-
+ constructor() {
// methods which translate input code or other information
// into es modules
this.translators = translators;
@@ -71,8 +41,9 @@ class Loader {
this._dynamicInstantiate = undefined;
}
- async resolve(specifier, parentURL = this.base) {
- if (typeof parentURL !== 'string')
+ async resolve(specifier, parentURL) {
+ const isMain = parentURL === undefined;
+ if (!isMain && typeof parentURL !== 'string')
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'parentURL', 'string');
const { url, format } =
@@ -93,7 +64,7 @@ class Loader {
return { url, format };
}
- async import(specifier, parent = this.base) {
+ async import(specifier, parent) {
const job = await this.getModuleJob(specifier, parent);
const module = await job.run();
return module.namespace();
@@ -107,7 +78,7 @@ class Loader {
this._dynamicInstantiate = FunctionBind(dynamicInstantiate, null);
}
- async getModuleJob(specifier, parentURL = this.base) {
+ async getModuleJob(specifier, parentURL) {
const { url, format } = await this.resolve(specifier, parentURL);
let job = this.moduleMap.get(url);
if (job !== undefined)
@@ -134,24 +105,16 @@ class Loader {
}
let inspectBrk = false;
- if (this.isMain) {
- if (process._breakFirstLine) {
- delete process._breakFirstLine;
- inspectBrk = true;
- }
- this.isMain = false;
+ if (process._breakFirstLine) {
+ delete process._breakFirstLine;
+ inspectBrk = true;
}
job = new ModuleJob(this, url, loaderInstance, inspectBrk);
this.moduleMap.set(url, job);
return job;
}
-
- static registerImportDynamicallyCallback(loader) {
- setImportModuleDynamicallyCallback(async (referrer, specifier) => {
- return loader.import(specifier, normalizeReferrerURL(referrer));
- });
- }
}
Object.setPrototypeOf(Loader.prototype, null);
+
module.exports = Loader;
diff --git a/lib/internal/loader/ModuleJob.js b/lib/internal/loader/ModuleJob.js
index db37765b20bd0c..b3553fc7235d95 100644
--- a/lib/internal/loader/ModuleJob.js
+++ b/lib/internal/loader/ModuleJob.js
@@ -15,6 +15,7 @@ class ModuleJob {
this.loader = loader;
this.error = null;
this.hadError = false;
+ this.inspectBrk = inspectBrk;
// This is a Promise<{ module, reflect }>, whose fields will be copied
// onto `this` by `link()` below once it has been resolved.
@@ -26,10 +27,6 @@ class ModuleJob {
const link = async () => {
({ module: this.module,
reflect: this.reflect } = await this.modulePromise);
- if (inspectBrk) {
- const initWrapper = process.binding('inspector').callAndPauseOnStart;
- initWrapper(this.module.instantiate, this.module);
- }
assert(this.module instanceof ModuleWrap);
const dependencyJobs = [];
@@ -53,10 +50,11 @@ class ModuleJob {
}
async instantiate() {
- if (this.instantiated) {
- return this.instantiated;
+ if (!this.instantiated) {
+ return this.instantiated = this._instantiate();
}
- return this.instantiated = this._instantiate();
+ await this.instantiated;
+ return this.module;
}
// This method instantiates the module associated with this job and its
@@ -83,7 +81,12 @@ class ModuleJob {
throw e;
}
try {
- this.module.instantiate();
+ if (this.inspectBrk) {
+ const initWrapper = process.binding('inspector').callAndPauseOnStart;
+ initWrapper(this.module.instantiate, this.module);
+ } else {
+ this.module.instantiate();
+ }
} catch (e) {
decorateErrorStack(e);
throw e;
diff --git a/lib/internal/loader/Translators.js b/lib/internal/loader/Translators.js
index d2f28774177fd6..18b1b12fd15854 100644
--- a/lib/internal/loader/Translators.js
+++ b/lib/internal/loader/Translators.js
@@ -19,7 +19,7 @@ const JsonParse = JSON.parse;
const translators = new SafeMap();
module.exports = translators;
-// Stragety for loading a standard JavaScript module
+// Strategy for loading a standard JavaScript module
translators.set('esm', async (url) => {
const source = `${await readFileAsync(new URL(url))}`;
debug(`Translating StandardModule ${url}`);
@@ -62,7 +62,7 @@ translators.set('builtin', async (url) => {
});
});
-// Stragety for loading a node native module
+// Strategy for loading a node native module
translators.set('addon', async (url) => {
debug(`Translating NativeModule ${url}`);
return createDynamicModule(['default'], url, (reflect) => {
@@ -74,7 +74,7 @@ translators.set('addon', async (url) => {
});
});
-// Stragety for loading a JSON file
+// Strategy for loading a JSON file
translators.set('json', async (url) => {
debug(`Translating JSONModule ${url}`);
return createDynamicModule(['default'], url, (reflect) => {
diff --git a/lib/internal/process/modules.js b/lib/internal/process/modules.js
new file mode 100644
index 00000000000000..bc977c718725f2
--- /dev/null
+++ b/lib/internal/process/modules.js
@@ -0,0 +1,47 @@
+'use strict';
+
+const {
+ setImportModuleDynamicallyCallback
+} = internalBinding('module_wrap');
+
+const { getURLFromFilePath } = require('internal/url');
+const Loader = require('internal/loader/Loader');
+const path = require('path');
+const { URL } = require('url');
+
+function normalizeReferrerURL(referrer) {
+ if (typeof referrer === 'string' && path.isAbsolute(referrer)) {
+ return getURLFromFilePath(referrer).href;
+ }
+ return new URL(referrer).href;
+}
+
+let loaderResolve;
+exports.loaderPromise = new Promise((resolve, reject) => {
+ loaderResolve = resolve;
+});
+
+exports.ESMLoader = undefined;
+
+exports.setup = function() {
+ let ESMLoader = new Loader();
+ const loaderPromise = (async () => {
+ const userLoader = process.binding('config').userLoader;
+ if (userLoader) {
+ const hooks = await ESMLoader.import(
+ userLoader, getURLFromFilePath(`${process.cwd()}/`).href);
+ ESMLoader = new Loader();
+ ESMLoader.hook(hooks);
+ exports.ESMLoader = ESMLoader;
+ }
+ return ESMLoader;
+ })();
+ loaderResolve(loaderPromise);
+
+ setImportModuleDynamicallyCallback(async (referrer, specifier) => {
+ const loader = await loaderPromise;
+ return loader.import(specifier, normalizeReferrerURL(referrer));
+ });
+
+ exports.ESMLoader = ESMLoader;
+};
diff --git a/lib/internal/readline.js b/lib/internal/readline.js
index e3d3007a75c645..979e62090b3b1d 100644
--- a/lib/internal/readline.js
+++ b/lib/internal/readline.js
@@ -87,33 +87,33 @@ if (process.binding('config').hasIntl) {
if (
code >= 0x1100 && (
code <= 0x115f || // Hangul Jamo
- 0x2329 === code || // LEFT-POINTING ANGLE BRACKET
- 0x232a === code || // RIGHT-POINTING ANGLE BRACKET
+ code === 0x2329 || // LEFT-POINTING ANGLE BRACKET
+ code === 0x232a || // RIGHT-POINTING ANGLE BRACKET
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
- (0x2e80 <= code && code <= 0x3247 && code !== 0x303f) ||
+ code >= 0x2e80 && code <= 0x3247 && code !== 0x303f ||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
- 0x3250 <= code && code <= 0x4dbf ||
+ code >= 0x3250 && code <= 0x4dbf ||
// CJK Unified Ideographs .. Yi Radicals
- 0x4e00 <= code && code <= 0xa4c6 ||
+ code >= 0x4e00 && code <= 0xa4c6 ||
// Hangul Jamo Extended-A
- 0xa960 <= code && code <= 0xa97c ||
+ code >= 0xa960 && code <= 0xa97c ||
// Hangul Syllables
- 0xac00 <= code && code <= 0xd7a3 ||
+ code >= 0xac00 && code <= 0xd7a3 ||
// CJK Compatibility Ideographs
- 0xf900 <= code && code <= 0xfaff ||
+ code >= 0xf900 && code <= 0xfaff ||
// Vertical Forms
- 0xfe10 <= code && code <= 0xfe19 ||
+ code >= 0xfe10 && code <= 0xfe19 ||
// CJK Compatibility Forms .. Small Form Variants
- 0xfe30 <= code && code <= 0xfe6b ||
+ code >= 0xfe30 && code <= 0xfe6b ||
// Halfwidth and Fullwidth Forms
- 0xff01 <= code && code <= 0xff60 ||
- 0xffe0 <= code && code <= 0xffe6 ||
+ code >= 0xff01 && code <= 0xff60 ||
+ code >= 0xffe0 && code <= 0xffe6 ||
// Kana Supplement
- 0x1b000 <= code && code <= 0x1b001 ||
+ code >= 0x1b000 && code <= 0x1b001 ||
// Enclosed Ideographic Supplement
- 0x1f200 <= code && code <= 0x1f251 ||
+ code >= 0x1f200 && code <= 0x1f251 ||
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
- 0x20000 <= code && code <= 0x3fffd
+ code >= 0x20000 && code <= 0x3fffd
)
) {
return true;
diff --git a/lib/internal/streams/legacy.js b/lib/internal/streams/legacy.js
index 3242b15eabdb0d..9790696bfc7131 100644
--- a/lib/internal/streams/legacy.js
+++ b/lib/internal/streams/legacy.js
@@ -12,10 +12,8 @@ Stream.prototype.pipe = function(dest, options) {
var source = this;
function ondata(chunk) {
- if (dest.writable) {
- if (false === dest.write(chunk) && source.pause) {
- source.pause();
- }
+ if (dest.writable && dest.write(chunk) === false && source.pause) {
+ source.pause();
}
}
diff --git a/lib/internal/util.js b/lib/internal/util.js
index fd481450bc246d..0241573fa818c8 100644
--- a/lib/internal/util.js
+++ b/lib/internal/util.js
@@ -320,5 +320,6 @@ module.exports = {
// Used by the buffer module to capture an internal reference to the
// default isEncoding implementation, just in case userland overrides it.
- kIsEncodingSymbol: Symbol('node.isEncoding')
+ kIsEncodingSymbol: Symbol('kIsEncodingSymbol'),
+ kExpandStackSymbol: Symbol('kExpandStackSymbol')
};
diff --git a/lib/internal/v8_prof_processor.js b/lib/internal/v8_prof_processor.js
index bb71213a8f4dae..7592253060294c 100644
--- a/lib/internal/v8_prof_processor.js
+++ b/lib/internal/v8_prof_processor.js
@@ -33,9 +33,9 @@ if (process.platform === 'darwin') {
tickArguments.push('--windows');
}
tickArguments.push.apply(tickArguments, process.argv.slice(1));
-script = `(function(require) {
+script = `(function(module, require) {
arguments = ${JSON.stringify(tickArguments)};
function write (s) { process.stdout.write(s) }
${script}
})`;
-vm.runInThisContext(script)(require);
+vm.runInThisContext(script)(module, require);
diff --git a/lib/module.js b/lib/module.js
index 22a3e354c31617..877cca590f077b 100644
--- a/lib/module.js
+++ b/lib/module.js
@@ -24,7 +24,6 @@
const NativeModule = require('native_module');
const util = require('util');
const { decorateErrorStack } = require('internal/util');
-const internalModule = require('internal/module');
const { getURLFromFilePath } = require('internal/url');
const vm = require('vm');
const assert = require('assert').ok;
@@ -35,6 +34,7 @@ const {
internalModuleReadFile,
internalModuleStat
} = process.binding('fs');
+const internalModule = require('internal/module');
const preserveSymlinks = !!process.binding('config').preserveSymlinks;
const experimentalModules = !!process.binding('config').experimentalModules;
@@ -43,10 +43,9 @@ const errors = require('internal/errors');
module.exports = Module;
// these are below module.exports for the circular reference
-const Loader = require('internal/loader/Loader');
+const internalESModule = require('internal/process/modules');
const ModuleJob = require('internal/loader/ModuleJob');
const createDynamicModule = require('internal/loader/CreateDynamicModule');
-let ESMLoader;
function stat(filename) {
filename = path.toNamespacedPath(filename);
@@ -444,7 +443,6 @@ Module._resolveLookupPaths = function(request, parent, newReturn) {
return (newReturn ? parentDir : [id, parentDir]);
};
-
// Check the cache for the requested file.
// 1. If a module already exists in the cache: return its exports object.
// 2. If the module is native: call `NativeModule.require()` with the
@@ -457,22 +455,10 @@ Module._load = function(request, parent, isMain) {
debug('Module._load REQUEST %s parent: %s', request, parent.id);
}
- if (isMain && experimentalModules) {
- (async () => {
- // loader setup
- if (!ESMLoader) {
- ESMLoader = new Loader();
- const userLoader = process.binding('config').userLoader;
- if (userLoader) {
- ESMLoader.isMain = false;
- const hooks = await ESMLoader.import(userLoader);
- ESMLoader = new Loader();
- ESMLoader.hook(hooks);
- }
- }
- Loader.registerImportDynamicallyCallback(ESMLoader);
- await ESMLoader.import(getURLFromFilePath(request).pathname);
- })()
+ if (experimentalModules && isMain) {
+ internalESModule.loaderPromise.then((loader) => {
+ return loader.import(getURLFromFilePath(request).pathname);
+ })
.catch((e) => {
decorateErrorStack(e);
console.error(e);
@@ -575,7 +561,8 @@ Module.prototype.load = function(filename) {
Module._extensions[extension](this, filename);
this.loaded = true;
- if (ESMLoader) {
+ if (experimentalModules) {
+ const ESMLoader = internalESModule.ESMLoader;
const url = getURLFromFilePath(filename);
const urlString = `${url}`;
const exports = this.exports;
diff --git a/lib/net.js b/lib/net.js
index 09ad917ad0b7f6..90e0db558e3a9b 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -245,7 +245,7 @@ function Socket(options) {
// shut down the socket when we're finished with it.
this.on('finish', onSocketFinish);
- this.on('_socketEnd', onSocketEnd);
+ this.on('end', onReadableStreamEnd);
initSocketHandle(this);
@@ -341,32 +341,6 @@ function afterShutdown(status, handle) {
}
}
-// the EOF has been received, and no more bytes are coming.
-// if the writable side has ended already, then clean everything
-// up.
-function onSocketEnd() {
- // XXX Should not have to do as much in this function.
- // ended should already be true, since this is called *after*
- // the EOF errno and onread has eof'ed
- debug('onSocketEnd', this._readableState);
- this._readableState.ended = true;
- if (this._readableState.endEmitted) {
- this.readable = false;
- maybeDestroy(this);
- } else {
- this.once('end', function end() {
- this.readable = false;
- maybeDestroy(this);
- });
- this.read(0);
- }
-
- if (!this.allowHalfOpen) {
- this.write = writeAfterFIN;
- this.destroySoon();
- }
-}
-
// Provide a better error message when we call end() as a result
// of the other side sending a FIN. The standard 'write after end'
// is overly vague, and makes it seem like the user's code is to blame.
@@ -512,6 +486,12 @@ Socket.prototype.end = function(data, encoding, callback) {
};
+// Called when the 'end' event is emitted.
+function onReadableStreamEnd() {
+ maybeDestroy(this);
+}
+
+
// Call whenever we set writable=false or readable=false
function maybeDestroy(socket) {
if (!socket.readable &&
@@ -625,10 +605,11 @@ function onread(nread, buffer) {
// Do it before `maybeDestroy` for correct order of events:
// `end` -> `close`
self.push(null);
+ self.read(0);
- if (self.readableLength === 0) {
- self.readable = false;
- maybeDestroy(self);
+ if (!self.allowHalfOpen) {
+ self.write = writeAfterFIN;
+ self.destroySoon();
}
// internal end event so that we know that the actual socket
diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js
index 6fd6e4a6b768ce..bd1bee19fc2a54 100644
--- a/lib/perf_hooks.js
+++ b/lib/perf_hooks.js
@@ -8,6 +8,7 @@ const {
observerCounts,
setupObservers,
timeOrigin,
+ timeOriginTimestamp,
timerify,
constants
} = process.binding('performance');
@@ -145,6 +146,13 @@ function now() {
return hr[0] * 1000 + hr[1] / 1e6;
}
+function getMilestoneTimestamp(milestoneIdx) {
+ const ns = milestones[milestoneIdx];
+ if (ns === -1)
+ return ns;
+ return ns / 1e6 - timeOrigin;
+}
+
class PerformanceNodeTiming {
constructor() {}
@@ -157,7 +165,7 @@ class PerformanceNodeTiming {
}
get startTime() {
- return timeOrigin;
+ return 0;
}
get duration() {
@@ -165,59 +173,64 @@ class PerformanceNodeTiming {
}
get nodeStart() {
- return milestones[NODE_PERFORMANCE_MILESTONE_NODE_START];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_NODE_START);
}
get v8Start() {
- return milestones[NODE_PERFORMANCE_MILESTONE_V8_START];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_V8_START);
}
get environment() {
- return milestones[NODE_PERFORMANCE_MILESTONE_ENVIRONMENT];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_ENVIRONMENT);
}
get loopStart() {
- return milestones[NODE_PERFORMANCE_MILESTONE_LOOP_START];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_LOOP_START);
}
get loopExit() {
- return milestones[NODE_PERFORMANCE_MILESTONE_LOOP_EXIT];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_LOOP_EXIT);
}
get bootstrapComplete() {
- return milestones[NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE);
}
get thirdPartyMainStart() {
- return milestones[NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START];
+ return getMilestoneTimestamp(
+ NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_START);
}
get thirdPartyMainEnd() {
- return milestones[NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END];
+ return getMilestoneTimestamp(
+ NODE_PERFORMANCE_MILESTONE_THIRD_PARTY_MAIN_END);
}
get clusterSetupStart() {
- return milestones[NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_START];
+ return getMilestoneTimestamp(
+ NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_START);
}
get clusterSetupEnd() {
- return milestones[NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_END];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_CLUSTER_SETUP_END);
}
get moduleLoadStart() {
- return milestones[NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
}
get moduleLoadEnd() {
- return milestones[NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END];
+ return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END);
}
get preloadModuleLoadStart() {
- return milestones[NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START];
+ return getMilestoneTimestamp(
+ NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START);
}
get preloadModuleLoadEnd() {
- return milestones[NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END];
+ return getMilestoneTimestamp(
+ NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END);
}
[kInspect]() {
@@ -466,11 +479,11 @@ class Performance extends PerformanceObserverEntryList {
}
get timeOrigin() {
- return timeOrigin;
+ return timeOriginTimestamp;
}
now() {
- return now();
+ return now() - timeOrigin;
}
mark(name) {
@@ -549,8 +562,9 @@ class Performance extends PerformanceObserverEntryList {
[kInspect]() {
return {
- timeOrigin,
- nodeTiming
+ maxEntries: this.maxEntries,
+ nodeTiming: this.nodeTiming,
+ timeOrigin: this.timeOrigin
};
}
}
diff --git a/lib/repl.js b/lib/repl.js
index b7af18ed492a9f..2078c5dcedaf20 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -155,6 +155,8 @@ function REPLServer(prompt,
self.replMode = replMode || exports.REPL_MODE_SLOPPY;
self.underscoreAssigned = false;
self.last = undefined;
+ self.underscoreErrAssigned = false;
+ self.lastError = undefined;
self.breakEvalOnSigint = !!breakEvalOnSigint;
self.editorMode = false;
// Context id for use with the inspector protocol.
@@ -295,6 +297,8 @@ function REPLServer(prompt,
internalUtil.decorateErrorStack(e);
Error.prepareStackTrace = pstrace;
const isError = internalUtil.isError(e);
+ if (!self.underscoreErrAssigned)
+ self.lastError = e;
if (e instanceof SyntaxError && e.stack) {
// remove repl:line-number and stack trace
e.stack = e.stack
@@ -693,6 +697,7 @@ REPLServer.prototype.createContext = function() {
REPLServer.prototype.resetContext = function() {
this.context = this.createContext();
this.underscoreAssigned = false;
+ this.underscoreErrAssigned = false;
this.lines = [];
this.lines.level = [];
@@ -708,6 +713,19 @@ REPLServer.prototype.resetContext = function() {
}
});
+ Object.defineProperty(this.context, '_error', {
+ configurable: true,
+ get: () => this.lastError,
+ set: (value) => {
+ this.lastError = value;
+ if (!this.underscoreErrAssigned) {
+ this.underscoreErrAssigned = true;
+ this.outputStream.write(
+ 'Expression assignment to _error now disabled.\n');
+ }
+ }
+ });
+
// Allow REPL extensions to extend the new context
this.emit('reset', this.context);
};
diff --git a/lib/util.js b/lib/util.js
index 318a4cef24c93d..cd6321cfe5270e 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -333,9 +333,10 @@ inspect.colors = Object.assign(Object.create(null), {
});
// Don't use 'blue' not visible on cmd.exe
+const windows = process.platform === 'win32';
inspect.styles = Object.assign(Object.create(null), {
'special': 'cyan',
- 'number': 'yellow',
+ 'number': windows ? 'yellow' : 'blue',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
diff --git a/node.gyp b/node.gyp
index 7da486ff6d8c7b..d85f6a491a9eea 100644
--- a/node.gyp
+++ b/node.gyp
@@ -115,6 +115,7 @@
'lib/internal/net.js',
'lib/internal/module.js',
'lib/internal/os.js',
+ 'lib/internal/process/modules.js',
'lib/internal/process/next_tick.js',
'lib/internal/process/promises.js',
'lib/internal/process/stdio.js',
@@ -359,9 +360,10 @@
'src/node_internals.h',
'src/node_javascript.h',
'src/node_mutex.h',
- 'src/node_platform.h',
'src/node_perf.h',
'src/node_perf_common.h',
+ 'src/node_persistent.h',
+ 'src/node_platform.h',
'src/node_root_certs.h',
'src/node_version.h',
'src/node_watchdog.h',
diff --git a/src/async_wrap.cc b/src/async_wrap.cc
index 93bd3d4864fd5d..cd9f26d7782d46 100644
--- a/src/async_wrap.cc
+++ b/src/async_wrap.cc
@@ -410,8 +410,8 @@ static void DisablePromiseHook(const FunctionCallbackInfo& args) {
class DestroyParam {
public:
double asyncId;
- v8::Persistent