chore: cleanup types exports for all packages (#8434)

**Motivation**

Make the types exports consistent for all packages. 

All modern runtimes support [conditional
exports](https://nodejs.org/api/packages.html#conditional-exports) and
there are caveats when we have both conditional exports and normal
exports present in a package.json. This PR tend to make all exports
follow same consistent and modern pattern.

**Description**

- We were using subpath exports for some packages and module exports for
other
- Keep all the types export consistent as subpath exports.
- Remove "types" and "exports` directive from package.json 
- Remove `typesVersions`, this is useful only if we have different
version of types for different versions of Typescript. Or having
different types files for different file paths.


**Steps to test or reproduce**

- Run all CI
This commit is contained in:
Nazar Hussain
2025-10-20 15:03:08 +02:00
committed by GitHub
parent f259361847
commit a0d00ac6dc
18 changed files with 65 additions and 130 deletions

View File

@@ -16,47 +16,45 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./server": {
"bun": "./src/server/index.ts",
"types": "./lib/server/index.d.ts",
"import": "./lib/server/index.js"
},
"./beacon": {
"bun": "./src/beacon/index.ts",
"types": "./lib/beacon/index.d.ts",
"import": "./lib/beacon/index.js"
},
"./beacon/server": {
"bun": "./src/beacon/server/index.ts",
"types": "./lib/beacon/server/index.d.ts",
"import": "./lib/beacon/server/index.js"
},
"./builder": {
"bun": "./src/builder/index.ts",
"types": "./lib/builder/index.d.ts",
"import": "./lib/builder/index.js"
},
"./builder/server": {
"bun": "./src/builder/server/index.ts",
"types": "./lib/builder/server/index.d.ts",
"import": "./lib/builder/server/index.js"
},
"./keymanager": {
"bun": "./src/keymanager/index.ts",
"types": "./lib/keymanager/index.d.ts",
"import": "./lib/keymanager/index.js"
},
"./keymanager/server": {
"bun": "./src/keymanager/server/index.ts",
"types": "./lib/keymanager/server/index.d.ts",
"import": "./lib/keymanager/server/index.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "./lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -16,50 +16,62 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./api": {
"bun": "./src/api/index.ts",
"types": "./lib/api/index.d.ts",
"import": "./lib/api/index.js"
},
"./chain": {
"bun": "./src/chain/index.ts",
"types": "./lib/chain/index.d.ts",
"import": "./lib/chain/index.js"
},
"./constants": {
"bun": "./src/constants/index.ts",
"types": "./lib/constants/index.d.ts",
"import": "./lib/constants/index.js"
},
"./db": {
"bun": "./src/db/index.ts",
"types": "./lib/db/index.d.ts",
"import": "./lib/db/index.js"
},
"./eth1": {
"bun": "./src/eth1/index.ts",
"types": "./lib/eth1/index.d.ts",
"import": "./lib/eth1/index.js"
},
"./metrics": {
"bun": "./src/metrics/index.ts",
"types": "./lib/metrics/index.d.ts",
"import": "./lib/metrics/index.js"
},
"./monitoring": {
"bun": "./src/monitoring/index.ts",
"types": "./lib/monitoring/index.d.ts",
"import": "./lib/monitoring/index.js"
},
"./network": {
"bun": "./src/network/index.ts",
"types": "./lib/network/index.d.ts",
"import": "./lib/network/index.js"
},
"./node": {
"bun": "./src/node/index.ts",
"types": "./lib/node/index.d.ts",
"import": "./lib/node/index.js"
},
"./sync": {
"bun": "./src/sync/index.ts",
"types": "./lib/sync/index.d.ts",
"import": "./lib/sync/index.js"
},
"./util": {
"bun": "./src/util/index.ts",
"types": "./lib/util/index.d.ts",
"import": "./lib/util/index.js"
}
},
@@ -73,16 +85,6 @@
"default": "datastore-level"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "./lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -12,6 +12,7 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
}
},

View File

