Open
Conversation
f2db7cc to
8851b6d
Compare
8851b6d to
fbbdeac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^7.1.2→^9.0.0Release Notes
ekalinin/sitemap.js (sitemap)
v9.0.1Compare Source
xslUrlin stylesheet processing instruction — special characters (&,",<,>) in the XSL URL are now escaped before being interpolated into the<?xml-stylesheet?>processing instructionXMLToSitemapItemStream— the parser now stops emitting items and emits an error when the limit is exceeded, rather than merely logging a warningXMLToSitemapItemStreamnow tracks a separateerrorCountand stops appending to theerrorsarray beyondLIMITS.MAX_PARSER_ERRORSdestinationDirpaths insimpleSitemapAndIndexto prevent arbitrary file writes — passing an absolute path (e.g./tmp/sitemaps) now throws immediately with a descriptive errorparseSitemapIndexnow destroys source and parser streams immediately when themaxEntrieslimit is exceeded, preventing unbounded memory consumption from large sitemap index filesv9.0.0Compare Source
This major release modernizes the package with ESM-first architecture, drops support for Node.js < 20, and includes comprehensive security and robustness improvements.
[BREAKING CHANGES]
Dropped Node.js < 20 Support
ESM Conversion with Dual Package Support
Package now uses
"type": "module"in package.jsonBuilt as dual ESM/CJS package with conditional exports
Import paths in ESM require
.jsextensions (TypeScript will add these automatically)Both ESM and CommonJS imports continue to work:
CLI remains ESM-only at
dist/esm/cli.jsBuild Output Changes
dist/esm/(wasdist/)dist/cjs/(new)dist/esm/index.d.ts(wasdist/index.d.ts)Node.js Modernization
node:protocol imports (node:stream,node:fs, etc.)pipelinefromnode:stream/promises(instead ofpromisify(pipeline))New Exports
The following validation functions and constants are now part of the public API:
Validation Functions (from
lib/validation.js):validateURL(),validatePath(),validateLimit(),validatePublicBasePath(),validateXSLUrl()isPriceType(),isResolution(),isValidChangeFreq(),isValidYesNo(),isAllowDeny()validators- object containing regex validators for all sitemap fieldsConstants (from
lib/constants.js):LIMITS- security limits object (max URL length, max items per sitemap, video/news/image constraints, etc.)DEFAULT_SITEMAP_ITEM_LIMIT- default items per sitemap file (45,000)New Type Export:
SimpleSitemapAndIndexOptionsinterface now exportedFeatures
Comprehensive Security Validation
Parser Security (#461): Added resource limits and comprehensive validation to sitemap index parser and stream
..sequences)Stream Validation (#456, #455, #454): Added comprehensive validation to all stream classes
>character)XML Generation Security (#457): Comprehensive validation and documentation in sitemap-xml
Robustness Improvements
Fixes
Refactoring
lib/constants.ts- single source of truth for all shared constantslib/validation.ts- centralized all validation logic and type guardsInfrastructure
Build System
tsconfig.json- ESM build (NodeNext module resolution)tsconfig.cjs.json- CJS build (CommonJS module)package.jsonwith"type": "commonjs"todist/cjs/Testing
.mjsformatDependencies
saxfrom ^1.2.4 to ^1.4.1@types/nodefrom ^17.0.5 to ^24.7.2Developer Experience
Upgrade Guide for 9.0.0
1. Update Node.js Version
Ensure you are running Node.js >=20.19.5 and npm >=10.8.2:
2. Update Package
3. Import Syntax (No Changes Required for Most Users)
Both ESM and CommonJS imports continue to work:
Note: If you're importing from the package in an ESM context, the module resolution happens automatically. If you're directly importing library files (not recommended), you'll need
.jsextensions.4. Existing Code Compatibility
ErrorLevel.WARNdefault behavior maintained5. TypeScript Users
tsconfig.jsonif needed to support ES2023dist/esm/index.d.ts(automatically resolved by package.json exports)6. New Optional Features
You can now import validation utilities and constants if needed:
v8.0.3: — Security PatchCompare Source
8.0.3 — Security Patch
xslUrlin stylesheet processing instruction — special characters (&,",<,>) in the XSL URL are now escaped before being interpolated into the<?xml-stylesheet?>processing instructionXMLToSitemapItemStream— the parser now stops emitting items and emits an error when the limit is exceeded, rather than merely logging a warningXMLToSitemapItemStreamnow tracks a separateerrorCountand stops appending to theerrorsarray beyondLIMITS.MAX_PARSER_ERRORSdestinationDirpaths insimpleSitemapAndIndexto prevent arbitrary file writes — passing an absolute path (e.g./tmp/sitemaps) now throws immediately with a descriptive errorparseSitemapIndexnow destroys source and parser streams immediately when themaxEntrieslimit is exceeded, preventing unbounded memory consumption from large sitemap index filesv8.0.2Compare Source
Bug Fixes
xsi:schemaLocationin custom namespaces - thanks @dzakkixsi:schemaLocation) in addition toxmlnsdeclarationsxmlns:prefix="uri"andprefix:attribute="value"patternsExample Usage
The following now works correctly (as documented in README):
Testing
Files Changed
2 files changed: 144 insertions, 5 deletions
v8.0.1Compare Source
SECURITY FIXES - This release backports comprehensive security patches from 9.0.0 to 8.0.x
Security Improvements
>character escaping, attribute name validation..sequences in file pathsInfrastructure
lib/constants.ts- Centralized security limits and constantslib/validation.ts- Comprehensive validation functionsBackward Compatibility
XMLToSitemapItemStream.errorgetter for backward compatibility (returnserrors[0])ErrorLevel.WARNbehavior unchangedDependencies Updated
sax: ^1.2.4 → ^1.4.1 (security updates)Files Changed
17 files changed: 2,122 additions, 245 deletions
Testing
v8.0.0Compare Source
v7.1.3: — Security PatchCompare Source
7.1.3 — Security Patch
xslUrlin stylesheet processing instruction (stylesheetIncludenow escapes&,",<,>)XMLToSitemapItemStream— parser stops emitting items instead of only logging a warningdestinationDirpaths insimpleSitemapAndIndexto prevent arbitrary file writesparseSitemapIndexnow accepts amaxEntrieslimit (default 50,000) and destroys source/parser streams immediately on breachConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.