Skip to content

Commit 4dcfd77

Browse files
Update to PureScript v0.15.0 (#46)
* ESM conversion * Arrow transformation * Update .eslintrc.json to ES6 * Update Bower dependencies to master or main * Update pulp to 16.0.0-0 and psa to 0.8.2 * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update to node v14 Co-authored-by: Nicholas Wolverson <[email protected]>
1 parent 0721f1e commit 4dcfd77

File tree

7 files changed

+101
-106
lines changed

7 files changed

+101
-106
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

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ 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:
19-
node-version: "10"
21+
node-version: "14"
2022

2123
- name: Install dependencies
2224
run: |

bower.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"url": "https://github.com/purescript-node/purescript-node-buffer.git"
1414
},
1515
"dependencies": {
16-
"purescript-arraybuffer-types": "^3.0.0",
17-
"purescript-effect": "^3.0.0",
18-
"purescript-maybe": "^5.0.0",
19-
"purescript-st": "^5.0.0",
20-
"purescript-unsafe-coerce": "^5.0.0"
16+
"purescript-arraybuffer-types": "main",
17+
"purescript-effect": "master",
18+
"purescript-maybe": "master",
19+
"purescript-st": "master",
20+
"purescript-unsafe-coerce": "master"
2121
},
2222
"devDependencies": {
23-
"purescript-assert": "^5.0.0",
24-
"purescript-console": "^5.0.0",
25-
"purescript-foldable-traversable": "^5.0.0"
23+
"purescript-assert": "master",
24+
"purescript-console": "master",
25+
"purescript-foldable-traversable": "master"
2626
}
2727
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
},
99
"devDependencies": {
1010
"eslint": "^7.15.0",
11-
"pulp": "^15.0.0",
12-
"purescript-psa": "^0.8.0",
11+
"pulp": "16.0.0-0",
12+
"purescript-psa": "^0.8.2",
1313
"rimraf": "^3.0.2"
1414
}
1515
}

src/Node/Buffer/Immutable.js

+49-50
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,99 @@
11
/* global Buffer */
2-
"use strict";
2+
import { inspect } from "util";
3+
export const showImpl = inspect;
34

