Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v15.2.0 proposal #36055

Merged
merged 66 commits into from Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
efbfeff
doc: fix incorrect heading level
700software Nov 4, 2020
6968b0f
doc: fix release-schedule link in backport guide
watilde Nov 2, 2020
1b277d9
src: remove ERR prefix in crypto status enums
danbev Oct 29, 2020
9b6512f
n-api: unlink reference during its destructor
Nov 2, 2020
4c6de85
benchmark: remove modules that require intl
richardlau Nov 4, 2020
acd3617
doc: option --prof documentation help added
Krank2me Aug 30, 2020
8bd364a
doc: add new wordings to the API description
PoojaDurgad Oct 10, 2020
23f0d0c
test: fix error in test/internet/test-dns.js
Trott Nov 4, 2020
6d56ba0
doc: update benchmark CI test indicator in README
Trott Nov 3, 2020
dc4936b
crypto: fix comment in ByteSource
tniessen Nov 4, 2020
9757b47
console: use more primordials
aduh95 Oct 21, 2020
b700900
lib: refactor to use more primordials
aduh95 Oct 29, 2020
d83e253
errors: refactor to use more primordials
aduh95 Nov 3, 2020
92bdfd1
fs: add support for AbortSignal in readFile
benjamingr Nov 1, 2020
76332a0
events: port some wpt tests
benjamingr May 28, 2020
a7d0c76
events: support emit on nodeeventtarget
benjamingr Oct 28, 2020
77d33c9
doc: update core-validate-commit link in guide
watilde Nov 3, 2020
01129a7
doc: revise v8.getHeapSnapshot()
Trott Oct 28, 2020
cb6f0d3
test: update old comment style test_util.cc
RaisinTen Oct 30, 2020
1dd744a
http2: fix error stream write followed by destroy
davedoesdev Nov 4, 2020
8d76db8
module: refactor to use iterable-weak-map
bcoe Nov 3, 2020
9d26c4d
domain: refactor to use more primordials
aduh95 Oct 30, 2020
da3c2ab
tools,doc: enable ecmaVersion 2021 in acorn parser
aduh95 Nov 6, 2020
9d9a044
benchmark: ignore build artifacts for napi addons
richardlau Nov 4, 2020
6011bfd
fs: remove unused assignment
Trott Oct 30, 2020
1f27214
tools: add new ESLint rule: prefer-primordials
Leko Sep 29, 2020
a7350b3
tools: don't print gold linker warning w/o flag
MylesBorins Nov 4, 2020
7a2edea
win, build: fix build time on Windows
bzoz Nov 2, 2020
33e2ee5
events: define event handler as enumerable
benjamingr Nov 2, 2020
ab0eb4f
events: support event handlers on prototypes
benjamingr Nov 2, 2020
ff59fcd
events: define abort on prototype
benjamingr Nov 2, 2020
9e67372
events: fire handlers in correct oder
benjamingr Nov 6, 2020
ccbe267
fs: remove unnecessary Function#bind() in fs/promises
bnoordhuis Sep 15, 2020
9c4b360
doc,crypto: added sign/verify method changes about dsaEncoding
panva Oct 12, 2020
06cc400
doc: fix crypto doc linter errors
aduh95 Nov 8, 2020
429113e
http2: move events to the JSStreamSocket
mmomtchev Oct 23, 2020
28ed7d0
http2: centralise socket event binding in Http2Session
mmomtchev Oct 24, 2020
b7aa5e2
stream: remove isPromise utility function
aduh95 Nov 2, 2020
567f8d8
events: getEventListeners static
benjamingr Nov 6, 2020
77e4f19
timers: cleanup abort listener on awaitable timers
jasnell Nov 6, 2020
af2a560
lib: add %TypedArray% abstract constructor to primordials
ExE-Boss Nov 7, 2020
7cb5c09
deps: cherry-pick 9a49b22 from V8 upstream
danbev Nov 3, 2020
4b03670
dns: fix trace_events name for resolveCaa()
Trott Nov 5, 2020
eea7e3b
tools,lib: tighten prefer-primordials rules for Error statics
aduh95 Nov 7, 2020
85cf305
doc,fs: document value of stats.isDirectory on symbolic links
coderaiser Apr 25, 2019
99cb362
doc: advise users to import the full set of trusted release keys
haqer1 Apr 4, 2020
d6bd78f
doc,net: document socket.timeout
kobelb Jul 28, 2020
71fa9c6
doc: add note regarding file structure in src/README.md
lundibundi Aug 31, 2020
11f5924
http2: add has method to proxySocketHandler
masx200 Sep 14, 2020
36c20d9
doc,stream: write(chunk, encoding, cb) encoding can be null
dev-script Sep 27, 2020
f73b8d8
test: improve error message for policy failures
bmeck Oct 13, 2020
292915a
bootstrap: refactor to use more primordials
aduh95 Nov 6, 2020
0a4c96a
test: use global.EventTarget instead of internals
aduh95 Nov 6, 2020
7ef9c70
fs: replace finally with PromisePrototypeFinally
baruchiro Nov 6, 2020
7a37590
module: refactor to use more primordials
aduh95 Nov 7, 2020
f8098c3
tools,lib: recommend using safe primordials
aduh95 Nov 7, 2020
10c9ea7
build: fix zlib inlining for IA-32
RaisinTen Oct 16, 2020
0d74226
crypto: refactor to use more primordials
aduh95 Nov 6, 2020
359a659
stream: writableNeedDrain
ronag Sep 25, 2020
6ac9c8f
build, tools: look for local installation of NASM
richardlau Nov 7, 2020
923276c
doc: move v8.getHeapCodeStatistics()
Trott Nov 7, 2020
fdae9ad
test: fix races in test-performance-eventlooputil
Flarna Nov 7, 2020
dcb2760
doc: escape asterisk in cctest gtest-filter
RaisinTen Nov 8, 2020
ccf9f0e
fs: support abortsignal in writeFile
benjamingr Nov 6, 2020
9774b4c
stream: fix thrown object reference
kanongil Nov 10, 2020
5ecd1c9
2020-11-10, Version 15.2.0 (Current)
danielleadams Nov 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -32,7 +32,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V15.md#15.1.0">15.1.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V15.md#15.2.0">15.2.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.1.0">15.1.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.0.1">15.0.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.0.0">15.0.0</a><br/>
</td>
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -602,7 +602,8 @@ Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys):
* **Shelley Vohr** &lt;shelley.vohr@gmail.com&gt;
`B9E2F5981AA6E0CD28160D9FF13993A75599653C`

