`rehype-raw` (and parse5) is always bundled, even when raw HTML is not used
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- electron, react, typescript, vite
- Área
- frontend, performance
Línea de trabajo
Start with the two entry points named in the issue: packages/streamdown/index.tsx and packages/streamdown/lib/markdown.ts; trace how the default plugin list and hasRehypeRaw() determine whether rehype-raw is bundled and how HTML is rendered. Compare production bundle output with and without raw HTML enabled, while preserving the default rendering behavior. Done means the unused dependency can be excluded when raw HTML is not enabled, without changing the default behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
rehype-raw is imported at module top level in two places, so it and its dependency tree (hast-util-raw → parse5) end up in every bundle that imports streamdown, whether or not raw HTML rendering is enabled:
packages/streamdown/index.tsx—defaultRehypePlugins.raw = rehypeRaw, andrawis part of the defaultrehypePluginsarray.packages/streamdown/lib/markdown.ts—hasRehypeRaw()compares each plugin against the importedrehypeRawby identity to decide whether to addremarkEscapeHtml(the behavior from #330 / #331).
Because of the identity check, no bundler can drop it even for apps that pass their own rehypePlugins without raw. In our app (Vite production build of an Electron renderer, [email protected], attributed with source maps), this is about 234 KB of the initial chunk: parse5 ≈ 225 KB, hast-util-raw ≈ 9 KB, all dead code since we intentionally leave raw HTML out and show it as text.
Constraint
raw is on by default, so simply removing the import would change the default rendering of HTML. Whatever the fix is, the default <Streamdown> should presumably keep its current behavior.
Possible directions (maintainers know better)
- Replace the identity check with something that does not need the
rehype-rawreference — e.g. a marker on the plugin (defaultRehypePlugins.rawbeing a small tagged wrapper defined next to the import), or an explicit option such ashtml: "render" | "escape". - Then make the default the only place that pulls
rehype-rawin, e.g. a lighter entry (streamdown/coreor similar) whose defaults omitraw, or astreamdown/rawsubpath that apps opt into.
We'd be happy to test a change against our build.
Environment
- streamdown 2.7.0 (also checked current
main: same imports) - Vite 7 / electron-vite, ESM, production build
- Lenguaje dominante
- TypeScript
- Estrellas
- 5.7k
- Forks
- 307
- Merge medio
- 1 d 22 h
- PR fusionados (30 d)
- 22
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de vercel/streamdown
-
`mode="static"` parses the whole document twice on mount (since the caret host in 2.7)Posiblemente ocupada @akhil9tiet la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
vercel/streamdown#673 · 3 comentarios · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
remend: unclosed `$$` in a table cell is closed on a new line when an earlier line has mathPosiblemente ocupada @orinnz la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
vercel/streamdown#652 ·
Los mantenedores suelen responder en 1 día
-
`data-*` and `aria-*` props passed to `<Streamdown>` are never set on its root elementPosiblemente ocupada @xyrolle la tomó hace 1 día. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 55/100
vercel/streamdown#675 ·
Los mantenedores suelen responder en 1 día
-
CJK autolink boundary handling keeps `**` in the URL when a bold URL is followed by CJK punctuationPosiblemente ocupada @mikemikimike la tomó hace 1 día. Abiertobug
Dificultad 3/5 Medio día Aptitud para principiantes 50/100
vercel/streamdown#672 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Animation: CJK paragraphs only animate their first batch, and queued words pop in when isAnimating turns falsePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
vercel/streamdown#669 ·
Los mantenedores suelen responder en 1 día
Todos los issues de vercel/streamdown
Issues similares
-
bnv-manager-v2: accept_invite creates the Mailcow domain admin before the commitPosiblemente ocupada @myOmikron la tomó hoy. Abiertobug ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Windows: mio 1.2.3 named-pipe use-after-free panics the native IPC broker and hangs every toolAbiertoplatform:windows tool triaged wontfix
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
nicolettas-muggelbude/RechnungsFee#448 ·
Los mantenedores suelen responder en 1 día
-
Android bug feature/error-tracking react-native team/error-tracking
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PostHog/posthog-js#5310 · 1 comentario ·
Los mantenedores suelen responder en 1 día