Skip to content

Commit 599622b

Browse files
committed
refactor: require Node.js 16.9.0 or above
BREAKING CHANGES: require Node.js 16.9.0 or above This allows us to remove code for `BareError#cause` which is now natively supported by `Error`.
1 parent 387ded0 commit 599622b

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ New entries must be placed in a section entitled `Unreleased`.
1515
Previously, `writeUintSafe` and `writeIntSafe` might output a non-canonical encoding for numbers that were too large.
1616
It now robustly handles invalid input numbers that are too large.
1717

18+
- BREAKING CHANGES: require Node.js 16.9.0 or above.
19+
20+
This allows us to remove code for `BareError#cause` which is now natively supported by `Error`.
21+
1822
## 0.6.1 (2026-01-05)
1923

2024
- Fix `writeUintSafe32` that wrongly encoded numbers larger than 16383 (`2e14 - 1`)

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"url": "https://github.com/bare-ts/lib/issues"
2222
},
2323
"engines": {
24-
"node": "^14.18.0 || >=16.0.0"
24+
"node": "^>=16.9.0"
2525
},
2626
"type": "module",
2727
"exports": {

‎src/core/bare-error.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
export class BareError extends Error {
88
override name = "BareError"
99

10-
readonly cause: unknown
11-
1210
readonly issue: string
1311

12+
/**
13+
* Byte offset in the read buffer where the error occurred.
14+
*/
1415
readonly offset: number
1516

16-
constructor(offset: number, issue: string, opts?: { cause: unknown }) {
17-
super(`(byte:${offset}) ${issue}`)
17+
constructor(offset: number, issue: string, options?: ErrorOptions) {
18+
super(`(byte:${offset}) ${issue}`, options)
1819
this.issue = issue
1920
this.offset = offset
20-
this.cause = opts?.cause
2121
}
2222
}

‎tsconfig-base.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"$schema": "https://json.schemastore.org/tsconfig",
33
"compilerOptions": {
44
"lib": [
5-
"ES2020"
5+
"ES2022"
66
],
77
"module": "Node16",
8-
"target": "ES2020",
8+
"target": "ES2022",
99
"types": [],
1010

1111
"noEmit": true,

0 commit comments

Comments
 (0)