Skip to content

Commit 4794930

Browse files
committed
chore(sdk/js)!: make solana/viem/curves peers truly opt-in
move @solana/web3.js, viem, and @noble/curves out of optionalDependencies into peerDependencies (with optional meta). they were auto-installed by npm despite the "optional" label, dragging ~70 transitive packages into every downstream install. now a bare `npm install @phala/dstack-sdk` pulls only @noble/hashes. consumers that import /solana, /viem, /encrypt-env-vars, or /verify-env-encrypt-public-key submodules must now install the matching peer explicitly. documented in README and CHANGELOG.
1 parent 2ed5015 commit 4794930

4 files changed

Lines changed: 40 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Changed (JS SDK)
11+
- **Breaking:** `@solana/web3.js`, `viem`, and `@noble/curves` moved from `optionalDependencies` to `peerDependencies` (with `peerDependenciesMeta.optional = true`). They are no longer auto-installed; consumers that import the matching submodule (`/solana`, `/viem`, `/encrypt-env-vars`, `/verify-env-encrypt-public-key`) must install them explicitly. A bare `import { DstackClient } from '@phala/dstack-sdk'` install now pulls only `@noble/hashes` as a transitive requirement.
12+
813
## [0.5.5] - 2025-10-20
914

1015
### Added

sdk/js/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,26 @@ Access TEE features from your JavaScript/TypeScript application running inside d
55
## Installation
66

77
```bash
8-
npm install @phala/dstack-sdk
8+
npm install @phala/dstack-sdk @noble/hashes
99
```
1010

11+
`@noble/hashes` is a required peer dependency used by the core client (sha256/sha384). The following peer dependencies are optional and only needed when you import the matching submodule:
12+
13+
| Submodule | Optional peer dependency |
14+
| --- | --- |
15+
| `@phala/dstack-sdk/viem` | `viem` |
16+
| `@phala/dstack-sdk/solana` | `@solana/web3.js` |
17+
| `@phala/dstack-sdk/encrypt-env-vars` | `@noble/curves` |
18+
| `@phala/dstack-sdk/verify-env-encrypt-public-key` | `@noble/curves` |
19+
20+
Install only what you import. For example, to use the Ethereum helpers:
21+
22+
```bash
23+
npm install @phala/dstack-sdk @noble/hashes viem
24+
```
25+
26+
> **Breaking change in 0.5.8:** prior versions auto-installed `@solana/web3.js`, `viem`, and `@noble/curves` through `optionalDependencies`. They are now opt-in peer dependencies—install them explicitly when you import the corresponding submodule.
27+
1128
## Quick Start
1229

1330
```typescript

sdk/js/bun.lock

Lines changed: 8 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/js/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,29 @@
9797
"author": "Leechael Yim",
9898
"license": "Apache-2.0",
9999
"devDependencies": {
100+
"@noble/curves": "^1.8.1",
101+
"@noble/hashes": "^1.6.1",
102+
"@solana/web3.js": "^1.98.4",
100103
"@types/node": "latest",
101104
"typescript": "^5.7.0",
105+
"viem": "^2.43.3",
102106
"vitest": "^3.2.4"
103107
},
104-
"optionalDependencies": {
108+
"peerDependencies": {
105109
"@noble/curves": "^1.8.1",
110+
"@noble/hashes": "^1.6.1",
106111
"@solana/web3.js": "^1.98.4",
107112
"viem": "^2.43.3"
108113
},
109-
"peerDependencies": {
110-
"@noble/curves": "^1.8.1",
111-
"@noble/hashes": "^1.6.1"
112-
},
113114
"peerDependenciesMeta": {
114-
"viem": {
115-
"optional": true
116-
},
117115
"@noble/curves": {
118116
"optional": true
119117
},
120118
"@solana/web3.js": {
121119
"optional": true
120+
},
121+
"viem": {
122+
"optional": true
122123
}
123124
}
124125
}

0 commit comments

Comments
 (0)