Commit 882fd94
chore: migrate from Vite v7 to v8 (Rolldown/Oxc) (#919)
## Summary
Vite 8 replaces Rollup+esbuild with Rolldown+Oxc as its bundler and
transformer. This PR adapts the codebase to all relevant breaking
changes.
### Config changes (all packages)
- Rename `build.rollupOptions` → `build.rolldownOptions` in every
`vite.config.ts` and `vitest.config.ts`
- Remove the `_commonjsHelpers` chunk-name special-case — Rolldown
handles CJS natively and this chunk no longer appears
- Update `vite-plugin-static-copy` targets with `rename: { stripBase:
true }` to match v4's new directory-structure-preserving behaviour
- Replace `vite-tsconfig-paths` plugin with the native
`resolve.tsconfigPaths: true` option (Vite 8 built-in)
- Replace deprecated `customResolver` alias with a `resolveId` plugin
hook for the `@metamask/kernel-shims/endoify` redirect
- Update `js-trusted-prelude.ts` plugin to read
`config.build.rolldownOptions?.input`
### `bundle-vat.ts` (kernel-utils)
- Use `RolldownOutput` / `OutputChunk` types from `rolldown` instead of
`Rollup.*` from `vite`
- Replace `output.inlineDynamicImports: true` (Rollup-only) with
`output.codeSplitting: false`
- Add `removeDynamicImportsPlugin`: Rolldown rejects IIFE format
whenever the bundle graph contains any `import()` expression, even with
`codeSplitting: false`. Some third-party packages (viem, `@endo/*`) use
lazy `await import(x)` for utilities that vats never call; the plugin
replaces all string-literal dynamic imports with `Promise.resolve({})`
to satisfy Rolldown's constraint
- Add a module-level promise-queue mutex to serialize concurrent
`bundleVat()` calls — Rolldown has global state that is corrupted when
multiple IIFE builds run concurrently via `Promise.all` (as `kernel-cli`
does when bundling a directory of vats)
- Add `rolldown` as a peer dependency and update the `vite` peer dep
range to `^8.0.6`
### `bundle-loader.ts` (ocap-kernel)
- Add `exports: {}` to the SES Compartment endowments — Rolldown
unconditionally emits `Object.defineProperty(exports,
Symbol.toStringTag, ...)` in every IIFE bundle preamble, even for
modules with no exports; without an `exports` endowment this throws
inside the Compartment
### `stringify.test.ts` (kernel-utils)
- Oxc serialises function declarations with tabs instead of spaces, so
the whitespace-sensitive string comparison is replaced with `String(fn)`
to stay bundler-agnostic
## Testing
All 24 build tasks and all 45 test tasks pass (`yarn build` + `yarn
test:dev:quiet` from the monorepo root, both cached and uncached).
The key non-obvious behaviour changes are covered by the existing vat
integration tests in `@ocap/kernel-test` (which build real vat bundles
via `bundleVat` and execute them in SES Compartments) and by the
`evm-wallet-experiment` build (which exercises the 4-vat `Promise.all`
path through `kernel-cli`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Medium risk because this upgrades the build/test toolchain
(Vite/Vitest/Rolldown) and changes bundling semantics for vats and
extension builds, which can cause subtle runtime or packaging
regressions.
>
> **Overview**
> Upgrades the monorepo to **Vite 8 / Vitest 4.1** (plus related tool
bumps like Playwright, jsdom, and static-copy/checker plugins) and
updates package configs accordingly.
>
> Migrates build/test configs from `build.rollupOptions` to
`build.rolldownOptions`, adjusts static asset copy behavior (adds
`rename.stripBase`), and replaces `vite-tsconfig-paths` with Vite’s
native `resolve.tsconfigPaths` plus a custom `resolveId` hook for the
`@metamask/kernel-shims/endoify` test redirect.
>
> Updates vat bundling to Rolldown by switching types/output options,
adding a `removeDynamicImportsPlugin()` workaround for IIFE constraints,
and serializing `bundleVat()` builds to avoid Rolldown concurrency
issues; `loadBundle()` is hardened to support Rolldown-generated IIFE
preambles (`exports`, `globalThis`, `global`). Minor follow-ups include
exporting `register` from the OpenClaw plugin entrypoint and making
`stringify` function tests bundler-output-agnostic.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3fc36bd. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent f1d2bb3 commit 882fd94
44 files changed
Lines changed: 1239 additions & 1258 deletions
File tree
- packages
- create-package
- evm-wallet-experiment
- openclaw-plugin
- test
- integration
- extension
- kernel-agents-repl
- kernel-agents
- kernel-browser-runtime
- kernel-cli
- kernel-errors
- kernel-language-model-service
- kernel-node-runtime
- kernel-platforms
- kernel-rpc-methods
- kernel-shims
- kernel-store
- kernel-test-local
- kernel-test
- kernel-ui
- kernel-utils
- src
- vite-plugins
- logger
- nodejs-test-workers
- ocap-kernel
- src/vats
- omnium-gatherum
- remote-iterables
- repo-tools
- src/vite-plugins
- streams
- template-package
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
| 75 | + | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
| 104 | + | |
| 105 | + | |
107 | 106 | | |
108 | 107 | | |
109 | 108 | | |
| |||
130 | 129 | | |
131 | 130 | | |
132 | 131 | | |
133 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
143 | 144 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
| 85 | + | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 82 | + | |
89 | 83 | | |
90 | 84 | | |
91 | 85 | | |
| |||
107 | 101 | | |
108 | 102 | | |
109 | 103 | | |
110 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
111 | 107 | | |
112 | 108 | | |
113 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
0 commit comments