Skip to content

Commit

Permalink
升级到 v12.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
h7lin committed Sep 30, 2019
1 parent 5207cf2 commit 50cc538
Show file tree
Hide file tree
Showing 342 changed files with 1,482 additions and 1,040 deletions.
1 change: 1 addition & 0 deletions assert/assert_deepequal_actual_expected_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ changes:
pr-url: https://github.com/nodejs/node/pull/5910
description: Handle non-`Uint8Array` typed arrays correctly.
-->

* `actual` {any}
* `expected` {any}
* `message` {string|Error}
Expand Down
1 change: 1 addition & 0 deletions assert/assert_equal_actual_expected_message.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!-- YAML
added: v0.1.21
-->

* `actual` {any}
* `expected` {any}
* `message` {string|Error}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ changes:
description: Calling `assert.fail()` with more than one argument is
deprecated and emits a warning.
-->

* `actual` {any}
* `expected` {any}
* `message` {string|Error}
Expand Down
1 change: 1 addition & 0 deletions assert/assert_notdeepequal_actual_expected_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ changes:
pr-url: https://github.com/nodejs/node/pull/5910
description: Handle non-`Uint8Array` typed arrays correctly.
-->

* `actual` {any}
* `expected` {any}
* `message` {string|Error}
Expand Down
1 change: 1 addition & 0 deletions assert/assert_notequal_actual_expected_message.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!-- YAML
added: v0.1.21
-->

* `actual` {any}
* `expected` {any}
* `message` {string|Error}
Expand Down
1 change: 1 addition & 0 deletions async_hooks/async_hooks_createhook_callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ added: v8.1.0
* `before` {Function} The [`before` callback][].
* `after` {Function} The [`after` callback][].
* `destroy` {Function} The [`destroy` callback][].
* `promiseResolve` {Function} The [`promiseResolve` callback][].
* Returns: {AsyncHook} Instance used for disabling and enabling hooks

Registers functions to be called for different lifetime events of each async
Expand Down
1 change: 1 addition & 0 deletions async_hooks/asyncresource_triggerasyncid.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@




2 changes: 1 addition & 1 deletion buffer/the_zero_fill_buffers_command_line_option.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ added: v5.10.0
使用这个选项可能会对性能产生重大的负面影响。
建议仅在需要强制新分配的 `Buffer` 实例不能包含可能敏感的旧数据时,才使用 `--zero-fill-buffers` 选项。

