diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 0e136dcfb..a3ee5304e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -26,7 +26,7 @@ jobs: with: cache: yarn node-version: 20 - - run: yarn --immutable && yarn build && yarn generate + - run: yarn --immutable && yarn generate - name: Run benchmarks run: yarn benchmark diff --git a/.github/workflows/cd-manual.yml b/.github/workflows/cd-manual.yml index c910461b3..685dd6b48 100644 --- a/.github/workflows/cd-manual.yml +++ b/.github/workflows/cd-manual.yml @@ -17,8 +17,6 @@ jobs: node-version: '20' - name: Bootstrap run: yarn --immutable - - name: Build - run: yarn build - name: Publish to Cloudflare Pages uses: cloudflare/pages-action@1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf6303701..3da7cefe3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,6 +38,11 @@ jobs: registry-url: 'https://registry.npmjs.org' if: ${{ steps.release.outputs.releases_created }} + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + if: ${{ steps.release.outputs.releases_created }} + - run: yarn install --immutable if: ${{ steps.release.outputs.releases_created }} @@ -46,7 +51,13 @@ jobs: - run: git config user.name $(git --no-pager show -s --format='%an' HEAD) if: ${{ steps.release.outputs.releases_created }} - - run: yarn build + + - name: Build JSR + run: lerna run build:jsr + if: ${{ steps.release.outputs.releases_created }} + + - name: Build NPM + run: lerna run build:npm if: ${{ steps.release.outputs.releases_created }} - env: @@ -56,12 +67,20 @@ jobs: - name: Check npm config run: npm config list - - - run: node_modules/.bin/lerna publish from-package --no-verify-access --yes + + - name: Publish NPM + run: lerna run publish:npm + if: ${{ steps.release.outputs.releases_created }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish JSR + run: lerna run publish:jsr if: ${{ steps.release.outputs.releases_created }} env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + JSR_AUTH_TOKEN: ${{ secrets.JSR_TOKEN }} + - name: Publish to Cloudflare Pages if: ${{ steps.release.outputs.releases_created }} uses: cloudflare/pages-action@1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5ed44b54b..f1ded51e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,8 +19,6 @@ jobs: cache: yarn - name: Bootstrap run: yarn --immutable - - name: Build - run: yarn build - name: Generate run: yarn generate - name: Check types @@ -83,8 +81,6 @@ jobs: bun-version: latest - name: Install run: yarn install --frozen-lockfile - - name: Build - run: yarn build - name: Generate run: bun run --filter '*' generate - name: Unit Tests @@ -103,8 +99,6 @@ jobs: deno-version: v2.x - name: Install run: yarn install --frozen-lockfile - - name: Build - run: yarn build # Deno does not run task in workspaces if same task exists on root package.json - name: Clean root scripts run: cat package.json | jq 'del( .scripts )' > package.json.backup && mv package.json.backup package.json diff --git a/.gitignore b/.gitignore index 03f0e09e2..18f87dd9d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,6 @@ node_modules !.yarn/versions # Deno -deno.lock \ No newline at end of file +deno.lock +# Dnt generate npm package +packages/*/npm/ \ No newline at end of file diff --git a/deno.jsonc b/deno.jsonc index 28a9877e6..e3440b94c 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,3 +1,18 @@ { - "nodeModulesDir": "auto" + "$schema": "https://raw.githubusercontent.com/denoland/deno/refs/heads/main/cli/schemas/config-file.v1.json", + "nodeModulesDir": "auto", + "workspace": [ + "./packages/as-sha256", + "./packages/persistent-merkle-tree", + "./packages/persistent-ts", + "./packages/simpleserialize.com", + "./packages/ssz" + ], + "compilerOptions": { + "noImplicitOverride": false, + "types": ["node"] + }, + "imports": { + "@deno/dnt": "jsr:@deno/dnt@^0.41.3" + } } \ No newline at end of file diff --git a/package.json b/package.json index 735e2be0d..325619cdb 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "scripts": { "clean": "lerna run clean", "generate": "lerna run generate", - "build": "yarn clean && lerna run build", "lint": "lerna run lint", "check-types": "lerna run check-types", "test:browsers": "lerna run test:browsers", diff --git a/packages/as-sha256/package.json b/packages/as-sha256/package.json index 5e5fdc8b8..8178d1948 100644 --- a/packages/as-sha256/package.json +++ b/packages/as-sha256/package.json @@ -13,12 +13,16 @@ "url": "git+https://github.com/chainsafe/ssz.git" }, "type": "module", - "main": "./lib/index.js", - "types": "./lib/index.d.ts", - "files": [ - "lib", - "build" - ], + "exports": { + ".": { + "import": "./src/index.ts" + } + }, + "engines": { + "node": ">= 18", + "deno": ">= 2.2", + "bun": ">= 1.1" + }, "scripts": { "clean": "rm -rf ./dist", "lint": "echo 'no linting for this package'", @@ -32,7 +36,10 @@ "asbuild:simd": "yarn asbuild:simd:untouched && yarn asbuild:simd:optimized", "build:lib": "tsc -p tsconfig.build.json", "build:web": "webpack --mode production --entry ./index.js --output ./dist/as-sha256.min.js", - "build": "yarn asbuild && yarn asbuild:simd && yarn generate && yarn build:lib", + "build:jsr": "yarn asbuild && yarn asbuild:simd && yarn generate && deno run -A ../../scripts/buildJsr.ts", + "build:npm": "yarn asbuild && yarn asbuild:simd && yarn generate && deno run -A ../../scripts/buildNpm.ts", + "publish:jsr": "deno publish", + "publish:npm": "cd npm && npm publish", "test:unit": "vitest run --dir test/unit/", "test:browsers": "vitest run --config ./vitest.browser.config.ts --dir test/unit", "benchmark": "node -r ts-node/register ./node_modules/.bin/benchmark 'test/perf/*.test.ts'", diff --git a/packages/as-sha256/src/alloc.ts b/packages/as-sha256/src/alloc.ts index 3ee6c8121..d0857d5c9 100644 --- a/packages/as-sha256/src/alloc.ts +++ b/packages/as-sha256/src/alloc.ts @@ -1,3 +1,6 @@ +import process from "node:process"; +import {Buffer} from "node:buffer"; + const isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null; /** diff --git a/packages/as-sha256/src/index.ts b/packages/as-sha256/src/index.ts index b7dddfda1..401ed613e 100644 --- a/packages/as-sha256/src/index.ts +++ b/packages/as-sha256/src/index.ts @@ -1,8 +1,8 @@ -import {allocUnsafe} from "./alloc.js"; -import {newInstance, WasmContext} from "./wasm.js"; -import type {HashObject} from "./hashObject.js"; -import {byteArrayIntoHashObject, byteArrayToHashObject, hashObjectToByteArray} from "./hashObject.js"; -import SHA256 from "./sha256.js"; +import {allocUnsafe} from "./alloc.ts"; +import {newInstance, WasmContext} from "./wasm.ts"; +import type {HashObject} from "./hashObject.ts"; +import {byteArrayIntoHashObject, byteArrayToHashObject, hashObjectToByteArray} from "./hashObject.ts"; +import SHA256 from "./sha256.ts"; export {HashObject, byteArrayToHashObject, hashObjectToByteArray, byteArrayIntoHashObject, SHA256}; let ctx: WasmContext; diff --git a/packages/as-sha256/src/sha256.ts b/packages/as-sha256/src/sha256.ts index 16b38302a..d01c90946 100644 --- a/packages/as-sha256/src/sha256.ts +++ b/packages/as-sha256/src/sha256.ts @@ -1,4 +1,4 @@ -import {newInstance, WasmContext} from "./wasm.js"; +import {newInstance, WasmContext} from "./wasm.ts"; /** * Class based SHA256 diff --git a/packages/as-sha256/src/wasm.ts b/packages/as-sha256/src/wasm.ts index b30145689..a16906366 100644 --- a/packages/as-sha256/src/wasm.ts +++ b/packages/as-sha256/src/wasm.ts @@ -1,5 +1,5 @@ -import {wasmCode} from "./wasmCode.js"; -import {wasmSimdCode} from "./wasmSimdCode.js"; +import {wasmCode} from "./wasmCode.ts"; +import {wasmSimdCode} from "./wasmSimdCode.ts"; export interface WasmContext { readonly HAS_SIMD: boolean; diff --git a/packages/as-sha256/test/unit/getSimdTests.ts b/packages/as-sha256/test/unit/getSimdTests.ts index 3d4af287e..8f4d1f7ba 100644 --- a/packages/as-sha256/test/unit/getSimdTests.ts +++ b/packages/as-sha256/test/unit/getSimdTests.ts @@ -4,7 +4,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import {describe, beforeAll, expect, it} from "vitest"; import crypto from "crypto"; -import {byteArrayToHashObject, hashObjectToByteArray} from "../../src/hashObject.js"; +import {byteArrayToHashObject, hashObjectToByteArray} from "../../src/hashObject.ts"; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function getSimdTests(sha256: any, useSimd: boolean): void { diff --git a/packages/as-sha256/test/unit/index.test.ts b/packages/as-sha256/test/unit/index.test.ts index ce1fde950..618f4115b 100644 --- a/packages/as-sha256/test/unit/index.test.ts +++ b/packages/as-sha256/test/unit/index.test.ts @@ -8,7 +8,7 @@ import { digest64, digest64HashObjects, hashObjectToByteArray, -} from "../../src/index.js"; +} from "../../src/index.ts"; describe("hashObjectToByteArray and byteArrayToHashObject", function () { const tcs = [ diff --git a/packages/as-sha256/test/unit/noSimd.test.ts b/packages/as-sha256/test/unit/noSimd.test.ts index 1d524567c..9b3e609b0 100644 --- a/packages/as-sha256/test/unit/noSimd.test.ts +++ b/packages/as-sha256/test/unit/noSimd.test.ts @@ -1,5 +1,5 @@ -import * as sha256 from "../../src/index.js"; -import {getSimdTests} from "./getSimdTests.js"; +import * as sha256 from "../../src/index.ts"; +import {getSimdTests} from "./getSimdTests.ts"; const useSimd = false; getSimdTests(sha256, useSimd); diff --git a/packages/as-sha256/test/unit/simd.test.ts b/packages/as-sha256/test/unit/simd.test.ts index cc5eb7116..6ad58554d 100644 --- a/packages/as-sha256/test/unit/simd.test.ts +++ b/packages/as-sha256/test/unit/simd.test.ts @@ -1,5 +1,5 @@ -import * as sha256 from "../../src/index.js"; -import {getSimdTests} from "./getSimdTests.js"; +import * as sha256 from "../../src/index.ts"; +import {getSimdTests} from "./getSimdTests.ts"; const useSimd = true; getSimdTests(sha256, useSimd); diff --git a/packages/as-sha256/tsconfig.build.json b/packages/as-sha256/tsconfig.build.json deleted file mode 100644 index 0a6d98d94..000000000 --- a/packages/as-sha256/tsconfig.build.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "typeRoots": ["../../node_modules/@types", "./node_modules/@types", "./types"], - } -} diff --git a/packages/persistent-merkle-tree/package.json b/packages/persistent-merkle-tree/package.json index 4765b6107..acd125f65 100644 --- a/packages/persistent-merkle-tree/package.json +++ b/packages/persistent-merkle-tree/package.json @@ -4,45 +4,29 @@ "description": "Merkle tree implemented as a persistent datastructure", "type": "module", "exports": { - ".": { - "import": "./lib/index.js", - "types": "./lib/index.d.ts" - }, - "./hasher/hashtree": { - "import": "./lib/hasher/hashtree.js", - "types": "./lib/hasher/hashtree.d.ts" - }, - "./hasher/noble": { - "import": "./lib/hasher/noble.js", - "types": "./lib/hasher/noble.d.ts" - }, - "./hasher/as-sha256": { - "import": "./lib/hasher/as-sha256.js", - "types": "./lib/hasher/as-sha256.d.ts" - } + ".": "./src/index.ts", + "./hasher/hashtree": "./src/hasher/hashtree.ts", + "./hasher/noble": "./src/hasher/noble.ts", + "./hasher/as-sha256": "./src/hasher/as-sha256.ts" }, - "typesVersions": { - "*": { - "*": [ - "*", - "lib/*", - "lib/*/index" - ] - } + "engines": { + "node": ">= 18", + "deno": ">= 2.2", + "bun": ">= 1.1" }, - "files": [ - "lib" - ], "scripts": { "check-types": "tsc --noEmit", "clean": "rm -rf lib", - "build": "tsc -p tsconfig.build.json", "lint": "eslint --color --ext .ts src/", "lint:fix": "yarn run lint --fix", "benchmark:files": "node --max-old-space-size=4096 --expose-gc --loader ts-node/esm ../../node_modules/.bin/benchmark", "benchmark": "yarn benchmark:files 'test/perf/*.test.ts'", "benchmark:local": "yarn benchmark --local", - "test:unit": "vitest run --dir test/unit" + "test:unit": "vitest run --dir test/unit", + "build:jsr": "deno run -A ../../scripts/buildJsr.ts", + "build:npm": "deno run -A ../../scripts/buildNpm.ts", + "publish:jsr": "deno publish", + "publish:npm": "cd npm && npm publish" }, "pre-push": [ "lint" diff --git a/packages/persistent-merkle-tree/src/hashComputation.ts b/packages/persistent-merkle-tree/src/hashComputation.ts index 6017b64a7..6c4526b10 100644 --- a/packages/persistent-merkle-tree/src/hashComputation.ts +++ b/packages/persistent-merkle-tree/src/hashComputation.ts @@ -1,4 +1,4 @@ -import type {Node} from "./node.js"; +import type {Node} from "./node.ts"; /** * HashComputation to be later used to compute hash of nodes from bottom up. diff --git a/packages/persistent-merkle-tree/src/hasher/as-sha256.ts b/packages/persistent-merkle-tree/src/hasher/as-sha256.ts index 2eb26d1b1..8916bab35 100644 --- a/packages/persistent-merkle-tree/src/hasher/as-sha256.ts +++ b/packages/persistent-merkle-tree/src/hasher/as-sha256.ts @@ -5,10 +5,10 @@ import { batchHash4HashObjectInputs, hashInto, } from "@chainsafe/as-sha256"; -import type {Hasher} from "./types.js"; -import {Node} from "../node.js"; -import type {HashComputationLevel} from "../hashComputation.js"; -import {BLOCK_SIZE, doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util.js"; +import type {Hasher} from "./types.ts"; +import {Node} from "../node.ts"; +import type {HashComputationLevel} from "../hashComputation.ts"; +import {BLOCK_SIZE, doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util.ts"; /** * hashInto() function of as-sha256 loop through every 256 bytes diff --git a/packages/persistent-merkle-tree/src/hasher/hashtree.ts b/packages/persistent-merkle-tree/src/hasher/hashtree.ts index 27183ec4d..7a375e99f 100644 --- a/packages/persistent-merkle-tree/src/hasher/hashtree.ts +++ b/packages/persistent-merkle-tree/src/hasher/hashtree.ts @@ -1,9 +1,9 @@ import {hashInto} from "@chainsafe/hashtree"; -import {Hasher, HashObject} from "./types.js"; -import {Node} from "../node.js"; -import type {HashComputationLevel} from "../hashComputation.js"; +import {Hasher, HashObject} from "./types.ts"; +import {Node} from "../node.ts"; +import type {HashComputationLevel} from "../hashComputation.ts"; import {byteArrayIntoHashObject} from "@chainsafe/as-sha256"; -import {doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util.js"; +import {doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util.ts"; /** * Best SIMD implementation is in 512 bits = 64 bytes diff --git a/packages/persistent-merkle-tree/src/hasher/index.ts b/packages/persistent-merkle-tree/src/hasher/index.ts index 0aaadb9d4..b38c21b7d 100644 --- a/packages/persistent-merkle-tree/src/hasher/index.ts +++ b/packages/persistent-merkle-tree/src/hasher/index.ts @@ -1,9 +1,9 @@ -import {Hasher} from "./types.js"; -import {hasher as nobleHasher} from "./noble.js"; -import type {HashComputationLevel} from "../hashComputation.js"; +import {Hasher} from "./types.ts"; +import {hasher as nobleHasher} from "./noble.ts"; +import type {HashComputationLevel} from "../hashComputation.ts"; -export * from "./types.js"; -export * from "./util.js"; +export * from "./types.ts"; +export * from "./util.ts"; /** * Hasher used across the SSZ codebase, by default, this does not support batch hash. diff --git a/packages/persistent-merkle-tree/src/hasher/noble.ts b/packages/persistent-merkle-tree/src/hasher/noble.ts index 9096dbb41..4528cf1ed 100644 --- a/packages/persistent-merkle-tree/src/hasher/noble.ts +++ b/packages/persistent-merkle-tree/src/hasher/noble.ts @@ -1,13 +1,13 @@ import {sha256} from "@noble/hashes/sha256"; import {digest64HashObjects, byteArrayIntoHashObject} from "@chainsafe/as-sha256"; -import type {Hasher} from "./types.js"; +import type {Hasher} from "./types.ts"; import { BLOCK_SIZE, doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes, hashObjectToUint8Array, -} from "./util.js"; +} from "./util.ts"; const digest64 = (a: Uint8Array, b: Uint8Array): Uint8Array => sha256.create().update(a).update(b).digest(); const hashInto = (input: Uint8Array, output: Uint8Array): void => { diff --git a/packages/persistent-merkle-tree/src/hasher/types.ts b/packages/persistent-merkle-tree/src/hasher/types.ts index 37327fa48..ae6266461 100644 --- a/packages/persistent-merkle-tree/src/hasher/types.ts +++ b/packages/persistent-merkle-tree/src/hasher/types.ts @@ -1,5 +1,5 @@ import type {HashObject} from "@chainsafe/as-sha256"; -import type {HashComputationLevel} from "../hashComputation.js"; +import type {HashComputationLevel} from "../hashComputation.ts"; export type {HashObject}; diff --git a/packages/persistent-merkle-tree/src/hasher/util.ts b/packages/persistent-merkle-tree/src/hasher/util.ts index a93ec2d26..b97dfc44e 100644 --- a/packages/persistent-merkle-tree/src/hasher/util.ts +++ b/packages/persistent-merkle-tree/src/hasher/util.ts @@ -1,5 +1,5 @@ import {byteArrayToHashObject, HashObject, hashObjectToByteArray} from "@chainsafe/as-sha256"; -import {zeroHash} from "../zeroHash.js"; +import {zeroHash} from "../zeroHash.ts"; export function hashObjectToUint8Array(obj: HashObject): Uint8Array { const byteArr = new Uint8Array(32); diff --git a/packages/persistent-merkle-tree/src/index.ts b/packages/persistent-merkle-tree/src/index.ts index ab8f1e806..38759c0b8 100644 --- a/packages/persistent-merkle-tree/src/index.ts +++ b/packages/persistent-merkle-tree/src/index.ts @@ -1,11 +1,11 @@ -export * from "./gindex.js"; -export * from "./hasher/index.js"; -export * from "./node.js"; -export * from "./hashComputation.js"; -export * from "./packedNode.js"; -export * from "./proof/index.js"; -export * from "./subtree.js"; -export * from "./tree.js"; -export * from "./zeroNode.js"; -export * from "./zeroHash.js"; -export * from "./snapshot.js"; +export * from "./gindex.ts"; +export * from "./hasher/index.ts"; +export * from "./node.ts"; +export * from "./hashComputation.ts"; +export * from "./packedNode.ts"; +export * from "./proof/index.ts"; +export * from "./subtree.ts"; +export * from "./tree.ts"; +export * from "./zeroNode.ts"; +export * from "./zeroHash.ts"; +export * from "./snapshot.ts"; diff --git a/packages/persistent-merkle-tree/src/node.ts b/packages/persistent-merkle-tree/src/node.ts index b522fa747..c9e2195e8 100644 --- a/packages/persistent-merkle-tree/src/node.ts +++ b/packages/persistent-merkle-tree/src/node.ts @@ -1,5 +1,5 @@ import type {HashObject} from "@chainsafe/as-sha256"; -import {hashObjectToUint8Array, hasher, uint8ArrayToHashObject} from "./hasher/index.js"; +import {hashObjectToUint8Array, hasher, uint8ArrayToHashObject} from "./hasher/index.ts"; const TWO_POWER_32 = 2 ** 32; diff --git a/packages/persistent-merkle-tree/src/packedNode.ts b/packages/persistent-merkle-tree/src/packedNode.ts index 0644a5b81..59098518e 100644 --- a/packages/persistent-merkle-tree/src/packedNode.ts +++ b/packages/persistent-merkle-tree/src/packedNode.ts @@ -1,5 +1,5 @@ -import {subtreeFillToContents} from "./subtree.js"; -import {Node, LeafNode, getNodeH, setNodeH} from "./node.js"; +import {subtreeFillToContents} from "./subtree.ts"; +import {Node, LeafNode, getNodeH, setNodeH} from "./node.ts"; const NUMBER_2_POW_32 = 2 ** 32; diff --git a/packages/persistent-merkle-tree/src/proof/compactMulti.ts b/packages/persistent-merkle-tree/src/proof/compactMulti.ts index 712cdb1e9..d2b8af739 100644 --- a/packages/persistent-merkle-tree/src/proof/compactMulti.ts +++ b/packages/persistent-merkle-tree/src/proof/compactMulti.ts @@ -1,6 +1,6 @@ -import {convertGindexToBitstring, Gindex, GindexBitstring} from "../gindex.js"; -import {BranchNode, LeafNode, Node} from "../node.js"; -import {computeProofBitstrings} from "./util.js"; +import {convertGindexToBitstring, Gindex, GindexBitstring} from "../gindex.ts"; +import {BranchNode, LeafNode, Node} from "../node.ts"; +import {computeProofBitstrings} from "./util.ts"; export function computeDescriptor(indices: Gindex[]): Uint8Array { // include all helper indices diff --git a/packages/persistent-merkle-tree/src/proof/index.ts b/packages/persistent-merkle-tree/src/proof/index.ts index 6fea37c39..e5af42396 100644 --- a/packages/persistent-merkle-tree/src/proof/index.ts +++ b/packages/persistent-merkle-tree/src/proof/index.ts @@ -1,17 +1,17 @@ -import {Gindex} from "../gindex.js"; -import {Node} from "../node.js"; -import {createMultiProof, createNodeFromMultiProof} from "./multi.js"; -import {createNodeFromCompactMultiProof, createCompactMultiProof} from "./compactMulti.js"; -import {createNodeFromSingleProof, createSingleProof} from "./single.js"; +import {Gindex} from "../gindex.ts"; +import {Node} from "../node.ts"; +import {createMultiProof, createNodeFromMultiProof} from "./multi.ts"; +import {createNodeFromCompactMultiProof, createCompactMultiProof} from "./compactMulti.ts"; +import {createNodeFromSingleProof, createSingleProof} from "./single.ts"; import { computeTreeOffsetProofSerializedLength, createNodeFromTreeOffsetProof, createTreeOffsetProof, deserializeTreeOffsetProof, serializeTreeOffsetProof, -} from "./treeOffset.js"; +} from "./treeOffset.ts"; -export {computeDescriptor, descriptorToBitlist} from "./compactMulti.js"; +export {computeDescriptor, descriptorToBitlist} from "./compactMulti.ts"; export enum ProofType { single = "single", diff --git a/packages/persistent-merkle-tree/src/proof/multi.ts b/packages/persistent-merkle-tree/src/proof/multi.ts index 3c6d6eaab..ff24a32dd 100644 --- a/packages/persistent-merkle-tree/src/proof/multi.ts +++ b/packages/persistent-merkle-tree/src/proof/multi.ts @@ -1,7 +1,7 @@ -import {Gindex} from "../gindex.js"; -import {BranchNode, LeafNode, Node} from "../node.js"; -import {Tree} from "../tree.js"; -import {computeMultiProofBitstrings, SortOrder} from "./util.js"; +import {Gindex} from "../gindex.ts"; +import {BranchNode, LeafNode, Node} from "../node.ts"; +import {Tree} from "../tree.ts"; +import {computeMultiProofBitstrings, SortOrder} from "./util.ts"; /** * Create an multiproof diff --git a/packages/persistent-merkle-tree/src/proof/single.ts b/packages/persistent-merkle-tree/src/proof/single.ts index 31d90dd13..a456bec05 100644 --- a/packages/persistent-merkle-tree/src/proof/single.ts +++ b/packages/persistent-merkle-tree/src/proof/single.ts @@ -1,5 +1,5 @@ -import {BranchNode, LeafNode, Node} from "../node.js"; -import {Gindex, gindexIterator} from "../gindex.js"; +import {BranchNode, LeafNode, Node} from "../node.ts"; +import {Gindex, gindexIterator} from "../gindex.ts"; export const ERR_INVALID_NAV = "Invalid tree navigation"; diff --git a/packages/persistent-merkle-tree/src/proof/treeOffset.ts b/packages/persistent-merkle-tree/src/proof/treeOffset.ts index 10cb5e099..016ed80db 100644 --- a/packages/persistent-merkle-tree/src/proof/treeOffset.ts +++ b/packages/persistent-merkle-tree/src/proof/treeOffset.ts @@ -1,6 +1,6 @@ -import {Gindex, GindexBitstring} from "../gindex.js"; -import {BranchNode, LeafNode, Node} from "../node.js"; -import {computeMultiProofBitstrings} from "./util.js"; +import {Gindex, GindexBitstring} from "../gindex.ts"; +import {BranchNode, LeafNode, Node} from "../node.ts"; +import {computeMultiProofBitstrings} from "./util.ts"; /** * Compute offsets and leaves of a tree-offset proof diff --git a/packages/persistent-merkle-tree/src/proof/util.ts b/packages/persistent-merkle-tree/src/proof/util.ts index 736102348..16aeb491c 100644 --- a/packages/persistent-merkle-tree/src/proof/util.ts +++ b/packages/persistent-merkle-tree/src/proof/util.ts @@ -1,4 +1,4 @@ -import {Gindex, GindexBitstring, gindexParent, gindexSibling} from "../gindex.js"; +import {Gindex, GindexBitstring, gindexParent, gindexSibling} from "../gindex.ts"; // Not currently in use, but simpler implementation useful for testing /** diff --git a/packages/persistent-merkle-tree/src/snapshot.ts b/packages/persistent-merkle-tree/src/snapshot.ts index 26ab1c471..dad93c562 100644 --- a/packages/persistent-merkle-tree/src/snapshot.ts +++ b/packages/persistent-merkle-tree/src/snapshot.ts @@ -1,7 +1,7 @@ -import {Tree, getNode} from "./tree.js"; -import {zeroNode} from "./zeroNode.js"; -import {Gindex, toGindex} from "./gindex.js"; -import {LeafNode, Node} from "./node.js"; +import {Tree, getNode} from "./tree.ts"; +import {zeroNode} from "./zeroNode.ts"; +import {Gindex, toGindex} from "./gindex.ts"; +import {LeafNode, Node} from "./node.ts"; type Snapshot = { finalized: Uint8Array[]; diff --git a/packages/persistent-merkle-tree/src/subtree.ts b/packages/persistent-merkle-tree/src/subtree.ts index 4d3c6bb95..250d04d4f 100644 --- a/packages/persistent-merkle-tree/src/subtree.ts +++ b/packages/persistent-merkle-tree/src/subtree.ts @@ -1,6 +1,6 @@ -import {BranchNode, Node} from "./node.js"; -import {getHashComputations, levelAtIndex, HashComputationLevel} from "./hashComputation.js"; -import {zeroNode} from "./zeroNode.js"; +import {BranchNode, Node} from "./node.ts"; +import {getHashComputations, levelAtIndex, HashComputationLevel} from "./hashComputation.ts"; +import {zeroNode} from "./zeroNode.ts"; export function subtreeFillToDepth(bottom: Node, depth: number): Node { let node = bottom; diff --git a/packages/persistent-merkle-tree/src/tree.ts b/packages/persistent-merkle-tree/src/tree.ts index fbb1997b1..e4a459356 100644 --- a/packages/persistent-merkle-tree/src/tree.ts +++ b/packages/persistent-merkle-tree/src/tree.ts @@ -1,9 +1,9 @@ -import {zeroNode} from "./zeroNode.js"; -import {Gindex, GindexBitstring, convertGindexToBitstring} from "./gindex.js"; -import {Node, LeafNode, BranchNode} from "./node.js"; -import {HashComputationLevel, levelAtIndex} from "./hashComputation.js"; -import {createNodeFromProof, createProof, Proof, ProofInput} from "./proof/index.js"; -import {createSingleProof} from "./proof/single.js"; +import {zeroNode} from "./zeroNode.ts"; +import {Gindex, GindexBitstring, convertGindexToBitstring} from "./gindex.ts"; +import {Node, LeafNode, BranchNode} from "./node.ts"; +import {HashComputationLevel, levelAtIndex} from "./hashComputation.ts"; +import {createNodeFromProof, createProof, Proof, ProofInput} from "./proof/index.ts"; +import {createSingleProof} from "./proof/single.ts"; export type Hook = (newRootNode: Node) => void; diff --git a/packages/persistent-merkle-tree/src/zeroNode.ts b/packages/persistent-merkle-tree/src/zeroNode.ts index 838cea5cb..7b2dbda56 100644 --- a/packages/persistent-merkle-tree/src/zeroNode.ts +++ b/packages/persistent-merkle-tree/src/zeroNode.ts @@ -1,4 +1,4 @@ -import {BranchNode, LeafNode, Node} from "./node.js"; +import {BranchNode, LeafNode, Node} from "./node.ts"; const zeroes: Node[] = [LeafNode.fromZero()]; diff --git a/packages/persistent-merkle-tree/test/perf/gindex.test.ts b/packages/persistent-merkle-tree/test/perf/gindex.test.ts index 83df559b9..cd70bff4c 100644 --- a/packages/persistent-merkle-tree/test/perf/gindex.test.ts +++ b/packages/persistent-merkle-tree/test/perf/gindex.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {getGindexBits, getGindicesAtDepth, gindexIterator, iterateAtDepth} from "../../src/index.js"; +import {getGindexBits, getGindicesAtDepth, gindexIterator, iterateAtDepth} from "../../src/index.ts"; describe("gindices at depth", () => { const count = 100; diff --git a/packages/persistent-merkle-tree/test/perf/hashComputation.test.ts b/packages/persistent-merkle-tree/test/perf/hashComputation.test.ts index f8ca1979e..16fb76626 100644 --- a/packages/persistent-merkle-tree/test/perf/hashComputation.test.ts +++ b/packages/persistent-merkle-tree/test/perf/hashComputation.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {HashComputation, HashComputationLevel, LeafNode, zeroHash} from "../../src/index.js"; +import {HashComputation, HashComputationLevel, LeafNode, zeroHash} from "../../src/index.ts"; /** * HashComputationLevel push then loop is faster than HashComputation[] push then loop diff --git a/packages/persistent-merkle-tree/test/perf/hasher.test.ts b/packages/persistent-merkle-tree/test/perf/hasher.test.ts index bb306866e..14e1c125f 100644 --- a/packages/persistent-merkle-tree/test/perf/hasher.test.ts +++ b/packages/persistent-merkle-tree/test/perf/hasher.test.ts @@ -1,10 +1,10 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {Hasher, HashObject, setHasher, uint8ArrayToHashObject} from "../../src/hasher/index.js"; -import {hasher as asSha256Hasher} from "../../src/hasher/as-sha256.js"; -import {hasher as nobleHasher} from "../../src/hasher/noble.js"; -import {hasher as hashtreeHasher} from "../../src/hasher/hashtree.js"; -import {buildComparisonTrees} from "../utils/tree.js"; -import {HashComputationLevel, getHashComputations} from "../../src/index.js"; +import {Hasher, HashObject, setHasher, uint8ArrayToHashObject} from "../../src/hasher/index.ts"; +import {hasher as asSha256Hasher} from "../../src/hasher/as-sha256.ts"; +import {hasher as nobleHasher} from "../../src/hasher/noble.ts"; +import {hasher as hashtreeHasher} from "../../src/hasher/hashtree.ts"; +import {buildComparisonTrees} from "../utils/tree.ts"; +import {HashComputationLevel, getHashComputations} from "../../src/index.ts"; describe("hasher", function () { const iterations = 500_000; diff --git a/packages/persistent-merkle-tree/test/perf/node.test.ts b/packages/persistent-merkle-tree/test/perf/node.test.ts index 06d145bc4..62865f812 100644 --- a/packages/persistent-merkle-tree/test/perf/node.test.ts +++ b/packages/persistent-merkle-tree/test/perf/node.test.ts @@ -1,7 +1,7 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {BranchNode, getNodeH, LeafNode} from "../../src/node.js"; -import {countToDepth, getHashComputations, subtreeFillToContents} from "../../src/index.js"; -import {batchHash} from "../utils/batchHash.js"; +import {BranchNode, getNodeH, LeafNode} from "../../src/node.ts"; +import {countToDepth, getHashComputations, subtreeFillToContents} from "../../src/index.ts"; +import {batchHash} from "../utils/batchHash.ts"; describe("HashObject LeafNode", () => { // Number of new nodes created in processAttestations() on average diff --git a/packages/persistent-merkle-tree/test/perf/proof.test.ts b/packages/persistent-merkle-tree/test/perf/proof.test.ts index 6d5bad30f..d450981dd 100644 --- a/packages/persistent-merkle-tree/test/perf/proof.test.ts +++ b/packages/persistent-merkle-tree/test/perf/proof.test.ts @@ -1,6 +1,6 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {computeDescriptor, createProof, ProofType} from "../../src/proof/index.js"; -import {createTree} from "../utils/tree.js"; +import {computeDescriptor, createProof, ProofType} from "../../src/proof/index.ts"; +import {createTree} from "../utils/tree.ts"; describe("Proofs", () => { const depth = 15; diff --git a/packages/persistent-merkle-tree/test/perf/subtree.test.ts b/packages/persistent-merkle-tree/test/perf/subtree.test.ts index 15f52d4f2..3ba3f9e83 100644 --- a/packages/persistent-merkle-tree/test/perf/subtree.test.ts +++ b/packages/persistent-merkle-tree/test/perf/subtree.test.ts @@ -1,8 +1,8 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {Node} from "../../src/node.js"; -import {packedRootsBytesToLeafNodes} from "../../src/packedNode.js"; -import {subtreeFillToContents} from "../../src/subtree.js"; -import {zeroNode} from "../../src/zeroNode.js"; +import {Node} from "../../src/node.ts"; +import {packedRootsBytesToLeafNodes} from "../../src/packedNode.ts"; +import {subtreeFillToContents} from "../../src/subtree.ts"; +import {zeroNode} from "../../src/zeroNode.ts"; describe("packedRootsBytesToLeafNodes", () => { const bytes = 4 * 1000; diff --git a/packages/persistent-merkle-tree/test/perf/tree.test.ts b/packages/persistent-merkle-tree/test/perf/tree.test.ts index 63f559389..272af4d84 100644 --- a/packages/persistent-merkle-tree/test/perf/tree.test.ts +++ b/packages/persistent-merkle-tree/test/perf/tree.test.ts @@ -8,7 +8,7 @@ import { toGindex, uint8ArrayToHashObject, toGindexBitstring, -} from "../../src/index.js"; +} from "../../src/index.ts"; describe("Track the performance of different Tree methods", () => { const VALIDATOR_REGISTRY_LIMIT = 1099511627776; diff --git a/packages/persistent-merkle-tree/test/perf/tree/depthSmall.test.ts b/packages/persistent-merkle-tree/test/perf/tree/depthSmall.test.ts index 9b5d0c805..a467e121e 100644 --- a/packages/persistent-merkle-tree/test/perf/tree/depthSmall.test.ts +++ b/packages/persistent-merkle-tree/test/perf/tree/depthSmall.test.ts @@ -1,6 +1,6 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {getNodeAtDepth, getNodesAtDepth, setNodeAtDepth, setNodesAtDepth, zeroNode} from "../../../src/index.js"; -import {linspace, fillArray} from "../../utils/misc.js"; +import {getNodeAtDepth, getNodesAtDepth, setNodeAtDepth, setNodesAtDepth, zeroNode} from "../../../src/index.ts"; +import {linspace, fillArray} from "../../utils/misc.ts"; describe("Tree opts with low depth", () => { const runsFactor = 100_000; diff --git a/packages/persistent-merkle-tree/test/perf/tree/getNodes.test.ts b/packages/persistent-merkle-tree/test/perf/tree/getNodes.test.ts index fffef9947..715b685c1 100644 --- a/packages/persistent-merkle-tree/test/perf/tree/getNodes.test.ts +++ b/packages/persistent-merkle-tree/test/perf/tree/getNodes.test.ts @@ -7,7 +7,7 @@ import { getNodesAtDepth, zeroNode, BranchNode, -} from "../../../src/index.js"; +} from "../../../src/index.ts"; // Results in Linux Dec 2021 // diff --git a/packages/persistent-merkle-tree/test/perf/tree/setNodes.test.ts b/packages/persistent-merkle-tree/test/perf/tree/setNodes.test.ts index da3305be7..a1a050656 100644 --- a/packages/persistent-merkle-tree/test/perf/tree/setNodes.test.ts +++ b/packages/persistent-merkle-tree/test/perf/tree/setNodes.test.ts @@ -1,5 +1,5 @@ import {describe, bench, beforeAll} from "@chainsafe/benchmark"; -import {subtreeFillToContents, Tree, Node, LeafNode, toGindex, setNodesAtDepth} from "../../../src/index.js"; +import {subtreeFillToContents, Tree, Node, LeafNode, toGindex, setNodesAtDepth} from "../../../src/index.ts"; // Results in Linux Dec 2021 // diff --git a/packages/persistent-merkle-tree/test/perf/treeDepth.test.ts b/packages/persistent-merkle-tree/test/perf/treeDepth.test.ts index 0668b87f3..f86cf7948 100644 --- a/packages/persistent-merkle-tree/test/perf/treeDepth.test.ts +++ b/packages/persistent-merkle-tree/test/perf/treeDepth.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {Tree, iterateAtDepth, LeafNode, subtreeFillToDepth} from "../../src/index.js"; +import {Tree, iterateAtDepth, LeafNode, subtreeFillToDepth} from "../../src/index.ts"; describe("Tree", () => { for (const depth of [8, 16, 32]) { diff --git a/packages/persistent-merkle-tree/test/perf/validators.test.ts b/packages/persistent-merkle-tree/test/perf/validators.test.ts index 93489b764..4e944bb1b 100644 --- a/packages/persistent-merkle-tree/test/perf/validators.test.ts +++ b/packages/persistent-merkle-tree/test/perf/validators.test.ts @@ -1,7 +1,7 @@ import {bench, describe, setBenchOpts} from "@chainsafe/benchmark"; -import {LeafNode, subtreeFillToContents, Node, countToDepth, zeroNode, getHashComputations} from "../../src/index.js"; -import {MemoryTracker} from "../utils/memTracker.js"; -import {batchHash} from "../utils/batchHash.js"; +import {LeafNode, subtreeFillToContents, Node, countToDepth, zeroNode, getHashComputations} from "../../src/index.ts"; +import {MemoryTracker} from "../utils/memTracker.ts"; +import {batchHash} from "../utils/batchHash.ts"; /** * Below is measured on Mac M1. diff --git a/packages/persistent-merkle-tree/test/unit/backing.test.ts b/packages/persistent-merkle-tree/test/unit/backing.test.ts index 0d28b3c5e..3b0ac9952 100644 --- a/packages/persistent-merkle-tree/test/unit/backing.test.ts +++ b/packages/persistent-merkle-tree/test/unit/backing.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {Tree, LeafNode, subtreeFillToDepth} from "../../src/index.js"; +import {Tree, LeafNode, subtreeFillToDepth} from "../../src/index.ts"; describe("get", () => { it("should return the right node", () => { diff --git a/packages/persistent-merkle-tree/test/unit/gindex.test.ts b/packages/persistent-merkle-tree/test/unit/gindex.test.ts index c8ce814e2..860d48e99 100644 --- a/packages/persistent-merkle-tree/test/unit/gindex.test.ts +++ b/packages/persistent-merkle-tree/test/unit/gindex.test.ts @@ -9,7 +9,7 @@ import { Bit, getGindicesAtDepth, getGindexBits, -} from "../../src/index.js"; +} from "../../src/index.ts"; describe("countToDepth", () => { const testCases = [ diff --git a/packages/persistent-merkle-tree/test/unit/hashComputation.test.ts b/packages/persistent-merkle-tree/test/unit/hashComputation.test.ts index 6ce413408..3331c1353 100644 --- a/packages/persistent-merkle-tree/test/unit/hashComputation.test.ts +++ b/packages/persistent-merkle-tree/test/unit/hashComputation.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect, beforeEach} from "vitest"; -import {zeroNode, Node} from "../../src/index.js"; -import {HashComputationLevel} from "../../src/hashComputation.js"; +import {zeroNode, Node} from "../../src/index.ts"; +import {HashComputationLevel} from "../../src/hashComputation.ts"; describe("HashComputationLevel", () => { let hashComputationLevel: HashComputationLevel; diff --git a/packages/persistent-merkle-tree/test/unit/hasher.test.ts b/packages/persistent-merkle-tree/test/unit/hasher.test.ts index 4ddf66ba9..9e74d2f5a 100644 --- a/packages/persistent-merkle-tree/test/unit/hasher.test.ts +++ b/packages/persistent-merkle-tree/test/unit/hasher.test.ts @@ -1,11 +1,11 @@ import {describe, it, expect} from "vitest"; -import {expectEqualHex} from "../utils/expectHex.js"; -import {uint8ArrayToHashObject, hashObjectToUint8Array} from "../../src/hasher/util.js"; -import {hasher as nobleHasher} from "../../src/hasher/noble.js"; -import {hasher as asSha256Hasher} from "../../src/hasher/as-sha256.js"; -import {hasher as hashtreeHasher} from "../../src/hasher/hashtree.js"; -import {buildComparisonTrees} from "../utils/tree.js"; +import {expectEqualHex} from "../utils/expectHex.ts"; +import {uint8ArrayToHashObject, hashObjectToUint8Array} from "../../src/hasher/util.ts"; +import {hasher as nobleHasher} from "../../src/hasher/noble.ts"; +import {hasher as asSha256Hasher} from "../../src/hasher/as-sha256.ts"; +import {hasher as hashtreeHasher} from "../../src/hasher/hashtree.ts"; +import {buildComparisonTrees} from "../utils/tree.ts"; import { HashComputationLevel, HashObject, @@ -13,8 +13,8 @@ import { LeafNode, getHashComputations, subtreeFillToContents, -} from "../../src/index.js"; -import {zeroHash} from "../../src/zeroHash.js"; +} from "../../src/index.ts"; +import {zeroHash} from "../../src/zeroHash.ts"; describe("hashers", function () { const hashers: Hasher[] = [hashtreeHasher, asSha256Hasher, nobleHasher]; diff --git a/packages/persistent-merkle-tree/test/unit/node.test.ts b/packages/persistent-merkle-tree/test/unit/node.test.ts index 7e9f3d508..82820fca8 100644 --- a/packages/persistent-merkle-tree/test/unit/node.test.ts +++ b/packages/persistent-merkle-tree/test/unit/node.test.ts @@ -1,7 +1,7 @@ import type {HashObject} from "@chainsafe/as-sha256"; import {describe, it, expect} from "vitest"; -import {BranchNode, LeafNode, countToDepth, subtreeFillToContents} from "../../src/index.js"; -import {HashComputation, HashComputationLevel, getHashComputations} from "../../src/hashComputation.js"; +import {BranchNode, LeafNode, countToDepth, subtreeFillToContents} from "../../src/index.ts"; +import {HashComputation, HashComputationLevel, getHashComputations} from "../../src/hashComputation.ts"; describe("LeafNode uint", () => { const testCasesNode: { diff --git a/packages/persistent-merkle-tree/test/unit/packedNode.test.ts b/packages/persistent-merkle-tree/test/unit/packedNode.test.ts index 47682174b..3ad5dba93 100644 --- a/packages/persistent-merkle-tree/test/unit/packedNode.test.ts +++ b/packages/persistent-merkle-tree/test/unit/packedNode.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; import type {HashObject} from "@chainsafe/as-sha256"; -import {LeafNode, Node} from "../../src/index.js"; -import {packedNodeRootsToBytes, packedRootsBytesToLeafNodes, packedUintNum64sToLeafNodes} from "../../src/packedNode.js"; +import {LeafNode, Node} from "../../src/index.ts"; +import {packedNodeRootsToBytes, packedRootsBytesToLeafNodes, packedUintNum64sToLeafNodes} from "../../src/packedNode.ts"; describe("subtree / packedNode single node", () => { const testCases: { diff --git a/packages/persistent-merkle-tree/test/unit/proof/compactMulti.test.ts b/packages/persistent-merkle-tree/test/unit/proof/compactMulti.test.ts index ca44e9204..6f9ceda2e 100644 --- a/packages/persistent-merkle-tree/test/unit/proof/compactMulti.test.ts +++ b/packages/persistent-merkle-tree/test/unit/proof/compactMulti.test.ts @@ -4,8 +4,8 @@ import { createCompactMultiProof, descriptorToBitlist, computeDescriptor, -} from "../../../src/proof/compactMulti.js"; -import {createTree} from "../../utils/tree.js"; +} from "../../../src/proof/compactMulti.ts"; +import {createTree} from "../../utils/tree.ts"; describe("CompactMultiProof", () => { const descriptorTestCases = [ diff --git a/packages/persistent-merkle-tree/test/unit/proof/index.test.ts b/packages/persistent-merkle-tree/test/unit/proof/index.test.ts index 69e98a20a..3a24e4dce 100644 --- a/packages/persistent-merkle-tree/test/unit/proof/index.test.ts +++ b/packages/persistent-merkle-tree/test/unit/proof/index.test.ts @@ -6,8 +6,8 @@ import { deserializeProof, ProofType, serializeProof, -} from "../../../src/proof/index.js"; -import {createTree} from "../../utils/tree.js"; +} from "../../../src/proof/index.ts"; +import {createTree} from "../../utils/tree.ts"; describe("proof equivalence", () => { it("should compute the same root from different proof types - single leaf", () => { diff --git a/packages/persistent-merkle-tree/test/unit/proof/treeOffset.test.ts b/packages/persistent-merkle-tree/test/unit/proof/treeOffset.test.ts index 28df6577f..80f798a33 100644 --- a/packages/persistent-merkle-tree/test/unit/proof/treeOffset.test.ts +++ b/packages/persistent-merkle-tree/test/unit/proof/treeOffset.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {createNodeFromTreeOffsetProof, createTreeOffsetProof} from "../../../src/proof/treeOffset.js"; -import {zeroNode} from "../../../src/zeroNode.js"; +import {createNodeFromTreeOffsetProof, createTreeOffsetProof} from "../../../src/proof/treeOffset.ts"; +import {zeroNode} from "../../../src/zeroNode.ts"; describe("computeTreeOffsetProof", () => { it("should properly compute known testcases", () => { diff --git a/packages/persistent-merkle-tree/test/unit/proof/util.test.ts b/packages/persistent-merkle-tree/test/unit/proof/util.test.ts index 1250a543a..f860aa12a 100644 --- a/packages/persistent-merkle-tree/test/unit/proof/util.test.ts +++ b/packages/persistent-merkle-tree/test/unit/proof/util.test.ts @@ -6,7 +6,7 @@ import { filterParentBitstrings, computeMultiProofBitstrings, sortDecreasingBitstrings, -} from "../../../src/proof/util.js"; +} from "../../../src/proof/util.ts"; describe("computeProofGindices", () => { it("simple implementation should match bitstring implementation", () => { diff --git a/packages/persistent-merkle-tree/test/unit/snapshot.test.ts b/packages/persistent-merkle-tree/test/unit/snapshot.test.ts index 174bf09cc..16edf5fed 100644 --- a/packages/persistent-merkle-tree/test/unit/snapshot.test.ts +++ b/packages/persistent-merkle-tree/test/unit/snapshot.test.ts @@ -1,9 +1,9 @@ import {describe, it, expect} from "vitest"; -import {fromSnapshot, indexToFinalizedGindices, toSnapshot} from "../../src/snapshot.js"; -import {subtreeFillToContents} from "../../src/subtree.js"; -import { LeafNode } from "../../src/node.js"; -import { Tree, setNodesAtDepth } from "../../src/tree.js"; -import { toGindex } from "../../src/index.js"; +import {fromSnapshot, indexToFinalizedGindices, toSnapshot} from "../../src/snapshot.ts"; +import {subtreeFillToContents} from "../../src/subtree.ts"; +import { LeafNode } from "../../src/node.ts"; +import { Tree, setNodesAtDepth } from "../../src/tree.ts"; +import { toGindex } from "../../src/index.ts"; describe("toSnapshot and fromSnapshot", () => { const depth = 4; diff --git a/packages/persistent-merkle-tree/test/unit/subtree.test.ts b/packages/persistent-merkle-tree/test/unit/subtree.test.ts index edf12643b..3e7b1c8da 100644 --- a/packages/persistent-merkle-tree/test/unit/subtree.test.ts +++ b/packages/persistent-merkle-tree/test/unit/subtree.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect, vi} from "vitest"; -import {subtreeFillToContents, LeafNode, getNodesAtDepth, executeHashComputations, BranchNode, Node, HashComputationLevel, zeroNode} from "../../src/index.js"; +import {subtreeFillToContents, LeafNode, getNodesAtDepth, executeHashComputations, BranchNode, Node, HashComputationLevel, zeroNode} from "../../src/index.ts"; describe("subtreeFillToContents", () => { // the hash computation takes time diff --git a/packages/persistent-merkle-tree/test/unit/tree.test.ts b/packages/persistent-merkle-tree/test/unit/tree.test.ts index f51d472e7..a6adde053 100644 --- a/packages/persistent-merkle-tree/test/unit/tree.test.ts +++ b/packages/persistent-merkle-tree/test/unit/tree.test.ts @@ -12,8 +12,8 @@ import { findDiffDepthi, getHashComputations, HashComputationLevel, -} from "../../src/index.js"; -import {batchHash} from "../utils/batchHash.js"; +} from "../../src/index.ts"; +import {batchHash} from "../utils/batchHash.ts"; describe("fixed-depth tree iteration", () => { it("should properly navigate the zero tree", () => { diff --git a/packages/persistent-merkle-tree/test/unit/tree/getNodes.test.ts b/packages/persistent-merkle-tree/test/unit/tree/getNodes.test.ts index 7cb34ac9b..4f0e9ba23 100644 --- a/packages/persistent-merkle-tree/test/unit/tree/getNodes.test.ts +++ b/packages/persistent-merkle-tree/test/unit/tree/getNodes.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect, beforeAll} from "vitest"; -import {getNodesAtDepth, LeafNode, Node, subtreeFillToContents, Tree} from "../../../src/index.js"; +import {getNodesAtDepth, LeafNode, Node, subtreeFillToContents, Tree} from "../../../src/index.ts"; describe("tree / getNodes", () => { const depth = 40; diff --git a/packages/persistent-merkle-tree/test/unit/tree/zeroAfterIndex.test.ts b/packages/persistent-merkle-tree/test/unit/tree/zeroAfterIndex.test.ts index 59af19f14..3ad51bd0e 100644 --- a/packages/persistent-merkle-tree/test/unit/tree/zeroAfterIndex.test.ts +++ b/packages/persistent-merkle-tree/test/unit/tree/zeroAfterIndex.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {LeafNode, Node, toGindex, Tree, zeroNode, treeZeroAfterIndex, getNodesAtDepth} from "../../../src/index.js"; +import {LeafNode, Node, toGindex, Tree, zeroNode, treeZeroAfterIndex, getNodesAtDepth} from "../../../src/index.ts"; describe("tree / zeroAfterIndex", () => { // Test all possible zeroAfterIndex operations for any tree with 0 <= depth < 6 diff --git a/packages/persistent-merkle-tree/test/utils/batchHash.ts b/packages/persistent-merkle-tree/test/utils/batchHash.ts index 6300031c8..f7ba98817 100644 --- a/packages/persistent-merkle-tree/test/utils/batchHash.ts +++ b/packages/persistent-merkle-tree/test/utils/batchHash.ts @@ -1,6 +1,6 @@ -import { HashComputationLevel, getHashComputations } from "../../src/hashComputation.js"; -import { executeHashComputations } from "../../src/hasher/index.js"; -import { Node } from "../../src/node.js"; +import { HashComputationLevel, getHashComputations } from "../../src/hashComputation.ts"; +import { executeHashComputations } from "../../src/hasher/index.ts"; +import { Node } from "../../src/node.ts"; /** * This is only a test utility function, don't want to use it in production because it allocates memory every time. diff --git a/packages/persistent-merkle-tree/test/utils/tree.ts b/packages/persistent-merkle-tree/test/utils/tree.ts index 032b1fd3e..fd5e76af6 100644 --- a/packages/persistent-merkle-tree/test/utils/tree.ts +++ b/packages/persistent-merkle-tree/test/utils/tree.ts @@ -1,6 +1,6 @@ -import {subtreeFillToContents} from "../../src/index.js"; -import {BranchNode, LeafNode, Node} from "../../src/node.js"; -import {linspace} from "./misc.js"; +import {subtreeFillToContents} from "../../src/index.ts"; +import {BranchNode, LeafNode, Node} from "../../src/node.ts"; +import {linspace} from "./misc.ts"; export function createTree(depth: number, index = 0): Node { if (!depth) { diff --git a/packages/persistent-merkle-tree/tsconfig.build.json b/packages/persistent-merkle-tree/tsconfig.build.json deleted file mode 100644 index 5f4950d18..000000000 --- a/packages/persistent-merkle-tree/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../tsconfig.build.json", - "include": [ - "src" - ], - "compilerOptions": { - "outDir": "lib", - "typeRoots": [ - "../../node_modules/@types", - "./node_modules/@types", - "./types" - ], - } -} \ No newline at end of file diff --git a/packages/persistent-ts/package.json b/packages/persistent-ts/package.json index 7add4c17b..16f68c9b4 100644 --- a/packages/persistent-ts/package.json +++ b/packages/persistent-ts/package.json @@ -3,20 +3,26 @@ "version": "1.0.0", "description": "Persistent data structures for TypeScript.", "type": "module", - "main": "./lib/index.js", - "types": "./lib/index.d.ts", - "files": [ - "lib/**/*.d.ts", - "lib/**/*.js", - "lib/**/*.js.map" - ], + "exports": { + ".": { + "import": "./src/index.ts" + } + }, + "engines": { + "node": ">= 18", + "deno": ">= 2.2", + "bun": ">= 1.1" + }, "scripts": { "clean": "rm -rf lib", - "build": "tsc -p tsconfig.build.json", "lint": "eslint --color --ext .ts src/", "check-types": "tsc --noEmit", "test:unit": "vitest run --dir test/unit", - "test:perf": "node --loader=ts-node/esm' benchmark 'test/perf/**/*.test.ts'" + "test:perf": "node --loader=ts-node/esm' benchmark 'test/perf/**/*.test.ts'", + "build:jsr": "deno run -A ../../scripts/buildJsr.ts", + "build:npm": "deno run -A ../../scripts/buildNpm.ts", + "publish:jsr": "deno publish", + "publish:npm": "cd npm && npm publish" }, "repository": { "type": "git", diff --git a/packages/persistent-ts/src/MutableVector.ts b/packages/persistent-ts/src/MutableVector.ts index 446cb3702..bb2f05765 100644 --- a/packages/persistent-ts/src/MutableVector.ts +++ b/packages/persistent-ts/src/MutableVector.ts @@ -1,4 +1,4 @@ -import {PersistentVector, TransientVector} from "./Vector.js"; +import {PersistentVector, TransientVector} from "./Vector.ts"; /** * A mutable reference to a PersistentVector or TransientVector diff --git a/packages/persistent-ts/src/index.ts b/packages/persistent-ts/src/index.ts index b54f7a0fb..9420895bb 100644 --- a/packages/persistent-ts/src/index.ts +++ b/packages/persistent-ts/src/index.ts @@ -1,3 +1,3 @@ -export * from "./List.js"; -export * from "./Vector.js"; -export * from "./MutableVector.js"; +export * from "./List.ts"; +export * from "./Vector.ts"; +export * from "./MutableVector.ts"; diff --git a/packages/persistent-ts/test/unit/List.test.ts b/packages/persistent-ts/test/unit/List.test.ts index 98879da94..818947977 100644 --- a/packages/persistent-ts/test/unit/List.test.ts +++ b/packages/persistent-ts/test/unit/List.test.ts @@ -1,6 +1,6 @@ import fc from "fast-check"; import {describe, it, expect} from "vitest"; -import {List} from "../../src/List.js"; +import {List} from "../../src/List.ts"; describe("List", () => { it("List.empty isEmpty", () => { diff --git a/packages/persistent-ts/test/unit/Vector.test.ts b/packages/persistent-ts/test/unit/Vector.test.ts index 294242d34..40fd9a7cc 100644 --- a/packages/persistent-ts/test/unit/Vector.test.ts +++ b/packages/persistent-ts/test/unit/Vector.test.ts @@ -1,6 +1,6 @@ import fc from "fast-check"; import {describe, it, expect} from "vitest"; -import {PersistentVector, TransientVector} from "../../src/Vector.js"; +import {PersistentVector, TransientVector} from "../../src/Vector.ts"; describe("Vector", () => { it("PersistentVector.empty has a length of 0", () => { diff --git a/packages/persistent-ts/tsconfig.build.json b/packages/persistent-ts/tsconfig.build.json deleted file mode 100644 index 5f4950d18..000000000 --- a/packages/persistent-ts/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../tsconfig.build.json", - "include": [ - "src" - ], - "compilerOptions": { - "outDir": "lib", - "typeRoots": [ - "../../node_modules/@types", - "./node_modules/@types", - "./types" - ], - } -} \ No newline at end of file diff --git a/packages/simpleserialize.com/.github/workflows/checks.yml b/packages/simpleserialize.com/.github/workflows/checks.yml index 3842780d5..f6aa5b34f 100644 --- a/packages/simpleserialize.com/.github/workflows/checks.yml +++ b/packages/simpleserialize.com/.github/workflows/checks.yml @@ -8,6 +8,5 @@ jobs: steps: - uses: actions/checkout@v1 - run: yarn install - - run: yarn build - run: yarn check-types - run: yarn lint diff --git a/packages/ssz/package.json b/packages/ssz/package.json index f900fb823..5bf07c8fa 100644 --- a/packages/ssz/package.json +++ b/packages/ssz/package.json @@ -6,23 +6,21 @@ "homepage": "https://github.com/chainsafe/ssz", "version": "1.0.2", "type": "module", - "main": "./lib/index.js", - "types": "./lib/index.d.ts", - "files": [ - "lib/**/*.d.ts", - "lib/**/*.js", - "lib/**/*.js.map" - ], + "engines": { + "node": ">= 18", + "deno": ">= 2.2", + "bun": ">= 1.1" + }, + "exports": { + ".": { + "import": "./sc/index.ts" + } + }, "scripts": { - "build": "tsc -p tsconfig.build.json", - "build-web": "webpack --mode production --entry ./lib/esm/web.js --output ./dist/ssz.min.js", - "build:docs": "typedoc --exclude src/index.ts,src/web.ts --out docs src", - "build:release": "yarn clean && yarn build && yarn build-web && yarn run build:docs", "check-types": "tsc --noEmit", "clean": "rm -rf lib && rm -rf dist && rm -f tsconfig.tsbuildinfo", "lint": "eslint --color --ext .ts src/ test/", "lint:fix": "yarn run lint --fix", - "prepublishOnly": "yarn build", "benchmark": "node --max-old-space-size=4096 --expose-gc ../../node_modules/.bin/benchmark 'test/perf/*.test.ts'", "benchmark:local": "yarn benchmark --local", "test:perf": "node --loader=ts-node/esm' benchmark 'test/perf/**/*.test.ts'", @@ -33,7 +31,13 @@ "test:spec-static-minimal": "LODESTAR_PRESET=minimal vitest run --dir test/spec/ test/spec/ssz_static.test.ts", "test:spec-static-mainnet": "LODESTAR_PRESET=mainnet vitest run --dir test/spec/ test/spec/ssz_static.test.ts", "test:spec-eip-4881": "vitest run --dir test/spec/ test/spec/eip-4881/**/*.test.ts", - "download-spec-tests": "node --loader ts-node/esm test/spec/downloadTests.ts" + "download-spec-tests": "node --loader ts-node/esm test/spec/downloadTests.ts", + "build:docs": "typedoc --exclude src/index.ts,src/web.ts --out docs src", + "build:web": "webpack --mode production --entry ./lib/esm/web.js --output ./dist/ssz.min.js", + "build:jsr": "deno run -A ../../scripts/buildJsr.ts", + "build:npm": "deno run -A ../../scripts/buildNpm.ts", + "publish:jsr": "deno publish", + "publish:npm": "cd npm && npm publish" }, "dependencies": { "@chainsafe/as-sha256": "1.0.0", diff --git a/packages/ssz/src/index.ts b/packages/ssz/src/index.ts index 360b8ce98..d27659dfc 100644 --- a/packages/ssz/src/index.ts +++ b/packages/ssz/src/index.ts @@ -1,42 +1,48 @@ // Types -export {BitListType, deserializeUint8ArrayBitListFromBytes} from "./type/bitList.js"; -export {BitVectorType} from "./type/bitVector.js"; -export {BooleanType} from "./type/boolean.js"; -export {ByteListType} from "./type/byteList.js"; -export {ByteVectorType} from "./type/byteVector.js"; -export {ContainerType} from "./type/container.js"; -export {ContainerNodeStructType} from "./type/containerNodeStruct.js"; -export {ListBasicType} from "./type/listBasic.js"; -export {ListCompositeType} from "./type/listComposite.js"; -export {PartialListCompositeType} from "./type/partialListComposite.js"; -export {NoneType} from "./type/none.js"; -export {UintBigintType, UintNumberType} from "./type/uint.js"; -export {UnionType} from "./type/union.js"; -export {OptionalType} from "./type/optional.js"; -export {VectorBasicType} from "./type/vectorBasic.js"; -export {VectorCompositeType} from "./type/vectorComposite.js"; -export {ListUintNum64Type} from "./type/listUintNum64.js"; -export {StableContainerType} from "./type/stableContainer.js"; -export {ProfileType} from "./type/profile.js"; +export {BitListType, deserializeUint8ArrayBitListFromBytes} from "./type/bitList.ts"; +export {BitVectorType} from "./type/bitVector.ts"; +export {BooleanType} from "./type/boolean.ts"; +export {ByteListType} from "./type/byteList.ts"; +export {ByteVectorType} from "./type/byteVector.ts"; +export {ContainerType} from "./type/container.ts"; +export {ContainerNodeStructType} from "./type/containerNodeStruct.ts"; +export {ListBasicType} from "./type/listBasic.ts"; +export {ListCompositeType} from "./type/listComposite.ts"; +export {PartialListCompositeType} from "./type/partialListComposite.ts"; +export {NoneType} from "./type/none.ts"; +export {UintBigintType, UintNumberType} from "./type/uint.ts"; +export {UnionType} from "./type/union.ts"; +export {OptionalType} from "./type/optional.ts"; +export {VectorBasicType} from "./type/vectorBasic.ts"; +export {VectorCompositeType} from "./type/vectorComposite.ts"; +export {ListUintNum64Type} from "./type/listUintNum64.ts"; +export {StableContainerType} from "./type/stableContainer.ts"; +export {ProfileType} from "./type/profile.ts"; // Base types -export {ArrayType} from "./type/array.js"; -export {BitArrayType} from "./type/bitArray.js"; -export {ByteArrayType} from "./type/byteArray.js"; +export {ArrayType} from "./type/array.ts"; +export {BitArrayType} from "./type/bitArray.ts"; +export {ByteArrayType} from "./type/byteArray.ts"; // Base type clases -export {Type, ValueOf, JsonPath, ByteViews} from "./type/abstract.js"; -export {BasicType, isBasicType} from "./type/basic.js"; -export {CompositeType, CompositeTypeAny, CompositeView, CompositeViewDU, isCompositeType} from "./type/composite.js"; -export {TreeView} from "./view/abstract.js"; -export {ValueOfFields} from "./view/container.js"; -export {TreeViewDU} from "./viewDU/abstract.js"; +export {Type, type ValueOf, type JsonPath, type ByteViews} from "./type/abstract.ts"; +export {BasicType, isBasicType} from "./type/basic.ts"; +export { + CompositeType, + type CompositeTypeAny, + type CompositeView, + type CompositeViewDU, + isCompositeType, +} from "./type/composite.ts"; +export {TreeView} from "./view/abstract.ts"; +export {type ValueOfFields} from "./view/container.ts"; +export {TreeViewDU} from "./viewDU/abstract.ts"; // Values -export {BitArray, getUint8ByteToBitBooleanArray} from "./value/bitArray.js"; +export {BitArray, getUint8ByteToBitBooleanArray} from "./value/bitArray.ts"; // Utils -export {fromHexString, toHexString, byteArrayEquals} from "./util/byteArray.js"; -export {Snapshot} from "./util/types.js"; -export {hash64, symbolCachedPermanentRoot} from "./util/merkleize.js"; -export {upgradeToNewType} from "./util/upgrade.js"; +export {fromHexString, toHexString, byteArrayEquals} from "./util/byteArray.ts"; +export {type Snapshot} from "./util/types.ts"; +export {hash64, symbolCachedPermanentRoot} from "./util/merkleize.ts"; +export {upgradeToNewType} from "./util/upgrade.ts"; diff --git a/packages/ssz/src/type/array.ts b/packages/ssz/src/type/array.ts index 1d6c19b69..3cab393f5 100644 --- a/packages/ssz/src/type/array.ts +++ b/packages/ssz/src/type/array.ts @@ -1,6 +1,6 @@ import {concatGindices, getNode, Gindex, Node, toGindex} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf, Type} from "./abstract.js"; -import {CompositeType, isCompositeType, LENGTH_GINDEX} from "./composite.js"; +import {ValueOf, Type} from "./abstract.ts"; +import {CompositeType, isCompositeType, LENGTH_GINDEX} from "./composite.ts"; import { value_fromJsonArray, value_toJsonArray, @@ -8,7 +8,7 @@ import { value_equals, value_defaultValueArray, ArrayProps, -} from "./arrayBasic.js"; +} from "./arrayBasic.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/arrayBasic.ts b/packages/ssz/src/type/arrayBasic.ts index 9743169fb..53ef76cf3 100644 --- a/packages/ssz/src/type/arrayBasic.ts +++ b/packages/ssz/src/type/arrayBasic.ts @@ -8,8 +8,8 @@ import { HashComputationLevel, levelAtIndex, } from "@chainsafe/persistent-merkle-tree"; -import {Type, ValueOf, ByteViews} from "./abstract.js"; -import {BasicType} from "./basic.js"; +import {Type, ValueOf, ByteViews} from "./abstract.ts"; +import {BasicType} from "./basic.ts"; // There's a matrix of Array-ish types that require a combination of this functions. // Regular class extends syntax doesn't work because it can only extend a single class. diff --git a/packages/ssz/src/type/arrayComposite.ts b/packages/ssz/src/type/arrayComposite.ts index f6dcf0562..c2861d6dc 100644 --- a/packages/ssz/src/type/arrayComposite.ts +++ b/packages/ssz/src/type/arrayComposite.ts @@ -1,7 +1,7 @@ import {Node, getNodesAtDepth, subtreeFillToContents} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf, ByteViews} from "./abstract.js"; -import {CompositeType} from "./composite.js"; -import {addLengthNode, assertValidArrayLength} from "./arrayBasic.js"; +import {ValueOf, ByteViews} from "./abstract.ts"; +import {CompositeType} from "./composite.ts"; +import {addLengthNode, assertValidArrayLength} from "./arrayBasic.ts"; // There's a matrix of Array-ish types that require a combination of this functions. // Regular class extends syntax doesn't work because it can only extend a single class. diff --git a/packages/ssz/src/type/basic.ts b/packages/ssz/src/type/basic.ts index 9fff70632..8d148aec1 100644 --- a/packages/ssz/src/type/basic.ts +++ b/packages/ssz/src/type/basic.ts @@ -1,5 +1,5 @@ import {LeafNode} from "@chainsafe/persistent-merkle-tree"; -import {Type} from "./abstract.js"; +import {Type} from "./abstract.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/bitArray.ts b/packages/ssz/src/type/bitArray.ts index ebe90cbc3..f7893d2e6 100644 --- a/packages/ssz/src/type/bitArray.ts +++ b/packages/ssz/src/type/bitArray.ts @@ -1,10 +1,10 @@ import {concatGindices, Gindex, Node, toGindex, Tree, HashComputationLevel} from "@chainsafe/persistent-merkle-tree"; -import {fromHexString, toHexString, byteArrayEquals} from "../util/byteArray.js"; -import {splitIntoRootChunks} from "../util/merkleize.js"; -import {CompositeType, LENGTH_GINDEX} from "./composite.js"; -import {BitArray} from "../value/bitArray.js"; -import {BitArrayTreeView} from "../view/bitArray.js"; -import {BitArrayTreeViewDU} from "../viewDU/bitArray.js"; +import {fromHexString, toHexString, byteArrayEquals} from "../util/byteArray.ts"; +import {splitIntoRootChunks} from "../util/merkleize.ts"; +import {CompositeType, LENGTH_GINDEX} from "./composite.ts"; +import {BitArray} from "../value/bitArray.ts"; +import {BitArrayTreeView} from "../view/bitArray.ts"; +import {BitArrayTreeViewDU} from "../viewDU/bitArray.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/bitList.ts b/packages/ssz/src/type/bitList.ts index 5afd2dc64..fa3221cda 100644 --- a/packages/ssz/src/type/bitList.ts +++ b/packages/ssz/src/type/bitList.ts @@ -1,11 +1,11 @@ import {getNodesAtDepth, Node, packedNodeRootsToBytes, packedRootsBytesToNode} from "@chainsafe/persistent-merkle-tree"; -import {mixInLength, maxChunksToDepth} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ByteViews} from "./composite.js"; -import {addLengthNode, getLengthFromRootNode, getChunksNodeFromRootNode} from "./arrayBasic.js"; -import {BitArray} from "../value/bitArray.js"; -import {BitArrayType} from "./bitArray.js"; +import {mixInLength, maxChunksToDepth} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ByteViews} from "./composite.ts"; +import {addLengthNode, getLengthFromRootNode, getChunksNodeFromRootNode} from "./arrayBasic.ts"; +import {BitArray} from "../value/bitArray.ts"; +import {BitArrayType} from "./bitArray.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/bitVector.ts b/packages/ssz/src/type/bitVector.ts index d07304e02..547f1ee71 100644 --- a/packages/ssz/src/type/bitVector.ts +++ b/packages/ssz/src/type/bitVector.ts @@ -1,10 +1,10 @@ import {getNodesAtDepth, Node, packedNodeRootsToBytes, packedRootsBytesToNode} from "@chainsafe/persistent-merkle-tree"; -import {maxChunksToDepth} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ByteViews} from "./composite.js"; -import {BitArray} from "../value/bitArray.js"; -import {BitArrayType} from "./bitArray.js"; +import {maxChunksToDepth} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ByteViews} from "./composite.ts"; +import {BitArray} from "../value/bitArray.ts"; +import {BitArrayType} from "./bitArray.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/boolean.ts b/packages/ssz/src/type/boolean.ts index 21703fdba..e84dc36fe 100644 --- a/packages/ssz/src/type/boolean.ts +++ b/packages/ssz/src/type/boolean.ts @@ -1,8 +1,8 @@ import {LeafNode, Node} from "@chainsafe/persistent-merkle-tree"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ByteViews} from "./abstract.js"; -import {BasicType} from "./basic.js"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ByteViews} from "./abstract.ts"; +import {BasicType} from "./basic.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/byteArray.ts b/packages/ssz/src/type/byteArray.ts index 5ae470233..0962416dc 100644 --- a/packages/ssz/src/type/byteArray.ts +++ b/packages/ssz/src/type/byteArray.ts @@ -7,10 +7,10 @@ import { HashComputationLevel, getHashComputations, } from "@chainsafe/persistent-merkle-tree"; -import {fromHexString, toHexString, byteArrayEquals} from "../util/byteArray.js"; -import {splitIntoRootChunks} from "../util/merkleize.js"; -import {ByteViews} from "./abstract.js"; -import {CompositeType, LENGTH_GINDEX} from "./composite.js"; +import {fromHexString, toHexString, byteArrayEquals} from "../util/byteArray.ts"; +import {splitIntoRootChunks} from "../util/merkleize.ts"; +import {ByteViews} from "./abstract.ts"; +import {CompositeType, LENGTH_GINDEX} from "./composite.ts"; export type ByteArray = Uint8Array; diff --git a/packages/ssz/src/type/byteList.ts b/packages/ssz/src/type/byteList.ts index 01c857e7b..873f95ebf 100644 --- a/packages/ssz/src/type/byteList.ts +++ b/packages/ssz/src/type/byteList.ts @@ -1,10 +1,10 @@ import {getNodesAtDepth, Node, packedNodeRootsToBytes, packedRootsBytesToNode} from "@chainsafe/persistent-merkle-tree"; -import {mixInLength, maxChunksToDepth} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {addLengthNode, getChunksNodeFromRootNode, getLengthFromRootNode} from "./arrayBasic.js"; -import {ByteViews} from "./composite.js"; -import {ByteArrayType, ByteArray} from "./byteArray.js"; +import {mixInLength, maxChunksToDepth} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {addLengthNode, getChunksNodeFromRootNode, getLengthFromRootNode} from "./arrayBasic.ts"; +import {ByteViews} from "./composite.ts"; +import {ByteArrayType, ByteArray} from "./byteArray.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/byteVector.ts b/packages/ssz/src/type/byteVector.ts index bae30ce48..47e98adef 100644 --- a/packages/ssz/src/type/byteVector.ts +++ b/packages/ssz/src/type/byteVector.ts @@ -1,9 +1,9 @@ import {getNodesAtDepth, Node, packedNodeRootsToBytes, packedRootsBytesToNode} from "@chainsafe/persistent-merkle-tree"; -import {maxChunksToDepth} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ByteViews} from "./composite.js"; -import {ByteArrayType} from "./byteArray.js"; +import {maxChunksToDepth} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ByteViews} from "./composite.ts"; +import {ByteArrayType} from "./byteArray.ts"; export type ByteVector = Uint8Array; diff --git a/packages/ssz/src/type/composite.ts b/packages/ssz/src/type/composite.ts index d0c58aa36..57f611e1a 100644 --- a/packages/ssz/src/type/composite.ts +++ b/packages/ssz/src/type/composite.ts @@ -9,11 +9,11 @@ import { Tree, HashComputationLevel, } from "@chainsafe/persistent-merkle-tree"; -import {byteArrayEquals} from "../util/byteArray.js"; -import {merkleize, symbolCachedPermanentRoot, ValueWithCachedPermanentRoot} from "../util/merkleize.js"; -import {treePostProcessFromProofNode} from "../util/proof/treePostProcessFromProofNode.js"; -import {Type, ByteViews, JsonPath, JsonPathProp} from "./abstract.js"; -export {ByteViews}; +import {byteArrayEquals} from "../util/byteArray.ts"; +import {merkleize, symbolCachedPermanentRoot, ValueWithCachedPermanentRoot} from "../util/merkleize.ts"; +import {treePostProcessFromProofNode} from "../util/proof/treePostProcessFromProofNode.ts"; +import {Type, ByteViews, JsonPath, JsonPathProp} from "./abstract.ts"; +export {type ByteViews}; export const LENGTH_GINDEX = BigInt(3); diff --git a/packages/ssz/src/type/container.ts b/packages/ssz/src/type/container.ts index a09f03fb3..fc5908527 100644 --- a/packages/ssz/src/type/container.ts +++ b/packages/ssz/src/type/container.ts @@ -9,19 +9,19 @@ import { getNode, HashComputationLevel, } from "@chainsafe/persistent-merkle-tree"; -import {maxChunksToDepth} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {Type, ValueOf} from "./abstract.js"; -import {CompositeType, ByteViews, CompositeTypeAny} from "./composite.js"; -import {getContainerTreeViewClass} from "../view/container.js"; -import {ValueOfFields, FieldEntry, ContainerTreeViewType, ContainerTreeViewTypeConstructor} from "../view/container.js"; +import {maxChunksToDepth} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {Type, ValueOf} from "./abstract.ts"; +import {CompositeType, ByteViews, CompositeTypeAny} from "./composite.ts"; +import {getContainerTreeViewClass} from "../view/container.ts"; +import {ValueOfFields, FieldEntry, ContainerTreeViewType, ContainerTreeViewTypeConstructor} from "../view/container.ts"; import { getContainerTreeViewDUClass, ContainerTreeViewDUType, ContainerTreeViewDUTypeConstructor, -} from "../viewDU/container.js"; -import {Case} from "../util/strings.js"; +} from "../viewDU/container.ts"; +import {Case} from "../util/strings.ts"; /* eslint-disable @typescript-eslint/member-ordering */ type BytesRange = {start: number; end: number}; diff --git a/packages/ssz/src/type/containerNodeStruct.ts b/packages/ssz/src/type/containerNodeStruct.ts index 00de9e2eb..0cc8de528 100644 --- a/packages/ssz/src/type/containerNodeStruct.ts +++ b/packages/ssz/src/type/containerNodeStruct.ts @@ -1,13 +1,13 @@ import {Node} from "@chainsafe/persistent-merkle-tree"; -import {Type, ByteViews} from "./abstract.js"; -import {isCompositeType} from "./composite.js"; -import {ContainerType, ContainerOptions, renderContainerTypeName} from "./container.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {getContainerTreeViewClass} from "../view/containerNodeStruct.js"; -import {getContainerTreeViewDUClass} from "../viewDU/containerNodeStruct.js"; -import {BranchNodeStruct} from "../branchNodeStruct.js"; -import {ValueOfFields} from "../view/container.js"; +import {Type, ByteViews} from "./abstract.ts"; +import {isCompositeType} from "./composite.ts"; +import {ContainerType, ContainerOptions, renderContainerTypeName} from "./container.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {getContainerTreeViewClass} from "../view/containerNodeStruct.ts"; +import {getContainerTreeViewDUClass} from "../viewDU/containerNodeStruct.ts"; +import {BranchNodeStruct} from "../branchNodeStruct.ts"; +import {ValueOfFields} from "../view/container.ts"; /** * ContainerNodeStruct: ordered heterogeneous collection of values. diff --git a/packages/ssz/src/type/listBasic.ts b/packages/ssz/src/type/listBasic.ts index 0640f12cd..74bb88a99 100644 --- a/packages/ssz/src/type/listBasic.ts +++ b/packages/ssz/src/type/listBasic.ts @@ -1,7 +1,7 @@ import {LeafNode, Node, Tree, HashComputationLevel} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "./abstract.js"; -import {BasicType} from "./basic.js"; -import {ByteViews} from "./composite.js"; +import {ValueOf} from "./abstract.ts"; +import {BasicType} from "./basic.ts"; +import {ByteViews} from "./composite.ts"; import { value_deserializeFromBytesArrayBasic, value_serializeToBytesArrayBasic, @@ -9,20 +9,20 @@ import { tree_serializeToBytesArrayBasic, addLengthNode, setChunksNode, -} from "./arrayBasic.js"; +} from "./arrayBasic.ts"; import { mixInLength, maxChunksToDepth, splitIntoRootChunks, symbolCachedPermanentRoot, ValueWithCachedPermanentRoot, -} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ArrayBasicType} from "../view/arrayBasic.js"; -import {ListBasicTreeView} from "../view/listBasic.js"; -import {ListBasicTreeViewDU} from "../viewDU/listBasic.js"; -import {ArrayType} from "./array.js"; +} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ArrayBasicType} from "../view/arrayBasic.ts"; +import {ListBasicTreeView} from "../view/listBasic.ts"; +import {ListBasicTreeViewDU} from "../viewDU/listBasic.ts"; +import {ArrayType} from "./array.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/listComposite.ts b/packages/ssz/src/type/listComposite.ts index 3b7314e55..51a6d40b9 100644 --- a/packages/ssz/src/type/listComposite.ts +++ b/packages/ssz/src/type/listComposite.ts @@ -4,12 +4,12 @@ import { maxChunksToDepth, symbolCachedPermanentRoot, ValueWithCachedPermanentRoot, -} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ValueOf, ByteViews} from "./abstract.js"; -import {CompositeType, CompositeView, CompositeViewDU} from "./composite.js"; -import {addLengthNode, getLengthFromRootNode, setChunksNode} from "./arrayBasic.js"; +} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ValueOf, ByteViews} from "./abstract.ts"; +import {CompositeType, CompositeView, CompositeViewDU} from "./composite.ts"; +import {addLengthNode, getLengthFromRootNode, setChunksNode} from "./arrayBasic.ts"; import { value_deserializeFromBytesArrayComposite, value_serializedSizeArrayComposite, @@ -19,11 +19,11 @@ import { tree_serializeToBytesArrayComposite, value_getRootsArrayComposite, maxSizeArrayComposite, -} from "./arrayComposite.js"; -import {ArrayCompositeType} from "../view/arrayComposite.js"; -import {ListCompositeTreeView} from "../view/listComposite.js"; -import {ListCompositeTreeViewDU} from "../viewDU/listComposite.js"; -import {ArrayType} from "./array.js"; +} from "./arrayComposite.ts"; +import {ArrayCompositeType} from "../view/arrayComposite.ts"; +import {ListCompositeTreeView} from "../view/listComposite.ts"; +import {ListCompositeTreeViewDU} from "../viewDU/listComposite.ts"; +import {ArrayType} from "./array.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/listUintNum64.ts b/packages/ssz/src/type/listUintNum64.ts index 46c92f3ba..038e952b9 100644 --- a/packages/ssz/src/type/listUintNum64.ts +++ b/packages/ssz/src/type/listUintNum64.ts @@ -1,9 +1,9 @@ import {LeafNode, Node, packedUintNum64sToLeafNodes, subtreeFillToContents} from "@chainsafe/persistent-merkle-tree"; -import {ListBasicTreeViewDU} from "../viewDU/listBasic.js"; -import {ListBasicOpts, ListBasicType} from "./listBasic.js"; -import {UintNumberType} from "./uint.js"; -import {addLengthNode} from "./arrayBasic.js"; +import {ListBasicTreeViewDU} from "../viewDU/listBasic.ts"; +import {ListBasicOpts, ListBasicType} from "./listBasic.ts"; +import {UintNumberType} from "./uint.ts"; +import {addLengthNode} from "./arrayBasic.ts"; /** * Specific implementation of ListBasicType for UintNumberType with some optimizations. diff --git a/packages/ssz/src/type/none.ts b/packages/ssz/src/type/none.ts index 36b01e98e..72cd1174b 100644 --- a/packages/ssz/src/type/none.ts +++ b/packages/ssz/src/type/none.ts @@ -1,6 +1,6 @@ import {LeafNode, Node, zeroNode} from "@chainsafe/persistent-merkle-tree"; -import {ByteViews} from "./abstract.js"; -import {BasicType} from "./basic.js"; +import {ByteViews} from "./abstract.ts"; +import {BasicType} from "./basic.ts"; /* eslint-disable @typescript-eslint/member-ordering */ /* eslint-disable @typescript-eslint/no-unused-vars */ diff --git a/packages/ssz/src/type/optional.ts b/packages/ssz/src/type/optional.ts index 4edcf57c5..9db7e1a3a 100644 --- a/packages/ssz/src/type/optional.ts +++ b/packages/ssz/src/type/optional.ts @@ -7,12 +7,12 @@ import { HashComputationLevel, getHashComputations, } from "@chainsafe/persistent-merkle-tree"; -import {mixInLength} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {Type, ByteViews, JsonPath, JsonPathProp} from "./abstract.js"; -import {CompositeType, isCompositeType} from "./composite.js"; -import {addLengthNode, getLengthFromRootNode} from "./arrayBasic.js"; +import {mixInLength} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {Type, ByteViews, JsonPath, JsonPathProp} from "./abstract.ts"; +import {CompositeType, isCompositeType} from "./composite.ts"; +import {addLengthNode, getLengthFromRootNode} from "./arrayBasic.ts"; /* eslint-disable @typescript-eslint/member-ordering */ export type NonOptionalType> = T extends OptionalType ? U : T; diff --git a/packages/ssz/src/type/partialListComposite.ts b/packages/ssz/src/type/partialListComposite.ts index a7a187d26..b544e35b8 100644 --- a/packages/ssz/src/type/partialListComposite.ts +++ b/packages/ssz/src/type/partialListComposite.ts @@ -1,11 +1,11 @@ import {fromSnapshot, zeroNode} from "@chainsafe/persistent-merkle-tree"; -import {CompositeType, CompositeView, CompositeViewDU} from "./composite.js"; -import {ListCompositeOpts, ListCompositeType} from "./listComposite.js"; -import {PartialListCompositeTreeViewDU} from "../viewDU/partialListComposite.js"; -import {Snapshot} from "../util/types.js"; -import {byteArrayEquals} from "../util/byteArray.js"; -import {zeroSnapshot} from "../util/snapshot.js"; -import {addLengthNode} from "./arrayBasic.js"; +import {CompositeType, CompositeView, CompositeViewDU} from "./composite.ts"; +import {ListCompositeOpts, ListCompositeType} from "./listComposite.ts"; +import {PartialListCompositeTreeViewDU} from "../viewDU/partialListComposite.ts"; +import {Snapshot} from "../util/types.ts"; +import {byteArrayEquals} from "../util/byteArray.ts"; +import {zeroSnapshot} from "../util/snapshot.ts"; +import {addLengthNode} from "./arrayBasic.ts"; /** * Similar to ListCompositeType, this is mainly used to create a PartialListCompositeTreeViewDU from a snapshot. diff --git a/packages/ssz/src/type/profile.ts b/packages/ssz/src/type/profile.ts index 0ec0e454b..4edc2f005 100644 --- a/packages/ssz/src/type/profile.ts +++ b/packages/ssz/src/type/profile.ts @@ -11,11 +11,11 @@ import { zeroHash, zeroNode, } from "@chainsafe/persistent-merkle-tree"; -import {ValueWithCachedPermanentRoot, maxChunksToDepth, symbolCachedPermanentRoot} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {Type, ValueOf} from "./abstract.js"; -import {CompositeType, ByteViews, CompositeTypeAny} from "./composite.js"; +import {ValueWithCachedPermanentRoot, maxChunksToDepth, symbolCachedPermanentRoot} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {Type, ValueOf} from "./abstract.ts"; +import {CompositeType, ByteViews, CompositeTypeAny} from "./composite.ts"; import { getProfileTreeViewClass, ValueOfFields, @@ -23,16 +23,16 @@ import { ContainerTreeViewType, ContainerTreeViewTypeConstructor, computeSerdesData, -} from "../view/profile.js"; +} from "../view/profile.ts"; import { getProfileTreeViewDUClass, ContainerTreeViewDUType, ContainerTreeViewDUTypeConstructor, -} from "../viewDU/profile.js"; -import {Case} from "../util/strings.js"; -import {BitArray} from "../value/bitArray.js"; -import {mixInActiveFields, setActiveFields} from "./stableContainer.js"; -import {NonOptionalFields, isOptionalType, toNonOptionalType} from "./optional.js"; +} from "../viewDU/profile.ts"; +import {Case} from "../util/strings.ts"; +import {BitArray} from "../value/bitArray.ts"; +import {mixInActiveFields, setActiveFields} from "./stableContainer.ts"; +import {NonOptionalFields, isOptionalType, toNonOptionalType} from "./optional.ts"; /* eslint-disable @typescript-eslint/member-ordering */ type BytesRange = {start: number; end: number}; diff --git a/packages/ssz/src/type/stableContainer.ts b/packages/ssz/src/type/stableContainer.ts index 99069305f..e603ec9c4 100644 --- a/packages/ssz/src/type/stableContainer.ts +++ b/packages/ssz/src/type/stableContainer.ts @@ -23,11 +23,11 @@ import { merkleize, splitIntoRootChunks, symbolCachedPermanentRoot, -} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {JsonPath, Type, ValueOf} from "./abstract.js"; -import {CompositeType, ByteViews, CompositeTypeAny, isCompositeType} from "./composite.js"; +} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {JsonPath, Type, ValueOf} from "./abstract.ts"; +import {CompositeType, ByteViews, CompositeTypeAny, isCompositeType} from "./composite.ts"; import { getContainerTreeViewClass, ValueOfFields, @@ -35,15 +35,15 @@ import { ContainerTreeViewType, ContainerTreeViewTypeConstructor, computeSerdesData, -} from "../view/stableContainer.js"; +} from "../view/stableContainer.ts"; import { getContainerTreeViewDUClass, ContainerTreeViewDUType, ContainerTreeViewDUTypeConstructor, -} from "../viewDU/stableContainer.js"; -import {Case} from "../util/strings.js"; -import {isOptionalType, toNonOptionalType, NonOptionalFields} from "./optional.js"; -import {BitArray} from "../value/bitArray.js"; +} from "../viewDU/stableContainer.ts"; +import {Case} from "../util/strings.ts"; +import {isOptionalType, toNonOptionalType, NonOptionalFields} from "./optional.ts"; +import {BitArray} from "../value/bitArray.ts"; /* eslint-disable @typescript-eslint/member-ordering */ type BytesRange = {start: number; end: number}; diff --git a/packages/ssz/src/type/uint.ts b/packages/ssz/src/type/uint.ts index ccd2ad6e3..1d8eb23ec 100644 --- a/packages/ssz/src/type/uint.ts +++ b/packages/ssz/src/type/uint.ts @@ -1,8 +1,8 @@ import {LeafNode, Node} from "@chainsafe/persistent-merkle-tree"; -import {namedClass} from "../util/named.js"; -import {Require} from "../util/types.js"; -import {ByteViews} from "./abstract.js"; -import {BasicType} from "./basic.js"; +import {namedClass} from "../util/named.ts"; +import {Require} from "../util/types.ts"; +import {ByteViews} from "./abstract.ts"; +import {BasicType} from "./basic.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/union.ts b/packages/ssz/src/type/union.ts index b02a1cc34..406c38775 100644 --- a/packages/ssz/src/type/union.ts +++ b/packages/ssz/src/type/union.ts @@ -7,13 +7,13 @@ import { HashComputationLevel, getHashComputations, } from "@chainsafe/persistent-merkle-tree"; -import {mixInLength} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {Type, ByteViews} from "./abstract.js"; -import {CompositeType, isCompositeType} from "./composite.js"; -import {addLengthNode, getLengthFromRootNode} from "./arrayBasic.js"; -import {NoneType} from "./none.js"; +import {mixInLength} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {Type, ByteViews} from "./abstract.ts"; +import {CompositeType, isCompositeType} from "./composite.ts"; +import {addLengthNode, getLengthFromRootNode} from "./arrayBasic.ts"; +import {NoneType} from "./none.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/vectorBasic.ts b/packages/ssz/src/type/vectorBasic.ts index 2c5b73c7f..098d1d9a4 100644 --- a/packages/ssz/src/type/vectorBasic.ts +++ b/packages/ssz/src/type/vectorBasic.ts @@ -1,18 +1,18 @@ import {Node, Tree, HashComputationLevel} from "@chainsafe/persistent-merkle-tree"; -import {maxChunksToDepth, splitIntoRootChunks} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ValueOf, ByteViews} from "./abstract.js"; -import {BasicType} from "./basic.js"; +import {maxChunksToDepth, splitIntoRootChunks} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ValueOf, ByteViews} from "./abstract.ts"; +import {BasicType} from "./basic.ts"; import { value_deserializeFromBytesArrayBasic, value_serializeToBytesArrayBasic, tree_deserializeFromBytesArrayBasic, tree_serializeToBytesArrayBasic, -} from "./arrayBasic.js"; -import {ArrayBasicType, ArrayBasicTreeView} from "../view/arrayBasic.js"; -import {ArrayBasicTreeViewDU} from "../viewDU/arrayBasic.js"; -import {ArrayType} from "./array.js"; +} from "./arrayBasic.ts"; +import {ArrayBasicType, ArrayBasicTreeView} from "../view/arrayBasic.ts"; +import {ArrayBasicTreeViewDU} from "../viewDU/arrayBasic.ts"; +import {ArrayType} from "./array.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/type/vectorComposite.ts b/packages/ssz/src/type/vectorComposite.ts index 57971b1f1..f1c4c9243 100644 --- a/packages/ssz/src/type/vectorComposite.ts +++ b/packages/ssz/src/type/vectorComposite.ts @@ -1,9 +1,9 @@ import {Node, Tree, HashComputationLevel} from "@chainsafe/persistent-merkle-tree"; -import {maxChunksToDepth} from "../util/merkleize.js"; -import {Require} from "../util/types.js"; -import {namedClass} from "../util/named.js"; -import {ValueOf, ByteViews} from "./abstract.js"; -import {CompositeType, CompositeView, CompositeViewDU} from "./composite.js"; +import {maxChunksToDepth} from "../util/merkleize.ts"; +import {Require} from "../util/types.ts"; +import {namedClass} from "../util/named.ts"; +import {ValueOf, ByteViews} from "./abstract.ts"; +import {CompositeType, CompositeView, CompositeViewDU} from "./composite.ts"; import { value_deserializeFromBytesArrayComposite, value_serializedSizeArrayComposite, @@ -14,10 +14,10 @@ import { value_getRootsArrayComposite, maxSizeArrayComposite, minSizeArrayComposite, -} from "./arrayComposite.js"; -import {ArrayCompositeType, ArrayCompositeTreeView} from "../view/arrayComposite.js"; -import {ArrayCompositeTreeViewDU} from "../viewDU/arrayComposite.js"; -import {ArrayType} from "./array.js"; +} from "./arrayComposite.ts"; +import {ArrayCompositeType, ArrayCompositeTreeView} from "../view/arrayComposite.ts"; +import {ArrayCompositeTreeViewDU} from "../viewDU/arrayComposite.ts"; +import {ArrayType} from "./array.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/util/byteArray.ts b/packages/ssz/src/util/byteArray.ts index 31cf06931..0d6293540 100644 --- a/packages/ssz/src/util/byteArray.ts +++ b/packages/ssz/src/util/byteArray.ts @@ -1,4 +1,4 @@ -import {ByteVector} from "../interface.js"; +import {ByteVector} from "../interface.ts"; // Caching this info costs about ~1000 bytes and speeds up toHexString() by x6 const hexByByte = new Array(256); diff --git a/packages/ssz/src/util/merkleize.ts b/packages/ssz/src/util/merkleize.ts index 2c237df5b..505f57dd2 100644 --- a/packages/ssz/src/util/merkleize.ts +++ b/packages/ssz/src/util/merkleize.ts @@ -1,5 +1,6 @@ import {hasher} from "@chainsafe/persistent-merkle-tree"; import {zeroHash} from "@chainsafe/persistent-merkle-tree"; +import {Buffer} from "node:buffer"; /** Dedicated property to cache hashTreeRoot of immutable CompositeType values */ export const symbolCachedPermanentRoot = Symbol("ssz_cached_permanent_root"); diff --git a/packages/ssz/src/util/proof/treePartialToJsonPaths.ts b/packages/ssz/src/util/proof/treePartialToJsonPaths.ts index 40d284055..7f695b21e 100644 --- a/packages/ssz/src/util/proof/treePartialToJsonPaths.ts +++ b/packages/ssz/src/util/proof/treePartialToJsonPaths.ts @@ -1,5 +1,5 @@ import {BranchNode, LeafNode, Node} from "@chainsafe/persistent-merkle-tree"; -import {CompositeType, isCompositeType} from "../../type/composite.js"; +import {CompositeType, isCompositeType} from "../../type/composite.ts"; type JsonPathProp = string | number; type JsonPath = JsonPathProp[]; diff --git a/packages/ssz/src/util/snapshot.ts b/packages/ssz/src/util/snapshot.ts index 4ff5c7730..c3321244d 100644 --- a/packages/ssz/src/util/snapshot.ts +++ b/packages/ssz/src/util/snapshot.ts @@ -1,6 +1,6 @@ import {zeroHash} from "@chainsafe/persistent-merkle-tree"; -import {hash64} from "./merkleize.js"; -import {Snapshot} from "./types.js"; +import {hash64} from "./merkleize.ts"; +import {Snapshot} from "./types.ts"; /** * Create a zero snapshot with the given chunksDepth. diff --git a/packages/ssz/src/util/upgrade.ts b/packages/ssz/src/util/upgrade.ts index 8e0830ac3..b8aa2eaa4 100644 --- a/packages/ssz/src/util/upgrade.ts +++ b/packages/ssz/src/util/upgrade.ts @@ -1,5 +1,5 @@ import {BranchNode, Node, zeroNode} from "@chainsafe/persistent-merkle-tree"; -import {ContainerType} from "../type/container.js"; +import {ContainerType} from "../type/container.ts"; /** Upgrade the current View/ViewDU to a root node of new type */ // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/ssz/src/view/abstract.ts b/packages/ssz/src/view/abstract.ts index ab16b327b..0d639698a 100644 --- a/packages/ssz/src/view/abstract.ts +++ b/packages/ssz/src/view/abstract.ts @@ -1,6 +1,6 @@ import {Node, Tree, Proof} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf, JsonPath} from "../type/abstract.js"; -import {CompositeType} from "../type/composite.js"; +import {ValueOf, JsonPath} from "../type/abstract.ts"; +import {CompositeType} from "../type/composite.ts"; /** * A Tree View is a wrapper around a type and an SSZ Tree that contains: diff --git a/packages/ssz/src/view/arrayBasic.ts b/packages/ssz/src/view/arrayBasic.ts index 48cbf44e3..1365a0fe4 100644 --- a/packages/ssz/src/view/arrayBasic.ts +++ b/packages/ssz/src/view/arrayBasic.ts @@ -1,9 +1,9 @@ import {getNodesAtDepth, LeafNode, Node, Tree, HashComputationLevel} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "../type/abstract.js"; -import {BasicType} from "../type/basic.js"; -import {CompositeType} from "../type/composite.js"; -import {TreeViewDU} from "../viewDU/abstract.js"; -import {TreeView} from "./abstract.js"; +import {ValueOf} from "../type/abstract.ts"; +import {BasicType} from "../type/basic.ts"; +import {CompositeType} from "../type/composite.ts"; +import {TreeViewDU} from "../viewDU/abstract.ts"; +import {TreeView} from "./abstract.ts"; /** Expected API of this View's type. This interface allows to break a recursive dependency between types and views */ export type ArrayBasicType> = CompositeType< diff --git a/packages/ssz/src/view/arrayComposite.ts b/packages/ssz/src/view/arrayComposite.ts index 87912aa99..dc8e1ef3f 100644 --- a/packages/ssz/src/view/arrayComposite.ts +++ b/packages/ssz/src/view/arrayComposite.ts @@ -1,8 +1,8 @@ import {getNodesAtDepth, Node, toGindexBitstring, Tree} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "../type/abstract.js"; -import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.js"; -import {TreeView} from "./abstract.js"; -import {ArrayType} from "./arrayBasic.js"; +import {ValueOf} from "../type/abstract.ts"; +import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.ts"; +import {TreeView} from "./abstract.ts"; +import {ArrayType} from "./arrayBasic.ts"; /** Expected API of this View's type. This interface allows to break a recursive dependency between types and views */ export type ArrayCompositeType< diff --git a/packages/ssz/src/view/bitArray.ts b/packages/ssz/src/view/bitArray.ts index 017e6a7df..d5a841303 100644 --- a/packages/ssz/src/view/bitArray.ts +++ b/packages/ssz/src/view/bitArray.ts @@ -1,7 +1,7 @@ import {Tree, Node} from "@chainsafe/persistent-merkle-tree"; -import {BitArray} from "../value/bitArray.js"; -import {CompositeType} from "../type/composite.js"; -import {TreeView} from "./abstract.js"; +import {BitArray} from "../value/bitArray.ts"; +import {CompositeType} from "../type/composite.ts"; +import {TreeView} from "./abstract.ts"; /** * Thin wrapper around BitArray to upstream changes to `tree` on every `this.set()` diff --git a/packages/ssz/src/view/container.ts b/packages/ssz/src/view/container.ts index ee10a4b54..7bb9c64fa 100644 --- a/packages/ssz/src/view/container.ts +++ b/packages/ssz/src/view/container.ts @@ -1,9 +1,9 @@ import {getNodeAtDepth, Gindex, LeafNode, Node, toGindexBitstring, Tree} from "@chainsafe/persistent-merkle-tree"; -import {Type, ValueOf} from "../type/abstract.js"; -import {isBasicType, BasicType} from "../type/basic.js"; -import {isCompositeType, CompositeType} from "../type/composite.js"; -import {TreeView} from "./abstract.js"; -import {NonOptionalFields} from "../type/optional.js"; +import {Type, ValueOf} from "../type/abstract.ts"; +import {isBasicType, BasicType} from "../type/basic.ts"; +import {isCompositeType, CompositeType} from "../type/composite.ts"; +import {TreeView} from "./abstract.ts"; +import {NonOptionalFields} from "../type/optional.ts"; export type FieldEntry>> = { fieldName: keyof Fields; diff --git a/packages/ssz/src/view/containerNodeStruct.ts b/packages/ssz/src/view/containerNodeStruct.ts index ee26f9e94..cca4b3c69 100644 --- a/packages/ssz/src/view/containerNodeStruct.ts +++ b/packages/ssz/src/view/containerNodeStruct.ts @@ -1,9 +1,9 @@ import {Node, Tree} from "@chainsafe/persistent-merkle-tree"; -import {Type, ValueOf} from "../type/abstract.js"; -import {isCompositeType} from "../type/composite.js"; -import {BranchNodeStruct} from "../branchNodeStruct.js"; -import {ContainerTreeViewTypeConstructor, ContainerTypeGeneric, ValueOfFields} from "./container.js"; -import {TreeView} from "./abstract.js"; +import {Type, ValueOf} from "../type/abstract.ts"; +import {isCompositeType} from "../type/composite.ts"; +import {BranchNodeStruct} from "../branchNodeStruct.ts"; +import {ContainerTreeViewTypeConstructor, ContainerTypeGeneric, ValueOfFields} from "./container.ts"; +import {TreeView} from "./abstract.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/view/listBasic.ts b/packages/ssz/src/view/listBasic.ts index c526141d7..40a51265e 100644 --- a/packages/ssz/src/view/listBasic.ts +++ b/packages/ssz/src/view/listBasic.ts @@ -1,7 +1,7 @@ import {LeafNode, Tree} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "../type/abstract.js"; -import {BasicType} from "../type/basic.js"; -import {ArrayBasicTreeView, ArrayBasicType} from "./arrayBasic.js"; +import {ValueOf} from "../type/abstract.ts"; +import {BasicType} from "../type/basic.ts"; +import {ArrayBasicTreeView, ArrayBasicType} from "./arrayBasic.ts"; /** Expected API of this View's type. This interface allows to break a recursive dependency between types and views */ export type ListBasicType> = ArrayBasicType & { diff --git a/packages/ssz/src/view/listComposite.ts b/packages/ssz/src/view/listComposite.ts index b841e55b4..66ae66cb0 100644 --- a/packages/ssz/src/view/listComposite.ts +++ b/packages/ssz/src/view/listComposite.ts @@ -1,7 +1,7 @@ import {Tree} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "../type/abstract.js"; -import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.js"; -import {ArrayCompositeTreeView, ArrayCompositeType} from "./arrayComposite.js"; +import {ValueOf} from "../type/abstract.ts"; +import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.ts"; +import {ArrayCompositeTreeView, ArrayCompositeType} from "./arrayComposite.ts"; /** Expected API of this View's type. This interface allows to break a recursive dependency between types and views */ export type ListCompositeType< diff --git a/packages/ssz/src/view/profile.ts b/packages/ssz/src/view/profile.ts index f71e46578..db4606b7f 100644 --- a/packages/ssz/src/view/profile.ts +++ b/packages/ssz/src/view/profile.ts @@ -7,12 +7,12 @@ import { toGindexBitstring, Tree, } from "@chainsafe/persistent-merkle-tree"; -import {Type, ValueOf} from "../type/abstract.js"; -import {isBasicType, BasicType} from "../type/basic.js"; -import {isCompositeType, CompositeType} from "../type/composite.js"; -import {TreeView} from "./abstract.js"; -import {BitArray} from "../value/bitArray.js"; -import {NonOptionalFields} from "../type/optional.js"; +import {Type, ValueOf} from "../type/abstract.ts"; +import {isBasicType, BasicType} from "../type/basic.ts"; +import {isCompositeType, CompositeType} from "../type/composite.ts"; +import {TreeView} from "./abstract.ts"; +import {BitArray} from "../value/bitArray.ts"; +import {NonOptionalFields} from "../type/optional.ts"; export type FieldEntry>> = { fieldName: keyof Fields; diff --git a/packages/ssz/src/view/stableContainer.ts b/packages/ssz/src/view/stableContainer.ts index 2308719d2..d5abc3470 100644 --- a/packages/ssz/src/view/stableContainer.ts +++ b/packages/ssz/src/view/stableContainer.ts @@ -7,12 +7,12 @@ import { Tree, zeroNode, } from "@chainsafe/persistent-merkle-tree"; -import {Type, ValueOf} from "../type/abstract.js"; -import {isBasicType, BasicType} from "../type/basic.js"; -import {isCompositeType, CompositeType} from "../type/composite.js"; -import {TreeView} from "./abstract.js"; -import {NonOptionalFields, OptionalType} from "../type/optional.js"; -import {BitArray} from "../value/bitArray.js"; +import {Type, ValueOf} from "../type/abstract.ts"; +import {isBasicType, BasicType} from "../type/basic.ts"; +import {isCompositeType, CompositeType} from "../type/composite.ts"; +import {TreeView} from "./abstract.ts"; +import {NonOptionalFields, OptionalType} from "../type/optional.ts"; +import {BitArray} from "../value/bitArray.ts"; // some code is here to break the circular dependency between type, view, and viewDU diff --git a/packages/ssz/src/viewDU/abstract.ts b/packages/ssz/src/viewDU/abstract.ts index 36e033491..e25922daf 100644 --- a/packages/ssz/src/viewDU/abstract.ts +++ b/packages/ssz/src/viewDU/abstract.ts @@ -1,6 +1,6 @@ import {HashComputationLevel, executeHashComputations, HashComputationGroup} from "@chainsafe/persistent-merkle-tree"; -import {ByteViews, CompositeType} from "../type/composite.js"; -import {TreeView} from "../view/abstract.js"; +import {ByteViews, CompositeType} from "../type/composite.ts"; +import {TreeView} from "../view/abstract.ts"; /** * Always allocating a new HashComputationGroup for each hashTreeRoot() is not great for gc diff --git a/packages/ssz/src/viewDU/arrayBasic.ts b/packages/ssz/src/viewDU/arrayBasic.ts index 492092ac0..5b51a21b2 100644 --- a/packages/ssz/src/viewDU/arrayBasic.ts +++ b/packages/ssz/src/viewDU/arrayBasic.ts @@ -7,10 +7,10 @@ import { Node, setNodesAtDepth, } from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "../type/abstract.js"; -import {BasicType} from "../type/basic.js"; -import {ArrayBasicType} from "../view/arrayBasic.js"; -import {TreeViewDU} from "./abstract.js"; +import {ValueOf} from "../type/abstract.ts"; +import {BasicType} from "../type/basic.ts"; +import {ArrayBasicType} from "../view/arrayBasic.ts"; +import {TreeViewDU} from "./abstract.ts"; export type ArrayBasicTreeViewDUCache = { nodes: LeafNode[]; @@ -22,7 +22,7 @@ export class ArrayBasicTreeViewDU> extend ArrayBasicType > { protected nodes: LeafNode[]; - protected readonly nodesChanged = new Set(); + protected readonly nodesChanged: Set = new Set(); protected _length: number; protected dirtyLength = false; private nodesPopulated: boolean; diff --git a/packages/ssz/src/viewDU/arrayComposite.ts b/packages/ssz/src/viewDU/arrayComposite.ts index aa7e2be4a..30f610d1a 100644 --- a/packages/ssz/src/viewDU/arrayComposite.ts +++ b/packages/ssz/src/viewDU/arrayComposite.ts @@ -6,10 +6,10 @@ import { Node, setNodesAtDepth, } from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "../type/abstract.js"; -import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.js"; -import {ArrayCompositeType} from "../view/arrayComposite.js"; -import {TreeViewDU} from "./abstract.js"; +import {ValueOf} from "../type/abstract.ts"; +import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.ts"; +import {ArrayCompositeType} from "../view/arrayComposite.ts"; +import {TreeViewDU} from "./abstract.ts"; export type ArrayCompositeTreeViewDUCache = { nodes: Node[]; @@ -23,7 +23,10 @@ export class ArrayCompositeTreeViewDU< > extends TreeViewDU> { protected nodes: Node[]; protected caches: unknown[]; - protected readonly viewsChanged = new Map>(); + protected readonly viewsChanged: Map> = new Map< + number, + CompositeViewDU + >(); protected _length: number; // TODO: Consider these properties are not accessible in the cache object persisted in the parent's cache. // nodes, caches, _length, and nodesPopulated are mutated. Consider having them in a _cache object such that diff --git a/packages/ssz/src/viewDU/bitArray.ts b/packages/ssz/src/viewDU/bitArray.ts index 7bdacd38b..aea290d3c 100644 --- a/packages/ssz/src/viewDU/bitArray.ts +++ b/packages/ssz/src/viewDU/bitArray.ts @@ -1,7 +1,7 @@ import {HashComputationLevel, Node, getHashComputations} from "@chainsafe/persistent-merkle-tree"; -import {BitArray} from "../value/bitArray.js"; -import {CompositeType} from "../type/composite.js"; -import {TreeViewDU} from "./abstract.js"; +import {BitArray} from "../value/bitArray.ts"; +import {CompositeType} from "../type/composite.ts"; +import {TreeViewDU} from "./abstract.ts"; /** * Thin wrapper around BitArray to upstream changes after `this.commit()` diff --git a/packages/ssz/src/viewDU/container.ts b/packages/ssz/src/viewDU/container.ts index ab71749c5..25ad016f0 100644 --- a/packages/ssz/src/viewDU/container.ts +++ b/packages/ssz/src/viewDU/container.ts @@ -6,11 +6,11 @@ import { Node, setNodesAtDepth, } from "@chainsafe/persistent-merkle-tree"; -import {ByteViews, Type} from "../type/abstract.js"; -import {BasicType, isBasicType} from "../type/basic.js"; -import {CompositeType, isCompositeType, CompositeTypeAny} from "../type/composite.js"; -import {BasicContainerTypeGeneric, ContainerTypeGeneric} from "../view/container.js"; -import {TreeViewDU} from "./abstract.js"; +import {ByteViews, Type} from "../type/abstract.ts"; +import {BasicType, isBasicType} from "../type/basic.ts"; +import {CompositeType, isCompositeType, CompositeTypeAny} from "../type/composite.ts"; +import {BasicContainerTypeGeneric, ContainerTypeGeneric} from "../view/container.ts"; +import {TreeViewDU} from "./abstract.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/viewDU/containerNodeStruct.ts b/packages/ssz/src/viewDU/containerNodeStruct.ts index 9ceb58f71..46a2af0df 100644 --- a/packages/ssz/src/viewDU/containerNodeStruct.ts +++ b/packages/ssz/src/viewDU/containerNodeStruct.ts @@ -1,10 +1,10 @@ import {Node, HashComputationLevel} from "@chainsafe/persistent-merkle-tree"; -import {Type, ValueOf} from "../type/abstract.js"; -import {isCompositeType} from "../type/composite.js"; -import {BranchNodeStruct} from "../branchNodeStruct.js"; -import {ContainerTypeGeneric, ValueOfFields} from "../view/container.js"; -import {ContainerTreeViewDUTypeConstructor} from "./container.js"; -import {TreeViewDU} from "./abstract.js"; +import {Type, ValueOf} from "../type/abstract.ts"; +import {isCompositeType} from "../type/composite.ts"; +import {BranchNodeStruct} from "../branchNodeStruct.ts"; +import {ContainerTypeGeneric, ValueOfFields} from "../view/container.ts"; +import {ContainerTreeViewDUTypeConstructor} from "./container.ts"; +import {TreeViewDU} from "./abstract.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/viewDU/listBasic.ts b/packages/ssz/src/viewDU/listBasic.ts index a815a476b..c32f959be 100644 --- a/packages/ssz/src/viewDU/listBasic.ts +++ b/packages/ssz/src/viewDU/listBasic.ts @@ -6,11 +6,11 @@ import { treeZeroAfterIndex, zeroNode, } from "@chainsafe/persistent-merkle-tree"; -import {ByteViews, ValueOf} from "../type/abstract.js"; -import {BasicType} from "../type/basic.js"; -import {ListBasicType} from "../view/listBasic.js"; -import {ArrayBasicTreeViewDU, ArrayBasicTreeViewDUCache} from "./arrayBasic.js"; -import {tree_serializeToBytesArrayBasic} from "../type/arrayBasic.js"; +import {ByteViews, ValueOf} from "../type/abstract.ts"; +import {BasicType} from "../type/basic.ts"; +import {ListBasicType} from "../view/listBasic.ts"; +import {ArrayBasicTreeViewDU, ArrayBasicTreeViewDUCache} from "./arrayBasic.ts"; +import {tree_serializeToBytesArrayBasic} from "../type/arrayBasic.ts"; export class ListBasicTreeViewDU> extends ArrayBasicTreeViewDU { constructor(readonly type: ListBasicType, protected _rootNode: Node, cache?: ArrayBasicTreeViewDUCache) { diff --git a/packages/ssz/src/viewDU/listComposite.ts b/packages/ssz/src/viewDU/listComposite.ts index 3c6c0225c..2354d18f6 100644 --- a/packages/ssz/src/viewDU/listComposite.ts +++ b/packages/ssz/src/viewDU/listComposite.ts @@ -1,11 +1,11 @@ import {Node, subtreeFillToContents, treeZeroAfterIndex, zeroNode, toSnapshot} from "@chainsafe/persistent-merkle-tree"; -import {ByteViews, ValueOf} from "../type/abstract.js"; -import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.js"; -import {ListCompositeType} from "../view/listComposite.js"; -import {ArrayCompositeTreeViewDU, ArrayCompositeTreeViewDUCache} from "./arrayComposite.js"; -import {tree_serializeToBytesArrayComposite} from "../type/arrayComposite.js"; -import {Snapshot} from "../util/types.js"; -import {zeroSnapshot} from "../util/snapshot.js"; +import {ByteViews, ValueOf} from "../type/abstract.ts"; +import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.ts"; +import {ListCompositeType} from "../view/listComposite.ts"; +import {ArrayCompositeTreeViewDU, ArrayCompositeTreeViewDUCache} from "./arrayComposite.ts"; +import {tree_serializeToBytesArrayComposite} from "../type/arrayComposite.ts"; +import {Snapshot} from "../util/types.ts"; +import {zeroSnapshot} from "../util/snapshot.ts"; export class ListCompositeTreeViewDU< ElementType extends CompositeType, CompositeView, CompositeViewDU> diff --git a/packages/ssz/src/viewDU/partialListComposite.ts b/packages/ssz/src/viewDU/partialListComposite.ts index 48a1f19f0..5f28352c2 100644 --- a/packages/ssz/src/viewDU/partialListComposite.ts +++ b/packages/ssz/src/viewDU/partialListComposite.ts @@ -1,11 +1,11 @@ import {Node, zeroNode, subtreeFillToContents, getNodesAtDepth} from "@chainsafe/persistent-merkle-tree"; -import {ValueOf} from "../type/abstract.js"; -import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.js"; -import {ArrayCompositeTreeViewDUCache} from "./arrayComposite.js"; -import {ListCompositeTreeViewDU} from "./listComposite.js"; -import {PartialListCompositeType} from "../type/partialListComposite.js"; -import {Snapshot} from "../util/types.js"; -import {zeroSnapshot} from "../util/snapshot.js"; +import {ValueOf} from "../type/abstract.ts"; +import {CompositeType, CompositeView, CompositeViewDU} from "../type/composite.ts"; +import {ArrayCompositeTreeViewDUCache} from "./arrayComposite.ts"; +import {ListCompositeTreeViewDU} from "./listComposite.ts"; +import {PartialListCompositeType} from "../type/partialListComposite.ts"; +import {Snapshot} from "../util/types.ts"; +import {zeroSnapshot} from "../util/snapshot.ts"; /** * Similar to ListCompositeTreeViewDU but this is created from a snapshot so some methods are not supported diff --git a/packages/ssz/src/viewDU/profile.ts b/packages/ssz/src/viewDU/profile.ts index d98e36d26..aa29e1501 100644 --- a/packages/ssz/src/viewDU/profile.ts +++ b/packages/ssz/src/viewDU/profile.ts @@ -1,12 +1,12 @@ import {getNodeAtDepth, LeafNode, Node, zeroNode} from "@chainsafe/persistent-merkle-tree"; -import {ByteViews, Type} from "../type/abstract.js"; -import {BasicType, isBasicType} from "../type/basic.js"; -import {CompositeType, isCompositeType} from "../type/composite.js"; -import {computeSerdesData, ContainerTypeGeneric} from "../view/profile.js"; -import {TreeViewDU} from "./abstract.js"; -import {BasicContainerTreeViewDU, ChangedNode} from "./container.js"; -import {OptionalType} from "../type/optional.js"; -import {BitArray} from "../value/bitArray.js"; +import {ByteViews, Type} from "../type/abstract.ts"; +import {BasicType, isBasicType} from "../type/basic.ts"; +import {CompositeType, isCompositeType} from "../type/composite.ts"; +import {computeSerdesData, ContainerTypeGeneric} from "../view/profile.ts"; +import {TreeViewDU} from "./abstract.ts"; +import {BasicContainerTreeViewDU, ChangedNode} from "./container.ts"; +import {OptionalType} from "../type/optional.ts"; +import {BitArray} from "../value/bitArray.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/viewDU/stableContainer.ts b/packages/ssz/src/viewDU/stableContainer.ts index 4f92065d8..7939a74ac 100644 --- a/packages/ssz/src/viewDU/stableContainer.ts +++ b/packages/ssz/src/viewDU/stableContainer.ts @@ -1,12 +1,12 @@ import {getNodeAtDepth, LeafNode, Node, zeroNode, HashComputationLevel} from "@chainsafe/persistent-merkle-tree"; -import {ByteViews, Type} from "../type/abstract.js"; -import {BasicType, isBasicType} from "../type/basic.js"; -import {CompositeType, isCompositeType} from "../type/composite.js"; -import {computeSerdesData, StableContainerTypeGeneric} from "../view/stableContainer.js"; -import {TreeViewDU} from "./abstract.js"; -import {OptionalType} from "../type/optional.js"; -import {BitArray} from "../value/bitArray.js"; -import {BasicContainerTreeViewDU} from "./container.js"; +import {ByteViews, Type} from "../type/abstract.ts"; +import {BasicType, isBasicType} from "../type/basic.ts"; +import {CompositeType, isCompositeType} from "../type/composite.ts"; +import {computeSerdesData, StableContainerTypeGeneric} from "../view/stableContainer.ts"; +import {TreeViewDU} from "./abstract.ts"; +import {OptionalType} from "../type/optional.ts"; +import {BitArray} from "../value/bitArray.ts"; +import {BasicContainerTreeViewDU} from "./container.ts"; /* eslint-disable @typescript-eslint/member-ordering */ diff --git a/packages/ssz/src/web.ts b/packages/ssz/src/web.ts index 2965d9a12..f7e67ffda 100644 --- a/packages/ssz/src/web.ts +++ b/packages/ssz/src/web.ts @@ -1,5 +1,5 @@ /** @module ssz */ -import * as ssz from "./index.js"; +import * as ssz from "./index.ts"; // eslint-disable-next-line @typescript-eslint/no-explicit-any (function (window: any) { diff --git a/packages/ssz/test/lodestarTypes/allForks/index.ts b/packages/ssz/test/lodestarTypes/allForks/index.ts index 7856cd729..16c35bb6e 100644 --- a/packages/ssz/test/lodestarTypes/allForks/index.ts +++ b/packages/ssz/test/lodestarTypes/allForks/index.ts @@ -1,3 +1,3 @@ -export * from "./types.js"; -export * as ts from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * from "./types.ts"; +export * as ts from "./types.ts"; +export * as ssz from "./sszTypes.ts"; diff --git a/packages/ssz/test/lodestarTypes/allForks/sszTypes.ts b/packages/ssz/test/lodestarTypes/allForks/sszTypes.ts index 023d7bc86..ed6e3358d 100644 --- a/packages/ssz/test/lodestarTypes/allForks/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/allForks/sszTypes.ts @@ -1,8 +1,8 @@ -import {ssz as phase0} from "../phase0/index.js"; -import {ssz as altair} from "../altair/index.js"; -import {ssz as bellatrix} from "../bellatrix/index.js"; -import {ssz as capella} from "../capella/index.js"; -import {ssz as deneb} from "../deneb/index.js"; +import {ssz as phase0} from "../phase0/index.ts"; +import {ssz as altair} from "../altair/index.ts"; +import {ssz as bellatrix} from "../bellatrix/index.ts"; +import {ssz as capella} from "../capella/index.ts"; +import {ssz as deneb} from "../deneb/index.ts"; /** * Index the ssz types that differ by fork diff --git a/packages/ssz/test/lodestarTypes/allForks/types.ts b/packages/ssz/test/lodestarTypes/allForks/types.ts index ec78694ee..432596215 100644 --- a/packages/ssz/test/lodestarTypes/allForks/types.ts +++ b/packages/ssz/test/lodestarTypes/allForks/types.ts @@ -1,15 +1,15 @@ -import {CompositeType, ContainerType, ValueOf, CompositeView, CompositeViewDU} from "../../../src/index.js"; -import {ts as phase0} from "../phase0/index.js"; -import {ts as altair} from "../altair/index.js"; -import {ts as bellatrix} from "../bellatrix/index.js"; -import {ts as capella} from "../capella/index.js"; -import {ts as deneb} from "../deneb/index.js"; +import {CompositeType, ContainerType, ValueOf, CompositeView, CompositeViewDU} from "../../../src/index.ts"; +import {ts as phase0} from "../phase0/index.ts"; +import {ts as altair} from "../altair/index.ts"; +import {ts as bellatrix} from "../bellatrix/index.ts"; +import {ts as capella} from "../capella/index.ts"; +import {ts as deneb} from "../deneb/index.ts"; -import {ssz as phase0Ssz} from "../phase0/index.js"; -import {ssz as altairSsz} from "../altair/index.js"; -import {ssz as bellatrixSsz} from "../bellatrix/index.js"; -import {ssz as capellaSsz} from "../capella/index.js"; -import {ssz as denebSsz} from "../deneb/index.js"; +import {ssz as phase0Ssz} from "../phase0/index.ts"; +import {ssz as altairSsz} from "../altair/index.ts"; +import {ssz as bellatrixSsz} from "../bellatrix/index.ts"; +import {ssz as capellaSsz} from "../capella/index.ts"; +import {ssz as denebSsz} from "../deneb/index.ts"; // Re-export union types for types that are _known_ to differ diff --git a/packages/ssz/test/lodestarTypes/altair/index.ts b/packages/ssz/test/lodestarTypes/altair/index.ts index 7856cd729..16c35bb6e 100644 --- a/packages/ssz/test/lodestarTypes/altair/index.ts +++ b/packages/ssz/test/lodestarTypes/altair/index.ts @@ -1,3 +1,3 @@ -export * from "./types.js"; -export * as ts from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * from "./types.ts"; +export * as ts from "./types.ts"; +export * as ssz from "./sszTypes.ts"; diff --git a/packages/ssz/test/lodestarTypes/altair/sszTypes.ts b/packages/ssz/test/lodestarTypes/altair/sszTypes.ts index a4d4de793..aafd6e5c4 100644 --- a/packages/ssz/test/lodestarTypes/altair/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/altair/sszTypes.ts @@ -4,8 +4,8 @@ import { ListBasicType, ListCompositeType, VectorCompositeType, -} from "../../../src/index.js"; -import {preset, FINALIZED_ROOT_DEPTH, NEXT_SYNC_COMMITTEE_DEPTH, SYNC_COMMITTEE_SUBNET_COUNT} from "../params.js"; +} from "../../../src/index.ts"; +import {preset, FINALIZED_ROOT_DEPTH, NEXT_SYNC_COMMITTEE_DEPTH, SYNC_COMMITTEE_SUBNET_COUNT} from "../params.ts"; const { SYNC_COMMITTEE_SIZE, HISTORICAL_ROOTS_LIMIT, @@ -13,8 +13,8 @@ const { EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH, } = preset; -import * as phase0Ssz from "../phase0/sszTypes.js"; -import * as primitiveSsz from "../primitive/sszTypes.js"; +import * as phase0Ssz from "../phase0/sszTypes.ts"; +import * as primitiveSsz from "../primitive/sszTypes.ts"; const { Bytes32, diff --git a/packages/ssz/test/lodestarTypes/altair/types.ts b/packages/ssz/test/lodestarTypes/altair/types.ts index 02adaa27e..d1f0eb2b0 100644 --- a/packages/ssz/test/lodestarTypes/altair/types.ts +++ b/packages/ssz/test/lodestarTypes/altair/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from "../../../src/index.js"; -import * as ssz from "./sszTypes.js"; +import {ValueOf} from "../../../src/index.ts"; +import * as ssz from "./sszTypes.ts"; export type SyncSubnets = ValueOf; export type Metadata = ValueOf; diff --git a/packages/ssz/test/lodestarTypes/bellatrix/index.ts b/packages/ssz/test/lodestarTypes/bellatrix/index.ts index 7856cd729..16c35bb6e 100644 --- a/packages/ssz/test/lodestarTypes/bellatrix/index.ts +++ b/packages/ssz/test/lodestarTypes/bellatrix/index.ts @@ -1,3 +1,3 @@ -export * from "./types.js"; -export * as ts from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * from "./types.ts"; +export * as ts from "./types.ts"; +export * as ssz from "./sszTypes.ts"; diff --git a/packages/ssz/test/lodestarTypes/bellatrix/sszTypes.ts b/packages/ssz/test/lodestarTypes/bellatrix/sszTypes.ts index 1f90566ce..4f1932766 100644 --- a/packages/ssz/test/lodestarTypes/bellatrix/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/bellatrix/sszTypes.ts @@ -1,9 +1,9 @@ -import {ByteListType, ByteVectorType, ContainerType, ListCompositeType} from "../../../src/index.js"; -import {preset} from "../params.js"; -import {ssz as primitiveSsz} from "../primitive/index.js"; -import {ssz as phase0Ssz} from "../phase0/index.js"; -import {ssz as altairSsz} from "../altair/index.js"; -import {stringType} from "../utils/StringType.js"; +import {ByteListType, ByteVectorType, ContainerType, ListCompositeType} from "../../../src/index.ts"; +import {preset} from "../params.ts"; +import {ssz as primitiveSsz} from "../primitive/index.ts"; +import {ssz as phase0Ssz} from "../phase0/index.ts"; +import {ssz as altairSsz} from "../altair/index.ts"; +import {stringType} from "../utils/StringType.ts"; const { BYTES_PER_LOGS_BLOOM, HISTORICAL_ROOTS_LIMIT, diff --git a/packages/ssz/test/lodestarTypes/bellatrix/types.ts b/packages/ssz/test/lodestarTypes/bellatrix/types.ts index ea05bfc56..d90d42fe9 100644 --- a/packages/ssz/test/lodestarTypes/bellatrix/types.ts +++ b/packages/ssz/test/lodestarTypes/bellatrix/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from "../../../src/index.js"; -import * as ssz from "./sszTypes.js"; +import {ValueOf} from "../../../src/index.ts"; +import * as ssz from "./sszTypes.ts"; export type Transaction = ValueOf; export type Transactions = ValueOf; diff --git a/packages/ssz/test/lodestarTypes/capella/index.ts b/packages/ssz/test/lodestarTypes/capella/index.ts index 7856cd729..16c35bb6e 100644 --- a/packages/ssz/test/lodestarTypes/capella/index.ts +++ b/packages/ssz/test/lodestarTypes/capella/index.ts @@ -1,3 +1,3 @@ -export * from "./types.js"; -export * as ts from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * from "./types.ts"; +export * as ts from "./types.ts"; +export * as ssz from "./sszTypes.ts"; diff --git a/packages/ssz/test/lodestarTypes/capella/sszTypes.ts b/packages/ssz/test/lodestarTypes/capella/sszTypes.ts index 0d8840eed..e7c45df24 100644 --- a/packages/ssz/test/lodestarTypes/capella/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/capella/sszTypes.ts @@ -1,9 +1,9 @@ -import {ContainerType, ListCompositeType, VectorCompositeType} from "../../../src/index.js"; -import {preset, BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH} from "../params.js"; -import {ssz as primitiveSsz} from "../primitive/index.js"; -import {ssz as phase0Ssz} from "../phase0/index.js"; -import {ssz as altairSsz} from "../altair/index.js"; -import {ssz as bellatrixSsz} from "../bellatrix/index.js"; +import {ContainerType, ListCompositeType, VectorCompositeType} from "../../../src/index.ts"; +import {preset, BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH} from "../params.ts"; +import {ssz as primitiveSsz} from "../primitive/index.ts"; +import {ssz as phase0Ssz} from "../phase0/index.ts"; +import {ssz as altairSsz} from "../altair/index.ts"; +import {ssz as bellatrixSsz} from "../bellatrix/index.ts"; const { HISTORICAL_ROOTS_LIMIT, MAX_WITHDRAWALS_PER_PAYLOAD, diff --git a/packages/ssz/test/lodestarTypes/capella/types.ts b/packages/ssz/test/lodestarTypes/capella/types.ts index adc1a6583..75a3fb157 100644 --- a/packages/ssz/test/lodestarTypes/capella/types.ts +++ b/packages/ssz/test/lodestarTypes/capella/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from "../../../src/index.js"; -import * as ssz from "./sszTypes.js"; +import {ValueOf} from "../../../src/index.ts"; +import * as ssz from "./sszTypes.ts"; export type Withdrawal = ValueOf; export type Withdrawals = ValueOf; diff --git a/packages/ssz/test/lodestarTypes/deneb/index.ts b/packages/ssz/test/lodestarTypes/deneb/index.ts index 7856cd729..16c35bb6e 100644 --- a/packages/ssz/test/lodestarTypes/deneb/index.ts +++ b/packages/ssz/test/lodestarTypes/deneb/index.ts @@ -1,3 +1,3 @@ -export * from "./types.js"; -export * as ts from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * from "./types.ts"; +export * as ts from "./types.ts"; +export * as ssz from "./sszTypes.ts"; diff --git a/packages/ssz/test/lodestarTypes/deneb/sszTypes.ts b/packages/ssz/test/lodestarTypes/deneb/sszTypes.ts index 4fd26bc75..d7b967fa6 100644 --- a/packages/ssz/test/lodestarTypes/deneb/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/deneb/sszTypes.ts @@ -1,15 +1,15 @@ -import {ContainerType, ListCompositeType, ByteVectorType, VectorCompositeType} from "../../../src/index.js"; +import {ContainerType, ListCompositeType, ByteVectorType, VectorCompositeType} from "../../../src/index.ts"; import { preset, BYTES_PER_FIELD_ELEMENT, BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH, MAX_REQUEST_BLOCKS_DENEB, -} from "../params.js"; -import {ssz as primitiveSsz} from "../primitive/index.js"; -import {ssz as phase0Ssz} from "../phase0/index.js"; -import {ssz as altairSsz} from "../altair/index.js"; -import {ssz as bellatrixSsz} from "../bellatrix/index.js"; -import {ssz as capellaSsz} from "../capella/index.js"; +} from "../params.ts"; +import {ssz as primitiveSsz} from "../primitive/index.ts"; +import {ssz as phase0Ssz} from "../phase0/index.ts"; +import {ssz as altairSsz} from "../altair/index.ts"; +import {ssz as bellatrixSsz} from "../bellatrix/index.ts"; +import {ssz as capellaSsz} from "../capella/index.ts"; const { HISTORICAL_ROOTS_LIMIT, MAX_BLOB_COMMITMENTS_PER_BLOCK, diff --git a/packages/ssz/test/lodestarTypes/deneb/types.ts b/packages/ssz/test/lodestarTypes/deneb/types.ts index 0f544ef4f..0955c67ad 100644 --- a/packages/ssz/test/lodestarTypes/deneb/types.ts +++ b/packages/ssz/test/lodestarTypes/deneb/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from "../../../src/index.js"; -import * as ssz from "./sszTypes.js"; +import {ValueOf} from "../../../src/index.ts"; +import * as ssz from "./sszTypes.ts"; export type KZGProof = ValueOf; export type KZGCommitment = ValueOf; diff --git a/packages/ssz/test/lodestarTypes/index.ts b/packages/ssz/test/lodestarTypes/index.ts index 825b962c5..77bdd3e90 100644 --- a/packages/ssz/test/lodestarTypes/index.ts +++ b/packages/ssz/test/lodestarTypes/index.ts @@ -1,6 +1,6 @@ -export * from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * from "./types.ts"; +export * as ssz from "./sszTypes.ts"; // Typeguards -export * from "./utils/typeguards.js"; +export * from "./utils/typeguards.ts"; // String type -export {StringType, stringType} from "./utils/StringType.js"; +export {StringType, stringType} from "./utils/StringType.ts"; diff --git a/packages/ssz/test/lodestarTypes/phase0/index.ts b/packages/ssz/test/lodestarTypes/phase0/index.ts index 7856cd729..16c35bb6e 100644 --- a/packages/ssz/test/lodestarTypes/phase0/index.ts +++ b/packages/ssz/test/lodestarTypes/phase0/index.ts @@ -1,3 +1,3 @@ -export * from "./types.js"; -export * as ts from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * from "./types.ts"; +export * as ts from "./types.ts"; +export * as ssz from "./sszTypes.ts"; diff --git a/packages/ssz/test/lodestarTypes/phase0/sszTypes.ts b/packages/ssz/test/lodestarTypes/phase0/sszTypes.ts index 077359d2f..19ba20f79 100644 --- a/packages/ssz/test/lodestarTypes/phase0/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/phase0/sszTypes.ts @@ -7,17 +7,17 @@ import { ListCompositeType, VectorBasicType, VectorCompositeType, -} from "../../../src/index.js"; -import {ListUintNum64Type} from "../../../src/type/listUintNum64.js"; -import {PartialListCompositeType} from "../../../src/type/partialListComposite.js"; +} from "../../../src/index.ts"; +import {ListUintNum64Type} from "../../../src/type/listUintNum64.ts"; +import {PartialListCompositeType} from "../../../src/type/partialListComposite.ts"; import { preset, MAX_REQUEST_BLOCKS, DEPOSIT_CONTRACT_TREE_DEPTH, JUSTIFICATION_BITS_LENGTH, ATTESTATION_SUBNET_COUNT, -} from "../params.js"; -import * as primitiveSsz from "../primitive/sszTypes.js"; +} from "../params.ts"; +import * as primitiveSsz from "../primitive/sszTypes.ts"; const { EPOCHS_PER_ETH1_VOTING_PERIOD, diff --git a/packages/ssz/test/lodestarTypes/phase0/types.ts b/packages/ssz/test/lodestarTypes/phase0/types.ts index 6fb6305ae..42d683e18 100644 --- a/packages/ssz/test/lodestarTypes/phase0/types.ts +++ b/packages/ssz/test/lodestarTypes/phase0/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from "../../../src/index.js"; -import * as ssz from "./sszTypes.js"; +import {ValueOf} from "../../../src/index.ts"; +import * as ssz from "./sszTypes.ts"; export type AttestationSubnets = ValueOf; export type BeaconBlockHeader = ValueOf; diff --git a/packages/ssz/test/lodestarTypes/primitive/index.ts b/packages/ssz/test/lodestarTypes/primitive/index.ts index 2953a04f1..64b38e6ca 100644 --- a/packages/ssz/test/lodestarTypes/primitive/index.ts +++ b/packages/ssz/test/lodestarTypes/primitive/index.ts @@ -1,2 +1,2 @@ -export * as ts from "./types.js"; -export * as ssz from "./sszTypes.js"; +export * as ts from "./types.ts"; +export * as ssz from "./sszTypes.ts"; diff --git a/packages/ssz/test/lodestarTypes/primitive/sszTypes.ts b/packages/ssz/test/lodestarTypes/primitive/sszTypes.ts index 7daf53896..1c7e3c5b3 100644 --- a/packages/ssz/test/lodestarTypes/primitive/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/primitive/sszTypes.ts @@ -1,4 +1,4 @@ -import {ByteVectorType, UintNumberType, UintBigintType, BooleanType} from "../../../src/index.js"; +import {ByteVectorType, UintNumberType, UintBigintType, BooleanType} from "../../../src/index.ts"; export const Boolean = new BooleanType(); export const Byte = new UintNumberType(1); diff --git a/packages/ssz/test/lodestarTypes/primitive/types.ts b/packages/ssz/test/lodestarTypes/primitive/types.ts index e74ac31f8..485a510b9 100644 --- a/packages/ssz/test/lodestarTypes/primitive/types.ts +++ b/packages/ssz/test/lodestarTypes/primitive/types.ts @@ -1,5 +1,5 @@ -import {ValueOf} from "../../../src/index.js"; -import * as ssz from "./sszTypes.js"; +import {ValueOf} from "../../../src/index.ts"; +import * as ssz from "./sszTypes.ts"; // Each type exported here contains both a compile-time type // (a typescript interface) and a run-time ssz type (a javascript variable) diff --git a/packages/ssz/test/lodestarTypes/sszTypes.ts b/packages/ssz/test/lodestarTypes/sszTypes.ts index 2a7df948a..129e57f70 100644 --- a/packages/ssz/test/lodestarTypes/sszTypes.ts +++ b/packages/ssz/test/lodestarTypes/sszTypes.ts @@ -1,11 +1,11 @@ -export * from "./primitive/sszTypes.js"; -export {ssz as phase0} from "./phase0/index.js"; -export {ssz as altair} from "./altair/index.js"; -export {ssz as bellatrix} from "./bellatrix/index.js"; -export {ssz as capella} from "./capella/index.js"; -export {ssz as deneb} from "./deneb/index.js"; +export * from "./primitive/sszTypes.ts"; +export {ssz as phase0} from "./phase0/index.ts"; +export {ssz as altair} from "./altair/index.ts"; +export {ssz as bellatrix} from "./bellatrix/index.ts"; +export {ssz as capella} from "./capella/index.ts"; +export {ssz as deneb} from "./deneb/index.ts"; -import {ssz as allForksSsz} from "./allForks/index.js"; +import {ssz as allForksSsz} from "./allForks/index.ts"; export const allForks = allForksSsz.allForks; export const allForksBlinded = allForksSsz.allForksBlinded; export const allForksExecution = allForksSsz.allForksExecution; diff --git a/packages/ssz/test/lodestarTypes/types.ts b/packages/ssz/test/lodestarTypes/types.ts index e2e416fa3..c99b6be8d 100644 --- a/packages/ssz/test/lodestarTypes/types.ts +++ b/packages/ssz/test/lodestarTypes/types.ts @@ -1,13 +1,13 @@ -import {Slot} from "./primitive/types.js"; +import {Slot} from "./primitive/types.ts"; -export * from "./primitive/types.js"; -export {ts as phase0} from "./phase0/index.js"; -export {ts as altair} from "./altair/index.js"; -export {ts as bellatrix} from "./bellatrix/index.js"; -export {ts as capella} from "./capella/index.js"; -export {ts as deneb} from "./deneb/index.js"; +export * from "./primitive/types.ts"; +export {ts as phase0} from "./phase0/index.ts"; +export {ts as altair} from "./altair/index.ts"; +export {ts as bellatrix} from "./bellatrix/index.ts"; +export {ts as capella} from "./capella/index.ts"; +export {ts as deneb} from "./deneb/index.ts"; -export {ts as allForks} from "./allForks/index.js"; +export {ts as allForks} from "./allForks/index.ts"; /** Common non-spec type to represent roots as strings */ export type RootHex = string; diff --git a/packages/ssz/test/lodestarTypes/utils/StringType.ts b/packages/ssz/test/lodestarTypes/utils/StringType.ts index 14a30341d..dd981c8a5 100644 --- a/packages/ssz/test/lodestarTypes/utils/StringType.ts +++ b/packages/ssz/test/lodestarTypes/utils/StringType.ts @@ -1,4 +1,4 @@ -import {BasicType} from "../../../src/index.js"; +import {BasicType} from "../../../src/index.ts"; export class StringType extends BasicType { readonly typeName = "string"; diff --git a/packages/ssz/test/lodestarTypes/utils/typeguards.ts b/packages/ssz/test/lodestarTypes/utils/typeguards.ts index 0303caa10..0a1d392a1 100644 --- a/packages/ssz/test/lodestarTypes/utils/typeguards.ts +++ b/packages/ssz/test/lodestarTypes/utils/typeguards.ts @@ -8,9 +8,9 @@ import { FullOrBlindedSignedBlobSidecar, BlindedBeaconBlockBody, BlindedBeaconBlock, -} from "../allForks/types.js"; -import {ts as bellatrix} from "../bellatrix/index.js"; -import {ts as deneb} from "../deneb/index.js"; +} from "../allForks/types.ts"; +import {ts as bellatrix} from "../bellatrix/index.ts"; +import {ts as deneb} from "../deneb/index.ts"; export function isBlindedExecution(payload: FullOrBlindedExecutionPayload): payload is ExecutionPayloadHeader { // we just check transactionsRoot for determinging as it the base field diff --git a/packages/ssz/test/memory/bytes.test.ts b/packages/ssz/test/memory/bytes.test.ts index efff0e0d8..df4ae2fd1 100644 --- a/packages/ssz/test/memory/bytes.test.ts +++ b/packages/ssz/test/memory/bytes.test.ts @@ -1,5 +1,5 @@ import {LeafNode} from "@chainsafe/persistent-merkle-tree"; -import {testRunnerMemory} from "./testRunnerMemory.js"; +import {testRunnerMemory} from "./testRunnerMemory.ts"; /* eslint-disable no-console */ diff --git a/packages/ssz/test/memory/eth2Objects.test.ts b/packages/ssz/test/memory/eth2Objects.test.ts index c50909da0..1ef6e34ef 100644 --- a/packages/ssz/test/memory/eth2Objects.test.ts +++ b/packages/ssz/test/memory/eth2Objects.test.ts @@ -1,11 +1,11 @@ -import {testRunnerMemory} from "./testRunnerMemory.js"; -import {ssz} from "../lodestarTypes/phase0/index.js"; +import {testRunnerMemory} from "./testRunnerMemory.ts"; +import {ssz} from "../lodestarTypes/phase0/index.ts"; import { getAttestation, getSignedAggregateAndProof, getBitsSingle, getSignedBeaconBlockPhase0, -} from "../utils/generateEth2Objs.js"; +} from "../utils/generateEth2Objs.ts"; // Results in Linux Dec 2021 // diff --git a/packages/ssz/test/memory/hooks.test.ts b/packages/ssz/test/memory/hooks.test.ts index 8f6314759..11016349b 100644 --- a/packages/ssz/test/memory/hooks.test.ts +++ b/packages/ssz/test/memory/hooks.test.ts @@ -1,4 +1,4 @@ -import {testRunnerMemory} from "./testRunnerMemory.js"; +import {testRunnerMemory} from "./testRunnerMemory.ts"; // Results in Linux Dec 2021 // diff --git a/packages/ssz/test/memory/treeView.test.ts b/packages/ssz/test/memory/treeView.test.ts index 48a71fd58..acb774412 100644 --- a/packages/ssz/test/memory/treeView.test.ts +++ b/packages/ssz/test/memory/treeView.test.ts @@ -1,6 +1,6 @@ import {LeafNode, Tree, zeroNode} from "@chainsafe/persistent-merkle-tree"; import {MutableVector} from "@chainsafe/persistent-ts"; -import {testRunnerMemory} from "./testRunnerMemory.js"; +import {testRunnerMemory} from "./testRunnerMemory.ts"; // Results in Linux Dec 2021 // diff --git a/packages/ssz/test/perf/bitlist.test.ts b/packages/ssz/test/perf/bitlist.test.ts index c0199c519..c4210136e 100644 --- a/packages/ssz/test/perf/bitlist.test.ts +++ b/packages/ssz/test/perf/bitlist.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {BitArray, BitListType} from "../../src/index.js"; +import {BitArray, BitListType} from "../../src/index.ts"; // running zipIndexesCommitteeBits() on `bitLen: 2048, bitsSet: 2048` takes 50.904 us/op // However deserializing a BitList to struct `len 2048, set 2048` takes 560.4670 us/op, diff --git a/packages/ssz/test/perf/byType/listBasic.test.ts b/packages/ssz/test/perf/byType/listBasic.test.ts index c56dc97c2..3b4d0c178 100644 --- a/packages/ssz/test/perf/byType/listBasic.test.ts +++ b/packages/ssz/test/perf/byType/listBasic.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {ListBasicType, UintNumberType} from "../../../src/index.js"; +import {ListBasicType, UintNumberType} from "../../../src/index.ts"; const byteType = new UintNumberType(1); diff --git a/packages/ssz/test/perf/byType/listComposite.test.ts b/packages/ssz/test/perf/byType/listComposite.test.ts index f9c7508d0..d535d42b9 100644 --- a/packages/ssz/test/perf/byType/listComposite.test.ts +++ b/packages/ssz/test/perf/byType/listComposite.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {ContainerNodeStructType, ContainerType, ListCompositeType, UintNumberType} from "../../../src/index.js"; +import {ContainerNodeStructType, ContainerType, ListCompositeType, UintNumberType} from "../../../src/index.ts"; const byteType = new UintNumberType(1); diff --git a/packages/ssz/test/perf/bytelist.test.ts b/packages/ssz/test/perf/bytelist.test.ts index 7a0f9e977..d07cdb7c7 100644 --- a/packages/ssz/test/perf/bytelist.test.ts +++ b/packages/ssz/test/perf/bytelist.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {ByteListType, ListBasicType, UintNumberType} from "../../src/index.js"; +import {ByteListType, ListBasicType, UintNumberType} from "../../src/index.ts"; describe("ByteListType vs BasicListType", () => { const limit = 256 * 2; diff --git a/packages/ssz/test/perf/cacheMutableRootStruct.test.ts b/packages/ssz/test/perf/cacheMutableRootStruct.test.ts index 7e1bacc2d..9aca483df 100644 --- a/packages/ssz/test/perf/cacheMutableRootStruct.test.ts +++ b/packages/ssz/test/perf/cacheMutableRootStruct.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {BitVectorType, ContainerType, UintBigintType, ValueOf} from "../../src/index.js"; +import {BitVectorType, ContainerType, UintBigintType, ValueOf} from "../../src/index.ts"; describe("cachePermanentRootStruct", () => { const uint64 = new UintBigintType(8); diff --git a/packages/ssz/test/perf/epochStatuses.test.ts b/packages/ssz/test/perf/epochStatuses.test.ts index f7117352a..c1bce0cd4 100644 --- a/packages/ssz/test/perf/epochStatuses.test.ts +++ b/packages/ssz/test/perf/epochStatuses.test.ts @@ -1,7 +1,7 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {CompositeViewDU} from "../../src/index.js"; -import {EpochParticipation} from "../lodestarTypes/altair/sszTypes.js"; -import {fillArray, linspace} from "../utils/misc.js"; +import {CompositeViewDU} from "../../src/index.ts"; +import {EpochParticipation} from "../lodestarTypes/altair/sszTypes.ts"; +import {fillArray, linspace} from "../utils/misc.ts"; describe("processAttestations() epochStatuses", () => { const len = 250_000; diff --git a/packages/ssz/test/perf/eth2/beaconState.test.ts b/packages/ssz/test/perf/eth2/beaconState.test.ts index aba8ff485..f45bfe3ea 100644 --- a/packages/ssz/test/perf/eth2/beaconState.test.ts +++ b/packages/ssz/test/perf/eth2/beaconState.test.ts @@ -1,8 +1,8 @@ import {describe, bench, setBenchOpts} from "@chainsafe/benchmark"; import {HashComputationLevel, executeHashComputations, HashComputationGroup} from "@chainsafe/persistent-merkle-tree"; -import {BeaconState} from "../../lodestarTypes/altair/sszTypes.js"; -import {BitArray, CompositeViewDU, toHexString} from "../../../src/index.js"; -import {preset} from "../../lodestarTypes/params.js"; +import {BeaconState} from "../../lodestarTypes/altair/sszTypes.ts"; +import {BitArray, CompositeViewDU, toHexString} from "../../../src/index.ts"; +import {preset} from "../../lodestarTypes/params.ts"; const {SLOTS_PER_HISTORICAL_ROOT, EPOCHS_PER_ETH1_VOTING_PERIOD, SLOTS_PER_EPOCH} = preset; const vc = 200_000; diff --git a/packages/ssz/test/perf/eth2/deserialize.test.ts b/packages/ssz/test/perf/eth2/deserialize.test.ts index a5835f1ff..8672b6bef 100644 --- a/packages/ssz/test/perf/eth2/deserialize.test.ts +++ b/packages/ssz/test/perf/eth2/deserialize.test.ts @@ -1,7 +1,7 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {BeaconState} from "../../lodestarTypes/altair/types.js"; -import * as sszPhase0 from "../../lodestarTypes/phase0/sszTypes.js"; -import * as sszAltair from "../../lodestarTypes/altair/sszTypes.js"; +import {BeaconState} from "../../lodestarTypes/altair/types.ts"; +import * as sszPhase0 from "../../lodestarTypes/phase0/sszTypes.ts"; +import * as sszAltair from "../../lodestarTypes/altair/sszTypes.ts"; import { getAttestation, getOnce, @@ -10,8 +10,8 @@ import { getSyncCommitteeMessage, getSignedContributionAndProof, getSignedBeaconBlockPhase0, -} from "../../utils/generateEth2Objs.js"; -import {CompositeType, isCompositeType, TreeViewDU, ValueOf} from "../../../src/index.js"; +} from "../../utils/generateEth2Objs.ts"; +import {CompositeType, isCompositeType, TreeViewDU, ValueOf} from "../../../src/index.ts"; describe("Deserialize frequent eth2 objects", () => { benchDeserialize(sszPhase0.Attestation, getAttestation(0)); diff --git a/packages/ssz/test/perf/eth2/hashTreeRoot.test.ts b/packages/ssz/test/perf/eth2/hashTreeRoot.test.ts index 689890a4d..72eb8cec0 100644 --- a/packages/ssz/test/perf/eth2/hashTreeRoot.test.ts +++ b/packages/ssz/test/perf/eth2/hashTreeRoot.test.ts @@ -1,7 +1,7 @@ import {describe, bench} from "@chainsafe/benchmark"; import {HashComputationGroup, hasher, uint8ArrayToHashObject} from "@chainsafe/persistent-merkle-tree"; -import * as sszPhase0 from "../../lodestarTypes/phase0/sszTypes.js"; -import * as sszAltair from "../../lodestarTypes/altair/sszTypes.js"; +import * as sszPhase0 from "../../lodestarTypes/phase0/sszTypes.ts"; +import * as sszAltair from "../../lodestarTypes/altair/sszTypes.ts"; import { getAttestation, getOnce, @@ -11,7 +11,7 @@ import { getSignedContributionAndProof, getSignedBeaconBlockPhase0, getValidator, -} from "../../utils/generateEth2Objs.js"; +} from "../../utils/generateEth2Objs.ts"; import { CompositeType, isCompositeType, @@ -21,8 +21,8 @@ import { CompositeView, CompositeViewDU, hash64, -} from "../../../src/index.js"; -import {CompositeTypeAny} from "../../../src/type/composite.js"; +} from "../../../src/index.ts"; +import {CompositeTypeAny} from "../../../src/type/composite.ts"; import {HashObject} from "@chainsafe/as-sha256"; describe("HashTreeRoot frequent eth2 objects", () => { diff --git a/packages/ssz/test/perf/eth2/validators.test.ts b/packages/ssz/test/perf/eth2/validators.test.ts index 07ca01fb6..fc3234131 100644 --- a/packages/ssz/test/perf/eth2/validators.test.ts +++ b/packages/ssz/test/perf/eth2/validators.test.ts @@ -1,7 +1,7 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {Validator} from "../../lodestarTypes/phase0/types.js"; -import {ValidatorContainer, ValidatorNodeStruct} from "../../lodestarTypes/phase0/sszTypes.js"; -import {CompositeViewDU} from "../../../src/index.js"; +import {Validator} from "../../lodestarTypes/phase0/types.ts"; +import {ValidatorContainer, ValidatorNodeStruct} from "../../lodestarTypes/phase0/sszTypes.ts"; +import {CompositeViewDU} from "../../../src/index.ts"; const validatorStruct: Validator = { pubkey: Buffer.alloc(48, 0xdd), diff --git a/packages/ssz/test/perf/iterate.test.ts b/packages/ssz/test/perf/iterate.test.ts index 47c193d33..d6c0015c5 100644 --- a/packages/ssz/test/perf/iterate.test.ts +++ b/packages/ssz/test/perf/iterate.test.ts @@ -1,6 +1,6 @@ import {bench, setBenchOpts, describe} from "@chainsafe/benchmark"; -import {ListBasicType, UintNumberType} from "../../src/index.js"; -import {Validators} from "../lodestarTypes/phase0/sszTypes.js"; +import {ListBasicType, UintNumberType} from "../../src/index.ts"; +import {Validators} from "../lodestarTypes/phase0/sszTypes.ts"; describe("iterate", () => { setBenchOpts({noThreshold: true}); diff --git a/packages/ssz/test/perf/list.test.ts b/packages/ssz/test/perf/list.test.ts index 53ecdd65b..64e702d75 100644 --- a/packages/ssz/test/perf/list.test.ts +++ b/packages/ssz/test/perf/list.test.ts @@ -1,6 +1,6 @@ import {LeafNode, subtreeFillToContents, Node} from "@chainsafe/persistent-merkle-tree"; import {describe, bench} from "@chainsafe/benchmark"; -import {UintNumberType, ListBasicType} from "../../src/index.js"; +import {UintNumberType, ListBasicType} from "../../src/index.ts"; describe("list", () => { const numBalances = 250_000; diff --git a/packages/ssz/test/perf/merkleize.test.ts b/packages/ssz/test/perf/merkleize.test.ts index 9d1b169e3..5025b4405 100644 --- a/packages/ssz/test/perf/merkleize.test.ts +++ b/packages/ssz/test/perf/merkleize.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {bitLength} from "../../src/util/merkleize.js"; +import {bitLength} from "../../src/util/merkleize.ts"; describe("merkleize / bitLength", () => { for (const n of [50, 8000, 250000]) { diff --git a/packages/ssz/test/perf/propertyGet.test.ts b/packages/ssz/test/perf/propertyGet.test.ts index ff0106af9..84191ab92 100644 --- a/packages/ssz/test/perf/propertyGet.test.ts +++ b/packages/ssz/test/perf/propertyGet.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {UintNumberType, ContainerType, VectorBasicType} from "../../src/index.js"; +import {UintNumberType, ContainerType, VectorBasicType} from "../../src/index.ts"; describe("SSZ get property", () => { const Gwei = new UintNumberType(8); diff --git a/packages/ssz/test/perf/serdes.test.ts b/packages/ssz/test/perf/serdes.test.ts index dc2b5c48e..1267aaa53 100644 --- a/packages/ssz/test/perf/serdes.test.ts +++ b/packages/ssz/test/perf/serdes.test.ts @@ -13,8 +13,8 @@ import { BitArray, UintNumberType, ByteVectorType, -} from "../../src/index.js"; -import {ValidatorContainer, ValidatorNodeStruct} from "../lodestarTypes/phase0/sszTypes.js"; +} from "../../src/index.ts"; +import {ValidatorContainer, ValidatorNodeStruct} from "../lodestarTypes/phase0/sszTypes.ts"; describe("SSZ (de)serialize", () => { const uint8 = new UintNumberType(1); diff --git a/packages/ssz/test/perf/stateTransitionOps/processAttestations.test.ts b/packages/ssz/test/perf/stateTransitionOps/processAttestations.test.ts index ccf1d42fa..68329fb77 100644 --- a/packages/ssz/test/perf/stateTransitionOps/processAttestations.test.ts +++ b/packages/ssz/test/perf/stateTransitionOps/processAttestations.test.ts @@ -1,6 +1,6 @@ import {describe, bench, beforeAll} from "@chainsafe/benchmark"; import {MutableVector} from "@chainsafe/persistent-ts"; -import {ListBasicType, UintNumberType, CompositeViewDU} from "../../../src/index.js"; +import {ListBasicType, UintNumberType, CompositeViewDU} from "../../../src/index.ts"; describe("processAttestations", () => { const vc = 250_000; diff --git a/packages/ssz/test/perf/uint.test.ts b/packages/ssz/test/perf/uint.test.ts index d028d7b1c..45e0d6136 100644 --- a/packages/ssz/test/perf/uint.test.ts +++ b/packages/ssz/test/perf/uint.test.ts @@ -1,5 +1,5 @@ import {describe, bench} from "@chainsafe/benchmark"; -import {ContainerType, UintNumberType, UintBigintType} from "../../src/index.js"; +import {ContainerType, UintNumberType, UintBigintType} from "../../src/index.ts"; describe("Uint64 types", () => { const ContainerNumber = new ContainerType({ diff --git a/packages/ssz/test/perf/uintFromBytes.test.ts b/packages/ssz/test/perf/uintFromBytes.test.ts index 4ec0bc687..8f75d4b06 100644 --- a/packages/ssz/test/perf/uintFromBytes.test.ts +++ b/packages/ssz/test/perf/uintFromBytes.test.ts @@ -1,6 +1,6 @@ import {LeafNode} from "@chainsafe/persistent-merkle-tree"; import {describe, bench, beforeAll} from "@chainsafe/benchmark"; -import {UintNumberType, UintBigintType, uintNumberByteLens, uintBigintByteLens} from "../../src/type/uint.js"; +import {UintNumberType, UintBigintType, uintNumberByteLens, uintBigintByteLens} from "../../src/type/uint.ts"; const POW_32 = 2 ** 32; diff --git a/packages/ssz/test/spec/downloadTests.ts b/packages/ssz/test/spec/downloadTests.ts index 09a4a9669..36f2504d7 100644 --- a/packages/ssz/test/spec/downloadTests.ts +++ b/packages/ssz/test/spec/downloadTests.ts @@ -1,5 +1,5 @@ import {downloadTests} from "@lodestar/spec-test-util/downloadTests"; -import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {ethereumConsensusSpecsTests} from "../specTestVersioning.ts"; /* eslint-disable no-console */ diff --git a/packages/ssz/test/spec/eip-4881/eip4881.test.ts b/packages/ssz/test/spec/eip-4881/eip4881.test.ts index e002b1490..30d2f06a0 100644 --- a/packages/ssz/test/spec/eip-4881/eip4881.test.ts +++ b/packages/ssz/test/spec/eip-4881/eip4881.test.ts @@ -3,10 +3,10 @@ import url from "node:url"; import path from "node:path"; import jsyaml from "js-yaml"; import {describe, it, expect, vi} from "vitest"; -import {ContainerType, ListCompositeType} from "../../../src/index.js"; -import {ssz} from "../../lodestarTypes/index.js"; -import {DepositDataRootFullList, DepositDataRootPartialList} from "../../lodestarTypes/phase0/sszTypes.js"; -import {ListCompositeTreeViewDU} from "../../../src/viewDU/listComposite.js"; +import {ContainerType, ListCompositeType} from "../../../src/index.ts"; +import {ssz} from "../../lodestarTypes/index.ts"; +import {DepositDataRootFullList, DepositDataRootPartialList} from "../../lodestarTypes/phase0/sszTypes.ts"; +import {ListCompositeTreeViewDU} from "../../../src/viewDU/listComposite.ts"; const EIP4881TestDataArrayItem = new ContainerType( { diff --git a/packages/ssz/test/spec/generic/index.test.ts b/packages/ssz/test/spec/generic/index.test.ts index 4a4cbe6c4..a0600b783 100644 --- a/packages/ssz/test/spec/generic/index.test.ts +++ b/packages/ssz/test/spec/generic/index.test.ts @@ -1,10 +1,10 @@ import {describe, it, expect} from "vitest"; import path from "node:path"; import fs from "node:fs"; -import {ethereumConsensusSpecsTests} from "../../specTestVersioning.js"; -import {parseSszGenericValidTestcase, parseSszGenericInvalidTestcase} from "../testRunner.js"; -import {runValidSszTest} from "../runValidTest.js"; -import {getTestType} from "./types.js"; +import {ethereumConsensusSpecsTests} from "../../specTestVersioning.ts"; +import {parseSszGenericValidTestcase, parseSszGenericInvalidTestcase} from "../testRunner.ts"; +import {runValidSszTest} from "../runValidTest.ts"; +import {getTestType} from "./types.ts"; const rootGenericSszPath = path.join( ethereumConsensusSpecsTests.outputDir, diff --git a/packages/ssz/test/spec/generic/types.ts b/packages/ssz/test/spec/generic/types.ts index 74e6684e1..60d3b24a8 100644 --- a/packages/ssz/test/spec/generic/types.ts +++ b/packages/ssz/test/spec/generic/types.ts @@ -9,8 +9,8 @@ import { ListBasicType, VectorBasicType, VectorCompositeType, -} from "../../../src/index.js"; -import {UintBigintByteLen} from "../../../src/type/uint.js"; +} from "../../../src/index.ts"; +import {UintBigintByteLen} from "../../../src/type/uint.ts"; const bool = new BooleanType(); const byte = new UintNumberType(1); diff --git a/packages/ssz/test/spec/replaceUintTypeWithUintBigintType.ts b/packages/ssz/test/spec/replaceUintTypeWithUintBigintType.ts index 2fd098088..d1d62a3cf 100644 --- a/packages/ssz/test/spec/replaceUintTypeWithUintBigintType.ts +++ b/packages/ssz/test/spec/replaceUintTypeWithUintBigintType.ts @@ -14,7 +14,7 @@ import { VectorBasicType, VectorCompositeType, ContainerNodeStructType, -} from "../../src/index.js"; +} from "../../src/index.ts"; /** * Transform the type to something that is safe to deserialize diff --git a/packages/ssz/test/spec/runValidTest.ts b/packages/ssz/test/spec/runValidTest.ts index 1f0b0553a..6df6f128e 100644 --- a/packages/ssz/test/spec/runValidTest.ts +++ b/packages/ssz/test/spec/runValidTest.ts @@ -1,11 +1,11 @@ import {expect} from "vitest"; import {LeafNode, Node} from "@chainsafe/persistent-merkle-tree"; -import {Type} from "../../src/type/abstract.js"; -import {fromHexString, toHexString} from "../../src/util/byteArray.js"; -import {CompositeType, isCompositeType} from "../../src/type/composite.js"; -import {isBasicType} from "../../src/type/basic.js"; -import {wrapErr} from "../utils/error.js"; -import {TreeViewDU} from "../../src/index.js"; +import {Type} from "../../src/type/abstract.ts"; +import {fromHexString, toHexString} from "../../src/util/byteArray.ts"; +import {CompositeType, isCompositeType} from "../../src/type/composite.ts"; +import {isBasicType} from "../../src/type/basic.ts"; +import {wrapErr} from "../utils/error.ts"; +import {TreeViewDU} from "../../src/index.ts"; type ValidTestCaseData = { root: string; diff --git a/packages/ssz/test/spec/ssz_static.test.ts b/packages/ssz/test/spec/ssz_static.test.ts index 95349075a..b8f1c4525 100644 --- a/packages/ssz/test/spec/ssz_static.test.ts +++ b/packages/ssz/test/spec/ssz_static.test.ts @@ -1,5 +1,5 @@ -import {ForkName} from "../utils/fork.js"; -import {sszStatic} from "./ssz_static.js"; +import {ForkName} from "../utils/fork.ts"; +import {sszStatic} from "./ssz_static.ts"; if (process.env.LODESTAR_FORK) { sszStatic(process.env.LODESTAR_FORK as ForkName); diff --git a/packages/ssz/test/spec/ssz_static.ts b/packages/ssz/test/spec/ssz_static.ts index b291589c1..5d20f3f18 100644 --- a/packages/ssz/test/spec/ssz_static.ts +++ b/packages/ssz/test/spec/ssz_static.ts @@ -1,15 +1,15 @@ import fs from "node:fs"; import path from "node:path"; import {describe, it, vi} from "vitest"; -import {isCompositeType, Type} from "../../src/index.js"; -import {ssz} from "../lodestarTypes/index.js"; -import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; -import {replaceUintTypeWithUintBigintType} from "./replaceUintTypeWithUintBigintType.js"; -import {parseSszStaticTestcase} from "./testRunner.js"; -import {runValidSszTest} from "./runValidTest.js"; -import {ForkName} from "../utils/fork.js"; -import {ACTIVE_PRESET} from "../lodestarTypes/params.js"; -import {runProofTestOnAllJsonPaths} from "../unit/byType/runTypeProofTest.js"; +import {isCompositeType, Type} from "../../src/index.ts"; +import {ssz} from "../lodestarTypes/index.ts"; +import {ethereumConsensusSpecsTests} from "../specTestVersioning.ts"; +import {replaceUintTypeWithUintBigintType} from "./replaceUintTypeWithUintBigintType.ts"; +import {parseSszStaticTestcase} from "./testRunner.ts"; +import {runValidSszTest} from "./runValidTest.ts"; +import {ForkName} from "../utils/fork.ts"; +import {ACTIVE_PRESET} from "../lodestarTypes/params.ts"; +import {runProofTestOnAllJsonPaths} from "../unit/byType/runTypeProofTest.ts"; // ssz_static // | Attestation diff --git a/packages/ssz/test/spec/testRunner.ts b/packages/ssz/test/spec/testRunner.ts index e5f2a527f..fb60d3a31 100644 --- a/packages/ssz/test/spec/testRunner.ts +++ b/packages/ssz/test/spec/testRunner.ts @@ -2,7 +2,7 @@ import path from "node:path"; import fs from "node:fs"; import {uncompress} from "snappyjs"; import jsyaml from "js-yaml"; -import {schema} from "./sszYamlSchema.js"; +import {schema} from "./sszYamlSchema.ts"; /* eslint-disable @typescript-eslint/explicit-module-boundary-types, diff --git a/packages/ssz/test/unit/byType/bitArray/tree.test.ts b/packages/ssz/test/unit/byType/bitArray/tree.test.ts index 5dad8e69d..f903446c0 100644 --- a/packages/ssz/test/unit/byType/bitArray/tree.test.ts +++ b/packages/ssz/test/unit/byType/bitArray/tree.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {BitVectorType, BitListType, BitArray} from "../../../../src/index.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; +import {BitVectorType, BitListType, BitArray} from "../../../../src/index.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; for (const type of [new BitVectorType(4), new BitListType(4)]) { runViewTestMutation({ diff --git a/packages/ssz/test/unit/byType/bitList/invalid.test.ts b/packages/ssz/test/unit/byType/bitList/invalid.test.ts index e8d3f62d4..5caa7d7f2 100644 --- a/packages/ssz/test/unit/byType/bitList/invalid.test.ts +++ b/packages/ssz/test/unit/byType/bitList/invalid.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {BitListType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {BitListType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new BitListType(8 * 8), diff --git a/packages/ssz/test/unit/byType/bitList/valid.test.ts b/packages/ssz/test/unit/byType/bitList/valid.test.ts index ca17b1f71..dba5fae6a 100644 --- a/packages/ssz/test/unit/byType/bitList/valid.test.ts +++ b/packages/ssz/test/unit/byType/bitList/valid.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {BitListType, BitArray, toHexString} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {BitListType, BitArray, toHexString} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new BitListType(2048), diff --git a/packages/ssz/test/unit/byType/bitVector/invalid.test.ts b/packages/ssz/test/unit/byType/bitVector/invalid.test.ts index 0b8aa1e59..d98b1b54a 100644 --- a/packages/ssz/test/unit/byType/bitVector/invalid.test.ts +++ b/packages/ssz/test/unit/byType/bitVector/invalid.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {BitVectorType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {BitVectorType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new BitVectorType(8 * 8), diff --git a/packages/ssz/test/unit/byType/bitVector/tree.test.ts b/packages/ssz/test/unit/byType/bitVector/tree.test.ts index ae060a07a..72b6b4220 100644 --- a/packages/ssz/test/unit/byType/bitVector/tree.test.ts +++ b/packages/ssz/test/unit/byType/bitVector/tree.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {BitVectorType, BitArray} from "../../../../src/index.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; +import {BitVectorType, BitArray} from "../../../../src/index.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; runViewTestMutation({ type: new BitVectorType(4), diff --git a/packages/ssz/test/unit/byType/bitVector/valid.test.ts b/packages/ssz/test/unit/byType/bitVector/valid.test.ts index 0c39da479..67c211510 100644 --- a/packages/ssz/test/unit/byType/bitVector/valid.test.ts +++ b/packages/ssz/test/unit/byType/bitVector/valid.test.ts @@ -1,5 +1,5 @@ -import {BitVectorType, BitArray} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {BitVectorType, BitArray} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new BitVectorType(128), diff --git a/packages/ssz/test/unit/byType/boolean/invalid.test.ts b/packages/ssz/test/unit/byType/boolean/invalid.test.ts index fda73e5c1..02f724022 100644 --- a/packages/ssz/test/unit/byType/boolean/invalid.test.ts +++ b/packages/ssz/test/unit/byType/boolean/invalid.test.ts @@ -1,5 +1,5 @@ -import {BooleanType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {BooleanType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new BooleanType(), diff --git a/packages/ssz/test/unit/byType/boolean/tree.test.ts b/packages/ssz/test/unit/byType/boolean/tree.test.ts index f36f07049..dd5434bad 100644 --- a/packages/ssz/test/unit/byType/boolean/tree.test.ts +++ b/packages/ssz/test/unit/byType/boolean/tree.test.ts @@ -1,7 +1,7 @@ import {LeafNode} from "@chainsafe/persistent-merkle-tree"; import {describe, it, expect} from "vitest"; -import {toHexString} from "../../../../src/util/byteArray.js"; -import {BooleanType} from "../../../../src/index.js"; +import {toHexString} from "../../../../src/util/byteArray.ts"; +import {BooleanType} from "../../../../src/index.ts"; describe("BooleanType / tree", () => { const booleanType = new BooleanType(); diff --git a/packages/ssz/test/unit/byType/boolean/valid.test.ts b/packages/ssz/test/unit/byType/boolean/valid.test.ts index 01f188c1f..2a83f728d 100644 --- a/packages/ssz/test/unit/byType/boolean/valid.test.ts +++ b/packages/ssz/test/unit/byType/boolean/valid.test.ts @@ -1,5 +1,5 @@ -import {BooleanType} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {BooleanType} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new BooleanType(), diff --git a/packages/ssz/test/unit/byType/byteList/invalid.test.ts b/packages/ssz/test/unit/byType/byteList/invalid.test.ts index 1ca08e5cb..7a2b81f67 100644 --- a/packages/ssz/test/unit/byType/byteList/invalid.test.ts +++ b/packages/ssz/test/unit/byType/byteList/invalid.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {ByteListType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {ByteListType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new ByteListType(8), diff --git a/packages/ssz/test/unit/byType/byteList/valid.test.ts b/packages/ssz/test/unit/byType/byteList/valid.test.ts index 89cbf89e6..af3fee082 100644 --- a/packages/ssz/test/unit/byType/byteList/valid.test.ts +++ b/packages/ssz/test/unit/byType/byteList/valid.test.ts @@ -1,5 +1,5 @@ -import {ListBasicType, ByteListType, fromHexString, UintNumberType} from "../../../../src/index.js"; -import {runTypeTestValid, TypeTestValid} from "../runTypeTestValid.js"; +import {ListBasicType, ByteListType, fromHexString, UintNumberType} from "../../../../src/index.ts"; +import {runTypeTestValid, TypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new ByteListType(256), diff --git a/packages/ssz/test/unit/byType/byteVector/invalid.test.ts b/packages/ssz/test/unit/byType/byteVector/invalid.test.ts index 26b6cfc79..355337f0f 100644 --- a/packages/ssz/test/unit/byType/byteVector/invalid.test.ts +++ b/packages/ssz/test/unit/byType/byteVector/invalid.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {ByteVectorType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {ByteVectorType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new ByteVectorType(8), diff --git a/packages/ssz/test/unit/byType/byteVector/tree.test.ts b/packages/ssz/test/unit/byType/byteVector/tree.test.ts index 3b15025e4..72d3d6f0c 100644 --- a/packages/ssz/test/unit/byType/byteVector/tree.test.ts +++ b/packages/ssz/test/unit/byType/byteVector/tree.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {ByteVectorType, ContainerType} from "../../../../src/index.js"; +import {ByteVectorType, ContainerType} from "../../../../src/index.ts"; describe("ByteVectorType proofs", () => { const rootType = new ByteVectorType(32); diff --git a/packages/ssz/test/unit/byType/byteVector/valid.test.ts b/packages/ssz/test/unit/byType/byteVector/valid.test.ts index 0f987fea8..d8b902514 100644 --- a/packages/ssz/test/unit/byType/byteVector/valid.test.ts +++ b/packages/ssz/test/unit/byType/byteVector/valid.test.ts @@ -1,5 +1,5 @@ -import {ByteVectorType} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {ByteVectorType} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new ByteVectorType(4), diff --git a/packages/ssz/test/unit/byType/composite/tree.test.ts b/packages/ssz/test/unit/byType/composite/tree.test.ts index c69203d58..97ba6b345 100644 --- a/packages/ssz/test/unit/byType/composite/tree.test.ts +++ b/packages/ssz/test/unit/byType/composite/tree.test.ts @@ -9,9 +9,9 @@ import { NoneType, BitVectorType, BitArray, -} from "../../../../src/index.js"; -import {uintNumberByteLens, uintBigintByteLens} from "../../../../src/type/uint.js"; -import {runViewTestCompositeSwap} from "../runViewTestCompositeSwap.js"; +} from "../../../../src/index.ts"; +import {uintNumberByteLens, uintBigintByteLens} from "../../../../src/type/uint.ts"; +import {runViewTestCompositeSwap} from "../runViewTestCompositeSwap.ts"; // Swap properties tests. Because swaping uses the same property names you can write many more tests // just by declaring the property type and two values: diff --git a/packages/ssz/test/unit/byType/container/invalid.test.ts b/packages/ssz/test/unit/byType/container/invalid.test.ts index 07b2fc3b2..c5bec1cbf 100644 --- a/packages/ssz/test/unit/byType/container/invalid.test.ts +++ b/packages/ssz/test/unit/byType/container/invalid.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {ContainerNodeStructType, ContainerType, ListBasicType, UintNumberType} from "../../../../src/index.js"; -import {byteType, uint16NumType} from "../../../utils/primitiveTypes.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {ContainerNodeStructType, ContainerType, ListBasicType, UintNumberType} from "../../../../src/index.ts"; +import {byteType, uint16NumType} from "../../../utils/primitiveTypes.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new ContainerType({a: uint16NumType}), diff --git a/packages/ssz/test/unit/byType/container/tree.test.ts b/packages/ssz/test/unit/byType/container/tree.test.ts index 973b78d4e..beed396c5 100644 --- a/packages/ssz/test/unit/byType/container/tree.test.ts +++ b/packages/ssz/test/unit/byType/container/tree.test.ts @@ -19,10 +19,10 @@ import { ValueOf, VectorBasicType, VectorCompositeType, -} from "../../../../src/index.js"; -import {uint64NumInfType, uint64NumType} from "../../../utils/primitiveTypes.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; -import {upgradeToNewType} from "../../../../src/util/upgrade.js"; +} from "../../../../src/index.ts"; +import {uint64NumInfType, uint64NumType} from "../../../utils/primitiveTypes.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; +import {upgradeToNewType} from "../../../../src/util/upgrade.ts"; // Test both ContainerType, ContainerNodeStructType only if // - All fields are immutable diff --git a/packages/ssz/test/unit/byType/container/valid.test.ts b/packages/ssz/test/unit/byType/container/valid.test.ts index 8436a8d2d..da5ecffa6 100644 --- a/packages/ssz/test/unit/byType/container/valid.test.ts +++ b/packages/ssz/test/unit/byType/container/valid.test.ts @@ -1,9 +1,9 @@ -import {ContainerType, ContainerNodeStructType, ListBasicType, ByteVectorType} from "../../../../src/index.js"; -import {ssz} from "../../../lodestarTypes/index.js"; -import {SignedContributionAndProof} from "../../../lodestarTypes/altair/sszTypes.js"; -import {replaceUintTypeWithUintBigintType} from "../../../spec/replaceUintTypeWithUintBigintType.js"; -import {uint64NumInfType} from "../../../utils/primitiveTypes.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {ContainerType, ContainerNodeStructType, ListBasicType, ByteVectorType} from "../../../../src/index.ts"; +import {ssz} from "../../../lodestarTypes/index.ts"; +import {SignedContributionAndProof} from "../../../lodestarTypes/altair/sszTypes.ts"; +import {replaceUintTypeWithUintBigintType} from "../../../spec/replaceUintTypeWithUintBigintType.ts"; +import {uint64NumInfType} from "../../../utils/primitiveTypes.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; for (const ContainerTypeTest of [ContainerType, ContainerNodeStructType]) { runTypeTestValid({ diff --git a/packages/ssz/test/unit/byType/listBasic/invalid.test.ts b/packages/ssz/test/unit/byType/listBasic/invalid.test.ts index 7d76eaf5f..32331560b 100644 --- a/packages/ssz/test/unit/byType/listBasic/invalid.test.ts +++ b/packages/ssz/test/unit/byType/listBasic/invalid.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {ListBasicType} from "../../../../src/index.js"; -import {byteType} from "../../../utils/primitiveTypes.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {ListBasicType} from "../../../../src/index.ts"; +import {byteType} from "../../../utils/primitiveTypes.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new ListBasicType(byteType, 2), diff --git a/packages/ssz/test/unit/byType/listBasic/misc.test.ts b/packages/ssz/test/unit/byType/listBasic/misc.test.ts index cb81a8bdc..ab76a43f0 100644 --- a/packages/ssz/test/unit/byType/listBasic/misc.test.ts +++ b/packages/ssz/test/unit/byType/listBasic/misc.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {ListBasicType, UintNumberType} from "../../../../src/index.js"; +import {ListBasicType, UintNumberType} from "../../../../src/index.ts"; describe("To hit 100% coverage", () => { const listBasic = new ListBasicType(new UintNumberType(1), 4); diff --git a/packages/ssz/test/unit/byType/listBasic/mutation.test.ts b/packages/ssz/test/unit/byType/listBasic/mutation.test.ts index b590efdf7..c83bf569f 100644 --- a/packages/ssz/test/unit/byType/listBasic/mutation.test.ts +++ b/packages/ssz/test/unit/byType/listBasic/mutation.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {ListBasicType, UintNumberType} from "../../../../src/index.js"; +import {ListBasicType, UintNumberType} from "../../../../src/index.ts"; describe("BasicList", () => { it("TreeView edit mutate and transfer", () => { diff --git a/packages/ssz/test/unit/byType/listBasic/tree.test.ts b/packages/ssz/test/unit/byType/listBasic/tree.test.ts index b5d6c0dba..5ae15cc80 100644 --- a/packages/ssz/test/unit/byType/listBasic/tree.test.ts +++ b/packages/ssz/test/unit/byType/listBasic/tree.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {ListBasicType, toHexString, UintNumberType} from "../../../../src/index.js"; -import {runViewTestMutation, TreeMutation} from "../runViewTestMutation.js"; -import {ListUintNum64Type} from "../../../../src/type/listUintNum64.js"; +import {ListBasicType, toHexString, UintNumberType} from "../../../../src/index.ts"; +import {runViewTestMutation, TreeMutation} from "../runViewTestMutation.ts"; +import {ListUintNum64Type} from "../../../../src/type/listUintNum64.ts"; const limit = 100; const uint64NumInf = new UintNumberType(8, {clipInfinity: true}); diff --git a/packages/ssz/test/unit/byType/listBasic/valid.test.ts b/packages/ssz/test/unit/byType/listBasic/valid.test.ts index 20c4b7580..ac9f9bc4c 100644 --- a/packages/ssz/test/unit/byType/listBasic/valid.test.ts +++ b/packages/ssz/test/unit/byType/listBasic/valid.test.ts @@ -1,5 +1,5 @@ -import {ListBasicType, UintNumberType} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {ListBasicType, UintNumberType} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new ListBasicType(new UintNumberType(1), 128), diff --git a/packages/ssz/test/unit/byType/listComposite/invalid.test.ts b/packages/ssz/test/unit/byType/listComposite/invalid.test.ts index 0bf820440..ff204acd8 100644 --- a/packages/ssz/test/unit/byType/listComposite/invalid.test.ts +++ b/packages/ssz/test/unit/byType/listComposite/invalid.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {ListCompositeType, UintNumberType, ContainerType, ListBasicType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {ListCompositeType, UintNumberType, ContainerType, ListBasicType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; const uint16 = new UintNumberType(2); diff --git a/packages/ssz/test/unit/byType/listComposite/tree.test.ts b/packages/ssz/test/unit/byType/listComposite/tree.test.ts index 404d5b014..8058c6ab8 100644 --- a/packages/ssz/test/unit/byType/listComposite/tree.test.ts +++ b/packages/ssz/test/unit/byType/listComposite/tree.test.ts @@ -7,11 +7,11 @@ import { toHexString, UintNumberType, ValueOf, -} from "../../../../src/index.js"; -import {ArrayCompositeTreeViewDU} from "../../../../src/viewDU/arrayComposite.js"; -import {ssz} from "../../../lodestarTypes/primitive/index.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; -import {ListCompositeTreeViewDU} from "../../../../src/viewDU/listComposite.js"; +} from "../../../../src/index.ts"; +import {ArrayCompositeTreeViewDU} from "../../../../src/viewDU/arrayComposite.ts"; +import {ssz} from "../../../lodestarTypes/primitive/index.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; +import {ListCompositeTreeViewDU} from "../../../../src/viewDU/listComposite.ts"; const uint64NumInfType = new UintNumberType(8, {clipInfinity: true}); const containerUintsType = new ContainerType( diff --git a/packages/ssz/test/unit/byType/listComposite/valid.test.ts b/packages/ssz/test/unit/byType/listComposite/valid.test.ts index 4a0db93e1..0d87028c7 100644 --- a/packages/ssz/test/unit/byType/listComposite/valid.test.ts +++ b/packages/ssz/test/unit/byType/listComposite/valid.test.ts @@ -4,8 +4,8 @@ import { UintNumberType, ByteVectorType, ListBasicType, -} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; const uint64Type = new UintNumberType(8); diff --git a/packages/ssz/test/unit/byType/none/invalid.test.ts b/packages/ssz/test/unit/byType/none/invalid.test.ts index 4b802bdaf..095a99053 100644 --- a/packages/ssz/test/unit/byType/none/invalid.test.ts +++ b/packages/ssz/test/unit/byType/none/invalid.test.ts @@ -1,5 +1,5 @@ -import {NoneType} from "../../../../src/type/none.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {NoneType} from "../../../../src/type/none.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new NoneType(), diff --git a/packages/ssz/test/unit/byType/none/misc.test.ts b/packages/ssz/test/unit/byType/none/misc.test.ts index c440c46e8..d11c86076 100644 --- a/packages/ssz/test/unit/byType/none/misc.test.ts +++ b/packages/ssz/test/unit/byType/none/misc.test.ts @@ -1,6 +1,6 @@ import {LeafNode} from "@chainsafe/persistent-merkle-tree"; import {describe, it, expect} from "vitest"; -import {NoneType, toHexString} from "../../../../src/index.js"; +import {NoneType, toHexString} from "../../../../src/index.ts"; describe("None type", () => { const noneType = new NoneType(); diff --git a/packages/ssz/test/unit/byType/none/valid.test.ts b/packages/ssz/test/unit/byType/none/valid.test.ts index 612039e63..815f9799f 100644 --- a/packages/ssz/test/unit/byType/none/valid.test.ts +++ b/packages/ssz/test/unit/byType/none/valid.test.ts @@ -1,5 +1,5 @@ -import {NoneType} from "../../../../src/type/none.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {NoneType} from "../../../../src/type/none.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new NoneType(), diff --git a/packages/ssz/test/unit/byType/optional/invalid.test.ts b/packages/ssz/test/unit/byType/optional/invalid.test.ts index 583788045..b0c5e45e3 100644 --- a/packages/ssz/test/unit/byType/optional/invalid.test.ts +++ b/packages/ssz/test/unit/byType/optional/invalid.test.ts @@ -1,5 +1,5 @@ -import {UintNumberType, OptionalType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {UintNumberType, OptionalType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; const byteType = new UintNumberType(1); diff --git a/packages/ssz/test/unit/byType/optional/tree.test.ts b/packages/ssz/test/unit/byType/optional/tree.test.ts index 673716a4b..845b05e7e 100644 --- a/packages/ssz/test/unit/byType/optional/tree.test.ts +++ b/packages/ssz/test/unit/byType/optional/tree.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {OptionalType, ContainerType, UintNumberType, ValueOf, toHexString} from "../../../../src/index.js"; +import {OptionalType, ContainerType, UintNumberType, ValueOf, toHexString} from "../../../../src/index.ts"; const byteType = new UintNumberType(1); const SimpleObject = new ContainerType({ diff --git a/packages/ssz/test/unit/byType/optional/valid.test.ts b/packages/ssz/test/unit/byType/optional/valid.test.ts index c35c91f7b..410796b17 100644 --- a/packages/ssz/test/unit/byType/optional/valid.test.ts +++ b/packages/ssz/test/unit/byType/optional/valid.test.ts @@ -1,5 +1,5 @@ -import {OptionalType, UintNumberType, ListBasicType, ContainerType, ListCompositeType} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {OptionalType, UintNumberType, ListBasicType, ContainerType, ListCompositeType} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; const number8Type = new UintNumberType(1); const SimpleObject = new ContainerType({ diff --git a/packages/ssz/test/unit/byType/partialListComposite/tree.test.ts b/packages/ssz/test/unit/byType/partialListComposite/tree.test.ts index 75a574302..94877587a 100644 --- a/packages/ssz/test/unit/byType/partialListComposite/tree.test.ts +++ b/packages/ssz/test/unit/byType/partialListComposite/tree.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {ContainerType, ListCompositeType, UintNumberType} from "../../../../src/index.js"; -import {PartialListCompositeType} from "../../../../src/type/partialListComposite.js"; +import {ContainerType, ListCompositeType, UintNumberType} from "../../../../src/index.ts"; +import {PartialListCompositeType} from "../../../../src/type/partialListComposite.ts"; const uint64NumInfType = new UintNumberType(8, {clipInfinity: true}); const containerUintsType = new ContainerType( diff --git a/packages/ssz/test/unit/byType/profile/tree.test.ts b/packages/ssz/test/unit/byType/profile/tree.test.ts index 00c8f85ba..b8990cc0c 100644 --- a/packages/ssz/test/unit/byType/profile/tree.test.ts +++ b/packages/ssz/test/unit/byType/profile/tree.test.ts @@ -20,9 +20,9 @@ import { ValueOf, VectorBasicType, VectorCompositeType, -} from "../../../../src/index.js"; -import {uint64NumInfType, uint64NumType} from "../../../utils/primitiveTypes.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; +} from "../../../../src/index.ts"; +import {uint64NumInfType, uint64NumType} from "../../../utils/primitiveTypes.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; // Test both ContainerType, ContainerNodeStructType only if // - All fields are immutable diff --git a/packages/ssz/test/unit/byType/profile/valid.test.ts b/packages/ssz/test/unit/byType/profile/valid.test.ts index c7209b96b..fc3bd53c1 100644 --- a/packages/ssz/test/unit/byType/profile/valid.test.ts +++ b/packages/ssz/test/unit/byType/profile/valid.test.ts @@ -1,5 +1,5 @@ -import {BitArray, ProfileType, UintNumberType} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {BitArray, ProfileType, UintNumberType} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; // taken from eip spec tests diff --git a/packages/ssz/test/unit/byType/runTypeProofTest.ts b/packages/ssz/test/unit/byType/runTypeProofTest.ts index 6c1ce6ea1..0c586b6b7 100644 --- a/packages/ssz/test/unit/byType/runTypeProofTest.ts +++ b/packages/ssz/test/unit/byType/runTypeProofTest.ts @@ -9,11 +9,11 @@ import { ProfileType, StableContainerType, Type, -} from "../../../src/index.js"; -import {CompositeTypeAny, isCompositeType} from "../../../src/type/composite.js"; -import {ArrayBasicTreeView} from "../../../src/view/arrayBasic.js"; -import {RootHex} from "../../lodestarTypes/index.js"; -import {wrapErr} from "../../utils/error.js"; +} from "../../../src/index.ts"; +import {CompositeTypeAny, isCompositeType} from "../../../src/type/composite.ts"; +import {ArrayBasicTreeView} from "../../../src/view/arrayBasic.ts"; +import {RootHex} from "../../lodestarTypes/index.ts"; +import {wrapErr} from "../../utils/error.ts"; export function runProofTestOnAllJsonPaths({ type, diff --git a/packages/ssz/test/unit/byType/runTypeTestInvalid.ts b/packages/ssz/test/unit/byType/runTypeTestInvalid.ts index f9fe92058..85bd8f139 100644 --- a/packages/ssz/test/unit/byType/runTypeTestInvalid.ts +++ b/packages/ssz/test/unit/byType/runTypeTestInvalid.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {CompositeType, fromHexString, Type} from "../../../src/index.js"; +import {CompositeType, fromHexString, Type} from "../../../src/index.ts"; /* eslint-disable @typescript-eslint/no-unsafe-assignment */ diff --git a/packages/ssz/test/unit/byType/runTypeTestValid.ts b/packages/ssz/test/unit/byType/runTypeTestValid.ts index 7654d2d33..9a972579f 100644 --- a/packages/ssz/test/unit/byType/runTypeTestValid.ts +++ b/packages/ssz/test/unit/byType/runTypeTestValid.ts @@ -1,9 +1,9 @@ import {describe, it, expect} from "vitest"; -import {toHexString, TreeViewDU, UnionType} from "../../../src/index.js"; -import {Type} from "../../../src/type/abstract.js"; -import {isCompositeType} from "../../../src/type/composite.js"; -import {runValidSszTest, toJsonOrString} from "../../spec/runValidTest.js"; -import {runProofTestOnAllJsonPaths} from "./runTypeProofTest.js"; +import {toHexString, TreeViewDU, UnionType} from "../../../src/index.ts"; +import {Type} from "../../../src/type/abstract.ts"; +import {isCompositeType} from "../../../src/type/composite.ts"; +import {runValidSszTest, toJsonOrString} from "../../spec/runValidTest.ts"; +import {runProofTestOnAllJsonPaths} from "./runTypeProofTest.ts"; /* eslint-disable @typescript-eslint/no-unsafe-assignment */ diff --git a/packages/ssz/test/unit/byType/runViewTestCompositeSwap.ts b/packages/ssz/test/unit/byType/runViewTestCompositeSwap.ts index 2fe1e69c0..be8b12309 100644 --- a/packages/ssz/test/unit/byType/runViewTestCompositeSwap.ts +++ b/packages/ssz/test/unit/byType/runViewTestCompositeSwap.ts @@ -1,12 +1,12 @@ -import {Type, ValueOf, TreeView, BasicType} from "../../../src/index.js"; +import {Type, ValueOf, TreeView, BasicType} from "../../../src/index.ts"; import { ContainerType, ListBasicType, ListCompositeType, VectorBasicType, VectorCompositeType, -} from "../../../src/index.js"; -import {runViewTestMutation} from "./runViewTestMutation.js"; +} from "../../../src/index.ts"; +import {runViewTestMutation} from "./runViewTestMutation.ts"; const runViewTestCompositeSwapFn = function runViewTestCompositeSwap>( propertyType: T, diff --git a/packages/ssz/test/unit/byType/runViewTestMutation.ts b/packages/ssz/test/unit/byType/runViewTestMutation.ts index f55fb8061..619ee2ffe 100644 --- a/packages/ssz/test/unit/byType/runViewTestMutation.ts +++ b/packages/ssz/test/unit/byType/runViewTestMutation.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {toHexString} from "../../../src/util/byteArray.js"; -import {CompositeType, ValueOf, TreeViewDU, CompositeViewDU} from "../../../src/index.js"; +import {toHexString} from "../../../src/util/byteArray.ts"; +import {CompositeType, ValueOf, TreeViewDU, CompositeViewDU} from "../../../src/index.ts"; export type TreeMutation> = { id: string; diff --git a/packages/ssz/test/unit/byType/stableContainer/tree.test.ts b/packages/ssz/test/unit/byType/stableContainer/tree.test.ts index 6beb2392d..473997173 100644 --- a/packages/ssz/test/unit/byType/stableContainer/tree.test.ts +++ b/packages/ssz/test/unit/byType/stableContainer/tree.test.ts @@ -18,9 +18,9 @@ import { ValueOf, VectorBasicType, VectorCompositeType, -} from "../../../../src/index.js"; -import {uint64NumInfType, uint64NumType} from "../../../utils/primitiveTypes.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; +} from "../../../../src/index.ts"; +import {uint64NumInfType, uint64NumType} from "../../../utils/primitiveTypes.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; import {getNodesAtDepth, Tree, zeroHash} from "@chainsafe/persistent-merkle-tree"; // Test both ContainerType, ContainerNodeStructType only if diff --git a/packages/ssz/test/unit/byType/stableContainer/valid.test.ts b/packages/ssz/test/unit/byType/stableContainer/valid.test.ts index bb585d2db..b76b8c715 100644 --- a/packages/ssz/test/unit/byType/stableContainer/valid.test.ts +++ b/packages/ssz/test/unit/byType/stableContainer/valid.test.ts @@ -1,5 +1,5 @@ -import {ListBasicType, OptionalType, StableContainerType, UintNumberType} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {ListBasicType, OptionalType, StableContainerType, UintNumberType} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; // taken from eip spec tests diff --git a/packages/ssz/test/unit/byType/uint/invalid.test.ts b/packages/ssz/test/unit/byType/uint/invalid.test.ts index f2aba989d..bf21c5a06 100644 --- a/packages/ssz/test/unit/byType/uint/invalid.test.ts +++ b/packages/ssz/test/unit/byType/uint/invalid.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {UintNumberType, UintBigintType} from "../../../../src/index.js"; -import {UintNumberByteLen, uintNumberByteLens, uintBigintByteLens} from "../../../../src/type/uint.js"; -import {runTypeTestInvalid, InvalidValue} from "../runTypeTestInvalid.js"; +import {UintNumberType, UintBigintType} from "../../../../src/index.ts"; +import {UintNumberByteLen, uintNumberByteLens, uintBigintByteLens} from "../../../../src/type/uint.ts"; +import {runTypeTestInvalid, InvalidValue} from "../runTypeTestInvalid.ts"; for (const byteLen of uintNumberByteLens) { runTypeTestInvalid({ diff --git a/packages/ssz/test/unit/byType/uint/tree.test.ts b/packages/ssz/test/unit/byType/uint/tree.test.ts index fa1291565..8e9c878d3 100644 --- a/packages/ssz/test/unit/byType/uint/tree.test.ts +++ b/packages/ssz/test/unit/byType/uint/tree.test.ts @@ -1,7 +1,7 @@ import {LeafNode} from "@chainsafe/persistent-merkle-tree"; import {describe, it, expect} from "vitest"; -import {toHexString, fromHexString} from "../../../../src/util/byteArray.js"; -import {byteType, uint64NumInfType} from "../../../utils/primitiveTypes.js"; +import {toHexString, fromHexString} from "../../../../src/util/byteArray.ts"; +import {byteType, uint64NumInfType} from "../../../utils/primitiveTypes.ts"; describe("UintNumberType / tree", () => { it("Single value", () => { diff --git a/packages/ssz/test/unit/byType/uint/valid.test.ts b/packages/ssz/test/unit/byType/uint/valid.test.ts index e3e2452a5..8b75f3ea1 100644 --- a/packages/ssz/test/unit/byType/uint/valid.test.ts +++ b/packages/ssz/test/unit/byType/uint/valid.test.ts @@ -1,5 +1,5 @@ -import {UintBigintType, UintNumberType} from "../../../../src/type/uint.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {UintBigintType, UintNumberType} from "../../../../src/type/uint.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; runTypeTestValid({ type: new UintNumberType(1), diff --git a/packages/ssz/test/unit/byType/union/invalid.test.ts b/packages/ssz/test/unit/byType/union/invalid.test.ts index 5a715ed2c..f6236cf45 100644 --- a/packages/ssz/test/unit/byType/union/invalid.test.ts +++ b/packages/ssz/test/unit/byType/union/invalid.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {UintNumberType, UnionType, NoneType} from "../../../../src/index.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {UintNumberType, UnionType, NoneType} from "../../../../src/index.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; const byteType = new UintNumberType(1); const noneType = new NoneType(); diff --git a/packages/ssz/test/unit/byType/union/tree.test.ts b/packages/ssz/test/unit/byType/union/tree.test.ts index 06f92df3b..8f2cd3646 100644 --- a/packages/ssz/test/unit/byType/union/tree.test.ts +++ b/packages/ssz/test/unit/byType/union/tree.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {UnionType, UintNumberType, NoneType, ValueOf, toHexString} from "../../../../src/index.js"; +import {UnionType, UintNumberType, NoneType, ValueOf, toHexString} from "../../../../src/index.ts"; const byteType = new UintNumberType(1); const noneType = new NoneType(); diff --git a/packages/ssz/test/unit/byType/union/valid.test.ts b/packages/ssz/test/unit/byType/union/valid.test.ts index a0b4e7738..b8fe5ed94 100644 --- a/packages/ssz/test/unit/byType/union/valid.test.ts +++ b/packages/ssz/test/unit/byType/union/valid.test.ts @@ -1,5 +1,5 @@ -import {ContainerType, UintNumberType, UnionType, NoneType} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +import {ContainerType, UintNumberType, UnionType, NoneType} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; const number16Type = new UintNumberType(2); const SimpleObject = new ContainerType({ diff --git a/packages/ssz/test/unit/byType/vector/invalid.test.ts b/packages/ssz/test/unit/byType/vector/invalid.test.ts index 17c52b042..9a21bf929 100644 --- a/packages/ssz/test/unit/byType/vector/invalid.test.ts +++ b/packages/ssz/test/unit/byType/vector/invalid.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {VectorBasicType, VectorCompositeType} from "../../../../src/index.js"; -import {byteType, uint16NumType} from "../../../utils/primitiveTypes.js"; -import {runTypeTestInvalid} from "../runTypeTestInvalid.js"; +import {VectorBasicType, VectorCompositeType} from "../../../../src/index.ts"; +import {byteType, uint16NumType} from "../../../utils/primitiveTypes.ts"; +import {runTypeTestInvalid} from "../runTypeTestInvalid.ts"; runTypeTestInvalid({ type: new VectorBasicType(uint16NumType, 2), diff --git a/packages/ssz/test/unit/byType/vector/valid.test.ts b/packages/ssz/test/unit/byType/vector/valid.test.ts index 20c6deb5c..0408eb873 100644 --- a/packages/ssz/test/unit/byType/vector/valid.test.ts +++ b/packages/ssz/test/unit/byType/vector/valid.test.ts @@ -5,8 +5,8 @@ import { UintNumberType, ByteVectorType, ListBasicType, -} from "../../../../src/index.js"; -import {runTypeTestValid} from "../runTypeTestValid.js"; +} from "../../../../src/index.ts"; +import {runTypeTestValid} from "../runTypeTestValid.ts"; const rootType = new ByteVectorType(32); const uint64Type = new UintNumberType(8); diff --git a/packages/ssz/test/unit/byType/vectorBasic/tree.test.ts b/packages/ssz/test/unit/byType/vectorBasic/tree.test.ts index 4fad5a315..f9c6ce053 100644 --- a/packages/ssz/test/unit/byType/vectorBasic/tree.test.ts +++ b/packages/ssz/test/unit/byType/vectorBasic/tree.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {UintNumberType, VectorBasicType} from "../../../../src/index.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; +import {UintNumberType, VectorBasicType} from "../../../../src/index.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; const uint64NumInf = new UintNumberType(8, {clipInfinity: true}); const vectorType = new VectorBasicType(uint64NumInf, 8); diff --git a/packages/ssz/test/unit/byType/vectorComposite/tree.test.ts b/packages/ssz/test/unit/byType/vectorComposite/tree.test.ts index 04d39b147..e88ff0441 100644 --- a/packages/ssz/test/unit/byType/vectorComposite/tree.test.ts +++ b/packages/ssz/test/unit/byType/vectorComposite/tree.test.ts @@ -5,8 +5,8 @@ import { UintNumberType, ValueOf, VectorCompositeType, -} from "../../../../src/index.js"; -import {runViewTestMutation} from "../runViewTestMutation.js"; +} from "../../../../src/index.ts"; +import {runViewTestMutation} from "../runViewTestMutation.ts"; const uint64NumInfType = new UintNumberType(8, {clipInfinity: true}); const containerUintsType = new ContainerType( diff --git a/packages/ssz/test/unit/byValue/bitArray.test.ts b/packages/ssz/test/unit/byValue/bitArray.test.ts index 34894eb46..a1b6f7864 100644 --- a/packages/ssz/test/unit/byValue/bitArray.test.ts +++ b/packages/ssz/test/unit/byValue/bitArray.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {getUint8ByteToBitBooleanArray, BitArray} from "../../../src/value/bitArray.js"; -import {BitVectorType} from "../../../src/index.js"; -import {linspace} from "../../utils/misc.js"; +import {getUint8ByteToBitBooleanArray, BitArray} from "../../../src/value/bitArray.ts"; +import {BitVectorType} from "../../../src/index.ts"; +import {linspace} from "../../utils/misc.ts"; const BITS_PER_BYTE = 8; diff --git a/packages/ssz/test/unit/cachePermanentRootStruct.test.ts b/packages/ssz/test/unit/cachePermanentRootStruct.test.ts index ee7f9dfbc..aa2bd0518 100644 --- a/packages/ssz/test/unit/cachePermanentRootStruct.test.ts +++ b/packages/ssz/test/unit/cachePermanentRootStruct.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {ContainerType, UintNumberType} from "../../src/index.js"; +import {ContainerType, UintNumberType} from "../../src/index.ts"; describe("cachePermanentRootStruct", () => { it("should cache permanent root struct", () => { diff --git a/packages/ssz/test/unit/eth2/allForks.test.ts b/packages/ssz/test/unit/eth2/allForks.test.ts index 9fe0e749e..5fef4cd07 100644 --- a/packages/ssz/test/unit/eth2/allForks.test.ts +++ b/packages/ssz/test/unit/eth2/allForks.test.ts @@ -1,8 +1,8 @@ import {describe, it} from "vitest"; import {Node, Tree} from "@chainsafe/persistent-merkle-tree"; -import {CompositeView, CompositeViewDU, ContainerType, ValueOf} from "../../../src/index.js"; -import {allForks, altair, bellatrix, phase0, ssz} from "../../lodestarTypes/index.js"; -import {ForkName} from "../../utils/fork.js"; +import {CompositeView, CompositeViewDU, ContainerType, ValueOf} from "../../../src/index.ts"; +import {allForks, altair, bellatrix, phase0, ssz} from "../../lodestarTypes/index.ts"; +import {ForkName} from "../../utils/fork.ts"; /** False variable to not run code but still compile with Typescript */ const alwaysFalse = 0 < 1; diff --git a/packages/ssz/test/unit/eth2/beaconState.test.ts b/packages/ssz/test/unit/eth2/beaconState.test.ts index f5d71beff..d8cf6b698 100644 --- a/packages/ssz/test/unit/eth2/beaconState.test.ts +++ b/packages/ssz/test/unit/eth2/beaconState.test.ts @@ -1,8 +1,8 @@ import {describe, it, expect} from "vitest"; -import {BeaconState} from "../../lodestarTypes/deneb/sszTypes.js"; -import {ListUintNum64Type} from "../../../src/type/listUintNum64.js"; -import {altair, phase0, ssz} from "../../lodestarTypes/index.js"; -import {BitArray, fromHexString} from "../../../src/index.js"; +import {BeaconState} from "../../lodestarTypes/deneb/sszTypes.ts"; +import {ListUintNum64Type} from "../../../src/type/listUintNum64.ts"; +import {altair, phase0, ssz} from "../../lodestarTypes/index.ts"; +import {BitArray, fromHexString} from "../../../src/index.ts"; const VALIDATOR_REGISTRY_LIMIT = 1099511627776; export const Balances = new ListUintNum64Type(VALIDATOR_REGISTRY_LIMIT); diff --git a/packages/ssz/test/unit/eth2/caseEth2.test.ts b/packages/ssz/test/unit/eth2/caseEth2.test.ts index c6a652cc0..451d240fc 100644 --- a/packages/ssz/test/unit/eth2/caseEth2.test.ts +++ b/packages/ssz/test/unit/eth2/caseEth2.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {precomputeJsonKey} from "../../../src/type/container.js"; +import {precomputeJsonKey} from "../../../src/type/container.ts"; describe("JSON case eth2", () => { const fieldNameToJsonKeyCsv = getFieldNameToJsonKeyCsv(); diff --git a/packages/ssz/test/unit/eth2/minMaxSize.test.ts b/packages/ssz/test/unit/eth2/minMaxSize.test.ts index 336427a23..107ee16fd 100644 --- a/packages/ssz/test/unit/eth2/minMaxSize.test.ts +++ b/packages/ssz/test/unit/eth2/minMaxSize.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import {ssz} from "../../lodestarTypes/index.js"; -import {Type} from "../../../src/index.js"; +import {ssz} from "../../lodestarTypes/index.ts"; +import {Type} from "../../../src/index.ts"; enum ForkName { phase0 = "phase0", diff --git a/packages/ssz/test/unit/eth2/regressions.test.ts b/packages/ssz/test/unit/eth2/regressions.test.ts index 04bf464cb..ae0984739 100644 --- a/packages/ssz/test/unit/eth2/regressions.test.ts +++ b/packages/ssz/test/unit/eth2/regressions.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {ssz} from "../../lodestarTypes/index.js"; +import {ssz} from "../../lodestarTypes/index.ts"; describe("Various issues and regressions of Eth2 types", () => { it("Should push state.validators to ViewDU and update length", () => { diff --git a/packages/ssz/test/unit/eth2/validators.test.ts b/packages/ssz/test/unit/eth2/validators.test.ts index 0f7554934..10bbc75a6 100644 --- a/packages/ssz/test/unit/eth2/validators.test.ts +++ b/packages/ssz/test/unit/eth2/validators.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect, vi} from "vitest"; -import {toHexString, ListCompositeType, ValueOf, CompositeViewDU} from "../../../src/index.js"; -import {ValidatorContainer, ValidatorNodeStruct} from "../../lodestarTypes/phase0/sszTypes.js"; +import {toHexString, ListCompositeType, ValueOf, CompositeViewDU} from "../../../src/index.ts"; +import {ValidatorContainer, ValidatorNodeStruct} from "../../lodestarTypes/phase0/sszTypes.ts"; type Validator = ValueOf; const validator: Validator = { diff --git a/packages/ssz/test/unit/merkleize.test.ts b/packages/ssz/test/unit/merkleize.test.ts index ceee0d1ac..ea748bc30 100644 --- a/packages/ssz/test/unit/merkleize.test.ts +++ b/packages/ssz/test/unit/merkleize.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {bitLength, maxChunksToDepth, nextPowerOf2} from "../../src/util/merkleize.js"; +import {bitLength, maxChunksToDepth, nextPowerOf2} from "../../src/util/merkleize.ts"; describe("util / merkleize / bitLength", () => { const bitLengthByIndex = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4]; diff --git a/packages/ssz/test/unit/named.test.ts b/packages/ssz/test/unit/named.test.ts index 4ebfc71d6..81cc947bb 100644 --- a/packages/ssz/test/unit/named.test.ts +++ b/packages/ssz/test/unit/named.test.ts @@ -14,7 +14,7 @@ import { UnionType, VectorBasicType, VectorCompositeType, -} from "../../src/index.js"; +} from "../../src/index.ts"; describe("Customize object name for all types", () => { const typeName = "CustomType1234"; diff --git a/packages/ssz/test/unit/packing.test.ts b/packages/ssz/test/unit/packing.test.ts index 9aa16c43c..d5588ee8c 100644 --- a/packages/ssz/test/unit/packing.test.ts +++ b/packages/ssz/test/unit/packing.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {UintBigintType, toHexString, VectorBasicType} from "../../src/index.js"; +import {UintBigintType, toHexString, VectorBasicType} from "../../src/index.ts"; describe("uint packing", () => { const uint8 = new UintBigintType(1); diff --git a/packages/ssz/test/unit/regressions.test.ts b/packages/ssz/test/unit/regressions.test.ts index d35dc9769..fa46cd38d 100644 --- a/packages/ssz/test/unit/regressions.test.ts +++ b/packages/ssz/test/unit/regressions.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {uint32NumType, uint64NumType} from "../utils/primitiveTypes.js"; +import {uint32NumType, uint64NumType} from "../utils/primitiveTypes.ts"; import { VectorBasicType, ListBasicType, @@ -12,7 +12,7 @@ import { BooleanType, UintBigintType, ValueOf, -} from "../../src/index.js"; +} from "../../src/index.ts"; // Compilation of various issues from SSZ and Lodestar libs diff --git a/packages/ssz/test/unit/snapshot.test.ts b/packages/ssz/test/unit/snapshot.test.ts index 7b8a336ff..01543020d 100644 --- a/packages/ssz/test/unit/snapshot.test.ts +++ b/packages/ssz/test/unit/snapshot.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {ByteVectorType} from "../../src/type/byteVector.js"; -import {ListCompositeType} from "../../src/index.js"; -import {PartialListCompositeType} from "../../src/type/partialListComposite.js"; +import {ByteVectorType} from "../../src/type/byteVector.ts"; +import {ListCompositeType} from "../../src/index.ts"; +import {PartialListCompositeType} from "../../src/type/partialListComposite.ts"; import {Tree, toGindex} from "@chainsafe/persistent-merkle-tree"; describe("snapshot", () => { diff --git a/packages/ssz/test/unit/specTestYamlLoader.test.ts b/packages/ssz/test/unit/specTestYamlLoader.test.ts index 7bc3333f5..4a9191de3 100644 --- a/packages/ssz/test/unit/specTestYamlLoader.test.ts +++ b/packages/ssz/test/unit/specTestYamlLoader.test.ts @@ -1,8 +1,8 @@ import {describe, it, expect} from "vitest"; import jsyaml from "js-yaml"; -import {readYamlNumbersAsStrings} from "../spec/testRunner.js"; -import {BeaconBlockHeader} from "../lodestarTypes/phase0/sszTypes.js"; -import {toHexString} from "../../src/index.js"; +import {readYamlNumbersAsStrings} from "../spec/testRunner.ts"; +import {BeaconBlockHeader} from "../lodestarTypes/phase0/sszTypes.ts"; +import {toHexString} from "../../src/index.ts"; /* eslint-disable quotes */ diff --git a/packages/ssz/test/unit/strings.test.ts b/packages/ssz/test/unit/strings.test.ts index c69a34bca..e19025319 100644 --- a/packages/ssz/test/unit/strings.test.ts +++ b/packages/ssz/test/unit/strings.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {Case} from "../../src/util/strings.js"; -import {KeyCase} from "../../src/type/container.js"; +import {Case} from "../../src/util/strings.ts"; +import {KeyCase} from "../../src/type/container.ts"; const testCases = ["fooBar", "foo1Bar", "fooBarBaz", "foo1Bar2Baz", "fooBar1"]; const expectedResults: {[key in KeyCase]: string[]} = { snake: ["foo_bar", "foo1_bar", "foo_bar_baz", "foo1_bar2_baz", "foo_bar1"], diff --git a/packages/ssz/test/unit/unchangedViewDUs.test.ts b/packages/ssz/test/unit/unchangedViewDUs.test.ts index c580db9f0..1b1be4f49 100644 --- a/packages/ssz/test/unit/unchangedViewDUs.test.ts +++ b/packages/ssz/test/unit/unchangedViewDUs.test.ts @@ -1,6 +1,6 @@ import {describe, it, expect} from "vitest"; -import * as sszAltair from "../lodestarTypes/altair/sszTypes.js"; -import {getRandomState} from "../utils/generateEth2Objs.js"; +import * as sszAltair from "../lodestarTypes/altair/sszTypes.ts"; +import {getRandomState} from "../utils/generateEth2Objs.ts"; describe("Unchanged ViewDUs", () => { const state = sszAltair.BeaconState.toViewDU(getRandomState(100)); diff --git a/packages/ssz/test/unit/util/errorPath.test.ts b/packages/ssz/test/unit/util/errorPath.test.ts index 262daf592..799ba9978 100644 --- a/packages/ssz/test/unit/util/errorPath.test.ts +++ b/packages/ssz/test/unit/util/errorPath.test.ts @@ -1,7 +1,7 @@ import {describe, it, expect} from "vitest"; -import {ContainerType, ListBasicType, ListCompositeType, Type} from "../../../src/index.js"; -import {byteType} from "../../utils/primitiveTypes.js"; +import {ContainerType, ListBasicType, ListCompositeType, Type} from "../../../src/index.ts"; +import {byteType} from "../../utils/primitiveTypes.ts"; const SimpleObject = new ContainerType({ b: byteType, diff --git a/packages/ssz/test/unit/util/hexString.test.ts b/packages/ssz/test/unit/util/hexString.test.ts index c4def9cfe..5a729129b 100644 --- a/packages/ssz/test/unit/util/hexString.test.ts +++ b/packages/ssz/test/unit/util/hexString.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {fromHexString, toHexString} from "../../../src/index.js"; +import {fromHexString, toHexString} from "../../../src/index.ts"; describe("util / byteArray / toHexString + fromHexString", () => { const testCases: string[] = [ diff --git a/packages/ssz/test/unit/util/proof.test.ts b/packages/ssz/test/unit/util/proof.test.ts index 3a6a11050..efe7cbe35 100644 --- a/packages/ssz/test/unit/util/proof.test.ts +++ b/packages/ssz/test/unit/util/proof.test.ts @@ -1,9 +1,9 @@ import {Tree} from "@chainsafe/persistent-merkle-tree"; import {describe, it, expect} from "vitest"; -import {ContainerNodeStructType, ContainerType, ListCompositeType} from "../../../src/index.js"; -import {bytes32Type, uint16NumType} from "../../utils/primitiveTypes.js"; -import {treePartialToJsonPaths, TreeDataTypeCode} from "../../../src/util/proof/treePartialToJsonPaths.js"; -import {treePostProcessFromProofNode} from "../../../src/util/proof/treePostProcessFromProofNode.js"; +import {ContainerNodeStructType, ContainerType, ListCompositeType} from "../../../src/index.ts"; +import {bytes32Type, uint16NumType} from "../../utils/primitiveTypes.ts"; +import {treePartialToJsonPaths, TreeDataTypeCode} from "../../../src/util/proof/treePartialToJsonPaths.ts"; +import {treePostProcessFromProofNode} from "../../../src/util/proof/treePostProcessFromProofNode.ts"; describe("Create proof of Array of Objects", () => { const SimpleObject = new ContainerType({a: uint16NumType, b: uint16NumType}, {typeName: "SimpleObject"}); diff --git a/packages/ssz/test/unit/util/proofs.test.ts b/packages/ssz/test/unit/util/proofs.test.ts index b9d767ad8..35c265166 100644 --- a/packages/ssz/test/unit/util/proofs.test.ts +++ b/packages/ssz/test/unit/util/proofs.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest"; -import {BitVectorType, BitListType, ContainerType} from "../../../src/index.js"; +import {BitVectorType, BitListType, ContainerType} from "../../../src/index.ts"; /** Pick bitLen to fill 2 nodes */ const bitLen2Nodes = 8 * 32 * 2; diff --git a/packages/ssz/test/utils/generateEth2Objs.ts b/packages/ssz/test/utils/generateEth2Objs.ts index c1ab58fd1..049f94ca0 100644 --- a/packages/ssz/test/utils/generateEth2Objs.ts +++ b/packages/ssz/test/utils/generateEth2Objs.ts @@ -1,7 +1,7 @@ -import * as sszAltair from "../lodestarTypes/altair/sszTypes.js"; -import {Attestation, SignedAggregateAndProof, SignedBeaconBlock, Validator} from "../lodestarTypes/phase0/types.js"; -import {SignedContributionAndProof, BeaconState, SyncCommitteeMessage} from "../lodestarTypes/altair/types.js"; -import {BitArray} from "../../src/index.js"; +import * as sszAltair from "../lodestarTypes/altair/sszTypes.ts"; +import {Attestation, SignedAggregateAndProof, SignedBeaconBlock, Validator} from "../lodestarTypes/phase0/types.ts"; +import {SignedContributionAndProof, BeaconState, SyncCommitteeMessage} from "../lodestarTypes/altair/types.ts"; +import {BitArray} from "../../src/index.ts"; // Typical mainnet numbers const BITS_PER_ATTESTATION = 90; diff --git a/packages/ssz/test/utils/primitiveTypes.ts b/packages/ssz/test/utils/primitiveTypes.ts index 2bf85e3bf..a65084590 100644 --- a/packages/ssz/test/utils/primitiveTypes.ts +++ b/packages/ssz/test/utils/primitiveTypes.ts @@ -1,5 +1,5 @@ // Adapted from https://github.com/prysmaticlabs/prysm/blob/master/shared/ssz/encode_test.go#L296 -import {UintBigintType, ByteVectorType, UintNumberType} from "../../src/index.js"; +import {UintBigintType, ByteVectorType, UintNumberType} from "../../src/index.ts"; export const byteType = new UintNumberType(1); export const bytes2Type = new ByteVectorType(2); diff --git a/packages/ssz/tsconfig.build.json b/packages/ssz/tsconfig.build.json deleted file mode 100644 index 5f4950d18..000000000 --- a/packages/ssz/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../tsconfig.build.json", - "include": [ - "src" - ], - "compilerOptions": { - "outDir": "lib", - "typeRoots": [ - "../../node_modules/@types", - "./node_modules/@types", - "./types" - ], - } -} \ No newline at end of file diff --git a/scripts/buildJsr.ts b/scripts/buildJsr.ts new file mode 100644 index 000000000..5786d28f2 --- /dev/null +++ b/scripts/buildJsr.ts @@ -0,0 +1,8 @@ +import { getPackageJson, npmExportsToDenoExports } from "./utils.ts"; + +const { name, version, exports } = await getPackageJson(); + +await Deno.writeTextFile( + `${Deno.cwd()}/deno.json`, + JSON.stringify({ name, version, exports: npmExportsToDenoExports(exports) }) +); diff --git a/scripts/buildNpm.ts b/scripts/buildNpm.ts new file mode 100644 index 000000000..b76d8b68a --- /dev/null +++ b/scripts/buildNpm.ts @@ -0,0 +1,56 @@ +import {build, emptyDir} from "@deno/dnt"; +import { getPackageJson, npmExportsToDntEntrypoints } from "./utils.ts"; + +const packageJSON = await getPackageJson(); +const currentDir = Deno.cwd(); + +const { + name, + version, + description, + author, + license, + bugs, + homepage, + repository, + dependencies, + exports, +} = packageJSON; + +await emptyDir(`${currentDir}/npm`); + +await build({ + outDir: `${currentDir}/npm`, + shims: { + // see JS docs for overview and more options + deno: false, + }, + test: false, + skipSourceOutput: true, + esModule: true, + scriptModule: false, + typeCheck: "both", + package: { + name, + version, + description, + author, + license, + bugs, + homepage, + repository, + dependencies, + }, + entryPoints: npmExportsToDntEntrypoints(exports), + filterDiagnostic(diagnostic) { + if (diagnostic.messageText?.endsWith("Cannot find name 'WebAssembly'.")) { + return false; + } + return true; + }, + postBuild() { + // steps to run after building and before running the tests + Deno.copyFileSync("LICENSE", "npm/LICENSE"); + Deno.copyFileSync("README.md", "npm/README.md"); + }, +}); diff --git a/scripts/utils.ts b/scripts/utils.ts new file mode 100644 index 000000000..471e11ad2 --- /dev/null +++ b/scripts/utils.ts @@ -0,0 +1,77 @@ +import { exists } from "jsr:@std/fs/exists"; + +interface PackageJSON { + name: string; + version: string; + description: string; + author: string; + license: string; + homepage: string; + repository: { + type: string; + url: string; + }; + bugs: string; + dependencies: Record; + exports: Record>; +} + +export async function getPackageJson(dir?: string): Promise { + const pkgFilePath = dir + ? `${dir}/package.json` + : `${Deno.cwd()}/package.json`; + + await exists(pkgFilePath); + + return JSON.parse(await Deno.readTextFile(pkgFilePath)) as PackageJSON; +} + +export function npmExportsToDenoExports( + exportNames: PackageJSON["exports"] +): Record { + const updatedExports: Record = {}; + for (const name of Object.keys(exportNames)) { + let path = ""; + + if (typeof exportNames[name] === "string") { + path = exportNames[name]; + } else if (exportNames[name]["import"]) { + path = exportNames[name]["import"] as string; + } else if (exportNames[name]["default"]) { + path = exportNames[name]["default"] as string; + } else { + throw new Error(`No export found as import or default for key ${name}`); + } + + updatedExports[name] = path; + } + + return updatedExports; +} + +export function npmExportsToDntEntrypoints( + exportNames: PackageJSON["exports"] +): { name: string; path: string }[] { + const entryPoints: { name: string; path: string }[] = []; + + for (const name of Object.keys(exportNames)) { + let path = ""; + + if (typeof exportNames[name] === "string") { + path = exportNames[name]; + } else if (exportNames[name]["import"]) { + path = exportNames[name]["import"] as string; + } else if (exportNames[name]["default"]) { + path = exportNames[name]["default"] as string; + } else { + throw new Error(`No export found as import or default for key ${name}`); + } + + entryPoints.push({ + name, + path, + }); + } + + return entryPoints; +} diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 51d177785..000000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "esModuleInterop": true, - "module": "NodeNext", - "noEmit": false, - "declaration": true, - "sourceMap": true, - "declarationMap": false, - } -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 0a9c85b2d..54cc44abe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,8 @@ "es2020.string", "es2020.symbol.wellknown" ], + "resolveJsonModule": true, + "allowImportingTsExtensions": true, "typeRoots": ["../../node_modules/@types", "./node_modules/@types", "./types"] } } \ No newline at end of file