Skip to content

Commit

Permalink
Add list of engines supported
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Mar 3, 2025
1 parent 6a4f500 commit 4e995f2
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 14 deletions.
8 changes: 5 additions & 3 deletions packages/as-sha256/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
},
"type": "module",
"main": "src/index.ts",
"files": [
"build"
],
"engines": {
"node": ">= 18",
"deno": ">= 2.2",
"bun": ">= 1.1"
},
"scripts": {
"clean": "rm -rf ./dist",
"lint": "echo 'no linting for this package'",
Expand Down
3 changes: 3 additions & 0 deletions packages/as-sha256/src/alloc.ts
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down
8 changes: 5 additions & 3 deletions packages/persistent-merkle-tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
"./hasher/noble": "./src/hasher/noble.ts",
"./hasher/as-sha256": "./src/hasher/as-sha256.ts"
},
"files": [
"lib"
],
"engines": {
"node": ">= 18",
"deno": ">= 2.2",
"bun": ">= 1.1"
},
"scripts": {
"check-types": "tsc --noEmit",
"clean": "rm -rf lib",
Expand Down
4 changes: 4 additions & 0 deletions packages/persistent-merkle-tree/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ export class LeafNode extends Node {
let h = getNodeH(this, hIndex);
if (uintBytes === 1) {
h &= ~(0xff << bitIndex);
// @ts-expect-error - We need to mask `value`
h |= (0xff && value) << bitIndex;
} else {
h &= ~(0xffff << bitIndex);
// @ts-expect-error - We need to mask `value`
h |= (0xffff && value) << bitIndex;
}
setNodeH(this, hIndex, h);
Expand Down Expand Up @@ -273,9 +275,11 @@ export class LeafNode extends Node {
let h = getNodeH(this, hIndex);
if (uintBytes === 1) {
h &= ~(0xff << bitIndex);
// @ts-expect-error - We need to mask `value`
h |= (0xff && value) << bitIndex;
} else {
h &= ~(0xffff << bitIndex);
// @ts-expect-error - We need to mask `value`
h |= (0xffff && value) << bitIndex;
}
setNodeH(this, hIndex, h);
Expand Down
10 changes: 5 additions & 5 deletions packages/persistent-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "Persistent data structures for TypeScript.",
"type": "module",
"main": "./src/index.ts",
"files": [
"lib/**/*.d.ts",
"lib/**/*.js",
"lib/**/*.js.map"
],
"engines": {
"node": ">= 18",
"deno": ">= 2.2",
"bun": ">= 1.1"
},
"scripts": {
"clean": "rm -rf lib",
"lint": "eslint --color --ext .ts src/",
Expand Down
11 changes: 10 additions & 1 deletion packages/ssz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
"homepage": "https://github.com/chainsafe/ssz",
"version": "1.0.2",
"type": "module",
"main": "./src/index.ts",
"engines": {
"node": ">= 18",
"deno": ">= 2.2",
"bun": ">= 1.1"
},
"exports": {
".": {
"import": "./sc/index.ts"
}
},
"files": [
"lib/**/*.d.ts",
"lib/**/*.js",
Expand Down
1 change: 1 addition & 0 deletions packages/ssz/src/util/merkleize.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion packages/ssz/src/viewDU/arrayBasic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ArrayBasicTreeViewDU<ElementType extends BasicType<unknown>> extend
ArrayBasicType<ElementType>
> {
protected nodes: LeafNode[];
protected readonly nodesChanged = new Set<number>();
protected readonly nodesChanged: Set<number> = new Set<number>();
protected _length: number;
protected dirtyLength = false;
private nodesPopulated: boolean;
Expand Down
5 changes: 4 additions & 1 deletion packages/ssz/src/viewDU/arrayComposite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export class ArrayCompositeTreeViewDU<
> extends TreeViewDU<ArrayCompositeType<ElementType>> {
protected nodes: Node[];
protected caches: unknown[];
protected readonly viewsChanged = new Map<number, CompositeViewDU<ElementType>>();
protected readonly viewsChanged: Map<number, CompositeViewDU<ElementType>> = new Map<
number,
CompositeViewDU<ElementType>
>();
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
Expand Down

0 comments on commit 4e995f2

Please sign in to comment.