From 9660c0db675d626ca1ceda3d449f6f0b1f1a2ced Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:41 -0500 Subject: [PATCH 01/11] Migrated FFI to ES modules via 'lebab' --- src/Web/Streams/QueuingStrategy.js | 12 ++++++------ src/Web/Streams/ReadableStream.js | 20 ++++++++++---------- src/Web/Streams/ReadableStreamController.js | 16 ++++++++-------- src/Web/Streams/Reader.js | 4 ++-- src/Web/Streams/Source.js | 4 ++-- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Web/Streams/QueuingStrategy.js b/src/Web/Streams/QueuingStrategy.js index e22c02f..922dc0d 100644 --- a/src/Web/Streams/QueuingStrategy.js +++ b/src/Web/Streams/QueuingStrategy.js @@ -1,19 +1,19 @@ "use strict"; -exports.new = function(options) { +export function new(options) { return function() { return new QueuingStrategy(options); }; -}; +} -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..cf5dd77 100644 --- a/src/Web/Streams/ReadableStream.js +++ b/src/Web/Streams/ReadableStream.js @@ -1,28 +1,28 @@ "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..46d888b 100644 --- a/src/Web/Streams/ReadableStreamController.js +++ b/src/Web/Streams/ReadableStreamController.js @@ -1,29 +1,29 @@ "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..9076824 100644 --- a/src/Web/Streams/Reader.js +++ b/src/Web/Streams/Reader.js @@ -1,10 +1,10 @@ "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..ef8f740 100644 --- a/src/Web/Streams/Source.js +++ b/src/Web/Streams/Source.js @@ -1,6 +1,6 @@ "use strict"; -exports._make = function(options) { +export function _make(options) { var newOptions = { start: function(controller) { return options.start(controller)(); @@ -17,4 +17,4 @@ exports._make = function(options) { }; } return newOptions; -}; +} From 6f9c332d7001c4a8363b8715837af404cf7b3fb5 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:41 -0500 Subject: [PATCH 02/11] Removed '"use strict";' in FFI files --- src/Web/Streams/QueuingStrategy.js | 2 -- src/Web/Streams/ReadableStream.js | 2 -- src/Web/Streams/ReadableStreamController.js | 2 -- src/Web/Streams/Reader.js | 2 -- src/Web/Streams/Source.js | 2 -- 5 files changed, 10 deletions(-) diff --git a/src/Web/Streams/QueuingStrategy.js b/src/Web/Streams/QueuingStrategy.js index 922dc0d..5b8167e 100644 --- a/src/Web/Streams/QueuingStrategy.js +++ b/src/Web/Streams/QueuingStrategy.js @@ -1,5 +1,3 @@ -"use strict"; - export function new(options) { return function() { return new QueuingStrategy(options); diff --git a/src/Web/Streams/ReadableStream.js b/src/Web/Streams/ReadableStream.js index cf5dd77..feea2ab 100644 --- a/src/Web/Streams/ReadableStream.js +++ b/src/Web/Streams/ReadableStream.js @@ -1,5 +1,3 @@ -"use strict"; - export function _new(source, strategy) { return new ReadableStream(source, strategy); } diff --git a/src/Web/Streams/ReadableStreamController.js b/src/Web/Streams/ReadableStreamController.js index 46d888b..118adc0 100644 --- a/src/Web/Streams/ReadableStreamController.js +++ b/src/Web/Streams/ReadableStreamController.js @@ -1,5 +1,3 @@ -"use strict"; - export function enqueue(chunk) { return function(controller) { return function() { diff --git a/src/Web/Streams/Reader.js b/src/Web/Streams/Reader.js index 9076824..5a86a2f 100644 --- a/src/Web/Streams/Reader.js +++ b/src/Web/Streams/Reader.js @@ -1,5 +1,3 @@ -"use strict"; - export function _read(nothing, just, reader) { return reader.read().then(function(res) { if (res.done) { diff --git a/src/Web/Streams/Source.js b/src/Web/Streams/Source.js index ef8f740..94cc7cb 100644 --- a/src/Web/Streams/Source.js +++ b/src/Web/Streams/Source.js @@ -1,5 +1,3 @@ -"use strict"; - export function _make(options) { var newOptions = { start: function(controller) { From 5f1f8f8be9ed71a956691c3fcbed7fa3bfb86b22 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:41 -0500 Subject: [PATCH 03/11] Update to CI to use 'unstable' purescript --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 063845e..f5a96fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: From 9da6ce4b7f22ed2e9b16aaccc723757288176efb Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:42 -0500 Subject: [PATCH 04/11] Update Bower dependencies to master or main --- bower.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index 0366d8d..4a82b90 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": "master" } } From 263c72bd4531bacdf07bd3cadba8e83a0a234ed0 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:42 -0500 Subject: [PATCH 05/11] Update pulp to 16.0.0-0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c67b54..18136bd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "eslint": "^7.15.0", - "pulp": "^15.0.0", + "pulp": "16.0.0-0", "purescript-psa": "^0.8.0", "rimraf": "^3.0.2" } From d578b2ccb5ec01730f0b248fafc72bd3f17d9325 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:42 -0500 Subject: [PATCH 06/11] Update psa to 0.8.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18136bd..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "devDependencies": { "eslint": "^7.15.0", "pulp": "16.0.0-0", - "purescript-psa": "^0.8.0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } From 92ddd1e0a95e30ae86278f4a1bbb744237d25cfb Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 17:15:42 -0500 Subject: [PATCH 07/11] Update Bower dependencies to master or main --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 4a82b90..d856e2b 100644 --- a/bower.json +++ b/bower.json @@ -21,6 +21,6 @@ "purescript-nullable": "main", "purescript-prelude": "master", "purescript-tuples": "master", - "purescript-web-promise": "master" + "purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#master" } } From df6c5e5398b360e42e123745f22cac6cf30d6751 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 17:18:20 -0500 Subject: [PATCH 08/11] Update eslint to es6 --- .eslintrc.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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": { From 372d66b56ac31baf96f95160142432ff9ff58438 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 17:18:25 -0500 Subject: [PATCH 09/11] Fix FFI export --- src/Web/Streams/QueuingStrategy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Web/Streams/QueuingStrategy.js b/src/Web/Streams/QueuingStrategy.js index 5b8167e..e64d3c6 100644 --- a/src/Web/Streams/QueuingStrategy.js +++ b/src/Web/Streams/QueuingStrategy.js @@ -1,8 +1,9 @@ -export function new(options) { +const newImpl = function (options) { return function() { return new QueuingStrategy(options); }; -} +}; +export { newImpl as new }; export function byteLengthQueuingStrategy(options) { return function() { From 2f54be61945ddc794736742098737976a8ae3ccd Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 17:20:00 -0500 Subject: [PATCH 10/11] Update CI to use Node 14 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5a96fe..06ed895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: with: purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "10" + node-version: "14" - name: Install dependencies run: | From 2e966e2695936d0b23d01c4b26d13b8a32410a76 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 17:20:21 -0500 Subject: [PATCH 11/11] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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: