Saxon-JS 2.2

By Norm Tovey-Walsh on May 11, 2021 at 12:00p.m.

Saxon-JS 2.2 has been published on and to the npm registry!

This is a maintenance release that fixes a few bugs. The big one, to my mind, is resolving the “global object” bug in Node.js. Previous releases of Saxon-JS always created a global object named “SaxonJS”. This isn’t best practice on Node.js and interfered with some platforms like Electron and Webpack.

Starting with 2.2, on Node.js, the global object no longer gets created. If you’ve consistently used

const SaxonJS = require('saxon-js');

to load Saxon-JS, you’ll be fine. If you’ve used some other name for the object, make sure that you refer to Saxon-JS exclusively by that name. For example:

const sjs = require('saxon-js');
const six = sjs.XPath.evaluate("3+3");
console.log(`six = ${six}`)

We fixed a few other bugs as detailed in the change history. Thanks to everyone who took the time to report them!