From 3d88b766803ecf46cf3eb7a2acf4490b07143b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 7 Oct 2019 10:20:28 +0200 Subject: [PATCH 01/65] deps: patch V8 to 7.7.299.13 Refs: https://github.com/v8/v8/compare/7.7.299.11...7.7.299.13 PR-URL: https://github.com/nodejs/node/pull/29869 Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Beth Griggs --- deps/v8/include/v8-version.h | 2 +- deps/v8/infra/testing/builders.pyl | 116 ++++++++++-------- deps/v8/src/execution/frames.cc | 11 +- .../test/mjsunit/regress/regress-1000635.js | 15 +++ 4 files changed, 89 insertions(+), 55 deletions(-) create mode 100644 deps/v8/test/mjsunit/regress/regress-1000635.js diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 0406f65b08e684..a87655058a058d 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 7 #define V8_MINOR_VERSION 7 #define V8_BUILD_NUMBER 299 -#define V8_PATCH_LEVEL 11 +#define V8_PATCH_LEVEL 13 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index 13a73f3e94cd90..965300da7735f2 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -43,7 +43,7 @@ {'name': 'v8testing', 'variant': 'default', 'shards': 4}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 4}, {'name': 'mozilla', 'variant': 'default'}, - {'name': 'test262_variants', 'variant': 'default', 'shards': 7}, + {'name': 'test262', 'variant': 'default', 'shards': 7}, ], }, ############################################################################## @@ -59,7 +59,7 @@ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'test262_variants', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, @@ -175,6 +175,7 @@ { 'name': 'test262', 'suffix': 'nosse3', + 'variant': 'default', 'test_args': [ '--extra-flags', '--noenable-sse3 --noenable-ssse3 --noenable-sse4-1 --noenable-avx', @@ -198,6 +199,7 @@ { 'name': 'test262', 'suffix': 'nosse4', + 'variant': 'default', 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'], }, { @@ -225,7 +227,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 7}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 2}, @@ -246,7 +248,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access', 'shards': 2}, {'name': 'mozilla', 'shards': 2}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 10}, {'name': 'v8testing', 'variant': 'extra', 'shards': 8}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 2}, @@ -273,7 +275,7 @@ {'name': 'benchmarks'}, {'name': 'mozilla'}, {'name': 'optimize_for_size'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 2}, ], }, @@ -288,7 +290,7 @@ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'test262_variants', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, @@ -325,7 +327,7 @@ 'os': 'Ubuntu-16.04', }, 'tests': [ - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 5}, ], }, @@ -413,7 +415,7 @@ 'tests': [ {'name': 'benchmarks'}, {'name': 'mozilla'}, - {'name': 'test262', 'shards': 3}, + {'name': 'test262', 'variant': 'default', 'shards': 3}, {'name': 'v8testing', 'shards': 5}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'variant': 'slow_path'}, @@ -452,7 +454,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla', 'shards': 2}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 10}, {'name': 'v8testing', 'variant': 'extra', 'shards': 6}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 3}, @@ -473,7 +475,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access', 'shards': 2}, {'name': 'mozilla', 'shards': 2}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 12}, {'name': 'v8testing', 'variant': 'extra', 'shards': 8}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 3}, @@ -538,7 +540,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 2}, ], }, @@ -559,7 +561,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, ], @@ -571,7 +573,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 2}, ], }, @@ -582,7 +584,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra'}, ], @@ -605,7 +607,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, ], @@ -626,7 +628,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra'}, ], @@ -696,7 +698,7 @@ 'os': 'Ubuntu-16.04', }, 'tests': [ - {'name': 'test262', 'shards': 3}, + {'name': 'test262', 'variant': 'default', 'shards': 3}, {'name': 'v8testing', 'shards': 4}, ], }, @@ -735,6 +737,7 @@ { 'name': 'test262', 'suffix': 'nosse3', + 'variant': 'default', 'test_args': ['--extra-flags', '--noenable-sse3 --noenable-ssse3 --noenable-sse4-1 --noenable-avx'] }, { @@ -752,6 +755,7 @@ { 'name': 'test262', 'suffix': 'nosse4', + 'variant': 'default', 'test_args': ['--extra-flags', '--noenable-sse4-1 --noenable-avx'] }, { @@ -863,7 +867,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -916,6 +920,7 @@ { 'name': 'test262', 'suffix': 'noavx', + 'variant': 'default', 'test_args': ['--extra-flags', '--noenable-avx'] }, { @@ -933,7 +938,7 @@ {'name': 'benchmarks'}, {'name': 'mozilla'}, {'name': 'optimize_for_size'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -972,6 +977,7 @@ { 'name': 'test262', 'suffix': 'noavx', + 'variant': 'default', 'test_args': ['--extra-flags', '--noenable-avx'] }, { @@ -1049,7 +1055,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -1091,7 +1097,7 @@ 'tests': [ {'name': 'benchmarks'}, {'name': 'mozilla'}, - {'name': 'test262', 'shards': 3}, + {'name': 'test262', 'variant': 'default', 'shards': 3}, {'name': 'v8testing', 'shards': 5}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'variant': 'slow_path', 'shards': 1}, @@ -1117,6 +1123,7 @@ }, { 'name': 'test262', + 'variant': 'default', 'test_args': ['--extra-flags=--stress-incremental-marking'], 'shards': 4, }, @@ -1141,7 +1148,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing'}, {'name': 'v8testing', 'variant': 'extra'}, ], @@ -1153,7 +1160,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra'}, ], @@ -1165,7 +1172,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 4}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, ], @@ -1195,7 +1202,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -1206,7 +1213,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 5}, ], }, @@ -1225,7 +1232,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, {'name': 'v8testing', 'variant': 'extra'}, ], @@ -1236,7 +1243,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 4}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, ], @@ -1247,7 +1254,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -1358,7 +1365,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 4}, {'name': 'v8testing', 'variant': 'extra'}, {'name': 'v8testing', 'variant': 'trusted'}, @@ -1371,6 +1378,7 @@ { 'name': 'test262', 'suffix': 'armv8-a', + 'variant': 'default', 'test_args': ['--extra-flags', '--enable-armv8'] }, { @@ -1380,8 +1388,17 @@ 'shards': 4 }, # Novfp3. - {'name': 'mozilla', 'suffix': 'novfp3', 'test_args': ['--novfp3']}, - {'name': 'test262', 'suffix': 'novfp3', 'test_args': ['--novfp3']}, + { + 'name': 'mozilla', + 'suffix': 'novfp3', + 'test_args': ['--novfp3'], + }, + { + 'name': 'test262', + 'suffix': 'novfp3', + 'variant': 'default', + 'test_args': ['--novfp3'], + }, { 'name': 'v8testing', 'suffix': 'novfp3', @@ -1397,7 +1414,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 8}, {'name': 'v8testing', 'variant': 'extra', 'shards': 4}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 2}, @@ -1411,6 +1428,7 @@ { 'name': 'test262', 'suffix': 'armv8-a', + 'variant': 'default', 'test_args': ['--extra-flags', '--enable-armv8'], 'shards': 2, }, @@ -1465,7 +1483,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra'}, {'name': 'v8testing', 'variant': 'trusted'}, @@ -1482,7 +1500,7 @@ 'tests': [ {'name': 'mjsunit_sp_frame_access'}, {'name': 'mozilla', 'shards': 2}, - {'name': 'test262', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 2}, {'name': 'v8testing', 'shards': 10}, {'name': 'v8testing', 'variant': 'extra', 'shards': 6}, {'name': 'v8testing', 'variant': 'trusted', 'shards': 2}, @@ -1515,7 +1533,7 @@ 'priority': 35, }, 'tests': [ - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 4}, ], }, @@ -1529,7 +1547,7 @@ 'priority': 35, }, 'tests': [ - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 4}, ], }, @@ -1715,7 +1733,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -1725,7 +1743,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 3}, ], }, @@ -1735,7 +1753,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -1745,7 +1763,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 3}, ], }, @@ -1755,7 +1773,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -1765,7 +1783,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 3}, ], }, @@ -1775,7 +1793,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing'}, ], }, @@ -1785,7 +1803,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 3}, ], }, @@ -1795,7 +1813,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 4}, ], }, @@ -1805,7 +1823,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 8}, ], }, @@ -1815,7 +1833,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 4}, ], }, @@ -1825,7 +1843,7 @@ }, 'tests': [ {'name': 'mozilla'}, - {'name': 'test262'}, + {'name': 'test262', 'variant': 'default'}, {'name': 'v8testing', 'shards': 8}, ], }, diff --git a/deps/v8/src/execution/frames.cc b/deps/v8/src/execution/frames.cc index 126cb9530ee7b9..f88e4c2788c530 100644 --- a/deps/v8/src/execution/frames.cc +++ b/deps/v8/src/execution/frames.cc @@ -1136,11 +1136,11 @@ void JavaScriptFrame::Summarize(std::vector* functions) const { DCHECK(functions->empty()); Code code = LookupCode(); int offset = static_cast(pc() - code.InstructionStart()); - AbstractCode abstract_code = AbstractCode::cast(code); + Handle abstract_code(AbstractCode::cast(code), isolate()); Handle params = GetParameters(); FrameSummary::JavaScriptFrameSummary summary( - isolate(), receiver(), function(), abstract_code, offset, IsConstructor(), - *params); + isolate(), receiver(), function(), *abstract_code, offset, + IsConstructor(), *params); functions->push_back(summary); } @@ -1813,10 +1813,11 @@ void InterpretedFrame::WriteInterpreterRegister(int register_index, void InterpretedFrame::Summarize(std::vector* functions) const { DCHECK(functions->empty()); - AbstractCode abstract_code = AbstractCode::cast(GetBytecodeArray()); + Handle abstract_code(AbstractCode::cast(GetBytecodeArray()), + isolate()); Handle params = GetParameters(); FrameSummary::JavaScriptFrameSummary summary( - isolate(), receiver(), function(), abstract_code, GetBytecodeOffset(), + isolate(), receiver(), function(), *abstract_code, GetBytecodeOffset(), IsConstructor(), *params); functions->push_back(summary); } diff --git a/deps/v8/test/mjsunit/regress/regress-1000635.js b/deps/v8/test/mjsunit/regress/regress-1000635.js new file mode 100644 index 00000000000000..2a02774f999d2d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1000635.js @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --stress-compaction --detailed-error-stack-trace --gc-interval=1 + +function add(a, b) { + throw new Error(); +} +for (let i = 0; i < 100; ++i) { + try { + add(1, 2); + } catch (e) { + } +} From 6bfe8f47fa70c113aea024452d6af840d960a127 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 19 Sep 2019 22:16:04 -0700 Subject: [PATCH 02/65] src: add buildflag to force context-aware addons PR-URL: https://github.com/nodejs/node/pull/29631 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis --- doc/api/cli.md | 8 ++++++++ doc/api/errors.md | 5 +++++ src/node_binding.cc | 8 ++++++++ src/node_errors.h | 3 +++ src/node_options.cc | 4 ++++ src/node_options.h | 1 + 6 files changed, 29 insertions(+) diff --git a/doc/api/cli.md b/doc/api/cli.md index 0ac58dba3510fb..4753b35591113f 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -439,6 +439,13 @@ added: v6.0.0 Silence all process warnings (including deprecations). +### `--force-context-aware` + + +Disable loading non-context-aware native addons. + ### `--openssl-config=file` -Disable loading non-context-aware native addons. +Disable loading native addons that are not [context-aware][]. ### `--openssl-config=file` * {integer} From f91778d2c72778bbe0da0f618277a6a231fc4857 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 26 Sep 2019 12:51:46 -0700 Subject: [PATCH 13/65] build: remove unused libatomic on ppc64, s390x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The library is not necessary for ppc64 or s390x. It does no harm with some linkers, but devtoolset-6 creates runtime dependencies on all link libraries, even unused ones. Fixes: https://github.com/nodejs/node/issues/27377 Fixes: https://github.com/nodejs/node/issues/29718 PR-URL: https://github.com/nodejs/node/pull/29727 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- tools/v8_gypfiles/v8.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 00e285ec2c2025..a506a67dba6d42 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -795,7 +795,7 @@ }], # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library # to implement atomic memory access - ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "ppc64", "s390x"]', { + ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc"]', { 'link_settings': { 'libraries': ['-latomic', ], }, From 03ec4cea3091a09d9934bd21273eb9f795d61845 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 26 Sep 2019 15:17:30 -0700 Subject: [PATCH 14/65] build: do not link against librt on linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/29727 Fixes: https://github.com/nodejs/node/issues/27377 Fixes: https://github.com/nodejs/node/issues/29718 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- node.gypi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node.gypi b/node.gypi index df10c972804218..05d80e846cffd3 100644 --- a/node.gypi +++ b/node.gypi @@ -291,6 +291,11 @@ [ 'OS=="sunos"', { 'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ], }], + [ 'OS=="linux"', { + 'libraries!': [ + '-lrt' + ], + }], [ 'OS in "freebsd linux"', { 'ldflags': [ '-Wl,-z,relro', '-Wl,-z,now' ] From 401f3e723502bfc2181c5d4cccd6444d7103fc55 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sun, 29 Sep 2019 16:53:43 +0300 Subject: [PATCH 15/65] doc: fix nits in dgram.md * Make a section with a history remark a YAML section of the relevant method. Refs: https://github.com/nodejs/node/pull/29761#discussion_r329354848 * Make a bold line a real heading to be included in the TOC. * Add formal return types. * Reduce redundancy in a description. * Unify link format. * Fix ASCII sorting in bottom references. PR-URL: https://github.com/nodejs/node/pull/29761 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat Reviewed-By: Minwoo Jung Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- doc/api/dgram.md | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index ef8cc69b7d18e1..7d8684f7f6daa7 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -137,6 +137,11 @@ properties. ### socket.bind([port][, address][, callback]) * `port` {integer} @@ -216,7 +221,7 @@ Specifying both a `'listening'` event listener and passing a useful. The `options` object may contain an additional `exclusive` property that is -used when using `dgram.Socket` objects with the [`cluster`] module. When +used when using `dgram.Socket` objects with the [`cluster`][] module. When `exclusive` is set to `false` (the default), cluster workers will use the same underlying socket handle allowing connection handling duties to be shared. When `exclusive` is `true`, however, the handle is not shared and attempted @@ -311,6 +316,8 @@ added: v8.7.0 added: v0.9.1 --> +* Returns: {dgram.Socket} + By default, binding a socket will cause it to block the Node.js process from exiting as long as the socket is open. The `socket.unref()` method can be used to exclude the socket from the reference counting that keeps the Node.js @@ -444,7 +451,7 @@ client.connect(41234, 'localhost', (err) => { }); ``` -**A Note about UDP datagram size** +#### Note about UDP datagram size The maximum size of an `IPv4/v6` datagram depends on the `MTU` (_Maximum Transmission Unit_) and on the `Payload Length` field size. @@ -626,6 +633,8 @@ The default on most systems is 64 but can vary. added: v0.9.1 --> +* Returns: {dgram.Socket} + By default, binding a socket will cause it to block the Node.js process from exiting as long as the socket is open. The `socket.unref()` method can be used to exclude the socket from the reference counting that keeps the Node.js @@ -637,27 +646,6 @@ Calling `socket.unref()` multiple times will have no addition effect. The `socket.unref()` method returns a reference to the socket so calls can be chained. -### Change to asynchronous `socket.bind()` behavior - -As of Node.js v0.10, [`dgram.Socket#bind()`][] changed to an asynchronous -execution model. Legacy code would use synchronous behavior: - -```js -const s = dgram.createSocket('udp4'); -s.bind(1234); -s.addMembership('224.0.0.114'); -``` - -Such legacy code would need to be changed to pass a callback function to the -[`dgram.Socket#bind()`][] function: - -```js -const s = dgram.createSocket('udp4'); -s.bind(1234, () => { - s.addMembership('224.0.0.114'); -}); -``` - ## `dgram` module functions ### dgram.createSocket(options[, callback]) @@ -708,9 +696,7 @@ added: v0.1.99 * `callback` {Function} - Attached as a listener to `'message'` events. * Returns: {dgram.Socket} -Creates a `dgram.Socket` object of the specified `type`. The `type` argument -can be either `'udp4'` or `'udp6'`. An optional `callback` function can be -passed which is added as a listener for `'message'` events. +Creates a `dgram.Socket` object of the specified `type`. Once the socket is created, calling [`socket.bind()`][] will instruct the socket to begin listening for datagram messages. When `address` and `port` are @@ -720,14 +706,13 @@ and `udp6` sockets). The bound address and port can be retrieved using [`socket.address().address`][] and [`socket.address().port`][]. [`'close'`]: #dgram_event_close -[`Error`]: errors.html#errors_class_error [`ERR_SOCKET_DGRAM_IS_CONNECTED`]: errors.html#errors_err_socket_dgram_is_connected [`ERR_SOCKET_DGRAM_NOT_CONNECTED`]: errors.html#errors_err_socket_dgram_not_connected +[`Error`]: errors.html#errors_class_error [`System Error`]: errors.html#errors_class_systemerror [`close()`]: #dgram_socket_close_callback [`cluster`]: cluster.html [`connect()`]: #dgram_socket_connect_port_address_callback -[`dgram.Socket#bind()`]: #dgram_socket_bind_options_callback [`dgram.createSocket()`]: #dgram_dgram_createsocket_options_callback [`dns.lookup()`]: dns.html#dns_dns_lookup_hostname_options_callback [`socket.address().address`]: #dgram_socket_address From 906245e1a4519678fe237b252ce4936730a2a345 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 29 Sep 2019 19:30:44 -0700 Subject: [PATCH 16/65] doc: clarify --pending-deprecation effects on Buffer() usage Refs: https://github.com/nodejs/node/pull/29725#issuecomment-535723152 PR-URL: https://github.com/nodejs/node/pull/29769 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Ruben Bridgewater --- doc/api/deprecations.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 7c96ac1d05d2f0..35bda82f591a47 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -154,9 +154,10 @@ objects: * [`Buffer.from(string[, encoding])`][from_string_encoding] - Create a `Buffer` that copies `string`. -As of v10.0.0, a deprecation warning is printed at runtime when -`--pending-deprecation` is used or when the calling code is -outside `node_modules` in order to better target developers, rather than users. +Without `--pending-deprecation`, runtime warnings occur only for code not in +`node_modules`. This means there will not be deprecation warnings for +`Buffer()` usage in dependencies. With `--pending-deprecation`, a runtime +warning results no matter where the `Buffer()` usage occurs. ### DEP0006: child\_process options.customFds From 60b1f6f303c51e88d668239898b2f414321198eb Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 1 Oct 2019 01:17:13 -0400 Subject: [PATCH 17/65] doc: complete cut off links in old changelog PR-URL: https://github.com/nodejs/node/pull/29558 Reviewed-By: Ruben Bridgewater --- doc/changelogs/CHANGELOG_IOJS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changelogs/CHANGELOG_IOJS.md b/doc/changelogs/CHANGELOG_IOJS.md index 658a92258ef0a0..6c5f87e557443a 100644 --- a/doc/changelogs/CHANGELOG_IOJS.md +++ b/doc/changelogs/CHANGELOG_IOJS.md @@ -744,7 +744,7 @@ See https://github.com/nodejs/node/labels/confirmed-bug for complete and current * [[`5c29c0c519`](https://github.com/nodejs/node/commit/5c29c0c519)] - **openssl**: fix keypress requirement in apps on win32 (Shigeki Ohtsu) [nodejs/node#1389](https://github.com/nodejs/node/pull/1389) * [[`2cd7f73d9f`](https://github.com/nodejs/node/commit/2cd7f73d9f)] - **openssl**: fix keypress requirement in apps on win32 (Shigeki Ohtsu) [nodejs/node#1389](https://github.com/nodejs/node/pull/1389) * [[`c65484a74d`](https://github.com/nodejs/node/commit/c65484a74d)] - **tls**: make server not use DHE in less than 1024bits (Shigeki Ohtsu) [#1739](https://github.com/nodejs/node/pull/1739) -* [[`77f518403f`](https://github.com/nodejs/node/commit/77f518403f)] - **win,node-gyp**: make delay-load hook C89 compliant (Sharat M R) [TooTallNate/node-gyp#616](https://github.com/TooTallNa +* [[`77f518403f`](https://github.com/nodejs/node/commit/77f518403f)] - **win,node-gyp**: make delay-load hook C89 compliant (Sharat M R) [TooTallNate/node-gyp#616](https://github.com/TooTallNate/node-gyp/pull/616) ## 2015-07-01, Version 2.3.2, @rvagg @@ -1128,7 +1128,7 @@ See https://github.com/nodejs/node/labels/confirmed-bug for complete and current * **crypto**: significantly reduced memory usage for TLS (Fedor Indutny & Сковорода Никита Андреевич) [#1529](https://github.com/nodejs/node/pull/1529) * **npm**: Upgrade npm to 2.9.0. See the [v2.8.4](https://github.com/npm/npm/releases/tag/v2.8.4) and [v2.9.0](https://github.com/npm/npm/releases/tag/v2.9.0) release notes for details. Summary: - * Add support for default author field to make `npm init -y` work without user-input (@othiym23) [npm/npm/d8eee6cf9d](https://github.com/npm/npm/commit/d8eee6cf9d2ff7aca68dfaed2de76824a3e0d9 + * Add support for default author field to make `npm init -y` work without user-input (@othiym23) [npm/npm/d8eee6cf9d](https://github.com/npm/npm/commit/d8eee6cf9d2ff7aca68dfaed2de76824a3e0d9) * Include local modules in `npm outdated` and `npm update` (@ArnaudRinquin) [npm/npm#7426](https://github.com/npm/npm/issues/7426) * The prefix used before the version number on `npm version` is now configurable via `tag-version-prefix` (@kkragenbrink) [npm/npm#8014](https://github.com/npm/npm/issues/8014) From de4652f55e6cb62674ef2f317c684e005f48c8af Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 1 Oct 2019 01:18:06 -0400 Subject: [PATCH 18/65] doc: convert old changlogs SHA links to match newer format PR-URL: https://github.com/nodejs/node/pull/29558 Reviewed-By: Ruben Bridgewater --- doc/changelogs/CHANGELOG_V010.md | 170 +++++++++---------- doc/changelogs/CHANGELOG_V012.md | 276 +++++++++++++++---------------- 2 files changed, 223 insertions(+), 223 deletions(-) diff --git a/doc/changelogs/CHANGELOG_V010.md b/doc/changelogs/CHANGELOG_V010.md index d01f98d059e9ea..e91115c3ee9229 100644 --- a/doc/changelogs/CHANGELOG_V010.md +++ b/doc/changelogs/CHANGELOG_V010.md @@ -93,9 +93,9 @@ This is a security release. All Node.js users should consult the security releas ### Commits -* [a14a6a3a11] - deps: c-ares, avoid single-byte buffer overwrite (Rod Vagg) https://github.com/nodejs/node/pull/9108 -* [b798f598af] - tls: fix minor jslint failure (Rod Vagg) https://github.com/nodejs/node/pull/9107 -* [92b232ba01] - win,build: try multiple timeservers when signing (Rod Vagg) https://github.com/nodejs/node/pull/9155 +* [[`a14a6a3a11`](https://github.com/nodejs/node/commit/a14a6a3a11)] - deps: c-ares, avoid single-byte buffer overwrite (Rod Vagg) https://github.com/nodejs/node/pull/9108 +* [[`b798f598af`](https://github.com/nodejs/node/commit/b798f598af)] - tls: fix minor jslint failure (Rod Vagg) https://github.com/nodejs/node/pull/9107 +* [[`92b232ba01`](https://github.com/nodejs/node/commit/92b232ba01)] - win,build: try multiple timeservers when signing (Rod Vagg) https://github.com/nodejs/node/pull/9155 ## 2016-09-27, Version 0.10.47 (Maintenance), @rvagg @@ -113,20 +113,20 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [fc259c7dc4] - buffer: zero-fill uninitialized bytes in .concat() (Сковорода Никита Андреевич) https://github.com/nodejs/node-private/pull/67 -* [35b49ed4bb] - build: turn on -fno-delete-null-pointer-checks (Ben Noordhuis) https://github.com/nodejs/node/pull/6738 -* [03f4920d6a] - crypto: don't build hardware engines (Rod Vagg) https://github.com/nodejs/node-private/pull/68 -* [1cbdb1957d] - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25368 -* [c66408cd0c] - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25654 -* [68f88ea792] - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 -* [884d50b348] - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 -* [bfd6cb5699] - deps: upgrade openssl sources to 1.0.1u (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 -* [3614a173d0] - http: check reason chars in writeHead (Evan Lucas) https://github.com/nodejs/node-private/pull/48 -* [f2433430ca] - http: disallow sending obviously invalid status codes (Evan Lucas) https://github.com/nodejs/node-private/pull/48 -* [0d7e21ee7b] - lib: make tls.checkServerIdentity() more strict (Ben Noordhuis) https://github.com/nodejs/node-private/pull/62 -* [1f4a6f5bd1] - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 -* [88dcc7f5bb] - v8: fix -Wsign-compare warning in Zone::New() (Ben Noordhuis) https://github.com/nodejs/node-private/pull/62 -* [fd8ac56c75] - v8: fix build errors with g++ 6.1.1 (Ben Noordhuis) https://github.com/nodejs/node-private/pull/62 +* [[`fc259c7dc4`](https://github.com/nodejs/node/commit/fc259c7dc4)] - buffer: zero-fill uninitialized bytes in .concat() (Сковорода Никита Андреевич) https://github.com/nodejs/node-private/pull/67 +* [[`35b49ed4bb`](https://github.com/nodejs/node/commit/35b49ed4bb)] - build: turn on -fno-delete-null-pointer-checks (Ben Noordhuis) https://github.com/nodejs/node/pull/6738 +* [[`03f4920d6a`](https://github.com/nodejs/node/commit/03f4920d6a)] - crypto: don't build hardware engines (Rod Vagg) https://github.com/nodejs/node-private/pull/68 +* [[`1cbdb1957d`](https://github.com/nodejs/node/commit/1cbdb1957d)] - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25368 +* [[`c66408cd0c`](https://github.com/nodejs/node/commit/c66408cd0c)] - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25654 +* [[`68f88ea792`](https://github.com/nodejs/node/commit/68f88ea792)] - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 +* [[`884d50b348`](https://github.com/nodejs/node/commit/884d50b348)] - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 +* [[`bfd6cb5699`](https://github.com/nodejs/node/commit/bfd6cb5699)] - deps: upgrade openssl sources to 1.0.1u (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 +* [[`3614a173d0`](https://github.com/nodejs/node/commit/3614a173d0)] - http: check reason chars in writeHead (Evan Lucas) https://github.com/nodejs/node-private/pull/48 +* [[`f2433430ca`](https://github.com/nodejs/node/commit/f2433430ca)] - http: disallow sending obviously invalid status codes (Evan Lucas) https://github.com/nodejs/node-private/pull/48 +* [[`0d7e21ee7b`](https://github.com/nodejs/node/commit/0d7e21ee7b)] - lib: make tls.checkServerIdentity() more strict (Ben Noordhuis) https://github.com/nodejs/node-private/pull/62 +* [[`1f4a6f5bd1`](https://github.com/nodejs/node/commit/1f4a6f5bd1)] - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 +* [[`88dcc7f5bb`](https://github.com/nodejs/node/commit/88dcc7f5bb)] - v8: fix -Wsign-compare warning in Zone::New() (Ben Noordhuis) https://github.com/nodejs/node-private/pull/62 +* [[`fd8ac56c75`](https://github.com/nodejs/node/commit/fd8ac56c75)] - v8: fix build errors with g++ 6.1.1 (Ben Noordhuis) https://github.com/nodejs/node-private/pull/62 ## 2016-06-23, Version 0.10.46 (Maintenance), @rvagg @@ -140,8 +140,8 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [3374f57973] - deps: update libuv to 0.10.37 (Saúl Ibarra Corretgé) https://github.com/nodejs/node/pull/7293 -* [fcb9145e29] - deps: backport 3a9bfec from v8 upstream (Myles Borins) https://github.com/nodejs/node-private/pull/43 +* [[`3374f57973`](https://github.com/nodejs/node/commit/3374f57973)] - deps: update libuv to 0.10.37 (Saúl Ibarra Corretgé) https://github.com/nodejs/node/pull/7293 +* [[`fcb9145e29`](https://github.com/nodejs/node/commit/fcb9145e29)] - deps: backport 3a9bfec from v8 upstream (Myles Borins) https://github.com/nodejs/node-private/pull/43 ## 2016-05-06, Version 0.10.45 (Maintenance), @rvagg @@ -155,14 +155,14 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [3cff81c7d6] - deps: completely upgrade npm in LTS to 2.15.1 (Forrest L Norvell) https://github.com/nodejs/node/pull/5987 -* [7c22f19009] - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 -* [5d78366937] - deps: update openssl asm files (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 -* [2bc2427cb7] - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/joyent/node/pull/25654 -* [8df4b0914c] - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 -* [11eefefb17] - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 -* [61ccc27b54] - deps: upgrade openssl sources to 1.0.1t (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 -* [aa02438274] - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 +* [[`3cff81c7d6`](https://github.com/nodejs/node/commit/3cff81c7d6)] - deps: completely upgrade npm in LTS to 2.15.1 (Forrest L Norvell) https://github.com/nodejs/node/pull/5987 +* [[`7c22f19009`](https://github.com/nodejs/node/commit/7c22f19009)] - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 +* [[`5d78366937`](https://github.com/nodejs/node/commit/5d78366937)] - deps: update openssl asm files (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 +* [[`2bc2427cb7`](https://github.com/nodejs/node/commit/2bc2427cb7)] - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/joyent/node/pull/25654 +* [[`8df4b0914c`](https://github.com/nodejs/node/commit/8df4b0914c)] - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 +* [[`11eefefb17`](https://github.com/nodejs/node/commit/11eefefb17)] - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 +* [[`61ccc27b54`](https://github.com/nodejs/node/commit/61ccc27b54)] - deps: upgrade openssl sources to 1.0.1t (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 +* [[`aa02438274`](https://github.com/nodejs/node/commit/aa02438274)] - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 ## 2016-03-31, Version 0.10.44 (Maintenance), @rvagg @@ -174,10 +174,10 @@ This is a security release. All Node.js users should consult the security releas ### Commits -* [feceb77d7e] - deps: upgrade npm in LTS to 2.15.1 (Forrest L Norvell) https://github.com/nodejs/node/pull/5968 -* [0847954331] - deps: Disable EXPORT and LOW ciphers in openssl (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 -* [6bb86e727a] - test: change tls tests not to use LOW cipher (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 -* [905bec29ad] - win,build: support Visual C++ Build Tools 2015 (João Reis) https://github.com/nodejs/node/pull/5627 +* [[`feceb77d7e`](https://github.com/nodejs/node/commit/feceb77d7e)] - deps: upgrade npm in LTS to 2.15.1 (Forrest L Norvell) https://github.com/nodejs/node/pull/5968 +* [[`0847954331`](https://github.com/nodejs/node/commit/0847954331)] - deps: Disable EXPORT and LOW ciphers in openssl (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 +* [[`6bb86e727a`](https://github.com/nodejs/node/commit/6bb86e727a)] - test: change tls tests not to use LOW cipher (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 +* [[`905bec29ad`](https://github.com/nodejs/node/commit/905bec29ad)] - win,build: support Visual C++ Build Tools 2015 (João Reis) https://github.com/nodejs/node/pull/5627 ## 2016-03-04, Version 0.10.43 (Maintenance), @rvagg @@ -196,13 +196,13 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [164157abbb] - build: update Node.js logo on OSX installer (Rod Vagg) https://github.com/nodejs/node/pull/5401 -* [f8cb0dcf67] - crypto,tls: remove SSLv2 support (Ben Noordhuis) https://github.com/nodejs/node/pull/5529 -* [42ded2a590] - deps: upgrade openssl to 1.0.1s (Ben Noordhuis) https://github.com/nodejs/node/pull/5508 -* [1e45a6111c] - deps: update http-parser to version 1.2 (James M Snell) https://github.com/nodejs/node/pull/5242 -* [6db377b2f4] - doc: remove SSLv2 descriptions (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5541 -* [563c359f5c] - domains: fix handling of uncaught exceptions (Julien Gilli) https://github.com/nodejs/node/pull/3887 -* [e483f3fd26] - test: fix hanging http obstext test (Ben Noordhuis) https://github.com/nodejs/node/pull/5511 +* [[`164157abbb`](https://github.com/nodejs/node/commit/164157abbb)] - build: update Node.js logo on OSX installer (Rod Vagg) https://github.com/nodejs/node/pull/5401 +* [[`f8cb0dcf67`](https://github.com/nodejs/node/commit/f8cb0dcf67)] - crypto,tls: remove SSLv2 support (Ben Noordhuis) https://github.com/nodejs/node/pull/5529 +* [[`42ded2a590`](https://github.com/nodejs/node/commit/42ded2a590)] - deps: upgrade openssl to 1.0.1s (Ben Noordhuis) https://github.com/nodejs/node/pull/5508 +* [[`1e45a6111c`](https://github.com/nodejs/node/commit/1e45a6111c)] - deps: update http-parser to version 1.2 (James M Snell) https://github.com/nodejs/node/pull/5242 +* [[`6db377b2f4`](https://github.com/nodejs/node/commit/6db377b2f4)] - doc: remove SSLv2 descriptions (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5541 +* [[`563c359f5c`](https://github.com/nodejs/node/commit/563c359f5c)] - domains: fix handling of uncaught exceptions (Julien Gilli) https://github.com/nodejs/node/pull/3887 +* [[`e483f3fd26`](https://github.com/nodejs/node/commit/e483f3fd26)] - test: fix hanging http obstext test (Ben Noordhuis) https://github.com/nodejs/node/pull/5511 ## 2016-02-09, Version 0.10.42 (Maintenance), @jasnell @@ -223,14 +223,14 @@ This is an important security release. All Node.js users should consult the secu ### Commits -* [fdc332183e] - build: enable xz compressed tarballs where possible (Rod Vagg) https://github.com/nodejs/node/pull/4894 -* [2d35b421b5] - deps: upgrade openssl sources to 1.0.1r (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 -* [b31c0f3ea4] - deps: update http-parser to version 1.1 (James M Snell) -* [616ec1d6b0] - doc: clarify v0.10.41 openssl tls security impact (Rod Vagg) https://github.com/nodejs/node/pull/4153 -* [ccb3c2377c] - http: strictly forbid invalid characters from headers (James M Snell) -* [f0af0d1f96] - src: avoid compiler warning in node_revert.cc (James M Snell) -* [df80e856c6] - src: add --security-revert command line flag (James M Snell) -* [ff58dcdd74] - tools: backport tools/install.py for headers (Richard Lau) https://github.com/nodejs/node/pull/4149 +* [[`fdc332183e`](https://github.com/nodejs/node/commit/fdc332183e)] - build: enable xz compressed tarballs where possible (Rod Vagg) https://github.com/nodejs/node/pull/4894 +* [[`2d35b421b5`](https://github.com/nodejs/node/commit/2d35b421b5)] - deps: upgrade openssl sources to 1.0.1r (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 +* [[`b31c0f3ea4`](https://github.com/nodejs/node/commit/b31c0f3ea4)] - deps: update http-parser to version 1.1 (James M Snell) +* [[`616ec1d6b0`](https://github.com/nodejs/node/commit/616ec1d6b0)] - doc: clarify v0.10.41 openssl tls security impact (Rod Vagg) https://github.com/nodejs/node/pull/4153 +* [[`ccb3c2377c`](https://github.com/nodejs/node/commit/ccb3c2377c)] - http: strictly forbid invalid characters from headers (James M Snell) +* [[`f0af0d1f96`](https://github.com/nodejs/node/commit/f0af0d1f96)] - src: avoid compiler warning in node_revert.cc (James M Snell) +* [[`df80e856c6`](https://github.com/nodejs/node/commit/df80e856c6)] - src: add --security-revert command line flag (James M Snell) +* [[`ff58dcdd74`](https://github.com/nodejs/node/commit/ff58dcdd74)] - tools: backport tools/install.py for headers (Richard Lau) https://github.com/nodejs/node/pull/4149 ## 2015-12-04, Version 0.10.41 (Maintenance), @rvagg @@ -245,45 +245,45 @@ Security Update ### Commits -* [16ca0779f5] - src/node.cc: fix build error without OpenSSL support (Jörg Krause) https://github.com/nodejs/node-v0.x-archive/pull/25862 -* [c559c7911d] - build: backport tools/release.sh (Rod Vagg) https://github.com/nodejs/node/pull/3965 -* [268d2b4637] - build: backport config for new CI infrastructure (Rod Vagg) https://github.com/nodejs/node/pull/3965 -* [c88a0b26da] - build: update manifest to include Windows 10 (Lucien Greathouse) https://github.com/nodejs/node/pull/2838 -* [8564a9f5f7] - build: gcc version detection on openSUSE Tumbleweed (Henrique Aparecido Lavezzo) https://github.com/nodejs/node-v0.x-archive/pull/25671 -* [9c7bd6de56] - build: run-ci makefile rule (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [ffa1e1f31d] - build: support flaky tests in test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [100dd19e61] - build: support Jenkins via test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [ec861f6f90] - build: make release process easier for multi users (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25638 -* [d7ae79a452] - build,win: fix node.exe resource version (João Reis) https://github.com/nodejs/node/pull/3053 -* [6ac47aa9f5] - build,win: try next MSVS version on failure (João Reis) https://github.com/nodejs/node/pull/2910 -* [e669b27740] - crypto: replace rwlocks with simple mutexes (Ben Noordhuis) https://github.com/nodejs/node/pull/2723 -* [ce0a48826e] - deps: upgrade to openssl 1.0.1q (Ben Noordhuis) https://github.com/nodejs/node/pull/4132 -* [b68781e500] - deps: upgrade npm to 1.4.29 (Forrest L Norvell) https://github.com/nodejs/node/pull/3639 -* [7cf0d9c1d9] - deps: fix openssl for MSVS 2015 (Andy Polyakov) https://github.com/nodejs/node-v0.x-archive/pull/25857 -* [9ee8a14f9e] - deps: fix gyp to work on MacOSX without XCode (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25857 -* [a525c7244e] - deps: update gyp to 25ed9ac (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25857 -* [6502160294] - dns: allow v8 to optimize lookup() (Brian White) https://github.com/nodejs/node-v0.x-archive/pull/8942 -* [5d829a63ab] - doc: backport README.md (Rod Vagg) https://github.com/nodejs/node/pull/3965 -* [62c8948109] - doc: fix Folders as Modules omission of index.json (Elan Shanker) https://github.com/nodejs/node-v0.x-archive/pull/8868 -* [572663f303] - https: don't overwrite servername option (skenqbx) https://github.com/nodejs/node-v0.x-archive/pull/9368 -* [75c84b2439] - test: add test for https agent servername option (skenqbx) https://github.com/nodejs/node-v0.x-archive/pull/9368 -* [841a6dd264] - test: mark more tests as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25807 -* [a7fee30da1] - test: mark test-tls-securepair-server as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25807 -* [7df57703dd] - test: mark test-net-error-twice flaky on SmartOS (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25760 -* [e10892cccc] - test: make test-abort-fatal-error non flaky (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25755 -* [a2f879f197] - test: mark recently failing tests as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [e7010bdf92] - test: runner should return 0 on flaky tests (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [c283c9bbb3] - test: support writing test output to file (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [eeaed586bb] - test: runner support for flaky tests (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [3bb8174b94] - test: refactor to use common testcfg (Timothy J Fontaine) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [df59d43586] - tools: pass constant to logger instead of string (Johan Bergström) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [d103d4ed9a] - tools: fix test.py after v8 upgrade (Ben Noordhuis) https://github.com/nodejs/node-v0.x-archive/pull/25686 -* [8002192b4e] - win: manifest node.exe for Windows 8.1 (Alexis Campailla) https://github.com/nodejs/node/pull/2838 -* [66ec1dae8f] - win: add MSVS 2015 support (Rod Vagg) https://github.com/nodejs/node-v0.x-archive/pull/25857 -* [e192f61514] - win: fix custom actions for WiX older than 3.9 (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25569 -* [16bcd68dc5] - win: fix custom actions on Visual Studio != 2013 (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25569 -* [517986c2f4] - win: backport bringing back xp/2k3 support (Bert Belder) https://github.com/nodejs/node-v0.x-archive/pull/25569 -* [10f251e8dd] - win: backport set env before generating projects (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25569 +* [[`16ca0779f5`](https://github.com/nodejs/node/commit/16ca0779f5)] - src/node.cc: fix build error without OpenSSL support (Jörg Krause) https://github.com/nodejs/node-v0.x-archive/pull/25862 +* [[`c559c7911d`](https://github.com/nodejs/node/commit/c559c7911d)] - build: backport tools/release.sh (Rod Vagg) https://github.com/nodejs/node/pull/3965 +* [[`268d2b4637`](https://github.com/nodejs/node/commit/268d2b4637)] - build: backport config for new CI infrastructure (Rod Vagg) https://github.com/nodejs/node/pull/3965 +* [[`c88a0b26da`](https://github.com/nodejs/node/commit/c88a0b26da)] - build: update manifest to include Windows 10 (Lucien Greathouse) https://github.com/nodejs/node/pull/2838 +* [[`8564a9f5f7`](https://github.com/nodejs/node/commit/8564a9f5f7)] - build: gcc version detection on openSUSE Tumbleweed (Henrique Aparecido Lavezzo) https://github.com/nodejs/node-v0.x-archive/pull/25671 +* [[`9c7bd6de56`](https://github.com/nodejs/node/commit/9c7bd6de56)] - build: run-ci makefile rule (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`ffa1e1f31d`](https://github.com/nodejs/node/commit/ffa1e1f31d)] - build: support flaky tests in test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`100dd19e61`](https://github.com/nodejs/node/commit/100dd19e61)] - build: support Jenkins via test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`ec861f6f90`](https://github.com/nodejs/node/commit/ec861f6f90)] - build: make release process easier for multi users (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25638 +* [[`d7ae79a452`](https://github.com/nodejs/node/commit/d7ae79a452)] - build,win: fix node.exe resource version (João Reis) https://github.com/nodejs/node/pull/3053 +* [[`6ac47aa9f5`](https://github.com/nodejs/node/commit/6ac47aa9f5)] - build,win: try next MSVS version on failure (João Reis) https://github.com/nodejs/node/pull/2910 +* [[`e669b27740`](https://github.com/nodejs/node/commit/e669b27740)] - crypto: replace rwlocks with simple mutexes (Ben Noordhuis) https://github.com/nodejs/node/pull/2723 +* [[`ce0a48826e`](https://github.com/nodejs/node/commit/ce0a48826e)] - deps: upgrade to openssl 1.0.1q (Ben Noordhuis) https://github.com/nodejs/node/pull/4132 +* [[`b68781e500`](https://github.com/nodejs/node/commit/b68781e500)] - deps: upgrade npm to 1.4.29 (Forrest L Norvell) https://github.com/nodejs/node/pull/3639 +* [[`7cf0d9c1d9`](https://github.com/nodejs/node/commit/7cf0d9c1d9)] - deps: fix openssl for MSVS 2015 (Andy Polyakov) https://github.com/nodejs/node-v0.x-archive/pull/25857 +* [[`9ee8a14f9e`](https://github.com/nodejs/node/commit/9ee8a14f9e)] - deps: fix gyp to work on MacOSX without XCode (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25857 +* [[`a525c7244e`](https://github.com/nodejs/node/commit/a525c7244e)] - deps: update gyp to 25ed9ac (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25857 +* [[`6502160294`](https://github.com/nodejs/node/commit/6502160294)] - dns: allow v8 to optimize lookup() (Brian White) https://github.com/nodejs/node-v0.x-archive/pull/8942 +* [[`5d829a63ab`](https://github.com/nodejs/node/commit/5d829a63ab)] - doc: backport README.md (Rod Vagg) https://github.com/nodejs/node/pull/3965 +* [[`62c8948109`](https://github.com/nodejs/node/commit/62c8948109)] - doc: fix Folders as Modules omission of index.json (Elan Shanker) https://github.com/nodejs/node-v0.x-archive/pull/8868 +* [[`572663f303`](https://github.com/nodejs/node/commit/572663f303)] - https: don't overwrite servername option (skenqbx) https://github.com/nodejs/node-v0.x-archive/pull/9368 +* [[`75c84b2439`](https://github.com/nodejs/node/commit/75c84b2439)] - test: add test for https agent servername option (skenqbx) https://github.com/nodejs/node-v0.x-archive/pull/9368 +* [[`841a6dd264`](https://github.com/nodejs/node/commit/841a6dd264)] - test: mark more tests as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25807 +* [[`a7fee30da1`](https://github.com/nodejs/node/commit/a7fee30da1)] - test: mark test-tls-securepair-server as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25807 +* [[`7df57703dd`](https://github.com/nodejs/node/commit/7df57703dd)] - test: mark test-net-error-twice flaky on SmartOS (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25760 +* [[`e10892cccc`](https://github.com/nodejs/node/commit/e10892cccc)] - test: make test-abort-fatal-error non flaky (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25755 +* [[`a2f879f197`](https://github.com/nodejs/node/commit/a2f879f197)] - test: mark recently failing tests as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`e7010bdf92`](https://github.com/nodejs/node/commit/e7010bdf92)] - test: runner should return 0 on flaky tests (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`c283c9bbb3`](https://github.com/nodejs/node/commit/c283c9bbb3)] - test: support writing test output to file (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`eeaed586bb`](https://github.com/nodejs/node/commit/eeaed586bb)] - test: runner support for flaky tests (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`3bb8174b94`](https://github.com/nodejs/node/commit/3bb8174b94)] - test: refactor to use common testcfg (Timothy J Fontaine) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`df59d43586`](https://github.com/nodejs/node/commit/df59d43586)] - tools: pass constant to logger instead of string (Johan Bergström) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`d103d4ed9a`](https://github.com/nodejs/node/commit/d103d4ed9a)] - tools: fix test.py after v8 upgrade (Ben Noordhuis) https://github.com/nodejs/node-v0.x-archive/pull/25686 +* [[`8002192b4e`](https://github.com/nodejs/node/commit/8002192b4e)] - win: manifest node.exe for Windows 8.1 (Alexis Campailla) https://github.com/nodejs/node/pull/2838 +* [[`66ec1dae8f`](https://github.com/nodejs/node/commit/66ec1dae8f)] - win: add MSVS 2015 support (Rod Vagg) https://github.com/nodejs/node-v0.x-archive/pull/25857 +* [[`e192f61514`](https://github.com/nodejs/node/commit/e192f61514)] - win: fix custom actions for WiX older than 3.9 (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25569 +* [[`16bcd68dc5`](https://github.com/nodejs/node/commit/16bcd68dc5)] - win: fix custom actions on Visual Studio != 2013 (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25569 +* [[`517986c2f4`](https://github.com/nodejs/node/commit/517986c2f4)] - win: backport bringing back xp/2k3 support (Bert Belder) https://github.com/nodejs/node-v0.x-archive/pull/25569 +* [[`10f251e8dd`](https://github.com/nodejs/node/commit/10f251e8dd)] - win: backport set env before generating projects (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25569 ## 2015-07-09, Version 0.10.40 (Maintenance) diff --git a/doc/changelogs/CHANGELOG_V012.md b/doc/changelogs/CHANGELOG_V012.md index c38d33bebb75e0..db88e9795cfe68 100644 --- a/doc/changelogs/CHANGELOG_V012.md +++ b/doc/changelogs/CHANGELOG_V012.md @@ -60,13 +60,13 @@ will be maintained until December 31st, 2016. ### Commits: -* [a47fd4549d] - build: add working lint-ci make target (Rod Vagg) https://github.com/nodejs/node/pull/9151 -* [830584ca59] - deps: define missing operator delete functions (John Barboza) https://github.com/nodejs/node/pull/10356 -* [c130b31cba] - deps: upgrade npm to 2.15.11 (Jeremiah Senkpiel) https://github.com/nodejs/node/pull/9619 -* [bc6766d847] - doc: update npm license in main LICENSE file (Rod Vagg) https://github.com/nodejs/node/pull/10352 -* [0cdf344c80] - (SEMVER-MINOR) process: reintroduce ares to versions (Johan Bergström) https://github.com/nodejs/node/pull/9191 -* [d8e27ec30a] - test: mark dgram-multicast-multi-process as flaky (Rod Vagg) https://github.com/nodejs/node/pull/9150 -* [c722335ead] - tls: fix minor jslint failure (Rod Vagg) https://github.com/nodejs/node/pull/9107 +* [[`a47fd4549d`](https://github.com/nodejs/node/commit/a47fd4549d) - build: add working lint-ci make target (Rod Vagg) https://github.com/nodejs/node/pull/9151 +* [[`830584ca59`](https://github.com/nodejs/node/commit/830584ca59) - deps: define missing operator delete functions (John Barboza) https://github.com/nodejs/node/pull/10356 +* [[`c130b31cba`](https://github.com/nodejs/node/commit/c130b31cba) - deps: upgrade npm to 2.15.11 (Jeremiah Senkpiel) https://github.com/nodejs/node/pull/9619 +* [[`bc6766d847`](https://github.com/nodejs/node/commit/bc6766d847) - doc: update npm license in main LICENSE file (Rod Vagg) https://github.com/nodejs/node/pull/10352 +* [[`0cdf344c80`](https://github.com/nodejs/node/commit/0cdf344c80) - (SEMVER-MINOR) process: reintroduce ares to versions (Johan Bergström) https://github.com/nodejs/node/pull/9191 +* [[`d8e27ec30a`](https://github.com/nodejs/node/commit/d8e27ec30a) - test: mark dgram-multicast-multi-process as flaky (Rod Vagg) https://github.com/nodejs/node/pull/9150 +* [[`c722335ead`](https://github.com/nodejs/node/commit/c722335ead) - tls: fix minor jslint failure (Rod Vagg) https://github.com/nodejs/node/pull/9107 ## 2016-10-18, Version 0.12.17 (Maintenance), @rvagg @@ -79,7 +79,7 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [c5b095ecf8] - deps: avoid single-byte buffer overwrite (Daniel Stenberg) https://github.com/nodejs/node/pull/8849 +* [[`c5b095ecf8`](https://github.com/nodejs/node/commit/c5b095ecf8) - deps: avoid single-byte buffer overwrite (Daniel Stenberg) https://github.com/nodejs/node/pull/8849 ## 2016-09-27, Version 0.12.16 (Maintenance), @rvagg @@ -99,18 +99,18 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [38d7258d89] - buffer: zero-fill uninitialized bytes in .concat() (Сковорода Никита Андреевич) https://github.com/nodejs/node-private/pull/66 -* [1ba6d16786] - build: turn on -fno-delete-null-pointer-checks (Ben Noordhuis) https://github.com/nodejs/node/pull/6737 -* [71e4285e27] - crypto: don't build hardware engines (Rod Vagg) https://github.com/nodejs/node-private/pull/69 -* [b6e0105a66] - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25368 -* [1caec97eab] - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25654 -* [734bc6938b] - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 -* [7cc6d4eb5c] - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 -* [4a9da21217] - deps: upgrade openssl sources to 1.0.1u (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 -* [6d977902bd] - http: check reason chars in writeHead (Evan Lucas) https://github.com/nodejs/node-private/pull/47 -* [ad470e496b] - http: disallow sending obviously invalid status codes (Evan Lucas) https://github.com/nodejs/node-private/pull/47 -* [9dbde2fc88] - lib: make tls.checkServerIdentity() more strict (Ben Noordhuis) https://github.com/nodejs/node-private/pull/61 -* [db80592071] - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 +* [[`38d7258d89`](https://github.com/nodejs/node/commit/38d7258d89) - buffer: zero-fill uninitialized bytes in .concat() (Сковорода Никита Андреевич) https://github.com/nodejs/node-private/pull/66 +* [[`1ba6d16786`](https://github.com/nodejs/node/commit/1ba6d16786) - build: turn on -fno-delete-null-pointer-checks (Ben Noordhuis) https://github.com/nodejs/node/pull/6737 +* [[`71e4285e27`](https://github.com/nodejs/node/commit/71e4285e27) - crypto: don't build hardware engines (Rod Vagg) https://github.com/nodejs/node-private/pull/69 +* [[`b6e0105a66`](https://github.com/nodejs/node/commit/b6e0105a66) - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25368 +* [[`1caec97eab`](https://github.com/nodejs/node/commit/1caec97eab) - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25654 +* [[`734bc6938b`](https://github.com/nodejs/node/commit/734bc6938b) - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 +* [[`7cc6d4eb5c`](https://github.com/nodejs/node/commit/7cc6d4eb5c) - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 +* [[`4a9da21217`](https://github.com/nodejs/node/commit/4a9da21217) - deps: upgrade openssl sources to 1.0.1u (Shigeki Ohtsu) https://github.com/nodejs/node/pull/8718 +* [[`6d977902bd`](https://github.com/nodejs/node/commit/6d977902bd) - http: check reason chars in writeHead (Evan Lucas) https://github.com/nodejs/node-private/pull/47 +* [[`ad470e496b`](https://github.com/nodejs/node/commit/ad470e496b) - http: disallow sending obviously invalid status codes (Evan Lucas) https://github.com/nodejs/node-private/pull/47 +* [[`9dbde2fc88`](https://github.com/nodejs/node/commit/9dbde2fc88) - lib: make tls.checkServerIdentity() more strict (Ben Noordhuis) https://github.com/nodejs/node-private/pull/61 +* [[`db80592071`](https://github.com/nodejs/node/commit/db80592071) - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/nodejs/node-v0.x-archive/pull/25654 ## 2016-06-23, Version 0.12.15 (Maintenance), @rvagg @@ -124,13 +124,13 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [da8501edf6] - deps: backport bd1777fd from libuv upstream (Rod Vagg) -* [9207a00f8e] - deps: backport 85adf43e from libuv upstream (Rod Vagg) -* [9627f34230] - deps: backport 98239224 from libuv upstream (Rod Vagg) -* [5df21b2e36] - deps: backport 9a4fd268 from libuv upstream (Rod Vagg) -* [e75de35057] - deps: backport 3eb6764a from libuv upstream (Rod Vagg) -* [a113e02f16] - deps: backport 3a9bfec from v8 upstream (Ben Noordhuis) -* [8138055c88] - test: fix test failure due to expired certificates (Ben Noordhuis) https://github.com/nodejs/node/pull/7195 +* [[`da8501edf6`](https://github.com/nodejs/node/commit/da8501edf6) - deps: backport bd1777fd from libuv upstream (Rod Vagg) +* [[`9207a00f8e`](https://github.com/nodejs/node/commit/9207a00f8e) - deps: backport 85adf43e from libuv upstream (Rod Vagg) +* [[`9627f34230`](https://github.com/nodejs/node/commit/9627f34230) - deps: backport 98239224 from libuv upstream (Rod Vagg) +* [[`5df21b2e36`](https://github.com/nodejs/node/commit/5df21b2e36) - deps: backport 9a4fd268 from libuv upstream (Rod Vagg) +* [[`e75de35057`](https://github.com/nodejs/node/commit/e75de35057) - deps: backport 3eb6764a from libuv upstream (Rod Vagg) +* [[`a113e02f16`](https://github.com/nodejs/node/commit/a113e02f16) - deps: backport 3a9bfec from v8 upstream (Ben Noordhuis) +* [[`8138055c88`](https://github.com/nodejs/node/commit/8138055c88) - test: fix test failure due to expired certificates (Ben Noordhuis) https://github.com/nodejs/node/pull/7195 ## 2016-05-06, Version 0.12.14 (Maintenance), @rvagg @@ -145,15 +145,15 @@ This is a security release. All Node.js users should consult the security releas ### Commits: -* [3e99ee1b47] - deps: completely upgrade npm in LTS to 2.15.1 (Forrest L Norvell) https://github.com/nodejs/node/pull/5988 -* [2b63396e1f] - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 -* [f21705df58] - deps: update openssl asm files (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 -* [02b6a6bc27] - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/joyent/node/pull/25654 -* [1aecc668b0] - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 -* [39380836a0] - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 -* [08c8ae44a8] - deps: upgrade openssl sources to 1.0.1t (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 -* [f5a961ab13] - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 -* [810fb211a7] - tools: remove obsolete npm test-legacy command (Kat Marchán) https://github.com/nodejs/node/pull/5988 +* [[`3e99ee1b47`](https://github.com/nodejs/node/commit/3e99ee1b47) - deps: completely upgrade npm in LTS to 2.15.1 (Forrest L Norvell) https://github.com/nodejs/node/pull/5988 +* [[`2b63396e1f`](https://github.com/nodejs/node/commit/2b63396e1f) - deps: add -no_rand_screen to openssl s_client (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 +* [[`f21705df58`](https://github.com/nodejs/node/commit/f21705df58) - deps: update openssl asm files (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 +* [[`02b6a6bc27`](https://github.com/nodejs/node/commit/02b6a6bc27) - deps: fix openssl assembly error on ia32 win32 (Fedor Indutny) https://github.com/joyent/node/pull/25654 +* [[`1aecc668b0`](https://github.com/nodejs/node/commit/1aecc668b0) - deps: separate sha256/sha512-x86_64.pl for openssl (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 +* [[`39380836a0`](https://github.com/nodejs/node/commit/39380836a0) - deps: copy all openssl header files to include dir (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 +* [[`08c8ae44a8`](https://github.com/nodejs/node/commit/08c8ae44a8) - deps: upgrade openssl sources to 1.0.1t (Shigeki Ohtsu) https://github.com/nodejs/node/pull/6553 +* [[`f5a961ab13`](https://github.com/nodejs/node/commit/f5a961ab13) - openssl: fix keypress requirement in apps on win32 (Shigeki Ohtsu) https://github.com/joyent/node/pull/25654 +* [[`810fb211a7`](https://github.com/nodejs/node/commit/810fb211a7) - tools: remove obsolete npm test-legacy command (Kat Marchán) https://github.com/nodejs/node/pull/5988 ## 2016-03-31, Version 0.12.13 (LTS), @rvagg @@ -165,12 +165,12 @@ This is a security release. All Node.js users should consult the security releas ### Commits -* [4041ea6bc5] - deps: upgrade npm in LTS to 2.15.1 (Forrest L Norvell) -* [a115779026] - deps: Disable EXPORT and LOW ciphers in openssl (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 -* [ab907eb5a8] - test: skip cluster-disconnect-race on Windows (Gibson Fahnestock) https://github.com/nodejs/node/pull/5621 -* [9c06db7444] - test: change tls tests not to use LOW cipher (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 -* [154098a3dc] - test: bp fix for test-http-get-pipeline-problem.js (Michael Dawson) https://github.com/nodejs/node/pull/3013 -* [ff2bed6e86] - win,build: support Visual C++ Build Tools 2015 (João Reis) https://github.com/nodejs/node/pull/5627 +* [[`4041ea6bc5`](https://github.com/nodejs/node/commit/4041ea6bc5) - deps: upgrade npm in LTS to 2.15.1 (Forrest L Norvell) +* [[`a115779026`](https://github.com/nodejs/node/commit/a115779026) - deps: Disable EXPORT and LOW ciphers in openssl (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 +* [[`ab907eb5a8`](https://github.com/nodejs/node/commit/ab907eb5a8) - test: skip cluster-disconnect-race on Windows (Gibson Fahnestock) https://github.com/nodejs/node/pull/5621 +* [[`9c06db7444`](https://github.com/nodejs/node/commit/9c06db7444) - test: change tls tests not to use LOW cipher (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5712 +* [[`154098a3dc`](https://github.com/nodejs/node/commit/154098a3dc) - test: bp fix for test-http-get-pipeline-problem.js (Michael Dawson) https://github.com/nodejs/node/pull/3013 +* [[`ff2bed6e86`](https://github.com/nodejs/node/commit/ff2bed6e86) - win,build: support Visual C++ Build Tools 2015 (João Reis) https://github.com/nodejs/node/pull/5627 ## 2016-03-08, Version 0.12.12 (LTS), @rvagg @@ -183,7 +183,7 @@ Note that the upgrade to OpenSSL 1.0.1s in Node.js v0.12.11 removed internal SSL ### Commits: -* [dbfc9d9241] - crypto,tls: remove SSLv2 support (Ben Noordhuis) https://github.com/nodejs/node/pull/5536 +* [[`dbfc9d9241`](https://github.com/nodejs/node/commit/dbfc9d9241) - crypto,tls: remove SSLv2 support (Ben Noordhuis) https://github.com/nodejs/node/pull/5536 ## 2016-03-03, Version 0.12.11 (LTS), @rvagg @@ -201,20 +201,20 @@ Note that the upgrade to OpenSSL 1.0.1s in Node.js v0.12.11 removed internal SSL ### Commits: -* [1ab6653db9] - build: update Node.js logo on OSX installer (Rod Vagg) https://github.com/nodejs/node/pull/5401 -* [fcc64792ae] - child_process: guard against race condition (Rich Trott) https://github.com/nodejs/node/pull/5153 -* [6c468df9af] - child_process: fix data loss with readable event (Brian White) https://github.com/nodejs/node/pull/5037 -* [61a22019c2] - deps: upgrade openssl to 1.0.1s (Ben Noordhuis) https://github.com/nodejs/node/pull/5509 -* [fa26b13df7] - deps: update to http-parser 2.3.2 (James M Snell) https://github.com/nodejs/node/pull/5241 -* [46c8e2165f] - deps: backport 1f8555 from v8's upstream (Trevor Norris) https://github.com/nodejs/node/pull/3945 -* [ce58c2c31a] - doc: remove SSLv2 descriptions (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5541 -* [018e4e0b1a] - domains: fix handling of uncaught exceptions (Julien Gilli) https://github.com/nodejs/node/pull/3885 -* [d421e85dc9] - lib: fix cluster handle leak (Rich Trott) https://github.com/nodejs/node/pull/5152 -* [3a48f0022f] - node: fix leaking Context handle (Trevor Norris) https://github.com/nodejs/node/pull/3945 -* [28dddabf6a] - src: fix build error without OpenSSL support (Jörg Krause) https://github.com/nodejs/node/pull/4201 -* [a79baf03cd] - src: use global SealHandleScope (Trevor Norris) https://github.com/nodejs/node/pull/3945 -* [be39f30447] - test: add test-domain-exit-dispose-again back (Julien Gilli) https://github.com/nodejs/node/pull/4278 -* [da66166b9a] - test: fix test-domain-exit-dispose-again (Julien Gilli) https://github.com/nodejs/node/pull/3991 +* [[`1ab6653db9`](https://github.com/nodejs/node/commit/1ab6653db9) - build: update Node.js logo on OSX installer (Rod Vagg) https://github.com/nodejs/node/pull/5401 +* [[`fcc64792ae`](https://github.com/nodejs/node/commit/fcc64792ae) - child_process: guard against race condition (Rich Trott) https://github.com/nodejs/node/pull/5153 +* [[`6c468df9af`](https://github.com/nodejs/node/commit/6c468df9af) - child_process: fix data loss with readable event (Brian White) https://github.com/nodejs/node/pull/5037 +* [[`61a22019c2`](https://github.com/nodejs/node/commit/61a22019c2) - deps: upgrade openssl to 1.0.1s (Ben Noordhuis) https://github.com/nodejs/node/pull/5509 +* [[`fa26b13df7`](https://github.com/nodejs/node/commit/fa26b13df7) - deps: update to http-parser 2.3.2 (James M Snell) https://github.com/nodejs/node/pull/5241 +* [[`46c8e2165f`](https://github.com/nodejs/node/commit/46c8e2165f) - deps: backport 1f8555 from v8's upstream (Trevor Norris) https://github.com/nodejs/node/pull/3945 +* [[`ce58c2c31a`](https://github.com/nodejs/node/commit/ce58c2c31a) - doc: remove SSLv2 descriptions (Shigeki Ohtsu) https://github.com/nodejs/node/pull/5541 +* [[`018e4e0b1a`](https://github.com/nodejs/node/commit/018e4e0b1a) - domains: fix handling of uncaught exceptions (Julien Gilli) https://github.com/nodejs/node/pull/3885 +* [[`d421e85dc9`](https://github.com/nodejs/node/commit/d421e85dc9) - lib: fix cluster handle leak (Rich Trott) https://github.com/nodejs/node/pull/5152 +* [[`3a48f0022f`](https://github.com/nodejs/node/commit/3a48f0022f) - node: fix leaking Context handle (Trevor Norris) https://github.com/nodejs/node/pull/3945 +* [[`28dddabf6a`](https://github.com/nodejs/node/commit/28dddabf6a) - src: fix build error without OpenSSL support (Jörg Krause) https://github.com/nodejs/node/pull/4201 +* [[`a79baf03cd`](https://github.com/nodejs/node/commit/a79baf03cd) - src: use global SealHandleScope (Trevor Norris) https://github.com/nodejs/node/pull/3945 +* [[`be39f30447`](https://github.com/nodejs/node/commit/be39f30447) - test: add test-domain-exit-dispose-again back (Julien Gilli) https://github.com/nodejs/node/pull/4278 +* [[`da66166b9a`](https://github.com/nodejs/node/commit/da66166b9a) - test: fix test-domain-exit-dispose-again (Julien Gilli) https://github.com/nodejs/node/pull/3991 ## 2016-02-09, Version 0.12.10 (LTS), @jasnell @@ -235,14 +235,14 @@ This is an important security release. All Node.js users should consult the secu ### Commits -* [4312848bff] - build: enable xz compressed tarballs where possible (Rod Vagg) https://github.com/nodejs/node/pull/4894 -* [247626245c] - deps: upgrade openssl sources to 1.0.1r (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 -* [744c9749fc] - deps: update http-parser to version 2.3.1 (James M Snell) -* [d1c56ec7d1] - doc: clarify v0.12.9 notable items (Rod Vagg) https://github.com/nodejs/node/pull/4154 -* [e128d9a5b4] - http: strictly forbid invalid characters from headers (James M Snell) -* [bdb9f2cf89] - src: avoiding compiler warnings in node_revert.cc (James M Snell) -* [23bced1fb3] - src: add --security-revert command line flag (James M Snell) -* [f41a3c73e7] - tools: backport tools/install.py for headers (Richard Lau) https://github.com/nodejs/node/pull/4149 +* [[`4312848bff`](https://github.com/nodejs/node/commit/4312848bff) - build: enable xz compressed tarballs where possible (Rod Vagg) https://github.com/nodejs/node/pull/4894 +* [[`247626245c`](https://github.com/nodejs/node/commit/247626245c) - deps: upgrade openssl sources to 1.0.1r (Shigeki Ohtsu) https://github.com/joyent/node/pull/25368 +* [[`744c9749fc`](https://github.com/nodejs/node/commit/744c9749fc) - deps: update http-parser to version 2.3.1 (James M Snell) +* [[`d1c56ec7d1`](https://github.com/nodejs/node/commit/d1c56ec7d1) - doc: clarify v0.12.9 notable items (Rod Vagg) https://github.com/nodejs/node/pull/4154 +* [[`e128d9a5b4`](https://github.com/nodejs/node/commit/e128d9a5b4) - http: strictly forbid invalid characters from headers (James M Snell) +* [[`bdb9f2cf89`](https://github.com/nodejs/node/commit/bdb9f2cf89) - src: avoiding compiler warnings in node_revert.cc (James M Snell) +* [[`23bced1fb3`](https://github.com/nodejs/node/commit/23bced1fb3) - src: add --security-revert command line flag (James M Snell) +* [[`f41a3c73e7`](https://github.com/nodejs/node/commit/f41a3c73e7) - tools: backport tools/install.py for headers (Richard Lau) https://github.com/nodejs/node/pull/4149 ## 2015-12-04, Version 0.12.9 (LTS), @rvagg @@ -256,83 +256,83 @@ Security Update ### Commits -* [8d24a14f2c] - deps: upgrade to openssl 1.0.1q (Ben Noordhuis) https://github.com/nodejs/node/pull/4133 -* [dfc6f4a9af] - http: fix pipeline regression (Fedor Indutny) +* [[`8d24a14f2c`](https://github.com/nodejs/node/commit/8d24a14f2c) - deps: upgrade to openssl 1.0.1q (Ben Noordhuis) https://github.com/nodejs/node/pull/4133 +* [[`dfc6f4a9af`](https://github.com/nodejs/node/commit/dfc6f4a9af) - http: fix pipeline regression (Fedor Indutny) ## 2015.11.25, Version 0.12.8 (LTS), @rvagg -* [d9399569bd] - build: backport tools/release.sh (Rod Vagg) https://github.com/nodejs/node/pull/3642 -* [78c5b4c8bd] - build: backport config for new CI infrastructure (Rod Vagg) https://github.com/nodejs/node/pull/3642 -* [83441616a5] - build: fix --without-ssl compile time error (Ben Noordhuis) https://github.com/nodejs/node/pull/3825 -* [8887666b0b] - build: update manifest to include Windows 10 (Lucien Greathouse) https://github.com/nodejs/node/pull/2843 -* [08afe4ec8e] - build: add MSVS 2015 support (Rod Vagg) https://github.com/nodejs/node/pull/2843 -* [4f2456369c] - build: work around VS2015 issue in ICU <56 (Steven R. Loomis) https://github.com/nodejs/node-v0.x-archive/pull/25804 -* [15030f26fd] - build: Intl: bump ICU4C from 54 to 55 (backport) (Steven R. Loomis) https://github.com/nodejs/node-v0.x-archive/pull/25856 -* [1083fa70f0] - build: run-ci makefile rule (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 -* [2d2494cf14] - build: support flaky tests in test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 -* [b25d26f2ef] - build: support Jenkins via test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 -* [7e4b47f38a] - build,win: fix node.exe resource version (João Reis) https://github.com/nodejs/node/pull/3053 -* [e07c86e240] - build,win: try next MSVS version on failure (João Reis) https://github.com/nodejs/node/pull/2843 -* [b5a0abcfdf] - child_process: clone spawn options argument (cjihrig) https://github.com/nodejs/node-v0.x-archive/pull/9159 -* [8b81f98c41] - configure: add --without-mdb flag (cgalibern) https://github.com/nodejs/node-v0.x-archive/pull/25707 -* [071c860c2b] - crypto: replace rwlocks with simple mutexes (Ben Noordhuis) https://github.com/nodejs/node/pull/2723 -* [ca97fb6be3] - deps: upgrade npm to 2.14.9 (Forrest L Norvell) https://github.com/nodejs/node/pull/3684 -* [583734342e] - deps: fix openssl for MSVS 2015 (Andy Polyakov) https://github.com/nodejs/node/pull/2843 -* [02c262a4c6] - deps: fix gyp to work on MacOSX without XCode (Shigeki Ohtsu) https://github.com/nodejs/node/pull/2843 -* [f0fba0bce8] - deps: update gyp to 25ed9ac (João Reis) https://github.com/nodejs/node/pull/2843 -* [f693565813] - deps: upgrade to npm 2.13.4 (Kat Marchán) https://github.com/nodejs/node-v0.x-archive/pull/25825 -* [618b142679] - deps,v8: fix compilation in VS2015 (João Reis) https://github.com/nodejs/node/pull/2843 -* [49b4f0d54e] - doc: backport README.md (Rod Vagg) https://github.com/nodejs/node/pull/3642 -* [2860c53562] - doc: fixed child_process.exec doc (Tyler Anton) https://github.com/nodejs/node-v0.x-archive/pull/14088 -* [4a91fa11a3] - doc: Update docs for os.platform() (George Kotchlamazashvili) https://github.com/nodejs/node-v0.x-archive/pull/25777 -* [b03ab02fe8] - doc: Change the link for v8 docs to v8dox.com (Chad Walker) https://github.com/nodejs/node-v0.x-archive/pull/25811 -* [1fd8f37efd] - doc: buffer, adding missing backtick (Dyana Rose) https://github.com/nodejs/node-v0.x-archive/pull/25811 -* [162d0db3bb] - doc: tls.markdown, adjust version from v0.10.39 to v0.10.x (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [eda2560cdc] - doc: additional refinement to readable event (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [881d9bea01] - doc: readable event clarification (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [b6378f0c75] - doc: stream.unshift does not reset reading state (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [4952e2b4d2] - doc: clarify Readable._read and Readable.push (fresheneesz) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [14000b97d4] - doc: two minor stream doc improvements (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [6b6bd21497] - doc: Clarified read method with specified size argument. (Philippe Laferriere) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [16f547600a] - doc: Document http.request protocol option (Ville Skyttä) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [618e4ecda9] - doc: add a note about readable in flowing mode (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [0b165be37b] - doc: fix line wrapping in buffer.markdown (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [70dd13f88d] - doc: add CleartextStream deprecation notice (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [418cde0765] - doc: mention that mode is ignored if file exists (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [85bcb281e4] - doc: improve http.abort description (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [5ccb429ee8] - doc, comments: Grammar and spelling fixes (Ville Skyttä) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [a24db43101] - docs: event emitter behavior notice (Samuel Mills (Henchman)) https://github.com/nodejs/node-v0.x-archive/pull/25467 -* [8cbf7cb021] - docs: events clarify emitter.listener() behavior (Benjamin Steephenson) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [b7229debbe] - docs: Fix default options for fs.createWriteStream() (Chris Neave) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [f0453caea2] - domains: port caeb677 from v0.10 to v0.12 (Jeremy Whitlock) https://github.com/nodejs/node-v0.x-archive/pull/25835 -* [261fa3620f] - src: fix intermittent SIGSEGV in resolveTxt (Evan Lucas) https://github.com/nodejs/node-v0.x-archive/pull/9300 -* [1f7257b02d] - test: mark test-https-aws-ssl flaky on linux (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25893 -* [cf435d55db] - test: mark test-signal-unregister as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25750 -* [ceb6a8c131] - test: fix test-debug-port-from-cmdline (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25748 -* [22997731e6] - test: add regression test for #25735 (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25739 -* [39e05639f4] - test: mark http-pipeline-flood flaky on win32 (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25707 -* [78d256e7f5] - test: unmark tests that are no longer flaky (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25676 -* [a9b642cf5b] - test: runner should return 0 on flaky tests (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 -* [b48639befd] - test: support writing test output to file (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 -* [caa16b41d6] - (SEMVER-MINOR) tls: prevent server from using dhe keys < 768 (Michael Dawson) https://github.com/nodejs/node/pull/3890 -* [0363cf4a80] - tls: Closing parent socket also closes the tls sock (Devin Nakamura) https://github.com/nodejs/node-v0.x-archive/pull/25642 -* [75697112e8] - tls: do not hang without `newSession` handler (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25739 -* [d998a65058] - tools: pass constant to logger instead of string (Johan Bergström) https://github.com/nodejs/node-v0.x-archive/pull/25653 -* [1982ed6e63] - v8: port fbff705 from v0.10 to v0.12 (Jeremy Whitlock) https://github.com/nodejs/node-v0.x-archive/pull/25835 -* [44d7054252] - win: fix custom actions for WiX older than 3.9 (João Reis) https://github.com/nodejs/node/pull/2843 -* [586c4d8b8e] - win: fix custom actions on Visual Studio != 2013 (Julien Gilli) https://github.com/nodejs/node/pull/2843 -* [14db629497] - win,msi: correct installation path registry keys (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25640 -* [8e80528453] - win,msi: change InstallScope to perMachine (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25640 -* [35bbe98401] - Update addons.markdown (Max Deepfield) https://github.com/nodejs/node-v0.x-archive/pull/25885 -* [9a6f1ce416] - comma (Julien Valéry) https://github.com/nodejs/node-v0.x-archive/pull/25811 -* [d384bf8f84] - Update assert.markdown (daveboivin) https://github.com/nodejs/node-v0.x-archive/pull/25811 -* [89b22ccbe1] - Fixed typo (Andrew Murray) https://github.com/nodejs/node-v0.x-archive/pull/25811 -* [5ad05af380] - Update util.markdown (Daniel Rentz) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [cb660ab3d3] - Update child_process.markdown, spelling (Jared Fox) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [59c67fe3cd] - updated documentation for fs.createReadStream (Michele Caini) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [53b6a615a5] - Documentation update about Buffer initialization (Sarath) https://github.com/nodejs/node-v0.x-archive/pull/25591 -* [b8d47a7b6f] - fix (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25739 +* [[`d9399569bd`](https://github.com/nodejs/node/commit/d9399569bd) - build: backport tools/release.sh (Rod Vagg) https://github.com/nodejs/node/pull/3642 +* [[`78c5b4c8bd`](https://github.com/nodejs/node/commit/78c5b4c8bd) - build: backport config for new CI infrastructure (Rod Vagg) https://github.com/nodejs/node/pull/3642 +* [[`83441616a5`](https://github.com/nodejs/node/commit/83441616a5) - build: fix --without-ssl compile time error (Ben Noordhuis) https://github.com/nodejs/node/pull/3825 +* [[`8887666b0b`](https://github.com/nodejs/node/commit/8887666b0b) - build: update manifest to include Windows 10 (Lucien Greathouse) https://github.com/nodejs/node/pull/2843 +* [[`08afe4ec8e`](https://github.com/nodejs/node/commit/08afe4ec8e) - build: add MSVS 2015 support (Rod Vagg) https://github.com/nodejs/node/pull/2843 +* [[`4f2456369c`](https://github.com/nodejs/node/commit/4f2456369c) - build: work around VS2015 issue in ICU <56 (Steven R. Loomis) https://github.com/nodejs/node-v0.x-archive/pull/25804 +* [[`15030f26fd`](https://github.com/nodejs/node/commit/15030f26fd) - build: Intl: bump ICU4C from 54 to 55 (backport) (Steven R. Loomis) https://github.com/nodejs/node-v0.x-archive/pull/25856 +* [[`1083fa70f0`](https://github.com/nodejs/node/commit/1083fa70f0) - build: run-ci makefile rule (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 +* [[`2d2494cf14`](https://github.com/nodejs/node/commit/2d2494cf14) - build: support flaky tests in test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 +* [[`b25d26f2ef`](https://github.com/nodejs/node/commit/b25d26f2ef) - build: support Jenkins via test-ci (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 +* [[`7e4b47f38a`](https://github.com/nodejs/node/commit/7e4b47f38a) - build,win: fix node.exe resource version (João Reis) https://github.com/nodejs/node/pull/3053 +* [[`e07c86e240`](https://github.com/nodejs/node/commit/e07c86e240) - build,win: try next MSVS version on failure (João Reis) https://github.com/nodejs/node/pull/2843 +* [[`b5a0abcfdf`](https://github.com/nodejs/node/commit/b5a0abcfdf) - child_process: clone spawn options argument (cjihrig) https://github.com/nodejs/node-v0.x-archive/pull/9159 +* [[`8b81f98c41`](https://github.com/nodejs/node/commit/8b81f98c41) - configure: add --without-mdb flag (cgalibern) https://github.com/nodejs/node-v0.x-archive/pull/25707 +* [[`071c860c2b`](https://github.com/nodejs/node/commit/071c860c2b) - crypto: replace rwlocks with simple mutexes (Ben Noordhuis) https://github.com/nodejs/node/pull/2723 +* [[`ca97fb6be3`](https://github.com/nodejs/node/commit/ca97fb6be3) - deps: upgrade npm to 2.14.9 (Forrest L Norvell) https://github.com/nodejs/node/pull/3684 +* [[`583734342e`](https://github.com/nodejs/node/commit/583734342e) - deps: fix openssl for MSVS 2015 (Andy Polyakov) https://github.com/nodejs/node/pull/2843 +* [[`02c262a4c6`](https://github.com/nodejs/node/commit/02c262a4c6) - deps: fix gyp to work on MacOSX without XCode (Shigeki Ohtsu) https://github.com/nodejs/node/pull/2843 +* [[`f0fba0bce8`](https://github.com/nodejs/node/commit/f0fba0bce8) - deps: update gyp to 25ed9ac (João Reis) https://github.com/nodejs/node/pull/2843 +* [[`f693565813`](https://github.com/nodejs/node/commit/f693565813) - deps: upgrade to npm 2.13.4 (Kat Marchán) https://github.com/nodejs/node-v0.x-archive/pull/25825 +* [[`618b142679`](https://github.com/nodejs/node/commit/618b142679) - deps,v8: fix compilation in VS2015 (João Reis) https://github.com/nodejs/node/pull/2843 +* [[`49b4f0d54e`](https://github.com/nodejs/node/commit/49b4f0d54e) - doc: backport README.md (Rod Vagg) https://github.com/nodejs/node/pull/3642 +* [[`2860c53562`](https://github.com/nodejs/node/commit/2860c53562) - doc: fixed child_process.exec doc (Tyler Anton) https://github.com/nodejs/node-v0.x-archive/pull/14088 +* [[`4a91fa11a3`](https://github.com/nodejs/node/commit/4a91fa11a3) - doc: Update docs for os.platform() (George Kotchlamazashvili) https://github.com/nodejs/node-v0.x-archive/pull/25777 +* [[`b03ab02fe8`](https://github.com/nodejs/node/commit/b03ab02fe8) - doc: Change the link for v8 docs to v8dox.com (Chad Walker) https://github.com/nodejs/node-v0.x-archive/pull/25811 +* [[`1fd8f37efd`](https://github.com/nodejs/node/commit/1fd8f37efd) - doc: buffer, adding missing backtick (Dyana Rose) https://github.com/nodejs/node-v0.x-archive/pull/25811 +* [[`162d0db3bb`](https://github.com/nodejs/node/commit/162d0db3bb) - doc: tls.markdown, adjust version from v0.10.39 to v0.10.x (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`eda2560cdc`](https://github.com/nodejs/node/commit/eda2560cdc) - doc: additional refinement to readable event (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`881d9bea01`](https://github.com/nodejs/node/commit/881d9bea01) - doc: readable event clarification (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`b6378f0c75`](https://github.com/nodejs/node/commit/b6378f0c75) - doc: stream.unshift does not reset reading state (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`4952e2b4d2`](https://github.com/nodejs/node/commit/4952e2b4d2) - doc: clarify Readable._read and Readable.push (fresheneesz) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`14000b97d4`](https://github.com/nodejs/node/commit/14000b97d4) - doc: two minor stream doc improvements (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`6b6bd21497`](https://github.com/nodejs/node/commit/6b6bd21497) - doc: Clarified read method with specified size argument. (Philippe Laferriere) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`16f547600a`](https://github.com/nodejs/node/commit/16f547600a) - doc: Document http.request protocol option (Ville Skyttä) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`618e4ecda9`](https://github.com/nodejs/node/commit/618e4ecda9) - doc: add a note about readable in flowing mode (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`0b165be37b`](https://github.com/nodejs/node/commit/0b165be37b) - doc: fix line wrapping in buffer.markdown (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`70dd13f88d`](https://github.com/nodejs/node/commit/70dd13f88d) - doc: add CleartextStream deprecation notice (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`418cde0765`](https://github.com/nodejs/node/commit/418cde0765) - doc: mention that mode is ignored if file exists (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`85bcb281e4`](https://github.com/nodejs/node/commit/85bcb281e4) - doc: improve http.abort description (James M Snell) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`5ccb429ee8`](https://github.com/nodejs/node/commit/5ccb429ee8) - doc, comments: Grammar and spelling fixes (Ville Skyttä) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`a24db43101`](https://github.com/nodejs/node/commit/a24db43101) - docs: event emitter behavior notice (Samuel Mills (Henchman)) https://github.com/nodejs/node-v0.x-archive/pull/25467 +* [[`8cbf7cb021`](https://github.com/nodejs/node/commit/8cbf7cb021) - docs: events clarify emitter.listener() behavior (Benjamin Steephenson) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`b7229debbe`](https://github.com/nodejs/node/commit/b7229debbe) - docs: Fix default options for fs.createWriteStream() (Chris Neave) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`f0453caea2`](https://github.com/nodejs/node/commit/f0453caea2) - domains: port caeb677 from v0.10 to v0.12 (Jeremy Whitlock) https://github.com/nodejs/node-v0.x-archive/pull/25835 +* [[`261fa3620f`](https://github.com/nodejs/node/commit/261fa3620f) - src: fix intermittent SIGSEGV in resolveTxt (Evan Lucas) https://github.com/nodejs/node-v0.x-archive/pull/9300 +* [[`1f7257b02d`](https://github.com/nodejs/node/commit/1f7257b02d) - test: mark test-https-aws-ssl flaky on linux (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25893 +* [[`cf435d55db`](https://github.com/nodejs/node/commit/cf435d55db) - test: mark test-signal-unregister as flaky (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25750 +* [[`ceb6a8c131`](https://github.com/nodejs/node/commit/ceb6a8c131) - test: fix test-debug-port-from-cmdline (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25748 +* [[`22997731e6`](https://github.com/nodejs/node/commit/22997731e6) - test: add regression test for #25735 (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25739 +* [[`39e05639f4`](https://github.com/nodejs/node/commit/39e05639f4) - test: mark http-pipeline-flood flaky on win32 (Julien Gilli) https://github.com/nodejs/node-v0.x-archive/pull/25707 +* [[`78d256e7f5`](https://github.com/nodejs/node/commit/78d256e7f5) - test: unmark tests that are no longer flaky (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25676 +* [[`a9b642cf5b`](https://github.com/nodejs/node/commit/a9b642cf5b) - test: runner should return 0 on flaky tests (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 +* [[`b48639befd`](https://github.com/nodejs/node/commit/b48639befd) - test: support writing test output to file (Alexis Campailla) https://github.com/nodejs/node-v0.x-archive/pull/25653 +* [[`caa16b41d6`](https://github.com/nodejs/node/commit/caa16b41d6) - (SEMVER-MINOR) tls: prevent server from using dhe keys < 768 (Michael Dawson) https://github.com/nodejs/node/pull/3890 +* [[`0363cf4a80`](https://github.com/nodejs/node/commit/0363cf4a80) - tls: Closing parent socket also closes the tls sock (Devin Nakamura) https://github.com/nodejs/node-v0.x-archive/pull/25642 +* [[`75697112e8`](https://github.com/nodejs/node/commit/75697112e8) - tls: do not hang without `newSession` handler (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25739 +* [[`d998a65058`](https://github.com/nodejs/node/commit/d998a65058) - tools: pass constant to logger instead of string (Johan Bergström) https://github.com/nodejs/node-v0.x-archive/pull/25653 +* [[`1982ed6e63`](https://github.com/nodejs/node/commit/1982ed6e63) - v8: port fbff705 from v0.10 to v0.12 (Jeremy Whitlock) https://github.com/nodejs/node-v0.x-archive/pull/25835 +* [[`44d7054252`](https://github.com/nodejs/node/commit/44d7054252) - win: fix custom actions for WiX older than 3.9 (João Reis) https://github.com/nodejs/node/pull/2843 +* [[`586c4d8b8e`](https://github.com/nodejs/node/commit/586c4d8b8e) - win: fix custom actions on Visual Studio != 2013 (Julien Gilli) https://github.com/nodejs/node/pull/2843 +* [[`14db629497`](https://github.com/nodejs/node/commit/14db629497) - win,msi: correct installation path registry keys (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25640 +* [[`8e80528453`](https://github.com/nodejs/node/commit/8e80528453) - win,msi: change InstallScope to perMachine (João Reis) https://github.com/nodejs/node-v0.x-archive/pull/25640 +* [[`35bbe98401`](https://github.com/nodejs/node/commit/35bbe98401) - Update addons.markdown (Max Deepfield) https://github.com/nodejs/node-v0.x-archive/pull/25885 +* [[`9a6f1ce416`](https://github.com/nodejs/node/commit/9a6f1ce416) - comma (Julien Valéry) https://github.com/nodejs/node-v0.x-archive/pull/25811 +* [[`d384bf8f84`](https://github.com/nodejs/node/commit/d384bf8f84) - Update assert.markdown (daveboivin) https://github.com/nodejs/node-v0.x-archive/pull/25811 +* [[`89b22ccbe1`](https://github.com/nodejs/node/commit/89b22ccbe1) - Fixed typo (Andrew Murray) https://github.com/nodejs/node-v0.x-archive/pull/25811 +* [[`5ad05af380`](https://github.com/nodejs/node/commit/5ad05af380) - Update util.markdown (Daniel Rentz) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`cb660ab3d3`](https://github.com/nodejs/node/commit/cb660ab3d3) - Update child_process.markdown, spelling (Jared Fox) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`59c67fe3cd`](https://github.com/nodejs/node/commit/59c67fe3cd) - updated documentation for fs.createReadStream (Michele Caini) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`53b6a615a5`](https://github.com/nodejs/node/commit/53b6a615a5) - Documentation update about Buffer initialization (Sarath) https://github.com/nodejs/node-v0.x-archive/pull/25591 +* [[`b8d47a7b6f`](https://github.com/nodejs/node/commit/b8d47a7b6f) - fix (Fedor Indutny) https://github.com/nodejs/node-v0.x-archive/pull/25739 ## 2015-07-09, Version 0.12.7 (Stable) From d1a4aa3ca2d0a485f1c66cb20bac6ee66996e1a1 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sat, 14 Sep 2019 14:42:53 -0400 Subject: [PATCH 19/65] doc: add missing reference link values Reference links were used in the document, but not define at the end. PR-URL: https://github.com/nodejs/node/pull/29558 Reviewed-By: Ruben Bridgewater --- doc/api/assert.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/assert.md b/doc/api/assert.md index db222580c30235..09d2aa46c26c96 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -1300,7 +1300,10 @@ second argument. This might lead to difficult-to-spot errors. [`assert.deepEqual()`]: #assert_assert_deepequal_actual_expected_message [`assert.deepStrictEqual()`]: #assert_assert_deepstrictequal_actual_expected_message [`assert.doesNotThrow()`]: #assert_assert_doesnotthrow_fn_error_message +[`assert.equal()`]: #assert_assert_equal_actual_expected_message +[`assert.notDeepEqual()`]: #assert_assert_notdeepequal_actual_expected_message [`assert.notDeepStrictEqual()`]: #assert_assert_notdeepstrictequal_actual_expected_message +[`assert.notEqual()`]: #assert_assert_notequal_actual_expected_message [`assert.notStrictEqual()`]: #assert_assert_notstrictequal_actual_expected_message [`assert.ok()`]: #assert_assert_ok_value_message [`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message From 62370efe7ed5b15db56619b64afff597e79ab3fe Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sat, 14 Sep 2019 14:50:00 -0400 Subject: [PATCH 20/65] doc: add dash between SHA and PR in changelog It gets confused as a reference link otherwis PR-URL: https://github.com/nodejs/node/pull/29558 Reviewed-By: Ruben Bridgewater --- doc/changelogs/CHANGELOG_V8.md | 116 ++++++++++++++++----------------- doc/changelogs/CHANGELOG_V9.md | 72 ++++++++++---------- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/doc/changelogs/CHANGELOG_V8.md b/doc/changelogs/CHANGELOG_V8.md index 43f23e6798d409..91f22f5b18f9bc 100644 --- a/doc/changelogs/CHANGELOG_V8.md +++ b/doc/changelogs/CHANGELOG_V8.md @@ -3405,28 +3405,28 @@ Big thanks to @addaleax who prepared the vast majority of this release. * **Build** * The compiler version requirement to build Node with GCC has been raised to GCC 4.9.4. - [[`820b011ed6`](https://github.com/nodejs/node/commit/820b011ed6)] + [[`820b011ed6`](https://github.com/nodejs/node/commit/820b011ed6)] - [#13466](https://github.com/nodejs/node/pull/13466) * **Cluster** * Users now have more fine-grained control over the inspector port used by individual cluster workers. Previously, cluster workers were restricted to incrementing from the master's debug port. - [[`dfc46e262a`](https://github.com/nodejs/node/commit/dfc46e262a)] + [[`dfc46e262a`](https://github.com/nodejs/node/commit/dfc46e262a)] - [#14140](https://github.com/nodejs/node/pull/14140) * **DNS** * The server used for DNS queries can now use a custom port. - [[`ebe7bb29aa`](https://github.com/nodejs/node/commit/ebe7bb29aa)] + [[`ebe7bb29aa`](https://github.com/nodejs/node/commit/ebe7bb29aa)] - [#13723](https://github.com/nodejs/node/pull/13723) * Support for `dns.resolveAny()` has been added. - [[`6e30e2558e`](https://github.com/nodejs/node/commit/6e30e2558e)] + [[`6e30e2558e`](https://github.com/nodejs/node/commit/6e30e2558e)] - [#13137](https://github.com/nodejs/node/pull/13137) * **npm** * The `npm` CLI has been updated to version 5.3.0. In particular, it now comes with the `npx` binary, which is also shipped with Node. - [[`dc3f6b9ac1`](https://github.com/nodejs/node/commit/dc3f6b9ac1)] + [[`dc3f6b9ac1`](https://github.com/nodejs/node/commit/dc3f6b9ac1)] - [#14235](https://github.com/nodejs/node/pull/14235) * `npm` Changelogs: * [v5.0.4](https://github.com/npm/npm/releases/tag/v5.0.4) @@ -3711,10 +3711,10 @@ This is a security release. All Node.js users should consult the security releas Two regressions with the `stream` module have been fixed: * The `finish` event will now always be emitted after the `error` event if one is emitted: - [[`0a9e96e86c`](https://github.com/nodejs/node/commit/0a9e96e86c)] + [[`0a9e96e86c`](https://github.com/nodejs/node/commit/0a9e96e86c)] - [#13850](https://github.com/nodejs/node/pull/13850) * In object mode, readable streams can now use `undefined` again. - [[`5840138e70`](https://github.com/nodejs/node/commit/5840138e70)] + [[`5840138e70`](https://github.com/nodejs/node/commit/5840138e70)] - [#13760](https://github.com/nodejs/node/pull/13760) ### Commits @@ -3798,24 +3798,24 @@ Ref: https://github.com/nodejs/node/issues/13667 * `stdout` and `stderr` are now available on the error output of a failed call to the `util.promisify()`ed version of `child_process.exec`. - [[`d66d4fc94c`](https://github.com/nodejs/node/commit/d66d4fc94c)] + [[`d66d4fc94c`](https://github.com/nodejs/node/commit/d66d4fc94c)] - [#13388](https://github.com/nodejs/node/pull/13388) * **HTTP** * A regression that broke certain scenarios in which HTTP is used together with the `cluster` module has been fixed. - [[`fff8a56d6f`](https://github.com/nodejs/node/commit/fff8a56d6f)] + [[`fff8a56d6f`](https://github.com/nodejs/node/commit/fff8a56d6f)] - [#13578](https://github.com/nodejs/node/pull/13578) * **HTTPS** * The `rejectUnauthorized` option now works properly for unix sockets. - [[`c4cbd99d37`](https://github.com/nodejs/node/commit/c4cbd99d37)] + [[`c4cbd99d37`](https://github.com/nodejs/node/commit/c4cbd99d37)] - [#13505](https://github.com/nodejs/node/pull/13505) * **Readline** * A change that broke `npm init` and other code which uses `readline` multiple times on the same input stream is reverted. - [[`0df6c0b5f0`](https://github.com/nodejs/node/commit/0df6c0b5f0)] + [[`0df6c0b5f0`](https://github.com/nodejs/node/commit/0df6c0b5f0)] - [#13560](https://github.com/nodejs/node/pull/13560) ### Commits @@ -3878,30 +3878,30 @@ Ref: https://github.com/nodejs/node/issues/13667 * **Async Hooks** * When one `Promise` leads to the creation of a new `Promise`, the parent `Promise` will be identified as the trigger - [[`135f4e6643`](https://github.com/nodejs/node/commit/135f4e6643)] + [[`135f4e6643`](https://github.com/nodejs/node/commit/135f4e6643)] - [#13367](https://github.com/nodejs/node/pull/13367). * **Dependencies** * libuv has been updated to 1.12.0 - [[`968596ec77`](https://github.com/nodejs/node/commit/968596ec77)] + [[`968596ec77`](https://github.com/nodejs/node/commit/968596ec77)] - [#13306](https://github.com/nodejs/node/pull/13306). * npm has been updated to 5.0.3 - [[`ffa7debd7a`](https://github.com/nodejs/node/commit/ffa7debd7a)] + [[`ffa7debd7a`](https://github.com/nodejs/node/commit/ffa7debd7a)] - [#13487](https://github.com/nodejs/node/pull/13487). * **File system** * The `fs.exists()` function now works correctly with `util.promisify()` - [[`6e0eccd7a1`](https://github.com/nodejs/node/commit/6e0eccd7a1)] + [[`6e0eccd7a1`](https://github.com/nodejs/node/commit/6e0eccd7a1)] - [#13316](https://github.com/nodejs/node/pull/13316). * fs.Stats times are now also available as numbers - [[`c756efb25a`](https://github.com/nodejs/node/commit/c756efb25a)] + [[`c756efb25a`](https://github.com/nodejs/node/commit/c756efb25a)] - [#13173](https://github.com/nodejs/node/pull/13173). * **Inspector** * It is now possible to bind to a random port using `--inspect=0` - [[`cc6ec2fb27`](https://github.com/nodejs/node/commit/cc6ec2fb27)] + [[`cc6ec2fb27`](https://github.com/nodejs/node/commit/cc6ec2fb27)] - [#5025](https://github.com/nodejs/node/pull/5025). * **Zlib** * A regression in the Zlib module that made it impossible to properly subclasses `zlib.Deflate` and other Zlib classes has been fixed. - [[`6aeb555cc4`](https://github.com/nodejs/node/commit/6aeb555cc4)] + [[`6aeb555cc4`](https://github.com/nodejs/node/commit/6aeb555cc4)] - [#13374](https://github.com/nodejs/node/pull/13374). ### Commits @@ -4037,47 +4037,47 @@ LTS codename `'Carbon'`. Note that the * **Async Hooks** * The `async_hooks` module has landed in core - [[`4a7233c178`](https://github.com/nodejs/node/commit/4a7233c178)] + [[`4a7233c178`](https://github.com/nodejs/node/commit/4a7233c178)] - [#12892](https://github.com/nodejs/node/pull/12892). * **Buffer** * Using the `--pending-deprecation` flag will cause Node.js to emit a deprecation warning when using `new Buffer(num)` or `Buffer(num)`. - [[`d2d32ea5a2`](https://github.com/nodejs/node/commit/d2d32ea5a2)] + [[`d2d32ea5a2`](https://github.com/nodejs/node/commit/d2d32ea5a2)] - [#11968](https://github.com/nodejs/node/pull/11968). * `new Buffer(num)` and `Buffer(num)` will zero-fill new `Buffer` instances - [[`7eb1b4658e`](https://github.com/nodejs/node/commit/7eb1b4658e)] + [[`7eb1b4658e`](https://github.com/nodejs/node/commit/7eb1b4658e)] - [#12141](https://github.com/nodejs/node/pull/12141). * Many `Buffer` methods now accept `Uint8Array` as input - [[`beca3244e2`](https://github.com/nodejs/node/commit/beca3244e2)] + [[`beca3244e2`](https://github.com/nodejs/node/commit/beca3244e2)] - [#10236](https://github.com/nodejs/node/pull/10236). * **Child Process** * Argument and kill signal validations have been improved - [[`97a77288ce`](https://github.com/nodejs/node/commit/97a77288ce)] + [[`97a77288ce`](https://github.com/nodejs/node/commit/97a77288ce)] - [#12348](https://github.com/nodejs/node/pull/12348), - [[`d75fdd96aa`](https://github.com/nodejs/node/commit/d75fdd96aa)] + [[`d75fdd96aa`](https://github.com/nodejs/node/commit/d75fdd96aa)] - [#10423](https://github.com/nodejs/node/pull/10423). * Child Process methods accept `Uint8Array` as input - [[`627ecee9ed`](https://github.com/nodejs/node/commit/627ecee9ed)] + [[`627ecee9ed`](https://github.com/nodejs/node/commit/627ecee9ed)] - [#10653](https://github.com/nodejs/node/pull/10653). * **Console** * Error events emitted when using `console` methods are now supressed. - [[`f18e08d820`](https://github.com/nodejs/node/commit/f18e08d820)] + [[`f18e08d820`](https://github.com/nodejs/node/commit/f18e08d820)] - [#9744](https://github.com/nodejs/node/pull/9744). * **Dependencies** * The npm client has been updated to 5.0.0 - [[`3c3b36af0f`](https://github.com/nodejs/node/commit/3c3b36af0f)] + [[`3c3b36af0f`](https://github.com/nodejs/node/commit/3c3b36af0f)] - [#12936](https://github.com/nodejs/node/pull/12936). * V8 has been updated to 5.8 with forward ABI stability to 6.0 - [[`60d1aac8d2`](https://github.com/nodejs/node/commit/60d1aac8d2)] + [[`60d1aac8d2`](https://github.com/nodejs/node/commit/60d1aac8d2)] - [#12784](https://github.com/nodejs/node/pull/12784). * **Domains** * Native `Promise` instances are now `Domain` aware - [[`84dabe8373`](https://github.com/nodejs/node/commit/84dabe8373)] + [[`84dabe8373`](https://github.com/nodejs/node/commit/84dabe8373)] - [#12489](https://github.com/nodejs/node/pull/12489). * **Errors** @@ -4087,118 +4087,118 @@ LTS codename `'Carbon'`. Note that the * **File System** * The utility class `fs.SyncWriteStream` has been deprecated - [[`7a55e34ef4`](https://github.com/nodejs/node/commit/7a55e34ef4)] + [[`7a55e34ef4`](https://github.com/nodejs/node/commit/7a55e34ef4)] - [#10467](https://github.com/nodejs/node/pull/10467). * The deprecated `fs.read()` string interface has been removed - [[`3c2a9361ff`](https://github.com/nodejs/node/commit/3c2a9361ff)] + [[`3c2a9361ff`](https://github.com/nodejs/node/commit/3c2a9361ff)] - [#9683](https://github.com/nodejs/node/pull/9683). * **HTTP** * Improved support for userland implemented Agents - [[`90403dd1d0`](https://github.com/nodejs/node/commit/90403dd1d0)] + [[`90403dd1d0`](https://github.com/nodejs/node/commit/90403dd1d0)] - [#11567](https://github.com/nodejs/node/pull/11567). * Outgoing Cookie headers are concatenated into a single string - [[`d3480776c7`](https://github.com/nodejs/node/commit/d3480776c7)] + [[`d3480776c7`](https://github.com/nodejs/node/commit/d3480776c7)] - [#11259](https://github.com/nodejs/node/pull/11259). * The `httpResponse.writeHeader()` method has been deprecated - [[`fb71ba4921`](https://github.com/nodejs/node/commit/fb71ba4921)] + [[`fb71ba4921`](https://github.com/nodejs/node/commit/fb71ba4921)] - [#11355](https://github.com/nodejs/node/pull/11355). * New methods for accessing HTTP headers have been added to `OutgoingMessage` - [[`3e6f1032a4`](https://github.com/nodejs/node/commit/3e6f1032a4)] + [[`3e6f1032a4`](https://github.com/nodejs/node/commit/3e6f1032a4)] - [#10805](https://github.com/nodejs/node/pull/10805). * **Lib** * All deprecation messages have been assigned static identifiers - [[`5de3cf099c`](https://github.com/nodejs/node/commit/5de3cf099c)] + [[`5de3cf099c`](https://github.com/nodejs/node/commit/5de3cf099c)] - [#10116](https://github.com/nodejs/node/pull/10116). * The legacy `linkedlist` module has been removed - [[`84a23391f6`](https://github.com/nodejs/node/commit/84a23391f6)] + [[`84a23391f6`](https://github.com/nodejs/node/commit/84a23391f6)] - [#12113](https://github.com/nodejs/node/pull/12113). * **N-API** * Experimental support for the new N-API API has been added - [[`56e881d0b0`](https://github.com/nodejs/node/commit/56e881d0b0)] + [[`56e881d0b0`](https://github.com/nodejs/node/commit/56e881d0b0)] - [#11975](https://github.com/nodejs/node/pull/11975). * **Process** * Process warning output can be redirected to a file using the `--redirect-warnings` command-line argument - [[`03e89b3ff2`](https://github.com/nodejs/node/commit/03e89b3ff2)] + [[`03e89b3ff2`](https://github.com/nodejs/node/commit/03e89b3ff2)] - [#10116](https://github.com/nodejs/node/pull/10116). * Process warnings may now include additional detail - [[`dd20e68b0f`](https://github.com/nodejs/node/commit/dd20e68b0f)] + [[`dd20e68b0f`](https://github.com/nodejs/node/commit/dd20e68b0f)] - [#12725](https://github.com/nodejs/node/pull/12725). * **REPL** * REPL magic mode has been deprecated - [[`3f27f02da0`](https://github.com/nodejs/node/commit/3f27f02da0)] + [[`3f27f02da0`](https://github.com/nodejs/node/commit/3f27f02da0)] - [#11599](https://github.com/nodejs/node/pull/11599). * **Src** * `NODE_MODULE_VERSION` has been updated to 57 - [[`ec7cbaf266`](https://github.com/nodejs/node/commit/ec7cbaf266)] + [[`ec7cbaf266`](https://github.com/nodejs/node/commit/ec7cbaf266)] - [#12995](https://github.com/nodejs/node/pull/12995). * Add `--pending-deprecation` command-line argument and `NODE_PENDING_DEPRECATION` environment variable - [[`a16b570f8c`](https://github.com/nodejs/node/commit/a16b570f8c)] + [[`a16b570f8c`](https://github.com/nodejs/node/commit/a16b570f8c)] - [#11968](https://github.com/nodejs/node/pull/11968). * The `--debug` command-line argument has been deprecated. Note that using `--debug` will enable the *new* Inspector-based debug protocol as the legacy Debugger protocol previously used by Node.js has been - removed. [[`010f864426`](https://github.com/nodejs/node/commit/010f864426)] + removed. [[`010f864426`](https://github.com/nodejs/node/commit/010f864426)] - [#12949](https://github.com/nodejs/node/pull/12949). * Throw when the `-c` and `-e` command-line arguments are used at the same - time [[`a5f91ab230`](https://github.com/nodejs/node/commit/a5f91ab230)] + time [[`a5f91ab230`](https://github.com/nodejs/node/commit/a5f91ab230)] - [#11689](https://github.com/nodejs/node/pull/11689). * Throw when the `--use-bundled-ca` and `--use-openssl-ca` command-line arguments are used at the same time. - [[`8a7db9d4b5`](https://github.com/nodejs/node/commit/8a7db9d4b5)] + [[`8a7db9d4b5`](https://github.com/nodejs/node/commit/8a7db9d4b5)] - [#12087](https://github.com/nodejs/node/pull/12087). * **Stream** * `Stream` now supports `destroy()` and `_destroy()` APIs - [[`b6e1d22fa6`](https://github.com/nodejs/node/commit/b6e1d22fa6)] + [[`b6e1d22fa6`](https://github.com/nodejs/node/commit/b6e1d22fa6)] - [#12925](https://github.com/nodejs/node/pull/12925). * `Stream` now supports the `_final()` API - [[`07c7f198db`](https://github.com/nodejs/node/commit/07c7f198db)] + [[`07c7f198db`](https://github.com/nodejs/node/commit/07c7f198db)] - [#12828](https://github.com/nodejs/node/pull/12828). * **TLS** * The `rejectUnauthorized` option now defaults to `true` - [[`348cc80a3c`](https://github.com/nodejs/node/commit/348cc80a3c)] + [[`348cc80a3c`](https://github.com/nodejs/node/commit/348cc80a3c)] - [#5923](https://github.com/nodejs/node/pull/5923). * The `tls.createSecurePair()` API now emits a runtime deprecation - [[`a2ae08999b`](https://github.com/nodejs/node/commit/a2ae08999b)] + [[`a2ae08999b`](https://github.com/nodejs/node/commit/a2ae08999b)] - [#11349](https://github.com/nodejs/node/pull/11349). * A runtime deprecation will now be emitted when `dhparam` is less than - 2048 bits [[`d523eb9c40`](https://github.com/nodejs/node/commit/d523eb9c40)] + 2048 bits [[`d523eb9c40`](https://github.com/nodejs/node/commit/d523eb9c40)] - [#11447](https://github.com/nodejs/node/pull/11447). * **URL** * The WHATWG URL implementation is now a fully-supported Node.js API - [[`d080ead0f9`](https://github.com/nodejs/node/commit/d080ead0f9)] + [[`d080ead0f9`](https://github.com/nodejs/node/commit/d080ead0f9)] - [#12710](https://github.com/nodejs/node/pull/12710). * **Util** * `Symbol` keys are now displayed by default when using `util.inspect()` - [[`5bfd13b81e`](https://github.com/nodejs/node/commit/5bfd13b81e)] + [[`5bfd13b81e`](https://github.com/nodejs/node/commit/5bfd13b81e)] - [#9726](https://github.com/nodejs/node/pull/9726). * `toJSON` errors will be thrown when formatting `%j` - [[`455e6f1dd8`](https://github.com/nodejs/node/commit/455e6f1dd8)] + [[`455e6f1dd8`](https://github.com/nodejs/node/commit/455e6f1dd8)] - [#11708](https://github.com/nodejs/node/pull/11708). * Convert `inspect.styles` and `inspect.colors` to prototype-less objects - [[`aab0d202f8`](https://github.com/nodejs/node/commit/aab0d202f8)] + [[`aab0d202f8`](https://github.com/nodejs/node/commit/aab0d202f8)] - [#11624](https://github.com/nodejs/node/pull/11624). * The new `util.promisify()` API has been added - [[`99da8e8e02`](https://github.com/nodejs/node/commit/99da8e8e02)] + [[`99da8e8e02`](https://github.com/nodejs/node/commit/99da8e8e02)] - [#12442](https://github.com/nodejs/node/pull/12442). * **Zlib** * Support `Uint8Array` in Zlib convenience methods - [[`91383e47fd`](https://github.com/nodejs/node/commit/91383e47fd)] + [[`91383e47fd`](https://github.com/nodejs/node/commit/91383e47fd)] - [#12001](https://github.com/nodejs/node/pull/12001). * Zlib errors now use `RangeError` and `TypeError` consistently - [[`b514bd231e`](https://github.com/nodejs/node/commit/b514bd231e)] + [[`b514bd231e`](https://github.com/nodejs/node/commit/b514bd231e)] - [#11391](https://github.com/nodejs/node/pull/11391). ### Commits diff --git a/doc/changelogs/CHANGELOG_V9.md b/doc/changelogs/CHANGELOG_V9.md index cf6a3c40ecf67f..6e82d6a3cc6cdd 100644 --- a/doc/changelogs/CHANGELOG_V9.md +++ b/doc/changelogs/CHANGELOG_V9.md @@ -2081,59 +2081,59 @@ Fixes for the following CVEs are included in this release: ### Notable Changes * **Async hooks** - * Older experimental APIs have been removed. [[`d731369b1d`](https://github.com/nodejs/node/commit/d731369b1d)] [#14414](https://github.com/nodejs/node/pull/14414) + * Older experimental APIs have been removed. [[`d731369b1d`](https://github.com/nodejs/node/commit/d731369b1d)] - [#14414](https://github.com/nodejs/node/pull/14414) * **Errors** - * Improvements have been made to `buffer` module error messages. [[`9e0f771224`](https://github.com/nodejs/node/commit/9e0f771224)] [#14975](https://github.com/nodejs/node/pull/14975) + * Improvements have been made to `buffer` module error messages. [[`9e0f771224`](https://github.com/nodejs/node/commit/9e0f771224)] - [#14975](https://github.com/nodejs/node/pull/14975) * The assignment of static error codes to Node.js error continues: - * `buffer`: [[`e79a61cf80`](https://github.com/nodejs/node/commit/e79a61cf80)] [#16352](https://github.com/nodejs/node/pull/16352), [[`dbfe8c4ea2`](https://github.com/nodejs/node/commit/dbfe8c4ea2)] [#13976](https://github.com/nodejs/node/pull/13976) - * `child_process`: [[`fe730d34ce`](https://github.com/nodejs/node/commit/fe730d34ce)] [#14009](https://github.com/nodejs/node/pull/14009) - * `console`: [[`0ecdf29340`](https://github.com/nodejs/node/commit/0ecdf29340)] [#11340](https://github.com/nodejs/node/pull/11340) - * `crypto`: [[`ee76f3153b`](https://github.com/nodejs/node/commit/ee76f3153b)] [#16428](https://github.com/nodejs/node/pull/16428), [[`df8c6c3651`](https://github.com/nodejs/node/commit/df8c6c3651)] [#16453](https://github.com/nodejs/node/pull/16453), [[`0a03e350fb`](https://github.com/nodejs/node/commit/0a03e350fb)] [#16454](https://github.com/nodejs/node/pull/16454), [[`eeada6ca63`](https://github.com/nodejs/node/commit/eeada6ca63)] [#16448](https://github.com/nodejs/node/pull/16448), [[`a78327f48b`](https://github.com/nodejs/node/commit/a78327f48b)] [#16429](https://github.com/nodejs/node/pull/16429), [[`b8bc652869`](https://github.com/nodejs/node/commit/b8bc652869)] [#15757](https://github.com/nodejs/node/pull/15757), [[`7124b466d9`](https://github.com/nodejs/node/commit/7124b466d9)] [#15746](https://github.com/nodejs/node/pull/15746), [[`3ddc88b5c2`](https://github.com/nodejs/node/commit/3ddc88b5c2)] [#15756](https://github.com/nodejs/node/pull/15756) - * `dns`: [[`9cb390d899`](https://github.com/nodejs/node/commit/9cb390d899)] [#14212](https://github.com/nodejs/node/pull/14212) - * `events`: [[`e5ad5456a2`](https://github.com/nodejs/node/commit/e5ad5456a2)] [#15623](https://github.com/nodejs/node/pull/15623) - * `fs`: [[`219932a9f7`](https://github.com/nodejs/node/commit/219932a9f7)] [#15043](https://github.com/nodejs/node/pull/15043), [[`b61cab2234`](https://github.com/nodejs/node/commit/b61cab2234)] [#11317](https://github.com/nodejs/node/pull/11317) - * `http`: [[`11a2ca29ba`](https://github.com/nodejs/node/commit/11a2ca29ba)] [#14735](https://github.com/nodejs/node/pull/14735), [[`a9f798ebcc`](https://github.com/nodejs/node/commit/a9f798ebcc)] [#13301](https://github.com/nodejs/node/pull/13301), [[`bdfbce9241`](https://github.com/nodejs/node/commit/bdfbce9241)] [#14423](https://github.com/nodejs/node/pull/14423), [[`4843c2f415`](https://github.com/nodejs/node/commit/4843c2f415)] [#15603](https://github.com/nodejs/node/pull/15603) - * `inspector`: [[`4cf56ad6f2`](https://github.com/nodejs/node/commit/4cf56ad6f2)] [#15619](https://github.com/nodejs/node/pull/15619) - * `net`: [[`a03d8cee1f`](https://github.com/nodejs/node/commit/a03d8cee1f)] [#11356](https://github.com/nodejs/node/pull/11356), [[`7f55349079`](https://github.com/nodejs/node/commit/7f55349079)] [#14782](https://github.com/nodejs/node/pull/14782) - * `path`: [[`dcfbbacba8`](https://github.com/nodejs/node/commit/dcfbbacba8)] [#11319](https://github.com/nodejs/node/pull/11319) - * `process`: [[`a0f7284346`](https://github.com/nodejs/node/commit/a0f7284346)] [#13739](https://github.com/nodejs/node/pull/13739), [[`062071a9c3`](https://github.com/nodejs/node/commit/062071a9c3)] [#13285](https://github.com/nodejs/node/pull/13285), [[`3129b2c035`](https://github.com/nodejs/node/commit/3129b2c035)] [#13982](https://github.com/nodejs/node/pull/13982) - * `querystring`: [[`9788e96836`](https://github.com/nodejs/node/commit/9788e96836)] [#15565](https://github.com/nodejs/node/pull/15565) - * `readline`: [[`7f3f72c19b`](https://github.com/nodejs/node/commit/7f3f72c19b)] [#11390](https://github.com/nodejs/node/pull/11390) - * `repl`: [[`aff8d358fa`](https://github.com/nodejs/node/commit/aff8d358fa)] [#11347](https://github.com/nodejs/node/pull/11347), [[`28227963fa`](https://github.com/nodejs/node/commit/28227963fa)] [#13299](https://github.com/nodejs/node/pull/13299) - * `streams`: [[`d50a802feb`](https://github.com/nodejs/node/commit/d50a802feb)] [#13310](https://github.com/nodejs/node/pull/13310), [[`d2913384aa`](https://github.com/nodejs/node/commit/d2913384aa)] [#13291](https://github.com/nodejs/node/pull/13291), [[`6e86a6651c`](https://github.com/nodejs/node/commit/6e86a6651c)] [#16589](https://github.com/nodejs/node/pull/16589), [[`88fb359c57`](https://github.com/nodejs/node/commit/88fb359c57)] [#15042](https://github.com/nodejs/node/pull/15042), [[`db7d1339c3`](https://github.com/nodejs/node/commit/db7d1339c3)] [#15665](https://github.com/nodejs/node/pull/15665) - * `string_decoder`: [[`eb4940e2d2`](https://github.com/nodejs/node/commit/eb4940e2d2)] [#14682](https://github.com/nodejs/node/pull/14682) - * `timers`: [[`4d893e093a`](https://github.com/nodejs/node/commit/4d893e093a)] [#14659](https://github.com/nodejs/node/pull/14659) - * `tls`: [[`f67aa566a6`](https://github.com/nodejs/node/commit/f67aa566a6)] [#13476](https://github.com/nodejs/node/pull/13476), [[`3ccfeb483d`](https://github.com/nodejs/node/commit/3ccfeb483d)] [#13994](https://github.com/nodejs/node/pull/13994) - * `url`: [[`473f0eff29`](https://github.com/nodejs/node/commit/473f0eff29)] [#13963](https://github.com/nodejs/node/pull/13963) - * `util`: [[`de4a749788`](https://github.com/nodejs/node/commit/de4a749788)] [#11301](https://github.com/nodejs/node/pull/11301), [[`1609899142`](https://github.com/nodejs/node/commit/1609899142)] [#13293](https://github.com/nodejs/node/pull/13293) - * `v8`: [[`ef238fb485`](https://github.com/nodejs/node/commit/ef238fb485)] [#16535](https://github.com/nodejs/node/pull/16535) - * `zlib`: [[`896eaf6820`](https://github.com/nodejs/node/commit/896eaf6820)] [#16540](https://github.com/nodejs/node/pull/16540), [[`74891412f1`](https://github.com/nodejs/node/commit/74891412f1)] [#15618](https://github.com/nodejs/node/pull/15618) + * `buffer`: [[`e79a61cf80`](https://github.com/nodejs/node/commit/e79a61cf80)] - [#16352](https://github.com/nodejs/node/pull/16352), [[`dbfe8c4ea2`](https://github.com/nodejs/node/commit/dbfe8c4ea2)] - [#13976](https://github.com/nodejs/node/pull/13976) + * `child_process`: [[`fe730d34ce`](https://github.com/nodejs/node/commit/fe730d34ce)] - [#14009](https://github.com/nodejs/node/pull/14009) + * `console`: [[`0ecdf29340`](https://github.com/nodejs/node/commit/0ecdf29340)] - [#11340](https://github.com/nodejs/node/pull/11340) + * `crypto`: [[`ee76f3153b`](https://github.com/nodejs/node/commit/ee76f3153b)] - [#16428](https://github.com/nodejs/node/pull/16428), [[`df8c6c3651`](https://github.com/nodejs/node/commit/df8c6c3651)] - [#16453](https://github.com/nodejs/node/pull/16453), [[`0a03e350fb`](https://github.com/nodejs/node/commit/0a03e350fb)] - [#16454](https://github.com/nodejs/node/pull/16454), [[`eeada6ca63`](https://github.com/nodejs/node/commit/eeada6ca63)] - [#16448](https://github.com/nodejs/node/pull/16448), [[`a78327f48b`](https://github.com/nodejs/node/commit/a78327f48b)] - [#16429](https://github.com/nodejs/node/pull/16429), [[`b8bc652869`](https://github.com/nodejs/node/commit/b8bc652869)] - [#15757](https://github.com/nodejs/node/pull/15757), [[`7124b466d9`](https://github.com/nodejs/node/commit/7124b466d9)] - [#15746](https://github.com/nodejs/node/pull/15746), [[`3ddc88b5c2`](https://github.com/nodejs/node/commit/3ddc88b5c2)] - [#15756](https://github.com/nodejs/node/pull/15756) + * `dns`: [[`9cb390d899`](https://github.com/nodejs/node/commit/9cb390d899)] - [#14212](https://github.com/nodejs/node/pull/14212) + * `events`: [[`e5ad5456a2`](https://github.com/nodejs/node/commit/e5ad5456a2)] - [#15623](https://github.com/nodejs/node/pull/15623) + * `fs`: [[`219932a9f7`](https://github.com/nodejs/node/commit/219932a9f7)] - [#15043](https://github.com/nodejs/node/pull/15043), [[`b61cab2234`](https://github.com/nodejs/node/commit/b61cab2234)] - [#11317](https://github.com/nodejs/node/pull/11317) + * `http`: [[`11a2ca29ba`](https://github.com/nodejs/node/commit/11a2ca29ba)] - [#14735](https://github.com/nodejs/node/pull/14735), [[`a9f798ebcc`](https://github.com/nodejs/node/commit/a9f798ebcc)] - [#13301](https://github.com/nodejs/node/pull/13301), [[`bdfbce9241`](https://github.com/nodejs/node/commit/bdfbce9241)] - [#14423](https://github.com/nodejs/node/pull/14423), [[`4843c2f415`](https://github.com/nodejs/node/commit/4843c2f415)] - [#15603](https://github.com/nodejs/node/pull/15603) + * `inspector`: [[`4cf56ad6f2`](https://github.com/nodejs/node/commit/4cf56ad6f2)] - [#15619](https://github.com/nodejs/node/pull/15619) + * `net`: [[`a03d8cee1f`](https://github.com/nodejs/node/commit/a03d8cee1f)] - [#11356](https://github.com/nodejs/node/pull/11356), [[`7f55349079`](https://github.com/nodejs/node/commit/7f55349079)] - [#14782](https://github.com/nodejs/node/pull/14782) + * `path`: [[`dcfbbacba8`](https://github.com/nodejs/node/commit/dcfbbacba8)] - [#11319](https://github.com/nodejs/node/pull/11319) + * `process`: [[`a0f7284346`](https://github.com/nodejs/node/commit/a0f7284346)] - [#13739](https://github.com/nodejs/node/pull/13739), [[`062071a9c3`](https://github.com/nodejs/node/commit/062071a9c3)] - [#13285](https://github.com/nodejs/node/pull/13285), [[`3129b2c035`](https://github.com/nodejs/node/commit/3129b2c035)] - [#13982](https://github.com/nodejs/node/pull/13982) + * `querystring`: [[`9788e96836`](https://github.com/nodejs/node/commit/9788e96836)] - [#15565](https://github.com/nodejs/node/pull/15565) + * `readline`: [[`7f3f72c19b`](https://github.com/nodejs/node/commit/7f3f72c19b)] - [#11390](https://github.com/nodejs/node/pull/11390) + * `repl`: [[`aff8d358fa`](https://github.com/nodejs/node/commit/aff8d358fa)] - [#11347](https://github.com/nodejs/node/pull/11347), [[`28227963fa`](https://github.com/nodejs/node/commit/28227963fa)] - [#13299](https://github.com/nodejs/node/pull/13299) + * `streams`: [[`d50a802feb`](https://github.com/nodejs/node/commit/d50a802feb)] - [#13310](https://github.com/nodejs/node/pull/13310), [[`d2913384aa`](https://github.com/nodejs/node/commit/d2913384aa)] - [#13291](https://github.com/nodejs/node/pull/13291), [[`6e86a6651c`](https://github.com/nodejs/node/commit/6e86a6651c)] - [#16589](https://github.com/nodejs/node/pull/16589), [[`88fb359c57`](https://github.com/nodejs/node/commit/88fb359c57)] - [#15042](https://github.com/nodejs/node/pull/15042), [[`db7d1339c3`](https://github.com/nodejs/node/commit/db7d1339c3)] - [#15665](https://github.com/nodejs/node/pull/15665) + * `string_decoder`: [[`eb4940e2d2`](https://github.com/nodejs/node/commit/eb4940e2d2)] - [#14682](https://github.com/nodejs/node/pull/14682) + * `timers`: [[`4d893e093a`](https://github.com/nodejs/node/commit/4d893e093a)] - [#14659](https://github.com/nodejs/node/pull/14659) + * `tls`: [[`f67aa566a6`](https://github.com/nodejs/node/commit/f67aa566a6)] - [#13476](https://github.com/nodejs/node/pull/13476), [[`3ccfeb483d`](https://github.com/nodejs/node/commit/3ccfeb483d)] - [#13994](https://github.com/nodejs/node/pull/13994) + * `url`: [[`473f0eff29`](https://github.com/nodejs/node/commit/473f0eff29)] - [#13963](https://github.com/nodejs/node/pull/13963) + * `util`: [[`de4a749788`](https://github.com/nodejs/node/commit/de4a749788)] - [#11301](https://github.com/nodejs/node/pull/11301), [[`1609899142`](https://github.com/nodejs/node/commit/1609899142)] - [#13293](https://github.com/nodejs/node/pull/13293) + * `v8`: [[`ef238fb485`](https://github.com/nodejs/node/commit/ef238fb485)] - [#16535](https://github.com/nodejs/node/pull/16535) + * `zlib`: [[`896eaf6820`](https://github.com/nodejs/node/commit/896eaf6820)] - [#16540](https://github.com/nodejs/node/pull/16540), [[`74891412f1`](https://github.com/nodejs/node/commit/74891412f1)] - [#15618](https://github.com/nodejs/node/pull/15618) * **Child Processes** - * Errors are emitted on process nextTick. [[`f2b01cba7b`](https://github.com/nodejs/node/commit/f2b01cba7b)] [#4670](https://github.com/nodejs/node/pull/4670) + * Errors are emitted on process nextTick. [[`f2b01cba7b`](https://github.com/nodejs/node/commit/f2b01cba7b)] - [#4670](https://github.com/nodejs/node/pull/4670) * **Domains** - * The long-deprecated `.dispose()` method has been removed [[`602fd36d95`](https://github.com/nodejs/node/commit/602fd36d95)] [#15412](https://github.com/nodejs/node/pull/15412) + * The long-deprecated `.dispose()` method has been removed [[`602fd36d95`](https://github.com/nodejs/node/commit/602fd36d95)] - [#15412](https://github.com/nodejs/node/pull/15412) * **fs** - * The `fs.ReadStream` and `fs.WriteStream` classes now use `destroy()`. [[`e5c290bed9`](https://github.com/nodejs/node/commit/e5c290bed9)] [#15407](https://github.com/nodejs/node/pull/15407) - * `fs` module callbacks are now invoked with an undefined context. [[`2249234fee`](https://github.com/nodejs/node/commit/2249234fee)] [#14645](https://github.com/nodejs/node/pull/14645) + * The `fs.ReadStream` and `fs.WriteStream` classes now use `destroy()`. [[`e5c290bed9`](https://github.com/nodejs/node/commit/e5c290bed9)] - [#15407](https://github.com/nodejs/node/pull/15407) + * `fs` module callbacks are now invoked with an undefined context. [[`2249234fee`](https://github.com/nodejs/node/commit/2249234fee)] - [#14645](https://github.com/nodejs/node/pull/14645) * **HTTP/1** - * A 400 Bad Request response will now be sent when parsing fails. [[`f2f391e575`](https://github.com/nodejs/node/commit/f2f391e575)] [#15324](https://github.com/nodejs/node/pull/15324) - * Socket timeout will be set when the socket connects. [[`10be20a0e8`](https://github.com/nodejs/node/commit/10be20a0e8)] [#8895](https://github.com/nodejs/node/pull/8895) - * A bug causing the request `'error'` event to fire twice was fixed. [[`620ba41694`](https://github.com/nodejs/node/commit/620ba41694)] [#14659](https://github.com/nodejs/node/pull/14659) - * HTTP clients may now use generic `Duplex` streams in addition to `net.Socket`. [[`3e25e4d00f`](https://github.com/nodejs/node/commit/3e25e4d00f)] [#16267](https://github.com/nodejs/node/pull/16267) + * A 400 Bad Request response will now be sent when parsing fails. [[`f2f391e575`](https://github.com/nodejs/node/commit/f2f391e575)] - [#15324](https://github.com/nodejs/node/pull/15324) + * Socket timeout will be set when the socket connects. [[`10be20a0e8`](https://github.com/nodejs/node/commit/10be20a0e8)] - [#8895](https://github.com/nodejs/node/pull/8895) + * A bug causing the request `'error'` event to fire twice was fixed. [[`620ba41694`](https://github.com/nodejs/node/commit/620ba41694)] - [#14659](https://github.com/nodejs/node/pull/14659) + * HTTP clients may now use generic `Duplex` streams in addition to `net.Socket`. [[`3e25e4d00f`](https://github.com/nodejs/node/commit/3e25e4d00f)] - [#16267](https://github.com/nodejs/node/pull/16267) * **Intl** - * The deprecated `Intl.v8BreakIterator` has been removed. [[`668ad44922`](https://github.com/nodejs/node/commit/668ad44922)] [#15238](https://github.com/nodejs/node/pull/15238) + * The deprecated `Intl.v8BreakIterator` has been removed. [[`668ad44922`](https://github.com/nodejs/node/commit/668ad44922)] - [#15238](https://github.com/nodejs/node/pull/15238) * **OS** - * The `os.EOL` property is now read-only [[`f6caeb9526`](https://github.com/nodejs/node/commit/f6caeb9526)] [#14622](https://github.com/nodejs/node/pull/14622) + * The `os.EOL` property is now read-only [[`f6caeb9526`](https://github.com/nodejs/node/commit/f6caeb9526)] - [#14622](https://github.com/nodejs/node/pull/14622) * **Timers** - * `setTimeout()` will emit a warning if the timeout is larger that the maximum 32-bit unsigned integer. [[`ce3586da31`](https://github.com/nodejs/node/commit/ce3586da31)] [#15627](https://github.com/nodejs/node/pull/15627) + * `setTimeout()` will emit a warning if the timeout is larger that the maximum 32-bit unsigned integer. [[`ce3586da31`](https://github.com/nodejs/node/commit/ce3586da31)] - [#15627](https://github.com/nodejs/node/pull/15627) ### Commits From 014eb67117fb360d97e8b0bc3fa2c57803c02184 Mon Sep 17 00:00:00 2001 From: Lucas Holmquist Date: Mon, 30 Sep 2019 13:56:26 -0400 Subject: [PATCH 21/65] doc: add documentation deprecation for process._tickCallback This change also supports --pending-deprecation for the new deprecation. PR-URL: https://github.com/nodejs/node/pull/29781 Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api/deprecations.md | 27 +++++++++++++++++++++++++ lib/internal/bootstrap/pre_execution.js | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 35bda82f591a47..e45130340c77ef 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2494,6 +2494,33 @@ Type: Runtime Passing a callback to [`worker.terminate()`][] is deprecated. Use the returned `Promise` instead, or a listener to the worker’s `'exit'` event. + +### DEP0133: http connection + + +Type: Documentation-only + +Prefer [`response.socket`][] over [`response.connection`] and +[`request.socket`][] over [`request.connection`]. + + +### DEP0XXX: process._tickCallback + +Type: Documentation-only (supports [`--pending-deprecation`][]) + +The `process._tickCallback` property was never documented as +an officially supported API. + [`--http-parser=legacy`]: cli.html#cli_http_parser_library [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`--throw-deprecation`]: cli.html#cli_throw_deprecation diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index 79f1d97fbb306d..626791a5725773 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -271,6 +271,10 @@ function initializeDeprecations() { process.binding = deprecate(process.binding, 'process.binding() is deprecated. ' + 'Please use public APIs instead.', 'DEP0111'); + + process._tickCallback = deprecate(process._tickCallback, + 'process._tickCallback() is deprecated', + 'DEP0XXX'); } // Create global.process and global.Buffer as getters so that we have a From 6a989da6a0986c22e8c260a8f12d7c4a118be285 Mon Sep 17 00:00:00 2001 From: ZYSzys Date: Tue, 1 Oct 2019 23:06:44 +0800 Subject: [PATCH 22/65] http2: use the latest settings Fixes: https://github.com/nodejs/node/issues/29764 PR-URL: https://github.com/nodejs/node/pull/29780 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Beth Griggs Reviewed-By: Anto Aravinth Reviewed-By: Ruben Bridgewater --- lib/internal/http2/core.js | 1 + test/parallel/test-http2-session-settings.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 6232df7f549a28..2a68376c09bcbd 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -518,6 +518,7 @@ function onSettings() { return; session[kUpdateTimer](); debugSessionObj(session, 'new settings received'); + session[kRemoteSettings] = undefined; session.emit('remoteSettings', session.remoteSettings); } diff --git a/test/parallel/test-http2-session-settings.js b/test/parallel/test-http2-session-settings.js index 46ba1753e2da41..35581d5f7179b3 100644 --- a/test/parallel/test-http2-session-settings.js +++ b/test/parallel/test-http2-session-settings.js @@ -38,6 +38,12 @@ server.on( }) ); +server.on('session', (session) => { + session.settings({ + maxConcurrentStreams: 2 + }); +}); + server.listen( 0, common.mustCall(() => { @@ -57,11 +63,18 @@ server.listen( assert.strictEqual(settings.maxFrameSize, 16384); }, 2) ); + + let calledOnce = false; client.on( 'remoteSettings', common.mustCall((settings) => { assert(settings); - }) + assert.strictEqual( + settings.maxConcurrentStreams, + calledOnce ? 2 : (2 ** 32) - 1 + ); + calledOnce = true; + }, 2) ); const headers = { ':path': '/' }; From 6d88f0fef7a3953e2e528fb4ed0cb151c4ab3a69 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 9 Sep 2019 12:20:16 -0500 Subject: [PATCH 23/65] vm: refactor SourceTextModule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removes redundant `instantiate` method - Refactors `link` to match the spec linking steps more accurately - Removes URL validation from SourceTextModule specifiers - DRYs some dynamic import logic Closes: https://github.com/nodejs/node/issues/29030 Co-Authored-By: Michaël Zasso PR-URL: https://github.com/nodejs/node/pull/29776 Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Minwoo Jung --- doc/api/errors.md | 10 +- doc/api/vm.md | 103 ++----- lib/internal/errors.js | 2 - lib/internal/modules/esm/loader.js | 4 +- lib/internal/vm/source_text_module.js | 284 +++++++++++------- lib/vm.js | 20 +- src/module_wrap.cc | 12 +- src/module_wrap.h | 2 +- test/parallel/test-internal-module-wrap.js | 2 +- test/parallel/test-util-inspect-namespace.js | 1 - test/parallel/test-util-types.js | 1 - test/parallel/test-vm-module-basic.js | 29 +- .../parallel/test-vm-module-dynamic-import.js | 4 - .../test-vm-module-dynamic-namespace.js | 17 +- test/parallel/test-vm-module-errors.js | 75 +---- test/parallel/test-vm-module-import-meta.js | 1 - test/parallel/test-vm-module-link.js | 35 +-- test/parallel/test-vm-module-reevaluate.js | 2 - 18 files changed, 269 insertions(+), 335 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 5783724774b600..f479d06f1456fb 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -1976,11 +1976,6 @@ than the parent module. Linked modules must share the same context. The linker function returned a module for which linking has failed. - -### ERR_VM_MODULE_NOT_LINKED - -The module must be successfully linked before instantiation. - ### ERR_VM_MODULE_NOT_MODULE @@ -2267,6 +2262,11 @@ removed: v10.0.0 Used when a given value is out of the accepted range. + +### ERR_VM_MODULE_NOT_LINKED + +The module must be successfully linked before instantiation. + ### ERR_ZLIB_BINDING_CLOSED

Gold Sponsors

-

Shopify Salesforce Badoo Airbnb Facebook Open Source

Silver Sponsors

+

Shopify Salesforce Badoo Airbnb Facebook Open Source

Silver Sponsors

AMP Project

Bronze Sponsors

-

Discord MONEYPUG Free Icons by Icons8 UI UX Design Agencies clay VPS Server ThemeIsle TekHattan Marfeel Fire Stick Tricks JSHeroes

+

Discord Mixpanel Free Icons by Icons8 UI UX Design Agencies clay VPS Server ThemeIsle TekHattan Marfeel Fire Stick Tricks JSHeroes

## Technology Sponsors diff --git a/tools/node_modules/eslint/bin/eslint.js b/tools/node_modules/eslint/bin/eslint.js index 061e94767f0b92..a9f51f1d7d4c57 100755 --- a/tools/node_modules/eslint/bin/eslint.js +++ b/tools/node_modules/eslint/bin/eslint.js @@ -16,9 +16,9 @@ require("v8-compile-cache"); // Helpers //------------------------------------------------------------------------------ -const useStdIn = (process.argv.indexOf("--stdin") > -1), - init = (process.argv.indexOf("--init") > -1), - debug = (process.argv.indexOf("--debug") > -1); +const useStdIn = process.argv.includes("--stdin"), + init = process.argv.includes("--init"), + debug = process.argv.includes("--debug"); // must do this initialization *before* other requires in order to work if (debug) { @@ -30,9 +30,9 @@ if (debug) { //------------------------------------------------------------------------------ // now we can safely include the other modules that use debug -const cli = require("../lib/cli"), - path = require("path"), - fs = require("fs"); +const path = require("path"), + fs = require("fs"), + cli = require("../lib/cli"); //------------------------------------------------------------------------------ // Execution @@ -50,7 +50,6 @@ process.once("uncaughtException", err => { console.error("\nOops! Something went wrong! :("); console.error(`\nESLint: ${pkg.version}.\n\n${template(err.messageData || {})}`); } else { - console.error(err.stack); } @@ -60,13 +59,40 @@ process.once("uncaughtException", err => { if (useStdIn) { /* - * Note: `process.stdin.fd` is not used here due to https://github.com/nodejs/node/issues/7439. - * Accessing the `process.stdin` property seems to modify the behavior of file descriptor 0, resulting - * in an error when stdin is piped in asynchronously. + * Note: See + * - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin + * - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io + * - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html + * - https://github.com/nodejs/node/issues/7439 (historical) + * + * On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems + * to read 4096 bytes before blocking and never drains to read further data. + * + * The investigation on the Emacs thread indicates: + * + * > Emacs on MS-Windows uses pipes to communicate with subprocesses; a + * > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than + * > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for + * > the subprocess to read its end of the pipe, at which time Emacs will + * > write the rest of the stuff. + * + * Using the nodejs code example for reading from stdin. */ - const STDIN_FILE_DESCRIPTOR = 0; + let contents = "", + chunk = ""; + + process.stdin.setEncoding("utf8"); + process.stdin.on("readable", () => { - process.exitCode = cli.execute(process.argv, fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")); + // Use a loop to make sure we read all available data. + while ((chunk = process.stdin.read()) !== null) { + contents += chunk; + } + }); + + process.stdin.on("end", () => { + process.exitCode = cli.execute(process.argv, contents, "utf8"); + }); } else if (init) { const configInit = require("../lib/init/config-initializer"); diff --git a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js index 7f80887f086464..3c67d33daa6413 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -85,8 +85,8 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]); * @property {number} warningCount Number of warnings for the result. * @property {number} fixableErrorCount Number of fixable errors for the result. * @property {number} fixableWarningCount Number of fixable warnings for the result. - * @property {string=} [source] The source code of the file that was linted. - * @property {string=} [output] The source code of the file that was linted, with as many fixes applied as possible. + * @property {string} [source] The source code of the file that was linted. + * @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible. */ /** @@ -329,7 +329,6 @@ function getRule(ruleId, configArrays) { /** * Collect used deprecated rules. * @param {ConfigArray[]} usedConfigArrays The config arrays which were used. - * @param {Map} ruleMap The rule definitions which were used (built-ins). * @returns {IterableIterator} Used deprecated rules. */ function *iterateRuleDeprecationWarnings(usedConfigArrays) { @@ -530,7 +529,6 @@ class CLIEngine { /** * Creates a new instance of the core CLI engine. * @param {CLIEngineOptions} providedOptions The options for this instance. - * @constructor */ constructor(providedOptions) { const options = Object.assign( diff --git a/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js b/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js index 137d156e9c05af..12dfce06665eef 100644 --- a/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js +++ b/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js @@ -78,7 +78,7 @@ function mergeDefaultOptions(options) { return Object.assign({}, DEFAULT_OPTIONS, options); } -/* eslint-disable valid-jsdoc */ +/* eslint-disable jsdoc/check-param-names, jsdoc/require-param */ /** * Normalize the path separators in a given string. * On Windows environment, this replaces `\` by `/`. @@ -89,7 +89,7 @@ function mergeDefaultOptions(options) { const normalizePathSeps = path.sep === "/" ? (str => str) : ((seps, str) => str.replace(seps, "/")).bind(null, new RegExp(`\\${path.sep}`, "gu")); -/* eslint-enable valid-jsdoc */ +/* eslint-enable jsdoc/check-param-names, jsdoc/require-param */ /** * Converts a glob pattern to a new glob pattern relative to a different directory @@ -298,7 +298,7 @@ class IgnoredPaths { /** * read ignore filepath - * @param {string} filePath, file to add to ig + * @param {string} filePath file to add to ig * @returns {Array} raw ignore rules */ readIgnoreFile(filePath) { diff --git a/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js b/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js index 9408780fb022c6..14e19d9e5a1c63 100644 --- a/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js +++ b/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js @@ -47,7 +47,6 @@ class LintResultCache { /** * Creates a new LintResultCache instance. - * @constructor * @param {string} cacheFileLocation The cache file location. * configuration lookup by file path). */ diff --git a/tools/node_modules/eslint/lib/cli.js b/tools/node_modules/eslint/lib/cli.js index c34545544b1040..18a917cf0b0a95 100644 --- a/tools/node_modules/eslint/lib/cli.js +++ b/tools/node_modules/eslint/lib/cli.js @@ -20,7 +20,8 @@ const fs = require("fs"), mkdirp = require("mkdirp"), { CLIEngine } = require("./cli-engine"), options = require("./options"), - log = require("./shared/logging"); + log = require("./shared/logging"), + RuntimeInfo = require("./shared/runtime-info"); const debug = require("debug")("eslint:cli"); @@ -159,13 +160,18 @@ const cli = { } const files = currentOptions._; - const useStdin = typeof text === "string"; - if (currentOptions.version) { // version from package.json - - log.info(`v${require("../package.json").version}`); - + if (currentOptions.version) { + log.info(RuntimeInfo.version()); + } else if (currentOptions.envInfo) { + try { + log.info(RuntimeInfo.environment()); + return 0; + } catch (err) { + log.error(err.message); + return 2; + } } else if (currentOptions.printConfig) { if (files.length) { log.error("The --print-config option must be used with exactly one file name."); @@ -177,17 +183,13 @@ const cli = { } const engine = new CLIEngine(translateOptions(currentOptions)); - const fileConfig = engine.getConfigForFile(currentOptions.printConfig); log.info(JSON.stringify(fileConfig, null, " ")); return 0; } else if (currentOptions.help || (!files.length && !useStdin)) { - log.info(options.generateHelp()); - } else { - debug(`Running on ${useStdin ? "text" : "files"}`); if (currentOptions.fix && currentOptions.fixDryRun) { @@ -227,9 +229,8 @@ const cli = { return (report.errorCount || tooManyWarnings) ? 1 : 0; } - return 2; - + return 2; } return 0; diff --git a/tools/node_modules/eslint/lib/init/config-rule.js b/tools/node_modules/eslint/lib/init/config-rule.js index fbe9b779ab7f54..e40feb7145b0cf 100644 --- a/tools/node_modules/eslint/lib/init/config-rule.js +++ b/tools/node_modules/eslint/lib/init/config-rule.js @@ -99,7 +99,7 @@ function groupByProperty(objects) { * Configs may also have one or more additional elements to specify rule * configuration or options. * - * @typedef {array|number} ruleConfig + * @typedef {Array|number} ruleConfig * @param {number} 0 The rule's severity (0, 1, 2). */ @@ -185,7 +185,7 @@ class RuleConfigSet { /** * Stored valid rule configurations for this instance - * @type {array} + * @type {Array} */ this.ruleConfigs = configs || []; } diff --git a/tools/node_modules/eslint/lib/init/npm-utils.js b/tools/node_modules/eslint/lib/init/npm-utils.js index 7fe7c6e7d59b34..3d4a896b6f6e51 100644 --- a/tools/node_modules/eslint/lib/init/npm-utils.js +++ b/tools/node_modules/eslint/lib/init/npm-utils.js @@ -163,7 +163,7 @@ function checkDevDeps(packages) { /** * Check whether package.json is found in current path. * - * @param {string=} startDir Starting directory + * @param {string} [startDir] Starting directory * @returns {boolean} Whether a package.json is found in current path. */ function checkPackageJson(startDir) { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js index 9af985ce85f56e..2ca6dbc1e5293c 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js @@ -21,7 +21,7 @@ const debug = require("debug")("eslint:code-path"); * @returns {string} Id of the segment. */ /* istanbul ignore next */ -function getId(segment) { // eslint-disable-line require-jsdoc +function getId(segment) { // eslint-disable-line jsdoc/require-jsdoc return segment.id + (segment.reachable ? "" : "!"); } diff --git a/tools/node_modules/eslint/lib/linter/linter.js b/tools/node_modules/eslint/lib/linter/linter.js index 7d1dc8c8c1cfd8..534181da9e4752 100644 --- a/tools/node_modules/eslint/lib/linter/linter.js +++ b/tools/node_modules/eslint/lib/linter/linter.js @@ -472,7 +472,6 @@ function normalizeFilename(filename) { return index === -1 ? filename : parts.slice(index).join(path.sep); } -// eslint-disable-next-line valid-jsdoc /** * Normalizes the possible options for `linter.verify` and `linter.verifyAndFix` to a * consistent shape. diff --git a/tools/node_modules/eslint/lib/options.js b/tools/node_modules/eslint/lib/options.js index 440773a844bbfd..83bf9afc22c9f1 100644 --- a/tools/node_modules/eslint/lib/options.js +++ b/tools/node_modules/eslint/lib/options.js @@ -224,6 +224,12 @@ module.exports = optionator({ default: "false", description: "Run config initialization wizard" }, + { + option: "env-info", + type: "Boolean", + default: "false", + description: "Output execution environment information" + }, { option: "debug", type: "Boolean", diff --git a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js index 0d1319c11a2fdc..9f8324a358fd77 100644 --- a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js +++ b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js @@ -130,7 +130,7 @@ function freezeDeeply(x) { */ function sanitize(text) { return text.replace( - /[\u0000-\u001f]/gu, // eslint-disable-line no-control-regex + /[\u0000-\u0009|\u000b-\u001a]/gu, // eslint-disable-line no-control-regex c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}` ); } @@ -177,7 +177,6 @@ class RuleTester { /** * Creates a new instance of RuleTester. * @param {Object} [testerConfig] Optional, extra configuration for the tester - * @constructor */ constructor(testerConfig) { diff --git a/tools/node_modules/eslint/lib/rules/capitalized-comments.js b/tools/node_modules/eslint/lib/rules/capitalized-comments.js index 47477743598ac8..dd7ef145648c66 100644 --- a/tools/node_modules/eslint/lib/rules/capitalized-comments.js +++ b/tools/node_modules/eslint/lib/rules/capitalized-comments.js @@ -59,7 +59,7 @@ const DEFAULTS = { * @param {string} which Either "line" or "block". * @returns {Object} The normalized options. */ -function getNormalizedOptions(rawOptions = {}, which) { +function getNormalizedOptions(rawOptions, which) { return Object.assign({}, DEFAULTS, rawOptions[which] || rawOptions); } @@ -70,7 +70,7 @@ function getNormalizedOptions(rawOptions = {}, which) { * @returns {Object} An object with "Line" and "Block" keys and corresponding * normalized options objects. */ -function getAllNormalizedOptions(rawOptions) { +function getAllNormalizedOptions(rawOptions = {}) { return { Line: getNormalizedOptions(rawOptions, "line"), Block: getNormalizedOptions(rawOptions, "block") diff --git a/tools/node_modules/eslint/lib/rules/indent-legacy.js b/tools/node_modules/eslint/lib/rules/indent-legacy.js index fb84b732ea307e..f1c024c368475d 100644 --- a/tools/node_modules/eslint/lib/rules/indent-legacy.js +++ b/tools/node_modules/eslint/lib/rules/indent-legacy.js @@ -303,7 +303,7 @@ module.exports = { * @param {int} needed Expected indentation character count * @param {int} gottenSpaces Indentation space count in the actual node/code * @param {int} gottenTabs Indentation tab count in the actual node/code - * @param {Object=} loc Error line and column location + * @param {Object} [loc] Error line and column location * @param {boolean} isLastNodeCheck Is the error for last node check * @returns {void} */ diff --git a/tools/node_modules/eslint/lib/rules/indent.js b/tools/node_modules/eslint/lib/rules/indent.js index f44eafa715cf96..a2fa9c4f409c01 100644 --- a/tools/node_modules/eslint/lib/rules/indent.js +++ b/tools/node_modules/eslint/lib/rules/indent.js @@ -81,6 +81,9 @@ const KNOWN_NODES = new Set([ "WhileStatement", "WithStatement", "YieldExpression", + "JSXFragment", + "JSXOpeningFragment", + "JSXClosingFragment", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", @@ -1453,6 +1456,31 @@ module.exports = { offsets.setDesiredOffsets(node.name.range, firstToken, 1); }, + JSXFragment(node) { + const firstOpeningToken = sourceCode.getFirstToken(node.openingFragment); + const firstClosingToken = sourceCode.getFirstToken(node.closingFragment); + + addElementListIndent(node.children, firstOpeningToken, firstClosingToken, 1); + }, + + JSXOpeningFragment(node) { + const firstToken = sourceCode.getFirstToken(node); + const closingToken = sourceCode.getLastToken(node); + + offsets.setDesiredOffsets(node.range, firstToken, 1); + offsets.matchOffsetOf(firstToken, closingToken); + }, + + JSXClosingFragment(node) { + const firstToken = sourceCode.getFirstToken(node); + const slashToken = sourceCode.getLastToken(node, { skip: 1 }); + const closingToken = sourceCode.getLastToken(node); + const tokenToMatch = astUtils.isTokenOnSameLine(slashToken, closingToken) ? slashToken : closingToken; + + offsets.setDesiredOffsets(node.range, firstToken, 1); + offsets.matchOffsetOf(firstToken, tokenToMatch); + }, + JSXExpressionContainer(node) { const openingCurly = sourceCode.getFirstToken(node); const closingCurly = sourceCode.getLastToken(node); diff --git a/tools/node_modules/eslint/lib/rules/new-parens.js b/tools/node_modules/eslint/lib/rules/new-parens.js index 4b9958fe6cb2fe..405ec1b515a4d6 100644 --- a/tools/node_modules/eslint/lib/rules/new-parens.js +++ b/tools/node_modules/eslint/lib/rules/new-parens.js @@ -65,7 +65,11 @@ module.exports = { const lastToken = sourceCode.getLastToken(node); const hasLastParen = lastToken && astUtils.isClosingParenToken(lastToken); - const hasParens = hasLastParen && astUtils.isOpeningParenToken(sourceCode.getTokenBefore(lastToken)); + + // `hasParens` is true only if the new expression ends with its own parens, e.g., new new foo() does not end with its own parens + const hasParens = hasLastParen && + astUtils.isOpeningParenToken(sourceCode.getTokenBefore(lastToken)) && + node.callee.range[1] < node.range[1]; if (always) { if (!hasParens) { diff --git a/tools/node_modules/eslint/lib/rules/no-extra-bind.js b/tools/node_modules/eslint/lib/rules/no-extra-bind.js index cc0b1f84372049..cc5611b10894ee 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-bind.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-bind.js @@ -40,6 +40,7 @@ module.exports = { }, create(context) { + const sourceCode = context.getSourceCode(); let scopeInfo = null; /** @@ -71,8 +72,13 @@ module.exports = { return null; } - const firstTokenToRemove = context.getSourceCode() + const firstTokenToRemove = sourceCode .getFirstTokenBetween(node.parent.object, node.parent.property, astUtils.isNotClosingParenToken); + const lastTokenToRemove = sourceCode.getLastToken(node.parent.parent); + + if (sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) { + return null; + } return fixer.removeRange([firstTokenToRemove.range[0], node.parent.parent.range[1]]); } diff --git a/tools/node_modules/eslint/lib/rules/no-extra-label.js b/tools/node_modules/eslint/lib/rules/no-extra-label.js index a4a98af5853b98..48add937e6ef57 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-label.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-label.js @@ -116,7 +116,15 @@ module.exports = { node: labelNode, messageId: "unexpected", data: labelNode, - fix: fixer => fixer.removeRange([sourceCode.getFirstToken(node).range[1], labelNode.range[1]]) + fix(fixer) { + const breakOrContinueToken = sourceCode.getFirstToken(node); + + if (sourceCode.commentsExistBetween(breakOrContinueToken, labelNode)) { + return null; + } + + return fixer.removeRange([breakOrContinueToken.range[1], labelNode.range[1]]); + } }); } return; diff --git a/tools/node_modules/eslint/lib/rules/no-extra-parens.js b/tools/node_modules/eslint/lib/rules/no-extra-parens.js index c5cf7904774c0d..c6809c355bc752 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js @@ -205,7 +205,14 @@ module.exports = { const lastToken = sourceCode.getLastToken(newExpression); const penultimateToken = sourceCode.getTokenBefore(lastToken); - return newExpression.arguments.length > 0 || astUtils.isOpeningParenToken(penultimateToken) && astUtils.isClosingParenToken(lastToken); + return newExpression.arguments.length > 0 || + ( + + // The expression should end with its own parens, e.g., new new foo() is not a new expression with parens + astUtils.isOpeningParenToken(penultimateToken) && + astUtils.isClosingParenToken(lastToken) && + newExpression.callee.range[1] < newExpression.range[1] + ); } /** @@ -338,7 +345,7 @@ module.exports = { function finishReport() { context.report({ node, - loc: leftParenToken.loc.start, + loc: leftParenToken.loc, messageId: "unexpected", fix(fixer) { const parenthesizedSource = sourceCode.text.slice(leftParenToken.range[1], rightParenToken.range[0]); @@ -887,6 +894,12 @@ module.exports = { report(node.object); } + if (nodeObjHasExcessParens && + node.object.type === "NewExpression" && + isNewExpressionWithParens(node.object)) { + report(node.object); + } + if (node.computed && hasExcessParens(node.property)) { report(node.property); } diff --git a/tools/node_modules/eslint/lib/rules/no-regex-spaces.js b/tools/node_modules/eslint/lib/rules/no-regex-spaces.js index 55e79517cef2d7..41f5e149df049b 100644 --- a/tools/node_modules/eslint/lib/rules/no-regex-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-regex-spaces.js @@ -5,7 +5,29 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + const astUtils = require("./utils/ast-utils"); +const regexpp = require("regexpp"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const regExpParser = new regexpp.RegExpParser(); +const DOUBLE_SPACE = / {2}/u; + +/** + * Check if node is a string + * @param {ASTNode} node node to evaluate + * @returns {boolean} True if its a string + * @private + */ +function isString(node) { + return node && node.type === "Literal" && typeof node.value === "string"; +} //------------------------------------------------------------------------------ // Rule Definition @@ -27,40 +49,70 @@ module.exports = { }, create(context) { - const sourceCode = context.getSourceCode(); /** - * Validate regular expressions - * @param {ASTNode} node node to validate - * @param {string} value regular expression to validate - * @param {number} valueStart The start location of the regex/string literal. It will always be the case that - * `sourceCode.getText().slice(valueStart, valueStart + value.length) === value` + * Validate regular expression + * + * @param {ASTNode} nodeToReport Node to report. + * @param {string} pattern Regular expression pattern to validate. + * @param {string} rawPattern Raw representation of the pattern in the source code. + * @param {number} rawPatternStartRange Start range of the pattern in the source code. + * @param {string} flags Regular expression flags. * @returns {void} * @private */ - function checkRegex(node, value, valueStart) { - const multipleSpacesRegex = /( {2,})( [+*{?]|[^+*{?]|$)/u, - regexResults = multipleSpacesRegex.exec(value); + function checkRegex(nodeToReport, pattern, rawPattern, rawPatternStartRange, flags) { - if (regexResults !== null) { - const count = regexResults[1].length; + // Skip if there are no consecutive spaces in the source code, to avoid reporting e.g., RegExp(' \ '). + if (!DOUBLE_SPACE.test(rawPattern)) { + return; + } - context.report({ - node, - message: "Spaces are hard to count. Use {{{count}}}.", - data: { count }, - fix(fixer) { - return fixer.replaceTextRange( - [valueStart + regexResults.index, valueStart + regexResults.index + count], - ` {${count}}` - ); - } - }); - - /* - * TODO: (platinumazure) Fix message to use rule message - * substitution when api.report is fixed in lib/eslint.js. - */ + const characterClassNodes = []; + let regExpAST; + + try { + regExpAST = regExpParser.parsePattern(pattern, 0, pattern.length, flags.includes("u")); + } catch (e) { + + // Ignore regular expressions with syntax errors + return; + } + + regexpp.visitRegExpAST(regExpAST, { + onCharacterClassEnter(ccNode) { + characterClassNodes.push(ccNode); + } + }); + + const spacesPattern = /( {2,})(?: [+*{?]|[^+*{?]|$)/gu; + let match; + + while ((match = spacesPattern.exec(pattern))) { + const { 1: { length }, index } = match; + + // Report only consecutive spaces that are not in character classes. + if ( + characterClassNodes.every(({ start, end }) => index < start || end <= index) + ) { + context.report({ + node: nodeToReport, + message: "Spaces are hard to count. Use {{{length}}}.", + data: { length }, + fix(fixer) { + if (pattern !== rawPattern) { + return null; + } + return fixer.replaceTextRange( + [rawPatternStartRange + index, rawPatternStartRange + index + length], + ` {${length}}` + ); + } + }); + + // Report only the first occurence of consecutive spaces + return; + } } } @@ -71,25 +123,22 @@ module.exports = { * @private */ function checkLiteral(node) { - const token = sourceCode.getFirstToken(node), - nodeType = token.type, - nodeValue = token.value; + if (node.regex) { + const pattern = node.regex.pattern; + const rawPattern = node.raw.slice(1, node.raw.lastIndexOf("/")); + const rawPatternStartRange = node.range[0] + 1; + const flags = node.regex.flags; - if (nodeType === "RegularExpression") { - checkRegex(node, nodeValue, token.range[0]); + checkRegex( + node, + pattern, + rawPattern, + rawPatternStartRange, + flags + ); } } - /** - * Check if node is a string - * @param {ASTNode} node node to evaluate - * @returns {boolean} True if its a string - * @private - */ - function isString(node) { - return node && node.type === "Literal" && typeof node.value === "string"; - } - /** * Validate strings passed to the RegExp constructor * @param {ASTNode} node node to validate @@ -100,9 +149,22 @@ module.exports = { const scope = context.getScope(); const regExpVar = astUtils.getVariableByName(scope, "RegExp"); const shadowed = regExpVar && regExpVar.defs.length > 0; + const patternNode = node.arguments[0]; + const flagsNode = node.arguments[1]; - if (node.callee.type === "Identifier" && node.callee.name === "RegExp" && isString(node.arguments[0]) && !shadowed) { - checkRegex(node, node.arguments[0].value, node.arguments[0].range[0] + 1); + if (node.callee.type === "Identifier" && node.callee.name === "RegExp" && isString(patternNode) && !shadowed) { + const pattern = patternNode.value; + const rawPattern = patternNode.raw.slice(1, -1); + const rawPatternStartRange = patternNode.range[0] + 1; + const flags = isString(flagsNode) ? flagsNode.value : ""; + + checkRegex( + node, + pattern, + rawPattern, + rawPatternStartRange, + flags + ); } } @@ -111,6 +173,5 @@ module.exports = { CallExpression: checkFunction, NewExpression: checkFunction }; - } }; diff --git a/tools/node_modules/eslint/lib/rules/no-undef-init.js b/tools/node_modules/eslint/lib/rules/no-undef-init.js index 1390c880fc8621..1fdccb867b3c24 100644 --- a/tools/node_modules/eslint/lib/rules/no-undef-init.js +++ b/tools/node_modules/eslint/lib/rules/no-undef-init.js @@ -37,7 +37,8 @@ module.exports = { init = node.init && node.init.name, scope = context.getScope(), undefinedVar = astUtils.getVariableByName(scope, "undefined"), - shadowed = undefinedVar && undefinedVar.defs.length > 0; + shadowed = undefinedVar && undefinedVar.defs.length > 0, + lastToken = sourceCode.getLastToken(node); if (init === "undefined" && node.parent.kind !== "const" && !shadowed) { context.report({ @@ -54,6 +55,11 @@ module.exports = { // Don't fix destructuring assignment to `undefined`. return null; } + + if (sourceCode.commentsExistBetween(node.id, lastToken)) { + return null; + } + return fixer.removeRange([node.id.range[1], node.range[1]]); } }); diff --git a/tools/node_modules/eslint/lib/rules/no-useless-rename.js b/tools/node_modules/eslint/lib/rules/no-useless-rename.js index c1860645ea698e..f31459bd8ae281 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-rename.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-rename.js @@ -36,7 +36,8 @@ module.exports = { }, create(context) { - const options = context.options[0] || {}, + const sourceCode = context.getSourceCode(), + options = context.options[0] || {}, ignoreDestructuring = options.ignoreDestructuring === true, ignoreImport = options.ignoreImport === true, ignoreExport = options.ignoreExport === true; @@ -64,10 +65,18 @@ module.exports = { type }, fix(fixer) { + if (sourceCode.commentsExistBetween(initial, result)) { + return null; + } + + const replacementText = result.type === "AssignmentPattern" + ? sourceCode.getText(result) + : name; + return fixer.replaceTextRange([ initial.range[0], result.range[1] - ], name); + ], replacementText); } }); } @@ -82,26 +91,29 @@ module.exports = { return; } - const properties = node.properties; + for (const property of node.properties) { - for (let i = 0; i < properties.length; i++) { - if (properties[i].shorthand) { + /* + * TODO: Remove after babel-eslint removes ExperimentalRestProperty + * https://github.com/eslint/eslint/issues/12335 + */ + if (property.type === "ExperimentalRestProperty") { continue; } /** - * If an ObjectPattern property is computed, we have no idea - * if a rename is useless or not. If an ObjectPattern property - * lacks a key, it is likely an ExperimentalRestProperty and - * so there is no "renaming" occurring here. + * Properties using shorthand syntax and rest elements can not be renamed. + * If the property is computed, we have no idea if a rename is useless or not. */ - if (properties[i].computed || !properties[i].key) { + if (property.shorthand || property.type === "RestElement" || property.computed) { continue; } - if (properties[i].key.type === "Identifier" && properties[i].key.name === properties[i].value.name || - properties[i].key.type === "Literal" && properties[i].key.value === properties[i].value.name) { - reportError(properties[i], properties[i].key, properties[i].value, "Destructuring assignment"); + const key = (property.key.type === "Identifier" && property.key.name) || (property.key.type === "Literal" && property.key.value); + const renamedKey = property.value.type === "AssignmentPattern" ? property.value.left.name : property.value.name; + + if (key === renamedKey) { + reportError(property, property.key, property.value, "Destructuring assignment"); } } } diff --git a/tools/node_modules/eslint/lib/rules/no-useless-return.js b/tools/node_modules/eslint/lib/rules/no-useless-return.js index 46b5f4b648fc99..7b12e85091c644 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-return.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-return.js @@ -82,6 +82,7 @@ module.exports = { create(context) { const segmentInfoMap = new WeakMap(); const usedUnreachableSegments = new WeakSet(); + const sourceCode = context.getSourceCode(); let scopeInfo = null; /** @@ -216,7 +217,7 @@ module.exports = { loc: node.loc, message: "Unnecessary return statement.", fix(fixer) { - if (isRemovable(node)) { + if (isRemovable(node) && !sourceCode.getCommentsInside(node).length) { /* * Extend the replacement range to include the @@ -224,7 +225,7 @@ module.exports = { * no-else-return. * https://github.com/eslint/eslint/issues/8026 */ - return new FixTracker(fixer, context.getSourceCode()) + return new FixTracker(fixer, sourceCode) .retainEnclosingFunction(node) .remove(node); } diff --git a/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js b/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js index 07e69f022c741b..7f4a9c3c8e34a1 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js +++ b/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js @@ -50,16 +50,16 @@ module.exports = { /** * Function to check regular expression. * - * @param {string} regex The regular expression to be check. + * @param {string} pattern The regular expression pattern to be check. * @param {ASTNode} node AST node which contains regular expression. * @param {boolean} uFlag Flag indicates whether unicode mode is enabled or not. * @returns {void} */ - function checkRegex(regex, node, uFlag) { + function checkRegex(pattern, node, uFlag) { let ast; try { - ast = parser.parsePattern(regex, 0, regex.length, uFlag); + ast = parser.parsePattern(pattern, 0, pattern.length, uFlag); } catch (_) { // ignore regex syntax errors @@ -69,21 +69,9 @@ module.exports = { regexpp.visitRegExpAST(ast, { onCapturingGroupEnter(group) { if (!group.name) { - const locNode = node.type === "Literal" ? node : node.arguments[0]; - context.report({ node, messageId: "required", - loc: { - start: { - line: locNode.loc.start.line, - column: locNode.loc.start.column + group.start + 1 - }, - end: { - line: locNode.loc.start.line, - column: locNode.loc.start.column + group.end + 1 - } - }, data: { group: group.raw } diff --git a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js index ca7358aa013bda..b4113a3b327542 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js +++ b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js @@ -96,6 +96,10 @@ module.exports = { fix(fixer) { const newPrefix = prefixMap[node.arguments[1].value]; + if (sourceCode.getCommentsInside(node).length) { + return null; + } + if (+(newPrefix + node.arguments[0].value) !== parseInt(node.arguments[0].value, node.arguments[1].value)) { /* diff --git a/tools/node_modules/eslint/lib/rules/use-isnan.js b/tools/node_modules/eslint/lib/rules/use-isnan.js index 877c02754aecf1..b2eb84b7b37f60 100644 --- a/tools/node_modules/eslint/lib/rules/use-isnan.js +++ b/tools/node_modules/eslint/lib/rules/use-isnan.js @@ -5,6 +5,19 @@ "use strict"; +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines if the given node is a NaN `Identifier` node. + * @param {ASTNode|null} node The node to check. + * @returns {boolean} `true` if the node is 'NaN' identifier. + */ +function isNaNIdentifier(node) { + return Boolean(node) && node.type === "Identifier" && node.name === "NaN"; +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -20,21 +33,69 @@ module.exports = { url: "https://eslint.org/docs/rules/use-isnan" }, - schema: [], + schema: [ + { + type: "object", + properties: { + enforceForSwitchCase: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], + messages: { - useIsNaN: "Use the isNaN function to compare with NaN." + comparisonWithNaN: "Use the isNaN function to compare with NaN.", + switchNaN: "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch.", + caseNaN: "'case NaN' can never match. Use Number.isNaN before the switch." } }, create(context) { - return { - BinaryExpression(node) { - if (/^(?:[<>]|[!=]=)=?$/u.test(node.operator) && (node.left.name === "NaN" || node.right.name === "NaN")) { - context.report({ node, messageId: "useIsNaN" }); + const enforceForSwitchCase = context.options[0] && context.options[0].enforceForSwitchCase; + + /** + * Checks the given `BinaryExpression` node. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkBinaryExpression(node) { + if ( + /^(?:[<>]|[!=]=)=?$/u.test(node.operator) && + (isNaNIdentifier(node.left) || isNaNIdentifier(node.right)) + ) { + context.report({ node, messageId: "comparisonWithNaN" }); + } + } + + /** + * Checks the discriminant and all case clauses of the given `SwitchStatement` node. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkSwitchStatement(node) { + if (isNaNIdentifier(node.discriminant)) { + context.report({ node, messageId: "switchNaN" }); + } + + for (const switchCase of node.cases) { + if (isNaNIdentifier(switchCase.test)) { + context.report({ node: switchCase, messageId: "caseNaN" }); } } + } + + const listeners = { + BinaryExpression: checkBinaryExpression }; + if (enforceForSwitchCase) { + listeners.SwitchStatement = checkSwitchStatement; + } + + return listeners; } }; diff --git a/tools/node_modules/eslint/lib/shared/logging.js b/tools/node_modules/eslint/lib/shared/logging.js index 3eb898c34f8a88..6aa1f5a1e59c77 100644 --- a/tools/node_modules/eslint/lib/shared/logging.js +++ b/tools/node_modules/eslint/lib/shared/logging.js @@ -12,6 +12,7 @@ module.exports = { /** * Cover for console.log + * @param {...any} args The elements to log. * @returns {void} */ info(...args) { @@ -20,6 +21,7 @@ module.exports = { /** * Cover for console.error + * @param {...any} args The elements to log. * @returns {void} */ error(...args) { diff --git a/tools/node_modules/eslint/lib/shared/runtime-info.js b/tools/node_modules/eslint/lib/shared/runtime-info.js new file mode 100644 index 00000000000000..169bbc58f13c16 --- /dev/null +++ b/tools/node_modules/eslint/lib/shared/runtime-info.js @@ -0,0 +1,163 @@ +/** + * @fileoverview Utility to get information about the execution environment. + * @author Kai Cataldo + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const path = require("path"); +const spawn = require("cross-spawn"); +const { isEmpty } = require("lodash"); +const log = require("../shared/logging"); +const packageJson = require("../../package.json"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Generates and returns execution environment information. + * @returns {string} A string that contains execution environment information. + */ +function environment() { + const cache = new Map(); + + /** + * Checks if a path is a child of a directory. + * @param {string} parentPath - The parent path to check. + * @param {string} childPath - The path to check. + * @returns {boolean} Whether or not the given path is a child of a directory. + */ + function isChildOfDirectory(parentPath, childPath) { + return !path.relative(parentPath, childPath).startsWith(".."); + } + + /** + * Synchronously executes a shell command and formats the result. + * @param {string} cmd - The command to execute. + * @param {Array} args - The arguments to be executed with the command. + * @returns {string} The version returned by the command. + */ + function execCommand(cmd, args) { + const key = [cmd, ...args].join(" "); + + if (cache.has(key)) { + return cache.get(key); + } + + const process = spawn.sync(cmd, args, { encoding: "utf8" }); + + if (process.error) { + throw process.error; + } + + const result = process.stdout.trim(); + + cache.set(key, result); + return result; + } + + /** + * Normalizes a version number. + * @param {string} versionStr - The string to normalize. + * @returns {string} The normalized version number. + */ + function normalizeVersionStr(versionStr) { + return versionStr.startsWith("v") ? versionStr : `v${versionStr}`; + } + + /** + * Gets bin version. + * @param {string} bin - The bin to check. + * @returns {string} The normalized version returned by the command. + */ + function getBinVersion(bin) { + const binArgs = ["--version"]; + + try { + return normalizeVersionStr(execCommand(bin, binArgs)); + } catch (e) { + log.error(`Error finding ${bin} version running the command \`${bin} ${binArgs.join(" ")}\``); + throw e; + } + } + + /** + * Gets installed npm package version. + * @param {string} pkg - The package to check. + * @param {boolean} global - Whether to check globally or not. + * @returns {string} The normalized version returned by the command. + */ + function getNpmPackageVersion(pkg, { global = false } = {}) { + const npmBinArgs = ["bin", "-g"]; + const npmLsArgs = ["ls", "--depth=0", "--json", "eslint"]; + + if (global) { + npmLsArgs.push("-g"); + } + + try { + const parsedStdout = JSON.parse(execCommand("npm", npmLsArgs)); + + /* + * Checking globally returns an empty JSON object, while local checks + * include the name and version of the local project. + */ + if (isEmpty(parsedStdout) || !(parsedStdout.dependencies && parsedStdout.dependencies.eslint)) { + return "Not found"; + } + + const [, processBinPath] = process.argv; + let npmBinPath; + + try { + npmBinPath = execCommand("npm", npmBinArgs); + } catch (e) { + log.error(`Error finding npm binary path when running command \`npm ${npmBinArgs.join(" ")}\``); + throw e; + } + + const isGlobal = isChildOfDirectory(npmBinPath, processBinPath); + let pkgVersion = parsedStdout.dependencies.eslint.version; + + if ((global && isGlobal) || (!global && !isGlobal)) { + pkgVersion += " (Currently used)"; + } + + return normalizeVersionStr(pkgVersion); + } catch (e) { + log.error(`Error finding ${pkg} version running the command \`npm ${npmLsArgs.join(" ")}\``); + throw e; + } + } + + return [ + "Environment Info:", + "", + `Node version: ${getBinVersion("node")}`, + `npm version: ${getBinVersion("npm")}`, + `Local ESLint version: ${getNpmPackageVersion("eslint", { global: false })}`, + `Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}` + ].join("\n"); +} + +/** + * Returns version of currently executing ESLint. + * @returns {string} The version from the currently executing ESLint's package.json. + */ +function version() { + return `v${packageJson.version}`; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + environment, + version +}; diff --git a/tools/node_modules/eslint/lib/source-code/source-code.js b/tools/node_modules/eslint/lib/source-code/source-code.js index 88a9c0a4e431c8..42e7b0c2f475e4 100644 --- a/tools/node_modules/eslint/lib/source-code/source-code.js +++ b/tools/node_modules/eslint/lib/source-code/source-code.js @@ -93,7 +93,6 @@ class SourceCode extends TokenStore { * @param {ScopeManager|null} textOrConfig.scopeManager - The scope of this source code. * @param {Object|null} textOrConfig.visitorKeys - The visitor keys to traverse AST. * @param {ASTNode} [astIfNoConfig] - The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. - * @constructor */ constructor(textOrConfig, astIfNoConfig) { let text, ast, parserServices, scopeManager, visitorKeys; @@ -206,9 +205,9 @@ class SourceCode extends TokenStore { /** * Gets the source code for the given node. - * @param {ASTNode=} node The AST node to get the text for. - * @param {int=} beforeCount The number of characters before the node to retrieve. - * @param {int=} afterCount The number of characters after the node to retrieve. + * @param {ASTNode} [node] The AST node to get the text for. + * @param {int} [beforeCount] The number of characters before the node to retrieve. + * @param {int} [afterCount] The number of characters after the node to retrieve. * @returns {string} The text representing the AST node. * @public */ diff --git a/tools/node_modules/eslint/node_modules/acorn/README.md b/tools/node_modules/eslint/node_modules/acorn/README.md index 9b7c0badb1084d..585f2736fc05b5 100644 --- a/tools/node_modules/eslint/node_modules/acorn/README.md +++ b/tools/node_modules/eslint/node_modules/acorn/README.md @@ -52,9 +52,10 @@ Options can be provided by passing a second argument, which should be an object containing any of these fields: - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be - either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial - support). This influences support for strict mode, the set of - reserved words, and support for new syntax features. Default is 10. + either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11 + (2020, partial support). This influences support for strict mode, + the set of reserved words, and support for new syntax features. + Default is 10. **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being implemented by Acorn. Other proposed new features can be implemented diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js index e4d9e76eb7b5d5..c9209c0f6cbdc4 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js @@ -2173,7 +2173,7 @@ // super [ Expression ] // super . IdentifierName // SuperCall: - // super Arguments + // super ( Arguments ) if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL) { this.unexpected(); } return this.finishNode(node, "Super") @@ -2468,7 +2468,7 @@ while (!this.eat(types.braceR)) { if (!first) { this.expect(types.comma); - if (this.afterTrailingComma(types.braceR)) { break } + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break } } else { first = false; } var prop = this.parseProperty(isPattern, refDestructuringErrors); @@ -4923,7 +4923,29 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript. - var version = "7.0.0"; + var version = "7.1.0"; + + Parser.acorn = { + Parser: Parser, + version: version, + defaultOptions: defaultOptions, + Position: Position, + SourceLocation: SourceLocation, + getLineInfo: getLineInfo, + Node: Node, + TokenType: TokenType, + tokTypes: types, + keywordTypes: keywords$1, + TokContext: TokContext, + tokContexts: types$1, + isIdentifierChar: isIdentifierChar, + isIdentifierStart: isIdentifierStart, + Token: Token, + isNewLine: isNewLine, + lineBreak: lineBreak, + lineBreakG: lineBreakG, + nonASCIIwhitespace: nonASCIIwhitespace + }; // The main exported interface (under `self.acorn` when in the // browser) is a `parse` function that takes a code string and diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs index 3e8e6f19fa4dcd..7e6aa1f70f6b57 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs @@ -2167,7 +2167,7 @@ pp$3.parseExprAtom = function(refDestructuringErrors) { // super [ Expression ] // super . IdentifierName // SuperCall: - // super Arguments + // super ( Arguments ) if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL) { this.unexpected(); } return this.finishNode(node, "Super") @@ -2462,7 +2462,7 @@ pp$3.parseObj = function(isPattern, refDestructuringErrors) { while (!this.eat(types.braceR)) { if (!first) { this.expect(types.comma); - if (this.afterTrailingComma(types.braceR)) { break } + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break } } else { first = false; } var prop = this.parseProperty(isPattern, refDestructuringErrors); @@ -4917,7 +4917,29 @@ pp$9.readWord = function() { // Acorn is a tiny, fast JavaScript parser written in JavaScript. -var version = "7.0.0"; +var version = "7.1.0"; + +Parser.acorn = { + Parser: Parser, + version: version, + defaultOptions: defaultOptions, + Position: Position, + SourceLocation: SourceLocation, + getLineInfo: getLineInfo, + Node: Node, + TokenType: TokenType, + tokTypes: types, + keywordTypes: keywords$1, + TokContext: TokContext, + tokContexts: types$1, + isIdentifierChar: isIdentifierChar, + isIdentifierStart: isIdentifierStart, + Token: Token, + isNewLine: isNewLine, + lineBreak: lineBreak, + lineBreakG: lineBreakG, + nonASCIIwhitespace: nonASCIIwhitespace +}; // The main exported interface (under `self.acorn` when in the // browser) is a `parse` function that takes a code string and diff --git a/tools/node_modules/eslint/node_modules/acorn/package.json b/tools/node_modules/eslint/node_modules/acorn/package.json index 46baa1e126513a..9fe1c550ef91c1 100644 --- a/tools/node_modules/eslint/node_modules/acorn/package.json +++ b/tools/node_modules/eslint/node_modules/acorn/package.json @@ -39,5 +39,5 @@ "scripts": { "prepare": "cd ..; npm run build:main && npm run build:bin" }, - "version": "7.0.0" + "version": "7.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/glob-parent/README.md b/tools/node_modules/eslint/node_modules/glob-parent/README.md index c7fbe3202264a2..36a279384b14a8 100644 --- a/tools/node_modules/eslint/node_modules/glob-parent/README.md +++ b/tools/node_modules/eslint/node_modules/glob-parent/README.md @@ -36,10 +36,19 @@ globParent('path/foo'); // 'path' (see issue #3 for details) ## API -### `globParent(maybeGlobString)` +### `globParent(maybeGlobString, [options])` Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. +#### options + +```js +{ + // Disables the automatic conversion of slashes for Windows + flipBackslashes: true +} +``` + ## Escaping The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: diff --git a/tools/node_modules/eslint/node_modules/glob-parent/index.js b/tools/node_modules/eslint/node_modules/glob-parent/index.js index 900d3fbe3bd1af..2ded6ea7e63ba0 100644 --- a/tools/node_modules/eslint/node_modules/glob-parent/index.js +++ b/tools/node_modules/eslint/node_modules/glob-parent/index.js @@ -10,9 +10,16 @@ var enclosure = /[\{\[].*[\/]*.*[\}\]]$/; var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; var escaped = /\\([\*\?\|\[\]\(\)\{\}])/g; -module.exports = function globParent(str) { +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + // flip windows path separators - if (isWin32 && str.indexOf(slash) < 0) { + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { str = str.replace(backslash, slash); } diff --git a/tools/node_modules/eslint/node_modules/glob-parent/package.json b/tools/node_modules/eslint/node_modules/glob-parent/package.json index f59d1f99f39cda..af850b522587b3 100644 --- a/tools/node_modules/eslint/node_modules/glob-parent/package.json +++ b/tools/node_modules/eslint/node_modules/glob-parent/package.json @@ -63,5 +63,5 @@ "pretest": "npm run lint", "test": "nyc mocha --async-only" }, - "version": "5.0.0" + "version": "5.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 2fa34e93727013..b57c88bc36455b 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -17,7 +17,7 @@ "cross-spawn": "^6.0.5", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-plugin-markdown": "1.0.0", + "eslint-plugin-markdown": "^1.0.0", "eslint-scope": "^5.0.0", "eslint-utils": "^1.4.2", "eslint-visitor-keys": "^1.1.0", @@ -67,6 +67,7 @@ "eslint-config-eslint": "file:packages/eslint-config-eslint", "eslint-plugin-eslint-plugin": "^2.0.1", "eslint-plugin-internal-rules": "file:tools/internal-rules", + "eslint-plugin-jsdoc": "^15.9.5", "eslint-plugin-node": "^9.0.0", "eslint-release": "^1.2.0", "eslump": "^2.0.0", @@ -137,6 +138,7 @@ }, "scripts": { "docs": "node Makefile.js docs", + "fix": "node Makefile.js lint -- fix", "fuzz": "node Makefile.js fuzz", "generate-alpharelease": "node Makefile.js generatePrerelease -- alpha", "generate-betarelease": "node Makefile.js generatePrerelease -- beta", @@ -149,5 +151,5 @@ "test": "node Makefile.js test", "webpack": "node Makefile.js webpack" }, - "version": "6.4.0" + "version": "6.5.1" } \ No newline at end of file From bf1727a3f3a09f6ae3189af61e75ade82cfa0b24 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sat, 28 Sep 2019 09:48:33 +0200 Subject: [PATCH 28/65] test: add test for writable.write() argument types PR-URL: https://github.com/nodejs/node/pull/29746 Reviewed-By: Matteo Collina Reviewed-By: Rich Trott --- .../test-stream-writable-invalid-chunk.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/parallel/test-stream-writable-invalid-chunk.js diff --git a/test/parallel/test-stream-writable-invalid-chunk.js b/test/parallel/test-stream-writable-invalid-chunk.js new file mode 100644 index 00000000000000..09ee5877c8d00c --- /dev/null +++ b/test/parallel/test-stream-writable-invalid-chunk.js @@ -0,0 +1,35 @@ +'use strict'; + +const common = require('../common'); +const stream = require('stream'); + +function testWriteType(val, objectMode, code) { + const writable = new stream.Writable({ + objectMode, + write: () => {} + }); + if (!code) { + writable.on('error', common.mustNotCall()); + } else { + writable.on('error', common.expectsError({ + code: code, + })); + } + writable.write(val); +} + +testWriteType([], false, 'ERR_INVALID_ARG_TYPE'); +testWriteType({}, false, 'ERR_INVALID_ARG_TYPE'); +testWriteType(0, false, 'ERR_INVALID_ARG_TYPE'); +testWriteType(true, false, 'ERR_INVALID_ARG_TYPE'); +testWriteType(0.0, false, 'ERR_INVALID_ARG_TYPE'); +testWriteType(undefined, false, 'ERR_INVALID_ARG_TYPE'); +testWriteType(null, false, 'ERR_STREAM_NULL_VALUES'); + +testWriteType([], true); +testWriteType({}, true); +testWriteType(0, true); +testWriteType(true, true); +testWriteType(0.0, true); +testWriteType(undefined, true); +testWriteType(null, true, 'ERR_STREAM_NULL_VALUES'); From 87fb1c297adb2a8b2cd5e7441f9447329af1584f Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 23 Sep 2019 17:22:10 +0200 Subject: [PATCH 29/65] errors: make sure all Node.js errors show their properties This improves Node.js errors by always showing the attached properties when inspecting such an error. This applies especially to SystemError. It did often not show any properties but now all properties will be visible. This is done in a mainly backwards compatible way. Instead of using prototype getters and setters, the property is now set directly on the error. PR-URL: https://github.com/nodejs/node/pull/29677 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum --- lib/internal/errors.js | 139 +++++++++--------- test/message/internal_assert.out | 4 +- test/message/internal_assert_fail.out | 4 +- .../parallel/test-dgram-socket-buffer-size.js | 23 ++- test/parallel/test-internal-errors.js | 12 +- test/parallel/test-repl-top-level-await.js | 6 +- 6 files changed, 103 insertions(+), 85 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 6c7c94c484add3..99ccec9109a650 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -12,8 +12,6 @@ const { Object, Math } = primordials; -const kCode = Symbol('code'); -const kInfo = Symbol('info'); const messages = new Map(); const codes = {}; @@ -121,76 +119,86 @@ class SystemError extends Error { writable: true, configurable: true }); - Object.defineProperty(this, kInfo, { - configurable: false, - enumerable: false, - value: context - }); - Object.defineProperty(this, kCode, { - configurable: true, - enumerable: false, - value: key, - writable: true - }); addCodeToName(this, 'SystemError', key); - } - get code() { - return this[kCode]; - } + this.code = key; - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, + Object.defineProperty(this, 'info', { + value: context, enumerable: true, - value, - writable: true + configurable: true, + writable: false }); - } - - get info() { - return this[kInfo]; - } - get errno() { - return this[kInfo].errno; - } - - set errno(val) { - this[kInfo].errno = val; - } - - get syscall() { - return this[kInfo].syscall; - } - - set syscall(val) { - this[kInfo].syscall = val; - } - - get path() { - return this[kInfo].path !== undefined ? - this[kInfo].path.toString() : undefined; - } + Object.defineProperty(this, 'errno', { + get() { + return context.errno; + }, + set: (value) => { + context.errno = value; + }, + enumerable: true, + configurable: true + }); - set path(val) { - this[kInfo].path = val ? - lazyBuffer().from(val.toString()) : undefined; - } + Object.defineProperty(this, 'syscall', { + get() { + return context.syscall; + }, + set: (value) => { + context.syscall = value; + }, + enumerable: true, + configurable: true + }); - get dest() { - return this[kInfo].path !== undefined ? - this[kInfo].dest.toString() : undefined; - } + if (context.path !== undefined) { + // TODO(BridgeAR): Investigate why and when the `.toString()` was + // introduced. The `path` and `dest` properties in the context seem to + // always be of type string. We should probably just remove the + // `.toString()` and `Buffer.from()` operations and set the value on the + // context as the user did. + Object.defineProperty(this, 'path', { + get() { + return context.path != null ? + context.path.toString() : context.path; + }, + set: (value) => { + context.path = value ? + lazyBuffer().from(value.toString()) : undefined; + }, + enumerable: true, + configurable: true + }); + } - set dest(val) { - this[kInfo].dest = val ? - lazyBuffer().from(val.toString()) : undefined; + if (context.dest !== undefined) { + Object.defineProperty(this, 'dest', { + get() { + return context.dest != null ? + context.dest.toString() : context.dest; + }, + set: (value) => { + context.dest = value ? + lazyBuffer().from(value.toString()) : undefined; + }, + enumerable: true, + configurable: true + }); + } } toString() { return `${this.name} [${this.code}]: ${this.message}`; } + + [Symbol.for('nodejs.util.inspect.custom')](recurseTimes, ctx) { + return lazyInternalUtilInspect().inspect(this, { + ...ctx, + getters: true, + customInspect: false + }); + } } function makeSystemErrorWithCode(key) { @@ -221,19 +229,7 @@ function makeNodeErrorWithCode(Base, key) { configurable: true }); addCodeToName(this, super.name, key); - } - - get code() { - return key; - } - - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }); + this.code = key; } toString() { @@ -394,7 +390,6 @@ function uvException(ctx) { err[prop] = ctx[prop]; } - // TODO(BridgeAR): Show the `code` property as part of the stack. err.code = code; if (path) { err.path = path; diff --git a/test/message/internal_assert.out b/test/message/internal_assert.out index ae8de3e1a0dff5..cf09fdcb605269 100644 --- a/test/message/internal_assert.out +++ b/test/message/internal_assert.out @@ -12,4 +12,6 @@ Please open an issue with this stack trace at https://github.com/nodejs/node/iss at * at * at * - at * + at * { + code: 'ERR_INTERNAL_ASSERTION' +} diff --git a/test/message/internal_assert_fail.out b/test/message/internal_assert_fail.out index 70f49ad33aa26d..11b532b7b2af3c 100644 --- a/test/message/internal_assert_fail.out +++ b/test/message/internal_assert_fail.out @@ -13,4 +13,6 @@ Please open an issue with this stack trace at https://github.com/nodejs/node/iss at * at * at * - at * + at * { + code: 'ERR_INTERNAL_ASSERTION' +} diff --git a/test/parallel/test-dgram-socket-buffer-size.js b/test/parallel/test-dgram-socket-buffer-size.js index c2936ba8fd91b0..d3317e85c3d1b6 100644 --- a/test/parallel/test-dgram-socket-buffer-size.js +++ b/test/parallel/test-dgram-socket-buffer-size.js @@ -4,6 +4,7 @@ const common = require('../common'); const assert = require('assert'); const dgram = require('dgram'); +const { inspect } = require('util'); const { SystemError } = require('internal/errors'); const { internalBinding } = require('internal/test/binding'); const { @@ -22,7 +23,7 @@ function getExpectedError(type) { 'ENOTSOCK (socket operation on non-socket)' : 'EBADF (bad file descriptor)'; const error = { code: 'ERR_SOCKET_BUFFER_SIZE', - type: SystemError, + name: 'SystemError', message: `Could not get or set buffer size: ${syscall} returned ${suffix}`, info: { code, @@ -40,9 +41,25 @@ function getExpectedError(type) { const socket = dgram.createSocket('udp4'); - common.expectsError(() => { + assert.throws(() => { socket.setSendBufferSize(8192); - }, errorObj); + }, (err) => { + assert.strictEqual( + inspect(err).replace(/^ +at .*\n/gm, ''), + `SystemError [ERR_SOCKET_BUFFER_SIZE]: ${errorObj.message}\n` + + " code: 'ERR_SOCKET_BUFFER_SIZE',\n" + + ' info: {\n' + + ` errno: ${errorObj.info.errno},\n` + + ` code: '${errorObj.info.code}',\n` + + ` message: '${errorObj.info.message}',\n` + + ` syscall: '${errorObj.info.syscall}'\n` + + ' },\n' + + ` errno: [Getter/Setter: ${errorObj.info.errno}],\n` + + ` syscall: [Getter/Setter: '${errorObj.info.syscall}']\n` + + '}' + ); + return true; + }); common.expectsError(() => { socket.getSendBufferSize(); diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index 10d79cb8fafef2..a34218fd1dd688 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -82,9 +82,9 @@ common.expectsError(() => { { const myError = new errors.codes.TEST_ERROR_1('foo'); assert.strictEqual(myError.code, 'TEST_ERROR_1'); - assert.strictEqual(myError.hasOwnProperty('code'), false); + assert.strictEqual(myError.hasOwnProperty('code'), true); assert.strictEqual(myError.hasOwnProperty('name'), false); - assert.deepStrictEqual(Object.keys(myError), []); + assert.deepStrictEqual(Object.keys(myError), ['code']); const initialName = myError.name; myError.code = 'FHQWHGADS'; assert.strictEqual(myError.code, 'FHQWHGADS'); @@ -99,11 +99,11 @@ common.expectsError(() => { // browser. Note that `name` becomes enumerable after being assigned. { const myError = new errors.codes.TEST_ERROR_1('foo'); - assert.deepStrictEqual(Object.keys(myError), []); + assert.deepStrictEqual(Object.keys(myError), ['code']); const initialToString = myError.toString(); myError.name = 'Fhqwhgads'; - assert.deepStrictEqual(Object.keys(myError), ['name']); + assert.deepStrictEqual(Object.keys(myError), ['code', 'name']); assert.notStrictEqual(myError.toString(), initialToString); } @@ -114,7 +114,7 @@ common.expectsError(() => { let initialConsoleLog = ''; hijackStdout((data) => { initialConsoleLog += data; }); const myError = new errors.codes.TEST_ERROR_1('foo'); - assert.deepStrictEqual(Object.keys(myError), []); + assert.deepStrictEqual(Object.keys(myError), ['code']); const initialToString = myError.toString(); console.log(myError); assert.notStrictEqual(initialConsoleLog, ''); @@ -124,7 +124,7 @@ common.expectsError(() => { let subsequentConsoleLog = ''; hijackStdout((data) => { subsequentConsoleLog += data; }); myError.message = 'Fhqwhgads'; - assert.deepStrictEqual(Object.keys(myError), []); + assert.deepStrictEqual(Object.keys(myError), ['code']); assert.notStrictEqual(myError.toString(), initialToString); console.log(myError); assert.strictEqual(subsequentConsoleLog, initialConsoleLog); diff --git a/test/parallel/test-repl-top-level-await.js b/test/parallel/test-repl-top-level-await.js index f72a5daa01581f..f629d3f1d0d428 100644 --- a/test/parallel/test-repl-top-level-await.js +++ b/test/parallel/test-repl-top-level-await.js @@ -161,8 +161,10 @@ async function ctrlCTest() { ]), [ 'await timeout(100000)\r', 'Thrown:', - 'Error [ERR_SCRIPT_EXECUTION_INTERRUPTED]: ' + - 'Script execution was interrupted by `SIGINT`', + '[Error [ERR_SCRIPT_EXECUTION_INTERRUPTED]: ' + + 'Script execution was interrupted by `SIGINT`] {', + " code: 'ERR_SCRIPT_EXECUTION_INTERRUPTED'", + '}', PROMPT ]); } From ab4c53e0ef6704b6c526bb8ee0cdc9e5aa896c92 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 1 Oct 2019 13:59:25 +0200 Subject: [PATCH 30/65] crypto: remove arbitrary UTF16 restriction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 71f633a32f1f5617, this is no longer necessary. Refs: https://github.com/nodejs/node/pull/22622 Fixes: https://github.com/nodejs/node/issues/29793 PR-URL: https://github.com/nodejs/node/pull/29795 Reviewed-By: Michaël Zasso Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: David Carlier --- doc/api/errors.md | 20 ++++++++++++-------- lib/internal/crypto/hash.js | 11 ++++------- lib/internal/errors.js | 2 -- src/node_crypto.cc | 1 - test/parallel/test-crypto-hash.js | 10 +++------- test/parallel/test-crypto-hmac.js | 9 +++------ 6 files changed, 22 insertions(+), 31 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index f479d06f1456fb..2ba78a95cf2550 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -763,14 +763,6 @@ to enable or disable FIPS mode in the `crypto` module. An attempt was made to enable or disable FIPS mode, but FIPS mode was not available. - -### ERR_CRYPTO_HASH_DIGEST_NO_UTF16 - -The UTF-16 encoding was used with [`hash.digest()`][]. While the -`hash.digest()` method does allow an `encoding` argument to be passed in, -causing the method to return a string rather than a `Buffer`, the UTF-16 -encoding (e.g. `ucs` or `utf16le`) is not supported. - ### ERR_CRYPTO_HASH_FINALIZED @@ -2070,6 +2062,18 @@ removed: v11.12.0 There was an attempt to use a `MessagePort` instance in a closed state, usually after `.close()` has been called. + +### ERR_CRYPTO_HASH_DIGEST_NO_UTF16 + + +The UTF-16 encoding was used with [`hash.digest()`][]. While the +`hash.digest()` method does allow an `encoding` argument to be passed in, +causing the method to return a string rather than a `Buffer`, the UTF-16 +encoding (e.g. `ucs` or `utf16le`) is not supported. + ### ERR_HTTP2_FRAME_ERROR +> Stability: 0 - Deprecated: Use `assert.fail([message])` or other assert +> functions instead. + * `actual` {any} * `expected` {any} * `message` {string|Error} * `operator` {string} **Default:** `'!='` * `stackStartFn` {Function} **Default:** `assert.fail` -> Stability: 0 - Deprecated: Use `assert.fail([message])` or other assert -> functions instead. - If `message` is falsy, the error message is set as the values of `actual` and `expected` separated by the provided `operator`. If just the two `actual` and `expected` arguments are provided, `operator` will default to `'!='`. If diff --git a/doc/api/events.md b/doc/api/events.md index 9b22d33e12caa0..608d7d09e04cf0 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -229,11 +229,11 @@ added: v0.9.12 deprecated: v4.0.0 --> +> Stability: 0 - Deprecated: Use [`emitter.listenerCount()`][] instead. + * `emitter` {EventEmitter} The emitter to query * `eventName` {string|symbol} The event name -> Stability: 0 - Deprecated: Use [`emitter.listenerCount()`][] instead. - A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`. diff --git a/doc/api/modules.md b/doc/api/modules.md index 6225f41cad8365..32490cf47f1792 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -970,12 +970,12 @@ added: v10.12.0 deprecated: v12.2.0 --> +> Stability: 0 - Deprecated: Please use [`createRequire()`][] instead. + * `filename` {string} Filename to be used to construct the relative require function. * Returns: {require} Require function -> Stability: 0 - Deprecated: Please use [`createRequire()`][] instead. - ```js const { createRequireFromPath } = require('module'); const requireUtil = createRequireFromPath('../src/utils/'); diff --git a/doc/api/repl.md b/doc/api/repl.md index 573fbb6af422a6..d4a207dc493373 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -482,12 +482,12 @@ added: v0.8.9 deprecated: v9.0.0 --> +> Stability: 0 - Deprecated. + * `keyword` {string} the potential keyword to parse and execute * `rest` {any} any parameters to the keyword command * Returns: {boolean} -> Stability: 0 - Deprecated. - An internal method used to parse and execute `REPLServer` keywords. Returns `true` if `keyword` is a valid keyword, otherwise `false`. diff --git a/doc/api/util.md b/doc/api/util.md index f00cf9e58c3010..d158fbd1a832d7 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1766,11 +1766,11 @@ added: v0.7.5 deprecated: v6.0.0 --> +> Stability: 0 - Deprecated: Use [`Object.assign()`] instead. + * `target` {Object} * `source` {Object} -> Stability: 0 - Deprecated: Use [`Object.assign()`] instead. - The `util._extend()` method was never intended to be used outside of internal Node.js modules. The community found and used it anyway. From 20896f74d615a23ba11787f36355d96470ba098b Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 1 Oct 2019 21:36:56 +0800 Subject: [PATCH 33/65] n-api,doc: clarify napi_finalize related APIs All these APIs have napi_finalize parameter but they don't behave exactly the same. Fixes: https://github.com/nodejs/node/issues/29750 PR-URL: https://github.com/nodejs/node/pull/29797 Reviewed-By: Gabriel Schulhof Reviewed-By: Rich Trott Reviewed-By: Michael Dawson --- doc/api/n-api.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 6ae0f44643c3b1..ec9af50ee15284 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1809,9 +1809,15 @@ Returns `napi_ok` if the API succeeded. This API allocates a JavaScript value with external data attached to it. This is used to pass external data through JavaScript code, so it can be retrieved -later by native code. The API allows the caller to pass in a finalize callback, -in case the underlying native resource needs to be cleaned up when the external -JavaScript value gets collected. +later by native code using [`napi_get_value_external`]. + +The API adds a `napi_finalize` callback which will be called when the JavaScript +object just created is ready for garbage collection. It is similar to +`napi_wrap()` except that: + +* the native data cannot be retrieved later using `napi_unwrap()`, +* nor can it be removed later using `napi_remove_wrap()`, and +* the object created by the API can be used with `napi_wrap()`. The created value is not an object, and therefore does not support additional properties. It is considered a distinct value type: calling `napi_typeof()` with @@ -1850,6 +1856,14 @@ The underlying byte buffer of the `ArrayBuffer` is externally allocated and managed. The caller must ensure that the byte buffer remains valid until the finalize callback is called. +The API adds a `napi_finalize` callback which will be called when the JavaScript +object just created is ready for garbage collection. It is similar to +`napi_wrap()` except that: + +* the native data cannot be retrieved later using `napi_unwrap()`, +* nor can it be removed later using `napi_remove_wrap()`, and +* the object created by the API can be used with `napi_wrap()`. + JavaScript `ArrayBuffer`s are described in [Section 24.1][] of the ECMAScript Language Specification. @@ -1884,6 +1898,14 @@ This API allocates a `node::Buffer` object and initializes it with data backed by the passed in buffer. While this is still a fully-supported data structure, in most cases using a `TypedArray` will suffice. +The API adds a `napi_finalize` callback which will be called when the JavaScript +object just created is ready for garbage collection. It is similar to +`napi_wrap()` except that: + +* the native data cannot be retrieved later using `napi_unwrap()`, +* nor can it be removed later using `napi_remove_wrap()`, and +* the object created by the API can be used with `napi_wrap()`. + For Node.js >=4 `Buffers` are `Uint8Array`s. #### napi_create_object @@ -4228,7 +4250,8 @@ in `js_object` is ready for garbage collection. This API is similar to * the native data cannot be retrieved later using `napi_unwrap()`, * nor can it be removed later using `napi_remove_wrap()`, and * the API can be called multiple times with different data items in order to - attach each of them to the JavaScript object. + attach each of them to the JavaScript object, and +* the object manipulated by the API can be used with `napi_wrap()`. *Caution*: The optional returned reference (if obtained) should be deleted via [`napi_delete_reference`][] ONLY in response to the finalize callback @@ -5164,6 +5187,7 @@ This API may only be called from the main thread. [`napi_get_last_error_info`]: #n_api_napi_get_last_error_info [`napi_get_property`]: #n_api_napi_get_property [`napi_get_reference_value`]: #n_api_napi_get_reference_value +[`napi_get_value_external`]: #n_api_napi_get_value_external [`napi_has_own_property`]: #n_api_napi_has_own_property [`napi_has_property`]: #n_api_napi_has_property [`napi_is_error`]: #n_api_napi_is_error From 65c475269edc38e310e814947cf913989d268665 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 1 Oct 2019 20:21:22 +0200 Subject: [PATCH 34/65] net: emit close on unconnected socket Socket should always emit 'close'. Regardless whether it has been connected or not. PR-URL: https://github.com/nodejs/node/pull/29803 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: Minwoo Jung --- lib/net.js | 6 ++++-- test/parallel/test-net-connect-destroy.js | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-net-connect-destroy.js diff --git a/lib/net.js b/lib/net.js index 760bf084f4d324..baaf2180d1b463 100644 --- a/lib/net.js +++ b/lib/net.js @@ -660,10 +660,12 @@ Socket.prototype._destroy = function(exception, cb) { this._handle.onread = noop; this._handle = null; this._sockname = null; + cb(exception); + } else { + cb(exception); + process.nextTick(emitCloseNT, this); } - cb(exception); - if (this._server) { debug('has server'); this._server._connections--; diff --git a/test/parallel/test-net-connect-destroy.js b/test/parallel/test-net-connect-destroy.js new file mode 100644 index 00000000000000..73fdb988f9ca83 --- /dev/null +++ b/test/parallel/test-net-connect-destroy.js @@ -0,0 +1,7 @@ +'use strict'; +const common = require('../common'); +const net = require('net'); + +const socket = new net.Socket(); +socket.on('close', common.mustCall()); +socket.destroy(); From d09f2b4170a20e3a7cd8d83d97143257786577f2 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 30 Sep 2019 13:14:18 -0400 Subject: [PATCH 35/65] build: build docs on Travis PR-URL: https://github.com/nodejs/node/pull/29783 Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3cf371831765a..93456573438b1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,14 +74,14 @@ jobs: - make -j1 V=1 test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp - python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare addons js-native-api node-api - - name: "Linter" + - name: "Run Linter and Build Docs" language: node_js node_js: "node" install: - pyenv global ${PYTHON_VERSION} - make lint-py-build || true script: - - NODE=$(which node) make lint lint-py + - NODE=$(which node) make lint-py doc-only lint - name: "First commit message adheres to guidelines at https://goo.gl/p2fr5Q" if: type = pull_request From a00cd17b9e517784130ab1244bdca6058def5393 Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 1 Oct 2019 14:19:26 +0800 Subject: [PATCH 36/65] doc: reuse link indexes for n-api.md PR-URL: https://github.com/nodejs/node/pull/29787 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Gabriel Schulhof Reviewed-By: Michael Dawson --- doc/api/n-api.md | 98 ++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index ec9af50ee15284..1aa05b9bc8bf2c 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -37,8 +37,7 @@ properties: The N-API is a C API that ensures ABI stability across Node.js versions and different compiler levels. A C++ API can be easier to use. To support using C++, the project maintains a -C++ wrapper module called -[node-addon-api](https://github.com/nodejs/node-addon-api). +C++ wrapper module called [node-addon-api][]. This wrapper provides an inlineable C++ API. Binaries built with `node-addon-api` will depend on the symbols for the N-API C-based functions exported by Node.js. `node-addon-api` is a more @@ -1557,8 +1556,7 @@ API. ## Working with JavaScript Values N-API exposes a set of APIs to create all types of JavaScript values. -Some of these types are documented under -[Section 6](https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values) +Some of these types are documented under [Section 6][] of the [ECMAScript Language Specification][]. Fundamentally, these APIs are used to do one of the following: @@ -1594,9 +1592,7 @@ typedef enum { ``` Describes the type of a `napi_value`. This generally corresponds to the types -described in -[Section 6.1](https://tc39.github.io/ecma262/#sec-ecmascript-language-types) of -the ECMAScript Language Specification. +described in [Section 6.1][] of the ECMAScript Language Specification. In addition to types in that section, `napi_valuetype` can also represent `Function`s and `Object`s with external data. @@ -1926,8 +1922,7 @@ Returns `napi_ok` if the API succeeded. This API allocates a default JavaScript `Object`. It is the equivalent of doing `new Object()` in JavaScript. -The JavaScript `Object` type is described in -[Section 6.1.7](https://tc39.github.io/ecma262/#sec-object-type) of the +The JavaScript `Object` type is described in [Section 6.1.7][] of the ECMAScript Language Specification. #### napi_create_symbol @@ -1951,8 +1946,7 @@ Returns `napi_ok` if the API succeeded. This API creates a JavaScript `Symbol` object from a UTF8-encoded C string. -The JavaScript `Symbol` type is described in -[Section 19.4](https://tc39.github.io/ecma262/#sec-symbol-objects) +The JavaScript `Symbol` type is described in [Section 19.4][] of the ECMAScript Language Specification. #### napi_create_typedarray @@ -2093,11 +2087,8 @@ This API is used to convert from the C `int64_t` type to the JavaScript The JavaScript `Number` type is described in [Section 6.1.6][] of the ECMAScript Language Specification. Note the complete range of `int64_t` cannot be represented with full precision in JavaScript. Integer values -outside the range of -[`Number.MIN_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.min_safe_integer) --(2^53 - 1) - -[`Number.MAX_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.max_safe_integer) -(2^53 - 1) will lose precision. +outside the range of [`Number.MIN_SAFE_INTEGER`][] `-(2^53 - 1)` - +[`Number.MAX_SAFE_INTEGER`][] `(2^53 - 1)` will lose precision. #### napi_create_double * `name` {string} -* Returns: {DiffieHellman} +* Returns: {DiffieHellmanGroup} An alias for [`crypto.getDiffieHellman()`][] @@ -2194,9 +2194,9 @@ added: v0.7.5 --> * `groupName` {string} -* Returns: {DiffieHellman} +* Returns: {DiffieHellmanGroup} -Creates a predefined `DiffieHellman` key exchange object. The +Creates a predefined `DiffieHellmanGroup` key exchange object. The supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC 2412][], but see [Caveats][]) and `'modp14'`, `'modp15'`, `'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526][]). The diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 35039b68d95c8f..4c3ec0503e7701 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -52,6 +52,7 @@ const customTypesMap = { 'Cipher': 'crypto.html#crypto_class_cipher', 'Decipher': 'crypto.html#crypto_class_decipher', 'DiffieHellman': 'crypto.html#crypto_class_diffiehellman', + 'DiffieHellmanGroup': 'crypto.html#crypto_class_diffiehellmangroup', 'ECDH': 'crypto.html#crypto_class_ecdh', 'Hash': 'crypto.html#crypto_class_hash', 'Hmac': 'crypto.html#crypto_class_hmac', From ea9bf4a666a8073bbecff39135c3bc5d1259b256 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 23 Sep 2019 16:04:11 +0300 Subject: [PATCH 38/65] doc: implement minor CSS improvements * split selectors to one per line * remove units from 0 * use double colon pseudo selectors consistently * use `background-color` instead of the `background` shorthand since only the color is supposed to change * remove leading zeros from numbers * remove redundant values from shorthands * use lowercase hex for colors * use numeric values for `font-weight` PR-URL: https://github.com/nodejs/node/pull/29669 Reviewed-By: Benjamin Gruenbaum --- doc/api_assets/style.css | 196 ++++++++++++++++++++++++--------------- 1 file changed, 122 insertions(+), 74 deletions(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index bdef22b04f78c9..4f1f5c93840626 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -13,28 +13,38 @@ html { } body { - font-family: "Lato", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif; + font-family: Lato, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif; margin: 0; padding: 0; color: #333; - background: #fff; -} - -h1 { font-size: 2.5rem } -h2 { font-size: 2rem } -h3 { font-size: 1.75rem } -h4 { font-size: 1.5rem } -h5 { font-size: 1.25rem } -h6 { font-size: 1rem } - -h1, h2, h3, h4, h5, h6 { + background-color: #fff; +} + +h1 { font-size: 2.5rem; } +h2 { font-size: 2rem; } +h3 { font-size: 1.75rem; } +h4 { font-size: 1.5rem; } +h5 { font-size: 1.25rem; } +h6 { font-size: 1rem; } + +h1, +h2, +h3, +h4, +h5, +h6 { margin: 1.5rem 0 1rem; text-rendering: optimizeLegibility; font-weight: 700; position: relative; } -pre, tt, code, .pre, span.type, a.type { +pre, +tt, +code, +.pre, +span.type, +a.type { font-family: SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace; font-size: .9em; } @@ -43,14 +53,17 @@ pre, tt, code, .pre, span.type, a.type { position: relative; } -a, a:link, a:active { +a, +a:link, +a:active { color: #43853d; text-decoration: none; border-radius: 2px; padding: 1px 3px; } -a:hover, a:focus { +a:hover, +a:focus { color: #fff; background-color: #43853d; outline: none; @@ -61,7 +74,7 @@ strong { } code a:hover { - background: none; + background-color: transparent; } em code { @@ -86,8 +99,8 @@ em code { #gtoc > ul > li { display: inline; border-right: 1px #000 solid; - margin-right: 0.4rem; - padding-right: 0.4rem; + margin-right: .4rem; + padding-right: .4rem; } #gtoc > ul > li:last-child { @@ -114,8 +127,8 @@ li.version-picker a span { } ol.version-picker { - background: #fff; - border: 1px #43853d solid; + background-color: #fff; + border: 1px solid #43853d; border-radius: 0 0 2px 2px; display: none; list-style: none; @@ -151,39 +164,40 @@ ol.version-picker li:last-child a { } .api_stability { - color: white !important; - margin: 0 0 1rem 0; - font-family: "Lato", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif; + color: #fff !important; + margin: 0 0 1rem; padding: 1rem; line-height: 1.5; } .api_stability * { - color: white !important; + color: #fff !important; } .api_stability a { text-decoration: underline; } -.api_stability a:hover, .api_stability a:active, .api_stability a:focus { - background: rgba(255, 255, 255, .4); +.api_stability a:hover, +.api_stability a:active, +.api_stability a:focus { + background-color: rgba(255, 255, 255, .4); } .api_stability a code { - background: none; + background-color: transparent; } .api_stability_0 { - background-color: #D60027; + background-color: #d60027; } .api_stability_1 { - background-color: #EC5315; + background-color: #ec5315; } .api_stability_2 { - background-color: #4EBA0F; + background-color: #4eba0f; } .api_metadata { @@ -196,7 +210,7 @@ ol.version-picker li:last-child a { } .api_metadata span:last-child { - margin-right: 0px; + margin-right: 0; } ul.plain { @@ -209,7 +223,7 @@ abbr { p { text-rendering: optimizeLegibility; - margin: 0 0 1.125rem 0; + margin: 0 0 1.125rem; line-height: 1.5; } @@ -220,29 +234,41 @@ p { table { border-collapse: collapse; - margin: 0 0 1.5rem 0; + margin: 0 0 1.5rem; } -th, td { +th, +td { border: 1px solid #aaa; - padding: .75rem 1rem .75rem 1rem; + padding: .75rem 1rem; vertical-align: top; } th { - text-align:left; + text-align: left; } -ol, ul, dl { - margin: 0 0 .6rem 0; +ol, +ul, +dl { + margin: 0 0 .6rem; padding: 0; } -ol ul, ol ol, ol dl, ul ul, ul ol, ul dl, dl ul, dl ol, dl dl { +ol ul, +ol ol, +ol dl, +ul ul, +ul ol, +ul dl, +dl ul, +dl ol, +dl dl { margin-bottom: 0; } -ul, ol { +ul, +ol { margin-left: 2rem; } @@ -253,7 +279,7 @@ dl dt { dl dd { position: relative; - margin: 0 1rem 0; + margin: 0 1rem; } dd + dt.pre { @@ -278,7 +304,10 @@ h3 + h3 { margin: 0 0 .5rem; } -h2, h3, h4, h5 { +h2, +h3, +h4, +h5 { position: relative; padding-right: 40px; } @@ -288,26 +317,38 @@ h2, h3, h4, h5 { font-size: smaller; } -h1 span, h2 span, h3 span, h4 span { +h1 span, +h2 span, +h3 span, +h4 span { position: absolute; display: block; top: 0; right: 0; } -h1 span:hover, h2 span:hover, h3 span:hover, h4 span:hover { +h1 span:hover, +h2 span:hover, +h3 span:hover, +h4 span:hover { opacity: 1; } -h1 span a, h2 span a, h3 span a, h4 span a { +h1 span a, +h2 span a, +h3 span a, +h4 span a { color: #000; text-decoration: none; - font-weight: bold; + font-weight: 700; } -pre, tt, code { +pre, +tt, +code { line-height: 1.5rem; - margin: 0; padding: 0; + margin: 0; + padding: 0; } .pre { @@ -317,7 +358,7 @@ pre, tt, code { pre { padding: 1rem; vertical-align: top; - background: #f2f2f2; + background-color: #f2f2f2; margin: 1rem; overflow-x: auto; } @@ -341,18 +382,17 @@ code.pre { #intro a { color: #ddd; - font-weight: bold; + font-weight: 700; } hr { - background: none; + background-color: transparent; border: medium none; border-bottom: 1px solid #7a7a7a; - margin: 0 0 1rem 0; + margin: 0 0 1rem; } #toc h2 { - margin-top: 0; margin: 1.5rem 0; } @@ -361,7 +401,7 @@ hr { } #toc ul a { - text-decoration:none; + text-decoration: none; } #toc ul li { @@ -390,7 +430,8 @@ hr { margin-bottom: 0; } -tt, code { +tt, +code { color: #040404; background-color: #f2f2f2; border-radius: 2px; @@ -398,12 +439,12 @@ tt, code { } .api_stability code { - background: rgba(0, 0, 0, .1); + background-color: rgba(0, 0, 0, .1); } a code { color: inherit; - background: inherit; + background-color: inherit; padding: 0; } @@ -419,7 +460,7 @@ a code { #column2.interior { width: 234px; - background: #333; + background-color: #333; position: fixed; left: 0; top: 0; @@ -431,7 +472,7 @@ a code { #column2 ul { list-style: none; margin: .9rem 0 .5rem; - background: #333; + background-color: #333; } #column2 > :first-child { @@ -467,33 +508,40 @@ a code { border-radius: 0; } -#column2 ul li a.active, #column2 ul li a.active:hover, +#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; - background: none; + background-color: transparent; } -#intro a:hover, #intro a:focus, -#column2 ul li a:hover, #column2 ul li a:focus { +#intro a:hover, +#intro a:focus, +#column2 ul li a:hover, +#column2 ul li a:focus { color: #fff; - background: none; + background-color: transparent; } -span > .mark, span > .mark:visited { +span > .mark, +span > .mark:visited { color: #707070; position: absolute; - top: 0px; - right: 0px; + top: 0; + right: 0; } -span > .mark:hover, span > .mark:focus, span > .mark:active { +span > .mark:hover, +span > .mark:focus, +span > .mark:active { color: #43853d; - background: none; + background-color: transparent; } -th > *:last-child, td > *:last-child { +th > *:last-child, +td > *:last-child { margin-bottom: 0; } @@ -504,7 +552,7 @@ th > *:last-child, td > *:last-child { } /* simpler clearfix */ -.clearfix:after { +.clearfix::after { content: "."; display: block; height: 0; @@ -536,14 +584,14 @@ th > *:last-child, td > *:last-child { @media print { html { height: auto; - font-size: 0.75em; + font-size: .75em; } #column2.interior { display: none; } #column1.interior { - margin-left: 0px; - padding: 0px; + margin-left: 0; + padding: 0; overflow-y: auto; } .api_metadata, From a7b56a5b017834c87e4335f4d67192d063603be6 Mon Sep 17 00:00:00 2001 From: Robert Jensen Date: Fri, 20 Sep 2019 14:15:16 -0400 Subject: [PATCH 39/65] tls: honor pauseOnConnect option `pauseOnConnect` is now passed along to the net.Socket constructor from the tls.Socket constructor. The `readable` flag must match the value of `pauseOnConnect`. Tests were added to cover all available net.Server options when used in the tls.Server constructor. Fixes: https://github.com/nodejs/node/issues/29620 Refs: https://github.com/nodejs/node/pull/27665 PR-URL: https://github.com/nodejs/node/pull/29635 Reviewed-By: Luigi Pinca --- lib/_tls_wrap.js | 7 +++++-- .../parallel/test-tls-server-parent-constructor-options.js | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index d29182d585779b..db6f6b5e765f0b 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -411,7 +411,9 @@ function TLSSocket(socket, opts) { net.Socket.call(this, { handle: this._wrapHandle(wrap), allowHalfOpen: socket ? socket.allowHalfOpen : tlsOptions.allowHalfOpen, - readable: false, + pauseOnCreate: tlsOptions.pauseOnConnect, + // The readable flag is only needed if pauseOnCreate will be handled. + readable: tlsOptions.pauseOnConnect, writable: false }); @@ -926,7 +928,8 @@ function tlsConnectionListener(rawSocket) { handshakeTimeout: this[kHandshakeTimeout], ALPNProtocols: this.ALPNProtocols, SNICallback: this[kSNICallback] || SNICallback, - enableTrace: this[kEnableTrace] + enableTrace: this[kEnableTrace], + pauseOnConnect: this.pauseOnConnect, }); socket.on('secure', onServerSocketSecure); diff --git a/test/parallel/test-tls-server-parent-constructor-options.js b/test/parallel/test-tls-server-parent-constructor-options.js index 17484c29bae930..f8b34e8b0cab62 100644 --- a/test/parallel/test-tls-server-parent-constructor-options.js +++ b/test/parallel/test-tls-server-parent-constructor-options.js @@ -19,9 +19,11 @@ const options = { { const server = tls.createServer(options, common.mustCall((socket) => { assert.strictEqual(socket.allowHalfOpen, false); + assert.strictEqual(socket.isPaused(), false); })); assert.strictEqual(server.allowHalfOpen, false); + assert.strictEqual(server.pauseOnConnect, false); server.listen(0, common.mustCall(() => { const socket = tls.connect({ @@ -40,13 +42,16 @@ const options = { { const server = tls.createServer({ allowHalfOpen: true, + pauseOnConnect: true, ...options }, common.mustCall((socket) => { assert.strictEqual(socket.allowHalfOpen, true); + assert.strictEqual(socket.isPaused(), true); socket.on('end', socket.end); })); assert.strictEqual(server.allowHalfOpen, true); + assert.strictEqual(server.pauseOnConnect, true); server.listen(0, common.mustCall(() => { const socket = tls.connect({ From 3f6ce39acf2e5f9f9029fe1d8fddde7eb2c95366 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 16 Sep 2019 10:45:05 +0200 Subject: [PATCH 40/65] src: fix ESM path resolution on Windows Windows has some reserved file names such as "con", "prn", "nul", etc. Such files can be accessed only if the path is prefixed with "\\.\" PR-URL: https://github.com/nodejs/node/pull/29574 Reviewed-By: Guy Bedford --- src/module_wrap.cc | 5 +++ test/es-module/test-esm-windows.js | 49 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 test/es-module/test-esm-windows.js diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 4a572c00e15086..2d0829860cefbf 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -488,7 +488,12 @@ enum DescriptorType { // Nothing for the "null" cache entries. inline Maybe OpenDescriptor(const std::string& path) { uv_fs_t fs_req; +#ifdef _WIN32 + std::string pth = "\\\\.\\" + path; + uv_file fd = uv_fs_open(nullptr, &fs_req, pth.c_str(), O_RDONLY, 0, nullptr); +#else uv_file fd = uv_fs_open(nullptr, &fs_req, path.c_str(), O_RDONLY, 0, nullptr); +#endif uv_fs_req_cleanup(&fs_req); if (fd < 0) return Nothing(); return Just(fd); diff --git a/test/es-module/test-esm-windows.js b/test/es-module/test-esm-windows.js new file mode 100644 index 00000000000000..64ba1249a76c06 --- /dev/null +++ b/test/es-module/test-esm-windows.js @@ -0,0 +1,49 @@ +'use strict'; + +// Flags: --experimental-modules +// This test ensures that JavaScript file that includes +// a reserved Windows word can be loaded as ESM module + +const common = require('../common'); +const tmpdir = require('../common/tmpdir'); +const assert = require('assert'); +const fs = require('fs').promises; +const path = require('path'); + +const imp = (file) => { + return import(path.relative(__dirname, file).replace(/\\/g, '/')); +}; + +(async () => { + const tmp = tmpdir.path; + await fs.mkdir(tmp).catch(() => {}); + const rel = (file) => path.join(tmp, file); + + { // Load a single script + const file = rel('con.mjs'); + await fs.writeFile(file, 'export default "ok"'); + assert.strictEqual((await imp(file)).default, 'ok'); + await fs.unlink(file); + } + + { // Load a module + const entry = rel('entry.mjs'); + const nmDir = rel('node_modules'); + const mDir = rel('node_modules/con'); + const pkg = rel('node_modules/con/package.json'); + const script = rel('node_modules/con/index.mjs'); + + await fs.writeFile(entry, 'export {default} from "con"'); + await fs.mkdir(nmDir); + await fs.mkdir(mDir); + await fs.writeFile(pkg, '{"main":"index.mjs"}'); + await fs.writeFile(script, 'export default "ok"'); + + assert.strictEqual((await imp(entry)).default, 'ok'); + await fs.unlink(script); + await fs.unlink(pkg); + await fs.rmdir(mDir); + await fs.rmdir(nmDir); + await fs.unlink(entry); + } +})().then(common.mustCall()); From b2cce1323534b792fbcf3c6b22624ec7daa6a9a2 Mon Sep 17 00:00:00 2001 From: dokugo Date: Sun, 15 Sep 2019 03:09:03 +0300 Subject: [PATCH 41/65] inspector: update faviconUrl PR-URL: https://github.com/nodejs/node/pull/29562 Reviewed-By: David Carlier Reviewed-By: Luigi Pinca Reviewed-By: Yongsheng Zhang Reviewed-By: Colin Ihrig Reviewed-By: Jiawen Geng Reviewed-By: Ruben Bridgewater --- src/inspector_socket_server.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc index 092d5e7a786d47..9e27bd30f76871 100644 --- a/src/inspector_socket_server.cc +++ b/src/inspector_socket_server.cc @@ -343,7 +343,8 @@ void InspectorSocketServer::SendListResponse(InspectorSocket* socket, response.push_back(std::map()); std::map& target_map = response.back(); target_map["description"] = "node.js instance"; - target_map["faviconUrl"] = "https://nodejs.org/static/favicon.ico"; + target_map["faviconUrl"] = + "https://nodejs.org/static/images/favicons/favicon.ico"; target_map["id"] = id; target_map["title"] = delegate_->GetTargetTitle(id); Escape(&target_map["title"]); From a5c2154534aa5342e4ec7842c8cb6678d2f3444c Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 2 Oct 2019 00:31:57 -0400 Subject: [PATCH 42/65] doc: add explicit bracket for markdown reference links Use explicit trailing `[]` for reference markdown links to prevent implicit links when references are added to documents. PR-URL: https://github.com/nodejs/node/pull/29808 Reviewed-By: Ruben Bridgewater Reviewed-By: David Carlier Reviewed-By: Colin Ihrig --- doc/api/assert.md | 6 +++--- doc/api/crypto.md | 4 ++-- doc/api/deprecations.md | 4 ++-- doc/api/errors.md | 18 ++++++++-------- doc/api/fs.md | 15 +++++++------- doc/api/globals.md | 22 ++++++++++---------- doc/api/http.md | 2 +- doc/api/http2.md | 10 ++++----- doc/api/inspector.md | 2 +- doc/api/process.md | 10 ++++----- doc/api/readline.md | 3 ++- doc/api/stream.md | 14 ++++++------- doc/api/timers.md | 2 +- doc/api/tls.md | 40 ++++++++++++++++++------------------ doc/api/tracing.md | 8 ++++---- doc/api/util.md | 2 +- doc/guides/maintaining-V8.md | 20 +++++++++--------- 17 files changed, 92 insertions(+), 90 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 2c74b6809e1a45..68feec9f45212e 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -34,9 +34,9 @@ All instances contain the built-in `Error` properties (`message` and `name`) and: * `actual` {any} Set to the `actual` argument for methods such as - [`assert.strictEqual()`]. + [`assert.strictEqual()`][]. * `expected` {any} Set to the `expected` value for methods such as - [`assert.strictEqual()`]. + [`assert.strictEqual()`][]. * `generatedMessage` {boolean} Indicates if the message was auto-generated (`true`) or not. * `code` {string} Value is always `ERR_ASSERTION` to show that the error is an @@ -638,7 +638,7 @@ If `message` is falsy, the error message is set as the values of `actual` and `message` is provided as third argument it will be used as the error message and the other arguments will be stored as properties on the thrown object. If `stackStartFn` is provided, all stack frames above that function will be -removed from stacktrace (see [`Error.captureStackTrace`]). If no arguments are +removed from stacktrace (see [`Error.captureStackTrace`][]). If no arguments are given, the default message `Failed` will be used. ```js diff --git a/doc/api/crypto.md b/doc/api/crypto.md index ba1582bd78d542..0c98506f1b48b1 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2076,7 +2076,7 @@ and Ed448 are currently supported. If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function behaves as if [`keyObject.export()`][] had been called on its result. Otherwise, -the respective part of the key is returned as a [`KeyObject`]. +the respective part of the key is returned as a [`KeyObject`][]. It is recommended to encode public keys as `'spki'` and private keys as `'pkcs8'` with encryption for long-term storage: @@ -2136,7 +2136,7 @@ and Ed448 are currently supported. If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function behaves as if [`keyObject.export()`][] had been called on its result. Otherwise, -the respective part of the key is returned as a [`KeyObject`]. +the respective part of the key is returned as a [`KeyObject`][]. When encoding public keys, it is recommended to use `'spki'`. When encoding private keys, it is recommended to use `'pks8'` with a strong passphrase, and to diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 08e4ec065a992a..9687f342b46141 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2505,8 +2505,8 @@ changes: Type: Documentation-only -Prefer [`response.socket`][] over [`response.connection`] and -[`request.socket`][] over [`request.connection`]. +Prefer [`response.socket`][] over [`response.connection`][] and +[`request.socket`][] over [`request.connection`][]. ### DEP0134: process._tickCallback diff --git a/doc/api/errors.md b/doc/api/errors.md index 2ba78a95cf2550..4b92452cd362a0 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -461,7 +461,7 @@ system error. The `error.errno` property is a number or a string. If it is a number, it is a negative value which corresponds to the error code defined in -[`libuv Error handling`]. See the libuv `errno.h` header file +[`libuv Error handling`][]. See the libuv `errno.h` header file (`deps/uv/include/uv/errno.h` in the Node.js source tree) for details. In case of a string, it is the same as `error.code`. @@ -1283,8 +1283,8 @@ semantics for determining whether a path can be used is platform-dependent. ### ERR_INVALID_HANDLE_TYPE An attempt was made to send an unsupported "handle" over an IPC communication -channel to a child process. See [`subprocess.send()`] and [`process.send()`] for -more information. +channel to a child process. See [`subprocess.send()`][] and [`process.send()`][] +for more information. ### ERR_INVALID_HTTP_TOKEN @@ -1436,7 +1436,7 @@ for more information. ### ERR_MANIFEST_ASSERT_INTEGRITY An attempt was made to load a resource, but the resource did not match the -integrity defined by the policy manifest. See the documentation for [policy] +integrity defined by the policy manifest. See the documentation for [policy][] manifests for more information. @@ -1444,7 +1444,7 @@ manifests for more information. An attempt was made to load a resource, but the resource was not listed as a dependency from the location that attempted to load it. See the documentation -for [policy] manifests for more information. +for [policy][] manifests for more information. ### ERR_MANIFEST_INTEGRITY_MISMATCH @@ -1452,20 +1452,20 @@ for [policy] manifests for more information. An attempt was made to load a policy manifest, but the manifest had multiple entries for a resource which did not match each other. Update the manifest entries to match in order to resolve this error. See the documentation for -[policy] manifests for more information. +[policy][] manifests for more information. ### ERR_MANIFEST_INVALID_RESOURCE_FIELD A policy manifest resource had an invalid value for one of its fields. Update the manifest entry to match in order to resolve this error. See the -documentation for [policy] manifests for more information. +documentation for [policy][] manifests for more information. ### ERR_MANIFEST_PARSE_POLICY An attempt was made to load a policy manifest, but the manifest was unable to -be parsed. See the documentation for [policy] manifests for more information. +be parsed. See the documentation for [policy][] manifests for more information. ### ERR_MANIFEST_TDZ @@ -1477,7 +1477,7 @@ initialization has not yet taken place. This is likely a bug in Node.js. ### ERR_MANIFEST_UNKNOWN_ONERROR A policy manifest was loaded, but had an unknown value for its "onerror" -behavior. See the documentation for [policy] manifests for more information. +behavior. See the documentation for [policy][] manifests for more information. ### ERR_MEMORY_ALLOCATION_FAILED diff --git a/doc/api/fs.md b/doc/api/fs.md index 7ea6835387719b..c22e169f1c3937 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3133,7 +3133,7 @@ Using `fs.stat()` to check for the existence of a file before calling Instead, user code should open/read/write the file directly and handle the error raised if the file is not available. -To check if a file exists without manipulating it afterwards, [`fs.access()`] +To check if a file exists without manipulating it afterwards, [`fs.access()`][] is recommended. For example, given the following folder structure: @@ -3541,12 +3541,13 @@ The recursive option is only supported on macOS and Windows. This feature depends on the underlying operating system providing a way to be notified of filesystem changes. -* On Linux systems, this uses [`inotify(7)`]. -* On BSD systems, this uses [`kqueue(2)`]. -* On macOS, this uses [`kqueue(2)`] for files and [`FSEvents`] for directories. -* On SunOS systems (including Solaris and SmartOS), this uses [`event ports`]. -* On Windows systems, this feature depends on [`ReadDirectoryChangesW`]. -* On Aix systems, this feature depends on [`AHAFS`], which must be enabled. +* On Linux systems, this uses [`inotify(7)`][]. +* On BSD systems, this uses [`kqueue(2)`][]. +* On macOS, this uses [`kqueue(2)`][] for files and [`FSEvents`][] for + directories. +* On SunOS systems (including Solaris and SmartOS), this uses [`event ports`][]. +* On Windows systems, this feature depends on [`ReadDirectoryChangesW`][]. +* On Aix systems, this feature depends on [`AHAFS`][], which must be enabled. If the underlying functionality is not available for some reason, then `fs.watch` will not be able to function. For example, watching files or diff --git a/doc/api/globals.md b/doc/api/globals.md index f3263c22e73644..89592b98e1c9bf 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -30,11 +30,11 @@ Used to handle binary data. See the [buffer section][]. ## \_\_dirname -This variable may appear to be global but is not. See [`__dirname`]. +This variable may appear to be global but is not. See [`__dirname`][]. ## \_\_filename -This variable may appear to be global but is not. See [`__filename`]. +This variable may appear to be global but is not. See [`__filename`][]. ## clearImmediate(immediateObject) -[`clearImmediate`] is described in the [timers][] section. +[`clearImmediate`][] is described in the [timers][] section. ## clearInterval(intervalObject) -[`clearInterval`] is described in the [timers][] section. +[`clearInterval`][] is described in the [timers][] section. ## clearTimeout(timeoutObject) -[`clearTimeout`] is described in the [timers][] section. +[`clearTimeout`][] is described in the [timers][] section. ## console -[`setImmediate`] is described in the [timers][] section. +[`setImmediate`][] is described in the [timers][] section. ## setInterval(callback, delay[, ...args]) -[`setInterval`] is described in the [timers][] section. +[`setInterval`][] is described in the [timers][] section. ## setTimeout(callback, delay[, ...args]) -[`setTimeout`] is described in the [timers][] section. +[`setTimeout`][] is described in the [timers][] section. ## TextDecoder Calls [`ref()`][`net.Socket.prototype.ref()`] on this `Http2Session` -instance's underlying [`net.Socket`]. +instance's underlying [`net.Socket`][]. #### http2session.remoteSettings Calls [`unref()`][`net.Socket.prototype.unref()`] on this `Http2Session` -instance's underlying [`net.Socket`]. +instance's underlying [`net.Socket`][]. ### Class: ServerHttp2Session Immediately close the session. All pending message callbacks will be called -with an error. [`session.connect()`] will need to be called to be able to send +with an error. [`session.connect()`][] will need to be called to be able to send messages again. Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. diff --git a/doc/api/process.md b/doc/api/process.md index ae0dd86bc00548..5ecd5b513f3543 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -80,7 +80,7 @@ all `'exit'` listeners have finished running the Node.js process will terminate. The listener callback function is invoked with the exit code specified either by the [`process.exitCode`][] property, or the `exitCode` argument passed to the -[`process.exit()`] method. +[`process.exit()`][] method. ```js process.on('exit', (code) => { @@ -570,8 +570,8 @@ added: v0.1.27 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 +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 arguments. @@ -1122,7 +1122,7 @@ added: v0.1.13 The `process.exit()` method instructs Node.js to terminate the process synchronously with an exit status of `code`. If `code` is omitted, exit uses either the 'success' code `0` or the value of `process.exitCode` if it has been -set. Node.js will not terminate until all the [`'exit'`] event listeners are +set. Node.js will not terminate until all the [`'exit'`][] event listeners are called. To exit with a 'failure' code: @@ -1506,7 +1506,7 @@ changes: fully drained after the current operation on the JavaScript stack runs to completion and before the event loop is allowed to continue. It's possible to create an infinite loop if one were to recursively call `process.nextTick()`. -See the [Event Loop] guide for more background. +See the [Event Loop][] guide for more background. ```js console.log('start'); diff --git a/doc/api/readline.md b/doc/api/readline.md index 898d7e005fb652..03fdc4417230cf 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -5,7 +5,8 @@ > Stability: 2 - Stable The `readline` module provides an interface for reading data from a [Readable][] -stream (such as [`process.stdin`]) one line at a time. It can be accessed using: +stream (such as [`process.stdin`][]) one line at a time. It can be accessed +using: ```js const readline = require('readline'); diff --git a/doc/api/stream.md b/doc/api/stream.md index eb4b0b82740a8f..4bdf3159dfaa80 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -89,7 +89,7 @@ total size of the internal write buffer is below the threshold set by the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` will be returned. -A key goal of the `stream` API, particularly the [`stream.pipe()`] method, +A key goal of the `stream` API, particularly the [`stream.pipe()`][] method, is to limit the buffering of data to acceptable levels such that sources and destinations of differing speeds will not overwhelm the available memory. @@ -682,7 +682,7 @@ from the stream. Adding a [`'readable'`][] event handler automatically make the stream to stop flowing, and the data to be consumed via -[`readable.read()`][stream-read]. If the [`'readable'`] event handler is +[`readable.read()`][stream-read]. If the [`'readable'`][] event handler is removed, then the stream will start flowing again if there is a [`'data'`][] event handler. @@ -1653,10 +1653,10 @@ on the type of stream being created, as detailed in the chart below: | Use-case | Class | Method(s) to implement | | -------- | ----- | ---------------------- | -| Reading only | [`Readable`] | [_read()][stream-_read] | -| Writing only | [`Writable`] | [_write()][stream-_write], [_writev()][stream-_writev], [_final()][stream-_final] | -| Reading and writing | [`Duplex`] | [_read()][stream-_read], [_write()][stream-_write], [_writev()][stream-_writev], [_final()][stream-_final] | -| Operate on written data, then read the result | [`Transform`] | [_transform()][stream-_transform], [_flush()][stream-_flush], [_final()][stream-_final] | +| Reading only | [`Readable`][] | [`_read()`][stream-_read] | +| Writing only | [`Writable`][] | [`_write()`][stream-_write], [`_writev()`][stream-_writev], [`_final()`][stream-_final] | +| Reading and writing | [`Duplex`][] | [`_read()`][stream-_read], [`_write()`][stream-_write], [`_writev()`][stream-_writev], [`_final()`][stream-_final] | +| Operate on written data, then read the result | [`Transform`][] | [`_transform()`][stream-_transform], [`_flush()`][stream-_flush], [`_final()`][stream-_final] | The implementation code for a stream should *never* call the "public" methods of a stream that are intended for use by consumers (as described in the @@ -1881,7 +1881,7 @@ or write buffered data before a stream ends. #### Errors While Writing Errors occurring during the processing of the [`writable._write()`][], -[`writable._writev()`][] and [`writable._final()`] methods must be propagated +[`writable._writev()`][] and [`writable._final()`][] methods must be propagated by invoking the callback and passing the error as the first argument. Throwing an `Error` from within these methods or manually emitting an `'error'` event results in undefined behavior. diff --git a/doc/api/timers.md b/doc/api/timers.md index 66ee2ca97e8455..a99dd1c41e60b0 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -136,7 +136,7 @@ added: v0.9.1 --> * `callback` {Function} The function to call at the end of this turn of - [the Node.js Event Loop] + the Node.js [Event Loop][] * `...args` {any} Optional arguments to pass when the `callback` is called. * Returns: {Immediate} for use with [`clearImmediate()`][] diff --git a/doc/api/tls.md b/doc/api/tls.md index 297c1e7fd460dc..d90affa4c3b70d 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -68,12 +68,12 @@ Where: -The term "[Forward Secrecy]" or "Perfect Forward Secrecy" describes a feature of -key-agreement (i.e., key-exchange) methods. That is, the server and client keys -are used to negotiate new temporary keys that are used specifically and only for -the current communication session. Practically, this means that even if the -server's private key is compromised, communication can only be decrypted by -eavesdroppers if the attacker manages to obtain the key-pair specifically +The term "[Forward Secrecy][]" or "Perfect Forward Secrecy" describes a feature +of key-agreement (i.e., key-exchange) methods. That is, the server and client +keys are used to negotiate new temporary keys that are used specifically and +only for the current communication session. Practically, this means that even +if the server's private key is compromised, communication can only be decrypted +by eavesdroppers if the attacker manages to obtain the key-pair specifically generated for the session. Perfect Forward Secrecy is achieved by randomly generating a key pair for @@ -83,8 +83,8 @@ all sessions). Methods implementing this technique are called "ephemeral". Currently two methods are commonly used to achieve Perfect Forward Secrecy (note the character "E" appended to the traditional abbreviations): -* [DHE] - An ephemeral version of the Diffie Hellman key-agreement protocol. -* [ECDHE] - An ephemeral version of the Elliptic Curve Diffie Hellman +* [DHE][] - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE][] - An ephemeral version of the Elliptic Curve Diffie Hellman key-agreement protocol. Ephemeral methods may have some performance drawbacks, because key generation @@ -102,7 +102,7 @@ openssl dhparam -outform PEM -out dhparam.pem 2048 If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are not required and a default ECDHE curve will be used. The `ecdhCurve` property can be used when creating a TLS Server to specify the list of names of supported -curves to use, see [`tls.createServer()`] for more info. +curves to use, see [`tls.createServer()`][] for more info. Perfect Forward Secrecy was optional up to TLSv1.2, but it is not optional for TLSv1.3, because all TLSv1.3 cipher suites use ECDHE. @@ -279,8 +279,8 @@ node server.js The default can also be replaced on a per client or server basis using the `ciphers` option from [`tls.createSecureContext()`][], which is also available -in [`tls.createServer()`], [`tls.connect()`], and when creating new -[`tls.TLSSocket`]s. +in [`tls.createServer()`][], [`tls.connect()`][], and when creating new +[`tls.TLSSocket`][]s. The ciphers list can contain a mixture of TLSv1.3 cipher suite names, the ones that start with `'TLS_'`, and specifications for TLSv1.2 and below cipher @@ -303,16 +303,16 @@ of an application. The `--tls-cipher-list` switch and `ciphers` option should by used only if absolutely necessary. The default cipher suite prefers GCM ciphers for [Chrome's 'modern -cryptography' setting] and also prefers ECDHE and DHE ciphers for Perfect +cryptography' setting][] and also prefers ECDHE and DHE ciphers for Perfect Forward Secrecy, while offering *some* backward compatibility. 128 bit AES is preferred over 192 and 256 bit AES in light of [specific -attacks affecting larger AES key sizes]. +attacks affecting larger AES key sizes][]. Old clients that rely on insecure and deprecated RC4 or DES-based ciphers (like Internet Explorer 6) cannot complete the handshaking process with the default configuration. If these clients _must_ be supported, the -[TLS recommendations] may offer a compatible cipher suite. For more details +[TLS recommendations][] may offer a compatible cipher suite. For more details on the format, see the OpenSSL [cipher list format][] documentation. There are only 5 TLSv1.3 cipher suites: @@ -415,7 +415,7 @@ The typical flow of an OCSP Request is as follows: 2. Server receives the request and emits the `'OCSPRequest'` event, calling the listener if registered. 3. Server extracts the OCSP URL from either the `certificate` or `issuer` and - performs an [OCSP request] to the CA. + performs an [OCSP request][] to the CA. 4. Server receives `'OCSPResponse'` from the CA and sends it back to the client via the `callback` argument 5. Client validates the response and either destroys the socket or performs a @@ -428,7 +428,7 @@ via the `ca` option when establishing the TLS connection.) Listening for this event will have an effect only on connections established after the addition of the event listener. -An npm module like [asn1.js] may be used to parse the certificates. +An npm module like [asn1.js][] may be used to parse the certificates. ### Event: 'resumeSession' The default curve name to use for ECDH key agreement in a tls server. The -default value is `'auto'`. See [`tls.createSecureContext()`] for further +default value is `'auto'`. See [`tls.createSecureContext()`][] for further information. ## tls.DEFAULT_MAX_VERSION diff --git a/doc/api/tracing.md b/doc/api/tracing.md index 64622d6b503a56..999c7d723012b0 100644 --- a/doc/api/tracing.md +++ b/doc/api/tracing.md @@ -14,8 +14,8 @@ accepts a list of comma-separated category names. The available categories are: * `node` - An empty placeholder. -* `node.async_hooks` - Enables capture of detailed [`async_hooks`] trace data. - The [`async_hooks`] events have a unique `asyncId` and a special `triggerId` +* `node.async_hooks` - Enables capture of detailed [`async_hooks`][] trace data. + The [`async_hooks`][] events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. * `node.bootstrap` - Enables capture of Node.js bootstrap milestones. * `node.console` - Enables capture of `console.time()` and `console.count()` @@ -23,7 +23,7 @@ The available categories are: * `node.dns.native` - Enables capture of trace data for DNS queries. * `node.environment` - Enables capture of Node.js Environment milestones. * `node.fs.sync` - Enables capture of trace data for file system sync methods. -* `node.perf` - Enables capture of [Performance API] measurements. +* `node.perf` - Enables capture of [Performance API][] measurements. * `node.perf.usertiming` - Enables capture of only Performance API User Timing measures and marks. * `node.perf.timerify` - Enables capture of only Performance API timerify @@ -32,7 +32,7 @@ The available categories are: of unhandled Promise rejections and handled-after-rejections. * `node.vm.script` - Enables capture of trace data for the `vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. -* `v8` - The [V8] events are GC, compiling, and execution related. +* `v8` - The [V8][] events are GC, compiling, and execution related. By default the `node`, `node.async_hooks`, and `v8` categories are enabled. diff --git a/doc/api/util.md b/doc/api/util.md index d158fbd1a832d7..46df7c01ea7e17 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1775,7 +1775,7 @@ The `util._extend()` method was never intended to be used outside of internal Node.js modules. The community found and used it anyway. It is deprecated and should not be used in new code. JavaScript comes with very -similar built-in functionality through [`Object.assign()`]. +similar built-in functionality through [`Object.assign()`][]. ### util.isArray(object) + +> Stability: 1 - Experimental + +Enable experimental Source Map V3 support for stack traces. + ### `--es-module-specifier-resolution=mode` * `--enable-fips` +* `--enable-source-maps` * `--es-module-specifier-resolution` * `--experimental-exports` * `--experimental-loader` diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index 6fe9f36bc2c1e6..f9593101561416 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -21,6 +21,15 @@ function prepareMainThreadExecution(expandArgv1 = false) { setupCoverageHooks(process.env.NODE_V8_COVERAGE); } + // If source-map support has been enabled, we substitute in a new + // prepareStackTrace method, replacing the default in errors.js. + if (getOptionValue('--enable-source-maps')) { + const { prepareStackTrace } = + require('internal/source_map/source_map_cache'); + const { setPrepareStackTraceCallback } = internalBinding('errors'); + setPrepareStackTraceCallback(prepareStackTrace); + } + setupDebugEnv(); // Only main thread receives signals. @@ -119,7 +128,8 @@ function setupCoverageHooks(dir) { const cwd = require('internal/process/execution').tryGetCwd(); const { resolve } = require('path'); const coverageDirectory = resolve(cwd, dir); - const { sourceMapCacheToObject } = require('internal/source_map'); + const { sourceMapCacheToObject } = + require('internal/source_map/source_map_cache'); if (process.features.inspector) { internalBinding('profiler').setCoverageDirectory(coverageDirectory); diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 9933839a055a47..e4c71f2edf44ef 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -31,7 +31,10 @@ const { } = primordials; const { NativeModule } = require('internal/bootstrap/loaders'); -const { maybeCacheSourceMap } = require('internal/source_map'); +const { + maybeCacheSourceMap, + rekeySourceMap +} = require('internal/source_map/source_map_cache'); const { pathToFileURL, fileURLToPath, URL } = require('internal/url'); const { deprecate } = require('internal/util'); const vm = require('vm'); @@ -52,6 +55,7 @@ const { loadNativeModule } = require('internal/modules/cjs/helpers'); const { getOptionValue } = require('internal/options'); +const enableSourceMaps = getOptionValue('--enable-source-maps'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const experimentalModules = getOptionValue('--experimental-modules'); @@ -708,7 +712,19 @@ Module._load = function(request, parent, isMain) { let threw = true; try { - module.load(filename); + // Intercept exceptions that occur during the first tick and rekey them + // on error instance rather than module instance (which will immediately be + // garbage collected). + if (enableSourceMaps) { + try { + module.load(filename); + } catch (err) { + rekeySourceMap(Module._cache[filename], err); + throw err; /* node-do-not-add-exception-line */ + } + } else { + module.load(filename); + } threw = false; } finally { if (threw) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 19f434d44e68d4..7a84b51e2d0e05 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -32,7 +32,7 @@ const { } = require('internal/errors').codes; const readFileAsync = promisify(fs.readFile); const JsonParse = JSON.parse; -const { maybeCacheSourceMap } = require('internal/source_map'); +const { maybeCacheSourceMap } = require('internal/source_map/source_map_cache'); const debug = debuglog('esm'); diff --git a/lib/internal/source_map/source_map.js b/lib/internal/source_map/source_map.js new file mode 100644 index 00000000000000..9044521b6d62d0 --- /dev/null +++ b/lib/internal/source_map/source_map.js @@ -0,0 +1,301 @@ +// This file is a modified version of: +// https://cs.chromium.org/chromium/src/v8/tools/SourceMap.js?rcl=dd10454c1d +// from the V8 codebase. Logic specific to WebInspector is removed and linting +// is made to match the Node.js style guide. + +// Copyright 2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This is a copy from blink dev tools, see: +// http://src.chromium.org/viewvc/blink/trunk/Source/devtools/front_end/SourceMap.js +// revision: 153407 + +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +'use strict'; + +let base64Map; + +const VLQ_BASE_SHIFT = 5; +const VLQ_BASE_MASK = (1 << 5) - 1; +const VLQ_CONTINUATION_MASK = 1 << 5; + +class StringCharIterator { + /** + * @constructor + * @param {string} string + */ + constructor(string) { + this._string = string; + this._position = 0; + } + + /** + * @return {string} + */ + next() { + return this._string.charAt(this._position++); + } + + /** + * @return {string} + */ + peek() { + return this._string.charAt(this._position); + } + + /** + * @return {boolean} + */ + hasNext() { + return this._position < this._string.length; + } +} + +/** + * Implements Source Map V3 model. See http://code.google.com/p/closure-compiler/wiki/SourceMaps + * for format description. + * @constructor + * @param {string} sourceMappingURL + * @param {SourceMapV3} payload + */ +class SourceMap { + #reverseMappingsBySourceURL = []; + #mappings = []; + #sources = {}; + #sourceContentByURL = {}; + + /** + * @constructor + * @param {SourceMapV3} payload + */ + constructor(payload) { + if (!base64Map) { + const base64Digits = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + base64Map = {}; + for (let i = 0; i < base64Digits.length; ++i) + base64Map[base64Digits[i]] = i; + } + this.#parseMappingPayload(payload); + } + + /** + * @param {SourceMapV3} mappingPayload + */ + #parseMappingPayload = (mappingPayload) => { + if (mappingPayload.sections) + this.#parseSections(mappingPayload.sections); + else + this.#parseMap(mappingPayload, 0, 0); + } + + /** + * @param {Array.} sections + */ + #parseSections = (sections) => { + for (let i = 0; i < sections.length; ++i) { + const section = sections[i]; + this.#parseMap(section.map, section.offset.line, section.offset.column); + } + } + + /** + * @param {number} lineNumber in compiled resource + * @param {number} columnNumber in compiled resource + * @return {?Array} + */ + findEntry(lineNumber, columnNumber) { + let first = 0; + let count = this.#mappings.length; + while (count > 1) { + const step = count >> 1; + const middle = first + step; + const mapping = this.#mappings[middle]; + if (lineNumber < mapping[0] || + (lineNumber === mapping[0] && columnNumber < mapping[1])) { + count = step; + } else { + first = middle; + count -= step; + } + } + const entry = this.#mappings[first]; + if (!first && entry && (lineNumber < entry[0] || + (lineNumber === entry[0] && columnNumber < entry[1]))) { + return null; + } + return entry; + } + + /** + * @param {string} sourceURL of the originating resource + * @param {number} lineNumber in the originating resource + * @return {Array} + */ + findEntryReversed(sourceURL, lineNumber) { + const mappings = this.#reverseMappingsBySourceURL[sourceURL]; + for (; lineNumber < mappings.length; ++lineNumber) { + const mapping = mappings[lineNumber]; + if (mapping) + return mapping; + } + return this.#mappings[0]; + } + + /** + * @override + */ + #parseMap = (map, lineNumber, columnNumber) => { + let sourceIndex = 0; + let sourceLineNumber = 0; + let sourceColumnNumber = 0; + + const sources = []; + const originalToCanonicalURLMap = {}; + for (let i = 0; i < map.sources.length; ++i) { + const url = map.sources[i]; + originalToCanonicalURLMap[url] = url; + sources.push(url); + this.#sources[url] = true; + + if (map.sourcesContent && map.sourcesContent[i]) + this.#sourceContentByURL[url] = map.sourcesContent[i]; + } + + const stringCharIterator = new StringCharIterator(map.mappings); + let sourceURL = sources[sourceIndex]; + + while (true) { + if (stringCharIterator.peek() === ',') + stringCharIterator.next(); + else { + while (stringCharIterator.peek() === ';') { + lineNumber += 1; + columnNumber = 0; + stringCharIterator.next(); + } + if (!stringCharIterator.hasNext()) + break; + } + + columnNumber += decodeVLQ(stringCharIterator); + if (isSeparator(stringCharIterator.peek())) { + this.#mappings.push([lineNumber, columnNumber]); + continue; + } + + const sourceIndexDelta = decodeVLQ(stringCharIterator); + if (sourceIndexDelta) { + sourceIndex += sourceIndexDelta; + sourceURL = sources[sourceIndex]; + } + sourceLineNumber += decodeVLQ(stringCharIterator); + sourceColumnNumber += decodeVLQ(stringCharIterator); + if (!isSeparator(stringCharIterator.peek())) + // Unused index into the names list. + decodeVLQ(stringCharIterator); + + this.#mappings.push([lineNumber, columnNumber, sourceURL, + sourceLineNumber, sourceColumnNumber]); + } + + for (let i = 0; i < this.#mappings.length; ++i) { + const mapping = this.#mappings[i]; + const url = mapping[2]; + if (!url) + continue; + if (!this.#reverseMappingsBySourceURL[url]) + this.#reverseMappingsBySourceURL[url] = []; + const reverseMappings = this.#reverseMappingsBySourceURL[url]; + const sourceLine = mapping[3]; + if (!reverseMappings[sourceLine]) + reverseMappings[sourceLine] = [mapping[0], mapping[1]]; + } + }; +} + +/** + * @param {string} char + * @return {boolean} + */ +function isSeparator(char) { + return char === ',' || char === ';'; +} + +/** + * @param {SourceMap.StringCharIterator} stringCharIterator + * @return {number} + */ +function decodeVLQ(stringCharIterator) { + // Read unsigned value. + let result = 0; + let shift = 0; + let digit; + do { + digit = base64Map[stringCharIterator.next()]; + result += (digit & VLQ_BASE_MASK) << shift; + shift += VLQ_BASE_SHIFT; + } while (digit & VLQ_CONTINUATION_MASK); + + // Fix the sign. + const negative = result & 1; + result >>= 1; + return negative ? -result : result; +} + +module.exports = { + SourceMap +}; diff --git a/lib/internal/source_map.js b/lib/internal/source_map/source_map_cache.js similarity index 58% rename from lib/internal/source_map.js rename to lib/internal/source_map/source_map_cache.js index 4b198ff59871d1..94a4165546b77c 100644 --- a/lib/internal/source_map.js +++ b/lib/internal/source_map/source_map_cache.js @@ -5,6 +5,7 @@ const { Buffer } = require('buffer'); const debug = require('internal/util/debuglog').debuglog('source_map'); const { dirname, resolve } = require('path'); const fs = require('fs'); +const { getOptionValue } = require('internal/options'); const { normalizeReferrerURL, } = require('internal/modules/cjs/helpers'); @@ -16,10 +17,14 @@ const cjsSourceMapCache = new WeakMap(); // on filenames. const esmSourceMapCache = new Map(); const { fileURLToPath, URL } = require('url'); +const { overrideStackTrace } = require('internal/errors'); +let experimentalSourceMaps; function maybeCacheSourceMap(filename, content, cjsModuleInstance) { - if (!process.env.NODE_V8_COVERAGE) return; - + if (experimentalSourceMaps === undefined) { + experimentalSourceMaps = getOptionValue('--enable-source-maps'); + } + if (!(process.env.NODE_V8_COVERAGE || experimentalSourceMaps)) return; let basePath; try { filename = normalizeReferrerURL(filename); @@ -35,6 +40,7 @@ function maybeCacheSourceMap(filename, content, cjsModuleInstance) { if (match) { if (cjsModuleInstance) { cjsSourceMapCache.set(cjsModuleInstance, { + filename, url: match.groups.sourceMappingURL, data: dataFromUrl(basePath, match.groups.sourceMappingURL) }); @@ -119,6 +125,16 @@ function sourcesToAbsolute(base, data) { return data; } +// Move source map from garbage collected module to alternate key. +function rekeySourceMap(cjsModuleInstance, newInstance) { + const sourceMap = cjsSourceMapCache.get(cjsModuleInstance); + if (sourceMap) { + cjsSourceMapCache.set(newInstance, sourceMap); + } +} + +// Get serialized representation of source-map cache, this is used +// to persist a cache of source-maps to disk when NODE_V8_COVERAGE is enabled. function sourceMapCacheToObject() { const obj = Object.create(null); @@ -136,17 +152,86 @@ function sourceMapCacheToObject() { // Since WeakMap can't be iterated over, we use Module._cache's // keys to facilitate Source Map serialization. +// +// TODO(bcoe): this means we don't currently serialize source-maps attached +// to error instances, only module instances. function appendCJSCache(obj) { const { Module } = require('internal/modules/cjs/loader'); Object.keys(Module._cache).forEach((key) => { const value = cjsSourceMapCache.get(Module._cache[key]); if (value) { - obj[`file://${key}`] = value; + obj[`file://${key}`] = { + url: value.url, + data: value.data + }; + } + }); +} + +// Create a prettified stacktrace, inserting context from source maps +// if possible. +const ErrorToString = Error.prototype.toString; // Capture original toString. +const prepareStackTrace = (globalThis, error, trace) => { + // API for node internals to override error stack formatting + // without interfering with userland code. + // TODO(bcoe): add support for source-maps to repl. + if (overrideStackTrace.has(error)) { + const f = overrideStackTrace.get(error); + overrideStackTrace.delete(error); + return f(error, trace); + } + + const { SourceMap } = require('internal/source_map/source_map'); + const errorString = ErrorToString.call(error); + + if (trace.length === 0) { + return errorString; + } + const preparedTrace = trace.map((t, i) => { + let str = i !== 0 ? '\n at ' : ''; + str = `${str}${t}`; + try { + const sourceMap = findSourceMap(t.getFileName(), error); + if (sourceMap && sourceMap.data) { + const sm = new SourceMap(sourceMap.data); + // Source Map V3 lines/columns use zero-based offsets whereas, in + // stack traces, they start at 1/1. + const [, , url, line, col] = + sm.findEntry(t.getLineNumber() - 1, t.getColumnNumber() - 1); + if (url && line !== undefined && col !== undefined) { + str += + `\n -> ${url.replace('file://', '')}:${line + 1}:${col + 1}`; + } + } + } catch (err) { + debug(err.stack); } + return str; }); + return `${errorString}\n at ${preparedTrace.join('')}`; +}; + +// Attempt to lookup a source map, which is either attached to a file URI, or +// keyed on an error instance. +function findSourceMap(uri, error) { + const { Module } = require('internal/modules/cjs/loader'); + let sourceMap = cjsSourceMapCache.get(Module._cache[uri]); + if (!uri.startsWith('file://')) uri = normalizeReferrerURL(uri); + if (sourceMap === undefined) { + sourceMap = esmSourceMapCache.get(uri); + } + if (sourceMap === undefined) { + const candidateSourceMap = cjsSourceMapCache.get(error); + if (candidateSourceMap && uri === candidateSourceMap.filename) { + sourceMap = candidateSourceMap; + } + } + return sourceMap; } module.exports = { + maybeCacheSourceMap, + prepareStackTrace, + rekeySourceMap, sourceMapCacheToObject, - maybeCacheSourceMap }; diff --git a/node.gyp b/node.gyp index 5bb6fd93845cd4..e7d0f27410bd73 100644 --- a/node.gyp +++ b/node.gyp @@ -175,7 +175,8 @@ 'lib/internal/repl/history.js', 'lib/internal/repl/utils.js', 'lib/internal/socket_list.js', - 'lib/internal/source_map.js', + 'lib/internal/source_map/source_map.js', + 'lib/internal/source_map/source_map_cache.js', 'lib/internal/test/binding.js', 'lib/internal/timers.js', 'lib/internal/tls.js', diff --git a/src/node_options.cc b/src/node_options.cc index a9425c4c0862ec..917de69fe8e875 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -312,6 +312,10 @@ DebugOptionsParser::DebugOptionsParser() { } EnvironmentOptionsParser::EnvironmentOptionsParser() { + AddOption("--enable-source-maps", + "experimental Source Map V3 support", + &EnvironmentOptions::enable_source_maps, + kAllowedInEnvironment); AddOption("--experimental-exports", "experimental support for exports in package.json", &EnvironmentOptions::experimental_exports, diff --git a/src/node_options.h b/src/node_options.h index c4d33831e02bbe..89f6363f4a6e04 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -100,6 +100,7 @@ class DebugOptions : public Options { class EnvironmentOptions : public Options { public: bool abort_on_uncaught_exception = false; + bool enable_source_maps = false; bool experimental_exports = false; bool experimental_modules = false; std::string es_module_specifier_resolution; diff --git a/test/fixtures/source-map/babel-esm-original.mjs b/test/fixtures/source-map/babel-esm-original.mjs new file mode 100644 index 00000000000000..70ae479452a970 --- /dev/null +++ b/test/fixtures/source-map/babel-esm-original.mjs @@ -0,0 +1,9 @@ +import {foo} from './esm-dep.mjs'; + +const obj = { + a: { + b: 22 + } +}; + +if (obj?.a?.b === 22) throw Error('an exception'); diff --git a/test/fixtures/source-map/babel-esm.mjs b/test/fixtures/source-map/babel-esm.mjs new file mode 100644 index 00000000000000..9ad84663a32d35 --- /dev/null +++ b/test/fixtures/source-map/babel-esm.mjs @@ -0,0 +1,10 @@ +var _obj$a; + +import { foo } from './esm-dep.mjs'; +const obj = { + a: { + b: 22 + } +}; +if ((obj === null || obj === void 0 ? void 0 : (_obj$a = obj.a) === null || _obj$a === void 0 ? void 0 : _obj$a.b) === 22) throw Error('an exception'); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhYmVsLWVzbS1vcmlnaW5hbC5tanMiXSwibmFtZXMiOlsiZm9vIiwib2JqIiwiYSIsImIiLCJFcnJvciJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxTQUFRQSxHQUFSLFFBQWtCLGVBQWxCO0FBRUEsTUFBTUMsR0FBRyxHQUFHO0FBQ1ZDLEVBQUFBLENBQUMsRUFBRTtBQUNEQyxJQUFBQSxDQUFDLEVBQUU7QUFERjtBQURPLENBQVo7QUFNQSxJQUFJLENBQUFGLEdBQUcsU0FBSCxJQUFBQSxHQUFHLFdBQUgsc0JBQUFBLEdBQUcsQ0FBRUMsQ0FBTCxrREFBUUMsQ0FBUixNQUFjLEVBQWxCLEVBQXNCLE1BQU1DLEtBQUssQ0FBQyxjQUFELENBQVgiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge2Zvb30gZnJvbSAnLi9lc20tZGVwLm1qcyc7XG5cbmNvbnN0IG9iaiA9IHtcbiAgYToge1xuICAgIGI6IDIyXG4gIH1cbn07XG5cbmlmIChvYmo/LmE/LmIgPT09IDIyKSB0aHJvdyBFcnJvcignYW4gZXhjZXB0aW9uJyk7XG5cbiJdfQ== diff --git a/test/fixtures/source-map/babel-throw-original.js b/test/fixtures/source-map/babel-throw-original.js new file mode 100644 index 00000000000000..779bd16fd4611d --- /dev/null +++ b/test/fixtures/source-map/babel-throw-original.js @@ -0,0 +1,19 @@ +/*--- +esid: prod-OptionalExpression +features: [optional-chaining] +---*/ + +const obj = { + a: { + b: 22 + } +}; + +function fn () { + return {}; +} + +setTimeout((err) => { + // OptionalExpression (MemberExpression OptionalChain) OptionalChain + if (obj?.a?.b === 22) throw Error('an exception'); +}, 5); diff --git a/test/fixtures/source-map/babel-throw.js b/test/fixtures/source-map/babel-throw.js new file mode 100644 index 00000000000000..3cef68136ce186 --- /dev/null +++ b/test/fixtures/source-map/babel-throw.js @@ -0,0 +1,21 @@ +/*--- +esid: prod-OptionalExpression +features: [optional-chaining] +---*/ +const obj = { + a: { + b: 22 + } +}; + +function fn() { + return {}; +} + +setTimeout(err => { + var _obj$a; + + // OptionalExpression (MemberExpression OptionalChain) OptionalChain + if ((obj === null || obj === void 0 ? void 0 : (_obj$a = obj.a) === null || _obj$a === void 0 ? void 0 : _obj$a.b) === 22) throw Error('an exception'); +}, 5); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhYmVsLXRocm93LW9yaWdpbmFsLmpzIl0sIm5hbWVzIjpbIm9iaiIsImEiLCJiIiwiZm4iLCJzZXRUaW1lb3V0IiwiZXJyIiwiRXJyb3IiXSwibWFwcGluZ3MiOiJBQUFBOzs7O0FBS0EsTUFBTUEsR0FBRyxHQUFHO0FBQ1ZDLEVBQUFBLENBQUMsRUFBRTtBQUNEQyxJQUFBQSxDQUFDLEVBQUU7QUFERjtBQURPLENBQVo7O0FBTUEsU0FBU0MsRUFBVCxHQUFlO0FBQ2IsU0FBTyxFQUFQO0FBQ0Q7O0FBRURDLFVBQVUsQ0FBRUMsR0FBRCxJQUFTO0FBQUE7O0FBQ2xCO0FBQ0EsTUFBSSxDQUFBTCxHQUFHLFNBQUgsSUFBQUEsR0FBRyxXQUFILHNCQUFBQSxHQUFHLENBQUVDLENBQUwsa0RBQVFDLENBQVIsTUFBYyxFQUFsQixFQUFzQixNQUFNSSxLQUFLLENBQUMsY0FBRCxDQUFYO0FBQ3ZCLENBSFMsRUFHUCxDQUhPLENBQVYiLCJzb3VyY2VzQ29udGVudCI6WyIvKi0tLVxuZXNpZDogcHJvZC1PcHRpb25hbEV4cHJlc3Npb25cbmZlYXR1cmVzOiBbb3B0aW9uYWwtY2hhaW5pbmddXG4tLS0qL1xuXG5jb25zdCBvYmogPSB7XG4gIGE6IHtcbiAgICBiOiAyMlxuICB9XG59O1xuXG5mdW5jdGlvbiBmbiAoKSB7XG4gIHJldHVybiB7fTtcbn1cblxuc2V0VGltZW91dCgoZXJyKSA9PiB7XG4gIC8vIE9wdGlvbmFsRXhwcmVzc2lvbiAoTWVtYmVyRXhwcmVzc2lvbiBPcHRpb25hbENoYWluKSBPcHRpb25hbENoYWluXG4gIGlmIChvYmo/LmE/LmIgPT09IDIyKSB0aHJvdyBFcnJvcignYW4gZXhjZXB0aW9uJyk7XG59LCA1KTtcblxuIl19 diff --git a/test/fixtures/source-map/basic.js b/test/fixtures/source-map/basic.js index a483ffb105cfd7..5d1420360f466e 100644 --- a/test/fixtures/source-map/basic.js +++ b/test/fixtures/source-map/basic.js @@ -4,4 +4,4 @@ if (true) { } else { const c = 102; } -//# sourceMappingURL=https://http.cat/418 +//# sourceMappingURL=https://ci.nodejs.org/418 diff --git a/test/fixtures/source-map/esm-basic.mjs b/test/fixtures/source-map/esm-basic.mjs index 55747d3870bbe6..03222b244bae36 100644 --- a/test/fixtures/source-map/esm-basic.mjs +++ b/test/fixtures/source-map/esm-basic.mjs @@ -1,4 +1,4 @@ import {foo} from './esm-dep.mjs'; import {strictEqual} from 'assert'; strictEqual(foo(), 'foo'); -//# sourceMappingURL=https://http.cat/405 +//# sourceMappingURL=https://ci.nodejs.org/405 diff --git a/test/fixtures/source-map/esm-dep.mjs b/test/fixtures/source-map/esm-dep.mjs index 00805894afa6a2..5e86405751427c 100644 --- a/test/fixtures/source-map/esm-dep.mjs +++ b/test/fixtures/source-map/esm-dep.mjs @@ -1,4 +1,4 @@ export function foo () { return 'foo'; }; -//# sourceMappingURL=https://http.cat/422 +//# sourceMappingURL=https://ci.nodejs.org/422 diff --git a/test/fixtures/source-map/exit-1.js b/test/fixtures/source-map/exit-1.js index 9734649a773b42..d8b56264457593 100644 --- a/test/fixtures/source-map/exit-1.js +++ b/test/fixtures/source-map/exit-1.js @@ -5,4 +5,4 @@ if (true) { const c = 102; } process.exit(1); -//# sourceMappingURL=https://http.cat/404 +//# sourceMappingURL=https://ci.nodejs.org/404 diff --git a/test/fixtures/source-map/istanbul-throw-original.js b/test/fixtures/source-map/istanbul-throw-original.js new file mode 100644 index 00000000000000..099faa175dbfd8 --- /dev/null +++ b/test/fixtures/source-map/istanbul-throw-original.js @@ -0,0 +1,10 @@ +/* + * comments dropped by uglify. + */ +function Hello() { + throw Error('goodbye'); +} + +setImmediate(function() { + Hello(); +}); diff --git a/test/fixtures/source-map/istanbul-throw.js b/test/fixtures/source-map/istanbul-throw.js new file mode 100644 index 00000000000000..4f719a1c7a1ff0 --- /dev/null +++ b/test/fixtures/source-map/istanbul-throw.js @@ -0,0 +1,4 @@ +var cov_ono70fls3=function(){var path="/Users/bencoe/oss/source-map-testing/istanbul-throw-original.js";var hash="4302fcea4eb0ea4d9af6e63a478f214aa61f9dd8";var global=new Function("return this")();var gcv="__coverage__";var coverageData={path:"/Users/bencoe/oss/source-map-testing/istanbul-throw-original.js",statementMap:{"0":{start:{line:5,column:2},end:{line:5,column:25}},"1":{start:{line:8,column:0},end:{line:10,column:3}},"2":{start:{line:9,column:2},end:{line:9,column:10}}},fnMap:{"0":{name:"Hello",decl:{start:{line:4,column:9},end:{line:4,column:14}},loc:{start:{line:4,column:17},end:{line:6,column:1}},line:4},"1":{name:"(anonymous_1)",decl:{start:{line:8,column:13},end:{line:8,column:14}},loc:{start:{line:8,column:24},end:{line:10,column:1}},line:8}},branchMap:{},s:{"0":0,"1":0,"2":0},f:{"0":0,"1":0},b:{},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184",hash:"4302fcea4eb0ea4d9af6e63a478f214aa61f9dd8"};var coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}return coverage[path]=coverageData;}();/* + * comments dropped by uglify. + */function Hello(){cov_ono70fls3.f[0]++;cov_ono70fls3.s[0]++;throw Error('goodbye');}cov_ono70fls3.s[1]++;setImmediate(function(){cov_ono70fls3.f[1]++;cov_ono70fls3.s[2]++;Hello();}); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9iZW5jb2Uvb3NzL3NvdXJjZS1tYXAtdGVzdGluZy9pc3RhbmJ1bC10aHJvdy1vcmlnaW5hbC5qcyJdLCJuYW1lcyI6WyJIZWxsbyIsIkVycm9yIiwic2V0SW1tZWRpYXRlIl0sIm1hcHBpbmdzIjoiMmpDQUFBOztHQUdBLFFBQVNBLENBQUFBLEtBQVQsRUFBaUIsMkNBQ2YsS0FBTUMsQ0FBQUEsS0FBSyxDQUFDLFNBQUQsQ0FBWCxDQUNELEMscUJBRURDLFlBQVksQ0FBQyxVQUFXLDJDQUN0QkYsS0FBSyxHQUNOLENBRlcsQ0FBWiIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBjb21tZW50cyBkcm9wcGVkIGJ5IHVnbGlmeS5cbiAqL1xuZnVuY3Rpb24gSGVsbG8oKSB7XG4gIHRocm93IEVycm9yKCdnb29kYnllJyk7XG59XG5cbnNldEltbWVkaWF0ZShmdW5jdGlvbigpIHtcbiAgSGVsbG8oKTtcbn0pO1xuXG4iXX0= diff --git a/test/fixtures/source-map/sigint.js b/test/fixtures/source-map/sigint.js index 11df66645f07d7..f9ffaa8666229d 100644 --- a/test/fixtures/source-map/sigint.js +++ b/test/fixtures/source-map/sigint.js @@ -5,4 +5,4 @@ if (true) { const c = 102; } process.kill(process.pid, "SIGINT"); -//# sourceMappingURL=https://http.cat/402 +//# sourceMappingURL=https://ci.nodejs.org/402 diff --git a/test/fixtures/source-map/typescript-throw.js b/test/fixtures/source-map/typescript-throw.js new file mode 100644 index 00000000000000..0c4e57756f708d --- /dev/null +++ b/test/fixtures/source-map/typescript-throw.js @@ -0,0 +1,27 @@ +var ATrue; +(function (ATrue) { + ATrue[ATrue["IsTrue"] = 1] = "IsTrue"; + ATrue[ATrue["IsFalse"] = 0] = "IsFalse"; +})(ATrue || (ATrue = {})); +if (false) { + console.info('unreachable'); +} +else if (true) { + console.info('reachable'); +} +else { + console.info('unreachable'); +} +function branch(a) { + if (a === ATrue.IsFalse) { + console.info('a = false'); + } + else if (a === ATrue.IsTrue) { + throw Error('an exception'); + } + else { + console.info('a = ???'); + } +} +branch(ATrue.IsTrue); +//# sourceMappingURL=typescript-throw.js.map diff --git a/test/fixtures/source-map/typescript-throw.js.map b/test/fixtures/source-map/typescript-throw.js.map new file mode 100644 index 00000000000000..f1f55af1a92107 --- /dev/null +++ b/test/fixtures/source-map/typescript-throw.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typescript-throw.js","sourceRoot":"","sources":["typescript-throw.ts"],"names":[],"mappings":"AAAA,IAAK,KAGJ;AAHD,WAAK,KAAK;IACR,qCAAU,CAAA;IACV,uCAAW,CAAA;AACb,CAAC,EAHI,KAAK,KAAL,KAAK,QAGT;AAED,IAAI,KAAK,EAAE;IACT,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;CAC5B;KAAM,IAAI,IAAI,EAAE;IACf,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;CAC1B;KAAM;IACL,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;CAC5B;AAED,SAAS,MAAM,CAAE,CAAQ;IACvB,IAAI,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;KAC1B;SAAM,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,EAAE;QAC7B,MAAM,KAAK,CAAC,cAAc,CAAC,CAAC;KAC7B;SAAM;QACL,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;KACxB;AACH,CAAC;AAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA"} diff --git a/test/fixtures/source-map/typescript-throw.ts b/test/fixtures/source-map/typescript-throw.ts new file mode 100644 index 00000000000000..befb58fe0a5185 --- /dev/null +++ b/test/fixtures/source-map/typescript-throw.ts @@ -0,0 +1,24 @@ +enum ATrue { + IsTrue = 1, + IsFalse = 0 +} + +if (false) { + console.info('unreachable') +} else if (true) { + console.info('reachable') +} else { + console.info('unreachable') +} + +function branch (a: ATrue) { + if (a === ATrue.IsFalse) { + console.info('a = false') + } else if (a === ATrue.IsTrue) { + throw Error('an exception'); + } else { + console.info('a = ???') + } +} + +branch(ATrue.IsTrue) diff --git a/test/fixtures/source-map/uglify-throw-original.js b/test/fixtures/source-map/uglify-throw-original.js new file mode 100644 index 00000000000000..099faa175dbfd8 --- /dev/null +++ b/test/fixtures/source-map/uglify-throw-original.js @@ -0,0 +1,10 @@ +/* + * comments dropped by uglify. + */ +function Hello() { + throw Error('goodbye'); +} + +setImmediate(function() { + Hello(); +}); diff --git a/test/fixtures/source-map/uglify-throw.js b/test/fixtures/source-map/uglify-throw.js new file mode 100644 index 00000000000000..ea6201e59d6c17 --- /dev/null +++ b/test/fixtures/source-map/uglify-throw.js @@ -0,0 +1,2 @@ +setImmediate(function(){!function(){throw Error("goodbye")}()}); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVnbGlmeS10aHJvdy1vcmlnaW5hbC5qcyJdLCJuYW1lcyI6WyJzZXRJbW1lZGlhdGUiLCJFcnJvciIsIkhlbGxvIl0sIm1hcHBpbmdzIjoiQUFPQUEsYUFBYSxZQUpiLFdBQ0UsTUFBTUMsTUFBTSxXQUlaQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBjb21tZW50cyBkcm9wcGVkIGJ5IHVnbGlmeS5cbiAqL1xuZnVuY3Rpb24gSGVsbG8oKSB7XG4gIHRocm93IEVycm9yKCdnb29kYnllJyk7XG59XG5cbnNldEltbWVkaWF0ZShmdW5jdGlvbigpIHtcbiAgSGVsbG8oKTtcbn0pO1xuXG4iXX0= diff --git a/test/message/source_map_throw_catch.js b/test/message/source_map_throw_catch.js new file mode 100644 index 00000000000000..f3a887474bfbac --- /dev/null +++ b/test/message/source_map_throw_catch.js @@ -0,0 +1,11 @@ +// Flags: --enable-source-maps + +'use strict'; +require('../common'); +try { + require('../fixtures/source-map/typescript-throw'); +} catch (err) { + setTimeout(() => { + console.info(err); + }, 10); +} diff --git a/test/message/source_map_throw_catch.out b/test/message/source_map_throw_catch.out new file mode 100644 index 00000000000000..63e3eca3eff0ce --- /dev/null +++ b/test/message/source_map_throw_catch.out @@ -0,0 +1,14 @@ +reachable +Error: an exception + at branch (*typescript-throw.js:20:15) + -> *typescript-throw.ts:18:11 + at Object. (*typescript-throw.js:26:1) + -> *typescript-throw.ts:24:1 + at Module._compile (internal/modules/cjs/loader.js:*) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:*) + at Module.load (internal/modules/cjs/loader.js:*) + at Function.Module._load (internal/modules/cjs/loader.js:*) + at Module.require (internal/modules/cjs/loader.js:*) + at require (internal/modules/cjs/helpers.js:*) + at Object. (*source_map_throw_catch.js:6:3) + at Module._compile (internal/modules/cjs/loader.js:*) diff --git a/test/message/source_map_throw_first_tick.js b/test/message/source_map_throw_first_tick.js new file mode 100644 index 00000000000000..b691b51f355194 --- /dev/null +++ b/test/message/source_map_throw_first_tick.js @@ -0,0 +1,5 @@ +// Flags: --enable-source-maps + +'use strict'; +require('../common'); +require('../fixtures/source-map/typescript-throw'); diff --git a/test/message/source_map_throw_first_tick.out b/test/message/source_map_throw_first_tick.out new file mode 100644 index 00000000000000..7f11d9fbd969be --- /dev/null +++ b/test/message/source_map_throw_first_tick.out @@ -0,0 +1,14 @@ +reachable +Error: an exception + at branch (*typescript-throw.js:20:15) + -> *typescript-throw.ts:18:11 + at Object. (*typescript-throw.js:26:1) + -> *typescript-throw.ts:24:1 + at Module._compile (internal/modules/cjs/loader.js:*) + at Object.Module._extensions..js (internal/modules/cjs/loader.js:*) + at Module.load (internal/modules/cjs/loader.js:*) + at Function.Module._load (internal/modules/cjs/loader.js:*) + at Module.require (internal/modules/cjs/loader.js:*) + at require (internal/modules/cjs/helpers.js:*) + at Object. (*source_map_throw_first_tick.js:5:1) + at Module._compile (internal/modules/cjs/loader.js:*) diff --git a/test/message/source_map_throw_set_immediate.js b/test/message/source_map_throw_set_immediate.js new file mode 100644 index 00000000000000..17da1bd7acea66 --- /dev/null +++ b/test/message/source_map_throw_set_immediate.js @@ -0,0 +1,5 @@ +// Flags: --enable-source-maps + +'use strict'; +require('../common'); +require('../fixtures/source-map/uglify-throw'); diff --git a/test/message/source_map_throw_set_immediate.out b/test/message/source_map_throw_set_immediate.out new file mode 100644 index 00000000000000..6b169d7e025f7e --- /dev/null +++ b/test/message/source_map_throw_set_immediate.out @@ -0,0 +1,10 @@ +*uglify-throw.js:1 +setImmediate(function(){!function(){throw Error("goodbye")}()}); + ^ + +Error: goodbye + at *uglify-throw.js:1:43 + -> *uglify-throw-original.js:5:9 + at Immediate. (*uglify-throw.js:1:60) + -> *uglify-throw-original.js:9:3 + at processImmediate (internal/timers.js:*) diff --git a/test/parallel/test-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index 36c323b97736a4..ae69f5aef01da9 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -55,7 +55,7 @@ const expectedModules = new Set([ 'NativeModule internal/process/task_queues', 'NativeModule internal/process/warning', 'NativeModule internal/querystring', - 'NativeModule internal/source_map', + 'NativeModule internal/source_map/source_map_cache', 'NativeModule internal/timers', 'NativeModule internal/url', 'NativeModule internal/util', diff --git a/test/parallel/test-source-map.js b/test/parallel/test-source-map.js index de728c05bf8413..41a315e3f8184c 100644 --- a/test/parallel/test-source-map.js +++ b/test/parallel/test-source-map.js @@ -30,7 +30,7 @@ function nextdir() { assert.strictEqual(output.status, 0); assert.strictEqual(output.stderr.toString(), ''); const sourceMap = getSourceMapFromCache('basic.js', coverageDirectory); - assert.strictEqual(sourceMap.url, 'https://http.cat/418'); + assert.strictEqual(sourceMap.url, 'https://ci.nodejs.org/418'); } // Outputs source maps when process.kill(process.pid, "SIGINT"); exits process. @@ -47,7 +47,7 @@ function nextdir() { } assert.strictEqual(output.stderr.toString(), ''); const sourceMap = getSourceMapFromCache('sigint.js', coverageDirectory); - assert.strictEqual(sourceMap.url, 'https://http.cat/402'); + assert.strictEqual(sourceMap.url, 'https://ci.nodejs.org/402'); } // Outputs source maps when source-file calls process.exit(1). @@ -58,7 +58,7 @@ function nextdir() { ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); assert.strictEqual(output.stderr.toString(), ''); const sourceMap = getSourceMapFromCache('exit-1.js', coverageDirectory); - assert.strictEqual(sourceMap.url, 'https://http.cat/404'); + assert.strictEqual(sourceMap.url, 'https://ci.nodejs.org/404'); } // Outputs source-maps for esm module. @@ -71,7 +71,7 @@ function nextdir() { ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); assert.strictEqual(output.stderr.toString(), ''); const sourceMap = getSourceMapFromCache('esm-basic.mjs', coverageDirectory); - assert.strictEqual(sourceMap.url, 'https://http.cat/405'); + assert.strictEqual(sourceMap.url, 'https://ci.nodejs.org/405'); } // Loads source-maps with relative path from .map file on disk. @@ -116,12 +116,95 @@ function nextdir() { ); } +// Does not apply source-map to stack trace if --experimental-modules +// is not set. +{ + const output = spawnSync(process.execPath, [ + require.resolve('../fixtures/source-map/uglify-throw.js') + ]); + assert.strictEqual( + output.stderr.toString().match(/->.*uglify-throw-original\.js:5:9/), + null + ); + assert.strictEqual( + output.stderr.toString().match(/->.*uglify-throw-original\.js:9:3/), + null + ); +} + +// Applies source-maps generated by uglifyjs to stack trace. +{ + const output = spawnSync(process.execPath, [ + '--enable-source-maps', + require.resolve('../fixtures/source-map/uglify-throw.js') + ]); + assert.ok( + output.stderr.toString().match(/->.*uglify-throw-original\.js:5:9/) + ); + assert.ok( + output.stderr.toString().match(/->.*uglify-throw-original\.js:9:3/) + ); +} + +// Applies source-maps generated by tsc to stack trace. +{ + const output = spawnSync(process.execPath, [ + '--enable-source-maps', + require.resolve('../fixtures/source-map/typescript-throw.js') + ]); + assert.ok(output.stderr.toString().match(/->.*typescript-throw\.ts:18:11/)); + assert.ok(output.stderr.toString().match(/->.*typescript-throw\.ts:24:1/)); +} + +// Applies source-maps generated by babel to stack trace. +{ + const output = spawnSync(process.execPath, [ + '--enable-source-maps', + require.resolve('../fixtures/source-map/babel-throw.js') + ]); + assert.ok( + output.stderr.toString().match(/->.*babel-throw-original\.js:18:31/) + ); +} + +// Applies source-maps generated by nyc to stack trace. +{ + const output = spawnSync(process.execPath, [ + '--enable-source-maps', + require.resolve('../fixtures/source-map/istanbul-throw.js') + ]); + assert.ok( + output.stderr.toString().match(/->.*istanbul-throw-original\.js:5:9/) + ); + assert.ok( + output.stderr.toString().match(/->.*istanbul-throw-original\.js:9:3/) + ); +} + +// Applies source-maps in esm modules to stack trace. +{ + const output = spawnSync(process.execPath, [ + '--enable-source-maps', + '--experimental-modules', + require.resolve('../fixtures/source-map/babel-esm.mjs') + ]); + assert.ok( + output.stderr.toString().match(/->.*babel-esm-original\.mjs:9:29/) + ); +} + function getSourceMapFromCache(fixtureFile, coverageDirectory) { const jsonFiles = fs.readdirSync(coverageDirectory); for (const jsonFile of jsonFiles) { - const maybeSourceMapCache = require( - path.join(coverageDirectory, jsonFile) - )['source-map-cache'] || {}; + let maybeSourceMapCache; + try { + maybeSourceMapCache = require( + path.join(coverageDirectory, jsonFile) + )['source-map-cache'] || {}; + } catch (err) { + console.warn(err); + maybeSourceMapCache = {}; + } const keys = Object.keys(maybeSourceMapCache); for (const key of keys) { if (key.includes(fixtureFile)) { From e7f604f495568091686678c1a4a612d1e0ea7889 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Fri, 27 Sep 2019 12:12:18 -0500 Subject: [PATCH 46/65] esm: remove proxy for builtin exports PR-URL: https://github.com/nodejs/node/pull/29737 Reviewed-By: Guy Bedford Reviewed-By: Gus Caplan Reviewed-By: Jan Krems Reviewed-By: Matteo Collina Reviewed-By: Minwoo Jung Reviewed-By: Benjamin Gruenbaum --- doc/api/esm.md | 12 ++-- doc/api/modules.md | 30 ++++++++ lib/internal/bootstrap/loaders.js | 92 ++++++++++-------------- lib/internal/modules/cjs/loader.js | 8 +++ lib/internal/modules/esm/translators.js | 10 +-- test/es-module/test-esm-live-binding.mjs | 24 ++++++- 6 files changed, 107 insertions(+), 69 deletions(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 580528401629e2..e0a548f0424410 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -555,10 +555,11 @@ cjs === 'cjs'; // true ## Builtin modules -Builtin modules will provide named exports of their public API, as well as a -default export which can be used for, among other things, modifying the named -exports. Named exports of builtin modules are updated when the corresponding -exports property is accessed, redefined, or deleted. +Builtin modules will provide named exports of their public API. A +default export is also provided which is the value of the CommonJS exports. +The default export can be used for, among other things, modifying the named +exports. Named exports of builtin modules are updated only by calling +[`module.syncBuiltinESMExports()`][]. ```js import EventEmitter from 'events'; @@ -578,8 +579,10 @@ readFile('./foo.txt', (err, source) => { ```js import fs, { readFileSync } from 'fs'; +import { syncBuiltinESMExports } from 'module'; fs.readFileSync = () => Buffer.from('Hello, ESM'); +syncBuiltinESMExports(); fs.readFileSync === readFileSync; ``` @@ -1008,6 +1011,7 @@ success! [`import.meta.url`]: #esm_import_meta [`import`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import [`module.createRequire()`]: modules.html#modules_module_createrequire_filename +[`module.syncBuiltinESMExports()`]: modules.html#modules_module_syncbuiltinesmexports [dynamic instantiate hook]: #esm_dynamic_instantiate_hook [package exports]: #esm_package_exports [special scheme]: https://url.spec.whatwg.org/#special-scheme diff --git a/doc/api/modules.md b/doc/api/modules.md index 32490cf47f1792..9ed9273e0b578f 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -984,6 +984,36 @@ const requireUtil = createRequireFromPath('../src/utils/'); requireUtil('./some-tool'); ``` +### module.syncBuiltinESMExports() + + +The `module.syncBuiltinESMExports()` method updates all the live bindings for +builtin ES Modules to match the properties of the CommonJS exports. It does +not add or remove exported names from the ES Modules. + +```js +const fs = require('fs'); +const { syncBuiltinESMExports } = require('module'); + +fs.readFile = null; + +delete fs.readFileSync; + +fs.newAPI = function newAPI() { + // ... +}; + +syncBuiltinESMExports(); + +import('fs').then((esmFS) => { + assert.strictEqual(esmFS.readFile, null); + assert.strictEqual('readFileSync' in fs, true); + assert.strictEqual(esmFS.newAPI, undefined); +}); +``` + [GLOBAL_FOLDERS]: #modules_loading_from_the_global_folders [`Error`]: errors.html#errors_class_error [`__dirname`]: #modules_dirname diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index cc1157a55774e2..dbc21a9697e800 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -151,6 +151,7 @@ function NativeModule(id) { this.id = id; this.exports = {}; this.reflect = undefined; + this.esmFacade = undefined; this.exportKeys = undefined; this.loaded = false; this.loading = false; @@ -211,15 +212,19 @@ function requireWithFallbackInDeps(request) { } // This is exposed for public loaders -NativeModule.prototype.compileForPublicLoader = function(needToProxify) { +NativeModule.prototype.compileForPublicLoader = function(needToSyncExports) { if (!this.canBeRequiredByUsers) { // No code because this is an assertion against bugs // eslint-disable-next-line no-restricted-syntax throw new Error(`Should not compile ${this.id} for public use`); } this.compile(); - if (needToProxify && !this.exportKeys) { - this.proxifyExports(); + if (needToSyncExports) { + if (!this.exportKeys) { + this.exportKeys = Object.keys(this.exports); + } + this.getESMFacade(); + this.syncExports(); } return this.exports; }; @@ -230,61 +235,38 @@ const getOwn = (target, property, receiver) => { undefined; }; +NativeModule.prototype.getURL = function() { + return `node:${this.id}`; +}; + +NativeModule.prototype.getESMFacade = function() { + if (this.esmFacade) return this.esmFacade; + const createDynamicModule = nativeModuleRequire( + 'internal/modules/esm/create_dynamic_module'); + const url = this.getURL(); + return this.esmFacade = createDynamicModule( + [], [...this.exportKeys, 'default'], url, (reflect) => { + this.reflect = reflect; + this.syncExports(); + reflect.exports.default.set(this.exports); + }); +}; + // Provide named exports for all builtin libraries so that the libraries // may be imported in a nicer way for ESM users. The default export is left -// as the entire namespace (module.exports) and wrapped in a proxy such -// that APMs and other behavior are still left intact. -NativeModule.prototype.proxifyExports = function() { - this.exportKeys = Object.keys(this.exports); - - const update = (property, value) => { - if (this.reflect !== undefined && - ObjectPrototype.hasOwnProperty(this.reflect.exports, property)) - this.reflect.exports[property].set(value); - }; - - const handler = { - __proto__: null, - defineProperty: (target, prop, descriptor) => { - // Use `Object.defineProperty` instead of `Reflect.defineProperty` - // to throw the appropriate error if something goes wrong. - Object.defineProperty(target, prop, descriptor); - if (typeof descriptor.get === 'function' && - !Reflect.has(handler, 'get')) { - handler.get = (target, prop, receiver) => { - const value = Reflect.get(target, prop, receiver); - if (ObjectPrototype.hasOwnProperty(target, prop)) - update(prop, value); - return value; - }; - } - update(prop, getOwn(target, prop)); - return true; - }, - deleteProperty: (target, prop) => { - if (Reflect.deleteProperty(target, prop)) { - update(prop, undefined); - return true; - } - return false; - }, - set: (target, prop, value, receiver) => { - const descriptor = Reflect.getOwnPropertyDescriptor(target, prop); - if (Reflect.set(target, prop, value, receiver)) { - if (descriptor && typeof descriptor.set === 'function') { - for (const key of this.exportKeys) { - update(key, getOwn(target, key, receiver)); - } - } else { - update(prop, getOwn(target, prop, receiver)); - } - return true; - } - return false; +// as the entire namespace (module.exports) and updates when this function is +// called so that APMs and other behavior are supported. +NativeModule.prototype.syncExports = function() { + const names = this.exportKeys; + if (this.reflect) { + for (let i = 0; i < names.length; i++) { + const exportName = names[i]; + if (exportName === 'default') continue; + this.reflect.exports[exportName].set( + getOwn(this.exports, exportName, this.exports) + ); } - }; - - this.exports = new Proxy(this.exports, handler); + } }; NativeModule.prototype.compile = function() { diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index e4c71f2edf44ef..77f5eeb319c4b9 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -1130,6 +1130,14 @@ Module._preloadModules = function(requests) { parent.require(requests[n]); }; +Module.syncBuiltinESMExports = function syncBuiltinESMExports() { + for (const mod of NativeModule.map.values()) { + if (mod.canBeRequiredByUsers) { + mod.syncExports(); + } + } +}; + // Backwards compatibility Module.Module = Module; diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 7a84b51e2d0e05..7e6c017213b0c4 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -129,14 +129,8 @@ translators.set('builtin', async function builtinStrategy(url) { if (!module) { throw new ERR_UNKNOWN_BUILTIN_MODULE(id); } - return createDynamicModule( - [], [...module.exportKeys, 'default'], url, (reflect) => { - debug(`Loading BuiltinModule ${url}`); - module.reflect = reflect; - for (const key of module.exportKeys) - reflect.exports[key].set(module.exports[key]); - reflect.exports.default.set(module.exports); - }); + debug(`Loading BuiltinModule ${url}`); + return module.getESMFacade(); }); // Strategy for loading a JSON file diff --git a/test/es-module/test-esm-live-binding.mjs b/test/es-module/test-esm-live-binding.mjs index 5858b13bb51861..4000a621a2bd04 100644 --- a/test/es-module/test-esm-live-binding.mjs +++ b/test/es-module/test-esm-live-binding.mjs @@ -1,6 +1,7 @@ // Flags: --experimental-modules import '../common/index.mjs'; import assert from 'assert'; +import { syncBuiltinESMExports } from 'module'; import fs, { readFile, readFileSync } from 'fs'; import events, { defaultMaxListeners } from 'events'; @@ -14,10 +15,12 @@ const s = Symbol(); const fn = () => s; Reflect.deleteProperty(fs, 'readFile'); +syncBuiltinESMExports(); assert.deepStrictEqual([fs.readFile, readFile], [undefined, undefined]); fs.readFile = fn; +syncBuiltinESMExports(); assert.deepStrictEqual([fs.readFile(), readFile()], [s, s]); @@ -26,10 +29,12 @@ Reflect.defineProperty(fs, 'readFile', { configurable: true, writable: true, }); +syncBuiltinESMExports(); assert.deepStrictEqual([fs.readFile(), readFile()], [s, s]); Reflect.deleteProperty(fs, 'readFile'); +syncBuiltinESMExports(); assert.deepStrictEqual([fs.readFile, readFile], [undefined, undefined]); @@ -39,10 +44,14 @@ Reflect.defineProperty(fs, 'readFile', { get() { return count; }, configurable: true, }); +syncBuiltinESMExports(); + +assert.deepStrictEqual([readFile, fs.readFile], [0, 0]); count++; +syncBuiltinESMExports(); -assert.deepStrictEqual([readFile, fs.readFile, readFile], [0, 1, 1]); +assert.deepStrictEqual([fs.readFile, readFile], [1, 1]); let otherValue; @@ -62,6 +71,7 @@ Reflect.defineProperty(fs, 'readFileSync', { }); fs.readFile = 2; +syncBuiltinESMExports(); assert.deepStrictEqual([readFile, readFileSync], [undefined, 2]); @@ -86,17 +96,23 @@ Reflect.defineProperty(Function.prototype, 'defaultMaxListeners', { }); }, }); +syncBuiltinESMExports(); assert.strictEqual(defaultMaxListeners, originDefaultMaxListeners); assert.strictEqual(events.defaultMaxListeners, originDefaultMaxListeners); -assert.strictEqual(++events.defaultMaxListeners, +events.defaultMaxListeners += 1; + +assert.strictEqual(events.defaultMaxListeners, originDefaultMaxListeners + 1); +syncBuiltinESMExports(); + assert.strictEqual(defaultMaxListeners, originDefaultMaxListeners + 1); assert.strictEqual(Function.prototype.defaultMaxListeners, 1); Function.prototype.defaultMaxListeners = 'foo'; +syncBuiltinESMExports(); assert.strictEqual(Function.prototype.defaultMaxListeners, 'foo'); assert.strictEqual(events.defaultMaxListeners, originDefaultMaxListeners + 1); @@ -117,16 +133,19 @@ const p = { }; util.__proto__ = p; // eslint-disable-line no-proto +syncBuiltinESMExports(); assert.strictEqual(util.foo, 1); util.foo = 'bar'; +syncBuiltinESMExports(); assert.strictEqual(count, 1); assert.strictEqual(util.foo, 'bar'); assert.strictEqual(p.foo, 2); p.foo = 'foo'; +syncBuiltinESMExports(); assert.strictEqual(p.foo, 'foo'); @@ -135,6 +154,7 @@ util.__proto__ = utilProto; // eslint-disable-line no-proto Reflect.deleteProperty(util, 'foo'); Reflect.deleteProperty(Function.prototype, 'defaultMaxListeners'); +syncBuiltinESMExports(); assert.throws( () => Object.defineProperty(events, 'defaultMaxListeners', { value: 3 }), From 6c75cc1b11fb38448290d16c224f738f6f84fc8d Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 3 Oct 2019 20:53:58 +0200 Subject: [PATCH 47/65] stream: do not deadlock duplexpair If nothing is buffered then _read will not be called and the callback will not be invoked, effectivly deadlocking. Fixes: https://github.com/nodejs/node/issues/29758 PR-URL: https://github.com/nodejs/node/pull/29836 Refs: https://github.com/nodejs/node/pull/29649 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Minwoo Jung --- doc/api/stream.md | 4 +++- lib/internal/streams/duplexpair.js | 8 ++++++-- test/common/duplexpair.js | 8 ++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 4bdf3159dfaa80..8189f5c84d93ab 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2059,7 +2059,9 @@ when `_read()` is called again after it has stopped should it resume pushing additional data onto the queue. Once the `readable._read()` method has been called, it will not be called again -until the [`readable.push()`][stream-push] method is called. +until more data is pushed through the [`readable.push()`][stream-push] method. +Empty data such as empty buffers and strings will not cause `readable._read()` +to be called. The `size` argument is advisory. For implementations where a "read" is a single operation that returns data can use the `size` argument to determine how diff --git a/lib/internal/streams/duplexpair.js b/lib/internal/streams/duplexpair.js index beaf9e9eb3d03d..6735bcb2b92531 100644 --- a/lib/internal/streams/duplexpair.js +++ b/lib/internal/streams/duplexpair.js @@ -20,8 +20,12 @@ class DuplexSocket extends Duplex { } _write(chunk, encoding, callback) { - this[kOtherSide][kCallback] = callback; - this[kOtherSide].push(chunk); + if (chunk.length === 0) { + process.nextTick(callback); + } else { + this[kOtherSide].push(chunk); + this[kOtherSide][kCallback] = callback; + } } _final(callback) { diff --git a/test/common/duplexpair.js b/test/common/duplexpair.js index 0783aeb861100e..4eb4f326f2d295 100644 --- a/test/common/duplexpair.js +++ b/test/common/duplexpair.js @@ -24,8 +24,12 @@ class DuplexSocket extends Duplex { _write(chunk, encoding, callback) { assert.notStrictEqual(this[kOtherSide], null); assert.strictEqual(this[kOtherSide][kCallback], null); - this[kOtherSide][kCallback] = callback; - this[kOtherSide].push(chunk); + if (chunk.length === 0) { + process.nextTick(callback); + } else { + this[kOtherSide].push(chunk); + this[kOtherSide][kCallback] = callback; + } } _final(callback) { From b309e2066144c66b43f522efed2b5598f5873834 Mon Sep 17 00:00:00 2001 From: Austin Wright Date: Sat, 21 Sep 2019 17:30:29 -0700 Subject: [PATCH 48/65] test: add test for HTTP server response with Connection: close PR-URL: https://github.com/nodejs/node/pull/29836 Refs: https://github.com/nodejs/node/issues/29758 Refs: https://github.com/nodejs/node/pull/29649 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Minwoo Jung --- test/parallel/test-http-generic-streams.js | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/test/parallel/test-http-generic-streams.js b/test/parallel/test-http-generic-streams.js index bc28d1fcd4632b..aea371432a3d07 100644 --- a/test/parallel/test-http-generic-streams.js +++ b/test/parallel/test-http-generic-streams.js @@ -23,6 +23,7 @@ const MakeDuplexPair = require('../common/duplexpair'); res.on('data', common.mustCall((data) => { assert.strictEqual(data, testData); })); + res.on('end', common.mustCall()); })); req.end(); } @@ -58,3 +59,82 @@ const MakeDuplexPair = require('../common/duplexpair'); doRequest(); }); } + +// Test 3: Connection: close request/response with chunked +{ + const testData = 'Hello, World!\n'; + const server = http.createServer(common.mustCall((req, res) => { + req.setEncoding('utf8'); + req.resume(); + req.on('data', common.mustCall(function test3_req_data(data) { + assert.strictEqual(data, testData); + })); + req.once('end', function() { + res.statusCode = 200; + res.setHeader('Content-Type', 'text/plain'); + res.write(testData); + res.end(); + }); + })); + + const { clientSide, serverSide } = MakeDuplexPair(); + server.emit('connection', serverSide); + clientSide.on('end', common.mustCall()); + serverSide.on('end', common.mustCall()); + + const req = http.request({ + createConnection: common.mustCall(() => clientSide), + method: 'PUT', + headers: { 'Connection': 'close' } + }, common.mustCall((res) => { + res.setEncoding('utf8'); + res.on('data', common.mustCall(function test3_res_data(data) { + assert.strictEqual(data, testData); + })); + res.on('end', common.mustCall()); + })); + req.write(testData); + req.end(); +} + +// Test 4: Connection: close request/response with Content-Length +// The same as Test 3, but with Content-Length headers +{ + const testData = 'Hello, World!\n'; + const server = http.createServer(common.mustCall((req, res) => { + assert.strictEqual(req.headers['content-length'], testData.length + ''); + req.setEncoding('utf8'); + req.on('data', common.mustCall(function test4_req_data(data) { + assert.strictEqual(data, testData); + })); + req.once('end', function() { + res.statusCode = 200; + res.setHeader('Content-Type', 'text/plain'); + res.setHeader('Content-Length', testData.length); + res.write(testData); + res.end(); + }); + + })); + + const { clientSide, serverSide } = MakeDuplexPair(); + server.emit('connection', serverSide); + clientSide.on('end', common.mustCall()); + serverSide.on('end', common.mustCall()); + + const req = http.request({ + createConnection: common.mustCall(() => clientSide), + method: 'PUT', + headers: { 'Connection': 'close' } + }, common.mustCall((res) => { + res.setEncoding('utf8'); + assert.strictEqual(res.headers['content-length'], testData.length + ''); + res.on('data', common.mustCall(function test4_res_data(data) { + assert.strictEqual(data, testData); + })); + res.on('end', common.mustCall()); + })); + req.setHeader('Content-Length', testData.length); + req.write(testData); + req.end(); +} From 600478ac137fff82f9c2b584e5aa1a45339592a1 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 2 Oct 2019 23:26:51 +0200 Subject: [PATCH 49/65] dgram: use `uv_udp_try_send()` This improves dgram performance by avoiding unnecessary async operations. One issue with this commit is that it seems hard to actually create conditions under which the fallback path to the async case is actually taken, for all supported OS, so an internal CLI option is used for testing that path. Another caveat is that the lack of an async operation means that there are slight timing differences (essentially `nextTick()` rather than `setImmediate()` for the send callback). PR-URL: https://github.com/nodejs/node/pull/29832 Reviewed-By: David Carlier Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis --- benchmark/dgram/array-vs-concat.js | 20 ++++++--- benchmark/dgram/multi-buffer.js | 10 +++-- benchmark/dgram/offset-length.js | 10 +++-- benchmark/dgram/single-buffer.js | 10 +++-- lib/dgram.js | 8 ++++ src/node_options.cc | 2 + src/node_options.h | 1 + src/udp_wrap.cc | 44 ++++++++++++++----- test/async-hooks/test-udpsendwrap.js | 1 + .../test-dgram-send-callback-recursive.js | 2 +- test/sequential/test-async-wrap-getasyncid.js | 2 +- 11 files changed, 82 insertions(+), 28 deletions(-) diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js index 669cf47df40ff2..d260a48063d489 100644 --- a/benchmark/dgram/array-vs-concat.js +++ b/benchmark/dgram/array-vs-concat.js @@ -29,17 +29,25 @@ function main({ dur, len, num, type, chunks }) { function onsendConcat() { if (sent++ % num === 0) { - for (var i = 0; i < num; i++) { - socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend); - } + // The setImmediate() is necessary to have event loop progress on OSes + // that only perform synchronous I/O on nonblocking UDP sockets. + setImmediate(() => { + for (var i = 0; i < num; i++) { + socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend); + } + }); } } function onsendMulti() { if (sent++ % num === 0) { - for (var i = 0; i < num; i++) { - socket.send(chunk, PORT, '127.0.0.1', onsend); - } + // The setImmediate() is necessary to have event loop progress on OSes + // that only perform synchronous I/O on nonblocking UDP sockets. + setImmediate(() => { + for (var i = 0; i < num; i++) { + socket.send(chunk, PORT, '127.0.0.1', onsend); + } + }); } } diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js index a1c50551b87196..7b69a82255ed4b 100644 --- a/benchmark/dgram/multi-buffer.js +++ b/benchmark/dgram/multi-buffer.js @@ -27,9 +27,13 @@ function main({ dur, len, num, type, chunks }) { function onsend() { if (sent++ % num === 0) { - for (var i = 0; i < num; i++) { - socket.send(chunk, PORT, '127.0.0.1', onsend); - } + // The setImmediate() is necessary to have event loop progress on OSes + // that only perform synchronous I/O on nonblocking UDP sockets. + setImmediate(() => { + for (var i = 0; i < num; i++) { + socket.send(chunk, PORT, '127.0.0.1', onsend); + } + }); } } diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js index 7c672acae20404..696fa6a7a0c0bd 100644 --- a/benchmark/dgram/offset-length.js +++ b/benchmark/dgram/offset-length.js @@ -23,9 +23,13 @@ function main({ dur, len, num, type }) { function onsend() { if (sent++ % num === 0) { - for (var i = 0; i < num; i++) { - socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend); - } + // The setImmediate() is necessary to have event loop progress on OSes + // that only perform synchronous I/O on nonblocking UDP sockets. + setImmediate(() => { + for (var i = 0; i < num; i++) { + socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend); + } + }); } } diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js index d183b9cd1d69a6..5c95b17887d37a 100644 --- a/benchmark/dgram/single-buffer.js +++ b/benchmark/dgram/single-buffer.js @@ -23,9 +23,13 @@ function main({ dur, len, num, type }) { function onsend() { if (sent++ % num === 0) { - for (var i = 0; i < num; i++) { - socket.send(chunk, PORT, '127.0.0.1', onsend); - } + // The setImmediate() is necessary to have event loop progress on OSes + // that only perform synchronous I/O on nonblocking UDP sockets. + setImmediate(() => { + for (var i = 0; i < num; i++) { + socket.send(chunk, PORT, '127.0.0.1', onsend); + } + }); } } diff --git a/lib/dgram.js b/lib/dgram.js index 923463cc2e7e08..cc61d4d274eea1 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -666,6 +666,14 @@ function doSend(ex, self, ip, list, address, port, callback) { else err = state.handle.send(req, list, list.length, !!callback); + if (err >= 1) { + // Synchronous finish. The return code is msg_length + 1 so that we can + // distinguish between synchronous success and asynchronous success. + if (callback) + process.nextTick(callback, null, err - 1); + return; + } + if (err && callback) { // Don't emit as error, dgram_legacy.js compatibility const ex = exceptionWithHostPort(err, 'send', address, port); diff --git a/src/node_options.cc b/src/node_options.cc index 917de69fe8e875..caba0b28c7d1b1 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -466,6 +466,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "write warnings to file instead of stderr", &EnvironmentOptions::redirect_warnings, kAllowedInEnvironment); + AddOption("--test-udp-no-try-send", "", // For testing only. + &EnvironmentOptions::test_udp_no_try_send); AddOption("--throw-deprecation", "throw an exception on deprecations", &EnvironmentOptions::throw_deprecation, diff --git a/src/node_options.h b/src/node_options.h index 89f6363f4a6e04..0721a4fe2f8821 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -137,6 +137,7 @@ class EnvironmentOptions : public Options { bool heap_prof = false; #endif // HAVE_INSPECTOR std::string redirect_warnings; + bool test_udp_no_try_send = false; bool throw_deprecation = false; bool trace_deprecation = false; bool trace_sync_io = false; diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 3c66db2155ab74..64c4c8b304fc5f 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -429,11 +429,6 @@ void UDPWrap::DoSend(const FunctionCallbackInfo& args, int family) { size_t count = args[2].As()->Value(); const bool have_callback = sendto ? args[5]->IsTrue() : args[3]->IsTrue(); - SendWrap* req_wrap; - { - AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(wrap); - req_wrap = new SendWrap(env, req_wrap_obj, have_callback); - } size_t msg_size = 0; MaybeStackBuffer bufs(count); @@ -448,8 +443,6 @@ void UDPWrap::DoSend(const FunctionCallbackInfo& args, int family) { msg_size += length; } - req_wrap->msg_size = msg_size; - int err = 0; struct sockaddr_storage addr_storage; sockaddr* addr = nullptr; @@ -462,18 +455,47 @@ void UDPWrap::DoSend(const FunctionCallbackInfo& args, int family) { } } + uv_buf_t* bufs_ptr = *bufs; + if (err == 0 && !UNLIKELY(env->options()->test_udp_no_try_send)) { + err = uv_udp_try_send(&wrap->handle_, bufs_ptr, count, addr); + if (err == UV_ENOSYS || err == UV_EAGAIN) { + err = 0; + } else if (err >= 0) { + size_t sent = err; + while (count > 0 && bufs_ptr->len <= sent) { + sent -= bufs_ptr->len; + bufs_ptr++; + count--; + } + if (count > 0) { + CHECK_LT(sent, bufs_ptr->len); + bufs_ptr->base += sent; + bufs_ptr->len -= sent; + } else { + CHECK_EQ(static_cast(err), msg_size); + // + 1 so that the JS side can distinguish 0-length async sends from + // 0-length sync sends. + args.GetReturnValue().Set(static_cast(msg_size) + 1); + return; + } + } + } + if (err == 0) { + AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(wrap); + SendWrap* req_wrap = new SendWrap(env, req_wrap_obj, have_callback); + req_wrap->msg_size = msg_size; + err = req_wrap->Dispatch(uv_udp_send, &wrap->handle_, - *bufs, + bufs_ptr, count, addr, OnSend); + if (err) + delete req_wrap; } - if (err) - delete req_wrap; - args.GetReturnValue().Set(err); } diff --git a/test/async-hooks/test-udpsendwrap.js b/test/async-hooks/test-udpsendwrap.js index 25b7eb6103d6f5..f1403e3226a165 100644 --- a/test/async-hooks/test-udpsendwrap.js +++ b/test/async-hooks/test-udpsendwrap.js @@ -1,3 +1,4 @@ +// Flags: --test-udp-no-try-send 'use strict'; const common = require('../common'); diff --git a/test/parallel/test-dgram-send-callback-recursive.js b/test/parallel/test-dgram-send-callback-recursive.js index 835fa332dfbe4d..1a4c7c84fc2719 100644 --- a/test/parallel/test-dgram-send-callback-recursive.js +++ b/test/parallel/test-dgram-send-callback-recursive.js @@ -22,7 +22,7 @@ function onsend() { client.on('listening', function() { port = this.address().port; - setImmediate(function() { + process.nextTick(() => { async = true; }); diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index f2702b4b497597..bef6b050ff3178 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose-gc --expose-internals --no-warnings +// Flags: --expose-gc --expose-internals --no-warnings --test-udp-no-try-send const common = require('../common'); const { internalBinding } = require('internal/test/binding'); From 60296a36122bfe4cd16f0611965993fccfc6582c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 3 Oct 2019 09:53:42 +0200 Subject: [PATCH 50/65] lib: make tick processor detect xcodebuild errors `node --prof-process` on macOS calls out to nm(1) to look up C++ symbols. If Xcode hasn't been properly installed or its license hasn't been accepted yet, it prints out an error and exits. Before this commit, that error was swallowed and the output of the tick processor was not showing the C++ entry points. This commit detects that error message and turns it into an exception. No regression test because this particular condition is hard to test for without going to extreme lengths to mock the output of nm. Fixes: https://github.com/nodejs/node/issues/29804 PR-URL: https://github.com/nodejs/node/pull/29830 Reviewed-By: David Carlier Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Minwoo Jung Reviewed-By: James M Snell --- lib/internal/v8_prof_polyfill.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/internal/v8_prof_polyfill.js b/lib/internal/v8_prof_polyfill.js index 59e1b8947eed55..7d8d3ff0202d20 100644 --- a/lib/internal/v8_prof_polyfill.js +++ b/lib/internal/v8_prof_polyfill.js @@ -48,8 +48,15 @@ const os = { } let out = cp.spawnSync(name, args).stdout.toString(); // Auto c++filt names, but not [iItT] - if (process.platform === 'darwin' && name === 'nm') + if (process.platform === 'darwin' && name === 'nm') { + // nm prints an error along the lines of "Run xcodebuild -license" and + // exits when Xcode hasn't been properly installed or when its license + // hasn't been accepted yet. Basically any mention of xcodebuild in + // the output means the nm command is non-functional. + const match = out.match(/(?:^|\n)([^\n]*xcodebuild[^\n]*)(?:\n|$)/); + if (match) throw new Error(match[1]); out = macCppfiltNm(out); + } return out; } }; From ba4946a520f3c810c802fa7cf88d3c7e92e60478 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 3 Oct 2019 02:24:19 +0200 Subject: [PATCH 51/65] tools: prohibit Error.prepareStackTrace() usage This eslint rule makes sure that `prepareStackTrace()` is not used in Node.js core. PR-URL: https://github.com/nodejs/node/pull/29827 Reviewed-By: James M Snell Reviewed-By: Gus Caplan --- lib/.eslintrc.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index b7e8e1f4fbeb4a..f66e15e6d963e8 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -33,6 +33,8 @@ rules: message: "Use an error exported by the internal/errors module." - selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']" message: "Please use `require('internal/errors').hideStackFrames()` instead." + - selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])" + message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'." # Custom rules in tools/eslint-rules node-core/lowercase-name-for-primitive: error node-core/non-ascii-character: error From 90562ae35685c7c0eafb743bfa14fd8ec9305d1b Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 4 Oct 2019 13:37:27 -0400 Subject: [PATCH 52/65] module: use v8 synthetic modules PR-URL: https://github.com/nodejs/node/pull/29846 Reviewed-By: Gus Caplan Reviewed-By: Minwoo Jung --- lib/internal/bootstrap/loaders.js | 30 ++--- lib/internal/modules/cjs/loader.js | 28 ++--- lib/internal/modules/esm/loader.js | 9 +- lib/internal/modules/esm/module_job.js | 6 +- lib/internal/modules/esm/translators.js | 42 ++++--- src/module_wrap.cc | 147 +++++++++++++++++++----- src/module_wrap.h | 7 ++ 7 files changed, 173 insertions(+), 96 deletions(-) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index dbc21a9697e800..0cad5209c4ff4e 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -150,8 +150,7 @@ function NativeModule(id) { this.filename = `${id}.js`; this.id = id; this.exports = {}; - this.reflect = undefined; - this.esmFacade = undefined; + this.module = undefined; this.exportKeys = undefined; this.loaded = false; this.loading = false; @@ -240,16 +239,18 @@ NativeModule.prototype.getURL = function() { }; NativeModule.prototype.getESMFacade = function() { - if (this.esmFacade) return this.esmFacade; - const createDynamicModule = nativeModuleRequire( - 'internal/modules/esm/create_dynamic_module'); + if (this.module) return this.module; + const { ModuleWrap } = internalBinding('module_wrap'); const url = this.getURL(); - return this.esmFacade = createDynamicModule( - [], [...this.exportKeys, 'default'], url, (reflect) => { - this.reflect = reflect; - this.syncExports(); - reflect.exports.default.set(this.exports); - }); + const nativeModule = this; + this.module = new ModuleWrap(function() { + nativeModule.syncExports(); + this.setExport('default', nativeModule.exports); + }, [...this.exportKeys, 'default'], url); + // Ensure immediate sync execution to capture exports now + this.module.instantiate(); + this.module.evaluate(-1, false); + return this.module; }; // Provide named exports for all builtin libraries so that the libraries @@ -258,13 +259,12 @@ NativeModule.prototype.getESMFacade = function() { // called so that APMs and other behavior are supported. NativeModule.prototype.syncExports = function() { const names = this.exportKeys; - if (this.reflect) { + if (this.module) { for (let i = 0; i < names.length; i++) { const exportName = names[i]; if (exportName === 'default') continue; - this.reflect.exports[exportName].set( - getOwn(this.exports, exportName, this.exports) - ); + this.module.setExport(exportName, + getOwn(this.exports, exportName, this.exports)); } } }; diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 77f5eeb319c4b9..2d058b7e0dace3 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -75,9 +75,7 @@ const experimentalExports = getOptionValue('--experimental-exports'); module.exports = Module; -let asyncESM; -let ModuleJob; -let createDynamicModule; +let asyncESM, ModuleJob, ModuleWrap, kInstantiated; const { CHAR_FORWARD_SLASH, @@ -820,21 +818,18 @@ Module.prototype.load = function(filename) { const module = ESMLoader.moduleMap.get(url); // Create module entry at load time to snapshot exports correctly const exports = this.exports; - if (module !== undefined) { // Called from cjs translator - if (module.reflect) { - module.reflect.onReady((reflect) => { - reflect.exports.default.set(exports); - }); - } + // Called from cjs translator + if (module !== undefined && module.module !== undefined) { + if (module.module.getStatus() >= kInstantiated) + module.module.setExport('default', exports); } else { // preemptively cache ESMLoader.moduleMap.set( url, - new ModuleJob(ESMLoader, url, async () => { - return createDynamicModule( - [], ['default'], url, (reflect) => { - reflect.exports.default.set(exports); - }); - }) + new ModuleJob(ESMLoader, url, () => + new ModuleWrap(function() { + this.setExport('default', exports); + }, ['default'], url) + ) ); } } @@ -1145,6 +1140,5 @@ Module.Module = Module; if (experimentalModules) { asyncESM = require('internal/process/esm_loader'); ModuleJob = require('internal/modules/esm/module_job'); - createDynamicModule = require( - 'internal/modules/esm/create_dynamic_module'); + ({ ModuleWrap, kInstantiated } = internalBinding('module_wrap')); } diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index 9800e8a550c2e0..138cf8b5ecc3ed 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -117,12 +117,7 @@ class Loader { source, url = pathToFileURL(`${process.cwd()}/[eval${++this.evalIndex}]`).href ) { - const evalInstance = async (url) => { - return { - module: new ModuleWrap(source, url), - reflect: undefined - }; - }; + const evalInstance = (url) => new ModuleWrap(source, url); const job = new ModuleJob(this, url, evalInstance, false); this.moduleMap.set(url, job); const { module, result } = await job.run(); @@ -165,7 +160,7 @@ class Loader { return createDynamicModule([], exports, url, (reflect) => { debug(`Loading dynamic ${url}`); execute(reflect.exports); - }); + }).module; }; } else { if (!translators.has(format)) diff --git a/lib/internal/modules/esm/module_job.js b/lib/internal/modules/esm/module_job.js index 6f265ed4608743..ef11e2ec833b89 100644 --- a/lib/internal/modules/esm/module_job.js +++ b/lib/internal/modules/esm/module_job.js @@ -30,19 +30,17 @@ class ModuleJob { // onto `this` by `link()` below once it has been resolved. this.modulePromise = moduleProvider.call(loader, url, isMain); this.module = undefined; - this.reflect = undefined; // Wait for the ModuleWrap instance being linked with all dependencies. const link = async () => { - ({ module: this.module, - reflect: this.reflect } = await this.modulePromise); + this.module = await this.modulePromise; assert(this.module instanceof ModuleWrap); const dependencyJobs = []; const promises = this.module.link(async (specifier) => { const jobPromise = this.loader.getModuleJob(specifier, url); dependencyJobs.push(jobPromise); - return (await (await jobPromise).modulePromise).module; + return (await jobPromise).modulePromise; }); if (promises !== undefined) diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 7e6c017213b0c4..6c710202b85b77 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -33,6 +33,8 @@ const { const readFileAsync = promisify(fs.readFile); const JsonParse = JSON.parse; const { maybeCacheSourceMap } = require('internal/source_map/source_map_cache'); +const moduleWrap = internalBinding('module_wrap'); +const { ModuleWrap } = moduleWrap; const debug = debuglog('esm'); @@ -78,22 +80,18 @@ translators.set('module', async function moduleStrategy(url) { const source = `${await getSource(url)}`; maybeCacheSourceMap(url, source); debug(`Translating StandardModule ${url}`); - const { ModuleWrap, callbackMap } = internalBinding('module_wrap'); const module = new ModuleWrap(stripShebang(source), url); - callbackMap.set(module, { + moduleWrap.callbackMap.set(module, { initializeImportMeta, importModuleDynamically, }); - return { - module, - reflect: undefined, - }; + return module; }); // Strategy for loading a node-style CommonJS module const isWindows = process.platform === 'win32'; const winSepRegEx = /\//g; -translators.set('commonjs', async function commonjsStrategy(url, isMain) { +translators.set('commonjs', function commonjsStrategy(url, isMain) { debug(`Translating CJSModule ${url}`); const pathname = internalURLModule.fileURLToPath(new URL(url)); const cached = this.cjsCache.get(url); @@ -106,17 +104,17 @@ translators.set('commonjs', async function commonjsStrategy(url, isMain) { ]; if (module && module.loaded) { const exports = module.exports; - return createDynamicModule([], ['default'], url, (reflect) => { - reflect.exports.default.set(exports); - }); + return new ModuleWrap(function() { + this.setExport('default', exports); + }, ['default'], url); } - return createDynamicModule([], ['default'], url, () => { + return new ModuleWrap(function() { debug(`Loading CJSModule ${url}`); // We don't care about the return val of _load here because Module#load // will handle it for us by checking the loader registry and filling the // exports like above CJSModule._load(pathname, undefined, isMain); - }); + }, ['default'], url); }); // Strategy for loading a node builtin CommonJS module that isn't @@ -146,9 +144,9 @@ translators.set('json', async function jsonStrategy(url) { module = CJSModule._cache[modulePath]; if (module && module.loaded) { const exports = module.exports; - return createDynamicModule([], ['default'], url, (reflect) => { - reflect.exports.default.set(exports); - }); + return new ModuleWrap(function() { + this.setExport('default', exports); + }, ['default'], url); } } const content = `${await getSource(url)}`; @@ -159,9 +157,9 @@ translators.set('json', async function jsonStrategy(url) { module = CJSModule._cache[modulePath]; if (module && module.loaded) { const exports = module.exports; - return createDynamicModule(['default'], url, (reflect) => { - reflect.exports.default.set(exports); - }); + return new ModuleWrap(function() { + this.setExport('default', exports); + }, ['default'], url); } } try { @@ -181,10 +179,10 @@ translators.set('json', async function jsonStrategy(url) { if (pathname) { CJSModule._cache[modulePath] = module; } - return createDynamicModule([], ['default'], url, (reflect) => { + return new ModuleWrap(function() { debug(`Parsing JSONModule ${url}`); - reflect.exports.default.set(module.exports); - }); + this.setExport('default', module.exports); + }, ['default'], url); }); // Strategy for loading a wasm module @@ -207,5 +205,5 @@ translators.set('wasm', async function(url) { const { exports } = new WebAssembly.Instance(compiled, reflect.imports); for (const expt of Object.keys(exports)) reflect.exports[expt].set(exports[expt]); - }); + }).module; }); diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 2d0829860cefbf..67e0cbc6185f34 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -98,6 +98,9 @@ ModuleWrap* ModuleWrap::GetFromID(Environment* env, uint32_t id) { return module_wrap_it->second; } +// new ModuleWrap(source, url) +// new ModuleWrap(source, url, context?, lineOffset, columnOffset) +// new ModuleWrap(syntheticExecutionFunction, export_names, url) void ModuleWrap::New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Isolate* isolate = env->isolate(); @@ -108,12 +111,6 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { const int argc = args.Length(); CHECK_GE(argc, 2); - CHECK(args[0]->IsString()); - Local source_text = args[0].As(); - - CHECK(args[1]->IsString()); - Local url = args[1].As(); - Local context; Local line_offset; Local column_offset; @@ -143,8 +140,7 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { column_offset = Integer::New(isolate, 0); } - ShouldNotAbortOnUncaughtScope no_abort_scope(env); - TryCatchScope try_catch(env); + Local url; Local module; Local host_defined_options = @@ -152,29 +148,60 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { host_defined_options->Set(isolate, HostDefinedOptions::kType, Number::New(isolate, ScriptType::kModule)); - // compile - { - ScriptOrigin origin(url, - line_offset, // line offset - column_offset, // column offset - True(isolate), // is cross origin - Local(), // script id - Local(), // source map URL - False(isolate), // is opaque (?) - False(isolate), // is WASM - True(isolate), // is ES Module - host_defined_options); - Context::Scope context_scope(context); - ScriptCompiler::Source source(source_text, origin); - if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) { - if (try_catch.HasCaught() && !try_catch.HasTerminated()) { - CHECK(!try_catch.Message().IsEmpty()); - CHECK(!try_catch.Exception().IsEmpty()); - AppendExceptionLine(env, try_catch.Exception(), try_catch.Message(), - ErrorHandlingMode::MODULE_ERROR); - try_catch.ReThrow(); + // new ModuleWrap(syntheticExecutionFunction, export_names, url) + bool synthetic = args[0]->IsFunction(); + if (synthetic) { + CHECK(args[1]->IsArray()); + Local export_names_arr = args[1].As(); + + uint32_t len = export_names_arr->Length(); + std::vector> export_names(len); + for (uint32_t i = 0; i < len; i++) { + Local export_name_val = + export_names_arr->Get(context, i).ToLocalChecked(); + CHECK(export_name_val->IsString()); + export_names[i] = export_name_val.As(); + } + + CHECK(args[2]->IsString()); + url = args[2].As(); + + module = Module::CreateSyntheticModule(isolate, url, export_names, + SyntheticModuleEvaluationStepsCallback); + // Compile + } else { + CHECK(args[0]->IsString()); + Local source_text = args[0].As(); + + CHECK(args[1]->IsString()); + url = args[1].As(); + + ShouldNotAbortOnUncaughtScope no_abort_scope(env); + TryCatchScope try_catch(env); + + { + ScriptOrigin origin(url, + line_offset, // line offset + column_offset, // column offset + True(isolate), // is cross origin + Local(), // script id + Local(), // source map URL + False(isolate), // is opaque (?) + False(isolate), // is WASM + True(isolate), // is ES Module + host_defined_options); + Context::Scope context_scope(context); + ScriptCompiler::Source source(source_text, origin); + if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) { + if (try_catch.HasCaught() && !try_catch.HasTerminated()) { + CHECK(!try_catch.Message().IsEmpty()); + CHECK(!try_catch.Exception().IsEmpty()); + AppendExceptionLine(env, try_catch.Exception(), try_catch.Message(), + ErrorHandlingMode::MODULE_ERROR); + try_catch.ReThrow(); + } + return; } - return; } } @@ -183,6 +210,13 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { } ModuleWrap* obj = new ModuleWrap(env, that, module, url); + + if (synthetic) { + obj->synthetic_ = true; + obj->synthetic_evaluation_steps_.Reset( + env->isolate(), args[0].As()); + } + obj->context_.Reset(isolate, context); env->hash_to_module_map.emplace(module->GetIdentityHash(), obj); @@ -307,6 +341,10 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo& args) { result = module->Evaluate(context); } + if (result.IsEmpty()) { + CHECK(try_catch.HasCaught()); + } + // Convert the termination exception into a regular exception. if (timed_out || received_signal) { if (!env->is_main_thread() && env->is_stopping()) @@ -1295,7 +1333,7 @@ static MaybeLocal ImportModuleDynamically( Local result; if (import_callback->Call( context, - v8::Undefined(iso), + Undefined(iso), arraysize(import_args), import_args).ToLocal(&result)) { CHECK(result->IsPromise()); @@ -1355,6 +1393,52 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( HostInitializeImportMetaObjectCallback); } +MaybeLocal ModuleWrap::SyntheticModuleEvaluationStepsCallback( + Local context, Local module) { + Environment* env = Environment::GetCurrent(context); + Isolate* isolate = env->isolate(); + + ModuleWrap* obj = GetFromModule(env, module); + + TryCatchScope try_catch(env); + Local synthetic_evaluation_steps = + obj->synthetic_evaluation_steps_.Get(isolate); + MaybeLocal ret = synthetic_evaluation_steps->Call(context, + obj->object(), 0, nullptr); + if (ret.IsEmpty()) { + CHECK(try_catch.HasCaught()); + } + obj->synthetic_evaluation_steps_.Reset(); + if (try_catch.HasCaught() && !try_catch.HasTerminated()) { + CHECK(!try_catch.Message().IsEmpty()); + CHECK(!try_catch.Exception().IsEmpty()); + try_catch.ReThrow(); + return MaybeLocal(); + } + return Undefined(isolate); +} + +void ModuleWrap::SetSyntheticExport( + const v8::FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local that = args.This(); + + ModuleWrap* obj; + ASSIGN_OR_RETURN_UNWRAP(&obj, that); + + CHECK(obj->synthetic_); + + CHECK_EQ(args.Length(), 2); + + CHECK(args[0]->IsString()); + Local export_name = args[0].As(); + + Local export_value = args[1]; + + Local module = obj->module_.Get(isolate); + module->SetSyntheticModuleExport(export_name, export_value); +} + void ModuleWrap::Initialize(Local target, Local unused, Local context, @@ -1369,6 +1453,7 @@ void ModuleWrap::Initialize(Local target, env->SetProtoMethod(tpl, "link", Link); env->SetProtoMethod(tpl, "instantiate", Instantiate); env->SetProtoMethod(tpl, "evaluate", Evaluate); + env->SetProtoMethod(tpl, "setExport", SetSyntheticExport); env->SetProtoMethodNoSideEffect(tpl, "getNamespace", GetNamespace); env->SetProtoMethodNoSideEffect(tpl, "getStatus", GetStatus); env->SetProtoMethodNoSideEffect(tpl, "getError", GetError); diff --git a/src/module_wrap.h b/src/module_wrap.h index 9e2aa3b9489dd3..ef20d255e916da 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -69,12 +69,19 @@ class ModuleWrap : public BaseObject { const v8::FunctionCallbackInfo& args); static void SetInitializeImportMetaObjectCallback( const v8::FunctionCallbackInfo& args); + static v8::MaybeLocal SyntheticModuleEvaluationStepsCallback( + v8::Local context, v8::Local module); + static void SetSyntheticExport( + const v8::FunctionCallbackInfo& args); + static v8::MaybeLocal ResolveCallback( v8::Local context, v8::Local specifier, v8::Local referrer); static ModuleWrap* GetFromModule(node::Environment*, v8::Local); + v8::Global synthetic_evaluation_steps_; + bool synthetic_ = false; v8::Global module_; v8::Global url_; bool linked_ = false; From a240d45d1acdd4af897f8ab6846fec44cb867126 Mon Sep 17 00:00:00 2001 From: ZYSzys Date: Thu, 3 Oct 2019 01:19:05 +0800 Subject: [PATCH 53/65] http2: support passing options of http2.connect to net.connect PR-URL: https://github.com/nodejs/node/pull/29816 Fixes: https://github.com/nodejs/node/issues/29811 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat Reviewed-By: Jiawen Geng --- lib/internal/http2/core.js | 2 +- test/parallel/test-http2-client-port-80.js | 2 +- test/parallel/test-http2-connect-options.js | 42 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-http2-connect-options.js diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 5925cbfefc52d9..73dc6a41e9930a 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2920,7 +2920,7 @@ function connect(authority, options, listener) { } else { switch (protocol) { case 'http:': - socket = net.connect(options.port || port, options.host || host); + socket = net.connect({ port, host, ...options }); break; case 'https:': socket = tls.connect(port, host, initializeTLSOptions(options, host)); diff --git a/test/parallel/test-http2-client-port-80.js b/test/parallel/test-http2-client-port-80.js index fc82e231f6af8f..a286dbf6a725d8 100644 --- a/test/parallel/test-http2-client-port-80.js +++ b/test/parallel/test-http2-client-port-80.js @@ -11,7 +11,7 @@ const net = require('net'); const connect = net.connect; net.connect = common.mustCall((...args) => { - assert.strictEqual(args[0], '80'); + assert.strictEqual(args[0].port, '80'); return connect(...args); }); diff --git a/test/parallel/test-http2-connect-options.js b/test/parallel/test-http2-connect-options.js new file mode 100644 index 00000000000000..1a7987621ab34e --- /dev/null +++ b/test/parallel/test-http2-connect-options.js @@ -0,0 +1,42 @@ +// Flags: --expose-internals +'use strict'; +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!common.hasMultiLocalhost()) + common.skip('platform-specific test.'); + +const http2 = require('http2'); +const assert = require('assert'); + +const server = http2.createServer((req, res) => { + console.log(`Connect from: ${req.connection.remoteAddress}`); + assert.strictEqual(req.connection.remoteAddress, '127.0.0.2'); + + req.on('end', common.mustCall(() => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.end(`You are from: ${req.connection.remoteAddress}`); + })); + req.resume(); +}); + +server.listen(0, '127.0.0.1', common.mustCall(() => { + const options = { localAddress: '127.0.0.2' }; + + const client = http2.connect( + 'http://localhost:' + server.address().port, + options + ); + const req = client.request({ + ':path': '/' + }); + req.on('data', () => req.resume()); + req.on('end', common.mustCall(function() { + client.close(); + req.close(); + server.close(); + process.exit(); + })); + req.end(); +})); From f566cd5801f081c193d65e73a1b6e7614266c12f Mon Sep 17 00:00:00 2001 From: Jakob Krigovsky Date: Fri, 4 Oct 2019 13:38:34 +0200 Subject: [PATCH 54/65] doc: remove misleading paragraph about the Legacy URL API The Legacy URL API is deprecated, see: - https://nodejs.org/api/url.html#url_legacy_url_api - https://nodejs.org/api/deprecations.html# deprecations_dep0116_legacy_url_api PR-URL: https://github.com/nodejs/node/pull/29844 Reviewed-By: James M Snell Reviewed-By: David Carlier Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: Anto Aravinth Reviewed-By: Luigi Pinca Reviewed-By: Minwoo Jung --- doc/api/url.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/api/url.md b/doc/api/url.md index 6cb82c71676e3a..3583d3107491b6 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -21,10 +21,6 @@ The `url` module provides two APIs for working with URLs: a legacy API that is Node.js specific, and a newer API that implements the same [WHATWG URL Standard][] used by web browsers. -While the Legacy API has not been deprecated, it is maintained solely for -backwards compatibility with existing applications. New application code -should use the WHATWG API. - A comparison between the WHATWG and Legacy APIs is provided below. Above the URL `'http://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash'`, properties of an object returned by the legacy `url.parse()` are shown. Below it are From b76a2e502c6f227f7df5f35ac3bbb0dcb2a8372d Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Tue, 27 Aug 2019 17:14:27 -0700 Subject: [PATCH 55/65] fs: introduce `opendir()` and `fs.Dir` This adds long-requested methods for asynchronously interacting and iterating through directory entries by using `uv_fs_opendir`, `uv_fs_readdir`, and `uv_fs_closedir`. `fs.opendir()` and friends return an `fs.Dir`, which contains methods for doing reads and cleanup. `fs.Dir` also has the async iterator symbol exposed. The `read()` method and friends only return `fs.Dirent`s for this API. Having a entry type or doing a `stat` call is deemed to be necessary in the majority of cases, so just returning dirents seems like the logical choice for a new api. Reading when there are no more entries returns `null` instead of a dirent. However the async iterator hides that (and does automatic cleanup). The code lives in separate files from the rest of fs, this is done partially to prevent over-pollution of those (already very large) files, but also in the case of js allows loading into `fsPromises`. Due to async_hooks, this introduces a new handle type of `DIRHANDLE`. This PR does not attempt to make complete optimization of this feature. Notable future improvements include: - Moving promise work into C++ land like FileHandle. - Possibly adding `readv()` to do multi-entry directory reads. - Aliasing `fs.readdir` to `fs.scandir` and doing a deprecation. Refs: https://github.com/nodejs/node-v0.x-archive/issues/388 Refs: https://github.com/nodejs/node/issues/583 Refs: https://github.com/libuv/libuv/pull/2057 PR-URL: https://github.com/nodejs/node/pull/29349 Reviewed-By: Anna Henningsen Reviewed-By: David Carlier --- doc/api/errors.md | 6 + doc/api/fs.md | 216 ++++++++++- lib/fs.js | 27 +- lib/internal/errors.js | 1 + lib/internal/fs/dir.js | 201 ++++++++++ lib/internal/fs/promises.js | 2 + lib/internal/fs/utils.js | 52 ++- node.gyp | 3 + src/async_wrap.h | 1 + src/env.h | 1 + src/node_binding.cc | 1 + src/node_dir.cc | 350 ++++++++++++++++++ src/node_dir.h | 60 +++ src/node_file.cc | 90 ----- src/node_file.h | 89 +++++ test/parallel/test-bootstrap-modules.js | 2 + test/parallel/test-fs-opendir.js | 174 +++++++++ test/sequential/test-async-wrap-getasyncid.js | 7 + tools/doc/type-parser.js | 1 + 19 files changed, 1165 insertions(+), 119 deletions(-) create mode 100644 lib/internal/fs/dir.js create mode 100644 src/node_dir.cc create mode 100644 src/node_dir.h create mode 100644 test/parallel/test-fs-opendir.js diff --git a/doc/api/errors.md b/doc/api/errors.md index 4b92452cd362a0..329c369d152a30 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -824,6 +824,11 @@ A signing `key` was not provided to the [`sign.sign()`][] method. [`crypto.timingSafeEqual()`][] was called with `Buffer`, `TypedArray`, or `DataView` arguments of different lengths. + +### ERR_DIR_CLOSED + +The [`fs.Dir`][] was previously closed. + ### ERR_DNS_SET_SERVERS_FAILED @@ -2380,6 +2385,7 @@ such as `process.stdout.on('data')`. [`dgram.disconnect()`]: dgram.html#dgram_socket_disconnect [`dgram.remoteAddress()`]: dgram.html#dgram_socket_remoteaddress [`errno`(3) man page]: http://man7.org/linux/man-pages/man3/errno.3.html +[`fs.Dir`]: fs.html#fs_class_fs_dir [`fs.readFileSync`]: fs.html#fs_fs_readfilesync_path_options [`fs.readdir`]: fs.html#fs_fs_readdir_path_options_callback [`fs.symlink()`]: fs.html#fs_fs_symlink_target_path_type_callback diff --git a/doc/api/fs.md b/doc/api/fs.md index c22e169f1c3937..a6736d127e9bbc 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -284,13 +284,148 @@ synchronous use libuv's threadpool, which can have surprising and negative performance implications for some applications. See the [`UV_THREADPOOL_SIZE`][] documentation for more information. +## Class fs.Dir + + +A class representing a directory stream. + +Created by [`fs.opendir()`][], [`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. + +Example using async interation: + +```js +const fs = require('fs'); + +async function print(path) { + const dir = await fs.promises.opendir(path); + for await (const dirent of dir) { + console.log(dirent.name); + } +} +print('./').catch(console.error); +``` + +### dir.path + + +* {string} + +The read-only path of this directory as was provided to [`fs.opendir()`][], +[`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. + +### dir.close() + + +* Returns: {Promise} + +Asynchronously close the directory's underlying resource handle. +Subsequent reads will result in errors. + +A `Promise` is returned that will be resolved after the resource has been +closed. + +### dir.close(callback) + + +* `callback` {Function} + * `err` {Error} + +Asynchronously close the directory's underlying resource handle. +Subsequent reads will result in errors. + +The `callback` will be called after the resource handle has been closed. + +### dir.closeSync() + + +Synchronously close the directory's underlying resource handle. +Subsequent reads will result in errors. + +### dir.read([options]) + + +* `options` {Object} + * `encoding` {string|null} **Default:** `'utf8'` +* Returns: {Promise} containing {fs.Dirent} + +Asynchronously read the next directory entry via readdir(3) as an +[`fs.Dirent`][]. + +A `Promise` is returned that will be resolved with a [Dirent][] after the read +is completed. + +_Directory entries returned by this function are in no particular order as +provided by the operating system's underlying directory mechanisms._ + +### dir.read([options, ]callback) + + +* `options` {Object} + * `encoding` {string|null} **Default:** `'utf8'` +* `callback` {Function} + * `err` {Error} + * `dirent` {fs.Dirent} + +Asynchronously read the next directory entry via readdir(3) as an +[`fs.Dirent`][]. + +The `callback` will be called with a [Dirent][] after the read is completed. + +The `encoding` option sets the encoding of the `name` in the `dirent`. + +_Directory entries returned by this function are in no particular order as +provided by the operating system's underlying directory mechanisms._ + +### dir.readSync([options]) + + +* `options` {Object} + * `encoding` {string|null} **Default:** `'utf8'` +* Returns: {fs.Dirent} + +Synchronously read the next directory entry via readdir(3) as an +[`fs.Dirent`][]. + +The `encoding` option sets the encoding of the `name` in the `dirent`. + +_Directory entries returned by this function are in no particular order as +provided by the operating system's underlying directory mechanisms._ + +### dir\[Symbol.asyncIterator\]() + + +* Returns: {AsyncIterator} to fully iterate over all entries in the directory. + +_Directory entries returned by this iterator are in no particular order as +provided by the operating system's underlying directory mechanisms._ + ## Class: fs.Dirent -When [`fs.readdir()`][] or [`fs.readdirSync()`][] is called with the -`withFileTypes` option set to `true`, the resulting array is filled with +A representation of a directory entry, as returned by reading from an [`fs.Dir`][]. + +Additionally, when [`fs.readdir()`][] or [`fs.readdirSync()`][] is called with +the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffers`. ### dirent.isBlockDevice() @@ -2505,6 +2640,46 @@ Returns an integer representing the file descriptor. For detailed information, see the documentation of the asynchronous version of this API: [`fs.open()`][]. +## fs.opendir(path[, options], callback) + + +* `path` {string|Buffer|URL} +* `options` {Object} + * `encoding` {string|null} **Default:** `'utf8'` +* `callback` {Function} + * `err` {Error} + * `dir` {fs.Dir} + +Asynchronously open a directory. See opendir(3). + +Creates an [`fs.Dir`][], which contains all further functions for reading from +and cleaning up the directory. + +The `encoding` option sets the encoding for the `path` while opening the +directory and subsequent read operations (unless otherwise overriden during +reads from the directory). + +## fs.opendirSync(path[, options]) + + +* `path` {string|Buffer|URL} +* `options` {Object} + * `encoding` {string|null} **Default:** `'utf8'` +* Returns: {fs.Dir} + +Synchronously open a directory. See opendir(3). + +Creates an [`fs.Dir`][], which contains all further functions for reading from +and cleaning up the directory. + +The `encoding` option sets the encoding for the `path` while opening the +directory and subsequent read operations (unless otherwise overriden during +reads from the directory). + ## fs.read(fd, buffer, offset, length, position, callback) + +* `path` {string|Buffer|URL} +* `options` {Object} + * `encoding` {string|null} **Default:** `'utf8'` +* Returns: {Promise} containing {fs.Dir} + +Asynchronously open a directory. See opendir(3). + +Creates an [`fs.Dir`][], which contains all further functions for reading from +and cleaning up the directory. + +The `encoding` option sets the encoding for the `path` while opening the +directory and subsequent read operations (unless otherwise overriden during +reads from the directory). + +Example using async interation: + +```js +const fs = require('fs'); + +async function print(path) { + const dir = await fs.promises.opendir(path); + for await (const dirent of dir) { + console.log(dirent.name); + } +} +print('./').catch(console.error); +``` + ### fsPromises.readdir(path[, options]) + +Enable experimental JSON support for the ES Module loader. + ### `--experimental-modules` -* `fd` {number} A readable file descriptor. +* `fd` {number|FileHandle} A readable file descriptor. * `headers` {HTTP/2 Headers Object} * `options` {Object} * `statCheck` {Function} @@ -1491,8 +1494,8 @@ The `offset` and `length` options may be used to limit the response to a specific range subset. This can be used, for instance, to support HTTP Range requests. -The file descriptor is not closed when the stream is closed, so it will need -to be closed manually once it is no longer needed. +The file descriptor or `FileHandle` is not closed when the stream is closed, +so it will need to be closed manually once it is no longer needed. Using the same file descriptor concurrently for multiple streams is not supported and may result in data loss. Re-using a file descriptor after a stream has finished is supported. diff --git a/lib/fs.js b/lib/fs.js index 4e994775a3042d..a435470fa71401 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1948,7 +1948,7 @@ Object.defineProperties(fs, { enumerable: true, get() { if (promises === null) - promises = require('internal/fs/promises'); + promises = require('internal/fs/promises').exports; return promises; } } diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 923ae97abdc26f..9843064efbc472 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -46,7 +46,7 @@ const { const pathModule = require('path'); const { promisify } = require('internal/util'); -const kHandle = Symbol('handle'); +const kHandle = Symbol('kHandle'); const { kUsePromises } = binding; const getDirectoryEntriesPromise = promisify(getDirents); @@ -498,29 +498,33 @@ async function readFile(path, options) { } module.exports = { - access, - copyFile, - open, - opendir: promisify(opendir), - rename, - truncate, - rmdir, - mkdir, - readdir, - readlink, - symlink, - lstat, - stat, - link, - unlink, - chmod, - lchmod, - lchown, - chown, - utimes, - realpath, - mkdtemp, - writeFile, - appendFile, - readFile + exports: { + access, + copyFile, + open, + opendir: promisify(opendir), + rename, + truncate, + rmdir, + mkdir, + readdir, + readlink, + symlink, + lstat, + stat, + link, + unlink, + chmod, + lchmod, + lchown, + chown, + utimes, + realpath, + mkdtemp, + writeFile, + appendFile, + readFile, + }, + + FileHandle }; diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 73dc6a41e9930a..28c91ee22d8f6d 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -82,6 +82,7 @@ const { hideStackFrames } = require('internal/errors'); const { validateNumber, validateString } = require('internal/validators'); +const fsPromisesInternal = require('internal/fs/promises'); const { utcDate } = require('internal/http'); const { onServerStream, Http2ServerRequest, @@ -2545,7 +2546,10 @@ class ServerHttp2Stream extends Http2Stream { this[kState].flags |= STREAM_FLAGS_HAS_TRAILERS; } - validateNumber(fd, 'fd'); + if (fd instanceof fsPromisesInternal.FileHandle) + fd = fd.fd; + else if (typeof fd !== 'number') + throw new ERR_INVALID_ARG_TYPE('fd', ['number', 'FileHandle'], fd); debugStreamObj(this, 'initiating response from fd'); this[kUpdateTimer](); diff --git a/test/parallel/test-http2-respond-file-fd-errors.js b/test/parallel/test-http2-respond-file-fd-errors.js index 9508cfae9799c0..5de21e7855eac1 100644 --- a/test/parallel/test-http2-respond-file-fd-errors.js +++ b/test/parallel/test-http2-respond-file-fd-errors.js @@ -42,7 +42,8 @@ server.on('stream', common.mustCall((stream) => { { type: TypeError, code: 'ERR_INVALID_ARG_TYPE', - message: 'The "fd" argument must be of type number. Received type ' + + message: 'The "fd" argument must be one of type number or FileHandle.' + + ' Received type ' + typeof types[type] } ); diff --git a/test/parallel/test-http2-respond-file-filehandle.js b/test/parallel/test-http2-respond-file-filehandle.js new file mode 100644 index 00000000000000..bc7bfbe356ff92 --- /dev/null +++ b/test/parallel/test-http2-respond-file-filehandle.js @@ -0,0 +1,47 @@ +'use strict'; + +const common = require('../common'); +const fixtures = require('../common/fixtures'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const http2 = require('http2'); +const assert = require('assert'); +const fs = require('fs'); + +const { + HTTP2_HEADER_CONTENT_TYPE, + HTTP2_HEADER_CONTENT_LENGTH +} = http2.constants; + +const fname = fixtures.path('elipses.txt'); +const data = fs.readFileSync(fname); +const stat = fs.statSync(fname); +fs.promises.open(fname, 'r').then(common.mustCall((fileHandle) => { + const server = http2.createServer(); + server.on('stream', (stream) => { + stream.respondWithFD(fileHandle, { + [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain', + [HTTP2_HEADER_CONTENT_LENGTH]: stat.size, + }); + }); + server.on('close', common.mustCall(() => fileHandle.close())); + server.listen(0, common.mustCall(() => { + + const client = http2.connect(`http://localhost:${server.address().port}`); + const req = client.request(); + + req.on('response', common.mustCall((headers) => { + assert.strictEqual(headers[HTTP2_HEADER_CONTENT_TYPE], 'text/plain'); + assert.strictEqual(+headers[HTTP2_HEADER_CONTENT_LENGTH], data.length); + })); + req.setEncoding('utf8'); + let check = ''; + req.on('data', (chunk) => check += chunk); + req.on('end', common.mustCall(() => { + assert.strictEqual(check, data.toString('utf8')); + client.close(); + server.close(); + })); + req.end(); + })); +})); From c56f765cf6c2ccad24b077ef2e975904b65511c0 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Wed, 9 Oct 2019 12:10:06 -0700 Subject: [PATCH 60/65] fs: remove options.encoding from Dir.read*() This is unlikely to be necessary in any case, and causes much unwarrented complexity when implementing further optimizations. Refs: https://github.com/nodejs/node/pull/29893#discussion_r333179482 PR-URL: https://github.com/nodejs/node/pull/29908 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api/fs.md | 25 ++++++------------------- lib/internal/fs/dir.js | 12 ++++-------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index a6736d127e9bbc..885272724d2384 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -351,13 +351,11 @@ added: REPLACEME Synchronously close the directory's underlying resource handle. Subsequent reads will result in errors. -### dir.read([options]) +### dir.read() -* `options` {Object} - * `encoding` {string|null} **Default:** `'utf8'` * Returns: {Promise} containing {fs.Dirent} Asynchronously read the next directory entry via readdir(3) as an @@ -369,13 +367,11 @@ is completed. _Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms._ -### dir.read([options, ]callback) +### dir.read(callback) -* `options` {Object} - * `encoding` {string|null} **Default:** `'utf8'` * `callback` {Function} * `err` {Error} * `dirent` {fs.Dirent} @@ -385,25 +381,19 @@ Asynchronously read the next directory entry via readdir(3) as an The `callback` will be called with a [Dirent][] after the read is completed. -The `encoding` option sets the encoding of the `name` in the `dirent`. - _Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms._ -### dir.readSync([options]) +### dir.readSync() -* `options` {Object} - * `encoding` {string|null} **Default:** `'utf8'` * Returns: {fs.Dirent} Synchronously read the next directory entry via readdir(3) as an [`fs.Dirent`][]. -The `encoding` option sets the encoding of the `name` in the `dirent`. - _Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms._ @@ -2658,8 +2648,7 @@ Creates an [`fs.Dir`][], which contains all further functions for reading from and cleaning up the directory. The `encoding` option sets the encoding for the `path` while opening the -directory and subsequent read operations (unless otherwise overriden during -reads from the directory). +directory and subsequent read operations. ## fs.opendirSync(path[, options]) -* Returns: {Promise} containing {fs.Dirent} +* Returns: {Promise} containing {fs.Dirent|null} Asynchronously read the next directory entry via readdir(3) as an [`fs.Dirent`][]. -A `Promise` is returned that will be resolved with a [Dirent][] after the read -is completed. +After the read is completed, a `Promise` is returned that will be resolved with +an [`fs.Dirent`][], or `null` if there are no more directory entries to read. _Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms._ @@ -374,12 +372,13 @@ added: REPLACEME * `callback` {Function} * `err` {Error} - * `dirent` {fs.Dirent} + * `dirent` {fs.Dirent|null} Asynchronously read the next directory entry via readdir(3) as an [`fs.Dirent`][]. -The `callback` will be called with a [Dirent][] after the read is completed. +After the read is completed, the `callback` will be called with an +[`fs.Dirent`][], or `null` if there are no more directory entries to read. _Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms._ @@ -389,11 +388,13 @@ provided by the operating system's underlying directory mechanisms._ added: REPLACEME --> -* Returns: {fs.Dirent} +* Returns: {fs.Dirent|null} Synchronously read the next directory entry via readdir(3) as an [`fs.Dirent`][]. +If there are no more directory entries to read, `null` will be returned. + _Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms._ @@ -402,7 +403,15 @@ provided by the operating system's underlying directory mechanisms._ added: REPLACEME --> -* Returns: {AsyncIterator} to fully iterate over all entries in the directory. +* Returns: {AsyncIterator} of {fs.Dirent} + +Asynchronously iterates over the directory via readdir(3) until all entries have +been read. + +Entries returned by the async iterator are always an [`fs.Dirent`][]. +The `null` case from `dir.read()` is handled internally. + +See [`fs.Dir`][] for an example. _Directory entries returned by this iterator are in no particular order as provided by the operating system's underlying directory mechanisms._ @@ -4825,7 +4834,7 @@ and cleaning up the directory. The `encoding` option sets the encoding for the `path` while opening the directory and subsequent read operations. -Example using async interation: +Example using async iteration: ```js const fs = require('fs'); From ea6b6abb91f39ce11b43d88a4eb630fdab0b2bd5 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Mon, 26 Aug 2019 23:52:08 -0400 Subject: [PATCH 62/65] doc: remove spaces inside code span elements Applies MarkdownLint MD038 rule PR-URL: https://github.com/nodejs/node/pull/29329 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- doc/STYLE_GUIDE.md | 2 +- doc/api/buffer.md | 2 +- doc/guides/contributing/pull-requests.md | 2 +- doc/guides/writing-tests.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md index 3cc162f6dc8300..6f98ad1fc8fb4e 100644 --- a/doc/STYLE_GUIDE.md +++ b/doc/STYLE_GUIDE.md @@ -43,7 +43,7 @@ * Instances should use camelCase. * Denote methods with parentheses: `socket.end()` instead of `socket.end`. * Function arguments or object properties should use the following format: - * ``` * `name` {type|type2} Optional description. **Default:** `value`. ``` + * ```* `name` {type|type2} Optional description. **Default:** `value`.``` * For example: * `byteOffset` {integer} Index of first byte to expose. **Default:** `0`. diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 2a254380f2b1f5..713024a21bd1ce 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1458,7 +1458,7 @@ changes: * `value` {string|Buffer|Uint8Array|integer} What to search for. * `byteOffset` {integer} Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. **Default:** - [`buf.length`][]` - 1`. + [`buf.length`][] `- 1`. * `encoding` {string} If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. **Default:** `'utf8'`. diff --git a/doc/guides/contributing/pull-requests.md b/doc/guides/contributing/pull-requests.md index a9ac6e42541b12..17257674a3b546 100644 --- a/doc/guides/contributing/pull-requests.md +++ b/doc/guides/contributing/pull-requests.md @@ -440,7 +440,7 @@ check with the contributor to see if they intend to continue the work before checking if they would mind if you took it over (especially if it just has nits left). When doing so, it is courteous to give the original contributor credit for the work they started (either by preserving their name and email -address in the commit log, or by using an `Author: ` meta-data tag in the +address in the commit log, or by using an `Author:` meta-data tag in the commit. ### Approving a change diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index f34c07cc151c59..584b1d2373ce1b 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -249,7 +249,7 @@ fs.readFile('test-file').then( ### Flags Some tests will require running Node.js with specific command line flags set. To -accomplish this, add a `// Flags: ` comment in the preamble of the +accomplish this, add a `// Flags:` comment in the preamble of the test followed by the flags. For example, to allow a test to require some of the `internal/*` modules, add the `--expose-internals` flag. A test that would require `internal/freelist` could start like this: From 6a5d401f304e4b192e495f2cd9ee6483e2a59745 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 2 Oct 2019 01:18:17 -0400 Subject: [PATCH 63/65] test: remove spaces inside code span elements Applies MarkdownLint MD038 rule PR-URL: https://github.com/nodejs/node/pull/29329 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- doc/api/buffer.md | 2 +- test/README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 713024a21bd1ce..2d37c65b8d3b6b 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1458,7 +1458,7 @@ changes: * `value` {string|Buffer|Uint8Array|integer} What to search for. * `byteOffset` {integer} Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. **Default:** - [`buf.length`][] `- 1`. + `buf.length - 1`. * `encoding` {string} If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. **Default:** `'utf8'`. diff --git a/test/README.md b/test/README.md index fcfafb492bc5d8..ad9d87a7e93051 100644 --- a/test/README.md +++ b/test/README.md @@ -15,7 +15,7 @@ For the tests to run on Windows, be sure to clone Node.js source code with the | Directory | Runs on CI | Purpose | | ------------------- | --------------- | --------------- | -| `abort` | Yes | Tests for when the ``` --abort-on-uncaught-exception ``` flag is used. | +| `abort` | Yes | Tests for when the `--abort-on-uncaught-exception` flag is used. | | `addons` | Yes | Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon. | | `async-hooks` | Yes | Tests for [async_hooks](https://nodejs.org/api/async_hooks.html) functionality. | | `benchmark` | No | Test minimal functionality of benchmarks. | @@ -28,12 +28,12 @@ For the tests to run on Windows, be sure to clone Node.js source code with the | `internet` | No | Tests that make real outbound network connections. Tests for networking related modules may also be present in other directories, but those tests do not make outbound connections. | | `js-native-api` | Yes | Tests for Node.js-agnostic [n-api](https://nodejs.org/api/n-api.html) functionality. | | `known_issues` | Yes | Tests reproducing known issues within the system. All tests inside of this directory are expected to fail. If a test doesn't fail on certain platforms, those should be skipped via `known_issues.status`. | -| `message` | Yes | Tests for messages that are output for various conditions (```console.log```, error messages etc.) | +| `message` | Yes | Tests for messages that are output for various conditions (`console.log`, error messages etc.) | | `node-api` | Yes | Tests for Node.js-specific [n-api](https://nodejs.org/api/n-api.html) functionality. | | `parallel` | Yes | Various tests that are able to be run in parallel. | | `pseudo-tty` | Yes | Tests that require stdin/stdout/stderr to be a TTY. | | `pummel` | No | Various tests for various modules / system functionality operating under load. | | `sequential` | Yes | Various tests that must not run in parallel. | | `testpy` | | Test configuration utility used by various test suites. | -| `tick-processor` | No | Tests for the V8 tick processor integration. The tests are for the logic in ```lib/internal/v8_prof_processor.js``` and ```lib/internal/v8_prof_polyfill.js```. The tests confirm that the profile processor packages the correct set of scripts from V8 and introduces the correct platform specific logic. | +| `tick-processor` | No | Tests for the V8 tick processor integration. The tests are for the logic in `lib/internal/v8_prof_processor.js` and `lib/internal/v8_prof_polyfill.js`. The tests confirm that the profile processor packages the correct set of scripts from V8 and introduces the correct platform specific logic. | | `v8-updates` | No | Tests for V8 performance integration. | From 5fdf4a474f011f745de1f924d470cdd2c0cd3382 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 7 Oct 2019 11:11:36 -0400 Subject: [PATCH 64/65] test: remove extra process.exit() process.exit() has a tendency to hide test failures because it forces the process to exit. This test doesn't need the process.exit(), so this commit removes it. PR-URL: https://github.com/nodejs/node/pull/29873 Reviewed-By: Jeremiah Senkpiel Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Yongsheng Zhang Reviewed-By: Ruben Bridgewater --- test/parallel/test-http2-connect-options.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/parallel/test-http2-connect-options.js b/test/parallel/test-http2-connect-options.js index 1a7987621ab34e..0c7ec807b84d38 100644 --- a/test/parallel/test-http2-connect-options.js +++ b/test/parallel/test-http2-connect-options.js @@ -36,7 +36,6 @@ server.listen(0, '127.0.0.1', common.mustCall(() => { client.close(); req.close(); server.close(); - process.exit(); })); req.end(); })); From 921493e2287aa895679620155b5288b2e1587bfd Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 10 Oct 2019 14:31:33 +0200 Subject: [PATCH 65/65] 2019-10-11, Version 12.12.0 (Current) Notable changes: * build: * Add `--force-context-aware` flag to prevent usage of native node addons that aren't context aware https://github.com/nodejs/node/pull/29631 * deprecations: * Add documentation-only deprecation for `process._tickCallback()` https://github.com/nodejs/node/pull/29781 * esm: * Using JSON modules is experimental again https://github.com/nodejs/node/pull/29754 * fs: * Introduce `opendir()` and `fs.Dir` to iterate through directories https://github.com/nodejs/node/pull/29349 * process: * Add source-map support to stack traces by using `--source-map-support` https://github.com/nodejs/node/pull/29564 * tls: * Honor `pauseOnConnect` option https://github.com/nodejs/node/pull/29635 * Add option for private keys for OpenSSL engines https://github.com/nodejs/node/pull/28973 PR-URL: https://github.com/nodejs/node/pull/29919 --- CHANGELOG.md | 3 +- doc/api/cli.md | 4 +- doc/api/deprecations.md | 4 +- doc/api/errors.md | 2 +- doc/api/fs.md | 24 ++++----- doc/api/http2.md | 4 +- doc/api/modules.md | 2 +- doc/api/tls.md | 2 +- doc/changelogs/CHANGELOG_V12.md | 87 +++++++++++++++++++++++++++++++++ src/node_version.h | 6 +-- 10 files changed, 113 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6e21279f63122..4e90bf32d78341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,8 @@ release. -12.11.1
+12.12.0
+12.11.1
12.11.0
12.10.0
12.9.1
diff --git a/doc/api/cli.md b/doc/api/cli.md index 93dbd43c2172a9..600137150a2c30 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -137,7 +137,7 @@ Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with ### `--enable-source-maps` > Stability: 1 - Experimental @@ -457,7 +457,7 @@ Silence all process warnings (including deprecations). ### `--force-context-aware` Disable loading native addons that are not [context-aware][]. diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 9687f342b46141..83ef32ca1da6f6 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2498,7 +2498,7 @@ Passing a callback to [`worker.terminate()`][] is deprecated. Use the returned ### DEP0133: http connection @@ -2512,7 +2512,7 @@ Prefer [`response.socket`][] over [`response.connection`][] and ### DEP0134: process._tickCallback diff --git a/doc/api/errors.md b/doc/api/errors.md index 329c369d152a30..e3a3c10d6a774e 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2071,7 +2071,7 @@ state, usually after `.close()` has been called. ### ERR_CRYPTO_HASH_DIGEST_NO_UTF16 The UTF-16 encoding was used with [`hash.digest()`][]. While the diff --git a/doc/api/fs.md b/doc/api/fs.md index d7a4ebcc2e8604..37518e46b0e1c1 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -286,7 +286,7 @@ performance implications for some applications. See the ## Class fs.Dir A class representing a directory stream. @@ -307,7 +307,7 @@ print('./').catch(console.error); ### dir.path * {string} @@ -317,7 +317,7 @@ The read-only path of this directory as was provided to [`fs.opendir()`][], ### dir.close() * Returns: {Promise} @@ -330,7 +330,7 @@ closed. ### dir.close(callback) * `callback` {Function} @@ -343,7 +343,7 @@ The `callback` will be called after the resource handle has been closed. ### dir.closeSync() Synchronously close the directory's underlying resource handle. @@ -351,7 +351,7 @@ Subsequent reads will result in errors. ### dir.read() * Returns: {Promise} containing {fs.Dirent|null} @@ -367,7 +367,7 @@ provided by the operating system's underlying directory mechanisms._ ### dir.read(callback) * `callback` {Function} @@ -385,7 +385,7 @@ provided by the operating system's underlying directory mechanisms._ ### dir.readSync() * Returns: {fs.Dirent|null} @@ -400,7 +400,7 @@ provided by the operating system's underlying directory mechanisms._ ### dir\[Symbol.asyncIterator\]() * Returns: {AsyncIterator} of {fs.Dirent} @@ -2641,7 +2641,7 @@ this API: [`fs.open()`][]. ## fs.opendir(path[, options], callback) * `path` {string|Buffer|URL} @@ -2661,7 +2661,7 @@ directory and subsequent read operations. ## fs.opendirSync(path[, options]) * `path` {string|Buffer|URL} @@ -4818,7 +4818,7 @@ a colon, Node.js will open a file system stream, as described by ## fsPromises.opendir(path[, options]) * `path` {string|Buffer|URL} diff --git a/doc/api/http2.md b/doc/api/http2.md index 04fdfe52167699..0798d1ec896ff9 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1439,7 +1439,7 @@ server.on('stream', (stream) => { The `module.syncBuiltinESMExports()` method updates all the live bindings for diff --git a/doc/api/tls.md b/doc/api/tls.md index d90affa4c3b70d..70c6b96a0e471d 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -1358,7 +1358,7 @@ argument.