npm / sitemap
sitemap
What changed in sitemap 5 to 10, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
55 breaking11 security3 deprecations26 new APIs and options8 behavior and defaults11 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initsitemap 1043 changes
Breaking changes 18
validateURL now throws InvalidURLError, a subclass of InvalidHostnameError, with a URL-specific message.
The validator accepts only whole yes, Yes, YES, no, No or NO values.
Parser character data longer than 64 KiB for one element is dropped with a warning.
The required Node.js version is now >=22.22.1, previously >=20.19.5.
Truncated XML now rejects, and source-stream failures reject instead of leaving the promise unsettled.
NaN is now reported as PriorityInvalidError, throwing at ErrorLevel.THROW and warning at WARN.
The default limit drops from 50,000 to 45,000 URLs per sitemap; pass limit: 50000 to keep the old output.
The package is ESM-only; the CommonJS build and require export condition are removed. Migrate to import syntax.
Gzipped sitemap files are now named sitemap-N.xml.gz, and the index lists that URL.
The limit accepts only decimal digits; forms such as 1e3, 0x10 and whitespace-padded values are rejected with a consistent error message.
Custom namespace validation now happens in the constructor, so invalid values throw from new SitemapStream().
Item failures now emit a stream error and destroy the stream instead of throwing from write(); callers should listen for error or use pipeline().
The unused UndefinedTargetFolder error class is removed.
Non-numeric or non-finite video duration, rating and view_count values are now invalid.
The bundled schema is found relative to the installed module rather than the working directory, and a missing schema rejects the promise instead of throwing.
error is now a read-only getter for the first error; assigning to it throws a TypeError in strict mode.
The parser now validates <loc> values with validateURL and drops malformed URLs with a warning, or throws under ErrorLevel.THROW.
CDATA sections are treated as ordinary character data in every tag.
Deprecations 3
MAX_URL_ENTRIES is deprecated and unused; parsers cap entries at MAX_SITEMAP_ITEM_LIMIT instead.
The property is renamed from xmlNS to xmlns; xmlNS remains a deprecated alias.
urlCount remains available as a deprecated alias for entryCount.
New APIs and options 8
LIMITS now exports priority and video validation bounds and the priority string regular expression.
Sitemap streams and helpers accept the shared logger option; validation warnings use it, and false silences them.
The Logger type is now exported.
The shared base options type for the XML parser streams is now exported.
The parser enforces the 50,000-entry limit, supports a maxEntries option, and emits maxEntriesExceeded when the cap is crossed.
The index parser gains a capped errors array and errorCount, where it previously kept only the first error.
The item parser gains maxEntries, entryCount and the maxEntriesExceeded event, and stops reading after the cap is crossed.
The item parser caps entries by default and supports maxEntries to set the cap; overflow is reported once.
Behavior and default changes 5
A new error reports alternate links without lang or hreflang; such links are dropped at WARN and SILENT.
validateSMIOptions now reports invalid yes/no video fields with the new InvalidVideoYesNo error.
All entries from the prepended sitemap are written before new URLs; files with over 50,000 URLs fail with exit code 1.
Validation exits with code 1 for invalid sitemaps and code 2 when validation cannot run.
The stream serializes each item itself and outputs one chunk per item; the XML is unchanged.
Fixes and other changes 9
Invalid news and video attribute values now go through errorHandler, including under ErrorLevel.THROW with a custom handler.
Its message now says the limit must be an integer between 1 and 50000.
An index over the entry limit is rejected and reading stops once the limit is crossed; maxEntries above 50,000 no longer raises the wrapper limit.
Stream errors are printed and the command exits with code 1 instead of crashing with an unhandled error event.
Parse, prepend and default modes print stream errors and exit with code 1 instead of crashing; early stdout closure is not treated as an error in those modes.
On sitemap-stream errors or invalid getSitemapStream results, it now destroys itself and emits the error once.
priority now accepts number or string; plain decimal strings are converted to numbers, while other invalid values follow error-level handling.
Ending the stream without items now produces a well-formed empty <urlset> instead of failing with EmptySitemap.
Changing the public level field after construction now takes effect when the stream warns.
sitemap 926 changes
Breaking changes 6
Rejects absolute paths to prevent arbitrary file writes.
Enforces a 50,000 URL hard limit in the parser.
Parser and stream inputs now receive security validation and resource limits; invalid data may be rejected, including disallowed URL protocols, overlong strings, and excessive sitemap resources.
Direct imports of library files from ESM contexts require .js extensions; TypeScript adds these automatically.
Node.js >=20.19.5 is now required; Node.js 14, 16, and 18 are no longer supported.
npm >=10.8.2 is now required.
Security 4
Caps the parser error array at 100 entries to prevent memory DoS.
Escapes xslUrl in the stylesheet processing instruction to prevent XML injection.
A public security limits object is available, covering maximum URL length and sitemap, video, news, and image constraints.
XML generation adds safe attribute and element generation and protection against XML injection attacks.
New APIs and options 13
A public constant provides the default items per sitemap file: 45,000.
An allow/deny type guard is now part of the public API.
A price type guard is now part of the public API.
A resolution type guard is now part of the public API.
A change frequency type guard is now part of the public API.
A yes/no type guard is now part of the public API.
The SimpleSitemapAndIndexOptions interface is now exported.
A limit validation function is now part of the public API.
A path validation function is now part of the public API.
A public base path validation function is now part of the public API.
A URL validation function is now part of the public API.
An XSL URL validation function is now part of the public API.
An object containing regex validators for all sitemap fields is now part of the public API.
Behavior and default changes 2
Destroys source and parser streams immediately when the maxEntries limit is exceeded.
The package now declares module type, with dual ESM/CJS output and conditional exports; both ESM and CommonJS imports continue to work.
Fixes and other changes 1
The CLI remains ESM-only at this path.
sitemap 811 changes
Breaking changes 3
The parser now stops emitting items and emits an error when the 50,000 URL hard limit is exceeded, rather than merely logging a warning.
Node.js 12 support was dropped.
Errors are now propagated in SitemapAndIndexStream.
Security 7
Hardens xmllint against command injection.
Adds resource limits to prevent memory exhaustion.
Adds comprehensive validation for user inputs.
Blocks .. sequences to prevent path traversal.
Blocks javascript:, data:, and file: URLs.
Enhanced escaping prevents XML injection and XSS.
Validates XSL URLs to prevent XSS.
Fixes and other changes 1
Custom namespace validation now accepts namespace-qualified attributes such as xsi:schemaLocation, in addition to xmlns:prefix="uri".
sitemap 76 changes
Breaking changes 4
Stops emitting items when the 50,000 URL hard limit is reached, rather than only logging a warning.
Removed the deprecated API; use SitemapAndIndexStream or simpleSitemapAndIndex instead.
Dropped support for Node 10 and added support for Node 16.
Dropped the deprecated getSitemapStream option because it does not return a write stream.
New APIs and options 2
Accepts a maxEntries limit, defaulting to 50,000, and destroys source and parser streams immediately when the limit is breached.
Added an option to simplesitemap that lets users set the location of sitemap files hosted on the site.
sitemap 614 changes
Breaking changes 12
buildSitemapIndex was replaced by SitemapIndexStream.
The CLI no longer accepts multiple file arguments or a mixture of file and streams, except as part of a parameter such as prepend.
The TypeScript type for price:resolution is now more restrictive.
The TypeScript type for price:type is now more restrictive.
The parser now returns a sitemapItem array rather than a config object usable with the removed Sitemap class.
Values supplied to sitemap receive stronger validity checking.
The deprecated Sitemap class was removed.
The deprecated SitemapIndex class was removed.
SitemapIndexStream replaces buildSitemapIndex.
The TypeScript type for view_count is now exclusively a number.
The type was renamed to XMLToSitemapOptions.
This type replaces XMLToISitemapOptions.
New APIs and options 2
The library can accept a stream and automatically write both the index and the sitemaps.
You can turn off XML namespaces or add custom ones.
sitemap 514 changes
Breaking changes 12
The API now returns a promise instead of using a callback.
The cacheTime option is removed because it did not actually cache as written.
Gzip is now enabled by default; pass gzip: false to disable it.
Renames createSitemapsIndex; it returns a promise that resolves to true or throws with an error.
Support for mobile sitemaps has been dropped because the missing Google DTD breaks validation.
Node 8 is no longer supported.
Removes the unused second argument; the signature changes from normalizeURL(url, XMLRoot, hostname) to normalizeURL(url, hostname).
Replaces --line-separated; by default, output is immediately compatible with feeding back into sitemap.
The SitemapIndex class has been dropped; its work was completed during construction, so retaining an instance was unnecessary.
The streaming interface does not support removing sitemap items because it does not retain items after converting them to XML.
Core methods now use streams, making the API about 20% faster and using 10% or less of the memory.
xslURL is removed from all APIs because XML styling is out of scope.
New APIs and options 1
Adds the ability to prepend URLs to an existing sitemap.xml file through the CLI.
Behavior and default changes 1
The CLI now infers JSON input, so the --json option is no longer needed.