Skip to content

Commit

Permalink
Upgrade dependencies (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored Oct 28, 2024
1 parent 46e0ec3 commit cdbd77b
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
node-version:
- 22
- 23
- 18
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"concat"
],
"dependencies": {
"@sec-ant/readable-stream": "^0.5.0",
"@sec-ant/readable-stream": "^0.6.0",
"is-stream": "^4.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion source/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class MaxBufferError extends Error {

// eslint-disable-next-line @typescript-eslint/ban-types
type TextStreamItem = string | Buffer | ArrayBuffer | ArrayBufferView;
// eslint-disable-next-line n/no-unsupported-features/node-builtins

export type AnyStream<SteamItem = TextStreamItem> = Readable | ReadableStream<SteamItem> | AsyncIterable<SteamItem>;

export type Options = {
Expand Down
1 change: 0 additions & 1 deletion source/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ expectError(await getStreamAsArrayBuffer(nodeStream, {maxBuffer: 10}, {}));
expectType<any[]>(await getStreamAsArray(nodeStream));
expectType<any[]>(await getStreamAsArray(nodeStream, {maxBuffer: 10}));
expectType<any[]>(await getStreamAsArray(readableStream));
// eslint-disable-next-line n/no-unsupported-features/node-builtins
expectType<Uint8Array[]>(await getStreamAsArray(readableStream as ReadableStream<Uint8Array>));
expectType<string[]>(await getStreamAsArray(stringAsyncIterable));
// eslint-disable-next-line @typescript-eslint/ban-types
Expand Down
1 change: 0 additions & 1 deletion test/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {finished} from 'node:stream/promises';
export {fromAnyIterable as readableStreamFrom} from '@sec-ant/readable-stream/ponyfill';

export const createStream = streamDefinition => typeof streamDefinition === 'function'
// eslint-disable-next-line n/no-unsupported-features/node-builtins
? Duplex.from(streamDefinition)
: Readable.from(streamDefinition);

Expand Down
3 changes: 0 additions & 3 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {fixtureString, fixtureBuffer, fixtureUtf16} from './fixtures/index.js';

const TEST_URL = 'https://nodejs.org/dist/index.json';

// eslint-disable-next-line n/no-unsupported-features/node-builtins
const createReadableStream = streamDefinition => Duplex.toWeb(Duplex.from(streamDefinition)).readable;

test('works with opendir()', async t => {
Expand Down Expand Up @@ -64,15 +63,13 @@ if (!nodeVersion.startsWith('v16.')) {
test('works with readableWebStream({ type: "bytes" })', readableWebStream, 'bytes');

test('works with fetch()', async t => {
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const {body} = await fetch(TEST_URL);
const result = await getStream(body);
const parsedResult = JSON.parse(result);
t.true(Array.isArray(parsedResult));
});

test('can use TextDecoderStream', async t => {
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const textDecoderStream = new TextDecoderStream('utf-16le');
const result = await getStream(
createReadableStream(fixtureUtf16).pipeThrough(textDecoderStream),
Expand Down
1 change: 0 additions & 1 deletion test/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ const testMultipleReads = async (t, wait) => {
assertSuccess(t, stream, Readable);
};

// eslint-disable-next-line n/no-unsupported-features/node-builtins
test('Handles multiple successive fast reads', testMultipleReads, () => scheduler.yield());
test('Handles multiple successive slow reads', testMultipleReads, () => pSetTimeout(100));

Expand Down
4 changes: 0 additions & 4 deletions test/web-stream-ponyfill.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import test from 'ava';

// Emulate browsers that do not support those methods
// eslint-disable-next-line n/no-unsupported-features/node-builtins
delete ReadableStream.prototype.values;
// eslint-disable-next-line n/no-unsupported-features/node-builtins
delete ReadableStream.prototype[Symbol.asyncIterator];

// Run those tests, but emulating browsers
await import('./web-stream.js');

test('Should not polyfill ReadableStream', t => {
// eslint-disable-next-line n/no-unsupported-features/node-builtins
t.is(ReadableStream.prototype.values, undefined);
// eslint-disable-next-line n/no-unsupported-features/node-builtins
t.is(ReadableStream.prototype[Symbol.asyncIterator], undefined);
});
3 changes: 0 additions & 3 deletions test/web-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ test('Can use already ended ReadableStream', async t => {

test('Can use already canceled ReadableStream', async t => {
let canceledValue;
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const stream = new ReadableStream({
cancel(canceledError) {
canceledValue = canceledError;
Expand All @@ -33,7 +32,6 @@ test('Can use already canceled ReadableStream', async t => {

test('Can use already errored ReadableStream', async t => {
const error = new Error('test');
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const stream = new ReadableStream({
start(controller) {
controller.error(error);
Expand All @@ -45,7 +43,6 @@ test('Can use already errored ReadableStream', async t => {

test('Cancel ReadableStream when maxBuffer is hit', async t => {
let canceled = false;
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const stream = new ReadableStream({
start(controller) {
controller.enqueue(fixtureString);
Expand Down

0 comments on commit cdbd77b

Please sign in to comment.