mirror of
https://github.com/alexandrev/xslt-lab.git
synced 2026-09-13 08:43:16 +00:00
9c6f81a043
@uiw/react-codemirror's basicSetup statically imports @codemirror/lint, /autocomplete and /search, so they landed in the critical codemirror chunk regardless of the runtime basicSetup flags. Since lint and autocomplete are already loaded on demand via useEditorExtras, they were being shipped twice — once eager, once deferred. Replace the @uiw wrapper with a thin EditorView binding (controlled value with an ExternalChange annotation to avoid onChange echo, plus compartments for theme / base options / deferred extras) and hand-pick only the primitives the critical path needs: state, view (lineNumbers, highlightActiveLine, drawSelection, keymap), commands (history), and language (syntaxHighlighting, indentOnInput, bracketMatching). lint, autocomplete and the completions table stay in useEditorExtras. Critical codemirror chunk 448KB/147KB gz -> 361KB/118KB gz. The autocomplete + lint code moves to deferred chunks, off first paint. Behaviour verified in a headless browser: typing/onChange, undo/redo, auto-close tags, deferred autocomplete (65 options), XML lint markers, and light/dark theme switch (oneDark applied) all work; no page errors. LCP/FCP/CLS unchanged (already gated by the static skeleton since the prior commit). Time-to-interactive-editor on throttled mobile improves from 2111ms to 1821ms median, with far tighter run-to-run variance. Drops the @uiw/react-codemirror dependency; promotes the four @codemirror/* primitives to direct dependencies. @monaco-editor/react stays (only referenced by a test mock). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JDk5guu51FjFxQMjgrrekW
37 lines
949 B
JSON
37 lines
949 B
JSON
{
|
|
"name": "xslt-playground",
|
|
"version": "0.2.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"test": "vitest run"
|
|
},
|
|
"dependencies": {
|
|
"@codemirror/autocomplete": "^6.20.1",
|
|
"@codemirror/commands": "^6.10.3",
|
|
"@codemirror/lang-xml": "^6.1.0",
|
|
"@codemirror/language": "^6.12.3",
|
|
"@codemirror/lint": "^6.9.5",
|
|
"@codemirror/state": "^6.6.0",
|
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
"@codemirror/view": "^6.41.0",
|
|
"@monaco-editor/react": "^4.7.0",
|
|
"firebase": "^9.23.0",
|
|
"ga-4-react": "^0.1.281",
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"react-ga": "^3.3.1",
|
|
"xml-formatter": "^3.7.0"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/jest-dom": "^6.6.3",
|
|
"@testing-library/react": "^16.1.0",
|
|
"@vitejs/plugin-react": "^4.1.0",
|
|
"jsdom": "^25.0.1",
|
|
"vite": "^5.0.0",
|
|
"vitest": "^2.1.4"
|
|
}
|
|
}
|