@@ -12,31 +12,25 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./default": {
"bun": "./src/default.ts",
"types": "./lib/default.d.ts",
"import": "./lib/default.js"
},
"./networks": {
"bun": "./src/networks.ts",
"types": "./lib/networks.d.ts",
"import": "./lib/networks.js"
},
"./configs": {
"bun": "./src/configs.ts",
"types": "./lib/configs.d.ts",
"import": "./lib/configs.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -15,6 +15,7 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./controller/level": {
@@ -28,7 +29,6 @@
"import": "./src/controller/level.js"
}
},
"types": "./lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -12,19 +12,10 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -16,10 +16,10 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
}
},
"types": "./lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -16,35 +16,30 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./utils": {
"bun": "./src/utils/index.ts",
"types": "./lib/utils/index.d.ts",
"import": "./lib/utils/index.js"
},
"./validation": {
"bun": "./src/validation.ts",
"types": "./lib/validation.d.ts",
"import": "./lib/validation.js"
},
"./spec": {
"bun": "./src/spec/index.ts",
"types": "./lib/spec/index.d.ts",
"import": "./lib/spec/index.js"
},
"./transport": {
"bun": "./src/transport/index.ts",
"types": "./lib/transport/index.d.ts",
"import": "./lib/transport/index.js"
}
},
"types": "./lib/index.d.ts",
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"files": [
"src",
"lib",

View File

@@ -16,34 +16,30 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./browser": {
"bun": "./src/browser.ts",
"types": "./lib/browser.d.ts",
"import": "./lib/browser.js"
},
"./env": {
"bun": "./src/env.ts",
"types": "./lib/env.d.ts",
"import": "./lib/env.js"
},
"./node": {
"bun": "./src/node.ts",
"types": "./lib/node.d.ts",
"import": "./lib/node.js"
},
"./empty": {
"bun": "./src/empty.ts",
"types": "./lib/empty.d.ts",
"import": "./lib/empty.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"files": [
"src",
"lib",

View File

@@ -12,40 +12,35 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./presets/mainnet": {
"bun": "./src/presets/mainnet.ts",
"types": "./lib/presets/mainnet.d.ts",
"import": "./lib/presets/mainnet.js"
},
"./presets/minimal": {
"bun": "./src/presets/minimal.ts",
"types": "./lib/presets/minimal.d.ts",
"import": "./lib/presets/minimal.js"
},
"./presets/gnosis": {
"bun": "./src/presets/gnosis.ts",
"types": "./lib/presets/gnosis.d.ts",
"import": "./lib/presets/gnosis.js"
},
"./setPreset": {
"bun": "./src/setPreset.ts",
"types": "./lib/setPreset.d.ts",
"import": "./lib/setPreset.js"
}
},
"types": "lib/index.d.ts",
"files": [
"src",
"lib",
"!**/*.tsbuildinfo"
],
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"scripts": {
"clean": "rm -rf lib && rm -f *.tsbuildinfo",
"build": "tsc -p tsconfig.build.json",

View File

@@ -16,26 +16,18 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./browser": {
"bun": "./src/browser/index.ts",
"types": "./lib/browser/index.d.ts",
"import": "./lib/browser/index.js"
}
},
"bin": {
"lodestar-prover": "lib/cli/index.js"
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "./lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -16,23 +16,15 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./utils": {
"bun": "./src/utils/index.ts",
"types": "./lib/utils/index.d.ts",
"import": "./lib/utils/index.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "./lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -12,23 +12,15 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./downloadTests": {
"bun": "./src/downloadTests.ts",
"types": "./lib/downloadTests.d.ts",
"import": "./lib/downloadTests.js"
}
},
"types": "lib/index.d.ts",
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"files": [
"src",
"lib",

View File

@@ -16,30 +16,25 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./block": {
"bun": "./src/block/index.ts",
"types": "./lib/block/index.d.ts",
"import": "./lib/block/index.js"
},
"./epoch": {
"bun": "./src/epoch/index.ts",
"types": "./lib/epoch/index.d.ts",
"import": "./lib/epoch/index.js"
},
"./slot": {
"bun": "./src/slot/index.ts",
"types": "./lib/slot/index.d.ts",
"import": "./lib/slot/index.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"files": [
"src",
"lib",

View File

@@ -13,23 +13,15 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./doubles": {
"bun": "./src/doubles.ts",
"types": "./lib/doubles.d.ts",
"import": "./lib/doubles.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "lib/index.d.ts",
"files": [
"src",
"lib",

View File

@@ -16,46 +16,45 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./altair": {
"bun": "./src/altair/index.ts",
"types": "./lib/altair/index.d.ts",
"import": "./lib/altair/index.js"
},
"./capella": {
"bun": "./src/capella/index.ts",
"types": "./lib/capella/index.d.ts",
"import": "./lib/capella/index.js"
},
"./bellatrix": {
"bun": "./src/bellatrix/index.ts",
"types": "./lib/bellatrix/index.d.ts",
"import": "./lib/bellatrix/index.js"
},
"./deneb": {
"bun": "./src/deneb/index.ts",
"types": "./lib/deneb/index.d.ts",
"import": "./lib/deneb/index.js"
},
"./electra": {
"bun": "./src/electra/index.ts",
"types": "./lib/electra/index.d.ts",
"import": "./lib/electra/index.js"
},
"./fulu": {
"bun": "./src/fulu/index.ts",
"types": "./lib/fulu/index.d.ts",
"import": "./lib/fulu/index.js"
},
"./phase0": {
"bun": "./src/phase0/index.ts",
"types": "./lib/phase0/index.d.ts",
"import": "./lib/phase0/index.js"
}
},
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"files": [
"src",
"lib",

View File

@@ -16,6 +16,7 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
}
},

View File

@@ -12,10 +12,10 @@
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
}
},
"types": "./lib/index.d.ts",
"files": [
"src",
"lib",