Releases: ZLouisMiguel/hint-errors
Releases · ZLouisMiguel/hint-errors
Release list
v1.3.1
Fixed
- Preserve existing
uncaughtExceptionandunhandledRejectionlisteners
instead of removing and manually replaying them. Node now dispatches each
event normally, preserving listener identity,oncebehavior, and the
original rejection reason. - Write fatal diagnostics synchronously to stdout before other process
listeners run, preventing an immediateprocess.exit()from truncating the
hint without mixing Node's raw stack trace into the output.
Changed
- Changed the project license from ISC to MIT and added the repository
LICENSE
file. - Changed the server entry point to flush its formatted error output and exit
instead of continuing after an uncaught exception. - Reordered overlapping hint rules so specific matches win before generic ones.
- Applied the shared color policy to package notices as well as error output.
Documentation
- Clarified how process listeners are preserved and when the synchronous
fatal-output write occurs.
v1.3.0
[1.3.0] - 2026-08-18
Added
addHint()extensibility API — consuming projects can now register
custom hints for their own error codes or Error subclasses without
forking the package:const { addHint } = require("hint-errors").
Custom hints default to "high" priority (checked before built-in hints)
and can opt into "low" priority (checked only as a fallback) via
addHint(entry, { priority: "low" }). Available from bothhint-errors
andhint-errors/server.- TypeScript declarations —
.d.tsfiles are now generated from the
existing JSDoc viatsc --emitDeclarationOnlyand published alongside
the package (dist/), so consumers get full type checking onaddHint()
and the underlying hint/error shapes with no@types/hint-errorspackage
needed. - Dual CJS/ESM entry points —
import "hint-errors"and
import { addHint } from "hint-errors"now work directly (also for
hint-errors/server), via thin.mjsshims that re-export the existing
CommonJS implementation. NocreateRequire()workaround needed in
"type": "module"projects.
v1.2.0
Added
- Production safety guard — both
index.jsandserver.jsnow disable themselves entirely whenNODE_ENV=production, registering no listeners at all. This closes a real reliability gap: a dev tool left in a production entry file could previously intercept uncaught exceptions in prod, including inserver.js, which is explicitly designed to keep the process alive after an error — masking failures instead of surfacing them. SetHINT_ERRORS_FORCE=1to opt back in deliberately. - Listener chaining —
uncaughtException/unhandledRejectionlisteners registered before hint-errors loads (e.g. Sentry, Winston, APM agents) are now snapshotted and re-invoked after hint-errors' own handler runs, regardless of require order. Previously, whichever tool registered first won the race to run — if an APM tool that callsprocess.exit()won that race, hint-errors' formatted hint might never print. No listener is dropped; this only guarantees ordering. NO_COLOR/FORCE_COLOR/ TTY-aware color output — ANSI color codes are now only emitted when stdout is an interactive TTY, honoring theNO_COLORstandard (no-color.org) and theFORCE_COLORoverride. Previously, color codes were written unconditionally, producing raw escape-code noise when output was piped into CI logs or a log aggregator (CloudWatch, Datadog, etc).- Parenless and
file://stack frame parsing (Tier 1 ESM support) —parser.jsnow also matches top-level V8 frames without a wrapping function name (at file.js:12:5, common in native ESM and top-levelawaitcontexts) and normalizesfile://URL frames (native ESM) back to a plain filesystem path vianode:url'sfileURLToPath. Previously these frame shapes silently fell through tofile: null.
Documentation
- README now documents the production safety default, listener-chaining compatibility behavior, and the
NO_COLOR/FORCE_COLOR/TERMoutput controls.
Full Changelog: v1.1.3...v1.2.0
v1.1.3
Added
- Zero-dependency test suite (
test/run.js) thatnpm testnow runs. Covers the parser, hint matching, formatter, and both entry points (index + server).
Fixed
npm testfailed out of the box: thetestdirectory was gitignored andpackage.jsonpointed at a test script that did not exist. The.gitignoreentry and thetestscript now reference the real suite.formatter.js— a file path was shortened if it merely shared a textual prefix with the current working directory (e.g. cwdappand fileapple/x.js). Paths are now only shortened when the file actually lives inside cwd, checked on a path boundary.hints.js— removed two hint entries that could never match:UnhandledPromiseRejection(the rejection reason, never that literal string, reachesgetHint) and anasync-specific undefined-read regex (no thrown message can contain both "Cannot read" and "async").index.js— stdout output was truncated when piped (e.g.node script.js | cat) becauseprocess.exit(1)killed the process before buffered stdout flushed. The exit code is now set viaprocess.exitCodeand the event loop is left to drain, which Node.js docs recommend for exactly this reason.
v1.1.2
formatter.js— replaced block-style terminal output with a compact
key/value layout. Each field (error,message,location,hint) renders
on its own line with keys dim-colored and left-aligned to a fixed column width.
Multi-line hint values are indented to the same column so all values share a
consistent left edge. Divider lines and decorative icons removed.
v1.1.0
Added
server.js— opt-in server mode entry point viarequire('hint-errors/server').
Identical pipeline toindex.jsbut omitsprocess.exit(1)so long-running
servers survive uncaught errors in individual request handlers without taking
down the entire processexportsfield inpackage.jsonexposing both.and./serveras valid
import paths so Node resolveshint-errors/servercorrectly- Console warning on server mode activation so silent error survival doesn't
go unnoticed during development
v1.0.0
Added
parser.js— extracts error type, message, file, and line number from raw
Node.jsErrorobjects. Filters Node internals andnode_modulesfrom the
stack trace so only user code frames are surfacedhints.js— 40+ hint entries covering TypeErrors, ReferenceErrors,
SyntaxErrors, RangeErrors, URIErrors, AssertionErrors, file system errors
(ENOENT,EACCES,EPERM,EEXIST,EISDIR,ENOTDIR,ENOTEMPTY,
EMFILE), network errors (ECONNREFUSED,ECONNRESET,ETIMEDOUT,
EADDRINUSE,EADDRNOTAVAIL,EPIPE,EAI_AGAIN,EHOSTUNREACH),
and async/Promise errorsformatter.js— renders structured error output to the terminal in three
sections: error type and message, file location and line number, and
developer hint. Zero-dependency colorization via raw ANSI codesindex.js— entry point that hooks intoprocess.on('uncaughtException')
andprocess.on('unhandledRejection')to intercept all unhandled errors
automatically onrequire- Full JSDoc documentation across all source files
- Windows-compatible path handling in
formatter.js