Skip to content

Commit 80b91b4

Browse files
Migrate FFI to ES modules (#287)
* Convert foreign modules to try bundling with esbuild * Update .eslintrc.json to ES6 * Migrated FFI to ES modules via 'lebab' * Fix eslint issues * Update CI purs to unstable * Get rid of extra space from 'use strict' line * Add changelog entry * Update pulp to 16.0.0-0 * Update psa to 0.8.2 Co-authored-by: Cyril Sobierajewicz <sobierajewicz.cyril@gmail.com>
1 parent ac720e4 commit 80b91b4

File tree

22 files changed

+81
-116
lines changed

22 files changed

+81
-116
lines changed

.eslintrc.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"parserOptions": {
3-
"ecmaVersion": 5
3+
"ecmaVersion": 6,
4+
"sourceType": "module"
45
},
56
"extends": "eslint:recommended",
6-
"env": {
7-
"commonjs": true
8-
},
97
"rules": {
108
"strict": [2, "global"],
119
"block-scoped-var": 2,

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
- uses: actions/checkout@v2
1313

1414
- uses: purescript-contrib/setup-purescript@main
15+
with:
16+
purescript: "unstable"
1517

1618
- uses: actions/setup-node@v1
1719
with:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based
55
## [Unreleased]
66

77
Breaking changes:
8+
- Migrated FFI to ES Modules (#287 by @kl0tl and @JordanMartinez)
89

910
New features:
1011

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
},
88
"devDependencies": {
99
"eslint": "^7.15.0",
10-
"purescript-psa": "^0.8.0",
11-
"pulp": "^15.0.0",
10+
"purescript-psa": "^0.8.2",
11+
"pulp": "16.0.0-0",
1212
"rimraf": "^3.0.2"
1313
}
1414
}

src/Control/Apply.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"use strict";
2-
3-
exports.arrayApply = function (fs) {
1+
export const arrayApply = function (fs) {
42
return function (xs) {
53
var l = fs.length;
64
var k = xs.length;

src/Control/Bind.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"use strict";
2-
3-
exports.arrayBind = function (arr) {
1+
export const arrayBind = function (arr) {
42
return function (f) {
53
var result = [];
64
for (var i = 0, l = arr.length; i < l; i++) {

src/Data/Bounded.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
"use strict";
1+
export const topInt = 2147483647;
2+
export const bottomInt = -2147483648;
23

3-
exports.topInt = 2147483647;
4-
exports.bottomInt = -2147483648;
4+
export const topChar = String.fromCharCode(65535);
5+
export const bottomChar = String.fromCharCode(0);
56

6-
exports.topChar = String.fromCharCode(65535);
7-
exports.bottomChar = String.fromCharCode(0);
8-
9-
exports.topNumber = Number.POSITIVE_INFINITY;
10-
exports.bottomNumber = Number.NEGATIVE_INFINITY;
7+
export const topNumber = Number.POSITIVE_INFINITY;
8+
export const bottomNumber = Number.NEGATIVE_INFINITY;

src/Data/Eq.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
"use strict";
2-
31
var refEq = function (r1) {
42
return function (r2) {
53
return r1 === r2;
64
};
75
};
86

9-
exports.eqBooleanImpl = refEq;
10-
exports.eqIntImpl = refEq;
11-
exports.eqNumberImpl = refEq;
12-
exports.eqCharImpl = refEq;
13-
exports.eqStringImpl = refEq;
7+
export const eqBooleanImpl = refEq;
8+
export const eqIntImpl = refEq;
9+
export const eqNumberImpl = refEq;
10+
export const eqCharImpl = refEq;
11+
export const eqStringImpl = refEq;
1412

15-
exports.eqArrayImpl = function (f) {
13+
export const eqArrayImpl = function (f) {
1614
return function (xs) {
1715
return function (ys) {
1816
if (xs.length !== ys.length) return false;

src/Data/EuclideanRing.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
"use strict";
2-
3-
exports.intDegree = function (x) {
1+
export const intDegree = function (x) {
42
return Math.min(Math.abs(x), 2147483647);
53
};
64

75
// See the Euclidean definition in
86
// https://en.m.wikipedia.org/wiki/Modulo_operation.
9-
exports.intDiv = function (x) {
7+
export const intDiv = function (x) {
108
return function (y) {
119
if (y === 0) return 0;
1210
return y > 0 ? Math.floor(x / y) : -Math.floor(x / -y);
1311
};
1412
};
1513

16-
exports.intMod = function (x) {
14+
export const intMod = function (x) {
1715
return function (y) {
1816
if (y === 0) return 0;
1917
var yy = Math.abs(y);
2018
return ((x % yy) + yy) % yy;
2119
};
2220
};
2321

24-
exports.numDiv = function (n1) {
22+
export const numDiv = function (n1) {
2523
return function (n2) {
2624
return n1 / n2;
2725
};

src/Data/Functor.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"use strict";
2-
3-
exports.arrayMap = function (f) {
1+
export const arrayMap = function (f) {
42
return function (arr) {
53
var l = arr.length;
64
var result = new Array(l);

0 commit comments

Comments
 (0)