diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 48ad8a90cb77c5..d3af8e681917a0 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -15,6 +15,7 @@ If you didn't find an answer in the resources above, try these unofficial resources: * [Questions tagged 'node.js' on Stack Overflow](https://stackoverflow.com/questions/tagged/node.js) +* [#nodejs](https://openjs-foundation.slack.com/archives/CK9Q4MB53) channel on the OpenJS Foundation Slack ([join here](https://slack-invite.openjsf.org/)) * [#node.js channel on chat.freenode.net](https://webchat.freenode.net?channels=node.js&uio=d4) * [Node.js Slack Community](https://node-js.slack.com/) * To register: [nodeslackers.com](https://www.nodeslackers.com/) diff --git a/.github/workflows/close-stalled.yml b/.github/workflows/close-stalled.yml index 89861c6445263a..1834d3ac2e6815 100644 --- a/.github/workflows/close-stalled.yml +++ b/.github/workflows/close-stalled.yml @@ -15,6 +15,10 @@ jobs: stale-issue-label: stalled close-issue-message: Closing this because it has stalled. Feel free to reopen if this issue is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. close-pr-message: Closing this because it has stalled. Feel free to reopen if this PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. + # used to filter issues to check whether or not should be closed, avoids hitting maximum operations allowed if needing to paginate through all open issues + only-labels: stalled + # max requests it will send per run to the GitHub API before it deliberately exits to avoid hitting API rate limits + operations-per-run: 500 # deactivates automatic removal of stalled label if issue gets any activity remove-stale-when-updated: false # deactivates automatic stale labelling as we prefer to do that manually diff --git a/.github/workflows/require-allow-edits.yml b/.github/workflows/require-allow-edits.yml deleted file mode 100644 index 31a3d24efb423d..00000000000000 --- a/.github/workflows/require-allow-edits.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Require “Allow Edits” - -on: [pull_request] - -jobs: - _: - name: "Require “Allow Edits”" - - runs-on: ubuntu-latest - - steps: - - uses: ljharb/require-allow-edits@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.mailmap b/.mailmap index 64f74f4b08a4b9..ae585f1023dbc9 100644 --- a/.mailmap +++ b/.mailmap @@ -37,6 +37,9 @@ Artem Zaytsev Artur G Vieira Artur Vieira Arnout Kazemier <3rd-Eden@users.noreply.github.com> Asaf David asafdav2 +Ash Cripps +Ash Cripps +Ash Cripps Ashley Maceli ashleyraymaceli Ashok Suthar Ashutosh Kumar Singh diff --git a/AUTHORS b/AUTHORS index 839039c541e56d..3d637a17bc0fce 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2872,7 +2872,7 @@ Michael Perrotte Alexandre Ferrando Loris Zinsou Jizu Sun -AshCripps +Ash Cripps garygsc Patrick Housley Artem Maksimov diff --git a/CHANGELOG.md b/CHANGELOG.md index d6980334356b3b..079a83e9778817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,8 @@ release. -14.11.0
+14.12.0
+14.11.0
14.10.1
14.10.0
14.9.0
diff --git a/README.md b/README.md index 6e3a1d80be11d0..ecacab8921ceba 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ For information on reporting security vulnerabilities in Node.js, see * [Contributing to the project][] * [Working Groups][] * [Strategic Initiatives][] +* [Technical values and prioritization][] ## Current Project Team Members @@ -180,7 +181,7 @@ For information about the governance of the Node.js project, see * [mcollina](https://github.com/mcollina) - **Matteo Collina** <matteo.collina@gmail.com> (he/him) * [mhdawson](https://github.com/mhdawson) - -**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) +**Michael Dawson** <midawson@redhat.com> (he/him) * [mmarchini](https://github.com/mmarchini) - **Mary Marchini** <oss@mmarchini.me> (she/her) * [MylesBorins](https://github.com/MylesBorins) - @@ -248,7 +249,7 @@ For information about the governance of the Node.js project, see * [apapirovski](https://github.com/apapirovski) - **Anatoli Papirovski** <apapirovski@mac.com> (he/him) * [AshCripps](https://github.com/AshCripps) - -**Ash Cripps** <ashley.cripps@ibm.com> +**Ash Cripps** <acripps@redhat.com> * [bcoe](https://github.com/bcoe) - **Ben Coe** <bencoe@gmail.com> (he/him) * [bengl](https://github.com/bengl) - @@ -288,7 +289,7 @@ For information about the governance of the Node.js project, see * [devnexen](https://github.com/devnexen) - **David Carlier** <devnexen@gmail.com> * [devsnek](https://github.com/devsnek) - -**Gus Caplan** <me@gus.host> (he/him) +**Gus Caplan** <me@gus.host> (they/them) * [edsadr](https://github.com/edsadr) - **Adrian Estrada** <edsadr@gmail.com> (he/him) * [eugeneo](https://github.com/eugeneo) - @@ -356,7 +357,7 @@ For information about the governance of the Node.js project, see * [mcollina](https://github.com/mcollina) - **Matteo Collina** <matteo.collina@gmail.com> (he/him) * [mhdawson](https://github.com/mhdawson) - -**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) +**Michael Dawson** <midawson@redhat.com> (he/him) * [mildsunrise](https://github.com/mildsunrise) - **Alba Mendez** <me@alba.sh> (she/her) * [misterdjules](https://github.com/misterdjules) - @@ -633,5 +634,6 @@ Other keys used to sign some previous releases: [Contributing to the project]: CONTRIBUTING.md [Node.js Website]: https://nodejs.org/ [OpenJS Foundation]: https://openjsf.org/ -[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md [Strategic Initiatives]: https://github.com/nodejs/TSC/blob/master/Strategic-Initiatives.md +[Technical values and prioritization]: doc/guides/technical-values.md +[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md diff --git a/deps/uvwasi/include/uvwasi.h b/deps/uvwasi/include/uvwasi.h index 9a0f8aa3c61711..d093a412d6d863 100644 --- a/deps/uvwasi/include/uvwasi.h +++ b/deps/uvwasi/include/uvwasi.h @@ -10,7 +10,7 @@ extern "C" { #define UVWASI_VERSION_MAJOR 0 #define UVWASI_VERSION_MINOR 0 -#define UVWASI_VERSION_PATCH 10 +#define UVWASI_VERSION_PATCH 11 #define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \ (UVWASI_VERSION_MINOR << 8) | \ (UVWASI_VERSION_PATCH)) diff --git a/deps/uvwasi/include/wasi_serdes.h b/deps/uvwasi/include/wasi_serdes.h index ed80e4a88e6ee4..038ae74786ad0b 100644 --- a/deps/uvwasi/include/wasi_serdes.h +++ b/deps/uvwasi/include/wasi_serdes.h @@ -103,6 +103,9 @@ IOVS_STRUCT(ciovec_t) #define UVWASI_SERDES_SIZE_iovec_t 8 IOVS_STRUCT(iovec_t) +#define UVWASI_SERDES_SIZE_dirent_t 24 +STRUCT(dirent_t) + #define UVWASI_SERDES_SIZE_fdstat_t 24 STRUCT(fdstat_t) diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c index acc25c3dba2f73..0b4b091f9d5a1f 100644 --- a/deps/uvwasi/src/uvwasi.c +++ b/deps/uvwasi/src/uvwasi.c @@ -13,6 +13,10 @@ #define UVWASI__READDIR_NUM_ENTRIES 1 +#if !defined(_WIN32) && !defined(__ANDROID__) +# define UVWASI_FD_READDIR_SUPPORTED 1 +#endif + #include "uvwasi.h" #include "uvwasi_alloc.h" #include "uv.h" @@ -22,6 +26,7 @@ #include "path_resolver.h" #include "poll_oneoff.h" #include "wasi_rights.h" +#include "wasi_serdes.h" #include "debug.h" /* IBMi PASE does not support posix_fadvise() */ @@ -1268,7 +1273,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, uvwasi_size_t buf_len, uvwasi_dircookie_t cookie, uvwasi_size_t* bufused) { - /* TODO(cjihrig): Support Windows where seekdir() and telldir() are used. */ +#if defined(UVWASI_FD_READDIR_SUPPORTED) /* TODO(cjihrig): Avoid opening and closing the directory on each call. */ struct uvwasi_fd_wrap_t* wrap; uvwasi_dirent_t dirent; @@ -1282,6 +1287,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, long tell; int i; int r; +#endif /* defined(UVWASI_FD_READDIR_SUPPORTED) */ UVWASI_DEBUG("uvwasi_fd_readdir(uvwasi=%p, fd=%d, buf=%p, buf_len=%d, " "cookie=%"PRIu64", bufused=%p)\n", @@ -1295,6 +1301,7 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, if (uvwasi == NULL || buf == NULL || bufused == NULL) return UVWASI_EINVAL; +#if defined(UVWASI_FD_READDIR_SUPPORTED) err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, @@ -1316,12 +1323,9 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, dir->nentries = UVWASI__READDIR_NUM_ENTRIES; uv_fs_req_cleanup(&req); -#ifndef _WIN32 - /* TODO(cjihrig): Need a Windows equivalent of this logic. */ /* Seek to the proper location in the directory. */ if (cookie != UVWASI_DIRCOOKIE_START) seekdir(dir->dir, cookie); -#endif /* Read the directory entries into the provided buffer. */ err = UVWASI_ESUCCESS; @@ -1333,25 +1337,20 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, goto exit; } + available = 0; + for (i = 0; i < r; i++) { - /* TODO(cjihrig): This should probably be serialized to the buffer - consistently across platforms. In other words, d_next should always - be 8 bytes, d_ino should always be 8 bytes, d_namlen should always be - 4 bytes, and d_type should always be 1 byte. */ -#ifndef _WIN32 tell = telldir(dir->dir); if (tell < 0) { err = uvwasi__translate_uv_error(uv_translate_sys_error(errno)); uv_fs_req_cleanup(&req); goto exit; } -#else - tell = 0; /* TODO(cjihrig): Need to support Windows. */ -#endif /* _WIN32 */ name_len = strlen(dirents[i].name); dirent.d_next = (uvwasi_dircookie_t) tell; - /* TODO(cjihrig): Missing ino libuv (and Windows) support. fstat()? */ + /* TODO(cjihrig): libuv doesn't provide d_ino, and d_type is not + supported on all platforms. Use stat()? */ dirent.d_ino = 0; dirent.d_namlen = name_len; @@ -1381,21 +1380,24 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, break; } - /* Write dirent to the buffer. */ - available = buf_len - *bufused; - size_to_cp = sizeof(dirent) > available ? available : sizeof(dirent); - memcpy((char*)buf + *bufused, &dirent, size_to_cp); - *bufused += size_to_cp; - /* Write the entry name to the buffer. */ + /* Write dirent to the buffer if it will fit. */ + if (UVWASI_SERDES_SIZE_dirent_t + *bufused > buf_len) + break; + + uvwasi_serdes_write_dirent_t(buf, *bufused, &dirent); + *bufused += UVWASI_SERDES_SIZE_dirent_t; available = buf_len - *bufused; + + /* Write as much of the entry name to the buffer as possible. */ size_to_cp = name_len > available ? available : name_len; - memcpy((char*)buf + *bufused, &dirents[i].name, size_to_cp); + memcpy((char*)buf + *bufused, dirents[i].name, size_to_cp); *bufused += size_to_cp; + available = buf_len - *bufused; } uv_fs_req_cleanup(&req); - if (*bufused >= buf_len) + if (available == 0) break; } @@ -1408,6 +1410,10 @@ uvwasi_errno_t uvwasi_fd_readdir(uvwasi_t* uvwasi, return uvwasi__translate_uv_error(r); return err; +#else + /* TODO(cjihrig): Need a solution for Windows and Android. */ + return UVWASI_ENOSYS; +#endif /* defined(UVWASI_FD_READDIR_SUPPORTED) */ } @@ -2353,6 +2359,7 @@ uvwasi_errno_t uvwasi_poll_oneoff(uvwasi_t* uvwasi, if (err != UVWASI_ESUCCESS) return err; + timer_userdata = 0; has_timeout = 0; min_timeout = 0; diff --git a/deps/uvwasi/src/wasi_serdes.c b/deps/uvwasi/src/wasi_serdes.c index 96253fc5af0623..ea7b9e1e52fbf3 100644 --- a/deps/uvwasi/src/wasi_serdes.c +++ b/deps/uvwasi/src/wasi_serdes.c @@ -84,6 +84,13 @@ uint8_t uvwasi_serdes_read_uint8_t(const void* ptr, size_t offset) { ALIAS(userdata_t, uint64_t) \ ALIAS(whence_t, uint8_t) \ \ + STRUCT(dirent_t) { \ + FIELD( 0, dircookie_t, d_next); \ + FIELD( 8, inode_t, d_ino); \ + FIELD(16, uint32_t, d_namlen); \ + FIELD(20, filetype_t, d_type); \ + } \ + \ STRUCT(fdstat_t) { \ FIELD( 0, filetype_t, fs_filetype); \ FIELD( 2, fdflags_t, fs_flags); \ diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 921147f5cc09b0..50baa8d4dde79e 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -1157,14 +1157,14 @@ functions called by `foo`. Outside of `run`, calling `getStore` will return In most cases your application or library code should have no issues with `AsyncLocalStorage`. But in rare cases you may face situations when the -current store is lost in one of asynchronous operations. Then you should +current store is lost in one of asynchronous operations. In those cases, consider the following options. If your code is callback-based, it is enough to promisify it with [`util.promisify()`][], so it starts working with native promises. If you need to keep using callback-based API, or your code assumes -a custom thenable implementation, you should use [`AsyncResource`][] class +a custom thenable implementation, use the [`AsyncResource`][] class to associate the asynchronous operation with the correct execution context. [`AsyncResource`]: #async_hooks_class_asyncresource diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 4902106a595de9..56449d1a6ec193 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -3229,12 +3229,12 @@ if `size` is less than or equal to half [`Buffer.poolSize`][]. Instances returned by [`Buffer.allocUnsafeSlow()`][] *never* use the shared internal memory pool. -### The `--zero-fill-buffers` command line option +### The `--zero-fill-buffers` command-line option -Node.js can be started using the `--zero-fill-buffers` command line option to +Node.js can be started using the `--zero-fill-buffers` command-line option to cause all newly-allocated `Buffer` instances to be zero-filled upon creation by default. Without the option, buffers created with [`Buffer.allocUnsafe()`][], [`Buffer.allocUnsafeSlow()`][], and `new SlowBuffer(size)` are not zero-filled. diff --git a/doc/api/child_process.md b/doc/api/child_process.md index d88adf49885b11..7ef5c82387346b 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -449,7 +449,7 @@ changes: * Returns: {ChildProcess} The `child_process.spawn()` method spawns a new process using the given -`command`, with command line arguments in `args`. If omitted, `args` defaults +`command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. **If the `shell` option is enabled, do not pass unsanitized user input to this @@ -1398,7 +1398,7 @@ the child process if any, else `null`. * {Array} -The `subprocess.spawnargs` property represents the full list of command line +The `subprocess.spawnargs` property represents the full list of command-line arguments the child process was launched with. ### `subprocess.spawnfile` @@ -1547,7 +1547,7 @@ to `stdout` although there are only 4 characters. ## Shell requirements The shell should understand the `-c` switch. If the shell is `'cmd.exe'`, it -should understand the `/d /s /c` switches and command line parsing should be +should understand the `/d /s /c` switches and command-line parsing should be compatible. ## Default Windows shell diff --git a/doc/api/cli.md b/doc/api/cli.md index 68fb11ff53e991..b0ff3fe30c2f13 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1,4 +1,4 @@ -# Command line options +# Command-line options @@ -18,7 +18,7 @@ To view this documentation as a manual page in a terminal, run `man node`. Execute without arguments to start the [REPL][]. -_For more info about `node inspect`, please see the [debugger][] documentation._ +For more info about `node inspect`, see the [debugger][] documentation. ## Options All options, including V8 options, allow words to be separated by both -dashes (`-`) or underscores (`_`). +dashes (`-`) or underscores (`_`). For example, `--pending-deprecation` is +equivalent to `--pending_deprecation`. -For example, `--pending-deprecation` is equivalent to `--pending_deprecation`. +If an option that takes a single value (such as `--max-http-header-size`) is +passed more than once, then the last passed value is used. Options from the +command line take precedence over options passed through the [`NODE_OPTIONS`][] +environment variable. ### `-` -Alias for stdin. Analogous to the use of `-` in other command line utilities, -meaning that the script will be read from stdin, and the rest of the options +Alias for stdin. Analogous to the use of `-` in other command-line utilities, +meaning that the script is read from stdin, and the rest of the options are passed to that script. ### `--` @@ -50,7 +54,7 @@ added: v6.11.0 Indicate the end of node options. Pass the rest of the arguments to the script. If no script filename or eval/print script is supplied prior to this, then -the next argument will be used as a script filename. +the next argument is used as a script filename. ### `--abort-on-uncaught-exception` Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the -property will be removed entirely. If `mode` is `throw`, accesses to the -property will throw an exception with the code `ERR_PROTO_ACCESS`. +property is removed entirely. If `mode` is `throw`, accesses to the +property throw an exception with the code `ERR_PROTO_ACCESS`. ### `--disallow-code-generation-from-strings` -Print V8 command line options. +Print V8 command-line options. ### `--v8-pool-size=num` -Print node command line options. +Print node command-line options. The output of this option is less detailed than this document. ### `-i`, `--interactive` @@ -1181,20 +1185,19 @@ When set to `1`, process warnings are silenced. added: v8.0.0 --> -A space-separated list of command line options. `options...` are interpreted -before command line options, so command line options will override or +A space-separated list of command-line options. `options...` are interpreted +before command-line options, so command-line options will override or compound after anything in `options...`. Node.js will exit with an error if an option that is not allowed in the environment is used, such as `-p` or a script file. -In case an option value happens to contain a space (for example a path listed -in `--require`), it must be escaped using double quotes. For example: +If an option value contains a space, it can be escaped using double quotes: ```bash NODE_OPTIONS='--require "./my path/file.js"' ``` -A singleton flag passed as a command line option will override the same flag +A singleton flag passed as a command-line option will override the same flag passed into `NODE_OPTIONS`: ```bash @@ -1203,7 +1206,7 @@ NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555 ``` A flag that can be passed multiple times will be treated as if its -`NODE_OPTIONS` instances were passed first, and then its command line +`NODE_OPTIONS` instances were passed first, and then its command-line instances afterwards: ```bash @@ -1328,7 +1331,7 @@ When set to `1`, emit pending deprecation warnings. Pending deprecations are generally identical to a runtime deprecation with the notable exception that they are turned *off* by default and will not be emitted -unless either the `--pending-deprecation` command line flag, or the +unless either the `--pending-deprecation` command-line flag, or the `NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations are used to provide a kind of selective "early warning" mechanism that developers may leverage to detect deprecated API usage. @@ -1476,7 +1479,7 @@ Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with `./configure --openssl-fips`. -If the [`--openssl-config`][] command line option is used, the environment +If the [`--openssl-config`][] command-line option is used, the environment variable is ignored. ### `SSL_CERT_DIR=dir` @@ -1550,21 +1553,22 @@ On a machine with 2GB of memory, consider setting this to $ node --max-old-space-size=1536 index.js ``` +[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ +[REPL]: repl.html +[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage +[Source Map]: https://sourcemaps.info/spec.html +[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity +[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html [`--openssl-config`]: #cli_openssl_config_file [`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait [`Buffer`]: buffer.html#buffer_class_buffer +[`NODE_OPTIONS`]: #cli_node_options_options [`SlowBuffer`]: buffer.html#buffer_class_slowbuffer [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn [`tls.DEFAULT_MAX_VERSION`]: tls.html#tls_tls_default_max_version [`tls.DEFAULT_MIN_VERSION`]: tls.html#tls_tls_default_min_version [`unhandledRejection`]: process.html#process_event_unhandledrejection [`worker_threads.threadId`]: worker_threads.html#worker_threads_worker_threadid -[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ -[REPL]: repl.html -[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage -[Source Map]: https://sourcemaps.info/spec.html -[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity -[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html [context-aware]: addons.html#addons_context_aware_addons [customizing ESM specifier resolution]: esm.html#esm_customizing_esm_specifier_resolution_algorithm [debugger]: debugger.html diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 1ed5e38670fb3c..92e4d42d60e3fd 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -436,7 +436,7 @@ If the graceful disconnect behavior is not needed, use `worker.process.kill()`. Causes `.exitedAfterDisconnect` to be set. -This method is aliased as `worker.destroy()` for backwards compatibility. +This method is aliased as `worker.destroy()` for backward compatibility. In a worker, `process.kill()` exists, but it is not this function; it is [`kill()`][]. diff --git a/doc/api/crypto.md b/doc/api/crypto.md index b56676e41ef40e..329f32bdeb1d80 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1602,7 +1602,7 @@ The default encoding to use for functions that can take either strings or [buffers][`Buffer`]. The default value is `'buffer'`, which makes methods default to [`Buffer`][] objects. -The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +The `crypto.DEFAULT_ENCODING` mechanism is provided for backward compatibility with legacy programs that expect `'latin1'` to be the default encoding. New applications should expect the default to be `'buffer'`. @@ -3614,7 +3614,7 @@ See the [list of SSL OP Flags][] for details. [RFC 5208]: https://www.rfc-editor.org/rfc/rfc5208.txt [encoding]: buffer.html#buffer_buffers_and_character_encodings [initialization vector]: https://en.wikipedia.org/wiki/Initialization_vector -[list of SSL OP Flags]: wiki.openssl.org/index.php/List_of_SSL_OP_Flags#Table_of_Options +[list of SSL OP Flags]: https://wiki.openssl.org/index.php/List_of_SSL_OP_Flags#Table_of_Options [safe integers]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger [scrypt]: https://en.wikipedia.org/wiki/Scrypt [stream]: stream.html diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 1579abeb7eca57..261c7fbd91105c 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1726,7 +1726,7 @@ Type: Deprecation revoked Importing assert directly was not recommended as the exposed functions use loose equality checks. The deprecation was revoked because use of the `assert` -module is not discouraged, and the deprecation caused end user confusion. +module is not discouraged, and the deprecation caused developer confusion. ### DEP0090: Invalid GCM authentication tag lengths **This module is pending deprecation**. Once a replacement API has been -finalized, this module will be fully deprecated. Most end users should +finalized, this module will be fully deprecated. Most developers should **not** have cause to use this module. Users who absolutely must have the functionality that domains provide may rely on it for the time being but should expect to have to migrate to a different solution diff --git a/doc/api/errors.md b/doc/api/errors.md index 7de3ee9da2e58f..1041d10b5c4129 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -224,7 +224,7 @@ above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation -details of error generation from an end user. For instance: +details of error generation from the user. For instance: ```js function MyError() { @@ -920,7 +920,7 @@ A `Promise` that was callbackified via `util.callbackify()` was rejected with a falsy value. -#### `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` +### `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` @@ -1391,7 +1391,7 @@ An invalid or unknown file encoding was passed. ### `ERR_INVALID_PACKAGE_CONFIG` -An invalid `package.json` file was found which failed parsing. +An invalid `package.json` file failed parsing. ### `ERR_INVALID_PACKAGE_TARGET` @@ -1608,8 +1608,8 @@ is thrown if a required option is missing. ### `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` An object that needs to be explicitly listed in the `transferList` argument -was found in the object passed to a `postMessage()` call, but not provided in -the `transferList` for that call. Usually, this is a `MessagePort`. +is in the object passed to a `postMessage()` call, but is not provided +in the `transferList` for that call. Usually, this is a `MessagePort`. ### `ERR_MISSING_PASSPHRASE` @@ -2092,7 +2092,7 @@ import 'package-name'; // supported ### `ERR_VALID_PERFORMANCE_ENTRY_TYPE` While using the Performance Timing API (`perf_hooks`), no valid performance -entry types were found. +entry types are found. ### `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING` diff --git a/doc/api/events.md b/doc/api/events.md index ed61072d8841fc..a3b77553bab46e 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -305,7 +305,7 @@ The `'removeListener'` event is emitted *after* the `listener` is removed. ### `EventEmitter.listenerCount(emitter, eventName)` > Stability: 0 - Deprecated: Use [`emitter.listenerCount()`][] instead. @@ -333,7 +333,7 @@ By default, a maximum of `10` listeners can be registered for any single event. This limit can be changed for individual `EventEmitter` instances using the [`emitter.setMaxListeners(n)`][] method. To change the default for *all* `EventEmitter` instances, the `EventEmitter.defaultMaxListeners` -property can be used. If this value is not a positive number, a `TypeError` +property can be used. If this value is not a positive number, a `RangeError` is thrown. Take caution when setting the `EventEmitter.defaultMaxListeners` because the @@ -355,7 +355,7 @@ emitter.once('event', () => { }); ``` -The [`--trace-warnings`][] command line flag can be used to display the +The [`--trace-warnings`][] command-line flag can be used to display the stack trace for such warnings. The emitted warning can be inspected with [`process.on('warning')`][] and will diff --git a/doc/api/fs.md b/doc/api/fs.md index a8aa1388c5be94..bafdcc4ef561d9 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1650,6 +1650,11 @@ operations. The specific constants currently defined are described in ## `fs.copyFile(src, dest[, mode], callback)` * `src` {string|Buffer|URL} source filename to copy @@ -1696,6 +1701,11 @@ fs.copyFile('source.txt', 'destination.txt', COPYFILE_EXCL, callback); ## `fs.copyFileSync(src, dest[, mode])` * `src` {string|Buffer|URL} source filename to copy @@ -2389,6 +2399,8 @@ changes: pr-url: https://github.com/nodejs/node/pull/7897 description: The `callback` parameter is no longer optional. Not passing it will emit a deprecation warning with id DEP0013. + - version: v0.4.7 + description: Documentation-only deprecation. --> * `path` {string|Buffer|URL} @@ -2406,6 +2418,8 @@ changes: - version: v10.6.0 pr-url: https://github.com/nodejs/node/pull/21498 description: This API is no longer deprecated. + - version: v0.4.7 + description: Documentation-only deprecation. --> * `path` {string|Buffer|URL} @@ -4133,6 +4147,10 @@ This happens when: * `fd` {integer} -* `buffer` {Buffer|TypedArray|DataView} +* `buffer` {Buffer|TypedArray|DataView|string|Object} * `offset` {integer} * `length` {integer} * `position` {integer} @@ -4167,7 +4185,8 @@ changes: * `bytesWritten` {integer} * `buffer` {Buffer|TypedArray|DataView} -Write `buffer` to the file specified by `fd`. +Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it +must have an own `toString` function property. `offset` determines the part of the buffer to be written, and `length` is an integer specifying the number of bytes to write. @@ -4194,6 +4213,10 @@ the end of the file. * `fd` {integer} -* `string` {string} +* `string` {string|Object} * `position` {integer} * `encoding` {string} **Default:** `'utf8'` * `callback` {Function} @@ -4220,8 +4243,8 @@ changes: * `written` {integer} * `string` {string} -Write `string` to the file specified by `fd`. If `string` is not a string, then -an exception will be thrown. +Write `string` to the file specified by `fd`. If `string` is not a string, or an +object with an own `toString` function property, then an exception is thrown. `position` refers to the offset from the beginning of the file where this data should be written. If `typeof position !== 'number'` the data will be written at @@ -4253,6 +4276,10 @@ details. * `file` {string|Buffer|URL|integer} filename or file descriptor -* `data` {string|Buffer|TypedArray|DataView} +* `data` {string|Buffer|TypedArray|DataView|Object} * `options` {Object|string} * `encoding` {string|null} **Default:** `'utf8'` * `mode` {integer} **Default:** `0o666` @@ -4294,6 +4321,7 @@ When `file` is a file descriptor, the behavior is similar to calling a file descriptor. The `encoding` option is ignored if `data` is a buffer. +If `data` is a normal object, it must have an own `toString` function property. ```js const data = new Uint8Array(Buffer.from('Hello Node.js')); @@ -4343,6 +4371,10 @@ to contain only `', World'`. * `file` {string|Buffer|URL|integer} filename or file descriptor -* `data` {string|Buffer|TypedArray|DataView} +* `data` {string|Buffer|TypedArray|DataView|Object} * `options` {Object|string} * `encoding` {string|null} **Default:** `'utf8'` * `mode` {integer} **Default:** `0o666` @@ -4375,6 +4407,10 @@ this API: [`fs.writeFile()`][]. * `fd` {integer} -* `buffer` {Buffer|TypedArray|DataView} +* `buffer` {Buffer|TypedArray|DataView|string|Object} * `offset` {integer} * `length` {integer} * `position` {integer} @@ -4405,6 +4441,10 @@ this API: [`fs.write(fd, buffer...)`][]. * `fd` {integer} -* `string` {string} +* `string` {string|Object} * `position` {integer} * `encoding` {string} * Returns: {number} The number of bytes written. @@ -4778,13 +4818,17 @@ This function does not work on AIX versions before 7.1, it will resolve the -* `buffer` {Buffer|Uint8Array} +* `buffer` {Buffer|Uint8Array|string|Object} * `offset` {integer} * `length` {integer} * `position` {integer} @@ -4815,19 +4859,23 @@ the end of the file. -* `string` {string} +* `string` {string|Object} * `position` {integer} * `encoding` {string} **Default:** `'utf8'` * Returns: {Promise} -Write `string` to the file. If `string` is not a string, then -an exception will be thrown. +Write `string` to the file. If `string` is not a string, or an +object with an own `toString` function property, then an exception is thrown. The `Promise` is resolved with an object containing a `bytesWritten` property identifying the number of bytes written, and a `buffer` property containing @@ -4851,20 +4899,24 @@ the end of the file. -* `data` {string|Buffer|Uint8Array} +* `data` {string|Buffer|Uint8Array|Object} * `options` {Object|string} * `encoding` {string|null} **Default:** `'utf8'` * Returns: {Promise} Asynchronously writes data to a file, replacing the file if it already exists. -`data` can be a string or a buffer. The `Promise` will be resolved with no -arguments upon success. +`data` can be a string, a buffer, or an object with an own `toString` function +property. The `Promise` is resolved with no arguments upon success. The `encoding` option is ignored if `data` is a buffer. @@ -4991,6 +5043,11 @@ upon success. ### `fsPromises.copyFile(src, dest[, mode])` * `src` {string|Buffer|URL} source filename to copy @@ -5477,6 +5534,10 @@ The `atime` and `mtime` arguments follow these rules: * `file` {string|Buffer|URL|FileHandle} filename or `FileHandle` -* `data` {string|Buffer|Uint8Array} +* `data` {string|Buffer|Uint8Array|Object} * `options` {Object|string} * `encoding` {string|null} **Default:** `'utf8'` * `mode` {integer} **Default:** `0o666` @@ -5492,8 +5553,8 @@ changes: * Returns: {Promise} Asynchronously writes data to a file, replacing the file if it already exists. -`data` can be a string or a buffer. The `Promise` will be resolved with no -arguments upon success. +`data` can be a string, a buffer, or an object with an own `toString` function +property. The `Promise` is resolved with no arguments upon success. The `encoding` option is ignored if `data` is a buffer. @@ -5882,7 +5943,7 @@ the file contents. [`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER [`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw [`ReadStream`]: #fs_class_fs_readstream -[Readable Stream]: #stream_class_stream_readable +[Readable Stream]: stream.html#stream_class_stream_readable [`URL`]: url.html#url_the_whatwg_url_api [`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size [`WriteStream`]: #fs_class_fs_writestream diff --git a/doc/api/http2.md b/doc/api/http2.md index 0e21555aa700d5..f11e6a62fa298a 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -3663,7 +3663,7 @@ following additional properties: [`ClientHttp2Stream`]: #http2_class_clienthttp2stream [`Duplex`]: stream.html#stream_class_stream_duplex [`Http2ServerRequest`]: #http2_class_http2_http2serverrequest -[`Http2ServerResponse`]: #class-http2http2serverresponse +[`Http2ServerResponse`]: #http2_class_http2_http2serverresponse [`Http2Session` and Sockets]: #http2_http2session_and_sockets [`Http2Stream`]: #http2_class_http2stream [`ServerHttp2Stream`]: #http2_class_serverhttp2stream diff --git a/doc/api/index.md b/doc/api/index.md index f5ef2b312f72b3..756b79ec0812dc 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -18,7 +18,7 @@ * [C++ embedder API](embedding.html) * [Child processes](child_process.html) * [Cluster](cluster.html) -* [Command line options](cli.html) +* [Command-line options](cli.html) * [Console](console.html) * [Crypto](crypto.html) * [Debugger](debugger.html) diff --git a/doc/api/module.md b/doc/api/module.md index 383e7214b295ae..797c50b9d6e6b5 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -150,10 +150,10 @@ added: should be fetched. The `error` instance should be passed as the second parameter to `findSourceMap` -in exceptional flows, e.g., when an overridden +in exceptional flows, such as when an overridden [`Error.prepareStackTrace(error, trace)`][] is invoked. Modules are not added to -the module cache until they are successfully loaded, in these cases source maps -will be associated with the `error` instance along with the `path`. +the module cache until they are successfully loaded. In these cases, source maps +are associated with the `error` instance along with the `path`. ### Class: `module.SourceMap` * `module.builtinModules` @@ -964,7 +963,7 @@ This section was moved to ## Source map v3 support This section was moved to -[Modules: `module` core module](modules_module.html#modules_module_source_map_v3_support). +[Modules: `module` core module](module.html#module_source_map_v3_support). * `module.findSourceMap(path[, error])` diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 0292de7f96c55b..3b62d1ecd870c2 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -244,16 +244,92 @@ from version 3 with some additions. This means that it is not necessary to recompile for new versions of Node.js which are listed as supporting a later version. -| | 1 | 2 | 3 | 4 | 5 | 6 | -|-------|----------|----------|----------|----------|-----------|-----------| -| v6.x | | | v6.14.2* | | | | -| v8.x | v8.6.0** | v8.10.0* | v8.11.2 | v8.16.0 | | | -| v9.x | v9.0.0* | v9.3.0* | v9.11.0* | | | | -| v10.x | v10.0.0 | v10.0.0 | v10.0.0 | v10.16.0 | v10.17.0 | v10.20.0 | -| v11.x | v11.0.0 | v11.0.0 | v11.0.0 | v11.8.0 | | | -| v12.x | v12.0.0 | v12.0.0 | v12.0.0 | v12.0.0 | v12.11.0 | v12.17.0 | -| v13.x | v13.0.0 | v13.0.0 | v13.0.0 | v13.0.0 | v13.0.0 | | -| v14.x | v14.0.0 | v14.0.0 | v14.0.0 | v14.0.0 | v14.0.0 | v14.0.0 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
123456
v6.xv6.14.2*
v8.xv8.6.0**v8.10.0*v8.11.2v8.16.0
v9.xv9.0.0*v9.3.0*v9.11.0*
v10.xv10.0.0v10.0.0v10.0.0v10.16.0v10.17.0v10.20.0
v11.xv11.0.0v11.0.0v11.0.0v11.8.0
v12.xv12.0.0v12.0.0v12.0.0v12.0.0v12.11.0v12.17.0
v13.xv13.0.0v13.0.0v13.0.0v13.0.0v13.0.0
v14.xv14.0.0v14.0.0v14.0.0v14.0.0v14.0.0v14.0.0
\* N-API was experimental. @@ -261,6 +337,18 @@ listed as supporting a later version. version 1 but continued to evolve until Node.js 8.6.0. The API is different in versions prior to Node.js 8.6.0. We recommend N-API version 3 or later. +Each API documented for N-API will have a header named `added in:`, and APIs +which are stable will have the additional header `N-API version:`. +APIs are directly usable when using a Node.js version which supports +the N-API version shown in `N-API version:` or higher. +When using a Node.js version that does not support the +`N-API version:` listed or if there is no `N-API version:` listed, +then the API will only be available if +`#define NAPI_EXPERIMENTAL` precedes the inclusion of `node_api.h` +or `js_native_api.h`. If an API appears not to be available on +a version of Node.js which is later than the one shown in `added in:` then +this is most likely the reason for the apparent absence. + The N-APIs associated strictly with accessing ECMAScript features from native code can be found separately in `js_native_api.h` and `js_native_api_types.h`. The APIs defined in these headers are included in `node_api.h` and @@ -1701,8 +1789,16 @@ provided by the addon: ```c napi_value Init(napi_env env, napi_value exports) { napi_status status; - napi_property_descriptor desc = - {"hello", NULL, Method, NULL, NULL, NULL, napi_default, NULL}; + napi_property_descriptor desc = { + "hello", + NULL, + Method, + NULL, + NULL, + NULL, + napi_writable | napi_enumerable | napi_configurable, + NULL + }; status = napi_define_properties(env, exports, 1, &desc); if (status != napi_ok) return NULL; return exports; @@ -1729,7 +1825,7 @@ To define a class so that new instances can be created (often used with napi_value Init(napi_env env, napi_value exports) { napi_status status; napi_property_descriptor properties[] = { - { "value", NULL, NULL, GetValue, SetValue, NULL, napi_default, NULL }, + { "value", NULL, NULL, GetValue, SetValue, NULL, napi_writable | napi_configurable, NULL }, DECLARE_NAPI_METHOD("plusOne", PlusOne), DECLARE_NAPI_METHOD("multiply", Multiply), }; @@ -3458,10 +3554,10 @@ defined in [Section 7.2.14][] of the ECMAScript Language Specification. added: - v13.0.0 - v12.16.0 + - v10.22.0 +napiVersion: 7 --> -> Stability: 1 - Experimental - ```c napi_status napi_detach_arraybuffer(napi_env env, napi_value arraybuffer) @@ -3486,10 +3582,10 @@ defined in [Section 24.1.1.3][] of the ECMAScript Language Specification. added: - v13.3.0 - v12.16.0 + - v10.22.0 +napiVersion: 7 --> -> Stability: 1 - Experimental - ```c napi_status napi_is_detached_arraybuffer(napi_env env, napi_value arraybuffer, @@ -3638,8 +3734,8 @@ if (status != napi_ok) return status; // Set the properties napi_property_descriptor descriptors[] = { - { "foo", NULL, NULL, NULL, NULL, fooValue, napi_default, NULL }, - { "bar", NULL, NULL, NULL, NULL, barValue, napi_default, NULL } + { "foo", NULL, NULL, NULL, NULL, fooValue, napi_writable | napi_configurable, NULL }, + { "bar", NULL, NULL, NULL, NULL, barValue, napi_writable | napi_configurable, NULL } } status = napi_define_properties(env, obj, @@ -3650,6 +3746,12 @@ if (status != napi_ok) return status; ### Structures #### napi_property_attributes + ```c typedef enum { @@ -3661,6 +3763,14 @@ typedef enum { // Used with napi_define_class to distinguish static properties // from instance properties. Ignored by napi_define_properties. napi_static = 1 << 10, + + // Default for class methods. + napi_default_method = napi_writable | napi_configurable, + + // Default for object properties, like in JS obj[prop]. + napi_default_property = napi_writable | + napi_enumerable | + napi_configurable, } napi_property_attributes; ``` @@ -3679,6 +3789,10 @@ They can be one or more of the following bitflags: * `napi_static`: The property will be defined as a static property on a class as opposed to an instance property, which is the default. This is used only by [`napi_define_class`][]. It is ignored by `napi_define_properties`. +* `napi_default_method`: Like a method in a JS class, the property is + configurable and writeable, but not enumerable. +* `napi_default_property`: Like a property set via assignment in JavaScript, the + property is writable, enumerable, and configurable. #### napi_property_descriptor diff --git a/doc/api/path.md b/doc/api/path.md index caefc15e601f1a..e78850fb7d2114 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -87,6 +87,19 @@ path.basename('/foo/bar/baz/asdf/quux.html', '.html'); // Returns: 'quux' ``` +Although Windows usually treats file names, including file extensions, in a +case-insensitive manner, this function does not. For example, `C:\\foo.html` and +`C:\\foo.HTML` refer to the same file, but `basename` treats the extension as a +case-sensitive string: + +```js +path.win32.basename('C:\\foo.html', '.html'); +// Returns: 'foo' + +path.win32.basename('C:\\foo.HTML', '.html'); +// Returns: 'foo.HTML' +``` + A [`TypeError`][] is thrown if `path` is not a string or if `ext` is given and is not a string. @@ -482,7 +495,7 @@ For instance, given the sequence of path segments: `/foo`, `/bar`, `baz`, calling `path.resolve('/foo', '/bar', 'baz')` would return `/bar/baz` because `'baz'` is not an absolute path but `'/bar' + '/' + 'baz'` is. -If after processing all given `path` segments an absolute path has not yet +If, after processing all given `path` segments, an absolute path has not yet been generated, the current working directory is used. The resulting path is normalized and trailing slashes are removed unless the diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index c821cd49dd6a25..67f791653f9421 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -53,13 +53,13 @@ added: v8.5.0 If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline. If `name` is provided, removes only the named mark. -### `performance.eventLoopUtilization([util1][,util2])` +### `performance.eventLoopUtilization([utilization1[, utilization2]])` -* `util1` {Object} The result of a previous call to `eventLoopUtilization()` -* `util2` {Object} The result of a previous call to `eventLoopUtilization()` +* `utilization1` {Object} The result of a previous call to `eventLoopUtilization()` +* `utilization2` {Object} The result of a previous call to `eventLoopUtilization()` prior to `util1` * Returns {Object} * `idle` {number} @@ -72,23 +72,23 @@ high resolution milliseconds timer. The `utilization` value is the calculated Event Loop Utilization (ELU). If bootstrapping has not yet finished, the properties have the value of 0. -`util1` and `util2` are optional parameters. +`utilization1` and `utilization2` are optional parameters. -If `util1` is passed then the delta between the current call's `active` and -`idle` times are calculated and returned (similar to [`process.hrtime()`][]). -Likewise the adjusted `utilization` value is calculated. +If `utilization1` is passed, then the delta between the current call's `active` +and `idle` times, as well as the corresponding `utilization` value are +calculated and returned (similar to [`process.hrtime()`][]). -If `util1` and `util2` are both passed then the calculation adjustments are -done between the two arguments. This is a convenience option because unlike -[`process.hrtime()`][] additional work is done to calculate the ELU. +If `utilization1` and `utilization2` are both passed, then the delta is +calculated between the two arguments. This is a convenience option because, +unlike [`process.hrtime()`][], calculating the ELU is more complex than a +single subtraction. -ELU is similar to CPU utilization except that it is calculated using high -precision wall-clock time. It represents the percentage of time the event loop -has spent outside the event loop's event provider (e.g. `epoll_wait`). No other -CPU idle time is taken into consideration. The following is an example of how -a mostly idle process will have a high ELU. +ELU is similar to CPU utilization, except that it only measures event loop +statistics and not CPU usage. It represents the percentage of time the event +loop has spent outside the event loop's event provider (e.g. `epoll_wait`). +No other CPU idle time is taken into consideration. The following is an example +of how a mostly idle process will have a high ELU. - ```js 'use strict'; const { eventLoopUtilization } = require('perf_hooks').performance; @@ -101,7 +101,7 @@ setImmediate(() => { }); ``` -While the CPU is mostly idle while running this script the value of +Although the CPU is mostly idle while running this script, the value of `utilization` is 1. This is because the call to [`child_process.spawnSync()`][] blocks the event loop from proceeding. @@ -754,7 +754,7 @@ require('some-module'); [`'exit'`]: process.html#process_event_exit [`process.hrtime()`]: process.html#process_process_hrtime_time -[`child_process.spawnSync()`]: #child_process_child_process_spawnsync_command_args_options +[`child_process.spawnSync()`]: child_process.html#child_process_child_process_spawnsync_command_args_options [`timeOrigin`]: https://w3c.github.io/hr-time/#dom-performance-timeorigin [`window.performance`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/performance [Async Hooks]: async_hooks.html diff --git a/doc/api/process.md b/doc/api/process.md index 0b51ef501f61bc..03733b2c7e8e4c 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -440,16 +440,16 @@ $ node --no-warnings The `--trace-warnings` command-line option can be used to have the default console output for warnings include the full stack trace of the warning. -Launching Node.js using the `--throw-deprecation` command line flag will +Launching Node.js using the `--throw-deprecation` command-line flag will cause custom deprecation warnings to be thrown as exceptions. -Using the `--trace-deprecation` command line flag will cause the custom +Using the `--trace-deprecation` command-line flag will cause the custom deprecation to be printed to `stderr` along with the stack trace. -Using the `--no-deprecation` command line flag will suppress all reporting +Using the `--no-deprecation` command-line flag will suppress all reporting of the custom deprecation. -The `*-deprecation` command line flags only affect warnings that use the name +The `*-deprecation` command-line flags only affect warnings that use the name `'DeprecationWarning'`. #### Emitting custom warnings @@ -616,11 +616,11 @@ added: v0.1.27 * {string[]} -The `process.argv` property returns an array containing the command line +The `process.argv` property returns an array containing the command-line arguments passed when the Node.js process was launched. The first element will be [`process.execPath`][]. See `process.argv0` if access to the original value of `argv[0]` is needed. The second element will be the path to the JavaScript -file being executed. The remaining elements will be any additional command line +file being executed. The remaining elements will be any additional command-line arguments. For example, assuming the following script for `process-args.js`: @@ -1768,19 +1768,22 @@ tarball. builds of Node.js and will be missing on all other platforms._ * `lts` {string} a string label identifying the [LTS][] label for this release. This property only exists for LTS releases and is `undefined` for all other - release types, including _Current_ releases. Currently the valid values are: - * `'Argon'` for the 4.x LTS line beginning with 4.2.0. - * `'Boron'` for the 6.x LTS line beginning with 6.9.0. - * `'Carbon'` for the 8.x LTS line beginning with 8.9.1. + release types, including _Current_ releases. + Valid values include the LTS Release Codenames (including those + that are no longer supported). A non-exhaustive example of + these codenames includes: + * `'Dubnium'` for the 10.x LTS line beginning with 10.13.0. + * `'Erbium'` for the 12.x LTS line beginning with 12.13.0. + For other LTS Release Codenames, see [Node.js Changelog Archive](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_ARCHIVE.md) ```js { name: 'node', - lts: 'Argon', - sourceUrl: 'https://nodejs.org/download/release/v4.4.5/node-v4.4.5.tar.gz', - headersUrl: 'https://nodejs.org/download/release/v4.4.5/node-v4.4.5-headers.tar.gz', - libUrl: 'https://nodejs.org/download/release/v4.4.5/win-x64/node.lib' + lts: 'Erbium', + sourceUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1.tar.gz', + headersUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1-headers.tar.gz', + libUrl: 'https://nodejs.org/download/release/v12.18.1/win-x64/node.lib' } ``` @@ -2317,7 +2320,7 @@ important ways: * Pipes (and sockets): *synchronous* on Windows, *asynchronous* on POSIX These behaviors are partly for historical reasons, as changing them would -create backwards incompatibility, but they are also expected by some users. +create backward incompatibility, but they are also expected by some users. Synchronous writes avoid problems such as output written with `console.log()` or `console.error()` being unexpectedly interleaved, or not written at all if @@ -2395,7 +2398,7 @@ the current value of `ps`. When a new value is assigned, different platforms will impose different maximum length restrictions on the title. Usually such restrictions are quite limited. For instance, on Linux and macOS, `process.title` is limited to the size of the -binary name plus the length of the command line arguments because setting the +binary name plus the length of the command-line arguments because setting the `process.title` overwrites the `argv` memory of the process. Node.js v0.8 allowed for longer process title strings by also overwriting the `environ` memory but that was potentially insecure and confusing in some (rather obscure) diff --git a/doc/api/punycode.md b/doc/api/punycode.md index bcdfb9a167fd04..d19d79f8195a78 100644 --- a/doc/api/punycode.md +++ b/doc/api/punycode.md @@ -1,9 +1,6 @@ # Punycode diff --git a/doc/api/readline.md b/doc/api/readline.md index af5e3147d41f4d..8d3eef1ab42aee 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -828,7 +828,7 @@ const { createInterface } = require('readline'); ctrl + w or ctrl + backspace - Delete backwards to a word boundary + Delete backward to a word boundary ctrl + backspace Doesn't work on Linux, Mac and Windows diff --git a/doc/api/repl.md b/doc/api/repl.md index 56dc29fcec8217..fe8115a9536377 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -224,7 +224,7 @@ Error: foo #### `await` keyword -With the [`--experimental-repl-await`][] command line option specified, +With the [`--experimental-repl-await`][] command-line option specified, experimental support for the `await` keyword is enabled. ```console @@ -246,8 +246,8 @@ added: v13.6.0 --> The REPL supports bi-directional reverse-i-search similar to [ZSH][]. It is -triggered with ` + R` to search backwards and ` + S` to search -forwards. +triggered with ` + R` to search backward and ` + S` to search +forward. Duplicated history entires will be skipped. @@ -537,7 +537,7 @@ added: v11.10.0 * `repl` {repl.REPLServer} Initializes a history log file for the REPL instance. When executing the -Node.js binary and using the command line REPL, a history file is initialized +Node.js binary and using the command-line REPL, a history file is initialized by default. However, this is not the case when creating a REPL programmatically. Use this method to initialize a history log file when working with REPL instances programmatically. @@ -565,6 +565,9 @@ changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/19187 description: The `REPL_MAGIC_MODE` `replMode` was removed. + - version: v6.3.0 + pr-url: https://github.com/nodejs/node/pull/6635 + description: The `breakEvalOnSigint` option is supported now. - version: v5.8.0 pr-url: https://github.com/nodejs/node/pull/5388 description: The `options` parameter is optional now. @@ -738,21 +741,21 @@ For an example of running a "full-featured" (`terminal`) REPL over a `net.Server` and `net.Socket` instance, see: . -For an example of running a REPL instance over [curl(1)][], see: +For an example of running a REPL instance over [`curl(1)`][], see: . +[TTY keybindings]: readline.html#readline_tty_keybindings [ZSH]: https://en.wikipedia.org/wiki/Z_shell [`'uncaughtException'`]: process.html#process_event_uncaughtexception [`--experimental-repl-await`]: cli.html#cli_experimental_repl_await [`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`]: errors.html#errors_err_domain_cannot_set_uncaught_exception_capture [`ERR_INVALID_REPL_INPUT`]: errors.html#errors_err_invalid_repl_input +[`curl(1)`]: https://curl.haxx.se/docs/manpage.html [`domain`]: domain.html [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn [`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function [`repl.ReplServer`]: #repl_class_replserver [`repl.start()`]: #repl_repl_start_options -[`util.inspect()`]: util.html#util_util_inspect_object_options [`reverse-i-search`]: #repl_reverse_i_search -[TTY keybindings]: readline.html#readline_tty_keybindings -[curl(1)]: https://curl.haxx.se/docs/manpage.html +[`util.inspect()`]: util.html#util_util_inspect_object_options [stream]: stream.html diff --git a/doc/api/synopsis.md b/doc/api/synopsis.md index 8ae933a499a16c..1a8fd3ab4bbc88 100644 --- a/doc/api/synopsis.md +++ b/doc/api/synopsis.md @@ -7,7 +7,7 @@ `node [options] [V8 options] [script.js | -e "script" | - ] [arguments]` -Please see the [Command Line Options][] document for more information. +Please see the [Command-line options][] document for more information. ## Example An example of a [web server][] written with Node.js which responds with @@ -86,6 +86,6 @@ Now, open any preferred web browser and visit `http://127.0.0.1:3000`. If the browser displays the string `Hello, World!`, that indicates the server is working. -[Command Line Options]: cli.html#cli_command_line_options +[Command-line options]: cli.html#cli_command_line_options [this guide]: https://nodejs.org/en/download/package-manager/ [web server]: http.html diff --git a/doc/api/timers.md b/doc/api/timers.md index f114d0f1766c6e..c3c0e825815b4a 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -130,15 +130,14 @@ of the Node.js application. added: v14.9.0 --> -* Returns: {integer} number that can be used to reference this `timeout` - -Coerce a `Timeout` to a primitive, a primitive will be generated that -can be used to clear the `Timeout`. -The generated number can only be used in the same thread where timeout -was created. Therefore to use it cross [`worker_threads`][] it has -to first be passed to a correct thread. -This allows enhanced compatibility with browser's `setTimeout()`, and -`setInterval()` implementations. +* Returns: {integer} a number that can be used to reference this `timeout` + +Coerce a `Timeout` to a primitive. The primitive can be used to +clear the `Timeout`. The primitive can only be used in the +same thread where the timeout was created. Therefore, to use it +across [`worker_threads`][] it must first be passed to the correct +thread. This allows enhanced compatibility with browser +`setTimeout()` and `setInterval()` implementations. ## Scheduling timers diff --git a/doc/api/tls.md b/doc/api/tls.md index 7746f25df8dda5..19ec9e1aa38b26 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -308,10 +308,10 @@ HIGH !CAMELLIA ``` -This default can be replaced entirely using the [`--tls-cipher-list`][] command -line switch (directly, or via the [`NODE_OPTIONS`][] environment variable). For -instance, the following makes `ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS -cipher suite: +This default can be replaced entirely using the [`--tls-cipher-list`][] +command-line switch (directly, or via the [`NODE_OPTIONS`][] environment +variable). For instance, the following makes `ECDHE-RSA-AES128-GCM-SHA256:!RC4` +the default TLS cipher suite: ```bash node --tls-cipher-list='ECDHE-RSA-AES128-GCM-SHA256:!RC4' server.js diff --git a/doc/api/util.md b/doc/api/util.md index e39fb08e240a04..bc75caa1b7bcbe 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -217,20 +217,20 @@ fn1(); // Emits a deprecation warning with code DEP0001 fn2(); // Does not emit a deprecation warning because it has the same code ``` -If either the `--no-deprecation` or `--no-warnings` command line flags are +If either the `--no-deprecation` or `--no-warnings` command-line flags are used, or if the `process.noDeprecation` property is set to `true` *prior* to the first deprecation warning, the `util.deprecate()` method does nothing. -If the `--trace-deprecation` or `--trace-warnings` command line flags are set, +If the `--trace-deprecation` or `--trace-warnings` command-line flags are set, or the `process.traceDeprecation` property is set to `true`, a warning and a stack trace are printed to `stderr` the first time the deprecated function is called. -If the `--throw-deprecation` command line flag is set, or the +If the `--throw-deprecation` command-line flag is set, or the `process.throwDeprecation` property is set to `true`, then an exception will be thrown when the deprecated function is called. -The `--throw-deprecation` command line flag and `process.throwDeprecation` +The `--throw-deprecation` command-line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation` and `process.traceDeprecation`. diff --git a/doc/api/v8.md b/doc/api/v8.md index 921c4378199496..a70567475f03d8 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -21,7 +21,7 @@ added: v8.0.0 * Returns: {integer} Returns an integer representing a "version tag" derived from the V8 version, -command line flags and detected CPU features. This is useful for determining +command-line flags and detected CPU features. This is useful for determining whether a [`vm.Script`][] `cachedData` buffer is compatible with this instance of V8. @@ -198,7 +198,7 @@ added: v1.0.0 * `flags` {string} The `v8.setFlagsFromString()` method can be used to programmatically set -V8 command line flags. This method should be used with care. Changing settings +V8 command-line flags. This method should be used with care. Changing settings after the VM has started may result in unpredictable behavior, including crashes and data loss; or it may simply do nothing. diff --git a/doc/api/wasi.md b/doc/api/wasi.md index b08c6c5558fcda..85a75bd104f857 100644 --- a/doc/api/wasi.md +++ b/doc/api/wasi.md @@ -83,7 +83,7 @@ added: The `WASI` class provides the WASI system call API and additional convenience methods for working with WASI-based applications. Each `WASI` instance represents a distinct sandbox environment. For security purposes, each `WASI` -instance must have its command line arguments, environment variables, and +instance must have its command-line arguments, environment variables, and sandbox directory structure configured explicitly. ### `new WASI([options])` @@ -95,7 +95,7 @@ added: * `options` {Object} * `args` {Array} An array of strings that the WebAssembly application will - see as command line arguments. The first argument is the virtual path to the + see as command-line arguments. The first argument is the virtual path to the WASI command itself. **Default:** `[]`. * `env` {Object} An object similar to `process.env` that the WebAssembly application will see as its environment. **Default:** `{}`. diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 5abafa6f9905bd..af170888be8f38 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -539,9 +539,8 @@ a code { #column2 ul li a.active, #column2 ul li a.active:hover, #column2 ul li a.active:focus { - color: #43853d; - border-radius: 0; - border-bottom: 1px solid #43853d; + font-weight: 700; + color: #fff; background-color: transparent; } diff --git a/doc/changelogs/CHANGELOG_V14.md b/doc/changelogs/CHANGELOG_V14.md index 86bda5aa6ef8fe..e26fc41877f30c 100644 --- a/doc/changelogs/CHANGELOG_V14.md +++ b/doc/changelogs/CHANGELOG_V14.md @@ -43,6 +43,91 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2020-09-22, Version 14.12.0 (Current), @ruyadorno + +### Notable changes + +* **deps**: + * update to uvwasi 0.0.11 (Colin Ihrig) [#35104](https://github.com/nodejs/node/pull/35104) +* **n-api**: + * create N-API version 7 (Gabriel Schulhof) [#35199](https://github.com/nodejs/node/pull/35199) + * add more property defaults (Gerhard Stoebich) [#35214](https://github.com/nodejs/node/pull/35214) + +### Commits +* [[`5229ffadcf`](https://github.com/nodejs/node/commit/5229ffadcf)] - **buffer**: adjust validation to account for buffer.kMaxLength (Anna Henningsen) [#35134](https://github.com/nodejs/node/pull/35134) +* [[`3d78686987`](https://github.com/nodejs/node/commit/3d78686987)] - **build**: increase API requests for stale action (Phillip Johnsen) [#35235](https://github.com/nodejs/node/pull/35235) +* [[`f2cc1c22c1`](https://github.com/nodejs/node/commit/f2cc1c22c1)] - **build**: filter issues & PRs to auto close by matching on stalled label (Phillip Johnsen) [#35159](https://github.com/nodejs/node/pull/35159) +* [[`f3c45a1cef`](https://github.com/nodejs/node/commit/f3c45a1cef)] - ***Revert*** "**build**: require "allow edits" to be checked" (Rich Trott) [#35094](https://github.com/nodejs/node/pull/35094) +* [[`1bb0ed3c6a`](https://github.com/nodejs/node/commit/1bb0ed3c6a)] - **crypto**: improve invalid arg type message for randomInt() (Rich Trott) [#35089](https://github.com/nodejs/node/pull/35089) +* [[`3573545315`](https://github.com/nodejs/node/commit/3573545315)] - **crypto**: improve randomInt out-of-range error message (Rich Trott) [#35088](https://github.com/nodejs/node/pull/35088) +* [[`d4389b59b4`](https://github.com/nodejs/node/commit/d4389b59b4)] - **deps**: update to uvwasi 0.0.11 (Colin Ihrig) [#35104](https://github.com/nodejs/node/pull/35104) +* [[`836680a4ea`](https://github.com/nodejs/node/commit/836680a4ea)] - **doc**: use present tense in error messages (Rich Trott) [#35164](https://github.com/nodejs/node/pull/35164) +* [[`b860a7f61c`](https://github.com/nodejs/node/commit/b860a7f61c)] - **doc**: standardize on \_backward\_ (Rich Trott) [#35243](https://github.com/nodejs/node/pull/35243) +* [[`d82dd0c773`](https://github.com/nodejs/node/commit/d82dd0c773)] - **doc**: revise stability section of values doc (Rich Trott) [#35242](https://github.com/nodejs/node/pull/35242) +* [[`2bc335dcf6`](https://github.com/nodejs/node/commit/2bc335dcf6)] - **doc**: clarify napi\_property\_attributes text (Rich Trott) [#35253](https://github.com/nodejs/node/pull/35253) +* [[`b62d9b47be`](https://github.com/nodejs/node/commit/b62d9b47be)] - **doc**: remove excessive formatting in dgram.md (Rich Trott) [#35234](https://github.com/nodejs/node/pull/35234) +* [[`b9161f408f`](https://github.com/nodejs/node/commit/b9161f408f)] - **doc**: sort repl references in ASCII order (Rich Trott) [#35230](https://github.com/nodejs/node/pull/35230) +* [[`d195d20dbc`](https://github.com/nodejs/node/commit/d195d20dbc)] - **doc**: relax prohibition on personal pronouns (Rich Trott) [#34353](https://github.com/nodejs/node/pull/34353) +* [[`6119e9511c`](https://github.com/nodejs/node/commit/6119e9511c)] - **doc**: clarify use of NAPI\_EXPERIMENTAL (Michael Dawson) [#35195](https://github.com/nodejs/node/pull/35195) +* [[`6d4ab36175`](https://github.com/nodejs/node/commit/6d4ab36175)] - **doc**: update attributes used by n-api samples (#35220) (Gerhard Stoebich) +* [[`7610fe500e`](https://github.com/nodejs/node/commit/7610fe500e)] - **doc**: add issue labels sections to release guide (Michaël Zasso) [#35224](https://github.com/nodejs/node/pull/35224) +* [[`2308be06b3`](https://github.com/nodejs/node/commit/2308be06b3)] - **doc**: fix header level for error code (Rich Trott) [#35219](https://github.com/nodejs/node/pull/35219) +* [[`64ac5c68aa`](https://github.com/nodejs/node/commit/64ac5c68aa)] - **doc**: fix small grammatical issues in timers.md (Turner Jabbour) [#35203](https://github.com/nodejs/node/pull/35203) +* [[`92a14d3c72`](https://github.com/nodejs/node/commit/92a14d3c72)] - **doc**: add technical values document (Michael Dawson) [#35145](https://github.com/nodejs/node/pull/35145) +* [[`dbfd3b261d`](https://github.com/nodejs/node/commit/dbfd3b261d)] - **doc**: remove "end user" (Rich Trott) [#35200](https://github.com/nodejs/node/pull/35200) +* [[`c1c93a6cde`](https://github.com/nodejs/node/commit/c1c93a6cde)] - **doc**: use command-line/command line consistently (Rich Trott) [#35198](https://github.com/nodejs/node/pull/35198) +* [[`70ec369b76`](https://github.com/nodejs/node/commit/70ec369b76)] - **doc**: replace "you should do X" with "do X" (Rich Trott) [#35194](https://github.com/nodejs/node/pull/35194) +* [[`e5fffe2f8f`](https://github.com/nodejs/node/commit/e5fffe2f8f)] - **doc**: fix missing word in dgram.md (Tom Atkinson) [#35231](https://github.com/nodejs/node/pull/35231) +* [[`c1e16d15dd`](https://github.com/nodejs/node/commit/c1e16d15dd)] - **doc**: fix deprecation documentation inconsistencies (Antoine du HAMEL) [#35082](https://github.com/nodejs/node/pull/35082) +* [[`910deff2de`](https://github.com/nodejs/node/commit/910deff2de)] - **doc**: fix broken link in crypto.md (Rich Trott) [#35181](https://github.com/nodejs/node/pull/35181) +* [[`066148d229`](https://github.com/nodejs/node/commit/066148d229)] - **doc**: remove problematic auto-linking of curl man pages (Rich Trott) [#35174](https://github.com/nodejs/node/pull/35174) +* [[`aea3f77c8d`](https://github.com/nodejs/node/commit/aea3f77c8d)] - **doc**: update eventLoopUtilization documentation (Anna Henningsen) [#35155](https://github.com/nodejs/node/pull/35155) +* [[`32d1731ae1`](https://github.com/nodejs/node/commit/32d1731ae1)] - **doc**: update process.release (schamberg97) [#35167](https://github.com/nodejs/node/pull/35167) +* [[`176e9e4054`](https://github.com/nodejs/node/commit/176e9e4054)] - **doc**: fix broken links in modules.md (Rich Trott) [#35182](https://github.com/nodejs/node/pull/35182) +* [[`dc4c5696da`](https://github.com/nodejs/node/commit/dc4c5696da)] - **doc**: add missing copyFile change history (Shelley Vohr) [#35056](https://github.com/nodejs/node/pull/35056) +* [[`e8d479ed67`](https://github.com/nodejs/node/commit/e8d479ed67)] - **doc**: perform cleanup on security-release-process.md (Rich Trott) [#35154](https://github.com/nodejs/node/pull/35154) +* [[`99785e48ea`](https://github.com/nodejs/node/commit/99785e48ea)] - **doc**: fix minor punctuation issue in path.md (Amila Welihinda) [#35127](https://github.com/nodejs/node/pull/35127) +* [[`ae85228e54`](https://github.com/nodejs/node/commit/ae85228e54)] - **doc**: perform minor cleanup on cli.md (Rich Trott) [#35152](https://github.com/nodejs/node/pull/35152) +* [[`e4105140e7`](https://github.com/nodejs/node/commit/e4105140e7)] - **doc**: improve table accessibility (Rich Trott) [#35146](https://github.com/nodejs/node/pull/35146) +* [[`7dbcd24541`](https://github.com/nodejs/node/commit/7dbcd24541)] - **doc**: fix left nav color contrast (Rich Trott) [#35141](https://github.com/nodejs/node/pull/35141) +* [[`331142ca25`](https://github.com/nodejs/node/commit/331142ca25)] - **doc**: update contact info for Ash Cripps (Ash Cripps) [#35139](https://github.com/nodejs/node/pull/35139) +* [[`df70861863`](https://github.com/nodejs/node/commit/df70861863)] - **doc**: simplify circular dependencies text in modules.md (Rich Trott) [#35126](https://github.com/nodejs/node/pull/35126) +* [[`f4e714aaf5`](https://github.com/nodejs/node/commit/f4e714aaf5)] - **doc**: update my email address (Michael Dawson) [#35121](https://github.com/nodejs/node/pull/35121) +* [[`46b9f4b376`](https://github.com/nodejs/node/commit/46b9f4b376)] - **doc**: add missing changes entry for breakEvalOnSigint REPL option (Anna Henningsen) [#35143](https://github.com/nodejs/node/pull/35143) +* [[`122edad98b`](https://github.com/nodejs/node/commit/122edad98b)] - **doc**: update security process (Michael Dawson) [#35107](https://github.com/nodejs/node/pull/35107) +* [[`aa93c1c22d`](https://github.com/nodejs/node/commit/aa93c1c22d)] - **doc**: fix broken link in perf\_hooks.md (Rich Trott) [#35113](https://github.com/nodejs/node/pull/35113) +* [[`5c8d2083c5`](https://github.com/nodejs/node/commit/5c8d2083c5)] - **doc**: fix broken link in http2.md (Rich Trott) [#35112](https://github.com/nodejs/node/pull/35112) +* [[`f4e958fc0c`](https://github.com/nodejs/node/commit/f4e958fc0c)] - **doc**: fix broken link in fs.md (Rich Trott) [#35111](https://github.com/nodejs/node/pull/35111) +* [[`79c6d92e49`](https://github.com/nodejs/node/commit/79c6d92e49)] - **doc**: fix broken links in deprecations.md (Rich Trott) [#35109](https://github.com/nodejs/node/pull/35109) +* [[`93e4d545d8`](https://github.com/nodejs/node/commit/93e4d545d8)] - **doc**: add note about path.basename on Windows (Tobias Nießen) [#35065](https://github.com/nodejs/node/pull/35065) +* [[`0a2610a7aa`](https://github.com/nodejs/node/commit/0a2610a7aa)] - **doc**: avoid double-while sentence in perf\_hooks.md (Rich Trott) [#35078](https://github.com/nodejs/node/pull/35078) +* [[`1cf9934e4e`](https://github.com/nodejs/node/commit/1cf9934e4e)] - **doc**: make minor improvements to module.md (Rich Trott) [#35083](https://github.com/nodejs/node/pull/35083) +* [[`fb89be63be`](https://github.com/nodejs/node/commit/fb89be63be)] - **doc**: use correct Error type for EventEmitter.defaultMaxListener (Rich Trott) [#35069](https://github.com/nodejs/node/pull/35069) +* [[`b75822dd93`](https://github.com/nodejs/node/commit/b75822dd93)] - **doc,test**: specify and test CLI option precedence rules (Anna Henningsen) [#35106](https://github.com/nodejs/node/pull/35106) +* [[`4bde865145`](https://github.com/nodejs/node/commit/4bde865145)] - **errors**: simplify ERR\_REQUIRE\_ESM message generation (Rich Trott) [#35123](https://github.com/nodejs/node/pull/35123) +* [[`6e622d6337`](https://github.com/nodejs/node/commit/6e622d6337)] - **esm**: better package.json parser errors (Guy Bedford) [#35117](https://github.com/nodejs/node/pull/35117) +* [[`beb75bd031`](https://github.com/nodejs/node/commit/beb75bd031)] - **fs**: loosen validation to allow objects with an own toString function (Jordan Harband) [#34993](https://github.com/nodejs/node/pull/34993) +* [[`8ea28536d0`](https://github.com/nodejs/node/commit/8ea28536d0)] - **http**: only set keep-alive when not exists (atian25@qq.com) [#35138](https://github.com/nodejs/node/pull/35138) +* [[`977b0ed865`](https://github.com/nodejs/node/commit/977b0ed865)] - **http**: allow Content-Length header for 304 responses (Arnaud Lefebvre) [#34835](https://github.com/nodejs/node/pull/34835) +* [[`d8b57140b4`](https://github.com/nodejs/node/commit/d8b57140b4)] - **https**: set requestTimeout default to 0 (Robert Nagy) [#35264](https://github.com/nodejs/node/pull/35264) +* [[`12f2934224`](https://github.com/nodejs/node/commit/12f2934224)] - **meta**: add links to OpenJSF Slack (Mary Marchini) [#35128](https://github.com/nodejs/node/pull/35128) +* [[`f21a5c6200`](https://github.com/nodejs/node/commit/f21a5c6200)] - **meta**: update my collab entry (devsnek) [#35160](https://github.com/nodejs/node/pull/35160) +* [[`76e24f9aa9`](https://github.com/nodejs/node/commit/76e24f9aa9)] - **module**: use isURLInstance instead of instanceof (Antoine du HAMEL) [#34951](https://github.com/nodejs/node/pull/34951) +* [[`314483cd09`](https://github.com/nodejs/node/commit/314483cd09)] - **module**: fix specifier resolution option value (himself65) [#35098](https://github.com/nodejs/node/pull/35098) +* [[`ca1181615e`](https://github.com/nodejs/node/commit/ca1181615e)] - **(SEMVER-MINOR)** **n-api**: create N-API version 7 (Gabriel Schulhof) [#35199](https://github.com/nodejs/node/pull/35199) +* [[`7f3b2b2a1f`](https://github.com/nodejs/node/commit/7f3b2b2a1f)] - **(SEMVER-MINOR)** **n-api**: add more property defaults (Gerhard Stoebich) [#35214](https://github.com/nodejs/node/pull/35214) +* [[`4f4faa8e3c`](https://github.com/nodejs/node/commit/4f4faa8e3c)] - **readline**: fix key name for function keys with modifiers (DrunkenPoney) [#35268](https://github.com/nodejs/node/pull/35268) +* [[`e29e2daf4c`](https://github.com/nodejs/node/commit/e29e2daf4c)] - **test**: improve assertions in pummel/test-timers (Rich Trott) [#35216](https://github.com/nodejs/node/pull/35216) +* [[`8357b56984`](https://github.com/nodejs/node/commit/8357b56984)] - **test**: add wasi readdir() test (Colin Ihrig) [#35202](https://github.com/nodejs/node/pull/35202) +* [[`49da459ce6`](https://github.com/nodejs/node/commit/49da459ce6)] - **test**: improve pummel/test-timers.js (Rich Trott) [#35175](https://github.com/nodejs/node/pull/35175) +* [[`379c5cefd7`](https://github.com/nodejs/node/commit/379c5cefd7)] - **test**: revise test-policy-integrity (Rich Trott) [#35101](https://github.com/nodejs/node/pull/35101) +* [[`6627c1f8e4`](https://github.com/nodejs/node/commit/6627c1f8e4)] - **test**: remove setMaxListeners in test-crypto-random (Tobias Nießen) [#35079](https://github.com/nodejs/node/pull/35079) +* [[`bc38485fb1`](https://github.com/nodejs/node/commit/bc38485fb1)] - **test**: fix comment about DNS lookup test (Tobias Nießen) [#35080](https://github.com/nodejs/node/pull/35080) +* [[`9faaa659b2`](https://github.com/nodejs/node/commit/9faaa659b2)] - **test**: separate the test fixtures between ICU and URL (Leko) [#35077](https://github.com/nodejs/node/pull/35077) +* [[`25f93f3ec3`](https://github.com/nodejs/node/commit/25f93f3ec3)] - **test**: add more valid results to test-trace-atomics-wait (Anna Henningsen) [#35066](https://github.com/nodejs/node/pull/35066) +* [[`0a97f44b50`](https://github.com/nodejs/node/commit/0a97f44b50)] - **tools**: update ESLint to 7.9.0 (Colin Ihrig) [#35170](https://github.com/nodejs/node/pull/35170) + ## 2020-09-15, Version 14.11.0 (Current), @richardlau diff --git a/doc/guides/contributing/pull-requests.md b/doc/guides/contributing/pull-requests.md index f7c76f3324edf9..18c84068380fa4 100644 --- a/doc/guides/contributing/pull-requests.md +++ b/doc/guides/contributing/pull-requests.md @@ -46,7 +46,16 @@ Node.js. We cannot accept such patches. In case of doubt, open an issue in the [issue tracker](https://github.com/nodejs/node/issues/) or contact one of the [project Collaborators](https://github.com/nodejs/node/#current-project-team-members). -Node.js has two IRC channels: + +Node.js has many channels on the +[OpenJS Foundation Slack](https://slack-invite.openjsf.org/). Interesting +channels are: +[#nodejs](https://openjs-foundation.slack.com/archives/CK9Q4MB53) for general +help, questions and discussions. +[#nodejs-dev](https://openjs-foundation.slack.com/archives/C019Y2T6STH) for +development of Node.js core specifically. + +Node.js also has two IRC channels: [#Node.js](https://webchat.freenode.net/?channels=node.js) for general help and questions, and [#node-dev](https://webchat.freenode.net/?channels=node-dev) for development of diff --git a/doc/guides/doc-style-guide.md b/doc/guides/doc-style-guide.md index 5e4f8db3ddb071..b44206ff9e2791 100644 --- a/doc/guides/doc-style-guide.md +++ b/doc/guides/doc-style-guide.md @@ -19,11 +19,11 @@ this guide. * Check changes to documentation with `make lint-md`. * [Use US spelling][]. * [Use serial commas][]. -* Avoid personal pronouns (_I_, _you_, _we_) in reference documentation. - * Personal pronouns are acceptable in colloquial documentation such as guides. - * Use gender-neutral pronouns and gender-neutral plural nouns. - * OK: _they_, _their_, _them_, _folks_, _people_, _developers_ - * NOT OK: _his_, _hers_, _him_, _her_, _guys_, _dudes_ +* Avoid first-person pronouns (_I_, _we_). + * Exception: _we recommend foo_ is preferable to _foo is recommended_. +* Use gender-neutral pronouns and gender-neutral plural nouns. + * OK: _they_, _their_, _them_, _folks_, _people_, _developers_ + * NOT OK: _his_, _hers_, _him_, _her_, _guys_, _dudes_ * When combining wrapping elements (parentheses and quotes), place terminal punctuation: * Inside the wrapping element if the wrapping element contains a complete diff --git a/doc/guides/releases.md b/doc/guides/releases.md index d4f2a2ac962771..c828a4b2826821 100644 --- a/doc/guides/releases.md +++ b/doc/guides/releases.md @@ -747,6 +747,14 @@ For example: The changes must be made as part of a new semver-minor release. +### Update release labels + +The `lts-watch-vN.x` issue label must be created, with the same color as other +existing labels for that release line, such as `vN.x`. + +If the release is transitioning from Active LTS to Maintenance, the +`backport-requested-vN.x` label must be deleted. + ## Major Releases The process for cutting a new Node.js major release has a number of differences @@ -783,6 +791,21 @@ One month or less before the release date, commits must be cherry-picked into the two branches. To land `SEMVER-MAJOR` at this time requires no objections from the TSC. +### Create release labels + +The following issue labels must be created: + +* `vN.x` +* `backport-blocked-vN.x` +* `backport-open-vN.x` +* `backport-requested-vN.x` +* `backported-to-vN.x` +* `dont-land-on-vN.x` + +The label description can be copied from existing labels of previous releases. +The label color must be the same for all new labels, but different from the +labels of previous releases. + ### Release Proposal A draft release proposal should be created two months before the release. A diff --git a/doc/guides/security-release-process.md b/doc/guides/security-release-process.md index acf6b56558e3ae..0ada9b63742615 100644 --- a/doc/guides/security-release-process.md +++ b/doc/guides/security-release-process.md @@ -1,8 +1,8 @@ -# Security Release Process +# Security release process The security release process covers the steps required to plan/implement a security release. This document is copied into the description of the Next -Security Release, and used to track progress on the release. It contains ***TEXT +Security Release and used to track progress on the release. It contains ***TEXT LIKE THIS*** which will be replaced during the release process with the information described. @@ -17,7 +17,7 @@ information described. * ... * [ ] PR release announcements in [private](https://github.com/nodejs-private/nodejs.org-private): - * (Use previous PRs as templates, don't forget to update the site banner, and + * (Use previous PRs as templates. Don't forget to update the site banner and the date in the slug so that it will move to the top of the blog list.) * [ ] pre-release: ***LINK TO PR*** * [ ] post-release: ***LINK TO PR*** @@ -44,6 +44,10 @@ information described. (Re-PR the pre-approved branch from nodejs-private/nodejs.org-private to nodejs/nodejs.org) +* [ ] Post in the #nodejs-social channel in the OpenJS Foundation Slack + asking that the social team tweet/retweet the pre-announcement. + If you are on Twitter, you can just direct message the `@nodejs` handle. + * [ ] Request releaser(s) to start integrating the PRs to be released. * [ ] Notify [docker-node][] of upcoming security release date: ***LINK*** @@ -65,9 +69,9 @@ information described. * (Re-PR the pre-approved branch from nodejs-private/nodejs.org-private to nodejs/nodejs.org) -* [ ] Email `"Rachel Romoff" ` to tweet an - announcement, or if you are on twitter you can just direct message the - `@nodejs` handle. +* [ ] Post in the #nodejs-social channel in the OpenJS Foundation Slack + asking that the social team tweet/retweet the announcement. + If you are on Twitter, you can just direct message the `@nodejs` handle. * [ ] Comment in [docker-node][] issue that release is ready for integration. The docker-node team will build and release docker image updates. @@ -89,5 +93,5 @@ information described. [H1 CVE requests]: https://hackerone.com/nodejs/cve_requests [docker-node]: https://github.com/nodejs/docker-node/issues -[nodejs/build]: https://github.com/nodejs/build/issues [email]: https://groups.google.com/forum/#!forum/nodejs-sec +[nodejs/build]: https://github.com/nodejs/build/issues diff --git a/doc/guides/technical-values.md b/doc/guides/technical-values.md new file mode 100644 index 00000000000000..d79fde6a461021 --- /dev/null +++ b/doc/guides/technical-values.md @@ -0,0 +1,61 @@ +# Technical values and priorities + +The project uses these technical values to establish priorities and guide +collaboration. + +## Values and priority level + +* Priority 1 - Developer experience +* Priority 2 - Stability +* Priority 3 - Operational qualities +* Priority 4 - Node.js maintainer experience +* Priority 5 - Up to date Technology and APIs + +## Value descriptions + +### 1 - Developer experience +We value ensuring that developers are productive and enjoy developing +with Node.js. Some key elements of this include: +* Approachability (both technical and community) +* Great documentation +* Bundling friction-reducing APIs and components, even though + they could be provided externally +* Enabling/supporting external packages to ensure overall developer experience + +### 2 - Stability +Whenever possible, we seek to ensure that working code continues to work. To +keep the trust of developers and users, we value stability. +Some key elements of this include: +* Backward compatibility +* Stable releases on a predictable schedule +* A strong safety net, including testing how changes + in Node.js affect popular packages +* Careful consideration of what goes into long term support (LTS) releases + +### 3 - Operational qualities +We value keeping Node.js safe, performant, and lightweight. +We value enabling the ability to investigate and debug problems in +development and production. Some key elements of this include: +* High throughput (speed) +* Fast startup +* Small binary size +* Small memory footprint +* High-quality debugging tools +* Robust diagnostic tools (profilers, etc.) +* Responsible security practices + +### 4 - Node.js maintainer experience +We value the productivity and happiness of the Node.js maintainers. +Some key elements of this include: +* Approachability of the codebase +* Good internal documentation and guides +* Low-friction policies and processes +* Good CI and tooling to make maintainers productive + +### 5 - Up to date Technology and APIs +We value providing developers with modern APIs and technologies +following existing standards whenever possible. +Some key elements of this include: +* Participating in standards work and organizations +* Web API compatibility +* Supporting and exposing new technologies and standards through early adoption diff --git a/doc/node.1 b/doc/node.1 index 45c82c2009ec66..f52014dbdcb9dc 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -95,7 +95,7 @@ The directory where the CPU profiles generated by will be placed. The default value is controlled by the .Fl -diagnostic-dir . -command line option. +command-line option. . .It Fl -cpu-prof-interval The sampling interval in microseconds for the CPU profiles generated by @@ -198,7 +198,7 @@ The directory where the heap profiles generated by will be placed. The default value is controlled by the .Fl -diagnostic-dir . -command line option. +command-line option. . .It Fl -heap-prof-interval The average sampling interval in bytes for the heap profiles generated by @@ -319,7 +319,7 @@ will be generated. The `file` name may be an absolute path. If it is not, the default directory it will be written to is controlled by the .Fl -diagnostic-dir . -command line option. +command-line option. . .It Fl -report-filename Name of the file to which the @@ -554,7 +554,7 @@ process warnings are silenced. .It Ev NODE_OPTIONS Ar options... A space-separated list of command-line .Ar options , -which are interpreted as if they had been specified on the command-line before the actual command (so they can be overridden). +which are interpreted as if they had been specified on the command line before the actual command (so they can be overridden). Node.js will exit with an error if an option that is not allowed in the environment is used, such as .Fl -print or a script file. @@ -580,7 +580,7 @@ Write process warnings to the given instead of printing to stderr. Equivalent to passing .Fl -redirect-warnings Ar file -on command-line. +on the command line. .It Ev NODE_REPL_HISTORY Ar file Path to the .Ar file diff --git a/lib/_http_client.js b/lib/_http_client.js index d19fa7c68107c7..320ab7dcb996ba 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -643,6 +643,11 @@ function parserOnIncomingClient(res, shouldKeepAlive) { if (method === 'HEAD') return 1; // Skip body but don't treat as Upgrade. + if (res.statusCode === 304) { + res.complete = true; + return 1; // Skip body as there won't be any + } + return 0; // No special treatment. } diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index f1392b6335ccad..d385109eed66c8 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -100,6 +100,7 @@ function OutgoingMessage() { this._last = false; this.chunkedEncoding = false; this.shouldKeepAlive = true; + this._defaultKeepAlive = true; this.useChunkedEncodingByDefault = true; this.sendDate = false; this._removedConnection = false; @@ -422,8 +423,8 @@ function _storeHeader(firstLine, headers) { (state.contLen || this.useChunkedEncodingByDefault || this.agent); if (shouldSendKeepAlive) { header += 'Connection: keep-alive\r\n'; - if (this._keepAliveTimeout) { - const timeoutSeconds = MathFloor(this._keepAliveTimeout) / 1000; + if (this._keepAliveTimeout && this._defaultKeepAlive) { + const timeoutSeconds = MathFloor(this._keepAliveTimeout / 1000); header += `Keep-Alive: timeout=${timeoutSeconds}\r\n`; } } else { @@ -519,6 +520,9 @@ function matchHeader(self, state, field, value) { case 'trailer': state[field] = true; break; + case 'keep-alive': + self._defaultKeepAlive = false; + break; } } diff --git a/lib/_http_server.js b/lib/_http_server.js index a88900aaf33e03..8fa2aff627bc48 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -364,7 +364,7 @@ function Server(options, requestListener) { this.keepAliveTimeout = 5000; this.maxHeadersCount = null; this.headersTimeout = 60 * 1000; // 60 seconds - this.requestTimeout = 0; // 120 seconds + this.requestTimeout = 0; } ObjectSetPrototypeOf(Server.prototype, net.Server.prototype); ObjectSetPrototypeOf(Server, net.Server); diff --git a/lib/buffer.js b/lib/buffer.js index 90ebe8866b582c..bed6bcbae47193 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -95,9 +95,12 @@ const { } = require('internal/errors'); const { validateBuffer, - validateInt32, + validateInteger, validateString } = require('internal/validators'); +// Provide validateInteger() but with kMaxLength as the default maximum value. +const validateOffset = (value, name, min = 0, max = kMaxLength) => + validateInteger(value, name, min, max); const { FastBuffer, @@ -557,7 +560,7 @@ Buffer.concat = function concat(list, length) { } } } else { - validateInt32(length, 'length', 0); + validateOffset(length, 'length'); } const buffer = Buffer.allocUnsafe(length); @@ -864,22 +867,22 @@ Buffer.prototype.compare = function compare(target, if (targetStart === undefined) targetStart = 0; else - validateInt32(targetStart, 'targetStart', 0); + validateOffset(targetStart, 'targetStart'); if (targetEnd === undefined) targetEnd = target.length; else - validateInt32(targetEnd, 'targetEnd', 0, target.length); + validateOffset(targetEnd, 'targetEnd', 0, target.length); if (sourceStart === undefined) sourceStart = 0; else - validateInt32(sourceStart, 'sourceStart', 0); + validateOffset(sourceStart, 'sourceStart'); if (sourceEnd === undefined) sourceEnd = this.length; else - validateInt32(sourceEnd, 'sourceEnd', 0, this.length); + validateOffset(sourceEnd, 'sourceEnd', 0, this.length); if (sourceStart >= sourceEnd) return (targetStart >= targetEnd ? 0 : -1); @@ -1003,12 +1006,12 @@ function _fill(buf, value, offset, end, encoding) { offset = 0; end = buf.length; } else { - validateInt32(offset, 'offset', 0); + validateOffset(offset, 'offset'); // Invalid ranges are not set to a default, so can range check early. if (end === undefined) { end = buf.length; } else { - validateInt32(end, 'end', 0, buf.length); + validateOffset(end, 'end', 0, buf.length); } if (offset >= end) return buf; @@ -1048,7 +1051,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) { // Buffer#write(string, offset[, length][, encoding]) } else { - validateInt32(offset, 'offset', 0, this.length); + validateOffset(offset, 'offset', 0, this.length); const remaining = this.length - offset; @@ -1058,7 +1061,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) { encoding = length; length = remaining; } else { - validateInt32(length, 'length', 0, this.length); + validateOffset(length, 'length', 0, this.length); if (length > remaining) length = remaining; } diff --git a/lib/fs.js b/lib/fs.js index 229167fc51eac6..67a050b4e8c480 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -37,6 +37,7 @@ const { ObjectDefineProperties, ObjectDefineProperty, Promise, + String, } = primordials; const { fs: constants } = internalBinding('constants'); @@ -663,7 +664,7 @@ function write(fd, buffer, offset, length, position, callback) { const req = new FSReqCallback(); req.oncomplete = wrapper; - return binding.writeString(fd, buffer, offset, length, req); + return binding.writeString(fd, String(buffer), offset, length, req); } ObjectDefineProperty(write, internalUtil.customPromisifyArgs, @@ -1383,7 +1384,7 @@ function writeFile(path, data, options, callback) { if (!isArrayBufferView(data)) { validateStringAfterArrayBufferView(data, 'data'); - data = Buffer.from(data, options.encoding || 'utf8'); + data = Buffer.from(String(data), options.encoding || 'utf8'); } if (isFd(path)) { @@ -1407,7 +1408,7 @@ function writeFileSync(path, data, options) { if (!isArrayBufferView(data)) { validateStringAfterArrayBufferView(data, 'data'); - data = Buffer.from(data, options.encoding || 'utf8'); + data = Buffer.from(String(data), options.encoding || 'utf8'); } const flag = options.flag || 'w'; diff --git a/lib/https.js b/lib/https.js index 4b21977fe48c3a..6aafef6cb639e1 100644 --- a/lib/https.js +++ b/lib/https.js @@ -80,7 +80,7 @@ function Server(opts, requestListener) { this.keepAliveTimeout = 5000; this.maxHeadersCount = null; this.headersTimeout = 60 * 1000; // 60 seconds - this.requestTimeout = 120 * 1000; // 120 seconds + this.requestTimeout = 0; } ObjectSetPrototypeOf(Server.prototype, tls.Server.prototype); ObjectSetPrototypeOf(Server, tls.Server); diff --git a/lib/internal/crypto/random.js b/lib/internal/crypto/random.js index 5f7f7efbf5b7c3..9e0500ea3a67bb 100644 --- a/lib/internal/crypto/random.js +++ b/lib/internal/crypto/random.js @@ -144,13 +144,15 @@ function randomInt(min, max, callback) { throw new ERR_INVALID_CALLBACK(callback); } if (!NumberIsSafeInteger(min)) { - throw new ERR_INVALID_ARG_TYPE('min', 'safe integer', min); + throw new ERR_INVALID_ARG_TYPE('min', 'a safe integer', min); } if (!NumberIsSafeInteger(max)) { - throw new ERR_INVALID_ARG_TYPE('max', 'safe integer', max); + throw new ERR_INVALID_ARG_TYPE('max', 'a safe integer', max); } if (max <= min) { - throw new ERR_OUT_OF_RANGE('max', `> ${min}`, max); + throw new ERR_OUT_OF_RANGE( + 'max', `greater than the value of "min" (${min})`, max + ); } // First we generate a random int between [0..range) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 6a64eb24a854f4..656cb374905f3f 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1119,7 +1119,7 @@ E('ERR_INVALID_OPT_VALUE', (name, value, reason = '') => { E('ERR_INVALID_OPT_VALUE_ENCODING', 'The value "%s" is invalid for option "encoding"', TypeError); E('ERR_INVALID_PACKAGE_CONFIG', (path, base, message) => { - return `Invalid package config ${path}${base ? ` imported from ${base}` : + return `Invalid package config ${path}${base ? ` while importing ${base}` : ''}${message ? `. ${message}` : ''}`; }, Error); E('ERR_INVALID_PACKAGE_TARGET', @@ -1303,7 +1303,7 @@ E('ERR_REQUIRE_ESM', filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + - `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + + `${filename} from ${parentPath} ` + 'is an ES module file as it is a .js file whose nearest parent ' + 'package.json contains "type": "module" which defines all .js ' + 'files in that package scope as ES modules.\nInstead rename ' + diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index 712bd87d85f6e6..ed89c616f26802 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -5,6 +5,7 @@ const { BigInt, DateNow, Error, + ObjectPrototypeHasOwnProperty, Number, NumberIsFinite, MathMin, @@ -697,13 +698,24 @@ const getValidMode = hideStackFrames((mode, type) => { }); const validateStringAfterArrayBufferView = hideStackFrames((buffer, name) => { - if (typeof buffer !== 'string') { - throw new ERR_INVALID_ARG_TYPE( - name, - ['string', 'Buffer', 'TypedArray', 'DataView'], - buffer - ); + if (typeof buffer === 'string') { + return; + } + + if ( + typeof buffer === 'object' && + buffer !== null && + typeof buffer.toString === 'function' && + ObjectPrototypeHasOwnProperty(buffer, 'toString') + ) { + return; } + + throw new ERR_INVALID_ARG_TYPE( + name, + ['string', 'Buffer', 'TypedArray', 'DataView'], + buffer + ); }); module.exports = { diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 0f8647a5f22992..99e0bdc5084ee8 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -58,7 +58,7 @@ const { maybeCacheSourceMap, rekeySourceMap } = require('internal/source_map/source_map_cache'); -const { pathToFileURL, fileURLToPath, URL } = require('internal/url'); +const { pathToFileURL, fileURLToPath, isURLInstance } = require('internal/url'); const { deprecate } = require('internal/util'); const vm = require('vm'); const assert = require('internal/assert'); @@ -1156,7 +1156,7 @@ const createRequireError = 'must be a file URL object, file URL string, or ' + function createRequire(filename) { let filepath; - if (filename instanceof URL || + if (isURLInstance(filename) || (typeof filename === 'string' && !path.isAbsolute(filename))) { try { filepath = fileURLToPath(filename); diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 0a828867692473..7091a55a5c41bf 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -82,7 +82,7 @@ function tryStatSync(path) { } } -function getPackageConfig(path) { +function getPackageConfig(path, specifier, base) { const existing = packageJSONCache.get(path); if (existing !== undefined) { return existing; @@ -106,7 +106,11 @@ function getPackageConfig(path) { try { packageJSON = JSONParse(source); } catch (error) { - throw new ERR_INVALID_PACKAGE_CONFIG(path, null, error.message); + throw new ERR_INVALID_PACKAGE_CONFIG( + path, + (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier), + error.message + ); } let { imports, main, name, type } = packageJSON; @@ -130,13 +134,14 @@ function getPackageConfig(path) { return packageConfig; } -function getPackageScopeConfig(resolved, base) { +function getPackageScopeConfig(resolved) { let packageJSONUrl = new URL('./package.json', resolved); while (true) { const packageJSONPath = packageJSONUrl.pathname; if (StringPrototypeEndsWith(packageJSONPath, 'node_modules/package.json')) break; - const packageConfig = getPackageConfig(fileURLToPath(packageJSONUrl), base); + const packageConfig = getPackageConfig(fileURLToPath(packageJSONUrl), + resolved); if (packageConfig.exists) return packageConfig; const lastPackageJSONUrl = packageJSONUrl; @@ -497,7 +502,7 @@ function packageImportsResolve(name, base, conditions) { throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base)); } let packageJSONUrl; - const packageConfig = getPackageScopeConfig(base, base); + const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); const imports = packageConfig.imports; @@ -535,7 +540,7 @@ function packageImportsResolve(name, base, conditions) { } function getPackageType(url) { - const packageConfig = getPackageScopeConfig(url, url); + const packageConfig = getPackageScopeConfig(url); return packageConfig.type; } @@ -580,7 +585,7 @@ function packageResolve(specifier, base, conditions) { StringPrototypeSlice(specifier, separatorIndex)); // ResolveSelf - const packageConfig = getPackageScopeConfig(base, base); + const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { const packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); if (packageConfig.name === packageName && @@ -608,7 +613,7 @@ function packageResolve(specifier, base, conditions) { } // Package match. - const packageConfig = getPackageConfig(packageJSONPath, base); + const packageConfig = getPackageConfig(packageJSONPath, specifier, base); if (packageConfig.exports !== undefined && packageConfig.exports !== null) return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js index d7b0ee56a1e8a5..892f6921745989 100644 --- a/lib/internal/modules/run_main.js +++ b/lib/internal/modules/run_main.js @@ -25,7 +25,7 @@ function shouldUseESMLoader(mainPath) { if (userLoader) return true; const esModuleSpecifierResolution = - getOptionValue('--es-module-specifier-resolution'); + getOptionValue('--experimental-specifier-resolution'); if (esModuleSpecifierResolution === 'node') return true; // Determine the module format of the main diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index 0b9fe8cde4f5ce..d75b64dd46beac 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -199,7 +199,13 @@ function* emitKeys(stream) { // Parse the key itself switch (code) { - /* xterm/gnome ESC O letter */ + /* xterm/gnome ESC [ letter (with modifier) */ + case '[P': key.name = 'f1'; break; + case '[Q': key.name = 'f2'; break; + case '[R': key.name = 'f3'; break; + case '[S': key.name = 'f4'; break; + + /* xterm/gnome ESC O letter (without modifier) */ case 'OP': key.name = 'f1'; break; case 'OQ': key.name = 'f2'; break; case 'OR': key.name = 'f3'; break; @@ -296,12 +302,15 @@ function* emitKeys(stream) { } else if (ch === '\r') { // carriage return key.name = 'return'; + key.meta = escaped; } else if (ch === '\n') { // Enter, should have been called linefeed key.name = 'enter'; + key.meta = escaped; } else if (ch === '\t') { // tab key.name = 'tab'; + key.meta = escaped; } else if (ch === '\b' || ch === '\x7f') { // backspace or ctrl+h key.name = 'backspace'; diff --git a/onboarding.md b/onboarding.md index 8ec268570e8a66..ce176be9a6ab67 100644 --- a/onboarding.md +++ b/onboarding.md @@ -56,11 +56,15 @@ onboarding session. * Watching the main repo will flood your inbox (several hundred notifications on typical weekdays), so be prepared -* `#node-dev` on [webchat.freenode.net](https://webchat.freenode.net/) is the - best place to interact with the TSC / other Collaborators - * If there are any questions after the session, a good place to ask is there! - * Presence is not mandatory, but please drop a note there if force-pushing to - `master` +The project has two venues for real-time discussion: +* [`#nodejs-dev`](https://openjs-foundation.slack.com/archives/C019Y2T6STH) on + the [OpenJS Foundation](https://slack-invite.openjsf.org/) +* `#node-dev` on [webchat.freenode.net](https://webchat.freenode.net/) is a + great place to interact with the TSC and other Collaborators + * If there are any questions after the session, a good place to ask is + there! + * Presence is not mandatory, but please drop a note there if force-pushing + to `master` ## Project goals & values diff --git a/src/js_native_api.h b/src/js_native_api.h index d0d975c2b454a8..bd8bd35d7b72c9 100644 --- a/src/js_native_api.h +++ b/src/js_native_api.h @@ -17,7 +17,7 @@ // functions available in a new version of N-API that is not yet ported in all // LTS versions, they can set NAPI_VERSION knowing that they have specifically // depended on that version. -#define NAPI_VERSION 6 +#define NAPI_VERSION 7 #endif #endif @@ -529,7 +529,7 @@ NAPI_EXTERN napi_status napi_get_instance_data(napi_env env, void** data); #endif // NAPI_VERSION >= 6 -#ifdef NAPI_EXPERIMENTAL +#if NAPI_VERSION >= 7 // ArrayBuffer detaching NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env, napi_value arraybuffer); @@ -537,6 +537,9 @@ NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env, NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env, napi_value value, bool* result); +#endif // NAPI_VERSION >= 7 + +#ifdef NAPI_EXPERIMENTAL // Type tagging NAPI_EXTERN napi_status napi_type_tag_object(napi_env env, napi_value value, diff --git a/src/js_native_api_types.h b/src/js_native_api_types.h index 115ccebf26132e..7011c80e671a15 100644 --- a/src/js_native_api_types.h +++ b/src/js_native_api_types.h @@ -30,6 +30,16 @@ typedef enum { // Used with napi_define_class to distinguish static properties // from instance properties. Ignored by napi_define_properties. napi_static = 1 << 10, + +#ifdef NAPI_EXPERIMENTAL + // Default for class methods. + napi_default_method = napi_writable | napi_configurable, + + // Default for object properties, like in JS obj[prop]. + napi_default_jsproperty = napi_writable | + napi_enumerable | + napi_configurable, +#endif // NAPI_EXPERIMENTAL } napi_property_attributes; typedef enum { diff --git a/src/node_options.cc b/src/node_options.cc index 2854ec072bf1c6..87f547da1de1c4 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -92,20 +92,7 @@ void EnvironmentOptions::CheckOptions(std::vector* errors) { } } - if (!es_module_specifier_resolution.empty()) { - if (!experimental_specifier_resolution.empty()) { - errors->push_back( - "bad option: cannot use --es-module-specifier-resolution" - " and --experimental-specifier-resolution at the same time"); - } else { - experimental_specifier_resolution = es_module_specifier_resolution; - if (experimental_specifier_resolution != "node" && - experimental_specifier_resolution != "explicit") { - errors->push_back( - "invalid value for --es-module-specifier-resolution"); - } - } - } else if (!experimental_specifier_resolution.empty()) { + if (!experimental_specifier_resolution.empty()) { if (experimental_specifier_resolution != "node" && experimental_specifier_resolution != "explicit") { errors->push_back( @@ -366,10 +353,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "either 'explicit' (default) or 'node'", &EnvironmentOptions::experimental_specifier_resolution, kAllowedInEnvironment); - AddOption("--es-module-specifier-resolution", - "", - &EnvironmentOptions::es_module_specifier_resolution, - kAllowedInEnvironment); + AddAlias("--es-module-specifier-resolution", + "--experimental-specifier-resolution"); AddOption("--no-deprecation", "silence deprecation warnings", &EnvironmentOptions::no_deprecation, diff --git a/src/node_options.h b/src/node_options.h index 3258d4b3f0df0c..bd63fcb0485c77 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -105,7 +105,6 @@ class EnvironmentOptions : public Options { bool experimental_json_modules = false; bool experimental_modules = false; std::string experimental_specifier_resolution; - std::string es_module_specifier_resolution; bool experimental_wasm_modules = false; bool experimental_import_meta_resolve = false; std::string module_type; diff --git a/src/node_version.h b/src/node_version.h index d68d033f2b57bc..42b53f309ebf86 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -23,13 +23,13 @@ #define SRC_NODE_VERSION_H_ #define NODE_MAJOR_VERSION 14 -#define NODE_MINOR_VERSION 11 -#define NODE_PATCH_VERSION 1 +#define NODE_MINOR_VERSION 12 +#define NODE_PATCH_VERSION 0 #define NODE_VERSION_IS_LTS 0 #define NODE_VERSION_LTS_CODENAME "" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) @@ -93,6 +93,6 @@ // The NAPI_VERSION provided by this version of the runtime. This is the version // which the Node binary being built supports. -#define NAPI_VERSION 6 +#define NAPI_VERSION 7 #endif // SRC_NODE_VERSION_H_ diff --git a/test/es-module/test-esm-invalid-pjson.js b/test/es-module/test-esm-invalid-pjson.js index 53ebd4962f0523..9f4711321230bf 100644 --- a/test/es-module/test-esm-invalid-pjson.js +++ b/test/es-module/test-esm-invalid-pjson.js @@ -19,11 +19,9 @@ child.on('close', mustCall((code, signal) => { strictEqual(signal, null); ok( stderr.includes( - [ - '[ERR_INVALID_PACKAGE_CONFIG]: ', - `Invalid package config ${invalidJson}. `, - `Unexpected token } in JSON at position ${isWindows ? 16 : 14}` - ].join(''), + `[ERR_INVALID_PACKAGE_CONFIG]: Invalid package config ${invalidJson} ` + + `while importing "invalid-pjson" from ${entry}. ` + + `Unexpected token } in JSON at position ${isWindows ? 16 : 14}` ), stderr); })); diff --git a/test/es-module/test-esm-specifiers-both-flags.mjs b/test/es-module/test-esm-specifiers-both-flags.mjs deleted file mode 100644 index a434684589dc07..00000000000000 --- a/test/es-module/test-esm-specifiers-both-flags.mjs +++ /dev/null @@ -1,14 +0,0 @@ -import { mustCall } from '../common/index.mjs'; -import { exec } from 'child_process'; -import assert from 'assert'; - -const expectedError = - 'cannot use --es-module-specifier-resolution ' + - 'and --experimental-specifier-resolution at the same time'; - -const flags = '--es-module-specifier-resolution=node ' + - '--experimental-specifier-resolution=node'; - -exec(`${process.execPath} ${flags}`, mustCall((error) => { - assert(error.message.includes(expectedError)); -})); diff --git a/test/es-module/test-esm-specifiers.mjs b/test/es-module/test-esm-specifiers.mjs index 5e436f21b74cc6..8451a6a703bb65 100644 --- a/test/es-module/test-esm-specifiers.mjs +++ b/test/es-module/test-esm-specifiers.mjs @@ -49,9 +49,14 @@ main().catch(mustNotCall); '../../fixtures/es-module-specifiers', item, ); - spawn(process.execPath, - ['--es-module-specifier-resolution=node', modulePath], - { stdio: 'inherit' }).on('exit', (code) => { - assert.strictEqual(code, 0); + [ + '--experimental-specifier-resolution', + '--es-module-specifier-resolution' + ].forEach((option) => { + spawn(process.execPath, + [`${option}=node`, modulePath], + { stdio: 'inherit' }).on('exit', (code) => { + assert.strictEqual(code, 0); + }); }); }); diff --git a/test/fixtures/es-modules/pjson-invalid/package.json b/test/fixtures/es-modules/pjson-invalid/package.json new file mode 100644 index 00000000000000..c91736ab5c7dbc --- /dev/null +++ b/test/fixtures/es-modules/pjson-invalid/package.json @@ -0,0 +1 @@ +syntax error diff --git a/test/fixtures/icu-punycode-toascii.json b/test/fixtures/icu-punycode-toascii.json new file mode 100644 index 00000000000000..814f06e794866d --- /dev/null +++ b/test/fixtures/icu-punycode-toascii.json @@ -0,0 +1,149 @@ +[ + "This resource is focused on highlighting issues with UTS #46 ToASCII", + { + "comment": "Label with hyphens in 3rd and 4th position", + "input": "aa--", + "output": "aa--" + }, + { + "input": "a†--", + "output": "xn--a---kp0a" + }, + { + "input": "ab--c", + "output": "ab--c" + }, + { + "comment": "Label with leading hyphen", + "input": "-x", + "output": "-x" + }, + { + "input": "-†", + "output": "xn----xhn" + }, + { + "input": "-x.xn--nxa", + "output": "-x.xn--nxa" + }, + { + "input": "-x.β", + "output": "-x.xn--nxa" + }, + { + "comment": "Label with trailing hyphen", + "input": "x-.xn--nxa", + "output": "x-.xn--nxa" + }, + { + "input": "x-.β", + "output": "x-.xn--nxa" + }, + { + "comment": "Empty labels", + "input": "x..xn--nxa", + "output": "x..xn--nxa" + }, + { + "input": "x..β", + "output": "x..xn--nxa" + }, + { + "comment": "Invalid Punycode", + "input": "xn--a", + "output": null + }, + { + "input": "xn--a.xn--nxa", + "output": null + }, + { + "input": "xn--a.β", + "output": null + }, + { + "comment": "Valid Punycode", + "input": "xn--nxa.xn--nxa", + "output": "xn--nxa.xn--nxa" + }, + { + "comment": "Mixed", + "input": "xn--nxa.β", + "output": "xn--nxa.xn--nxa" + }, + { + "input": "ab--c.xn--nxa", + "output": "ab--c.xn--nxa" + }, + { + "input": "ab--c.β", + "output": "ab--c.xn--nxa" + }, + { + "comment": "CheckJoiners is true", + "input": "\u200D.example", + "output": null + }, + { + "input": "xn--1ug.example", + "output": null + }, + { + "comment": "CheckBidi is true", + "input": "يa", + "output": null + }, + { + "input": "xn--a-yoc", + "output": null + }, + { + "comment": "processing_option is Nontransitional_Processing", + "input": "ශ්‍රී", + "output": "xn--10cl1a0b660p" + }, + { + "input": "نامه‌ای", + "output": "xn--mgba3gch31f060k" + }, + { + "comment": "U+FFFD", + "input": "\uFFFD.com", + "output": null + }, + { + "comment": "U+FFFD character encoded in Punycode", + "input": "xn--zn7c.com", + "output": null + }, + { + "comment": "Label longer than 63 code points", + "input": "x01234567890123456789012345678901234567890123456789012345678901x", + "output": "x01234567890123456789012345678901234567890123456789012345678901x" + }, + { + "input": "x01234567890123456789012345678901234567890123456789012345678901†", + "output": "xn--x01234567890123456789012345678901234567890123456789012345678901-6963b" + }, + { + "input": "x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa", + "output": "x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa" + }, + { + "input": "x01234567890123456789012345678901234567890123456789012345678901x.β", + "output": "x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa" + }, + { + "comment": "Domain excluding TLD longer than 253 code points", + "input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x", + "output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x" + }, + { + "input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa", + "output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa" + }, + { + "input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.β", + "output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa" + } +] diff --git a/test/js-native-api/test_general/test.js b/test/js-native-api/test_general/test.js index de06aecb590529..4dbdc37c918c37 100644 --- a/test/js-native-api/test_general/test.js +++ b/test/js-native-api/test_general/test.js @@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject), test_general.testGetPrototype(extendedObject)); // Test version management functions -assert.strictEqual(test_general.testGetVersion(), 6); +assert.strictEqual(test_general.testGetVersion(), 7); [ 123, diff --git a/test/js-native-api/test_typedarray/test_typedarray.c b/test/js-native-api/test_typedarray/test_typedarray.c index 66b1f9019c04ea..1714b5fe717f87 100644 --- a/test/js-native-api/test_typedarray/test_typedarray.c +++ b/test/js-native-api/test_typedarray/test_typedarray.c @@ -1,4 +1,3 @@ -#define NAPI_EXPERIMENTAL #include #include #include diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 110d28ecf82261..383edd6f887a01 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -42,8 +42,7 @@ const dnsPromises = dns.promises; assert.strictEqual(res.family, 6); })(); -// Try resolution without callback - +// Try resolution without hostname. dns.lookup(null, common.mustCall((error, result, addressType) => { assert.ifError(error); assert.strictEqual(result, null); diff --git a/test/parallel/test-cli-options-precedence.js b/test/parallel/test-cli-options-precedence.js new file mode 100644 index 00000000000000..f76c12043e29cd --- /dev/null +++ b/test/parallel/test-cli-options-precedence.js @@ -0,0 +1,22 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { spawnSync } = require('child_process'); + +// The last option on the command line takes precedence: +assert.strictEqual(spawnSync(process.execPath, [ + '--max-http-header-size=1234', + '--max-http-header-size=5678', + '-p', 'http.maxHeaderSize' +], { + encoding: 'utf8' +}).stdout.trim(), '5678'); + +// The command line takes precedence over NODE_OPTIONS: +assert.strictEqual(spawnSync(process.execPath, [ + '--max-http-header-size=5678', + '-p', 'http.maxHeaderSize' +], { + encoding: 'utf8', + env: { ...process.env, NODE_OPTIONS: '--max-http-header-size=1234' } +}).stdout.trim(), '5678'); diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index b3f14013e59a33..e175550c4b4c12 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -34,9 +34,6 @@ const { inspect } = require('util'); const kMaxUint32 = Math.pow(2, 32) - 1; const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32); -// Bump, we register a lot of exit listeners -process.setMaxListeners(256); - common.expectWarning('DeprecationWarning', 'crypto.pseudoRandomBytes is deprecated.', 'DEP0115'); @@ -394,13 +391,13 @@ assert.throws( const invalidMinError = { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "min" argument must be safe integer.' + + message: 'The "min" argument must be a safe integer.' + `${common.invalidArgTypeHelper(i)}`, }; const invalidMaxError = { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "max" argument must be safe integer.' + + message: 'The "max" argument must be a safe integer.' + `${common.invalidArgTypeHelper(i)}`, }; @@ -441,7 +438,7 @@ assert.throws( { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "min" argument must be safe integer.' + + message: 'The "min" argument must be a safe integer.' + `${common.invalidArgTypeHelper(minInt - 1)}`, } ); @@ -451,7 +448,7 @@ assert.throws( { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "max" argument must be safe integer.' + + message: 'The "max" argument must be a safe integer.' + `${common.invalidArgTypeHelper(maxInt + 1)}`, } ); @@ -462,8 +459,9 @@ assert.throws( assert.throws(() => crypto.randomInt(...arg, common.mustNotCall()), { code: 'ERR_OUT_OF_RANGE', name: 'RangeError', - message: 'The value of "max" is out of range. It must be > ' + - `${arg[arg.length - 2] || 0}. Received ${arg[arg.length - 1]}` + message: 'The value of "max" is out of range. It must be greater than ' + + `the value of "min" (${arg[arg.length - 2] || 0}). ` + + `Received ${arg[arg.length - 1]}` }); } diff --git a/test/parallel/test-fs-write-file-sync.js b/test/parallel/test-fs-write-file-sync.js index 013322ed15ba46..2ef7d14365b781 100644 --- a/test/parallel/test-fs-write-file-sync.js +++ b/test/parallel/test-fs-write-file-sync.js @@ -101,3 +101,17 @@ tmpdir.refresh(); const content = fs.readFileSync(file, { encoding: 'utf8' }); assert.strictEqual(content, 'hello world!'); } + +// Test writeFileSync with an object with an own toString function +{ + const file = path.join(tmpdir.path, 'testWriteFileSyncStringify.txt'); + const data = { + toString() { + return 'hello world!'; + } + }; + + fs.writeFileSync(file, data, { encoding: 'utf8', flag: 'a' }); + const content = fs.readFileSync(file, { encoding: 'utf8' }); + assert.strictEqual(content, String(data)); +} diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js index bdbbad9cb834d4..a6724eac300d16 100644 --- a/test/parallel/test-fs-write.js +++ b/test/parallel/test-fs-write.js @@ -32,6 +32,7 @@ tmpdir.refresh(); const fn = path.join(tmpdir.path, 'write.txt'); const fn2 = path.join(tmpdir.path, 'write2.txt'); const fn3 = path.join(tmpdir.path, 'write3.txt'); +const fn4 = path.join(tmpdir.path, 'write4.txt'); const expected = 'ümlaut.'; const constants = fs.constants; @@ -134,6 +135,21 @@ fs.open(fn3, 'w', 0o644, common.mustCall((err, fd) => { fs.write(fd, expected, done); })); +fs.open(fn4, 'w', 0o644, common.mustCall((err, fd) => { + assert.ifError(err); + + const done = common.mustCall((err, written) => { + assert.ifError(err); + assert.strictEqual(written, Buffer.byteLength(expected)); + fs.closeSync(fd); + }); + + const data = { + toString() { return expected; } + }; + fs.write(fd, data, done); +})); + [false, 'test', {}, [], null, undefined].forEach((i) => { assert.throws( () => fs.write(i, common.mustNotCall()), diff --git a/test/parallel/test-http-allow-content-length-304.js b/test/parallel/test-http-allow-content-length-304.js new file mode 100644 index 00000000000000..172733e73570d1 --- /dev/null +++ b/test/parallel/test-http-allow-content-length-304.js @@ -0,0 +1,32 @@ +'use strict'; +const common = require('../common'); + +// This test ensures that the http-parser doesn't expect a body when +// a 304 Not Modified response has a non-zero Content-Length header + +const assert = require('assert'); +const http = require('http'); + +const server = http.createServer(common.mustCall((req, res) => { + res.setHeader('Content-Length', 11); + res.statusCode = 304; + res.end(null); +})); + +server.listen(0, () => { + const request = http.request({ + port: server.address().port, + }); + + request.on('response', common.mustCall((response) => { + response.on('data', common.mustNotCall()); + response.on('aborted', common.mustNotCall()); + response.on('end', common.mustCall(() => { + assert.strictEqual(response.headers['content-length'], '11'); + assert.strictEqual(response.statusCode, 304); + server.close(); + })); + })); + + request.end(null); +}); diff --git a/test/parallel/test-http-keep-alive-timeout-custom.js b/test/parallel/test-http-keep-alive-timeout-custom.js new file mode 100644 index 00000000000000..a74aa5a2127b85 --- /dev/null +++ b/test/parallel/test-http-keep-alive-timeout-custom.js @@ -0,0 +1,31 @@ +'use strict'; + +const common = require('../common'); +const http = require('http'); +const assert = require('assert'); + +const server = http.createServer(common.mustCall((req, res) => { + const body = 'hello world\n'; + + res.writeHead(200, { + 'Content-Length': body.length, + 'Keep-Alive': 'timeout=50' + }); + res.write(body); + res.end(); +})); +server.keepAliveTimeout = 12010; + +const agent = new http.Agent({ maxSockets: 1, keepAlive: true }); + +server.listen(0, common.mustCall(function() { + http.get({ + path: '/', port: this.address().port, agent: agent + }, common.mustCall((response) => { + response.resume(); + assert.strictEqual( + response.headers['keep-alive'], 'timeout=50'); + server.close(); + agent.destroy(); + })); +})); diff --git a/test/parallel/test-http-keep-alive-timeout.js b/test/parallel/test-http-keep-alive-timeout.js index fccb267b8e9ee2..94f8adc4d86076 100644 --- a/test/parallel/test-http-keep-alive-timeout.js +++ b/test/parallel/test-http-keep-alive-timeout.js @@ -11,7 +11,7 @@ const server = http.createServer(common.mustCall((req, res) => { res.write(body); res.end(); })); -server.keepAliveTimeout = 12000; +server.keepAliveTimeout = 12010; const agent = new http.Agent({ maxSockets: 1, keepAlive: true }); diff --git a/test/parallel/test-https-server-request-timeout.js b/test/parallel/test-https-server-request-timeout.js new file mode 100644 index 00000000000000..66a1cb9f25f82e --- /dev/null +++ b/test/parallel/test-https-server-request-timeout.js @@ -0,0 +1,21 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const assert = require('assert'); +const { createServer } = require('https'); +const fixtures = require('../common/fixtures'); + +const options = { + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') +}; + +const server = createServer(options); + +// 0 seconds is the default +assert.strictEqual(server.requestTimeout, 0); +const requestTimeout = common.platformTimeout(1000); +server.requestTimeout = requestTimeout; +assert.strictEqual(server.requestTimeout, requestTimeout); diff --git a/test/parallel/test-icu-punycode.js b/test/parallel/test-icu-punycode.js index 7595ffc4937c46..29e88f9b9a6262 100644 --- a/test/parallel/test-icu-punycode.js +++ b/test/parallel/test-icu-punycode.js @@ -16,10 +16,7 @@ assert(!icu.hasConverter('x'), 'hasConverter should report converter does not exist for x'); const tests = require('../fixtures/url-idna.js'); -const fixtures = require('../common/fixtures'); -const wptToASCIITests = require( - fixtures.path('wpt', 'url', 'resources', 'toascii.json') -); +const fixtures = require('../fixtures/icu-punycode-toascii.json'); { for (const [i, { ascii, unicode }] of tests.entries()) { @@ -33,7 +30,7 @@ const wptToASCIITests = require( } { - for (const [i, test] of wptToASCIITests.entries()) { + for (const [i, test] of fixtures.entries()) { if (typeof test === 'string') continue; // skip comments const { comment, input, output } = test; diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index f0162ab06b8f38..bdc93c148edbfe 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -92,10 +92,13 @@ addTest('io.JS', [ ]); // Named characters -addTest('\n\r\t', [ +addTest('\n\r\t\x1b\n\x1b\r\x1b\t', [ { name: 'enter', sequence: '\n' }, { name: 'return', sequence: '\r' }, { name: 'tab', sequence: '\t' }, + { name: 'enter', sequence: '\x1b\n', meta: true }, + { name: 'return', sequence: '\x1b\r', meta: true }, + { name: 'tab', sequence: '\x1b\t', meta: true }, ]); // Space and backspace @@ -132,6 +135,25 @@ addTest('a\x1baA\x1bA', [ { name: 'a', sequence: '\x1bA', meta: true, shift: true }, ]); +// xterm/gnome ESC [ letter (with modifiers) +/* eslint-disable max-len */ +addTest('\x1b[2P\x1b[3P\x1b[4P\x1b[5P\x1b[6P\x1b[7P\x1b[8P\x1b[3Q\x1b[8Q\x1b[3R\x1b[8R\x1b[3S\x1b[8S', [ + { name: 'f1', sequence: '\x1b[2P', code: '[P', shift: true, meta: false, ctrl: false }, + { name: 'f1', sequence: '\x1b[3P', code: '[P', shift: false, meta: true, ctrl: false }, + { name: 'f1', sequence: '\x1b[4P', code: '[P', shift: true, meta: true, ctrl: false }, + { name: 'f1', sequence: '\x1b[5P', code: '[P', shift: false, meta: false, ctrl: true }, + { name: 'f1', sequence: '\x1b[6P', code: '[P', shift: true, meta: false, ctrl: true }, + { name: 'f1', sequence: '\x1b[7P', code: '[P', shift: false, meta: true, ctrl: true }, + { name: 'f1', sequence: '\x1b[8P', code: '[P', shift: true, meta: true, ctrl: true }, + { name: 'f2', sequence: '\x1b[3Q', code: '[Q', meta: true }, + { name: 'f2', sequence: '\x1b[8Q', code: '[Q', shift: true, meta: true, ctrl: true }, + { name: 'f3', sequence: '\x1b[3R', code: '[R', meta: true }, + { name: 'f3', sequence: '\x1b[8R', code: '[R', shift: true, meta: true, ctrl: true }, + { name: 'f4', sequence: '\x1b[3S', code: '[S', meta: true }, + { name: 'f4', sequence: '\x1b[8S', code: '[S', shift: true, meta: true, ctrl: true }, +]); +/* eslint-enable max-len */ + // xterm/gnome ESC O letter addTest('\x1bOP\x1bOQ\x1bOR\x1bOS', [ { name: 'f1', sequence: '\x1bOP', code: 'OP' }, diff --git a/test/parallel/test-trace-atomics-wait.js b/test/parallel/test-trace-atomics-wait.js index d925ffbe6c2cd4..03b76791586d98 100644 --- a/test/parallel/test-trace-atomics-wait.js +++ b/test/parallel/test-trace-atomics-wait.js @@ -54,6 +54,11 @@ const expectedTimelines = [ [Thread 0] Atomics.wait(
+ 4, 0, inf) started [Thread 1] Atomics.wait(
+ 4, -1, inf) started [Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread +[Thread 1] Atomics.wait(
+ 4, -1, inf) was woken up by another thread`, + `${begin} +[Thread 1] Atomics.wait(
+ 4, 0, inf) started +[Thread 0] Atomics.wait(
+ 4, -1, inf) started +[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread [Thread 1] Atomics.wait(
+ 4, -1, inf) was woken up by another thread`, `${begin} [Thread 0] Atomics.wait(
+ 4, 0, inf) started @@ -71,6 +76,12 @@ values mismatched`, [Thread 1] Atomics.wait(
+ 4, -1, inf) started [Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread [Thread 1] Atomics.wait(
+ 4, -1, inf) did not wait because the \ +values mismatched`, + `${begin} +[Thread 1] Atomics.wait(
+ 4, 0, inf) started +[Thread 0] Atomics.wait(
+ 4, -1, inf) started +[Thread 0] Atomics.wait(
+ 4, 0, inf) was woken up by another thread +[Thread 1] Atomics.wait(
+ 4, -1, inf) did not wait because the \ values mismatched`, `${begin} [Thread 0] Atomics.wait(
+ 4, 0, inf) started @@ -78,7 +89,7 @@ values mismatched`, values mismatched [Thread 1] Atomics.wait(
+ 4, -1, inf) started [Thread 1] Atomics.wait(
+ 4, -1, inf) did not wait because the \ -values mismatched` +values mismatched`, ]; assert(expectedTimelines.includes(actualTimeline)); diff --git a/test/pummel/test-policy-integrity.js b/test/pummel/test-policy-integrity.js index 3965372ed84351..db1589c5ffe834 100644 --- a/test/pummel/test-policy-integrity.js +++ b/test/pummel/test-policy-integrity.js @@ -13,6 +13,8 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); +const cpus = require('os').cpus().length; + function hash(algo, body) { const values = []; { @@ -82,7 +84,7 @@ function queueSpawn(opts) { } function drainQueue() { - if (spawned > 50) { + if (spawned > cpus) { return; } if (toSpawn.length) { @@ -383,6 +385,5 @@ debug(`spawning ${tests.size} policy integrity permutations`); for (const config of tests) { const parsed = JSON.parse(config); - tests.delete(config); queueSpawn(parsed); } diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js index cd6417abe4079f..2f5580840231e3 100644 --- a/test/pummel/test-timers.js +++ b/test/pummel/test-timers.js @@ -26,16 +26,17 @@ const assert = require('assert'); const WINDOW = 200; // Why does this need to be so big? -const starttime = new Date(); { + const starttime = Date.now(); + setTimeout(common.mustCall(function() { - const endtime = new Date(); + const endtime = Date.now(); const diff = endtime - starttime; assert.ok(diff > 0); console.error(`diff: ${diff}`); - assert.strictEqual(1000 - WINDOW < diff && diff < 1000 + WINDOW, true); + assert.ok(1000 <= diff && diff < 1000 + WINDOW); }), 1000); } @@ -46,11 +47,13 @@ const starttime = new Date(); } { + const starttime = Date.now(); + let interval_count = 0; setInterval(common.mustCall(function() { interval_count += 1; - const endtime = new Date(); + const endtime = Date.now(); const diff = endtime - starttime; assert.ok(diff > 0); @@ -58,9 +61,9 @@ const starttime = new Date(); const t = interval_count * 1000; - assert.strictEqual(t - WINDOW < diff && diff < t + WINDOW, true); + assert.ok(t <= diff && diff < t + (WINDOW * interval_count)); - assert.strictEqual(interval_count <= 3, true); + assert.ok(interval_count <= 3, `interval_count: ${interval_count}`); if (interval_count === 3) clearInterval(this); }, 3), 1000); diff --git a/test/wasi/c/readdir.c b/test/wasi/c/readdir.c new file mode 100644 index 00000000000000..a18ae5de34eb8f --- /dev/null +++ b/test/wasi/c/readdir.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include +#include + +int main() { + DIR* dir; + struct dirent* entry; + char* platform; + int cnt; + int has_d_type; + + platform = getenv("NODE_PLATFORM"); + assert(platform != NULL); + has_d_type = (0 != strcmp(platform, "aix") && 0 != strcmp(platform, "sunos")); + + dir = opendir("/sandbox"); + assert(dir != NULL); + + cnt = 0; + errno = 0; + while (NULL != (entry = readdir(dir))) { + if (strcmp(entry->d_name, "input.txt") == 0 || + strcmp(entry->d_name, "input2.txt") == 0 || + strcmp(entry->d_name, "notadir") == 0) { + if (has_d_type) { + assert(entry->d_type == DT_REG); + } else { + assert(entry->d_type == DT_UNKNOWN); + } + } else if (strcmp(entry->d_name, "subdir") == 0) { + if (has_d_type) { + assert(entry->d_type == DT_DIR); + } else { + assert(entry->d_type == DT_UNKNOWN); + } + } else { + assert("unexpected file"); + } + + cnt++; + } + + assert(errno == 0); + assert(cnt == 4); + closedir(dir); + return 0; +} diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js index 8ebc290d7b8269..b4c404e515cbb2 100644 --- a/test/wasi/test-wasi.js +++ b/test/wasi/test-wasi.js @@ -84,6 +84,11 @@ if (process.argv[2] === 'wasi-child') { runWASI({ test: 'notdir' }); runWASI({ test: 'poll' }); runWASI({ test: 'preopen_populates' }); + + if (!common.isWindows && process.platform !== 'android') { + runWASI({ test: 'readdir' }); + } + runWASI({ test: 'read_file', stdout: `hello from input.txt${EOL}` }); runWASI({ test: 'read_file_twice', diff --git a/test/wasi/wasm/readdir.wasm b/test/wasi/wasm/readdir.wasm new file mode 100755 index 00000000000000..ce6cb4999524db Binary files /dev/null and b/test/wasi/wasm/readdir.wasm differ diff --git a/tools/doc/html.js b/tools/doc/html.js index ae8c1b10ddad7a..cbed8ba6b2d8ef 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -126,7 +126,6 @@ function preprocessText({ nodeVersion }) { // Syscalls which appear in the docs, but which only exist in BSD / macOS. const BSD_ONLY_SYSCALLS = new Set(['lchmod']); -const HAXX_ONLY_SYSCALLS = new Set(['curl']); const MAN_PAGE = /(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm; // Handle references to man pages, eg "open(2)" or "lchmod(2)". @@ -143,9 +142,6 @@ function linkManPages(text) { return `${beginning}${displayAs}`; } - if (HAXX_ONLY_SYSCALLS.has(name)) { - return `${beginning}${displayAs}`; - } return `${beginning}${displayAs}`; diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index a3182dbb0136cb..7f0a8cdbacfe53 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -251,7 +251,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino CasinoTop.com Casino Topp Writers Per Hour Anagram Solver Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel

+

Buy.Fineproxy.Org Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino CasinoTop.com Casino Topp Anagram Solver Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel Fire Stick Tricks

## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js index e81494ed86ab5c..2c7a79b491ecb3 100644 --- a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js +++ b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js @@ -286,14 +286,15 @@ function loadESLintIgnoreFile(filePath) { * Creates an error to notify about a missing config to extend from. * @param {string} configName The name of the missing config. * @param {string} importerName The name of the config that imported the missing config + * @param {string} messageTemplate The text template to source error strings from. * @returns {Error} The error object to throw * @private */ -function configMissingError(configName, importerName) { +function configInvalidError(configName, importerName, messageTemplate) { return Object.assign( new Error(`Failed to load config "${configName}" to extend from.`), { - messageTemplate: "extend-config-missing", + messageTemplate, messageData: { configName, importerName } } ); @@ -802,7 +803,7 @@ class ConfigArrayFactory { }); } - throw configMissingError(extendName, ctx.name); + throw configInvalidError(extendName, ctx.name, "extend-config-missing"); } /** @@ -814,6 +815,11 @@ class ConfigArrayFactory { */ _loadExtendedPluginConfig(extendName, ctx) { const slashIndex = extendName.lastIndexOf("/"); + + if (slashIndex === -1) { + throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); + } + const pluginName = extendName.slice("plugin:".length, slashIndex); const configName = extendName.slice(slashIndex + 1); @@ -834,7 +840,7 @@ class ConfigArrayFactory { }); } - throw plugin.error || configMissingError(extendName, ctx.filePath); + throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); } /** @@ -867,7 +873,7 @@ class ConfigArrayFactory { } catch (error) { /* istanbul ignore else */ if (error && error.code === "MODULE_NOT_FOUND") { - throw configMissingError(extendName, ctx.filePath); + throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); } throw error; } diff --git a/tools/node_modules/eslint/lib/rules/id-length.js b/tools/node_modules/eslint/lib/rules/id-length.js index b97f32b97876cd..4df081ff9fe4f8 100644 --- a/tools/node_modules/eslint/lib/rules/id-length.js +++ b/tools/node_modules/eslint/lib/rules/id-length.js @@ -64,12 +64,7 @@ module.exports = { const minLength = typeof options.min !== "undefined" ? options.min : 2; const maxLength = typeof options.max !== "undefined" ? options.max : Infinity; const properties = options.properties !== "never"; - const exceptions = (options.exceptions ? options.exceptions : []) - .reduce((obj, item) => { - obj[item] = true; - - return obj; - }, {}); + const exceptions = new Set(options.exceptions); const exceptionPatterns = (options.exceptionPatterns || []).map(pattern => new RegExp(pattern, "u")); const reportedNode = new Set(); @@ -130,7 +125,7 @@ module.exports = { const isShort = name.length < minLength; const isLong = name.length > maxLength; - if (!(isShort || isLong) || exceptions[name] || matchesExceptionPattern(name)) { + if (!(isShort || isLong) || exceptions.has(name) || matchesExceptionPattern(name)) { return; // Nothing to report } diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index 1a51956dde53ff..d3314dc7e0de77 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -178,6 +178,11 @@ module.exports = { const rightNode = node.init; const sourceCode = context.getSourceCode(); + // Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved. + if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(rightNode.object).length) { + return null; + } + return fixer.replaceText( node, `{${rightNode.property.name}} = ${sourceCode.getText(rightNode.object)}` diff --git a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js index 6a42ce3686f597..fb8beb25211ee7 100644 --- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -37,7 +37,7 @@ const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]); // A set of node types that can contain a list of statements const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]); -const DECIMAL_INTEGER_PATTERN = /^(0|[1-9](?:_?\d)*)$/u; +const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; const OCTAL_ESCAPE_PATTERN = /^(?:[^\\]|\\[^0-7]|\\0(?![0-9]))*\\(?:[1-7]|0[0-9])/u; const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]); @@ -1244,6 +1244,8 @@ module.exports = { * 50 // true * 5_000 // true * 1_234_56 // true + * 08 // true + * 0192 // true * 5. // false * .5 // false * 5.0 // false diff --git a/tools/node_modules/eslint/messages/plugin-invalid.txt b/tools/node_modules/eslint/messages/plugin-invalid.txt new file mode 100644 index 00000000000000..3ee251821bef27 --- /dev/null +++ b/tools/node_modules/eslint/messages/plugin-invalid.txt @@ -0,0 +1,8 @@ +"<%- configName %>" is invalid syntax for a config specifier. + +* If your intention is to extend from a configuration exported from the plugin, add the configuration name after a slash: e.g. "<%- configName %>/myConfig". +* If this is the name of a shareable config instead of a plugin, remove the "plugin:" prefix: i.e. "<%- configName.slice("plugin:".length) %>". + +"<%- configName %>" was referenced from the config file in "<%- importerName %>". + +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. diff --git a/tools/node_modules/eslint/node_modules/acorn-jsx/index.js b/tools/node_modules/eslint/node_modules/acorn-jsx/index.js index 0ff263c5adae03..004e0809024006 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/index.js +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/index.js @@ -27,7 +27,7 @@ function getJsxTokens(acorn) { const tokTypes = { jsxName: new TokenType('jsxName'), jsxText: new TokenType('jsxText', {beforeExpr: true}), - jsxTagStart: new TokenType('jsxTagStart'), + jsxTagStart: new TokenType('jsxTagStart', {startsExpr: true}), jsxTagEnd: new TokenType('jsxTagEnd') }; diff --git a/tools/node_modules/eslint/node_modules/acorn-jsx/package.json b/tools/node_modules/eslint/node_modules/acorn-jsx/package.json index df867c6ae5c0a3..e26bc863624eb8 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/package.json +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/package.json @@ -6,7 +6,7 @@ "deprecated": false, "description": "Modern, fast React.js JSX parser", "devDependencies": { - "acorn": "^7.0.0" + "acorn": "^8.0.1" }, "homepage": "https://github.com/acornjs/acorn-jsx", "license": "MIT", @@ -19,7 +19,7 @@ ], "name": "acorn-jsx", "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0" + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "repository": { "type": "git", @@ -28,5 +28,5 @@ "scripts": { "test": "node test/run.js" }, - "version": "5.2.0" + "version": "5.3.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js index 5c4c967780a3e5..bdb5f637f684e5 100644 --- a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js +++ b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js @@ -37,7 +37,7 @@ const assert = require("assert"); * Test if scope is struct * @param {Scope} scope - scope * @param {Block} block - block - * @param {boolean} isMethodDefinition - is method definiton + * @param {boolean} isMethodDefinition - is method definition * @param {boolean} useDirective - use directive * @returns {boolean} is strict scope */ diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/package.json b/tools/node_modules/eslint/node_modules/eslint-scope/package.json index b39dbae1cc391c..bc425ebbd0bea4 100644 --- a/tools/node_modules/eslint/node_modules/eslint-scope/package.json +++ b/tools/node_modules/eslint/node_modules/eslint-scope/package.json @@ -4,7 +4,7 @@ }, "bundleDependencies": false, "dependencies": { - "esrecurse": "^4.1.0", + "esrecurse": "^4.3.0", "estraverse": "^4.1.1" }, "deprecated": false, @@ -49,5 +49,5 @@ "publish-release": "eslint-publish-release", "test": "node Makefile.js test" }, - "version": "5.1.0" + "version": "5.1.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 3d2f9ab4c83ea4..8801f73606f62c 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -154,5 +154,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.8.1" + "version": "7.9.0" } \ No newline at end of file