Mercurial > hg > nginx-site
changeset 2507:8ad2ea80e0c2
njs-0.3.9
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 03 Mar 2020 15:45:30 +0000 |
parents | feb8b843e482 |
children | d3d5b67a1462 |
files | xml/en/docs/njs/changes.xml xml/en/docs/njs/compatibility.xml xml/en/docs/njs/reference.xml xml/index.xml xml/ru/docs/njs/compatibility.xml |
diffstat | 5 files changed, 327 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/njs/changes.xml Tue Mar 03 18:11:05 2020 +0300 +++ b/xml/en/docs/njs/changes.xml Tue Mar 03 15:45:30 2020 +0000 @@ -9,9 +9,178 @@ <article name="Changes" link="/en/docs/njs/changes.html" lang="en" - rev="27" + rev="28" toc="no"> +<section id="njs0.3.9" name="Changes with njs 0.3.9"> + +<para> +Release Date: +03 March 2020 +</para> + +<para> +nginx modules: +<list type="bullet"> + +<listitem> +<para> +Feature: +added detached mode for +<link doc="reference.xml" id="subrequest"><literal>r.subrequest()</literal></link>. +Responses to detached subrequests are ignored. +Unlike ordinary subrequests, +a detached subrequest can be created inside a variable handler. +</para> +</listitem> + +</list> +</para> + +<para> +Core: +<list type="bullet"> + +<listitem> +<para> +Feature: +added <literal>promises</literal> API for +<link doc="reference.xml" id="njs_api_fs"><literal>fs</literal></link> module. +Thanks to Artem S. Povalyukhin. +</para> +</listitem> + +<listitem> +<para> +Feature: +extended <link doc="reference.xml" id="njs_api_fs"><literal>fs</literal></link> +module. +Added +<link doc="reference.xml" id="fs_accesssync"><literal>access()</literal></link>, +<link doc="reference.xml" id="fs_symlinksync"><literal>symlink()</literal></link>, +<link doc="reference.xml" id="fs_unlinksync"><literal>unlink()</literal></link>, +<link doc="reference.xml" id="fs_realpathsync"><literal>realpath()</literal></link>, +and friends. +Thanks to Artem S. Povalyukhin. +</para> +</listitem> + +<listitem> +<para> +Improvement: +introduced memory-efficient ordinary arrays. +</para> +</listitem> + +<listitem> +<para> +Improvement: +lexer refactoring. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed matching of native functions in backtraces. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed callback invocations in +<link doc="reference.xml" id="njs_api_fs"><literal>fs</literal></link> module. +Thanks to Artem S. Povalyukhin. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed <literal>Object.getOwnPropertySymbols()</literal>. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed heap-buffer-overflow in +<literal>njs_json_append_string()</literal>. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed +<link doc="reference.xml" id="encodeuri"><literal>encodeURI()</literal></link> +and +<link doc="reference.xml" id="decodeuri"><literal>decodeURI()</literal></link> +according to the specification. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed <literal>Number.prototype.toPrecision()</literal>. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed handling of space argument in +<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link>. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed +<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link> +with +<literal>Number()</literal> and +<literal>String()</literal> +objects. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed Unicode Escaping in +<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link> +according to specification. +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed non-native module importing. +Thanks to 洪志道 (Hong Zhi Dao). +</para> +</listitem> + +<listitem> +<para> +Bugfix: +fixed +<literal>njs.dump()</literal> with the +<literal>Date()</literal> +instance in a container. +</para> +</listitem> + +</list> +</para> + +</section> + + <section id="njs0.3.8" name="Changes with njs 0.3.8"> <para> @@ -698,7 +867,7 @@ <para> Feature: added -<link doc="reference.xml" id="renamesync"><literal>fs.renameSync()</literal></link>. +<link doc="reference.xml" id="fs_renamesync"><literal>fs.renameSync()</literal></link>. </para> </listitem>
--- a/xml/en/docs/njs/compatibility.xml Tue Mar 03 18:11:05 2020 +0300 +++ b/xml/en/docs/njs/compatibility.xml Tue Mar 03 15:45:30 2020 +0000 @@ -9,7 +9,7 @@ <article name="Compatibility" link="/en/docs/njs/compatibility.html" lang="en" - rev="22" + rev="23" toc="no"> <section> @@ -618,14 +618,27 @@ <listitem> <literal>File system</literal> methods: +<link doc="reference.xml" id="fs_accesssync"><literal>fs.accessSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), <link doc="reference.xml" id="appendfilesync"><literal>fs.appendFileSync</literal></link>, <link doc="reference.xml" id="readfilesync"><literal>fs.readFileSync</literal></link>, -<link doc="reference.xml" id="renamesync"><literal>fs.renameSync</literal></link> +<link doc="reference.xml" id="fs_realpathsync"><literal>fs.realpathSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +<link doc="reference.xml" id="fs_renamesync"><literal>fs.renameSync</literal></link> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>), +<link doc="reference.xml" id="fs_symlinksync"><literal>fs.symlinkSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +<link doc="reference.xml" id="fs_unlinksync"><literal>fs.unlinkSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), <link doc="reference.xml" id="writefilesync"><literal>fs.writeFileSync</literal></link> </listitem> <listitem> +<literal>fs.promises</literal> API (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +asynchronous version of file system methods. +</listitem> + +<listitem> <literal>Crypto</literal> methods (0.2.0): <link doc="reference.xml" id="crypto_createhash"><literal>crypto.createHash</literal></link>, <link doc="reference.xml" id="crypto_createhmac"><literal>crypto.createHmac</literal></link>
--- a/xml/en/docs/njs/reference.xml Tue Mar 03 18:11:05 2020 +0300 +++ b/xml/en/docs/njs/reference.xml Tue Mar 03 15:45:30 2020 +0000 @@ -9,7 +9,7 @@ <article name="Reference" link="/en/docs/njs/reference.html" lang="en" - rev="35"> + rev="36"> <section id="summary"> @@ -221,6 +221,16 @@ HTTP method, by default the <literal>GET</literal> method is used </tag-desc> +<tag-name><literal>detached</literal></tag-name> +<tag-desc> +boolean flag (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +if <literal>true</literal>, the created subrequest is a detached subrequest. +Responses to detached subrequests are ignored. +Unlike ordinary subrequests, a detached subrequest +can be created inside a variable handler. +The detached flag and callback argument are mutually exclusive. +</tag-desc> + </list> </para> @@ -1162,9 +1172,49 @@ <para> The File System module provides operations with files. +</para> + +<para> The module object is returned by <literal>require('fs')</literal>. +Since (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +promissified versions of methods described below are available through +<literal>require('fs').promises</literal> object: +<example> +> var fs = require('fs').promises; +undefined +> fs.readFile("/file/path").then((data)=>console.log(data)) +<file data> +</example> <list type="tag"> +<tag-name id="fs_accesssync"><literal>accessSync(<value>path</value>[, +<value>mode</value>])</literal></tag-name> +<tag-desc> +Synchronously tests permissions for a file or directory +specified in the <literal>path</literal> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). +If the check fails, an error will be returned, +otherwise, the method will return undefined. +<list type="tag"> + +<tag-name><literal>mode</literal></tag-name> +<tag-desc> +by default is <link id="access_const"><literal>fs.constants.F_OK</literal></link>. +The mode argument is an optional integer +that specifies the accessibility checks to be performed. +<example> +try { + fs.accessSync('/file/path', fs.constants.R_OK | fs.constants.W_OK); + console.log('has access'); +} catch (e) { + console.log('no access');) +} +</example> +</tag-desc> + +</list> +</tag-desc> + <tag-name id="appendfilesync"><literal>appendFileSync(<value>filename</value>, <value>data</value>[, <value>options</value>])</literal></tag-name> <tag-desc> @@ -1225,6 +1275,18 @@ </example> </tag-desc> +<tag-name id="fs_realpathsync"><literal>realpathSync(<value>path</value>[, +<value>options</value>])</literal></tag-name> +<tag-desc> +Synchronously computes the canonical pathname by resolving +<literal>.</literal>, <literal>..</literal> and symbolic links using +<link url="http://man7.org/linux/man-pages/man3/realpath.3.html">realpath(3)</link> +The <literal>options</literal> argument can be a string specifying an encoding, +or an object with an encoding property specifying the character encoding +to use for the path passed to the callback +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). +</tag-desc> + <tag-name id="writefilesync"><literal>writeFileSync(<value>filename</value>, <value>data</value>[, <value>options</value>])</literal></tag-name> @@ -1256,7 +1318,7 @@ </example> </tag-desc> -<tag-name id="renamesync"><literal>renameSync(<value>oldPath</value>, +<tag-name id="fs_renamesync"><literal>renameSync(<value>oldPath</value>, <value>newPath</value>)</literal></tag-name> <tag-desc> Synchronously changes the name or location of a file from @@ -1270,10 +1332,62 @@ </example> </tag-desc> +<tag-name id="fs_symlinksync"><literal>symlinkSync(<value>target</value>, +<value>path</value>)</literal></tag-name> +<tag-desc> +Synchronously creates the link called <literal>path</literal> +pointing to <literal>target</literal> using +<link url="http://man7.org/linux/man-pages/man2/symlink.2.html">symlink(2)</link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). +Relative targets are relative to the link’s parent directory. +</tag-desc> + +<tag-name id="fs_unlinksync"><literal>unlinkSync(<value>path</value>)</literal></tag-name> +<tag-desc> +Synchronously unlinks a file by <literal>path</literal> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). +</tag-desc> + </list> </para> +<section id="access_const" name="File Access Constants"> + +<para> +The <link id="fs_accesssync"><literal>access()</literal></link> method +can accept the following flags. +These flags are exported by <literal>fs.constants</literal>: + +<list type= "bullet" compact="no"> + +<listitem> +<literal>F_OK</literal>—indicates that the file +is visible to the calling process, +used by default if no mode is specified +</listitem> + +<listitem> +<literal>R_OK</literal>—indicates that the file can be +read by the calling process +</listitem> + +<listitem> +<literal>W_OK</literal>—indicates that the file can be +written by the calling process +</listitem> + +<listitem> +<literal>X_OK</literal>—indicates that the file can be +executed by the calling process +</listitem> + +</list> +</para> + +</section> + + <section id="njs_api_fs_flags" name="File System Flags"> <para>
--- a/xml/index.xml Tue Mar 03 18:11:05 2020 +0300 +++ b/xml/index.xml Tue Mar 03 15:45:30 2020 +0000 @@ -9,6 +9,16 @@ <event date="2020-03-03"> <para> +<link doc="en/docs/njs/index.xml">njs-0.3.9</link> +version has been +<link doc="en/docs/njs/changes.xml" id="njs0.3.9">released</link>, +featuring detached mode for +<link doc="en/docs/njs/reference.xml" id="subrequest">r.subrequest()</link>. +</para> +</event> + +<event date="2020-03-03"> +<para> <link doc="en/download.xml">nginx-1.17.9</link> mainline version has been released. </para>
--- a/xml/ru/docs/njs/compatibility.xml Tue Mar 03 18:11:05 2020 +0300 +++ b/xml/ru/docs/njs/compatibility.xml Tue Mar 03 15:45:30 2020 +0000 @@ -9,7 +9,7 @@ <article name="Совместимость" link="/ru/docs/njs/compatibility.html" lang="ru" - rev="22" + rev="23" toc="no"> <section> @@ -619,14 +619,27 @@ <listitem> Методы <literal>File system</literal>: +<link doc="reference.xml" id="fs_accesssync"><literal>fs.accessSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), <link doc="reference.xml" id="appendfilesync"><literal>fs.appendFileSync</literal></link>, <link doc="reference.xml" id="readfilesync"><literal>fs.readFileSync</literal></link>, -<link doc="reference.xml" id="renamesync"><literal>fs.renameSync</literal></link> +<link doc="reference.xml" id="fs_realpathsync"><literal>fs.realpathSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +<link doc="reference.xml" id="fs_renamesync"><literal>fs.renameSync</literal></link> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>), +<link doc="reference.xml" id="fs_symlinksync"><literal>fs.symlinkSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +<link doc="reference.xml" id="fs_unlinksync"><literal>fs.unlinkSync</literal></link> +(<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), <link doc="reference.xml" id="writefilesync"><literal>fs.writeFileSync</literal></link> </listitem> <listitem> +<literal>fs.promises</literal> API (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), +асинхронная версия файловых методов file system. +</listitem> + +<listitem> Методы <literal>Crypto</literal> (0.2.0): <link doc="reference.xml" id="crypto_createhash"><literal>crypto.createHash</literal></link>, <link doc="reference.xml" id="crypto_createhmac"><literal>crypto.createHmac</literal></link>