diff --git a/CHANGELOG.md b/CHANGELOG.md index 2339e11e484f00..444d98dd966cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,8 @@ release. -8.1.0
+8.1.1
+8.1.0
8.0.0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e11be25b0234a7..7f9bd33e055db1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,7 @@ locally. ```text $ git clone git@github.com:username/node.git $ cd node -$ git remote add upstream git://github.com/nodejs/node.git +$ git remote add upstream https://github.com/nodejs/node.git ``` #### Which branch? diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 417c16e04e7ae3..d7d60671ac1ad2 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -1,33 +1,17 @@ # Node.js Project Governance -## Core Technical Committee - -The Node.js project is governed by a Core Technical Committee (CTC) which is -responsible for high-level guidance of the project. - -The CTC has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Conduct guidelines -* Maintaining the list of additional Collaborators - -For the current list of CTC members, see the project -[README.md](./README.md#current-project-team-members). +The Node.js project is governed by its Collaborators, including a Core Technical +Committee (CTC) which is responsible for high-level guidance of the project. ## Collaborators The [nodejs/node](https://github.com/nodejs/node) GitHub repository is -maintained by the CTC and additional Collaborators who are added by the -CTC on an ongoing basis. +maintained by Collaborators who are added by the CTC on an ongoing basis. Individuals identified by the CTC as making significant and valuable -contributions are made Collaborators and given commit access to the project. - -_Note:_ If you make a significant contribution and are not considered -for commit access, log an issue or contact a CTC member directly. +contributions are made Collaborators and given commit access to the project. If +you make a significant contribution and are not considered for commit access, +log an issue or contact a CTC member directly. Modifications of the contents of the nodejs/node repository are made on a collaborative basis. Anybody with a GitHub account may propose a @@ -45,18 +29,15 @@ be accepted unless: the change. Previously-objecting Collaborators do not necessarily have to sign-off on the change, but they should not be opposed to it. * The change is escalated to the CTC and the CTC votes to approve the change. - This should be used only after other options (especially discussion among - the disagreeing Collaborators) have been exhausted. + This should only happen if disagreements between Collaborators cannot be + resolved through discussion. Collaborators may opt to elevate significant or controversial modifications to the CTC by assigning the `ctc-review` label to a pull request or issue. The CTC should serve as the final arbiter where required. -For the current list of Collaborators, see the project -[README.md](./README.md#current-project-team-members). - -A guide for Collaborators is maintained in -[COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md). +* [Current list of Collaborators](./README.md#current-project-team-members) +* [A guide for Collaborators](./COLLABORATOR_GUIDE.md) ### Collaborator Activities @@ -68,9 +49,23 @@ Typical activities of a Collaborator include: * participation in working groups * merging pull requests -While the above are typical things done by Collaborators, there are no required -activities to retain Collaborator status. There is currently no process by which -inactive Collaborators are removed from the project. +The CTC periodically reviews the Collaborator list to identify inactive +Collaborators. Past Collaborators are typically given _Emeritus_ status. Emeriti +may request that the CTC restore them to active status. + +## Core Technical Committee + +The Core Technical Committee (CTC) has final authority over this project +including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Conduct guidelines +* Maintaining the list of additional Collaborators + +* [Current list of CTC members](./README.md#current-project-team-members) ## CTC Membership @@ -83,9 +78,10 @@ membership beyond these rules. The CTC may add additional members to the CTC by a standard CTC motion. -When a CTC member's participation in [CTC activities](#ctc-activities) has become -minimal for a sustained period of time, the CTC will request that the member -either indicate an intention to increase participation or voluntarily resign. +When a CTC member's participation in [CTC activities](#ctc-activities) has +become minimal for a sustained period of time, the CTC will request that the +member either indicate an intention to increase participation or voluntarily +resign. CTC members may only be removed by voluntary resignation or through a standard CTC motion. diff --git a/README.md b/README.md index e014085c69e56e..1c93a5f2ede66e 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,10 @@ more information about the governance of the Node.js project, see **Fedor Indutny** <fedor.indutny@gmail.com> * [jasnell](https://github.com/jasnell) - **James M Snell** <jasnell@gmail.com> (he/him) +* [joyeecheung](https://github.com/joyeecheung) - +**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) +* [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) * [misterdjules](https://github.com/misterdjules) - @@ -301,8 +305,6 @@ more information about the governance of the Node.js project, see **João Reis** <reis@janeasystems.com> * [joshgav](https://github.com/joshgav) - **Josh Gavant** <josh.gavant@outlook.com> -* [joyeecheung](https://github.com/joyeecheung) - -**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) * [julianduque](https://github.com/julianduque) - **Julian Duque** <julianduquej@gmail.com> (he/him) * [JungMinu](https://github.com/JungMinu) - @@ -319,8 +321,6 @@ more information about the governance of the Node.js project, see **Aleksey Smolenchuk** <lxe@lxe.co> * [matthewloring](https://github.com/matthewloring) - **Matthew Loring** <mattloring@google.com> -* [mcollina](https://github.com/mcollina) - -**Matteo Collina** <matteo.collina@gmail.com> (he/him) * [micnic](https://github.com/micnic) - **Nicu Micleușanu** <micnic90@gmail.com> (he/him) * [mikeal](https://github.com/mikeal) - diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js index 758c8b8b514e3f..2f1eb08763b241 100644 --- a/benchmark/buffers/buffer-write.js +++ b/benchmark/buffers/buffer-write.js @@ -52,7 +52,7 @@ function main(conf) { var buff = new clazz(8); var fn = `write${conf.type}`; - if (fn.match(/Int/)) + if (/Int/.test(fn)) benchInt(buff, fn, len, noAssert); else benchFloat(buff, fn, len, noAssert); diff --git a/benchmark/child_process/child-process-exec-stdout.js b/benchmark/child_process/child-process-exec-stdout.js index a30eb92f6ad39a..dcd352cfcf65e7 100644 --- a/benchmark/child_process/child-process-exec-stdout.js +++ b/benchmark/child_process/child-process-exec-stdout.js @@ -1,41 +1,42 @@ 'use strict'; const common = require('../common.js'); +const { exec, execSync } = require('child_process'); +const isWindows = process.platform === 'win32'; var messagesLength = [64, 256, 1024, 4096]; -// Windows does not support that long arguments -if (process.platform !== 'win32') - messagesLength.push(32768); -const bench = common.createBenchmark(main, { +// Windows does not support command lines longer than 8191 characters +if (!isWindows) messagesLength.push(32768); + +const bench = common.createBenchmark(childProcessExecStdout, { len: messagesLength, dur: [5] }); -const child_process = require('child_process'); -const exec = child_process.exec; -function main(conf) { +function childProcessExecStdout(conf) { bench.start(); - const dur = +conf.dur; + const maxDuration = conf.dur * 1000; const len = +conf.len; - const msg = `"${'.'.repeat(len)}"`; - // eslint-disable-next-line no-unescaped-regexp-dot - msg.match(/./); - const options = {'stdio': ['ignore', 'pipe', 'ignore']}; - const child = exec(`yes ${msg}`, options); + const cmd = `yes "${'.'.repeat(len)}"`; + const child = exec(cmd, { 'stdio': ['ignore', 'pipe', 'ignore'] }); var bytes = 0; - child.stdout.on('data', function(msg) { + child.stdout.on('data', (msg) => { bytes += msg.length; }); - setTimeout(function() { + setTimeout(() => { bench.end(bytes); - if (process.platform === 'win32') { - // Sometimes there's a yes.exe process left hanging around on Windows... - child_process.execSync(`taskkill /f /t /pid ${child.pid}`); + if (isWindows) { + // Sometimes there's a yes.exe process left hanging around on Windows. + try { + execSync(`taskkill /f /t /pid ${child.pid}`); + } catch (_) { + // this is a best effort kill. stderr is piped to parent for tracing. + } } else { child.kill(); } - }, dur * 1000); + }, maxDuration); } diff --git a/benchmark/cluster/echo.js b/benchmark/cluster/echo.js new file mode 100644 index 00000000000000..0733bdbd2077aa --- /dev/null +++ b/benchmark/cluster/echo.js @@ -0,0 +1,70 @@ +'use strict'; + +const cluster = require('cluster'); +if (cluster.isMaster) { + const common = require('../common.js'); + const bench = common.createBenchmark(main, { + workers: [1], + payload: ['string', 'object'], + sendsPerBroadcast: [1, 10], + n: [1e5] + }); + + function main(conf) { + var n = +conf.n; + var workers = +conf.workers; + var sends = +conf.sendsPerBroadcast; + var expectedPerBroadcast = sends * workers; + var payload; + var readies = 0; + var broadcasts = 0; + var msgCount = 0; + + switch (conf.payload) { + case 'string': + payload = 'hello world!'; + break; + case 'object': + payload = { action: 'pewpewpew', powerLevel: 9001 }; + break; + default: + throw new Error('Unsupported payload type'); + } + + for (var i = 0; i < workers; ++i) + cluster.fork().on('online', onOnline).on('message', onMessage); + + function onOnline(msg) { + if (++readies === workers) { + bench.start(); + broadcast(); + } + } + + function broadcast() { + var id; + if (broadcasts++ === n) { + bench.end(n); + for (id in cluster.workers) + cluster.workers[id].disconnect(); + return; + } + for (id in cluster.workers) { + const worker = cluster.workers[id]; + for (var i = 0; i < sends; ++i) + worker.send(payload); + } + } + + function onMessage(msg) { + if (++msgCount === expectedPerBroadcast) { + msgCount = 0; + broadcast(); + } + } + } +} else { + process.on('message', function(msg) { + process.send(msg); + }); +} diff --git a/benchmark/common.js b/benchmark/common.js index bc9c21b3902ad7..622d053e5f9ee6 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -40,9 +40,10 @@ function Benchmark(fn, configs, options) { Benchmark.prototype._parseArgs = function(argv, configs) { const cliOptions = {}; const extraOptions = {}; + const validArgRE = /^(.+?)=([\s\S]*)$/; // Parse configuration arguments for (const arg of argv) { - const match = arg.match(/^(.+?)=([\s\S]*)$/); + const match = arg.match(validArgRE); if (!match) { console.error(`bad argument: ${arg}`); process.exit(1); diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js index 90bf548c76cdbb..9fd88f1d864dff 100644 --- a/benchmark/crypto/cipher-stream.js +++ b/benchmark/crypto/cipher-stream.js @@ -11,7 +11,7 @@ var bench = common.createBenchmark(main, { function main(conf) { var api = conf.api; - if (api === 'stream' && process.version.match(/^v0\.[0-8]\./)) { + if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); // use the legacy, just so that we can compare them. api = 'legacy'; diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js index 296127ab3846e2..dfab32c8af7ea1 100644 --- a/benchmark/crypto/hash-stream-creation.js +++ b/benchmark/crypto/hash-stream-creation.js @@ -15,7 +15,7 @@ var bench = common.createBenchmark(main, { function main(conf) { var api = conf.api; - if (api === 'stream' && process.version.match(/^v0\.[0-8]\./)) { + if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); // use the legacy, just so that we can compare them. api = 'legacy'; diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js index dbb2e5c99958d3..cedaeb872f494d 100644 --- a/benchmark/crypto/hash-stream-throughput.js +++ b/benchmark/crypto/hash-stream-throughput.js @@ -14,7 +14,7 @@ var bench = common.createBenchmark(main, { function main(conf) { var api = conf.api; - if (api === 'stream' && process.version.match(/^v0\.[0-8]\./)) { + if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); // use the legacy, just so that we can compare them. api = 'legacy'; diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index f7f30217dd3be2..2610dc17104822 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -437,7 +437,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { i::V8::SetSnapshotBlob(snapshot_blob); } -void* v8::ArrayBuffer::Allocator::Reserve(size_t length) { UNIMPLEMENTED(); } +void* v8::ArrayBuffer::Allocator::Reserve(size_t length) { + UNIMPLEMENTED(); + return nullptr; +} void v8::ArrayBuffer::Allocator::Free(void* data, size_t length, AllocationMode mode) { diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 2120e36f4be32e..17d54e7f7e844f 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -215,7 +215,9 @@ child runs longer than `timeout` milliseconds. replace the existing process and uses a shell to execute the command. If this method is invoked as its [`util.promisify()`][]ed version, it returns -a Promise for an object with `stdout` and `stderr` properties. +a Promise for an object with `stdout` and `stderr` properties. In case of an +error, a rejected promise is returned, with the same `error` object given in the +callback, but with an additional two properties `stdout` and `stderr`. For example: @@ -281,7 +283,9 @@ stderr output. If `encoding` is `'buffer'`, or an unrecognized character encoding, `Buffer` objects will be passed to the callback instead. If this method is invoked as its [`util.promisify()`][]ed version, it returns -a Promise for an object with `stdout` and `stderr` properties. +a Promise for an object with `stdout` and `stderr` properties. In case of an +error, a rejected promise is returned, with the same `error` object given in the +callback, but with an additional two properties `stdout` and `stderr`. ```js const util = require('util'); diff --git a/doc/api/fs.md b/doc/api/fs.md index fc3e5d95665b2f..a2a8165e3a2fbd 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -426,6 +426,13 @@ changes: pr-url: https://github.com/nodejs/node/pull/10739 description: The `path` parameter can be a WHATWG `URL` object using `file:` protocol. Support is currently still *experimental*. + - version: v6.3.0 + pr-url: https://github.com/nodejs/node/pull/6534 + description: The constants like `fs.R_OK`, etc which were present directly + on `fs` were moved into `fs.constants` as a soft deprecation. + Thus for Node `< v6.3.0` use `fs` to access those constants, or + do something like `(fs.constants || fs).R_OK` to work with all + versions. --> * `path` {string|Buffer|URL} @@ -1699,7 +1706,7 @@ changes: parameter in case of success. - version: v5.0.0 pr-url: https://github.com/nodejs/node/pull/3163 - description: The `file` parameter can be a file descriptor now. + description: The `path` parameter can be a file descriptor now. --> * `path` {string|Buffer|URL|integer} filename or file descriptor @@ -1759,7 +1766,7 @@ changes: protocol. Support is currently still *experimental*. - version: v5.0.0 pr-url: https://github.com/nodejs/node/pull/3163 - description: The `file` parameter can be a file descriptor now. + description: The `path` parameter can be a file descriptor now. --> * `path` {string|Buffer|URL|integer} filename or file descriptor @@ -1767,7 +1774,7 @@ changes: * `encoding` {string|null} default = `null` * `flag` {string} default = `'r'` -Synchronous version of [`fs.readFile`][]. Returns the contents of the `file`. +Synchronous version of [`fs.readFile()`][]. Returns the contents of the `path`. If the `encoding` option is specified then this function returns a string. Otherwise it returns a buffer. @@ -2831,9 +2838,10 @@ The following constants are meant for use with the [`fs.Stats`][] object's [`fs.mkdtemp()`]: #fs_fs_mkdtemp_prefix_options_callback [`fs.open()`]: #fs_fs_open_path_flags_mode_callback [`fs.read()`]: #fs_fs_read_fd_buffer_offset_length_position_callback -[`fs.readFile`]: #fs_fs_readfile_file_options_callback +[`fs.readFile()`]: #fs_fs_readfile_path_options_callback +[`fs.readFileSync()`]: #fs_fs_readfilesync_path_options [`fs.stat()`]: #fs_fs_stat_path_callback -[`fs.utimes()`]: #fs_fs_futimes_fd_atime_mtime_callback +[`fs.utimes()`]: #fs_fs_utimes_path_atime_mtime_callback [`fs.watch()`]: #fs_fs_watch_filename_options_listener [`fs.write()`]: #fs_fs_write_fd_buffer_offset_length_position_callback [`fs.writeFile()`]: #fs_fs_writefile_file_data_options_callback diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 668e3fab18f8a5..bc7f605c13bf80 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -407,7 +407,9 @@ This API queries a `napi_value` to check if it represents an error object. added: v8.0.0 --> ```C -NODE_EXTERN napi_status napi_create_error(napi_env env, const char* msg); +NODE_EXTERN napi_status napi_create_error(napi_env env, + const char* msg, + napi_value* result); ``` - `[in] env`: The environment that the API is invoked under. - `[in] msg`: C string representing the text to be associated with. @@ -422,7 +424,9 @@ This API returns a JavaScript Error with the text provided. added: v8.0.0 --> ```C -NODE_EXTERN napi_status napi_create_type_error(napi_env env, const char* msg); +NODE_EXTERN napi_status napi_create_type_error(napi_env env, + const char* msg, + napi_value* result); ``` - `[in] env`: The environment that the API is invoked under. - `[in] msg`: C string representing the text to be associated with. @@ -438,7 +442,9 @@ This API returns a JavaScript TypeError with the text provided. added: v8.0.0 --> ```C -NODE_EXTERN napi_status napi_create_range_error(napi_env env, const char* msg); +NODE_EXTERN napi_status napi_create_range_error(napi_env env, + const char* msg, + napi_value* result); ``` - `[in] env`: The environment that the API is invoked under. - `[in] msg`: C string representing the text to be associated with. @@ -1560,25 +1566,6 @@ is passed in it returns `napi_number_expected`. This API returns the C int64 primitive equivalent of the given JavaScript Number -#### *napi_get_value_string_length* - -```C -napi_status napi_get_value_string_length(napi_env env, - napi_value value, - int* result) -``` - -- `[in] env`: The environment that the API is invoked under. -- `[in] value`: `napi_value` representing JavaScript string. -- `[out] result`: Number of characters in the given JavaScript string. - -Returns `napi_ok` if the API succeeded. If a non-String `napi_value` -is passed in it returns `napi_string_expected`. - -This API returns the number of characters in the given JavaScript string. - #### *napi_get_value_string_utf8*