Welcome! Log In Create A New Profile

Advanced

[nginx-announce] njs-0.7.11

Posted by Dmitry Volyntsev 
Dmitry Volyntsev
[nginx-announce] njs-0.7.11
March 09, 2023 06:44PM
Hello,

I'm glad to announce a new release of NGINX JavaScript module (njs).

Notable new features:
- XMLNode API to modify XML documents:
: const xml = require("xml");
: let data = `<note><to b="bar" a="foo">Tove</to><from>Jani</from></note>`;
: let doc = xml.parse(data);
:
: doc.$root.to.$attr$b = 'bar2';
: doc.$root.to.setAttribute('c', 'baz');
: delete doc.$root.to.$attr$a;
:
: console.log(xml.serializeToString(doc.$root.to))
: /* '<to b="bar2" c="baz">Tove</to>' */
:
: doc.$root.to.removeAllAttributes();
: doc.$root.from.$text = 'Jani2';
:
: console.log(xml.serializeToString(doc))
: /* '<note><to>Tove</to><from>Jani2</from></note>' */
:
: doc.$root.to.$tags = [xml.parse(`<a/>`), xml.parse(`<b/>`)];
: doc.$root.to.addChild(xml.parse(`<a/>`));
:
: console.log(xml.serializeToString(doc.$root.to))
: /* '<to><a></a><b></b><a></a></to>' */
:
: doc.$root.to.removeChildren('a');
:
: console.log(xml.serializeToString(doc.$root.to))
: /* '<to><b></b></to>' */


Learn more about njs:

- Overview and introduction:
https://nginx.org/en/docs/njs/
- NGINX JavaScript in Your Web Server Configuration:
https://youtu.be/Jc_L6UffFOs
- Extending NGINX with Custom Code:
https://youtu.be/0CVhq4AUU7M
- Using node modules with njs:
https://nginx.org/en/docs/njs/node_modules.html
- Writing njs code using TypeScript definition files:
https://nginx.org/en/docs/njs/typescript.html

Feel free to try it and give us feedback on:

- Github:
https://github.com/nginx/njs/issues
- Mailing list:
https://mailman.nginx.org/mailman/listinfo/nginx-devel

Additional examples and howtos can be found here:

- Github:
https://github.com/nginx/njs-examples

Changes with njs 0.7.11 9 Mar 2023
nginx modules:

*) Bugfix: added missed linking with libxml2 for the dynamic module.
The bug was introduced in 0.7.10.

Core:

*) Feature: added XMLNode API to modify XML documents.

*) Change: removed XML_PARSE_DTDVALID during parsing of XML document
due to security implications. The issue was introduced
in 0.7.10. When XML_PARSE_DTDVALID is enabled, libxml2 parses and
executes external entities present inside an XML document.

*) Bugfix: fixed the detection of await in arguments.

*) Bugfix: fixed Error() instance dumping when "name" prop is not
primitive.

*) Bugfix: fixed array instance with a getter property dumping.

*) Bugfix: fixed njs_object_property() with NJS_WHITEOUT properties.

*) Bugfix: fixed func instance dumping with "name" as getter.

*) Bugfix: fixed attaching of a stack to an error object.

*) Bugfix: fixed String.prototype.replace() with replacement
containing "$'", "$`".
_______________________________________________
nginx-announce mailing list
nginx-announce@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-announce
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready