this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

editor: refactor codemirror with modern-er @coremirror/view

- add syntax highlight and line numbers

Clément 6bcfa0a7 154056ab

+33 -59
+2 -1
app/package.json
··· 25 25 "@atproto/jwk": "^0.6.0", 26 26 "@cloudflare/vite-plugin": "^1.31.0", 27 27 "@codemirror/lang-javascript": "^6.2.5", 28 + "@codemirror/language": "^6.12.3", 29 + "@codemirror/view": "^6.41.0", 28 30 "@prisma/adapter-d1": "7.5.0", 29 31 "@prisma/client": "7.5.0", 30 32 "@tailwindcss/vite": "^4.2.2", ··· 42 44 "@tanstack/store": "^0.9.3", 43 45 "@trivago/prettier-plugin-sort-imports": "^6.0.2", 44 46 "@types/node": "^24.10.12", 45 - "codemirror": "^6.0.2", 46 47 "eslint": "^10.2.0", 47 48 "lucide-solid": "^1.7.0", 48 49 "prettier": "^3.8.1",
+13 -3
app/src/lib/components/Editor.tsx
··· 1 1 import { javascript } from '@codemirror/lang-javascript'; 2 - import { EditorView, basicSetup } from 'codemirror'; 2 + import { 3 + defaultHighlightStyle, 4 + syntaxHighlighting, 5 + } from '@codemirror/language'; 6 + import { EditorView, lineNumbers } from '@codemirror/view'; 3 7 import { onCleanup, onMount } from 'solid-js'; 4 8 import type { JSX } from 'solid-js'; 5 9 ··· 12 16 onMount(() => { 13 17 view = new EditorView({ 14 18 doc: props.initialValue, 15 - extensions: [basicSetup, javascript()], 19 + extensions: [ 20 + lineNumbers(), 21 + syntaxHighlighting(defaultHighlightStyle), 22 + javascript(), 23 + ], 16 24 parent: ref!, 17 25 }); 18 26 }); 19 27 20 - onCleanup(() => view?.destroy()); 28 + onCleanup(() => { 29 + view?.destroy(); 30 + }); 21 31 22 32 return <div ref={ref!} {...props} />; 23 33 }
-8
app/vite.config.ts
··· 34 34 ), 35 35 'import.meta.env.VITE_OAUTH_SCOPE': JSON.stringify(metadata.scope), 36 36 }, 37 - optimizeDeps: { 38 - exclude: ['@codemirror/lang-javascript', 'codemirror'], 39 - }, 40 - ssr: { 41 - optimizeDeps: { 42 - exclude: ['@codemirror/lang-javascript', 'codemirror'], 43 - }, 44 - }, 45 37 });
+18 -47
pnpm-lock.yaml
··· 37 37 '@codemirror/lang-javascript': 38 38 specifier: ^6.2.5 39 39 version: 6.2.5 40 + '@codemirror/language': 41 + specifier: ^6.12.3 42 + version: 6.12.3 43 + '@codemirror/view': 44 + specifier: ^6.41.0 45 + version: 6.41.0 40 46 '@prisma/adapter-d1': 41 47 specifier: 7.5.0 42 48 version: 7.5.0 ··· 88 94 '@types/node': 89 95 specifier: ^24.10.12 90 96 version: 24.10.12 91 - codemirror: 92 - specifier: ^6.0.2 93 - version: 6.0.2 94 97 eslint: 95 98 specifier: ^10.2.0 96 99 version: 10.2.0(jiti@2.6.1) ··· 352 355 '@codemirror/autocomplete@6.20.1': 353 356 resolution: {integrity: sha512-1cvg3Vz1dSSToCNlJfRA2WSI4ht3K+WplO0UMOgmUYPivCyy2oueZY6Lx7M9wThm7SDUBViRmuT+OG/i8+ON9A==} 354 357 355 - '@codemirror/commands@6.10.3': 356 - resolution: {integrity: sha512-JFRiqhKu+bvSkDLI+rUhJwSxQxYb759W5GBezE8Uc8mHLqC9aV/9aTC7yJSqCtB3F00pylrLCwnyS91Ap5ej4Q==} 357 - 358 358 '@codemirror/lang-javascript@6.2.5': 359 359 resolution: {integrity: sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==} 360 360 361 - '@codemirror/language@6.12.2': 362 - resolution: {integrity: sha512-jEPmz2nGGDxhRTg3lTpzmIyGKxz3Gp3SJES4b0nAuE5SWQoKdT5GoQ69cwMmFd+wvFUhYirtDTr0/DRHpQAyWg==} 361 + '@codemirror/language@6.12.3': 362 + resolution: {integrity: sha512-QwCZW6Tt1siP37Jet9Tb02Zs81TQt6qQrZR2H+eGMcFsL1zMrk2/b9CLC7/9ieP1fjIUMgviLWMmgiHoJrj+ZA==} 363 363 364 364 '@codemirror/lint@6.9.5': 365 365 resolution: {integrity: sha512-GElsbU9G7QT9xXhpUg1zWGmftA/7jamh+7+ydKRuT0ORpWS3wOSP0yT1FOlIZa7mIJjpVPipErsyvVqB9cfTFA==} 366 366 367 - '@codemirror/search@6.6.0': 368 - resolution: {integrity: sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==} 369 - 370 367 '@codemirror/state@6.6.0': 371 368 resolution: {integrity: sha512-4nbvra5R5EtiCzr9BTHiTLc+MLXK2QGiAVYMyi8PkQd3SR+6ixar/Q/01Fa21TBIDOZXgeWV4WppsQolSreAPQ==} 372 369 373 - '@codemirror/view@6.40.0': 374 - resolution: {integrity: sha512-WA0zdU7xfF10+5I3HhUUq3kqOx3KjqmtQ9lqZjfK7jtYk4G72YW9rezcSywpaUMCWOMlq+6E0pO1IWg1TNIhtg==} 370 + '@codemirror/view@6.41.0': 371 + resolution: {integrity: sha512-6H/qadXsVuDY219Yljhohglve8xf4B8xJkVOEWfA5uiYKiTFppjqsvsfR5iPA0RbvRBoOyTZpbLIxe9+0UR8xA==} 375 372 376 373 '@cspotcode/source-map-support@0.8.1': 377 374 resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} ··· 2306 2303 resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} 2307 2304 engines: {node: '>=6'} 2308 2305 2309 - codemirror@6.0.2: 2310 - resolution: {integrity: sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==} 2311 - 2312 2306 comment-parser@1.4.5: 2313 2307 resolution: {integrity: sha512-aRDkn3uyIlCFfk5NUA+VdwMmMsh8JGhc4hapfV4yxymHGQ3BVskMQfoXGpCo5IoBuQ9tS5iiVKhCpTcB4pW4qw==} 2314 2308 engines: {node: '>= 12.0.0'} ··· 4003 3997 4004 3998 '@codemirror/autocomplete@6.20.1': 4005 3999 dependencies: 4006 - '@codemirror/language': 6.12.2 4000 + '@codemirror/language': 6.12.3 4007 4001 '@codemirror/state': 6.6.0 4008 - '@codemirror/view': 6.40.0 4009 - '@lezer/common': 1.5.1 4010 - 4011 - '@codemirror/commands@6.10.3': 4012 - dependencies: 4013 - '@codemirror/language': 6.12.2 4014 - '@codemirror/state': 6.6.0 4015 - '@codemirror/view': 6.40.0 4002 + '@codemirror/view': 6.41.0 4016 4003 '@lezer/common': 1.5.1 4017 4004 4018 4005 '@codemirror/lang-javascript@6.2.5': 4019 4006 dependencies: 4020 4007 '@codemirror/autocomplete': 6.20.1 4021 - '@codemirror/language': 6.12.2 4008 + '@codemirror/language': 6.12.3 4022 4009 '@codemirror/lint': 6.9.5 4023 4010 '@codemirror/state': 6.6.0 4024 - '@codemirror/view': 6.40.0 4011 + '@codemirror/view': 6.41.0 4025 4012 '@lezer/common': 1.5.1 4026 4013 '@lezer/javascript': 1.5.4 4027 4014 4028 - '@codemirror/language@6.12.2': 4015 + '@codemirror/language@6.12.3': 4029 4016 dependencies: 4030 4017 '@codemirror/state': 6.6.0 4031 - '@codemirror/view': 6.40.0 4018 + '@codemirror/view': 6.41.0 4032 4019 '@lezer/common': 1.5.1 4033 4020 '@lezer/highlight': 1.2.3 4034 4021 '@lezer/lr': 1.4.8 ··· 4037 4024 '@codemirror/lint@6.9.5': 4038 4025 dependencies: 4039 4026 '@codemirror/state': 6.6.0 4040 - '@codemirror/view': 6.40.0 4041 - crelt: 1.0.6 4042 - 4043 - '@codemirror/search@6.6.0': 4044 - dependencies: 4045 - '@codemirror/state': 6.6.0 4046 - '@codemirror/view': 6.40.0 4027 + '@codemirror/view': 6.41.0 4047 4028 crelt: 1.0.6 4048 4029 4049 4030 '@codemirror/state@6.6.0': 4050 4031 dependencies: 4051 4032 '@marijn/find-cluster-break': 1.0.2 4052 4033 4053 - '@codemirror/view@6.40.0': 4034 + '@codemirror/view@6.41.0': 4054 4035 dependencies: 4055 4036 '@codemirror/state': 6.6.0 4056 4037 crelt: 1.0.6 ··· 6151 6132 citty@0.2.2: {} 6152 6133 6153 6134 clsx@2.1.1: {} 6154 - 6155 - codemirror@6.0.2: 6156 - dependencies: 6157 - '@codemirror/autocomplete': 6.20.1 6158 - '@codemirror/commands': 6.10.3 6159 - '@codemirror/language': 6.12.2 6160 - '@codemirror/lint': 6.9.5 6161 - '@codemirror/search': 6.6.0 6162 - '@codemirror/state': 6.6.0 6163 - '@codemirror/view': 6.40.0 6164 6135 6165 6136 comment-parser@1.4.5: {} 6166 6137