npm sitemap 5.0.0
Streams

latest releases: 8.0.0, 7.1.2, 7.1.1...
5 years ago

Streams

This release is heavily focused on converting the core methods of this library to use streams. Why? Overall its made the API ~20% faster and uses only 10% or less of the memory. Some tradeoffs had to be made as in their nature streams are operate on individual segments of data as opposed to the whole. For instance, the streaming interface does not support removal of sitemap items as it does not hold on to a sitemap item after its converted to XML. It should however be possible to create your own transform that filters out entries should you desire it. The existing synchronous interfaces will remain for this release at least. Do not be surprised if they go away in a future breaking release.

Sitemap Index

This library interface has been overhauled to use streams internally. Although it would have been preferable to convert this to a stream as well, I could not think of an interface that wouldn't actually end up more complex or confusing. It may be altered in the near future to accept a stream in addition to a simple list.

Misc

  • runnable examples, some pulled straight from README have been added to the examples directory.
  • createSitemapsIndex was renamed createSitemapsAndIndex to more accurately reflect its function. It now returns a promise that resolves to true or throws with an error.
  • You can now add to existing sitemap.xml files via the cli using npx sitemap --prepend existingSitemap.xml < listOfNewURLs.json.txt

Breaking Changes

  • Dropped support for mobile sitemap - Google appears to have deleted their dtd and all references to it, strongly implying that they do not want you to use it. As its absence now breaks the validator, it has been dropped.
  • normalizeURL(url, XMLRoot, hostname) -> normalizeURL(url, hostname)
    • The second argument was unused and has been eliminated
  • Support for Node 8 dropped - Node 8 is reaching its EOL December 2019
  • xslURL is being dropped from all apis - styling xml is out of scope of this library.
  • createSitemapIndex has been converted to a promised based api rather than callback.
  • createSitemapIndex now gzips by default - pass gzip: false to disable
  • cacheTime is being dropped from createSitemapIndex - This didn't actually cache the way it was written so this should be a non-breaking change in effect.
  • SitemapIndex as a class has been dropped. The class did all its work on construction and there was no reason to hold on to it once you created it.
  • The options for the cli have been overhauled
    • --json is now inferred
    • --line-separated has been flipped to --single-line-json to by default output options immediately compatible with feeding back into sitemap

Don't miss a new sitemap release

NewReleases is sending notifications on new releases.