fix(web): use WASM engine for diff highlighting#3885
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ccc0c37. Configure here.
ApprovabilityVerdict: Needs human review This PR modifies Content Security Policy (CSP) settings and changes the highlighting engine from JavaScript regex to WASM-based Oniguruma. CSP changes have security implications and switching highlighting engines affects core runtime behavior, both warranting human review. You can customize Macroscope's approvability policy. Learn more. |

Summary
@pierre/diffsworker pool from Shiki's JavaScript RegExp engine to the Oniguruma WASM engine'wasm-unsafe-eval'sourceRationale
Issue #3884 reports six Pierre
DedicatedWorkerthreads remaining at 100% CPU. Pierre's worker highlighting is synchronous, and the JavaScript RegExp engine can suffer runaway backtracking for certain TextMate grammar inputs. Selectingshiki-wasmuses Oniguruma's stronger runaway-backtracking protections for the desktop/web worker pool.The desktop protocol CSP explicitly permits WASM compilation without enabling general JavaScript eval. Mobile remains unchanged because it already uses
react-native-shiki-enginewith native Oniguruma.Addresses #3884.
Validation
pnpm exec vp test apps/desktop/src/electron/ElectronProtocol.test.tspnpm exec vp checkpnpm exec vp run typecheckpnpm exec vp run --filter @t3tools/web buildNote
Use WASM engine for diff highlighting in the web app
preferredHighlighter: "shiki-wasm"in DiffWorkerPoolProvider.tsx to use the WASM-based Shiki highlighter at runtime.'wasm-unsafe-eval'to thescript-srcdirective in ElectronProtocol.ts so the desktop CSP permits WASM execution.Macroscope summarized ed35e48.