Repository navigation
A rewrite of @hyperjump/browser. The documentation is now at https://hyperjump.io/browser/.
What's new
- Hyperjump sessions. A session holds its configuration and fetches the way a web browser does. Requests belong to it, the way a page load's do. See Hyperjump sessions.
- Safe with documents you don't control. A session fetches only the URLs its
allowRetrievalallows, and headers like credentials go only to the URLs they're for. See What a session can fetch. - A stack of layers. Each request goes through layers you choose, like an RFC 9111 HTTP cache and a scheduler, and ends at a transport chosen by URL scheme. Write your own layers. See Layers.
- Selectors and walks.
jrefSelect,jrefVisit, andjrefFindfind values in a document and follow only the references they need. See Read values. - JSON and JRef parsers with positions. They never throw, recover from syntax errors, and give every value its place in the text. They work as unified plugins too. See Parse JSON and JRef.
- Registries. A session answers documents your app already has without fetching them. See Registries.
- Tracing. See what a session fetched and why, as a waterfall or a HAR file. See Tracing.
- JSON is built in, beside JRef.
Breaking changes
- A session fetches only the URLs its
allowRetrievalallows. By default, that's the working directory in Node.js and the page's origin in a browser. getisbrowse, which takes aHyperjumpsession and gives you a target instead of aBrowser.get(url, browser)isbrowse(session, url, { referencedFrom }).value,typeOf,has,step,iter,values,entries, andkeysare thejreffunctions, likejrefValueandjrefStep. They take the session first, return promises, and aren't curried.jrefValueonly gives you a string, number, boolean, or null. There's nolength.- Media type plugins are in the session's
mediaTypesinstead of global, and a plugin'sparsereturns a document whose root is a JSON AST node. - URI scheme plugins are fetchers in the transport, like
defaultTransport({ "urn:": fetcher(fn) }). - The error classes are gone. Errors have a
cause.code, like"ERR_HTTP_STATUS", and the URL that failed as theirurl. @hyperjump/browser/jrefis gone.fromJrefparses JRef into a tree.- It needs Node.js 24 or later, or Chrome 126, Edge 126, Firefox 131, or Safari 18.4 or later.
See Migrate from v1 for each change and what to do about it.