Update JS impls: use ffi-napi and Ubuntu 18.04
authorJoel Martin <github@martintribe.org>
Wed, 28 Nov 2018 23:12:17 +0000 (17:12 -0600)
committerJoel Martin <github@martintribe.org>
Wed, 28 Nov 2018 23:12:17 +0000 (17:12 -0600)
44 files changed:
.gitignore
clojure/Dockerfile
clojure/package.json
clojure/project.clj
clojure/src/mal/node_readline.js
clojure/src/mal/readline.cljs
coffee/Dockerfile
coffee/node_readline.coffee
coffee/package.json
crystal/Dockerfile
elm/Dockerfile
elm/node_readline.js
elm/package.json
es6/Dockerfile
es6/core.mjs
es6/node_readline.js
es6/package.json
es6/run
es6/step0_repl.mjs
es6/step1_read_print.mjs
es6/step2_eval.mjs
es6/step3_env.mjs
es6/step4_if_fn_do.mjs
es6/step5_tco.mjs
es6/step6_file.mjs
es6/step7_quote.mjs
es6/step8_macros.mjs
es6/step9_try.mjs
es6/stepA_mal.mjs
haxe/Dockerfile
haxe/node_readline.js
haxe/package.json
js/Dockerfile
js/node_readline.js
js/package.json
livescript/Dockerfile
livescript/node_readline.js
livescript/package.json
miniMAL/Dockerfile
miniMAL/node_readline.js
miniMAL/package.json
ts/Dockerfile
ts/node_readline.ts
ts/package.json

