Skip to content

Commit 01e3ade

Browse files
Update to PureScript v0.15.0 (#31)
* ESM conversion * Arrow transformations, fix dynamic imports * Fix missing export * Fix fork * Fix process export * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update Bower dependencies to master or main * Update pulp to 16.0.0-0 * Update psa to 0.8.2 * Update Bower dependencies to master or main * Update eslintrc * Fix eslint errors * Update changelog * Update ci.yml to v2 Co-authored-by: Nicholas Wolverson <[email protected]>
1 parent 5c4e560 commit 01e3ade

File tree

6 files changed

+89
-129
lines changed

6 files changed

+89
-129
lines changed

.eslintrc.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"parserOptions": {
3-
"ecmaVersion": 5
3+
"ecmaVersion": 6,
4+
"sourceType": "module"
45
},
56
"extends": "eslint:recommended",
67
"env": {
7-
"commonjs": true
8+
"node": true
89
},
910
"rules": {
1011
"strict": [2, "global"],

.github/workflows/ci.yml

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

17-
- uses: actions/setup-node@v1
19+
- uses: actions/setup-node@v2
1820
with:
19-
node-version: "10"
21+
node-version: "14"
2022

2123
- name: Install dependencies
2224
run: |

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+
- Update project and deps to PureScript v0.15.0 (#31 by @JordanMartinez, @thomashoneyman, @sigma-andex)
89

910
New features:
1011

bower.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
"package.json"
1717
],
1818
"dependencies": {
19-
"purescript-exceptions": "^5.0.0",
20-
"purescript-foreign": "^6.0.0",
21-
"purescript-foreign-object": "^3.0.0",
22-
"purescript-functions": "^5.0.0",
23-
"purescript-node-fs": "^6.0.0",
24-
"purescript-node-streams": "^5.0.0",
25-
"purescript-nullable": "^5.0.0",
26-
"purescript-posix-types": "^5.0.0",
27-
"purescript-unsafe-coerce": "^5.0.0"
19+
"purescript-exceptions": "master",
20+
"purescript-foreign": "master",
21+
"purescript-foreign-object": "master",
22+
"purescript-functions": "master",
23+
"purescript-node-fs": "master",
24+
"purescript-node-streams": "master",
25+
"purescript-nullable": "main",
26+
"purescript-posix-types": "master",
27+
"purescript-unsafe-coerce": "master"
2828
},
2929
"devDependencies": {
30-
"purescript-console": "^5.0.0"
30+
"purescript-console": "master"
3131
}
3232
}

package.json

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

src/Node/ChildProcess.js

+69-113
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,96 @@
1-
"use strict";
2-
31
/* eslint-env node*/
42

5-
exports.unsafeFromNullable = function unsafeFromNullable(msg) {
6-
return function (x) {
3+
import { spawn, exec, execFile, execSync, execFileSync, fork as cp_fork } from "child_process";
4+
5+
export function unsafeFromNullable(msg) {
6+
return x => {
77
if (x === null) throw new Error(msg);
88
return x;
99
};
10-
};
10+
}
1111

12-
exports.spawnImpl = function spawnImpl(command) {
13-
return function (args) {
14-
return function (opts) {
15-
return function () {
16-
return require("child_process").spawn(command, args, opts);
17-
};
18-
};
19-
};
20-
};
12+
export function spawnImpl(command) {
13+
return args => opts => () => spawn(command, args, opts);
14+
}
2115

22-
exports.execImpl = function execImpl(command) {
23-
return function (opts) {
24-
return function (callback) {
25-
return function () {
26-
return require("child_process").exec(
27-
command,
28-
opts,
29-
function (err, stdout, stderr) {
30-
callback(err)(stdout)(stderr)();
31-
}
32-
);
33-
};
34-
};
35-
};
36-
};
16+
export function execImpl(command) {
17+
return opts => callback => () => exec(
18+
command,
19+
opts,
20+
(err, stdout, stderr) => {
21+
callback(err)(stdout)(stderr)();
22+
}
23+
);
24+
}
3725

38-
exports.execFileImpl = function execImpl(command) {
39-
return function (args) {
40-
return function (opts) {
41-
return function (callback) {
42-
return function () {
43-
return require("child_process").execFile(
44-
command,
45-
args,
46-
opts,
47-
function (err, stdout, stderr) {
48-
callback(err)(stdout)(stderr)();
49-
}
50-
);
51-
};
52-
};
53-
};
54-
};
26+
export const execFileImpl = function execImpl(command) {
27+
return args => opts => callback => () => execFile(
28+
command,
29+
args,
30+
opts,
31+
(err, stdout, stderr) => {
32+
callback(err)(stdout)(stderr)();
33+
}
34+
);
5535
};
5636

57-
exports.execSyncImpl = function execSyncImpl(command) {
58-
return function (opts) {
59-
return function () {
60-
return require("child_process").execSync(command, opts);
61-
};
62-
};
63-
};
37+
export function execSyncImpl(command) {
38+
return opts => () => execSync(command, opts);
39+
}
6440

65-
exports.execFileSyncImpl = function execFileSyncImpl(command) {
66-
return function (args) {
67-
return function (opts) {
68-
return function () {
69-
return require("child_process").execFileSync(command, args, opts);
70-
};
71-
};
72-
};
73-
};
41+
export function execFileSyncImpl(command) {
42+
return args => opts => () => execFileSync(command, args, opts);
43+
}
7444

75-
exports.fork = function fork(cmd) {
76-
return function (args) {
77-
return function () {
78-
return require("child_process").fork(cmd, args);
79-
};
80-
};
81-
};
45+
export function fork(cmd) {
46+
return args => () => cp_fork(cmd, args);
47+
}
8248

83-
exports.mkOnExit = function mkOnExit(mkChildExit) {
49+
export function mkOnExit(mkChildExit) {
8450
return function onExit(cp) {
85-
return function (cb) {
86-
return function () {
87-
cp.on("exit", function (code, signal) {
88-
cb(mkChildExit(code)(signal))();
89-
});
90-
};
51+
return cb => () => {
52+
cp.on("exit", (code, signal) => {
53+
cb(mkChildExit(code)(signal))();
54+
});
9155
};
9256
};
93-
};
57+
}
9458

95-
exports.mkOnClose = function mkOnClose(mkChildExit) {
59+
export function mkOnClose(mkChildExit) {
9660
return function onClose(cp) {
97-
return function (cb) {
98-
return function () {
99-
cp.on("close", function (code, signal) {
100-
cb(mkChildExit(code)(signal))();
101-
});
102-
};
103-
};
104-
};
105-
};
106-
107-
exports.onDisconnect = function onDisconnect(cp) {
108-
return function (cb) {
109-
return function () {
110-
cp.on("disconnect", cb);
61+
return cb => () => {
62+
cp.on("close", (code, signal) => {
63+
cb(mkChildExit(code)(signal))();
64+
});
11165
};
11266
};
113-
};
67+
}
11468

115-
exports.mkOnMessage = function mkOnMessage(nothing) {
116-
return function (just) {
117-
return function onMessage(cp) {
118-
return function (cb) {
119-
return function () {
120-
cp.on("message", function (mess, sendHandle) {
121-
cb(mess, sendHandle ? just(sendHandle) : nothing)();
122-
});
123-
};
124-
};
125-
};
69+
export function onDisconnect(cp) {
70+
return cb => () => {
71+
cp.on("disconnect", cb);
12672
};
127-
};
73+
}
12874

129-
exports.onError = function onError(cp) {
130-
return function (cb) {
131-
return function () {
132-
cp.on("error", function (err) {
133-
cb(err)();
75+
export function mkOnMessage(nothing) {
76+
return just => (function onMessage(cp) {
77+
return cb => () => {
78+
cp.on("message", (mess, sendHandle) => {
79+
cb(mess, sendHandle ? just(sendHandle) : nothing)();
13480
});
13581
};
82+
});
83+
}
84+
85+
export function onError(cp) {
86+
return cb => () => {
87+
cp.on("error", err => {
88+
cb(err)();
89+
});
13690
};
137-
};
91+
}
13892

139-
exports.undefined = undefined;
140-
exports.process = process;
93+
const _undefined = undefined;
94+
export { _undefined as undefined };
95+
import process from "process";
96+
export { process };

0 commit comments

Comments
 (0)