diff --git a/.eslintrc.json b/.eslintrc.json index cb9c786..3a97d05 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,10 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", "env": { - "commonjs": true, "browser": true }, "rules": { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 063845e..06ed895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 6affe6a..49a9376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 (#12 by @JordanMartinez) New features: diff --git a/bower.json b/bower.json index 4ba6908..563cd8d 100644 --- a/bower.json +++ b/bower.json @@ -15,7 +15,7 @@ "package.json" ], "dependencies": { - "purescript-arraybuffer-types": "^3.0.0", - "purescript-web-file": "^3.0.0" + "purescript-arraybuffer-types": "main", + "purescript-web-file": "master" } } diff --git a/package.json b/package.json index 1c67b54..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/Web/Socket/Event/CloseEvent.js b/src/Web/Socket/Event/CloseEvent.js index 88734db..d52f621 100644 --- a/src/Web/Socket/Event/CloseEvent.js +++ b/src/Web/Socket/Event/CloseEvent.js @@ -1,13 +1,11 @@ -"use strict"; - -exports.code = function (e) { +export function code(e) { return e.code; -}; +} -exports.reason = function (e) { +export function reason(e) { return e.reason; -}; +} -exports.wasClean = function (e) { +export function wasClean(e) { return e.wasClean; -}; +} diff --git a/src/Web/Socket/Event/MessageEvent.js b/src/Web/Socket/Event/MessageEvent.js index 62472b6..a4fea20 100644 --- a/src/Web/Socket/Event/MessageEvent.js +++ b/src/Web/Socket/Event/MessageEvent.js @@ -1,13 +1,11 @@ -"use strict"; - -exports.data_ = function (e) { +export function data_(e) { return e.data; -}; +} -exports.origin = function (e) { +export function origin(e) { return e.origin; -}; +} -exports.lastEventId = function (e) { +export function lastEventId(e) { return e.lastEventId; -}; +} diff --git a/src/Web/Socket/WebSocket.js b/src/Web/Socket/WebSocket.js index 77405ab..9f5fc4d 100644 --- a/src/Web/Socket/WebSocket.js +++ b/src/Web/Socket/WebSocket.js @@ -1,67 +1,65 @@ -"use strict"; - -exports.create = function (url) { +export function create(url) { return function (protocols) { return function () { return new WebSocket(url, protocols); }; }; -}; +} -exports.url = function (ws) { +export function url(ws) { return function () { return ws.url; }; -}; +} -exports.readyStateImpl = function (ws) { +export function readyStateImpl(ws) { return function () { return ws.readyState; }; -}; +} -exports.bufferedAmount = function (ws) { +export function bufferedAmount(ws) { return function () { return ws.bufferedAmount; }; -}; +} -exports.extensions = function (ws) { +export function extensions(ws) { return function () { return ws.extensions; }; -}; +} -exports.protocol = function (ws) { +export function protocol(ws) { return function () { return ws.protocol; }; -}; +} -exports.close = function (ws) { +export function close(ws) { return function () { return ws.close(); }; -}; +} -exports.getBinaryTypeImpl = function (ws) { +export function getBinaryTypeImpl(ws) { return function () { return ws.binaryType; }; -}; +} -exports.setBinaryTypeImpl = function (ws) { +export function setBinaryTypeImpl(ws) { return function (bt) { return function () { ws.binaryType = bt; }; }; -}; +} -exports.sendImpl = function (ws) { +export function sendImpl(ws) { return function (value) { return function () { ws.send(value); }; }; -}; +}