Releases: poppinss/youch
Releases · poppinss/youch
Update dependencies
Tag as latest after a stable beta being tested for more than a year
4.1.0 (2026-02-24)
Breaking Changes
- Switch from CommonJS to ESM. The package can no longer be
require()'d. - Switch from a default export to named exports.
- import Youch from 'youch' + import { Youch } from 'youch'
- The
Youchconstructor no longer accepts the error or request object. Instead, the error is passed directly totoHTML(),toJSON(), and the newtoANSI()methods.- const youch = new Youch(error, req) - const html = await youch.toHTML() - const json = await youch.toJSON() + const youch = new Youch() + const html = await youch.toHTML(error) + const json = await youch.toJSON(error)
- The HTTP request is no longer passed to the constructor. Pass it as an option to
toHTML()instead. The request must be a plain object withurl,method, andheadersproperties (not a Node.jshttp.IncomingMessage).- const youch = new Youch(error, req) - const html = await youch.toHTML() + const youch = new Youch() + const html = await youch.toHTML(error, { + request: { + url: req.url, + method: req.method, + headers: req.headers, + }, + })
- The
toJSON()return value is now aParsedErrorobject directly, instead of being wrapped inside{ error: {...} }.- const { error } = await youch.toJSON() - console.log(error.message) + const error = await youch.toJSON(error) + console.log(error.message)
- The
toHTML()method no longer accepts arbitrary template data. Use the structuredoptionsobject instead, which acceptstitle,cspNonce,ide,request,offset, andframeSourceBuffer.- await youch.toHTML({ cspNonce: 'abc123' }) + await youch.toHTML(error, { cspNonce: 'abc123' })
- The
preLinesandpostLinesconstructor options have been replaced byframeSourceBufferon each render method.- const youch = new Youch(error, req, { preLines: 8, postLines: 8 }) - const html = await youch.toHTML() + const youch = new Youch() + const html = await youch.toHTML(error, { frameSourceBuffer: 8 })
- Remove the
addLink()method. Custom links can no longer be added to the error page. Use the new template/component system to customize the HTML output instead. - Remove the
toggleShowAllFrames()method. Frame visibility is now handled by the new HTML UI.
Features
- Add
toANSI()method for rendering errors as ANSI-colored terminal output.const youch = new Youch() const output = await youch.toANSI(error) console.log(output)
- Add structured
MetadataAPI for attaching contextual information to error pages. Metadata is organized into groups, sections, and rows.const youch = new Youch() youch.metadata.group('Request', { Headers: [ { key: 'Host', value: 'localhost:3000' }, { key: 'Accept', value: 'text/html' }, ], Cookies: [ { key: 'session_id', value: 'abc123' }, ], })
- Add
useParser()for pre-processing errors before they are parsed.youch.useParser((source) => { // Normalize or transform the error before parsing return source })
- Add
useTransformer()for post-processing parsed errors.youch.useTransformer((error, source) => { // Mutate the ParsedError after parsing error.hint = 'Did you forget to install dependencies?' })
- Add
defineSourceLoader()for custom source code loading (e.g., remote files, bundled sources).youch.defineSourceLoader(async (frame) => { const contents = await fetchSource(frame.fileName) return { contents } })
- Add pluggable template/component system. Every section of the HTML output (
header,layout,errorInfo,errorStack,errorStackSource,errorCause,errorMetadata) can be replaced with a custom component.youch.templates.use('errorInfo', new MyCustomErrorInfo())
- Add IDE integration. Clicking file paths in the HTML output opens them in your editor. Configurable via the
ideoption ("vscode","sublime","phpstorm", etc.) or a custom URL format.await youch.toHTML(error, { ide: 'vscode' })
- Add
templates.injectStyles()for injecting custom CSS into the error page.youch.templates.injectStyles(':root { --surface-bg: #1a1a2e; }')
- Add dark mode support with automatic theme toggle in the HTML output.
- Export
BaseComponentclass for building custom template components. - Export
Metadataclass for standalone use.
What's Changed
- chore(deps-dev): bump standard from 12.0.1 to 13.0.2 by @dependabot-preview[bot] in #21
- chore(deps): [security] bump lodash from 4.17.11 to 4.17.14 by @dependabot-preview[bot] in #18
- chore(deps-dev): bump uglify-js from 3.4.9 to 3.6.0 by @dependabot-preview[bot] in #17
- chore(deps): bump mustache from 3.0.0 to 3.0.1 by @dependabot-preview[bot] in #16
- chore(deps-dev): bump supertest from 3.3.0 to 4.0.2 by @dependabot-preview[bot] in #15
- chore(deps): bump cookie from 0.3.1 to 0.4.0 by @dependabot-preview[bot] in #13
- chore(deps-dev): bump cz-conventional-changelog from 2.1.0 to 3.0.1 by @dependabot-preview[bot] in #22
- chore(deps-dev): bump cz-conventional-changelog from 3.0.1 to 3.0.2 by @dependabot-preview[bot] in #23
- chore(deps-dev): bump standard from 12.0.1 to 13.1.0 by @dependabot-preview[bot] in #24
- chore: add types by @henriquepw in #26
- Install @types/stack-trace by @peterp in #30
- chore(deps): bump ini from 1.3.5 to 1.3.7 by @dependabot[bot] in #31
- [Snyk] Upgrade mustache from 4.0.1 to 4.1.0 by @snyk-bot in #32
- [Snyk] Upgrade mustache from 4.1.0 to 4.2.0 by @snyk-bot in #34
- chore(deps): bump hosted-git-info from 2.8.8 to 2.8.9 by @dependabot[bot] in #36
- fix: frames not being filtered on page load by @OmgImAlexis in #41
- fix: add
codeContextproperty to types by @Julien-R44 in #43 - fix: normalize all frame
filePathto posix format by @Julien-R44 in #46 - fix: detect node modules frames by @Julien-R44 in #47
- Fix type of the argument for
toHTMLmethod by @yorch in #51 - Fix preview width if stack rows are too wide by @dunhamjared in #54
- fix: update template exports with the correct path by @ahce in #59
- feat: add event handlers of HTML through
addEventListenerby @AylenHoz in #62 - build: allow node.js 18 in
enginesby @pi0 in #69 - Adjust HTML styles for small screens by @AylenHoz in #67
- fix: Add or execute
DOMContentLoadedevents based on document state by @AylenHoz in #65 - Add @poppinss/colors dependency to satisfy Yarn PnP requirements by @robigan in #71
- feat: add copy button for copying error name + message by @danielroe in #76
- fix - Support errors without stack trace and move scripts to the body end by @AylenHoz in #77
- fix(template): wrong scollbar color when page and browser theme mismatch by @L33Z22L11 in #80
- fix: Adjust styles for devices with small screens by @AylenHoz in #82
- fix: Escape HTML in error content by @AylenHoz in #83
- feat: add stack trace to copy button by @atinux in #86
New Contributors
- @dependabot-preview[bot] made their first contribution in #21
- @henriquepw made their first contribution in #26
- @peterp made their first contribution in #30
- @dependabot[bot] made their first contribution in #31
- @snyk-bot made their first contribution in #32
- @OmgImAlexis made their first contribution in #41
- @Julien-R44 made their first contribution in #43
- @yorch made their first contribution in #51
- @dunhamjared made their first contribution in #54
- @ahce made their first contribution in #59
- @AylenHoz made their first contribution in #62
- @pi0 made their first contribution in #69
- @robigan made their first contribution in #71
- @danielroe made their first contribution in #76
- @L33Z22L11 made their first contribution in #80
- @atinux made their first contribution in #86
**Full Changel...
Escape HTML in error context and copy error with complete stack trace
4.1.0-beta.14 (2026-02-12)
Bug Fixes
Features
What's Changed
- fix: Escape HTML in error content by @AylenHoz in #83
- feat: add stack trace to copy button by @atinux in #86
New Contributors
Full Changelog: v4.1.0-beta.13...v4.1.0-beta.14
Release 4.1.0-beta.13
4.1.0-beta.13 (2025-11-18)
Bug Fixes
Bug fixes and replace cookie package with cookie-es
4.1.0-beta.12 (2025-11-03)
Bug Fixes
Features
What's Changed
- fix - Support errors without stack trace and move scripts to the body end by @AylenHoz in #77
- fix(template): wrong scollbar color when page and browser theme mismatch by @L33Z22L11 in #80
New Contributors
- @L33Z22L11 made their first contribution in #80
Full Changelog: v4.1.0-beta.11...v4.1.0-beta.12
Add copy button to copy the error message
4.1.0-beta.11 (2025-07-30)
Bug Fixes
- rename jsFile property to scriptFile (94358df)
Features
- add copy button for copying error name + message (#76) (bfe0366)
- add logos (781e496)
- copy button styling improvements (d3b5cf4)
- mute copy button icon default color (a974f0f)
What's Changed
- feat: add copy button for copying error name + message by @danielroe in #76
New Contributors
- @danielroe made their first contribution in #76
Full Changelog: v4.1.0-beta.10...v4.1.0-beta.11
Update dependencies
4.1.0-beta.10 (2025-07-04)
Full Changelog: v4.1.0-beta.9...v4.1.0-beta.10
Fix CSP issue
Add missing `@poppinss/colors` dependency
4.1.0-beta.8 (2025-05-28)
What's Changed
New Contributors
Full Changelog: v4.1.0-beta.7...v4.1.0-beta.8
Mobile view styling fixes
4.1.0-beta.7 (2025-04-09)
Bug Fixes
- Add or execute
DOMContentLoadedevents based on document state (#65) (e136cb8) - Adjust HTML styles for small screens (#67) (468e628)
What's Changed
- Adjust HTML styles for small screens by @AylenHoz in #67
- fix: Add or execute
DOMContentLoadedevents based on document state by @AylenHoz in #65
Full Changelog: v4.1.0-beta.6...v4.1.0-beta.7