From 5a6987706eb0c82e012020bc941fa57a10fdf7f7 Mon Sep 17 00:00:00 2001 From: v1rtl Date: Thu, 4 Jan 2024 13:36:36 +0200 Subject: [PATCH] bump deps and switch to deno bdd --- .vscode/settings.json | 5 ++- bindings.ts | 8 ++-- common.ts | 2 +- deno.lock | 85 ++++++++++++++++++++++++++++++++++++++++++- deps.ts | 2 +- download_test.ts | 5 +-- mod_test.ts | 5 +-- 7 files changed, 98 insertions(+), 14 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8425d36..440fbef 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,8 @@ "https://x.nest.land/": true, "https://esm.sh": false }, - "prettier.enable": false + "[typescript]": { + "editor.defaultFormatter": "denoland.vscode-deno" + }, + "editor.formatOnSave": true } diff --git a/bindings.ts b/bindings.ts index 078c3a4..0b8190b 100644 --- a/bindings.ts +++ b/bindings.ts @@ -3,7 +3,7 @@ */ import { isNil } from './common.ts' -import { Alloc, License, Reset, SolJson, Version } from './deps.ts' +import type { Alloc, License, Reset, SolJson, Version } from './deps.ts' import type { Callbacks, CoreBindings } from './types.ts' function bindSolcMethod( @@ -219,8 +219,8 @@ function runWithCallbacks( } function bindCompileStandard(solJson: SolJson, coreBindings: CoreBindings) { - let boundFunctionStandard: any = null - let boundFunctionSolidity: any = null + let boundFunctionStandard: ((input: number, readCallback: Callbacks) => void) | null = null + let boundFunctionSolidity: ((...args: unknown[]) => void) | null = null // input (jsontext), callback (ptr) -> output (jsontext) const compileInternal = bindSolcMethod( @@ -248,7 +248,7 @@ function bindCompileStandard(solJson: SolJson, coreBindings: CoreBindings) { if (!isNil(boundFunctionSolidity)) { boundFunctionStandard = function (input: number, callbacks: Callbacks) { - return runWithCallbacks(coreBindings, callbacks, boundFunctionSolidity, [input]) + return runWithCallbacks(coreBindings, callbacks, boundFunctionSolidity as ((...args: unknown[]) => void), [input]) } } diff --git a/common.ts b/common.ts index 3a14e56..73e442a 100644 --- a/common.ts +++ b/common.ts @@ -11,4 +11,4 @@ export const formatFatalError = (message: string) => ], }) -export const isNil = (value: unknown) => value == null +export const isNil = (value: unknown): value is null => value == null diff --git a/deno.lock b/deno.lock index 3a7ba5d..f3b516c 100644 --- a/deno.lock +++ b/deno.lock @@ -1,5 +1,16 @@ { - "version": "2", + "version": "3", + "packages": { + "specifiers": { + "npm:@types/node": "npm:@types/node@18.16.19" + }, + "npm": { + "@types/node@18.16.19": { + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "dependencies": {} + } + } + }, "remote": { "https://deno.land/std@0.106.0/fmt/colors.ts": "d2f8355f00a74404668fc5a1e4a92983ce1a9b0a6ac1d40efbd681cb8f519586", "https://deno.land/std@0.177.0/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462", @@ -405,6 +416,64 @@ "https://deno.land/std@0.187.0/streams/writer_from_stream_writer.ts": "07c7ee025151a190f37fc42cbb01ff93afc949119ebddc6e0d0df14df1bf6950", "https://deno.land/std@0.187.0/streams/zip_readable_streams.ts": "a9d81aa451240f79230add674809dbee038d93aabe286e2d9671e66591fc86ca", "https://deno.land/std@0.187.0/types.d.ts": "dbaeb2c4d7c526db9828fc8df89d8aecf53b9ced72e0c4568f97ddd8cda616a4", + "https://deno.land/std@0.197.0/fmt/colors.ts": "a7eecffdf3d1d54db890723b303847b6e0a1ab4b528ba6958b8f2e754cf1b3bc", + "https://deno.land/std@0.210.0/assert/_constants.ts": "8a9da298c26750b28b326b297316cdde860bc237533b07e1337c021379e6b2a9", + "https://deno.land/std@0.210.0/assert/_diff.ts": "2c9371f17cf08cbb843c924bc31ca77af422ec4fe162f73d42c651d547573fa8", + "https://deno.land/std@0.210.0/assert/_format.ts": "335ce8e15c65b679ad142dbc9e5e97e5d58602c39dd3c9175cef6c85fe22d6d5", + "https://deno.land/std@0.210.0/assert/assert.ts": "e265ad50a9341f3b40e51dd4cb41ab253d976943ba78a977106950e52e0302ab", + "https://deno.land/std@0.210.0/assert/assert_equals.ts": "991b0c2b437a015d623654f758e48bfd931068211a52e8131b397cdf005c595f", + "https://deno.land/std@0.210.0/assert/assert_false.ts": "99cf237fe374cabf57072d2fb41b3eaff389029f850fbb96f643c875792f10ce", + "https://deno.land/std@0.210.0/assert/assert_instance_of.ts": "7c093d36b1a86666d5a60a8c290c91a51a627153b821a5a4dc40b24cab69f1e7", + "https://deno.land/std@0.210.0/assert/assert_is_error.ts": "a8a758581661edec514c453910bee2f9c91b1346a515c58404963b130d81cd80", + "https://deno.land/std@0.210.0/assert/assert_match.ts": "e541a9769cf5726312ff9e15031e2faa2df3c59fbdc5573c8758b1f4668ccc62", + "https://deno.land/std@0.210.0/assert/assert_not_equals.ts": "6bce4b28f3316029c0aef107f8390796798835c382d31c1004160baef0b80db0", + "https://deno.land/std@0.210.0/assert/assert_not_instance_of.ts": "866243fd28bc6665e2ffcc027a9df1d2a69cb644aef1e9b8d1ce34377c6b8a84", + "https://deno.land/std@0.210.0/assert/assert_not_match.ts": "59707eceb0d2b16d6892fbf92ec86f92fd76fcfc55f8b61508299db7d2972cab", + "https://deno.land/std@0.210.0/assert/assert_not_strict_equals.ts": "c84b8e229450e8dfc44b9910d602788313ff7333d67d5bd8528371567b6a3632", + "https://deno.land/std@0.210.0/assert/assert_object_match.ts": "ebeff248d48e5810f787e8742ae4f6b39904f4640edc2f69796596ceb6dbcdf8", + "https://deno.land/std@0.210.0/assert/assert_strict_equals.ts": "4007dabef1c2e9d6f1bb0e948ba7ba99ec9b1bee97ba34d67f7c10e7e5d794f7", + "https://deno.land/std@0.210.0/assert/assertion_error.ts": "26ed1863d905005f00785c89750c001c3522c5417e4f58f95044b8143cfc1593", + "https://deno.land/std@0.210.0/assert/equal.ts": "6f81c8a3b12c08bdc3510c8a1293b4db1c083692219d7e3828d2234b448d3d3d", + "https://deno.land/std@0.210.0/bytes/concat.ts": "148a7575649e4a06246203f725f4878dce08690cc33c448f1000632e7a050449", + "https://deno.land/std@0.210.0/bytes/copy.ts": "939d89e302a9761dcf1d9c937c7711174ed74c59eef40a1e4569a05c9de88219", + "https://deno.land/std@0.210.0/expect/_format.ts": "872f1c3542df2dc85dbb89f65ffd34c38c6c01267f86324a9509fb79526c0e66", + "https://deno.land/std@0.210.0/expect/_inspect_args.ts": "0225bbc87c64899e5a72dcd4f54ca79ab1e8bd2c3934be2ec78be987cdaf7287", + "https://deno.land/std@0.210.0/expect/_matchers.ts": "2b3c17830c85a66b6d9d977717454d36375eef3fa7145ef44c6b0dc175b91026", + "https://deno.land/std@0.210.0/expect/_mock_util.ts": "af1127940f8f5243d3d0352a6552447f864ce948c3654b86590ec4aae7c4f8e6", + "https://deno.land/std@0.210.0/expect/_types.ts": "29e7de1c6bd4fbee6f58b5b812d9f95e60c7d3cb99c78617c9212870721fe9c9", + "https://deno.land/std@0.210.0/expect/expect.ts": "e9395770b4abe77e0351564cd26bd9988f19a0c26b03d5d22c4701d15dff3fa3", + "https://deno.land/std@0.210.0/expect/fn.ts": "4fb4b54df34a50ed3c638fd48ee6b5aab3d6e7b3d850631d8f7744f38a9cc620", + "https://deno.land/std@0.210.0/expect/mod.ts": "e963871d002da3d9eddceb01068d93d956bd477292537c4e58dbaf189880455b", + "https://deno.land/std@0.210.0/fmt/colors.ts": "2685c524bef9b16b3059a417daf6860c754eb755e19e812762ef5dff62f24481", + "https://deno.land/std@0.210.0/io/buffer.ts": "b2ea4d33cd8d1f306d720a4768676382b9462fc0d0cf56b5f7bc2a33ea423b10", + "https://deno.land/std@0.210.0/streams/_common.ts": "3b2c1f0287ce2ad51fff4091a7d0f48375c85b0ec341468e76d5ac13bb0014dd", + "https://deno.land/std@0.210.0/streams/buffer.ts": "f74da2f5aeafd444530dcdb7a79047393d5359cbe5ec4dd806a005f1ca7dc73e", + "https://deno.land/std@0.210.0/streams/byte_slice_stream.ts": "ecf523d7ff665d554100de981058c60f5207ab718319244f7c742d9e1194fa64", + "https://deno.land/std@0.210.0/streams/copy.ts": "1ec21a36d1290f3100d965fb3a37a136fc6d1698f3893decc24de10a9f040162", + "https://deno.land/std@0.210.0/streams/delimiter_stream.ts": "b89d6ac032f825c93cd10c08a6e2cdf1d1455561262eb25e99c97730ffbf531e", + "https://deno.land/std@0.210.0/streams/early_zip_readable_streams.ts": "e33ca3a207063a3dcd8e6f37d5a3f836712fdef7e923edab5678794c22115996", + "https://deno.land/std@0.210.0/streams/iterate_reader.ts": "9eebdd8099d5645f3c82e6d61e9496d7b5c8579e921c1a7c009fd1881dc40596", + "https://deno.land/std@0.210.0/streams/limited_bytes_transform_stream.ts": "89ad4789b80e7ac3aa460874194fb8b2a4552ce649a249d7a1fba1082a2b0592", + "https://deno.land/std@0.210.0/streams/limited_transform_stream.ts": "c7ff76ab70d9cb16b2b7e99f2ac5adab8e9dbc618b7be36ed2452e2ad9f6fdfd", + "https://deno.land/std@0.210.0/streams/merge_readable_streams.ts": "767b42770d58147cdddb9a4a805c02c56f57724d9157ff019c70b2459b545e57", + "https://deno.land/std@0.210.0/streams/mod.ts": "e133c271474f1e9dc19f5c4959406f5c2101540c56a3e7d7abc6bdb7bcef807e", + "https://deno.land/std@0.210.0/streams/read_all.ts": "ce30cb93f0b7977f912d60a30f1766929c2891efdb44a2679cfbc25cf8c60184", + "https://deno.land/std@0.210.0/streams/readable_stream_from_reader.ts": "490200922e5806d68a9d141246fe4bbd4b868874415e46948c51aedb04c9aa83", + "https://deno.land/std@0.210.0/streams/reader_from_iterable.ts": "6689c4699102f273747927b98c2fe2d4e13c4a434f48af76eca09725e00795fa", + "https://deno.land/std@0.210.0/streams/reader_from_stream_reader.ts": "ac387c8826ee922a8e29afa9ba9add50dd9ac8ec6a21ba17dd52f43d369ee9b3", + "https://deno.land/std@0.210.0/streams/text_delimiter_stream.ts": "58f00c97af9242ed46cca7090214682c3bc1fcb6506327d323fbb6aa31d390ca", + "https://deno.land/std@0.210.0/streams/text_line_stream.ts": "e3bb7769ebd789a125ab8fecfc823c218ac6435aaff6257929bcc2e3f07817f0", + "https://deno.land/std@0.210.0/streams/to_array_buffer.ts": "6a73bc04b0669bafa75df95dda5c369ae64041e9a4f3233ea11956b079c330ff", + "https://deno.land/std@0.210.0/streams/to_blob.ts": "4c7188e070a0a82b36edc52176ef95c0e603d3855f618959b97e2543fb9dd07f", + "https://deno.land/std@0.210.0/streams/to_json.ts": "a70f62c6b16fdd44d631a3a4c2afe4791670267f43013ffab3e64fcdac99bb63", + "https://deno.land/std@0.210.0/streams/to_text.ts": "5b43bd0bdf4dcecd766019df541b3cc65e2e8fc2c68a7f7eb910c55735745eff", + "https://deno.land/std@0.210.0/streams/to_transform_stream.ts": "d71d163cbf1d14c7d1c9edb3426175b30ce3018be1b20bf8ffac31d94f5e1cb4", + "https://deno.land/std@0.210.0/streams/writable_stream_from_writer.ts": "5e43157b2c3d68c5610f699fb1e7d729339419a01a116283b62cd0b557e7b245", + "https://deno.land/std@0.210.0/streams/write_all.ts": "af86903af1ca8bc443bf615c2d3847afd2687ffc1b91c128e28461d5f4f86769", + "https://deno.land/std@0.210.0/streams/writer_from_stream_writer.ts": "fa3713a78892671246c9b30c2d1d536cebc313c7c72d1216a4b1498f6041eec0", + "https://deno.land/std@0.210.0/streams/zip_readable_streams.ts": "5ceff68e74be552da3a769512b9e8776303f9488c625409c9eef994a1c9af8d7", + "https://deno.land/std@0.210.0/testing/_test_suite.ts": "30f018feeb3835f12ab198d8a518f9089b1bcb2e8c838a8b615ab10d5005465c", + "https://deno.land/std@0.210.0/testing/bdd.ts": "c41f019786c4a9112aadb7e5a7bbcc711f58429ac5904b3855fa248ba5fa0ba6", "https://deno.land/std@0.97.0/fmt/colors.ts": "db22b314a2ae9430ae7460ce005e0a7130e23ae1c999157e3bb77cf55800f7e4", "https://deno.land/std@0.97.0/testing/_diff.ts": "961eaf6d9f5b0a8556c9d835bbc6fa74f5addd7d3b02728ba7936ff93364f7a3", "https://deno.land/std@0.97.0/testing/asserts.ts": "341292d12eebc44be4c3c2ca101ba8b6b5859cef2fa69d50c217f9d0bfbcfd1f", @@ -412,6 +481,10 @@ "https://deno.land/x/expect@v0.2.9/matchers.ts": "ba7360b73c5031a22449fa98eb4d5dbe7f256a88dd4c22ccae96dc6c01f0b19c", "https://deno.land/x/expect@v0.2.9/mock.ts": "562d4b1d735d15b0b8e935f342679096b64fe452f86e96714fe8616c0c884914", "https://deno.land/x/expect@v0.2.9/mod.ts": "0304d2430e1e96ba669a8495e24ba606dcc3d152e1f81aaa8da898cea24e36c2", + "https://deno.land/x/expect@v0.4.0/expect.ts": "1d1856758a750f440d0b65d74f19e5d4829bb76d8e576d05546abd8e7b1dfb9e", + "https://deno.land/x/expect@v0.4.0/matchers.ts": "55acf74a3c4a308d079798930f05ab11da2080ec7acd53517193ca90d1296bf7", + "https://deno.land/x/expect@v0.4.0/mock.ts": "562d4b1d735d15b0b8e935f342679096b64fe452f86e96714fe8616c0c884914", + "https://deno.land/x/expect@v0.4.0/mod.ts": "0304d2430e1e96ba669a8495e24ba606dcc3d152e1f81aaa8da898cea24e36c2", "https://deno.land/x/tincan@1.0.1/mod.ts": "9473507398048cb24dbb37b3a220777106c69c28d573898648deb2bb84a7e131", "https://deno.land/x/tincan@1.0.1/src/deps.ts": "b02ae57b7ab5035b903f2526b278c26a301e05242668a77eb9e2e82011b651aa", "https://deno.land/x/tincan@1.0.1/src/environment.ts": "1096dc35b77ee070bba03584489f71c446574d3a7676936ab0bb4aed507d7e27", @@ -422,6 +495,16 @@ "https://deno.land/x/tincan@1.0.1/src/nodes/utilities.ts": "5e6a6f0e2650df4e10f7dfde889ef88a588fe9c3b3618aca2acd47e80b3ee3d8", "https://deno.land/x/tincan@1.0.1/src/reporter.ts": "84e09297da18c840076be951c02c749678b75dc89b2575f34db1378cbb509939", "https://deno.land/x/tincan@1.0.1/src/runner.ts": "54e1a0934a52469437bd4655df51f0c9148327d94a2b0d6c175f6f992a697b86", + "https://deno.land/x/tincan@1.0.2/mod.ts": "9473507398048cb24dbb37b3a220777106c69c28d573898648deb2bb84a7e131", + "https://deno.land/x/tincan@1.0.2/src/deps.ts": "cd4b02330db12f33c208706fc90626320152d9ea45f8370a135d69dd94818c49", + "https://deno.land/x/tincan@1.0.2/src/environment.ts": "1096dc35b77ee070bba03584489f71c446574d3a7676936ab0bb4aed507d7e27", + "https://deno.land/x/tincan@1.0.2/src/mod.ts": "a105a5d14ec3d40f1b240517eaa92eeeec1c70be331a12877d6bea25c07e3bd7", + "https://deno.land/x/tincan@1.0.2/src/nodes/mod.ts": "c22f058dd205d10c3b261c9afdbcd95a8eb807401e822f9c899cca2ab0f16473", + "https://deno.land/x/tincan@1.0.2/src/nodes/nodes.ts": "a8b8b3178868c8b13a6d4d0c96cb41e4c1df48719a8cd2977495af9f9352ab04", + "https://deno.land/x/tincan@1.0.2/src/nodes/tree.ts": "c119fb6a2ee1fe9833b70111382cc8d9a3f5b875b4bb65a0e8774d919193faa3", + "https://deno.land/x/tincan@1.0.2/src/nodes/utilities.ts": "5e6a6f0e2650df4e10f7dfde889ef88a588fe9c3b3618aca2acd47e80b3ee3d8", + "https://deno.land/x/tincan@1.0.2/src/reporter.ts": "84e09297da18c840076be951c02c749678b75dc89b2575f34db1378cbb509939", + "https://deno.land/x/tincan@1.0.2/src/runner.ts": "54e1a0934a52469437bd4655df51f0c9148327d94a2b0d6c175f6f992a697b86", "https://raw.githubusercontent.com/ethereum/solc-js/540a9643cd7974e329287ebf8d4c2c70d744c11d/common/types.ts": "8ab10911ffceee409aab33f37237dcb1d3207c8ad310c291e2abcb9c7a5f4d2c" } } diff --git a/deps.ts b/deps.ts index 174db9c..9b2e4f2 100644 --- a/deps.ts +++ b/deps.ts @@ -1,4 +1,4 @@ -export { copy, readerFromStreamReader } from 'https://deno.land/std@0.187.0/streams/mod.ts' +export { copy, readerFromStreamReader } from 'https://deno.land/std@0.210.0/streams/mod.ts' export type { Alloc, Callbacks, diff --git a/download_test.ts b/download_test.ts index 814b895..cc2d82a 100644 --- a/download_test.ts +++ b/download_test.ts @@ -1,4 +1,5 @@ -import { describe, expect, it, run } from 'https://deno.land/x/tincan@1.0.1/mod.ts' +import { describe, it } from 'https://deno.land/std@0.210.0/testing/bdd.ts' +import { expect } from 'https://deno.land/std@0.210.0/expect/mod.ts' import { download } from 'solc/download' import { exists } from './helpers_test.ts' @@ -25,5 +26,3 @@ describe('solc/download.ts', () => { } }) }) - -run() diff --git a/mod_test.ts b/mod_test.ts index 3e73500..073339b 100644 --- a/mod_test.ts +++ b/mod_test.ts @@ -1,4 +1,5 @@ -import { beforeAll, describe, expect, it, run } from 'https://deno.land/x/tincan@1.0.1/mod.ts' +import { beforeAll, describe, it } from 'https://deno.land/std@0.210.0/testing/bdd.ts' +import { expect } from 'https://deno.land/std@0.210.0/expect/mod.ts' import { wrapper } from 'solc' import { createRequire } from './helpers_test.ts' import { download } from 'solc/download' @@ -53,5 +54,3 @@ describe('solc/wrapper.ts', () => { ]) }) }) - -run()