@ledgerhq/errors 7.0.0-nightly.20260801030117 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,19 @@
1
1
  # @ledgerhq/errors
2
2
 
3
- ## 7.0.0-nightly.20260801030117
3
+ ## 7.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#19974](https://github.com/LedgerHQ/ledger-live/pull/19974) [`1070564`](https://github.com/LedgerHQ/ledger-live/commit/107056410174d3da2d45c468232a8d742aea021f) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Remove `CustomErrorClassType` and `TransportStatusErrorClassType` from the public exports of `@ledgerhq/errors`.
8
+
9
+ These type aliases are part of the deprecated serialize/deserialize stack being sunset as part of LIVE-32915. Internal callers have been migrated:
10
+
11
+ - `libs/ledger-live-common/deviceSDK/tasks/core`: replaced `CustomErrorClassType`/`TransportStatusErrorClassType` with `new (...args: any[]) => Error`
12
+ - `libs/ledger-live-common/__tests__/errors.ts`: deleted (was testing lib internals)
13
+
14
+ Note: `serializeError` and `deserializeError` remain exported for now due to an external dependency (`wallet-api-core@1.35.0`) that imports them. They will be dropped in a follow-up once that package is updated.
15
+
16
+ ## 7.0.0-next.0
4
17
 
5
18
  ### Major Changes
6
19
 
package/DEPRECATED.md CHANGED
@@ -1,15 +1,11 @@
1
1
  # @ledgerhq/errors is deprecated
2
2
 
3
- This package is **frozen**. Nothing in this monorepo depends on it anymore, and nothing
4
- may start to: the `enforce-boundaries` CI check fails on any workspace manifest that
5
- declares `@ledgerhq/errors` in any dependency field (see
6
- `tools/nx-plugins/enforce-boundaries/constraints.js`).
7
-
8
- It only still lives here so it keeps being published for external consumers.
3
+ This package is **frozen** and being sunset. It stays published for backward
4
+ compatibility (it is consumed externally, including by `@ledgerhq/coin-module-framework`),
5
+ but it must not grow.
9
6
 
10
7
  ## Do not
11
8
 
12
- - ❌ Add it back as a dependency of any workspace package.
13
9
  - ❌ Add new error classes here (whether via `createCustomErrorClass` or hand-written).
14
10
  - ❌ Use `createCustomErrorClass` in any package.
15
11
  - ❌ Use the serialization stack — `serializeError`, `deserializeError`,
@@ -22,74 +18,12 @@ Define errors as plain native classes in your own package's `src/errors.ts`, and
22
18
  check their type with `error.name === "X"` rather than `instanceof` (the name
23
19
  survives serialization across IPC / workers / external frameworks).
24
20
 
