Repository navigation
Release 3.0.0
·
33 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Breaking: migrating from 2.x
Most apps upgrade without code changes. Check these if you rely on them:
- Network failures throw
LinkpeekErrorwith codeFETCH_FAILED(the original error iscause). Code that checkederror instanceof TypeErrorshould checkerror.code === "FETCH_FAILED". Caller aborts are still rethrown unchanged. - New
LinkpeekErrorCodememberFETCH_FAILED. Exhaustiveswitchstatements over error codes need a case for it. <title>now beats JSON-LD fortitle, and JSON-LD fields come from the page's main entity. Some titles change, usually for the better: a site-wideOrganizationname no longer becomes the title, and anOrganization-only page no longer fillstitle/descriptionfrom it.parseHTML(html, baseUrl)throwsINVALID_URLwhenbaseUrlis not an absolutehttp(s)URL, instead of returning made-upexample.comvalues.- Single-label and internal hosts are private:
http://intranet/,*.internal,*.local,*.localdomain,*.intranet,*.private,*.corp,*.home,*.lan,*.home.arpaandlocalhost.variants are blocked unlessallowPrivateIPs: true. maxRedirectsandtimeoutcover the wholepreview()call, including a meta-refresh hop.maxRedirects: 0therefore also stops meta refresh.PreviewResulthas a new required field,truncated. Code that constructs result objects (mocks, fixtures) must add it.- A relative
response.urlfrom a customfetchis resolved against the request URL and validated like any redirect target.
Fixed
- Keep reading
<head>after a<noscript>tracking pixel (Meta Pixel) or an inline<svg>sprite. Fast mode used to treat them as the start of<body>and drop later Open Graph tags. - Prefer
<title>over JSON-LD fortitle, and take JSON-LD fields from the page's main entity only, so a site-wideOrganizationname no longer becomes the title and fields from unrelated entities no longer mix. JSON-LD@idreferences are followed. parseHTML()throwsLinkpeekErrorINVALID_URLfor a base URL that is not absolutehttp(s), instead of inventing anexample.comsite name, favicon and canonical URL.isPrivateHost()normalises hosts likefetch()does, catching2130706433,0x7f000001,127.1and0177.0.0.1, and blocks internal names:*.internal(includingmetadata.google.internal),*.home.arpa,localhost.variants and single-label hosts.- Validate the final
response.urlreported by a customfetchthat followed redirects itself. - An unknown
Content-Typecharset label (charset=bogus) falls through to the<meta charset>prescan. timeoutandmaxRedirectscover the wholepreview()call, including the meta-refresh hop.- Trim and collapse whitespace in text fields; blank values (a whitespace-only
og:title) count as missing. - Sniff HTML when
Content-Typeis missing, keep the firstrel=canonicalandimage_srclike every other field, and accept meta refresh written as0; https://…. - Fall back to the JSON-LD
WebPagedescription when the main entity has none (Yoast and WordPress graphs), and prefer typed@graphentities over an untyped wrapper. - Check a custom
fetch'sresponse.urlonce: a URL that only differs by normalisation or fragment is not resolved a second time. - Wait for a UTF-8 BOM split across stream chunks before sniffing, and do not report
truncatedwhen a body ends exactly atmaxBytes.
Added
resolveHostoption: an opt-in DNS check on the first request and every redirect hop, with no new dependency.FETCH_FAILEDerror code: network and DNS failures throwLinkpeekErrorwith the original error ascause. Previously they propagated as rawTypeErrors.truncatedresult field:truewhenmaxBytescut the response before the end of<head>.- JSON-LD
WebSitename as asiteNamefallback, scalable (sizes="any"/SVG) favicons ranked above small raster icons, andapple-touch-icon-precomposed. - Benchmark fixtures for a head with more than 30 kB of inline CSS/JS and for a head pixel snippet.
Docs and website
- New documentation site (Next.js + Fumadocs) with a live preview demo, benchmarks, five library comparisons, framework guides (Next.js, React, Cloudflare Workers, Express, AI agents),
llms.txt, Markdown versions of every page and a ready-made task for coding agents at/prompt.md. - New brand: two eyes peeking over the orange
<head>band.