diff --git a/packages/as-sha256/package.json b/packages/as-sha256/package.json index 9b1bea04..aa2b2b4e 100644 --- a/packages/as-sha256/package.json +++ b/packages/as-sha256/package.json @@ -13,6 +13,7 @@ "url": "git+https://github.com/chainsafe/ssz.git" }, "main": "lib/index.js", + "deno": "src/index.ts", "typesVersions": { "*": { "*": [ diff --git a/packages/persistent-merkle-tree/package.json b/packages/persistent-merkle-tree/package.json index eb7b9cd8..f30f4c72 100644 --- a/packages/persistent-merkle-tree/package.json +++ b/packages/persistent-merkle-tree/package.json @@ -3,6 +3,7 @@ "version": "0.8.0", "description": "Merkle tree implemented as a persistent datastructure", "main": "lib/index.js", + "deno": "src/index.ts", "typesVersions": { "*": { "*": [ diff --git a/packages/persistent-merkle-tree/src/hasher/util.ts b/packages/persistent-merkle-tree/src/hasher/util.ts index 365307eb..110e986c 100644 --- a/packages/persistent-merkle-tree/src/hasher/util.ts +++ b/packages/persistent-merkle-tree/src/hasher/util.ts @@ -1,4 +1,4 @@ -import {byteArrayToHashObject, HashObject, hashObjectToByteArray} from "@chainsafe/as-sha256/lib/hashObject"; +import {byteArrayToHashObject, HashObject, hashObjectToByteArray} from "@chainsafe/as-sha256"; import {zeroHash} from "../zeroHash"; export function hashObjectToUint8Array(obj: HashObject): Uint8Array { diff --git a/packages/persistent-ts/package.json b/packages/persistent-ts/package.json index 8e56deac..19ad3449 100644 --- a/packages/persistent-ts/package.json +++ b/packages/persistent-ts/package.json @@ -3,6 +3,7 @@ "version": "0.19.1", "description": "Persistent data structures for TypeScript.", "main": "lib/index.js", + "deno": "src/index.ts", "files": [ "lib/**/*.d.ts", "lib/**/*.js", diff --git a/packages/ssz/package.json b/packages/ssz/package.json index 84435f8e..1e36f62d 100644 --- a/packages/ssz/package.json +++ b/packages/ssz/package.json @@ -6,6 +6,7 @@ "homepage": "https://github.com/chainsafe/ssz", "version": "0.18.0", "main": "lib/index.js", + "deno": "src/index.ts", "files": [ "lib/**/*.d.ts", "lib/**/*.js", diff --git a/packages/ssz/src/util/merkleize.ts b/packages/ssz/src/util/merkleize.ts index 073dea5d..097a7788 100644 --- a/packages/ssz/src/util/merkleize.ts +++ b/packages/ssz/src/util/merkleize.ts @@ -1,5 +1,4 @@ -import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index"; -import {zeroHash} from "@chainsafe/persistent-merkle-tree"; +import {zeroHash, digest64} from "@chainsafe/persistent-merkle-tree"; /** Dedicated property to cache hashTreeRoot of immutable CompositeType values */ export const symbolCachedPermanentRoot = Symbol("ssz_cached_permanent_root"); @@ -10,7 +9,7 @@ export type ValueWithCachedPermanentRoot = { }; export function hash64(bytes32A: Uint8Array, bytes32B: Uint8Array): Uint8Array { - return hasher.digest64(bytes32A, bytes32B); + return digest64(bytes32A, bytes32B); } export function merkleize(chunks: Uint8Array[], padFor: number): Uint8Array { diff --git a/vitest.base.unit.config.ts b/vitest.base.unit.config.ts index fc0d7367..890683f6 100644 --- a/vitest.base.unit.config.ts +++ b/vitest.base.unit.config.ts @@ -26,6 +26,11 @@ function getTestEnvironment( } export default defineConfig({ + resolve: { + // Adding `deno` field is just for testing purpose. + // Vite validates the package.json and could not find `lib/index.js` in deno runtime + mainFields: ["deno", "main"], + }, test: { include: ["**/*.test.ts"], exclude: [