25
- In the ledger-live repo, the `errors` skill documents the full how-to,
26
- `libs/ledger-auth/src/errors.ts` is a reference implementation, and
27
- `libs/ledger-wallet-framework/src/errors.ts` is the shared home for errors used by
28
- several coin modules.
29
-
30
- ## Why it is still here
31
-
32
- Two independent reasons, and only the first one has an end in sight.
33
-
34
- **1. It is still published.** External consumers resolve `@ledgerhq/errors` from npm, so the
35
- package keeps living here to be released. Removing it from the workspace means no more
36
- publishes — a product decision, not a mechanical follow-up.
37
-
38
- **2. An external peerDependency.** `@ledgerhq/coin-module-framework`,
39
- `@ledgerhq/coin-stellar`, `@ledgerhq/coin-xrp` and `@ledgerhq/coin-hypercore` declare
40
- `@ledgerhq/errors` as a `peerDependency` and `require()` it at runtime. With
41
- `auto-install-peers=false` that peer has to be provided by us, so the root `package.json`
42
- bridges it through `pnpm.packageExtensions` pointing at this workspace copy.
43
-
44
- `workspace:*` is deliberate there: it reuses this single copy, so the dependency graph keeps
45
- exactly the physical copies it had before. Pinning an npm version instead adds a duplicate
46
- and Desktop Bundle Checks reports a renderer duplication regression.
47
-
48
- The bridge has **three parts**, and all are needed:
49
-
50
- 1. **Resolution** — `pnpm.packageExtensions` in the root `package.json` turns the peer into a
51
- real dependency for those four, so they can find `@ledgerhq/errors` at all. An override
52
- alone does not do this: with `auto-install-peers=false` an undeclared peer is never
53
- installed, it just gets its *range* rewritten (`missing peer @ledgerhq/errors@workspace:*`).
54
- 2. **Deduplication** — `pnpm.overrides` carries `"@ledgerhq/errors": "workspace:*"`, the same
55
- idiom already used for `@ledgerhq/devices` and `@ledgerhq/hw-transport`. Four *other*
56
- external packages depend on published versions — `@ledgerhq/wallet-api-core` and
57
- `@ledgerhq/live-network` (the npm one) on `6.36.0`, `iso-filecoin` and
58
- `@mysten/ledgerjs-hw-app-sui` on `6.32.0` — and the override collapses all of them onto
59
- this single copy.
60
- 3. **Build order** — `targetDefaults.build.dependsOn` in `nx.workspace.json` carries
61
- `{ "projects": ["@ledgerhq/errors"], "target": "build" }`, so this package is compiled
62
- before anything that bundles those external packages.
63
-
64
- Part 2 is what keeps Desktop Bundle Checks quiet. `extractDuplicatesFromRspack` flags a
65
- package when the renderer contains **two or more distinct versions** under
66
- `node_modules/.pnpm/@ledgerhq+errors@<version>/`; a workspace link does not match that path
67
- at all, so it is invisible to the detector. Before this, `develop` stayed clean only by
68
- accident: `apps/ledger-live-desktop` declared the package, and rspack's
69
- `resolve.modules: [lldRoot/node_modules, …]` search path made every nested request resolve
70
- to that one copy. Removing the declaration exposed the registry copies underneath it.
71
-
72
- Part 3 is easy to miss. `lib/` and `lib-es/` are gitignored, so they only exist once
73
- `nx run @ledgerhq/errors:build` has run — and nx derives build order from the *package.json*
74
- project graph, which it cannot see `packageExtensions` in. Without that edge, a clean
75
- checkout resolves the symlink to a source directory with no `lib/index.js` and every bundler
76
- and Jest run fails with `Cannot find module '@ledgerhq/errors'`. A global edge is used rather
77
- than per-project `implicitDependencies` so no consumer can be missed, and so the bridge stays
78
- a few lines to delete instead of dozens.
79
-
80
- ## Retiring the bridge
81
-
82
- Two upstream releases remove the need for these parts, independently:
21
+ In the ledger-live repo, the `errors` skill documents the full how-to, and
22
+ `libs/ledger-auth/src/errors.ts` is a reference implementation.
83
23
 
84
- - [LedgerHQ/coin-modules#752](https://github.com/LedgerHQ/coin-modules/pull/752) drops the
85
- `peerDependency` from those four coin packages. Once released, parts **1 and 3** can go.
86
- - [LedgerHQ/wallet-api@916d7a3](https://github.com/LedgerHQ/wallet-api/commit/916d7a398ef0dc656e7c5af06524639b20f73b32)
87
- removes `@ledgerhq/errors` from `wallet-api-core` (local `serialization.ts` replaces
88
- `serializeError` / `deserializeError`). It is merged but **unreleased** — npm latest is still
89
- `wallet-api-core@1.35.0` requiring `^6.35.0`. Once released and picked up (our pin is
90
- `^1.35.0`, so a lockfile refresh suffices), the `6.36.0` copy disappears and the only
91
- remaining consumers, `iso-filecoin` and `@mysten/ledgerjs-hw-app-sui`, **both pin `6.32.0`**
92
- — a single version, which the detector ignores. Part **2** can then go too.
24
+ ## Why it can't just be deleted
93
25
 
94
- After both, nothing in this repo needs the package and it can be deleted — subject to reason 1
95
- above, which is a separate decision.
26
+ - The public API is consumed by external packages and apps; removal is future work.
27
+ - ~22 errors are shared by several sibling coin modules and have no editable home
28
+ package below the coin layer yet. They stay here for now; future owner is the
29
+ `coin-module-framework` repo.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/errors",
3
- "version": "7.0.0-nightly.20260801030117",
3
+ "version": "7.0.0",
4
4
  "description": "Ledger common errors",
5
5
  "keywords": [
6
6
  "Ledger"