To import the full set of trusted release keys:
To import the full set of trusted release keys (including subkeys possibly used
to sign releases):

```bash
gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
Expand Down
2 changes: 0 additions & 2 deletions benchmark/fixtures/require-builtins.js
Expand Up @@ -17,7 +17,6 @@ const list = [
'http',
'http2',
'https',
'inspector',
'module',
'net',
'os',
Expand All @@ -32,7 +31,6 @@ const list = [
'string_decoder',
'timers',
'tls',
'trace_events',
'tty',
'url',
'util',
Expand Down
1 change: 1 addition & 0 deletions benchmark/napi/type-tag-check/.gitignore
@@ -0,0 +1 @@
build/
1 change: 1 addition & 0 deletions benchmark/napi/type-tag/.gitignore
@@ -0,0 +1 @@
build/
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,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.16',
'v8_embedder_string': '-node.17',

##### V8 defaults for Node.js #####

Expand Down
3 changes: 2 additions & 1 deletion configure.py
Expand Up @@ -1761,7 +1761,8 @@ def configure_section_file(o):
proc = subprocess.Popen(['ld.gold'] + ['-v'], stdin = subprocess.PIPE,
stdout = subprocess.PIPE, stderr = subprocess.PIPE)
except OSError:
warn('''No acceptable ld.gold linker found!''')
if options.node_section_ordering_info != "":
warn('''No acceptable ld.gold linker found!''')
return 0

match = re.match(r"^GNU gold.*([0-9]+)\.([0-9]+)$",
Expand Down
7 changes: 7 additions & 0 deletions deps/v8/include/v8.h
Expand Up @@ -5020,6 +5020,13 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase {
*/
bool IsShared() const;

/**
* Prevent implicit instantiation of operator delete with size_t argument.
* The size_t argument would be incorrect because ptr points to the
* internal BackingStore object.
*/
void operator delete(void* ptr) { ::operator delete(ptr); }

/**
* Wrapper around ArrayBuffer::Allocator::Reallocate that preserves IsShared.
* Assumes that the backing_store was allocated by the ArrayBuffer allocator
Expand Down
1 change: 1 addition & 0 deletions deps/zlib/contrib/optimizations/chunkcopy.h
Expand Up @@ -29,6 +29,7 @@
#include <arm_neon.h>
typedef uint8x16_t z_vec128i_t;
#elif defined(INFLATE_CHUNK_SIMD_SSE2)
#pragma GCC target ("sse2")
#include <emmintrin.h>
typedef __m128i z_vec128i_t;
#else
Expand Down
1 change: 1 addition & 0 deletions deps/zlib/fill_window_sse.c
Expand Up @@ -9,6 +9,7 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/

#pragma GCC target ("sse2")
#include <immintrin.h>
#include "deflate.h"

Expand Down
21 changes: 21 additions & 0 deletions doc/api/crypto.md
Expand Up @@ -1458,6 +1458,11 @@ changes:
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/35093
description: The privateKey can also be an ArrayBuffer and CryptoKey.
- version:
- v13.2.0
- v12.16.0
pr-url: https://github.com/nodejs/node/pull/29292
description: This function now supports IEEE-P1363 DSA and ECDSA signatures.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/26960
description: This function now supports RSA-PSS keys.
Expand Down Expand Up @@ -1576,6 +1581,11 @@ changes:
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/35093
description: The object can also be an ArrayBuffer and CryptoKey.
- version:
- v13.2.0
- v12.16.0
pr-url: https://github.com/nodejs/node/pull/29292
description: This function now supports IEEE-P1363 DSA and ECDSA signatures.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/26960
description: This function now supports RSA-PSS keys.
Expand Down Expand Up @@ -3314,6 +3324,12 @@ Throws an error if FIPS mode is not available.
### `crypto.sign(algorithm, data, key)`
<!-- YAML
added: v12.0.0
changes:
- version:
- v13.2.0
- v12.16.0
pr-url: https://github.com/nodejs/node/pull/29292
description: This function now supports IEEE-P1363 DSA and ECDSA signatures.
-->

<!--lint disable maximum-line-length remark-lint-->
Expand Down Expand Up @@ -3380,6 +3396,11 @@ changes:
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/35093
description: The data, key, and signature arguments can also be ArrayBuffer.
- version:
- v13.2.0
- v12.16.0
pr-url: https://github.com/nodejs/node/pull/29292
description: This function now supports IEEE-P1363 DSA and ECDSA signatures.
-->

<!--lint disable maximum-line-length remark-lint-->
Expand Down
2 changes: 1 addition & 1 deletion doc/api/dns.md
Expand Up @@ -950,7 +950,7 @@ Here is an example of the result object:
minttl: 60 } ]
```

