MyGit

v23.1.0

nodejs/node

版本发布时间: 2024-10-25 05:30:47

nodejs/node最新发布版本:v18.20.5(2024-11-13 05:41:28)

Notable Changes

Buffer now work with resizable ArrayBuffer

When a Buffer is created using a resizable ArrayBuffer, the Buffer length will now correctly change as the underlying ArrayBuffer size is changed.

const ab = new ArrayBuffer(10, { maxByteLength: 20 });
const buffer = Buffer.from(ab);
console.log(buffer.byteLength); 10
ab.resize(15);
console.log(buffer.byteLength); 15
ab.resize(5);
console.log(buffer.byteLength); 5

Contributed by James M Snell in #55377.

MockTimers test runner API is now stable

MockTimers, introduced in April 2023, has just reached stable status. This API provides comprehensive support for mocking Date and all major timers in Node.js, including setTimeout, setInterval, and setImmediate, both from the node:timers, node:timers/promises modules and global objects. After months of refinement, developers can now fully rely on MockTimers for testing time-based operations with confidence, ensuring better control over asynchronous behavior in their Node.js applications.

Example usage with initial Date object as time set:

import { mock } from 'node:test';
mock.timers.enable({ apis: ['Date'], now: new Date('1970-01-01') });

Contributed by Erick Wendel in #55398.

JSON modules and import attributes are now stable

The two proposals reached stage 4 of the TC39 process, at the October 2024 meeting. The Node.js implementation already matches exactly the semantics required by the proposals.

Contributed by Nicolò Ribaudo by #55333.

Other Notable Changes

Commits

相关地址:原始地址 下载(tar) 下载(zip)

查看:2024-10-25发行的版本