4-
exports.showImpl = require("util").inspect;
5-
6-
exports.eqImpl = function (a) {
7-
return function (b) {
5+
export function eqImpl(a) {
6+
return b => {
87
return a.equals(b);
98
};
10-
};
9+
}
1110

12-
exports.compareImpl = function (a) {
13-
return function (b) {
11+
export function compareImpl(a) {
12+
return b => {
1413
return a.compare(b);
1514
};
16-
};
15+
}
1716

18-
exports.create = function (size) {
17+
export function create(size) {
1918
return Buffer.alloc(size);
20-
};
19+
}
2120

22-
exports.fromArray = function (octets) {
21+
export function fromArray(octets) {
2322
return Buffer.from(octets);
24-
};
23+
}
2524

26-
exports.size = function (buff) {
25+
export function size(buff) {
2726
return buff.length;
28-
};
27+
}
2928

30-
exports.toArray = function (buff) {
29+
export function toArray(buff) {
3130
var json = buff.toJSON();
3231
return json.data || json;
33-
};
32+
}
3433

35-
exports.toArrayBuffer = function (buff) {
34+
export function toArrayBuffer(buff) {
3635
return buff.buffer.slice(buff.byteOffset, buff.byteOffset + buff.byteLength);
37-
};
36+
}
3837

39-
exports.fromArrayBuffer = function (ab) {
38+
export function fromArrayBuffer(ab) {
4039
return Buffer.from(ab);
41-
};
40+
}
4241

43-
exports.fromStringImpl = function (str) {
44-
return function (encoding) {
42+
export function fromStringImpl(str) {
43+
return encoding => {
4544
return Buffer.from(str, encoding);
4645
};
47-
};
46+
}
4847

49-
exports.readImpl = function (ty) {
50-
return function (offset) {
51-
return function (buf) {
48+
export function readImpl(ty) {
49+
return offset => {
50+
return buf => {
5251
return buf["read" + ty](offset);
5352
};
5453
};
55-
};
54+
}
5655

57-
exports.readStringImpl = function (enc) {
58-
return function (start) {
59-
return function (end) {
60-
return function (buff) {
56+
export function readStringImpl(enc) {
57+
return start => {
58+
return end => {
59+
return buff => {
6160
return buff.toString(enc, start, end);
6261
};
6362
};
6463
};
65-
};
64+
}
6665

67-
exports.getAtOffsetImpl = function (just) {
68-
return function (nothing) {
69-
return function (offset) {
70-
return function (buff) {
66+
export function getAtOffsetImpl(just) {
67+
return nothing => {
68+
return offset => {
69+
return buff => {
7170
var octet = buff[offset];
7271
return octet == null ? nothing : just(octet);
7372
};
7473
};
7574
};
76-
};
75+
}
7776

78-
exports.toStringImpl = function (enc) {
79-
return function (buff) {
77+
export function toStringImpl(enc) {
78+
return buff => {
8079
return buff.toString(enc);
8180
};
82-
};
81+
}
8382

84-
exports.slice = function (start) {
85-
return function (end) {
86-
return function (buff) {
83+
export function slice(start) {
84+
return end => {
85+
return buff => {
8786
return buff.slice(start, end);
8887
};
8988
};
90-
};
89+
}
9190

92-
exports.concat = function (buffs) {
91+
export function concat(buffs) {
9392
return Buffer.concat(buffs);
94-
};
93+
}
9594

96-
exports.concatToLength = function (buffs) {
97-
return function (totalLength) {
95+
export function concatToLength(buffs) {
96+
return totalLength => {
9897
return Buffer.concat(buffs, totalLength);
9998
};
100-
};
99+
}

src/Node/Buffer/Internal.js

+34-36
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,68 @@
11
/* global Buffer */
2-
"use strict";
3-
4-
exports.copyAll = function (a) {
5-
return function () {
2+
export function copyAll(a) {
3+
return () => {
64
return Buffer.from(a);
75
};
8-
};
6+
}
97

10-
exports.writeInternal = function (ty) {
11-
return function (value) {
12-
return function (offset) {
13-
return function (buf) {
14-
return function () {
8+
export function writeInternal(ty) {
9+
return value => {
10+
return offset => {
11+
return buf => {
12+
return () => {
1513
buf["write" + ty](value, offset);
1614
};
1715
};
1816
};
1917
};
20-
};
18+
}
2119

22-
exports.writeStringInternal = function (encoding) {
23-
return function (offset) {
24-
return function (length) {
25-
return function (value) {
26-
return function (buff) {
27-
return function () {
20+
export function writeStringInternal(encoding) {
21+
return offset => {
22+
return length => {
23+
return value => {
24+
return buff => {
25+
return () => {
2826
return buff.write(value, offset, length, encoding);
2927
};
3028
};
3129
};
3230
};
3331
};
34-
};
32+
}
3533

36-
exports.setAtOffset = function (value) {
37-
return function (offset) {
38-
return function (buff) {
39-
return function () {
34+
export function setAtOffset(value) {
35+
return offset => {
36+
return buff => {
37+
return () => {
4038
buff[offset] = value;
4139
};
4240
};
4341
};
44-
};
42+
}
4543

46-
exports.copy = function (srcStart) {
47-
return function (srcEnd) {
48-
return function (src) {
49-
return function (targStart) {
50-
return function (targ) {
51-
return function () {
44+
export function copy(srcStart) {
45+
return srcEnd => {
46+
return src => {
47+
return targStart => {
48+
return targ => {
49+
return () => {
5250
return src.copy(targ, targStart, srcStart, srcEnd);
5351
};
5452
};
5553
};
5654
};
5755
};
58-
};
56+
}
5957

60-
exports.fill = function (octet) {
61-
return function (start) {
62-
return function (end) {
63-
return function (buf) {
64-
return function () {
58+
export function fill(octet) {
59+
return start => {
60+
return end => {
61+
return buf => {
62+
return () => {
6563
buf.fill(octet, start, end);
6664
};
6765
};
6866
};
6967
};
70-
};
68+
}

src/Node/Encoding.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* global Buffer */
2-
"use strict";
3-
4-
exports.byteLengthImpl = function (str) {
5-
return function (enc) {
2+
export function byteLengthImpl(str) {
3+
return enc => {
64
return Buffer.byteLength(str, enc);
75
};
8-
};
6+
}

0 commit comments

Comments
 (0)