## `dnsPromises.resolveCaa(hostname)`
### `dnsPromises.resolveCaa(hostname)`
<!-- YAML
added: v15.0.0
-->
Expand Down
34 changes: 34 additions & 0 deletions doc/api/events.md
Expand Up @@ -829,6 +829,40 @@ class MyClass extends EventEmitter {
}
```

## `events.getEventListeners(emitterOrTarget, eventName)`
<!-- YAML
added:
- v15.2.0
-->
* `emitterOrTarget` {EventEmitter|EventTarget}
* `eventName` {string|symbol}
* Returns: {Function[]}

Returns a copy of the array of listeners for the event named `eventName`.

For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
the emitter.

For `EventTarget`s this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.

```js
const { getEventListeners, EventEmitter } = require('events');

{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
getEventListeners(ee, 'foo'); // [listener]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
ee.addEventListener('foo', listener);
getEventListeners(ee, 'foo'); // [listener]
}
```

## `events.once(emitter, name[, options])`
<!-- YAML
added:
Expand Down
107 changes: 106 additions & 1 deletion doc/api/fs.md
Expand Up @@ -826,6 +826,10 @@ added: v0.1.10

Returns `true` if the `fs.Stats` object describes a file system directory.

If the `fs.Stats` object was obtained from [`fs.lstat()`][], this method will
always return `false`. This is because [`fs.lstat()`][] returns information
about a symbolic link itself and not the path it resolves to.

### `stats.isFIFO()`
<!-- YAML
added: v0.1.10
Expand Down Expand Up @@ -3031,6 +3035,10 @@ If `options.withFileTypes` is set to `true`, the result will contain
<!-- YAML
added: v0.1.29
changes:
- version: v15.2.0
pr-url: https://github.com/nodejs/node/pull/35911
description: The options argument may include an AbortSignal to abort an
ongoing readFile request.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/12562
description: The `callback` parameter is no longer optional. Not passing
Expand All @@ -3056,6 +3064,7 @@ changes:
* `options` {Object|string}
* `encoding` {string|null} **Default:** `null`
* `flag` {string} See [support of file system `flags`][]. **Default:** `'r'`.
* `signal` {AbortSignal} allows aborting an in-progress readFile
* `callback` {Function}
* `err` {Error}
* `data` {string|Buffer}
Expand Down Expand Up @@ -3097,9 +3106,25 @@ fs.readFile('<directory>', (err, data) => {
});
```

