fix(deps): update dependency sitemap to v10 #82
No reviewers
Labels
No labels
dependencies
automerge
bug
dependencies
duplicate
help wanted
invalid
lang
rust
migrations
opencode
question
security
type
documentation
type
enhancement
type
maintenance
type
refactor
vulnerability
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
Personal/martials.no!82
Loading…
Reference in a new issue
No description provided.
Delete branch "renovate/sitemap-10.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
^9.0.0→^10.0.0Release Notes
ekalinin/sitemap.js (sitemap)
v10.0.0Compare Source
[BREAKING CHANGES]
Dropped CommonJS build — the package is now ESM-only
require('sitemap')is no longer supported on Node versions withoutbuilt-in
require(esm). Thedist/cjsbuild, therequireexport condition,and
tsconfig.cjs.jsonare all gone;exportsnow resolves todist/index.jsfor every consumer. Migrate to
import { SitemapStream } from 'sitemap'.consumers can still load this package through
require(esm), which landedunflagged in 22.12; the floor is 22.22.1 to match the development toolchain.
dist/esm/*anddist/cjs/*todist/*. Thebinentry is nowdist/cli.js.simpleSitemapAndIndexdefaults to 45,000 URLs per sitemaplimitdrops from 50,000 to 45,000, the same defaultSitemapAndIndexStreamand the CLI already use (DEFAULT_SITEMAP_ITEM_LIMIT).The headroom keeps rich entries (images, video, news) under the 50MB
uncompressed file-size limit. A 50,000-URL input now produces two sitemap
files instead of one; pass
limit: 50000to keep the old output.SitemapStreamwrites an empty sitemap instead of erroringSitemapStreamwithout writing any items now produces awell-formed empty
<urlset>instead of failing withEmptySitemap(#394, #421). This matches
SitemapIndexStream, which already wrote an empty<sitemapindex>.EmptySitemapis still exported but deprecated and nolonger thrown. An empty
<urlset>does not pass strictsitemap.xsdvalidation, which requires at least one
<url>; search engines accept it.One
loggeroption across the library;xmlNSrenamed toxmlnsSitemapStream,SitemapIndexStream,SitemapAndIndexStreamandsimpleSitemapAndIndexaccept the sameloggeroption the parsers alreadyhad (#348). Validation warnings that went straight to
console.warnnow gothrough it. Pass
falseto silence. TheLoggertype is now exported.errorHandler(andso the logger) like every other validation error, instead of a hardcoded
console.warn. The warning text is now the error's name and message, which starts withthe item's URL. Under
ErrorLevel.THROWa customerrorHandlerreceivesthese errors too, like every other validation error; the default handler
still throws.
SitemapStreampropertyxmlNSis nowxmlns, matching the optionname (#300).
xmlNSstill works as a deprecated alias.SitemapStream.errorHandleris always set now; it defaults toa handler that warns through
logger.Both XML parsers share one error store and entry cap
XMLToSitemapItemStreamandXMLToSitemapIndexStreamnow extend one internalbase class, so they report errors and cap entries the same way.
XMLToSitemapIndexStream.erroris a read-only getter for the first error(
errors[0], ornull). Assigning to it now throws aTypeErrorin strictmode. The index parser also gains the
errorsarray (capped atLIMITS.MAX_PARSER_ERRORS) anderrorCount, where it previously kept onlythe first error.
XMLToSitemapItemStreamreports a sitemap with more than 50,000<url>entries once, instead of logging and recording an error for every dropped
entry, so
errorCountand the log no longer grow with the overflow. Itgains the index parser's
maxEntriesoption,entryCountproperty and'maxEntriesExceeded'event, and anerrorgetter.urlCountstill worksas a deprecated alias for
entryCount.parseSitemapstill resolves withthe first 50,000 items, but it now stops reading once the cap is crossed
and destroys the source stream, as
parseSitemapIndexalready did.when the input ends), like any other malformed XML. Before, the
unfinished entry was dropped silently.
parseSitemapandparseSitemapIndexreject in that case, andparseSitemapnow alsorejects when the source stream fails instead of never settling.
<loc>or<lastmod>are nowlogged as one message, the same text recorded in
errors. The recordedlastmod error now reads
Invalid lastmod date format in sitemap index: ….SitemapAndIndexStreamdestroys itself on errorgetSitemapStreamthrows or returns aninvalid tuple,
SitemapAndIndexStreamnow destroys itself and emits theerror once. It used to emit the error without stopping, so the same failure
could be emitted twice, and a
getSitemapStreamfailure was followed by ageneric
No sitemap stream availableerror. Code that listened forerrorand kept writing now gets write-after-destroy errors instead.
sitemap --index --gzipnames sitemapssitemap-N.xml.gz--gzip,sitemap --indexnow writes each sitemap tositemap-N.xml.gzand lists that URL in the index, as
simpleSitemapAndIndexalready did. Itused to write gzipped data to
sitemap-N.xmland index it under that name,so crawlers fetched gzip bytes from a
.xmlURL. Update scripts that uploador serve
sitemap-*.xmlafter a gzipped run.SitemapStreamreports item errors as stream errorsSitemapStreamandSitemapItemStreamnow report a failure on an itemthrough the stream:
write()no longer throws, and the stream emitserrorand is destroyed. This covers an invalid item atErrorLevel.THROW, an itemnormalizeURLrejects (such as an invalidlastmod), and an item that can't be serialized (such as a non-stringvideo attribute at
ErrorLevel.SILENT). Before, the error was thrown outof
write(), so a piped source crashed the process with an uncaughtexception. Code that wrapped
write()intry/catchmust listen forerrorinstead, or usepipeline().SitemapStreamchecksxmlns.customin its constructor, so an invalidcustom namespace now throws from
new SitemapStream()instead of from thefirst
write().SitemapStreamserializes each item itself instead of piping it through aninternal
SitemapItemStream, so it now outputs one chunk per item. The XMLis unchanged.
Stricter
priorityand alternate-link validationpriorityofNaNis now reported as aPriorityInvalidError: itthrows at
ErrorLevel.THROWand warns atWARN. It used to skipvalidation and write
<priority>NaN</priority>at every level.langorhreflangis now reported as the newInvalidLinkHreflangerror atWARNandTHROW, and dropped from theoutput at
WARNandSILENT.SitemapItemStream, which doesn'tvalidate, drops it too, with no warning. Every level used to fail with a
TypeErrorfrom the XML writer. Writing the link withouthreflangwouldproduce the
androidLinkmarkup, which parses back asandroidLink.Error classes are exported by name;
UndefinedTargetFolderremovedindex.tslists the error classes explicitly instead ofexport * from './lib/errors.js', like the public types, so a new errorclass is public only once it is added there.
UndefinedTargetFolderis removed. Nothing has thrown it since 7.0.0,which removed
createSitemapsAndIndex, its only user.Changed
util.parseArgsinstead ofthe
argpackage, which is no longer a dependency (#471). Unknown optionsand a non-integer
--limitnow print a message and exit with code 2 insteadof throwing an uncaught error.
thresholds moved from
jest.config.cjsinto thetest:coveragescript and areenforced in CI by a dedicated job.
and typechecking run once rather than on every matrix leg.
<loc>validation in the sitemap parser:XMLToSitemapItemStreamnow validates
<loc>values with the samevalidateURLused by the sitemapindex parser, adding a URL-parseability check on top of the existing length
and protocol checks. A malformed URL that passed the old checks but fails
new URL()is now dropped with a warning (or throws underErrorLevel.THROW). Warn/error messages for invalid<loc>values changed tothe
Invalid URL in sitemap: …form.validateURLthrowsInvalidURLError, a new subclass ofInvalidHostnameError(soinstanceof InvalidHostnameErrorstill matches).Its message reads
Invalid URL "…": …instead ofInvalid hostname "…": …,and it shows at most the first 100 characters of the offending value.
validateSMIOptions: a videoduration,ratingorview_countthat isNaN,Infinityor otherwise non-numericis now reported as invalid (and throws under
ErrorLevel.THROW). Previouslyonly out-of-range finite numbers were caught, so
NaNslipped through.XMLToSitemapItemStreamnow buffers each element's character data andhandles it once at the next tag boundary: text and CDATA chunks within one
element are joined, surrounding whitespace is trimmed for CDATA as it already
was for text, whitespace between chunks is kept (
Episode <![CDATA[One]]>now parses as
Episode One, notEpisodeOne), and stray character databetween elements is reported against
the enclosing element instead of overwriting the previous one. Character data
longer than
LIMITS.MAX_PARSER_CHAR_DATA_LENGTH(64 KiB) for one element isdropped with a warning.
text/cdataSAX handlers were collapsedinto one, and its inline bounds checks (priority, video duration/rating/view
count, ISO dates) now delegate to shared guards in
lib/validation.ts, withthe bounds defined once in
LIMITS.XMLToSitemapIndexStreamnow handles character data the same way: text andCDATA within one
<loc>or<lastmod>are joined and trimmed, straycharacter data is reported against the enclosing element, and values longer
than
LIMITS.MAX_PARSER_CHAR_DATA_LENGTHare dropped with a warning.Unhandled CDATA is now logged as
unhandled text for tag:instead ofunhandled cdata for tag:. Both parsers share one buffer,createCharDataBufferinlib/utils.ts.XMLToSitemapIndexStreamenforces the 50,000-entry spec limit itself.Entries past
LIMITS.MAX_SITEMAP_ITEM_LIMITare dropped with a single error(which throws under
ErrorLevel.THROW), and a newentryCountproperty countsevery
<sitemap>seen. Previously only theparseSitemapIndexwrapper cappedentries, so piping the stream directly had no limit.
parseSitemapIndexstillrejects an over-limit index and stops reading as soon as the limit is crossed,
but a
maxEntriesabove 50,000 no longer raises the limit. A newmaxEntriesstream option lowers the cap, or raises it (Infinityturns itoff) for callers that knowingly parse oversized indexes. When the cap is
crossed the stream emits
'maxEntriesExceeded', and logs the overflow onlyif nothing listens for that event, so
parseSitemapIndexrejects withoutalso logging.
maxEntries: 0is allowed (nothing is emitted, andparseSitemapIndexrejects on the first entry); a negative, fractional orNaNvalue is rejected, andparseSitemapIndexdestroys the source streambefore rejecting.
simpleSitemapAndIndexandSitemapAndIndexStreamwrap, suchas
Failed to write sitemap files: …or agetSitemapStreamfailure, nowcarry the original error as
cause.SaxParserStreamOptions, the shared base ofXMLToSitemapItemStreamOptionsand
XMLToSitemapIndexItemStreamOptions, is exported.LIMITSgains the bounds the validators use:MIN_PRIORITY,MAX_PRIORITY,PRIORITY_STRING_REGEX,MIN_VIDEO_DURATION,MAX_VIDEO_DURATION,MIN_VIDEO_RATING,MAX_VIDEO_RATINGandMIN_VIDEO_VIEW_COUNT.LIMITS.MAX_URL_ENTRIESis deprecated. Nothing reads it; the parsers capentries at
LIMITS.MAX_SITEMAP_ITEM_LIMIT(the same value), which theirmaxEntriesoption overrides.Fixed
priorityno longer crashesSitemapStreamwithitem.priority.toFixed is not a function(#393). A plain decimal stringsuch as
'0.5'or'.5'is converted to a number (hex, binary andexponent forms such as
'0x1'or'1e-1'are not), andSitemapItemLoose.prioritynow acceptsnumber | string. Any other value,including an empty string, is reported as a
PriorityInvalidErroratWARNandTHROW, and written as given atWARNandSILENT, like otherinvalid values.
isValidPriorityrejects non-numbers instead of coercingthem.
isValidYesNoaccepts only a wholeyes,Yes,YES,no,NoorNO.Its unanchored alternation used to accept any value that started with
YES,contained
NOoryes, or ended inno, such asNOPEormaybe-yes, sothe parsers and
validateSMIOptionslet those values through.XMLToSitemapItemStreamreports an invalidvideo:requires_subscription,video:family_friendly,video:liveorplayer_locallow_embedvalue as awarning and a parse error. It used to drop the value without a word. It also
trims whitespace around
allow_embed, as it already does for element text.validateSMIOptionschecksrequires_subscription,liveandplayer_loc:allow_embedas well asfamily_friendly, and reports an invalidvalue with the new
InvalidVideoYesNoerror.SitemapAndIndexStreamerrors withERR_STREAM_PREMATURE_CLOSEinstead ofhanging when a sitemap's write stream is destroyed before it finishes, at any
point in the sitemap. A
SitemapAndIndexStreamdestroyed during rotation nolonger opens another sitemap file once the current one has finished.
SitemapAndIndexStreamdestroys itself with the error when a sitemap's writestream fails while the sitemap is still open, such as
EACCESorEISDIRwhen opening the file. It used to crash the process with an unhandled
errorevent.simpleSitemapAndIndexnow rejects in that case.SitemapAndIndexStreamalso destroys the open sitemap and itswrite stream, so the file descriptor is released.
SitemapAndIndexStreamdestroys the streamsgetSitemapStreamreturned whenit rejects the tuple, instead of leaving their file open.
ErrorLevel.THROW,SitemapAndIndexStreamfails when the index rejects asitemap's index item, such as a non-http(s) URL. It used to drop the error,
writing the sitemap file without listing it in the index.
simpleSitemapAndIndexand the CLI connect each sitemap to its gzip and filestreams with
pipeline(), so a gzip failure fails the sitemap instead ofleaving the write stream open.
SitemapAndIndexStreamfails with the error, instead of leaving an unhandledpromise rejection, when writing the first item of a sitemap after rotation
throws.
ErrorLevel.THROW,SitemapIndexStreamno longer outputs a partial<sitemap><loc>element before it fails on an invalidlastmod.simpleSitemapAndIndexand the CLI validate each sitemap URL before theycreate its file, so a URL the index rejects no longer leaves an empty
sitemap file behind. They now fail on such a URL at every error level.
sitemap --indexprints a stream error and exits with code 1 instead ofcrashing with an unhandled
errorevent.sitemap --validateexits with code 1 when the sitemap is invalid and 2 whenvalidation cannot run (xmllint missing or not executable, or schema not
found). It used to exit 0 in every case, so scripts and CI could not detect a
failed validation. An xmllint that fails to start for a reason other than
ENOENT, such asEACCES, now rejectsxmlLint()with[error]aloneinstead of
[error, ''], so it is no longer reported as an invalid sitemap.sitemap --prependwrites every entry of the prepended sitemap, then the newURLs. Both sources were piped into one stream, so whichever ended first
ended the sitemap: a large prepended file was cut off after its first entries
and failed with a write-after-end error.
A prepended file with more than 50,000 URLs, the most a sitemap may hold,
now fails with exit code 1 instead of being silently truncated.
sitemap --parse,--prependand the default mode print a stream error,such as a parse error or a missing input file, and exit with code 1 instead
of crashing with an unhandled
errorevent. In those modes a reader thatcloses stdout early, such as
| head, is not treated as an error. In--indexmode it still is (exit code 1), because the sitemap files writtenso far are left incomplete.
xmlLint()andsitemap --validatefind the bundledschema/directorywhen the package is installed as a dependency. The lookup searched relative
to
process.cwd(), so outside this repository it threw a synchronous"Schema directory not found" error that crashed the CLI. It now walks up from
the module's own directory, and a missing schema rejects the promise instead
of throwing.
xmlLint()destroys aReadableinput if xmllint exits or fails to startbefore reading all of it, so the source no longer stays paused with its file
descriptor open.
SitemapStreamandSitemapIndexStreamcheck their publiclevelfieldwhen they warn, so changing
levelafter construction takes effect again,as it did in 9.0.1.
@types/nodeis a runtime dependency again, as it was in 9.0.1, because thepublished type definitions import Node's stream types. The range now covers
every supported Node major (
^22 || ^24 || ^26), so npm can share aconsumer's own copy.
XMLToSitemapItemStreamnow treats CDATA sections as ordinary character datain every tag. Previously only the 8 tags from issue #445 (
loc,image:loc,video:title,video:description,news:name,news:title,image:caption,image:title) accepted CDATA; content in any other tag waslogged as unhandled. See
docs/adr/0001-cdata-is-character-data.md.xmlLint()no longer probes for the binary withwhich, which is not acommand on Windows and made validation report
XMLLintUnavailablethere evenwhen xmllint was installed. A missing binary is now detected via
ENOENTfromthe spawn itself, which is correct on every platform.
dist/andschema/(via afilesallowlist), so maintainer files such as
CLAUDE.mdno longer ship toconsumers (#480).
package.jsonby walking up from its own directory instead ofa hardcoded relative depth, so
--versionno longer breaks when the buildoutput layout changes.
sitemap --indexreports an invalid--limitwith the same message assimpleSitemapAndIndex'sInvalidLimitError, prefixed with--limit:, andaccepts only decimal digits: forms such as
1e3,0x10or250arerejected rather than converted.
InvalidLimitErrorsays the limit must be an integer between 1 and 50000,rather than a number, since fractional limits are rejected too.
XMLToSitemapItemStreamno longer adds an empty{ url: '', lang: '' }entry to
linksfor anxhtml:linkthat lacksrelorhrefor has anunsupported
rel. It still warns and records a parse error.XMLToSitemapItemStreamandXMLToSitemapIndexStreamcopy their optionsinstead of setting
objectModeon the object the caller passed in.Documentation
api.mdnow documentsXMLToSitemapIndexStreamandparseSitemapIndex, andthe 50,000-entry and error-array caps the parsers enforce.
api.mdno longer claimssimpleSitemapAndIndexaccepts an absolutedestinationDir; absolute paths have been rejected since 9.0.1 (#478).parseSitemapandparseSitemapIndexuseimportandcurrent APIs instead of
require()and the removedcreateSitemap.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate CLI.