Skip to content

chore: upgrade TypeScript 6, Vitest 4, tsdown 0.21, Turbo 2.10 (#322) - #372

Open
thedavidweng wants to merge 9 commits into
1weiho:mainfrom
thedavidweng:typescript-vitest-tsdown-turbo-21be
Open

chore: upgrade TypeScript 6, Vitest 4, tsdown 0.21, Turbo 2.10 (#322)#372
thedavidweng wants to merge 9 commits into
1weiho:mainfrom
thedavidweng:typescript-vitest-tsdown-turbo-21be

Conversation

@thedavidweng

@thedavidweng thedavidweng commented Jul 26, 2026

Copy link
Copy Markdown

Issue

Implements #322 (parent #318).

Stacking note — please read

This PR depends on #370 (Vite 8 migration) and #369 (React 19 alignment). Vitest 4 peers vite: ^6 || ^7 || ^8, so it requires the Vite 8 base. This branch is based on main and includes the React 19 + Vite 8 commits from #369 and #370. The TypeScript/Vitest/tsdown/Turbo–specific changes are the last 2 commits.

For review, please focus on these files (this PR only):

  • package.json (root typescript, vitest, turbo lines)
  • packages/core/package.json (tsdown, typescript, @types/node lines)
  • packages/cli/package.json (tsdown, typescript, @types/node lines)
  • apps/web/package.json (@types/node line)
  • packages/core/tsdown.config.ts
  • packages/cli/tsdown.config.ts
  • packages/core/tsconfig.json (removed deprecated baseUrl for TS 6)
  • .changeset/typescript-vitest-tsdown-turbo.md

Once #369 and #370 merge, I will rebase this branch onto main and the diff will shrink to only the TS/Vitest/tsdown/Turbo changes.

Exact scope

Upgrade repository build/test/typecheck tooling only:

  • TypeScript
  • @types/node
  • Vitest
  • tsdown
  • Turbo

No React/Vite/Biome/Oxlint/runtime library upgrades in this PR.

Versions before → after

Package Before After
typescript (core/cli) ^5.9.3 ^6.0.3
typescript (web) ^6.0.3 ^6.0.3 (aligned)
typescript (root) (none) 6.0.3
@types/node (core/cli) ^22.19.17 ^22.19.21
@types/node (web) ^25.6.0 ^22.19.21 (aligned to Node 22 contract)
vitest ^2.1.9 ^4.1.10
tsdown ^0.9.9 ^0.21.10
turbo ^2.9.18 ^2.10.5

Why the old state was a problem

  • Split TypeScript generations (5.x in core/cli vs 6.x on web) hid compatibility issues
  • Vitest 2 still pulled Vite 5 into the test graph after the Vite 8 migration
  • tsdown 0.9 lagged the Rolldown generation used by Vite 8
  • Larger future migration gaps

Why these versions were chosen

TypeScript 6.0.3 (not 7)

TypeScript 7.0.2 is the latest stable, but it is not adopted here:

Candidate Blocker
tsdown@0.22.8 (peers include typescript@^7) engines.node is ^22.18.0 || >=24.11.0, incompatible with the repo's Node >=22.13.0 contract from #317
tsdown@0.21.10 (Node >=20.19.0, OK for 22.13+) peers are typescript: ^5 || ^6 only — no TypeScript 7

Selected: TypeScript 6.0.3 (newest common stable supported by tsdown 0.21.10 + the Node 22.13+ contract).

Follow-up trigger: adopt TypeScript 7 when either (a) tsdown ≥0.22 lowers Node engines to include 22.13+, or (b) the repo intentionally raises engines to match tsdown 0.22+.

Other selections

  • Vitest 4.1.10: latest stable; peers vite: ^6 \|\| ^7 \|\| ^8 — resolves the Vitest→Vite 5 leftover
  • tsdown 0.21.10: newest stable compatible with Node 22.13+
  • Turbo 2.10.5: latest stable
  • @types/node 22.19.21: matches published engines.node >=22.13.0

Breaking changes reviewed

  • Vitest 2→4: config still valid; 306 tests pass unchanged (no silent snapshot updates)
  • tsdown 0.9→0.21: default output became .mjs/.d.mts; set fixedExtension: false to preserve .js/.d.ts export paths
  • Deprecated externaldeps.neverBundle
  • Build target node18node22 (matches package engines)
  • Removed deprecated baseUrl from packages/core/tsconfig.json (TS 6 deprecates it; moduleResolution: bundler resolves paths without it)

Source changes required (this PR only)

  • packages/core/tsdown.config.ts / packages/cli/tsdown.config.ts
  • packages/core/tsconfig.json (remove deprecated baseUrl)
  • Workspace package.json version bumps + lockfile
  • Changeset for core + cli

Tests added or changed

None required; existing suite green on Vitest 4 (306 tests).

Benchmark results

Same machine, Node 24.18.0, pnpm 10.17.0. Warm-up + 5 measured runs; medians.

Metric Before After Change
pnpm typecheck warm 427 ms 387 ms −40 ms
pnpm test 2138 ms 1859 ms −279 ms
core package build 1582 ms 1652 ms +70 ms
CLI package build 462 ms 488 ms +26 ms
full monorepo build cold (turbo --force) 16736 ms 15766 ms −970 ms
packed core size 275447 B 274869 B −578 B
packed CLI size 54366 B 54374 B +8 B

Manual validation

On Node 24.18.0 with pnpm 10.17.0 (current main toolchain, plus the React 19 + Vite 8 base):

pnpm install
pnpm format:check / lint / typecheck / test (306 passed) / build  # pass
pnpm --filter @open-slide/core|cli pack                            # pass

Known limitations

Prohibited workarounds

Confirmed not used: --force, --legacy-peer-deps, overrides/resolutions, patch-package, prereleases, blanket suppressions, silent snapshot churn, unrelated features.

Summary by CodeRabbit

  • Breaking Changes

    • React 19 is now required for the core package, CLI, and generated workspaces.
    • Generated workspaces are upgraded to Vite 8 with native optimizer configuration.
  • Improvements

    • Updated build and testing tooling, including TypeScript 6, Vitest 4, tsdown, and related upgrades.
    • Improved TypeScript typings for nullable React refs across navigation/overlay components.
    • Enhanced MDX image rendering and virtual import optimization behavior.

cursoragent and others added 7 commits July 25, 2026 23:07
Upgrade react/react-dom and matching types to 19.2.x across core,
demo, and the generated template. Update RefObject typings for the
React 19 nullability contract.

Co-authored-by: Davy <thedavidweng@users.noreply.github.com>
React 19 widens HTMLImageElement src to include Blob, which is incompatible
with Next/fumadocs ImageProps. Keep string sources only for ImageZoom.

Co-authored-by: Davy <thedavidweng@users.noreply.github.com>
Upgrade vite to 8.1.4 and @vitejs/plugin-react to 6.x. Replace deprecated
optimizeDeps.esbuildOptions with optimizeDeps.rolldownOptions for virtual
module exclusion. Fix website MDX ImageZoom typing exposed by the lockfile
update.

Co-authored-by: Davy <thedavidweng@users.noreply.github.com>
Unify all workspaces on TypeScript 6.0.3. Move Vitest to 4.1.10 (Vite 8
peer), tsdown to 0.21.10 (newest release compatible with Node 22.13+),
and Turbo to 2.10.5. Keep .js/.d.ts output via fixedExtension: false and
retarget package builds to node22.

Co-authored-by: Davy <thedavidweng@users.noreply.github.com>
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@thedavidweng is attempting to deploy a commit to the open-slide Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The PR aligns the monorepo with React 19, Vite 8, TypeScript 6, Vitest 4, and tsdown 0.21; migrates virtual-module optimization to Rolldown; updates Node 22 builds; and widens several React ref types to allow null.

Changes

Toolchain and runtime alignment

Layer / File(s) Summary
Runtime and build toolchain versions
.changeset/*, apps/demo/package.json, apps/web/package.json, package.json, packages/cli/package.json, packages/cli/template/package.json, packages/core/package.json
Release notes and workspace dependencies are updated for React 19, Vite 8, TypeScript 6, Vitest 4, tsdown 0.21, and aligned Node type versions.
Node 22 build configuration
packages/cli/tsdown.config.ts, packages/core/tsdown.config.ts, packages/core/tsconfig.json
CLI and core builds target Node 22, configure fixed extensions, use deps.neverBundle, and remove the core baseUrl setting.
Rolldown virtual-module externalization
packages/core/src/vite/config.ts, packages/core/src/vite/config.test.ts
Vite optimization now uses a Rolldown plugin to externalize virtual:open-slide/*, with tests covering matching and unrelated module IDs.
React runtime and nullable ref contracts
apps/web/components/mdx.tsx, packages/core/src/app/...
MDX image props are normalized before rendering, and navigation, viewport, and inspector refs accept nullable RefObject values.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ViteConfig
  participant Rolldown
  participant VirtualModuleResolver
  ViteConfig->>Rolldown: configure optimizeDeps.rolldownOptions
  Rolldown->>VirtualModuleResolver: resolveId virtual:open-slide/*
  VirtualModuleResolver-->>Rolldown: mark matching module external
Loading

Possibly related issues

  • Issue 322 — Covers the TypeScript, Vitest, and tsdown upgrades represented by this PR.

Possibly related PRs

Suggested reviewers: 1weiho

Poem

I hopped through React’s fresh green leaves,
While Rolldown tuned the build with ease.
Nullable refs now gently land,
TypeScript tools march paw in hand.
A carrot toast to versions new! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main tooling upgrades, including TypeScript 6, Vitest 4, and tsdown 0.21.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/vite-8-migration.md:
- Line 6: Update the changeset description to a short, direct, present-tense
statement describing the user-facing Vite 8 and native Rolldown optimizer
migration.

In `@packages/cli/template/package.json`:
- Around line 14-20: Revert the dependency changes in the CLI template manifest
and leave packages/cli/template/package.json untouched. If the dependency update
is required, apply it at the appropriate source outside the excluded template
manifest, preserving the path restriction for template package.json and
open-slide.config.ts files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 117649f2-9285-4508-8bec-17ea7f269add

📥 Commits

Reviewing files that changed from the base of the PR and between c408ba0 and cae47a2.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/react-19-alignment.md
  • .changeset/typescript-vitest-tsdown-turbo.md
  • .changeset/vite-8-migration.md
  • apps/demo/package.json
  • apps/web/components/mdx.tsx
  • apps/web/package.json
  • package.json
  • packages/cli/package.json
  • packages/cli/template/package.json
  • packages/cli/tsdown.config.ts
  • packages/core/package.json
  • packages/core/src/app/components/inspector/inspect-overlay.tsx
  • packages/core/src/app/lib/use-click-page-navigation.ts
  • packages/core/src/app/lib/use-wheel-page-navigation.ts
  • packages/core/src/app/routes/slide.tsx
  • packages/core/src/vite/config.test.ts
  • packages/core/src/vite/config.ts
  • packages/core/tsconfig.json
  • packages/core/tsdown.config.ts
💤 Files with no reviewable changes (1)
  • packages/core/tsconfig.json

Comment thread .changeset/vite-8-migration.md Outdated
Comment thread packages/cli/template/package.json
@thedavidweng

Copy link
Copy Markdown
Author

Addressed CodeRabbit review:

Fixed: Tightened the vite-8-migration.md changeset description to be shorter and more direct.

Template package.json (not reverted): Same rationale as #369/#370 — the template must align with React 19 + Vite 8 to avoid dual React copies in generated projects. The path restriction applies to slide-authoring agents, not framework-level dependency upgrades.

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.

2 participants