v4.0.0
parse-xml has been rewritten in TypeScript. The API is unchanged, but the parseXml()
function is now a named export rather than a default export, which will require a small change to how you import it. See below for details.
This release also contains major performance improvements. Parsing is now 1.4x to 2.5x as fast as it was in 3.0.0, depending on the document being parsed.
Breaking Changes
-
The
parseXml()
function is now a named export rather than the default export. Please update yourimport
andrequire
statements accordingly:ESM
-import parseXml from '@rgrove/parse-xml'; +import { parseXml } from '@rgrove/parse-xml';
CommonJS
-const parseXml = require('@rgrove/parse-xml'); +const { parseXml } = require('@rgrove/parse-xml');
-
XML node classes (
XmlNode
,XmlDocument
,XmlElement
, etc.) are now named exports of the@rgrove/parse-xml
package rather than properties on theparseXml()
function. This is unlikely to affect most people since there aren't many reasons to use these classes directly.ESM
-import parseXml from '@rgrove/parse-xml'; -const { XmlNode } = parseXml; +import { parseXml, XmlNode } from '@rgrove/parse-xml';
CommonJS
-const parseXml = require('@rgrove/parse-xml'); -const { XmlNode } = parseXml; +const { parseXml, XmlNode } = require('@rgrove/parse-xml');
-
The minified browser-ready global bundle, which was previously located at
dist/umd/parse-xml.min.js
, is now located atdist/global.min.js
. This is unlikely to affect most people because this file isn't used by Node.js or by browser bundlers like webpack. It's only a convenience for people who want to load parse-xml directly from a CDN like unpkg with a<script>
element and use it via aparseXml()
global.-<script src="https://unpkg.com/@rgrove/[email protected]/dist/umd/parse-xml.min.js"></script> +<script src="https://unpkg.com/@rgrove/[email protected]/dist/global.min.js"></script>
-
Node.js 12 is no longer supported. Node.js 14 is now the minimum supported version.
Other Changes
-
Parsing performance has been improved significantly, and is now 1.4 to 2.5 times as fast as it was in 3.0.0, depending on the document being parsed.
-
The package now includes a browser-specific entry point that's optimized for minification. Using parse-xml with a minifying bundler like webpack or esbuild should now result in a smaller bundle.