From 6cd9e4afa66aa9a27a461b58bf20827bf2215646 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 25 Apr 2019 10:12:55 +0200 Subject: [PATCH] fix(NAPI): Ref-napi ffi-napi added. Makes use of more modern node APIs --- package.json | 4 +-- src/native/_app.js | 2 +- src/native/_auth.js | 4 +-- src/native/_base.js | 4 +-- src/native/_cipher_opt.js | 2 +- src/native/_crypto.js | 2 +- src/native/_immutable.js | 2 +- src/native/_mutable.js | 2 +- src/native/_nfs.js | 2 +- src/native/_system_uri.js | 4 +-- src/native/_testing.js | 2 +- src/native/lib.js | 2 +- yarn.lock | 53 ++++++++++++++++++++++++++------------- 13 files changed, 51 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 221fdd0..296e8e4 100644 --- a/package.json +++ b/package.json @@ -48,12 +48,12 @@ "cross-env": "5.1.3", "deps_downloader": "https://s3.eu-west-2.amazonaws.com/deps-downloader/deps_downloader-0.3.0.tgz", "enum": "^2.3.0", - "ffi": "^2.3.0", + "ffi-napi": "2.4.5", "mime": "^2.0.3", "multihashes": "^0.4.14", "rdflib": "^0.19.1", - "ref": "^1.3.3", "ref-array": "^1.2.0", + "ref-napi": "1.4.1", "ref-struct": "^1.1.0", "weak-napi": "1.0.3" }, diff --git a/src/native/_app.js b/src/native/_app.js index 4b2154d..181c17e 100644 --- a/src/native/_app.js +++ b/src/native/_app.js @@ -11,7 +11,7 @@ // relating to use of the SAFE Network Software. -const ffi = require('ffi'); +const ffi = require('ffi-napi'); const ref = require("ref"); const Struct = require('ref-struct'); const makeError = require('./_error.js'); diff --git a/src/native/_auth.js b/src/native/_auth.js index d08bf62..c8ccb9a 100644 --- a/src/native/_auth.js +++ b/src/native/_auth.js @@ -11,10 +11,10 @@ // relating to use of the SAFE Network Software. -const ffi = require('ffi'); +const ffi = require('ffi-napi'); const Enum = require('enum'); const ArrayType = require('ref-array'); -const ref = require('ref'); +const ref = require('ref-napi'); const Struct = require('ref-struct'); const base = require('./_base.js'); const makeError = require('./_error.js'); diff --git a/src/native/_base.js b/src/native/_base.js index e8620cb..5c8497c 100644 --- a/src/native/_base.js +++ b/src/native/_base.js @@ -13,8 +13,8 @@ const makeError = require('./_error.js'); const errConst = require('../error_const'); -const ffi = require('ffi'); -const ref = require('ref'); +const ffi = require('ffi-napi'); +const ref = require('ref-napi'); const Enum = require('enum'); const Struct = require('ref-struct'); const ArrayType = require('ref-array'); diff --git a/src/native/_cipher_opt.js b/src/native/_cipher_opt.js index 047a5d4..7b14ec3 100644 --- a/src/native/_cipher_opt.js +++ b/src/native/_cipher_opt.js @@ -11,7 +11,7 @@ // relating to use of the SAFE Network Software. -const ffi = require('ffi'); +const ffi = require('ffi-napi'); const ref = require("ref"); const Struct = require('ref-struct'); const base = require('./_base'); diff --git a/src/native/_crypto.js b/src/native/_crypto.js index 417c6a1..d0b7506 100644 --- a/src/native/_crypto.js +++ b/src/native/_crypto.js @@ -11,7 +11,7 @@ // relating to use of the SAFE Network Software. -const ffi = require('ffi'); +const ffi = require('ffi-napi'); const ref = require("ref"); const Struct = require('ref-struct'); const base = require('./_base'); diff --git a/src/native/_immutable.js b/src/native/_immutable.js index 8c324e1..0da3192 100644 --- a/src/native/_immutable.js +++ b/src/native/_immutable.js @@ -11,7 +11,7 @@ // relating to use of the SAFE Network Software. -const ffi = require('ffi'); +const ffi = require('ffi-napi'); const ref = require("ref"); const Struct = require('ref-struct'); const base = require('./_base'); diff --git a/src/native/_mutable.js b/src/native/_mutable.js index 2b0bef1..77dec17 100644 --- a/src/native/_mutable.js +++ b/src/native/_mutable.js @@ -11,7 +11,7 @@ // relating to use of the SAFE Network Software. -const ffi = require('ffi'); +const ffi = require('ffi-napi'); const ref = require("ref"); const Struct = require('ref-struct'); const Enum = require('enum'); diff --git a/src/native/_nfs.js b/src/native/_nfs.js index cc256b4..9364cbe 100644 --- a/src/native/_nfs.js +++ b/src/native/_nfs.js @@ -11,7 +11,7 @@ // relating to use of the SAFE Network Software. -const ffi = require('ffi'); +const ffi = require('ffi-napi'); const ref = require("ref"); const Struct = require('ref-struct'); const base = require('./_base'); diff --git a/src/native/_system_uri.js b/src/native/_system_uri.js index 8612902..624ecec 100644 --- a/src/native/_system_uri.js +++ b/src/native/_system_uri.js @@ -12,8 +12,8 @@ const path = require('path'); -const FFI = require('ffi'); -const ref = require('ref'); +const FFI = require('ffi-napi'); +const ref = require('ref-napi'); const { getSystemUriLibFilename } = require('../helpers'); const makeError = require('./_error.js'); const h = require('./helpers'); diff --git a/src/native/_testing.js b/src/native/_testing.js index 6260d58..036229a 100644 --- a/src/native/_testing.js +++ b/src/native/_testing.js @@ -11,7 +11,7 @@ // relating to use of the SAFE Network Software. -const ref = require('ref'); +const ref = require('ref-napi'); const { types: t, helpers: h } = require("./_base"); const { types } = require('./_auth'); diff --git a/src/native/lib.js b/src/native/lib.js index 0b8ccdb..5041f77 100644 --- a/src/native/lib.js +++ b/src/native/lib.js @@ -13,7 +13,7 @@ const path = require('path'); const fs = require('fs'); -const FFI = require('ffi'); +const FFI = require('ffi-napi'); const { getSafeAppLibFilename } = require('../helpers'); const { getSystemUriLibFilename } = require('../helpers'); const os = require('os'); diff --git a/yarn.lock b/yarn.lock index 42c0406..bf6fe40 100644 --- a/yarn.lock +++ b/yarn.lock @@ -383,11 +383,6 @@ bindings@1, bindings@^1.3.0: dependencies: file-uri-to-path "1.0.0" -bindings@~1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" - integrity sha1-FK1hE4EtLTfXLme0ystLtyZQXxE= - bluebird@~3.5.0: version "3.5.4" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.4.tgz#d6cc661595de30d5b3af5fcedd3c0b3ef6ec5714" @@ -1327,16 +1322,17 @@ fast-levenshtein@~2.0.4: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -ffi@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/ffi/-/ffi-2.3.0.tgz#fa1a7b3d85c0fa8c83d96947a64b5192bc47f858" - integrity sha512-vkPA9Hf9CVuQ5HeMZykYvrZF2QNJ/iKGLkyDkisBnoOOFeFXZQhUPxBARPBIZMJVulvBI2R+jgofW03gyPpJcQ== +ffi-napi@2.4.5: + version "2.4.5" + resolved "https://registry.yarnpkg.com/ffi-napi/-/ffi-napi-2.4.5.tgz#12e807f238f8c68fc094fc46c1ce5193c2ab64f8" + integrity sha512-24Et/c5/sRvZvpOZ9nvkK0Be1S8A1Vkt6aJSKGaohOGb5FwV4+EmecaTtNhN4TCLJDjYC8z/k4X8W1SC5IK/fw== dependencies: - bindings "~1.2.0" - debug "2" - nan "2" - ref "1" - ref-struct "1" + bindings "^1.3.0" + debug "^3.1.0" + get-uv-event-loop-napi-h "^1.0.5" + node-addon-api "1.5.0" + ref-napi "^1.4.0" + ref-struct-di "^1.1.0" figures@^1.3.5: version "1.7.0" @@ -1511,7 +1507,7 @@ get-symbol-from-current-process-h@^1.0.1: resolved "https://registry.yarnpkg.com/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.1.tgz#7e4809087e7d2f3a78a785b36f787e2183ba4c5d" integrity sha512-QvP1+tCDjgTiu+akjdEYd8eK8MFYy6nRCRNjfiCeQB9RJEHQZpN+WE+CVqPRNqjIVMwSqd0WiD008B+b7iIdaA== -get-uv-event-loop-napi-h@^1.0.2: +get-uv-event-loop-napi-h@^1.0.2, get-uv-event-loop-napi-h@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.5.tgz#1904a1dc1fa6df7487c9e8eaf87302bcc9e33e47" integrity sha512-uWDHId313vRTyqeLhlLWJS0CJOP8QXY5en/9Pv14dnPvAlRfKBfD6h2EDtoy7jxxOIWB9QgzYK16VCN3pCZOBg== @@ -2607,7 +2603,12 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-addon-api@^1.1.0: +node-addon-api@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.5.0.tgz#55be6b3da36e746f4b1f2af16c2adf67647d1ff8" + integrity sha512-YsL/8dpBWxCFj3wAVAa/ceN4TlT8lACK8EgpuN0q/4ecflWHDuKpodb+tt7Rx22r/6FJ2f+IT25XSsXnZGwYgA== + +node-addon-api@^1.1.0, node-addon-api@^1.6.2: version "1.6.3" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.6.3.tgz#3998d4593e2dca2ea82114670a4eb003386a9fe1" integrity sha512-FXWH6mqjWgU8ewuahp4spec8LkroFZK2NicOv6bNwZC3kcwZUI8LeZdG80UzTSLLhK4T7MsgNwlYDVRlDdfTDg== @@ -3162,7 +3163,23 @@ ref-array@^1.2.0: debug "2" ref "1" -ref-struct@1, ref-struct@^1.1.0: +ref-napi@1.4.1, ref-napi@^1.4.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/ref-napi/-/ref-napi-1.4.1.tgz#ab129c5d4c2b4ccbb50503c09c315334a5a3a77b" + integrity sha512-7AK1YNzEO2z8DLFPTf+AvOViCUgLK0stM4hnR0HWLb71Bo10UJWIpMDN3Tz7BNnUJhsj2pHWfjxugcaRvCF7zA== + dependencies: + bindings "^1.3.0" + debug "^3.1.0" + node-addon-api "^1.6.2" + +ref-struct-di@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ref-struct-di/-/ref-struct-di-1.1.0.tgz#d252144eb449608ccf2e5c12fda35f8153bd3760" + integrity sha512-gghZITj/iQwdwFDduZ6T8kL2B2ogInlOz7AOB0ggFoEc7akAKMcDrbzh3OIPk13Kxy8U2bHPvN6nejcBh4jN7A== + dependencies: + debug "^3.1.0" + +ref-struct@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ref-struct/-/ref-struct-1.1.0.tgz#5d5ee65ad41cefc3a5c5feb40587261e479edc13" integrity sha1-XV7mWtQc78Olxf60BYcmHkee3BM= @@ -3170,7 +3187,7 @@ ref-struct@1, ref-struct@^1.1.0: debug "2" ref "1" -ref@1, ref@^1.3.3: +ref@1: version "1.3.5" resolved "https://registry.yarnpkg.com/ref/-/ref-1.3.5.tgz#0e33f080cdb94a3d95312b2b3b1fd0f82044ca0f" integrity sha512-2cBCniTtxcGUjDpvFfVpw323a83/0RLSGJJY5l5lcomZWhYpU2cuLdsvYqMixvsdLJ9+sTdzEkju8J8ZHDM2nA==