Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove support for CJS #440

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0",
"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.1",
"description": "Persistent data structures for TypeScript.",
"type": "module",
"main": "./lib/cjs/index.js",
"module": "./lib/index.js",
"main": "./lib/index.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package needs subpath exports for the as-sha256 hasher and the setHasher function, see https://github.com/ChainSafe/lodestar/pull/7387/files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to add extra named exports in a separate PR to have clarity in the change logs. What do you think?

"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.0",
"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,
}
}
Loading