Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
danielleadams committed Jan 3, 2023

Verified

This commit was signed with the committer’s verified signature.
AgeManning Age Manning
1 parent 2098d7a commit 9902286
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
@@ -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/>
2 changes: 1 addition & 1 deletion doc/api/async_context.md
Original file line number Diff line number Diff line change
@@ -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.
-->
8 changes: 4 additions & 4 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
@@ -5025,7 +5025,7 @@ See [`Buffer.from(string[, encoding])`][`Buffer.from(string)`].
## Class: `File`

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

> Stability: 1 - Experimental
@@ -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\[]}
@@ -5055,7 +5055,7 @@ added: REPLACEME
### `file.name`

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

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

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

* Type: {number}
6 changes: 3 additions & 3 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
@@ -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.
@@ -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.
-->
@@ -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.
-->
8 changes: 4 additions & 4 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
@@ -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:
@@ -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.
-->
@@ -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.
-->
@@ -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.
-->
2 changes: 1 addition & 1 deletion doc/api/diagnostics_channel.md
Original file line number Diff line number Diff line change
@@ -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.
-->
2 changes: 1 addition & 1 deletion doc/api/n-api.md
Original file line number Diff line number Diff line change
@@ -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
-->

2 changes: 1 addition & 1 deletion doc/api/net.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
@@ -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
32 changes: 16 additions & 16 deletions doc/api/test.md
Original file line number Diff line number Diff line change
@@ -294,7 +294,7 @@ test('a test that creates asynchronous activity', (t) => {
## Watch mode

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

> Stability: 1 - Experimental
@@ -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
@@ -744,7 +744,7 @@ mocks created via the [`MockTracker`][] APIs.
### `ctx.calls`

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

* {Array}
@@ -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.
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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.
@@ -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`
@@ -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.
@@ -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
@@ -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
@@ -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`
@@ -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
2 changes: 1 addition & 1 deletion doc/api/tls.md
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 1 addition & 1 deletion doc/api/url.md
Original file line number Diff line number Diff line change
@@ -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:
4 changes: 2 additions & 2 deletions doc/api/util.md
Original file line number Diff line number Diff line change
@@ -1023,7 +1023,7 @@ equality.
## Class: `util.MIMEType`

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

> Stability: 1 - Experimental
@@ -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
2 changes: 1 addition & 1 deletion doc/api/vm.md
Original file line number Diff line number Diff line change
@@ -347,7 +347,7 @@ console.log(globalVar);
### `script.sourceMapURL`

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

* {string|undefined}
468 changes: 468 additions & 0 deletions doc/changelogs/CHANGELOG_V18.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/node_version.h
Original file line number Diff line number Diff line change
@@ -23,13 +23,13 @@
#define SRC_NODE_VERSION_H_

#define NODE_MAJOR_VERSION 18
#define NODE_MINOR_VERSION 12
#define NODE_PATCH_VERSION 2
#define NODE_MINOR_VERSION 13
#define NODE_PATCH_VERSION 0

#define NODE_VERSION_IS_LTS 1
#define NODE_VERSION_LTS_CODENAME "Hydrogen"

#define NODE_VERSION_IS_RELEASE 0
#define NODE_VERSION_IS_RELEASE 1

#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)

0 comments on commit 9902286

Please sign in to comment.