From 4178c61d3d6dc74c3094b2b617cec92df11635b2 Mon Sep 17 00:00:00 2001 From: Cyril Sobierajewicz Date: Sat, 17 Jul 2021 20:57:45 +0200 Subject: [PATCH 1/8] Convert foreign modules to try bundling with esbuild --- src/Data/Int.js | 14 +++++++------- src/Data/Int/Bits.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Data/Int.js b/src/Data/Int.js index 9900e5e..704d1cb 100644 --- a/src/Data/Int.js +++ b/src/Data/Int.js @@ -1,6 +1,6 @@ "use strict"; -exports.fromNumberImpl = function (just) { +export var fromNumberImpl = function (just) { return function (nothing) { return function (n) { /* jshint bitwise: false */ @@ -9,11 +9,11 @@ exports.fromNumberImpl = function (just) { }; }; -exports.toNumber = function (n) { +export var toNumber = function (n) { return n; }; -exports.fromStringAsImpl = function (just) { +export var fromStringAsImpl = function (just) { return function (nothing) { return function (radix) { var digits; @@ -39,27 +39,27 @@ exports.fromStringAsImpl = function (just) { }; }; -exports.toStringAs = function (radix) { +export var toStringAs = function (radix) { return function (i) { return i.toString(radix); }; }; -exports.quot = function (x) { +export var quot = function (x) { return function (y) { /* jshint bitwise: false */ return x / y | 0; }; }; -exports.rem = function (x) { +export var rem = function (x) { return function (y) { return x % y; }; }; -exports.pow = function (x) { +export var pow = function (x) { return function (y) { /* jshint bitwise: false */ return Math.pow(x,y) | 0; diff --git a/src/Data/Int/Bits.js b/src/Data/Int/Bits.js index ed36ea4..82b5453 100644 --- a/src/Data/Int/Bits.js +++ b/src/Data/Int/Bits.js @@ -2,49 +2,49 @@ // module Data.Int.Bits -exports.and = function (n1) { +export var and = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 & n2; }; }; -exports.or = function (n1) { +export var or = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 | n2; }; }; -exports.xor = function (n1) { +export var xor = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 ^ n2; }; }; -exports.shl = function (n1) { +export var shl = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 << n2; }; }; -exports.shr = function (n1) { +export var shr = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 >> n2; }; }; -exports.zshr = function (n1) { +export var zshr = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 >>> n2; }; }; -exports.complement = function (n) { +export var complement = function (n) { /* jshint bitwise: false */ return ~n; }; From 67f9acf4230707714f4ed593284243e0d441d71a Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 11 Mar 2022 14:17:27 -0800 Subject: [PATCH 2/8] Replaced 'export var' with 'export const' --- src/Data/Int.js | 14 +++++++------- src/Data/Int/Bits.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Data/Int.js b/src/Data/Int.js index 704d1cb..22c43d3 100644 --- a/src/Data/Int.js +++ b/src/Data/Int.js @@ -1,6 +1,6 @@ "use strict"; -export var fromNumberImpl = function (just) { +export const fromNumberImpl = function (just) { return function (nothing) { return function (n) { /* jshint bitwise: false */ @@ -9,11 +9,11 @@ export var fromNumberImpl = function (just) { }; }; -export var toNumber = function (n) { +export const toNumber = function (n) { return n; }; -export var fromStringAsImpl = function (just) { +export const fromStringAsImpl = function (just) { return function (nothing) { return function (radix) { var digits; @@ -39,27 +39,27 @@ export var fromStringAsImpl = function (just) { }; }; -export var toStringAs = function (radix) { +export const toStringAs = function (radix) { return function (i) { return i.toString(radix); }; }; -export var quot = function (x) { +export const quot = function (x) { return function (y) { /* jshint bitwise: false */ return x / y | 0; }; }; -export var rem = function (x) { +export const rem = function (x) { return function (y) { return x % y; }; }; -export var pow = function (x) { +export const pow = function (x) { return function (y) { /* jshint bitwise: false */ return Math.pow(x,y) | 0; diff --git a/src/Data/Int/Bits.js b/src/Data/Int/Bits.js index 82b5453..ef7bd76 100644 --- a/src/Data/Int/Bits.js +++ b/src/Data/Int/Bits.js @@ -2,49 +2,49 @@ // module Data.Int.Bits -export var and = function (n1) { +export const and = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 & n2; }; }; -export var or = function (n1) { +export const or = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 | n2; }; }; -export var xor = function (n1) { +export const xor = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 ^ n2; }; }; -export var shl = function (n1) { +export const shl = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 << n2; }; }; -export var shr = function (n1) { +export const shr = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 >> n2; }; }; -export var zshr = function (n1) { +export const zshr = function (n1) { return function (n2) { /* jshint bitwise: false */ return n1 >>> n2; }; }; -export var complement = function (n) { +export const complement = function (n) { /* jshint bitwise: false */ return ~n; }; From c25dbedce26561f6a08c2a341eee1e247fdd6949 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 11 Mar 2022 14:17:28 -0800 Subject: [PATCH 3/8] Removed '"use strict";' in FFI files --- src/Data/Int.js | 2 -- src/Data/Int/Bits.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/Data/Int.js b/src/Data/Int.js index 22c43d3..9829cce 100644 --- a/src/Data/Int.js +++ b/src/Data/Int.js @@ -1,5 +1,3 @@ -"use strict"; - export const fromNumberImpl = function (just) { return function (nothing) { return function (n) { diff --git a/src/Data/Int/Bits.js b/src/Data/Int/Bits.js index ef7bd76..49bbaff 100644 --- a/src/Data/Int/Bits.js +++ b/src/Data/Int/Bits.js @@ -1,5 +1,3 @@ -"use strict"; - // module Data.Int.Bits export const and = function (n1) { From 47aebeb7b60077d71a2fc561e1193d2cb3fb0538 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 11 Mar 2022 14:17:28 -0800 Subject: [PATCH 4/8] 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 43d2897..b6ebf3a 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 237c908b7fa1928fa726312a908558e18c2fed7e Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 11 Mar 2022 14:17:28 -0800 Subject: [PATCH 5/8] Update pulp to 16.0.0-0 and psa to 0.8.2 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fd4391e..a1d6811 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,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" } } From e319ed2e3958840b9382447c55c7393ba521ce17 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 11 Mar 2022 14:59:22 -0800 Subject: [PATCH 6/8] Update Bower dependencies to master --- bower.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index d96eae8..154ef73 100644 --- a/bower.json +++ b/bower.json @@ -16,14 +16,14 @@ "package.json" ], "dependencies": { - "purescript-math": "^3.0.0", - "purescript-maybe": "^5.0.0", - "purescript-numbers": "^8.0.0", - "purescript-prelude": "^5.0.0" + "purescript-math": "master", + "purescript-maybe": "master", + "purescript-numbers": "master", + "purescript-prelude": "master" }, "devDependencies": { - "purescript-assert": "^5.0.0", - "purescript-console": "^5.0.0", - "purescript-partial": "^3.0.0" + "purescript-assert": "master", + "purescript-console": "master", + "purescript-partial": "master" } } From e0829ea1cfb08d3b82213d6fd98e40b7d7928ffa Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Mon, 14 Mar 2022 15:16:08 -0700 Subject: [PATCH 7/8] Update .eslintrc.json to ES6 --- .eslintrc.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 84cef4f..1c6afb9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,9 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", - "env": { - "commonjs": true - }, "rules": { "strict": [2, "global"], "block-scoped-var": 2, From 867af08aa4545eb95fa4a9af49f85ddb41590e54 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Mon, 14 Mar 2022 15:17:04 -0700 Subject: [PATCH 8/8] Added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba9e0fd..6ddf194 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 (#50 by @kl0tl and @JordanMartinez) New features: