Skip to content

v4.0.0

Compare
Choose a tag to compare
@rgrove rgrove released this 26 Sep 00:13
· 39 commits to main since this release
1946e02

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 your import and require 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 the parseXml() 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 at dist/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 a parseXml() global.

    -<script src="https://unpkg.com/@rgrove/parse-xml@3.0.0/dist/umd/parse-xml.min.js"></script>
    +<script src="https://unpkg.com/@rgrove/parse-xml@4.0.0/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.