```txt
```console
$ node --zero-fill-buffers
> Buffer.allocUnsafe(5);
<Buffer 00 00 00 00 00>
Expand Down
2 changes: 1 addition & 1 deletion child_process/spawning_bat_and_cmd_files_on_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bat.on('exit', (code) => {

```js
// 或:
const { exec } = require('child_process');
const { exec, spawn } = require('child_process');
exec('my.bat', (err, stdout, stderr) => {
if (err) {
console.error(err);
Expand Down
16 changes: 16 additions & 0 deletions cli/coverage_output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Coverage is output as an array of [ScriptCoverage][] objects on the top-level
key `result`:

```json
{
"result": [
{
"scriptId": "67",
"url": "internal/tty.js",
"functions": []
}
]
}
```

4 changes: 2 additions & 2 deletions cli/http_parser_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ added: v11.4.0

Chooses an HTTP parser library. Available values are:

- `llhttp` for https://llhttp.org/
- `legacy` for https://github.com/nodejs/http-parser
* `llhttp` for https://llhttp.org/
* `legacy` for https://github.com/nodejs/http-parser

The default is `llhttp`, unless otherwise specified when building Node.js.

Expand Down
140 changes: 70 additions & 70 deletions cli/node_options_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,79 +35,79 @@ node --require "./a.js" --require "./b.js"

Node.js options that are allowed are:
<!-- node-options-node start -->
- `--enable-fips`
- `--es-module-specifier-resolution`
- `--experimental-exports`
- `--experimental-modules`
- `--experimental-policy`
- `--experimental-repl-await`
- `--experimental-report`
- `--experimental-vm-modules`
- `--experimental-wasm-modules`
- `--force-fips`
- `--frozen-intrinsics`
- `--heapsnapshot-signal`
- `--http-parser`
- `--http-server-default-timeout`
- `--icu-data-dir`
- `--input-type`
- `--inspect-brk`
- `--inspect-port`, `--debug-port`
- `--inspect-publish-uid`
- `--inspect`
- `--loader`
- `--max-http-header-size`
- `--napi-modules`
- `--no-deprecation`
- `--no-force-async-hooks-checks`
- `--no-warnings`
- `--openssl-config`
- `--pending-deprecation`
- `--policy-integrity`
- `--preserve-symlinks-main`
- `--preserve-symlinks`
- `--prof-process`
- `--redirect-warnings`
- `--report-directory`
- `--report-filename`
- `--report-on-fatalerror`
- `--report-on-signal`
- `--report-signal`
- `--report-uncaught-exception`
- `--require`, `-r`
- `--throw-deprecation`
- `--title`
- `--tls-cipher-list`
- `--tls-max-v1.2`
- `--tls-max-v1.3`
- `--tls-min-v1.0`
- `--tls-min-v1.1`
- `--tls-min-v1.2`
- `--tls-min-v1.3`
- `--trace-deprecation`
- `--trace-event-categories`
- `--trace-event-file-pattern`
- `--trace-events-enabled`
- `--trace-sync-io`
- `--trace-tls`
- `--trace-warnings`
- `--track-heap-objects`
- `--unhandled-rejections`
- `--use-bundled-ca`
- `--use-openssl-ca`
- `--v8-pool-size`
- `--zero-fill-buffers`
* `--enable-fips`
* `--es-module-specifier-resolution`
* `--experimental-exports`
* `--experimental-modules`
* `--experimental-policy`
* `--experimental-repl-await`
* `--experimental-report`
* `--experimental-vm-modules`
* `--experimental-wasm-modules`
* `--force-fips`
* `--frozen-intrinsics`
* `--heapsnapshot-signal`
* `--http-parser`
* `--http-server-default-timeout`
* `--icu-data-dir`
* `--input-type`
* `--inspect-brk`
* `--inspect-port`, `--debug-port`
* `--inspect-publish-uid`
* `--inspect`
* `--loader`
* `--max-http-header-size`
* `--napi-modules`
* `--no-deprecation`
* `--no-force-async-hooks-checks`
* `--no-warnings`
* `--openssl-config`
* `--pending-deprecation`
* `--policy-integrity`
* `--preserve-symlinks-main`
* `--preserve-symlinks`
* `--prof-process`
* `--redirect-warnings`
* `--report-directory`
* `--report-filename`
* `--report-on-fatalerror`
* `--report-on-signal`
* `--report-signal`
* `--report-uncaught-exception`
* `--require`, `-r`
* `--throw-deprecation`
* `--title`
* `--tls-cipher-list`
* `--tls-max-v1.2`
* `--tls-max-v1.3`
* `--tls-min-v1.0`
* `--tls-min-v1.1`
* `--tls-min-v1.2`
* `--tls-min-v1.3`
* `--trace-deprecation`
* `--trace-event-categories`
* `--trace-event-file-pattern`
* `--trace-events-enabled`
* `--trace-sync-io`
* `--trace-tls`
* `--trace-warnings`
* `--track-heap-objects`
* `--unhandled-rejections`
* `--use-bundled-ca`
* `--use-openssl-ca`
* `--v8-pool-size`
* `--zero-fill-buffers`
<!-- node-options-node end -->

V8 options that are allowed are:
<!-- node-options-v8 start -->
- `--abort-on-uncaught-exception`
- `--interpreted-frames-native-stack`
- `--max-old-space-size`
- `--perf-basic-prof-only-functions`
- `--perf-basic-prof`
- `--perf-prof-unwinding-info`
- `--perf-prof`
- `--stack-trace-limit`
* `--abort-on-uncaught-exception`
* `--interpreted-frames-native-stack`
* `--max-old-space-size`
* `--perf-basic-prof-only-functions`
* `--perf-basic-prof`
* `--perf-prof-unwinding-info`
* `--perf-prof`
* `--stack-trace-limit`
<!-- node-options-v8 end -->

21 changes: 3 additions & 18 deletions cli/node_v8_coverage_dir.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@

When set, Node.js will begin outputting [V8 JavaScript code coverage][] to the
directory provided as an argument. Coverage is output as an array of


```json
{
"result": [
{
"scriptId": "67",
"url": "internal/tty.js",
"functions": []
}
]
}
```
When set, Node.js will begin outputting [V8 JavaScript code coverage][] and
[Source Map][] data to the directory provided as an argument (coverage
information is written as JSON to files with a `coverage` prefix).

`NODE_V8_COVERAGE` will automatically propagate to subprocesses, making it
easier to instrument applications that call the `child_process.spawn()` family
of functions. `NODE_V8_COVERAGE` can be set to an empty string, to prevent
propagation.

At this time coverage is only collected in the main thread and will not be
output for code executed by worker threads.

40 changes: 40 additions & 0 deletions cli/source_map_cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

> Stability: 1 - Experimental

If found, Source Map data is appended to the top-level key `source-map-cache`
on the JSON coverage object.

`source-map-cache` is an object with keys representing the files source maps
were extracted from, and the values include the raw source-map URL
(in the key `url`) and the parsed Source Map V3 information (in the key `data`).
```json
{
"result": [
{
"scriptId": "68",
"url": "file:///absolute/path/to/source.js",
"functions": []
}
],
"source-map-cache": {
"file:///absolute/path/to/source.js": {
"url": "./path-to-map.json",
"data": {
"version": 3,
"sources": [
"file:///absolute/path/to/original.js"
],
"names": [
"Foo",
"console",
"info"
],
"mappings": "MAAMA,IACJC,YAAaC",
"sourceRoot": "./"
}
}
}
}
```

9 changes: 5 additions & 4 deletions cli/uv_threadpool_size_size.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Asynchronous system APIs are used by Node.js whenever possible, but where they
do not exist, libuv's threadpool is used to create asynchronous node APIs based
on synchronous system APIs. Node.js APIs that use the threadpool are:

- all `fs` APIs, other than the file watcher APIs and those that are explicitly
* all `fs` APIs, other than the file watcher APIs and those that are explicitly
synchronous
- asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`,
* asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`,
`crypto.randomBytes()`, `crypto.randomFill()`, `crypto.generateKeyPair()`
- `dns.lookup()`
- all `zlib` APIs, other than those that are explicitly synchronous
* `dns.lookup()`
* all `zlib` APIs, other than those that are explicitly synchronous

Because libuv's threadpool has a fixed size, it means that if for whatever
reason any of these APIs takes a long time, other (seemingly unrelated) APIs
Expand Down Expand Up @@ -38,4 +38,5 @@ greater than `4` (its current default value). For more information, see the





2 changes: 1 addition & 1 deletion cluster/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (cluster.isMaster) {

运行代码,则工作进程会共享 8000 端口:

```txt
```console
$ node server.js
主进程 3596 正在运行
工作进程 4324 已启动
Expand Down
9 changes: 6 additions & 3 deletions cluster/worker_exitedafterdisconnect.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ added: v6.0.0

* {boolean}

当调用 `.kill()` 或者 `.disconnect()` 方法时被设置,在这之前都是 `undefined`
如果工作进程由于 `.kill()` `.disconnect()` 而退出,则此属性为 `true`
如果工作进程以任何其他方式退出,则为 `false`
如果工作进程尚未退出,则为 `undefined`

[`worker.exitedAfterDisconnect`] 可以用于区分自发退出还是被动退出,主进程可以根据这个值决定是否重新衍生工作进程。

[`worker.exitedAfterDisconnect`] 可以用于区分自发退出还是被动退出,主进程可以根据这个值决定是否重新衍生新的工作进程。

```js
cluster.on('exit', (worker, code, signal) => {
if (worker.exitedAfterDisconnect === true) {
console.log('这是自发退出,无需担心');
console.log('这是自发退出,无需担心');
}
});
Expand Down
Loading

0 comments on commit 50cc538

Please sign in to comment.