diff --git a/index.node.cjs b/index.node.cjs new file mode 100644 index 0000000..1343d9c --- /dev/null +++ b/index.node.cjs @@ -0,0 +1,35 @@ +const { + ReadableStream, + ReadableStreamDefaultReader, + ReadableStreamBYOBReader, + ReadableStreamBYOBRequest, + ReadableByteStreamController, + ReadableStreamDefaultController, + TransformStream, + TransformStreamDefaultController, + WritableStream, + WritableStreamDefaultWriter, + WritableStreamDefaultController, + ByteLengthQueuingStrategy, + CountQueuingStrategy, + TextEncoderStream, + TextDecoderStream, +} = require("node:stream/web"); + +module.exports = { + ReadableStream, + ReadableStreamDefaultReader, + ReadableStreamBYOBReader, + ReadableStreamBYOBRequest, + ReadableByteStreamController, + ReadableStreamDefaultController, + TransformStream, + TransformStreamDefaultController, + WritableStream, + WritableStreamDefaultWriter, + WritableStreamDefaultController, + ByteLengthQueuingStrategy, + CountQueuingStrategy, + TextEncoderStream, + TextDecoderStream, +} \ No newline at end of file diff --git a/index.node.js b/index.node.mjs similarity index 100% rename from index.node.js rename to index.node.mjs diff --git a/package.json b/package.json index a084694..41a86ef 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,16 @@ "name": "isomorphic-streams", "version": "1.0.3", "description": "Isomorphic WHATWG Streams API package for browser and Node.js", - "main": "./index.node.js", + "main": "./index.node.cjs", + "module": "./index.module.mjs", "browser": "./index.browser.js", "types": "./index.d.ts", "exports": { "types": "./index.d.ts", - "node": "./index.node.js", + "node": { + "import": "./index.node.mjs", + "require": "./index.node.cjs" + }, "default": "./index.browser.js" }, "license": "MIT", @@ -47,7 +51,8 @@ "files": [ "index.d.ts", "index.browser.js", - "index.node.js", + "index.node.cjs", + "index.node.mjs", "LICENSE", "README.md" ]