Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to PureScript v0.15.0 #8

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,
"browser": 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:
- Migrate FFI to ES modules (#8 by @JordanMartinez)

New features:

Expand Down
18 changes: 9 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"package.json"
],
"dependencies": {
"purescript-effect": "^3.0.0",
"purescript-foreign-object": "^3.0.0",
"purescript-http-methods": "^5.0.0",
"purescript-prelude": "^5.0.0",
"purescript-record": "^3.0.0",
"purescript-typelevel-prelude": "^6.0.0",
"purescript-web-file": "^3.0.0",
"purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#2.0.0",
"purescript-web-streams": "https://github.com/purescript-web/purescript-web-streams.git#2.0.0"
"purescript-effect": "master",
"purescript-foreign-object": "master",
"purescript-http-methods": "main",
"purescript-prelude": "master",
"purescript-record": "master",
"purescript-typelevel-prelude": "master",
"purescript-web-file": "master",
"purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#master",
"purescript-web-streams": "https://github.com/purescript-web/purescript-web-streams.git#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"
}
}
6 changes: 2 additions & 4 deletions src/Web/Fetch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

exports._fetch = function(a, b) {
export function _fetch(a, b) {
return fetch(a, b);
};
}
13 changes: 6 additions & 7 deletions src/Web/Fetch/AbortController.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
"use strict";

exports.new = function() {
const newImpl = function () {
return new AbortController();
};
export { newImpl as new };

exports.abort = function(controller) {
export function abort(controller) {
return function() {
return controller.abort();
};
};
}

exports.signal = function(controller) {
export function signal(controller) {
return controller.signal;
};
}
22 changes: 10 additions & 12 deletions src/Web/Fetch/Headers.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
"use strict";

exports.unsafeNew = function() {
export function unsafeNew() {
return new Headers();
};
}

exports.unsafeAppend = function(key, value, headers) {
export function unsafeAppend(key, value, headers) {
return headers.append(key, value);
};
}

exports.unsafeFromRecord = function(r) {
export function unsafeFromRecord(r) {
return new Headers(r);
};
}

exports._toArray = function(tuple, headers) {
export function _toArray(tuple, headers) {
return Array.from(headers.entries(), function (pair) {
return tuple(pair[0])(pair[1]);
});
};
}

exports.fromObject = function(obj) {
export function fromObject(obj) {
return new Headers(obj);
};
}
6 changes: 2 additions & 4 deletions src/Web/Fetch/Request.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"use strict";

exports._unsafeNew = function(url, options) {
export function _unsafeNew(url, options) {
try {
return new Request(url, options);
} catch (e) {
console.error(e);
throw e;
}
};
}
12 changes: 5 additions & 7 deletions src/Web/Fetch/RequestBody.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";

exports.fromArrayBuffer = function(a) { return a };
exports.fromArrayView = function(a) { return a };
exports.fromString = function(a) { return a };
exports.fromReadableStream = function(a) { return a };
exports.empty = null;
export function fromArrayBuffer(a) { return a }
export function fromArrayView(a) { return a }
export function fromString(a) { return a }
export function fromReadableStream(a) { return a }
export const empty = null;
42 changes: 20 additions & 22 deletions src/Web/Fetch/Response.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
"use strict";

exports.headers = function (resp) {
export function headers(resp) {
return resp.headers;
};
}

exports.ok = function (resp) {
export function ok(resp) {
return resp.ok;
};
}

exports.redirected = function (resp) {
export function redirected(resp) {
return resp.redirected;
};
}

exports.status = function (resp) {
export function status(resp) {
return resp.status;
};
}

exports.statusText = function (resp) {
export function statusText(resp) {
return resp.statusText;
};
}

exports.url = function (resp) {
export function url(resp) {
return resp.url;
};
}

exports.body = function (resp) {
export function body(resp) {
return function() {
return resp.body;
};
};
}

exports.arrayBuffer = function (resp) {
export function arrayBuffer(resp) {
return function() {
return resp.arrayBuffer();
};
};
}

exports.blob = function (resp) {
export function blob(resp) {
return function() {
return resp.blob();
};
};
}

exports.text = function (resp) {
export function text(resp) {
return function() {
return resp.text();
};
};
}