diff --git a/.eslintrc.json b/.eslintrc.json index 8d8d9cb..d4b83db 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,10 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", "env": { - "commonjs": true, "browser": true }, "globals": { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 063845e..06ed895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,12 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "10" + node-version: "14" - name: Install dependencies run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index c7974ea..bb4665e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Migrate FFI to ES modules (#7 by @JordanMartinez) New features: diff --git a/bower.json b/bower.json index 0366d8d..d856e2b 100644 --- a/bower.json +++ b/bower.json @@ -15,12 +15,12 @@ "package.json" ], "dependencies": { - "purescript-arraybuffer-types": "^3.0.0", - "purescript-effect": "^3.0.0", - "purescript-exceptions": "^5.0.0", - "purescript-nullable": "^5.0.0", - "purescript-prelude": "^5.0.0", - "purescript-tuples": "^6.0.0", - "purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#2.0.0" + "purescript-arraybuffer-types": "main", + "purescript-effect": "master", + "purescript-exceptions": "master", + "purescript-nullable": "main", + "purescript-prelude": "master", + "purescript-tuples": "master", + "purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#master" } } diff --git a/package.json b/package.json index 1c67b54..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ }, "devDependencies": { "eslint": "^7.15.0", - "pulp": "^15.0.0", - "purescript-psa": "^0.8.0", + "pulp": "16.0.0-0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } diff --git a/src/Web/Streams/QueuingStrategy.js b/src/Web/Streams/QueuingStrategy.js index e22c02f..e64d3c6 100644 --- a/src/Web/Streams/QueuingStrategy.js +++ b/src/Web/Streams/QueuingStrategy.js @@ -1,19 +1,18 @@ -"use strict"; - -exports.new = function(options) { +const newImpl = function (options) { return function() { return new QueuingStrategy(options); }; }; +export { newImpl as new }; -exports.byteLengthQueuingStrategy = function(options) { +export function byteLengthQueuingStrategy(options) { return function() { return new ByteLengthQueuingStrategy(options); }; -}; +} -exports.countQueuingStrategy = function(options) { +export function countQueuingStrategy(options) { return function() { return new CountQueuingStrategy(options); }; -}; +} diff --git a/src/Web/Streams/ReadableStream.js b/src/Web/Streams/ReadableStream.js index 060ec06..feea2ab 100644 --- a/src/Web/Streams/ReadableStream.js +++ b/src/Web/Streams/ReadableStream.js @@ -1,28 +1,26 @@ -"use strict"; - -exports._new = function(source, strategy) { +export function _new(source, strategy) { return new ReadableStream(source, strategy); -}; +} -exports.cancel = function(stream) { +export function cancel(stream) { return function() { return stream.cancel(); }; -}; +} -exports.locked = function(stream) { +export function locked(stream) { return function() { return stream.locked; }; -}; +} -exports.getReader = function(stream) { +export function getReader(stream) { return function() { return stream.getReader(); }; -}; +} -exports._tee = function(tuple, stream) { +export function _tee(tuple, stream) { var r = stream.tee(); return tuple(r[0])(r[1]); -}; +} diff --git a/src/Web/Streams/ReadableStreamController.js b/src/Web/Streams/ReadableStreamController.js index 3f66e4c..118adc0 100644 --- a/src/Web/Streams/ReadableStreamController.js +++ b/src/Web/Streams/ReadableStreamController.js @@ -1,29 +1,27 @@ -"use strict"; - -exports.enqueue = function(chunk) { +export function enqueue(chunk) { return function(controller) { return function() { return controller.enqueue(chunk); }; }; -}; +} -exports.close = function(controller) { +export function close(controller) { return function() { return controller.close(); }; -}; +} -exports.error = function(error) { +export function error(error) { return function(controller) { return function() { return controller.error(error); }; }; -}; +} -exports.desiredSize = function(controller) { +export function desiredSize(controller) { return function() { return controller.desiredSize; }; -}; +} diff --git a/src/Web/Streams/Reader.js b/src/Web/Streams/Reader.js index f4360fa..5a86a2f 100644 --- a/src/Web/Streams/Reader.js +++ b/src/Web/Streams/Reader.js @@ -1,10 +1,8 @@ -"use strict"; - -exports._read = function(nothing, just, reader) { +export function _read(nothing, just, reader) { return reader.read().then(function(res) { if (res.done) { return nothing; } return just(res.value); }); -}; +} diff --git a/src/Web/Streams/Source.js b/src/Web/Streams/Source.js index 6c1a4cb..94cc7cb 100644 --- a/src/Web/Streams/Source.js +++ b/src/Web/Streams/Source.js @@ -1,6 +1,4 @@ -"use strict"; - -exports._make = function(options) { +export function _make(options) { var newOptions = { start: function(controller) { return options.start(controller)(); @@ -17,4 +15,4 @@ exports._make = function(options) { }; } return newOptions; -}; +}