From xeioex at nginx.com Tue Feb 7 23:59:56 2023 From: xeioex at nginx.com (Dmitry Volyntsev) Date: Tue, 7 Feb 2023 15:59:56 -0800 Subject: [nginx-announce] njs-0.7.10 Message-ID: <990f544a-9f32-da0b-d160-c4b9212d5423@nginx.com> Hello, I'm glad to announce a new feature heavy release of NGINX JavaScript module (njs). Notable new features: - Fetch API extended support, including Headers() and Request() constructors: : async function makeRequest(uri, headers) { : let h = new Headers(headers); : h.delete("bar"); : h.append("foo", "xxx"); : let r = new Request(uri, {headers: h}); : return await ngx.fetch(r); : } - Extended WebCrypto API, most notably JWK support was added: : async function importSigningJWK(jwk) { : return await crypto.subtle.importKey('jwk', jwk, : {name: "RSASSA-PKCS1-v1_5"}, : true, ['sign']); : } - XML parsing module: : const xml = require("xml"); : let data = `ToveJani`; : let doc = xml.parse(data); : : console.log(doc.note.to.$text) /* 'Tove' */ : console.log(doc.note.to.$attr$b) /* 'bar' */ : console.log(doc.note.$tags[1].$text) /* 'Jani' */ 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.10 7 Feb 2023 nginx modules: *) Feature: added Request, Response and Headers ctors in Fetch API. *) Bugfix: fixed nginx logger callback for calls in master process. Core: *) Feature: added signal support in CLI. *) Feature: added "xml" module for working with XML documents. *) Feature: extended support for symmetric and asymmetric keys in WebCrypto. Most notably JWK format for importKey() was added. generateKey() and exportKey() were also implemented. *) Feature: added String.prototype.replaceAll(). *) Bugfix: fixed for(expr1; conditional syntax error handling. *) Bugfix: fixed Object.values() and Object.entries() with external objects. *) Bugfix: fixed RegExp.prototype[@@replace](). From xeioex at nginx.com Thu Mar 9 23:43:54 2023 From: xeioex at nginx.com (Dmitry Volyntsev) Date: Thu, 9 Mar 2023 15:43:54 -0800 Subject: [nginx-announce] njs-0.7.11 Message-ID: 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 = `ToveJani`; : 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)) : /* 'Tove' */ : : doc.$root.to.removeAllAttributes(); : doc.$root.from.$text = 'Jani2'; : : console.log(xml.serializeToString(doc)) : /* 'ToveJani2' */ : : doc.$root.to.$tags = [xml.parse(``), xml.parse(``)]; : doc.$root.to.addChild(xml.parse(``)); : : console.log(xml.serializeToString(doc.$root.to)) : /* '' */ : : doc.$root.to.removeChildren('a'); : : console.log(xml.serializeToString(doc.$root.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 "$'", "$`".