It is possible to abort an ongoing request using an `AbortSignal`. If a
request is aborted the callback is called with an `AbortError`:

```js
const controller = new AbortController();
const signal = controller.signal;
fs.readFile(fileInfo[0].name, { signal }, (err, buf) => {
// ...
});
// When you want to abort the request
controller.abort();
```

The `fs.readFile()` function buffers the entire file. To minimize memory costs,
when possible prefer streaming via `fs.createReadStream()`.

Aborting an ongoing request does not abort individual operating
system requests but rather the internal buffering `fs.readFile` performs.

### File descriptors

1. Any specified file descriptor has to support reading.
Expand Down Expand Up @@ -4360,6 +4385,10 @@ details.
<!-- YAML
added: v0.1.29
changes:
- version: v15.2.0
pr-url: https://github.com/nodejs/node/pull/35993
description: The options argument may include an AbortSignal to abort an
ongoing writeFile request.
- version: v14.12.0
pr-url: https://github.com/nodejs/node/pull/34993
description: The `data` parameter will stringify an object with an
Expand Down Expand Up @@ -4394,6 +4423,7 @@ changes:
* `encoding` {string|null} **Default:** `'utf8'`
* `mode` {integer} **Default:** `0o666`
* `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`.
* `signal` {AbortSignal} allows aborting an in-progress writeFile
* `callback` {Function}
* `err` {Error}

Expand Down Expand Up @@ -4425,6 +4455,28 @@ It is unsafe to use `fs.writeFile()` multiple times on the same file without
waiting for the callback. For this scenario, [`fs.createWriteStream()`][] is
recommended.

Similarly to `fs.readFile` - `fs.writeFile` is a convenience method that
performs multiple `write` calls internally to write the buffer passed to it.
For performance sensitive code consider using [`fs.createWriteStream()`][].

It is possible to use an {AbortSignal} to cancel an `fs.writeFile()`.
Cancelation is "best effort", and some amount of data is likely still
to be written.

```js
const controller = new AbortController();
const { signal } = controller;
const data = new Uint8Array(Buffer.from('Hello Node.js'));
fs.writeFile('message.txt', data, { signal }, (err) => {
// When a request is aborted - the callback is called with an AbortError
});
// When the request should be aborted
controller.abort();
```