index a7558f6..f3eac16 100644 (file)
@@ -71,6 +71,8 @@ haxe/*.js
 java/mal.jar
 java/target/
 java/dependency-reduced-pom.xml
+.npm/
+.node-gyp/
 js/mal.js
 js/web/mal.js
 kotlin/*.jar
@@ -103,6 +105,7 @@ ps/mal.ps
 python/mal.pyz
 r/mal.r
 ruby/mal.rb
+.cargo/
 rust/target/
 rust/Cargo.lock
 rust/.cargo
index 5060a80..2d1dea4 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:17.10
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -40,12 +40,15 @@ ENV LEIN_JVM_OPTS -Duser.home=/mal
 # For building node modules
 RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 8.X
-RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
-# Install nodejs.
+# Install nodejs
 RUN apt-get -y install nodejs
 
+ENV NPM_CONFIG_CACHE /mal/.npm
+
 ## Install ffi and lumo-cljs modules globally
 #RUN npm install -g ffi lumo-cljs
 
index e224825..904cd36 100644 (file)
@@ -3,7 +3,7 @@
     "version": "0.0.1",
     "description": "Make a Lisp (mal) language implemented in ClojureScript",
     "dependencies": {
-        "ffi": "2.2.x",
-        "lumo-cljs": "1.7.x"
+        "ffi-napi": "2.4.x",
+        "lumo-cljs": "1.9.x"
     }
 }
index f2eea93..5bb5f96 100644 (file)
@@ -1,7 +1,7 @@
 (defproject mal "0.0.1-SNAPSHOT"
   :description "Make-A-Lisp"
 
-  :dependencies [[org.clojure/clojure "1.8.0-RC4"]
+  :dependencies [[org.clojure/clojure "1.9.0"]
                  [org.clojure/tools.reader "0.8.3"]
                  [net.n01se/clojure-jna "1.0.0"]]
 
index dc64e3f..6042eaa 100644 (file)
@@ -6,7 +6,7 @@ var HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history');
 
 var rlwrap = {}; // namespace for this module in web context
 
-var ffi = require('ffi'),
+var ffi = require('ffi-napi'),
     fs = require('fs');
 
 var rllib = ffi.Library(RL_LIB, {
index 88f3117..ea21874 100644 (file)
@@ -1,3 +1,3 @@
 (ns mal.readline)
 
-(def readline (.-readline (js/require "./src/mal/node_readline.js")))
+(def readline (.-readline (js/require "../src/mal/node_readline.js")))
index 895a563..075c304 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:vivid
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -24,18 +24,16 @@ WORKDIR /mal
 # For building node modules
 RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 0.12 stable
-RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
 # Install nodejs
 RUN apt-get -y install nodejs
 
-# Link common name
-RUN ln -sf nodejs /usr/bin/node
-
 ENV NPM_CONFIG_CACHE /mal/.npm
 
 # CoffeeScript specific
-RUN npm install -g coffee-script
+RUN npm install -g coffeescript
 RUN touch /.coffee_history && chmod go+w /.coffee_history
 
index 87c8d37..fecddc8 100644 (file)
@@ -6,7 +6,7 @@ HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history')
 
 rlwrap = {} # namespace for this module in web context
 
-ffi = require('ffi')
+ffi = require('ffi-napi')
 fs = require('fs')
 
 rllib = ffi.Library(RL_LIB, {
index d28b74b..9850858 100644 (file)
@@ -3,7 +3,7 @@
     "version": "0.0.1",
     "description": "Make a Lisp (mal) language implemented in CoffeeScript",
     "dependencies": {
-        "ffi": "1.3.x",
-        "coffee-script": "~1.8"
+        "ffi-napi": "2.4.x",
+        "coffeescript": "~1.8"
     }
 }
index 1c24bbd..0d02375 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:vivid
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -25,6 +25,6 @@ WORKDIR /mal
 RUN apt-get -y install g++
 
 # Crystal
-RUN apt-get -y install apt-transport-https
+RUN apt-get -y install apt-transport-https gnupg
 RUN curl http://dist.crystal-lang.org/apt/setup.sh | bash
 RUN apt-get -y install crystal
index 5b3bc3e..b0553bd 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:xenial
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -21,14 +21,18 @@ WORKDIR /mal
 # Specific implementation requirements
 ##########################################################
 
-# For building node modules and pulling elm packages
-RUN apt-get -y install g++ netbase
+# For building node modules
+RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 7.X
-RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
 # Install nodejs
 RUN apt-get -y install nodejs
 
+# For pulling elm packages
+RUN apt-get -y install netbase
+
 ENV HOME /mal
 ENV NPM_CONFIG_CACHE /mal/.npm
index e59a62b..0a50f91 100644 (file)
@@ -6,7 +6,7 @@ var HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history');
 
 var rlwrap = {}; // namespace for this module in web context
 
-var ffi = require('ffi'),
+var ffi = require('ffi-napi'),
     fs = require('fs');
 
 var rllib = ffi.Library(RL_LIB, {
index dfbc2c7..67d4127 100644 (file)
@@ -4,7 +4,7 @@
   "description": "",
   "main": "bootstrap.js",
   "dependencies": {
-    "ffi": "2.0.x"
+    "ffi-napi": "2.4.x"
   },
   "devDependencies": {
     "elm": "^0.18.0"
index ddcadb5..f7677e9 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:xenial
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -24,11 +24,11 @@ WORKDIR /mal
 # For building node modules
 RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 7.X
-RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
 # Install nodejs
 RUN apt-get -y install nodejs
 
-# Link common name
 ENV NPM_CONFIG_CACHE /mal/.npm
index 64a7436..d99c3c5 100644 (file)
@@ -1,15 +1,17 @@
 import { _equal_Q, _clone, _keyword, _keyword_Q } from './types'
 import { _list_Q, Vector, _assoc_BANG, Atom } from './types'
 import { pr_str } from './printer'
-import { readline } from './node_readline'
+import rl from './node_readline'
+const readline = rl.readline
 import { read_str } from './reader'
+import { readFileSync } from 'fs'
 
 function _error(e) { throw new Error(e) }
 
 // String functions
 function slurp(f) {
-    if (typeof require !== 'undefined') {
-        return require('fs').readFileSync(f, 'utf-8')
+    if (typeof process !== 'undefined') {
+        return readFileSync(f, 'utf-8')
     } else {
         var req = new XMLHttpRequest()
         req.open('GET', f, false)
index 9e2fb86..500f892 100644 (file)
@@ -4,7 +4,7 @@ var RL_LIB = "libreadline";  // NOTE: libreadline is GPL
 
 var HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history');
 
-var ffi = require('ffi'),
+var ffi = require('ffi-napi'),
     fs = require('fs');
 
 var rllib = ffi.Library(RL_LIB, {
index 627da97..850dff0 100644 (file)
@@ -3,10 +3,10 @@
     "version": "0.0.1",
     "description": "Make a Lisp (mal) language implemented in ES6 (ECMAScript 6 / ECMAScript 2015)",
     "dependencies": {
-        "@std/esm": "^0.11.0",
-        "ffi": "2.0.x"
+        "esm": "3.0.x",
+        "ffi-napi": "2.4.x"
     },
-    "@std/esm": {
+    "esm": {
         "cjs": true
     }
 }
diff --git a/es6/run b/es6/run
index a6c8bf8..ad5a837 100755 (executable)
--- a/es6/run
+++ b/es6/run
@@ -1,2 +1,2 @@
 #!/bin/bash
-exec node -r @std/esm $(dirname $0)/${STEP:-stepA_mal}.mjs "${@}"
+exec node -r esm $(dirname $0)/${STEP:-stepA_mal}.mjs "${@}"
index 6679a09..6eaca05 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 
 // read
 const READ = str => str
index 6ff1cee..8af709f 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
 
index 40abe09..f49b78a 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index 0026b34..034315a 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index 4fe1f90..e3c7073 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index 7bcb778..bf83f4a 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q, _malfunc, _malfunc_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index 7396197..1053976 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q, _malfunc, _malfunc_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index 947c3a2..31642da 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q, _malfunc, _malfunc_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index 9aa6e1c..e106975 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q, _malfunc, _malfunc_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index ede914d..389c1c8 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q, _malfunc, _malfunc_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index c883980..a861993 100644 (file)
@@ -1,4 +1,5 @@
-import { readline } from './node_readline'
+import rl from './node_readline.js'
+const readline = rl.readline
 import { _list_Q, _malfunc, _malfunc_Q } from './types'
 import { BlankException, read_str } from './reader'
 import { pr_str } from './printer'
index 545c7a6..a0b5572 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:vivid
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -27,15 +27,13 @@ WORKDIR /mal
 # For building node modules
 RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 0.12 stable
-RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
 # Install nodejs
 RUN apt-get -y install nodejs
 
-# Link common name
-RUN ln -sf nodejs /usr/bin/node
-
 ENV NPM_CONFIG_CACHE /mal/.npm
 
 
index 2045d66..80885cf 100644 (file)
@@ -6,7 +6,7 @@ var HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history');
 
 var rlwrap = {}; // namespace for this module in web context
 
-var ffi = require('ffi'),
+var ffi = require('ffi-napi'),
     fs = require('fs');
 
 var rllib = ffi.Library(RL_LIB, {
index 34fc239..e84e49a 100644 (file)
@@ -3,6 +3,6 @@
     "version": "0.0.1",
     "description": "Make a Lisp (mal) language implemented in Haxe/Javascript",
     "dependencies": {
-        "ffi": "1.3.x"
+        "ffi-napi": "2.4.x"
     }
 }
index 0559f7a..f7677e9 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:vivid
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -24,14 +24,11 @@ WORKDIR /mal
 # For building node modules
 RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 0.12 stable
-RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
 # Install nodejs
 RUN apt-get -y install nodejs
 
-# Link common name
-RUN ln -sf nodejs /usr/bin/node
-
 ENV NPM_CONFIG_CACHE /mal/.npm
-
index dc64e3f..6042eaa 100644 (file)
@@ -6,7 +6,7 @@ var HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history');
 
 var rlwrap = {}; // namespace for this module in web context
 
-var ffi = require('ffi'),
+var ffi = require('ffi-napi'),
     fs = require('fs');
 
 var rllib = ffi.Library(RL_LIB, {
index 4eec270..e6246a8 100644 (file)
@@ -3,6 +3,6 @@
     "version": "0.0.1",
     "description": "Make a Lisp (mal) language implemented in Javascript",
     "dependencies": {
-        "ffi": "2.0.x"
+        "ffi-napi": "2.4.x"
     }
 }
index edfa694..f7677e9 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:xenial
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -24,11 +24,11 @@ WORKDIR /mal
 # For building node modules
 RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 7.X
-RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
 # Install nodejs
 RUN apt-get -y install nodejs
 
 ENV NPM_CONFIG_CACHE /mal/.npm
-
index e59a62b..0a50f91 100644 (file)
@@ -6,7 +6,7 @@ var HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history');
 
 var rlwrap = {}; // namespace for this module in web context
 
-var ffi = require('ffi'),
+var ffi = require('ffi-napi'),
     fs = require('fs');
 
 var rllib = ffi.Library(RL_LIB, {
index af94704..fe5b589 100644 (file)
@@ -4,11 +4,11 @@
   "description": "",
   "main": "index.js",
   "dependencies": {
-    "ffi": "2.0.x",
+    "ffi-napi": "2.4.x",
     "prelude-ls": "^1.1.2"
   },
   "devDependencies": {
-    "livescript": "^1.5.0"
+    "livescript": "^1.6.0"
   },
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1"
index 152c82a..fa54933 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:xenial
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -24,15 +24,13 @@ WORKDIR /mal
 # For building node modules
 RUN apt-get -y install g++
 
-# Add nodesource apt repo config for 7.X
-RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
 
 # Install nodejs
 RUN apt-get -y install nodejs
 
-# Link common name
-RUN ln -sf nodejs /usr/bin/node
-
 ENV NPM_CONFIG_CACHE /mal/.npm
 
 # install miniMAL
index dc64e3f..6042eaa 100644 (file)
@@ -6,7 +6,7 @@ var HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history');
 
 var rlwrap = {}; // namespace for this module in web context
 
-var ffi = require('ffi'),
+var ffi = require('ffi-napi'),
     fs = require('fs');
 
 var rllib = ffi.Library(RL_LIB, {
index 0c87452..bd9e2cf 100644 (file)
@@ -4,6 +4,6 @@
     "description": "Make a Lisp (mal) language implemented in miniMAL",
     "dependencies": {
         "minimal-lisp": "1.0.2",
-        "ffi": "2.0.x"
+        "ffi-napi": "2.4.x"
     }
 }
index 1bb0452..f7677e9 100644 (file)
@@ -1,4 +1,4 @@
-FROM ubuntu:xenial
+FROM ubuntu:18.04
 MAINTAINER Joel Martin <github@martintribe.org>
 
 ##########################################################
@@ -21,8 +21,14 @@ WORKDIR /mal
 # Specific implementation requirements
 ##########################################################
 
-RUN apt-get -y install build-essential
-RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
+# For building node modules
+RUN apt-get -y install g++
+
+# Add nodesource apt repo config for 10.x stable
+RUN apt-get -y install gnupg
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
+
+# Install nodejs
 RUN apt-get -y install nodejs
 
 ENV NPM_CONFIG_CACHE /mal/.npm
index cc0af94..6018c92 100644 (file)
@@ -1,5 +1,5 @@
 import * as path from "path";
-import * as ffi from "ffi";
+import * as ffi from "ffi-napi";
 import * as fs from "fs";
 
 // IMPORTANT: choose one
index 162c752..6a5bd97 100644 (file)
     "test:stepA": "cd .. && make 'test^ts^stepA'"
   },
   "dependencies": {
-    "ffi": "^2.2.0"
+    "ffi-napi": "^2.4.0"
   },
   "devDependencies": {
-    "@types/ffi": "0.0.19",
+    "@types/ffi-napi": "2.4.0",
     "@types/node": "^7.0.5",
     "typescript": "^2.2.1",
     "typescript-formatter": "^4.1.2"