Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Implement using web-streams-polyfill #3

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

const {
ByteLengthQueuingStrategy,
CountQueuingStrategy,
ReadableByteStreamController,
ReadableStream,
ReadableStreamBYOBReader,
ReadableStreamBYOBRequest,
ReadableStreamDefaultController,
ReadableStreamDefaultReader,
TransformStream,
TransformStreamDefaultController,
WritableStream,
WritableStreamDefaultController,
WritableStreamDefaultWriter
} = require('web-streams-polyfill/ponyfill/es2018');

module.exports = {
ByteLengthQueuingStrategy,
CountQueuingStrategy,
ReadableByteStreamController,
ReadableStream,
ReadableStreamBYOBReader,
ReadableStreamBYOBRequest,
ReadableStreamDefaultController,
ReadableStreamDefaultReader,
TransformStream,
TransformStreamDefaultController,
WritableStream,
WritableStreamDefaultController,
WritableStreamDefaultWriter
};
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "WIP support for WHATWG Stream in Node",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node --expose-internals --expose_gc test/wpt/test.js"
},
"repository": {
"type": "git",
Expand All @@ -15,5 +15,11 @@
"bugs": {
"url": "https://github.com/nodejs/whatwg-stream/issues"
},
"homepage": "https://github.com/nodejs/whatwg-stream#readme"
"homepage": "https://github.com/nodejs/whatwg-stream#readme",
"engines": {
"node": ">= 15"
},
"dependencies": {
"web-streams-polyfill": "^3.0.2"
}
}
33 changes: 33 additions & 0 deletions test/common/fixtures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable node-core/require-common-first, node-core/required-modules */
'use strict';

const path = require('path');
const fs = require('fs');

const fixturesDir = path.join(__dirname, '..', 'fixtures');

function fixturesPath(...args) {
return path.join(fixturesDir, ...args);
}

function readFixtureSync(args, enc) {
if (Array.isArray(args))
return fs.readFileSync(fixturesPath(...args), enc);
return fs.readFileSync(fixturesPath(args), enc);
}

function readFixtureKey(name, enc) {
return fs.readFileSync(fixturesPath('keys', name), enc);
}

function readFixtureKeys(enc, ...names) {
return names.map((name) => readFixtureKey(name, enc));
}

module.exports = {
fixturesDir,
path: fixturesPath,
readSync: readFixtureSync,
readKey: readFixtureKey,
readKeys: readFixtureKeys,
};
4 changes: 4 additions & 0 deletions test/common/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

exports.hasIntl = true;

Loading