From 4f719ce3776aa69b493afa2b91077b93fb862de0 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 4 Mar 2019 16:47:55 +0100 Subject: [PATCH] Remove syncify (NodeJS only) (#349) * Remove syncify (NodeJS only) * Bump version (interface change) --- CHANGELOG.md | 4 ++++ lerna.json | 2 +- packages/chainspec/package.json | 4 ++-- packages/db/package.json | 6 +++--- packages/keyring/package.json | 6 +++--- packages/trie-codec/package.json | 4 ++-- packages/trie-db/package.json | 16 +++++++------- packages/trie-hash/package.json | 6 +++--- packages/util-crypto/package.json | 4 ++-- packages/util-rlp/package.json | 4 ++-- packages/util/package.json | 3 +-- packages/util/src/syncify.spec.ts | 31 --------------------------- packages/util/src/syncify.ts | 35 ------------------------------- yarn.lock | 18 ---------------- 14 files changed, 31 insertions(+), 112 deletions(-) delete mode 100644 packages/util/src/syncify.spec.ts delete mode 100644 packages/util/src/syncify.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 3426f67d2..1c26cc707 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.35.1 + +- Remove NodeJs-only `syncify` function, not exported by the package (with binary dependency for Node) + # 0.34.1 - Keyring now allows for ed25519 and sr25519 instances. Upon creation, you need to pass the `ed25519`or `sr25519` string to denote the type, i.e. `new Keyring({ type: 'sr25519' })` diff --git a/lerna.json b/lerna.json index c5067a07e..4de2de4ea 100644 --- a/lerna.json +++ b/lerna.json @@ -9,5 +9,5 @@ "packages": [ "packages/*" ], - "version": "0.34.41" + "version": "0.35.0" } diff --git a/packages/chainspec/package.json b/packages/chainspec/package.json index 2143d86ec..73af2d75a 100644 --- a/packages/chainspec/package.json +++ b/packages/chainspec/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/chainspec", - "version": "0.34.41", + "version": "0.35.0", "description": "Contains chain specifications for known chains", "main": "index.js", "keywords": [ @@ -29,6 +29,6 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/chainspec#readme", "dependencies": { "@babel/runtime": "^7.3.4", - "@polkadot/util": "^0.34.41" + "@polkadot/util": "^0.35.0" } } diff --git a/packages/db/package.json b/packages/db/package.json index 30bae6e30..6953d062a 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/db", - "version": "0.34.41", + "version": "0.35.0", "description": "Implementation of a basic sync in-memory and on-disk databases with overlays", "main": "index.js", "keywords": [ @@ -29,8 +29,8 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/db#readme", "dependencies": { "@babel/runtime": "^7.3.4", - "@polkadot/trie-hash": "^0.34.41", - "@polkadot/util": "^0.34.41", + "@polkadot/trie-hash": "^0.35.0", + "@polkadot/util": "^0.35.0", "@types/mkdirp": "^0.5.2", "@types/rimraf": "^2.0.2", "@types/snappy": "^6.0.0", diff --git a/packages/keyring/package.json b/packages/keyring/package.json index d12620ad2..3702453cb 100644 --- a/packages/keyring/package.json +++ b/packages/keyring/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/keyring", - "version": "0.34.41", + "version": "0.35.0", "description": "Keyring management", "main": "index.js", "engines": { @@ -31,8 +31,8 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme", "dependencies": { "@babel/runtime": "^7.3.4", - "@polkadot/util": "^0.34.41", - "@polkadot/util-crypto": "^0.34.41", + "@polkadot/util": "^0.35.0", + "@polkadot/util-crypto": "^0.35.0", "@types/bs58": "^4.0.0", "bs58": "^4.0.1" } diff --git a/packages/trie-codec/package.json b/packages/trie-codec/package.json index 6be7c20cd..c1c5c8b68 100644 --- a/packages/trie-codec/package.json +++ b/packages/trie-codec/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/trie-codec", - "version": "0.34.41", + "version": "0.35.0", "description": "This is an implementation of the codec for Substrate Trie", "main": "index.js", "keywords": [ @@ -29,6 +29,6 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-codec#readme", "dependencies": { "@babel/runtime": "^7.3.4", - "@polkadot/util": "^0.34.41" + "@polkadot/util": "^0.35.0" } } diff --git a/packages/trie-db/package.json b/packages/trie-db/package.json index 318e87659..07ce9470d 100644 --- a/packages/trie-db/package.json +++ b/packages/trie-db/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/trie-db", - "version": "0.34.41", + "version": "0.35.0", "description": "This is an implementation of the modified merkle patricia tree as specified in Ethereum's yellow paper, adapted for Polkadot", "main": "index.js", "keywords": [ @@ -29,15 +29,15 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-db#readme", "dependencies": { "@babel/runtime": "^7.3.4", - "@polkadot/db": "^0.34.41", - "@polkadot/trie-codec": "^0.34.41", - "@polkadot/trie-hash": "^0.34.41", - "@polkadot/util": "^0.34.41", - "@polkadot/util-crypto": "^0.34.41" + "@polkadot/db": "^0.35.0", + "@polkadot/trie-codec": "^0.35.0", + "@polkadot/trie-hash": "^0.35.0", + "@polkadot/util": "^0.35.0", + "@polkadot/util-crypto": "^0.35.0" }, "devDependencies": { - "@polkadot/chainspec": "^0.34.41", - "@polkadot/util-rlp": "^0.34.41", + "@polkadot/chainspec": "^0.35.0", + "@polkadot/util-rlp": "^0.35.0", "ethereumjs-testing": "1.0.4" } } diff --git a/packages/trie-hash/package.json b/packages/trie-hash/package.json index 714fdc7a6..56bf500f5 100644 --- a/packages/trie-hash/package.json +++ b/packages/trie-hash/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/trie-hash", - "version": "0.34.41", + "version": "0.35.0", "description": "Generates trie roots from key-value pairs", "main": "index.js", "keywords": [ @@ -29,9 +29,9 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/trie-hash#readme", "dependencies": { "@babel/runtime": "^7.3.4", - "@polkadot/util": "^0.34.41" + "@polkadot/util": "^0.35.0" }, "devDependencies": { - "@polkadot/chainspec": "^0.34.41" + "@polkadot/chainspec": "^0.35.0" } } diff --git a/packages/util-crypto/package.json b/packages/util-crypto/package.json index ae365b021..2257eea77 100644 --- a/packages/util-crypto/package.json +++ b/packages/util-crypto/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-crypto", - "version": "0.34.41", + "version": "0.35.0", "description": "A collection of useful crypto utilities for @polkadot", "main": "index.js", "keywords": [ @@ -30,7 +30,7 @@ "dependencies": { "@babel/runtime": "^7.3.4", "@polkadot/schnorrkel-js": "^0.1.2-3", - "@polkadot/util": "^0.34.41", + "@polkadot/util": "^0.35.0", "@types/bip39": "^2.4.2", "@types/pbkdf2": "^3.0.0", "@types/secp256k1": "^3.5.0", diff --git a/packages/util-rlp/package.json b/packages/util-rlp/package.json index 669d28f2f..f62188a96 100644 --- a/packages/util-rlp/package.json +++ b/packages/util-rlp/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-rlp", - "version": "0.34.41", + "version": "0.35.0", "description": "RLP encoding and decoding", "main": "index.js", "keywords": [ @@ -31,7 +31,7 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-rlp#readme", "dependencies": { "@babel/runtime": "^7.3.4", - "@polkadot/util": "^0.34.41" + "@polkadot/util": "^0.35.0" }, "devDependencies": { "ethereumjs-testing": "1.0.4" diff --git a/packages/util/package.json b/packages/util/package.json index b312a514a..0494f4d94 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util", - "version": "0.34.41", + "version": "0.35.0", "description": "A collection of useful utilities for @polkadot", "main": "index.js", "keywords": [ @@ -37,7 +37,6 @@ "camelcase": "^5.0.0", "chalk": "^2.4.2", "core-js": "^2.6.5", - "deasync": "^0.1.14", "ip-regex": "^4.0.0", "moment": "^2.24.0" } diff --git a/packages/util/src/syncify.spec.ts b/packages/util/src/syncify.spec.ts deleted file mode 100644 index 4ba6bb17b..000000000 --- a/packages/util/src/syncify.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017-2019 @polkadot/util authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import syncify from './syncify'; - -describe('syncify', () => { - it('returns the result of the promise', () => { - expect( - syncify( - new Promise((resolve) => { - setTimeout(() => { - resolve(12345); - }, 100); - }) - ) - ).toEqual(12345); - }); - - it('throws promise exceptions', () => { - expect( - () => syncify( - new Promise((resolve, reject) => { - setTimeout(() => { - reject(new Error('test reject error')); - }, 100); - }) - ) - ).toThrow(/test reject error/); - }); -}); diff --git a/packages/util/src/syncify.ts b/packages/util/src/syncify.ts deleted file mode 100644 index 327151870..000000000 --- a/packages/util/src/syncify.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017-2019 @polkadot/util authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import deasync from 'deasync'; - -import isError from './is/error'; - -// FIXME: This is currently for Node environments only - for Browser environments deasync is not available, we need a different solution. - -export default function syncify (promise: Promise): any { - let result: any; - let hasResult = false; - - // tslint:disable-next-line - (async () => { - try { - result = await promise; - } catch (error) { - result = error; - } - - hasResult = true; - })(); - - deasync.loopWhile( - () => hasResult === false - ); - - if (isError(result)) { - throw result; - } - - return result; -} diff --git a/yarn.lock b/yarn.lock index 688788d77..b8aad4991 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2558,11 +2558,6 @@ bindings@^1.2.1, bindings@^1.3.1: dependencies: file-uri-to-path "1.0.0" -bindings@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" - integrity sha1-FK1hE4EtLTfXLme0ystLtyZQXxE= - bip39@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235" @@ -3852,14 +3847,6 @@ de-indent@^1.0.2: resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0= -deasync@^0.1.14: - version "0.1.14" - resolved "https://registry.yarnpkg.com/deasync/-/deasync-0.1.14.tgz#232ea2252b443948cad033d792eb3b24b0a3d828" - integrity sha512-wN8sIuEqIwyQh72AG7oY6YQODCxIp1eXzEZlZznBuwDF8Q03Tdy9QNp1BNZXeadXoklNrw+Ip1fch+KXo/+ASw== - dependencies: - bindings "~1.2.1" - node-addon-api "^1.6.0" - debug@*, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" @@ -7629,11 +7616,6 @@ node-abi@^2.7.0: dependencies: semver "^5.4.1" -node-addon-api@^1.6.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.6.2.tgz#d8aad9781a5cfc4132cc2fecdbdd982534265217" - integrity sha512-479Bjw9nTE5DdBSZZWprFryHGjUaQC31y1wHo19We/k0BZlrmhqQitWoUL0cD8+scljCbIUL+E58oRDEakdGGA== - node-dir@^0.1.16: version "0.1.17" resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5"