Skip to content

Commit 7f63dbe

Browse files
JordanMartinezkl0tl
andauthoredMar 14, 2022
Update to v0.15.0 (#218)
* Convert foreign modules to try bundling with esbuild * fixup! Convert foreign modules to try bundling with esbuild * Migrated FFI to ES modules via 'lebab' * Replaced 'export var' with 'export const' * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update pulp to 16.0.0-0 and psa to 0.8.2 * Update Bower dependencies to master * Update .eslintrc.json to ES6 * Fix FFI for undefined * Added changelog entry Co-authored-by: Cyril Sobierajewicz <[email protected]>
1 parent 7e264fd commit 7f63dbe

File tree

10 files changed

+76
-81
lines changed

10 files changed

+76
-81
lines changed
 

‎.eslintrc.json

+2-4
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

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
- uses: actions/checkout@v2
1414

1515
- uses: purescript-contrib/setup-purescript@main
16+
with:
17+
purescript: "unstable"
1618

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

‎CHANGELOG.md

+1
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+
- Migrate FFI to ES modules (#218 by @kl0tl and @JordanMartinez)
89

910
New features:
1011

‎bower.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
"package.json"
1616
],
1717
"dependencies": {
18-
"purescript-bifunctors": "^5.0.0",
19-
"purescript-control": "^5.0.0",
20-
"purescript-foldable-traversable": "^5.0.0",
21-
"purescript-maybe": "^5.0.0",
22-
"purescript-nonempty": "^6.0.0",
23-
"purescript-partial": "^3.0.0",
24-
"purescript-prelude": "^5.0.0",
25-
"purescript-st": "^5.0.0",
26-
"purescript-tailrec": "^5.0.0",
27-
"purescript-tuples": "^6.0.0",
28-
"purescript-unfoldable": "^5.0.0",
29-
"purescript-unsafe-coerce": "^5.0.0"
18+
"purescript-bifunctors": "master",
19+
"purescript-control": "master",
20+
"purescript-foldable-traversable": "master",
21+
"purescript-maybe": "master",
22+
"purescript-nonempty": "master",
23+
"purescript-partial": "master",
24+
"purescript-prelude": "master",
25+
"purescript-st": "master",
26+
"purescript-tailrec": "master",
27+
"purescript-tuples": "master",
28+
"purescript-unfoldable": "master",
29+
"purescript-unsafe-coerce": "master"
3030
},
3131
"devDependencies": {
32-
"purescript-assert": "^5.0.0",
33-
"purescript-console": "^5.0.0",
34-
"purescript-const": "^5.0.0",
35-
"purescript-minibench": "^3.0.0"
32+
"purescript-assert": "master",
33+
"purescript-console": "master",
34+
"purescript-const": "master",
35+
"purescript-minibench": "master"
3636
}
3737
}

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
},
1111
"devDependencies": {
1212
"eslint": "^7.15.0",
13-
"pulp": "^15.0.0",
14-
"purescript-psa": "^0.8.0",
13+
"pulp": "16.0.0-0",
14+
"purescript-psa": "^0.8.2",
1515
"rimraf": "^3.0.2"
1616
}
1717
}

‎src/Data/Array.js

+24-26
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
"use strict";
2-
31
//------------------------------------------------------------------------------
42
// Array creation --------------------------------------------------------------
53
//------------------------------------------------------------------------------
64

