From cf7649e38fb9560a57c1d76ef20dca290188f113 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:23 -0500 Subject: [PATCH 01/10] Migrated FFI to ES modules via 'lebab' --- src/Web/Promise/Internal.js | 32 ++++++++++++++++---------------- src/Web/Promise/Rejection.js | 8 ++++---- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Web/Promise/Internal.js b/src/Web/Promise/Internal.js index 4cc44d7..87da336 100644 --- a/src/Web/Promise/Internal.js +++ b/src/Web/Promise/Internal.js @@ -1,33 +1,33 @@ "use strict"; -exports.new = function(k) { +export function new(k) { return new Promise(k); -}; +} -exports.then_ = function(k, p) { +export function then_(k, p) { return p.then(k); -}; +} -exports.catch = function(k, p) { +export function catch(k, p) { return p.catch(k); -}; +} -exports.finally = function(k, p) { +export function finally(k, p) { return p.finally(k); -}; +} -exports.resolve = function(a) { +export function resolve(a) { return Promise.resolve(a); -}; +} -exports.reject = function(a) { +export function reject(a) { return Promise.reject(a); -}; +} -exports.all = function(a) { +export function all(a) { return Promise.all(a); -}; +} -exports.race = function(a) { +export function race(a) { return Promise.race(a); -}; +} diff --git a/src/Web/Promise/Rejection.js b/src/Web/Promise/Rejection.js index 3c8ea75..fd3252d 100644 --- a/src/Web/Promise/Rejection.js +++ b/src/Web/Promise/Rejection.js @@ -1,12 +1,12 @@ "use strict"; -exports.fromError = function(a) { +export function fromError(a) { return a; -}; +} -exports._toError = function(just, nothing, ref) { +export function _toError(just, nothing, ref) { if (ref instanceof Error) { return just(ref); } return nothing; -}; +} From 7d871d3a63ef14bd197da349dc8231f228aa93ae Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:23 -0500 Subject: [PATCH 02/10] Removed '"use strict";' in FFI files --- src/Web/Promise/Internal.js | 2 -- src/Web/Promise/Rejection.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/Web/Promise/Internal.js b/src/Web/Promise/Internal.js index 87da336..7155de2 100644 --- a/src/Web/Promise/Internal.js +++ b/src/Web/Promise/Internal.js @@ -1,5 +1,3 @@ -"use strict"; - export function new(k) { return new Promise(k); } diff --git a/src/Web/Promise/Rejection.js b/src/Web/Promise/Rejection.js index fd3252d..83dcb67 100644 --- a/src/Web/Promise/Rejection.js +++ b/src/Web/Promise/Rejection.js @@ -1,5 +1,3 @@ -"use strict"; - export function fromError(a) { return a; } From 5b0be7406842a7c773d29d9028944b3bfeba2c22 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:23 -0500 Subject: [PATCH 03/10] 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 d1bfdd84baf552cdc13f8db52a5f7dedf1a55500 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:23 -0500 Subject: [PATCH 04/10] Update Bower dependencies to master or main --- bower.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 060778b..7cc1da9 100644 --- a/bower.json +++ b/bower.json @@ -13,11 +13,11 @@ "output" ], "dependencies": { - "purescript-effect": "^3.0.0", - "purescript-exceptions": "^5.0.0", - "purescript-functions": "^5.0.0", - "purescript-maybe": "^5.0.0", - "purescript-prelude": "^5.0.0", - "purescript-foldable-traversable": "^5.0.0" + "purescript-effect": "master", + "purescript-exceptions": "master", + "purescript-functions": "master", + "purescript-maybe": "master", + "purescript-prelude": "master", + "purescript-foldable-traversable": "master" } } From 60689a868f83fda895b78d9232c72cef3de65adb Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:23 -0500 Subject: [PATCH 05/10] 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 98b78faaffbeb294e26e6c2145c1885ed3e918d7 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 15:05:23 -0500 Subject: [PATCH 06/10] 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 3cbc29145c00bff4032f305a8bcfba0053ed2523 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 16:15:11 -0500 Subject: [PATCH 07/10] 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 2b3f06a66df5ad3f06bbaf9fa249cfdf56b79003 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 16:17:56 -0500 Subject: [PATCH 08/10] Update eslint to es6 --- .eslintrc.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 65496fa..6dd17f6 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 e824d420243cbe404aec3b5dc1ae747f77717829 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 16:18:01 -0500 Subject: [PATCH 09/10] Fix FFI exports --- src/Web/Promise/Internal.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Web/Promise/Internal.js b/src/Web/Promise/Internal.js index 7155de2..f3b6e8a 100644 --- a/src/Web/Promise/Internal.js +++ b/src/Web/Promise/Internal.js @@ -1,18 +1,21 @@ -export function new(k) { +const newImpl = function (k) { return new Promise(k); -} +}; +export { newImpl as new }; export function then_(k, p) { return p.then(k); } -export function catch(k, p) { +const catchImpl = function (k, p) { return p.catch(k); -} +}; +export { catchImpl as catch }; -export function finally(k, p) { +const finallyImpl = function (k, p) { return p.finally(k); -} +}; +export { finallyImpl as finally }; export function resolve(a) { return Promise.resolve(a); From dcbbc7318224462a82492497a23823971c5cec7b Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 22 Mar 2022 16:20:35 -0500 Subject: [PATCH 10/10] Added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d60d0e0..a52cba2 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 (#14 by @JordanMartinez) New features: