Skip to content

chore(deps): migrate monorepo library builds from tsup to tsdown#2173

Merged
alexmatson-da merged 2 commits into
canton-network:mainfrom
singhyash05:chore/1965-migrate-tsup-to-tsdown
Jul 21, 2026
Merged

chore(deps): migrate monorepo library builds from tsup to tsdown#2173
alexmatson-da merged 2 commits into
canton-network:mainfrom
singhyash05:chore/1965-migrate-tsup-to-tsdown

Conversation

@singhyash05

@singhyash05 singhyash05 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces tsup with tsdown for library builds across ~35 core/* and sdk/* packages.
  • Shared config is now tsdown.base.ts (old tsup.base.ts and per-package tsup.config.ts files removed). Scripts and devDependencies point at tsdown@^0.22.9, including root and yarn.lock.
  • Special cases kept working:
    • browser: provider-dapp, provider-ledger, rpc-transport, splice-provider
    • node: signing-internal, signing-participant, wallet-test-utils
    • ledger-proto: separate ESM/CJS outputs, CJS relative-import rewrite, CJS sourcemaps off (avoids SOURCEMAP_BROKEN spam)
  • RPC generator TypeScript client template updated (_package.json + tsdown.config.ts) so yarn generate:* copies a config that resolves tsdown.base.ts from core/<client>/, not from the template directory.
  • Source tweaks for rolldown: export type in ledger-client, signing-lib, and splice-client. Mixed default+named export packages set outputOptions.exports: 'named'.
  • Root does not get "type": "module" — that would break .commitlintrc.js.
  • Follow-up fix: ParsedURL no longer uses constructor parameter properties. Under tsdown/oxc, those emitted this before super()ReferenceError in wallet-sdk e2e. Validate URL first, call super(), then assign fields.

Fixes #1965

Test plan

  • Clean full rebuild (yarn clean:all && yarn build:all) — 45/45
  • rg tsup — no leftovers in source/config
  • yarn workspace @canton-network/wallet-sdk build — emit has super(validateUrl(...)) before this.ctx
  • yarn nx playwright:e2e @canton-network/example-portfolio — 25 passed (localnet)
  • CI e2e jobs green on PR

@singhyash05
singhyash05 requested a review from a team as a code owner July 20, 2026 11:39
@alexmatson-da

Copy link
Copy Markdown
Contributor

I think something might've broken the wallet SDK's module (CI job failed)

  1) [chromium] › tests/allocation-next.spec.ts:125:5 › OTC allocations › shows reservations and every settlement leg 

    ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor

       at ../../../sdk/wallet-sdk/src/wallet/namespace/utils/url.ts:11

       9 | export class ParsedURL extends URL {
      10 |     constructor(
    > 11 |         private readonly ctx: SDKContext,
         |                          ^
      12 |         private readonly input: URLInput
      13 |     ) {
      14 |         try {
        at ParsedURL (/home/runner/work/wallet/wallet/sdk/wallet-sdk/src/wallet/namespace/utils/url.ts:11:26)
        at map (/home/runner/work/wallet/wallet/sdk/wallet-sdk/src/wallet/init/initializedSDK.ts:122:28)
        at Object.asset (/home/runner/work/wallet/wallet/sdk/wallet-sdk/src/wallet/init/initializedSDK.ts:121:43)
        at ExtendedInitializedSDK.create (/home/runner/work/wallet/wallet/sdk/wallet-sdk/src/wallet/init/initializedSDK.ts:260:64)
        at SDK.create (/home/runner/work/wallet/wallet/sdk/wallet-sdk/src/wallet/sdk.ts:151:45)
        at OTCTrade.setup (/home/runner/work/wallet/wallet/core/wallet-test-utils/src/otc-trade.ts:65:20)
        at setupOtcTrade (/home/runner/work/wallet/wallet/examples/portfolio/tests/allocation-next.spec.ts:106:29)
        at /home/runner/work/wallet/wallet/examples/portfolio/tests/allocation-next.spec.ts:138:13

    Error Context: test-results/allocation-next-OTC-alloca-27cef-ns-and-every-settlement-leg-chromium/error-context.md

I recommend rebasing on latest main (we upgraded the repo's splice version recently).

The steps to repro what CI is doing (requires local docker setup):

  • yarn script:fetch:localnet
  • yarn start:localnet
  • yarn build:all
  • yarn start:all
  • yarn nx playwright:e2e @canton-network/example-portfolio

Swap tsup for tsdown across core/sdk packages with a shared
tsdown.base.ts, including the RPC generator TypeScript client template.
Adapt configs for rolldown (type-only re-exports, node/browser
platforms, ledger-proto CJS sourcemaps, named exports where needed).
Verified with clean full rebuild; no tsup leftovers remain.

Fixes canton-network#1965

Signed-off-by: singhyash05 <yashsingh5609@gmail.com>
Parameter properties ran before super() under oxc → ReferenceError
in e2e. Validate URL first, then super(), then assign fields.

Signed-off-by: singhyash05 <yashsingh5609@gmail.com>
@singhyash05
singhyash05 force-pushed the chore/1965-migrate-tsup-to-tsdown branch from 0545423 to 49b63f4 Compare July 21, 2026 17:40
@singhyash05

singhyash05 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@alexmatson-da , problem was ParsedURL: tsdown (oxc) compiles the constructor's parameter properties into assignments that run before super(), which throws on a class extending URL. Rewrote it to validate the URL, call super(), then set the fields.

Ran yarn nx playwright:e2e @canton-network/example-portfolio locally and all 25 passed. Rebased onto main too, thanks for the pointer.

@alexmatson-da alexmatson-da left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks great! thanks

@alexmatson-da
alexmatson-da merged commit 7133dd4 into canton-network:main Jul 21, 2026
28 of 44 checks passed
mateuszpiatkowski-da pushed a commit that referenced this pull request Jul 22, 2026
* chore(deps): migrate monorepo library builds from tsup to tsdown

Swap tsup for tsdown across core/sdk packages with a shared
tsdown.base.ts, including the RPC generator TypeScript client template.
Adapt configs for rolldown (type-only re-exports, node/browser
platforms, ledger-proto CJS sourcemaps, named exports where needed).
Verified with clean full rebuild; no tsup leftovers remain.

Fixes #1965

Signed-off-by: singhyash05 <yashsingh5609@gmail.com>

* Fix ParsedURL constructor for tsdown/oxc emit.
Parameter properties ran before super() under oxc → ReferenceError
in e2e. Validate URL first, then super(), then assign fields.

Signed-off-by: singhyash05 <yashsingh5609@gmail.com>

---------

Signed-off-by: singhyash05 <yashsingh5609@gmail.com>
Signed-off-by: Mateusz Piątkowski <mateusz.piatkowski@digitalasset.com>
fayi-da added a commit that referenced this pull request Jul 22, 2026
Leftover from #2173

Signed-off-by: Fayi Femi-Balogun <fayimora.femibalogun@digitalasset.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate away from tsup

2 participants