ReviewOS

also looking at this

stacks/ts-syntax-highlighter

fix: browser-safe config loading and correct dual-theme token colors

#477
Open jmadore-payfacto wants to merge fix/browser-safe-config-and-dual-theme-colors into main
6 files +237 -21
packages/ts-syntax-highlighter/src/config.tsmodified+7-1
Changes to packages/ts-syntax-highlighter/src/config.ts
@@ -1,5 +1,4 @@
11import type { SyntaxHighlighterConfig } from './types'
2import { loadConfig } from 'bunfig'
32
43export const defaultConfig: SyntaxHighlighterConfig = {
54 verbose: false,
@@ -14,6 +13,13 @@ let _config: SyntaxHighlighterConfig | null = null
1413
1514export async function loadSyntaxHighlighterConfig(): Promise<SyntaxHighlighterConfig> {
1615 if (!_config) {
16 // `bunfig` reads config files from disk and is Node/Bun-only, so it is
17 // imported dynamically here rather than at module scope. A static
18 // top-level import would drag its own eager, unguarded `process.env`
19 // access into every consumer's bundle purely by importing this
20 // package's index, crashing immediately in a browser even for callers
21 // who never touch config loading.
22 const { loadConfig } = await import('bunfig')
1723 _config = await loadConfig({
1824 name: 'syntax',
1925 defaultConfig,