diff --git a/CHANGELOG.md b/CHANGELOG.md index 39bd3d4..a39017e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # chernge lerg +## 5.0 + +- No default export, only a named export + ## 4.2 - add AbortSignal support diff --git a/README.md b/README.md index 3cb71e3..6108809 100644 --- a/README.md +++ b/README.md @@ -92,9 +92,9 @@ Example: ```js // hybrid module, either works -import Minipass from 'minipass' +import { Minipass } from 'minipass' // or: -const Minipass = require('minipass') +const { Minipass } = require('minipass') const stream = new Minipass() stream.on('data', () => console.log('data event')) @@ -116,9 +116,9 @@ options, or by setting `stream.async = true` later on. ```js // hybrid module, either works -import Minipass from 'minipass' +import { Minipass } from 'minipass' // or: -const Minipass = require('minipass') +const { Minipass } = require('minipass') const asyncStream = new Minipass({ async: true }) asyncStream.on('data', () => console.log('data event')) @@ -135,7 +135,7 @@ Switching _out_ of async mode is unsafe, as it could cause data corruption, and so is not enabled. Example: ```js -import Minipass from 'minipass' +import { Minipass } from 'minipass' const stream = new Minipass({ encoding: 'utf8' }) stream.on('data', chunk => console.log(chunk)) stream.async = true @@ -156,7 +156,7 @@ To avoid this problem, once set into async mode, any attempt to make the stream sync again will be ignored. ```js -const Minipass = require('minipass') +const { Minipass } = require('minipass') const stream = new Minipass({ encoding: 'utf8' }) stream.on('data', chunk => console.log(chunk)) stream.async = true @@ -384,7 +384,7 @@ It's a stream! Use it like a stream and it'll most likely do what you want. ```js -import Minipass from 'minipass' +import { Minipass } from 'minipass' const mp = new Minipass(options) // optional: { encoding, objectMode } mp.write('foo') mp.pipe(someOtherStream) diff --git a/index.d.mts b/index.d.mts deleted file mode 100644 index 1be212f..0000000 --- a/index.d.mts +++ /dev/null @@ -1,18 +0,0 @@ -import Minipass from "./index.js"; - -export { - Encoding, - Writable, - Readable, - DualIterable, - ContiguousData, - BufferOrString, - SharedOptions, - StringOptions, - BufferOptions, - ObjectModeOptions, - PipeOptions, - Options -} from "./index.js"; - -export default Minipass; diff --git a/index.d.ts b/index.d.ts index 4c8907a..86851f9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -6,58 +6,62 @@ import { EventEmitter } from 'events' import { Stream } from 'stream' -declare namespace Minipass { - type Encoding = BufferEncoding | 'buffer' | null +export namespace Minipass { + export type Encoding = BufferEncoding | 'buffer' | null - interface Writable extends EventEmitter { + export interface Writable extends EventEmitter { end(): any write(chunk: any, ...args: any[]): any } - interface Readable extends EventEmitter { + export interface Readable extends EventEmitter { pause(): any resume(): any pipe(): any } - type DualIterable = Iterable & AsyncIterable + export type DualIterable = Iterable & AsyncIterable - type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string + export type ContiguousData = + | Buffer + | ArrayBufferLike + | ArrayBufferView + | string - type BufferOrString = Buffer | string + export type BufferOrString = Buffer | string - interface SharedOptions { + export interface SharedOptions { async?: boolean signal?: AbortSignal } - interface StringOptions extends SharedOptions { + export interface StringOptions extends SharedOptions { encoding: BufferEncoding objectMode?: boolean } - interface BufferOptions extends SharedOptions { + export interface BufferOptions extends SharedOptions { encoding?: null | 'buffer' objectMode?: boolean } - interface ObjectModeOptions extends SharedOptions { + export interface ObjectModeOptions extends SharedOptions { objectMode: true } - interface PipeOptions { + export interface PipeOptions { end?: boolean proxyErrors?: boolean } - type Options = T extends string + export type Options = T extends string ? StringOptions : T extends Buffer ? BufferOptions : ObjectModeOptions } -declare class Minipass< +export class Minipass< RType extends any = Buffer, WType extends any = RType extends Minipass.BufferOrString ? Minipass.ContiguousData @@ -146,6 +150,3 @@ declare class Minipass< [Symbol.iterator](): Generator [Symbol.asyncIterator](): AsyncGenerator } - -export default Minipass; -export = Minipass; diff --git a/index.js b/index.js index 150b64a..ed07c17 100644 --- a/index.js +++ b/index.js @@ -699,5 +699,4 @@ class Minipass extends Stream { } } -Minipass.default = Minipass -module.exports = Minipass +exports.Minipass = Minipass diff --git a/package.json b/package.json index 9b48056..f891a14 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "exports": { ".": { "import": { - "types": "./index.d.mts", + "types": "./index.d.ts", "default": "./index.mjs" }, "require": { @@ -52,7 +52,6 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "license": "ISC", "files": [ - "index.d.mts", "index.d.ts", "index.js", "index.mjs" diff --git a/scripts/transpile-to-esm.js b/scripts/transpile-to-esm.js index 4badbc6..5a73597 100644 --- a/scripts/transpile-to-esm.js +++ b/scripts/transpile-to-esm.js @@ -4,7 +4,8 @@ const { readFileSync, writeFileSync } = require('fs') const { resolve } = require('path') const cjs = readFileSync(resolve(__dirname, '../index.js'), 'utf8') const esm = cjs - .replace(/module.exports\s*=\s*/, 'export default ') + .replace(/exports\.Minipass\s*=[^\n]*/, '') + .replace(/class Minipass /, 'export class Minipass ') .replace( /const ([a-zA-Z0-9]+)\s*=\s*require\('([^']+)'\)/g, `import $1 from '$2'` diff --git a/test/abort.js b/test/abort.js index 36d01ff..1bb9631 100644 --- a/test/abort.js +++ b/test/abort.js @@ -1,4 +1,4 @@ -const MM = require('../') +const { Minipass: MM } = require('../') const t = require('tap') if (typeof AbortSignal === 'undefined') { Object.assign(global, require('node-abort-controller')) diff --git a/test/array-buffers.js b/test/array-buffers.js index bcbc81a..f9afd56 100644 --- a/test/array-buffers.js +++ b/test/array-buffers.js @@ -10,7 +10,7 @@ const stringToArrayBuffer = s => { return ab } -const MP = require('../') +const { Minipass: MP } = require('../') const e = { encoding: 'utf8' } t.test('write array buffer', t => { diff --git a/test/async-duplicate-end.js b/test/async-duplicate-end.js index e636323..af06c2c 100644 --- a/test/async-duplicate-end.js +++ b/test/async-duplicate-end.js @@ -1,4 +1,4 @@ -const Minipass = require('../') +const { Minipass } = require('../') const t = require('tap') t.test('async pipes should only end one time', t => { diff --git a/test/async-stream.js b/test/async-stream.js index b20c7c1..25bdae4 100644 --- a/test/async-stream.js +++ b/test/async-stream.js @@ -1,5 +1,5 @@ const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') t.test('pipe', t => { const m = new MP({ encoding: 'utf8', async: true }) diff --git a/test/auto-end-deferred-when-paused.js b/test/auto-end-deferred-when-paused.js index d2543c3..51e2eb7 100644 --- a/test/auto-end-deferred-when-paused.js +++ b/test/auto-end-deferred-when-paused.js @@ -1,5 +1,5 @@ const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') t.test('do not auto-end empty stream if explicitly paused', t => { const mp = new MP() let waitedForEnd = false diff --git a/test/basic.js b/test/basic.js index c80fcfc..be53364 100644 --- a/test/basic.js +++ b/test/basic.js @@ -1,9 +1,9 @@ -const MiniPass = require('../') +const { Minipass } = require('../') const t = require('tap') const EE = require('events').EventEmitter t.test('some basic piping and writing', async t => { - let mp = new MiniPass({ encoding: 'base64', debugExposeBuffer: true }) + let mp = new Minipass({ encoding: 'base64', debugExposeBuffer: true }) t.notOk(mp.flowing) mp.flowing = true t.notOk(mp.flowing) @@ -13,7 +13,7 @@ t.test('some basic piping and writing', async t => { t.equal(mp.readable, true) t.equal(mp.writable, true) t.equal(mp.write('hello'), false) - let dest = new MiniPass({ debugExposeBuffer: true }) + let dest = new Minipass({ debugExposeBuffer: true }) let sawDestData = false dest.once('data', chunk => { sawDestData = true @@ -34,7 +34,7 @@ t.test('some basic piping and writing', async t => { t.test('unicode splitting', async t => { const butterfly = '🦋' - const mp = new MiniPass({ encoding: 'utf8' }) + const mp = new Minipass({ encoding: 'utf8' }) t.plan(2) t.equal(mp.encoding, 'utf8') mp.on('data', chunk => { @@ -50,7 +50,7 @@ t.test('unicode splitting', async t => { t.test('unicode splitting with setEncoding', async t => { const butterfly = '🦋' - const mp = new MiniPass({ encoding: 'hex' }) + const mp = new Minipass({ encoding: 'hex' }) t.plan(4) t.equal(mp.encoding, 'hex') mp.setEncoding('hex') @@ -71,8 +71,8 @@ t.test('unicode splitting with setEncoding', async t => { t.test('base64 -> utf8 piping', t => { t.plan(1) const butterfly = '🦋' - const mp = new MiniPass({ encoding: 'base64' }) - const dest = new MiniPass({ encoding: 'utf8' }) + const mp = new Minipass({ encoding: 'base64' }) + const dest = new Minipass({ encoding: 'utf8' }) mp.pipe(dest) let out = '' dest.on('data', c => (out += c)) @@ -86,8 +86,8 @@ t.test('base64 -> utf8 piping', t => { t.test('utf8 -> base64 piping', t => { t.plan(1) const butterfly = '🦋' - const mp = new MiniPass({ encoding: 'utf8' }) - const dest = new MiniPass({ encoding: 'base64' }) + const mp = new Minipass({ encoding: 'utf8' }) + const dest = new Minipass({ encoding: 'base64' }) mp.pipe(dest) let out = '' dest.on('data', c => (out += c)) @@ -100,7 +100,7 @@ t.test('utf8 -> base64 piping', t => { t.test('read method', async t => { const butterfly = '🦋' - const mp = new MiniPass({ encoding: 'utf8' }) + const mp = new Minipass({ encoding: 'utf8' }) mp.on('data', c => t.equal(c, butterfly)) mp.pause() t.equal(mp.paused, true, 'paused=true') @@ -113,7 +113,7 @@ t.test('read method', async t => { t.test('read with no args', async t => { t.test('buffer -> string', async t => { const butterfly = '🦋' - const mp = new MiniPass({ encoding: 'utf8' }) + const mp = new Minipass({ encoding: 'utf8' }) mp.on('data', c => t.equal(c, butterfly)) mp.pause() const butterbuf = Buffer.from(butterfly) @@ -125,7 +125,7 @@ t.test('read with no args', async t => { t.test('buffer -> buffer', async t => { const butterfly = Buffer.from('🦋') - const mp = new MiniPass() + const mp = new Minipass() mp.on('data', c => t.same(c, butterfly)) mp.pause() mp.write(butterfly.slice(0, 2)) @@ -137,7 +137,7 @@ t.test('read with no args', async t => { t.test('string -> buffer', async t => { const butterfly = '🦋' const butterbuf = Buffer.from(butterfly) - const mp = new MiniPass() + const mp = new Minipass() mp.on('data', c => t.same(c, butterbuf)) mp.pause() mp.write(butterfly) @@ -147,7 +147,7 @@ t.test('read with no args', async t => { t.test('string -> string', async t => { const butterfly = '🦋' - const mp = new MiniPass({ encoding: 'utf8' }) + const mp = new Minipass({ encoding: 'utf8' }) mp.on('data', c => t.equal(c, butterfly)) mp.pause() mp.write(butterfly[0]) @@ -159,7 +159,7 @@ t.test('read with no args', async t => { t.test('partial read', async t => { const butterfly = '🦋' - const mp = new MiniPass() + const mp = new Minipass() const butterbuf = Buffer.from(butterfly) mp.write(butterbuf.slice(0, 1)) mp.write(butterbuf.slice(1, 2)) @@ -172,7 +172,7 @@ t.test('partial read', async t => { }) t.test('write after end', async t => { - const mp = new MiniPass() + const mp = new Minipass() let sawEnd = false mp.on('end', _ => (sawEnd = true)) mp.end('not empty') @@ -184,7 +184,7 @@ t.test('write after end', async t => { }) t.test('write after end', async t => { - const mp = new MiniPass() + const mp = new Minipass() let sawEnd = 0 mp.on('end', _ => sawEnd++) mp.end() // empty @@ -196,7 +196,7 @@ t.test('write after end', async t => { }) t.test('write cb', async t => { - const mp = new MiniPass() + const mp = new Minipass() let calledCb = false mp.write('ok', () => (calledCb = true)) t.ok(calledCb) @@ -204,7 +204,7 @@ t.test('write cb', async t => { t.test('end with chunk', async t => { let out = '' - const mp = new MiniPass({ encoding: 'utf8' }) + const mp = new Minipass({ encoding: 'utf8' }) let sawEnd = false mp.prependListener('end', _ => (sawEnd = true)) mp.addListener('data', c => (out += c)) @@ -216,8 +216,8 @@ t.test('end with chunk', async t => { }) t.test('no drain if could not entirely drain on resume', async t => { - const mp = new MiniPass() - const dest = new MiniPass({ encoding: 'buffer' }) + const mp = new Minipass() + const dest = new Minipass({ encoding: 'buffer' }) t.equal(mp.write('foo'), false) t.equal(mp.write('bar'), false) t.equal(mp.write('baz'), false) @@ -227,7 +227,7 @@ t.test('no drain if could not entirely drain on resume', async t => { }) t.test('end with chunk pending', async t => { - const mp = new MiniPass() + const mp = new Minipass() t.equal(mp.write('foo'), false) t.equal(mp.write('626172', 'hex'), false) t.equal(mp.write('baz'), false) @@ -253,7 +253,7 @@ t.test('pipe to stderr does not throw', t => { fs.writeFileSync( file, ` - const MP = require(${module}) + const { Minipass: MP } = require(${module}) const mp = new MP() mp.pipe(process.stderr) mp.end("hello") @@ -274,7 +274,7 @@ t.test('pipe to stderr does not throw', t => { }) t.test('emit works with many args', t => { - const mp = new MiniPass() + const mp = new Minipass() t.plan(2) mp.on('foo', function (a, b, c, d, e, f, g) { t.same([a, b, c, d, e, f, g], [1, 2, 3, 4, 5, 6, 7]) @@ -284,7 +284,7 @@ t.test('emit works with many args', t => { }) t.test('emit drain on resume, even if no flush', t => { - const mp = new MiniPass({ debugExposeBuffer: true }) + const mp = new Minipass({ debugExposeBuffer: true }) mp.encoding = 'utf8' const chunks = [] @@ -314,7 +314,7 @@ t.test('emit drain on resume, even if no flush', t => { }) t.test('save close for end', t => { - const mp = new MiniPass() + const mp = new Minipass() let ended = false mp.on('close', _ => { t.equal(ended, true, 'end before close') @@ -333,7 +333,7 @@ t.test('save close for end', t => { t.test('eos works', t => { const eos = require('end-of-stream') - const mp = new MiniPass() + const mp = new Minipass() eos(mp, er => { if (er) throw er @@ -347,7 +347,7 @@ t.test('eos works', t => { t.test('bufferLength property', t => { const eos = require('end-of-stream') - const mp = new MiniPass() + const mp = new Minipass() mp.write('a') mp.write('a') mp.write('a') @@ -365,7 +365,7 @@ t.test('bufferLength property', t => { }) t.test('emit resume event on resume', t => { - const mp = new MiniPass() + const mp = new Minipass() t.plan(3) mp.on('resume', _ => t.pass('got resume event')) mp.end('asdf') @@ -375,7 +375,7 @@ t.test('emit resume event on resume', t => { }) t.test('objectMode', t => { - const mp = new MiniPass({ objectMode: true }) + const mp = new Minipass({ objectMode: true }) t.equal(mp.objectMode, true, 'objectMode getter returns value') mp.objectMode = false t.equal(mp.objectMode, true, 'objectMode getter is read-only') @@ -398,7 +398,7 @@ t.test('objectMode', t => { }) t.test('objectMode no encoding', t => { - const mp = new MiniPass({ + const mp = new Minipass({ objectMode: true, encoding: 'utf8', }) @@ -420,7 +420,7 @@ t.test('objectMode no encoding', t => { }) t.test('objectMode read() and buffering', t => { - const mp = new MiniPass({ objectMode: true }) + const mp = new Minipass({ objectMode: true }) const a = { a: 1 } const b = { b: 1 } t.notOk(mp.write(a)) @@ -432,21 +432,21 @@ t.test('objectMode read() and buffering', t => { t.test('set encoding in object mode throws', async t => t.throws( - _ => (new MiniPass({ objectMode: true }).encoding = 'utf8'), + _ => (new Minipass({ objectMode: true }).encoding = 'utf8'), new Error('cannot set encoding in objectMode') ) ) t.test('set encoding again throws', async t => t.throws(_ => { - const mp = new MiniPass({ encoding: 'hex' }) + const mp = new Minipass({ encoding: 'hex' }) mp.write('ok') mp.encoding = 'utf8' }, new Error('cannot change encoding')) ) t.test('set encoding with existing buffer', async t => { - const mp = new MiniPass() + const mp = new Minipass() const butterfly = '🦋' const butterbuf = Buffer.from(butterfly) mp.write(butterbuf.slice(0, 1)) @@ -458,8 +458,8 @@ t.test('set encoding with existing buffer', async t => { t.test('end:false', async t => { t.plan(1) - const mp = new MiniPass({ encoding: 'utf8' }) - const d = new MiniPass({ encoding: 'utf8' }) + const mp = new Minipass({ encoding: 'utf8' }) + const d = new Minipass({ encoding: 'utf8' }) d.end = () => t.threw(new Error('no end no exit no way out')) d.on('data', c => t.equal(c, 'this is fine')) mp.pipe(d, { end: false }) @@ -467,7 +467,7 @@ t.test('end:false', async t => { }) t.test('objectMode allows falsey values for data', t => { - const mp = new MiniPass({ objectMode: true }) + const mp = new Minipass({ objectMode: true }) mp.write('') mp.write(null) mp.write(undefined) diff --git a/test/buffer-chunk-when-flowing-stops.js b/test/buffer-chunk-when-flowing-stops.js index 8dcde3a..3345b48 100644 --- a/test/buffer-chunk-when-flowing-stops.js +++ b/test/buffer-chunk-when-flowing-stops.js @@ -5,7 +5,7 @@ // // This caused issues when piping make-fetch-happen stream to tar.extract // https://github.com/npm/cli/issues/3884 -const Minipass = require('../') +const { Minipass } = require('../') const t = require('tap') class Pauser extends Minipass { diff --git a/test/collect-with-error-end.js b/test/collect-with-error-end.js index 285e8c4..b7ac832 100644 --- a/test/collect-with-error-end.js +++ b/test/collect-with-error-end.js @@ -1,4 +1,4 @@ -const MP = require('../') +const { Minipass: MP } = require('../') const mp = new MP() const poop = new Error('poop') mp.on('end', () => mp.emit('error', poop)) diff --git a/test/collect.js b/test/collect.js index 211ade0..c743297 100644 --- a/test/collect.js +++ b/test/collect.js @@ -1,6 +1,6 @@ 'use strict' const t = require('tap') -const MP = require('../index.js') +const { Minipass: MP } = require('../index.js') t.test('basic', async t => { const mp = new MP() diff --git a/test/dest-write-returns-nonboolean.js b/test/dest-write-returns-nonboolean.js index dd1d488..75582b9 100644 --- a/test/dest-write-returns-nonboolean.js +++ b/test/dest-write-returns-nonboolean.js @@ -1,5 +1,5 @@ const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') t.test('writing to a non-bool returning write() does not pause', t => { const booleyStream = new (class extends MP { diff --git a/test/destroy.js b/test/destroy.js index 2c82896..708fe1a 100644 --- a/test/destroy.js +++ b/test/destroy.js @@ -1,4 +1,4 @@ -const MP = require('../') +const { Minipass: MP } = require('../') const t = require('tap') t.match(new MP(), { destroy: Function }, 'destroy is implemented') diff --git a/test/emit-during-end-event.js b/test/emit-during-end-event.js index 60e1676..c5605da 100644 --- a/test/emit-during-end-event.js +++ b/test/emit-during-end-event.js @@ -1,4 +1,4 @@ -const Minipass = require('../') +const { Minipass } = require('../') const t = require('tap') class FancyEnder extends Minipass { diff --git a/test/empty-buffer-end-with-encoding.js b/test/empty-buffer-end-with-encoding.js index 7765d2c..d35d228 100644 --- a/test/empty-buffer-end-with-encoding.js +++ b/test/empty-buffer-end-with-encoding.js @@ -1,5 +1,5 @@ const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') const enc = { encoding: 'utf8' } diff --git a/test/empty-stream-emits-end-without-read.js b/test/empty-stream-emits-end-without-read.js index a00d104..08175e5 100644 --- a/test/empty-stream-emits-end-without-read.js +++ b/test/empty-stream-emits-end-without-read.js @@ -1,3 +1,3 @@ -const MP = require('../') +const { Minipass: MP } = require('../') const t = require('tap') t.test('empty end emits end without reading', t => new MP().end().promise()) diff --git a/test/end-missed.js b/test/end-missed.js index a4351a3..1d322cc 100644 --- a/test/end-missed.js +++ b/test/end-missed.js @@ -1,6 +1,6 @@ 'use strict' const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') t.test('end is not missed if listened to after end', t => { t.plan(1) diff --git a/test/end-returns-this.js b/test/end-returns-this.js index 404f917..0f4ee3e 100644 --- a/test/end-returns-this.js +++ b/test/end-returns-this.js @@ -1,4 +1,4 @@ const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') const mp = new MP() t.equal(mp.end(), mp, 'end returns this') diff --git a/test/end-twice.js b/test/end-twice.js index df9970b..50f4ac3 100644 --- a/test/end-twice.js +++ b/test/end-twice.js @@ -1,6 +1,6 @@ 'use strict' const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') t.test('organic', t => { const butterfly = Buffer.from([0x61, 0xf0, 0x9f, 0xa6, 0x8b, 0xf0]) diff --git a/test/error-before-promise.js b/test/error-before-promise.js index 69c48e2..a340ad6 100644 --- a/test/error-before-promise.js +++ b/test/error-before-promise.js @@ -1,4 +1,4 @@ -const MP = require('../') +const { Minipass: MP } = require('../') const t = require('tap') t.test('emit an error before calling stream.promise()', t => { diff --git a/test/esm.mjs b/test/esm.mjs index 827baac..f3f283e 100644 --- a/test/esm.mjs +++ b/test/esm.mjs @@ -1,4 +1,4 @@ -import Minipass from '../index.mjs' +import { Minipass } from '../index.mjs' import t from 'tap' t.test(`just make sure it's actually a stream`, async t => { diff --git a/test/flush-buffer-before-flowing.js b/test/flush-buffer-before-flowing.js index c5ae4da..17f0dac 100644 --- a/test/flush-buffer-before-flowing.js +++ b/test/flush-buffer-before-flowing.js @@ -6,7 +6,7 @@ // the Pipeline's buffer is holding a chunk, but the Pipeline itself is in // flowing mode. The solution is to always drain the buffer before emitting // 'data', if there is other data waiting to be emitted. -const Minipass = require('../') +const { Minipass } = require('../') const t = require('tap') const src = new Minipass({ encoding: 'utf8' }) diff --git a/test/is-stream.js b/test/is-stream.js index bdbda6a..9d5d2a8 100644 --- a/test/is-stream.js +++ b/test/is-stream.js @@ -1,4 +1,4 @@ -const MP = require('../') +const { Minipass: MP } = require('../') const EE = require('events') const t = require('tap') const Stream = require('stream') diff --git a/test/iterate-max-listener-test.js b/test/iterate-max-listener-test.js index 2e151e0..5547530 100644 --- a/test/iterate-max-listener-test.js +++ b/test/iterate-max-listener-test.js @@ -1,5 +1,5 @@ const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') // make warnings throw Object.defineProperty(process, 'emitWarning', { diff --git a/test/iteration-unsupported.js b/test/iteration-unsupported.js index 527d222..1438d93 100644 --- a/test/iteration-unsupported.js +++ b/test/iteration-unsupported.js @@ -1,7 +1,7 @@ 'use strict' const t = require('tap') global._MP_NO_ITERATOR_SYMBOLS_ = '1' -const MP = require('../index.js') +const { Minipass: MP } = require('../index.js') const mp = new MP() mp.write('foo') setTimeout(() => mp.end()) diff --git a/test/iteration.js b/test/iteration.js index 45306ec..475a28f 100644 --- a/test/iteration.js +++ b/test/iteration.js @@ -1,6 +1,6 @@ 'use strict' const t = require('tap') -const MP = require('../index.js') +const { Minipass: MP } = require('../index.js') t.test('sync iteration', t => { const cases = { diff --git a/test/no-process-ok.js b/test/no-process-ok.js index fb8f3b3..e0b34ac 100644 --- a/test/no-process-ok.js +++ b/test/no-process-ok.js @@ -1,7 +1,7 @@ const tap = require('tap') const proc = global.process global.process = null -const MP = require('../') +const { Minipass: MP } = require('../') const src = new MP() const dest = new MP({ encoding: 'utf8' }) src.pipe(dest) diff --git a/test/pipe-ended-stream.js b/test/pipe-ended-stream.js index 7fe5473..52faad9 100644 --- a/test/pipe-ended-stream.js +++ b/test/pipe-ended-stream.js @@ -1,5 +1,5 @@ const t = require('tap') -const MP = require('../') +const { Minipass: MP } = require('../') t.test('pipe from ended stream', t => { const from = new MP() from.end().on('end', () => { diff --git a/test/proxy-errors.js b/test/proxy-errors.js index e125119..15abf3a 100644 --- a/test/proxy-errors.js +++ b/test/proxy-errors.js @@ -1,5 +1,5 @@ const t = require('tap') -const Minipass = require('../') +const { Minipass } = require('../') t.test('not proxied', t => { const src = new Minipass() diff --git a/test/readable-emits-immediately.js b/test/readable-emits-immediately.js index 821631e..e437779 100644 --- a/test/readable-emits-immediately.js +++ b/test/readable-emits-immediately.js @@ -1,5 +1,5 @@ // https://github.com/isaacs/minipass/issues/36 -const Minipass = require('../') +const { Minipass } = require('../') const t = require('tap') const m = new Minipass({ encoding: 'utf8' }) diff --git a/test/readable-only-when-buffering.js b/test/readable-only-when-buffering.js index deba6a5..e729096 100644 --- a/test/readable-only-when-buffering.js +++ b/test/readable-only-when-buffering.js @@ -1,4 +1,4 @@ -const MP = require('../') +const { Minipass: MP } = require('../') const t = require('tap') const mp = new MP() let readables = 0 diff --git a/test/unpipe.js b/test/unpipe.js index c9cb0f0..fd425f4 100644 --- a/test/unpipe.js +++ b/test/unpipe.js @@ -1,5 +1,5 @@ const t = require('tap') -const Minipass = require('../') +const { Minipass } = require('../') const src = new Minipass({ encoding: 'utf8', debugExposePipes: true }) const dest = new Minipass({ encoding: 'utf8' }) diff --git a/test/write-returns-true-when-readable-triggers-flow.js b/test/write-returns-true-when-readable-triggers-flow.js index e7ed362..5d4465d 100644 --- a/test/write-returns-true-when-readable-triggers-flow.js +++ b/test/write-returns-true-when-readable-triggers-flow.js @@ -2,7 +2,7 @@ // true, because even though s is not flowing at the START of the write(), // it IS flowing by the END of the write call. -const Minipass = require('../') +const { Minipass } = require('../') const t = require('tap') t.test('empty write', async t => {