Repository navigation
The first stable 3.x release, now latest on npm. The 2.x line stays maintained on the v2 branch for bug and security fixes (npm install mapsite@2).
npm install mapsiteChangelog
The constructor, option names, run, fromBuffer and the { type, urls, errors }
result are unchanged. The internals were rewritten; see "Upgrading from 2.x" in the
README for the full list of differences.
Fixed
- Works on Bun: redirects are followed internally instead of via
Dispatcher.compose. proxyworks on Bun, whose built-inundiciignoredProxyAgentand sent
requests directly; proxied requests now use Bun'sfetchproxyoption.- A
Content-Typeheader with several comma-joined values is accepted if any is allowed.
Known limitations
- On Bun,
timeoutis not enforced andclose()does not close connections:
Bun's built-inundiciignores them.
Breaking
typereports the root document: a sitemap index is"index"(2.x returned
whichever document finished last).- Removed the
debugoption,SitemapParser.getLinesFromText, and the
currentDepth,currentRetryandmaximumDepthproperties. maximumRetriesdefaults to1regardless of other options (2.x used3only
without an options object) and accepts0. Only transient failures are retried,
with exponential backoff; 4xx responses other than 408, 425 and 429 are not.- Content types are matched exactly instead of by substring.
- Invalid options throw a
TypeErrornaming the option instead of aZodError. - Pages and sitemaps seen more than once are skipped; pages come back in document
order. - Documents over 50 MiB (compressed or decompressed) are rejected; see
maximumResponseSize. <loc>is read only as a child of<url>or<sitemap>.
Added
entrieson the result, behind theincludeEntriesoption (defaultfalse):lastmod,changefreq,priorityand hreflang
alternatesnext to each URL.discover(site)finds sitemaps throughrobots.txt(falling back to
/sitemap.xml).stream(url)yields entries as they are found, and stops fetching when you stop
iterating.AbortSignalsupport on every method, andclose()/await using.- Plain-text sitemaps, RSS and Atom feeds.
- Redirects are followed, and gzip is detected from the data rather than the
content type. - Options
concurrency,maximumResponseSizeandretryDelay. proxyMode: 'fallback': fetch directly and only use the proxy for sites that
answer 401, 403 or 429.blockPrivateAddresses: refuse direct connections to non-public addresses,
including through redirects and DNS, for crawling user-supplied URLs.- ESM and CommonJS builds with an
exportsmap.
Changed
- Rewrote the crawler and HTTP layer; sitemaps are fetched concurrently without the
fixed three-at-a-time batches and delays. - Parsing uses
htmlparser2instead of Cheerio and regular expressions;
cheerioandzodare no longer dependencies. - Tests exercise the public API against local servers; strict TypeScript.