From 6c1d8f749b5cb0afe6d0804213328bac6e93b0b8 Mon Sep 17 00:00:00 2001 From: Kent Wu Date: Thu, 10 Sep 2026 13:14:31 -0400 Subject: [PATCH] chore: remove @openpgp/web-stream-tools dependency Replace external dependency with local concatStream implementation. The package changed to ESM-only between v0.0.13 and v0.3.1, breaking Jest's module resolution even with Jest 30. Since only 3 tests use this simple utility, implementing it locally (~15 lines) is more maintainable than dealing with ESM compatibility issues. - Remove @openpgp/web-stream-tools from package.json - Add concatStream() helper in streams-dom-tests.ts - Remove package from jest.config.js transformIgnorePatterns - All 696 tests pass --- jest.config.js | 1 - package-lock.json | 16 ------------ package.json | 1 - test/unit/ipc/reader/streams-dom-tests.ts | 30 ++++++++++++++++------- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/jest.config.js b/jest.config.js index 5a004ef8..68c69a6b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -57,6 +57,5 @@ export default { }, transformIgnorePatterns: [ "/targets/(es5|es2015|esnext|apache-arrow)/", - "/node_modules/(?!@openpgp/web-stream-tools)/", ], }; diff --git a/package-lock.json b/package-lock.json index e9a2ccc2..77d5e6a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,6 @@ "arrow2csv": "bin/arrow2csv.cjs" }, "devDependencies": { - "@openpgp/web-stream-tools": "0.0.13", "@rollup/plugin-alias": "6.0.0", "@rollup/plugin-node-resolve": "16.0.3", "@rollup/stream": "3.0.1", @@ -3488,21 +3487,6 @@ "node": ">= 8" } }, - "node_modules/@openpgp/web-stream-tools": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/@openpgp/web-stream-tools/-/web-stream-tools-0.0.13.tgz", - "integrity": "sha512-VQ0O0lUcD9ilLcMLQMJMgPhp8fDgMd4copd+UhSBGjud0vbI1ONQ3ffAhixEMml/AApLJtqCpd7PJcccPliFSA==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "typescript": ">=4.2" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/@oxc-resolver/binding-android-arm-eabi": { "version": "11.6.1", "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-android-arm-eabi/-/binding-android-arm-eabi-11.6.1.tgz", diff --git a/package.json b/package.json index 5509a4bb..7f038a29 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "tslib": "^2.6.2" }, "devDependencies": { - "@openpgp/web-stream-tools": "0.0.13", "@rollup/plugin-alias": "6.0.0", "@rollup/plugin-node-resolve": "16.0.3", "@rollup/stream": "3.0.1", diff --git a/test/unit/ipc/reader/streams-dom-tests.ts b/test/unit/ipc/reader/streams-dom-tests.ts index b3d9bcab..5d13b2a0 100644 --- a/test/unit/ipc/reader/streams-dom-tests.ts +++ b/test/unit/ipc/reader/streams-dom-tests.ts @@ -25,6 +25,27 @@ import { Table } from 'apache-arrow'; +// Concatenates multiple ReadableStreams into a single stream +function concatStream(streams: ReadableStream[]): ReadableStream { + return new ReadableStream({ + async start(controller) { + for (const stream of streams) { + const reader = stream.getReader(); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + controller.enqueue(value); + } + } finally { + reader.releaseLock(); + } + } + controller.close(); + } + }); +} + (() => { if (process.env.TEST_DOM_STREAMS !== 'true') { return test('not testing DOM streams because process.env.TEST_DOM_STREAMS !== "true"', () => { }); @@ -101,9 +122,6 @@ import { } it('readAll() should pipe to separate WhatWG WritableStreams', async () => { - // @ts-ignore - const { concatStream } = await import('@openpgp/web-stream-tools'); - expect.hasAssertions(); const tables = [...generateRandomTables([10, 20, 30])]; @@ -141,9 +159,6 @@ import { }); it('should not close the underlying WhatWG ReadableStream when reading multiple tables to completion', async () => { - // @ts-ignore - const { concatStream } = await import('@openpgp/web-stream-tools'); - expect.hasAssertions(); const tables = [...generateRandomTables([10, 20, 30])]; @@ -174,9 +189,6 @@ import { }); it('should close the underlying WhatWG ReadableStream when reading multiple tables and we break early', async () => { - // @ts-ignore - const { concatStream } = await import('@openpgp/web-stream-tools'); - expect.hasAssertions(); const tables = [...generateRandomTables([10, 20, 30])];