Skip to content

Commit 34b18fb

Browse files
authored
fix!: remove AbortOptions exports (#156)
Re-use the `AbortOptions` export from the `abort-error` module. BREAKING CHANGE: the `AbortOptions` interface is no longer exported, use the one from `abort-error` instead
1 parent ee968c1 commit 34b18fb

12 files changed

Lines changed: 13 additions & 49 deletions

File tree

packages/it-byte-stream/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
"release": "aegir release"
137137
},
138138
"dependencies": {
139+
"abort-error": "^1.0.1",
139140
"it-queueless-pushable": "^1.0.0",
140141
"it-stream-types": "^2.0.2",
141142
"uint8arraylist": "^2.4.8"

packages/it-byte-stream/src/index.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,13 @@
2121
* ```
2222
*/
2323

24+
import { AbortError } from 'abort-error'
2425
import { queuelessPushable } from 'it-queueless-pushable'
2526
import { Uint8ArrayList } from 'uint8arraylist'
2627
import { UnexpectedEOFError } from './errors.js'
28+
import type { AbortOptions } from 'abort-error'
2729
import type { Duplex } from 'it-stream-types'
2830

29-
/**
30-
* @deprecated This will not be exported in a future release
31-
*/
32-
export class CodeError extends Error {
33-
public readonly code: string
34-
35-
constructor (message: string, code: string) {
36-
super(message)
37-
this.code = code
38-
}
39-
}
40-
41-
/**
42-
* @deprecated This will not be exported in a future release
43-
*/
44-
export class AbortError extends CodeError {
45-
public readonly type: string
46-
47-
constructor (message: string) {
48-
super(message, 'ABORT_ERR')
49-
this.type = 'aborted'
50-
this.name = 'AbortError'
51-
}
52-
}
53-
54-
export interface AbortOptions {
55-
signal?: AbortSignal
56-
}
57-
5831
export interface ByteStream <Stream = unknown> {
5932
/**
6033
* Read a set number of bytes from the stream

packages/it-cbor-stream/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
"release": "aegir release"
138138
},
139139
"dependencies": {
140+
"abort-error": "^1.0.1",
140141
"cborg": "^4.2.8",
141142
"it-length-prefixed-stream": "^1.0.0",
142143
"it-stream-types": "^2.0.2"

packages/it-cbor-stream/src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@
2424

2525
import { encode, decode } from 'cborg'
2626
import { lpStream } from 'it-length-prefixed-stream'
27+
import type { AbortOptions } from 'abort-error'
2728
import type { EncodeOptions, DecodeOptions } from 'cborg/interface'
2829
import type { LengthPrefixedStreamOpts } from 'it-length-prefixed-stream'
2930
import type { Duplex } from 'it-stream-types'
3031

31-
export interface AbortOptions {
32-
signal?: AbortSignal
33-
}
34-
3532
/**
3633
* Convenience methods for working with CBOR streams
3734
*/

packages/it-length-prefixed-stream/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
"release": "aegir release"
137137
},
138138
"dependencies": {
139+
"abort-error": "^1.0.1",
139140
"it-byte-stream": "^1.0.0",
140141
"it-stream-types": "^2.0.2",
141142
"uint8-varint": "^2.0.4",

packages/it-length-prefixed-stream/src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@ import { byteStream, type ByteStreamOpts } from 'it-byte-stream'
2727
import * as varint from 'uint8-varint'
2828
import { Uint8ArrayList } from 'uint8arraylist'
2929
import { InvalidDataLengthError, InvalidDataLengthLengthError, InvalidMessageLengthError } from './errors.js'
30+
import type { AbortOptions } from 'abort-error'
3031
import type { Duplex } from 'it-stream-types'
3132

32-
export interface AbortOptions {
33-
signal?: AbortSignal
34-
}
35-
3633
export interface LengthPrefixedStream <Stream = unknown> {
3734
/**
3835
* Read the next length-prefixed number of bytes from the stream

packages/it-ndjson-stream/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
"release": "aegir release"
137137
},
138138
"dependencies": {
139+
"abort-error": "^1.0.1",
139140
"it-ndjson": "^1.0.0",
140141
"it-queueless-pushable": "^1.0.0",
141142
"it-stream-types": "^2.0.2",

packages/it-ndjson-stream/src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@ import { parse } from 'it-ndjson'
2727
import { queuelessPushable } from 'it-queueless-pushable'
2828
import { raceSignal } from 'race-signal'
2929
import { UnexpectedEOFError } from './errors.js'
30+
import type { AbortOptions } from 'abort-error'
3031
import type { ParseOptions } from 'it-ndjson'
3132
import type { Duplex } from 'it-stream-types'
3233

33-
export interface AbortOptions {
34-
signal?: AbortSignal
35-
}
36-
3734
export interface NDJSONStream <T = any, Stream = unknown> {
3835
/**
3936
* Read the next message from the stream

packages/it-protobuf-stream/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"release": "aegir release"
139139
},
140140
"dependencies": {
141+
"abort-error": "^1.0.1",
141142
"it-length-prefixed-stream": "^1.0.0",
142143
"it-stream-types": "^2.0.2",
143144
"uint8arraylist": "^2.4.8"

packages/it-protobuf-stream/src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@
2626
*/
2727

2828
import { lpStream } from 'it-length-prefixed-stream'
29+
import type { AbortOptions } from 'abort-error'
2930
import type { LengthPrefixedStreamOpts } from 'it-length-prefixed-stream'
3031
import type { Duplex } from 'it-stream-types'
3132
import type { Uint8ArrayList } from 'uint8arraylist'
3233

33-
export interface AbortOptions {
34-
signal?: AbortSignal
35-
}
36-
3734
/**
3835
* A protobuf decoder - takes a byte array and returns an object
3936
*/

0 commit comments

Comments
 (0)