From dedc714f0d2de6fc4a3c0cfb91475b931e388db3 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Mon, 14 Mar 2022 09:32:29 -0700 Subject: [PATCH] Update to v0.15.0 (#39) * Convert foreign modules to try bundling with esbuild * Replaced 'export var' with 'export const' * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update pulp to 16.0.0-0 and psa to 0.8.2 * Update Bower dependencies to master * Update .eslintrc.json to ES6 * Added changelog entry Co-authored-by: Cyril Sobierajewicz --- .eslintrc.json | 6 ++---- .github/workflows/ci.yml | 2 ++ CHANGELOG.md | 1 + bower.json | 6 +++--- package.json | 4 ++-- src/Effect/Ref.js | 12 +++++------- src/Effect/Ref.purs | 5 ++++- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 84cef4f..1c6afb9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,9 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", - "env": { - "commonjs": true - }, "rules": { "strict": [2, "global"], "block-scoped-var": 2, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d2897..b6ebf3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 36d5020..7998480 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 (#39 by @kl0tl and @JordanMartinez) New features: diff --git a/bower.json b/bower.json index 495322f..0e4cc9b 100644 --- a/bower.json +++ b/bower.json @@ -16,10 +16,10 @@ "package.json" ], "dependencies": { - "purescript-effect": "^3.0.0", - "purescript-prelude": "^5.0.0" + "purescript-effect": "master", + "purescript-prelude": "master" }, "devDependencies": { - "purescript-assert": "^5.0.0" + "purescript-assert": "master" } } diff --git a/package.json b/package.json index 8a83ad5..e6d4187 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,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/Effect/Ref.js b/src/Effect/Ref.js index a4f98fc..6427e0d 100644 --- a/src/Effect/Ref.js +++ b/src/Effect/Ref.js @@ -1,12 +1,10 @@ -"use strict"; - -exports.new = function (val) { +export const _new = function (val) { return function () { return { value: val }; }; }; -exports.newWithSelf = function (f) { +export const newWithSelf = function (f) { return function () { var ref = { value: null }; ref.value = f(ref); @@ -14,13 +12,13 @@ exports.newWithSelf = function (f) { }; }; -exports.read = function (ref) { +export const read = function (ref) { return function () { return ref.value; }; }; -exports.modifyImpl = function (f) { +export const modifyImpl = function (f) { return function (ref) { return function () { var t = f(ref.value); @@ -30,7 +28,7 @@ exports.modifyImpl = function (f) { }; }; -exports.write = function (val) { +export const write = function (val) { return function (ref) { return function () { ref.value = val; diff --git a/src/Effect/Ref.purs b/src/Effect/Ref.purs index 2dcf74c..115238e 100644 --- a/src/Effect/Ref.purs +++ b/src/Effect/Ref.purs @@ -41,7 +41,10 @@ foreign import data Ref :: Type -> Type type role Ref representational -- | Create a new mutable reference containing the specified value. -foreign import new :: forall s. s -> Effect (Ref s) +foreign import _new :: forall s. s -> Effect (Ref s) + +new :: forall s. s -> Effect (Ref s) +new = _new -- | Create a new mutable reference containing a value that can refer to the -- | `Ref` being created.