Skip to content

Commit

Permalink
Update to PureScript v0.15.0 (#34)
Browse files Browse the repository at this point in the history
* ESM conversion

The changes are interesting WRT require, as it should still be in existance in ESM but
is CJS specific

https://nodejs.org/api/esm.html#require

__filename and __dirname are probably broken

* Arrow/let transformation

* Missing export

* Fix process export

* Bad process export

* Breaking: Remove Node.Globals

Some of these bindings are no longer available with es modules, and all of them are
dodgy (and probably in the wrong place).

* 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

* Add changelog entry

* Update ci.yml to v2

* Update src/Node/Process.js

* Update eslintrc

* Readd environment section to eslint

Co-authored-by: Nicholas Wolverson <[email protected]>
Co-authored-by: Thomas Honeyman <[email protected]>
  • Loading branch information
3 people authored Mar 22, 2022
1 parent e1e807a commit e636d1d
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 99 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"parserOptions": {
"ecmaVersion": 5
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": "eslint:recommended",
"env": {
"commonjs": true,
"node": true
},
"rules": {
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ jobs:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"

- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: "10"
node-version: "14"

- name: Install dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based
## [Unreleased]

Breaking changes:
- Update project and deps to PureScript v0.15.0 (#34 by @nwolverson, @JordanMartinez, @sigma-andex)

New features:

Expand Down
14 changes: 7 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"output"
],
"dependencies": {
"purescript-effect": "^3.0.0",
"purescript-foreign-object": "^3.0.0",
"purescript-maybe": "^5.0.0",
"purescript-node-streams": "^5.0.0",
"purescript-posix-types": "^5.0.0",
"purescript-prelude": "^5.0.0",
"purescript-unsafe-coerce": "^5.0.0"
"purescript-effect": "master",
"purescript-foreign-object": "master",
"purescript-maybe": "master",
"purescript-node-streams": "master",
"purescript-posix-types": "master",
"purescript-prelude": "master",
"purescript-unsafe-coerce": "master"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,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"
}
}
11 changes: 0 additions & 11 deletions src/Node/Globals.js

This file was deleted.

26 changes: 0 additions & 26 deletions src/Node/Globals.purs

This file was deleted.

89 changes: 40 additions & 49 deletions src/Node/Process.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,70 @@
"use strict";
import process from "process";
export { process };

exports.process = process;

exports.onBeforeExit = function (callback) {
return function () {
export function onBeforeExit(callback) {
return () => {
process.on("beforeExit", callback);
};
};
}

exports.onExit = function (callback) {
return function () {
process.on("exit", function (code) {
export function onExit(callback) {
return () => {
process.on("exit", code => {
callback(code)();
});
};
};
}

exports.onUncaughtException = function (callback) {
return function () {
process.on("uncaughtException", function (error) {
export function onUncaughtException(callback) {
return () => {
process.on("uncaughtException", error => {
callback(error)();
});
};
};
}

exports.onUnhandledRejection = function (callback) {
return function () {
process.on("unhandledRejection", function (error, promise) {
export function onUnhandledRejection(callback) {
return () => {
process.on("unhandledRejection", (error, promise) => {
callback(error)(promise)();
});
};
};
}

exports.onSignalImpl = function (signal) {
return function (callback) {
return function () {
process.on(signal, callback);
};
export function onSignalImpl(signal) {
return callback => () => {
process.on(signal, callback);
};
};
}

exports.chdir = function (dir) {
return function () {
export function chdir(dir) {
return () => {
process.chdir(dir);
};
};
}

exports.setEnv = function (var_) {
return function (val) {
return function () {
process.env[var_] = val;
};
export function setEnv(var_) {
return val => () => {
process.env[var_] = val;
};
};
}

exports.unsetEnv = function (var_) {
return function () {
export function unsetEnv(var_) {
return () => {
delete process.env[var_];
};
};
}

exports.exit = function (code) {
return function () {
export function exit(code) {
return () => {
process.exit(code);
};
};
}

exports.copyArray = function (xs) {
return function () {
return xs.slice();
};
};
export function copyArray(xs) {
return () => xs.slice();
}

exports.copyObject = function (o) {
return function () {
return Object.assign({}, o);
};
};
export function copyObject(o) {
return () => Object.assign({}, o);
}

0 comments on commit e636d1d

Please sign in to comment.