Aborting an ongoing request does not abort individual operating
system requests but rather the internal buffering `fs.writeFile` performs.

### Using `fs.writeFile()` with file descriptors

When `file` is a file descriptor, the behavior is almost identical to directly
Expand Down Expand Up @@ -4771,6 +4823,7 @@ added: v10.0.0

* `options` {Object|string}
* `encoding` {string|null} **Default:** `null`
* `signal` {AbortSignal} allows aborting an in-progress readFile
* Returns: {Promise}

Asynchronously reads the entire contents of a file.
Expand Down Expand Up @@ -5438,12 +5491,18 @@ print('./').catch(console.error);
### `fsPromises.readFile(path[, options])`
<!-- YAML
added: v10.0.0
changes:
- version: v15.2.0
pr-url: https://github.com/nodejs/node/pull/35911
description: The options argument may include an AbortSignal to abort an
ongoing readFile request.
-->

* `path` {string|Buffer|URL|FileHandle} filename or `FileHandle`
* `options` {Object|string}
* `encoding` {string|null} **Default:** `null`
* `flag` {string} See [support of file system `flags`][]. **Default:** `'r'`.
* `signal` {AbortSignal} allows aborting an in-progress readFile
* Returns: {Promise}

Asynchronously reads the entire contents of a file.
Expand All @@ -5459,6 +5518,20 @@ platform-specific. On macOS, Linux, and Windows, the promise will be rejected
with an error. On FreeBSD, a representation of the directory's contents will be
returned.

It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a
request is aborted the promise returned is rejected with an `AbortError`:

```js
const controller = new AbortController();
const signal = controller.signal;
readFile(fileName, { signal }).then((file) => { /* ... */ });
// Abort the request
controller.abort();
```

Aborting an ongoing request does not abort individual operating
system requests but rather the internal buffering `fs.readFile` performs.

Any specified `FileHandle` has to support reading.

### `fsPromises.readlink(path[, options])`
Expand Down Expand Up @@ -5671,6 +5744,10 @@ The `atime` and `mtime` arguments follow these rules:
<!-- YAML
added: v10.0.0
changes:
- version: v15.2.0
pr-url: https://github.com/nodejs/node/pull/35993
description: The options argument may include an AbortSignal to abort an
ongoing writeFile request.
- version: v14.12.0
pr-url: https://github.com/nodejs/node/pull/34993
description: The `data` parameter will stringify an object with an
Expand All @@ -5687,6 +5764,7 @@ changes:
* `encoding` {string|null} **Default:** `'utf8'`
* `mode` {integer} **Default:** `0o666`
* `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`.
* `signal` {AbortSignal} allows aborting an in-progress writeFile
* Returns: {Promise}

Asynchronously writes data to a file, replacing the file if it already exists.
Expand All @@ -5700,7 +5778,34 @@ If `options` is a string, then it specifies the encoding.
Any specified `FileHandle` has to support writing.

It is unsafe to use `fsPromises.writeFile()` multiple times on the same file
without waiting for the `Promise` to be resolved (or rejected).
without waiting for the `Promise` to be fulfilled (or rejected).

Similarly to `fsPromises.readFile` - `fsPromises.writeFile` is a convenience
method that performs multiple `write` calls internally to write the buffer
passed to it. For performance sensitive code consider using
[`fs.createWriteStream()`][].

It is possible to use an {AbortSignal} to cancel an `fsPromises.writeFile()`.
Cancelation is "best effort", and some amount of data is likely still
to be written.

```js
const controller = new AbortController();
const { signal } = controller;
const data = new Uint8Array(Buffer.from('Hello Node.js'));
(async () => {
try {
await fs.writeFile('message.txt', data, { signal });
} catch (err) {
// When a request is aborted - err is an AbortError
}
})();
// When the request should be aborted
controller.abort();
```

Aborting an ongoing request does not abort individual operating
system requests but rather the internal buffering `fs.writeFile` performs.

## FS constants

Expand Down