Skip to content

Commit

Permalink
feat!: remove support for CJS (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain authored and wemeetagain committed Jan 23, 2025
1 parent eaa5422 commit 57d14f1
Show file tree
Hide file tree
Showing 20 changed files with 18 additions and 155 deletions.
9 changes: 3 additions & 6 deletions packages/as-sha256/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"url": "git+https://github.com/chainsafe/ssz.git"
},
"type": "module",
"main": "./lib/cjs/index.js",
"module": "./lib/index.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib",
Expand All @@ -31,11 +30,9 @@
"asbuild:simd:untouched": "asc assembly/index.simd.ts -o build/untouched.simd.wasm -t build/untouched.simd.wat --runtime minimal --target debug --enable simd",
"asbuild:simd:optimized": "asc assembly/index.simd.ts -o build/optimized.simd.wasm -t build/optimized.simd.wat --runtime minimal --target release -O3z --noAssert --enable simd",
"asbuild:simd": "yarn asbuild:simd:untouched && yarn asbuild:simd:optimized",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json",
"build:types": "tsc -p tsconfig.build.types.json",
"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:cjs && yarn build:esm && yarn build:types",
"build": "yarn asbuild && yarn asbuild:simd && yarn generate && yarn build:lib",
"test": "yarn run test:unit",
"test:unit": "vitest run --dir test/unit/",
"test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox",
Expand Down
8 changes: 0 additions & 8 deletions packages/as-sha256/tsconfig.build.cjs.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.esm.json",
"extends": "../../tsconfig.build.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib",
Expand Down
8 changes: 0 additions & 8 deletions packages/as-sha256/tsconfig.build.types.json

This file was deleted.

8 changes: 2 additions & 6 deletions packages/persistent-merkle-tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
"version": "0.9.1",
"description": "Merkle tree implemented as a persistent datastructure",
"type": "module",
"module": "./lib/index.js",
"main": "./lib/cjs/index.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib"
],
"scripts": {
"check-types": "tsc --noEmit",
"clean": "rm -rf lib",
"build": "yarn build:cjs && yarn build:esm && yarn build:types",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json",
"build:types": "tsc -p tsconfig.build.types.json",
"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",
Expand Down
14 changes: 0 additions & 14 deletions packages/persistent-merkle-tree/tsconfig.build.cjs.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.esm.json",
"extends": "../../tsconfig.build.json",
"include": [
"src"
],
Expand Down
14 changes: 0 additions & 14 deletions packages/persistent-merkle-tree/tsconfig.build.types.json

This file was deleted.

11 changes: 3 additions & 8 deletions packages/persistent-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
"version": "0.19.2",
"description": "Persistent data structures for TypeScript.",
"type": "module",
"main": "./lib/cjs/index.js",
"module": "./lib/index.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib/**/*.d.ts",
"lib/**/*.js",
"lib/**/*.js.map",
"lib/**/package.json"
"lib/**/*.js.map"
],
"scripts": {
"clean": "rm -rf lib",
"build": "yarn build:cjs && yarn build:esm && yarn build:types",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json",
"build:types": "tsc -p tsconfig.build.types.json",
"build": "tsc -p tsconfig.build.json",
"lint": "eslint --color --ext .ts src/",
"check-types": "tsc --noEmit",
"test:unit": "vitest run --dir test/unit",
Expand Down
14 changes: 0 additions & 14 deletions packages/persistent-ts/tsconfig.build.cjs.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.esm.json",
"extends": "../../tsconfig.build.json",
"include": [
"src"
],
Expand Down
14 changes: 0 additions & 14 deletions packages/persistent-ts/tsconfig.build.types.json

This file was deleted.

11 changes: 3 additions & 8 deletions packages/ssz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@
"homepage": "https://github.com/chainsafe/ssz",
"version": "0.19.1",
"type": "module",
"main": "./lib/cjs/index.js",
"module": "./lib/index.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib/**/*.d.ts",
"lib/**/*.js",
"lib/**/*.js.map",
"lib/**/package.json"
"lib/**/*.js.map"
],
"scripts": {
"build": "yarn run build:cjs && yarn build:esm && yarn build:types",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json",
"build:types": "tsc -p tsconfig.build.types.json",
"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",
Expand Down
14 changes: 0 additions & 14 deletions packages/ssz/tsconfig.build.cjs.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.build.esm.json",
"extends": "../../tsconfig.build.json",
"include": [
"src"
],
Expand Down
14 changes: 0 additions & 14 deletions packages/ssz/tsconfig.build.types.json

This file was deleted.

4 changes: 2 additions & 2 deletions setHasher.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Set the hasher to hashtree
// Used to run benchmarks with with visibility into hashtree performance, useful for Lodestar
import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/cjs/hasher/index.js";
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/cjs/hasher/hashtree.js";
import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js";
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/hashtree.js";
setHasher(hasher);

export {};
10 changes: 0 additions & 10 deletions tsconfig.build.cjs.json

This file was deleted.

10 changes: 0 additions & 10 deletions tsconfig.build.esm.json

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.build.types.json → tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "NodeNext",
"noEmit": false,
"declaration": true,
"sourceMap": true,
"declarationMap": false,
"emitDeclarationOnly": true,
}
}

0 comments on commit 57d14f1

Please sign in to comment.