njs-0.3.9

Dmitry Volyntsev xeioex at nginx.com
Tue Mar 3 17:40:08 UTC 2020


Hello,

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

This release proceeds to extend the coverage of ECMAScript
specifications.

Notable new features:
- Promises API for "fs" module.
: var fs = require('fs').promises;
: fs.readFile('/file/path').then(data => r.return(200, data));

- detached r.subrequest(): Running a subrequest in the log phase
: nginx.conf:
:   ...
:   js_set $js_log js_log;
:   ...
:   log_format subrequest_log "...$js_log";
:   access_log /log/path.log subrequest_log;
:
: nginx.js:
:   function js_log(r) {
:        r.subrequest('/_log', {detached:true});
:        return '';
:   }

You can learn more about njs:

- Overview and introduction: http://nginx.org/en/docs/njs/
- Presentation: https://youtu.be/Jc_L6UffFOs
- Using node modules with njs: 
http://nginx.org/en/docs/njs/node_modules.html

Feel free to try it and give us feedback on:

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


Changes with njs 0.3.9                                     03 Mar 2020

     nginx modules:

     *) Feature: added detached mode for r.subrequest(). Responses to
        detached subrequests are ignored. Unlike ordinary subrequests,
        a detached subrequest can be created inside a variable handler.

     Core:

     *) Feature: added promises API for "fs" module.
        Thanks to Artem S. Povalyukhin.

     *) Feature: extended "fs" module. Added access(), symlink(), unlink(),
        realpath() and friends.
        Thanks to Artem S. Povalyukhin.

     *) Improvement: introduced memory-efficient ordinary arrays.

     *) Improvement: lexer refactoring.

     *) Bugfix: fixed matching of native functions in backtraces.

     *) Bugfix: fixed callback invocations in "fs" module.
        Thanks to Artem S. Povalyukhin.

     *) Bugfix: fixed Object.getOwnPropertySymbols().

     *) Bugfix: fixed heap-buffer-overflow in njs_json_append_string().

     *) Bugfix: fixed encodeURI() and decodeURI() according to
        the specification.

     *) Bugfix: fixed Number.prototype.toPrecision().

     *) Bugfix: fixed handling of space argument in JSON.stringify().

     *) Bugfix: fixed JSON.stringify() with Number() and String() objects.

     *) Bugfix: fixed Unicode Escaping in JSON.stringify() according
        to specification.

     *) Bugfix: fixed non-native module importing.
        Thanks to 洪志道 (Hong Zhi Dao).

     *) Bugfix: fixed njs.dump() with the Date() instance in a container.


More information about the nginx mailing list