Skip to content

Commit

Permalink
2023-01-03, Version 18.13.0 'Hydrogen' (LTS)
Browse files Browse the repository at this point in the history
Notable changes:

Add support for externally shared js builtins:

By default Node.js is built so that all dependencies are bundled into the
Node.js binary itself. Some Node.js distributions prefer to manage dependencies
externally. There are existing build options that allow dependencies with
native code to be externalized. This commit adds additional options so that
dependencies with JavaScript code (including WASM) can also be externalized.
This addition does not affect binaries shipped by the Node.js project but
will allow other distributions to externalize additional dependencies when
needed.

Contributed by Michael Dawson in #44376

Introduce `File`:

The File class is part of the [FileAPI](https://w3c.github.io/FileAPI/).
It can be used anywhere a Blob can, for example in `URL.createObjectURL`
and `FormData`. It contains two properties that Blobs do not have: `lastModified`,
the last time the file was modified in ms, and `name`, the name of the file.

Contributed by Khafra in #45139

Support function mocking on Node.js test runner:

The `node:test` module supports mocking during testing via a top-level `mock`
object.

```js
test('spies on an object method', (t) => {
  const number = {
    value: 5,
    add(a) {
      return this.value + a;
    },
  };
  t.mock.method(number, 'add');

  assert.strictEqual(number.add(3), 8);
  assert.strictEqual(number.add.mock.calls.length, 1);
});
```

Contributed by Colin Ihrig in #45326

Other notable changes:

build:
  * disable v8 snapshot compression by default (Joyee Cheung) #45716
crypto:
  * update root certificates (Luigi Pinca) #45490
deps:
  * update ICU to 72.1 (Michaël Zasso) #45068
doc:
  * add doc-only deprecation for headers/trailers setters (Rich Trott) #45697
  * add Rafael to the tsc (Michael Dawson) #45691
  * deprecate use of invalid ports in `url.parse` (Antoine du Hamel) #45576
  * add lukekarrys to collaborators (Luke Karrys) #45180
  * add anonrig to collaborators (Yagiz Nizipli) #45002
  * deprecate url.parse() (Rich Trott) #44919
lib:
  * drop fetch experimental warning (Matteo Collina) #45287
net:
  * (SEMVER-MINOR) add autoSelectFamily and autoSelectFamilyAttemptTimeout options (Paolo Insogna) #44731
* src:
  * (SEMVER-MINOR) add uvwasi version (Jithil P Ponnan) #45639
  * (SEMVER-MINOR) add initial shadow realm support (Chengzhong Wu) #42869
test_runner:
  * (SEMVER-MINOR) add t.after() hook (Colin Ihrig) #45792
  * (SEMVER-MINOR) don't use a symbol for runHook() (Colin Ihrig) #45792
tls:
  * (SEMVER-MINOR) add "ca" property to certificate object (Ben Noordhuis) #44935
  * remove trustcor root ca certificates (Ben Noordhuis) #45776
tools:
  * update certdata.txt (Luigi Pinca) #45490
util:
  * add fast path for utf8 encoding (Yagiz Nizipli) #45412
  * improve textdecoder decode performance (Yagiz Nizipli) #45294
  * (SEMVER-MINOR) add MIME utilities (#21128) (Bradley Farias) #21128

PR-URL: #46025
  • Loading branch information
danielleadams committed Jan 4, 2023
1 parent bac6b7d commit 496f5e7
Show file tree
Hide file tree
Showing 16 changed files with 510 additions and 41 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V18.md#18.12.1">18.12.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V18.md#18.13.0">18.13.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V18.md#18.12.1">18.12.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V18.md#18.12.0">18.12.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V18.md#18.11.0">18.11.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V18.md#18.10.0">18.10.0</a><br/>
Expand Down
2 changes: 1 addition & 1 deletion doc/api/async_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ added:
- v13.10.0
- v12.17.0
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/45386
description: Add option onPropagate.
-->
Expand Down
8 changes: 4 additions & 4 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5025,7 +5025,7 @@ See [`Buffer.from(string[, encoding])`][`Buffer.from(string)`].
## Class: `File`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

> Stability: 1 - Experimental
Expand All @@ -5037,7 +5037,7 @@ A [`File`][] provides information about files.
### `new buffer.File(sources, fileName[, options])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* `sources` {string\[]|ArrayBuffer\[]|TypedArray\[]|DataView\[]|Blob\[]|File\[]}
Expand All @@ -5055,7 +5055,7 @@ added: REPLACEME
### `file.name`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* Type: {string}
Expand All @@ -5065,7 +5065,7 @@ The name of the `File`.
### `file.lastModified`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* Type: {number}
Expand Down
6 changes: 3 additions & 3 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Use this flag to disable top-level await in REPL.
### `--experimental-shadow-realm`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

Use this flag to enable [ShadowRealm][] support.
Expand Down Expand Up @@ -1199,7 +1199,7 @@ status code 1.
<!-- YAML
added: v18.1.0
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/45214
description: Test runner now supports running in watch mode.
-->
Expand Down Expand Up @@ -1567,7 +1567,7 @@ amount of CPUs, but it may diverge in environments such as VMs or containers.
<!-- YAML
added: v18.11.0
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/45214
description: Test runner now supports running in watch mode.
-->
Expand Down
8 changes: 4 additions & 4 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ future release.

<!-- YAML
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/44919
description: \`url.parse()` is deprecated again in DEP0169.
- version:
Expand Down Expand Up @@ -3272,7 +3272,7 @@ Node-API callbacks.
<!-- YAML
changes:
- version:
- REPLACEME
- v18.13.0
pr-url: https://github.com/nodejs/node/pull/44919
description: Documentation-only deprecation.
-->
Expand All @@ -3288,7 +3288,7 @@ issued for `url.parse()` vulnerabilities.
<!-- YAML
changes:
- version:
- REPLACEME
- v18.13.0
pr-url: https://github.com/nodejs/node/pull/45576
description: Documentation-only deprecation.
-->
Expand All @@ -3304,7 +3304,7 @@ an error in future versions of Node.js, as the [WHATWG URL API][] does already.
<!-- YAML
changes:
- version:
- REPLACEME
- v18.13.0
pr-url: https://github.com/nodejs/node/pull/45697
description: Documentation-only deprecation.
-->
Expand Down
2 changes: 1 addition & 1 deletion doc/api/diagnostics_channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- YAML
added: v15.1.0
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/45290
description: diagnostics_channel is now Stable.
-->
Expand Down
2 changes: 1 addition & 1 deletion doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ handle and/or callback scope inside the function body is not necessary.
#### `napi_cleanup_hook`

<!-- YAML
added: REPLACEME
added: v18.13.0
napiVersion: 3
-->

Expand Down
2 changes: 1 addition & 1 deletion doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ behavior.
<!-- YAML
added: v0.1.90
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/44731
description: Added the `autoSelectFamily` option.
- version: v17.7.0
Expand Down
2 changes: 1 addition & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ has less then 64 KiB of data because no `highWaterMark` option is provided to
##### `readable.compose(stream[, options])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

> Stability: 1 - Experimental
Expand Down
32 changes: 16 additions & 16 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ test('a test that creates asynchronous activity', (t) => {
## Watch mode

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

> Stability: 1 - Experimental
Expand Down Expand Up @@ -735,7 +735,7 @@ describe('tests', async () => {
## Class: `MockFunctionContext`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

The `MockFunctionContext` class is used to inspect or manipulate the behavior of
Expand All @@ -744,7 +744,7 @@ mocks created via the [`MockTracker`][] APIs.
### `ctx.calls`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* {Array}
Expand All @@ -766,7 +766,7 @@ mock. Each entry in the array is an object with the following properties.
### `ctx.callCount()`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* Returns: {integer} The number of times that this mock has been invoked.
Expand All @@ -778,7 +778,7 @@ is a getter that creates a copy of the internal call tracking array.
### `ctx.mockImplementation(implementation)`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* `implementation` {Function|AsyncFunction} The function to be used as the
Expand Down Expand Up @@ -815,7 +815,7 @@ test('changes a mock behavior', (t) => {
### `ctx.mockImplementationOnce(implementation[, onCall])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* `implementation` {Function|AsyncFunction} The function to be used as the
Expand Down Expand Up @@ -859,15 +859,15 @@ test('changes a mock behavior once', (t) => {
### `ctx.resetCalls()`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

Resets the call history of the mock function.

### `ctx.restore()`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

Resets the implementation of the mock function to its original behavior. The
Expand All @@ -876,7 +876,7 @@ mock can still be used after calling this function.
## Class: `MockTracker`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

The `MockTracker` class is used to manage mocking functionality. The test runner
Expand All @@ -887,7 +887,7 @@ Each test also provides its own `MockTracker` instance via the test context's
### `mock.fn([original[, implementation]][, options])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* `original` {Function|AsyncFunction} An optional function to create a mock on.
Expand Down Expand Up @@ -938,7 +938,7 @@ test('mocks a counting function', (t) => {
### `mock.getter(object, methodName[, implementation][, options])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

This function is syntax sugar for [`MockTracker.method`][] with `options.getter`
Expand All @@ -947,7 +947,7 @@ set to `true`.
### `mock.method(object, methodName[, implementation][, options])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* `object` {Object} The object whose method is being mocked.
Expand Down Expand Up @@ -1001,7 +1001,7 @@ test('spies on an object method', (t) => {
### `mock.reset()`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

This function restores the default behavior of all mocks that were previously
Expand All @@ -1017,7 +1017,7 @@ function manually is recommended.
### `mock.restoreAll()`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

This function restores the default behavior of all mocks that were previously
Expand All @@ -1027,7 +1027,7 @@ not disassociate the mocks from the `MockTracker` instance.
### `mock.setter(object, methodName[, implementation][, options])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

This function is syntax sugar for [`MockTracker.method`][] with `options.setter`
Expand Down Expand Up @@ -1118,7 +1118,7 @@ test('top level test', async (t) => {
### `context.after([fn][, options])`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* `fn` {Function|AsyncFunction} The hook function. The first argument
Expand Down
2 changes: 1 addition & 1 deletion doc/api/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ certificate.

<!-- YAML
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/44935
description: Add "ca" property.
- version:
Expand Down
2 changes: 1 addition & 1 deletion doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ The formatting process operates as follows:
<!-- YAML
added: v0.1.25
changes:
- version: REPLACEME
- version: v18.13.0
pr-url: https://github.com/nodejs/node/pull/44919
description: Documentation-only deprecation.
- version:
Expand Down
4 changes: 2 additions & 2 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ equality.
## Class: `util.MIMEType`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

> Stability: 1 - Experimental
Expand Down Expand Up @@ -1222,7 +1222,7 @@ console.log(JSON.stringify(myMIMES));
### Class: `util.MIMEParams`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

The `MIMEParams` API provides read and write access to the parameters of a
Expand Down
2 changes: 1 addition & 1 deletion doc/api/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ console.log(globalVar);
### `script.sourceMapURL`

<!-- YAML
added: REPLACEME
added: v18.13.0
-->

* {string|undefined}
Expand Down
Loading

0 comments on commit 496f5e7

Please sign in to comment.