7-
exports.range = function (start) {
5+
export const range = function (start) {
86
return function (end) {
97
var step = start > end ? -1 : 1;
108
var result = new Array(step * (end - start) + 1);
@@ -40,9 +38,9 @@ var replicatePolyfill = function (count) {
4038
};
4139

4240
// In browsers that have Array.prototype.fill we use it, as it's faster.
43-
exports.replicate = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
41+
export const replicate = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
4442

45-
exports.fromFoldableImpl = (function () {
43+
export const fromFoldableImpl = (function () {
4644
function Cons(head, tail) {
4745
this.head = head;
4846
this.tail = tail;
@@ -77,15 +75,15 @@ exports.fromFoldableImpl = (function () {
7775
// Array size ------------------------------------------------------------------
7876
//------------------------------------------------------------------------------
7977

80-
exports.length = function (xs) {
78+
export const length = function (xs) {
8179
return xs.length;
8280
};
8381

8482
//------------------------------------------------------------------------------
8583
// Non-indexed reads -----------------------------------------------------------
8684
//------------------------------------------------------------------------------
8785

88-
exports.unconsImpl = function (empty) {
86+
export const unconsImpl = function (empty) {
8987
return function (next) {
9088
return function (xs) {
9189
return xs.length === 0 ? empty({}) : next(xs[0])(xs.slice(1));
@@ -97,7 +95,7 @@ exports.unconsImpl = function (empty) {
9795
// Indexed operations ----------------------------------------------------------
9896
//------------------------------------------------------------------------------
9997

100-
exports.indexImpl = function (just) {
98+
export const indexImpl = function (just) {
10199
return function (nothing) {
102100
return function (xs) {
103101
return function (i) {
@@ -107,7 +105,7 @@ exports.indexImpl = function (just) {
107105
};
108106
};
109107

110-
exports.findMapImpl = function (nothing) {
108+
export const findMapImpl = function (nothing) {
111109
return function (isJust) {
112110
return function (f) {
113111
return function (xs) {
@@ -121,7 +119,7 @@ exports.findMapImpl = function (nothing) {
121119
};
122120
};
123121

124-
exports.findIndexImpl = function (just) {
122+
export const findIndexImpl = function (just) {
125123
return function (nothing) {
126124
return function (f) {
127125
return function (xs) {
@@ -134,7 +132,7 @@ exports.findIndexImpl = function (just) {
134132
};
135133
};
136134

137-
exports.findLastIndexImpl = function (just) {
135+
export const findLastIndexImpl = function (just) {
138136
return function (nothing) {
139137
return function (f) {
140138
return function (xs) {
@@ -147,7 +145,7 @@ exports.findLastIndexImpl = function (just) {
147145
};
148146
};
149147

150-
exports._insertAt = function (just) {
148+
export const _insertAt = function (just) {
151149
return function (nothing) {
152150
return function (i) {
153151
return function (a) {
@@ -162,7 +160,7 @@ exports._insertAt = function (just) {
162160
};
163161
};
164162

165-
exports._deleteAt = function (just) {
163+
export const _deleteAt = function (just) {
166164
return function (nothing) {
167165
return function (i) {
168166
return function (l) {
@@ -175,7 +173,7 @@ exports._deleteAt = function (just) {
175173
};
176174
};
177175

178-
exports._updateAt = function (just) {
176+
export const _updateAt = function (just) {
179177
return function (nothing) {
180178
return function (i) {
181179
return function (a) {
@@ -194,11 +192,11 @@ exports._updateAt = function (just) {
194192
// Transformations -------------------------------------------------------------
195193
//------------------------------------------------------------------------------
196194

197-
exports.reverse = function (l) {
195+
export const reverse = function (l) {
198196
return l.slice().reverse();
199197
};
200198

201-
exports.concat = function (xss) {
199+
export const concat = function (xss) {
202200
if (xss.length <= 10000) {
203201
// This method is faster, but it crashes on big arrays.
204202
// So we use it when can and fallback to simple variant otherwise.
@@ -215,13 +213,13 @@ exports.concat = function (xss) {
215213
return result;
216214
};
217215

218-
exports.filter = function (f) {
216+
export const filter = function (f) {
219217
return function (xs) {
220218
return xs.filter(f);
221219
};
222220
};
223221

224-
exports.partition = function (f) {
222+
export const partition = function (f) {
225223
return function (xs) {
226224
var yes = [];
227225
var no = [];
@@ -236,7 +234,7 @@ exports.partition = function (f) {
236234
};
237235
};
238236

239-
exports.scanl = function (f) {
237+
export const scanl = function (f) {
240238
return function (b) {
241239
return function (xs) {
242240
var len = xs.length;
@@ -251,7 +249,7 @@ exports.scanl = function (f) {
251249
};
252250
};
253251

254-
exports.scanr = function (f) {
252+
export const scanr = function (f) {
255253
return function (b) {
256254
return function (xs) {
257255
var len = xs.length;
@@ -270,7 +268,7 @@ exports.scanr = function (f) {
270268
// Sorting ---------------------------------------------------------------------
271269
//------------------------------------------------------------------------------
272270

273-
exports.sortByImpl = (function () {
271+
export const sortByImpl = (function () {
274272
function mergeFromTo(compare, fromOrdering, xs1, xs2, from, to) {
275273
var mid;
276274
var i;
@@ -328,7 +326,7 @@ exports.sortByImpl = (function () {
328326
// Subarrays -------------------------------------------------------------------
329327
//------------------------------------------------------------------------------
330328

331-
exports.slice = function (s) {
329+
export const slice = function (s) {
332330
return function (e) {
333331
return function (l) {
334332
return l.slice(s, e);
@@ -340,7 +338,7 @@ exports.slice = function (s) {
340338
// Zipping ---------------------------------------------------------------------
341339
//------------------------------------------------------------------------------
342340

343-
exports.zipWith = function (f) {
341+
export const zipWith = function (f) {
344342
return function (xs) {
345343
return function (ys) {
346344
var l = xs.length < ys.length ? xs.length : ys.length;
@@ -357,7 +355,7 @@ exports.zipWith = function (f) {
357355
// Folding ---------------------------------------------------------------------
358356
//------------------------------------------------------------------------------
359357

360-
exports.any = function (p) {
358+
export const any = function (p) {
361359
return function (xs) {
362360
var len = xs.length;
363361
for (var i = 0; i < len; i++) {
@@ -367,7 +365,7 @@ exports.any = function (p) {
367365
};
368366
};
369367

370-
exports.all = function (p) {
368+
export const all = function (p) {
371369
return function (xs) {
372370
var len = xs.length;
373371
for (var i = 0; i < len; i++) {
@@ -381,7 +379,7 @@ exports.all = function (p) {
381379
// Partial ---------------------------------------------------------------------
382380
//------------------------------------------------------------------------------
383381

384-
exports.unsafeIndexImpl = function (xs) {
382+
export const unsafeIndexImpl = function (xs) {
385383
return function (n) {
386384
return xs[n];
387385
};

‎src/Data/Array/NonEmpty/Internal.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"use strict";
2-
3-
exports.foldr1Impl = function (f) {
1+
export const foldr1Impl = function (f) {
42
return function (xs) {
53
var acc = xs[xs.length - 1];
64
for (var i = xs.length - 2; i >= 0; i--) {
@@ -10,7 +8,7 @@ exports.foldr1Impl = function (f) {
108
};
119
};
1210

13-
exports.foldl1Impl = function (f) {
11+
export const foldl1Impl = function (f) {
1412
return function (xs) {
1513
var acc = xs[0];
1614
var len = xs.length;
@@ -21,7 +19,7 @@ exports.foldl1Impl = function (f) {
2119
};
2220
};
2321

24-
exports.traverse1Impl = function () {
22+
export const traverse1Impl = function () {
2523
function Cont(fn) {
2624
this.fn = fn;
2725
}

‎src/Data/Array/ST.js

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
"use strict";
2-
3-
exports["new"] = function () {
1+
function newSTArray () {
42
return [];
5-
};
3+
}
4+
export { newSTArray as new };
65

7-
exports.peekImpl = function (just) {
6+
export const peekImpl = function (just) {
87
return function (nothing) {
98
return function (i) {
109
return function (xs) {
@@ -16,7 +15,7 @@ exports.peekImpl = function (just) {
1615
};
1716
};
1817

19-
exports.poke = function (i) {
18+
export const poke = function (i) {
2019
return function (a) {
2120
return function (xs) {
2221
return function () {
@@ -28,7 +27,7 @@ exports.poke = function (i) {
2827
};
2928
};
3029

31-
exports.popImpl = function (just) {
30+
export const popImpl = function (just) {
3231
return function (nothing) {
3332
return function (xs) {
3433
return function () {
@@ -38,15 +37,15 @@ exports.popImpl = function (just) {
3837
};
3938
};
4039

41-
exports.pushAll = function (as) {
40+
export const pushAll = function (as) {
4241
return function (xs) {
4342
return function () {
4443
return xs.push.apply(xs, as);
4544
};
4645
};
4746
};
4847

49-
exports.shiftImpl = function (just) {
48+
export const shiftImpl = function (just) {
5049
return function (nothing) {
5150
return function (xs) {
5251
return function () {
@@ -56,15 +55,15 @@ exports.shiftImpl = function (just) {
5655
};
5756
};
5857

59-
exports.unshiftAll = function (as) {
58+
export const unshiftAll = function (as) {
6059
return function (xs) {
6160
return function () {
6261
return xs.unshift.apply(xs, as);
6362
};
6463
};
6564
};
6665

67-
exports.splice = function (i) {
66+
export const splice = function (i) {
6867
return function (howMany) {
6968
return function (bs) {
7069
return function (xs) {
@@ -76,13 +75,13 @@ exports.splice = function (i) {
7675
};
7776
};
7877

79-
exports.unsafeFreeze = function (xs) {
78+
export const unsafeFreeze = function (xs) {
8079
return function () {
8180
return xs;
8281
};
8382
};
8483

85-
exports.unsafeThaw = function (xs) {
84+
export const unsafeThaw = function (xs) {
8685
return function () {
8786
return xs;
8887
};
@@ -94,11 +93,11 @@ function copyImpl(xs) {
9493
};
9594
}
9695

97-
exports.freeze = copyImpl;
96+
export const freeze = copyImpl;
9897

99-
exports.thaw = copyImpl;
98+
export const thaw = copyImpl;
10099

101-
exports.sortByImpl = (function () {
100+
export const sortByImpl = (function () {
102101
function mergeFromTo(compare, fromOrdering, xs1, xs2, from, to) {
103102
var mid;
104103
var i;
@@ -151,7 +150,7 @@ exports.sortByImpl = (function () {
151150
};
152151
})();
153152

154-
exports.toAssocArray = function (xs) {
153+
export const toAssocArray = function (xs) {
155154
return function () {
156155
var n = xs.length;
157156
var as = new Array(n);

‎src/Data/Array/ST/Partial.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
"use strict";
2-
3-
exports.peekImpl = function (i) {
1+
export const peekImpl = function (i) {
42
return function (xs) {
53
return function () {
64
return xs[i];
75
};
86
};
97
};
108

11-
exports.pokeImpl = function (i) {
9+
export const pokeImpl = function (i) {
1210
return function (a) {
1311
return function (xs) {
1412
return function () {

‎test/Test/Data/UndefinedOr.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
exports.undefined = undefined;
1+
const undefinedImpl = undefined;
2+
export {undefinedImpl as undefined};
23

3-
exports.defined = function (x) {
4+
export function defined(x) {
45
return x;
5-
};
6+
}
67

7-
exports.eqUndefinedOrImpl = function (eq) {
8+
export function eqUndefinedOrImpl(eq) {
89
return function (a) {
910
return function (b) {
1011
return (a === undefined && b === undefined) || eq(a)(b);
1112
};
1213
};
13-
};
14+
}
1415

15-
exports.compareUndefinedOrImpl = function (lt) {
16+
export function compareUndefinedOrImpl(lt) {
1617
return function (eq) {
1718
return function (gt) {
1819
return function (compare) {
@@ -27,4 +28,4 @@ exports.compareUndefinedOrImpl = function (lt) {
2728
};
2829
};
2930
};
30-
};
31+
}

0 commit comments

Comments
 (0)
Please sign in to comment.