From ffb4087def252db3bb226adcf06baa6c99cc6728 Mon Sep 17 00:00:00 2001 From: Chi-chi Wang Date: Fri, 12 Oct 2018 13:32:55 -0500 Subject: [PATCH 001/223] src: remove function hasTextDecoder in encoding.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also... return TextDecoder directly from factories PR-URL: https://github.com/nodejs/node/pull/23625 Reviewed-By: Anna Henningsen Reviewed-By: Сковорода Никита Андреевич Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani --- lib/internal/encoding.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index 161ae72a19eaef..c0083948e0d72d 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -341,22 +341,16 @@ Object.defineProperties( value: 'TextEncoder' } }); -const { hasConverter, TextDecoder } = +const TextDecoder = process.binding('config').hasIntl ? makeTextDecoderICU() : makeTextDecoderJS(); -function hasTextDecoder(encoding = 'utf-8') { - validateArgument(encoding, 'string', 'encoding', 'string'); - return hasConverter(getEncodingFromLabel(encoding)); -} - function makeTextDecoderICU() { const { decode: _decode, getConverter, - hasConverter - } = process.binding('icu'); + } = internalBinding('icu'); class TextDecoder { constructor(encoding = 'utf-8', options = {}) { @@ -409,7 +403,7 @@ function makeTextDecoderICU() { } } - return { hasConverter, TextDecoder }; + return TextDecoder; } function makeTextDecoderJS() { @@ -497,7 +491,7 @@ function makeTextDecoderJS() { } } - return { hasConverter, TextDecoder }; + return TextDecoder; } // Mix in some shared properties. @@ -552,7 +546,6 @@ function makeTextDecoderJS() { module.exports = { getEncodingFromLabel, - hasTextDecoder, TextDecoder, TextEncoder }; From 4749640b2e3bf412647af322baa653f96b22c31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Thu, 11 Oct 2018 19:56:49 +0200 Subject: [PATCH 002/223] crypto: reduce memory usage of SignFinal The fixed-size buffer on the stack is unnecessary and way too large for most applications. This change removes it and allocates the required memory directly instead of copying into heap later. PR-URL: https://github.com/nodejs/node/pull/23427 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- src/node_crypto.cc | 71 +++++++++++++++++++++++++--------------------- src/node_crypto.h | 13 ++++----- src/util.h | 7 ++++- 3 files changed, 50 insertions(+), 41 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 8e65bd3c44b071..1027f5f760a56a 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -43,6 +43,7 @@ #include #include +#include #include static const int X509_NAME_FLAGS = ASN1_STRFLGS_ESC_CTRL @@ -3530,46 +3531,51 @@ void Sign::SignUpdate(const FunctionCallbackInfo& args) { sign->CheckThrow(err); } -static int Node_SignFinal(EVPMDPointer&& mdctx, unsigned char* md, - unsigned int* sig_len, - const EVPKeyPointer& pkey, int padding, - int pss_salt_len) { +static MallocedBuffer Node_SignFinal(EVPMDPointer&& mdctx, + const EVPKeyPointer& pkey, + int padding, + int pss_salt_len) { unsigned char m[EVP_MAX_MD_SIZE]; unsigned int m_len; - *sig_len = 0; if (!EVP_DigestFinal_ex(mdctx.get(), m, &m_len)) - return 0; + return MallocedBuffer(); + + int signed_sig_len = EVP_PKEY_size(pkey.get()); + CHECK_GE(signed_sig_len, 0); + size_t sig_len = static_cast(signed_sig_len); + MallocedBuffer sig(sig_len); - size_t sltmp = static_cast(EVP_PKEY_size(pkey.get())); EVPKeyCtxPointer pkctx(EVP_PKEY_CTX_new(pkey.get(), nullptr)); if (pkctx && EVP_PKEY_sign_init(pkctx.get()) > 0 && ApplyRSAOptions(pkey, pkctx.get(), padding, pss_salt_len) && EVP_PKEY_CTX_set_signature_md(pkctx.get(), EVP_MD_CTX_md(mdctx.get())) > 0 && - EVP_PKEY_sign(pkctx.get(), md, &sltmp, m, m_len) > 0) { - *sig_len = sltmp; - return 1; + EVP_PKEY_sign(pkctx.get(), sig.data, &sig_len, m, m_len) > 0) { + sig.Truncate(sig_len); + return sig; } - return 0; + + return MallocedBuffer(); } -SignBase::Error Sign::SignFinal(const char* key_pem, - int key_pem_len, - const char* passphrase, - unsigned char* sig, - unsigned int* sig_len, - int padding, - int salt_len) { +std::pair> Sign::SignFinal( + const char* key_pem, + int key_pem_len, + const char* passphrase, + int padding, + int salt_len) { + MallocedBuffer buffer; + if (!mdctx_) - return kSignNotInitialised; + return std::make_pair(kSignNotInitialised, std::move(buffer)); EVPMDPointer mdctx = std::move(mdctx_); BIOPointer bp(BIO_new_mem_buf(const_cast(key_pem), key_pem_len)); if (!bp) - return kSignPrivateKey; + return std::make_pair(kSignPrivateKey, std::move(buffer)); EVPKeyPointer pkey(PEM_read_bio_PrivateKey(bp.get(), nullptr, @@ -3580,7 +3586,7 @@ SignBase::Error Sign::SignFinal(const char* key_pem, // without `pkey` being set to nullptr; // cf. the test of `test_bad_rsa_privkey.pem` for an example. if (!pkey || 0 != ERR_peek_error()) - return kSignPrivateKey; + return std::make_pair(kSignPrivateKey, std::move(buffer)); #ifdef NODE_FIPS_MODE /* Validate DSA2 parameters from FIPS 186-4 */ @@ -3604,10 +3610,9 @@ SignBase::Error Sign::SignFinal(const char* key_pem, } #endif // NODE_FIPS_MODE - if (Node_SignFinal(std::move(mdctx), sig, sig_len, pkey, padding, salt_len)) - return kSignOk; - else - return kSignPrivateKey; + buffer = Node_SignFinal(std::move(mdctx), pkey, padding, salt_len); + Error error = buffer.is_empty() ? kSignPrivateKey : kSignOk; + return std::make_pair(error, std::move(buffer)); } @@ -3631,22 +3636,22 @@ void Sign::SignFinal(const FunctionCallbackInfo& args) { int salt_len = args[3].As()->Value(); ClearErrorOnReturn clear_error_on_return; - unsigned char md_value[8192]; - unsigned int md_len = sizeof(md_value); - Error err = sign->SignFinal( + std::pair> ret = sign->SignFinal( buf, buf_len, len >= 2 && !args[1]->IsNull() ? *passphrase : nullptr, - md_value, - &md_len, padding, salt_len); - if (err != kSignOk) - return sign->CheckThrow(err); + + if (std::get(ret) != kSignOk) + return sign->CheckThrow(std::get(ret)); + + MallocedBuffer sig = + std::move(std::get>(ret)); Local rc = - Buffer::Copy(env, reinterpret_cast(md_value), md_len) + Buffer::New(env, reinterpret_cast(sig.release()), sig.size) .ToLocalChecked(); args.GetReturnValue().Set(rc); } diff --git a/src/node_crypto.h b/src/node_crypto.h index fd865e909d773f..6fcf737f6c43c3 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -518,13 +518,12 @@ class Sign : public SignBase { public: static void Initialize(Environment* env, v8::Local target); - Error SignFinal(const char* key_pem, - int key_pem_len, - const char* passphrase, - unsigned char* sig, - unsigned int* sig_len, - int padding, - int saltlen); + std::pair> SignFinal( + const char* key_pem, + int key_pem_len, + const char* passphrase, + int padding, + int saltlen); protected: static void New(const v8::FunctionCallbackInfo& args); diff --git a/src/util.h b/src/util.h index d41255bd32cc81..880408df4d57fd 100644 --- a/src/util.h +++ b/src/util.h @@ -439,9 +439,14 @@ struct MallocedBuffer { return ret; } + void Truncate(size_t new_size) { + CHECK(new_size <= size); + size = new_size; + } + inline bool is_empty() const { return data == nullptr; } - MallocedBuffer() : data(nullptr) {} + MallocedBuffer() : data(nullptr), size(0) {} explicit MallocedBuffer(size_t size) : data(Malloc(size)), size(size) {} MallocedBuffer(T* data, size_t size) : data(data), size(size) {} MallocedBuffer(MallocedBuffer&& other) : data(other.data), size(other.size) { From c6a43fa2ef80aff8efdb1f58c848e798ddaa9e66 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Thu, 18 Oct 2018 17:40:57 +0200 Subject: [PATCH 003/223] zlib: do not leak on destroy PR-URL: https://github.com/nodejs/node/pull/23734 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina --- lib/zlib.js | 9 +++++++++ test/parallel/test-zlib-close-in-ondata.js | 10 ++++++++++ test/parallel/test-zlib-destroy.js | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 test/parallel/test-zlib-close-in-ondata.js create mode 100644 test/parallel/test-zlib-destroy.js diff --git a/lib/zlib.js b/lib/zlib.js index 97b12410f121ef..9336b52f85313b 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -427,6 +427,11 @@ Zlib.prototype.close = function close(callback) { this.destroy(); }; +Zlib.prototype._destroy = function _destroy(err, callback) { + _close(this); + callback(err); +}; + Zlib.prototype._transform = function _transform(chunk, encoding, cb) { var flushFlag = this._defaultFlushFlag; // We use a 'fake' zero-length chunk to carry information about flushes from @@ -589,6 +594,10 @@ function processCallback() { assert(false, 'have should not go down'); } + if (self.destroyed) { + return; + } + // exhausted the output buffer, or used all the input create a new one. if (availOutAfter === 0 || self._outOffset >= self._chunkSize) { handle.availOutBefore = self._chunkSize; diff --git a/test/parallel/test-zlib-close-in-ondata.js b/test/parallel/test-zlib-close-in-ondata.js new file mode 100644 index 00000000000000..44d996311dca13 --- /dev/null +++ b/test/parallel/test-zlib-close-in-ondata.js @@ -0,0 +1,10 @@ +'use strict'; + +const common = require('../common'); +const zlib = require('zlib'); + +const ts = zlib.createGzip(); +const buf = Buffer.alloc(1024 * 1024 * 20); + +ts.on('data', common.mustCall(() => ts.close())); +ts.end(buf); diff --git a/test/parallel/test-zlib-destroy.js b/test/parallel/test-zlib-destroy.js new file mode 100644 index 00000000000000..d8eab42186a5fa --- /dev/null +++ b/test/parallel/test-zlib-destroy.js @@ -0,0 +1,13 @@ +'use strict'; + +require('../common'); + +const assert = require('assert'); +const zlib = require('zlib'); + +// verify that the zlib transform does clean up +// the handle when calling destroy. + +const ts = zlib.createGzip(); +ts.destroy(); +assert.strictEqual(ts._handle, null); From 383d512ed7bed1d7509611d8ee0a90d3496b8206 Mon Sep 17 00:00:00 2001 From: Uttam Pawar Date: Fri, 12 Oct 2018 13:52:52 -0700 Subject: [PATCH 004/223] src: memory management using smart pointer Introduced use of smart pointers instead of MallocedBuffer to manage memory allocated in the cares library. PR-URL: https://github.com/nodejs/node/pull/23628 Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann --- src/cares_wrap.cc | 109 +++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 55 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 8799f4a3cd0c37..ad5284c2ba4171 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1061,118 +1061,117 @@ int ParseSoaReply(Environment* env, EscapableHandleScope handle_scope(env->isolate()); auto context = env->context(); - /* Can't use ares_parse_soa_reply() here which can only parse single record */ - unsigned int ancount = cares_get_16bit(buf + 6); + // Manage memory using standardard smart pointer std::unique_tr + struct AresDeleter { + void operator()(char* ptr) const noexcept { ares_free_string(ptr); } + }; + using ares_unique_ptr = std::unique_ptr; + + // Can't use ares_parse_soa_reply() here which can only parse single record + const unsigned int ancount = cares_get_16bit(buf + 6); unsigned char* ptr = buf + NS_HFIXEDSZ; - char* name; - char* rr_name; + char* name_temp; long temp_len; // NOLINT(runtime/int) - int status = ares_expand_name(ptr, buf, len, &name, &temp_len); + int status = ares_expand_name(ptr, buf, len, &name_temp, &temp_len); + const ares_unique_ptr name(name_temp); if (status != ARES_SUCCESS) { - /* returns EBADRESP in case of invalid input */ + // returns EBADRESP in case of invalid input return status == ARES_EBADNAME ? ARES_EBADRESP : status; } if (ptr + temp_len + NS_QFIXEDSZ > buf + len) { - free(name); return ARES_EBADRESP; } ptr += temp_len + NS_QFIXEDSZ; for (unsigned int i = 0; i < ancount; i++) { - status = ares_expand_name(ptr, buf, len, &rr_name, &temp_len); + char* rr_name_temp; + long rr_temp_len; // NOLINT(runtime/int) + int status2 = ares_expand_name(ptr, buf, len, &rr_name_temp, &rr_temp_len); + const ares_unique_ptr rr_name(rr_name_temp); - if (status != ARES_SUCCESS) - break; + if (status2 != ARES_SUCCESS) + return status2 == ARES_EBADNAME ? ARES_EBADRESP : status2; - ptr += temp_len; + ptr += rr_temp_len; if (ptr + NS_RRFIXEDSZ > buf + len) { - free(rr_name); - status = ARES_EBADRESP; - break; + return ARES_EBADRESP; } const int rr_type = cares_get_16bit(ptr); const int rr_len = cares_get_16bit(ptr + 8); ptr += NS_RRFIXEDSZ; - /* only need SOA */ + // only need SOA if (rr_type == ns_t_soa) { - ares_soa_reply soa; - - status = ares_expand_name(ptr, buf, len, &soa.nsname, &temp_len); - if (status != ARES_SUCCESS) { - free(rr_name); - break; + char* nsname_temp; + long nsname_temp_len; // NOLINT(runtime/int) + + int status3 = ares_expand_name(ptr, buf, len, + &nsname_temp, + &nsname_temp_len); + const ares_unique_ptr nsname(nsname_temp); + if (status3 != ARES_SUCCESS) { + return status3 == ARES_EBADNAME ? ARES_EBADRESP : status3; } - ptr += temp_len; - - status = ares_expand_name(ptr, buf, len, &soa.hostmaster, &temp_len); - if (status != ARES_SUCCESS) { - free(rr_name); - free(soa.nsname); - break; + ptr += nsname_temp_len; + + char* hostmaster_temp; + long hostmaster_temp_len; // NOLINT(runtime/int) + int status4 = ares_expand_name(ptr, buf, len, + &hostmaster_temp, + &hostmaster_temp_len); + const ares_unique_ptr hostmaster(hostmaster_temp); + if (status4 != ARES_SUCCESS) { + return status4 == ARES_EBADNAME ? ARES_EBADRESP : status4; } - ptr += temp_len; + ptr += hostmaster_temp_len; if (ptr + 5 * 4 > buf + len) { - free(rr_name); - free(soa.nsname); - free(soa.hostmaster); - status = ARES_EBADRESP; - break; + return ARES_EBADRESP; } - soa.serial = cares_get_32bit(ptr + 0 * 4); - soa.refresh = cares_get_32bit(ptr + 1 * 4); - soa.retry = cares_get_32bit(ptr + 2 * 4); - soa.expire = cares_get_32bit(ptr + 3 * 4); - soa.minttl = cares_get_32bit(ptr + 4 * 4); + const unsigned int serial = cares_get_32bit(ptr + 0 * 4); + const unsigned int refresh = cares_get_32bit(ptr + 1 * 4); + const unsigned int retry = cares_get_32bit(ptr + 2 * 4); + const unsigned int expire = cares_get_32bit(ptr + 3 * 4); + const unsigned int minttl = cares_get_32bit(ptr + 4 * 4); Local soa_record = Object::New(env->isolate()); soa_record->Set(context, env->nsname_string(), - OneByteString(env->isolate(), soa.nsname)).FromJust(); + OneByteString(env->isolate(), nsname.get())).FromJust(); soa_record->Set(context, env->hostmaster_string(), OneByteString(env->isolate(), - soa.hostmaster)).FromJust(); + hostmaster.get())).FromJust(); soa_record->Set(context, env->serial_string(), - Integer::New(env->isolate(), soa.serial)).FromJust(); + Integer::New(env->isolate(), serial)).FromJust(); soa_record->Set(context, env->refresh_string(), - Integer::New(env->isolate(), soa.refresh)).FromJust(); + Integer::New(env->isolate(), refresh)).FromJust(); soa_record->Set(context, env->retry_string(), - Integer::New(env->isolate(), soa.retry)).FromJust(); + Integer::New(env->isolate(), retry)).FromJust(); soa_record->Set(context, env->expire_string(), - Integer::New(env->isolate(), soa.expire)).FromJust(); + Integer::New(env->isolate(), expire)).FromJust(); soa_record->Set(context, env->minttl_string(), - Integer::New(env->isolate(), soa.minttl)).FromJust(); + Integer::New(env->isolate(), minttl)).FromJust(); soa_record->Set(context, env->type_string(), env->dns_soa_string()).FromJust(); - free(soa.nsname); - free(soa.hostmaster); *ret = handle_scope.Escape(soa_record); break; } - free(rr_name); ptr += rr_len; } - free(name); - - if (status != ARES_SUCCESS) { - return status == ARES_EBADNAME ? ARES_EBADRESP : status; - } - return ARES_SUCCESS; } From 15d05bbf0211277e85e78ea04c4e736f226d12f2 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 20 Oct 2018 12:13:40 +0200 Subject: [PATCH 005/223] src: simplify `TimerFunctionCall()` in `node_perf.cc` Picking a path according to a boolean is essentially free, compared to the cost of a function call. Also, remove an unnecessary `TryCatch`. PR-URL: https://github.com/nodejs/node/pull/23782 Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Matheus Marchini Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- src/node_perf.cc | 59 ++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/src/node_perf.cc b/src/node_perf.cc index aed97d2b3b263a..4aa5da03d7a7e4 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -317,49 +317,30 @@ void TimerFunctionCall(const FunctionCallbackInfo& args) { size_t idx; SlicedArguments call_args(args); Utf8Value name(isolate, GetName(fn)); + bool is_construct_call = args.IsConstructCall(); - uint64_t start; - uint64_t end; - v8::TryCatch try_catch(isolate); - if (args.IsConstructCall()) { - start = PERFORMANCE_NOW(); - TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0( - TRACING_CATEGORY_NODE2(perf, timerify), - *name, *name, start / 1000); - v8::MaybeLocal ret = fn->NewInstance(context, - call_args.size(), - call_args.data()); - end = PERFORMANCE_NOW(); - TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0( - TRACING_CATEGORY_NODE2(perf, timerify), - *name, *name, end / 1000); - - if (ret.IsEmpty()) { - try_catch.ReThrow(); - return; - } - args.GetReturnValue().Set(ret.ToLocalChecked()); + uint64_t start = PERFORMANCE_NOW(); + TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0( + TRACING_CATEGORY_NODE2(perf, timerify), + *name, *name, start / 1000); + v8::MaybeLocal ret; + + if (is_construct_call) { + ret = fn->NewInstance(context, call_args.size(), call_args.data()) + .FromMaybe(Local()); } else { - start = PERFORMANCE_NOW(); - TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0( - TRACING_CATEGORY_NODE2(perf, timerify), - *name, *name, start / 1000); - v8::MaybeLocal ret = fn->Call(context, - args.This(), - call_args.size(), - call_args.data()); - end = PERFORMANCE_NOW(); - TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0( - TRACING_CATEGORY_NODE2(perf, timerify), - *name, *name, end / 1000); - - if (ret.IsEmpty()) { - try_catch.ReThrow(); - return; - } - args.GetReturnValue().Set(ret.ToLocalChecked()); + ret = fn->Call(context, args.This(), call_args.size(), call_args.data()); } + uint64_t end = PERFORMANCE_NOW(); + TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0( + TRACING_CATEGORY_NODE2(perf, timerify), + *name, *name, end / 1000); + + if (ret.IsEmpty()) + return; + args.GetReturnValue().Set(ret.ToLocalChecked()); + AliasedBuffer& observers = env->performance_state()->observers; if (!observers[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION]) From 3170cb49d8b0e6fd7b95813eafc64f68b18ba762 Mon Sep 17 00:00:00 2001 From: Andre Jodat-Danbrani Date: Fri, 12 Oct 2018 14:44:10 -0400 Subject: [PATCH 006/223] tls: throw if protocol too long The convertProtocols() function now throws a range error when the byte length of a protocol is too long to fit in a Buffer. Also added a test case in test/parallel/test-tls-basic-validations.js to cover this. PR-URL: https://github.com/nodejs/node/pull/23606 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Sakthipriyan Vairamani --- lib/internal/errors.js | 7 ++++--- lib/tls.js | 9 ++++++++- test/parallel/test-tls-basic-validations.js | 13 +++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 9f5e6d696c3043..9ec369ce0a12b8 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -834,10 +834,11 @@ E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); E('ERR_NO_LONGER_SUPPORTED', '%s is no longer supported', Error); E('ERR_OUT_OF_RANGE', - (name, range, value) => { - let msg = `The value of "${name}" is out of range.`; + (str, range, input, replaceDefaultBoolean = false) => { + let msg = replaceDefaultBoolean ? str : + `The value of "${str}" is out of range.`; if (range !== undefined) msg += ` It must be ${range}.`; - msg += ` Received ${value}`; + msg += ` Received ${input}`; return msg; }, RangeError); E('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s', Error); diff --git a/lib/tls.js b/lib/tls.js index 0324f6db877d48..b8de6efc8e402d 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -21,7 +21,10 @@ 'use strict'; -const { ERR_TLS_CERT_ALTNAME_INVALID } = require('internal/errors').codes; +const { + ERR_TLS_CERT_ALTNAME_INVALID, + ERR_OUT_OF_RANGE +} = require('internal/errors').codes; const internalUtil = require('internal/util'); const internalTLS = require('internal/tls'); internalUtil.assertCrypto(); @@ -59,6 +62,10 @@ function convertProtocols(protocols) { const lens = new Array(protocols.length); const buff = Buffer.allocUnsafe(protocols.reduce((p, c, i) => { var len = Buffer.byteLength(c); + if (len > 255) { + throw new ERR_OUT_OF_RANGE('The byte length of the protocol at index ' + + `${i} exceeds the maximum length.`, '<= 255', len, true); + } lens[i] = len; return p + 1 + len; }, 0)); diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js index 3840acc0243898..b5987251a71b13 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -115,3 +115,16 @@ common.expectsError( tls.convertNPNProtocols(buffer, out); assert(out.NPNProtocols.equals(Buffer.from('abcd'))); } + +{ + const protocols = [(new String('a')).repeat(500)]; + const out = {}; + common.expectsError( + () => tls.convertALPNProtocols(protocols, out), + { + code: 'ERR_OUT_OF_RANGE', + message: 'The byte length of the protocol at index 0 exceeds the ' + + 'maximum length. It must be <= 255. Received 500' + } + ); +} From 6f3bc0d28a05dbabb1d7536b3090d47f3e05ad01 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 18 Oct 2018 16:37:24 -0700 Subject: [PATCH 007/223] doc, test: document and test vm timeout escapes Using `process.nextTick()` or `Promise`, it is possible to escape the `timeout` set when running code with `vm.runInContext()`, `vm.runInThisContext()`, and `vm.runInNewContext()`. This documents the issue and adds two known_issues tests. Refs: https://github.com/nodejs/node/issues/3020 PR-URL: https://github.com/nodejs/node/pull/23743 Refs: https://github.com/nodejs/node/issues/3020 Reviewed-By: Luigi Pinca Reviewed-By: Tiancheng "Timothy" Gu --- doc/api/vm.md | 32 +++++++++++++++ .../test-vm-timeout-escape-nexttick.js | 41 +++++++++++++++++++ .../test-vm-timeout-escape-promise.js | 39 ++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 test/known_issues/test-vm-timeout-escape-nexttick.js create mode 100644 test/known_issues/test-vm-timeout-escape-promise.js diff --git a/doc/api/vm.md b/doc/api/vm.md index 892f7b97c39a30..1053a37d9025ff 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -944,6 +944,38 @@ within which it can operate. The process of creating the V8 Context and associating it with the `sandbox` object is what this document refers to as "contextifying" the `sandbox`. +## Timeout limitations when using process.nextTick(), and Promises + +Because of the internal mechanics of how the `process.nextTick()` queue and +the microtask queue that underlies Promises are implemented within V8 and +Node.js, it is possible for code running within a context to "escape" the +`timeout` set using `vm.runInContext()`, `vm.runInNewContext()`, and +`vm.runInThisContext()`. + +For example, the following code executed by `vm.runInNewContext()` with a +timeout of 5 milliseconds schedules an infinite loop to run after a promise +resolves. The scheduled loop is never interrupted by the timeout: + +```js +const vm = require('vm'); + +function loop() { + while (1) console.log(Date.now()); +} + +vm.runInNewContext( + 'Promise.resolve().then(loop);', + { loop, console }, + { timeout: 5 } +); +``` + +This issue also occurs when the `loop()` call is scheduled using +the `process.nextTick()` function. + +This issue occurs because all contexts share the same microtask and nextTick +queues. + [`Error`]: errors.html#errors_class_error [`URL`]: url.html#url_class_url [`eval()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval diff --git a/test/known_issues/test-vm-timeout-escape-nexttick.js b/test/known_issues/test-vm-timeout-escape-nexttick.js new file mode 100644 index 00000000000000..8afe2fb8cebb15 --- /dev/null +++ b/test/known_issues/test-vm-timeout-escape-nexttick.js @@ -0,0 +1,41 @@ +'use strict'; + +// https://github.com/nodejs/node/issues/3020 +// Promises, nextTick, and queueMicrotask allow code to escape the timeout +// set for runInContext, runInNewContext, and runInThisContext + +require('../common'); +const assert = require('assert'); +const vm = require('vm'); + +const NS_PER_MS = 1000000n; + +const hrtime = process.hrtime.bigint; +const nextTick = process.nextTick; + +function loop() { + const start = hrtime(); + while (1) { + const current = hrtime(); + const span = (current - start) / NS_PER_MS; + if (span >= 100n) { + throw new Error( + `escaped timeout at ${span} milliseconds!`); + } + } +} + +assert.throws(() => { + vm.runInNewContext( + 'nextTick(loop); loop();', + { + hrtime, + nextTick, + loop + }, + { timeout: 5 } + ); +}, { + code: 'ERR_SCRIPT_EXECUTION_TIMEOUT', + message: 'Script execution timed out after 5ms' +}); diff --git a/test/known_issues/test-vm-timeout-escape-promise.js b/test/known_issues/test-vm-timeout-escape-promise.js new file mode 100644 index 00000000000000..4452c83cd182e3 --- /dev/null +++ b/test/known_issues/test-vm-timeout-escape-promise.js @@ -0,0 +1,39 @@ +'use strict'; + +// https://github.com/nodejs/node/issues/3020 +// Promises, nextTick, and queueMicrotask allow code to escape the timeout +// set for runInContext, runInNewContext, and runInThisContext + +require('../common'); +const assert = require('assert'); +const vm = require('vm'); + +const NS_PER_MS = 1000000n; + +const hrtime = process.hrtime.bigint; + +function loop() { + const start = hrtime(); + while (1) { + const current = hrtime(); + const span = (current - start) / NS_PER_MS; + if (span >= 100n) { + throw new Error( + `escaped timeout at ${span} milliseconds!`); + } + } +} + +assert.throws(() => { + vm.runInNewContext( + 'Promise.resolve().then(loop); loop();', + { + hrtime, + loop + }, + { timeout: 5 } + ); +}, { + code: 'ERR_SCRIPT_EXECUTION_TIMEOUT', + message: 'Script execution timed out after 5ms' +}); From b16311b19fbd9e43cec86ceb687b185b8e07792d Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 24 Oct 2018 08:03:07 -0700 Subject: [PATCH 008/223] test: mark test-vm-timeout-* known issue tests flaky These are known issues that can be flaky on certain platforms because they rely entirely on timing differences. PR-URL: https://github.com/nodejs/node/pull/23743 Refs: https://github.com/nodejs/node/issues/3020 Reviewed-By: Luigi Pinca Reviewed-By: Tiancheng "Timothy" Gu --- test/known_issues/known_issues.status | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/known_issues/known_issues.status b/test/known_issues/known_issues.status index e21913e232c03f..447f648e5a8c9e 100644 --- a/test/known_issues/known_issues.status +++ b/test/known_issues/known_issues.status @@ -9,6 +9,8 @@ prefix known_issues [$system==win32] [$system==linux] +test-vm-timeout-escape-nexttick: PASS,FLAKY +test-vm-timeout-escape-promise: PASS,FLAKY [$system==macos] From 72d2d2cd8e8da2bac4627c38c5a098175f9015b8 Mon Sep 17 00:00:00 2001 From: Jonathan Cardoso Machado Date: Mon, 8 Oct 2018 21:39:29 -0300 Subject: [PATCH 009/223] build: expose more openssl categories for addons Those categories are necessary to build addons that depends on libcurl and libssh, the following were the missing symbols: libcurl: OCSP_cert_status_str OCSP_check_validity OCSP_basic_verify OCSP_RESPONSE_free OCSP_single_get0_status OCSP_response_get1_basic OCSP_BASICRESP_free OCSP_crl_reason_str OCSP_resp_count OCSP_response_status OCSP_response_status_str OCSP_resp_get0 d2i_OCSP_RESPONSE SSL_CTX_set_next_proto_select_cb libssh: EVP_ripemd160 EVP_cast5_cbc Fixes: https://github.com/nodejs/node/issues/23293 PR-URL: https://github.com/nodejs/node/pull/23344 Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- node.gyp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/node.gyp b/node.gyp index 55f028636fd266..a8de196916c085 100644 --- a/node.gyp +++ b/node.gyp @@ -622,7 +622,8 @@ # Categories to export. '-CAES,BF,BIO,DES,DH,DSA,EC,ECDH,ECDSA,ENGINE,EVP,HMAC,MD4,MD5,' 'PSK,RC2,RC4,RSA,SHA,SHA0,SHA1,SHA256,SHA512,SOCK,STDIO,TLSEXT,' - 'FP_API,TLS1_METHOD,TLS1_1_METHOD,TLS1_2_METHOD,SCRYPT', + 'FP_API,TLS1_METHOD,TLS1_1_METHOD,TLS1_2_METHOD,SCRYPT,OCSP,' + 'NEXTPROTONEG,RMD160,CAST', # Defines. '-DWIN32', # Symbols to filter from the export list. From 44a1993e9d43841f31b43e8a5de8be7094de3640 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 24 Oct 2018 10:56:26 +0200 Subject: [PATCH 010/223] src: avoid extra `Persistent` in `DefaultTriggerAsyncIdScope` Instead of getting a reference to the main `AliasedBuffer`, which would always unnecesarily allocate and destroy a `Persistent` handle, store and use a reference to the owning object. PR-URL: https://github.com/nodejs/node/pull/23844 Reviewed-By: Matteo Collina Reviewed-By: Matheus Marchini Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anatoli Papirovski --- src/env-inl.h | 8 ++++---- src/env.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index 208cc5381c9008..b512412c0ff4f0 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -186,20 +186,20 @@ inline void Environment::AsyncHooks::clear_async_id_stack() { inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope ::DefaultTriggerAsyncIdScope(Environment* env, double default_trigger_async_id) - : async_id_fields_ref_(env->async_hooks()->async_id_fields()) { + : async_hooks_(env->async_hooks()) { if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) { CHECK_GE(default_trigger_async_id, 0); } old_default_trigger_async_id_ = - async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId]; - async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] = + async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId]; + async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] = default_trigger_async_id; } inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope ::~DefaultTriggerAsyncIdScope() { - async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] = + async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] = old_default_trigger_async_id_; } diff --git a/src/env.h b/src/env.h index 80fc750f0b555a..1d2baf58b007ea 100644 --- a/src/env.h +++ b/src/env.h @@ -482,7 +482,7 @@ class Environment { ~DefaultTriggerAsyncIdScope(); private: - AliasedBuffer async_id_fields_ref_; + AsyncHooks* async_hooks_; double old_default_trigger_async_id_; DISALLOW_COPY_AND_ASSIGN(DefaultTriggerAsyncIdScope); From 042749fd231692e8cb0d6bf03a12afda111407ea Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Tue, 6 Nov 2018 10:55:09 +0800 Subject: [PATCH 011/223] build: only try to find node when it's needed by the target Right now `node -p process.versions.openssl` always gets run in the Makefile even when it's not needed by the target (e.g. `make clean`, `make test-only`). This patch makes it a run time call instead of part of the global expansion. PR-URL: https://github.com/nodejs/node/pull/24115 Reviewed-By: Richard Lau Reviewed-By: Daniel Bevenius --- Makefile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index ae3830ddd40e00..b7a80f57450fe7 100644 --- a/Makefile +++ b/Makefile @@ -332,16 +332,16 @@ ifeq ($(OSTYPE),aix) DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp endif -node_use_openssl = $(shell $(call available-node,"-p" \ - "process.versions.openssl != undefined")) +node_use_openssl = $(call available-node,"-p" \ + "process.versions.openssl != undefined") test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules -ifeq ($(node_use_openssl),true) - $(RM) -r test/addons/??_*/ - [ -x $(NODE) ] && $(NODE) $< || node $< - touch $@ -else - @echo "Skipping .docbuildstamp (no crypto)" -endif + @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ + echo "Skipping .docbuildstamp (no crypto)"; \ + else \ + $(RM) -r test/addons/??_*/; \ + [ -x $(NODE) ] && $(NODE) $< || node $< ; \ + touch $@; \ + fi ADDONS_BINDING_GYPS := \ $(filter-out test/addons/??_*/binding.gyp, \ @@ -609,11 +609,11 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json)) apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*))) tools/doc/node_modules: tools/doc/package.json -ifeq ($(node_use_openssl),true) - cd tools/doc && $(call available-node,$(run-npm-ci)) -else - @echo "Skipping tools/doc/node_modules (no crypto)" -endif + @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ + echo "Skipping tools/doc/node_modules (no crypto)"; \ + else \ + cd tools/doc && $(call available-node,$(run-npm-ci)) \ + fi .PHONY: doc-only doc-only: tools/doc/node_modules \ From 74f1dad61317d20777f2a01f27d648bca932fc5b Mon Sep 17 00:00:00 2001 From: Tadhg Creedon Date: Tue, 6 Nov 2018 14:30:19 +0000 Subject: [PATCH 012/223] test: http-client-timeout error assert arguments PR-URL: https://github.com/nodejs/node/pull/24130 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil --- test/parallel/test-http-client-timeout-on-connect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-client-timeout-on-connect.js b/test/parallel/test-http-client-timeout-on-connect.js index 928f781e261758..3a0098229d9af8 100644 --- a/test/parallel/test-http-client-timeout-on-connect.js +++ b/test/parallel/test-http-client-timeout-on-connect.js @@ -24,7 +24,7 @@ server.listen(0, common.localhostIPv4, common.mustCall(() => { })); req.on('timeout', common.mustCall(() => req.abort())); req.on('error', common.mustCall((err) => { - assert.strictEqual('socket hang up', err.message); + assert.strictEqual(err.message, 'socket hang up'); server.close(); })); })); From c37b3196b62b5874851aea21d08866533ae5946d Mon Sep 17 00:00:00 2001 From: Fran Herrero Date: Tue, 6 Nov 2018 14:30:10 +0000 Subject: [PATCH 013/223] test: fix arguments order PR-URL: https://github.com/nodejs/node/pull/24131 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Gireesh Punathil --- test/parallel/test-net-stream.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-net-stream.js b/test/parallel/test-net-stream.js index a6ec4548ada6ea..4e7e06bfcf2546 100644 --- a/test/parallel/test-net-stream.js +++ b/test/parallel/test-net-stream.js @@ -34,11 +34,11 @@ s.server = new net.Server(); s.server.connections = 10; s._server = s.server; -assert.strictEqual(10, s.server.connections); +assert.strictEqual(s.server.connections, 10); s.destroy(); -assert.strictEqual(9, s.server.connections); +assert.strictEqual(s.server.connections, 9); s.destroy(); -assert.strictEqual(9, s.server.connections); +assert.strictEqual(s.server.connections, 9); const SIZE = 2E6; const N = 10; @@ -69,5 +69,5 @@ const server = net.createServer(function(socket) { }); process.on('exit', function() { - assert.strictEqual(0, server.connections); + assert.strictEqual(server.connections, 0); }); From 04f8d6bffd63590253c8dfcee632dd7993fabeb6 Mon Sep 17 00:00:00 2001 From: Jimb Esser Date: Wed, 31 Oct 2018 12:55:00 -0700 Subject: [PATCH 014/223] child_process: allow 'http_parser' monkey patching again Lazy load _http_common and HTTPParser so that the 'http_parser' binding can be monkey patched before any internal modules require it. This also probably improves startup performance minimally for programs that never require the HTTP stack. Fixes: https://github.com/nodejs/node/issues/23716 Fixes: https://github.com/creationix/http-parser-js/issues/57 PR-URL: https://github.com/nodejs/node/pull/24006 Reviewed-By: Joyee Cheung Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- lib/internal/child_process.js | 14 +++++-- test/parallel/test-http-parser-lazy-loaded.js | 37 +++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 test/parallel/test-http-parser-lazy-loaded.js diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 0a1dc40f8aaf77..63038bcc54750f 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -31,9 +31,7 @@ const SocketList = require('internal/socket_list'); const { owner_symbol } = require('internal/async_hooks').symbols; const { convertToValidSignal } = require('internal/util'); const { isArrayBufferView } = require('internal/util/types'); -const spawn_sync = process.binding('spawn_sync'); -const { HTTPParser } = process.binding('http_parser'); -const { freeParser } = require('_http_common'); +const spawn_sync = internalBinding('spawn_sync'); const { kStateSymbol } = require('internal/dgram'); const { @@ -51,6 +49,10 @@ const { SocketListSend, SocketListReceive } = SocketList; // Lazy loaded for startup performance. let StringDecoder; +// Lazy loaded for startup performance and to allow monkey patching of +// internalBinding('http_parser').HTTPParser. +let freeParser; +let HTTPParser; const MAX_HANDLE_RETRANSMISSIONS = 3; @@ -115,6 +117,12 @@ const handleConversion = { handle.onread = nop; socket._handle = null; socket.setTimeout(0); + + if (freeParser === undefined) + freeParser = require('_http_common').freeParser; + if (HTTPParser === undefined) + HTTPParser = internalBinding('http_parser').HTTPParser; + // In case of an HTTP connection socket, release the associated // resources if (socket.parser && socket.parser instanceof HTTPParser) { diff --git a/test/parallel/test-http-parser-lazy-loaded.js b/test/parallel/test-http-parser-lazy-loaded.js new file mode 100644 index 00000000000000..c1eb29fb163d00 --- /dev/null +++ b/test/parallel/test-http-parser-lazy-loaded.js @@ -0,0 +1,37 @@ +// Flags: --expose-internals + +'use strict'; + +const { internalBinding } = require('internal/test/binding'); + +// Monkey patch before requiring anything +class DummyParser { + constructor(type) { + this.test_type = type; + } +} +DummyParser.REQUEST = Symbol(); +internalBinding('http_parser').HTTPParser = DummyParser; + +const common = require('../common'); +const assert = require('assert'); +const { spawn } = require('child_process'); +const { parsers } = require('_http_common'); + +// Test _http_common was not loaded before monkey patching +const parser = parsers.alloc(); +assert.strictEqual(parser instanceof DummyParser, true); +assert.strictEqual(parser.test_type, DummyParser.REQUEST); + +if (process.argv[2] !== 'child') { + // Also test in a child process with IPC (specific case of https://github.com/nodejs/node/issues/23716) + const child = spawn(process.execPath, [ + '--expose-internals', __filename, 'child' + ], { + stdio: ['inherit', 'inherit', 'inherit', 'ipc'] + }); + child.on('exit', common.mustCall((code, signal) => { + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); + })); +} From e599889649334a4d8bd0f7eb7dd924d896490d14 Mon Sep 17 00:00:00 2001 From: Petar Dodev Date: Tue, 6 Nov 2018 17:29:36 +0300 Subject: [PATCH 015/223] test: fs readfile, swap arguments in strictEqual PR-URL: https://github.com/nodejs/node/pull/24133 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: Gireesh Punathil --- test/parallel/test-fs-readfile-fd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-readfile-fd.js b/test/parallel/test-fs-readfile-fd.js index 7458af7b2e53af..b5d2a33e285f5f 100644 --- a/test/parallel/test-fs-readfile-fd.js +++ b/test/parallel/test-fs-readfile-fd.js @@ -17,7 +17,7 @@ tempFd(function(fd, close) { tempFd(function(fd, close) { fs.readFile(fd, 'utf8', function(err, data) { - assert.strictEqual('', data); + assert.strictEqual(data, ''); close(); }); }); @@ -27,7 +27,7 @@ tempFdSync(function(fd) { }); tempFdSync(function(fd) { - assert.strictEqual('', fs.readFileSync(fd, 'utf8')); + assert.strictEqual(fs.readFileSync(fd, 'utf8'), ''); }); function tempFd(callback) { From 11a84a7b32d0db1ec64d5ece82f87fd8464a9b56 Mon Sep 17 00:00:00 2001 From: Musa Hamwala Date: Tue, 6 Nov 2018 14:27:21 +0000 Subject: [PATCH 016/223] test: swap the order of arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swapped the actual and expected arguments in `assert.strictEqual()` calls. Arguments are now in correct order. Literal value is now the second argument and the value returned by the function is the first argument. PR-URL: https://github.com/nodejs/node/pull/24134 Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: Gireesh Punathil Reviewed-By: George Adams --- test/parallel/test-fs-write-sync.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-fs-write-sync.js b/test/parallel/test-fs-write-sync.js index 4ca7a1dd570eb0..1873c44fb9ae33 100644 --- a/test/parallel/test-fs-write-sync.js +++ b/test/parallel/test-fs-write-sync.js @@ -34,7 +34,7 @@ tmpdir.refresh(); const fd = fs.openSync(filename, 'w'); let written = fs.writeSync(fd, ''); - assert.strictEqual(0, written); + assert.strictEqual(written, 0); fs.writeSync(fd, 'foo'); @@ -50,7 +50,7 @@ tmpdir.refresh(); const fd = fs.openSync(filename, 'w'); let written = fs.writeSync(fd, ''); - assert.strictEqual(0, written); + assert.strictEqual(written, 0); fs.writeSync(fd, 'foo'); @@ -66,7 +66,7 @@ tmpdir.refresh(); const fd = fs.openSync(filename, 'w'); let written = fs.writeSync(fd, ''); - assert.strictEqual(0, written); + assert.strictEqual(written, 0); fs.writeSync(fd, 'foo'); From 2d88af354ff6c7e8dd98f04631f4c0a70dd08660 Mon Sep 17 00:00:00 2001 From: Ahmad Nassri Date: Tue, 6 Nov 2018 14:45:42 +0000 Subject: [PATCH 017/223] test: strictEqual argument order (actual, expected) PR-URL: https://github.com/nodejs/node/pull/24137 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: Gireesh Punathil --- test/parallel/test-console-instance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 0b69212948dd2c..91d130f260184b 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -33,7 +33,7 @@ const err = new Stream(); process.stdout.write = process.stderr.write = common.mustNotCall(); // Make sure that the "Console" function exists. -assert.strictEqual('function', typeof Console); +assert.strictEqual(typeof Console, 'function'); // Make sure that the Console constructor throws // when not given a writable stream instance. From 64fd19f1026f76721ab423a72140ac0ab60819c1 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 6 Nov 2018 14:29:34 +0000 Subject: [PATCH 018/223] test: fix invalid argument order in test-http-expect-continue.js `assert.strictEqual` expects arguments in the following order: actual, expected[, message] PR-URL: https://github.com/nodejs/node/pull/24138 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: Gireesh Punathil --- test/parallel/test-http-expect-continue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-expect-continue.js b/test/parallel/test-http-expect-continue.js index eb4dd23d7b552f..10bcb9d568ff35 100644 --- a/test/parallel/test-http-expect-continue.js +++ b/test/parallel/test-http-expect-continue.js @@ -67,7 +67,7 @@ server.on('listening', common.mustCall(() => { })); req.on('response', common.mustCall((res) => { assert.ok(got_continue, 'Full response received before 100 Continue'); - assert.strictEqual(200, res.statusCode, + assert.strictEqual(res.statusCode, 200, `Final status code was ${res.statusCode}, not 200.`); res.setEncoding('utf8'); res.on('data', function(chunk) { body += chunk; }); From 78a320130df9710085a6265601cfd2fb9fcf22ca Mon Sep 17 00:00:00 2001 From: Remy Parzinski Date: Tue, 6 Nov 2018 15:47:41 +0100 Subject: [PATCH 019/223] test: change order of assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/24142 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-file-write-stream.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-file-write-stream.js b/test/parallel/test-file-write-stream.js index 4860417dd29bc5..4d9df25d4cd2ac 100644 --- a/test/parallel/test-file-write-stream.js +++ b/test/parallel/test-file-write-stream.js @@ -44,7 +44,7 @@ file .on('open', function(fd) { console.error('open!'); callbacks.open++; - assert.strictEqual('number', typeof fd); + assert.strictEqual(typeof fd, 'number'); }) .on('error', function(err) { throw err; @@ -86,7 +86,7 @@ for (let i = 0; i < 11; i++) { process.on('exit', function() { for (const k in callbacks) { - assert.strictEqual(0, callbacks[k], `${k} count off by ${callbacks[k]}`); + assert.strictEqual(callbacks[k], 0, `${k} count off by ${callbacks[k]}`); } console.log('ok'); }); From f0eee63ee0768ae0935831d643ca0528a5cdaed6 Mon Sep 17 00:00:00 2001 From: Roland Broekema Date: Tue, 6 Nov 2018 15:47:53 +0100 Subject: [PATCH 020/223] test: fix assert parameter order Switched arguments in assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/24144 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- test/parallel/test-http-blank-header.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-blank-header.js b/test/parallel/test-http-blank-header.js index 40377fb6684db4..3f2b512fc85567 100644 --- a/test/parallel/test-http-blank-header.js +++ b/test/parallel/test-http-blank-header.js @@ -26,8 +26,8 @@ const http = require('http'); const net = require('net'); const server = http.createServer(common.mustCall((req, res) => { - assert.strictEqual('GET', req.method); - assert.strictEqual('/blah', req.url); + assert.strictEqual(req.method, 'GET'); + assert.strictEqual(req.url, '/blah'); assert.deepStrictEqual({ host: 'example.org:443', origin: 'http://example.org', From abf9bd15db0dee1c11cbd73707def0505d8ec4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florin-Daniel=20B=C3=8ELB=C3=8EE?= Date: Tue, 6 Nov 2018 15:03:59 +0000 Subject: [PATCH 021/223] test: swap expected and actual in assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/24146 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-buffer-indexof.js | 54 ++++++++++++++-------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 357558c74d2edc..d7e34b66d2b3b3 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -183,24 +183,24 @@ assert.strictEqual(Buffer.from('aaaa00a').indexOf('3030', 'hex'), 4); // test usc2 encoding const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); - assert.strictEqual(8, twoByteString.indexOf('\u0395', 4, 'ucs2')); - assert.strictEqual(6, twoByteString.indexOf('\u03a3', -4, 'ucs2')); - assert.strictEqual(4, twoByteString.indexOf('\u03a3', -6, 'ucs2')); - assert.strictEqual(4, twoByteString.indexOf( - Buffer.from('\u03a3', 'ucs2'), -6, 'ucs2')); + assert.strictEqual(twoByteString.indexOf('\u0395', 4, 'ucs2'), 8); + assert.strictEqual(twoByteString.indexOf('\u03a3', -4, 'ucs2'), 6); + assert.strictEqual(twoByteString.indexOf('\u03a3', -6, 'ucs2'), 4); + assert.strictEqual(twoByteString.indexOf( + Buffer.from('\u03a3', 'ucs2'), -6, 'ucs2'), 4); assert.strictEqual(-1, twoByteString.indexOf('\u03a3', -2, 'ucs2')); } const mixedByteStringUcs2 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395', 'ucs2'); -assert.strictEqual(6, mixedByteStringUcs2.indexOf('bc', 0, 'ucs2')); -assert.strictEqual(10, mixedByteStringUcs2.indexOf('\u03a3', 0, 'ucs2')); +assert.strictEqual(mixedByteStringUcs2.indexOf('bc', 0, 'ucs2'), 6); +assert.strictEqual(mixedByteStringUcs2.indexOf('\u03a3', 0, 'ucs2'), 10); assert.strictEqual(-1, mixedByteStringUcs2.indexOf('\u0396', 0, 'ucs2')); assert.strictEqual( - 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); + mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2'), 6); assert.strictEqual( - 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); + mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2'), 10); assert.strictEqual( -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); @@ -208,34 +208,34 @@ assert.strictEqual( const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); // Test single char pattern - assert.strictEqual(0, twoByteString.indexOf('\u039a', 0, 'ucs2')); + assert.strictEqual(twoByteString.indexOf('\u039a', 0, 'ucs2'), 0); let index = twoByteString.indexOf('\u0391', 0, 'ucs2'); - assert.strictEqual(2, index, `Alpha - at index ${index}`); + assert.strictEqual(index, 2, `Alpha - at index ${index}`); index = twoByteString.indexOf('\u03a3', 0, 'ucs2'); - assert.strictEqual(4, index, `First Sigma - at index ${index}`); + assert.strictEqual(index, 4, `First Sigma - at index ${index}`); index = twoByteString.indexOf('\u03a3', 6, 'ucs2'); - assert.strictEqual(6, index, `Second Sigma - at index ${index}`); + assert.strictEqual(index, 6, `Second Sigma - at index ${index}`); index = twoByteString.indexOf('\u0395', 0, 'ucs2'); - assert.strictEqual(8, index, `Epsilon - at index ${index}`); + assert.strictEqual(index, 8, `Epsilon - at index ${index}`); index = twoByteString.indexOf('\u0392', 0, 'ucs2'); assert.strictEqual(-1, index, `Not beta - at index ${index}`); // Test multi-char pattern index = twoByteString.indexOf('\u039a\u0391', 0, 'ucs2'); - assert.strictEqual(0, index, `Lambda Alpha - at index ${index}`); + assert.strictEqual(index, 0, `Lambda Alpha - at index ${index}`); index = twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2'); - assert.strictEqual(2, index, `Alpha Sigma - at index ${index}`); + assert.strictEqual(index, 2, `Alpha Sigma - at index ${index}`); index = twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2'); - assert.strictEqual(4, index, `Sigma Sigma - at index ${index}`); + assert.strictEqual(index, 4, `Sigma Sigma - at index ${index}`); index = twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2'); - assert.strictEqual(6, index, `Sigma Epsilon - at index ${index}`); + assert.strictEqual(index, 6, `Sigma Epsilon - at index ${index}`); } const mixedByteStringUtf8 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395'); -assert.strictEqual(5, mixedByteStringUtf8.indexOf('bc')); -assert.strictEqual(5, mixedByteStringUtf8.indexOf('bc', 5)); -assert.strictEqual(5, mixedByteStringUtf8.indexOf('bc', -8)); -assert.strictEqual(7, mixedByteStringUtf8.indexOf('\u03a3')); +assert.strictEqual(mixedByteStringUtf8.indexOf('bc'), 5); +assert.strictEqual(mixedByteStringUtf8.indexOf('bc', 5), 5); +assert.strictEqual(mixedByteStringUtf8.indexOf('bc', -8), 5); +assert.strictEqual(mixedByteStringUtf8.indexOf('\u03a3'), 7); assert.strictEqual(-1, mixedByteStringUtf8.indexOf('\u0396')); @@ -257,22 +257,22 @@ for (let i = 0; i < longBufferString.length - pattern.length; i += 7) { } let index = longBufferString.indexOf('AJABACA'); -assert.strictEqual(510, index, `Long AJABACA, First J - at index ${index}`); +assert.strictEqual(index, 510, `Long AJABACA, First J - at index ${index}`); index = longBufferString.indexOf('AJABACA', 511); -assert.strictEqual(1534, index, `Long AJABACA, Second J - at index ${index}`); +assert.strictEqual(index, 1534, `Long AJABACA, Second J - at index ${index}`); pattern = 'JABACABADABACABA'; index = longBufferString.indexOf(pattern); -assert.strictEqual(511, index, `Long JABACABA..., First J - at index ${index}`); +assert.strictEqual(index, 511, `Long JABACABA..., First J - at index ${index}`); index = longBufferString.indexOf(pattern, 512); assert.strictEqual( - 1535, index, `Long JABACABA..., Second J - at index ${index}`); + index, 1535, `Long JABACABA..., Second J - at index ${index}`); // Search for a non-ASCII string in a pure ASCII string. const asciiString = Buffer.from( 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); assert.strictEqual(-1, asciiString.indexOf('\x2061')); -assert.strictEqual(3, asciiString.indexOf('leb', 0)); +assert.strictEqual(asciiString.indexOf('leb', 0), 3); // Search in string containing many non-ASCII chars. const allCodePoints = []; From 6e8fa5361abba7e61767abde1e527c822e509ebe Mon Sep 17 00:00:00 2001 From: Robin Drexler Date: Tue, 6 Nov 2018 15:52:49 +0100 Subject: [PATCH 022/223] test: add tests for OutgoingMessage setTimeout These tests ensure that OutgoingMessage setTimeout method will call setTimeout on its socket Co-authored-by: ZauberNerd PR-URL: https://github.com/nodejs/node/pull/24148 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- .../parallel/test-http-outgoing-settimeout.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/parallel/test-http-outgoing-settimeout.js diff --git a/test/parallel/test-http-outgoing-settimeout.js b/test/parallel/test-http-outgoing-settimeout.js new file mode 100644 index 00000000000000..3dd27686153672 --- /dev/null +++ b/test/parallel/test-http-outgoing-settimeout.js @@ -0,0 +1,30 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +const { OutgoingMessage } = require('http'); + +{ + // tests for settimeout method with socket + const expectedMsecs = 42; + const outgoingMessage = new OutgoingMessage(); + outgoingMessage.socket = { + setTimeout: common.mustCall((msecs) => { + assert.strictEqual(msecs, expectedMsecs); + }) + }; + outgoingMessage.setTimeout(expectedMsecs); +} + +{ + // tests for settimeout method without socket + const expectedMsecs = 23; + const outgoingMessage = new OutgoingMessage(); + outgoingMessage.setTimeout(expectedMsecs); + + outgoingMessage.emit('socket', { + setTimeout: common.mustCall((msecs) => { + assert.strictEqual(msecs, expectedMsecs); + }) + }); +} From cd07b024727c59e5d7cbe7f5da48a8b898ff1f83 Mon Sep 17 00:00:00 2001 From: "G. Carcaci" Date: Tue, 6 Nov 2018 15:11:59 +0000 Subject: [PATCH 023/223] test: fixing arguments order in `assert.strictEqual()` PR-URL: https://github.com/nodejs/node/pull/24152 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-event-emitter-add-listeners.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-event-emitter-add-listeners.js b/test/parallel/test-event-emitter-add-listeners.js index 45bfd3832caaaf..6ef39522183d4f 100644 --- a/test/parallel/test-event-emitter-add-listeners.js +++ b/test/parallel/test-event-emitter-add-listeners.js @@ -42,8 +42,8 @@ const EventEmitter = require('events'); }); const hello = common.mustCall(function(a, b) { - assert.strictEqual('a', a); - assert.strictEqual('b', b); + assert.strictEqual(a, 'a'); + assert.strictEqual(b, 'b'); }); ee.once('newListener', function(name, listener) { From 380789eb68f7151e54c92e3bf9e62e93d4a50003 Mon Sep 17 00:00:00 2001 From: Marc Posth Date: Tue, 6 Nov 2018 14:35:19 +0000 Subject: [PATCH 024/223] test: fixe argument order in assert.strictEqual File: test/parallel/test-http-client-upload-buf.js PR-URL: https://github.com/nodejs/node/pull/24140 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-http-client-upload-buf.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/parallel/test-http-client-upload-buf.js b/test/parallel/test-http-client-upload-buf.js index b778d07a826b1d..1c75612c807874 100644 --- a/test/parallel/test-http-client-upload-buf.js +++ b/test/parallel/test-http-client-upload-buf.js @@ -27,8 +27,7 @@ const http = require('http'); const N = 1024; const server = http.createServer(common.mustCall(function(req, res) { - assert.strictEqual('POST', req.method); - + assert.strictEqual(req.method, 'POST'); let bytesReceived = 0; req.on('data', function(chunk) { From 8f2bdaca69ec7d2b1f6623eef03a7bcd3446d6f1 Mon Sep 17 00:00:00 2001 From: Simona Cotin Date: Tue, 6 Nov 2018 15:11:41 +0000 Subject: [PATCH 025/223] test: fix arguments order the actual and expected arguments in assert.strictEqual() calls are in the wrong order. Any literal value should be the second argument while the first argument should be the value returned by a function/be the calculated value. PR-URL: https://github.com/nodejs/node/pull/24151 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-fs-readfile-empty.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-fs-readfile-empty.js b/test/parallel/test-fs-readfile-empty.js index 36eccfb1162713..7bb942fc2d6fe3 100644 --- a/test/parallel/test-fs-readfile-empty.js +++ b/test/parallel/test-fs-readfile-empty.js @@ -35,12 +35,12 @@ fs.readFile(fn, function(err, data) { }); fs.readFile(fn, 'utf8', function(err, data) { - assert.strictEqual('', data); + assert.strictEqual(data, ''); }); fs.readFile(fn, { encoding: 'utf8' }, function(err, data) { - assert.strictEqual('', data); + assert.strictEqual(data, ''); }); assert.ok(fs.readFileSync(fn)); -assert.strictEqual('', fs.readFileSync(fn, 'utf8')); +assert.strictEqual(fs.readFileSync(fn, 'utf8'), ''); From f46fa9072a3e9c6a72ed01e8bc7b0bd6ee70619b Mon Sep 17 00:00:00 2001 From: Mathieu Pavageau Date: Tue, 6 Nov 2018 14:33:10 +0000 Subject: [PATCH 026/223] test: switch arguments in strictEqual In the `test/parallel/test-vm-create-and-run-in-context.js` test the actual and expected arguments in the `assert.strictEqual()` call on line 32 are in the wrong order and they have to be switched around. PR-URL: https://github.com/nodejs/node/pull/24141 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-vm-create-and-run-in-context.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-vm-create-and-run-in-context.js b/test/parallel/test-vm-create-and-run-in-context.js index 8f4ce72c50f246..bd746cf2df7080 100644 --- a/test/parallel/test-vm-create-and-run-in-context.js +++ b/test/parallel/test-vm-create-and-run-in-context.js @@ -29,7 +29,7 @@ const vm = require('vm'); // Run in a new empty context let context = vm.createContext(); let result = vm.runInContext('"passed";', context); -assert.strictEqual('passed', result); +assert.strictEqual(result, 'passed'); // Create a new pre-populated context context = vm.createContext({ 'foo': 'bar', 'thing': 'lala' }); From 1588fba73fde5eedd2c07cf83f776073269286d6 Mon Sep 17 00:00:00 2001 From: Clement Date: Tue, 6 Nov 2018 15:53:55 +0100 Subject: [PATCH 027/223] test: fix argument order in assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/24147 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-http-chunked.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http-chunked.js b/test/parallel/test-http-chunked.js index 9ae2932a5c4149..264a87be6adc7f 100644 --- a/test/parallel/test-http-chunked.js +++ b/test/parallel/test-http-chunked.js @@ -48,7 +48,7 @@ server.listen(0, common.mustCall(() => { x.setEncoding('utf8'); x.on('data', (c) => data += c); x.on('end', common.mustCall(() => { - assert.strictEqual('string', typeof data); + assert.strictEqual(typeof data, 'string'); assert.strictEqual(UTF8_STRING, data); server.close(); })); From 90f98905f1be2d1a85800afd438d51db6d08a0df Mon Sep 17 00:00:00 2001 From: razvanbh Date: Tue, 6 Nov 2018 17:25:27 +0200 Subject: [PATCH 028/223] test: fix arguments order in test-fs-write-buffer PR-URL: https://github.com/nodejs/node/pull/24155 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/parallel/test-fs-write-buffer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-write-buffer.js b/test/parallel/test-fs-write-buffer.js index 6e6154642a583d..0ff9fd69a82a3a 100644 --- a/test/parallel/test-fs-write-buffer.js +++ b/test/parallel/test-fs-write-buffer.js @@ -58,11 +58,11 @@ tmpdir.refresh(); const cb = common.mustCall((err, written) => { assert.ifError(err); - assert.strictEqual(2, written); + assert.strictEqual(written, 2); fs.closeSync(fd); const found = fs.readFileSync(filename, 'utf8'); - assert.strictEqual('lo', found); + assert.strictEqual(found, 'lo'); }); fs.write(fd, Buffer.from('hello'), 3, cb); From fc84ccd0f05b7294f863d1d8796661adb7939d32 Mon Sep 17 00:00:00 2001 From: Jackson Chui <14085209+haiXchuus@users.noreply.github.com> Date: Tue, 6 Nov 2018 20:23:08 -0800 Subject: [PATCH 029/223] test: removed extraneous argument 's' PR-URL: https://github.com/nodejs/node/pull/24213 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- test/abort/test-http-parser-consume.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/abort/test-http-parser-consume.js b/test/abort/test-http-parser-consume.js index 673e04cfa3a573..13dc93874a226f 100644 --- a/test/abort/test-http-parser-consume.js +++ b/test/abort/test-http-parser-consume.js @@ -7,7 +7,7 @@ const { spawn } = require('child_process'); if (process.argv[2] === 'child') { // sub-process const server = createServer(common.mustCall((_, res) => res.end('h'))); - server.listen(0, common.mustCall((s) => { + server.listen(0, common.mustCall(() => { const rr = get({ port: server.address().port }, common.mustCall(() => { // This bad input (0) should abort the parser and the process rr.parser.consume(0); From e0c6f5cbf77638514cb0a700a831cad920763440 Mon Sep 17 00:00:00 2001 From: Manish Poddar Date: Tue, 6 Nov 2018 15:40:01 +0000 Subject: [PATCH 030/223] test: fix assert argument order PR-URL: https://github.com/nodejs/node/pull/24160 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/parallel/test-child-process-stdio.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-child-process-stdio.js b/test/parallel/test-child-process-stdio.js index 5ca3875f5600f6..a5e5f952259cee 100644 --- a/test/parallel/test-child-process-stdio.js +++ b/test/parallel/test-child-process-stdio.js @@ -60,8 +60,8 @@ const { spawn } = require('child_process'); })); child.on('close', common.mustCall(function() { - assert.strictEqual(true, output.length > 1); - assert.strictEqual('\n', output[output.length - 1]); + assert.strictEqual(output.length > 1, true); + assert.strictEqual(output[output.length - 1], '\n'); })); } From b63e9cb3fe9dc2d1748a4edf1282e7df51e09597 Mon Sep 17 00:00:00 2001 From: szabolcsit Date: Tue, 6 Nov 2018 15:33:38 +0100 Subject: [PATCH 031/223] test: fix arguments order in assert.strictEqual In the test test/parallel/test-http-client-upload.js test the actual and expected arguments in assert.strictEqual() calls were in the wrong order. Switched them around so the returned value by the function is the first argument and the literal value is the second argument. PR-URL: https://github.com/nodejs/node/pull/24143 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-http-client-upload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-client-upload.js b/test/parallel/test-http-client-upload.js index 000bf1d58424a3..830c37da8ef567 100644 --- a/test/parallel/test-http-client-upload.js +++ b/test/parallel/test-http-client-upload.js @@ -25,7 +25,7 @@ const assert = require('assert'); const http = require('http'); const server = http.createServer(common.mustCall(function(req, res) { - assert.strictEqual('POST', req.method); + assert.strictEqual(req.method, 'POST'); req.setEncoding('utf8'); let sent_body = ''; @@ -36,7 +36,7 @@ const server = http.createServer(common.mustCall(function(req, res) { }); req.on('end', common.mustCall(function() { - assert.strictEqual('1\n2\n3\n', sent_body); + assert.strictEqual(sent_body, '1\n2\n3\n'); console.log('request complete from server'); res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('hello\n'); From 2e0d3c9de905d79f12aa309b6c7db4e1e747c94b Mon Sep 17 00:00:00 2001 From: Kevin Seidel Date: Tue, 6 Nov 2018 17:06:28 +0100 Subject: [PATCH 032/223] test: fix order in assert.strictEqual to actual, expected PR-URL: https://github.com/nodejs/node/pull/24184 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/addons-napi/test_make_callback/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/addons-napi/test_make_callback/test.js b/test/addons-napi/test_make_callback/test.js index 3f51acb6c07ac6..f409bbc9d127d6 100644 --- a/test/addons-napi/test_make_callback/test.js +++ b/test/addons-napi/test_make_callback/test.js @@ -14,7 +14,7 @@ function myMultiArgFunc(arg1, arg2, arg3) { } assert.strictEqual(makeCallback(process, common.mustCall(function() { - assert.strictEqual(0, arguments.length); + assert.strictEqual(arguments.length, 0); assert.strictEqual(this, process); return 42; })), 42); From d7722dd9d8582b76f04a16bd11c4cd7140880365 Mon Sep 17 00:00:00 2001 From: mzucker Date: Wed, 7 Nov 2018 15:14:13 +0000 Subject: [PATCH 033/223] test: fix the arguments order in `assert.strictEqual` This change was initiated from the NodeConfEU session. PR-URL: https://github.com/nodejs/node/pull/24226 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- test/parallel/test-fs-read-stream-fd-leak.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-fs-read-stream-fd-leak.js b/test/parallel/test-fs-read-stream-fd-leak.js index 5bf0157ff4e7ae..81712def761340 100644 --- a/test/parallel/test-fs-read-stream-fd-leak.js +++ b/test/parallel/test-fs-read-stream-fd-leak.js @@ -37,8 +37,8 @@ function testLeak(endFn, callback) { } assert.strictEqual( - 0, openCount, + 0, `no leaked file descriptors using ${endFn}() (got ${openCount})` ); From 9052a22dd12df6e3a046bb45dff6c1ee02a54804 Mon Sep 17 00:00:00 2001 From: mzucker Date: Wed, 7 Nov 2018 15:21:37 +0000 Subject: [PATCH 034/223] test: fix the arguments order in `assert.strictEqual` This change was initiated from the NodeConfEU session. PR-URL: https://github.com/nodejs/node/pull/24227 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- test/parallel/test-fs-link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-fs-link.js b/test/parallel/test-fs-link.js index d007f4e985b2d5..9b95fc3e026140 100644 --- a/test/parallel/test-fs-link.js +++ b/test/parallel/test-fs-link.js @@ -15,7 +15,7 @@ fs.writeFileSync(srcPath, 'hello world'); function callback(err) { assert.ifError(err); const dstContent = fs.readFileSync(dstPath, 'utf8'); - assert.strictEqual('hello world', dstContent); + assert.strictEqual(dstContent, 'hello world'); } fs.link(srcPath, dstPath, common.mustCall(callback)); From cc688bb23f7b7703036b065c23b1b06b1fdec95a Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 6 Nov 2018 09:58:42 -0800 Subject: [PATCH 035/223] doc: fix some inconsistent use of hostname host names are DNS names, host addresses are IP addresses, and `host` arguments and options can be either. PR-URL: https://github.com/nodejs/node/pull/24199 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- doc/api/async_hooks.md | 2 +- doc/api/http.md | 14 +++++++------- doc/api/tls.md | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index f0752a5892c362..751bb124cd0a25 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -296,7 +296,7 @@ of propagating what resource is responsible for the new resource's existence. been initialized. This can contain useful information that can vary based on the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type, `resource` provides the hostname used when looking up the IP address for the -hostname in `net.Server.listen()`. The API for accessing this information is +host in `net.Server.listen()`. The API for accessing this information is currently not considered public, but using the Embedder API, users can provide and document their own resource objects. For example, such a resource object could contain the SQL query being executed. diff --git a/doc/api/http.md b/doc/api/http.md index af4c2c65f53b6c..c350e3458bee43 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -368,7 +368,7 @@ proxy.listen(1337, '127.0.0.1', () => { // make a request to a tunneling proxy const options = { port: 1337, - hostname: '127.0.0.1', + host: '127.0.0.1', method: 'CONNECT', path: 'www.google.com:80' }; @@ -415,7 +415,7 @@ event is emitted with a callback containing an object with a status code. const http = require('http'); const options = { - hostname: '127.0.0.1', + host: '127.0.0.1', port: 8080, path: '/length_request' }; @@ -502,7 +502,7 @@ srv.listen(1337, '127.0.0.1', () => { // make a request const options = { port: 1337, - hostname: '127.0.0.1', + host: '127.0.0.1', headers: { 'Connection': 'Upgrade', 'Upgrade': 'websocket' @@ -1924,14 +1924,14 @@ changes: * `host` {string} A domain name or IP address of the server to issue the request to. **Default:** `'localhost'`. * `hostname` {string} Alias for `host`. To support [`url.parse()`][], - `hostname` is preferred over `host`. - * `family` {number} IP address family to use when resolving `host` and + `hostname` will be used if both `host` and `hostname` are specified. + * `family` {number} IP address family to use when resolving `host` or `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be used. * `port` {number} Port of remote server. **Default:** `80`. * `localAddress` {string} Local interface to bind for network connections. - * `socketPath` {string} Unix Domain Socket (use one of `host:port` or - `socketPath`). + * `socketPath` {string} Unix Domain Socket (cannot be used if one of `host` + or `port` is specified, those specify a TCP Socket). * `method` {string} A string specifying the HTTP request method. **Default:** `'GET'`. * `path` {string} Request path. Should include query string if any. diff --git a/doc/api/tls.md b/doc/api/tls.md index 30dfb9c31e01fe..12ed2cf16aa8d2 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -799,14 +799,15 @@ decrease overall server throughput. added: v0.8.4 --> -* `hostname` {string} The hostname to verify the certificate against +* `hostname` {string} The host name or IP address to verify the certificate + against. * `cert` {Object} An object representing the peer's certificate. The returned object has some properties corresponding to the fields of the certificate. * Returns: {Error|undefined} Verifies the certificate `cert` is issued to `hostname`. -Returns {Error} object, populating it with the reason, host, and cert on +Returns {Error} object, populating it with `reason`, `host`, and `cert` on failure. On success, returns {undefined}. This function can be overwritten by providing alternative function as part of From efd697bc57fc578e37c4f3f220aec55c4eee1202 Mon Sep 17 00:00:00 2001 From: Jonah Polack Date: Tue, 6 Nov 2018 16:52:32 +0000 Subject: [PATCH 036/223] test: switch order of strictEqual arguments PR-URL: https://github.com/nodejs/node/pull/24185 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-fs-read-file-sync.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-read-file-sync.js b/test/parallel/test-fs-read-file-sync.js index c8a9941b4990da..ee6f34ac4dccfd 100644 --- a/test/parallel/test-fs-read-file-sync.js +++ b/test/parallel/test-fs-read-file-sync.js @@ -29,6 +29,6 @@ const fn = fixtures.path('elipses.txt'); const s = fs.readFileSync(fn, 'utf8'); for (let i = 0; i < s.length; i++) { - assert.strictEqual('\u2026', s[i]); + assert.strictEqual(s[i], '\u2026'); } -assert.strictEqual(10000, s.length); +assert.strictEqual(s.length, 10000); From d7a3a3bd9f3e177a9056d03886c4df91447401a6 Mon Sep 17 00:00:00 2001 From: Paul Isache Date: Tue, 6 Nov 2018 15:22:40 +0000 Subject: [PATCH 037/223] test: change arguments order in strictEqual Fix actual/expected ordering in test-net-eaddrinuse. PR-URL: https://github.com/nodejs/node/pull/24156 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-net-eaddrinuse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-net-eaddrinuse.js b/test/parallel/test-net-eaddrinuse.js index 8c3bcc6cf142dc..29508e4582852e 100644 --- a/test/parallel/test-net-eaddrinuse.js +++ b/test/parallel/test-net-eaddrinuse.js @@ -30,7 +30,7 @@ const server2 = net.createServer(function(socket) { }); server1.listen(0, function() { server2.on('error', function(error) { - assert.strictEqual(true, error.message.includes('EADDRINUSE')); + assert.strictEqual(error.message.includes('EADDRINUSE'), true); server1.close(); }); server2.listen(this.address().port); From 9a64ceca390cfc5a98ec8c0dfaab96fd6383a35b Mon Sep 17 00:00:00 2001 From: Brian White Date: Tue, 6 Nov 2018 18:16:16 -0500 Subject: [PATCH 038/223] buffer: fix writeUInt16BE range check Fixes: https://github.com/nodejs/node/issues/24205 PR-URL: https://github.com/nodejs/node/pull/24208 Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen --- lib/internal/buffer.js | 2 +- test/parallel/test-buffer-writeuint.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index 3a944a13de3031..42f4dc3fdc07a4 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -658,7 +658,7 @@ function writeU_Int16BE(buf, value, offset, min, max) { } function writeUInt16BE(value, offset = 0) { - return writeU_Int16BE(this, value, offset, 0, 0xffffffff); + return writeU_Int16BE(this, value, offset, 0, 0xffff); } function writeIntLE(value, offset = 0, byteLength) { diff --git a/test/parallel/test-buffer-writeuint.js b/test/parallel/test-buffer-writeuint.js index b0d49240dc6b90..346bb589a72b50 100644 --- a/test/parallel/test-buffer-writeuint.js +++ b/test/parallel/test-buffer-writeuint.js @@ -84,6 +84,18 @@ const assert = require('assert'); data.writeUInt16BE(value, 0); assert.ok(data.equals(new Uint8Array([0xff, 0x80, 0x43, 0x23]))); + + value = 0xfffff; + ['writeUInt16BE', 'writeUInt16LE'].forEach((fn) => { + assert.throws( + () => data[fn](value, 0), + { + code: 'ERR_OUT_OF_RANGE', + message: 'The value of "value" is out of range. ' + + `It must be >= 0 and <= 65535. Received ${value}` + } + ); + }); } // Test 32 bit From e57a5c37342bf27f612fed6acaa02d6e0599a595 Mon Sep 17 00:00:00 2001 From: reineke-fox Date: Tue, 6 Nov 2018 15:24:56 +0000 Subject: [PATCH 039/223] test: fix order of arguments in test-delayed-require assertion Fix order of arguments in equality assertion in test-delayed-require. PR-URL: https://github.com/nodejs/node/pull/24165 Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater --- test/parallel/test-delayed-require.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-delayed-require.js b/test/parallel/test-delayed-require.js index 8aecb354698185..355d503d2650d2 100644 --- a/test/parallel/test-delayed-require.js +++ b/test/parallel/test-delayed-require.js @@ -26,7 +26,7 @@ const fixtures = require('../common/fixtures'); setTimeout(common.mustCall(function() { const a = require(fixtures.path('a')); - assert.strictEqual(true, 'A' in a); - assert.strictEqual('A', a.A()); - assert.strictEqual('D', a.D()); + assert.strictEqual('A' in a, true); + assert.strictEqual(a.A(), 'A'); + assert.strictEqual(a.D(), 'D'); }), 50); From 8e9ff69d7f20df9f71964b8728b2754a57f93aa5 Mon Sep 17 00:00:00 2001 From: Mark Arranz Date: Tue, 6 Nov 2018 21:25:30 -0800 Subject: [PATCH 040/223] test: add error code tests in dgram test Improve error validation in test-dgram-send-bad-arguments. PR-URL: https://github.com/nodejs/node/pull/24215 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- .../parallel/test-dgram-send-bad-arguments.js | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-dgram-send-bad-arguments.js b/test/parallel/test-dgram-send-bad-arguments.js index 4eb7dca7a38e5d..20356ba50c477a 100644 --- a/test/parallel/test-dgram-send-bad-arguments.js +++ b/test/parallel/test-dgram-send-bad-arguments.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const dgram = require('dgram'); @@ -28,9 +28,16 @@ const buf = Buffer.from('test'); const host = '127.0.0.1'; const sock = dgram.createSocket('udp4'); -assert.throws(() => { - sock.send(); -}, TypeError); // First argument should be a buffer. +// First argument should be a buffer. +common.expectsError( + () => { sock.send(); }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "buffer" argument must be one of type ' + + 'Buffer, Uint8Array, or string. Received type undefined' + } +); // send(buf, offset, length, port, host) assert.throws(() => { sock.send(buf, 1, 1, -1, host); }, RangeError); @@ -38,7 +45,23 @@ assert.throws(() => { sock.send(buf, 1, 1, 0, host); }, RangeError); assert.throws(() => { sock.send(buf, 1, 1, 65536, host); }, RangeError); // send(buf, port, host) -assert.throws(() => { sock.send(23, 12345, host); }, TypeError); +common.expectsError( + () => { sock.send(23, 12345, host); }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "buffer" argument must be one of type ' + + 'Buffer, Uint8Array, or string. Received type number' + } +); // send([buf1, ..], port, host) -assert.throws(() => { sock.send([buf, 23], 12345, host); }, TypeError); +common.expectsError( + () => { sock.send([buf, 23], 12345, host); }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "buffer list arguments" argument must be one of type ' + + 'Buffer or string. Received type object' + } +); From 8c107a37f93bc1736ca68a6c1a628c254abbe075 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 7 Nov 2018 15:58:51 +0800 Subject: [PATCH 041/223] url: make the context non-enumerable At the moment we expose the context as a normal property on the prototype chain of URL or take them from the base URL which makes them enumerable and considered by assert libraries even though the context carries path-dependent information that do not affect the equivalence of these objects. This patch fixes it in a minimal manner by marking the context non-enumerable as making it full private would require more refactoring and can be done in a bigger patch later. PR-URL: https://github.com/nodejs/node/pull/24218 Refs: https://github.com/nodejs/node/issues/24211 Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: Daijiro Wachi --- lib/internal/url.js | 15 +++++++++++++-- ...est-whatwg-url-custom-no-enumerable-context.js | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-whatwg-url-custom-no-enumerable-context.js diff --git a/lib/internal/url.js b/lib/internal/url.js index 2bad698883631e..a3b1bedaca51ef 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -245,7 +245,14 @@ function onParseError(flags, input) { // Reused by URL constructor and URL#href setter. function parse(url, input, base) { const base_context = base ? base[context] : undefined; - url[context] = new URLContext(); + // In the URL#href setter + if (!url[context]) { + Object.defineProperty(url, context, { + enumerable: false, + configurable: false, + value: new URLContext() + }); + } _parse(input.trim(), -1, base_context, undefined, onParseComplete.bind(url), onParseError); } @@ -1437,7 +1444,11 @@ function toPathIfFileURL(fileURLOrPath) { } function NativeURL(ctx) { - this[context] = ctx; + Object.defineProperty(this, context, { + enumerable: false, + configurable: false, + value: ctx + }); } NativeURL.prototype = URL.prototype; diff --git a/test/parallel/test-whatwg-url-custom-no-enumerable-context.js b/test/parallel/test-whatwg-url-custom-no-enumerable-context.js new file mode 100644 index 00000000000000..f24a47b6d5c8f0 --- /dev/null +++ b/test/parallel/test-whatwg-url-custom-no-enumerable-context.js @@ -0,0 +1,14 @@ +'use strict'; +// This tests that the context of URL objects are not +// enumerable and thus considered by assert libraries. +// See https://github.com/nodejs/node/issues/24211 + +// Tests below are not from WPT. + +require('../common'); +const assert = require('assert'); + +assert.deepStrictEqual( + new URL('./foo', 'https://example.com/'), + new URL('https://example.com/foo') +); From 0c206e0d6d1f5f7d7a7390117e1bc5a22783204b Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 7 Nov 2018 04:28:50 +0800 Subject: [PATCH 042/223] benchmark: support more options in startup benchmark 1. Add options to benchmark the startup performance of a node "instance" after running a script. By default there are two options: `test/fixtures/semicolon` which is basically an empty file, and `benchmark/fixtures/require-cachable` which require all the cachable modules before exiting. This allows us to measure the overhead of bootstrap in more scenarios. 2. Add options to benchmark the overhead of spinning node through a process and through a worker. PR-URL: https://github.com/nodejs/node/pull/24220 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau --- benchmark/fixtures/require-cachable.js | 13 ++++ benchmark/misc/startup.js | 88 +++++++++++++++++++------- test/parallel/test-benchmark-misc.js | 2 + 3 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 benchmark/fixtures/require-cachable.js diff --git a/benchmark/fixtures/require-cachable.js b/benchmark/fixtures/require-cachable.js new file mode 100644 index 00000000000000..f651728dc78f35 --- /dev/null +++ b/benchmark/fixtures/require-cachable.js @@ -0,0 +1,13 @@ +'use strict'; + +const list = require('internal/bootstrap/cache'); +const { + isMainThread +} = require('worker_threads'); + +for (const key of list.cachableBuiltins) { + if (!isMainThread && key === 'trace_events') { + continue; + } + require(key); +} diff --git a/benchmark/misc/startup.js b/benchmark/misc/startup.js index 703146f081b3c6..1350cd291e2b18 100644 --- a/benchmark/misc/startup.js +++ b/benchmark/misc/startup.js @@ -1,36 +1,76 @@ 'use strict'; const common = require('../common.js'); -const spawn = require('child_process').spawn; +const { spawn } = require('child_process'); const path = require('path'); -const emptyJsFile = path.resolve(__dirname, '../../test/fixtures/semicolon.js'); -const bench = common.createBenchmark(startNode, { - dur: [1] +let Worker; // Lazy loaded in main + +const bench = common.createBenchmark(main, { + dur: [1], + script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'], + mode: ['process', 'worker'] +}, { + flags: ['--expose-internals', '--experimental-worker'] // for workers }); -function startNode({ dur }) { - var go = true; - var starts = 0; +function spawnProcess(script) { + const cmd = process.execPath || process.argv[0]; + const argv = ['--expose-internals', script]; + return spawn(cmd, argv); +} + +function spawnWorker(script) { + return new Worker(script, { stderr: true, stdout: true }); +} + +function start(state, script, bench, getNode) { + const node = getNode(script); + let stdout = ''; + let stderr = ''; + + node.stdout.on('data', (data) => { + stdout += data; + }); + + node.stderr.on('data', (data) => { + stderr += data; + }); + + node.on('exit', (code) => { + if (code !== 0) { + console.error('------ stdout ------'); + console.error(stdout); + console.error('------ stderr ------'); + console.error(stderr); + throw new Error(`Error during node startup, exit code ${code}`); + } + state.throughput++; + + if (state.go) { + start(state, script, bench, getNode); + } else { + bench.end(state.throughput); + } + }); +} + +function main({ dur, script, mode }) { + const state = { + go: true, + throughput: 0 + }; setTimeout(function() { - go = false; + state.go = false; }, dur * 1000); - bench.start(); - start(); - - function start() { - const node = spawn(process.execPath || process.argv[0], [emptyJsFile]); - node.on('exit', function(exitCode) { - if (exitCode !== 0) { - throw new Error('Error during node startup'); - } - starts++; - - if (go) - start(); - else - bench.end(starts); - }); + script = path.resolve(__dirname, '../../', `${script}.js`); + if (mode === 'worker') { + Worker = require('worker_threads').Worker; + bench.start(); + start(state, script, bench, spawnWorker); + } else { + bench.start(); + start(state, script, bench, spawnProcess); } } diff --git a/test/parallel/test-benchmark-misc.js b/test/parallel/test-benchmark-misc.js index fc7e340a80d0bb..b88415280833bc 100644 --- a/test/parallel/test-benchmark-misc.js +++ b/test/parallel/test-benchmark-misc.js @@ -11,4 +11,6 @@ runBenchmark('misc', [ 'n=1', 'type=', 'val=magyarország.icom.museum', + 'script=test/fixtures/semicolon', + 'mode=worker' ], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); From 31441f42c43d2459f68c94bc7be2f7920d1789ee Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 7 Nov 2018 13:25:52 -0800 Subject: [PATCH 043/223] doc: describe what tls servername is for Docs should describe the purpose of the option. PR-URL: https://github.com/nodejs/node/pull/24236 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- doc/api/tls.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 12ed2cf16aa8d2..12786e111b7ce6 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -892,7 +892,10 @@ changes: first byte is the length of the next protocol name. Passing an array is usually much simpler, e.g. `['hello', 'world']`. * `servername`: {string} Server name for the SNI (Server Name Indication) TLS - extension. It must be a host name, and not an IP address. + extension. It is the name of the host being connected to, and must be a host + name, and not an IP address. It can be used by a multi-homed server to + choose the correct certificate to present to the client, see the + `SNICallback` option to [`tls.createServer()`][]. * `checkServerIdentity(servername, cert)` {Function} A callback function to be used (instead of the builtin `tls.checkServerIdentity()` function) when checking the server's hostname (or the provided `servername` when From 9a69d030ce996c50b76214123dc167d9de48be66 Mon Sep 17 00:00:00 2001 From: alyssaq Date: Tue, 6 Nov 2018 14:34:52 +0000 Subject: [PATCH 044/223] src: reuse std::make_unique Ref: https://github.com/nodejs/node/commit/283a967e356311a467113eea450a81827d43c969 PR-URL: https://github.com/nodejs/node/pull/24132 Refs: https://github.com/nodejs/node/commit/283a967e356311a467113eea450a81827d43c969 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Eugene Ostroukhov --- src/inspector_agent.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index ebb7b7d5bc3e72..48a3e2e2be6e51 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -474,11 +474,9 @@ class NodeInspectorClient : public V8InspectorClient { bool prevent_shutdown) { events_dispatched_ = true; int session_id = next_session_id_++; - // TODO(addaleax): Revert back to using make_unique once we get issues - // with CI resolved (i.e. revert the patch that added this comment). - channels_[session_id].reset( - new ChannelImpl(env_, client_, getWorkerManager(), - std::move(delegate), prevent_shutdown)); + channels_[session_id] = + std::make_unique(env_, client_, getWorkerManager(), + std::move(delegate), prevent_shutdown); return session_id; } From 53b12c3731a250909b050b1d724b196745bb6c9f Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 7 Nov 2018 07:50:51 +0100 Subject: [PATCH 045/223] test: fix NewFromUtf8 compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently there are a number of compiler warnings like the following: ../binding.cc:6:41: warning: 'NewFromUtf8' is deprecated: Use maybe version [-Wdeprecated-declarations] args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); ^ /node/deps/v8/include/v8.h:2883:10: note: 'NewFromUtf8' has been explicitly marked deprecated here static V8_DEPRECATE_SOON( ^ /node/deps/v8/include/v8config.h:341:29: note: expanded from macro 'V8_DEPRECATE_SOON' declarator __attribute__((deprecated(message))) ^ This commit updates the code to use the maybe versions. PR-URL: https://github.com/nodejs/node/pull/24216 Reviewed-By: Michaël Zasso Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- doc/api/addons.md | 46 ++++++++++++++----- test/addons/dlopen-ping-pong/binding.cc | 4 +- test/addons/heap-profiler/binding.cc | 3 +- test/addons/hello-world-esm/binding.cc | 3 +- .../hello-world-function-export/binding.cc | 3 +- test/addons/hello-world/binding.cc | 3 +- test/addons/load-long-path/binding.cc | 3 +- test/addons/new-target/binding.cc | 3 +- test/addons/openssl-binding/binding.cc | 3 +- test/addons/symlinked-module/binding.cc | 3 +- test/addons/zlib-binding/binding.cc | 3 +- 11 files changed, 56 insertions(+), 21 deletions(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 757f24c5194271..e2530acb77d5e0 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -63,13 +63,15 @@ namespace demo { using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Object; using v8::String; using v8::Value; void Method(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); + args.GetReturnValue().Set(String::NewFromUtf8( + isolate, "world", NewStringType::kNormal).ToLocalChecked()); } void Initialize(Local exports) { @@ -464,6 +466,7 @@ using v8::Exception; using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Number; using v8::Object; using v8::String; @@ -479,14 +482,18 @@ void Add(const FunctionCallbackInfo& args) { if (args.Length() < 2) { // Throw an Error that is passed back to JavaScript isolate->ThrowException(Exception::TypeError( - String::NewFromUtf8(isolate, "Wrong number of arguments"))); + String::NewFromUtf8(isolate, + "Wrong number of arguments", + NewStringType::kNormal).ToLocalChecked())); return; } // Check the argument types if (!args[0]->IsNumber() || !args[1]->IsNumber()) { isolate->ThrowException(Exception::TypeError( - String::NewFromUtf8(isolate, "Wrong arguments"))); + String::NewFromUtf8(isolate, + "Wrong arguments", + NewStringType::kNormal).ToLocalChecked())); return; } @@ -534,6 +541,7 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Null; using v8::Object; using v8::String; @@ -543,7 +551,10 @@ void RunCallback(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); Local cb = Local::Cast(args[0]); const unsigned argc = 1; - Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + Local argv[argc] = { + String::NewFromUtf8(isolate, + "hello world", + NewStringType::kNormal).ToLocalChecked() }; cb->Call(Null(isolate), argc, argv); } @@ -591,6 +602,7 @@ using v8::Context; using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Object; using v8::String; using v8::Value; @@ -600,7 +612,9 @@ void CreateObject(const FunctionCallbackInfo& args) { Local context = isolate->GetCurrentContext(); Local obj = Object::New(isolate); - obj->Set(String::NewFromUtf8(isolate, "msg"), + obj->Set(String::NewFromUtf8(isolate, + "msg", + NewStringType::kNormal).ToLocalChecked(), args[0]->ToString(context).ToLocalChecked()); args.GetReturnValue().Set(obj); @@ -644,13 +658,15 @@ using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Object; using v8::String; using v8::Value; void MyFunction(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); + args.GetReturnValue().Set(String::NewFromUtf8( + isolate, "hello world", NewStringType::kNormal).ToLocalChecked()); } void CreateFunction(const FunctionCallbackInfo& args) { @@ -661,7 +677,8 @@ void CreateFunction(const FunctionCallbackInfo& args) { Local fn = tpl->GetFunction(context).ToLocalChecked(); // omit this to make it anonymous - fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + fn->SetName(String::NewFromUtf8( + isolate, "theFunction", NewStringType::kNormal).ToLocalChecked()); args.GetReturnValue().Set(fn); } @@ -757,6 +774,7 @@ using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Number; using v8::Object; using v8::Persistent; @@ -776,7 +794,8 @@ void MyObject::Init(Local exports) { // Prepare constructor template Local tpl = FunctionTemplate::New(isolate, New); - tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); // Prototype @@ -784,7 +803,8 @@ void MyObject::Init(Local exports) { Local context = isolate->GetCurrentContext(); constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); - exports->Set(String::NewFromUtf8(isolate, "MyObject"), + exports->Set(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked()); } @@ -952,6 +972,7 @@ using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Number; using v8::Object; using v8::Persistent; @@ -969,7 +990,8 @@ MyObject::~MyObject() { void MyObject::Init(Isolate* isolate) { // Prepare constructor template Local tpl = FunctionTemplate::New(isolate, New); - tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); // Prototype @@ -1167,6 +1189,7 @@ using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Object; using v8::Persistent; using v8::String; @@ -1183,7 +1206,8 @@ MyObject::~MyObject() { void MyObject::Init(Isolate* isolate) { // Prepare constructor template Local tpl = FunctionTemplate::New(isolate, New); - tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); Local context = isolate->GetCurrentContext(); diff --git a/test/addons/dlopen-ping-pong/binding.cc b/test/addons/dlopen-ping-pong/binding.cc index a3b9af1b8099a3..6a6c297b52fff9 100644 --- a/test/addons/dlopen-ping-pong/binding.cc +++ b/test/addons/dlopen-ping-pong/binding.cc @@ -15,6 +15,7 @@ using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; using v8::Object; +using v8::NewStringType; using v8::String; using v8::Value; @@ -33,7 +34,8 @@ void LoadLibrary(const FunctionCallbackInfo& args) { void Ping(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); assert(ping_func != nullptr); - args.GetReturnValue().Set(String::NewFromUtf8(isolate, ping_func())); + args.GetReturnValue().Set(String::NewFromUtf8( + isolate, ping_func(), NewStringType::kNormal).ToLocalChecked()); } void init(Local exports) { diff --git a/test/addons/heap-profiler/binding.cc b/test/addons/heap-profiler/binding.cc index 861fb5a80c4651..29f58a5920825a 100644 --- a/test/addons/heap-profiler/binding.cc +++ b/test/addons/heap-profiler/binding.cc @@ -19,7 +19,8 @@ inline void Test(const v8::FunctionCallbackInfo& args) { inline void Initialize(v8::Local binding) { v8::Isolate* const isolate = binding->GetIsolate(); v8::Local context = isolate->GetCurrentContext(); - binding->Set(v8::String::NewFromUtf8(isolate, "test"), + binding->Set(v8::String::NewFromUtf8( + isolate, "test", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, Test) ->GetFunction(context) .ToLocalChecked()); diff --git a/test/addons/hello-world-esm/binding.cc b/test/addons/hello-world-esm/binding.cc index 944f5631956d15..02eecec099807a 100644 --- a/test/addons/hello-world-esm/binding.cc +++ b/test/addons/hello-world-esm/binding.cc @@ -3,7 +3,8 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); + args.GetReturnValue().Set(v8::String::NewFromUtf8( + isolate, "world", v8::NewStringType::kNormal).ToLocalChecked()); } void init(v8::Local exports) { diff --git a/test/addons/hello-world-function-export/binding.cc b/test/addons/hello-world-function-export/binding.cc index 55d64b3d6c3513..e5476c4ee1e364 100644 --- a/test/addons/hello-world-function-export/binding.cc +++ b/test/addons/hello-world-function-export/binding.cc @@ -3,7 +3,8 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); + args.GetReturnValue().Set(v8::String::NewFromUtf8( + isolate, "world", v8::NewStringType::kNormal).ToLocalChecked()); } void init(v8::Local exports, v8::Local module) { diff --git a/test/addons/hello-world/binding.cc b/test/addons/hello-world/binding.cc index 341b58f9a640d8..81bcbc29c78645 100644 --- a/test/addons/hello-world/binding.cc +++ b/test/addons/hello-world/binding.cc @@ -3,7 +3,8 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); + args.GetReturnValue().Set(v8::String::NewFromUtf8( + isolate, "world", v8::NewStringType::kNormal).ToLocalChecked()); } // Not using the full NODE_MODULE_INIT() macro here because we want to test the diff --git a/test/addons/load-long-path/binding.cc b/test/addons/load-long-path/binding.cc index 944f5631956d15..02eecec099807a 100644 --- a/test/addons/load-long-path/binding.cc +++ b/test/addons/load-long-path/binding.cc @@ -3,7 +3,8 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); + args.GetReturnValue().Set(v8::String::NewFromUtf8( + isolate, "world", v8::NewStringType::kNormal).ToLocalChecked()); } void init(v8::Local exports) { diff --git a/test/addons/new-target/binding.cc b/test/addons/new-target/binding.cc index 21b932ae018dfd..c2777c831e484a 100644 --- a/test/addons/new-target/binding.cc +++ b/test/addons/new-target/binding.cc @@ -12,7 +12,8 @@ inline void NewClass(const v8::FunctionCallbackInfo& args) { inline void Initialize(v8::Local binding) { auto isolate = binding->GetIsolate(); auto context = isolate->GetCurrentContext(); - binding->Set(v8::String::NewFromUtf8(isolate, "Class"), + binding->Set(v8::String::NewFromUtf8( + isolate, "Class", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, NewClass) ->GetFunction(context) .ToLocalChecked()); diff --git a/test/addons/openssl-binding/binding.cc b/test/addons/openssl-binding/binding.cc index bb00f1e176d7ce..122d420bc14e0b 100644 --- a/test/addons/openssl-binding/binding.cc +++ b/test/addons/openssl-binding/binding.cc @@ -22,7 +22,8 @@ inline void Initialize(v8::Local exports, v8::Local module, v8::Local context) { auto isolate = context->GetIsolate(); - auto key = v8::String::NewFromUtf8(isolate, "randomBytes"); + auto key = v8::String::NewFromUtf8( + isolate, "randomBytes", v8::NewStringType::kNormal).ToLocalChecked(); auto value = v8::FunctionTemplate::New(isolate, RandomBytes) ->GetFunction(context) .ToLocalChecked(); diff --git a/test/addons/symlinked-module/binding.cc b/test/addons/symlinked-module/binding.cc index 944f5631956d15..02eecec099807a 100644 --- a/test/addons/symlinked-module/binding.cc +++ b/test/addons/symlinked-module/binding.cc @@ -3,7 +3,8 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); + args.GetReturnValue().Set(v8::String::NewFromUtf8( + isolate, "world", v8::NewStringType::kNormal).ToLocalChecked()); } void init(v8::Local exports) { diff --git a/test/addons/zlib-binding/binding.cc b/test/addons/zlib-binding/binding.cc index 1d0af911115359..0b82de211a8430 100644 --- a/test/addons/zlib-binding/binding.cc +++ b/test/addons/zlib-binding/binding.cc @@ -45,7 +45,8 @@ inline void Initialize(v8::Local exports, v8::Local module, v8::Local context) { auto isolate = context->GetIsolate(); - auto key = v8::String::NewFromUtf8(isolate, "compressBytes"); + auto key = v8::String::NewFromUtf8( + isolate, "compressBytes", v8::NewStringType::kNormal).ToLocalChecked(); auto value = v8::FunctionTemplate::New(isolate, CompressBytes) ->GetFunction(context) .ToLocalChecked(); From 540b741ae2d3803c82ed8e75d4f11e1340fc6454 Mon Sep 17 00:00:00 2001 From: Artur Daschevici Date: Tue, 6 Nov 2018 17:11:18 +0000 Subject: [PATCH 046/223] test: add coverage for escape key switch case PR-URL: https://github.com/nodejs/node/pull/24194 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/parallel/test-readline-keys.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index f739999110b12f..c5b3cbf44cd496 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -108,6 +108,11 @@ addTest('\b\x7f\x1b\b\x1b\x7f \x1b ', [ { name: 'space', sequence: '\x1b ', meta: true }, ]); +// escape key +addTest('\x1b\x1b\x1b', [ + { name: 'escape', sequence: '\x1b\x1b\x1b', meta: true }, +]); + // control keys addTest('\x01\x0b\x10', [ { name: 'a', sequence: '\x01', ctrl: true }, From 2d6e942035b3480b5a208ac9f9fe5b651a606825 Mon Sep 17 00:00:00 2001 From: razvanbh Date: Wed, 7 Nov 2018 13:08:27 +0200 Subject: [PATCH 047/223] test: add test for 'ERR_INVALID_CALLBACK' PR-URL: https://github.com/nodejs/node/pull/24224 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/sequential/test-inspector-module.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/sequential/test-inspector-module.js b/test/sequential/test-inspector-module.js index eaecd49c982311..26bb7fe9262889 100644 --- a/test/sequential/test-inspector-module.js +++ b/test/sequential/test-inspector-module.js @@ -46,6 +46,17 @@ session.post('Runtime.evaluate', { expression: '2 + 2' }); ); }); +[1, 'a', {}, [], true, Infinity].forEach((i) => { + common.expectsError( + () => session.post('test', {}, i), + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError, + message: 'Callback must be a function' + } + ); +}); + common.expectsError( () => session.connect(), { From abe3edad48cf275127ab5e2a6238f04a7bd639f5 Mon Sep 17 00:00:00 2001 From: Grant Carthew Date: Tue, 6 Nov 2018 08:40:22 +1000 Subject: [PATCH 048/223] doc: fix code examples in stream.md * Replace `console.error()` with `console.log()`. * Fix case and punctuation in logged output. PR-URL: https://github.com/nodejs/node/pull/24112 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt --- doc/api/stream.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index fbb8ad78facf70..ec4f47a80a9c44 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -291,7 +291,7 @@ for (let i = 0; i < 100; i++) { } writer.end('This is the end\n'); writer.on('finish', () => { - console.error('All writes are now complete.'); + console.log('All writes are now complete.'); }); ``` @@ -309,7 +309,7 @@ a readable stream, adding this writable to its set of destinations. const writer = getWritableStreamSomehow(); const reader = getReadableStreamSomehow(); writer.on('pipe', (src) => { - console.error('something is piping into the writer'); + console.log('Something is piping into the writer.'); assert.equal(src, reader); }); reader.pipe(writer); @@ -334,7 +334,7 @@ This is also emitted in case this [`Writable`][] stream emits an error when a const writer = getWritableStreamSomehow(); const reader = getReadableStreamSomehow(); writer.on('unpipe', (src) => { - console.error('Something has stopped piping into the writer.'); + console.log('Something has stopped piping into the writer.'); assert.equal(src, reader); }); reader.pipe(writer); @@ -551,7 +551,7 @@ function write(data, cb) { // Wait for cb to be called before doing any other write. write('hello', () => { - console.log('write completed, do more writes now'); + console.log('Write completed, do more writes now.'); }); ``` @@ -1091,7 +1091,7 @@ const readable = getReadableStreamSomehow(); readable.setEncoding('utf8'); readable.on('data', (chunk) => { assert.equal(typeof chunk, 'string'); - console.log('got %d characters of string data', chunk.length); + console.log('Got %d characters of string data:', chunk.length); }); ``` @@ -1119,9 +1119,9 @@ const writable = fs.createWriteStream('file.txt'); // but only for the first second readable.pipe(writable); setTimeout(() => { - console.log('Stop writing to file.txt'); + console.log('Stop writing to file.txt.'); readable.unpipe(writable); - console.log('Manually close the file stream'); + console.log('Manually close the file stream.'); writable.end(); }, 1000); ``` @@ -1329,9 +1329,9 @@ const rs = fs.createReadStream('archive.tar'); finished(rs, (err) => { if (err) { - console.error('Stream failed', err); + console.error('Stream failed.', err); } else { - console.log('Stream is done reading'); + console.log('Stream is done reading.'); } }); @@ -1351,7 +1351,7 @@ const rs = fs.createReadStream('archive.tar'); async function run() { await finished(rs); - console.log('Stream is done reading'); + console.log('Stream is done reading.'); } run().catch(console.error); @@ -1386,9 +1386,9 @@ pipeline( fs.createWriteStream('archive.tar.gz'), (err) => { if (err) { - console.error('Pipeline failed', err); + console.error('Pipeline failed.', err); } else { - console.log('Pipeline succeeded'); + console.log('Pipeline succeeded.'); } } ); @@ -1405,7 +1405,7 @@ async function run() { zlib.createGzip(), fs.createWriteStream('archive.tar.gz') ); - console.log('Pipeline succeeded'); + console.log('Pipeline succeeded.'); } run().catch(console.error); From a1d7ed7de6a3ac78a8afae6ffbc31e7b19e26e26 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 6 Nov 2018 10:21:43 +0000 Subject: [PATCH 049/223] tracing: fix static destruction order issue Sometimes, the `parallel/test-tracing-no-crash` would not work as expected, at least on Windows, because there is a static destruction race between tearing down the `NodeTraceWriter` instance and the per-process options struct. If the per-process options were destroyed before the `NodeTraceWriter`, the reference to the tracing filename would be gone before opening the file was attempted. This can be solved by creating a copy of the string when creating the `NodeTraceWriter` instance rather than taking a reference. Fixes: https://github.com/nodejs/node/issues/22523 PR-URL: https://github.com/nodejs/node/pull/24123 Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- src/tracing/node_trace_writer.h | 2 +- test/parallel/test-tracing-no-crash.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/tracing/node_trace_writer.h b/src/tracing/node_trace_writer.h index 5e5781479c689f..a91176ad4905a9 100644 --- a/src/tracing/node_trace_writer.h +++ b/src/tracing/node_trace_writer.h @@ -61,7 +61,7 @@ class NodeTraceWriter : public AsyncTraceWriter { int highest_request_id_completed_ = 0; int total_traces_ = 0; int file_num_ = 0; - const std::string& log_file_pattern_; + std::string log_file_pattern_; std::ostringstream stream_; std::unique_ptr json_trace_writer_; bool exited_ = false; diff --git a/test/parallel/test-tracing-no-crash.js b/test/parallel/test-tracing-no-crash.js index 5b11522911e75d..0ae402f5288cca 100644 --- a/test/parallel/test-tracing-no-crash.js +++ b/test/parallel/test-tracing-no-crash.js @@ -8,7 +8,15 @@ function CheckNoSignalAndErrorCodeOne(code, signal) { assert.strictEqual(code, 1); } -const child = spawn(process.execPath, - ['--trace-event-categories', 'madeup', '-e', - 'throw new Error()'], { stdio: 'inherit' }); +const child = spawn(process.execPath, [ + '--trace-event-categories', 'madeup', '-e', 'throw new Error()' +], { stdio: [ 'inherit', 'inherit', 'pipe' ] }); child.on('exit', common.mustCall(CheckNoSignalAndErrorCodeOne)); + +let stderr; +child.stderr.setEncoding('utf8'); +child.stderr.on('data', (chunk) => stderr += chunk); +child.stderr.on('end', common.mustCall(() => { + assert(stderr.includes('throw new Error()'), stderr); + assert(!stderr.includes('Could not open trace file'), stderr); +})); From 9fa71468f5cc59e0065ef0fd48b1bceed0583050 Mon Sep 17 00:00:00 2001 From: Alex Seifert Date: Tue, 6 Nov 2018 14:51:20 +0000 Subject: [PATCH 050/223] test: fix order of arguments in assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/24145 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/parallel/test-buffer-indexof.js | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index d7e34b66d2b3b3..3647d115b0dc5b 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -505,20 +505,20 @@ assert.strictEqual(buf_bc.lastIndexOf(Buffer.from('你好'), 7), -1); // Test lastIndexOf on a longer buffer: const bufferString = Buffer.from('a man a plan a canal panama'); -assert.strictEqual(15, bufferString.lastIndexOf('canal')); -assert.strictEqual(21, bufferString.lastIndexOf('panama')); -assert.strictEqual(0, bufferString.lastIndexOf('a man a plan a canal panama')); +assert.strictEqual(bufferString.lastIndexOf('canal'), 15); +assert.strictEqual(bufferString.lastIndexOf('panama'), 21); +assert.strictEqual(bufferString.lastIndexOf('a man a plan a canal panama'), 0); assert.strictEqual(-1, bufferString.lastIndexOf('a man a plan a canal mexico')); assert.strictEqual(-1, bufferString .lastIndexOf('a man a plan a canal mexico city')); assert.strictEqual(-1, bufferString.lastIndexOf(Buffer.from('a'.repeat(1000)))); -assert.strictEqual(0, bufferString.lastIndexOf('a man a plan', 4)); -assert.strictEqual(13, bufferString.lastIndexOf('a ')); -assert.strictEqual(13, bufferString.lastIndexOf('a ', 13)); -assert.strictEqual(6, bufferString.lastIndexOf('a ', 12)); -assert.strictEqual(0, bufferString.lastIndexOf('a ', 5)); -assert.strictEqual(13, bufferString.lastIndexOf('a ', -1)); -assert.strictEqual(0, bufferString.lastIndexOf('a ', -27)); +assert.strictEqual(bufferString.lastIndexOf('a man a plan', 4), 0); +assert.strictEqual(bufferString.lastIndexOf('a '), 13); +assert.strictEqual(bufferString.lastIndexOf('a ', 13), 13); +assert.strictEqual(bufferString.lastIndexOf('a ', 12), 6); +assert.strictEqual(bufferString.lastIndexOf('a ', 5), 0); +assert.strictEqual(bufferString.lastIndexOf('a ', -1), 13); +assert.strictEqual(bufferString.lastIndexOf('a ', -27), 0); assert.strictEqual(-1, bufferString.lastIndexOf('a ', -28)); // Test lastIndexOf for the case that the first character can be found, @@ -534,18 +534,18 @@ assert.strictEqual(-1, Buffer.from('bc').lastIndexOf(Buffer.from('ab'))); assert.strictEqual(-1, Buffer.from('bc', 'ucs2').lastIndexOf('ab', 'ucs2')); assert.strictEqual(-1, Buffer.from('bc', 'ucs2').lastIndexOf(abInUCS2)); -assert.strictEqual(0, Buffer.from('abc').lastIndexOf('ab')); -assert.strictEqual(0, Buffer.from('abc').lastIndexOf('ab', 1)); -assert.strictEqual(0, Buffer.from('abc').lastIndexOf('ab', 2)); -assert.strictEqual(0, Buffer.from('abc').lastIndexOf('ab', 3)); +assert.strictEqual(Buffer.from('abc').lastIndexOf('ab'), 0); +assert.strictEqual(Buffer.from('abc').lastIndexOf('ab', 1), 0); +assert.strictEqual(Buffer.from('abc').lastIndexOf('ab', 2), 0); +assert.strictEqual(Buffer.from('abc').lastIndexOf('ab', 3), 0); // The above tests test the LINEAR and SINGLE-CHAR strategies. // Now, we test the BOYER-MOORE-HORSPOOL strategy. // Test lastIndexOf on a long buffer w multiple matches: pattern = 'JABACABADABACABA'; -assert.strictEqual(1535, longBufferString.lastIndexOf(pattern)); -assert.strictEqual(1535, longBufferString.lastIndexOf(pattern, 1535)); -assert.strictEqual(511, longBufferString.lastIndexOf(pattern, 1534)); +assert.strictEqual(longBufferString.lastIndexOf(pattern), 1535); +assert.strictEqual(longBufferString.lastIndexOf(pattern, 1535), 1535); +assert.strictEqual(longBufferString.lastIndexOf(pattern, 1534), 511); // Finally, give it a really long input to trigger fallback from BMH to // regular BOYER-MOORE (which has better worst-case complexity). @@ -567,19 +567,19 @@ for (let i = 0; i < 1000000; i++) { parts.push((countBits(i) % 2 === 0) ? 'yolo' : 'swag'); } const reallyLong = Buffer.from(parts.join(' ')); -assert.strictEqual('yolo swag swag yolo', reallyLong.slice(0, 19).toString()); +assert.strictEqual(reallyLong.slice(0, 19).toString(), 'yolo swag swag yolo'); // Expensive reverse searches. Stress test lastIndexOf: pattern = reallyLong.slice(0, 100000); // First 1/50th of the pattern. -assert.strictEqual(4751360, reallyLong.lastIndexOf(pattern)); -assert.strictEqual(3932160, reallyLong.lastIndexOf(pattern, 4000000)); -assert.strictEqual(2949120, reallyLong.lastIndexOf(pattern, 3000000)); +assert.strictEqual(reallyLong.lastIndexOf(pattern), 4751360); +assert.strictEqual(reallyLong.lastIndexOf(pattern, 4000000), 3932160); +assert.strictEqual(reallyLong.lastIndexOf(pattern, 3000000), 2949120); pattern = reallyLong.slice(100000, 200000); // Second 1/50th. -assert.strictEqual(4728480, reallyLong.lastIndexOf(pattern)); +assert.strictEqual(reallyLong.lastIndexOf(pattern), 4728480); pattern = reallyLong.slice(0, 1000000); // First 1/5th. -assert.strictEqual(3932160, reallyLong.lastIndexOf(pattern)); +assert.strictEqual(reallyLong.lastIndexOf(pattern), 3932160); pattern = reallyLong.slice(0, 2000000); // first 2/5ths. -assert.strictEqual(0, reallyLong.lastIndexOf(pattern)); +assert.strictEqual(reallyLong.lastIndexOf(pattern), 0); // test truncation of Number arguments to uint8 { From cd2dedfa4fd6e41b4ce4fa03b6ce44cc85a26c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amer=20Alimanovi=C4=87?= Date: Tue, 6 Nov 2018 17:46:28 +0000 Subject: [PATCH 051/223] test: add coverage for systemerror set name PR-URL: https://github.com/nodejs/node/pull/24200 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater --- test/parallel/test-errors-systemerror.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/parallel/test-errors-systemerror.js b/test/parallel/test-errors-systemerror.js index 957a0dd7b22196..0b5f9b9a107d59 100644 --- a/test/parallel/test-errors-systemerror.js +++ b/test/parallel/test-errors-systemerror.js @@ -111,3 +111,25 @@ const { ERR_TEST } = codes; assert.strictEqual(err.path, 'path'); assert.strictEqual(err.dest, 'path'); } + +{ + const ctx = { + code: 'ERR_TEST', + message: 'Error occurred', + syscall: 'syscall_test' + }; + assert.throws( + () => { + const err = new ERR_TEST(ctx); + err.name = 'SystemError [CUSTOM_ERR_TEST]'; + throw err; + }, + { + code: 'ERR_TEST', + name: 'SystemError [CUSTOM_ERR_TEST]', + message: 'custom message: syscall_test returned ERR_TEST ' + + '(Error occurred)', + info: ctx + } + ); +} From 1b5b1cc08b4592ee65c13023a1c84a7bbe8f5510 Mon Sep 17 00:00:00 2001 From: Nikita Malyschkin Date: Wed, 7 Nov 2018 10:10:12 +0100 Subject: [PATCH 052/223] test: add test for strictDeepEqual PR-URL: https://github.com/nodejs/node/pull/24197 Reviewed-By: Ruben Bridgewater Reviewed-By: Daijiro Wachi --- test/parallel/test-util-isDeepStrictEqual.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/parallel/test-util-isDeepStrictEqual.js b/test/parallel/test-util-isDeepStrictEqual.js index 938781a43084a5..fd585f7ccf0f1e 100644 --- a/test/parallel/test-util-isDeepStrictEqual.js +++ b/test/parallel/test-util-isDeepStrictEqual.js @@ -459,10 +459,13 @@ utilIsDeepStrict(-0, -0); const obj1 = { [symbol1]: 1 }; const obj2 = { [symbol1]: 1 }; const obj3 = { [Symbol()]: 1 }; + const obj4 = { }; // Add a non enumerable symbol as well. It is going to be ignored! Object.defineProperty(obj2, Symbol(), { value: 1 }); + Object.defineProperty(obj4, symbol1, { value: 1 }); notUtilIsDeepStrict(obj1, obj3); utilIsDeepStrict(obj1, obj2); + notUtilIsDeepStrict(obj1, obj4); // TypedArrays have a fast path. Test for this as well. const a = new Uint8Array(4); const b = new Uint8Array(4); From c417c7a89a13225243acaa367190d04776d64754 Mon Sep 17 00:00:00 2001 From: "ivan.filenko" Date: Mon, 15 Oct 2018 20:04:29 +0300 Subject: [PATCH 053/223] test: use assert.strictEqual instead of assert.equal PR-URL: https://github.com/nodejs/node/pull/23673 Reviewed-By: Ruben Bridgewater Reviewed-By: Refael Ackermann --- test/pseudo-tty/test-tty-get-color-depth.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pseudo-tty/test-tty-get-color-depth.js b/test/pseudo-tty/test-tty-get-color-depth.js index d802add1189db2..e735f4c286aeb3 100644 --- a/test/pseudo-tty/test-tty-get-color-depth.js +++ b/test/pseudo-tty/test-tty-get-color-depth.js @@ -10,7 +10,7 @@ const writeStream = new WriteStream(fd); { const depth = writeStream.getColorDepth(); - assert.equal(typeof depth, 'number'); + assert.strictEqual(typeof depth, 'number'); assert(depth >= 1 && depth <= 24); } @@ -44,7 +44,7 @@ const writeStream = new WriteStream(fd); [{ TERM: 'dumb', COLORTERM: '1' }, 4], ].forEach(([env, depth], i) => { const actual = writeStream.getColorDepth(env); - assert.equal( + assert.strictEqual( actual, depth, `i: ${i}, expected: ${depth}, actual: ${actual}, env: ${env}` @@ -57,8 +57,8 @@ const writeStream = new WriteStream(fd); const [ value, depth1, depth2 ] = process.platform !== 'win32' ? ['win32', 1, 4] : ['linux', 4, 1]; - assert.equal(writeStream.getColorDepth({}), depth1); + assert.strictEqual(writeStream.getColorDepth({}), depth1); Object.defineProperty(process, 'platform', { value }); - assert.equal(writeStream.getColorDepth({}), depth2); + assert.strictEqual(writeStream.getColorDepth({}), depth2); Object.defineProperty(process, 'platform', platform); } From 4054c24cac5cad258ec9ef2d1703d51bbbf9c84a Mon Sep 17 00:00:00 2001 From: "ivan.filenko" Date: Mon, 15 Oct 2018 20:32:30 +0300 Subject: [PATCH 054/223] test: fix uses of deprecated assert.fail with multiple args PR-URL: https://github.com/nodejs/node/pull/23673 Reviewed-By: Ruben Bridgewater Reviewed-By: Refael Ackermann --- test/async-hooks/init-hooks.js | 3 +-- test/parallel/test-net-connect-options-fd.js | 4 ++-- test/parallel/test-string-decoder.js | 2 +- test/pseudo-tty/test-tty-get-color-depth.js | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/async-hooks/init-hooks.js b/test/async-hooks/init-hooks.js index 14969d8e753b68..817b2db0c781b4 100644 --- a/test/async-hooks/init-hooks.js +++ b/test/async-hooks/init-hooks.js @@ -120,8 +120,7 @@ class ActivityCollector { } if (violations.length) { console.error(violations.join('\n\n') + '\n'); - assert.fail(violations.length, 0, - `${violations.length} failed sanity checks`); + assert.fail(`${violations.length} failed sanity checks`); } } diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 76a5e30755b15c..8a53c3df928b25 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -68,7 +68,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); }) .on('error', function(err) { console.error(err); - assert.fail(null, null, `[Pipe server]${err}`); + assert.fail(`[Pipe server]${err}`); }) .listen({ path: serverPath }, common.mustCall(function serverOnListen() { const getSocketOpt = (index) => { @@ -92,7 +92,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`); this.on('error', function(err) { console.error(err); - assert.fail(null, null, `[Pipe Client]${err}`); + assert.fail(`[Pipe Client]${err}`); }); }); diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index c4607672b0420c..37902c5ccbc5fd 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -217,7 +217,7 @@ function test(encoding, input, expected, singleSequence) { `input: ${input.toString('hex').match(hexNumberRE)}\n` + `Write sequence: ${JSON.stringify(sequence)}\n` + `Full Decoder State: ${inspect(decoder)}`; - assert.fail(output, expected, message); + assert.fail(message); } }); } diff --git a/test/pseudo-tty/test-tty-get-color-depth.js b/test/pseudo-tty/test-tty-get-color-depth.js index e735f4c286aeb3..d4062f5fdb6d39 100644 --- a/test/pseudo-tty/test-tty-get-color-depth.js +++ b/test/pseudo-tty/test-tty-get-color-depth.js @@ -2,7 +2,6 @@ const common = require('../common'); const assert = require('assert').strict; -/* eslint-disable no-restricted-properties */ const { WriteStream } = require('tty'); const fd = common.getTTYfd(); From b305db8634c0ad2c96933474df1adec6221759ce Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 7 Nov 2018 22:43:45 -0800 Subject: [PATCH 055/223] doc: edit BUILDING.md Minor edits to BUILDING.md to keep sentences short and clear. PR-URL: https://github.com/nodejs/node/pull/24243 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt Reviewed-By: Refael Ackermann --- BUILDING.md | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index efe39e656b383a..36d87c0f141b79 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -69,8 +69,7 @@ There are three support tiers: ### Supported platforms The community does not build or test against end-of-life distributions (EoL). -Thus, we do not recommend that you use Node.js on end-of-life or unsupported -platforms in production. +For production applications, run Node.js on supported platforms only. | System | Support type | Version | Architectures | Notes | |--------------|--------------|----------------------------------|----------------------|------------------| @@ -134,21 +133,20 @@ OpenSSL-1.1.0 requires the following assembler version for use of asm support on x86_64 and ia32. * gas (GNU assembler) version 2.23 or higher -* xcode version 5.0 or higher +* Xcode version 5.0 or higher * llvm version 3.3 or higher * nasm version 2.10 or higher in Windows -Otherwise `configure` will fail with an error. This can be avoided by -either providing a newer assembler as per the list above or by -using the `--openssl-no-asm` flag. +If compiling without one of the above, use `configure` with the +`--openssl-no-asm` flag. Otherwise, `configure` will fail. The forthcoming OpenSSL-1.1.1 will have different requirements. Please refer to https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html for details. ## Building Node.js on supported platforms -*Note:* All prerequisites can be easily installed by following -[this bootstrapping guide](https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md). +The [bootstrapping guide](https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md) +explains how to install all prerequisites. ### Unix/macOS @@ -159,7 +157,7 @@ The forthcoming OpenSSL-1.1.1 will have different requirements. Please refer to * Python 2.6 or 2.7 * GNU Make 3.81 or newer -On macOS, you will need to install the `Xcode Command Line Tools` by running +On macOS, install the `Xcode Command Line Tools` by running `xcode-select --install`. Alternatively, if you already have the full Xcode installed, you can find them under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`. This step will install `clang`, `clang++`, and @@ -180,13 +178,9 @@ $ ./configure $ make -j4 ``` -Running `make` with the `-j4` flag will cause it to run 4 compilation jobs -concurrently which may significantly reduce build time. The number after `-j` -can be changed to best suit the number of processor cores on your machine. If -you run into problems running `make` with concurrency, try running it without -the `-j4` flag. See the -[GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html) -for more information. +The `-j4` option will cause `make` to run 4 simultaneous compilation jobs which +may reduce build time. For more information, see the +[GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html). Note that the above requires that `python` resolve to Python 2.6 or 2.7 and not a newer version. From 4b9518dba3a8e8476e7ab2c70d4563201cd6108a Mon Sep 17 00:00:00 2001 From: Marcus Scott Date: Tue, 16 Oct 2018 14:16:17 +0000 Subject: [PATCH 056/223] test: move test-fs-watch-system-limit from sequential to pummel PR-URL: https://github.com/nodejs/node/pull/23692 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/{sequential => pummel}/test-fs-watch-system-limit.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{sequential => pummel}/test-fs-watch-system-limit.js (100%) diff --git a/test/sequential/test-fs-watch-system-limit.js b/test/pummel/test-fs-watch-system-limit.js similarity index 100% rename from test/sequential/test-fs-watch-system-limit.js rename to test/pummel/test-fs-watch-system-limit.js From 3966b698f6691e8dca7b2b868d03ecd6d403780a Mon Sep 17 00:00:00 2001 From: Paul Isache Date: Tue, 6 Nov 2018 15:57:45 +0000 Subject: [PATCH 057/223] lib: combine contructor, tag, Object into a function combine these parts into a function to be used in multiple parts PR-URL: https://github.com/nodejs/node/pull/24171 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- lib/internal/util/inspect.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 6cec84355211d4..094240c694ea53 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -362,6 +362,10 @@ function getKeys(value, showHidden) { return keys; } +function getCtxStyle(constructor, tag) { + return constructor || tag || 'Object'; +} + function formatProxy(ctx, proxy, recurseTimes) { if (recurseTimes != null) { if (recurseTimes < 0) @@ -708,7 +712,7 @@ function formatRaw(ctx, value, recurseTimes) { if (recurseTimes != null) { if (recurseTimes < 0) - return ctx.stylize(`[${constructor || tag || 'Object'}]`, 'special'); + return ctx.stylize(`[${getCtxStyle(constructor, tag)}]`, 'special'); recurseTimes -= 1; } @@ -746,7 +750,7 @@ function handleMaxCallStackSize(ctx, err, constructor, tag, indentationLvl) { ctx.seen.pop(); ctx.indentationLvl = indentationLvl; return ctx.stylize( - `[${constructor || tag || 'Object'}: Inspection interrupted ` + + `[${getCtxStyle(constructor, tag)}: Inspection interrupted ` + 'prematurely. Maximum call stack size exceeded.]', 'special' ); From 5dfc1bb46c0983aa8b10bc1d380d852ae7aff92c Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Tue, 23 Oct 2018 16:51:42 -0400 Subject: [PATCH 058/223] build,tools: update make-v8.sh for s390x PR-URL: https://github.com/nodejs/node/pull/23839 Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- tools/make-v8.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/make-v8.sh b/tools/make-v8.sh index 4365412856d741..1bbf472aae7df2 100755 --- a/tools/make-v8.sh +++ b/tools/make-v8.sh @@ -1,9 +1,27 @@ -#!/bin/bash +#!/bin/bash -xe BUILD_ARCH_TYPE=$1 V8_BUILD_OPTIONS=$2 cd deps/v8 tools/node/fetch_deps.py . -PATH=~/_depot_tools:$PATH tools/dev/v8gen.py $BUILD_ARCH_TYPE --no-goma $V8_BUILD_OPTIONS -PATH=~/_depot_tools:$PATH ninja -C out.gn/$BUILD_ARCH_TYPE/ d8 cctest inspector-test + +if [ "`arch`" == "s390x" ] +then + # set paths manually for now to use locally installed gn + export BUILD_TOOLS=/home/iojs/build-tools + export LD_LIBRARY_PATH=$BUILD_TOOLS:$LD_LIBRARY_PATH + export PATH=$BUILD_TOOLS:$PATH + CXX_PATH=`which $CXX |grep g++` + rm -f "$BUILD_TOOLS/g++" + rm -f "$BUILD_TOOLS/gcc" + ln -s $CXX_PATH "$BUILD_TOOLS/g++" + ln -s $CXX_PATH "$BUILD_TOOLS/gcc" + g++ --version + export PKG_CONFIG_PATH=$BUILD_TOOLS/pkg-config + gn gen -v out.gn/$BUILD_ARCH_TYPE --args='is_component_build=false is_debug=false use_goma=false goma_dir="None" use_custom_libcxx=false v8_target_cpu="s390x" target_cpu="s390x"' + ninja -v -C out.gn/$BUILD_ARCH_TYPE d8 cctest inspector-test +else + PATH=~/_depot_tools:$PATH tools/dev/v8gen.py $BUILD_ARCH_TYPE --no-goma $V8_BUILD_OPTIONS + PATH=~/_depot_tools:$PATH ninja -C out.gn/$BUILD_ARCH_TYPE/ d8 cctest inspector-test +fi From d8ac55a0125597d60a1207d6e1873dad9221966b Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 5 Nov 2018 14:20:53 +0100 Subject: [PATCH 059/223] test: use NULL instead of 0 in common.h This commit updates the macros in test/addons-napi/common.h to use NULL instead of 0. This is very minor, but I had to look twice while going through the code and finding what the macro was doing and comparing with the struct definition. Using NULL makes it a little clearer I think. PR-URL: https://github.com/nodejs/node/pull/24104 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/addons-napi/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/addons-napi/common.h b/test/addons-napi/common.h index 422418ced49a39..b16f944771c1df 100644 --- a/test/addons-napi/common.h +++ b/test/addons-napi/common.h @@ -54,7 +54,7 @@ NAPI_CALL_BASE(env, the_call, NAPI_RETVAL_NOTHING) #define DECLARE_NAPI_PROPERTY(name, func) \ - { (name), 0, (func), 0, 0, 0, napi_default, 0 } + { (name), NULL, (func), NULL, NULL, NULL, napi_default, NULL } #define DECLARE_NAPI_GETTER(name, func) \ - { (name), 0, 0, (func), 0, 0, napi_default, 0 } + { (name), NULL, NULL, (func), NULL, NULL, napi_default, NULL } From 10a27277ad272c5a5cdfddd786251ffaa8e02295 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 4 Nov 2018 12:28:27 +0100 Subject: [PATCH 060/223] net: simplify Socket.prototype._final Remove conditions that should be irrelevant since we started using `_final`, as well as an extra `defaultTriggerAsyncIdScope()` call which is unnecessary because there is an equivalent scope already present on the native side. PR-URL: https://github.com/nodejs/node/pull/24075 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- lib/net.js | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/lib/net.js b/lib/net.js index 48a8bc069901e2..643137b70d0641 100644 --- a/lib/net.js +++ b/lib/net.js @@ -335,14 +335,6 @@ Socket.prototype._unrefTimer = function _unrefTimer() { }; -function shutdownSocket(self, callback) { - var req = new ShutdownWrap(); - req.oncomplete = afterShutdown; - req.handle = self._handle; - req.callback = callback; - return self._handle.shutdown(req); -} - // the user has called .end(), and all the bytes have been // sent out to the other side. Socket.prototype._final = function(cb) { @@ -352,23 +344,16 @@ Socket.prototype._final = function(cb) { return this.once('connect', () => this._final(cb)); } - if (!this.readable || this._readableState.ended) { - debug('_final: ended, destroy', this._readableState); - cb(); - return this.destroy(); - } + if (!this._handle) + return cb(); debug('_final: not ended, call shutdown()'); - // otherwise, just shutdown, or destroy() if not possible - if (!this._handle || !this._handle.shutdown) { - cb(); - return this.destroy(); - } - - var err = defaultTriggerAsyncIdScope( - this[async_id_symbol], shutdownSocket, this, cb - ); + var req = new ShutdownWrap(); + req.oncomplete = afterShutdown; + req.handle = this._handle; + req.callback = cb; + var err = this._handle.shutdown(req); if (err) return this.destroy(errnoException(err, 'shutdown')); @@ -387,7 +372,7 @@ function afterShutdown(status, handle) { if (self.destroyed) return; - if (self._readableState.ended) { + if (!self.readable || self._readableState.ended) { debug('readableState ended, destroying'); self.destroy(); } From 704b68aee466cbf712109381d5e2dfa2c29db851 Mon Sep 17 00:00:00 2001 From: Berry de Witte Date: Tue, 6 Nov 2018 15:14:12 +0000 Subject: [PATCH 061/223] test: increase coverage internal readline PR-URL: https://github.com/nodejs/node/pull/24150 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- test/parallel/test-readline-keys.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index c5b3cbf44cd496..b1c88e2acee157 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -99,11 +99,12 @@ addTest('\n\r\t', [ ]); // space and backspace -addTest('\b\x7f\x1b\b\x1b\x7f \x1b ', [ +addTest('\b\x7f\x1b\b\x1b\x7f\x1b\x1b \x1b ', [ { name: 'backspace', sequence: '\b' }, { name: 'backspace', sequence: '\x7f' }, { name: 'backspace', sequence: '\x1b\b', meta: true }, { name: 'backspace', sequence: '\x1b\x7f', meta: true }, + { name: 'space', sequence: '\x1b\x1b ', meta: true }, { name: 'space', sequence: ' ' }, { name: 'space', sequence: '\x1b ', meta: true }, ]); From 897114bf94cc80ef2e55daaa306f38f2fbb81020 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 10 Nov 2018 20:59:50 +0100 Subject: [PATCH 062/223] net: partially revert "simplify Socket.prototype._final" Partially revert b7e6ccd0cc60f20cc397e6ac0705bb3f38c7d225 because it broke a test that was added since its last CI run. Refs: https://github.com/nodejs/node/pull/24075 Refs: https://github.com/nodejs/node/pull/23866 PR-URL: https://github.com/nodejs/node/pull/24288 Reviewed-By: Colin Ihrig Reviewed-By: Ujjwal Sharma --- lib/net.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/net.js b/lib/net.js index 643137b70d0641..35bfd33eaaf473 100644 --- a/lib/net.js +++ b/lib/net.js @@ -344,6 +344,12 @@ Socket.prototype._final = function(cb) { return this.once('connect', () => this._final(cb)); } + // TODO(addaleax): This should not be necessary. + if (!this.readable || this._readableState.ended) { + cb(); + return this.destroy(); + } + if (!this._handle) return cb(); From 6ce4ef3387faa42a884fbd31ffd13e8ae49b4972 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 3 Nov 2018 17:48:47 +0100 Subject: [PATCH 063/223] stream: make `.destroy()` interact better with write queue Make sure that it is safe to call the callback for `_write()` even in the presence of `.destroy()` calls during that write. In particular, letting the write queue continue processing would previously have thrown an exception, because processing writes after calling `.destroy()` is forbidden. One test had to be modified to account for the fact that callbacks for writes will now always be called, even when the stream is destroyed during the process. PR-URL: https://github.com/nodejs/node/pull/24062 Reviewed-By: Matteo Collina Reviewed-By: James M Snell --- lib/_stream_writable.js | 2 +- test/parallel/test-stream-write-destroy.js | 59 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-stream-write-destroy.js diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 3bad957912b323..ed354126f7d812 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -456,7 +456,7 @@ function onwrite(stream, er) { onwriteError(stream, state, sync, er, cb); else { // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); + var finished = needFinish(state) || stream.destroyed; if (!finished && !state.corked && diff --git a/test/parallel/test-stream-write-destroy.js b/test/parallel/test-stream-write-destroy.js new file mode 100644 index 00000000000000..83b329a6a8a7b3 --- /dev/null +++ b/test/parallel/test-stream-write-destroy.js @@ -0,0 +1,59 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { Writable } = require('stream'); + +// Test interaction between calling .destroy() on a writable and pending +// writes. + +for (const withPendingData of [ false, true ]) { + for (const useEnd of [ false, true ]) { + const callbacks = []; + + const w = new Writable({ + write(data, enc, cb) { + callbacks.push(cb); + }, + // Effectively disable the HWM to observe 'drain' events more easily. + highWaterMark: 1 + }); + + let chunksWritten = 0; + let drains = 0; + let finished = false; + w.on('drain', () => drains++); + w.on('finish', () => finished = true); + + w.write('abc', () => chunksWritten++); + assert.strictEqual(chunksWritten, 0); + assert.strictEqual(drains, 0); + callbacks.shift()(); + assert.strictEqual(chunksWritten, 1); + assert.strictEqual(drains, 1); + + if (withPendingData) { + // Test 2 cases: There either is or is not data still in the write queue. + // (The second write will never actually get executed either way.) + w.write('def', () => chunksWritten++); + } + if (useEnd) { + // Again, test 2 cases: Either we indicate that we want to end the + // writable or not. + w.end('ghi', () => chunksWritten++); + } else { + w.write('ghi', () => chunksWritten++); + } + + assert.strictEqual(chunksWritten, 1); + w.destroy(); + assert.strictEqual(chunksWritten, 1); + callbacks.shift()(); + assert.strictEqual(chunksWritten, 2); + assert.strictEqual(callbacks.length, 0); + assert.strictEqual(drains, 1); + + // When we used `.end()`, we see the 'finished' event if and only if + // we actually finished processing the write queue. + assert.strictEqual(finished, !withPendingData && useEnd); + } +} From a6f786dee99d03c6c064e0551b0a88fd7e5efd74 Mon Sep 17 00:00:00 2001 From: saurabhSiddhu Date: Sun, 4 Nov 2018 18:10:56 +0530 Subject: [PATCH 064/223] test: replacing fixture directory with temp PR-URL: https://github.com/nodejs/node/pull/24077 Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/parallel/test-fs-error-messages.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index e0c8e4b584f5b5..5e7c1ec1a4553a 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -25,15 +25,22 @@ const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const fs = require('fs'); +const path = require('path'); tmpdir.refresh(); -const nonexistentFile = fixtures.path('non-existent'); -const nonexistentDir = fixtures.path('non-existent', 'foo', 'bar'); -const existingFile = fixtures.path('exit.js'); -const existingFile2 = fixtures.path('a.js'); -const existingDir = tmpdir.path; + +const nonexistentFile = path.join(tmpdir.path, 'non-existent'); +const nonexistentDir = path.join(tmpdir.path, 'non-existent', 'foo', 'bar'); +const existingFile = path.join(tmpdir.path, 'existingFile.js'); +const existingFile2 = path.join(tmpdir.path, 'existingFile2.js'); +const existingDir = path.join(tmpdir.path, 'dir'); const existingDir2 = fixtures.path('keys'); +fs.mkdirSync(existingDir); +fs.writeFileSync(existingFile, 'test', 'utf-8'); +fs.writeFileSync(existingFile2, 'test', 'utf-8'); + + const { COPYFILE_EXCL } = fs.constants; const uv = process.binding('uv'); From 4e21eb40043ffbe57d62808a1b063ffb28a4ede0 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 8 Nov 2018 13:27:39 -0500 Subject: [PATCH 065/223] build: lint commit message in separate Travis job Move the first commit message linting to a separate Travis job. Run the script in bash debug mode to capture any issues communicating with the GitHub API (e.g. network issues, rate limits). PR-URL: https://github.com/nodejs/node/pull/24254 Reviewed-By: Rich Trott Reviewed-By: Refael Ackermann Reviewed-By: Matheus Marchini --- .travis.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80c729a772fed5..e496919579b2f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,14 @@ cache: ccache os: linux matrix: include: + - name: "First commit message adheres to guidelines at https://goo.gl/p2fr5Q" + if: type = pull_request + language: node_js + node_js: "node" + script: + - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST}; + fi - name: "Linter" language: node_js node_js: "node" @@ -11,10 +19,6 @@ matrix: - NODE=$(which node) script: - make lint - # Lint the first commit in the PR. - - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then - bash tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST} || true; - fi - name: "Test Suite" addons: apt: From 1ec6923276728b02b1bf706257d62dd61278e772 Mon Sep 17 00:00:00 2001 From: Marie Terrier Date: Tue, 6 Nov 2018 17:37:47 +0100 Subject: [PATCH 066/223] test : compare objects not identical by reference PR-URL: https://github.com/nodejs/node/pull/24189 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca --- test/parallel/test-assert-deep.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index af1003fd51eebe..45f4353ce6c577 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -947,6 +947,27 @@ assert.throws(() => assert.deepStrictEqual(new Boolean(true), {}), ); } +// Strict equal with identical objects that are not identical +// by reference and longer than 30 elements +// E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() }) +{ + const a = {}; + const b = {}; + for (let i = 0; i < 35; i++) { + a[`symbol${i}`] = Symbol(); + b[`symbol${i}`] = Symbol(); + } + + assert.throws( + () => assert.deepStrictEqual(a, b), + { + code: 'ERR_ASSERTION', + name: 'AssertionError [ERR_ASSERTION]', + message: /\.\.\./g + } + ); +} + // Basic valueOf check. { const a = new String(1); From 3bb63721e397348b34118779f8b65eef69f3b9bc Mon Sep 17 00:00:00 2001 From: John Mc Quillan Date: Tue, 6 Nov 2018 16:12:21 +0000 Subject: [PATCH 067/223] test: fix assert.strictEqual argument order The arguments to assert.strictEqual in a number of calls were in the wrong order. It is preferred that literal values are in the second argument. Updates test/parallel/test-fs-readStream.js PR-URL: https://github.com/nodejs/node/pull/24172 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-fs-read-stream.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-fs-read-stream.js b/test/parallel/test-fs-read-stream.js index 870edf2820e87b..db9cf9a72fdadf 100644 --- a/test/parallel/test-fs-read-stream.js +++ b/test/parallel/test-fs-read-stream.js @@ -42,7 +42,7 @@ const rangeFile = fixtures.path('x.txt'); file.on('open', common.mustCall(function(fd) { file.length = 0; - assert.strictEqual('number', typeof fd); + assert.strictEqual(typeof fd, 'number'); assert.strictEqual(file.bytesRead, 0); assert.ok(file.readable); @@ -91,12 +91,12 @@ const rangeFile = fixtures.path('x.txt'); const file = fs.createReadStream(fn, { encoding: 'utf8' }); file.length = 0; file.on('data', function(data) { - assert.strictEqual('string', typeof data); + assert.strictEqual(typeof data, 'string'); file.length += data.length; for (let i = 0; i < data.length; i++) { // http://www.fileformat.info/info/unicode/char/2026/index.htm - assert.strictEqual('\u2026', data[i]); + assert.strictEqual(data[i], '\u2026'); } }); @@ -162,7 +162,7 @@ common.expectsError( }); stream.on('end', common.mustCall(function() { - assert.strictEqual('x', stream.data); + assert.strictEqual(stream.data, 'x'); })); } @@ -176,7 +176,7 @@ common.expectsError( }); stream.on('end', common.mustCall(function() { - assert.strictEqual('xy', stream.data); + assert.strictEqual(stream.data, 'xy'); })); } @@ -197,7 +197,7 @@ if (!common.isWindows) { }); stream.on('end', common.mustCall(function() { - assert.strictEqual('xy', stream.data); + assert.strictEqual(stream.data, 'xy'); fs.unlinkSync(filename); })); } else { From 23592738688b7ec9cc5cbef36e766d5d34240c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulises=20Santana=20Su=C3=A1rez?= Date: Tue, 6 Nov 2018 16:38:36 +0000 Subject: [PATCH 068/223] test: fix arguments order in assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/24192 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- test/parallel/test-http-1.0.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-http-1.0.js b/test/parallel/test-http-1.0.js index 47df50e2897b79..134a5bb9853102 100644 --- a/test/parallel/test-http-1.0.js +++ b/test/parallel/test-http-1.0.js @@ -58,9 +58,9 @@ function test(handler, request_generator, response_validator) { { function handler(req, res) { - assert.strictEqual('1.0', req.httpVersion); - assert.strictEqual(1, req.httpVersionMajor); - assert.strictEqual(0, req.httpVersionMinor); + assert.strictEqual(req.httpVersion, '1.0'); + assert.strictEqual(req.httpVersionMajor, 1); + assert.strictEqual(req.httpVersionMinor, 0); res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(body); } @@ -72,8 +72,8 @@ function test(handler, request_generator, response_validator) { function response_validator(server_response, client_got_eof, timed_out) { const m = server_response.split('\r\n\r\n'); assert.strictEqual(m[1], body); - assert.strictEqual(true, client_got_eof); - assert.strictEqual(false, timed_out); + assert.strictEqual(client_got_eof, true); + assert.strictEqual(timed_out, false); } test(handler, request_generator, response_validator); @@ -86,9 +86,9 @@ function test(handler, request_generator, response_validator) { // { function handler(req, res) { - assert.strictEqual('1.0', req.httpVersion); - assert.strictEqual(1, req.httpVersionMajor); - assert.strictEqual(0, req.httpVersionMinor); + assert.strictEqual(req.httpVersion, '1.0'); + assert.strictEqual(req.httpVersionMajor, 1); + assert.strictEqual(req.httpVersionMinor, 0); res.sendDate = false; res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('Hello, '); res._send(''); @@ -112,9 +112,9 @@ function test(handler, request_generator, response_validator) { '\r\n' + 'Hello, world!'; - assert.strictEqual(expected_response, server_response); - assert.strictEqual(true, client_got_eof); - assert.strictEqual(false, timed_out); + assert.strictEqual(server_response, expected_response); + assert.strictEqual(client_got_eof, true); + assert.strictEqual(timed_out, false); } test(handler, request_generator, response_validator); @@ -122,9 +122,9 @@ function test(handler, request_generator, response_validator) { { function handler(req, res) { - assert.strictEqual('1.1', req.httpVersion); - assert.strictEqual(1, req.httpVersionMajor); - assert.strictEqual(1, req.httpVersionMinor); + assert.strictEqual(req.httpVersion, '1.1'); + assert.strictEqual(req.httpVersionMajor, 1); + assert.strictEqual(req.httpVersionMinor, 1); res.sendDate = false; res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('Hello, '); res._send(''); @@ -155,9 +155,9 @@ function test(handler, request_generator, response_validator) { '0\r\n' + '\r\n'; - assert.strictEqual(expected_response, server_response); - assert.strictEqual(true, client_got_eof); - assert.strictEqual(false, timed_out); + assert.strictEqual(server_response, expected_response); + assert.strictEqual(client_got_eof, true); + assert.strictEqual(timed_out, false); } test(handler, request_generator, response_validator); From c8d2635ed1e57338bacb827f59cd8d66e1e53c25 Mon Sep 17 00:00:00 2001 From: Ouyang Yadong Date: Sun, 11 Nov 2018 16:59:41 +0800 Subject: [PATCH 069/223] doc: add oyyd to collaborators PR-URL: https://github.com/nodejs/node/pull/24300 Fixes: https://github.com/nodejs/node/issues/23955 Reviewed-By: Gireesh Punathil Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 79b12e289a58f4..533b36bf8dbd58 100644 --- a/README.md +++ b/README.md @@ -401,6 +401,8 @@ For information about the governance of the Node.js project, see **Alexis Campailla** <orangemocha@nodejs.org> * [othiym23](https://github.com/othiym23) - **Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him) +* [oyyd](https://github.com/oyyd) - +**Ouyang Yadong** <oyydoibh@gmail.com> (he/him) * [pmq20](https://github.com/pmq20) - **Minqi Pan** <pmq2001@gmail.com> * [princejwesley](https://github.com/princejwesley) - From dd67f39ae23ef5703ccd5e421799a703794374e0 Mon Sep 17 00:00:00 2001 From: Yehiyam Livneh Date: Tue, 6 Nov 2018 17:41:19 +0200 Subject: [PATCH 070/223] test: add test for deepEqual Float32Array PR-URL: https://github.com/nodejs/node/pull/24164 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- test/parallel/test-assert-typedarray-deepequal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-assert-typedarray-deepequal.js b/test/parallel/test-assert-typedarray-deepequal.js index b648f07d3297f6..65b94f6c24b028 100644 --- a/test/parallel/test-assert-typedarray-deepequal.js +++ b/test/parallel/test-assert-typedarray-deepequal.js @@ -44,6 +44,7 @@ const notEqualArrayPairs = [ [new Int16Array([-256]), new Uint16Array([0xff00])], // same bits [new Int32Array([-256]), new Uint32Array([0xffffff00])], // ditto [new Float32Array([0.1]), new Float32Array([0.0])], + [new Float32Array([0.1]), new Float32Array([0.1, 0.2])], [new Float64Array([0.1]), new Float64Array([0.0])] ]; From 63dc2214f9312bf42d2b89baf81b7603814ed5dd Mon Sep 17 00:00:00 2001 From: Aivo Paas Date: Tue, 6 Nov 2018 15:52:09 +0000 Subject: [PATCH 071/223] test: add test case for completion bash flag This test case verifies that starting Node.js with the completion bash flag prints out the expected result and ends right after. PR-URL: https://github.com/nodejs/node/pull/24168 Reviewed-By: Bryan English Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- test/parallel/test-bash-completion.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/parallel/test-bash-completion.js diff --git a/test/parallel/test-bash-completion.js b/test/parallel/test-bash-completion.js new file mode 100644 index 00000000000000..50378a7b0f8028 --- /dev/null +++ b/test/parallel/test-bash-completion.js @@ -0,0 +1,23 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const child_process = require('child_process'); + +const p = child_process.spawnSync( + process.execPath, [ '--completion-bash' ]); +assert.ifError(p.error); +assert.ok(p.stdout.toString().includes( + `_node_complete() { + local cur_word options + cur_word="\${COMP_WORDS[COMP_CWORD]}" + if [[ "\${cur_word}" == -* ]] ; then + COMPREPLY=( $(compgen -W '`)); +assert.ok(p.stdout.toString().includes( + `' -- "\${cur_word}") ) + return 0 + else + COMPREPLY=( $(compgen -f "\${cur_word}") ) + return 0 + fi +} +complete -F _node_complete node node_g`)); From 0260db525a3279d2e91324c88c31a6aeefbee0f7 Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich Date: Fri, 2 Nov 2018 23:58:37 +0100 Subject: [PATCH 072/223] doc: correct async_hooks sample outputs Correct the output of async_hooks samples * `TIMERWRAP` has been removed in #20894 * `console.log()` doesn't issue `TTYWRAP` nor `SIGNALWRAP` I don't know which PR caused that `console.log()` is no longer using `TTYWRAP` and `SIGNALWRAP`; I think it was between 8.4.0 and 8.5.0. PR-URL: https://github.com/nodejs/node/pull/24050 Refs: https://github.com/nodejs/node/pull/20894 Reviewed-By: James M Snell --- doc/api/async_hooks.md | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 751bb124cd0a25..c05cb9ce1251ab 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -276,8 +276,8 @@ require('net').createServer((conn) => {}).listen(8080); Output when hitting the server with `nc localhost 8080`: ```console -TCPSERVERWRAP(2): trigger: 1 execution: 1 -TCPWRAP(4): trigger: 2 execution: 0 +TCPSERVERWRAP(5): trigger: 1 execution: 1 +TCPWRAP(7): trigger: 5 execution: 0 ``` The `TCPSERVERWRAP` is the server which receives the connections. @@ -355,27 +355,18 @@ require('net').createServer(() => {}).listen(8080, () => { Output from only starting the server: ```console -TCPSERVERWRAP(2): trigger: 1 execution: 1 -TickObject(3): trigger: 2 execution: 1 -before: 3 - Timeout(4): trigger: 3 execution: 3 - TIMERWRAP(5): trigger: 3 execution: 3 -after: 3 -destroy: 3 -before: 5 - before: 4 - TTYWRAP(6): trigger: 4 execution: 4 - SIGNALWRAP(7): trigger: 4 execution: 4 - TTYWRAP(8): trigger: 4 execution: 4 ->>> 4 - TickObject(9): trigger: 4 execution: 4 - after: 4 -after: 5 -before: 9 -after: 9 -destroy: 4 -destroy: 9 -destroy: 5 +TCPSERVERWRAP(5): trigger: 1 execution: 1 +TickObject(6): trigger: 5 execution: 1 +before: 6 + Timeout(7): trigger: 6 execution: 6 +after: 6 +destroy: 6 +before: 7 +>>> 7 + TickObject(8): trigger: 7 execution: 7 +after: 7 +before: 8 +after: 8 ``` As illustrated in the example, `executionAsyncId()` and `execution` each specify @@ -385,7 +376,7 @@ the value of the current execution context; which is delineated by calls to Only using `execution` to graph resource allocation results in the following: ```console -TTYWRAP(6) -> Timeout(4) -> TIMERWRAP(5) -> TickObject(3) -> root(1) +Timeout(7) -> TickObject(6) -> root(1) ``` The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for From 704d886000800e93fea9d0d1f29da68fbcceb3d1 Mon Sep 17 00:00:00 2001 From: Natalie Cluer Date: Tue, 6 Nov 2018 15:15:40 +0000 Subject: [PATCH 073/223] test: correct order of args in assert.strictEqual() Ensure literal values are passed in as second argument PR-URL: https://github.com/nodejs/node/pull/24157 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell --- test/parallel/test-buffer-fill.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index 4eef0edefcbb22..2544a73819ce17 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -302,19 +302,19 @@ Buffer.alloc(8, ''); buf.fill(0); for (let i = 0; i < buf.length; i++) - assert.strictEqual(0, buf[i]); + assert.strictEqual(buf[i], 0); buf.fill(null); for (let i = 0; i < buf.length; i++) - assert.strictEqual(0, buf[i]); + assert.strictEqual(buf[i], 0); buf.fill(1, 16, 32); for (let i = 0; i < 16; i++) - assert.strictEqual(0, buf[i]); + assert.strictEqual(buf[i], 0); for (let i = 16; i < 32; i++) - assert.strictEqual(1, buf[i]); + assert.strictEqual(buf[i], 1); for (let i = 32; i < buf.length; i++) - assert.strictEqual(0, buf[i]); + assert.strictEqual(buf[i], 0); } { From cf209171c94169a149007964e365af4cbf490e91 Mon Sep 17 00:00:00 2001 From: Dmitry Igrishin Date: Sun, 11 Nov 2018 13:55:43 +0300 Subject: [PATCH 074/223] doc: add links to Stream section PR-URL: https://github.com/nodejs/node/pull/24301 Reviewed-By: Vse Mozhet Byt Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- doc/api/http.md | 1 + doc/api/http2.md | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/api/http.md b/doc/api/http.md index c350e3458bee43..b7f66aef23e9e2 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -2138,3 +2138,4 @@ not abort the request or do anything besides add a `'timeout'` event. [`socket.unref()`]: net.html#net_socket_unref [`url.parse()`]: url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost [Readable Stream]: stream.html#stream_class_stream_readable +[Stream]: stream.html#stream_stream diff --git a/doc/api/http2.md b/doc/api/http2.md index f3314695cfcc02..8418c31a58ac75 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -3393,6 +3393,7 @@ following additional properties: [HTTPS]: https.html [Performance Observer]: perf_hooks.html [Readable Stream]: stream.html#stream_class_stream_readable +[Stream]: stream.html#stream_stream [RFC 7838]: https://tools.ietf.org/html/rfc7838 [RFC 8336]: https://tools.ietf.org/html/rfc8336 [RFC 8441]: https://tools.ietf.org/html/rfc8441 From 07b9a663e018d58d8a01c50ba56b19273d60c047 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 6 Nov 2018 16:52:42 +0000 Subject: [PATCH 075/223] console: cover .assert with single argument PR-URL: https://github.com/nodejs/node/pull/24188 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- test/parallel/test-console.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index a97e4cf33f8603..0898e964069204 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -168,6 +168,8 @@ assert.strictEqual(errStrings[errStrings.length - 1], console.assert(true, 'this should not throw'); +console.assert(true); + assert.strictEqual(strings.length, process.stdout.writeTimes); assert.strictEqual(errStrings.length, process.stderr.writeTimes); restoreStdout(); From b4c1d8273cd9ac0ca3eadef3ca845bbe3a2f6571 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Thu, 8 Nov 2018 11:45:33 +1100 Subject: [PATCH 076/223] doc: update fs.open() changes record for optional 'flags' Was missed on original PR. Ref: https://github.com/nodejs/node/pull/23767 PR-URL: https://github.com/nodejs/node/pull/24240 Refs: https://github.com/nodejs/node/pull/23767 Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/fs.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 21f1b91db6e15e..a062ba6db52250 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2308,6 +2308,9 @@ object with an `encoding` property specifying the character encoding to use. * `path` {string|Buffer|URL} * `flags` {string|number} See [support of file system `flags`][]. + **Default:** `'r'`. * `mode` {integer} **Default:** `0o666` (readable and writable) * Returns: {Promise} From 09bb49165f6e1b5e4288401c4b439389a65775b6 Mon Sep 17 00:00:00 2001 From: Martin Kask Date: Tue, 6 Nov 2018 16:59:38 +0200 Subject: [PATCH 077/223] test: fix strictEqual argument order Fix the order of assert.strictEqual() arguments. It should have first argument as the calculated/tested value. PR-URL: https://github.com/nodejs/node/pull/24153 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell --- test/parallel/test-buffer-slice.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-buffer-slice.js b/test/parallel/test-buffer-slice.js index 6175370a9bccee..f40a495b206079 100644 --- a/test/parallel/test-buffer-slice.js +++ b/test/parallel/test-buffer-slice.js @@ -24,8 +24,8 @@ require('../common'); const assert = require('assert'); -assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length); -assert.strictEqual(0, Buffer('hello', 'utf8').slice(0, 0).length); +assert.strictEqual(Buffer.from('hello', 'utf8').slice(0, 0).length, 0); +assert.strictEqual(Buffer('hello', 'utf8').slice(0, 0).length, 0); const buf = Buffer.from('0123456789', 'utf8'); const expectedSameBufs = [ @@ -72,7 +72,7 @@ for (let i = 0, s = buf.toString(); i < buf.length; ++i) { } expectedSameBufs.forEach(([buf1, buf2]) => { - assert.strictEqual(0, Buffer.compare(buf1, buf2)); + assert.strictEqual(Buffer.compare(buf1, buf2), 0); }); const utf16Buf = Buffer.from('0123456789', 'utf16le'); @@ -83,12 +83,12 @@ assert.strictEqual(Buffer.alloc(0).slice(0, 1).length, 0); { // Single argument slice - assert.strictEqual('bcde', - Buffer.from('abcde', 'utf8').slice(1).toString('utf8')); + assert.strictEqual(Buffer.from('abcde', 'utf8').slice(1).toString('utf8'), + 'bcde'); } // slice(0,0).length === 0 -assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length); +assert.strictEqual(Buffer.from('hello', 'utf8').slice(0, 0).length, 0); { // Regression tests for https://github.com/nodejs/node/issues/9096 From d2cc9d72b6b695a5cdf34440ab996467c4d6e474 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 27 Nov 2018 12:18:10 -0800 Subject: [PATCH 078/223] doc: sort bottom-of-file markdown links Reapply #12726 It would be nice to have the sort check applied as part of doc testing, but this change doesn't implement that. Backport-PR-URL: https://github.com/nodejs/node/pull/24681 PR-URL: https://github.com/nodejs/node/pull/24679 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca --- doc/api/assert.md | 4 ++-- doc/api/async_hooks.md | 2 +- doc/api/buffer.md | 2 +- doc/api/child_process.md | 14 +++++++------- doc/api/crypto.md | 4 ++-- doc/api/deprecations.md | 12 ++++++------ doc/api/dgram.md | 4 ++-- doc/api/documentation.md | 2 +- doc/api/errors.md | 19 ++++++++++--------- doc/api/fs.md | 12 ++++++------ doc/api/globals.md | 4 ++-- doc/api/http.md | 2 +- doc/api/http2.md | 14 +++++++------- doc/api/https.md | 2 +- doc/api/inspector.md | 2 +- doc/api/intl.md | 8 ++++---- doc/api/modules.md | 4 ++-- doc/api/n-api.md | 32 +++++++++++++++----------------- doc/api/net.md | 2 +- doc/api/process.md | 12 ++++++------ doc/api/stream.md | 22 +++++++++++----------- doc/api/tty.md | 2 +- doc/api/util.md | 26 +++++++++++++------------- doc/api/v8.md | 4 ++-- doc/api/vm.md | 2 +- doc/api/worker_threads.md | 34 +++++++++++++++++----------------- doc/api/zlib.md | 4 ++-- 27 files changed, 125 insertions(+), 126 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 50519b831c9a2c..ab664d94d88a65 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -1233,8 +1233,8 @@ assert.throws(throwingFirst, /Second$/); Due to the confusing notation, it is recommended not to use a string as the second argument. This might lead to difficult-to-spot errors. -[`ERR_INVALID_RETURN_VALUE`]: errors.html#errors_err_invalid_return_value [`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes +[`ERR_INVALID_RETURN_VALUE`]: errors.html#errors_err_invalid_return_value [`Error.captureStackTrace`]: errors.html#errors_error_capturestacktrace_targetobject_constructoropt [`Error`]: errors.html#errors_class_error [`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map @@ -1255,10 +1255,10 @@ second argument. This might lead to difficult-to-spot errors. [`assert.throws()`]: #assert_assert_throws_fn_error_message [`strict mode`]: #assert_strict_mode [Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison +[Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript [Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring [SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue [Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison [enumerable "own" properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties [mdn-equality-guide]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness [prototype-spec]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots -[Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index c05cb9ce1251ab..0be5ef7bf56082 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -711,6 +711,7 @@ never be called. * Returns: {number} The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. +[`Worker`]: worker_threads.html#worker_threads_class_worker [`after` callback]: #async_hooks_after_asyncid [`asyncResource.runInAsyncScope()`]: #async_hooks_asyncresource_runinasyncscope_fn_thisarg_args [`before` callback]: #async_hooks_before_asyncid @@ -719,4 +720,3 @@ never be called. [Hook Callbacks]: #async_hooks_hook_callbacks [PromiseHooks]: https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit [promise execution tracking]: #async_hooks_promise_execution_tracking -[`Worker`]: worker_threads.html#worker_threads_class_worker diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 897512ae000805..97fc170c02c9c6 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -2669,9 +2669,9 @@ This value may depend on the JS engine that is being used. [`buf.length`]: #buffer_buf_length [`buf.slice()`]: #buffer_buf_slice_start_end [`buf.values()`]: #buffer_buf_values -[`buffer.kMaxLength`]: #buffer_buffer_kmaxlength [`buffer.constants.MAX_LENGTH`]: #buffer_buffer_constants_max_length [`buffer.constants.MAX_STRING_LENGTH`]: #buffer_buffer_constants_max_string_length +[`buffer.kMaxLength`]: #buffer_buffer_kmaxlength [`util.inspect()`]: util.html#util_util_inspect_object_options [RFC1345]: https://tools.ietf.org/html/rfc1345 [RFC4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5 diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 23715b2dd1080f..04f8fa8a3d9bb6 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1432,13 +1432,6 @@ unavailable. [`ChildProcess`]: #child_process_child_process [`Error`]: errors.html#errors_class_error [`EventEmitter`]: events.html#events_class_eventemitter -[`subprocess.connected`]: #child_process_subprocess_connected -[`subprocess.disconnect()`]: #child_process_subprocess_disconnect -[`subprocess.kill()`]: #child_process_subprocess_kill_signal -[`subprocess.send()`]: #child_process_subprocess_send_message_sendhandle_options_callback -[`subprocess.stderr`]: #child_process_subprocess_stderr -[`subprocess.stdin`]: #child_process_subprocess_stdin -[`subprocess.stdout`]: #child_process_subprocess_stdout [`child_process.exec()`]: #child_process_child_process_exec_command_options_callback [`child_process.execFile()`]: #child_process_child_process_execfile_file_args_options_callback [`child_process.execFileSync()`]: #child_process_child_process_execfilesync_file_args_options @@ -1455,6 +1448,13 @@ unavailable. [`process.execPath`]: process.html#process_process_execpath [`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback [`stdio`]: #child_process_options_stdio +[`subprocess.connected`]: #child_process_subprocess_connected +[`subprocess.disconnect()`]: #child_process_subprocess_disconnect +[`subprocess.kill()`]: #child_process_subprocess_kill_signal +[`subprocess.send()`]: #child_process_subprocess_send_message_sendhandle_options_callback +[`subprocess.stderr`]: #child_process_subprocess_stderr +[`subprocess.stdin`]: #child_process_subprocess_stdin +[`subprocess.stdout`]: #child_process_subprocess_stdout [`util.promisify()`]: util.html#util_util_promisify_original [Default Windows Shell]: #child_process_default_windows_shell [Shell Requirements]: #child_process_shell_requirements diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 30e0a50f3fde27..e7728ced90084d 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2914,15 +2914,15 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. [`hmac.update()`]: #crypto_hmac_update_data_inputencoding [`sign.sign()`]: #crypto_sign_sign_privatekey_outputformat [`sign.update()`]: #crypto_sign_update_data_inputencoding -[`stream.transform` options]: stream.html#stream_new_stream_transform_options [`stream.Writable` options]: stream.html#stream_constructor_new_stream_writable_options +[`stream.transform` options]: stream.html#stream_new_stream_transform_options [`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options [`util.promisify()`]: util.html#util_util_promisify_original [`verify.update()`]: #crypto_verify_update_data_inputencoding [`verify.verify()`]: #crypto_verify_verify_object_signature_signatureformat [AEAD algorithms]: https://en.wikipedia.org/wiki/Authenticated_encryption -[Caveats]: #crypto_support_for_weak_or_compromised_algorithms [CCM mode]: #crypto_ccm_mode +[Caveats]: #crypto_support_for_weak_or_compromised_algorithms [Crypto Constants]: #crypto_crypto_constants_1 [HTML 5.2]: https://www.w3.org/TR/html52/changes.html#features-removed [HTML5's `keygen` element]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 22f40da01c4fe1..4374d4dd3c7afa 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2072,24 +2072,25 @@ only. Use of `process.binding()` by userland code is unsupported. [`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj [`Cipher`]: crypto.html#crypto_class_cipher [`Decipher`]: crypto.html#crypto_class_decipher -[`assert`]: assert.html -[`clearInterval()`]: timers.html#timers_clearinterval_timeout -[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout [`EventEmitter.listenerCount(emitter, eventName)`]: events.html#events_eventemitter_listenercount_emitter_eventname +[`REPLServer.clearBufferedCommand()`]: repl.html#repl_replserver_clearbufferedcommand [`Server.connections`]: net.html#net_server_connections [`Server.getConnections()`]: net.html#net_server_getconnections_callback [`Server.listen({fd: })`]: net.html#net_server_listen_handle_backlog_callback [`SlowBuffer`]: buffer.html#buffer_class_slowbuffer +[`assert`]: assert.html [`asyncResource.runInAsyncScope()`]: async_hooks.html#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args [`child_process`]: child_process.html +[`clearInterval()`]: timers.html#timers_clearinterval_timeout +[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout [`console.error()`]: console.html#console_console_error_data_args [`console.log()`]: console.html#console_console_log_data_args +[`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding [`crypto.createCipher()`]: crypto.html#crypto_crypto_createcipher_algorithm_password_options [`crypto.createCipheriv()`]: crypto.html#crypto_crypto_createcipheriv_algorithm_key_iv_options [`crypto.createCredentials()`]: crypto.html#crypto_crypto_createcredentials_details [`crypto.createDecipher()`]: crypto.html#crypto_crypto_createdecipher_algorithm_password_options [`crypto.createDecipheriv()`]: crypto.html#crypto_crypto_createdecipheriv_algorithm_key_iv_options -[`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding [`crypto.fips`]: crypto.html#crypto_crypto_fips [`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback [`crypto.scrypt()`]: crypto.html#crypto_crypto_scrypt_password_salt_keylen_options_callback @@ -2147,9 +2148,8 @@ only. Use of `process.binding()` by userland code is unsupported. [`util`]: util.html [`worker.exitedAfterDisconnect`]: cluster.html#cluster_worker_exitedafterdisconnect [`zlib.bytesWritten`]: zlib.html#zlib_zlib_byteswritten +[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding [alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size [from_arraybuffer]: buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length [from_string_encoding]: buffer.html#buffer_class_method_buffer_from_string_encoding -[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf -[`REPLServer.clearBufferedCommand()`]: repl.html#repl_replserver_clearbufferedcommand diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 7db8cdf3650342..1bd9c967030d8b 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -640,6 +640,7 @@ and `udp6` sockets). The bound address and port can be retrieved using [`'close'`]: #dgram_event_close [`Error`]: errors.html#errors_class_error [`EventEmitter`]: events.html +[`System Error`]: errors.html#errors_class_systemerror [`close()`]: #dgram_socket_close_callback [`cluster`]: cluster.html [`dgram.Socket#bind()`]: #dgram_socket_bind_options_callback @@ -648,7 +649,6 @@ and `udp6` sockets). The bound address and port can be retrieved using [`socket.address().address`]: #dgram_socket_address [`socket.address().port`]: #dgram_socket_address [`socket.bind()`]: #dgram_socket_bind_port_address_callback -[`System Error`]: errors.html#errors_class_systemerror -[byte length]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding [IPv6 Zone Indices]: https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses [RFC 4007]: https://tools.ietf.org/html/rfc4007 +[byte length]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding diff --git a/doc/api/documentation.md b/doc/api/documentation.md index a1b0d5903b5130..440f21c7af08dc 100644 --- a/doc/api/documentation.md +++ b/doc/api/documentation.md @@ -86,7 +86,7 @@ sometimes impossible to replace Unix syscall semantics on Windows, see [Node.js issue 4760](https://github.com/nodejs/node/issues/4760). [`'warning'`]: process.html#process_event_warning -[`stderr`]: process.html#process_process_stderr [`fs.open()`]: fs.html#fs_fs_open_path_flags_mode_callback +[`stderr`]: process.html#process_process_stderr [submit an issue]: https://github.com/nodejs/node/issues/new [the contributing guide]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md diff --git a/doc/api/errors.md b/doc/api/errors.md index f51ba038d9cbbf..ff9dfd3987c1c7 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2103,24 +2103,25 @@ instance.setEncoding('utf8'); An attempt has been made to create a string larger than the maximum allowed size. -[`--force-fips`]: cli.html#cli_force_fips [`'uncaughtException'`]: process.html#process_event_uncaughtexception +[`--force-fips`]: cli.html#cli_force_fips +[`Class: assert.AssertionError`]: assert.html#assert_class_assert_assertionerror +[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE +[`EventEmitter`]: events.html#events_class_eventemitter +[`Writable`]: stream.html#stream_class_stream_writable [`child_process`]: child_process.html [`cipher.getAuthTag()`]: crypto.html#crypto_cipher_getauthtag -[`Class: assert.AssertionError`]: assert.html#assert_class_assert_assertionerror [`crypto.scrypt()`]: crypto.html#crypto_crypto_scrypt_password_salt_keylen_options_callback [`crypto.scryptSync()`]: crypto.html#crypto_crypto_scryptsync_password_salt_keylen_options [`crypto.timingSafeEqual()`]: crypto.html#crypto_crypto_timingsafeequal_a_b [`dgram.createSocket()`]: dgram.html#dgram_dgram_createsocket_options_callback -[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE -[`EventEmitter`]: events.html#events_class_eventemitter -[`fs`]: fs.html [`errno`(3) man page]: http://man7.org/linux/man-pages/man3/errno.3.html [`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 [`fs.symlinkSync()`]: fs.html#fs_fs_symlinksync_target_path_type [`fs.unlink`]: fs.html#fs_fs_unlink_path_callback +[`fs`]: fs.html [`hash.digest()`]: crypto.html#crypto_hash_digest_encoding [`hash.update()`]: crypto.html#crypto_hash_update_data_inputencoding [`http`]: http.html @@ -2132,10 +2133,10 @@ size. [`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn [`readable._read()`]: stream.html#stream_readable_read_size_1 -[`require()`]: modules.html#modules_require [`require('crypto').setEngine()`]: crypto.html#crypto_crypto_setengine_engine_flags -[`server.listen()`]: net.html#net_server_listen +[`require()`]: modules.html#modules_require [`server.close()`]: net.html#net_server_close_callback +[`server.listen()`]: net.html#net_server_listen [`sign.sign()`]: crypto.html#crypto_sign_sign_privatekey_outputformat [`stream.pipe()`]: stream.html#stream_readable_pipe_destination_options [`stream.push()`]: stream.html#stream_readable_push_chunk_encoding @@ -2143,11 +2144,12 @@ size. [`stream.write()`]: stream.html#stream_writable_write_chunk_encoding_callback [`subprocess.kill()`]: child_process.html#child_process_subprocess_kill_signal [`subprocess.send()`]: child_process.html#child_process_subprocess_send_message_sendhandle_options_callback -[`Writable`]: stream.html#stream_class_stream_writable [`zlib`]: zlib.html [ES6 module]: esm.html +[ICU]: intl.html#intl_internationalization_support [Node.js Error Codes]: #nodejs-error-codes [V8's stack trace API]: https://github.com/v8/v8/wiki/Stack-Trace-API +[WHATWG Supported Encodings]: util.html#util_whatwg_supported_encodings [WHATWG URL API]: url.html#url_the_whatwg_url_api [crypto digest algorithm]: crypto.html#crypto_crypto_gethashes [domains]: domain.html @@ -2157,4 +2159,3 @@ size. [syscall]: http://man7.org/linux/man-pages/man2/syscalls.2.html [try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch [vm]: vm.html -[WHATWG Supported Encodings]: util.html#util_whatwg_supported_encodings diff --git a/doc/api/fs.md b/doc/api/fs.md index a062ba6db52250..16cede54dba598 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4812,13 +4812,13 @@ the file contents. [`AHAFS`]: https://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/ [`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding [`Buffer`]: buffer.html#buffer_buffer +[`EventEmitter`]: events.html [`FSEvents`]: https://developer.apple.com/documentation/coreservices/file_system_events [`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw [`ReadStream`]: #fs_class_fs_readstream [`URL`]: url.html#url_the_whatwg_url_api [`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size [`WriteStream`]: #fs_class_fs_writestream -[`EventEmitter`]: events.html [`event ports`]: http://illumos.org/man/port_create [`fs.Dirent`]: #fs_class_fs_dirent [`fs.FSWatcher`]: #fs_class_fs_fswatcher @@ -4837,10 +4837,10 @@ the file contents. [`fs.mkdtemp()`]: #fs_fs_mkdtemp_prefix_options_callback [`fs.open()`]: #fs_fs_open_path_flags_mode_callback [`fs.read()`]: #fs_fs_read_fd_buffer_offset_length_position_callback -[`fs.readdir()`]: #fs_fs_readdir_path_options_callback -[`fs.readdirSync()`]: #fs_fs_readdirsync_path_options [`fs.readFile()`]: #fs_fs_readfile_path_options_callback [`fs.readFileSync()`]: #fs_fs_readfilesync_path_options +[`fs.readdir()`]: #fs_fs_readdir_path_options_callback +[`fs.readdirSync()`]: #fs_fs_readdirsync_path_options [`fs.realpath()`]: #fs_fs_realpath_path_options_callback [`fs.rmdir()`]: #fs_fs_rmdir_path_callback [`fs.stat()`]: #fs_fs_stat_path_options_callback @@ -4858,13 +4858,13 @@ the file contents. [Caveats]: #fs_caveats [Common System Errors]: errors.html#errors_common_system_errors [FS Constants]: #fs_fs_constants_1 +[File Access Constants]: #fs_file_access_constants [MDN-Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date [MDN-Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type [MSDN-Rel-Path]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#fully-qualified-vs-relative-paths +[MSDN-Using-Streams]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams +[Naming Files, Paths, and Namespaces]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file [Readable Streams]: stream.html#stream_class_stream_readable [Writable Stream]: stream.html#stream_class_stream_writable [inode]: https://en.wikipedia.org/wiki/Inode -[Naming Files, Paths, and Namespaces]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file -[MSDN-Using-Streams]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams [support of file system `flags`]: #fs_file_system_flags -[File Access Constants]: #fs_file_access_constants diff --git a/doc/api/globals.md b/doc/api/globals.md index 0277f7db603ef8..a3f76db9d6d692 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -169,6 +169,8 @@ The object that acts as the namespace for all W3C [WebAssembly][webassembly-org] related functionality. See the [Mozilla Developer Network][webassembly-mdn] for usage and compatibility. +[`URLSearchParams`]: url.html#url_class_urlsearchparams +[`URL`]: url.html#url_class_url [`__dirname`]: modules.html#modules_dirname [`__filename`]: modules.html#modules_filename [`clearImmediate`]: timers.html#timers_clearimmediate_immediate @@ -182,8 +184,6 @@ The object that acts as the namespace for all W3C [`setImmediate`]: timers.html#timers_setimmediate_callback_args [`setInterval`]: timers.html#timers_setinterval_callback_delay_args [`setTimeout`]: timers.html#timers_settimeout_callback_delay_args -[`URL`]: url.html#url_class_url -[`URLSearchParams`]: url.html#url_class_urlsearchparams [buffer section]: buffer.html [built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects [module system documentation]: modules.html diff --git a/doc/api/http.md b/doc/api/http.md index b7f66aef23e9e2..8a42a3e82d313e 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -2118,8 +2118,8 @@ not abort the request or do anything besides add a `'timeout'` event. [`request.getHeader()`]: #http_request_getheader_name [`request.setHeader()`]: #http_request_setheader_name_value [`request.setTimeout()`]: #http_request_settimeout_timeout_callback -[`request.socket`]: #http_request_socket [`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed +[`request.socket`]: #http_request_socket [`request.write(data, encoding)`]: #http_request_write_chunk_encoding_callback [`response.end()`]: #http_response_end_data_encoding_callback [`response.getHeader()`]: #http_response_getheader_name diff --git a/doc/api/http2.md b/doc/api/http2.md index 8418c31a58ac75..c3b081f6483a76 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -3382,21 +3382,21 @@ following additional properties: * `type` {string} Either `'server'` or `'client'` to identify the type of `Http2Session`. -[ALPN negotiation]: #http2_alpn_negotiation [ALPN Protocol ID]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids +[ALPN negotiation]: #http2_alpn_negotiation [Compatibility API]: #http2_compatibility_api [HTTP/1]: http.html -[HTTP/2]: https://tools.ietf.org/html/rfc7540 -[HTTP/2 Unencrypted]: https://http2.github.io/faq/#does-http2-require-encryption [HTTP/2 Headers Object]: #http2_headers_object [HTTP/2 Settings Object]: #http2_settings_object +[HTTP/2 Unencrypted]: https://http2.github.io/faq/#does-http2-require-encryption +[HTTP/2]: https://tools.ietf.org/html/rfc7540 [HTTPS]: https.html [Performance Observer]: perf_hooks.html -[Readable Stream]: stream.html#stream_class_stream_readable -[Stream]: stream.html#stream_stream [RFC 7838]: https://tools.ietf.org/html/rfc7838 [RFC 8336]: https://tools.ietf.org/html/rfc8336 [RFC 8441]: https://tools.ietf.org/html/rfc8441 +[Readable Stream]: stream.html#stream_class_stream_readable +[Stream]: stream.html#stream_stream [Using `options.selectPadding()`]: #http2_using_options_selectpadding [`'checkContinue'`]: #http2_event_checkcontinue [`'request'`]: #http2_event_request @@ -3409,15 +3409,15 @@ following additional properties: [`ServerHttp2Stream`]: #http2_class_serverhttp2stream [`TypeError`]: errors.html#errors_class_typeerror [`http2.SecureServer`]: #http2_class_http2secureserver -[`http2.createSecureServer()`]: #http2_http2_createsecureserver_options_onrequesthandler [`http2.Server`]: #http2_class_http2server +[`http2.createSecureServer()`]: #http2_http2_createsecureserver_options_onrequesthandler [`http2.createServer()`]: #http2_http2_createserver_options_onrequesthandler [`http2session.close()`]: #http2_http2session_close_callback [`http2stream.pushStream()`]: #http2_http2stream_pushstream_headers_options_callback [`net.Server.close()`]: net.html#net_server_close_callback -[`net.Socket`]: net.html#net_class_net_socket [`net.Socket.prototype.ref()`]: net.html#net_socket_ref [`net.Socket.prototype.unref()`]: net.html#net_socket_unref +[`net.Socket`]: net.html#net_class_net_socket [`net.connect()`]: net.html#net_net_connect [`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed [`response.end()`]: #http2_response_end_data_encoding_callback diff --git a/doc/api/https.md b/doc/api/https.md index b61a4bef08d22d..0de57478a6df4d 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -373,8 +373,8 @@ headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; p [`http.Server#setTimeout()`]: http.html#http_server_settimeout_msecs_callback [`http.Server#timeout`]: http.html#http_server_timeout [`http.Server`]: http.html#http_class_http_server -[`http.createServer()`]: http.html#http_http_createserver_options_requestlistener [`http.close()`]: http.html#http_server_close_callback +[`http.createServer()`]: http.html#http_http_createserver_options_requestlistener [`http.get()`]: http.html#http_http_get_options_callback [`http.request()`]: http.html#http_http_request_options_callback [`https.Agent`]: #https_class_https_agent diff --git a/doc/api/inspector.md b/doc/api/inspector.md index 7406e36e73ce7e..6af8b90aaf6238 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -183,5 +183,5 @@ session.post('Profiler.enable', () => { [`'Debugger.paused'`]: https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-paused [`EventEmitter`]: events.html#events_class_eventemitter [`session.connect()`]: #inspector_session_connect -[Chrome DevTools Protocol Viewer]: https://chromedevtools.github.io/devtools-protocol/v8/ [CPU Profiler]: https://chromedevtools.github.io/devtools-protocol/v8/Profiler +[Chrome DevTools Protocol Viewer]: https://chromedevtools.github.io/devtools-protocol/v8/ diff --git a/doc/api/intl.md b/doc/api/intl.md index 1d844500ccebbc..b6e1cf188b41b2 100644 --- a/doc/api/intl.md +++ b/doc/api/intl.md @@ -194,19 +194,19 @@ to be helpful: ["ICU Data"]: http://userguide.icu-project.org/icudata [`--icu-data-dir`]: cli.html#cli_icu_data_dir_file [`Date.prototype.toLocaleString()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString -[`Intl`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl [`Intl.DateTimeFormat`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat +[`Intl`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl [`NODE_ICU_DATA`]: cli.html#cli_node_icu_data_file [`Number.prototype.toLocaleString()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString [`RegExp` Unicode Property Escapes]: https://github.com/tc39/proposal-regexp-unicode-property-escapes -[`require('buffer').transcode()`]: buffer.html#buffer_buffer_transcode_source_fromenc_toenc -[`require('util').TextDecoder`]: util.html#util_class_util_textdecoder [`String.prototype.localeCompare()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare [`String.prototype.normalize()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize [`String.prototype.toLowerCase()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase [`String.prototype.toUpperCase()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase -[BUILDING.md]: https://github.com/nodejs/node/blob/master/BUILDING.md +[`require('buffer').transcode()`]: buffer.html#buffer_buffer_transcode_source_fromenc_toenc +[`require('util').TextDecoder`]: util.html#util_class_util_textdecoder [BUILDING.md#full-icu]: https://github.com/nodejs/node/blob/master/BUILDING.md#build-with-full-icu-support-all-locales-supported-by-icu +[BUILDING.md]: https://github.com/nodejs/node/blob/master/BUILDING.md [ECMA-262]: https://tc39.github.io/ecma262/ [ECMA-402]: https://tc39.github.io/ecma402/ [ICU]: http://site.icu-project.org/ diff --git a/doc/api/modules.md b/doc/api/modules.md index c7d9d4b59c7726..d75905e4c5bd01 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -922,12 +922,12 @@ const requireUtil = createRequireFromPath('../src/utils'); requireUtil('./some-tool'); ``` +[GLOBAL_FOLDERS]: #modules_loading_from_the_global_folders +[`Error`]: errors.html#errors_class_error [`__dirname`]: #modules_dirname [`__filename`]: #modules_filename -[`Error`]: errors.html#errors_class_error [`module` object]: #modules_the_module_object [`path.dirname()`]: path.html#path_path_dirname_path -[GLOBAL_FOLDERS]: #modules_loading_from_the_global_folders [`require`]: #modules_require [exports shortcut]: #modules_exports_shortcut [module resolution]: #modules_all_together diff --git a/doc/api/n-api.md b/doc/api/n-api.md index c976c5e8f060f0..17d6dac0a333e9 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -4602,26 +4602,26 @@ This API may only be called from the main thread. [Native Abstractions for Node.js]: https://github.com/nodejs/nan [Object Lifetime Management]: #n_api_object_lifetime_management [Object Wrap]: #n_api_object_wrap -[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type -[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type -[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2 -[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc [Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator [Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects [Section 22.2]: https://tc39.github.io/ecma262/#sec-typedarray-objects [Section 24.1]: https://tc39.github.io/ecma262/#sec-arraybuffer-objects [Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects [Section 25.4]: https://tc39.github.io/ecma262/#sec-promise-objects +[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type +[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type +[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2 +[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc [Working with JavaScript Functions]: #n_api_working_with_javascript_functions [Working with JavaScript Properties]: #n_api_working_with_javascript_properties -[Working with JavaScript Values]: #n_api_working_with_javascript_values [Working with JavaScript Values - Abstract Operations]: #n_api_working_with_javascript_values_abstract_operations - +[Working with JavaScript Values]: #n_api_working_with_javascript_values +[`init` hooks]: async_hooks.html#async_hooks_init_asyncid_type_triggerasyncid_resource [`napi_add_finalizer`]: #n_api_napi_add_finalizer [`napi_async_init`]: #n_api_napi_async_init [`napi_cancel_async_work`]: #n_api_napi_cancel_async_work -[`napi_close_escapable_handle_scope`]: #n_api_napi_close_escapable_handle_scope [`napi_close_callback_scope`]: #n_api_napi_close_callback_scope +[`napi_close_escapable_handle_scope`]: #n_api_napi_close_escapable_handle_scope [`napi_close_handle_scope`]: #n_api_napi_close_handle_scope [`napi_create_async_work`]: #n_api_napi_create_async_work [`napi_create_error`]: #n_api_napi_create_error @@ -4629,23 +4629,22 @@ This API may only be called from the main thread. [`napi_create_range_error`]: #n_api_napi_create_range_error [`napi_create_reference`]: #n_api_napi_create_reference [`napi_create_type_error`]: #n_api_napi_create_type_error -[`napi_delete_async_work`]: #n_api_napi_delete_async_work [`napi_define_class`]: #n_api_napi_define_class +[`napi_delete_async_work`]: #n_api_napi_delete_async_work [`napi_delete_element`]: #n_api_napi_delete_element [`napi_delete_property`]: #n_api_napi_delete_property [`napi_delete_reference`]: #n_api_napi_delete_reference [`napi_escape_handle`]: #n_api_napi_escape_handle +[`napi_get_and_clear_last_exception`]: #n_api_napi_get_and_clear_last_exception [`napi_get_array_length`]: #n_api_napi_get_array_length [`napi_get_element`]: #n_api_napi_get_element +[`napi_get_last_error_info`]: #n_api_napi_get_last_error_info [`napi_get_property`]: #n_api_napi_get_property -[`napi_has_property`]: #n_api_napi_has_property -[`napi_has_own_property`]: #n_api_napi_has_own_property -[`napi_set_property`]: #n_api_napi_set_property [`napi_get_reference_value`]: #n_api_napi_get_reference_value +[`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 [`napi_is_exception_pending`]: #n_api_napi_is_exception_pending -[`napi_get_last_error_info`]: #n_api_napi_get_last_error_info -[`napi_get_and_clear_last_exception`]: #n_api_napi_get_and_clear_last_exception [`napi_make_callback`]: #n_api_napi_make_callback [`napi_open_callback_scope`]: #n_api_napi_open_callback_scope [`napi_open_escapable_handle_scope`]: #n_api_napi_open_escapable_handle_scope @@ -4654,16 +4653,15 @@ This API may only be called from the main thread. [`napi_queue_async_work`]: #n_api_napi_queue_async_work [`napi_reference_ref`]: #n_api_napi_reference_ref [`napi_reference_unref`]: #n_api_napi_reference_unref -[`napi_throw`]: #n_api_napi_throw +[`napi_set_property`]: #n_api_napi_set_property [`napi_throw_error`]: #n_api_napi_throw_error [`napi_throw_range_error`]: #n_api_napi_throw_range_error [`napi_throw_type_error`]: #n_api_napi_throw_type_error +[`napi_throw`]: #n_api_napi_throw [`napi_unwrap`]: #n_api_napi_unwrap [`napi_wrap`]: #n_api_napi_wrap +[`process.release`]: process.html#process_process_release [`uv_ref`]: http://docs.libuv.org/en/v1.x/handle.html#c.uv_ref [`uv_unref`]: http://docs.libuv.org/en/v1.x/handle.html#c.uv_unref - -[`process.release`]: process.html#process_process_release -[`init` hooks]: async_hooks.html#async_hooks_init_asyncid_type_triggerasyncid_resource [async_hooks `type`]: async_hooks.html#async_hooks_type [context-aware addons]: addons.html#addons_context_aware_addons diff --git a/doc/api/net.md b/doc/api/net.md index 07c88cc88520af..3c3f4db26b989b 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1156,6 +1156,7 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`. [`net.createConnection(port, host)`]: #net_net_createconnection_port_host_connectlistener [`net.createServer()`]: #net_net_createserver_options_connectionlistener [`new net.Socket(options)`]: #net_new_net_socket_options +[`readable.setEncoding()`]: stream.html#stream_readable_setencoding_encoding [`server.close()`]: #net_server_close_callback [`server.getConnections()`]: #net_server_getconnections_callback [`server.listen()`]: #net_server_listen @@ -1174,7 +1175,6 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`. [`socket.setEncoding()`]: #net_socket_setencoding_encoding [`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback [`socket.setTimeout(timeout)`]: #net_socket_settimeout_timeout_callback -[`readable.setEncoding()`]: stream.html#stream_readable_setencoding_encoding [IPC]: #net_ipc_support [Identifying paths for IPC connections]: #net_identifying_paths_for_ipc_connections [Readable Stream]: stream.html#stream_class_stream_readable diff --git a/doc/api/process.md b/doc/api/process.md index 2eac1160586af1..f33c47295ea595 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2136,18 +2136,17 @@ cases: [`'rejectionHandled'`]: #process_event_rejectionhandled [`'uncaughtException'`]: #process_event_uncaughtexception [`ChildProcess.disconnect()`]: child_process.html#child_process_subprocess_disconnect -[`subprocess.kill()`]: child_process.html#child_process_subprocess_kill_signal [`ChildProcess.send()`]: child_process.html#child_process_subprocess_send_message_sendhandle_options_callback [`ChildProcess`]: child_process.html#child_process_class_childprocess [`Error`]: errors.html#errors_class_error [`EventEmitter`]: events.html#events_class_eventemitter +[`NODE_OPTIONS`]: cli.html#cli_node_options_options [`Worker`]: worker_threads.html#worker_threads_class_worker [`console.error()`]: console.html#console_console_error_data_args [`console.log()`]: console.html#console_console_log_data_args [`domain`]: domain.html [`net.Server`]: net.html#net_class_net_server [`net.Socket`]: net.html#net_class_net_socket -[`NODE_OPTIONS`]: cli.html#cli_node_options_options [`os.constants.dlopen`]: os.html#os_dlopen_constants [`process.argv`]: #process_process_argv [`process.config`]: #process_process_config @@ -2163,18 +2162,19 @@ cases: [`require.main`]: modules.html#modules_accessing_the_main_module [`require.resolve()`]: modules.html#modules_require_resolve_request_options [`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args +[`subprocess.kill()`]: child_process.html#child_process_subprocess_kill_signal [`v8.setFlagsFromString()`]: v8.html#v8_v8_setflagsfromstring_flags [Android building]: https://github.com/nodejs/node/blob/master/BUILDING.md#androidandroid-based-devices-eg-firefox-os [Child Process]: child_process.html [Cluster]: cluster.html -[debugger]: debugger.html [Duplex]: stream.html#stream_duplex_and_transform_streams [LTS]: https://github.com/nodejs/Release -[note on process I/O]: process.html#process_a_note_on_process_i_o -[process_emit_warning]: #process_process_emitwarning_warning_type_code_ctor -[process_warning]: #process_event_warning [Readable]: stream.html#stream_readable_streams [Signal Events]: #process_signal_events [Stream compatibility]: stream.html#stream_compatibility_with_older_node_js_versions [TTY]: tty.html#tty_tty [Writable]: stream.html#stream_writable_streams +[debugger]: debugger.html +[note on process I/O]: process.html#process_a_note_on_process_i_o +[process_emit_warning]: #process_process_emitwarning_warning_type_code_ctor +[process_warning]: #process_event_warning diff --git a/doc/api/stream.md b/doc/api/stream.md index ec4f47a80a9c44..52aaeed71a9126 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2421,57 +2421,57 @@ contain multi-byte characters. [`'end'`]: #stream_event_end [`'finish'`]: #stream_event_finish [`'readable'`]: #stream_event_readable +[`Duplex`]: #stream_class_stream_duplex [`EventEmitter`]: events.html#events_class_eventemitter +[`Readable`]: #stream_class_stream_readable [`Symbol.hasInstance`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance +[`Transform`]: #stream_class_stream_transform +[`Writable`]: #stream_class_stream_writable [`fs.createReadStream()`]: fs.html#fs_fs_createreadstream_path_options [`fs.createWriteStream()`]: fs.html#fs_fs_createwritestream_path_options [`net.Socket`]: net.html#net_class_net_socket [`process.stderr`]: process.html#process_process_stderr [`process.stdin`]: process.html#process_process_stdin [`process.stdout`]: process.html#process_process_stdout +[`readable.push('')`]: #stream_readable_push [`stream.cork()`]: #stream_writable_cork [`stream.pipe()`]: #stream_readable_pipe_destination_options [`stream.uncork()`]: #stream_writable_uncork [`stream.unpipe()`]: #stream_readable_unpipe_destination [`stream.wrap()`]: #stream_readable_wrap_stream -[`readable.push('')`]: #stream_readable_push [`writable.cork()`]: #stream_writable_cork [`writable.uncork()`]: #stream_writable_uncork [`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options [API for Stream Consumers]: #stream_api_for_stream_consumers [API for Stream Implementers]: #stream_api_for_stream_implementers [Compatibility]: #stream_compatibility_with_older_node_js_versions -[`Duplex`]: #stream_class_stream_duplex [HTTP requests, on the client]: http.html#http_class_http_clientrequest [HTTP responses, on the server]: http.html#http_class_http_serverresponse -[`Readable`]: #stream_class_stream_readable [TCP sockets]: net.html#net_class_net_socket -[`Transform`]: #stream_class_stream_transform -[`Writable`]: #stream_class_stream_writable [child process stdin]: child_process.html#child_process_subprocess_stdin [child process stdout and stderr]: child_process.html#child_process_subprocess_stdout [crypto]: crypto.html +[finished]: #stream_stream_finished_stream_callback [fs read streams]: fs.html#fs_class_fs_readstream [fs write streams]: fs.html#fs_class_fs_writestream [http-incoming-message]: http.html#http_class_http_incomingmessage -[zlib]: zlib.html [hwm-gotcha]: #stream_highwatermark_discrepancy_after_calling_readable_setencoding +[object-mode]: #stream_object_mode [pipeline]: #stream_stream_pipeline_streams_callback -[finished]: #stream_stream_finished_stream_callback +[readable-_destroy]: #stream_readable_destroy_err_callback +[readable-destroy]: #stream_readable_destroy_error +[stream-_final]: #stream_writable_final_callback [stream-_flush]: #stream_transform_flush_callback [stream-_read]: #stream_readable_read_size_1 [stream-_transform]: #stream_transform_transform_chunk_encoding_callback [stream-_write]: #stream_writable_write_chunk_encoding_callback_1 [stream-_writev]: #stream_writable_writev_chunks_callback -[stream-_final]: #stream_writable_final_callback [stream-end]: #stream_writable_end_chunk_encoding_callback [stream-pause]: #stream_readable_pause [stream-push]: #stream_readable_push_chunk_encoding [stream-read]: #stream_readable_read_size [stream-resume]: #stream_readable_resume [stream-write]: #stream_writable_write_chunk_encoding_callback -[readable-_destroy]: #stream_readable_destroy_err_callback -[readable-destroy]: #stream_readable_destroy_error [writable-_destroy]: #stream_writable_destroy_err_callback [writable-destroy]: #stream_writable_destroy_error -[object-mode]: #stream_object_mode +[zlib]: zlib.html diff --git a/doc/api/tty.md b/doc/api/tty.md index 2b205481560392..26761442a50865 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -214,6 +214,6 @@ a TTY and `false` if it is not, including whenever `fd` is not a non-negative integer. [`net.Socket`]: net.html#net_class_net_socket +[`process.stderr`]: process.html#process_process_stderr [`process.stdin`]: process.html#process_process_stdin [`process.stdout`]: process.html#process_process_stdout -[`process.stderr`]: process.html#process_process_stderr diff --git a/doc/api/util.md b/doc/api/util.md index 250f6ceebf0e13..8be463bdf86cbe 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -2141,20 +2141,17 @@ Deprecated predecessor of `console.log`. [`'uncaughtException'`]: process.html#process_event_uncaughtexception [`'warning'`]: process.html#process_event_warning [`Array.isArray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray -[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer [`ArrayBuffer.isView()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView -[`assert.deepStrictEqual()`]: assert.html#assert_assert_deepstrictequal_actual_expected_message +[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer [`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj -[`console.error()`]: console.html#console_console_error_data_args -[`console.log()`]: console.html#console_console_log_data_args [`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView [`Date`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date [`Error`]: errors.html#errors_class_error [`Float32Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array [`Float64Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array -[`Int8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array [`Int16Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array [`Int32Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array +[`Int8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array [`Map`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map [`Object.assign()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign [`Promise`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise @@ -2162,6 +2159,16 @@ Deprecated predecessor of `console.log`. [`Set`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer [`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray +[`Uint16Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array +[`Uint32Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array +[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array +[`Uint8ClampedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray +[`WeakMap`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap +[`WeakSet`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet +[`WebAssembly.Module`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module +[`assert.deepStrictEqual()`]: assert.html#assert_assert_deepstrictequal_actual_expected_message +[`console.error()`]: console.html#console_console_error_data_args +[`console.log()`]: console.html#console_console_log_data_args [`util.format()`]: #util_util_format_format_args [`util.inspect()`]: #util_util_inspect_object_options [`util.promisify()`]: #util_util_promisify_original @@ -2170,20 +2177,13 @@ Deprecated predecessor of `console.log`. [`util.types.isDate()`]: #util_util_types_isdate_value [`util.types.isNativeError()`]: #util_util_types_isnativeerror_value [`util.types.isSharedArrayBuffer()`]: #util_util_types_issharedarraybuffer_value -[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array -[`Uint8ClampedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray -[`Uint16Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array -[`Uint32Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array -[`WeakMap`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap -[`WeakSet`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet -[`WebAssembly.Module`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module +[Common System Errors]: errors.html#errors_common_system_errors [Custom inspection functions on Objects]: #util_custom_inspection_functions_on_objects [Custom promisified functions]: #util_custom_promisified_functions [Customizing `util.inspect` colors]: #util_customizing_util_inspect_colors [Internationalization]: intl.html [Module Namespace Object]: https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects [WHATWG Encoding Standard]: https://encoding.spec.whatwg.org/ -[Common System Errors]: errors.html#errors_common_system_errors [async function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function [compare function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters [constructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor diff --git a/doc/api/v8.md b/doc/api/v8.md index 4a04e89319927d..e16e8645090713 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -404,6 +404,7 @@ A subclass of [`Deserializer`][] corresponding to the format written by [`DefaultSerializer`]: #v8_class_v8_defaultserializer [`Deserializer`]: #v8_class_v8_deserializer [`Error`]: errors.html#errors_class_error +[`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-10.6/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 [`Serializer`]: #v8_class_v8_serializer [`deserializer._readHostObject()`]: #v8_deserializer_readhostobject [`deserializer.transferArrayBuffer()`]: #v8_deserializer_transferarraybuffer_id_arraybuffer @@ -413,8 +414,7 @@ A subclass of [`Deserializer`][] corresponding to the format written by [`serializer.releaseBuffer()`]: #v8_serializer_releasebuffer [`serializer.transferArrayBuffer()`]: #v8_serializer_transferarraybuffer_id_arraybuffer [`serializer.writeRawBytes()`]: #v8_serializer_writerawbytes_buffer +[`vm.Script`]: vm.html#vm_new_vm_script_code_options [HTML structured clone algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm [V8]: https://developers.google.com/v8/ -[`vm.Script`]: vm.html#vm_new_vm_script_code_options [here]: https://github.com/thlorenz/v8-flags/blob/master/flags-0.11.md -[`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-10.6/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 diff --git a/doc/api/vm.md b/doc/api/vm.md index 1053a37d9025ff..d023d9c216903a 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -985,9 +985,9 @@ queues. [`vm.createContext()`]: #vm_vm_createcontext_sandbox_options [`vm.runInContext()`]: #vm_vm_runincontext_code_contextifiedsandbox_options [`vm.runInThisContext()`]: #vm_vm_runinthiscontext_code_options -[GetModuleNamespace]: https://tc39.github.io/ecma262/#sec-getmodulenamespace [ECMAScript Module Loader]: esm.html#esm_ecmascript_modules [Evaluate() concrete method]: https://tc39.github.io/ecma262/#sec-moduleevaluation +[GetModuleNamespace]: https://tc39.github.io/ecma262/#sec-getmodulenamespace [HostResolveImportedModule]: https://tc39.github.io/ecma262/#sec-hostresolveimportedmodule [Instantiate() concrete method]: https://tc39.github.io/ecma262/#sec-moduledeclarationinstantiation [Source Text Module Record]: https://tc39.github.io/ecma262/#sec-source-text-module-records diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index b73787174cdc96..86b66fec90f9b4 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -462,34 +462,34 @@ active handle in the event system. If the worker is already `unref()`ed calling [`Buffer`]: buffer.html [`EventEmitter`]: events.html [`MessagePort`]: #worker_threads_class_messageport -[`port.postMessage()`]: #worker_threads_port_postmessage_value_transferlist +[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer +[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array [`Worker`]: #worker_threads_class_worker -[`worker.terminate()`]: #worker_threads_worker_terminate_callback -[`worker.postMessage()`]: #worker_threads_worker_postmessage_value_transferlist -[`worker.on('message')`]: #worker_threads_event_message_1 -[`worker.threadId`]: #worker_threads_worker_threadid_1 +[`cluster` module]: cluster.html +[`inspector`]: inspector.html [`port.on('message')`]: #worker_threads_event_message -[`process.exit()`]: process.html#process_process_exit_code +[`port.postMessage()`]: #worker_threads_port_postmessage_value_transferlist [`process.abort()`]: process.html#process_process_abort [`process.chdir()`]: process.html#process_process_chdir_directory [`process.env`]: process.html#process_process_env -[`process.stdin`]: process.html#process_process_stdin +[`process.exit()`]: process.html#process_process_exit_code [`process.stderr`]: process.html#process_process_stderr +[`process.stdin`]: process.html#process_process_stdin [`process.stdout`]: process.html#process_process_stdout [`process.title`]: process.html#process_process_title -[`require('worker_threads').workerData`]: #worker_threads_worker_workerdata -[`require('worker_threads').parentPort.on('message')`]: #worker_threads_event_message -[`require('worker_threads').postMessage()`]: #worker_threads_worker_postmessage_value_transferlist [`require('worker_threads').isMainThread`]: #worker_threads_worker_ismainthread +[`require('worker_threads').parentPort.on('message')`]: #worker_threads_event_message [`require('worker_threads').parentPort`]: #worker_threads_worker_parentport +[`require('worker_threads').postMessage()`]: #worker_threads_worker_postmessage_value_transferlist [`require('worker_threads').threadId`]: #worker_threads_worker_threadid -[`cluster` module]: cluster.html -[`inspector`]: inspector.html -[v8.serdes]: v8.html#v8_serialization_api -[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer +[`require('worker_threads').workerData`]: #worker_threads_worker_workerdata +[`worker.on('message')`]: #worker_threads_event_message_1 +[`worker.postMessage()`]: #worker_threads_worker_postmessage_value_transferlist +[`worker.terminate()`]: #worker_threads_worker_terminate_callback +[`worker.threadId`]: #worker_threads_worker_threadid_1 +[HTML structured clone algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm [Signals events]: process.html#process_signal_events -[`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array +[Web Workers]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API [browser `MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort [child processes]: child_process.html -[HTML structured clone algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm -[Web Workers]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API +[v8.serdes]: v8.html#v8_serialization_api diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 8725c40354d3a7..7e5e7b65ff031c 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -835,12 +835,12 @@ Decompress a chunk of data with [`Unzip`][]. [`Buffer`]: buffer.html#buffer_class_buffer [`Content-Encoding`]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11 [`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView -[`Deflate`]: #zlib_class_zlib_deflate [`DeflateRaw`]: #zlib_class_zlib_deflateraw +[`Deflate`]: #zlib_class_zlib_deflate [`Gunzip`]: #zlib_class_zlib_gunzip [`Gzip`]: #zlib_class_zlib_gzip -[`Inflate`]: #zlib_class_zlib_inflate [`InflateRaw`]: #zlib_class_zlib_inflateraw +[`Inflate`]: #zlib_class_zlib_inflate [`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray [`Unzip`]: #zlib_class_zlib_unzip [`stream.Transform`]: stream.html#stream_class_stream_transform From 4209e122b77ba5160a4491d58cc09bc370ba433c Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich <18708370+Flarna@users.noreply.github.com> Date: Tue, 27 Nov 2018 23:02:32 +0100 Subject: [PATCH 079/223] doc: correct async_hooks resource names Correct async hooks resource names to match the implementation: `TCPSERVER` => `TCPSERVERWRAP` Backport-PR-URL: https://github.com/nodejs/node/pull/24683 PR-URL: https://github.com/nodejs/node/pull/24001 Refs: https://github.com/nodejs/node/pull/21971 Refs: https://github.com/nodejs/node/pull/17157 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- doc/api/async_hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 0be5ef7bf56082..6a6cc781a79f1f 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -238,8 +238,8 @@ resource's constructor. ```text FSEVENTWRAP, FSREQWRAP, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER, JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP, SHUTDOWNWRAP, -SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVER, TCPWRAP, TIMERWRAP, TTYWRAP, -UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST, +SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVERWRAP, TCPWRAP, TIMERWRAP, +TTYWRAP, UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST, RANDOMBYTESREQUEST, TLSWRAP, Timeout, Immediate, TickObject ``` From 17b55bf1a48f6b902182811cc626a18085fd8687 Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Thu, 13 Dec 2018 20:39:13 -0800 Subject: [PATCH 080/223] deps: V8: cherry-pick 52a9e67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [turbofan] Fix ObjectCreate's side effect annotation. Bug: chromium:888923 Change-Id: Ifb22cd9b34f53de3cf6e47cd92f3c0abeb10ac79 Reviewed-on: https://chromium-review.googlesource.com/1245763 Reviewed-by: Benedikt Meurer Commit-Queue: Jaroslav Sevcik Cr-Commit-Position: refs/heads/master@{#56236} Refs: https://github.com/v8/v8/commit/52a9e67a477bdb67ca893c25c145ef5191976220 PR-URL: https://github.com/nodejs/node/pull/25027 Refs: https://github.com/v8/v8/commit/52a9e67a477bdb67ca893c25c145ef5191976220 Reviewed-By: Michaël Zasso Reviewed-By: Myles Borins --- common.gypi | 2 +- deps/v8/src/compiler/js-operator.cc | 2 +- .../test/mjsunit/compiler/regress-888923.js | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 deps/v8/test/mjsunit/compiler/regress-888923.js diff --git a/common.gypi b/common.gypi index e2295ee35de832..ba444e1429f856 100644 --- a/common.gypi +++ b/common.gypi @@ -33,7 +33,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.45', + 'v8_embedder_string': '-node.46', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/compiler/js-operator.cc b/deps/v8/src/compiler/js-operator.cc index 04feec6827aad0..8dedd68d946032 100644 --- a/deps/v8/src/compiler/js-operator.cc +++ b/deps/v8/src/compiler/js-operator.cc @@ -598,7 +598,7 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) { V(CreateKeyValueArray, Operator::kEliminatable, 2, 1) \ V(CreatePromise, Operator::kEliminatable, 0, 1) \ V(CreateTypedArray, Operator::kNoProperties, 5, 1) \ - V(CreateObject, Operator::kNoWrite, 1, 1) \ + V(CreateObject, Operator::kNoProperties, 1, 1) \ V(ObjectIsArray, Operator::kNoProperties, 1, 1) \ V(HasProperty, Operator::kNoProperties, 2, 1) \ V(HasInPrototypeChain, Operator::kNoProperties, 2, 1) \ diff --git a/deps/v8/test/mjsunit/compiler/regress-888923.js b/deps/v8/test/mjsunit/compiler/regress-888923.js new file mode 100644 index 00000000000000..e352673b7d933d --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-888923.js @@ -0,0 +1,31 @@ +// Copyright 2018 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: --allow-natives-syntax + +(function() { + function f(o) { + o.x; + Object.create(o); + return o.y.a; + } + + f({ x : 0, y : { a : 1 } }); + f({ x : 0, y : { a : 2 } }); + %OptimizeFunctionOnNextCall(f); + assertEquals(3, f({ x : 0, y : { a : 3 } })); +})(); + +(function() { + function f(o) { + let a = o.y; + Object.create(o); + return o.x + a; + } + + f({ x : 42, y : 21 }); + f({ x : 42, y : 21 }); + %OptimizeFunctionOnNextCall(f); + assertEquals(63, f({ x : 42, y : 21 })); +})(); From d04c3c2718b725fb40373e2a9354cfc1ada28045 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 8 Nov 2018 16:33:42 -0800 Subject: [PATCH 081/223] test: move benchmark tests out of main test suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move benchmark tests (which are slow) out of the main test suite. We can hopefully add them to node-daily-master so that they are still run daily on CI. Backport-PR-URL: https://github.com/nodejs/node/pull/25049 PR-URL: https://github.com/nodejs/node/pull/24265 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Joyee Cheung Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- Makefile | 11 +++++--- test/README.md | 1 + test/benchmark/benchmark.status | 21 ++++++++++++++ .../test-benchmark-assert.js | 0 .../test-benchmark-async-hooks.js | 0 .../test-benchmark-buffer.js | 0 .../test-benchmark-child-process.js | 0 .../test-benchmark-cluster.js | 0 .../test-benchmark-crypto.js | 0 .../test-benchmark-dgram.js | 0 .../test-benchmark-dns.js | 0 .../test-benchmark-domain.js | 0 .../test-benchmark-es.js | 0 .../test-benchmark-events.js | 0 .../test-benchmark-fs.js | 0 .../test-benchmark-http.js | 0 .../test-benchmark-misc.js | 0 .../test-benchmark-module.js | 0 .../test-benchmark-napi.js | 0 .../test-benchmark-net.js | 0 .../test-benchmark-os.js | 0 .../test-benchmark-path.js | 0 .../test-benchmark-process.js | 0 .../test-benchmark-querystring.js | 0 .../test-benchmark-streams.js | 0 .../test-benchmark-string_decoder.js | 0 .../test-benchmark-timers.js | 0 .../test-benchmark-tls.js | 0 .../test-benchmark-url.js | 0 .../test-benchmark-util.js | 0 .../test-benchmark-v8.js | 0 .../test-benchmark-vm.js | 0 .../test-benchmark-worker.js | 0 .../test-benchmark-zlib.js | 0 test/benchmark/testcfg.py | 6 ++++ test/root.status | 28 ------------------- tools/test.py | 1 + vcbuild.bat | 3 +- 38 files changed, 38 insertions(+), 33 deletions(-) create mode 100644 test/benchmark/benchmark.status rename test/{parallel => benchmark}/test-benchmark-assert.js (100%) rename test/{sequential => benchmark}/test-benchmark-async-hooks.js (100%) rename test/{sequential => benchmark}/test-benchmark-buffer.js (100%) rename test/{sequential => benchmark}/test-benchmark-child-process.js (100%) rename test/{parallel => benchmark}/test-benchmark-cluster.js (100%) rename test/{parallel => benchmark}/test-benchmark-crypto.js (100%) rename test/{sequential => benchmark}/test-benchmark-dgram.js (100%) rename test/{parallel => benchmark}/test-benchmark-dns.js (100%) rename test/{parallel => benchmark}/test-benchmark-domain.js (100%) rename test/{parallel => benchmark}/test-benchmark-es.js (100%) rename test/{parallel => benchmark}/test-benchmark-events.js (100%) rename test/{parallel => benchmark}/test-benchmark-fs.js (100%) rename test/{sequential => benchmark}/test-benchmark-http.js (100%) rename test/{parallel => benchmark}/test-benchmark-misc.js (100%) rename test/{parallel => benchmark}/test-benchmark-module.js (100%) rename test/{sequential => benchmark}/test-benchmark-napi.js (100%) rename test/{sequential => benchmark}/test-benchmark-net.js (100%) rename test/{parallel => benchmark}/test-benchmark-os.js (100%) rename test/{sequential => benchmark}/test-benchmark-path.js (100%) rename test/{parallel => benchmark}/test-benchmark-process.js (100%) rename test/{parallel => benchmark}/test-benchmark-querystring.js (100%) rename test/{parallel => benchmark}/test-benchmark-streams.js (100%) rename test/{parallel => benchmark}/test-benchmark-string_decoder.js (100%) rename test/{parallel => benchmark}/test-benchmark-timers.js (100%) rename test/{sequential => benchmark}/test-benchmark-tls.js (100%) rename test/{parallel => benchmark}/test-benchmark-url.js (100%) rename test/{parallel => benchmark}/test-benchmark-util.js (100%) rename test/{parallel => benchmark}/test-benchmark-v8.js (100%) rename test/{parallel => benchmark}/test-benchmark-vm.js (100%) rename test/{sequential => benchmark}/test-benchmark-worker.js (100%) rename test/{parallel => benchmark}/test-benchmark-zlib.js (100%) create mode 100644 test/benchmark/testcfg.py diff --git a/Makefile b/Makefile index b7a80f57450fe7..d24451f4289414 100644 --- a/Makefile +++ b/Makefile @@ -270,7 +270,7 @@ v8: tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) .PHONY: jstest -jstest: build-addons build-addons-napi bench-addons-build ## Runs addon tests and JS tests +jstest: build-addons build-addons-napi ## Runs addon tests and JS tests $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ --skip-tests=$(CI_SKIP_TESTS) \ $(CI_JS_SUITES) \ @@ -414,7 +414,7 @@ clear-stalled: echo $${PS_OUT} | xargs kill -9; \ fi -test-build: | all build-addons build-addons-napi bench-addons-build +test-build: | all build-addons build-addons-napi test-build-addons-napi: all build-addons-napi @@ -455,7 +455,7 @@ test-ci-js: | clear-stalled .PHONY: test-ci # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned test-ci: LOGLEVEL := info -test-ci: | clear-stalled build-addons build-addons-napi doc-only bench-addons-build +test-ci: | clear-stalled build-addons build-addons-napi doc-only out/Release/cctest --gtest_output=tap:cctest.tap $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ @@ -496,7 +496,7 @@ test-debug: test-build test-message: test-build $(PYTHON) tools/test.py $(PARALLEL_ARGS) message -test-simple: | cctest bench-addons-build # Depends on 'all'. +test-simple: | cctest # Depends on 'all'. $(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential test-pummel: all @@ -509,6 +509,9 @@ test-node-inspect: $(NODE_EXE) USE_EMBEDDED_NODE_INSPECT=1 $(NODE) tools/test-npm-package \ --install deps/node-inspect test +test-benchmark: | bench-addons-build + $(PYTHON) tools/test.py $(PARALLEL_ARGS) benchmark + test-tick-processor: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) tick-processor diff --git a/test/README.md b/test/README.md index 7ef705230983f3..25243d7687d133 100644 --- a/test/README.md +++ b/test/README.md @@ -19,6 +19,7 @@ GitHub with the `autocrlf` git config flag set to true. | `addons` | Yes | Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon to function properly. | | `addons-napi` | Yes | Tests for [n-api](https://nodejs.org/api/n-api.html) functionality. | | `async-hooks` | Yes | Tests for [async_hooks](https://nodejs.org/api/async_hooks.html) functionality. | +| `benchmark` | No | Test minimal functionality of benchmarks. | | `cctest` | Yes | C++ tests that are run as part of the build process. | | `code-cache` | No | Tests for a Node.js binary compiled with V8 code cache. | | `common` | | Common modules shared among many tests. [Documentation](./common/README.md) | diff --git a/test/benchmark/benchmark.status b/test/benchmark/benchmark.status new file mode 100644 index 00000000000000..6a966743aab26b --- /dev/null +++ b/test/benchmark/benchmark.status @@ -0,0 +1,21 @@ +prefix benchmark + +# To mark a test as flaky, list the test name in the appropriate section +# below, without ".js", followed by ": PASS,FLAKY". Example: +# sample-test : PASS,FLAKY + +[true] # This section applies to all platforms + +[$system==win32] + +[$system==linux] + +[$system==macos] + +[$system==solaris] # Also applies to SmartOS + +[$system==freebsd] + +[$system==aix] + +[$arch==arm] diff --git a/test/parallel/test-benchmark-assert.js b/test/benchmark/test-benchmark-assert.js similarity index 100% rename from test/parallel/test-benchmark-assert.js rename to test/benchmark/test-benchmark-assert.js diff --git a/test/sequential/test-benchmark-async-hooks.js b/test/benchmark/test-benchmark-async-hooks.js similarity index 100% rename from test/sequential/test-benchmark-async-hooks.js rename to test/benchmark/test-benchmark-async-hooks.js diff --git a/test/sequential/test-benchmark-buffer.js b/test/benchmark/test-benchmark-buffer.js similarity index 100% rename from test/sequential/test-benchmark-buffer.js rename to test/benchmark/test-benchmark-buffer.js diff --git a/test/sequential/test-benchmark-child-process.js b/test/benchmark/test-benchmark-child-process.js similarity index 100% rename from test/sequential/test-benchmark-child-process.js rename to test/benchmark/test-benchmark-child-process.js diff --git a/test/parallel/test-benchmark-cluster.js b/test/benchmark/test-benchmark-cluster.js similarity index 100% rename from test/parallel/test-benchmark-cluster.js rename to test/benchmark/test-benchmark-cluster.js diff --git a/test/parallel/test-benchmark-crypto.js b/test/benchmark/test-benchmark-crypto.js similarity index 100% rename from test/parallel/test-benchmark-crypto.js rename to test/benchmark/test-benchmark-crypto.js diff --git a/test/sequential/test-benchmark-dgram.js b/test/benchmark/test-benchmark-dgram.js similarity index 100% rename from test/sequential/test-benchmark-dgram.js rename to test/benchmark/test-benchmark-dgram.js diff --git a/test/parallel/test-benchmark-dns.js b/test/benchmark/test-benchmark-dns.js similarity index 100% rename from test/parallel/test-benchmark-dns.js rename to test/benchmark/test-benchmark-dns.js diff --git a/test/parallel/test-benchmark-domain.js b/test/benchmark/test-benchmark-domain.js similarity index 100% rename from test/parallel/test-benchmark-domain.js rename to test/benchmark/test-benchmark-domain.js diff --git a/test/parallel/test-benchmark-es.js b/test/benchmark/test-benchmark-es.js similarity index 100% rename from test/parallel/test-benchmark-es.js rename to test/benchmark/test-benchmark-es.js diff --git a/test/parallel/test-benchmark-events.js b/test/benchmark/test-benchmark-events.js similarity index 100% rename from test/parallel/test-benchmark-events.js rename to test/benchmark/test-benchmark-events.js diff --git a/test/parallel/test-benchmark-fs.js b/test/benchmark/test-benchmark-fs.js similarity index 100% rename from test/parallel/test-benchmark-fs.js rename to test/benchmark/test-benchmark-fs.js diff --git a/test/sequential/test-benchmark-http.js b/test/benchmark/test-benchmark-http.js similarity index 100% rename from test/sequential/test-benchmark-http.js rename to test/benchmark/test-benchmark-http.js diff --git a/test/parallel/test-benchmark-misc.js b/test/benchmark/test-benchmark-misc.js similarity index 100% rename from test/parallel/test-benchmark-misc.js rename to test/benchmark/test-benchmark-misc.js diff --git a/test/parallel/test-benchmark-module.js b/test/benchmark/test-benchmark-module.js similarity index 100% rename from test/parallel/test-benchmark-module.js rename to test/benchmark/test-benchmark-module.js diff --git a/test/sequential/test-benchmark-napi.js b/test/benchmark/test-benchmark-napi.js similarity index 100% rename from test/sequential/test-benchmark-napi.js rename to test/benchmark/test-benchmark-napi.js diff --git a/test/sequential/test-benchmark-net.js b/test/benchmark/test-benchmark-net.js similarity index 100% rename from test/sequential/test-benchmark-net.js rename to test/benchmark/test-benchmark-net.js diff --git a/test/parallel/test-benchmark-os.js b/test/benchmark/test-benchmark-os.js similarity index 100% rename from test/parallel/test-benchmark-os.js rename to test/benchmark/test-benchmark-os.js diff --git a/test/sequential/test-benchmark-path.js b/test/benchmark/test-benchmark-path.js similarity index 100% rename from test/sequential/test-benchmark-path.js rename to test/benchmark/test-benchmark-path.js diff --git a/test/parallel/test-benchmark-process.js b/test/benchmark/test-benchmark-process.js similarity index 100% rename from test/parallel/test-benchmark-process.js rename to test/benchmark/test-benchmark-process.js diff --git a/test/parallel/test-benchmark-querystring.js b/test/benchmark/test-benchmark-querystring.js similarity index 100% rename from test/parallel/test-benchmark-querystring.js rename to test/benchmark/test-benchmark-querystring.js diff --git a/test/parallel/test-benchmark-streams.js b/test/benchmark/test-benchmark-streams.js similarity index 100% rename from test/parallel/test-benchmark-streams.js rename to test/benchmark/test-benchmark-streams.js diff --git a/test/parallel/test-benchmark-string_decoder.js b/test/benchmark/test-benchmark-string_decoder.js similarity index 100% rename from test/parallel/test-benchmark-string_decoder.js rename to test/benchmark/test-benchmark-string_decoder.js diff --git a/test/parallel/test-benchmark-timers.js b/test/benchmark/test-benchmark-timers.js similarity index 100% rename from test/parallel/test-benchmark-timers.js rename to test/benchmark/test-benchmark-timers.js diff --git a/test/sequential/test-benchmark-tls.js b/test/benchmark/test-benchmark-tls.js similarity index 100% rename from test/sequential/test-benchmark-tls.js rename to test/benchmark/test-benchmark-tls.js diff --git a/test/parallel/test-benchmark-url.js b/test/benchmark/test-benchmark-url.js similarity index 100% rename from test/parallel/test-benchmark-url.js rename to test/benchmark/test-benchmark-url.js diff --git a/test/parallel/test-benchmark-util.js b/test/benchmark/test-benchmark-util.js similarity index 100% rename from test/parallel/test-benchmark-util.js rename to test/benchmark/test-benchmark-util.js diff --git a/test/parallel/test-benchmark-v8.js b/test/benchmark/test-benchmark-v8.js similarity index 100% rename from test/parallel/test-benchmark-v8.js rename to test/benchmark/test-benchmark-v8.js diff --git a/test/parallel/test-benchmark-vm.js b/test/benchmark/test-benchmark-vm.js similarity index 100% rename from test/parallel/test-benchmark-vm.js rename to test/benchmark/test-benchmark-vm.js diff --git a/test/sequential/test-benchmark-worker.js b/test/benchmark/test-benchmark-worker.js similarity index 100% rename from test/sequential/test-benchmark-worker.js rename to test/benchmark/test-benchmark-worker.js diff --git a/test/parallel/test-benchmark-zlib.js b/test/benchmark/test-benchmark-zlib.js similarity index 100% rename from test/parallel/test-benchmark-zlib.js rename to test/benchmark/test-benchmark-zlib.js diff --git a/test/benchmark/testcfg.py b/test/benchmark/testcfg.py new file mode 100644 index 00000000000000..2c2929f610b851 --- /dev/null +++ b/test/benchmark/testcfg.py @@ -0,0 +1,6 @@ +import sys, os +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +import testpy + +def GetConfiguration(context, root): + return testpy.SimpleTestConfiguration(context, root, 'benchmark') diff --git a/test/root.status b/test/root.status index 9ed9004c2169d0..9c40512cb68051 100644 --- a/test/root.status +++ b/test/root.status @@ -9,27 +9,6 @@ async-hooks/test-tlswrap: SLOW async-hooks/test-tlswrap: SLOW message/eval_messages: SLOW message/stdin_messages: SLOW -parallel/test-benchmark-assert: SLOW -parallel/test-benchmark-cluster: SLOW -parallel/test-benchmark-crypto: SLOW -parallel/test-benchmark-dns: SLOW -parallel/test-benchmark-domain: SLOW -parallel/test-benchmark-es: SLOW -parallel/test-benchmark-events: SLOW -parallel/test-benchmark-fs: SLOW -parallel/test-benchmark-misc: SLOW -parallel/test-benchmark-module: SLOW -parallel/test-benchmark-os: SLOW -parallel/test-benchmark-process: SLOW -parallel/test-benchmark-querystring: SLOW -parallel/test-benchmark-streams: SLOW -parallel/test-benchmark-string_decoder: SLOW -parallel/test-benchmark-timers: SLOW -parallel/test-benchmark-url: SLOW -parallel/test-benchmark-util: SLOW -parallel/test-benchmark-v8: SLOW -parallel/test-benchmark-vm: SLOW -parallel/test-benchmark-zlib: SLOW parallel/test-buffer-constructor-node-modules-paths: SLOW parallel/test-buffer-indexof: SLOW parallel/test-child-process-spawnsync-input: SLOW @@ -165,13 +144,6 @@ parallel/test-worker-unsupported-things: SLOW parallel/test-worker-workerdata-sharedarraybuffer: SLOW parallel/test-zlib-bytes-read: SLOW parallel/test-zlib-convenience-methods: SLOW -sequential/test-benchmark-buffer: SLOW -sequential/test-benchmark-child-process: SLOW -sequential/test-benchmark-dgram: SLOW -sequential/test-benchmark-http: SLOW -sequential/test-benchmark-net: SLOW -sequential/test-benchmark-path: SLOW -sequential/test-benchmark-tls: SLOW sequential/test-child-process-execsync: SLOW sequential/test-child-process-exit: SLOW sequential/test-child-process-pass-fd: SLOW diff --git a/tools/test.py b/tools/test.py index cd361196653043..3a464be61da1b3 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1498,6 +1498,7 @@ def PrintCrashed(code): IGNORED_SUITES = [ 'addons', 'addons-napi', + 'benchmark', 'doctool', 'internet', 'pummel', diff --git a/vcbuild.bat b/vcbuild.bat index 8627dcb296fba7..81dd6087882d32 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -85,6 +85,7 @@ if /i "%1"=="build-addons" set build_addons=1&goto arg-ok if /i "%1"=="build-addons-napi" set build_addons_napi=1&goto arg-ok if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok if /i "%1"=="test-addons-napi" set test_args=%test_args% addons-napi&set build_addons_napi=1&goto arg-ok +if /i "%1"=="test-benchmark" set test_args=%test_args% benchmark&goto arg-ok if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok if /i "%1"=="test-tick-processor" set test_args=%test_args% tick-processor&goto arg-ok @@ -632,7 +633,7 @@ del .used_configure_flags goto exit :help -echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [ltcg] [nopch] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] +echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-benchmark/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [ltcg] [nopch] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build From 1bceb9d39758bf2e4b21569bac53777db406689d Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 26 Dec 2018 13:21:57 +0100 Subject: [PATCH 082/223] test: fix test-repl-envvars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In 180f86507d496b11aa35b2df4594629a92cce329, the test was changed so that the `env` argument of `createInternalRepl()` also contained external environment variables, because keeping them can be necessary for spawning processes on some systems. However, this test does not spawn new processes, and relies on the fact that the environment variables it tests are not already set (and fails otherwise); therefore, reverting to the original state should fix this. Fixes: https://github.com/nodejs/node/issues/21451 Fixes: https://github.com/nodejs/build/issues/1377 Refs: https://github.com/nodejs/node/pull/25219 PR-URL: https://github.com/nodejs/node/pull/25226 Reviewed-By: Rich Trott Reviewed-By: Tobias Nießen Reviewed-By: Benjamin Gruenbaum Reviewed-By: Denys Otrishko Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/parallel/test-repl-envvars.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-repl-envvars.js b/test/parallel/test-repl-envvars.js index d6a45a664fa3b7..5d7a60194b1e9e 100644 --- a/test/parallel/test-repl-envvars.js +++ b/test/parallel/test-repl-envvars.js @@ -36,7 +36,7 @@ const tests = [ ]; function run(test) { - const env = Object.assign({}, process.env, test.env); + const env = test.env; const expected = test.expected; const opts = { terminal: true, From a30f5a02b886429457dccf427e835708fc6e55a9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 8 Nov 2018 10:03:30 -0800 Subject: [PATCH 083/223] test: fix flaky test-vm-timeout-escape-nexttick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increase the VM timeout. If it is too small, the VM does not exit before the code has a chance to create the problematic condition that causes the timeout to be ignored. Fixes: https://github.com/nodejs/node/issues/24120 PR-URL: https://github.com/nodejs/node/pull/24251 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Michaël Zasso --- test/known_issues/test-vm-timeout-escape-nexttick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/known_issues/test-vm-timeout-escape-nexttick.js b/test/known_issues/test-vm-timeout-escape-nexttick.js index 8afe2fb8cebb15..c888c7f6466fa8 100644 --- a/test/known_issues/test-vm-timeout-escape-nexttick.js +++ b/test/known_issues/test-vm-timeout-escape-nexttick.js @@ -33,7 +33,7 @@ assert.throws(() => { nextTick, loop }, - { timeout: 5 } + { timeout: 10 } ); }, { code: 'ERR_SCRIPT_EXECUTION_TIMEOUT', From 90f3f5e88f2b83d58830861f2599d20435071c5f Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 7 Nov 2018 12:27:47 -0800 Subject: [PATCH 084/223] doc: clarify allowed encoding parameter types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the incorrect enumerations of their possible values, which weren't up to date with the values actually supported. Also renamed two arguments that used "format" when they meant "encoding". PR-URL: https://github.com/nodejs/node/pull/24230 Reviewed-By: Tobias Nießen Reviewed-By: Refael Ackermann Reviewed-By: Vse Mozhet Byt --- doc/api/crypto.md | 185 ++++++++++++++++++++++------------------------ doc/api/errors.md | 2 +- 2 files changed, 91 insertions(+), 96 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index e7728ced90084d..985c368f678e0e 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -72,7 +72,7 @@ console.log(challenge.toString('utf8')); added: v9.0.0 --> * `spkac` {string | Buffer | TypedArray | DataView} -* `encoding` {string} +* `encoding` {string} The [encoding][] of the `spkac` string. * Returns: {Buffer} The public key component of the `spkac` data structure, which includes a public key and a challenge. @@ -231,9 +231,9 @@ console.log(encrypted); -* `outputEncoding` {string} +* `outputEncoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Any remaining enciphered contents. - If `outputEncoding` is one of `'latin1'`, `'base64'` or `'hex'`, a string is + If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a [`Buffer`][] is returned. Once the `cipher.final()` method has been called, the `Cipher` object can no @@ -299,19 +299,19 @@ changes: description: The default `inputEncoding` changed from `binary` to `utf8`. --> * `data` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} -* `outputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the data. +* `outputEncoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Updates the cipher with `data`. If the `inputEncoding` argument is given, -its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` +the `data` argument is a string using the specified encoding. If the `inputEncoding` argument is not given, `data` must be a [`Buffer`][], `TypedArray`, or `DataView`. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. The `outputEncoding` specifies the output format of the enciphered -data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `outputEncoding` +data. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a [`Buffer`][] is returned. @@ -390,9 +390,9 @@ console.log(decrypted); -* `outputEncoding` {string} +* `outputEncoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Any remaining deciphered contents. - If `outputEncoding` is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is + If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a [`Buffer`][] is returned. Once the `decipher.final()` method has been called, the `Decipher` object can @@ -476,18 +476,18 @@ changes: description: The default `inputEncoding` changed from `binary` to `utf8`. --> * `data` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} -* `outputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the `data` string. +* `outputEncoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Updates the decipher with `data`. If the `inputEncoding` argument is given, -its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` +the `data` argument is a string using the specified encoding. If the `inputEncoding` argument is not given, `data` must be a [`Buffer`][]. If `data` is a [`Buffer`][] then `inputEncoding` is ignored. The `outputEncoding` specifies the output format of the enciphered -data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `outputEncoding` +data. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a [`Buffer`][] is returned. @@ -531,15 +531,15 @@ assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); added: v0.5.0 --> * `otherPublicKey` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} -* `outputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of an `otherPublicKey` string. +* `outputEncoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Computes the shared secret using `otherPublicKey` as the other party's public key and returns the computed shared secret. The supplied key is interpreted using the specified `inputEncoding`, and secret is -encoded using specified `outputEncoding`. Encodings can be -`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not +encoded using specified `outputEncoding`. +If the `inputEncoding` is not provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. @@ -550,57 +550,57 @@ If `outputEncoding` is given a string is returned; otherwise, a -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Generates private and public Diffie-Hellman key values, and returns the public key in the specified `encoding`. This key should be -transferred to the other party. Encoding can be `'latin1'`, `'hex'`, -or `'base64'`. If `encoding` is provided a string is returned; otherwise a +transferred to the other party. +If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### diffieHellman.getGenerator([encoding]) -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} -Returns the Diffie-Hellman generator in the specified `encoding`, which can -be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +Returns the Diffie-Hellman generator in the specified `encoding`. +If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### diffieHellman.getPrime([encoding]) -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} -Returns the Diffie-Hellman prime in the specified `encoding`, which can -be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +Returns the Diffie-Hellman prime in the specified `encoding`. +If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### diffieHellman.getPrivateKey([encoding]) -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} -Returns the Diffie-Hellman private key in the specified `encoding`, -which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +Returns the Diffie-Hellman private key in the specified `encoding`. +If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### diffieHellman.getPublicKey([encoding]) -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} -Returns the Diffie-Hellman public key in the specified `encoding`, which -can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +Returns the Diffie-Hellman public key in the specified `encoding`. +If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### diffieHellman.setPrivateKey(privateKey[, encoding]) @@ -608,10 +608,10 @@ string is returned; otherwise a [`Buffer`][] is returned. added: v0.5.0 --> * `privateKey` {string | Buffer | TypedArray | DataView} -* `encoding` {string} +* `encoding` {string} The [encoding][] of the `privateKey` string. -Sets the Diffie-Hellman private key. If the `encoding` argument is provided -and is either `'latin1'`, `'hex'`, or `'base64'`, `privateKey` is expected +Sets the Diffie-Hellman private key. If the `encoding` argument is provided, +`privateKey` is expected to be a string. If no `encoding` is provided, `privateKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. @@ -620,10 +620,10 @@ to be a [`Buffer`][], `TypedArray`, or `DataView`. added: v0.5.0 --> * `publicKey` {string | Buffer | TypedArray | DataView} -* `encoding` {string} +* `encoding` {string} The [encoding][] of the `publicKey` string. -Sets the Diffie-Hellman public key. If the `encoding` argument is provided -and is either `'latin1'`, `'hex'` or `'base64'`, `publicKey` is expected +Sets the Diffie-Hellman public key. If the `encoding` argument is provided, +`publicKey` is expected to be a string. If no `encoding` is provided, `publicKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. @@ -681,8 +681,8 @@ added: v10.0.0 * `key` {string | Buffer | TypedArray | DataView} * `curve` {string} -* `inputEncoding` {string} -* `outputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the `key` string. +* `outputEncoding` {string} The [encoding][] of the return value. * `format` {string} **Default:** `'uncompressed'` * Returns: {Buffer | string} @@ -690,8 +690,7 @@ Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the format specified by `format`. The `format` argument specifies point encoding and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is interpreted using the specified `inputEncoding`, and the returned key is encoded -using the specified `outputEncoding`. Encodings can be `'latin1'`, `'hex'`, -or `'base64'`. +using the specified `outputEncoding`. Use [`crypto.getCurves()`][] to obtain a list of available curve names. On recent OpenSSL releases, `openssl ecparam -list_curves` will also display @@ -736,15 +735,15 @@ changes: error --> * `otherPublicKey` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} -* `outputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the `otherPublicKey` string. +* `outputEncoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Computes the shared secret using `otherPublicKey` as the other party's public key and returns the computed shared secret. The supplied key is interpreted using specified `inputEncoding`, and the returned secret -is encoded using the specified `outputEncoding`. Encodings can be -`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not +is encoded using the specified `outputEncoding`. +If the `inputEncoding` is not provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. @@ -761,7 +760,7 @@ its recommended for developers to handle this exception accordingly. -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * `format` {string} **Default:** `'uncompressed'` * Returns: {Buffer | string} @@ -773,24 +772,24 @@ The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified, the point will be returned in `'uncompressed'` format. -The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If -`encoding` is provided a string is returned; otherwise a [`Buffer`][] +If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### ecdh.getPrivateKey([encoding]) -* `encoding` {string} -* Returns: {Buffer | string} The EC Diffie-Hellman private key in the specified - `encoding`, which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` - is provided a string is returned; otherwise a [`Buffer`][] is returned. +* `encoding` {string} The [encoding][] of the return value. +* Returns: {Buffer | string} The EC Diffie-Hellman in the specified `encoding`. + +If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is +returned. ### ecdh.getPublicKey([encoding][, format]) -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * `format` {string} **Default:** `'uncompressed'` * Returns: {Buffer | string} The EC Diffie-Hellman public key in the specified `encoding` and `format`. @@ -799,8 +798,7 @@ The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in `'uncompressed'` format. -The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If -`encoding` is specified, a string is returned; otherwise a [`Buffer`][] is +If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is returned. ### ecdh.setPrivateKey(privateKey[, encoding]) @@ -808,10 +806,10 @@ returned. added: v0.11.14 --> * `privateKey` {string | Buffer | TypedArray | DataView} -* `encoding` {string} +* `encoding` {string} The [encoding][] of the `privateKey` string. -Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`, -`'hex'` or `'base64'`. If `encoding` is provided, `privateKey` is expected +Sets the EC Diffie-Hellman private key. +If `encoding` is provided, `privateKey` is expected to be a string; otherwise `privateKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. @@ -828,10 +826,10 @@ deprecated: v5.2.0 > Stability: 0 - Deprecated * `publicKey` {string | Buffer | TypedArray | DataView} -* `encoding` {string} +* `encoding` {string} The [encoding][] of the `publicKey` string. -Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`, -`'hex'` or `'base64'`. If `encoding` is provided `publicKey` is expected to +Sets the EC Diffie-Hellman public key. +If `encoding` is provided `publicKey` is expected to be a string; otherwise a [`Buffer`][], `TypedArray`, or `DataView` is expected. Note that there is not normally a reason to call this method because `ECDH` @@ -928,12 +926,12 @@ console.log(hash.digest('hex')); -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Calculates the digest of all of the data passed to be hashed (using the -[`hash.update()`][] method). The `encoding` can be `'hex'`, `'latin1'` or -`'base64'`. If `encoding` is provided a string will be returned; otherwise +[`hash.update()`][] method). +If `encoding` is provided a string will be returned; otherwise a [`Buffer`][] is returned. The `Hash` object can not be used again after `hash.digest()` method has been @@ -948,11 +946,11 @@ changes: description: The default `inputEncoding` changed from `binary` to `utf8`. --> * `data` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the hash content with the given `data`, the encoding of which -is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or -`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. @@ -1020,11 +1018,11 @@ console.log(hmac.digest('hex')); -* `encoding` {string} +* `encoding` {string} The [encoding][] of the return value. * Returns: {Buffer | string} Calculates the HMAC digest of all of the data passed using [`hmac.update()`][]. -The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is +If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned; The `Hmac` object can not be used again after `hmac.digest()` has been @@ -1039,11 +1037,11 @@ changes: description: The default `inputEncoding` changed from `binary` to `utf8`. --> * `data` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the `Hmac` content with the given `data`, the encoding of which -is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or -`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. @@ -1113,7 +1111,7 @@ console.log(sign.sign(privateKey, 'hex')); // Prints: the calculated signature ``` -### sign.sign(privateKey[, outputFormat]) +### sign.sign(privateKey[, outputEncoding]) * `data` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the `Sign` content with the given `data`, the encoding of which -is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or -`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. @@ -1230,17 +1227,17 @@ changes: description: The default `inputEncoding` changed from `binary` to `utf8`. --> * `data` {string | Buffer | TypedArray | DataView} -* `inputEncoding` {string} +* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the `Verify` content with the given `data`, the encoding of which -is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or -`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +is given in `inputEncoding`. +If `inputEncoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. This can be called many times with new data as it is streamed. -### verify.verify(object, signature[, signatureFormat]) +### verify.verify(object, signature[, signatureEncoding]) * `object` {string | Object} * `signature` {string | Buffer | TypedArray | DataView} -* `signatureFormat` {string} +* `signatureEncoding` {string} The [encoding][] of the `signature` string. * Returns: {boolean} `true` or `false` depending on the validity of the signature for the data and public key. @@ -1273,8 +1270,8 @@ or an object with one or more of the following properties: determined automatically. The `signature` argument is the previously calculated signature for the data, in -the `signatureFormat` which can be `'latin1'`, `'hex'` or `'base64'`. -If a `signatureFormat` is specified, the `signature` is expected to be a +the `signatureEncoding`. +If a `signatureEncoding` is specified, the `signature` is expected to be a string; otherwise `signature` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. @@ -1551,10 +1548,10 @@ changes: from `binary` to `utf8`. --> * `prime` {string | Buffer | TypedArray | DataView} -* `primeEncoding` {string} +* `primeEncoding` {string} The [encoding][] of the `prime` string. * `generator` {number | string | Buffer | TypedArray | DataView} **Default:** `2` -* `generatorEncoding` {string} +* `generatorEncoding` {string} The [encoding][] of the `generator` string. * Returns: {DiffieHellman} Creates a `DiffieHellman` key exchange object using the supplied `prime` and an @@ -1563,9 +1560,6 @@ optional specific `generator`. The `generator` argument can be a number, string, or [`Buffer`][]. If `generator` is not specified, the value `2` is used. -The `primeEncoding` and `generatorEncoding` arguments can be `'latin1'`, -`'hex'`, or `'base64'`. - If `primeEncoding` is specified, `prime` is expected to be a string; otherwise a [`Buffer`][], `TypedArray`, or `DataView` is expected. @@ -2912,14 +2906,14 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. [`hash.update()`]: #crypto_hash_update_data_inputencoding [`hmac.digest()`]: #crypto_hmac_digest_encoding [`hmac.update()`]: #crypto_hmac_update_data_inputencoding -[`sign.sign()`]: #crypto_sign_sign_privatekey_outputformat +[`sign.sign()`]: #crypto_sign_sign_privatekey_outputencoding [`sign.update()`]: #crypto_sign_update_data_inputencoding [`stream.Writable` options]: stream.html#stream_constructor_new_stream_writable_options [`stream.transform` options]: stream.html#stream_new_stream_transform_options [`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options [`util.promisify()`]: util.html#util_util_promisify_original [`verify.update()`]: #crypto_verify_update_data_inputencoding -[`verify.verify()`]: #crypto_verify_verify_object_signature_signatureformat +[`verify.verify()`]: #crypto_verify_verify_object_signature_signatureencoding [AEAD algorithms]: https://en.wikipedia.org/wiki/Authenticated_encryption [CCM mode]: #crypto_ccm_mode [Caveats]: #crypto_support_for_weak_or_compromised_algorithms @@ -2935,6 +2929,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. [RFC 3526]: https://www.rfc-editor.org/rfc/rfc3526.txt [RFC 3610]: https://www.rfc-editor.org/rfc/rfc3610.txt [RFC 4055]: https://www.rfc-editor.org/rfc/rfc4055.txt +[encoding]: buffer.html#buffer_buffers_and_character_encodings [initialization vector]: https://en.wikipedia.org/wiki/Initialization_vector [scrypt]: https://en.wikipedia.org/wiki/Scrypt [stream-writable-write]: stream.html#stream_writable_write_chunk_encoding_callback diff --git a/doc/api/errors.md b/doc/api/errors.md index ff9dfd3987c1c7..72df6b27cb7b08 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2137,7 +2137,7 @@ size. [`require()`]: modules.html#modules_require [`server.close()`]: net.html#net_server_close_callback [`server.listen()`]: net.html#net_server_listen -[`sign.sign()`]: crypto.html#crypto_sign_sign_privatekey_outputformat +[`sign.sign()`]: crypto.html#crypto_sign_sign_privatekey_outputencoding [`stream.pipe()`]: stream.html#stream_readable_pipe_destination_options [`stream.push()`]: stream.html#stream_readable_push_chunk_encoding [`stream.unshift()`]: stream.html#stream_readable_unshift_chunk From 4d1a80363aef7691149bc54b498f6ae1f0b96a8c Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 8 Nov 2018 11:43:50 +0100 Subject: [PATCH 085/223] test: fix v8 Set/Get compiler warnings PR-URL: https://github.com/nodejs/node/pull/24246 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- benchmark/napi/function_args/binding.cc | 3 ++- doc/api/addons.md | 14 +++++++++----- test/addons/async-hello-world/binding.cc | 3 ++- test/addons/heap-profiler/binding.cc | 4 ++-- test/addons/new-target/binding.cc | 4 ++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/benchmark/napi/function_args/binding.cc b/benchmark/napi/function_args/binding.cc index d0c1a079210532..9f250aaa83db50 100644 --- a/benchmark/napi/function_args/binding.cc +++ b/benchmark/napi/function_args/binding.cc @@ -33,7 +33,8 @@ void CallWithArray(const FunctionCallbackInfo& args) { uint32_t length = array->Length(); for (uint32_t i = 0; i < length; ++ i) { Local v; - v = array->Get(i); + v = array->Get(args.GetIsolate()->GetCurrentContext(), + i).ToLocalChecked(); } } } diff --git a/doc/api/addons.md b/doc/api/addons.md index e2530acb77d5e0..d993c72d346495 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -537,6 +537,7 @@ to invoke such callbacks: namespace demo { +using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; using v8::Isolate; @@ -549,13 +550,14 @@ using v8::Value; void RunCallback(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); Local cb = Local::Cast(args[0]); const unsigned argc = 1; Local argv[argc] = { String::NewFromUtf8(isolate, "hello world", NewStringType::kNormal).ToLocalChecked() }; - cb->Call(Null(isolate), argc, argv); + cb->Call(context, Null(isolate), argc, argv).ToLocalChecked(); } void Init(Local exports, Local module) { @@ -612,10 +614,12 @@ void CreateObject(const FunctionCallbackInfo& args) { Local context = isolate->GetCurrentContext(); Local obj = Object::New(isolate); - obj->Set(String::NewFromUtf8(isolate, + obj->Set(context, + String::NewFromUtf8(isolate, "msg", NewStringType::kNormal).ToLocalChecked(), - args[0]->ToString(context).ToLocalChecked()); + args[0]->ToString(context).ToLocalChecked()) + .FromJust(); args.GetReturnValue().Set(obj); } @@ -803,9 +807,9 @@ void MyObject::Init(Local exports) { Local context = isolate->GetCurrentContext(); constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); - exports->Set(String::NewFromUtf8( + exports->Set(context, String::NewFromUtf8( isolate, "MyObject", NewStringType::kNormal).ToLocalChecked(), - tpl->GetFunction(context).ToLocalChecked()); + tpl->GetFunction(context).ToLocalChecked()).FromJust(); } void MyObject::New(const FunctionCallbackInfo& args) { diff --git a/test/addons/async-hello-world/binding.cc b/test/addons/async-hello-world/binding.cc index 3a584a88a07bc9..1bf94ddd1d70bc 100644 --- a/test/addons/async-hello-world/binding.cc +++ b/test/addons/async-hello-world/binding.cc @@ -53,7 +53,8 @@ void AfterAsync(uv_work_t* r) { // This should be changed to an empty handle. assert(!ret.IsEmpty()); } else { - callback->Call(global, 2, argv); + callback->Call(isolate->GetCurrentContext(), + global, 2, argv).ToLocalChecked(); } // cleanup diff --git a/test/addons/heap-profiler/binding.cc b/test/addons/heap-profiler/binding.cc index 29f58a5920825a..9e1e97e9fc2afc 100644 --- a/test/addons/heap-profiler/binding.cc +++ b/test/addons/heap-profiler/binding.cc @@ -19,11 +19,11 @@ inline void Test(const v8::FunctionCallbackInfo& args) { inline void Initialize(v8::Local binding) { v8::Isolate* const isolate = binding->GetIsolate(); v8::Local context = isolate->GetCurrentContext(); - binding->Set(v8::String::NewFromUtf8( + binding->Set(context, v8::String::NewFromUtf8( isolate, "test", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, Test) ->GetFunction(context) - .ToLocalChecked()); + .ToLocalChecked()).FromJust(); } NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) diff --git a/test/addons/new-target/binding.cc b/test/addons/new-target/binding.cc index c2777c831e484a..48ceeb55ca1aae 100644 --- a/test/addons/new-target/binding.cc +++ b/test/addons/new-target/binding.cc @@ -12,11 +12,11 @@ inline void NewClass(const v8::FunctionCallbackInfo& args) { inline void Initialize(v8::Local binding) { auto isolate = binding->GetIsolate(); auto context = isolate->GetCurrentContext(); - binding->Set(v8::String::NewFromUtf8( + binding->Set(context, v8::String::NewFromUtf8( isolate, "Class", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, NewClass) ->GetFunction(context) - .ToLocalChecked()); + .ToLocalChecked()).FromJust(); } NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) From 07b7db2f81a8052ae60c31720251bda1ce911824 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 2 Nov 2018 07:53:57 +0100 Subject: [PATCH 086/223] build: use BUILDTYPE in bench-addons-build targets This commit uses the BUILDTYPE for the benchmark targets that currently explicitly use Release as the build type. The motivation for this change is allows switching between debug builds and release builds using the bench-addons-clean/bench-addons-build targets. PR-URL: https://github.com/nodejs/node/pull/24033 Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- Makefile | 8 ++++---- benchmark/common.js | 2 ++ benchmark/napi/function_args/index.js | 4 ++-- benchmark/napi/function_call/index.js | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d24451f4289414..2c7c52d262fe1a 100644 --- a/Makefile +++ b/Makefile @@ -308,7 +308,7 @@ test-valgrind: all test-check-deopts: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential -benchmark/napi/function_call/build/Release/binding.node: \ +benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node: \ benchmark/napi/function_call/napi_binding.c \ benchmark/napi/function_call/binding.cc \ benchmark/napi/function_call/binding.gyp | all @@ -317,7 +317,7 @@ benchmark/napi/function_call/build/Release/binding.node: \ --directory="$(shell pwd)/benchmark/napi/function_call" \ --nodedir="$(shell pwd)" -benchmark/napi/function_args/build/Release/binding.node: \ +benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node: \ benchmark/napi/function_args/napi_binding.c \ benchmark/napi/function_args/binding.cc \ benchmark/napi/function_args/binding.gyp | all @@ -1046,8 +1046,8 @@ bench: bench-addons-build # Build required addons for benchmark before running it. .PHONY: bench-addons-build -bench-addons-build: benchmark/napi/function_call/build/Release/binding.node \ - benchmark/napi/function_args/build/Release/binding.node +bench-addons-build: benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node \ + benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node .PHONY: bench-addons-clean bench-addons-clean: diff --git a/benchmark/common.js b/benchmark/common.js index 148f51830f7b8d..bc4177d512d037 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -3,6 +3,8 @@ const child_process = require('child_process'); const http_benchmarkers = require('./_http-benchmarkers.js'); +exports.buildType = process.features.debug ? 'Debug' : 'Release'; + exports.createBenchmark = function(fn, configs, options) { return new Benchmark(fn, configs, options); }; diff --git a/benchmark/napi/function_args/index.js b/benchmark/napi/function_args/index.js index c41b5d78abadd9..df567dcfcc55bc 100644 --- a/benchmark/napi/function_args/index.js +++ b/benchmark/napi/function_args/index.js @@ -10,14 +10,14 @@ let v8; let napi; try { - v8 = require('./build/Release/binding'); + v8 = require(`./build/${common.buildType}/binding`); } catch { console.error(`${__filename}: V8 Binding failed to load`); process.exit(0); } try { - napi = require('./build/Release/napi_binding'); + napi = require(`./build/${common.buildType}/napi_binding`); } catch { console.error(`${__filename}: NAPI-Binding failed to load`); process.exit(0); diff --git a/benchmark/napi/function_call/index.js b/benchmark/napi/function_call/index.js index 272c41662d2830..59063e500f7a84 100644 --- a/benchmark/napi/function_call/index.js +++ b/benchmark/napi/function_call/index.js @@ -12,7 +12,7 @@ const common = require('../../common.js'); // abort quietly. try { - var binding = require('./build/Release/binding'); + var binding = require(`./build/${common.buildType}/binding`); } catch { console.error('misc/function_call.js Binding failed to load'); process.exit(0); @@ -21,7 +21,7 @@ const cxx = binding.hello; let napi_binding; try { - napi_binding = require('./build/Release/napi_binding'); + napi_binding = require(`./build/${common.buildType}/napi_binding`); } catch { console.error('misc/function_call/index.js NAPI-Binding failed to load'); process.exit(0); From 454ede2d9011a5bfc412ee1611ff1dedf1fa210d Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Tue, 6 Nov 2018 17:16:52 +0100 Subject: [PATCH 087/223] test: check control characters replacing Add test that creates an error with a control character in the message. PR-URL: https://github.com/nodejs/node/pull/24182 Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-assert.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index fd2d8721299ac9..335f5f56800909 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -835,6 +835,14 @@ common.expectsError( ); { + + assert.throws(() => { + assert.ok((() => Boolean('' === false))()); + }, { + message: 'The expression evaluated to a falsy value:\n\n' + + " assert.ok((() => Boolean('\\u0001' === false))())\n" + }); + const errFn = () => { const err = new TypeError('Wrong value'); err.code = 404; From 51643c208e4a877ee15869f9d713af44addb6a29 Mon Sep 17 00:00:00 2001 From: Vladyslav Kopylash Date: Tue, 6 Nov 2018 16:59:46 +0000 Subject: [PATCH 088/223] test: fix args order in process-getactiverequests PR-URL: https://github.com/nodejs/node/pull/24186 Reviewed-By: Ruben Bridgewater Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-process-getactiverequests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-process-getactiverequests.js b/test/parallel/test-process-getactiverequests.js index f55f298298d446..41883d35aa7dbc 100644 --- a/test/parallel/test-process-getactiverequests.js +++ b/test/parallel/test-process-getactiverequests.js @@ -7,4 +7,4 @@ const fs = require('fs'); for (let i = 0; i < 12; i++) fs.open(__filename, 'r', () => {}); -assert.strictEqual(12, process._getActiveRequests().length); +assert.strictEqual(process._getActiveRequests().length, 12); From 733cb1ef84ce7a077bda0dae6d34c3604b757207 Mon Sep 17 00:00:00 2001 From: Peter Marshall Date: Fri, 9 Nov 2018 13:06:07 +0100 Subject: [PATCH 089/223] deps: cherry-pick b87d408 from upstream V8 Original commit message: [heap-profiler] Fix a use-after-free when snapshots are deleted If a caller starts the sampling heap profiler and takes a snapshot, and then deletes the snapshot before the sampling has completed, a use-after-free will occur on the StringsStorage pointer. The same issue applies for StartTrackingHeapObjects which shares the same StringsStorage object. Bug: v8:8373 Change-Id: I5d69d60d3f9465f9dd3b3bef107c204e0fda0643 Reviewed-on: https://chromium-review.googlesource.com/c/1301477 Commit-Queue: Peter Marshall Reviewed-by: Alexei Filippov Cr-Commit-Position: refs/heads/master@{#57114} PR-URL: https://github.com/nodejs/node/pull/24272 Refs: https://github.com/v8/v8/commit/b87d408f65b9ab49a4d199e850d2358995deaeb2 Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius --- common.gypi | 2 +- deps/v8/src/profiler/heap-profiler.cc | 9 ++++- deps/v8/src/profiler/heap-profiler.h | 2 ++ deps/v8/test/cctest/test-heap-profiler.cc | 42 +++++++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/common.gypi b/common.gypi index ba444e1429f856..0a4ed881a5b925 100644 --- a/common.gypi +++ b/common.gypi @@ -33,7 +33,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.46', + 'v8_embedder_string': '-node.12', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/profiler/heap-profiler.cc b/deps/v8/src/profiler/heap-profiler.cc index 02b80c21d6e7e7..a4f53d69d5e40a 100644 --- a/deps/v8/src/profiler/heap-profiler.cc +++ b/deps/v8/src/profiler/heap-profiler.cc @@ -23,9 +23,14 @@ HeapProfiler::~HeapProfiler() = default; void HeapProfiler::DeleteAllSnapshots() { snapshots_.clear(); - names_.reset(new StringsStorage()); + MaybeClearStringsStorage(); } +void HeapProfiler::MaybeClearStringsStorage() { + if (snapshots_.empty() && !sampling_heap_profiler_ && !allocation_tracker_) { + names_.reset(new StringsStorage()); + } +} void HeapProfiler::RemoveSnapshot(HeapSnapshot* snapshot) { snapshots_.erase( @@ -126,6 +131,7 @@ bool HeapProfiler::StartSamplingHeapProfiler( void HeapProfiler::StopSamplingHeapProfiler() { sampling_heap_profiler_.reset(); + MaybeClearStringsStorage(); } @@ -159,6 +165,7 @@ void HeapProfiler::StopHeapObjectsTracking() { ids_->StopHeapObjectsTracking(); if (allocation_tracker_) { allocation_tracker_.reset(); + MaybeClearStringsStorage(); heap()->RemoveHeapObjectAllocationTracker(this); } } diff --git a/deps/v8/src/profiler/heap-profiler.h b/deps/v8/src/profiler/heap-profiler.h index fc0b005e1c67ce..bdc98521231a7d 100644 --- a/deps/v8/src/profiler/heap-profiler.h +++ b/deps/v8/src/profiler/heap-profiler.h @@ -92,6 +92,8 @@ class HeapProfiler : public HeapObjectAllocationTracker { v8::PersistentValueVector* objects); private: + void MaybeClearStringsStorage(); + Heap* heap() const; // Mapping from HeapObject addresses to objects' uids. diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index 70dc07d3dc872e..e8d974be3ef9a2 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -3690,3 +3690,45 @@ TEST(WeakReference) { const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot)); } + +TEST(Bug8373_1) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); + + heap_profiler->StartSamplingHeapProfiler(100); + + heap_profiler->TakeHeapSnapshot(); + // Causes the StringsStorage to be deleted. + heap_profiler->DeleteAllHeapSnapshots(); + + // Triggers an allocation sample that tries to use the StringsStorage. + for (int i = 0; i < 2 * 1024; ++i) { + CompileRun( + "new Array(64);" + "new Uint8Array(16);"); + } + + heap_profiler->StopSamplingHeapProfiler(); +} + +TEST(Bug8373_2) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); + + heap_profiler->StartTrackingHeapObjects(true); + + heap_profiler->TakeHeapSnapshot(); + // Causes the StringsStorage to be deleted. + heap_profiler->DeleteAllHeapSnapshots(); + + // Triggers an allocations that try to use the StringsStorage. + for (int i = 0; i < 2 * 1024; ++i) { + CompileRun( + "new Array(64);" + "new Uint8Array(16);"); + } + + heap_profiler->StopTrackingHeapObjects(); +} From 9970d562c65af98fee5bae28a5f956ed6238187c Mon Sep 17 00:00:00 2001 From: Petar Dodev Date: Tue, 6 Nov 2018 18:36:17 +0300 Subject: [PATCH 090/223] test: test add and remove for lib/domain Testing some of the more specific cases of using domain.add and domain.remove. For example, calling domain.add twice with same event emmiter and actually removing an event emitter from the domain. PR-URL: https://github.com/nodejs/node/pull/24163 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater --- test/parallel/test-domain-add-remove.js | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/parallel/test-domain-add-remove.js diff --git a/test/parallel/test-domain-add-remove.js b/test/parallel/test-domain-add-remove.js new file mode 100644 index 00000000000000..8e1d082125cb0b --- /dev/null +++ b/test/parallel/test-domain-add-remove.js @@ -0,0 +1,26 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); +const domain = require('domain'); +const EventEmitter = require('events'); + +const d = new domain.Domain(); +const e = new EventEmitter(); +const e2 = new EventEmitter(); + +d.add(e); +assert.strictEqual(e.domain, d); + +// Adding the same event to a domain should not change the member count +let previousMemberCount = d.members.length; +d.add(e); +assert.strictEqual(previousMemberCount, d.members.length); + +d.add(e2); +assert.strictEqual(e2.domain, d); + +previousMemberCount = d.members.length; +d.remove(e2); +assert.notStrictEqual(e2.domain, d); +assert.strictEqual(previousMemberCount - 1, d.members.length); From aba7b47e5c106dcb25d3913c3103e69a07da5481 Mon Sep 17 00:00:00 2001 From: Osmond van Hemert Date: Thu, 8 Nov 2018 21:21:13 +0100 Subject: [PATCH 091/223] test: url format path ending hashchar not covered PR-URL: https://github.com/nodejs/node/pull/24259 Reviewed-By: Weijia Wang Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-url-format.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/parallel/test-url-format.js b/test/parallel/test-url-format.js index 1f62792dfbcd78..571895832a3ffb 100644 --- a/test/parallel/test-url-format.js +++ b/test/parallel/test-url-format.js @@ -173,6 +173,16 @@ const formatTests = { hash: '#bar' }, + // `#` in path end + `#` in query + '/path/to/%%23?foo=the%231#bar': { + href: '/path/to/%%23?foo=the%231#bar', + pathname: '/path/to/%#', + query: { + foo: 'the#1' + }, + hash: '#bar' + }, + // `?` and `#` in path and search 'http://ex.com/foo%3F100%m%23r?abc=the%231?&foo=bar#frag': { href: 'http://ex.com/foo%3F100%m%23r?abc=the%231?&foo=bar#frag', From 7527632235cf1681fa76e852a08940e1b4b127c9 Mon Sep 17 00:00:00 2001 From: msmichellegar Date: Tue, 6 Nov 2018 14:38:37 +0000 Subject: [PATCH 092/223] lib: adjust params from uvExceptionWithHostPort PR-URL: https://github.com/nodejs/node/pull/24159 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- lib/internal/errors.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 9ec369ce0a12b8..b418fa295d2dcc 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -295,10 +295,9 @@ function uvException(ctx) { * @param {string} syscall * @param {string} address * @param {number} [port] - * @param {string} [additional] * @returns {Error} */ -function uvExceptionWithHostPort(err, syscall, address, port, additional) { +function uvExceptionWithHostPort(err, syscall, address, port) { const [ code, uvmsg ] = errmap.get(err); const message = `${syscall} ${code}: ${uvmsg}`; let details = ''; @@ -308,9 +307,6 @@ function uvExceptionWithHostPort(err, syscall, address, port, additional) { } else if (address) { details = ` ${address}`; } - if (additional) { - details += ` - Local (${additional})`; - } // eslint-disable-next-line no-restricted-syntax const ex = new Error(`${message}${details}`); From 33fd13c5ce8bfc7e9aceabee1a303c85e0469486 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 11 Nov 2018 09:02:48 -0800 Subject: [PATCH 093/223] build: fix benchmark tests on CI PR-URL: https://github.com/nodejs/node/pull/24307 Refs: https://github.com/nodejs/build/issues/1568#issuecomment-437681599 Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2c7c52d262fe1a..ef942738eee875 100644 --- a/Makefile +++ b/Makefile @@ -455,7 +455,7 @@ test-ci-js: | clear-stalled .PHONY: test-ci # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned test-ci: LOGLEVEL := info -test-ci: | clear-stalled build-addons build-addons-napi doc-only +test-ci: | clear-stalled build-addons build-addons-napi doc-only bench-addons-build out/Release/cctest --gtest_output=tap:cctest.tap $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ From e21d784cf8185545638c48881fe52ed2aa47bac0 Mon Sep 17 00:00:00 2001 From: Lauri Piisang Date: Tue, 6 Nov 2018 15:29:11 +0000 Subject: [PATCH 094/223] test: add else and error case for TextDecoder add test for tinyurl.com/codeandlearn-encoding-1 add test for tinyurl.com/codeandlearn-encoding-2 PR-URL: https://github.com/nodejs/node/pull/24162 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater --- .../test-whatwg-encoding-textdecoder-fatal.js | 12 ++++++++++++ test/parallel/test-whatwg-encoding-textdecoder.js | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/test/parallel/test-whatwg-encoding-textdecoder-fatal.js b/test/parallel/test-whatwg-encoding-textdecoder-fatal.js index cfb595e78e6b40..6d0ed1ef842d37 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder-fatal.js +++ b/test/parallel/test-whatwg-encoding-textdecoder-fatal.js @@ -91,3 +91,15 @@ bad.forEach((t) => { assert(!new TextDecoder().fatal); assert(new TextDecoder('utf-8', { fatal: true }).fatal); } + +{ + const notArrayBufferViewExamples = [false, {}, 1, '', new Error()]; + notArrayBufferViewExamples.forEach((invalidInputType) => { + common.expectsError(() => { + new TextDecoder(undefined, null).decode(invalidInputType); + }, { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); + }); +} diff --git a/test/parallel/test-whatwg-encoding-textdecoder.js b/test/parallel/test-whatwg-encoding-textdecoder.js index e87364de1e91f7..10f2c8ea0197e8 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-textdecoder.js @@ -76,6 +76,14 @@ if (common.hasIntl) { }); } +// Test TextDecoder, label undefined, options null +{ + const dec = new TextDecoder(undefined, null); + assert.strictEqual(dec.encoding, 'utf-8'); + assert.strictEqual(dec.fatal, false); + assert.strictEqual(dec.ignoreBOM, false); +} + // Test TextDecoder, UTF-16le { const dec = new TextDecoder('utf-16le'); From 87283615338fb89653e4f5a0ffaf32b9d62e4dd4 Mon Sep 17 00:00:00 2001 From: kiyomizumia Date: Tue, 6 Nov 2018 16:21:23 +0000 Subject: [PATCH 095/223] test: fixed order of actual and expected arguments PR-URL: https://github.com/nodejs/node/pull/24178 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/parallel/test-event-emitter-modify-in-emit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-event-emitter-modify-in-emit.js b/test/parallel/test-event-emitter-modify-in-emit.js index 9c28fecbdd8c4c..995fa01d11a1a8 100644 --- a/test/parallel/test-event-emitter-modify-in-emit.js +++ b/test/parallel/test-event-emitter-modify-in-emit.js @@ -74,7 +74,7 @@ callbacks_called = []; e.on('foo', callback2); e.on('foo', callback3); -assert.strictEqual(2, e.listeners('foo').length); +assert.strictEqual(e.listeners('foo').length, 2); e.emit('foo'); assert.deepStrictEqual(['callback2', 'callback3'], callbacks_called); -assert.strictEqual(0, e.listeners('foo').length); +assert.strictEqual(e.listeners('foo').length, 0); From 817d8713276a1314de9360f8f5433377da6bdccc Mon Sep 17 00:00:00 2001 From: Fran Herrero Date: Tue, 6 Nov 2018 16:36:32 +0000 Subject: [PATCH 096/223] test: esm loader unknown builtin module PR-URL: https://github.com/nodejs/node/pull/24183 Reviewed-By: James M Snell Reviewed-By: Gus Caplan Reviewed-By: Ruben Bridgewater --- .../loader-unknown-builtin-module.mjs | 6 ++++++ .../parallel/test-loaders-unknown-builtin-module.mjs | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs create mode 100644 test/parallel/test-loaders-unknown-builtin-module.mjs diff --git a/test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs b/test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs new file mode 100644 index 00000000000000..e7c6c8ff345617 --- /dev/null +++ b/test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs @@ -0,0 +1,6 @@ +export async function resolve(specifier, parent, defaultResolve) { + if (specifier === 'unknown-builtin-module') { + return { url: 'unknown-builtin-module', format: 'builtin' }; + } + return defaultResolve(specifier, parent); +} \ No newline at end of file diff --git a/test/parallel/test-loaders-unknown-builtin-module.mjs b/test/parallel/test-loaders-unknown-builtin-module.mjs new file mode 100644 index 00000000000000..db3cfa3582e9e2 --- /dev/null +++ b/test/parallel/test-loaders-unknown-builtin-module.mjs @@ -0,0 +1,12 @@ +// Flags: --experimental-modules --loader ./test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs +import { expectsError, mustCall } from '../common'; +import assert from 'assert'; + +const unknownBuiltinModule = 'unknown-builtin-module'; + +import(unknownBuiltinModule) +.then(assert.fail, expectsError({ + code: 'ERR_UNKNOWN_BUILTIN_MODULE', + message: `No such built-in module: ${unknownBuiltinModule}` +})) +.then(mustCall()); From d4fd76a782aa591de4a24baa55af4782fe2b8d9c Mon Sep 17 00:00:00 2001 From: Paul Hodgson Date: Fri, 9 Nov 2018 08:02:26 +0000 Subject: [PATCH 097/223] test: remove unused parameters in function definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unused parameters triggerAsyncId and resource from oninit function in test-async-await.js. PR-URL: https://github.com/nodejs/node/pull/24268 Reviewed-By: Weijia Wang Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Tobias Nießen --- test/async-hooks/test-async-await.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/async-hooks/test-async-await.js b/test/async-hooks/test-async-await.js index f5e886e9d50001..0103f63621e3ba 100644 --- a/test/async-hooks/test-async-await.js +++ b/test/async-hooks/test-async-await.js @@ -26,7 +26,7 @@ const hooks = initHooks({ }); hooks.enable(); -function oninit(asyncId, type, triggerAsyncId, resource) { +function oninit(asyncId, type) { if (type === 'PROMISE') { promisesInitState.set(asyncId, 'inited'); } From b29b23546dd09f2cb4b47279544a7ccb4808e92d Mon Sep 17 00:00:00 2001 From: Emanuel Kluge Date: Tue, 6 Nov 2018 16:15:02 +0100 Subject: [PATCH 098/223] test: fix arguments order in assertions Have the actual value first & the expected value second. PR-URL: https://github.com/nodejs/node/pull/24149 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/parallel/test-process-env.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-process-env.js b/test/parallel/test-process-env.js index 69379f60061985..60f4d6f4faf13b 100644 --- a/test/parallel/test-process-env.js +++ b/test/parallel/test-process-env.js @@ -26,12 +26,12 @@ const assert = require('assert'); // changes in environment should be visible to child processes if (process.argv[2] === 'you-are-the-child') { - assert.strictEqual(false, 'NODE_PROCESS_ENV_DELETED' in process.env); - assert.strictEqual('42', process.env.NODE_PROCESS_ENV); - assert.strictEqual('asdf', process.env.hasOwnProperty); + assert.strictEqual('NODE_PROCESS_ENV_DELETED' in process.env, false); + assert.strictEqual(process.env.NODE_PROCESS_ENV, '42'); + assert.strictEqual(process.env.hasOwnProperty, 'asdf'); const hasOwnProperty = Object.prototype.hasOwnProperty; const has = hasOwnProperty.call(process.env, 'hasOwnProperty'); - assert.strictEqual(true, has); + assert.strictEqual(has, true); process.exit(0); } @@ -41,18 +41,18 @@ if (process.argv[2] === 'you-are-the-child') { assert.strictEqual(Object.prototype.hasOwnProperty, process.env.hasOwnProperty); const has = process.env.hasOwnProperty('hasOwnProperty'); - assert.strictEqual(false, has); + assert.strictEqual(has, false); process.env.hasOwnProperty = 'asdf'; process.env.NODE_PROCESS_ENV = 42; - assert.strictEqual('42', process.env.NODE_PROCESS_ENV); + assert.strictEqual(process.env.NODE_PROCESS_ENV, '42'); process.env.NODE_PROCESS_ENV_DELETED = 42; - assert.strictEqual(true, 'NODE_PROCESS_ENV_DELETED' in process.env); + assert.strictEqual('NODE_PROCESS_ENV_DELETED' in process.env, true); delete process.env.NODE_PROCESS_ENV_DELETED; - assert.strictEqual(false, 'NODE_PROCESS_ENV_DELETED' in process.env); + assert.strictEqual('NODE_PROCESS_ENV_DELETED' in process.env, false); const child = spawn(process.argv[0], [process.argv[1], 'you-are-the-child']); child.stdout.on('data', function(data) { console.log(data.toString()); }); From 35d2397ae5fe3c3d44480f17f96359373cef0b35 Mon Sep 17 00:00:00 2001 From: Lauri Piisang Date: Tue, 6 Nov 2018 16:19:07 +0000 Subject: [PATCH 099/223] http: remove obsolete function escapeHeaderValue There are test cases which validate the useful path of the function never runs the functionality of it is obsoleted by checkInvalidHeaderChar PR-URL: https://github.com/nodejs/node/pull/24173 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- lib/_http_outgoing.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 67d0090d7dabf7..04a36d2be2fde3 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -409,7 +409,7 @@ function processHeader(self, state, key, value, validate) { function storeHeader(self, state, key, value, validate) { if (validate) validateHeaderValue(key, value); - state.header += key + ': ' + escapeHeaderValue(value) + CRLF; + state.header += key + ': ' + value + CRLF; matchHeader(self, state, key, value); } @@ -642,13 +642,6 @@ function connectionCorkNT(msg, conn) { } -function escapeHeaderValue(value) { - // Protect against response splitting. The regex test is there to - // minimize the performance impact in the common case. - return /[\r\n]/.test(value) ? value.replace(/[\r\n]+[ \t]*/g, '') : value; -} - - OutgoingMessage.prototype.addTrailers = function addTrailers(headers) { this._trailer = ''; var keys = Object.keys(headers); @@ -670,7 +663,7 @@ OutgoingMessage.prototype.addTrailers = function addTrailers(headers) { debug('Trailer "%s" contains invalid characters', field); throw new ERR_INVALID_CHAR('trailer content', field); } - this._trailer += field + ': ' + escapeHeaderValue(value) + CRLF; + this._trailer += field + ': ' + value + CRLF; } }; From a9a6cb1b06b79e6c3dc1c55d9b35ada6f6f769d2 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 7 Nov 2018 14:18:10 -0800 Subject: [PATCH 100/223] doc: fix echo example programs Adjust to work with self-signed certificates, and certificates that do not name "localhost" as their host name. Removed duplicate examples, they differed only by using `pfx`. Its not necessary to show every option, and we don't, and the example wouldn't work with most pfx anyway, since it didn't specify a password. PR-URL: https://github.com/nodejs/node/pull/24235 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Ujjwal Sharma Reviewed-By: Daniel Bevenius --- doc/api/tls.md | 77 ++++++++------------------------------------------ 1 file changed, 12 insertions(+), 65 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 12786e111b7ce6..4f97bd2b32dfa2 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -923,49 +923,24 @@ The `callback` function, if specified, will be added as a listener for the `tls.connect()` returns a [`tls.TLSSocket`][] object. -Here is an example of a client of echo server as described in +The following illustrates a client for the echo server example from [`tls.createServer()`][]: ```js -// This example assumes that you have created an echo server that is -// listening on port 8000. +// Assumes an echo server that is listening on port 8000. const tls = require('tls'); const fs = require('fs'); const options = { - // Necessary only if using the client certificate authentication + // Necessary only if the server requires client certificate authentication. key: fs.readFileSync('client-key.pem'), cert: fs.readFileSync('client-cert.pem'), - // Necessary only if the server uses the self-signed certificate - ca: [ fs.readFileSync('server-cert.pem') ] -}; + // Necessary only if the server uses a self-signed certificate. + ca: [ fs.readFileSync('server-cert.pem') ], -const socket = tls.connect(8000, options, () => { - console.log('client connected', - socket.authorized ? 'authorized' : 'unauthorized'); - process.stdin.pipe(socket); - process.stdin.resume(); -}); -socket.setEncoding('utf8'); -socket.on('data', (data) => { - console.log(data); -}); -socket.on('end', () => { - console.log('client ends'); -}); -``` - -Or - -```js -// This example assumes that you have created an echo server that is -// listening on port 8000. -const tls = require('tls'); -const fs = require('fs'); - -const options = { - pfx: fs.readFileSync('client.pfx') + // Necessary only if the server's cert isn't for "localhost". + checkServerIdentity: () => { return null; }, }; const socket = tls.connect(8000, options, () => { @@ -979,7 +954,7 @@ socket.on('data', (data) => { console.log(data); }); socket.on('end', () => { - console.log('client ends'); + console.log('server ends connection'); }); ``` @@ -1198,10 +1173,10 @@ const options = { key: fs.readFileSync('server-key.pem'), cert: fs.readFileSync('server-cert.pem'), - // This is necessary only if using the client certificate authentication. + // This is necessary only if using client certificate authentication. requestCert: true, - // This is necessary only if the client uses the self-signed certificate. + // This is necessary only if the client uses a self-signed certificate. ca: [ fs.readFileSync('client-cert.pem') ] }; @@ -1217,36 +1192,8 @@ server.listen(8000, () => { }); ``` -Or - -```js -const tls = require('tls'); -const fs = require('fs'); - -const options = { - pfx: fs.readFileSync('server.pfx'), - - // This is necessary only if using the client certificate authentication. - requestCert: true, -}; - -const server = tls.createServer(options, (socket) => { - console.log('server connected', - socket.authorized ? 'authorized' : 'unauthorized'); - socket.write('welcome!\n'); - socket.setEncoding('utf8'); - socket.pipe(socket); -}); -server.listen(8000, () => { - console.log('server bound'); -}); -``` - -This server can be tested by connecting to it using `openssl s_client`: - -```sh -openssl s_client -connect 127.0.0.1:8000 -``` +The server can be tested by connecting to it using the example client from +[`tls.connect()`][]. ## tls.getCiphers() ` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // ` - - - -Implementation of function.prototype.bind - -## Example - -I mainly do this for unit tests I run on phantomjs. -PhantomJS does not have Function.prototype.bind :( - -```js -Function.prototype.bind = require("function-bind") -``` - -## Installation - -`npm install function-bind` - -## Contributors - - - Raynos - -## MIT Licenced - - [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg - [travis-url]: https://travis-ci.org/Raynos/function-bind - [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg - [npm-url]: https://npmjs.org/package/function-bind - [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png - [6]: https://coveralls.io/r/Raynos/function-bind - [7]: https://gemnasium.com/Raynos/function-bind.png - [8]: https://gemnasium.com/Raynos/function-bind - [deps-svg]: https://david-dm.org/Raynos/function-bind.svg - [deps-url]: https://david-dm.org/Raynos/function-bind - [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg - [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies - [11]: https://ci.testling.com/Raynos/function-bind.png - [12]: https://ci.testling.com/Raynos/function-bind diff --git a/tools/node_modules/eslint/node_modules/function-bind/implementation.js b/tools/node_modules/eslint/node_modules/function-bind/implementation.js deleted file mode 100644 index cc4daec1b080a1..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/implementation.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -/* eslint no-invalid-this: 1 */ - -var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; -var slice = Array.prototype.slice; -var toStr = Object.prototype.toString; -var funcType = '[object Function]'; - -module.exports = function bind(that) { - var target = this; - if (typeof target !== 'function' || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - - var bound; - var binder = function () { - if (this instanceof bound) { - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - } - }; - - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push('$' + i); - } - - bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); - - if (target.prototype) { - var Empty = function Empty() {}; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - - return bound; -}; diff --git a/tools/node_modules/eslint/node_modules/function-bind/index.js b/tools/node_modules/eslint/node_modules/function-bind/index.js deleted file mode 100644 index 3bb6b9609889f8..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var implementation = require('./implementation'); - -module.exports = Function.prototype.bind || implementation; diff --git a/tools/node_modules/eslint/node_modules/function-bind/package.json b/tools/node_modules/eslint/node_modules/function-bind/package.json deleted file mode 100644 index 6574255758b8bc..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "bugs": { - "url": "https://github.com/Raynos/function-bind/issues", - "email": "raynos2@gmail.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Raynos" - }, - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "Implementation of Function.prototype.bind", - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "covert": "^1.1.0", - "eslint": "^4.5.0", - "jscs": "^3.0.7", - "tape": "^4.8.0" - }, - "homepage": "https://github.com/Raynos/function-bind", - "keywords": [ - "function", - "bind", - "shim", - "es5" - ], - "license": "MIT", - "main": "index", - "name": "function-bind", - "repository": { - "type": "git", - "url": "git://github.com/Raynos/function-bind.git" - }, - "scripts": { - "coverage": "covert test/*.js", - "eslint": "eslint *.js */*.js", - "jscs": "jscs *.js */*.js", - "lint": "npm run jscs && npm run eslint", - "posttest": "npm run coverage -- --quiet", - "pretest": "npm run lint", - "test": "npm run tests-only", - "tests-only": "node test" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "version": "1.1.1" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/globby/index.js b/tools/node_modules/eslint/node_modules/globby/index.js index 39da9f64d1ee42..587a0fdd1cc0fb 100644 --- a/tools/node_modules/eslint/node_modules/globby/index.js +++ b/tools/node_modules/eslint/node_modules/globby/index.js @@ -3,7 +3,6 @@ var Promise = require('pinkie-promise'); var arrayUnion = require('array-union'); var objectAssign = require('object-assign'); var glob = require('glob'); -var arrify = require('arrify'); var pify = require('pify'); var globP = pify(glob, Promise).bind(glob); @@ -12,10 +11,22 @@ function isNegative(pattern) { return pattern[0] === '!'; } +function isString(value) { + return typeof value === 'string'; +} + +function assertPatternsInput(patterns) { + if (!patterns.every(isString)) { + throw new TypeError('patterns must be a string or an array of strings'); + } +} + function generateGlobTasks(patterns, opts) { + patterns = [].concat(patterns); + assertPatternsInput(patterns); + var globTasks = []; - patterns = arrify(patterns); opts = objectAssign({ cache: Object.create(null), statCache: Object.create(null), @@ -45,7 +56,13 @@ function generateGlobTasks(patterns, opts) { } module.exports = function (patterns, opts) { - var globTasks = generateGlobTasks(patterns, opts); + var globTasks; + + try { + globTasks = generateGlobTasks(patterns, opts); + } catch (err) { + return Promise.reject(err); + } return Promise.all(globTasks.map(function (task) { return globP(task.pattern, task.opts); @@ -63,3 +80,9 @@ module.exports.sync = function (patterns, opts) { }; module.exports.generateGlobTasks = generateGlobTasks; + +module.exports.hasMagic = function (patterns, opts) { + return [].concat(patterns).some(function (pattern) { + return glob.hasMagic(pattern, opts); + }); +}; diff --git a/tools/node_modules/eslint/node_modules/globby/node_modules/pify/index.js b/tools/node_modules/eslint/node_modules/globby/node_modules/pify/index.js new file mode 100644 index 00000000000000..7c720ebee88727 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/globby/node_modules/pify/index.js @@ -0,0 +1,68 @@ +'use strict'; + +var processFn = function (fn, P, opts) { + return function () { + var that = this; + var args = new Array(arguments.length); + + for (var i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return new P(function (resolve, reject) { + args.push(function (err, result) { + if (err) { + reject(err); + } else if (opts.multiArgs) { + var results = new Array(arguments.length - 1); + + for (var i = 1; i < arguments.length; i++) { + results[i - 1] = arguments[i]; + } + + resolve(results); + } else { + resolve(result); + } + }); + + fn.apply(that, args); + }); + }; +}; + +var pify = module.exports = function (obj, P, opts) { + if (typeof P !== 'function') { + opts = P; + P = Promise; + } + + opts = opts || {}; + opts.exclude = opts.exclude || [/.+Sync$/]; + + var filter = function (key) { + var match = function (pattern) { + return typeof pattern === 'string' ? key === pattern : pattern.test(key); + }; + + return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + }; + + var ret = typeof obj === 'function' ? function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } + + return processFn(obj, P, opts).apply(this, arguments); + } : {}; + + return Object.keys(obj).reduce(function (ret, key) { + var x = obj[key]; + + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x; + + return ret; + }, ret); +}; + +pify.all = pify; diff --git a/tools/node_modules/eslint/node_modules/arrify/license b/tools/node_modules/eslint/node_modules/globby/node_modules/pify/license similarity index 100% rename from tools/node_modules/eslint/node_modules/arrify/license rename to tools/node_modules/eslint/node_modules/globby/node_modules/pify/license diff --git a/tools/node_modules/eslint/node_modules/globby/node_modules/pify/package.json b/tools/node_modules/eslint/node_modules/globby/node_modules/pify/package.json new file mode 100644 index 00000000000000..40780115cf1d0a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/globby/node_modules/pify/package.json @@ -0,0 +1,57 @@ +{ + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/pify/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Promisify a callback-style function", + "devDependencies": { + "ava": "*", + "pinkie-promise": "^1.0.0", + "v8-natives": "0.0.2", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/pify#readme", + "keywords": [ + "promise", + "promises", + "promisify", + "denodify", + "denodeify", + "callback", + "cb", + "node", + "then", + "thenify", + "convert", + "transform", + "wrap", + "wrapper", + "bind", + "to", + "async", + "es2015" + ], + "license": "MIT", + "name": "pify", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/pify.git" + }, + "scripts": { + "optimization-test": "node --allow-natives-syntax optimization-test.js", + "test": "xo && ava && npm run optimization-test" + }, + "version": "2.3.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/globby/node_modules/pify/readme.md b/tools/node_modules/eslint/node_modules/globby/node_modules/pify/readme.md new file mode 100644 index 00000000000000..97aeeb628b0897 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/globby/node_modules/pify/readme.md @@ -0,0 +1,119 @@ +# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) + +> Promisify a callback-style function + + +## Install + +``` +$ npm install --save pify +``` + + +## Usage + +```js +const fs = require('fs'); +const pify = require('pify'); + +// promisify a single function + +pify(fs.readFile)('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); + +// or promisify all methods in a module + +pify(fs).readFile('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); +``` + + +## API + +### pify(input, [promiseModule], [options]) + +Returns a promise wrapped version of the supplied function or module. + +#### input + +Type: `function`, `object` + +Callback-style function or module whose methods you want to promisify. + +#### promiseModule + +Type: `function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + +#### options + +##### multiArgs + +Type: `boolean` +Default: `false` + +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. + +```js +const request = require('request'); +const pify = require('pify'); + +pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { + const [httpResponse, body] = result; +}); +``` + +##### include + +Type: `array` of (`string`|`regex`) + +Methods in a module to promisify. Remaining methods will be left untouched. + +##### exclude + +Type: `array` of (`string`|`regex`) +Default: `[/.+Sync$/]` + +Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. + +##### excludeMain + +Type: `boolean` +Default: `false` + +By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module. + +```js +const pify = require('pify'); + +function fn() { + return true; +} + +fn.method = (data, callback) => { + setImmediate(() => { + callback(data, null); + }); +}; + +// promisify methods but not fn() +const promiseFn = pify(fn, {excludeMain: true}); + +if (promiseFn()) { + promiseFn.method('hi').then(data => { + console.log(data); + }); +} +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/tools/node_modules/eslint/node_modules/globby/package.json b/tools/node_modules/eslint/node_modules/globby/package.json index 34b15123bb0008..fad7fc179674cb 100644 --- a/tools/node_modules/eslint/node_modules/globby/package.json +++ b/tools/node_modules/eslint/node_modules/globby/package.json @@ -10,7 +10,6 @@ "bundleDependencies": false, "dependencies": { "array-union": "^1.0.1", - "arrify": "^1.0.0", "glob": "^7.0.3", "object-assign": "^4.0.1", "pify": "^2.0.0", @@ -20,11 +19,11 @@ "description": "Extends `glob` with support for multiple patterns and exposes a Promise API", "devDependencies": { "ava": "*", - "glob-stream": "github:wearefractal/glob-stream#master", + "glob-stream": "github:gulpjs/glob-stream#master", "globby": "github:sindresorhus/globby#master", "matcha": "^0.7.0", "rimraf": "^2.2.8", - "xo": "*" + "xo": "^0.16.0" }, "engines": { "node": ">=0.10.0" @@ -72,8 +71,8 @@ "url": "git+https://github.com/sindresorhus/globby.git" }, "scripts": { - "bench": "npm update globby glob-stream && matcha bench.js", + "bench": "npm update glob-stream && matcha bench.js", "test": "xo && ava" }, - "version": "5.0.0" + "version": "6.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/globby/readme.md b/tools/node_modules/eslint/node_modules/globby/readme.md index aad991d020b1b5..e10a48868f9e29 100644 --- a/tools/node_modules/eslint/node_modules/globby/readme.md +++ b/tools/node_modules/eslint/node_modules/globby/readme.md @@ -42,11 +42,17 @@ Returns an array of matching paths. Returns an array of objects in the format `{ pattern: string, opts: Object }`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages. -Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, create a new tasks list to ensure that file system changes are taken in consideration. +Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration. + +### globby.hasMagic(patterns, [options]) + +Returns a `boolean` of whether there are any special glob characters in the `patterns`. + +Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, then that is considered magical, unless `nobrace: true` is set. #### patterns -Type: `string`, `Array` +Type: `string` `Array` See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). diff --git a/tools/node_modules/eslint/node_modules/graceful-fs/fs.js b/tools/node_modules/eslint/node_modules/graceful-fs/clone.js similarity index 88% rename from tools/node_modules/eslint/node_modules/graceful-fs/fs.js rename to tools/node_modules/eslint/node_modules/graceful-fs/clone.js index 8ad4a383965b7b..028356c96ed536 100644 --- a/tools/node_modules/eslint/node_modules/graceful-fs/fs.js +++ b/tools/node_modules/eslint/node_modules/graceful-fs/clone.js @@ -1,8 +1,6 @@ 'use strict' -var fs = require('fs') - -module.exports = clone(fs) +module.exports = clone function clone (obj) { if (obj === null || typeof obj !== 'object') diff --git a/tools/node_modules/eslint/node_modules/graceful-fs/graceful-fs.js b/tools/node_modules/eslint/node_modules/graceful-fs/graceful-fs.js index 33b30d2e986eba..ac206757e63c5a 100644 --- a/tools/node_modules/eslint/node_modules/graceful-fs/graceful-fs.js +++ b/tools/node_modules/eslint/node_modules/graceful-fs/graceful-fs.js @@ -1,6 +1,8 @@ var fs = require('fs') var polyfills = require('./polyfills.js') var legacy = require('./legacy-streams.js') +var clone = require('./clone.js') + var queue = [] var util = require('util') @@ -24,17 +26,17 @@ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { }) } -module.exports = patch(require('./fs.js')) -if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { - module.exports = patch(fs) +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; } // Always patch fs.close/closeSync, because we want to // retry() whenever a close happens *anywhere* in the program. // This is essential when multiple graceful-fs instances are // in play at the same time. -module.exports.close = -fs.close = (function (fs$close) { return function (fd, cb) { +module.exports.close = (function (fs$close) { return function (fd, cb) { return fs$close.call(fs, fd, function (err) { if (!err) retry() @@ -44,8 +46,7 @@ fs.close = (function (fs$close) { return function (fd, cb) { }) }})(fs.close) -module.exports.closeSync = -fs.closeSync = (function (fs$closeSync) { return function (fd) { +module.exports.closeSync = (function (fs$closeSync) { return function (fd) { // Note that graceful-fs also retries when fs.closeSync() fails. // Looks like a bug to me, although it's probably a harmless one. var rval = fs$closeSync.apply(fs, arguments) @@ -53,6 +54,17 @@ fs.closeSync = (function (fs$closeSync) { return function (fd) { return rval }})(fs.closeSync) +// Only patch fs once, otherwise we'll run into a memory leak if +// graceful-fs is loaded multiple times, such as in test environments that +// reset the loaded modules between tests. +// We look for the string `graceful-fs` from the comment above. This +// way we are not adding any extra properties and it will detect if older +// versions of graceful-fs are installed. +if (!/\bgraceful-fs\b/.test(fs.closeSync.toString())) { + fs.closeSync = module.exports.closeSync; + fs.close = module.exports.close; +} + function patch (fs) { // Everything that references the open() function needs to be in here polyfills(fs) @@ -144,6 +156,7 @@ function patch (fs) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) enqueue([go$readdir, [args]]) + else { if (typeof cb === 'function') cb.apply(this, arguments) @@ -163,12 +176,16 @@ function patch (fs) { } var fs$ReadStream = fs.ReadStream - ReadStream.prototype = Object.create(fs$ReadStream.prototype) - ReadStream.prototype.open = ReadStream$open + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } var fs$WriteStream = fs.WriteStream - WriteStream.prototype = Object.create(fs$WriteStream.prototype) - WriteStream.prototype.open = WriteStream$open + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } fs.ReadStream = ReadStream fs.WriteStream = WriteStream diff --git a/tools/node_modules/eslint/node_modules/graceful-fs/package.json b/tools/node_modules/eslint/node_modules/graceful-fs/package.json index ea35fce0aa2359..b585bfe22fd54f 100644 --- a/tools/node_modules/eslint/node_modules/graceful-fs/package.json +++ b/tools/node_modules/eslint/node_modules/graceful-fs/package.json @@ -6,21 +6,20 @@ "deprecated": false, "description": "A drop-in replacement for fs, making various improvements.", "devDependencies": { + "import-fresh": "^2.0.0", "mkdirp": "^0.5.0", "rimraf": "^2.2.8", - "tap": "^5.4.2" + "tap": "^12.0.1" }, "directories": { "test": "test" }, - "engines": { - "node": ">=0.4.0" - }, "files": [ "fs.js", "graceful-fs.js", "legacy-streams.js", - "polyfills.js" + "polyfills.js", + "clone.js" ], "homepage": "https://github.com/isaacs/node-graceful-fs#readme", "keywords": [ @@ -47,7 +46,10 @@ "url": "git+https://github.com/isaacs/node-graceful-fs.git" }, "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", "test": "node test.js | tap -" }, - "version": "4.1.11" + "version": "4.1.15" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/graceful-fs/polyfills.js b/tools/node_modules/eslint/node_modules/graceful-fs/polyfills.js index 4c6aca78a3dc8b..b964ed0806ceeb 100644 --- a/tools/node_modules/eslint/node_modules/graceful-fs/polyfills.js +++ b/tools/node_modules/eslint/node_modules/graceful-fs/polyfills.js @@ -1,4 +1,3 @@ -var fs = require('./fs.js') var constants = require('constants') var origCwd = process.cwd @@ -145,73 +144,36 @@ function patch (fs) { } } }})(fs.readSync) -} - -function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } - - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) - - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } -} -function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) return } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) }) }) }) } - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. var threw = true + var ret try { - ret = fs.futimesSync(fd, at, mt) + ret = fs.fchmodSync(fd, mode) threw = false } finally { if (threw) { @@ -224,107 +186,144 @@ function patchLutimes (fs) { } return ret } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK")) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} + } else { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } } -} -function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } } -} -function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } } } -} -function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } } -} -function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } } } -} -function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, cb) { - return orig.call(fs, target, function (er, stats) { - if (!stats) return cb.apply(this, arguments) + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, cb) { + return orig.call(fs, target, function (er, stats) { + if (!stats) return cb.apply(this, arguments) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + if (cb) cb.apply(this, arguments) + }) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target) { + var stats = orig.call(fs, target) if (stats.uid < 0) stats.uid += 0x100000000 if (stats.gid < 0) stats.gid += 0x100000000 - if (cb) cb.apply(this, arguments) - }) + return stats; + } } -} -function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target) { - var stats = orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - return stats; - } -} + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true -// ENOSYS means that the fs doesn't support the op. Just ignore -// that, because it doesn't matter. -// -// if there's no getuid, or if getuid() is something other -// than 0, and the error is EINVAL or EPERM, then just ignore -// it. -// -// This specific case is a silent failure in cp, install, tar, -// and most other unix tools that manage permissions. -// -// When running as root, or if other types of errors are -// encountered, then it's strict. -function chownErOk (er) { - if (!er) - return true - - if (er.code === "ENOSYS") - return true - - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") + if (er.code === "ENOSYS") return true - } - return false + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } } diff --git a/tools/node_modules/eslint/node_modules/has/LICENSE-MIT b/tools/node_modules/eslint/node_modules/has/LICENSE-MIT deleted file mode 100644 index ae7014d385df3d..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 Thiago de Arruda - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/has/README.md b/tools/node_modules/eslint/node_modules/has/README.md deleted file mode 100644 index 635e3a4baab00b..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# has - -> Object.prototype.hasOwnProperty.call shortcut - -## Installation - -```sh -npm install --save has -``` - -## Usage - -```js -var has = require('has'); - -has({}, 'hasOwnProperty'); // false -has(Object.prototype, 'hasOwnProperty'); // true -``` diff --git a/tools/node_modules/eslint/node_modules/has/package.json b/tools/node_modules/eslint/node_modules/has/package.json deleted file mode 100644 index 4b061b0e838104..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "author": { - "name": "Thiago de Arruda", - "email": "tpadilha84@gmail.com" - }, - "bugs": { - "url": "https://github.com/tarruda/has/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - } - ], - "dependencies": { - "function-bind": "^1.1.1" - }, - "deprecated": false, - "description": "Object.prototype.hasOwnProperty.call shortcut", - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "eslint": "^4.19.1", - "tape": "^4.9.0" - }, - "engines": { - "node": ">= 0.4.0" - }, - "homepage": "https://github.com/tarruda/has", - "license": "MIT", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" - } - ], - "main": "./src", - "name": "has", - "repository": { - "type": "git", - "url": "git://github.com/tarruda/has.git" - }, - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "tape test" - }, - "version": "1.0.3" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/has/src/index.js b/tools/node_modules/eslint/node_modules/has/src/index.js deleted file mode 100644 index dd92dd9094edb0..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/tools/node_modules/eslint/node_modules/p-map/index.js b/tools/node_modules/eslint/node_modules/p-map/index.js new file mode 100644 index 00000000000000..f91477e1f5b3f3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/p-map/index.js @@ -0,0 +1,67 @@ +'use strict'; +module.exports = (iterable, mapper, opts) => new Promise((resolve, reject) => { + opts = Object.assign({ + concurrency: Infinity + }, opts); + + if (typeof mapper !== 'function') { + throw new TypeError('Mapper function is required'); + } + + const concurrency = opts.concurrency; + + if (!(typeof concurrency === 'number' && concurrency >= 1)) { + throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`); + } + + const ret = []; + const iterator = iterable[Symbol.iterator](); + let isRejected = false; + let iterableDone = false; + let resolvingCount = 0; + let currentIdx = 0; + + const next = () => { + if (isRejected) { + return; + } + + const nextItem = iterator.next(); + const i = currentIdx; + currentIdx++; + + if (nextItem.done) { + iterableDone = true; + + if (resolvingCount === 0) { + resolve(ret); + } + + return; + } + + resolvingCount++; + + Promise.resolve(nextItem.value) + .then(el => mapper(el, i)) + .then( + val => { + ret[i] = val; + resolvingCount--; + next(); + }, + err => { + isRejected = true; + reject(err); + } + ); + }; + + for (let i = 0; i < concurrency; i++) { + next(); + + if (iterableDone) { + break; + } + } +}); diff --git a/tools/node_modules/eslint/node_modules/p-map/license b/tools/node_modules/eslint/node_modules/p-map/license new file mode 100644 index 00000000000000..e7af2f77107d73 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/p-map/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/p-map/package.json b/tools/node_modules/eslint/node_modules/p-map/package.json new file mode 100644 index 00000000000000..455e05c8bf2ebf --- /dev/null +++ b/tools/node_modules/eslint/node_modules/p-map/package.json @@ -0,0 +1,56 @@ +{ + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/p-map/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Map over promises concurrently", + "devDependencies": { + "ava": "*", + "delay": "^2.0.0", + "in-range": "^1.0.0", + "random-int": "^1.0.0", + "time-span": "^2.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/p-map#readme", + "keywords": [ + "promise", + "map", + "resolved", + "wait", + "collection", + "iterable", + "iterator", + "race", + "fulfilled", + "async", + "await", + "promises", + "concurrently", + "concurrency", + "parallel", + "bluebird" + ], + "license": "MIT", + "name": "p-map", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/p-map.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.2.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/p-map/readme.md b/tools/node_modules/eslint/node_modules/p-map/readme.md new file mode 100644 index 00000000000000..7727581a0e578c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/p-map/readme.md @@ -0,0 +1,81 @@ +# p-map [![Build Status](https://travis-ci.org/sindresorhus/p-map.svg?branch=master)](https://travis-ci.org/sindresorhus/p-map) + +> Map over promises concurrently + +Useful when you need to run promise-returning & async functions multiple times with different inputs concurrently. + + +## Install + +``` +$ npm install p-map +``` + + +## Usage + +```js +const pMap = require('p-map'); +const got = require('got'); + +const sites = [ + getWebsiteFromUsername('sindresorhus'), //=> Promise + 'ava.li', + 'todomvc.com', + 'github.com' +]; + +const mapper = el => got.head(el).then(res => res.requestUrl); + +pMap(sites, mapper, {concurrency: 2}).then(result => { + console.log(result); + //=> ['http://sindresorhus.com/', 'http://ava.li/', 'http://todomvc.com/', 'http://github.com/'] +}); +``` + + +## API + +### pMap(input, mapper, [options]) + +Returns a `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order. + +#### input + +Type: `Iterable` + +Iterated over concurrently in the `mapper` function. + +#### mapper(element, index) + +Type: `Function` + +Expected to return a `Promise` or value. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises returned by `mapper`. + + +## Related + +- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency +- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently +- [p-times](https://github.com/sindresorhus/p-times) - Run promise-returning & async functions a specific number of times concurrently +- [p-props](https://github.com/sindresorhus/p-props) - Like `Promise.all()` but for `Map` and `Object` +- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially +- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/tools/node_modules/eslint/node_modules/pify/index.js b/tools/node_modules/eslint/node_modules/pify/index.js index 7c720ebee88727..1dee43ad08f62b 100644 --- a/tools/node_modules/eslint/node_modules/pify/index.js +++ b/tools/node_modules/eslint/node_modules/pify/index.js @@ -1,68 +1,84 @@ 'use strict'; -var processFn = function (fn, P, opts) { - return function () { - var that = this; - var args = new Array(arguments.length); +const processFn = (fn, opts) => function () { + const P = opts.promiseModule; + const args = new Array(arguments.length); - for (var i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } + for (let i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } - return new P(function (resolve, reject) { + return new P((resolve, reject) => { + if (opts.errorFirst) { args.push(function (err, result) { - if (err) { - reject(err); - } else if (opts.multiArgs) { - var results = new Array(arguments.length - 1); + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); - for (var i = 1; i < arguments.length; i++) { + for (let i = 1; i < arguments.length; i++) { results[i - 1] = arguments[i]; } - resolve(results); + if (err) { + results.unshift(err); + reject(results); + } else { + resolve(results); + } + } else if (err) { + reject(err); } else { resolve(result); } }); + } else { + args.push(function (result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); - fn.apply(that, args); - }); - }; -}; + for (let i = 0; i < arguments.length; i++) { + results[i] = arguments[i]; + } -var pify = module.exports = function (obj, P, opts) { - if (typeof P !== 'function') { - opts = P; - P = Promise; - } + resolve(results); + } else { + resolve(result); + } + }); + } - opts = opts || {}; - opts.exclude = opts.exclude || [/.+Sync$/]; + fn.apply(this, args); + }); +}; - var filter = function (key) { - var match = function (pattern) { - return typeof pattern === 'string' ? key === pattern : pattern.test(key); - }; +module.exports = (obj, opts) => { + opts = Object.assign({ + exclude: [/.+(Sync|Stream)$/], + errorFirst: true, + promiseModule: Promise + }, opts); + const filter = key => { + const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); return opts.include ? opts.include.some(match) : !opts.exclude.some(match); }; - var ret = typeof obj === 'function' ? function () { - if (opts.excludeMain) { - return obj.apply(this, arguments); - } - - return processFn(obj, P, opts).apply(this, arguments); - } : {}; + let ret; + if (typeof obj === 'function') { + ret = function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } - return Object.keys(obj).reduce(function (ret, key) { - var x = obj[key]; + return processFn(obj, opts).apply(this, arguments); + }; + } else { + ret = Object.create(Object.getPrototypeOf(obj)); + } - ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x; + for (const key in obj) { // eslint-disable-line guard-for-in + const x = obj[key]; + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, opts) : x; + } - return ret; - }, ret); + return ret; }; - -pify.all = pify; diff --git a/tools/node_modules/eslint/node_modules/pify/license b/tools/node_modules/eslint/node_modules/pify/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/pify/license +++ b/tools/node_modules/eslint/node_modules/pify/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/pify/package.json b/tools/node_modules/eslint/node_modules/pify/package.json index 40780115cf1d0a..37d6bd41a0aeb6 100644 --- a/tools/node_modules/eslint/node_modules/pify/package.json +++ b/tools/node_modules/eslint/node_modules/pify/package.json @@ -12,12 +12,12 @@ "description": "Promisify a callback-style function", "devDependencies": { "ava": "*", - "pinkie-promise": "^1.0.0", - "v8-natives": "0.0.2", + "pinkie-promise": "^2.0.0", + "v8-natives": "^1.0.0", "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -27,6 +27,7 @@ "promise", "promises", "promisify", + "all", "denodify", "denodeify", "callback", @@ -41,7 +42,9 @@ "bind", "to", "async", - "es2015" + "await", + "es2015", + "bluebird" ], "license": "MIT", "name": "pify", @@ -53,5 +56,5 @@ "optimization-test": "node --allow-natives-syntax optimization-test.js", "test": "xo && ava && npm run optimization-test" }, - "version": "2.3.0" + "version": "3.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/pify/readme.md b/tools/node_modules/eslint/node_modules/pify/readme.md index c79ca8bf643927..376ca4e59d74c4 100644 --- a/tools/node_modules/eslint/node_modules/pify/readme.md +++ b/tools/node_modules/eslint/node_modules/pify/readme.md @@ -16,15 +16,13 @@ $ npm install --save pify const fs = require('fs'); const pify = require('pify'); -// promisify a single function - +// Promisify a single function pify(fs.readFile)('package.json', 'utf8').then(data => { console.log(JSON.parse(data).name); //=> 'pify' }); -// or promisify all methods in a module - +// Promisify all methods in a module pify(fs).readFile('package.json', 'utf8').then(data => { console.log(JSON.parse(data).name); //=> 'pify' @@ -34,32 +32,24 @@ pify(fs).readFile('package.json', 'utf8').then(data => { ## API -### pify(input, [promiseModule], [options]) +### pify(input, [options]) -Returns a promise wrapped version of the supplied function or module. +Returns a `Promise` wrapped version of the supplied function or module. #### input -Type: `function`, `object` +Type: `Function` `Object` Callback-style function or module whose methods you want to promisify. -#### promiseModule - -Type: `function` - -Custom promise module to use instead of the native one. - -Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. - #### options ##### multiArgs -Type: `boolean` +Type: `boolean`
Default: `false` -By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error. ```js const request = require('request'); @@ -72,23 +62,23 @@ pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { ##### include -Type: `array` of (`string`|`regex`) +Type: `string[]` `RegExp[]` Methods in a module to promisify. Remaining methods will be left untouched. ##### exclude -Type: `array` of (`string`|`regex`) -Default: `[/.+Sync$/]` +Type: `string[]` `RegExp[]`
+Default: `[/.+(Sync|Stream)$/]` Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. ##### excludeMain -Type: `boolean` +Type: `boolean`
Default: `false` -By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module. +If given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module. ```js const pify = require('pify'); @@ -99,11 +89,11 @@ function fn() { fn.method = (data, callback) => { setImmediate(() => { - callback(data, null); + callback(null, data); }); }; -// promisify methods but not fn() +// Promisify methods but not `fn()` const promiseFn = pify(fn, {excludeMain: true}); if (promiseFn()) { @@ -113,7 +103,29 @@ if (promiseFn()) { } ``` +##### errorFirst + +Type: `boolean`
+Default: `true` + +Whether the callback has an error as the first argument. You'll want to set this to `false` if you're dealing with an API that doesn't have an error as the first argument, like `fs.exists()`, some browser APIs, Chrome Extension APIs, etc. + +##### promiseModule + +Type: `Function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + + +## Related + +- [p-event](https://github.com/sindresorhus/p-event) - Promisify an event by waiting for it to be emitted +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [More…](https://github.com/sindresorhus/promise-fun) + ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/decode.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/decode.js index 75116385eed36c..fd45b729d069e1 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/decode.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/decode.js @@ -1,13 +1,6 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:decode - * @fileoverview Decode entities. - */ - 'use strict'; +var xtend = require('xtend'); var entities = require('parse-entities'); module.exports = factory; @@ -62,10 +55,10 @@ function factory(ctx) { } /* Decode `value` (at `position`) into a string. */ - function decodeRaw(value, position) { - return entities(value, { + function decodeRaw(value, position, options) { + return entities(value, xtend(options, { position: normalize(position), warning: handleWarning - }); + })); } } diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/defaults.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/defaults.js index ccb3fabd485901..37846f3930a35a 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/defaults.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/defaults.js @@ -1,21 +1,10 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:defaults - * @fileoverview Default options for `parse`. - */ - 'use strict'; -/* Expose. */ module.exports = { position: true, gfm: true, - yaml: true, commonmark: false, footnotes: false, pedantic: false, - blocks: require('./block-elements'), - breaks: false + blocks: require('./block-elements.json') }; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/break.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/break.js index b5550e10076605..295bdc9855126e 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/break.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/break.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:break - * @fileoverview Locate a break. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/code-inline.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/code-inline.js index 010e74dcec4b00..981c81698254fe 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/code-inline.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/code-inline.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:code-inline - * @fileoverview Locate inline code. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/delete.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/delete.js index 1a892e1be7716e..d208aef2fff386 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/delete.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/delete.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:delete - * @fileoverview Locate strikethrough. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/emphasis.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/emphasis.js index 270daad0f9e00c..6a1f24227d05bb 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/emphasis.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/emphasis.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:emphasis - * @fileoverview Locate italics / emphasis. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/escape.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/escape.js index 45f9b449a7873c..f6c63715827ef3 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/escape.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/escape.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:escape - * @fileoverview Locate an escape. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js index dab2a3c54f1774..0f16fd8016bd36 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:link - * @fileoverview Locate a link. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/strong.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/strong.js index 717259f36eae22..da1cac0a499f2e 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/strong.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/strong.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:strong - * @fileoverview Locate bold / strong / importance. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/tag.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/tag.js index 56e2d49e564587..3c5534268abe1d 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/tag.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/tag.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:tag - * @fileoverview Locate a tag. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/url.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/url.js index 53b239241c104a..59b63e2563693e 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/url.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/url.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:locate:url - * @fileoverview Locate a URL. - */ - 'use strict'; module.exports = locate; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/parse.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/parse.js index 53a50b181e67d4..5a8d8119556792 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/parse.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/parse.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:parse - * @fileoverview Parse the document - */ - 'use strict'; var xtend = require('xtend'); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/parser.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/parser.js index 8fe982b661c41c..9291109f16f3ec 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/parser.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/parser.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse - * @fileoverview Markdown parser. - */ - 'use strict'; var xtend = require('xtend'); @@ -17,7 +9,6 @@ var tokenizer = require('./tokenizer'); module.exports = Parser; -/* Construct a new parser. */ function Parser(doc, file) { this.file = file; this.offset = {}; @@ -34,7 +25,6 @@ function Parser(doc, file) { this.decode = decode(this); } -/* Prototype. */ var proto = Parser.prototype; /* Expose core. */ @@ -80,6 +70,7 @@ proto.interruptParagraph = [ * In the above example, the thematic break “interupts” * the list. */ proto.interruptList = [ + ['atxHeading', {pedantic: false}], ['fencedCode', {pedantic: false}], ['thematicBreak', {pedantic: false}], ['definition', {commonmark: false}], @@ -109,7 +100,6 @@ proto.interruptBlockquote = [ /* Handlers. */ proto.blockTokenizers = { - yamlFrontMatter: require('./tokenize/yaml'), newline: require('./tokenize/newline'), indentedCode: require('./tokenize/code-indented'), fencedCode: require('./tokenize/code-fenced'), diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/set-options.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/set-options.js index 3f9abad7c49a06..c55f7f32f31def 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/set-options.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/set-options.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse - * @fileoverview Markdown parser. - */ - 'use strict'; var xtend = require('xtend'); @@ -14,7 +6,6 @@ var defaults = require('./defaults'); module.exports = setOptions; -/* Set options. */ function setOptions(options) { var self = this; var current = self.options; @@ -43,10 +34,7 @@ function setOptions(options) { (key !== 'blocks' && typeof value !== 'boolean') || (key === 'blocks' && typeof value !== 'object') ) { - throw new Error( - 'Invalid value `' + value + '` ' + - 'for setting `options.' + key + '`' - ); + throw new Error('Invalid value `' + value + '` for setting `options.' + key + '`'); } options[key] = value; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js index 3861b48a14aead..c945a2c1f88f58 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js @@ -1,13 +1,6 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:auto-link - * @fileoverview Tokenise an auto-link. - */ - 'use strict'; +var whitespace = require('is-whitespace-character'); var decode = require('parse-entities'); var locate = require('../locate/tag'); @@ -34,7 +27,7 @@ function autoLink(eat, value, silent) { var link; var now; var content; - var tokenize; + var tokenizers; var exit; if (value.charAt(0) !== C_LT) { @@ -56,7 +49,7 @@ function autoLink(eat, value, silent) { character = value.charAt(index); if ( - character === ' ' || + whitespace(character) || character === C_GT || character === C_AT_SIGN || (character === ':' && value.charAt(index + 1) === C_SLASH) @@ -96,7 +89,7 @@ function autoLink(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === ' ' || character === C_GT) { + if (whitespace(character) || character === C_GT) { break; } @@ -132,20 +125,21 @@ function autoLink(eat, value, silent) { } } - /* Temporarily remove support for escapes in autolinks. */ - tokenize = self.inlineTokenizers.escape; - self.inlineTokenizers.escape = null; + /* Temporarily remove all tokenizers except text in autolinks. */ + tokenizers = self.inlineTokenizers; + self.inlineTokenizers = {text: tokenizers.text}; + exit = self.enterLink(); content = self.tokenizeInline(content, now); - self.inlineTokenizers.escape = tokenize; + self.inlineTokenizers = tokenizers; exit(); return eat(subvalue)({ type: 'link', title: null, - url: decode(link), + url: decode(link, {nonTerminated: false}), children: content }); } diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js index 764e0aa010392c..bd700d6a6c8276 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:blockquote - * @fileoverview Tokenise blockquote. - */ - 'use strict'; var trim = require('trim'); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/break.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/break.js index 6d2d0dcff9552b..eb531342bfebcb 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/break.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/break.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:break - * @fileoverview Tokenise a break. - */ - 'use strict'; var locate = require('../locate/break'); @@ -15,10 +7,7 @@ hardBreak.locator = locate; var MIN_BREAK_LENGTH = 2; -/* Tokenise a break. */ function hardBreak(eat, value, silent) { - var self = this; - var breaks = self.options.breaks; var length = value.length; var index = -1; var queue = ''; @@ -28,7 +17,7 @@ function hardBreak(eat, value, silent) { character = value.charAt(index); if (character === '\n') { - if (!breaks && index < MIN_BREAK_LENGTH) { + if (index < MIN_BREAK_LENGTH) { return; } diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js index f2577405b26587..65f2bc73273ab3 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:code-fenced - * @fileoverview Tokenise fenced code. - */ - 'use strict'; var trim = require('trim-trailing-lines'); @@ -21,7 +13,6 @@ var C_TICK = '`'; var MIN_FENCE_COUNT = 3; var CODE_INDENT_COUNT = 4; -/* Tokenise fenced code. */ function fencedCode(eat, value, silent) { var self = this; var settings = self.options; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js index 50c581fe26e2e4..c73849d9ad8bf2 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:code-indented - * @fileoverview Tokenise indented code. - */ - 'use strict'; var repeat = require('repeat-string'); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js index 9157412753ad1a..c0a496b49255ba 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:code-inline - * @fileoverview Tokenise inline code. - */ - 'use strict'; var whitespace = require('is-whitespace-character'); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/definition.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/definition.js index 3f7345a2c901c8..1cce274cfbdd71 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/definition.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/definition.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:definition - * @fileoverview Tokenise a definition. - */ - 'use strict'; var whitespace = require('is-whitespace-character'); @@ -29,7 +21,6 @@ var C_COLON = ':'; var C_LT = '<'; var C_GT = '>'; -/* Tokenise a definition. */ function definition(eat, value, silent) { var self = this; var commonmark = self.options.commonmark; @@ -254,7 +245,7 @@ function definition(eat, value, silent) { } beforeURL = eat(beforeURL).test().end; - url = self.decode.raw(self.unescape(url), beforeURL); + url = self.decode.raw(self.unescape(url), beforeURL, {nonTerminated: false}); if (title) { beforeTitle = eat(beforeTitle).test().end; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/delete.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/delete.js index 60ae9c4936c61f..ca7c68a8c5c1be 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/delete.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/delete.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:delete - * @fileoverview Tokenise strikethrough. - */ - 'use strict'; var whitespace = require('is-whitespace-character'); @@ -17,7 +9,6 @@ strikethrough.locator = locate; var C_TILDE = '~'; var DOUBLE = '~~'; -/* Tokenise strikethrough. */ function strikethrough(eat, value, silent) { var self = this; var character = ''; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js index 46249369224bc5..b2c87b4497de38 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:emphasis - * @fileoverview Tokenise emphasis. - */ - 'use strict'; var trim = require('trim'); @@ -19,7 +11,6 @@ emphasis.locator = locate; var C_ASTERISK = '*'; var C_UNDERSCORE = '_'; -/* Tokenise emphasis. */ function emphasis(eat, value, silent) { var self = this; var index = 0; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/escape.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/escape.js index 3e41a4cec5e6ea..d6f99bcc10381d 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/escape.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/escape.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:escape - * @fileoverview Tokenise an escape. - */ - 'use strict'; var locate = require('../locate/escape'); @@ -13,7 +5,6 @@ var locate = require('../locate/escape'); module.exports = escape; escape.locator = locate; -/* Tokenise an escape. */ function escape(eat, value, silent) { var self = this; var character; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js index 3537ccb6115017..f48ff9bb7eb187 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:footnote-definition - * @fileoverview Tokenise footnote definition. - */ - 'use strict'; var whitespace = require('is-whitespace-character'); @@ -26,7 +18,6 @@ var C_COLON = ':'; var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm; -/* Tokenise a footnote definition. */ function footnoteDefinition(eat, value, silent) { var self = this; var offsets = self.offset; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js index e5fdedc537ad0b..aafeabb54910f6 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:heading-atx - * @fileoverview Tokenise an ATX-style heading. - */ - 'use strict'; module.exports = atxHeading; @@ -17,7 +9,6 @@ var C_HASH = '#'; var MAX_ATX_COUNT = 6; -/* Tokenise an ATX-style heading. */ function atxHeading(eat, value, silent) { var self = this; var settings = self.options; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js index db8bbcfb73c2c9..96c6130da744e1 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:heading-setext - * @fileoverview Tokenise an setext-style heading. - */ - 'use strict'; module.exports = setextHeading; @@ -25,7 +17,6 @@ var SETEXT_MARKERS = {}; SETEXT_MARKERS[C_EQUALS] = 1; SETEXT_MARKERS[C_DASH] = 2; -/* Tokenise an setext-style heading. */ function setextHeading(eat, value, silent) { var self = this; var now = eat.now(); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-block.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-block.js index dc861b53c3a37b..6e81eb290a3993 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-block.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-block.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:html-block - * @fileoverview Tokenise block HTML. - */ - 'use strict'; var openCloseTag = require('../util/html').openCloseTag; @@ -17,7 +9,6 @@ var C_SPACE = ' '; var C_NEWLINE = '\n'; var C_LT = '<'; -/* Tokenise block HTML. */ function blockHTML(eat, value, silent) { var self = this; var blocks = self.options.blocks; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js index d8c0b9ab21829a..c204e962b15ae8 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:html-inline - * @fileoverview Tokenise inline HTML. - */ - 'use strict'; var alphabetical = require('is-alphabetical'); @@ -18,7 +10,6 @@ inlineHTML.locator = locate; var EXPRESSION_HTML_LINK_OPEN = /^/i; -/* Tokenise inline HTML. */ function inlineHTML(eat, value, silent) { var self = this; var length = value.length; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/link.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/link.js index fb11c5099054df..3ef5e1ba312d75 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/link.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/link.js @@ -1,20 +1,13 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:link - * @fileoverview Tokenise a link. - */ - 'use strict'; -var has = require('has'); var whitespace = require('is-whitespace-character'); var locate = require('../locate/link'); module.exports = link; link.locator = locate; +var own = {}.hasOwnProperty; + var C_BACKSLASH = '\\'; var C_BRACKET_OPEN = '['; var C_BRACKET_CLOSE = ']'; @@ -41,12 +34,12 @@ COMMONMARK_LINK_MARKERS[C_DOUBLE_QUOTE] = C_DOUBLE_QUOTE; COMMONMARK_LINK_MARKERS[C_SINGLE_QUOTE] = C_SINGLE_QUOTE; COMMONMARK_LINK_MARKERS[C_PAREN_OPEN] = C_PAREN_CLOSE; -/* Tokenise a link. */ function link(eat, value, silent) { var self = this; var subvalue = ''; var index = 0; var character = value.charAt(0); + var pedantic = self.options.pedantic; var commonmark = self.options.commonmark; var gfm = self.options.gfm; var closed; @@ -134,7 +127,7 @@ function link(eat, value, silent) { } else { /* Allow white-space between content and * url in GFM mode. */ - if (gfm) { + if (!pedantic) { while (index < length) { character = value.charAt(index + 1); @@ -224,12 +217,12 @@ function link(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (subqueue && has(markers, character)) { + if (subqueue && own.call(markers, character)) { break; } if (whitespace(character)) { - if (commonmark) { + if (!pedantic) { break; } @@ -282,7 +275,7 @@ function link(eat, value, silent) { subvalue += queue; /* Eat the title. */ - if (queue && has(markers, character)) { + if (queue && own.call(markers, character)) { index++; subvalue += character; queue = ''; @@ -374,7 +367,7 @@ function link(eat, value, silent) { subvalue += C_PAREN_CLOSE; - url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end); + url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end, {nonTerminated: false}); if (title) { beforeTitle = eat(beforeTitle).test().end; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/list.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/list.js index da8002e574196c..9164c8167f8dc1 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/list.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/list.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:list - * @fileoverview Tokenise a list. - */ - 'use strict'; /* eslint-disable max-params */ @@ -58,7 +50,6 @@ var LIST_ORDERED_COMMONMARK_MARKERS = {}; LIST_ORDERED_COMMONMARK_MARKERS[C_DOT] = true; LIST_ORDERED_COMMONMARK_MARKERS[C_PAREN_CLOSE] = true; -/* Tokenise a list. */ function list(eat, value, silent) { var self = this; var commonmark = self.options.commonmark; @@ -371,17 +362,6 @@ function list(eat, value, silent) { return node; } -/** - * Create a list-item node. - * - * @example - * listItem('- _foo_', now()); - * - * @param {Object} ctx - Parser. - * @param {Object} value - List-item. - * @param {Object} position - List-item location. - * @return {Object} - `listItem` node. - */ function listItem(ctx, value, position) { var offsets = ctx.offset; var fn = ctx.options.pedantic ? pedanticListItem : normalListItem; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/newline.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/newline.js index f710e0ef976603..6008670cc5e742 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/newline.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/newline.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:newline - * @fileoverview Tokenise a newline. - */ - 'use strict'; var whitespace = require('is-whitespace-character'); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js index 7d064522ffecbd..1492a027e78237 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:paragraph - * @fileoverview Tokenise a paragraph. - */ - 'use strict'; var trim = require('trim'); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/reference.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/reference.js index 1fa150d9e6b958..50713f1ccfc8fa 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/reference.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/reference.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:reference - * @fileoverview Tokenise a reference. - */ - 'use strict'; var whitespace = require('is-whitespace-character'); @@ -26,7 +18,6 @@ var C_BACKSLASH = '\\'; var C_BRACKET_OPEN = '['; var C_BRACKET_CLOSE = ']'; -/* Tokenise a reference. */ function reference(eat, value, silent) { var self = this; var character = value.charAt(0); @@ -61,11 +52,13 @@ function reference(eat, value, silent) { queue = ''; /* Check whether we’re eating a footnote. */ - if ( - self.options.footnotes && - type === T_LINK && - value.charAt(index) === C_CARET - ) { + if (self.options.footnotes && value.charAt(index) === C_CARET) { + /* Exit if `![^` is found, so the `!` will be seen as text after this, + * and we’ll enter this function again when `[^` is found. */ + if (type === T_IMAGE) { + return; + } + intro += C_CARET; index++; type = T_FOOTNOTE; @@ -122,7 +115,8 @@ function reference(eat, value, silent) { character = value.charAt(index); - if (character === C_BRACKET_OPEN) { + /* Inline footnotes cannot have an identifier. */ + if (type !== T_FOOTNOTE && character === C_BRACKET_OPEN) { identifier = ''; queue += character; index++; @@ -168,13 +162,6 @@ function reference(eat, value, silent) { return; } - /* Inline footnotes cannot have an identifier. */ - if (type === T_FOOTNOTE && referenceType !== REFERENCE_TYPE_SHORTCUT) { - type = T_LINK; - intro = C_BRACKET_OPEN + C_CARET; - content = C_CARET + content; - } - subvalue = intro + subvalue; if (type === T_LINK && self.inLink) { diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/strong.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/strong.js index 765993fa0bd4b3..12d5785bc64a74 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/strong.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/strong.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:strong - * @fileoverview Tokenise strong. - */ - 'use strict'; var trim = require('trim'); @@ -18,7 +10,6 @@ strong.locator = locate; var C_ASTERISK = '*'; var C_UNDERSCORE = '_'; -/* Tokenise strong. */ function strong(eat, value, silent) { var self = this; var index = 0; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/table.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/table.js index c440067e1011d7..ce93b1d22f0f31 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/table.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/table.js @@ -1,17 +1,8 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:table - * @fileoverview Tokenise a table. - */ - 'use strict'; var whitespace = require('is-whitespace-character'); module.exports = table; -table.notInList = true; var C_BACKSLASH = '\\'; var C_TICK = '`'; @@ -30,7 +21,6 @@ var TABLE_ALIGN_CENTER = 'center'; var TABLE_ALIGN_RIGHT = 'right'; var TABLE_ALIGN_NONE = null; -/* Tokenise a table. */ function table(eat, value, silent) { var self = this; var index; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/text.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/text.js index ef6d3f2879d46e..4aedfa90d5d9b8 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/text.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/text.js @@ -1,16 +1,7 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:text - * @fileoverview Tokenise text. - */ - 'use strict'; module.exports = text; -/* Tokenise text. */ function text(eat, value, silent) { var self = this; var methods; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js index a580d09fe09c0b..2391e3f592cb25 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:thematic-break - * @fileoverview Tokenise a thematic break. - */ - 'use strict'; module.exports = thematicBreak; @@ -19,7 +11,6 @@ var C_DASH = '-'; var THEMATIC_BREAK_MARKER_COUNT = 3; -/* Tokenise a thematic break. */ function thematicBreak(eat, value, silent) { var index = -1; var length = value.length + 1; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/url.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/url.js index fd2debd32f35fe..297940bf4ab922 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/url.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/url.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:url - * @fileoverview Tokenise a URL. - */ - 'use strict'; var decode = require('parse-entities'); @@ -35,7 +27,6 @@ var PROTOCOLS = [ var PROTOCOLS_LENGTH = PROTOCOLS.length; -/* Tokenise a URL. */ function url(eat, value, silent) { var self = this; var subvalue; @@ -147,7 +138,7 @@ function url(eat, value, silent) { return eat(subvalue)({ type: 'link', title: null, - url: decode(subvalue), + url: decode(subvalue, {nonTerminated: false}), children: content }); } diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/yaml.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/yaml.js deleted file mode 100644 index 78dec31a0f9eb8..00000000000000 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenize/yaml.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenize:yaml - * @fileoverview Tokenise YAML. - */ - -'use strict'; - -module.exports = yaml; -yaml.onlyAtStart = true; - -var FENCE = '---'; -var C_DASH = '-'; -var C_NEWLINE = '\n'; - -/* Tokenise YAML. */ -function yaml(eat, value, silent) { - var self = this; - var subvalue; - var content; - var index; - var length; - var character; - var queue; - - if ( - !self.options.yaml || - value.charAt(0) !== C_DASH || - value.charAt(1) !== C_DASH || - value.charAt(2) !== C_DASH || - value.charAt(3) !== C_NEWLINE - ) { - return; - } - - subvalue = FENCE + C_NEWLINE; - content = ''; - queue = ''; - index = 3; - length = value.length; - - while (++index < length) { - character = value.charAt(index); - - if ( - character === C_DASH && - (queue || !content) && - value.charAt(index + 1) === C_DASH && - value.charAt(index + 2) === C_DASH - ) { - /* istanbul ignore if - never used (yet) */ - if (silent) { - return true; - } - - subvalue += queue + FENCE; - - return eat(subvalue)({ - type: 'yaml', - value: content - }); - } - - if (character === C_NEWLINE) { - queue += character; - } else { - subvalue += queue + character; - content += queue + character; - queue = ''; - } - } -} diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenizer.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenizer.js index aefe551fc37993..498ef22ad949af 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenizer.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/tokenizer.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:tokenizer - * @fileoverview Markdown tokenizer. - */ - 'use strict'; module.exports = factory; @@ -101,7 +93,7 @@ function factory(type) { if ( method && - (!method.onlyAtStart || self.atStart) && + /* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && (!method.notInList || !self.inList) && (!method.notInBlock || !self.inBlock) && (!method.notInLink || !self.inLink) @@ -128,15 +120,8 @@ function factory(type) { return tokens; - /** - * Update line, column, and offset based on - * `value`. - * - * @example - * updatePosition('foo'); - * - * @param {string} subvalue - Subvalue to eat. - */ + /* Update line, column, and offset based on + * `value`. */ function updatePosition(subvalue) { var lastIndex = -1; var index = subvalue.indexOf('\n'); @@ -162,23 +147,14 @@ function factory(type) { } } - /** - * Get offset. Called before the first character is - * eaten to retrieve the range's offsets. - * - * @return {Function} - `done`, to be called when - * the last character is eaten. - */ + /* Get offset. Called before the first character is + * eaten to retrieve the range's offsets. */ function getOffset() { var indentation = []; var pos = line + 1; - /** - * Done. Called when the last character is - * eaten to retrieve the range’s offsets. - * - * @return {Array.} - Offset. - */ + /* Done. Called when the last character is + * eaten to retrieve the range’s offsets. */ return function () { var last = line + 1; @@ -192,14 +168,7 @@ function factory(type) { }; } - /** - * Get the current position. - * - * @example - * position = now(); // {line: 1, column: 1, offset: 0} - * - * @return {Object} - Current Position. - */ + /* Get the current position. */ function now() { var pos = {line: line, column: column}; @@ -208,41 +177,15 @@ function factory(type) { return pos; } - /** - * Store position information for a node. - * - * @example - * start = now(); - * updatePosition('foo'); - * location = new Position(start); - * // { - * // start: {line: 1, column: 1, offset: 0}, - * // end: {line: 1, column: 3, offset: 2} - * // } - * - * @param {Object} start - Starting position. - */ + /* Store position information for a node. */ function Position(start) { this.start = start; this.end = now(); } - /** - * Throw when a value is incorrectly eaten. + /* Throw when a value is incorrectly eaten. * This shouldn’t happen but will throw on new, - * incorrect rules. - * - * @example - * // When the current value is set to `foo bar`. - * validateEat('foo'); - * eat('foo'); - * - * validateEat('bar'); - * // throws, because the space is not eaten. - * - * @param {string} subvalue - Value to be eaten. - * @throws {Error} - When `subvalue` cannot be eaten. - */ + * incorrect rules. */ function validateEat(subvalue) { /* istanbul ignore if */ if (value.substring(0, subvalue.length) !== subvalue) { @@ -257,39 +200,13 @@ function factory(type) { } } - /** - * Mark position and patch `node.position`. - * - * @example - * var update = position(); - * updatePosition('foo'); - * update({}); - * // { - * // position: { - * // start: {line: 1, column: 1, offset: 0}, - * // end: {line: 1, column: 3, offset: 2} - * // } - * // } - * - * @returns {Function} - Updater. - */ + /* Mark position and patch `node.position`. */ function position() { var before = now(); return update; - /** - * Add the position to a node. - * - * @example - * update({type: 'text', value: 'foo'}); - * - * @param {Node} node - Node to attach position - * on. - * @param {Array} [indent] - Indentation for - * `node`. - * @return {Node} - `node`. - */ + /* Add the position to a node. */ function update(node, indent) { var prev = node.position; var start = prev ? prev.start : before; @@ -327,19 +244,8 @@ function factory(type) { } } - /** - * Add `node` to `parent`s children or to `tokens`. - * Performs merges where possible. - * - * @example - * add({}); - * - * add({}, {children: []}); - * - * @param {Object} node - Node to add. - * @param {Object} [parent] - Parent to insert into. - * @return {Object} - Added or merged into node. - */ + /* Add `node` to `parent`s children or to `tokens`. + * Performs merges where possible. */ function add(node, parent) { var children = parent ? parent.children : tokens; var prev = children[children.length - 1]; @@ -365,18 +271,8 @@ function factory(type) { return node; } - /** - * Remove `subvalue` from `value`. - * `subvalue` must be at the start of `value`. - * - * @example - * eat('foo')({type: 'text', value: 'foo'}); - * - * @param {string} subvalue - Removed from `value`, - * and passed to `updatePosition`. - * @return {Function} - Wrapper around `add`, which - * also adds `position` to node. - */ + /* Remove `subvalue` from `value`. + * `subvalue` must be at the start of `value`. */ function eat(subvalue) { var indent = getOffset(); var pos = position(); @@ -396,31 +292,19 @@ function factory(type) { return apply; - /** - * Add the given arguments, add `position` to - * the returned node, and return the node. - * - * @param {Object} node - Node to add. - * @param {Object} [parent] - Node to insert into. - * @return {Node} - Added node. - */ + /* Add the given arguments, add `position` to + * the returned node, and return the node. */ function apply(node, parent) { return pos(add(pos(node), parent), indent); } - /** - * Functions just like apply, but resets the + /* Functions just like apply, but resets the * content: the line and column are reversed, * and the eaten value is re-added. - * * This is useful for nodes with a single * type of content, such as lists and tables. - * * See `apply` above for what parameters are - * expected. - * - * @return {Node} - Added node. - */ + * expected. */ function reset() { var node = apply.apply(null, arguments); @@ -431,12 +315,8 @@ function factory(type) { return node; } - /** - * Test the position, after eating, and reverse - * to a not-eaten state. - * - * @return {Position} - Position after eating `subvalue`. - */ + /* Test the position, after eating, and reverse + * to a not-eaten state. */ function test() { var result = pos({}); diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/unescape.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/unescape.js index dc83486126112c..321900e7eacd73 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/unescape.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/unescape.js @@ -1,14 +1,5 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:unescape - * @fileoverview Unescape escapes. - */ - 'use strict'; -/* Expose. */ module.exports = factory; /* Factory to de-escape a value, based on a list at `key` diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/get-indentation.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/get-indentation.js index eebd40c94ac26b..3e09e1411ed67c 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/get-indentation.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/get-indentation.js @@ -1,26 +1,12 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:get-indentation - * @fileoverview Get indentation. - */ - 'use strict'; -/* Expose. */ module.exports = indentation; /* Map of characters, and their column length, * which can be used as indentation. */ var characters = {' ': 1, '\t': 4}; -/** - * Gets indentation information for a line. - * - * @param {string} value - Indented line. - * @return {Object} - Indetation information. - */ +/* Gets indentation information for a line. */ function indentation(value) { var index = 0; var indent = 0; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/html.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/html.js index 234ba342e1d3fa..5f211f13f8f534 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/html.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/html.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:html - * @fileoverview HTML regexes. - */ - 'use strict'; var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js index b8dc2305501db1..e3178ab45c60df 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js @@ -1,11 +1,3 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:get-indentation - * @fileoverview Get indentation. - */ - 'use strict'; module.exports = interrupt; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/normalize.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/normalize.js index 3602a18f788317..846ceeecac5ade 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/normalize.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/normalize.js @@ -1,29 +1,11 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:normalize - * @fileoverview Normalize an identifier. - */ - 'use strict'; -/* Dependencies. */ var collapseWhiteSpace = require('collapse-white-space'); -/* Expose. */ module.exports = normalize; -/** - * Normalize an identifier. Collapses multiple white space - * characters into a single space, and removes casing. - * - * @example - * normalizeIdentifier('FOO\t bar'); // 'foo bar' - * - * @param {string} value - Content to normalize. - * @return {string} - Normalized content. - */ +/* Normalize an identifier. Collapses multiple white space + * characters into a single space, and removes casing. */ function normalize(value) { return collapseWhiteSpace(value).toLowerCase(); } diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/remove-indentation.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/remove-indentation.js index d56db0bad4b735..20f18be74087eb 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/remove-indentation.js +++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/remove-indentation.js @@ -1,42 +1,18 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:remove-indentation - * @fileoverview Remove indentation. - */ - 'use strict'; -/* Dependencies. */ var trim = require('trim'); var repeat = require('repeat-string'); var getIndent = require('./get-indentation'); -/* Expose. */ module.exports = indentation; -/* Characters. */ var C_SPACE = ' '; var C_NEWLINE = '\n'; var C_TAB = '\t'; -/** - * Remove the minimum indent from every line in `value`. +/* Remove the minimum indent from every line in `value`. * Supports both tab, spaced, and mixed indentation (as - * well as possible). - * - * @example - * removeIndentation(' foo'); // 'foo' - * removeIndentation(' foo', 2); // ' foo' - * removeIndentation('\tfoo', 2); // ' foo' - * removeIndentation(' foo\n bar'); // ' foo\n bar' - * - * @param {string} value - Value to trim. - * @param {number?} [maximum] - Maximum indentation - * to remove. - * @return {string} - Unindented `value`. - */ + * well as possible). */ function indentation(value, maximum) { var values = value.split(C_NEWLINE); var position = values.length + 1; diff --git a/tools/node_modules/eslint/node_modules/remark-parse/package.json b/tools/node_modules/eslint/node_modules/remark-parse/package.json index fcecf978cd74e0..b47866c95b256b 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/package.json +++ b/tools/node_modules/eslint/node_modules/remark-parse/package.json @@ -5,7 +5,7 @@ "url": "http://wooorm.com" }, "bugs": { - "url": "https://github.com/wooorm/remark/issues" + "url": "https://github.com/remarkjs/remark/issues" }, "bundleDependencies": false, "contributors": [ @@ -21,13 +21,12 @@ ], "dependencies": { "collapse-white-space": "^1.0.2", - "has": "^1.0.1", "is-alphabetical": "^1.0.0", "is-decimal": "^1.0.0", "is-whitespace-character": "^1.0.0", "is-word-character": "^1.0.0", "markdown-escapes": "^1.0.0", - "parse-entities": "^1.0.2", + "parse-entities": "^1.1.0", "repeat-string": "^1.5.4", "state-toggle": "^1.0.0", "trim": "0.0.1", @@ -56,8 +55,8 @@ "name": "remark-parse", "repository": { "type": "git", - "url": "https://github.com/wooorm/remark/tree/master/packages/remark-parse" + "url": "https://github.com/remarkjs/remark/tree/master/packages/remark-parse" }, - "version": "3.0.1", + "version": "5.0.0", "xo": false } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/remark-parse/readme.md b/tools/node_modules/eslint/node_modules/remark-parse/readme.md index 53426f41eee224..ecaa6c093c0ab2 100644 --- a/tools/node_modules/eslint/node_modules/remark-parse/readme.md +++ b/tools/node_modules/eslint/node_modules/remark-parse/readme.md @@ -33,7 +33,7 @@ process.stdin ## Table of Contents * [API](#api) - * [processor.use(parse)](#processoruseparse) + * [processor.use(parse\[, options\])](#processoruseparse-options) * [parse.Parser](#parseparser) * [Extending the Parser](#extending-the-parser) * [Parser#blockTokenizers](#parserblocktokenizers) @@ -46,29 +46,19 @@ process.stdin * [add(node\[, parent\])](#addnode-parent) * [add.test()](#addtest) * [add.reset(node\[, parent\])](#addresetnode-parent) + * [Turning off a tokenizer](#turning-off-a-tokenizer) * [License](#license) ## API -### `processor.use(parse)` +### `processor.use(parse[, options])` Configure the `processor` to read markdown as input and process an [**MDAST**][mdast] syntax tree. -#### `options` +##### `options` -Options are passed later through [`processor.parse()`][parse], -[`processor.process()`][process], or [`processor.pipe()`][pipe]. -The following settings are supported: - -* [`gfm`][options-gfm] (`boolean`, default: `true`) -* [`yaml`][options-yaml] (`boolean`, default: `true`) -* [`commonmark`][options-commonmark] (`boolean`, default: `false`) -* [`footnotes`][options-footnotes] (`boolean`, default: `false`) -* [`pedantic`][options-pedantic] (`boolean`, default: `false`) -* [`breaks`][options-breaks] (`boolean`, default: `false`) -* [`blocks`][options-blocks] (`Array.`, default: list of block HTML - elements) +Options are passed directly, or passed later through [`processor.data()`][data]. ##### `options.gfm` @@ -76,7 +66,7 @@ The following settings are supported: hello ~~hi~~ world ``` -GFM mode (default: `true`) turns on: +GFM mode (`boolean`, default: `true`) turns on: * [Fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) * [Autolinking of URLs](https://help.github.com/articles/github-flavored-markdown/#url-autolinking) @@ -84,19 +74,6 @@ GFM mode (default: `true`) turns on: * [Task lists](https://help.github.com/articles/writing-on-github/#task-lists) * [Tables](https://help.github.com/articles/github-flavored-markdown/#tables) -##### `options.yaml` - -```md ---- -title: YAML is Cool ---- - -# YAML is Cool -``` - -YAML mode (default: `true`) enables raw YAML front matter to be detected -at the top. - ##### `options.commonmark` ```md @@ -104,7 +81,7 @@ This is a paragraph and this is also part of the preceding paragraph. ``` -CommonMark mode (default: `false`) allows: +CommonMark mode (`boolean`, default: `false`) allows: * Empty lines to split blockquotes * Parentheses (`(` and `)`) around for link and image titles @@ -136,20 +113,10 @@ And something else[^1]. * ...and a list ``` -Footnotes mode (default: `false`) enables reference footnotes and inline -footnotes. Both are wrapped in square brackets and preceded by a caret +Footnotes mode (`boolean`, default: `false`) enables reference footnotes and +inline footnotes. Both are wrapped in square brackets and preceded by a caret (`^`), and can be referenced from inside other footnotes. -##### `options.breaks` - -```md -This is a -paragraph. -``` - -Breaks mode (default: `false`) exposes newline characters inside -paragraphs as breaks. - ##### `options.blocks` ```md @@ -157,8 +124,8 @@ paragraphs as breaks. ``` -Blocks (default: a list of HTML block elements) exposes -let’s users define block-level HTML elements. +Blocks (`Array.`, default: list of [block HTML elements][blocks]) +exposes let’s users define block-level HTML elements. ##### `options.pedantic` @@ -166,7 +133,7 @@ let’s users define block-level HTML elements. Check out some_file_name.txt ``` -Pedantic mode (default: `false`) turns on: +Pedantic mode (`boolean`, default: `false`) turns on: * Emphasis (`_alpha_`) and importance (`__bravo__`) with underscores in words @@ -187,11 +154,11 @@ the desired output. Sometimes, mainly when introducing new syntactic entities with a certain level of precedence, interfacing with the parser is necessary. -If this plug-in is used, it adds a [`Parser`][parser] constructor to -the `processor`. Other plug-ins can add tokenizers to the parser’s -prototype to change how markdown is parsed. +If the `remark-parse` plugin is used, it adds a [`Parser`][parser] constructor +to the `processor`. Other plugins can add tokenizers to the parser’s prototype +to change how markdown is parsed. -The below plug-in adds a [tokenizer][] for at-mentions. +The below plugin adds a [tokenizer][] for at-mentions. ```js module.exports = mentions; @@ -215,22 +182,63 @@ An object mapping tokenizer names to [tokenizer][]s. These tokenizers (for example: `fencedCode`, `table`, and `paragraph`) eat from the start of a value to a line ending. +See `#blockMethods` below for a list of methods that are included by +default. + ### `Parser#blockMethods` Array of `blockTokenizers` names (`string`) specifying the order in which they run. + + +* `newline` +* `indentedCode` +* `fencedCode` +* `blockquote` +* `atxHeading` +* `thematicBreak` +* `list` +* `setextHeading` +* `html` +* `footnote` +* `definition` +* `table` +* `paragraph` + + + ### `Parser#inlineTokenizers` An object mapping tokenizer names to [tokenizer][]s. These tokenizers (for example: `url`, `reference`, and `emphasis`) eat from the start of a value. To increase performance, they depend on [locator][]s. +See `#inlineMethods` below for a list of methods that are included by +default. + ### `Parser#inlineMethods` Array of `inlineTokenizers` names (`string`) specifying the order in which they run. + + +* `escape` +* `autoLink` +* `url` +* `html` +* `link` +* `reference` +* `strong` +* `emphasis` +* `deletion` +* `code` +* `break` +* `text` + + + ### `function tokenizer(eat, value, silent)` ```js @@ -379,63 +387,58 @@ for list items The given `node`. +### Turning off a tokenizer + +In rare situations, you may want to turn off a tokenizer to avoid parsing +that syntactic feature. This can be done by deleting the tokenizer from +your Parser’s `blockTokenizers` (or `blockMethods`) or `inlineTokenizers` +(or `inlineMethods`). + +The following example turns off indented code blocks: + +```js +delete remarkParse.Parser.prototype.blockTokenizers.indentedCode; +``` + ## License [MIT][license] © [Titus Wormer][author] -[build-badge]: https://img.shields.io/travis/wooorm/remark.svg +[build-badge]: https://img.shields.io/travis/remarkjs/remark.svg -[build-status]: https://travis-ci.org/wooorm/remark +[build-status]: https://travis-ci.org/remarkjs/remark -[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark.svg +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg -[coverage-status]: https://codecov.io/github/wooorm/remark +[coverage-status]: https://codecov.io/github/remarkjs/remark -[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg +[chat-badge]: https://img.shields.io/gitter/room/remarkjs/Lobby.svg -[chat]: https://gitter.im/wooorm/remark +[chat]: https://gitter.im/remarkjs/Lobby -[license]: https://github.com/wooorm/remark/blob/master/LICENSE +[license]: https://github.com/remarkjs/remark/blob/master/LICENSE [author]: http://wooorm.com [npm]: https://docs.npmjs.com/cli/install -[unified]: https://github.com/wooorm/unified - -[parse]: https://github.com/wooorm/unified#processorparsefilevalue-options +[unified]: https://github.com/unifiedjs/unified -[process]: https://github.com/wooorm/unified#processorprocessfilevalue-options-done +[data]: https://github.com/unifiedjs/unified#processordatakey-value -[pipe]: https://github.com/wooorm/unified#processorpipestream-options +[processor]: https://github.com/unifiedjs/remark/blob/master/packages/remark -[processor]: https://github.com/wooorm/remark/blob/master/packages/remark - -[mdast]: https://github.com/wooorm/mdast +[mdast]: https://github.com/syntax-tree/mdast [escapes]: http://spec.commonmark.org/0.25/#backslash-escapes -[node]: https://github.com/wooorm/unist#node - -[location]: https://github.com/wooorm/unist#location - -[options-gfm]: #optionsgfm - -[options-yaml]: #optionsyaml - -[options-commonmark]: #optionscommonmark +[node]: https://github.com/syntax-tree/unist#node -[options-footnotes]: #optionsfootnotes +[location]: https://github.com/syntax-tree/unist#location -[options-pedantic]: #optionspedantic - -[options-breaks]: #optionsbreaks - -[options-blocks]: #optionsblocks - -[parser]: https://github.com/wooorm/unified#processorparser +[parser]: https://github.com/unifiedjs/unified#processorparser [extend]: #extending-the-parser @@ -446,3 +449,5 @@ The given `node`. [eat]: #eatsubvalue [add]: #addnode-parent + +[blocks]: https://github.com/remarkjs/remark/blob/master/packages/remark-parse/lib/block-elements.json diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 7b47dbd691f1ce..f35659fc8a1c23 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": "^2.1.0", - "eslint-plugin-markdown": "^1.0.0-beta.8", + "eslint-plugin-markdown": "^1.0.0-rc.1", "eslint-scope": "^4.0.0", "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", @@ -66,8 +66,8 @@ "coveralls": "^3.0.1", "dateformat": "^3.0.3", "ejs": "^2.6.1", - "eslint-plugin-eslint-plugin": "^1.2.0", - "eslint-plugin-node": "^7.0.1", + "eslint-plugin-eslint-plugin": "^1.4.1", + "eslint-plugin-node": "^8.0.0", "eslint-plugin-rulesdir": "^0.1.0", "eslint-release": "^1.0.0", "eslint-rule-composer": "^0.3.0", @@ -135,5 +135,5 @@ "publish-release": "node Makefile.js publishRelease", "test": "node Makefile.js test" }, - "version": "5.8.0" + "version": "5.9.0" } \ No newline at end of file From fbf5321dcfc09e10e6d516902fed713d6b238503 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 10 Nov 2018 16:35:38 +0100 Subject: [PATCH 105/223] async_hooks: add HandleScopes to C++ embedder/addon API Add `HandleScope`s to the public C++ API for embedders/addons, since these methods create V8 handles that should not leak into the outer scopes. In particular, for some of the methods it was not clear from the function signatures that these functions previously needed to be invoked with a `HandleScope`. PR-URL: https://github.com/nodejs/node/pull/24285 Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Joyee Cheung Reviewed-By: Michael Dawson --- src/async_wrap.cc | 8 ++++++++ test/addons/async-hello-world/binding.cc | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index bf751f9b661cee..b7d59671908564 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -694,6 +694,8 @@ MaybeLocal AsyncWrap::MakeCallback(const Local cb, async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) { + // Environment::GetCurrent() allocates a Local<> handle. + v8::HandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); if (env == nullptr) return -1; return env->execution_async_id(); @@ -701,6 +703,8 @@ async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) { async_id AsyncHooksGetTriggerAsyncId(Isolate* isolate) { + // Environment::GetCurrent() allocates a Local<> handle. + v8::HandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); if (env == nullptr) return -1; return env->trigger_async_id(); @@ -711,6 +715,7 @@ async_context EmitAsyncInit(Isolate* isolate, Local resource, const char* name, async_id trigger_async_id) { + v8::HandleScope handle_scope(isolate); Local type = String::NewFromUtf8(isolate, name, v8::NewStringType::kInternalized) .ToLocalChecked(); @@ -721,6 +726,7 @@ async_context EmitAsyncInit(Isolate* isolate, Local resource, v8::Local name, async_id trigger_async_id) { + v8::HandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); CHECK_NOT_NULL(env); @@ -741,6 +747,8 @@ async_context EmitAsyncInit(Isolate* isolate, } void EmitAsyncDestroy(Isolate* isolate, async_context asyncContext) { + // Environment::GetCurrent() allocates a Local<> handle. + v8::HandleScope handle_scope(isolate); AsyncWrap::EmitDestroy( Environment::GetCurrent(isolate), asyncContext.async_id); } diff --git a/test/addons/async-hello-world/binding.cc b/test/addons/async-hello-world/binding.cc index 1bf94ddd1d70bc..ff899628c4d56d 100644 --- a/test/addons/async-hello-world/binding.cc +++ b/test/addons/async-hello-world/binding.cc @@ -57,6 +57,8 @@ void AfterAsync(uv_work_t* r) { global, 2, argv).ToLocalChecked(); } + // None of the following operations should allocate handles into this scope. + v8::SealHandleScope seal_handle_scope(isolate); // cleanup node::EmitAsyncDestroy(isolate, req->context); req->callback.Reset(); From 672879f406c5218e24b65a4c45d68d99bca1a4ac Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 7 Nov 2018 13:16:50 -0800 Subject: [PATCH 106/223] doc: use real protocol names in ALPN example PR-URL: https://github.com/nodejs/node/pull/24232 Reviewed-By: James M Snell --- doc/api/tls.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 4f97bd2b32dfa2..3b0420eddc5251 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -888,9 +888,10 @@ changes: * `ALPNProtocols`: {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array} An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have - the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the - first byte is the length of the next protocol name. Passing an array is - usually much simpler, e.g. `['hello', 'world']`. + the format `[len][name][len][name]...` e.g. `'\x08http/1.1\x08http/1.0'`, + where the `len` byte is the length of the next protocol name. Passing an + array is usually much simpler, e.g. `['http/1.1', 'http/1.0']`. + Protocols earlier in the list have higher preference than those later. * `servername`: {string} Server name for the SNI (Server Name Indication) TLS extension. It is the name of the host being connected to, and must be a host name, and not an IP address. It can be used by a multi-homed server to From 2d0105c751b37ecb133ee936f8eb74190b919cbf Mon Sep 17 00:00:00 2001 From: Philipp Dunkel Date: Tue, 6 Nov 2018 15:25:35 +0000 Subject: [PATCH 107/223] net: remove unreachable check in internalConnect Checked all call-sites to ensure that this code is truly unreachable. addressType is always checked before internalConnect is even called. PR-URL: https://github.com/nodejs/node/pull/24158 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- lib/net.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/net.js b/lib/net.js index 35bfd33eaaf473..30cad781bfe134 100644 --- a/lib/net.js +++ b/lib/net.js @@ -830,12 +830,9 @@ function internalConnect( if (addressType === 4) { localAddress = localAddress || '0.0.0.0'; err = self._handle.bind(localAddress, localPort); - } else if (addressType === 6) { + } else { // addressType === 6 localAddress = localAddress || '::'; err = self._handle.bind6(localAddress, localPort); - } else { - self.destroy(new ERR_INVALID_ADDRESS_FAMILY(addressType)); - return; } debug('binding to localAddress: %s and localPort: %d (addressType: %d)', localAddress, localPort, addressType); From 0c2d1d57e8fdac2c51e08080175d93fb97aaa06f Mon Sep 17 00:00:00 2001 From: Steven Gabarro Date: Wed, 7 Nov 2018 05:54:13 -0500 Subject: [PATCH 108/223] net: add comments explaining error check PR-URL: https://github.com/nodejs/node/pull/24222 Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca --- lib/net.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/net.js b/lib/net.js index 30cad781bfe134..20b0ede7b78b3b 100644 --- a/lib/net.js +++ b/lib/net.js @@ -263,9 +263,16 @@ function Socket(options) { const { fd } = options; let err; + // createHandle will throw ERR_INVALID_FD_TYPE if `fd` is not + // a valid `PIPE` or `TCP` descriptor this._handle = createHandle(fd, false); err = this._handle.open(fd); + + // While difficult to fabricate, in some architectures + // `open` may return an error code for valid file descriptors + // which cannot be opened. This is difficult to test as most + // un-openable fds will throw on `createHandle` if (err) throw errnoException(err, 'open'); From 916ead940d7b943f8ec8c689599cab3da84fce18 Mon Sep 17 00:00:00 2001 From: James Herrington Date: Wed, 7 Nov 2018 08:57:13 +0000 Subject: [PATCH 109/223] test: add tests for Socket.setNoDelay PR-URL: https://github.com/nodejs/node/pull/24250 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/parallel/test-net-socket-setnodelay.js | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/parallel/test-net-socket-setnodelay.js diff --git a/test/parallel/test-net-socket-setnodelay.js b/test/parallel/test-net-socket-setnodelay.js new file mode 100644 index 00000000000000..be5c8ffc8524dc --- /dev/null +++ b/test/parallel/test-net-socket-setnodelay.js @@ -0,0 +1,43 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); + +const truthyValues = [true, 1, 'true', {}, []]; +const falseyValues = [false, 0, '']; +const genSetNoDelay = (desiredArg) => (enable) => { + assert.strictEqual(enable, desiredArg); +}; + +// setNoDelay should default to true +let socket = new net.Socket({ + handle: { + setNoDelay: common.mustCall(genSetNoDelay(true)) + } +}); +socket.setNoDelay(); + +socket = new net.Socket({ + handle: { + setNoDelay: common.mustCall(genSetNoDelay(true), truthyValues.length) + } +}); +truthyValues.forEach((testVal) => socket.setNoDelay(testVal)); + +socket = new net.Socket({ + handle: { + setNoDelay: common.mustCall(genSetNoDelay(false), falseyValues.length) + } +}); +falseyValues.forEach((testVal) => socket.setNoDelay(testVal)); + +// if a handler doesn't have a setNoDelay function it shouldn't be called. +// In the case below, if it is called an exception will be thrown +socket = new net.Socket({ + handle: { + setNoDelay: null + } +}); +const returned = socket.setNoDelay(true); +assert.ok(returned instanceof net.Socket); From ac3e264f1c37f06168e3a2493aa9039583f508ea Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 13 Nov 2018 20:41:51 -0800 Subject: [PATCH 110/223] doc: fix comma splices in process.md PR-URL: https://github.com/nodejs/node/pull/24357 Reviewed-By: Daniel Bevenius Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt --- doc/api/process.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index f33c47295ea595..af5694b9391458 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -429,7 +429,7 @@ process.on('SIGTERM', handle); removed (Node.js will no longer exit). * `'SIGPIPE'` is ignored by default. It can have a listener installed. * `'SIGHUP'` is generated on Windows when the console window is closed, and on - other platforms under various similar conditions, see signal(7). It can have a + other platforms under various similar conditions. See signal(7). It can have a listener installed, however Node.js will be unconditionally terminated by Windows about 10 seconds later. On non-Windows platforms, the default behavior of `SIGHUP` is to terminate Node.js, but once a listener has been @@ -1382,7 +1382,7 @@ process.kill(process.pid, 'SIGHUP'); ``` When `SIGUSR1` is received by a Node.js process, Node.js will start the -debugger, see [Signal Events][]. +debugger. See [Signal Events][]. ## process.mainModule + +* {boolean} + +The `request.finished` property will be `true` if [`request.end()`][] +has been called. `request.end()` will automatically be called if the +request was initiated via [`http.get()`][]. + ### request.flushHeaders() |'; @@ -25043,14 +25186,21 @@ var cdata = ''; var openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')'); -var tag = new RegExp('^(?:' + - openTag + '|' + - closeTag + '|' + - comment + '|' + - processing + '|' + - declaration + '|' + - cdata + -')'); +var tag = new RegExp( + '^(?:' + + openTag + + '|' + + closeTag + + '|' + + comment + + '|' + + processing + + '|' + + declaration + + '|' + + cdata + + ')' +); var html = { openCloseTag: openCloseTag, @@ -25059,16 +25209,33 @@ var html = { var openCloseTag$1 = html.openCloseTag; -var htmlBlock = blockHTML; - -var C_TAB$8 = '\t'; -var C_SPACE$8 = ' '; -var C_NEWLINE$9 = '\n'; -var C_LT = '<'; - -function blockHTML(eat, value, silent) { +var htmlBlock = blockHtml; + +var tab$9 = '\t'; +var space$9 = ' '; +var lineFeed$10 = '\n'; +var lessThan = '<'; + +var rawOpenExpression = /^<(script|pre|style)(?=(\s|>|$))/i; +var rawCloseExpression = /<\/(script|pre|style)>/i; +var commentOpenExpression = /^/; +var instructionOpenExpression = /^<\?/; +var instructionCloseExpression = /\?>/; +var directiveOpenExpression = /^/; +var cdataOpenExpression = /^/; +var elementCloseExpression = /^$/; +var otherElementOpenExpression = new RegExp(openCloseTag$1.source + '\\s*$'); + +function blockHtml(eat, value, silent) { var self = this; - var blocks = self.options.blocks; + var blocks = self.options.blocks.join('|'); + var elementOpenExpression = new RegExp( + '^|$))', + 'i' + ); var length = value.length; var index = 0; var next; @@ -25080,31 +25247,31 @@ function blockHTML(eat, value, silent) { var subvalue; var sequences = [ - [/^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true], - [/^/, true], - [/^<\?/, /\?>/, true], - [/^/, true], - [/^/, true], - [new RegExp('^|$))', 'i'), /^$/, true], - [new RegExp(openCloseTag$1.source + '\\s*$'), /^$/, false] + [rawOpenExpression, rawCloseExpression, true], + [commentOpenExpression, commentCloseExpression, true], + [instructionOpenExpression, instructionCloseExpression, true], + [directiveOpenExpression, directiveCloseExpression, true], + [cdataOpenExpression, cdataCloseExpression, true], + [elementOpenExpression, elementCloseExpression, true], + [otherElementOpenExpression, elementCloseExpression, false] ]; - /* Eat initial spacing. */ + // Eat initial spacing. while (index < length) { character = value.charAt(index); - if (character !== C_TAB$8 && character !== C_SPACE$8) { - break; + if (character !== tab$9 && character !== space$9) { + break } index++; } - if (value.charAt(index) !== C_LT) { - return; + if (value.charAt(index) !== lessThan) { + return } - next = value.indexOf(C_NEWLINE$9, index + 1); + next = value.indexOf(lineFeed$10, index + 1); next = next === -1 ? length : next; line = value.slice(index, next); offset = -1; @@ -25113,23 +25280,23 @@ function blockHTML(eat, value, silent) { while (++offset < count) { if (sequences[offset][0].test(line)) { sequence = sequences[offset]; - break; + break } } if (!sequence) { - return; + return } if (silent) { - return sequence[2]; + return sequence[2] } index = next; if (!sequence[1].test(line)) { while (index < length) { - next = value.indexOf(C_NEWLINE$9, index + 1); + next = value.indexOf(lineFeed$10, index + 1); next = next === -1 ? length : next; line = value.slice(index + 1, next); @@ -25138,7 +25305,7 @@ function blockHTML(eat, value, silent) { index = next; } - break; + break } index = next; @@ -25147,7 +25314,7 @@ function blockHTML(eat, value, silent) { subvalue = value.slice(0, index); - return eat(subvalue)({type: 'html', value: subvalue}); + return eat(subvalue)({type: 'html', value: subvalue}) } var collapseWhiteSpace = collapse; @@ -25159,24 +25326,24 @@ function collapse(value) { var normalize_1 = normalize$2; -/* Normalize an identifier. Collapses multiple white space - * characters into a single space, and removes casing. */ +// Normalize an identifier. Collapses multiple white space characters into a +// single space, and removes casing. function normalize$2(value) { - return collapseWhiteSpace(value).toLowerCase(); + return collapseWhiteSpace(value).toLowerCase() } var footnoteDefinition_1 = footnoteDefinition; footnoteDefinition.notInList = true; footnoteDefinition.notInBlock = true; -var C_BACKSLASH = '\\'; -var C_NEWLINE$10 = '\n'; -var C_TAB$9 = '\t'; -var C_SPACE$9 = ' '; -var C_BRACKET_OPEN = '['; -var C_BRACKET_CLOSE = ']'; -var C_CARET = '^'; -var C_COLON = ':'; +var backslash$1 = '\\'; +var lineFeed$11 = '\n'; +var tab$10 = '\t'; +var space$10 = ' '; +var leftSquareBracket = '['; +var rightSquareBracket = ']'; +var caret$1 = '^'; +var colon$1 = ':'; var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm; @@ -25197,7 +25364,7 @@ function footnoteDefinition(eat, value, silent) { var exit; if (!self.options.footnotes) { - return; + return } index = 0; @@ -25210,7 +25377,7 @@ function footnoteDefinition(eat, value, silent) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } subvalue += character; @@ -25218,22 +25385,22 @@ function footnoteDefinition(eat, value, silent) { } if ( - value.charAt(index) !== C_BRACKET_OPEN || - value.charAt(index + 1) !== C_CARET + value.charAt(index) !== leftSquareBracket || + value.charAt(index + 1) !== caret$1 ) { - return; + return } - subvalue += C_BRACKET_OPEN + C_CARET; + subvalue += leftSquareBracket + caret$1; index = subvalue.length; queue = ''; while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_CLOSE) { - break; - } else if (character === C_BACKSLASH) { + if (character === rightSquareBracket) { + break + } else if (character === backslash$1) { queue += character; index++; character = value.charAt(index); @@ -25245,25 +25412,25 @@ function footnoteDefinition(eat, value, silent) { if ( !queue || - value.charAt(index) !== C_BRACKET_CLOSE || - value.charAt(index + 1) !== C_COLON + value.charAt(index) !== rightSquareBracket || + value.charAt(index + 1) !== colon$1 ) { - return; + return } if (silent) { - return true; + return true } - identifier = normalize_1(queue); - subvalue += queue + C_BRACKET_CLOSE + C_COLON; + identifier = queue; + subvalue += queue + rightSquareBracket + colon$1; index = subvalue.length; while (index < length) { character = value.charAt(index); - if (character !== C_TAB$9 && character !== C_SPACE$9) { - break; + if (character !== tab$10 && character !== space$10) { + break } subvalue += character; @@ -25279,15 +25446,15 @@ function footnoteDefinition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === C_NEWLINE$10) { + if (character === lineFeed$11) { subqueue = character; index++; while (index < length) { character = value.charAt(index); - if (character !== C_NEWLINE$10) { - break; + if (character !== lineFeed$11) { + break } subqueue += character; @@ -25300,8 +25467,8 @@ function footnoteDefinition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$9) { - break; + if (character !== space$10) { + break } subqueue += character; @@ -25309,7 +25476,7 @@ function footnoteDefinition(eat, value, silent) { } if (subqueue.length === 0) { - break; + break } queue += subqueue; @@ -25326,11 +25493,11 @@ function footnoteDefinition(eat, value, silent) { subvalue += content; - content = content.replace(EXPRESSION_INITIAL_TAB, function (line) { + content = content.replace(EXPRESSION_INITIAL_TAB, function(line) { offsets[currentLine] = (offsets[currentLine] || 0) + line.length; currentLine++; - return ''; + return '' }); add = eat(subvalue); @@ -25341,28 +25508,29 @@ function footnoteDefinition(eat, value, silent) { return add({ type: 'footnoteDefinition', - identifier: identifier, + identifier: normalize_1(identifier), + label: identifier, children: content - }); + }) } var definition_1 = definition; definition.notInList = true; definition.notInBlock = true; -var C_DOUBLE_QUOTE = '"'; -var C_SINGLE_QUOTE = '\''; -var C_BACKSLASH$1 = '\\'; -var C_NEWLINE$11 = '\n'; -var C_TAB$10 = '\t'; -var C_SPACE$10 = ' '; -var C_BRACKET_OPEN$1 = '['; -var C_BRACKET_CLOSE$1 = ']'; -var C_PAREN_OPEN = '('; -var C_PAREN_CLOSE$1 = ')'; -var C_COLON$1 = ':'; -var C_LT$1 = '<'; -var C_GT$1 = '>'; +var quotationMark = '"'; +var apostrophe = "'"; +var backslash$2 = '\\'; +var lineFeed$12 = '\n'; +var tab$11 = '\t'; +var space$11 = ' '; +var leftSquareBracket$1 = '['; +var rightSquareBracket$1 = ']'; +var leftParenthesis = '('; +var rightParenthesis$1 = ')'; +var colon$2 = ':'; +var lessThan$1 = '<'; +var greaterThan$1 = '>'; function definition(eat, value, silent) { var self = this; @@ -25382,8 +25550,8 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character !== C_SPACE$10 && character !== C_TAB$10) { - break; + if (character !== space$11 && character !== tab$11) { + break } subvalue += character; @@ -25392,8 +25560,8 @@ function definition(eat, value, silent) { character = value.charAt(index); - if (character !== C_BRACKET_OPEN$1) { - return; + if (character !== leftSquareBracket$1) { + return } index++; @@ -25403,9 +25571,9 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_CLOSE$1) { - break; - } else if (character === C_BACKSLASH$1) { + if (character === rightSquareBracket$1) { + break + } else if (character === backslash$2) { queue += character; index++; character = value.charAt(index); @@ -25417,26 +25585,22 @@ function definition(eat, value, silent) { if ( !queue || - value.charAt(index) !== C_BRACKET_CLOSE$1 || - value.charAt(index + 1) !== C_COLON$1 + value.charAt(index) !== rightSquareBracket$1 || + value.charAt(index + 1) !== colon$2 ) { - return; + return } identifier = queue; - subvalue += queue + C_BRACKET_CLOSE$1 + C_COLON$1; + subvalue += queue + rightSquareBracket$1 + colon$2; index = subvalue.length; queue = ''; while (index < length) { character = value.charAt(index); - if ( - character !== C_TAB$10 && - character !== C_SPACE$10 && - character !== C_NEWLINE$11 - ) { - break; + if (character !== tab$11 && character !== space$11 && character !== lineFeed$12) { + break } subvalue += character; @@ -25447,14 +25611,14 @@ function definition(eat, value, silent) { queue = ''; beforeURL = subvalue; - if (character === C_LT$1) { + if (character === lessThan$1) { index++; while (index < length) { character = value.charAt(index); if (!isEnclosedURLCharacter(character)) { - break; + break } queue += character; @@ -25464,11 +25628,11 @@ function definition(eat, value, silent) { character = value.charAt(index); if (character === isEnclosedURLCharacter.delimiter) { - subvalue += C_LT$1 + queue + character; + subvalue += lessThan$1 + queue + character; index++; } else { if (commonmark) { - return; + return } index -= queue.length + 1; @@ -25481,7 +25645,7 @@ function definition(eat, value, silent) { character = value.charAt(index); if (!isUnclosedURLCharacter(character)) { - break; + break } queue += character; @@ -25492,7 +25656,7 @@ function definition(eat, value, silent) { } if (!queue) { - return; + return } url = queue; @@ -25501,12 +25665,8 @@ function definition(eat, value, silent) { while (index < length) { character = value.charAt(index); - if ( - character !== C_TAB$10 && - character !== C_SPACE$10 && - character !== C_NEWLINE$11 - ) { - break; + if (character !== tab$11 && character !== space$11 && character !== lineFeed$12) { + break } queue += character; @@ -25516,12 +25676,12 @@ function definition(eat, value, silent) { character = value.charAt(index); test = null; - if (character === C_DOUBLE_QUOTE) { - test = C_DOUBLE_QUOTE; - } else if (character === C_SINGLE_QUOTE) { - test = C_SINGLE_QUOTE; - } else if (character === C_PAREN_OPEN) { - test = C_PAREN_CLOSE$1; + if (character === quotationMark) { + test = quotationMark; + } else if (character === apostrophe) { + test = apostrophe; + } else if (character === leftParenthesis) { + test = rightParenthesis$1; } if (!test) { @@ -25536,18 +25696,18 @@ function definition(eat, value, silent) { character = value.charAt(index); if (character === test) { - break; + break } - if (character === C_NEWLINE$11) { + if (character === lineFeed$12) { index++; character = value.charAt(index); - if (character === C_NEWLINE$11 || character === test) { - return; + if (character === lineFeed$12 || character === test) { + return } - queue += C_NEWLINE$11; + queue += lineFeed$12; } queue += character; @@ -25557,7 +25717,7 @@ function definition(eat, value, silent) { character = value.charAt(index); if (character !== test) { - return; + return } beforeTitle = subvalue; @@ -25566,14 +25726,14 @@ function definition(eat, value, silent) { title = queue; queue = ''; } else { - return; + return } while (index < length) { character = value.charAt(index); - if (character !== C_TAB$10 && character !== C_SPACE$10) { - break; + if (character !== tab$11 && character !== space$11) { + break } subvalue += character; @@ -25582,13 +25742,13 @@ function definition(eat, value, silent) { character = value.charAt(index); - if (!character || character === C_NEWLINE$11) { + if (!character || character === lineFeed$12) { if (silent) { - return true; + return true } beforeURL = eat(beforeURL).test().end; - url = self.decode.raw(self.unescape(url), beforeURL); + url = self.decode.raw(self.unescape(url), beforeURL, {nonTerminated: false}); if (title) { beforeTitle = eat(beforeTitle).test().end; @@ -25598,46 +25758,50 @@ function definition(eat, value, silent) { return eat(subvalue)({ type: 'definition', identifier: normalize_1(identifier), + label: identifier, title: title || null, url: url - }); + }) } } -/* Check if `character` can be inside an enclosed URI. */ +// Check if `character` can be inside an enclosed URI. function isEnclosedURLCharacter(character) { - return character !== C_GT$1 && - character !== C_BRACKET_OPEN$1 && - character !== C_BRACKET_CLOSE$1; + return ( + character !== greaterThan$1 && + character !== leftSquareBracket$1 && + character !== rightSquareBracket$1 + ) } -isEnclosedURLCharacter.delimiter = C_GT$1; +isEnclosedURLCharacter.delimiter = greaterThan$1; -/* Check if `character` can be inside an unclosed URI. */ +// Check if `character` can be inside an unclosed URI. function isUnclosedURLCharacter(character) { - return character !== C_BRACKET_OPEN$1 && - character !== C_BRACKET_CLOSE$1 && - !isWhitespaceCharacter(character); + return ( + character !== leftSquareBracket$1 && + character !== rightSquareBracket$1 && + !isWhitespaceCharacter(character) + ) } var table_1 = table$1; -var C_BACKSLASH$2 = '\\'; -var C_TICK$1 = '`'; -var C_DASH$3 = '-'; -var C_PIPE = '|'; -var C_COLON$2 = ':'; -var C_SPACE$11 = ' '; -var C_NEWLINE$12 = '\n'; -var C_TAB$11 = '\t'; +var tab$12 = '\t'; +var lineFeed$13 = '\n'; +var space$12 = ' '; +var dash$4 = '-'; +var colon$3 = ':'; +var backslash$3 = '\\'; +var graveAccent$1 = '`'; +var verticalBar = '|'; -var MIN_TABLE_COLUMNS = 1; -var MIN_TABLE_ROWS = 2; +var minColumns = 1; +var minRows = 2; -var TABLE_ALIGN_LEFT = 'left'; -var TABLE_ALIGN_CENTER = 'center'; -var TABLE_ALIGN_RIGHT = 'right'; -var TABLE_ALIGN_NONE = null; +var left = 'left'; +var center = 'center'; +var right = 'right'; function table$1(eat, value, silent) { var self = this; @@ -25666,35 +25830,34 @@ function table$1(eat, value, silent) { var pipeIndex; var first; - /* Exit when not in gfm-mode. */ + // Exit when not in gfm-mode. if (!self.options.gfm) { - return; + return } - /* Get the rows. - * Detecting tables soon is hard, so there are some - * checks for performance here, such as the minimum - * number of rows, and allowed characters in the - * alignment row. */ + // Get the rows. + // Detecting tables soon is hard, so there are some checks for performance + // here, such as the minimum number of rows, and allowed characters in the + // alignment row. index = 0; lineCount = 0; length = value.length + 1; lines = []; while (index < length) { - lineIndex = value.indexOf(C_NEWLINE$12, index); - pipeIndex = value.indexOf(C_PIPE, index + 1); + lineIndex = value.indexOf(lineFeed$13, index); + pipeIndex = value.indexOf(verticalBar, index + 1); if (lineIndex === -1) { lineIndex = value.length; } if (pipeIndex === -1 || pipeIndex > lineIndex) { - if (lineCount < MIN_TABLE_ROWS) { - return; + if (lineCount < minRows) { + return } - break; + break } lines.push(value.slice(index, lineIndex)); @@ -25702,8 +25865,8 @@ function table$1(eat, value, silent) { index = lineIndex + 1; } - /* Parse the alignment row. */ - subvalue = lines.join(C_NEWLINE$12); + // Parse the alignment row. + subvalue = lines.join(lineFeed$13); alignments = lines.splice(1, 1)[0] || []; index = 0; length = alignments.length; @@ -25714,12 +25877,12 @@ function table$1(eat, value, silent) { while (index < length) { character = alignments.charAt(index); - if (character === C_PIPE) { + if (character === verticalBar) { hasDash = null; if (alignment === false) { if (first === false) { - return; + return } } else { align.push(alignment); @@ -25727,19 +25890,19 @@ function table$1(eat, value, silent) { } first = false; - } else if (character === C_DASH$3) { + } else if (character === dash$4) { hasDash = true; - alignment = alignment || TABLE_ALIGN_NONE; - } else if (character === C_COLON$2) { - if (alignment === TABLE_ALIGN_LEFT) { - alignment = TABLE_ALIGN_CENTER; - } else if (hasDash && alignment === TABLE_ALIGN_NONE) { - alignment = TABLE_ALIGN_RIGHT; + alignment = alignment || null; + } else if (character === colon$3) { + if (alignment === left) { + alignment = center; + } else if (hasDash && alignment === null) { + alignment = right; } else { - alignment = TABLE_ALIGN_LEFT; + alignment = left; } } else if (!isWhitespaceCharacter(character)) { - return; + return } index++; @@ -25749,37 +25912,32 @@ function table$1(eat, value, silent) { align.push(alignment); } - /* Exit when without enough columns. */ - if (align.length < MIN_TABLE_COLUMNS) { - return; + // Exit when without enough columns. + if (align.length < minColumns) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - /* Parse the rows. */ + // Parse the rows. position = -1; rows = []; - table = eat(subvalue).reset({ - type: 'table', - align: align, - children: rows - }); + table = eat(subvalue).reset({type: 'table', align: align, children: rows}); while (++position < lineCount) { line = lines[position]; row = {type: 'tableRow', children: []}; - /* Eat a newline character when this is not the - * first row. */ + // Eat a newline character when this is not the first row. if (position) { - eat(C_NEWLINE$12); + eat(lineFeed$13); } - /* Eat the row. */ + // Eat the row. eat(line).reset(row, table); length = line.length + 1; @@ -25793,7 +25951,7 @@ function table$1(eat, value, silent) { while (index < length) { character = line.charAt(index); - if (character === C_TAB$11 || character === C_SPACE$11) { + if (character === tab$12 || character === space$12) { if (cell) { queue += character; } else { @@ -25801,17 +25959,17 @@ function table$1(eat, value, silent) { } index++; - continue; + continue } - if (character === '' || character === C_PIPE) { + if (character === '' || character === verticalBar) { if (preamble) { eat(character); } else { if (character && opening) { queue += character; index++; - continue; + continue } if ((cell || character) && !preamble) { @@ -25829,10 +25987,10 @@ function table$1(eat, value, silent) { now = eat.now(); - eat(subvalue)({ - type: 'tableCell', - children: self.tokenizeInline(cell, now) - }, row); + eat(subvalue)( + {type: 'tableCell', children: self.tokenizeInline(cell, now)}, + row + ); } eat(queue + character); @@ -25848,12 +26006,12 @@ function table$1(eat, value, silent) { cell += character; - if (character === C_BACKSLASH$2 && index !== length - 2) { + if (character === backslash$3 && index !== length - 2) { cell += line.charAt(index + 1); index++; } - if (character === C_TICK$1) { + if (character === graveAccent$1) { count = 1; while (line.charAt(index + 1) === character) { @@ -25874,24 +26032,24 @@ function table$1(eat, value, silent) { index++; } - /* Eat the alignment row. */ + // Eat the alignment row. if (!position) { - eat(C_NEWLINE$12 + alignments); + eat(lineFeed$13 + alignments); } } - return table; + return table } var paragraph_1 = paragraph; -var C_NEWLINE$13 = '\n'; -var C_TAB$12 = '\t'; -var C_SPACE$12 = ' '; +var tab$13 = '\t'; +var lineFeed$14 = '\n'; +var space$13 = ' '; -var TAB_SIZE$1 = 4; +var tabSize$4 = 4; -/* Tokenise paragraph. */ +// Tokenise paragraph. function paragraph(eat, value, silent) { var self = this; var settings = self.options; @@ -25899,7 +26057,7 @@ function paragraph(eat, value, silent) { var gfm = settings.gfm; var tokenizers = self.blockTokenizers; var interruptors = self.interruptParagraph; - var index = value.indexOf(C_NEWLINE$13); + var index = value.indexOf(lineFeed$14); var length = value.length; var position; var subvalue; @@ -25908,19 +26066,18 @@ function paragraph(eat, value, silent) { var now; while (index < length) { - /* Eat everything if there’s no following newline. */ + // Eat everything if there’s no following newline. if (index === -1) { index = length; - break; + break } - /* Stop if the next character is NEWLINE. */ - if (value.charAt(index + 1) === C_NEWLINE$13) { - break; + // Stop if the next character is NEWLINE. + if (value.charAt(index + 1) === lineFeed$14) { + break } - /* In commonmark-mode, following indented lines - * are part of the paragraph. */ + // In commonmark-mode, following indented lines are part of the paragraph. if (commonmark) { size = 0; position = index + 1; @@ -25928,52 +26085,48 @@ function paragraph(eat, value, silent) { while (position < length) { character = value.charAt(position); - if (character === C_TAB$12) { - size = TAB_SIZE$1; - break; - } else if (character === C_SPACE$12) { + if (character === tab$13) { + size = tabSize$4; + break + } else if (character === space$13) { size++; } else { - break; + break } position++; } - if (size >= TAB_SIZE$1) { - index = value.indexOf(C_NEWLINE$13, index + 1); - continue; + if (size >= tabSize$4 && character !== lineFeed$14) { + index = value.indexOf(lineFeed$14, index + 1); + continue } } subvalue = value.slice(index + 1); - /* Check if the following code contains a possible - * block. */ + // Check if the following code contains a possible block. if (interrupt_1(interruptors, tokenizers, self, [eat, subvalue, true])) { - break; + break } - /* Break if the following line starts a list, when - * already in a list, or when in commonmark, or when - * in gfm mode and the bullet is *not* numeric. */ + // Break if the following line starts a list, when already in a list, or + // when in commonmark, or when in gfm mode and the bullet is *not* numeric. if ( tokenizers.list.call(self, eat, subvalue, true) && - ( - self.inList || + (self.inList || commonmark || - (gfm && !isDecimal(trim_1.left(subvalue).charAt(0))) - ) + (gfm && !isDecimal(trim_1.left(subvalue).charAt(0)))) ) { - break; + break } position = index; - index = value.indexOf(C_NEWLINE$13, index + 1); + index = value.indexOf(lineFeed$14, index + 1); if (index !== -1 && trim_1(value.slice(position, index)) === '') { index = position; - break; + break } } @@ -25982,12 +26135,12 @@ function paragraph(eat, value, silent) { if (trim_1(subvalue) === '') { eat(subvalue); - return null; + return null } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } now = eat.now(); @@ -25996,42 +26149,42 @@ function paragraph(eat, value, silent) { return eat(subvalue)({ type: 'paragraph', children: self.tokenizeInline(subvalue, now) - }); + }) } var _escape = locate; function locate(value, fromIndex) { - return value.indexOf('\\', fromIndex); + return value.indexOf('\\', fromIndex) } var _escape$2 = escape; escape.locator = _escape; +var lineFeed$15 = '\n'; +var backslash$4 = '\\'; + function escape(eat, value, silent) { var self = this; var character; var node; - if (value.charAt(0) === '\\') { + if (value.charAt(0) === backslash$4) { character = value.charAt(1); if (self.escape.indexOf(character) !== -1) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - if (character === '\n') { + if (character === lineFeed$15) { node = {type: 'break'}; } else { - node = { - type: 'text', - value: character - }; + node = {type: 'text', value: character}; } - return eat('\\' + character)(node); + return eat(backslash$4 + character)(node) } } } @@ -26039,60 +26192,51 @@ function escape(eat, value, silent) { var tag$1 = locate$2; function locate$2(value, fromIndex) { - return value.indexOf('<', fromIndex); + return value.indexOf('<', fromIndex) } var autoLink_1 = autoLink; autoLink.locator = tag$1; autoLink.notInLink = true; -var C_LT$2 = '<'; -var C_GT$2 = '>'; -var C_AT_SIGN = '@'; -var C_SLASH = '/'; -var MAILTO = 'mailto:'; -var MAILTO_LENGTH = MAILTO.length; +var lessThan$2 = '<'; +var greaterThan$2 = '>'; +var atSign = '@'; +var slash = '/'; +var mailto = 'mailto:'; +var mailtoLength = mailto.length; -/* Tokenise a link. */ function autoLink(eat, value, silent) { - var self; - var subvalue; - var length; - var index; - var queue; + var self = this; + var subvalue = ''; + var length = value.length; + var index = 0; + var queue = ''; + var hasAtCharacter = false; + var link = ''; var character; - var hasAtCharacter; - var link; var now; var content; - var tokenize; + var tokenizers; var exit; - if (value.charAt(0) !== C_LT$2) { - return; + if (value.charAt(0) !== lessThan$2) { + return } - self = this; - subvalue = ''; - length = value.length; - index = 0; - queue = ''; - hasAtCharacter = false; - link = ''; - index++; - subvalue = C_LT$2; + subvalue = lessThan$2; while (index < length) { character = value.charAt(index); if ( isWhitespaceCharacter(character) || - character === C_GT$2 || - character === C_AT_SIGN || - (character === ':' && value.charAt(index + 1) === C_SLASH) + character === greaterThan$2 || + character === atSign || + (character === ':' && value.charAt(index + 1) === slash) ) { - break; + break } queue += character; @@ -26100,7 +26244,7 @@ function autoLink(eat, value, silent) { } if (!queue) { - return; + return } link += queue; @@ -26110,25 +26254,22 @@ function autoLink(eat, value, silent) { link += character; index++; - if (character === C_AT_SIGN) { + if (character === atSign) { hasAtCharacter = true; } else { - if ( - character !== ':' || - value.charAt(index + 1) !== C_SLASH - ) { - return; + if (character !== ':' || value.charAt(index + 1) !== slash) { + return } - link += C_SLASH; + link += slash; index++; } while (index < length) { character = value.charAt(index); - if (isWhitespaceCharacter(character) || character === C_GT$2) { - break; + if (isWhitespaceCharacter(character) || character === greaterThan$2) { + break } queue += character; @@ -26137,13 +26278,13 @@ function autoLink(eat, value, silent) { character = value.charAt(index); - if (!queue || character !== C_GT$2) { - return; + if (!queue || character !== greaterThan$2) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } link += queue; @@ -26154,80 +26295,83 @@ function autoLink(eat, value, silent) { now.offset++; if (hasAtCharacter) { - if (link.slice(0, MAILTO_LENGTH).toLowerCase() === MAILTO) { - content = content.substr(MAILTO_LENGTH); - now.column += MAILTO_LENGTH; - now.offset += MAILTO_LENGTH; + if (link.slice(0, mailtoLength).toLowerCase() === mailto) { + content = content.substr(mailtoLength); + now.column += mailtoLength; + now.offset += mailtoLength; } else { - link = MAILTO + link; + link = mailto + link; } } - /* Temporarily remove support for escapes in autolinks. */ - tokenize = self.inlineTokenizers.escape; - self.inlineTokenizers.escape = null; + // Temporarily remove all tokenizers except text in autolinks. + tokenizers = self.inlineTokenizers; + self.inlineTokenizers = {text: tokenizers.text}; + exit = self.enterLink(); content = self.tokenizeInline(content, now); - self.inlineTokenizers.escape = tokenize; + self.inlineTokenizers = tokenizers; exit(); return eat(subvalue)({ type: 'link', title: null, - url: parseEntities_1(link), + url: parseEntities_1(link, {nonTerminated: false}), children: content - }); + }) } var url = locate$4; -var PROTOCOLS = ['https://', 'http://', 'mailto:']; +var protocols = ['https://', 'http://', 'mailto:']; function locate$4(value, fromIndex) { - var length = PROTOCOLS.length; + var length = protocols.length; var index = -1; var min = -1; var position; if (!this.options.gfm) { - return -1; + return -1 } while (++index < length) { - position = value.indexOf(PROTOCOLS[index], fromIndex); + position = value.indexOf(protocols[index], fromIndex); if (position !== -1 && (position < min || min === -1)) { min = position; } } - return min; + return min } var url_1 = url$2; url$2.locator = url; url$2.notInLink = true; -var C_BRACKET_OPEN$2 = '['; -var C_BRACKET_CLOSE$2 = ']'; -var C_PAREN_OPEN$1 = '('; -var C_PAREN_CLOSE$2 = ')'; -var C_LT$3 = '<'; -var C_AT_SIGN$1 = '@'; - -var HTTP_PROTOCOL = 'http://'; -var HTTPS_PROTOCOL = 'https://'; -var MAILTO_PROTOCOL = 'mailto:'; - -var PROTOCOLS$1 = [ - HTTP_PROTOCOL, - HTTPS_PROTOCOL, - MAILTO_PROTOCOL -]; +var quotationMark$1 = '"'; +var apostrophe$1 = "'"; +var leftParenthesis$1 = '('; +var rightParenthesis$2 = ')'; +var comma$1 = ','; +var dot$2 = '.'; +var colon$4 = ':'; +var semicolon = ';'; +var lessThan$3 = '<'; +var atSign$1 = '@'; +var leftSquareBracket$2 = '['; +var rightSquareBracket$2 = ']'; + +var http = 'http://'; +var https = 'https://'; +var mailto$1 = 'mailto:'; + +var protocols$1 = [http, https, mailto$1]; -var PROTOCOLS_LENGTH = PROTOCOLS$1.length; +var protocolsLength = protocols$1.length; function url$2(eat, value, silent) { var self = this; @@ -26242,28 +26386,28 @@ function url$2(eat, value, silent) { var queue; var parenCount; var nextCharacter; + var tokenizers; var exit; if (!self.options.gfm) { - return; + return } subvalue = ''; index = -1; - length = PROTOCOLS_LENGTH; - while (++index < length) { - protocol = PROTOCOLS$1[index]; + while (++index < protocolsLength) { + protocol = protocols$1[index]; match = value.slice(0, protocol.length); if (match.toLowerCase() === protocol) { subvalue = match; - break; + break } } if (!subvalue) { - return; + return } index = subvalue.length; @@ -26274,36 +26418,36 @@ function url$2(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (isWhitespaceCharacter(character) || character === C_LT$3) { - break; + if (isWhitespaceCharacter(character) || character === lessThan$3) { + break } if ( - character === '.' || - character === ',' || - character === ':' || - character === ';' || - character === '"' || - character === '\'' || - character === ')' || - character === ']' + character === dot$2 || + character === comma$1 || + character === colon$4 || + character === semicolon || + character === quotationMark$1 || + character === apostrophe$1 || + character === rightParenthesis$2 || + character === rightSquareBracket$2 ) { nextCharacter = value.charAt(index + 1); if (!nextCharacter || isWhitespaceCharacter(nextCharacter)) { - break; + break } } - if (character === C_PAREN_OPEN$1 || character === C_BRACKET_OPEN$2) { + if (character === leftParenthesis$1 || character === leftSquareBracket$2) { parenCount++; } - if (character === C_PAREN_CLOSE$2 || character === C_BRACKET_CLOSE$2) { + if (character === rightParenthesis$2 || character === rightSquareBracket$2) { parenCount--; if (parenCount < 0) { - break; + break } } @@ -26312,37 +26456,44 @@ function url$2(eat, value, silent) { } if (!queue) { - return; + return } subvalue += queue; content = subvalue; - if (protocol === MAILTO_PROTOCOL) { - position = queue.indexOf(C_AT_SIGN$1); + if (protocol === mailto$1) { + position = queue.indexOf(atSign$1); if (position === -1 || position === length - 1) { - return; + return } - content = content.substr(MAILTO_PROTOCOL.length); + content = content.substr(mailto$1.length); } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } exit = self.enterLink(); + + // Temporarily remove all tokenizers except text in url. + tokenizers = self.inlineTokenizers; + self.inlineTokenizers = {text: tokenizers.text}; + content = self.tokenizeInline(content, eat.now()); + + self.inlineTokenizers = tokenizers; exit(); return eat(subvalue)({ type: 'link', title: null, - url: parseEntities_1(subvalue), + url: parseEntities_1(subvalue, {nonTerminated: false}), children: content - }); + }) } var tag$3 = html.tag; @@ -26350,8 +26501,13 @@ var tag$3 = html.tag; var htmlInline = inlineHTML; inlineHTML.locator = tag$1; -var EXPRESSION_HTML_LINK_OPEN = /^/i; +var lessThan$4 = '<'; +var questionMark = '?'; +var exclamationMark$1 = '!'; +var slash$1 = '/'; + +var htmlLinkOpenExpression = /^/i; function inlineHTML(eat, value, silent) { var self = this; @@ -26359,41 +26515,41 @@ function inlineHTML(eat, value, silent) { var character; var subvalue; - if (value.charAt(0) !== '<' || length < 3) { - return; + if (value.charAt(0) !== lessThan$4 || length < 3) { + return } character = value.charAt(1); if ( !isAlphabetical(character) && - character !== '?' && - character !== '!' && - character !== '/' + character !== questionMark && + character !== exclamationMark$1 && + character !== slash$1 ) { - return; + return } subvalue = value.match(tag$3); if (!subvalue) { - return; + return } /* istanbul ignore if - not used yet. */ if (silent) { - return true; + return true } subvalue = subvalue[0]; - if (!self.inLink && EXPRESSION_HTML_LINK_OPEN.test(subvalue)) { + if (!self.inLink && htmlLinkOpenExpression.test(subvalue)) { self.inLink = true; - } else if (self.inLink && EXPRESSION_HTML_LINK_CLOSE.test(subvalue)) { + } else if (self.inLink && htmlLinkCloseExpression.test(subvalue)) { self.inLink = false; } - return eat(subvalue)({type: 'html', value: subvalue}); + return eat(subvalue)({type: 'html', value: subvalue}) } var link = locate$6; @@ -26403,44 +26559,29 @@ function locate$6(value, fromIndex) { var image = value.indexOf('![', fromIndex); if (image === -1) { - return link; + return link } - /* Link can never be `-1` if an image is found, so we don’t need - * to check for that :) */ - return link < image ? link : image; + // Link can never be `-1` if an image is found, so we don’t need to check + // for that :) + return link < image ? link : image } var link_1 = link$2; link$2.locator = link; -var own$5 = {}.hasOwnProperty; - -var C_BACKSLASH$3 = '\\'; -var C_BRACKET_OPEN$3 = '['; -var C_BRACKET_CLOSE$3 = ']'; -var C_PAREN_OPEN$2 = '('; -var C_PAREN_CLOSE$3 = ')'; -var C_LT$4 = '<'; -var C_GT$3 = '>'; -var C_TICK$2 = '`'; -var C_DOUBLE_QUOTE$1 = '"'; -var C_SINGLE_QUOTE$1 = '\''; - -/* Map of characters, which can be used to mark link - * and image titles. */ -var LINK_MARKERS = {}; - -LINK_MARKERS[C_DOUBLE_QUOTE$1] = C_DOUBLE_QUOTE$1; -LINK_MARKERS[C_SINGLE_QUOTE$1] = C_SINGLE_QUOTE$1; - -/* Map of characters, which can be used to mark link - * and image titles in commonmark-mode. */ -var COMMONMARK_LINK_MARKERS = {}; - -COMMONMARK_LINK_MARKERS[C_DOUBLE_QUOTE$1] = C_DOUBLE_QUOTE$1; -COMMONMARK_LINK_MARKERS[C_SINGLE_QUOTE$1] = C_SINGLE_QUOTE$1; -COMMONMARK_LINK_MARKERS[C_PAREN_OPEN$2] = C_PAREN_CLOSE$3; +var lineFeed$16 = '\n'; +var exclamationMark$2 = '!'; +var quotationMark$2 = '"'; +var apostrophe$2 = "'"; +var leftParenthesis$2 = '('; +var rightParenthesis$3 = ')'; +var lessThan$5 = '<'; +var greaterThan$3 = '>'; +var leftSquareBracket$3 = '['; +var backslash$5 = '\\'; +var rightSquareBracket$3 = ']'; +var graveAccent$2 = '`'; function link$2(eat, value, silent) { var self = this; @@ -26457,7 +26598,6 @@ function link$2(eat, value, silent) { var beforeTitle; var subqueue; var hasMarker; - var markers; var isImage; var content; var marker; @@ -26470,29 +26610,28 @@ function link$2(eat, value, silent) { var exit; var node; - /* Detect whether this is an image. */ - if (character === '!') { + // Detect whether this is an image. + if (character === exclamationMark$2) { isImage = true; subvalue = character; character = value.charAt(++index); } - /* Eat the opening. */ - if (character !== C_BRACKET_OPEN$3) { - return; + // Eat the opening. + if (character !== leftSquareBracket$3) { + return } - /* Exit when this is a link and we’re already inside - * a link. */ + // Exit when this is a link and we’re already inside a link. if (!isImage && self.inLink) { - return; + return } subvalue += character; queue = ''; index++; - /* Eat the content. */ + // Eat the content. length = value.length; now = eat.now(); depth = 0; @@ -26504,11 +26643,11 @@ function link$2(eat, value, silent) { character = value.charAt(index); subqueue = character; - if (character === C_TICK$2) { - /* Inline-code in link content. */ + if (character === graveAccent$2) { + // Inline-code in link content. count = 1; - while (value.charAt(index + 1) === C_TICK$2) { + while (value.charAt(index + 1) === graveAccent$2) { subqueue += character; index++; count++; @@ -26519,28 +26658,25 @@ function link$2(eat, value, silent) { } else if (count >= opening) { opening = 0; } - } else if (character === C_BACKSLASH$3) { - /* Allow brackets to be escaped. */ + } else if (character === backslash$5) { + // Allow brackets to be escaped. index++; subqueue += value.charAt(index); - /* In GFM mode, brackets in code still count. - * In all other modes, they don’t. This empty - * block prevents the next statements are - * entered. */ - } else if ((!opening || gfm) && character === C_BRACKET_OPEN$3) { + } else if ((!opening || gfm) && character === leftSquareBracket$3) { + // In GFM mode, brackets in code still count. In all other modes, + // they don’t. depth++; - } else if ((!opening || gfm) && character === C_BRACKET_CLOSE$3) { + } else if ((!opening || gfm) && character === rightSquareBracket$3) { if (depth) { depth--; } else { - /* Allow white-space between content and - * url in GFM mode. */ + // Allow white-space between content and url in GFM mode. if (!pedantic) { while (index < length) { character = value.charAt(index + 1); if (!isWhitespaceCharacter(character)) { - break; + break } subqueue += character; @@ -26548,15 +26684,15 @@ function link$2(eat, value, silent) { } } - if (value.charAt(index + 1) !== C_PAREN_OPEN$2) { - return; + if (value.charAt(index + 1) !== leftParenthesis$2) { + return } - subqueue += C_PAREN_OPEN$2; + subqueue += leftParenthesis$2; closed = true; index++; - break; + break } } @@ -26565,57 +26701,56 @@ function link$2(eat, value, silent) { index++; } - /* Eat the content closing. */ + // Eat the content closing. if (!closed) { - return; + return } content = queue; subvalue += queue + subqueue; index++; - /* Eat white-space. */ + // Eat white-space. while (index < length) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } subvalue += character; index++; } - /* Eat the URL. */ + // Eat the URL. character = value.charAt(index); - markers = commonmark ? COMMONMARK_LINK_MARKERS : LINK_MARKERS; queue = ''; beforeURL = subvalue; - if (character === C_LT$4) { + if (character === lessThan$5) { index++; - beforeURL += C_LT$4; + beforeURL += lessThan$5; while (index < length) { character = value.charAt(index); - if (character === C_GT$3) { - break; + if (character === greaterThan$3) { + break } - if (commonmark && character === '\n') { - return; + if (commonmark && character === lineFeed$16) { + return } queue += character; index++; } - if (value.charAt(index) !== C_GT$3) { - return; + if (value.charAt(index) !== greaterThan$3) { + return } - subvalue += C_LT$4 + queue + C_GT$3; + subvalue += lessThan$5 + queue + greaterThan$3; url = queue; index++; } else { @@ -26625,22 +26760,27 @@ function link$2(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (subqueue && own$5.call(markers, character)) { - break; + if ( + subqueue && + (character === quotationMark$2 || + character === apostrophe$2 || + (commonmark && character === leftParenthesis$2)) + ) { + break } if (isWhitespaceCharacter(character)) { if (!pedantic) { - break; + break } subqueue += character; } else { - if (character === C_PAREN_OPEN$2) { + if (character === leftParenthesis$2) { depth++; - } else if (character === C_PAREN_CLOSE$3) { + } else if (character === rightParenthesis$3) { if (depth === 0) { - break; + break } depth--; @@ -26649,8 +26789,8 @@ function link$2(eat, value, silent) { queue += subqueue; subqueue = ''; - if (character === C_BACKSLASH$3) { - queue += C_BACKSLASH$3; + if (character === backslash$5) { + queue += backslash$5; character = value.charAt(++index); } @@ -26665,14 +26805,14 @@ function link$2(eat, value, silent) { index = subvalue.length; } - /* Eat white-space. */ + // Eat white-space. queue = ''; while (index < length) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } queue += character; @@ -26682,29 +26822,32 @@ function link$2(eat, value, silent) { character = value.charAt(index); subvalue += queue; - /* Eat the title. */ - if (queue && own$5.call(markers, character)) { + // Eat the title. + if ( + queue && + (character === quotationMark$2 || + character === apostrophe$2 || + (commonmark && character === leftParenthesis$2)) + ) { index++; subvalue += character; queue = ''; - marker = markers[character]; + marker = character === leftParenthesis$2 ? rightParenthesis$3 : character; beforeTitle = subvalue; - /* In commonmark-mode, things are pretty easy: the - * marker cannot occur inside the title. - * - * Non-commonmark does, however, support nested - * delimiters. */ + // In commonmark-mode, things are pretty easy: the marker cannot occur + // inside the title. Non-commonmark does, however, support nested + // delimiters. if (commonmark) { while (index < length) { character = value.charAt(index); if (character === marker) { - break; + break } - if (character === C_BACKSLASH$3) { - queue += C_BACKSLASH$3; + if (character === backslash$5) { + queue += backslash$5; character = value.charAt(++index); } @@ -26715,7 +26858,7 @@ function link$2(eat, value, silent) { character = value.charAt(index); if (character !== marker) { - return; + return } title = queue; @@ -26726,7 +26869,7 @@ function link$2(eat, value, silent) { character = value.charAt(index); if (!isWhitespaceCharacter(character)) { - break; + break } subvalue += character; @@ -26747,10 +26890,10 @@ function link$2(eat, value, silent) { hasMarker = true; } else if (!hasMarker) { queue += character; - } else if (character === C_PAREN_CLOSE$3) { + } else if (character === rightParenthesis$3) { subvalue += queue + marker + subqueue; title = queue; - break; + break } else if (isWhitespaceCharacter(character)) { subqueue += character; } else { @@ -26764,18 +26907,20 @@ function link$2(eat, value, silent) { } } - if (value.charAt(index) !== C_PAREN_CLOSE$3) { - return; + if (value.charAt(index) !== rightParenthesis$3) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - subvalue += C_PAREN_CLOSE$3; + subvalue += rightParenthesis$3; - url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end); + url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end, { + nonTerminated: false + }); if (title) { beforeTitle = eat(beforeTitle).test().end; @@ -26796,32 +26941,35 @@ function link$2(eat, value, silent) { exit(); } - return eat(subvalue)(node); + return eat(subvalue)(node) } var reference_1 = reference; reference.locator = link; -var T_LINK = 'link'; -var T_IMAGE = 'image'; -var T_FOOTNOTE = 'footnote'; -var REFERENCE_TYPE_SHORTCUT = 'shortcut'; -var REFERENCE_TYPE_COLLAPSED = 'collapsed'; -var REFERENCE_TYPE_FULL = 'full'; -var C_CARET$1 = '^'; -var C_BACKSLASH$4 = '\\'; -var C_BRACKET_OPEN$4 = '['; -var C_BRACKET_CLOSE$4 = ']'; +var link$3 = 'link'; +var image$1 = 'image'; +var footnote = 'footnote'; +var shortcut = 'shortcut'; +var collapsed = 'collapsed'; +var full = 'full'; +var space$14 = ' '; +var exclamationMark$3 = '!'; +var leftSquareBracket$4 = '['; +var backslash$6 = '\\'; +var rightSquareBracket$4 = ']'; +var caret$2 = '^'; function reference(eat, value, silent) { var self = this; + var commonmark = self.options.commonmark; var character = value.charAt(0); var index = 0; var length = value.length; var subvalue = ''; var intro = ''; - var type = T_LINK; - var referenceType = REFERENCE_TYPE_SHORTCUT; + var type = link$3; + var referenceType = shortcut; var content; var identifier; var now; @@ -26831,51 +26979,53 @@ function reference(eat, value, silent) { var bracketed; var depth; - /* Check whether we’re eating an image. */ - if (character === '!') { - type = T_IMAGE; + // Check whether we’re eating an image. + if (character === exclamationMark$3) { + type = image$1; intro = character; character = value.charAt(++index); } - if (character !== C_BRACKET_OPEN$4) { - return; + if (character !== leftSquareBracket$4) { + return } index++; intro += character; queue = ''; - /* Check whether we’re eating a footnote. */ - if ( - self.options.footnotes && - type === T_LINK && - value.charAt(index) === C_CARET$1 - ) { - intro += C_CARET$1; + // Check whether we’re eating a footnote. + if (self.options.footnotes && value.charAt(index) === caret$2) { + // Exit if `![^` is found, so the `!` will be seen as text after this, + // and we’ll enter this function again when `[^` is found. + if (type === image$1) { + return + } + + intro += caret$2; index++; - type = T_FOOTNOTE; + type = footnote; } - /* Eat the text. */ + // Eat the text. depth = 0; while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_OPEN$4) { + if (character === leftSquareBracket$4) { bracketed = true; depth++; - } else if (character === C_BRACKET_CLOSE$4) { + } else if (character === rightSquareBracket$4) { if (!depth) { - break; + break } depth--; } - if (character === C_BACKSLASH$4) { - queue += C_BACKSLASH$4; + if (character === backslash$6) { + queue += backslash$6; character = value.charAt(++index); } @@ -26887,29 +27037,34 @@ function reference(eat, value, silent) { content = queue; character = value.charAt(index); - if (character !== C_BRACKET_CLOSE$4) { - return; + if (character !== rightSquareBracket$4) { + return } index++; subvalue += character; queue = ''; - while (index < length) { - character = value.charAt(index); + if (!commonmark) { + // The original markdown syntax definition explicitly allows for whitespace + // between the link text and link label; commonmark departs from this, in + // part to improve support for shortcut reference links + while (index < length) { + character = value.charAt(index); - if (!isWhitespaceCharacter(character)) { - break; - } + if (!isWhitespaceCharacter(character)) { + break + } - queue += character; - index++; + queue += character; + index++; + } } character = value.charAt(index); - /* Inline footnotes cannot have an identifier. */ - if (type !== T_FOOTNOTE && character === C_BRACKET_OPEN$4) { + // Inline footnotes cannot have an identifier. + if (type !== footnote && character === leftSquareBracket$4) { identifier = ''; queue += character; index++; @@ -26917,12 +27072,12 @@ function reference(eat, value, silent) { while (index < length) { character = value.charAt(index); - if (character === C_BRACKET_OPEN$4 || character === C_BRACKET_CLOSE$4) { - break; + if (character === leftSquareBracket$4 || character === rightSquareBracket$4) { + break } - if (character === C_BACKSLASH$4) { - identifier += C_BACKSLASH$4; + if (character === backslash$6) { + identifier += backslash$6; character = value.charAt(++index); } @@ -26932,8 +27087,8 @@ function reference(eat, value, silent) { character = value.charAt(index); - if (character === C_BRACKET_CLOSE$4) { - referenceType = identifier ? REFERENCE_TYPE_FULL : REFERENCE_TYPE_COLLAPSED; + if (character === rightSquareBracket$4) { + referenceType = identifier ? full : collapsed; queue += identifier + character; index++; } else { @@ -26944,58 +27099,59 @@ function reference(eat, value, silent) { queue = ''; } else { if (!content) { - return; + return } identifier = content; } - /* Brackets cannot be inside the identifier. */ - if (referenceType !== REFERENCE_TYPE_FULL && bracketed) { - return; + // Brackets cannot be inside the identifier. + if (referenceType !== full && bracketed) { + return } subvalue = intro + subvalue; - if (type === T_LINK && self.inLink) { - return null; + if (type === link$3 && self.inLink) { + return null } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - if (type === T_FOOTNOTE && content.indexOf(' ') !== -1) { + if (type === footnote && content.indexOf(space$14) !== -1) { return eat(subvalue)({ - type: 'footnote', + type: footnote, children: this.tokenizeInline(content, eat.now()) - }); + }) } now = eat.now(); now.column += intro.length; now.offset += intro.length; - identifier = referenceType === REFERENCE_TYPE_FULL ? identifier : content; + identifier = referenceType === full ? identifier : content; node = { type: type + 'Reference', - identifier: normalize_1(identifier) + identifier: normalize_1(identifier), + label: identifier }; - if (type === T_LINK || type === T_IMAGE) { + if (type === link$3 || type === image$1) { node.referenceType = referenceType; } - if (type === T_LINK) { + if (type === link$3) { exit = self.enterLink(); node.children = self.tokenizeInline(content, now); exit(); - } else if (type === T_IMAGE) { + } else if (type === image$1) { node.alt = self.decode.raw(self.unescape(content), now) || null; } - return eat(subvalue)(node); + return eat(subvalue)(node) } var strong = locate$8; @@ -27005,21 +27161,22 @@ function locate$8(value, fromIndex) { var underscore = value.indexOf('__', fromIndex); if (underscore === -1) { - return asterisk; + return asterisk } if (asterisk === -1) { - return underscore; + return underscore } - return underscore < asterisk ? underscore : asterisk; + return underscore < asterisk ? underscore : asterisk } var strong_1 = strong$2; strong$2.locator = strong; -var C_ASTERISK$2 = '*'; -var C_UNDERSCORE$2 = '_'; +var backslash$7 = '\\'; +var asterisk$2 = '*'; +var underscore$2 = '_'; function strong$2(eat, value, silent) { var self = this; @@ -27034,10 +27191,10 @@ function strong$2(eat, value, silent) { var prev; if ( - (character !== C_ASTERISK$2 && character !== C_UNDERSCORE$2) || + (character !== asterisk$2 && character !== underscore$2) || value.charAt(++index) !== character ) { - return; + return } pedantic = self.options.pedantic; @@ -27049,7 +27206,7 @@ function strong$2(eat, value, silent) { character = ''; if (pedantic && isWhitespaceCharacter(value.charAt(index))) { - return; + return } while (index < length) { @@ -27065,12 +27222,12 @@ function strong$2(eat, value, silent) { if (character !== marker) { if (!trim_1(queue)) { - return; + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } now = eat.now(); @@ -27080,11 +27237,11 @@ function strong$2(eat, value, silent) { return eat(subvalue + queue + subvalue)({ type: 'strong', children: self.tokenizeInline(queue, now) - }); + }) } } - if (!pedantic && character === '\\') { + if (!pedantic && character === backslash$7) { queue += character; character = value.charAt(++index); } @@ -27114,21 +27271,22 @@ function locate$10(value, fromIndex) { var underscore = value.indexOf('_', fromIndex); if (underscore === -1) { - return asterisk; + return asterisk } if (asterisk === -1) { - return underscore; + return underscore } - return underscore < asterisk ? underscore : asterisk; + return underscore < asterisk ? underscore : asterisk } var emphasis_1 = emphasis$2; emphasis$2.locator = emphasis; -var C_ASTERISK$3 = '*'; -var C_UNDERSCORE$3 = '_'; +var asterisk$3 = '*'; +var underscore$3 = '_'; +var backslash$8 = '\\'; function emphasis$2(eat, value, silent) { var self = this; @@ -27142,8 +27300,8 @@ function emphasis$2(eat, value, silent) { var length; var prev; - if (character !== C_ASTERISK$3 && character !== C_UNDERSCORE$3) { - return; + if (character !== asterisk$3 && character !== underscore$3) { + return } pedantic = self.options.pedantic; @@ -27155,7 +27313,7 @@ function emphasis$2(eat, value, silent) { character = ''; if (pedantic && isWhitespaceCharacter(value.charAt(index))) { - return; + return } while (index < length) { @@ -27167,17 +27325,17 @@ function emphasis$2(eat, value, silent) { if (character !== marker) { if (!trim_1(queue) || prev === marker) { - return; + return } - if (!pedantic && marker === C_UNDERSCORE$3 && isWordCharacter(character)) { + if (!pedantic && marker === underscore$3 && isWordCharacter(character)) { queue += marker; - continue; + continue } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } now = eat.now(); @@ -27187,13 +27345,13 @@ function emphasis$2(eat, value, silent) { return eat(subvalue + queue + marker)({ type: 'emphasis', children: self.tokenizeInline(queue, now) - }); + }) } queue += marker; } - if (!pedantic && character === '\\') { + if (!pedantic && character === backslash$8) { queue += character; character = value.charAt(++index); } @@ -27206,14 +27364,14 @@ function emphasis$2(eat, value, silent) { var _delete = locate$12; function locate$12(value, fromIndex) { - return value.indexOf('~~', fromIndex); + return value.indexOf('~~', fromIndex) } var _delete$2 = strikethrough; strikethrough.locator = _delete; -var C_TILDE$1 = '~'; -var DOUBLE = '~~'; +var tilde$2 = '~'; +var fence = '~~'; function strikethrough(eat, value, silent) { var self = this; @@ -27227,11 +27385,11 @@ function strikethrough(eat, value, silent) { if ( !self.options.gfm || - value.charAt(0) !== C_TILDE$1 || - value.charAt(1) !== C_TILDE$1 || + value.charAt(0) !== tilde$2 || + value.charAt(1) !== tilde$2 || isWhitespaceCharacter(value.charAt(2)) ) { - return; + return } index = 1; @@ -27244,19 +27402,19 @@ function strikethrough(eat, value, silent) { character = value.charAt(index); if ( - character === C_TILDE$1 && - previous === C_TILDE$1 && + character === tilde$2 && + previous === tilde$2 && (!preceding || !isWhitespaceCharacter(preceding)) ) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } - return eat(DOUBLE + subvalue + DOUBLE)({ + return eat(fence + subvalue + fence)({ type: 'delete', children: self.tokenizeInline(subvalue, now) - }); + }) } subvalue += previous; @@ -27268,15 +27426,14 @@ function strikethrough(eat, value, silent) { var codeInline = locate$14; function locate$14(value, fromIndex) { - return value.indexOf('`', fromIndex); + return value.indexOf('`', fromIndex) } var codeInline$2 = inlineCode; inlineCode.locator = codeInline; -var C_TICK$3 = '`'; +var graveAccent$3 = '`'; -/* Tokenise inline code. */ function inlineCode(eat, value, silent) { var length = value.length; var index = 0; @@ -27292,16 +27449,16 @@ function inlineCode(eat, value, silent) { var next; while (index < length) { - if (value.charAt(index) !== C_TICK$3) { - break; + if (value.charAt(index) !== graveAccent$3) { + break } - queue += C_TICK$3; + queue += graveAccent$3; index++; } if (!queue) { - return; + return } subvalue = queue; @@ -27314,7 +27471,7 @@ function inlineCode(eat, value, silent) { character = next; next = value.charAt(index + 1); - if (character === C_TICK$3) { + if (character === graveAccent$3) { count++; tickQueue += character; } else { @@ -27322,11 +27479,11 @@ function inlineCode(eat, value, silent) { queue += character; } - if (count && next !== C_TICK$3) { + if (count && next !== graveAccent$3) { if (count === openingCount) { subvalue += queue + tickQueue; found = true; - break; + break } queue += tickQueue; @@ -27338,7 +27495,7 @@ function inlineCode(eat, value, silent) { if (!found) { if (openingCount % 2 !== 0) { - return; + return } queue = ''; @@ -27346,7 +27503,7 @@ function inlineCode(eat, value, silent) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } contentQueue = ''; @@ -27359,7 +27516,7 @@ function inlineCode(eat, value, silent) { if (isWhitespaceCharacter(character)) { subqueue += character; - continue; + continue } if (subqueue) { @@ -27373,10 +27530,7 @@ function inlineCode(eat, value, silent) { contentQueue += character; } - return eat(subvalue)({ - type: 'inlineCode', - value: contentQueue - }); + return eat(subvalue)({type: 'inlineCode', value: contentQueue}) } var _break = locate$16; @@ -27386,19 +27540,21 @@ function locate$16(value, fromIndex) { while (index > fromIndex) { if (value.charAt(index - 1) !== ' ') { - break; + break } index--; } - return index; + return index } var _break$2 = hardBreak; hardBreak.locator = _break; -var MIN_BREAK_LENGTH = 2; +var space$15 = ' '; +var lineFeed$17 = '\n'; +var minBreakLength = 2; function hardBreak(eat, value, silent) { var length = value.length; @@ -27409,23 +27565,23 @@ function hardBreak(eat, value, silent) { while (++index < length) { character = value.charAt(index); - if (character === '\n') { - if (index < MIN_BREAK_LENGTH) { - return; + if (character === lineFeed$17) { + if (index < minBreakLength) { + return } /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } queue += character; - return eat(queue)({type: 'break'}); + return eat(queue)({type: 'break'}) } - if (character !== ' ') { - return; + if (character !== space$15) { + return } queue += character; @@ -27449,7 +27605,7 @@ function text(eat, value, silent) { /* istanbul ignore if - never used (yet) */ if (silent) { - return true; + return true } methods = self.inlineMethods; @@ -27462,7 +27618,7 @@ function text(eat, value, silent) { name = methods[index]; if (name === 'text' || !tokenizers[name]) { - continue; + continue } tokenizer = tokenizers[name].locator; @@ -27481,12 +27637,11 @@ function text(eat, value, silent) { subvalue = value.slice(0, min); now = eat.now(); - self.decode(subvalue, now, function (content, position, source) { - eat(source || content)({ - type: 'text', - value: content - }); - }); + self.decode(subvalue, now, handler); + + function handler(content, position, source) { + eat(source || content)({type: 'text', value: content}); + } } var parser = Parser; @@ -27507,31 +27662,30 @@ function Parser(doc, file) { this.decode = decode$1(this); } -var proto$3 = Parser.prototype; +var proto$5 = Parser.prototype; -/* Expose core. */ -proto$3.setOptions = setOptions_1; -proto$3.parse = parse_1$3; +// Expose core. +proto$5.setOptions = setOptions_1; +proto$5.parse = parse_1$3; -/* Expose `defaults`. */ -proto$3.options = defaults$2; +// Expose `defaults`. +proto$5.options = defaults$2; -/* Enter and exit helpers. */ -proto$3.exitStart = stateToggle('atStart', true); -proto$3.enterList = stateToggle('inList', false); -proto$3.enterLink = stateToggle('inLink', false); -proto$3.enterBlock = stateToggle('inBlock', false); +// Enter and exit helpers. +proto$5.exitStart = stateToggle('atStart', true); +proto$5.enterList = stateToggle('inList', false); +proto$5.enterLink = stateToggle('inLink', false); +proto$5.enterBlock = stateToggle('inBlock', false); -/* Nodes that can interupt a paragraph: - * - * ```markdown - * A paragraph, followed by a thematic break. - * ___ - * ``` - * - * In the above example, the thematic break “interupts” - * the paragraph. */ -proto$3.interruptParagraph = [ +// Nodes that can interupt a paragraph: +// +// ```markdown +// A paragraph, followed by a thematic break. +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the paragraph. +proto$5.interruptParagraph = [ ['thematicBreak'], ['atxHeading'], ['fencedCode'], @@ -27542,32 +27696,31 @@ proto$3.interruptParagraph = [ ['footnote', {commonmark: false}] ]; -/* Nodes that can interupt a list: - * - * ```markdown - * - One - * ___ - * ``` - * - * In the above example, the thematic break “interupts” - * the list. */ -proto$3.interruptList = [ +// Nodes that can interupt a list: +// +// ```markdown +// - One +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the list. +proto$5.interruptList = [ + ['atxHeading', {pedantic: false}], ['fencedCode', {pedantic: false}], ['thematicBreak', {pedantic: false}], ['definition', {commonmark: false}], ['footnote', {commonmark: false}] ]; -/* Nodes that can interupt a blockquote: - * - * ```markdown - * > A paragraph. - * ___ - * ``` - * - * In the above example, the thematic break “interupts” - * the blockquote. */ -proto$3.interruptBlockquote = [ +// Nodes that can interupt a blockquote: +// +// ```markdown +// > A paragraph. +// ___ +// ``` +// +// In the above example, the thematic break “interupts” the blockquote. +proto$5.interruptBlockquote = [ ['indentedCode', {commonmark: true}], ['fencedCode', {commonmark: true}], ['atxHeading', {commonmark: true}], @@ -27579,8 +27732,8 @@ proto$3.interruptBlockquote = [ ['footnote', {commonmark: false}] ]; -/* Handlers. */ -proto$3.blockTokenizers = { +// Handlers. +proto$5.blockTokenizers = { newline: newline_1, indentedCode: codeIndented, fencedCode: codeFenced, @@ -27596,7 +27749,7 @@ proto$3.blockTokenizers = { paragraph: paragraph_1 }; -proto$3.inlineTokenizers = { +proto$5.inlineTokenizers = { escape: _escape$2, autoLink: autoLink_1, url: url_1, @@ -27611,16 +27764,16 @@ proto$3.inlineTokenizers = { text: text_1 }; -/* Expose precedence. */ -proto$3.blockMethods = keys$1(proto$3.blockTokenizers); -proto$3.inlineMethods = keys$1(proto$3.inlineTokenizers); +// Expose precedence. +proto$5.blockMethods = keys$1(proto$5.blockTokenizers); +proto$5.inlineMethods = keys$1(proto$5.inlineTokenizers); -/* Tokenizers. */ -proto$3.tokenizeBlock = tokenizer('block'); -proto$3.tokenizeInline = tokenizer('inline'); -proto$3.tokenizeFactory = tokenizer; +// Tokenizers. +proto$5.tokenizeBlock = tokenizer('block'); +proto$5.tokenizeInline = tokenizer('inline'); +proto$5.tokenizeFactory = tokenizer; -/* Get all keys in `value`. */ +// Get all keys in `value`. function keys$1(value) { var result = []; var key; @@ -27629,55 +27782,55 @@ function keys$1(value) { result.push(key); } - return result; + return result } var remarkParse = parse$9; parse$9.Parser = parser; function parse$9(options) { + var settings = this.data('settings'); var Local = unherit_1(parser); - Local.prototype.options = immutable(Local.prototype.options, this.data('settings'), options); + + Local.prototype.options = immutable(Local.prototype.options, settings, options); + this.Parser = Local; } -var returner_1 = returner; +var identity_1 = identity$1; -function returner(value) { - return value; +function identity$1(value) { + return value } var enterLinkReference = enter; -/* Shortcut and collapsed link references need no escaping - * and encoding during the processing of child nodes (it - * must be implied from identifier). - * - * This toggler turns encoding and escaping off for shortcut - * and collapsed references. - * - * Implies `enterLink`. - */ +// Shortcut and collapsed link references need no escaping and encoding during +// the processing of child nodes (it must be implied from identifier). +// +// This toggler turns encoding and escaping off for shortcut and collapsed +// references. +// +// Implies `enterLink`. function enter(compiler, node) { var encode = compiler.encode; var escape = compiler.escape; - var exit = compiler.enterLink(); + var exitLink = compiler.enterLink(); - if ( - node.referenceType !== 'shortcut' && - node.referenceType !== 'collapsed' - ) { - return exit; + if (node.referenceType !== 'shortcut' && node.referenceType !== 'collapsed') { + return exitLink } - compiler.escape = returner_1; - compiler.encode = returner_1; + compiler.escape = identity_1; + compiler.encode = identity_1; - return function () { + return exit + + function exit() { compiler.encode = encode; compiler.escape = escape; - exit(); - }; + exitLink(); + } } var defaults$5 = { @@ -27704,7 +27857,7 @@ var defaults$5 = { }; function stringLength(value) { - return value.length; + return value.length } const nbsp$2 = " "; @@ -27863,7 +28016,7 @@ const Prime$1 = "″"; const oline$1 = "‾"; const frasl$1 = "⁄"; const weierp$1 = "℘"; -const image$1 = "ℑ"; +const image$2 = "ℑ"; const real$1 = "ℜ"; const trade$1 = "™"; const alefsym$1 = "ℵ"; @@ -27937,7 +28090,7 @@ const Scaron$1 = "Š"; const scaron$1 = "š"; const Yuml$1 = "Ÿ"; const circ$1 = "ˆ"; -const tilde$1 = "˜"; +const tilde$3 = "˜"; const ensp$1 = " "; const emsp$1 = " "; const thinsp$1 = " "; @@ -28116,7 +28269,7 @@ var index$5 = { oline: oline$1, frasl: frasl$1, weierp: weierp$1, - image: image$1, + image: image$2, real: real$1, trade: trade$1, alefsym: alefsym$1, @@ -28190,7 +28343,7 @@ var index$5 = { scaron: scaron$1, Yuml: Yuml$1, circ: circ$1, - tilde: tilde$1, + tilde: tilde$3, ensp: ensp$1, emsp: emsp$1, thinsp: thinsp$1, @@ -28371,7 +28524,7 @@ var characterEntitiesHtml4 = Object.freeze({ oline: oline$1, frasl: frasl$1, weierp: weierp$1, - image: image$1, + image: image$2, real: real$1, trade: trade$1, alefsym: alefsym$1, @@ -28445,7 +28598,7 @@ var characterEntitiesHtml4 = Object.freeze({ scaron: scaron$1, Yuml: Yuml$1, circ: circ$1, - tilde: tilde$1, + tilde: tilde$3, ensp: ensp$1, emsp: emsp$1, thinsp: thinsp$1, @@ -28500,7 +28653,7 @@ var own$6 = {}.hasOwnProperty; var escapes$2 = ['"', "'", '<', '>', '&', '`']; /* Map of characters to names. */ -var characters$1 = construct(); +var characters = construct(); /* Default escapes. */ var defaultEscapes = toExpression(escapes$2); @@ -28563,8 +28716,8 @@ function one$1(char, next, options) { var named; var numeric; - if ((shortest || options.useNamedReferences) && own$6.call(characters$1, char)) { - named = toNamed(characters$1[char], next, omit, options.attribute); + if ((shortest || options.useNamedReferences) && own$6.call(characters, char)) { + named = toNamed(characters[char], next, omit, options.attribute); } if (shortest || !named) { @@ -28627,42 +28780,75 @@ var isAlphanumeric = function (str) { var entityPrefixLength = length; -/* Returns the length of HTML entity that is a prefix of - * the given string (excluding the ampersand), 0 if it - * does not start with an entity. */ +var ampersand = '&'; + +// Returns the length of HTML entity that is a prefix of the given string +// (excluding the ampersand), 0 if it does not start with an entity. function length(value) { var prefix; - /* istanbul ignore if - Currently also tested for at - * implemention, but we keep it here because that’s - * proper. */ - if (value.charAt(0) !== '&') { - return 0; + /* istanbul ignore if - Currently also tested for at implemention, but we + * keep it here because that’s proper. */ + if (value.charAt(0) !== ampersand) { + return 0 } - prefix = value.split('&', 2).join('&'); + prefix = value.split(ampersand, 2).join(ampersand); - return prefix.length - parseEntities_1(prefix).length; + return prefix.length - parseEntities_1(prefix).length } var _escape$4 = factory$5; -var BACKSLASH = '\\'; -var BULLETS = ['*', '-', '+']; -var ALLIGNMENT = [':', '-', ' ', '|']; -var entities$1 = {'<': '<', ':': ':', '&': '&', '|': '|', '~': '~'}; +var tab$14 = '\t'; +var lineFeed$18 = '\n'; +var space$16 = ' '; +var numberSign$1 = '#'; +var ampersand$1 = '&'; +var leftParenthesis$3 = '('; +var rightParenthesis$4 = ')'; +var asterisk$4 = '*'; +var plusSign$1 = '+'; +var dash$5 = '-'; +var dot$3 = '.'; +var colon$5 = ':'; +var lessThan$6 = '<'; +var greaterThan$4 = '>'; +var leftSquareBracket$5 = '['; +var backslash$9 = '\\'; +var rightSquareBracket$5 = ']'; +var underscore$4 = '_'; +var graveAccent$4 = '`'; +var verticalBar$1 = '|'; +var tilde$4 = '~'; +var exclamationMark$4 = '!'; + +var entities$1 = { + '<': '<', + ':': ':', + '&': '&', + '|': '|', + '~': '~' +}; + +var shortcut$1 = 'shortcut'; +var mailto$2 = 'mailto'; +var https$1 = 'https'; +var http$1 = 'http'; -/* Factory to escape characters. */ +var blankExpression = /\n\s*$/; + +// Factory to escape characters. function factory$5(options) { - return escape; + return escape - /* Escape punctuation characters in a node's value. */ + // Escape punctuation characters in a node’s value. function escape(value, node, parent) { var self = this; var gfm = options.gfm; var commonmark = options.commonmark; var pedantic = options.pedantic; - var markers = commonmark ? ['.', ')'] : ['.']; + var markers = commonmark ? [dot$3, rightParenthesis$4] : [dot$3]; var siblings = parent && parent.children; var index = siblings && siblings.indexOf(node); var prev = siblings && siblings[index - 1]; @@ -28680,14 +28866,10 @@ function factory$5(options) { var replace; if (prev) { - afterNewLine = text$1(prev) && /\n\s*$/.test(prev.value); + afterNewLine = text$1(prev) && blankExpression.test(prev.value); } else { - afterNewLine = !parent || parent.type === 'root' || parent.type === 'paragraph'; - } - - function one(character) { - return escapable.indexOf(character) === -1 ? - entities$1[character] : BACKSLASH + character; + afterNewLine = + !parent || parent.type === 'root' || parent.type === 'paragraph'; } while (++position < length) { @@ -28697,35 +28879,36 @@ function factory$5(options) { if (character === '\n') { afterNewLine = true; } else if ( - character === BACKSLASH || - character === '`' || - character === '*' || - character === '[' || - character === '<' || - (character === '&' && entityPrefixLength(value.slice(position)) > 0) || - (character === ']' && self.inLink) || - (gfm && character === '~' && value.charAt(position + 1) === '~') || - (gfm && character === '|' && (self.inTable || alignment(value, position))) || - ( - character === '_' && - /* Delegate leading/trailing underscores - * to the multinode version below. */ + character === backslash$9 || + character === graveAccent$4 || + character === asterisk$4 || + (character === exclamationMark$4 && + value.charAt(position + 1) === leftSquareBracket$5) || + character === leftSquareBracket$5 || + character === lessThan$6 || + (character === ampersand$1 && entityPrefixLength(value.slice(position)) > 0) || + (character === rightSquareBracket$5 && self.inLink) || + (gfm && character === tilde$4 && value.charAt(position + 1) === tilde$4) || + (gfm && + character === verticalBar$1 && + (self.inTable || alignment(value, position))) || + (character === underscore$4 && + // Delegate leading/trailing underscores to the multinode version below. position > 0 && position < length - 1 && - ( - pedantic || - !isAlphanumeric(value.charAt(position - 1)) || - !isAlphanumeric(value.charAt(position + 1)) - ) - ) || - (gfm && !self.inLink && character === ':' && protocol(queue.join(''))) + (pedantic || + !isAlphanumeric(value.charAt(position - 1)) || + !isAlphanumeric(value.charAt(position + 1)))) || + (gfm && !self.inLink && character === colon$5 && protocol(queue.join(''))) ) { replace = true; } else if (afterNewLine) { if ( - character === '>' || - character === '#' || - BULLETS.indexOf(character) !== -1 + character === greaterThan$4 || + character === numberSign$1 || + character === asterisk$4 || + character === dash$5 || + character === plusSign$1 ) { replace = true; } else if (isDecimal(character)) { @@ -28733,7 +28916,7 @@ function factory$5(options) { while (offset < length) { if (!isDecimal(value.charAt(offset))) { - break; + break } offset++; @@ -28742,7 +28925,7 @@ function factory$5(options) { if (markers.indexOf(value.charAt(offset)) !== -1) { next = value.charAt(offset + 1); - if (!next || next === ' ' || next === '\t' || next === '\n') { + if (!next || next === space$16 || next === tab$14 || next === lineFeed$18) { queue.push(value.slice(position, offset)); position = offset; character = value.charAt(position); @@ -28759,135 +28942,157 @@ function factory$5(options) { queue.push(replace ? one(character) : character); } - /* Multi-node versions. */ + // Multi-node versions. if (siblings && text$1(node)) { - /* Check for an opening parentheses after a - * link-reference (which can be joined by - * white-space). */ - if (prev && prev.referenceType === 'shortcut') { + // Check for an opening parentheses after a link-reference (which can be + // joined by white-space). + if (prev && prev.referenceType === shortcut$1) { position = -1; length = escaped.length; while (++position < length) { character = escaped[position]; - if (character === ' ' || character === '\t') { - continue; + if (character === space$16 || character === tab$14) { + continue } - if (character === '(' || character === ':') { + if (character === leftParenthesis$3 || character === colon$5) { escaped[position] = one(character); } - break; + break } - /* If the current node is all spaces / tabs, - * preceded by a shortcut, and followed by - * a text starting with `(`, escape it. */ + // If the current node is all spaces / tabs, preceded by a shortcut, + // and followed by a text starting with `(`, escape it. if ( text$1(next) && position === length && - next.value.charAt(0) === '(' + next.value.charAt(0) === leftParenthesis$3 ) { - escaped.push(BACKSLASH); + escaped.push(backslash$9); } } - /* Ensure non-auto-links are not seen as links. - * This pattern needs to check the preceding - * nodes too. */ + // Ensure non-auto-links are not seen as links. This pattern needs to + // check the preceding nodes too. if ( gfm && !self.inLink && text$1(prev) && - value.charAt(0) === ':' && + value.charAt(0) === colon$5 && protocol(prev.value.slice(-6)) ) { - escaped[0] = one(':'); + escaped[0] = one(colon$5); } - /* Escape ampersand if it would otherwise - * start an entity. */ + // Escape ampersand if it would otherwise start an entity. if ( text$1(next) && - value.charAt(length - 1) === '&' && - entityPrefixLength('&' + next.value) !== 0 + value.charAt(length - 1) === ampersand$1 && + entityPrefixLength(ampersand$1 + next.value) !== 0 + ) { + escaped[escaped.length - 1] = one(ampersand$1); + } + + // Escape exclamation marks immediately followed by links. + if ( + next && + next.type === 'link' && + value.charAt(length - 1) === exclamationMark$4 ) { - escaped[escaped.length - 1] = one('&'); + escaped[escaped.length - 1] = one(exclamationMark$4); } - /* Escape double tildes in GFM. */ + // Escape double tildes in GFM. if ( gfm && text$1(next) && - value.charAt(length - 1) === '~' && - next.value.charAt(0) === '~' + value.charAt(length - 1) === tilde$4 && + next.value.charAt(0) === tilde$4 ) { - escaped.splice(escaped.length - 1, 0, BACKSLASH); + escaped.splice(escaped.length - 1, 0, backslash$9); } - /* Escape underscores, but not mid-word (unless - * in pedantic mode). */ + // Escape underscores, but not mid-word (unless in pedantic mode). wordCharBefore = text$1(prev) && isAlphanumeric(prev.value.slice(-1)); wordCharAfter = text$1(next) && isAlphanumeric(next.value.charAt(0)); if (length === 1) { - if (value === '_' && (pedantic || !wordCharBefore || !wordCharAfter)) { - escaped.unshift(BACKSLASH); + if ( + value === underscore$4 && + (pedantic || !wordCharBefore || !wordCharAfter) + ) { + escaped.unshift(backslash$9); } } else { if ( - value.charAt(0) === '_' && + value.charAt(0) === underscore$4 && (pedantic || !wordCharBefore || !isAlphanumeric(value.charAt(1))) ) { - escaped.unshift(BACKSLASH); + escaped.unshift(backslash$9); } if ( - value.charAt(length - 1) === '_' && - (pedantic || !wordCharAfter || !isAlphanumeric(value.charAt(length - 2))) + value.charAt(length - 1) === underscore$4 && + (pedantic || + !wordCharAfter || + !isAlphanumeric(value.charAt(length - 2))) ) { - escaped.splice(escaped.length - 1, 0, BACKSLASH); + escaped.splice(escaped.length - 1, 0, backslash$9); } } } - return escaped.join(''); + return escaped.join('') + + function one(character) { + return escapable.indexOf(character) === -1 + ? entities$1[character] + : backslash$9 + character + } } } -/* Check if `index` in `value` is inside an alignment row. */ +// Check if `index` in `value` is inside an alignment row. function alignment(value, index) { - var start = value.lastIndexOf('\n', index); - var end = value.indexOf('\n', index); + var start = value.lastIndexOf(lineFeed$18, index); + var end = value.indexOf(lineFeed$18, index); + var char; - start = start === -1 ? -1 : start; end = end === -1 ? value.length : end; while (++start < end) { - if (ALLIGNMENT.indexOf(value.charAt(start)) === -1) { - return false; + char = value.charAt(start); + + if ( + char !== colon$5 && + char !== dash$5 && + char !== space$16 && + char !== verticalBar$1 + ) { + return false } } - return true; + return true } -/* Check if `node` is a text node. */ +// Check if `node` is a text node. function text$1(node) { - return node && node.type === 'text'; + return node && node.type === 'text' } -/* Check if `value` ends in a protocol. */ +// Check if `value` ends in a protocol. function protocol(value) { var val = value.slice(-6).toLowerCase(); - return val === 'mailto' || val.slice(-5) === 'https' || val.slice(-4) === 'http'; + return val === mailto$2 || val.slice(-5) === https$1 || val.slice(-4) === http$1 } var setOptions_1$2 = setOptions$1; -/* Map of applicable enum's. */ +// Map of applicable enums. var maps = { entities: {true: true, false: true, numbers: true, escape: true}, bullet: {'*': true, '-': true, '+': true}, @@ -28898,7 +29103,7 @@ var maps = { fence: {'`': true, '~': true} }; -/* Expose `validate`. */ +// Expose `validate`. var validate = { boolean: validateBoolean, string: validateString, @@ -28906,8 +29111,7 @@ var validate = { function: validateFunction }; -/* Set options. Does not overwrite previously set - * options. */ +// Set options. Does not overwrite previously set options. function setOptions$1(options) { var self = this; var current = self.options; @@ -28919,7 +29123,7 @@ function setOptions$1(options) { } else if (typeof options === 'object') { options = immutable(options); } else { - throw new Error('Invalid value `' + options + '` for setting `options`'); + throw new Error('Invalid value `' + options + '` for setting `options`') } for (key in defaults$5) { @@ -28937,18 +29141,11 @@ function setOptions$1(options) { self.options = options; - return self; -} - -/* Throw an exception with in its `message` `value` - * and `name`. */ -function raise(value, name) { - throw new Error('Invalid value `' + value + '` for setting `' + name + '`'); + return self } -/* Validate a value to be boolean. Defaults to `def`. - * Raises an exception with `context[name]` when not - * a boolean. */ +// Validate a value to be boolean. Defaults to `def`. Raises an exception with +// `context[name]` when not a boolean. function validateBoolean(context, name, def) { var value = context[name]; @@ -28963,9 +29160,8 @@ function validateBoolean(context, name, def) { context[name] = value; } -/* Validate a value to be boolean. Defaults to `def`. - * Raises an exception with `context[name]` when not - * a boolean. */ +// Validate a value to be boolean. Defaults to `def`. Raises an exception with +// `context[name]` when not a boolean. function validateNumber(context, name, def) { var value = context[name]; @@ -28980,9 +29176,8 @@ function validateNumber(context, name, def) { context[name] = value; } -/* Validate a value to be in `map`. Defaults to `def`. - * Raises an exception with `context[name]` when not - * in `map`. */ +// Validate a value to be in `map`. Defaults to `def`. Raises an exception +// with `context[name]` when not in `map`. function validateString(context, name, def, map) { var value = context[name]; @@ -28999,9 +29194,8 @@ function validateString(context, name, def, map) { context[name] = value; } -/* Validate a value to be function. Defaults to `def`. - * Raises an exception with `context[name]` when not - * a function. */ +// Validate a value to be function. Defaults to `def`. Raises an exception +// with `context[name]` when not a function. function validateFunction(context, name, def) { var value = context[name]; @@ -29016,17 +29210,15 @@ function validateFunction(context, name, def) { context[name] = value; } -/* Factory to encode HTML entities. - * Creates a no-operation function when `type` is - * `'false'`, a function which encodes using named - * references when `type` is `'true'`, and a function - * which encodes using numbered references when `type` is - * `'numbers'`. */ +// Factory to encode HTML entities. Creates a no-operation function when +// `type` is `'false'`, a function which encodes using named references when +// `type` is `'true'`, and a function which encodes using numbered references +// when `type` is `'numbers'`. function encodeFactory(type) { var options = {}; if (type === 'false') { - return returner_1; + return identity_1 } if (type === 'true') { @@ -29038,14 +29230,19 @@ function encodeFactory(type) { options.useNamedReferences = true; } - return wrapped; + return wrapped - /* Encode HTML entities using the bound options. */ + // Encode HTML entities using the bound options. function wrapped(value) { - return stringifyEntities(value, options); + return stringifyEntities(value, options) } } +// Throw an exception with in its `message` `value` and `name`. +function raise(value, name) { + throw new Error('Invalid value `' + value + '` for setting `' + name + '`') +} + var mdastUtilCompact = compact; /* Make an MDAST tree compact by merging adjacent text nodes. */ @@ -29106,9 +29303,9 @@ function mergeable$1(node, commonmark) { var compile_1 = compile$2; -/* Stringify the given tree. */ +// Stringify the given tree. function compile$2() { - return this.visit(mdastUtilCompact(this.tree, this.options.commonmark)); + return this.visit(mdastUtilCompact(this.tree, this.options.commonmark)) } var one_1 = one$2; @@ -29117,23 +29314,22 @@ function one$2(node, parent) { var self = this; var visitors = self.visitors; - /* Fail on unknown nodes. */ + // Fail on unknown nodes. if (typeof visitors[node.type] !== 'function') { self.file.fail( new Error( - 'Missing compiler for node of type `' + - node.type + '`: `' + node + '`' + 'Missing compiler for node of type `' + node.type + '`: `' + node + '`' ), node ); } - return visitors[node.type].call(self, node, parent); + return visitors[node.type].call(self, node, parent) } var all_1 = all; -/* Visit all children of `parent`. */ +// Visit all children of `parent`. function all(parent) { var self = this; var children = parent.children; @@ -29145,70 +29341,83 @@ function all(parent) { results[index] = self.visit(children[index], parent); } - return results; + return results } var block_1 = block$1; -/* Stringify a block node with block children (e.g., `root` - * or `blockquote`). - * Knows about code following a list, or adjacent lists - * with similar bullets, and places an extra newline - * between them. */ +var lineFeed$19 = '\n'; + +var blank$1 = lineFeed$19 + lineFeed$19; +var triple = blank$1 + lineFeed$19; +var comment$1 = blank$1 + '' + blank$1; + +// Stringify a block node with block children (e.g., `root` or `blockquote`). +// Knows about code following a list, or adjacent lists with similar bullets, +// and places an extra line feed between them. function block$1(node) { var self = this; + var options = self.options; + var fences = options.fences; + var gap = options.commonmark ? comment$1 : triple; var values = []; var children = node.children; var length = children.length; var index = -1; - var child; var prev; + var child; while (++index < length) { + prev = child; child = children[index]; if (prev) { - /* Duplicate nodes, such as a list - * directly following another list, - * often need multiple new lines. - * - * Additionally, code blocks following a list - * might easily be mistaken for a paragraph - * in the list itself. */ - if (child.type === prev.type && prev.type === 'list') { - values.push(prev.ordered === child.ordered ? '\n\n\n' : '\n\n'); - } else if (prev.type === 'list' && child.type === 'code' && !child.lang) { - values.push('\n\n\n'); + // A list preceding another list that are equally ordered, or a + // list preceding an indented code block, need a gap between them, + // so as not to see them as one list, or content of the list, + // respectively. + // + // In commonmark, only something that breaks both up can do that, + // so we opt for an empty, invisible comment. In other flavours, + // two blank lines are fine. + if ( + prev.type === 'list' && + ((child.type === 'list' && prev.ordered === child.ordered) || + (child.type === 'code' && (!child.lang && !fences))) + ) { + values.push(gap); } else { - values.push('\n\n'); + values.push(blank$1); } } values.push(self.visit(child, node)); - - prev = child; } - return values.join(''); + return values.join('') } var orderedItems_1 = orderedItems; -/* Visit ordered list items. - * - * Starts the list with - * `node.start` and increments each following list item - * bullet by one: - * - * 2. foo - * 3. bar - * - * In `incrementListMarker: false` mode, does not increment - * each marker and stays on `node.start`: - * - * 1. foo - * 1. bar - */ +var lineFeed$20 = '\n'; +var dot$4 = '.'; + +var blank$2 = lineFeed$20 + lineFeed$20; + +// Visit ordered list items. +// +// Starts the list with +// `node.start` and increments each following list item +// bullet by one: +// +// 2. foo +// 3. bar +// +// In `incrementListMarker: false` mode, does not increment +// each marker and stays on `node.start`: +// +// 1. foo +// 1. bar function orderedItems(node) { var self = this; var fn = self.visitors.listItem; @@ -29220,19 +29429,23 @@ function orderedItems(node) { var index = -1; var bullet; + start = start == null ? 1 : start; + while (++index < length) { - bullet = (increment ? start + index : start) + '.'; + bullet = (increment ? start + index : start) + dot$4; values[index] = fn.call(self, children[index], node, index, bullet); } - return values.join('\n'); + return values.join(node.spread ? blank$2 : lineFeed$20) } var unorderedItems_1 = unorderedItems; -/* Visit unordered list items. - * Uses `options.bullet` as each item's bullet. - */ +var lineFeed$21 = '\n'; + +var blank$3 = lineFeed$21 + lineFeed$21; + +// Visit unordered list items. Uses `options.bullet` as each item’s bullet. function unorderedItems(node) { var self = this; var bullet = self.options.bullet; @@ -29246,52 +29459,66 @@ function unorderedItems(node) { values[index] = fn.call(self, children[index], node, index, bullet); } - return values.join('\n'); + return values.join(node.spread ? blank$3 : lineFeed$21) } var root_1 = root; -/* Stringify a root. - * Adds a final newline to ensure valid POSIX files. */ +var lineFeed$22 = '\n'; + +// Stringify a root. +// Adds a final newline to ensure valid POSIX files. */ function root(node) { - return this.block(node) + '\n'; + return this.block(node) + lineFeed$22 } -var text_1$2 = text$2; - -/* Stringify text. - * Supports named entities in `settings.encode: true` mode: - * - * AT&T - * - * Supports numbered entities in `settings.encode: numbers` - * mode: - * - * AT&T - */ +var text_1$2 = text$2; + +// Stringify text. +// Supports named entities in `settings.encode: true` mode: +// +// ```markdown +// AT&T +// ``` +// +// Supports numbered entities in `settings.encode: numbers` mode: +// +// ```markdown +// AT&T +// ``` function text$2(node, parent) { - return this.encode(this.escape(node.value, node, parent), node); + return this.encode(this.escape(node.value, node, parent), node) } var heading_1 = heading; -/* Stringify a heading. - * - * In `setext: true` mode and when `depth` is smaller than - * three, creates a setext header: - * - * Foo - * === - * - * Otherwise, an ATX header is generated: - * - * ### Foo - * - * In `closeAtx: true` mode, the header is closed with - * hashes: - * - * ### Foo ### - */ +var lineFeed$23 = '\n'; +var space$17 = ' '; +var numberSign$2 = '#'; +var dash$6 = '-'; +var equalsTo$1 = '='; + +// Stringify a heading. +// +// In `setext: true` mode and when `depth` is smaller than three, creates a +// setext header: +// +// ```markdown +// Foo +// === +// ``` +// +// Otherwise, an ATX header is generated: +// +// ```markdown +// ### Foo +// ``` +// +// In `closeAtx: true` mode, the header is closed with hashes: +// +// ```markdown +// ### Foo ### +// ``` function heading(node) { var self = this; var depth = node.depth; @@ -29301,24 +29528,30 @@ function heading(node) { var prefix; if (setext && depth < 3) { - return content + '\n' + repeatString(depth === 1 ? '=' : '-', content.length); + return ( + content + lineFeed$23 + repeatString(depth === 1 ? equalsTo$1 : dash$6, content.length) + ) } - prefix = repeatString('#', node.depth); + prefix = repeatString(numberSign$2, node.depth); - return prefix + ' ' + content + (closeAtx ? ' ' + prefix : ''); + return prefix + space$17 + content + (closeAtx ? space$17 + prefix : '') } var paragraph_1$2 = paragraph$1; function paragraph$1(node) { - return this.all(node).join(''); + return this.all(node).join('') } var blockquote_1$2 = blockquote$1; +var lineFeed$24 = '\n'; +var space$18 = ' '; +var greaterThan$5 = '>'; + function blockquote$1(node) { - var values = this.block(node).split('\n'); + var values = this.block(node).split(lineFeed$24); var result = []; var length = values.length; var index = -1; @@ -29326,74 +29559,74 @@ function blockquote$1(node) { while (++index < length) { value = values[index]; - result[index] = (value ? ' ' : '') + value; + result[index] = (value ? space$18 : '') + value; } - return '>' + result.join('\n>'); + return greaterThan$5 + result.join(lineFeed$24 + greaterThan$5) } var list_1$2 = list$1; -/* Which method to use based on `list.ordered`. */ -var ORDERED_MAP = { - true: 'visitOrderedItems', - false: 'visitUnorderedItems' -}; - function list$1(node) { - return this[ORDERED_MAP[node.ordered]](node); + var fn = node.ordered ? this.visitOrderedItems : this.visitUnorderedItems; + return fn.call(this, node) } var pad_1 = pad; -var INDENT = 4; +var lineFeed$25 = '\n'; +var space$19 = ' '; -/* Pad `value` with `level * INDENT` spaces. Respects - * lines. Ignores empty lines. */ -function pad(value, level) { - var index; - var padding; - - value = value.split('\n'); +var tabSize$5 = 4; - index = value.length; - padding = repeatString(' ', level * INDENT); +// Pad `value` with `level * tabSize` spaces. Respects lines. Ignores empty +// lines. +function pad(value, level) { + var values = value.split(lineFeed$25); + var index = values.length; + var padding = repeatString(space$19, level * tabSize$5); while (index--) { - if (value[index].length !== 0) { - value[index] = padding + value[index]; + if (values[index].length !== 0) { + values[index] = padding + values[index]; } } - return value.join('\n'); + return values.join(lineFeed$25) } var listItem_1 = listItem$1; -/* Which checkbox to use. */ -var CHECKBOX_MAP = { - undefined: '', - null: '', - true: '[x] ', - false: '[ ] ' -}; +var lineFeed$26 = '\n'; +var space$20 = ' '; +var leftSquareBracket$6 = '['; +var rightSquareBracket$6 = ']'; +var lowercaseX$1 = 'x'; -/* Stringify a list item. - * - * Prefixes the content with a checked checkbox when - * `checked: true`: - * - * [x] foo - * - * Prefixes the content with an unchecked checkbox when - * `checked: false`: - * - * [ ] foo - */ +var ceil = Math.ceil; +var blank$4 = lineFeed$26 + lineFeed$26; + +var tabSize$6 = 4; + +// Stringify a list item. +// +// Prefixes the content with a checked checkbox when `checked: true`: +// +// ```markdown +// [x] foo +// ``` +// +// Prefixes the content with an unchecked checkbox when `checked: false`: +// +// ```markdown +// [ ] foo +// ``` function listItem$1(node, parent, position, bullet) { var self = this; var style = self.options.listItemIndent; - var loose = node.loose; + var marker = bullet || self.options.bullet; + var spread = node.spread == null ? true : node.spread; + var checked = node.checked; var children = node.children; var length = children.length; var values = []; @@ -29406,23 +29639,31 @@ function listItem$1(node, parent, position, bullet) { values[index] = self.visit(children[index], node); } - value = CHECKBOX_MAP[node.checked] + values.join(loose ? '\n\n' : '\n'); + value = values.join(spread ? blank$4 : lineFeed$26); - if (style === '1' || (style === 'mixed' && value.indexOf('\n') === -1)) { - indent = bullet.length + 1; - spacing = ' '; - } else { - indent = Math.ceil((bullet.length + 1) / 4) * 4; - spacing = repeatString(' ', indent - bullet.length); + if (typeof checked === 'boolean') { + // Note: I’d like to be able to only add the space between the check and + // the value, but unfortunately github does not support empty list-items + // with a checkbox :( + value = + leftSquareBracket$6 + + (checked ? lowercaseX$1 : space$20) + + rightSquareBracket$6 + + space$20 + + value; } - value = bullet + spacing + pad_1(value, indent / 4).slice(indent); - - if (loose && parent.children.length - 1 !== position) { - value += '\n'; + if (style === '1' || (style === 'mixed' && value.indexOf(lineFeed$26) === -1)) { + indent = marker.length + 1; + spacing = space$20; + } else { + indent = ceil((marker.length + 1) / tabSize$6) * tabSize$6; + spacing = repeatString(space$20, indent - marker.length); } - return value; + return value + ? marker + spacing + pad_1(value, indent / tabSize$6).slice(indent) + : marker } /* Expose. */ @@ -29464,178 +29705,222 @@ function longestStreak(value, character) { var inlineCode_1 = inlineCode$1; -/* Stringify inline code. - * - * Knows about internal ticks (`\``), and ensures one more - * tick is used to enclose the inline code: - * - * ```foo ``bar`` baz``` - * - * Even knows about inital and final ticks: - * - * `` `foo `` - * `` foo` `` - */ +var space$21 = ' '; +var graveAccent$5 = '`'; + +// Stringify inline code. +// +// Knows about internal ticks (`\``), and ensures one more tick is used to +// enclose the inline code: +// +// ````markdown +// ```foo ``bar`` baz``` +// ```` +// +// Even knows about inital and final ticks: +// +// ``markdown +// `` `foo `` +// `` foo` `` +// ``` function inlineCode$1(node) { var value = node.value; - var ticks = repeatString('`', longestStreak_1(value, '`') + 1); + var ticks = repeatString(graveAccent$5, longestStreak_1(value, graveAccent$5) + 1); var start = ticks; var end = ticks; - if (value.charAt(0) === '`') { - start += ' '; + if (value.charAt(0) === graveAccent$5) { + start += space$21; } - if (value.charAt(value.length - 1) === '`') { - end = ' ' + end; + if (value.charAt(value.length - 1) === graveAccent$5) { + end = space$21 + end; } - return start + value + end; + return start + value + end } var code_1 = code; -var FENCE = /([`~])\1{2}/; +var lineFeed$27 = '\n'; +var space$22 = ' '; -/* Stringify code. - * Creates indented code when: - * - * - No language tag exists; - * - Not in `fences: true` mode; - * - A non-empty value exists. - * - * Otherwise, GFM fenced code is created: - * - * ```js - * foo(); - * ``` - * - * When in ``fence: `~` `` mode, uses tildes as fences: - * - * ~~~js - * foo(); - * ~~~ - * - * Knows about internal fences (Note: GitHub/Kramdown does - * not support this): - * - * ````javascript - * ```markdown - * foo - * ``` - * ```` - */ +// Stringify code. +// Creates indented code when: +// +// - No language tag exists +// - Not in `fences: true` mode +// - A non-empty value exists +// +// Otherwise, GFM fenced code is created: +// +// ````markdown +// ```js +// foo(); +// ``` +// ```` +// +// When in ``fence: `~` `` mode, uses tildes as fences: +// +// ```markdown +// ~~~js +// foo(); +// ~~~ +// ``` +// +// Knows about internal fences: +// +// `````markdown +// ````markdown +// ```javascript +// foo(); +// ``` +// ```` +// ````` function code(node, parent) { var self = this; var value = node.value; var options = self.options; var marker = options.fence; - var language = self.encode(node.lang || '', node); + var info = node.lang || ''; var fence; - /* Without (needed) fences. */ - if (!language && !options.fences && value) { - /* Throw when pedantic, in a list item which - * isn’t compiled using a tab. */ + if (info && node.meta) { + info += space$22 + node.meta; + } + + info = self.encode(self.escape(info, node)); + + // Without (needed) fences. + if (!info && !options.fences && value) { + // Throw when pedantic, in a list item which isn’t compiled using a tab. if ( parent && parent.type === 'listItem' && options.listItemIndent !== 'tab' && options.pedantic ) { - self.file.fail('Cannot indent code properly. See http://git.io/vgFvT', node.position); + self.file.fail( + 'Cannot indent code properly. See https://git.io/fxKR8', + node.position + ); } - return pad_1(value, 1); - } - - fence = longestStreak_1(value, marker) + 1; - - /* Fix GFM / RedCarpet bug, where fence-like characters - * inside fenced code can exit a code-block. - * Yes, even when the outer fence uses different - * characters, or is longer. - * Thus, we can only pad the code to make it work. */ - if (FENCE.test(value)) { - value = pad_1(value, 1); + return pad_1(value, 1) } - fence = repeatString(marker, Math.max(fence, 3)); + fence = repeatString(marker, Math.max(longestStreak_1(value, marker) + 1, 3)); - return fence + language + '\n' + value + '\n' + fence; + return fence + info + lineFeed$27 + value + lineFeed$27 + fence } var html_1 = html$2; function html$2(node) { - return node.value; + return node.value } var thematicBreak$1 = thematic; -/* Stringify a `thematic-break`. - * The character used is configurable through `rule`: (`'_'`) - * - * ___ - * - * The number of repititions is defined through - * `ruleRepetition`: (`6`) - * - * ****** - * - * Whether spaces delimit each character, is configured - * through `ruleSpaces`: (`true`) - * - * * * * - */ +var space$23 = ' '; + +// Stringify a `thematic-break`. +// The character used is configurable through `rule`: (`'_'`): +// +// ```markdown +// ___ +// ``` +// +// The number of repititions is defined through `ruleRepetition` (`6`): +// +// ```markdown +// ****** +// ``` +// +// Whether spaces delimit each character, is configured through `ruleSpaces` +// (`true`): +// ```markdown +// * * * +// ``` function thematic() { var options = this.options; var rule = repeatString(options.rule, options.ruleRepetition); - return options.ruleSpaces ? rule.split('').join(' ') : rule; + return options.ruleSpaces ? rule.split('').join(space$23) : rule } var strong_1$2 = strong$3; -/* Stringify a `strong`. - * - * The marker used is configurable by `strong`, which - * defaults to an asterisk (`'*'`) but also accepts an - * underscore (`'_'`): - * - * __foo__ - */ +// Stringify a `strong`. +// +// The marker used is configurable by `strong`, which defaults to an asterisk +// (`'*'`) but also accepts an underscore (`'_'`): +// +// ```markdown +// __foo__ +// ``` function strong$3(node) { var marker = repeatString(this.options.strong, 2); - return marker + this.all(node).join('') + marker; + return marker + this.all(node).join('') + marker } var emphasis_1$2 = emphasis$3; -/* Stringify an `emphasis`. - * - * The marker used is configurable through `emphasis`, which - * defaults to an underscore (`'_'`) but also accepts an - * asterisk (`'*'`): - * - * *foo* - */ +var underscore$5 = '_'; +var asterisk$5 = '*'; + +// Stringify an `emphasis`. +// +// The marker used is configurable through `emphasis`, which defaults to an +// underscore (`'_'`) but also accepts an asterisk (`'*'`): +// +// ```markdown +// *foo* +// ``` +// +// In `pedantic` mode, text which itself contains an underscore will cause the +// marker to default to an asterisk instead: +// +// ```markdown +// *foo_bar* +// ``` function emphasis$3(node) { var marker = this.options.emphasis; - return marker + this.all(node).join('') + marker; + var content = this.all(node).join(''); + + // When in pedantic mode, prevent using underscore as the marker when there + // are underscores in the content. + if ( + this.options.pedantic && + marker === underscore$5 && + content.indexOf(marker) !== -1 + ) { + marker = asterisk$5; + } + + return marker + content + marker } var _break$4 = lineBreak; -var map$4 = {true: '\\\n', false: ' \n'}; +var backslash$10 = '\\'; +var lineFeed$28 = '\n'; +var space$24 = ' '; + +var commonmark$1 = backslash$10 + lineFeed$28; +var normal = space$24 + space$24 + lineFeed$28; function lineBreak() { - return map$4[this.options.commonmark]; + return this.options.commonmark ? commonmark$1 : normal } var _delete$4 = strikethrough$1; +var tilde$5 = '~'; + +var fence$1 = tilde$5 + tilde$5; + function strikethrough$1(node) { - return '~~' + this.all(node).join('') + '~~'; + return fence$1 + this.all(node).join('') + fence$1 } var ccount_1 = ccount; @@ -29662,59 +29947,82 @@ function ccount(value, character) { var encloseUri = enclose; -var re$3 = /\s/; +var leftParenthesis$4 = '('; +var rightParenthesis$5 = ')'; +var lessThan$7 = '<'; +var greaterThan$6 = '>'; -/* Wrap `url` in angle brackets when needed, or when - * forced. - * In links, images, and definitions, the URL part needs - * to be enclosed when it: - * - * - has a length of `0`; - * - contains white-space; - * - has more or less opening than closing parentheses. - */ +var expression = /\s/; + +// Wrap `url` in angle brackets when needed, or when +// forced. +// In links, images, and definitions, the URL part needs +// to be enclosed when it: +// +// - has a length of `0` +// - contains white-space +// - has more or less opening than closing parentheses function enclose(uri, always) { - if (always || uri.length === 0 || re$3.test(uri) || ccount_1(uri, '(') !== ccount_1(uri, ')')) { - return '<' + uri + '>'; + if ( + always || + uri.length === 0 || + expression.test(uri) || + ccount_1(uri, leftParenthesis$4) !== ccount_1(uri, rightParenthesis$5) + ) { + return lessThan$7 + uri + greaterThan$6 } - return uri; + return uri } var encloseTitle = enclose$1; -/* There is currently no way to support nested delimiters - * across Markdown.pl, CommonMark, and GitHub (RedCarpet). - * The following code supports Markdown.pl and GitHub. - * CommonMark is not supported when mixing double- and - * single quotes inside a title. */ +var quotationMark$3 = '"'; +var apostrophe$3 = "'"; + +// There is currently no way to support nested delimiters across Markdown.pl, +// CommonMark, and GitHub (RedCarpet). The following code supports Markdown.pl +// and GitHub. +// CommonMark is not supported when mixing double- and single quotes inside a +// title. function enclose$1(title) { - var delimiter = title.indexOf('"') === -1 ? '"' : '\''; - return delimiter + title + delimiter; + var delimiter = + title.indexOf(quotationMark$3) === -1 ? quotationMark$3 : apostrophe$3; + return delimiter + title + delimiter } -var link_1$2 = link$3; +var link_1$2 = link$4; -/* Expression for a protocol: - * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ -var PROTOCOL = /^[a-z][a-z+.-]+:\/?/i; +var space$25 = ' '; +var leftSquareBracket$7 = '['; +var rightSquareBracket$7 = ']'; +var leftParenthesis$5 = '('; +var rightParenthesis$6 = ')'; -/* Stringify a link. - * - * When no title exists, the compiled `children` equal - * `url`, and `url` starts with a protocol, an auto - * link is created: - * - * - * - * Otherwise, is smart about enclosing `url` (see - * `encloseURI()`) and `title` (see `encloseTitle()`). - * - * [foo]( 'An "example" e-mail') - * - * Supports named entities in the `url` and `title` when - * in `settings.encode` mode. */ -function link$3(node) { +// Expression for a protocol: +// See . +var protocol$1 = /^[a-z][a-z+.-]+:\/?/i; + +// Stringify a link. +// +// When no title exists, the compiled `children` equal `url`, and `url` starts +// with a protocol, an auto link is created: +// +// ```markdown +// +// ``` +// +// Otherwise, is smart about enclosing `url` (see `encloseURI()`) and `title` +// (see `encloseTitle()`). +// ``` +// +// ```markdown +// [foo]( 'An "example" e-mail') +// ``` +// +// Supports named entities in the `url` and `title` when in `settings.encode` +// mode. +function link$4(node) { var self = this; var content = self.encode(node.url || '', node); var exit = self.enterLink(); @@ -29723,37 +30031,40 @@ function link$3(node) { exit(); - if ( - node.title == null && - PROTOCOL.test(content) && - (escaped === value || escaped === 'mailto:' + value) - ) { - /* Backslash escapes do not work in autolinks, - * so we do not escape. */ - return encloseUri(self.encode(node.url), true); + if (node.title == null && protocol$1.test(content) && escaped === value) { + // Backslash escapes do not work in autolinks, so we do not escape. + return encloseUri(self.encode(node.url), true) } content = encloseUri(content); if (node.title) { - content += ' ' + encloseTitle(self.encode(self.escape(node.title, node), node)); + content += space$25 + encloseTitle(self.encode(self.escape(node.title, node), node)); } - return '[' + value + '](' + content + ')'; + return ( + leftSquareBracket$7 + + value + + rightSquareBracket$7 + + leftParenthesis$5 + + content + + rightParenthesis$6 + ) } var copyIdentifierEncoding = copy$5; -var PUNCTUATION = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; +var ampersand$2 = '&'; -/* For shortcut and collapsed reference links, the contents - * is also an identifier, so we need to restore the original - * encoding and escaping that were present in the source - * string. - * - * This function takes the unescaped & unencoded value from - * shortcut's child nodes and the identifier and encodes - * the former according to the latter. */ +var punctuationExppresion = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; + +// For shortcut and collapsed reference links, the contents is also an +// identifier, so we need to restore the original encoding and escaping +// that were present in the source string. +// +// This function takes the unescaped & unencoded value from shortcut’s +// child nodes and the identifier and encodes the former according to +// the latter. function copy$5(value, identifier) { var length = value.length; var count = identifier.length; @@ -29763,25 +30074,31 @@ function copy$5(value, identifier) { var start; while (index < length) { - /* Take next non-punctuation characters from `value`. */ + // Take next non-punctuation characters from `value`. start = index; - while (index < length && !PUNCTUATION.test(value.charAt(index))) { + while (index < length && !punctuationExppresion.test(value.charAt(index))) { index += 1; } result.push(value.slice(start, index)); - /* Advance `position` to the next punctuation character. */ - while (position < count && !PUNCTUATION.test(identifier.charAt(position))) { + // Advance `position` to the next punctuation character. + while ( + position < count && + !punctuationExppresion.test(identifier.charAt(position)) + ) { position += 1; } - /* Take next punctuation characters from `identifier`. */ + // Take next punctuation characters from `identifier`. start = position; - while (position < count && PUNCTUATION.test(identifier.charAt(position))) { - if (identifier.charAt(position) === '&') { + while ( + position < count && + punctuationExppresion.test(identifier.charAt(position)) + ) { + if (identifier.charAt(position) === ampersand$2) { position += entityPrefixLength(identifier.slice(position)); } @@ -29790,32 +30107,49 @@ function copy$5(value, identifier) { result.push(identifier.slice(start, position)); - /* Advance `index` to the next non-punctuation character. */ - while (index < length && PUNCTUATION.test(value.charAt(index))) { + // Advance `index` to the next non-punctuation character. + while (index < length && punctuationExppresion.test(value.charAt(index))) { index += 1; } } - return result.join(''); + return result.join('') } var label_1 = label; -/* Stringify a reference label. - * Because link references are easily, mistakingly, - * created (for example, `[foo]`), reference nodes have - * an extra property depicting how it looked in the - * original document, so stringification can cause minimal - * changes. */ +var leftSquareBracket$8 = '['; +var rightSquareBracket$8 = ']'; + +var shortcut$2 = 'shortcut'; +var collapsed$1 = 'collapsed'; + +// Stringify a reference label. +// Because link references are easily, mistakingly, created (for example, +// `[foo]`), reference nodes have an extra property depicting how it looked in +// the original document, so stringification can cause minimal changes. function label(node) { var type = node.referenceType; - var value = type === 'full' ? node.identifier : ''; - return type === 'shortcut' ? value : '[' + value + ']'; + if (type === shortcut$2) { + return '' + } + + return ( + leftSquareBracket$8 + + (type === collapsed$1 ? '' : node.label || node.identifier) + + rightSquareBracket$8 + ) } var linkReference_1 = linkReference; +var leftSquareBracket$9 = '['; +var rightSquareBracket$9 = ']'; + +var shortcut$3 = 'shortcut'; +var collapsed$2 = 'collapsed'; + function linkReference(node) { var self = this; var type = node.referenceType; @@ -29824,51 +30158,82 @@ function linkReference(node) { exit(); - if (type === 'shortcut' || type === 'collapsed') { - value = copyIdentifierEncoding(value, node.identifier); + if (type === shortcut$3 || type === collapsed$2) { + value = copyIdentifierEncoding(value, node.label || node.identifier); } - return '[' + value + ']' + label_1(node); + return leftSquareBracket$9 + value + rightSquareBracket$9 + label_1(node) } var imageReference_1 = imageReference; +var leftSquareBracket$10 = '['; +var rightSquareBracket$10 = ']'; +var exclamationMark$5 = '!'; + function imageReference(node) { - return '![' + (this.encode(node.alt, node) || '') + ']' + label_1(node); + return ( + exclamationMark$5 + + leftSquareBracket$10 + + (this.encode(node.alt, node) || '') + + rightSquareBracket$10 + + label_1(node) + ) } var definition_1$2 = definition$1; -/* Stringify an URL definition. - * - * Is smart about enclosing `url` (see `encloseURI()`) and - * `title` (see `encloseTitle()`). - * - * [foo]: 'An "example" e-mail' - */ +var space$26 = ' '; +var colon$6 = ':'; +var leftSquareBracket$11 = '['; +var rightSquareBracket$11 = ']'; + +// Stringify an URL definition. +// +// Is smart about enclosing `url` (see `encloseURI()`) and `title` (see +// `encloseTitle()`). +// +// ```markdown +// [foo]: 'An "example" e-mail' +// ``` function definition$1(node) { var content = encloseUri(node.url); if (node.title) { - content += ' ' + encloseTitle(node.title); + content += space$26 + encloseTitle(node.title); } - return '[' + node.identifier + ']: ' + content; + return ( + leftSquareBracket$11 + + (node.label || node.identifier) + + rightSquareBracket$11 + + colon$6 + + space$26 + + content + ) } -var image_1 = image$2; +var image_1 = image$3; -/* Stringify an image. - * - * Is smart about enclosing `url` (see `encloseURI()`) and - * `title` (see `encloseTitle()`). - * - * ![foo]( 'My "favourite" icon') - * - * Supports named entities in `url`, `alt`, and `title` - * when in `settings.encode` mode. - */ -function image$2(node) { +var space$27 = ' '; +var leftParenthesis$6 = '('; +var rightParenthesis$7 = ')'; +var leftSquareBracket$12 = '['; +var rightSquareBracket$12 = ']'; +var exclamationMark$6 = '!'; + +// Stringify an image. +// +// Is smart about enclosing `url` (see `encloseURI()`) and `title` (see +// `encloseTitle()`). +// +// ```markdown +// ![foo]( 'My "favourite" icon') +// ``` +// +// Supports named entities in `url`, `alt`, and `title` when in +// `settings.encode` mode. +function image$3(node) { var self = this; var content = encloseUri(self.encode(node.url || '', node)); var exit = self.enterLink(); @@ -29877,31 +30242,72 @@ function image$2(node) { exit(); if (node.title) { - content += ' ' + encloseTitle(self.encode(node.title, node)); + content += space$27 + encloseTitle(self.encode(node.title, node)); } - return '![' + alt + '](' + content + ')'; + return ( + exclamationMark$6 + + leftSquareBracket$12 + + alt + + rightSquareBracket$12 + + leftParenthesis$6 + + content + + rightParenthesis$7 + ) } -var footnote_1 = footnote; +var footnote_1 = footnote$1; + +var leftSquareBracket$13 = '['; +var rightSquareBracket$13 = ']'; +var caret$3 = '^'; -function footnote(node) { - return '[^' + this.all(node).join('') + ']'; +function footnote$1(node) { + return ( + leftSquareBracket$13 + caret$3 + this.all(node).join('') + rightSquareBracket$13 + ) } var footnoteReference_1 = footnoteReference; +var leftSquareBracket$14 = '['; +var rightSquareBracket$14 = ']'; +var caret$4 = '^'; + function footnoteReference(node) { - return '[^' + node.identifier + ']'; + return ( + leftSquareBracket$14 + + caret$4 + + (node.label || node.identifier) + + rightSquareBracket$14 + ) } +var lineFeed$29 = '\n'; +var space$28 = ' '; +var colon$7 = ':'; +var leftSquareBracket$15 = '['; +var rightSquareBracket$15 = ']'; +var caret$5 = '^'; + +var tabSize$7 = 4; +var blank$5 = lineFeed$29 + lineFeed$29; +var indent = repeatString(space$28, tabSize$7); + var footnoteDefinition_1$2 = footnoteDefinition$1; function footnoteDefinition$1(node) { - var id = node.identifier.toLowerCase(); - var content = this.all(node).join('\n\n' + repeatString(' ', 4)); + var content = this.all(node).join(blank$5 + indent); - return '[^' + id + ']: ' + content; + return ( + leftSquareBracket$15 + + caret$5 + + (node.label || node.identifier) + + rightSquareBracket$15 + + colon$7 + + space$28 + + content + ) } /* Expose. */ @@ -29918,7 +30324,7 @@ var CENTER = 'c'; var DOT = '.'; var NULL = ''; -var ALLIGNMENT$1 = [LEFT, RIGHT, CENTER, DOT, NULL]; +var ALLIGNMENT = [LEFT, RIGHT, CENTER, DOT, NULL]; var MIN_CELL_SIZE = 3; /* Characters. */ @@ -30003,7 +30409,7 @@ function markdownTable(table, options) { align = align.charAt(0).toLowerCase(); } - if (ALLIGNMENT$1.indexOf(align) === -1) { + if (ALLIGNMENT.indexOf(align) === -1) { align = NULL; } @@ -30156,26 +30562,28 @@ function dotindex$1(value) { var table_1$2 = table$2; -/* Stringify table. - * - * Creates a fenced table by default, but not in - * `looseTable: true` mode: - * - * Foo | Bar - * :-: | --- - * Baz | Qux - * - * NOTE: Be careful with `looseTable: true` mode, as a - * loose table inside an indented code block on GitHub - * renders as an actual table! - * - * Creates a spaced table by default, but not in - * `spacedTable: false`: - * - * |Foo|Bar| - * |:-:|---| - * |Baz|Qux| - */ +var space$29 = ' '; +var verticalBar$2 = '|'; + +// Stringify table. +// +// Creates a fenced table by default, but not in `looseTable: true` mode: +// +// ```markdown +// Foo | Bar +// :-: | --- +// Baz | Qux +// +// NOTE: Be careful with `looseTable: true` mode, as a loose table inside an +// indented code block on GitHub renders as an actual table! +// +// Creates a spaced table by default, but not in `spacedTable: false`: +// +// ```markdown +// |Foo|Bar| +// |:-:|---| +// |Baz|Qux| +// ``` function table$2(node) { var self = this; var options = self.options; @@ -30200,11 +30608,11 @@ function table$2(node) { start = ''; end = ''; } else if (spaced) { - start = '| '; - end = ' |'; + start = verticalBar$2 + space$29; + end = space$29 + verticalBar$2; } else { - start = '|'; - end = '|'; + start = verticalBar$2; + end = verticalBar$2; } return markdownTable_1(result, { @@ -30213,19 +30621,19 @@ function table$2(node) { start: start, end: end, stringLength: stringLength, - delimiter: spaced ? ' | ' : '|' - }); + delimiter: spaced ? space$29 + verticalBar$2 + space$29 : verticalBar$2 + }) } var tableCell_1 = tableCell; function tableCell(node) { - return this.all(node).join(''); + return this.all(node).join('') } var compiler = Compiler; -/* Construct a new compiler. */ +// Construct a new compiler. function Compiler(tree, file) { this.inLink = false; this.inTable = false; @@ -30235,26 +30643,26 @@ function Compiler(tree, file) { this.setOptions({}); } -var proto$4 = Compiler.prototype; +var proto$6 = Compiler.prototype; -/* Enter and exit helpers. */ -proto$4.enterLink = stateToggle('inLink', false); -proto$4.enterTable = stateToggle('inTable', false); -proto$4.enterLinkReference = enterLinkReference; +// Enter and exit helpers. */ +proto$6.enterLink = stateToggle('inLink', false); +proto$6.enterTable = stateToggle('inTable', false); +proto$6.enterLinkReference = enterLinkReference; -/* Configuration. */ -proto$4.options = defaults$5; -proto$4.setOptions = setOptions_1$2; +// Configuration. +proto$6.options = defaults$5; +proto$6.setOptions = setOptions_1$2; -proto$4.compile = compile_1; -proto$4.visit = one_1; -proto$4.all = all_1; -proto$4.block = block_1; -proto$4.visitOrderedItems = orderedItems_1; -proto$4.visitUnorderedItems = unorderedItems_1; +proto$6.compile = compile_1; +proto$6.visit = one_1; +proto$6.all = all_1; +proto$6.block = block_1; +proto$6.visitOrderedItems = orderedItems_1; +proto$6.visitUnorderedItems = unorderedItems_1; -/* Expose visitors. */ -proto$4.visitors = { +// Expose visitors. +proto$6.visitors = { root: root_1, text: text_1$2, heading: heading_1, @@ -30287,81 +30695,124 @@ stringify$7.Compiler = compiler; function stringify$7(options) { var Local = unherit_1(compiler); - Local.prototype.options = immutable(Local.prototype.options, this.data('settings'), options); + Local.prototype.options = immutable( + Local.prototype.options, + this.data('settings'), + options + ); this.Compiler = Local; } -var remark = unified_1().use(remarkParse).use(remarkStringify).freeze(); - -const name = "remark"; -const version$1 = "8.0.0"; +var remark = unified_1() + .use(remarkParse) + .use(remarkStringify) + .freeze(); + +const _from = "remark@^10.0.0"; +const _id = "remark@10.0.0"; +const _inBundle = false; +const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ=="; +const _location = "/remark"; +const _phantomChildren = {}; +const _requested = {"type":"range","registry":true,"raw":"remark@^10.0.0","name":"remark","escapedName":"remark","rawSpec":"^10.0.0","saveSpec":null,"fetchSpec":"^10.0.0"}; +const _requiredBy = ["/"]; +const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz"; +const _shasum = "4d94ae09d0e81e52fe40a31e89a0103c553f509e"; +const _spec = "remark@^10.0.0"; +const _where = "/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"; +const author = {"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}; +const bugs = {"url":"https://github.com/remarkjs/remark/issues"}; +const bundleDependencies = false; +const contributors = [{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}]; +const dependencies = {"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"}; +const deprecated$1 = false; const description = "Markdown processor powered by plugins"; -const license = "MIT"; -const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; -const dependencies = {"remark-parse":"^4.0.0","remark-stringify":"^4.0.0","unified":"^6.0.0"}; -const homepage = "http://remark.js.org"; -const repository = "https://github.com/wooorm/remark/tree/master/packages/remark"; -const bugs = "https://github.com/wooorm/remark/issues"; -const author = "Titus Wormer (http://wooorm.com)"; -const contributors = ["Titus Wormer (http://wooorm.com)"]; +const devDependencies = {"tape":"^4.9.1"}; const files = ["index.js"]; -const scripts = {}; +const homepage = "http://remark.js.org"; +const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; +const license = "MIT"; +const name = "remark"; +const repository = {"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"}; +const scripts = {"test":"tape test.js"}; +const version$1 = "10.0.0"; const xo = false; -const _resolved = "https://registry.npmjs.org/remark/-/remark-8.0.0.tgz"; -const _integrity = "sha512-K0PTsaZvJlXTl9DN6qYlvjTkqSZBFELhROZMrblm2rB+085flN84nz4g/BscKRMqDvhzlK1oQ/xnWQumdeNZYw=="; -const _from = "remark@8.0.0"; var _package = { - name: name, - version: version$1, - description: description, - license: license, - keywords: keywords, - dependencies: dependencies, - homepage: homepage, - repository: repository, - bugs: bugs, + _from: _from, + _id: _id, + _inBundle: _inBundle, + _integrity: _integrity, + _location: _location, + _phantomChildren: _phantomChildren, + _requested: _requested, + _requiredBy: _requiredBy, + _resolved: _resolved, + _shasum: _shasum, + _spec: _spec, + _where: _where, author: author, + bugs: bugs, + bundleDependencies: bundleDependencies, contributors: contributors, + dependencies: dependencies, + deprecated: deprecated$1, + description: description, + devDependencies: devDependencies, files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, scripts: scripts, - xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from + version: version$1, + xo: xo }; var _package$1 = Object.freeze({ - name: name, - version: version$1, - description: description, - license: license, - keywords: keywords, - dependencies: dependencies, - homepage: homepage, - repository: repository, - bugs: bugs, + _from: _from, + _id: _id, + _inBundle: _inBundle, + _integrity: _integrity, + _location: _location, + _phantomChildren: _phantomChildren, + _requested: _requested, + _requiredBy: _requiredBy, + _resolved: _resolved, + _shasum: _shasum, + _spec: _spec, + _where: _where, author: author, + bugs: bugs, + bundleDependencies: bundleDependencies, contributors: contributors, + dependencies: dependencies, + deprecated: deprecated$1, + description: description, + devDependencies: devDependencies, files: files, + homepage: homepage, + keywords: keywords, + license: license, + name: name, + repository: repository, scripts: scripts, + version: version$1, xo: xo, - _resolved: _resolved, - _integrity: _integrity, - _from: _from, default: _package }); const name$1 = "node-lint-md-cli-rollup"; const description$1 = "remark packaged for node markdown linting"; const version$2 = "1.0.0"; -const devDependencies = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; -const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^8.0.0","remark-lint":"^6.0.2","remark-preset-lint-node":"^1.1.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; +const devDependencies$1 = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; +const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.1.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."}; var _package$2 = { name: name$1, description: description$1, version: version$2, - devDependencies: devDependencies, + devDependencies: devDependencies$1, dependencies: dependencies$1, scripts: scripts$1 }; @@ -30370,7 +30821,7 @@ var _package$3 = Object.freeze({ name: name$1, description: description$1, version: version$2, - devDependencies: devDependencies, + devDependencies: devDependencies$1, dependencies: dependencies$1, scripts: scripts$1, default: _package$2 @@ -31489,7 +31940,7 @@ var remarkLintFencedCodeFlag = unifiedLintRule('remark-lint:fenced-code-flag', f var start$1 = unistUtilPosition.start; var end$1 = unistUtilPosition.end; -var fence = /^ {0,3}([~`])\1{2,}/; +var fence$2 = /^ {0,3}([~`])\1{2,}/; var reasonInvalid = 'Invalid code-language flag'; var reasonMissing = 'Missing code-language flag'; @@ -31520,7 +31971,7 @@ function fencedCodeFlag(tree, file, pref) { } else { value = contents.slice(start$1(node).offset, end$1(node).offset); - if (!allowEmpty && fence.test(value)) { + if (!allowEmpty && fence$2.test(value)) { file.message(reasonMissing, node); } } @@ -31596,15 +32047,15 @@ function hardBreakSpaces(tree, file) { } } -var mdastUtilToString = toString$5; +var mdastUtilToString = toString$6; /* Get the text content of a node. If the node itself * does not expose plain-text fields, `toString` will * recursivly try its children. */ -function toString$5(node) { +function toString$6(node) { return ( valueOf$1(node) || - (node.children && node.children.map(toString$5).join('')) || + (node.children && node.children.map(toString$6).join('')) || '' ) } @@ -31627,7 +32078,7 @@ var end$2 = unistUtilPosition.end; /* Protocol expression. See: * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ -var protocol$1 = /^[a-z][a-z+.-]+:\/?/i; +var protocol$2 = /^[a-z][a-z+.-]+:\/?/i; var reason$3 = 'All automatic links must start with a protocol'; @@ -31643,7 +32094,7 @@ function noAutoLinkWithoutProtocol(tree, file) { if ( start$3(node).column === start$3(children[0]).column - 1 && end$2(node).column === end$2(children[children.length - 1]).column + 1 && - !protocol$1.test(mdastUtilToString(node)) + !protocol$2.test(mdastUtilToString(node)) ) { file.message(reason$3, node); } @@ -33041,7 +33492,7 @@ function fileExtension(tree, file, pref) { var remarkLintFirstHeadingLevel = unifiedLintRule('remark-lint:first-heading-level', firstHeadingLevel); -var re$4 = / Date: Sat, 10 Nov 2018 21:09:42 +0100 Subject: [PATCH 124/223] tls: do not rely on 'drain' handlers in StreamWrap `'drain'` event handlers may not be invoked if the stream is currently finishing. Instead, use the fact that we know when writes are active or not, and invoke the delayed shutdown handler from our own after-write callback. PR-URL: https://github.com/nodejs/node/pull/24290 Refs: https://github.com/nodejs/node/pull/24288 Refs: https://github.com/nodejs/node/pull/24075 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Ouyang Yadong --- lib/internal/wrap_js_stream.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/internal/wrap_js_stream.js b/lib/internal/wrap_js_stream.js index 7ca7ff8bf49d25..cf8f45aa4505ff 100644 --- a/lib/internal/wrap_js_stream.js +++ b/lib/internal/wrap_js_stream.js @@ -11,6 +11,7 @@ const { ERR_STREAM_WRAP } = require('internal/errors').codes; const kCurrentWriteRequest = Symbol('kCurrentWriteRequest'); const kCurrentShutdownRequest = Symbol('kCurrentShutdownRequest'); +const kPendingShutdownRequest = Symbol('kPendingShutdownRequest'); function isClosing() { return this[owner_symbol].isClosing(); } function onreadstart() { return this[owner_symbol].readStart(); } @@ -79,6 +80,7 @@ class JSStreamWrap extends Socket { this.stream = stream; this[kCurrentWriteRequest] = null; this[kCurrentShutdownRequest] = null; + this[kPendingShutdownRequest] = null; this.readable = stream.readable; this.writable = stream.writable; @@ -115,8 +117,10 @@ class JSStreamWrap extends Socket { // Working around that on the native side is not quite trivial (yet?), // so for now that is supported here. - if (this[kCurrentWriteRequest] !== null) - return this.once('drain', () => this.doShutdown(req)); + if (this[kCurrentWriteRequest] !== null) { + this[kPendingShutdownRequest] = req; + return 0; + } assert.strictEqual(this[kCurrentWriteRequest], null); assert.strictEqual(this[kCurrentShutdownRequest], null); this[kCurrentShutdownRequest] = req; @@ -189,6 +193,11 @@ class JSStreamWrap extends Socket { this[kCurrentWriteRequest] = null; handle.finishWrite(req, errCode); + if (this[kPendingShutdownRequest]) { + const req = this[kPendingShutdownRequest]; + this[kPendingShutdownRequest] = null; + this.doShutdown(req); + } } doClose(cb) { From 0f6a9524f82ca435ae5c53dfc580b7b37dbf9913 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 10 Nov 2018 21:11:17 +0100 Subject: [PATCH 125/223] tls: destroy TLS socket if StreamWrap is destroyed Previously, there was no mechanism in place that would have destroyed the TLS socket once the underlying socket had been closed. PR-URL: https://github.com/nodejs/node/pull/24290 Refs: https://github.com/nodejs/node/pull/24288 Refs: https://github.com/nodejs/node/pull/24075 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Ouyang Yadong --- lib/_tls_wrap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 9049a830f805e4..9bfdd4062fc762 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -310,10 +310,12 @@ function TLSSocket(socket, opts) { // Wrap plain JS Stream into StreamWrap var wrap; - if ((socket instanceof net.Socket && socket._handle) || !socket) + if ((socket instanceof net.Socket && socket._handle) || !socket) { wrap = socket; - else + } else { wrap = new StreamWrap(socket); + wrap.once('close', () => this.destroy()); + } // Just a documented property to make secure sockets // distinguishable from regular ones. From c84b4204571e8f87fae300e4ab331e688912fb10 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 10 Nov 2018 21:03:46 +0100 Subject: [PATCH 126/223] Revert "net: partially revert "simplify Socket.prototype._final"" This reverts commit ac1f56c76a5d1a8ebcb2421d5c629e51df1ac48c. Refs: https://github.com/nodejs/node/pull/24288 Refs: https://github.com/nodejs/node/pull/24075 PR-URL: https://github.com/nodejs/node/pull/24290 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Ouyang Yadong --- lib/net.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/net.js b/lib/net.js index 190f40c38f78b6..d21040198de631 100644 --- a/lib/net.js +++ b/lib/net.js @@ -349,12 +349,6 @@ Socket.prototype._final = function(cb) { return this.once('connect', () => this._final(cb)); } - // TODO(addaleax): This should not be necessary. - if (!this.readable || this._readableState.ended) { - cb(); - return this.destroy(); - } - if (!this._handle) return cb(); From 987df276cb02b0e937201e6e57307528d44ad919 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 14 Nov 2018 11:09:57 -0800 Subject: [PATCH 127/223] test: remove unused function arguments in async-hooks tests Remove unused function arguments in two async-hooks tests. PR-URL: https://github.com/nodejs/node/pull/24368 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Franziska Hinkelmann --- test/async-hooks/test-getaddrinforeqwrap.js | 2 +- test/async-hooks/test-getnameinforeqwrap.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/async-hooks/test-getaddrinforeqwrap.js b/test/async-hooks/test-getaddrinforeqwrap.js index 298c4931cce74e..bb5bf04849b477 100644 --- a/test/async-hooks/test-getaddrinforeqwrap.js +++ b/test/async-hooks/test-getaddrinforeqwrap.js @@ -14,7 +14,7 @@ const hooks = initHooks(); hooks.enable(); dns.lookup('www.google.com', 4, common.mustCall(onlookup)); -function onlookup(err_, ip, family) { +function onlookup() { // we don't care about the error here in order to allow // tests to run offline (lookup will fail in that case and the err be set); diff --git a/test/async-hooks/test-getnameinforeqwrap.js b/test/async-hooks/test-getnameinforeqwrap.js index a32814e5b5df4a..f0425ee3dc8599 100644 --- a/test/async-hooks/test-getnameinforeqwrap.js +++ b/test/async-hooks/test-getnameinforeqwrap.js @@ -14,7 +14,7 @@ const hooks = initHooks(); hooks.enable(); dns.lookupService('127.0.0.1', 80, common.mustCall(onlookupService)); -function onlookupService(err_, ip, family) { +function onlookupService() { // we don't care about the error here in order to allow // tests to run offline (lookup will fail in that case and the err be set) From dc5647f71bada184eb458aa23ee8dcf3aef51edb Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 10 Nov 2018 17:12:56 -0500 Subject: [PATCH 128/223] build,tools: update make-v8.sh for ppc64le PR-URL: https://github.com/nodejs/node/pull/24293 Fixes: https://github.com/nodejs/build/issues/1536 Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson Reviewed-By: Franziska Hinkelmann --- tools/make-v8.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/make-v8.sh b/tools/make-v8.sh index 1bbf472aae7df2..fd66fda94274df 100755 --- a/tools/make-v8.sh +++ b/tools/make-v8.sh @@ -6,8 +6,8 @@ V8_BUILD_OPTIONS=$2 cd deps/v8 tools/node/fetch_deps.py . -if [ "`arch`" == "s390x" ] -then +ARCH="`arch`" +if [[ "$ARCH" == "s390x" ]] || [[ "$ARCH" == "ppc64le" ]]; then # set paths manually for now to use locally installed gn export BUILD_TOOLS=/home/iojs/build-tools export LD_LIBRARY_PATH=$BUILD_TOOLS:$LD_LIBRARY_PATH @@ -15,12 +15,21 @@ then CXX_PATH=`which $CXX |grep g++` rm -f "$BUILD_TOOLS/g++" rm -f "$BUILD_TOOLS/gcc" +fi +if [[ "$ARCH" == "s390x" ]]; then ln -s $CXX_PATH "$BUILD_TOOLS/g++" ln -s $CXX_PATH "$BUILD_TOOLS/gcc" g++ --version export PKG_CONFIG_PATH=$BUILD_TOOLS/pkg-config gn gen -v out.gn/$BUILD_ARCH_TYPE --args='is_component_build=false is_debug=false use_goma=false goma_dir="None" use_custom_libcxx=false v8_target_cpu="s390x" target_cpu="s390x"' ninja -v -C out.gn/$BUILD_ARCH_TYPE d8 cctest inspector-test +elif [[ "$ARCH" == "ppc64le" ]]; then + ln -s /usr/bin/$CXX "$BUILD_TOOLS/g++" + ln -s /usr/bin/$CC "$BUILD_TOOLS/gcc" + g++ --version + export PKG_CONFIG_PATH=$BUILD_TOOLS/pkg-config-files + gn gen out.gn/$BUILD_ARCH_TYPE --args='is_component_build=false is_debug=false use_goma=false goma_dir="None" use_custom_libcxx=false v8_target_cpu="ppc64" target_cpu="ppc64"' + ninja -C out.gn/$BUILD_ARCH_TYPE d8 cctest inspector-test else PATH=~/_depot_tools:$PATH tools/dev/v8gen.py $BUILD_ARCH_TYPE --no-goma $V8_BUILD_OPTIONS PATH=~/_depot_tools:$PATH ninja -C out.gn/$BUILD_ARCH_TYPE/ d8 cctest inspector-test From c19d6e26a3faf1ae8fd334ce40c02322214e473f Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 14 Nov 2018 14:51:12 -0500 Subject: [PATCH 129/223] doc: better linkage to node-addon-api One of the comments we got at the N-API workshop at NodeConfEU was that we should have a better link to node-addon-api and the docs in the main API docs for N-API. The goal being to help people find node-addon-api and potentially start with the node-addon-api docs instead if they are using C++. This expands and strengthens the link along with a recommendation that starting with the node-addon-api docs might make sense. PR-URL: https://github.com/nodejs/node/pull/24371 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Vse Mozhet Byt Reviewed-By: Franziska Hinkelmann --- doc/api/n-api.md | 52 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 17d6dac0a333e9..91a39ff4835266 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -34,13 +34,51 @@ properties: handling section [Error Handling][]. The N-API is a C API that ensures ABI stability across Node.js versions -and different compiler levels. However, we also understand that a C++ -API can be easier to use in many cases. To support these cases we expect -there to be one or more C++ wrapper modules that provide an inlineable C++ -API. Binaries built with these wrapper modules will depend on the symbols -for the N-API C based functions exported by Node.js. These wrappers are not -part of N-API, nor will they be maintained as part of Node.js. One such -example is: [node-addon-api](https://github.com/nodejs/node-addon-api). +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). +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 +efficient way to write code that calls N-API. Take, for example, the +following `node-addon-api` code. The first section shows the +`node-addon-api` code and the second section shows what actually gets +used in the addon. + +```C++ +Object obj = Object::New(env); +obj["foo"] = String::New(env, "bar"); +``` + +```C++ +napi_status status; +napi_value object, string; +status = napi_create_object(env, &object); +if (status != napi_ok) { + napi_throw_error(env, ...); + return; +} + +status = napi_crate_string_utf8(env, "bar", NAPI_AUTO_LENGTH, &string); +if (status != napi_ok) { + napi_throw_error(env, ...); + return; +} + +status = napi_set_named_property(env, object, "foo", string); +if (status != napi_ok) { + napi_throw_error(env, ...); + return; +} +``` + +The end result is that the addon only uses the exported C APIs. As a result, +it still gets the benefits of the ABI stability provided by the C API. + +When using `node-addon-api` instead of the C APIs, start with the API +[docs](https://github.com/nodejs/node-addon-api#api-documentation) +for `node-addon-api`. ## Implications of ABI Stability From 8c8199211bd6acacd7052f6129556f59d18b5eea Mon Sep 17 00:00:00 2001 From: Osmond van Hemert Date: Thu, 8 Nov 2018 15:04:09 +0100 Subject: [PATCH 130/223] test: https agent clientcertengine coverage PR-URL: https://github.com/nodejs/node/pull/24248 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/parallel/test-https-agent-getname.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index c29e09731df0b2..b68850f21d57ca 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -22,6 +22,7 @@ const options = { localAddress: '192.168.1.1', ca: 'ca', cert: 'cert', + clientCertEngine: 'dynamic', ciphers: 'ciphers', crl: [Buffer.from('c'), Buffer.from('r'), Buffer.from('l')], dhparam: 'dhparam', @@ -38,6 +39,6 @@ const options = { assert.strictEqual( agent.getName(options), - '0.0.0.0:443:192.168.1.1:ca:cert::ciphers:key:pfx:false:localhost:' + + '0.0.0.0:443:192.168.1.1:ca:cert:dynamic:ciphers:key:pfx:false:localhost:' + 'secureProtocol:c,r,l:false:ecdhCurve:dhparam:0:sessionIdContext' ); From 3b6135ff2c2690c66444f2b9373a583b6abc68a1 Mon Sep 17 00:00:00 2001 From: Julia Date: Wed, 14 Nov 2018 20:34:16 -0500 Subject: [PATCH 131/223] test: use destructuring and remove unused arguments Use destructuring consistently and remove unused function arguments in test-pipewrap.js PR-URL: https://github.com/nodejs/node/pull/24375 Reviewed-By: Rich Trott Reviewed-By: Weijia Wang Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann Reviewed-By: Trivikram Kamat --- test/async-hooks/test-pipewrap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/async-hooks/test-pipewrap.js b/test/async-hooks/test-pipewrap.js index f2b5bf985225b9..d4df64d743069e 100644 --- a/test/async-hooks/test-pipewrap.js +++ b/test/async-hooks/test-pipewrap.js @@ -8,7 +8,7 @@ const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); -const spawn = require('child_process').spawn; +const { spawn } = require('child_process'); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different async IDs'); @@ -45,7 +45,7 @@ checkInvocations(processwrap, { init: 1 }, checkInvocations(x, { init: 1 }, 'pipe wrap when sleep.spawn was called'); }); -function onsleepExit(code) { +function onsleepExit() { checkInvocations(processwrap, { init: 1, before: 1 }, 'processwrap while in onsleepExit callback'); } From e11d46cb84c9fae195ab398ecb380cbe4ddcdcd1 Mon Sep 17 00:00:00 2001 From: Thomas Hunter II Date: Mon, 12 Nov 2018 12:09:39 -0800 Subject: [PATCH 132/223] doc: adjusting formatting when printing - reduces page margins - removes emphasis from links - hides expandable history items - removes horizontal scrollbar from bottom of print output - reduce stability rectangle sizes - shrink headlines slightly - hide ToC (as it's unclickable when printed) Ref: https://thomashunter.name/nodejs-documentation-pdf PR-URL: https://github.com/nodejs/node/pull/24325 Reviewed-By: Rich Trott Reviewed-By: Bryan English --- doc/api_assets/style.css | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 7d65b7405b41d1..d5220e816810f6 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -533,12 +533,51 @@ th > *:last-child, td > *:last-child { @media print { html { height: auto; + font-size: 0.75em; } #column2.interior { display: none; } #column1.interior { - margin-left: auto; + margin-left: 0px; + padding: 0px; overflow-y: auto; } + .api_metadata, + #toc, + .srclink, + #gtoc, + .mark { + display: none; + } + h1 { + font-size: 2rem; + } + h2 { + font-size: 1.75rem; + } + h3 { + font-size: 1.5rem; + } + h4 { + font-size: 1.3rem; + } + h5 { + font-size: 1.2rem; + } + h6 { + font-size: 1.1rem; + } + .api_stability { + display: inline-block; + } + .api_stability a { + text-decoration: none; + } + a { + color: inherit; + } + #apicontent { + overflow: hidden; + } } From 5d2dadccff24f66e5157707be7ff531522f1a02c Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 8 Nov 2018 13:49:40 -0500 Subject: [PATCH 133/223] build: check minimum ICU in configure for system-icu - check the version number coming out of pkg-config PR-URL: https://github.com/nodejs/node/pull/24255 Fixes: https://github.com/nodejs/node/issues/24253 Reviewed-By: Gus Caplan Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- configure.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index a5075bd9d8a60b..0a7ffba5e069b0 100755 --- a/configure.py +++ b/configure.py @@ -429,7 +429,7 @@ dest='with_icu_source', help='Intl mode: optional local path to icu/ dir, or path/URL of ' 'the icu4c source archive. ' - 'v%d.x or later recommended.' % icu_versions["minimum_icu"]) + 'v%d.x or later recommended.' % icu_versions['minimum_icu']) parser.add_option('--with-ltcg', action='store_true', @@ -621,9 +621,13 @@ def b(value): def pkg_config(pkg): + """Run pkg-config on the specified package + Returns ("-l flags", "-I flags", "-L flags", "version") + otherwise (None, None, None, None)""" pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config') retval = () - for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']: + for flag in ['--libs-only-l', '--cflags-only-I', + '--libs-only-L', '--modversion']: try: proc = subprocess.Popen( shlex.split(pkg_config) + ['--silence-errors', flag, pkg], @@ -631,7 +635,7 @@ def pkg_config(pkg): val = proc.communicate()[0].strip() except OSError as e: if e.errno != errno.ENOENT: raise e # Unexpected error. - return (None, None, None) # No pkg-config/pkgconf installed. + return (None, None, None, None) # No pkg-config/pkgconf installed. retval += (val,) return retval @@ -1123,7 +1127,7 @@ def configure_library(lib, output): output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) if getattr(options, shared_lib): - (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) + (pkg_libs, pkg_cflags, pkg_libpath, pkg_modversion) = pkg_config(lib) if options.__dict__[shared_lib + '_includes']: output['include_dirs'] += [options.__dict__[shared_lib + '_includes']] @@ -1356,7 +1360,12 @@ def write_config(data, name): if pkgicu[0] is None: error('''Could not load pkg-config data for "icu-i18n". See above errors or the README.md.''') - (libs, cflags, libpath) = pkgicu + (libs, cflags, libpath, icuversion) = pkgicu + icu_ver_major = icuversion.split('.')[0] + o['variables']['icu_ver_major'] = icu_ver_major + if int(icu_ver_major) < icu_versions['minimum_icu']: + error('icu4c v%s is too old, v%d.x or later is required.' % + (icuversion, icu_versions['minimum_icu'])) # libpath provides linker path which may contain spaces if libpath: o['libraries'] += [libpath] @@ -1474,9 +1483,9 @@ def write_config(data, name): icu_ver_major = m.group(1) if not icu_ver_major: error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h) - elif int(icu_ver_major) < icu_versions["minimum_icu"]: - error('icu4c v%d.x is too old, v%d.x or later is required.' % (int(icu_ver_major), - icu_versions["minimum_icu"])) + elif int(icu_ver_major) < icu_versions['minimum_icu']: + error('icu4c v%s.x is too old, v%d.x or later is required.' % + (icu_ver_major, icu_versions['minimum_icu'])) icu_endianness = sys.byteorder[0]; o['variables']['icu_ver_major'] = icu_ver_major o['variables']['icu_endianness'] = icu_endianness From fa52ba621bebd58c9a97431e905db056131e73a6 Mon Sep 17 00:00:00 2001 From: Kanika Singhal Date: Sat, 17 Nov 2018 17:10:27 +0530 Subject: [PATCH 134/223] src: elevate v8 namespaces of referenced artifacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24424 Reviewed-By: Michaël Zasso Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- src/node_perf.cc | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/node_perf.cc b/src/node_perf.cc index 4aa5da03d7a7e4..3af5e6d5094a4c 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -10,17 +10,24 @@ namespace performance { using v8::Array; using v8::Context; +using v8::DontDelete; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; +using v8::GCCallbackFlags; +using v8::GCType; using v8::HandleScope; using v8::Integer; using v8::Isolate; using v8::Local; using v8::Name; +using v8::NewStringType; using v8::Number; using v8::Object; +using v8::PropertyAttribute; +using v8::ReadOnly; using v8::String; +using v8::Uint32Array; using v8::Value; // Microseconds in a second, as a float. @@ -36,7 +43,7 @@ uint64_t performance_node_start; uint64_t performance_v8_start; uint64_t performance_last_gc_start_mark_ = 0; -v8::GCType performance_last_gc_type_ = v8::GCType::kGCTypeAll; +GCType performance_last_gc_type_ = GCType::kGCTypeAll; void performance_state::Mark(enum PerformanceMilestone milestone, uint64_t ts) { @@ -69,13 +76,13 @@ inline void InitObject(const PerformanceEntry& entry, Local obj) { Environment* env = entry.env(); Isolate* isolate = env->isolate(); Local context = env->context(); - v8::PropertyAttribute attr = - static_cast(v8::ReadOnly | v8::DontDelete); + PropertyAttribute attr = + static_cast(ReadOnly | DontDelete); obj->DefineOwnProperty(context, env->name_string(), String::NewFromUtf8(isolate, entry.name().c_str(), - v8::NewStringType::kNormal) + NewStringType::kNormal) .ToLocalChecked(), attr) .FromJust(); @@ -83,7 +90,7 @@ inline void InitObject(const PerformanceEntry& entry, Local obj) { env->entry_type_string(), String::NewFromUtf8(isolate, entry.type().c_str(), - v8::NewStringType::kNormal) + NewStringType::kNormal) .ToLocalChecked(), attr) .FromJust(); @@ -124,7 +131,7 @@ void PerformanceEntry::Notify(Environment* env, PerformanceEntryType type, Local object) { Context::Scope scope(env->context()); - AliasedBuffer& observers = + AliasedBuffer& observers = env->performance_state()->observers; if (type != NODE_PERFORMANCE_ENTRY_TYPE_INVALID && observers[type]) { @@ -242,12 +249,12 @@ void PerformanceGCCallback(Environment* env, void* ptr) { HandleScope scope(env->isolate()); Local context = env->context(); - AliasedBuffer& observers = + AliasedBuffer& observers = env->performance_state()->observers; if (observers[NODE_PERFORMANCE_ENTRY_TYPE_GC]) { Local obj = entry->ToObject(); - v8::PropertyAttribute attr = - static_cast(v8::ReadOnly | v8::DontDelete); + PropertyAttribute attr = + static_cast(ReadOnly | DontDelete); obj->DefineOwnProperty(context, env->kind_string(), Integer::New(env->isolate(), entry->gckind()), @@ -260,16 +267,16 @@ void PerformanceGCCallback(Environment* env, void* ptr) { // Marks the start of a GC cycle void MarkGarbageCollectionStart(Isolate* isolate, - v8::GCType type, - v8::GCCallbackFlags flags) { + GCType type, + GCCallbackFlags flags) { performance_last_gc_start_mark_ = PERFORMANCE_NOW(); performance_last_gc_type_ = type; } // Marks the end of a GC cycle void MarkGarbageCollectionEnd(Isolate* isolate, - v8::GCType type, - v8::GCCallbackFlags flags, + GCType type, + GCCallbackFlags flags, void* data) { Environment* env = static_cast(data); // If no one is listening to gc performance entries, do not create them. @@ -341,7 +348,7 @@ void TimerFunctionCall(const FunctionCallbackInfo& args) { return; args.GetReturnValue().Set(ret.ToLocalChecked()); - AliasedBuffer& observers = + AliasedBuffer& observers = env->performance_state()->observers; if (!observers[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION]) return; @@ -414,18 +421,18 @@ void Initialize(Local target, NODE_PERFORMANCE_MILESTONES(V) #undef V - v8::PropertyAttribute attr = - static_cast(v8::ReadOnly | v8::DontDelete); + PropertyAttribute attr = + static_cast(ReadOnly | DontDelete); target->DefineOwnProperty(context, FIXED_ONE_BYTE_STRING(isolate, "timeOrigin"), - v8::Number::New(isolate, timeOrigin / 1e6), + Number::New(isolate, timeOrigin / 1e6), attr).ToChecked(); target->DefineOwnProperty( context, FIXED_ONE_BYTE_STRING(isolate, "timeOriginTimestamp"), - v8::Number::New(isolate, timeOriginTimestamp / MICROS_PER_MILLIS), + Number::New(isolate, timeOriginTimestamp / MICROS_PER_MILLIS), attr).ToChecked(); target->DefineOwnProperty(context, From 2734c20bd9fb327faadff1f582447d71205de672 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 15 Nov 2018 16:47:44 -0800 Subject: [PATCH 135/223] doc: simplify first-time contributors section of Collaborator Guide PR-URL: https://github.com/nodejs/node/pull/24387 Reviewed-By: Ouyang Yadong Reviewed-By: Weijia Wang Reviewed-By: Refael Ackermann Reviewed-By: Franziska Hinkelmann Reviewed-By: Trivikram Kamat Reviewed-By: Vse Mozhet Byt --- COLLABORATOR_GUIDE.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index deadf87ed15092..1eb75fc1f8d703 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -50,16 +50,14 @@ request. See [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker). ### Welcoming First-Time Contributors -Courtesy should always be shown to individuals submitting issues and pull -requests to the Node.js project. Be welcoming to first-time contributors, -identified by the GitHub ![First-time contributor](./doc/first_timer_badge.png) -badge. +Always show courtesy to individuals submitting issues and pull requests. Be +welcoming to first-time contributors, identified by the GitHub +![First-time contributor](./doc/first_timer_badge.png) badge. -For first-time contributors, check if the commit author is the same as the -pull request author, and ask if they have configured their git +For first-time contributors, check if the commit author is the same as the pull +request author. This way, once their pull request lands, GitHub will show them +as a _Contributor_. Ask if they have configured their git [username][git-username] and [email][git-email] to their liking. -This is to make sure they would be promoted to "contributor" once their -pull request lands. ### Closing Issues and Pull Requests From 555ef65042564875da1b7fad9eaaeece014a8de6 Mon Sep 17 00:00:00 2001 From: Lakshmi Shanmugam Date: Sat, 17 Nov 2018 16:54:37 +0530 Subject: [PATCH 136/223] test: fixed the arguments order in `assert.strictEqual` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24414 Reviewed-By: Michaël Zasso Reviewed-By: Ouyang Yadong Reviewed-By: Gireesh Punathil --- test/internet/test-dns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 4608713927abbd..e4d863a77d5e7a 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -691,7 +691,7 @@ req.oncomplete = function(err, domains) { process.on('exit', function() { console.log(`${completed} tests completed`); assert.strictEqual(running, false); - assert.strictEqual(expected, completed); + assert.strictEqual(completed, expected); assert.ok(getaddrinfoCallbackCalled); }); From 53973fde9df573e79e73edd4ec99ddce40564bce Mon Sep 17 00:00:00 2001 From: Jayasankar Date: Sat, 17 Nov 2018 17:03:24 +0530 Subject: [PATCH 137/223] test:replace anonymous closure function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24415 Reviewed-By: Michaël Zasso Reviewed-By: Ouyang Yadong Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- .../test-http-pipeline-socket-parser-typeerror.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-http-pipeline-socket-parser-typeerror.js b/test/parallel/test-http-pipeline-socket-parser-typeerror.js index 0cb20e76172766..8987b822c26496 100644 --- a/test/parallel/test-http-pipeline-socket-parser-typeerror.js +++ b/test/parallel/test-http-pipeline-socket-parser-typeerror.js @@ -20,7 +20,7 @@ let more; let done; const server = http - .createServer(function(req, res) { + .createServer((req, res) => { if (!once) server.close(); once = true; @@ -41,18 +41,18 @@ const server = http } done(); }) - .on('upgrade', function(req, socket) { - second.end(chunk, function() { + .on('upgrade', (req, socket) => { + second.end(chunk, () => { socket.end(); }); first.end('hello'); }) - .listen(0, function() { - const s = net.connect(this.address().port); - more = function() { + .listen(0, () => { + const s = net.connect(server.address().port); + more = () => { s.write('GET / HTTP/1.1\r\n\r\n'); }; - done = function() { + done = () => { s.write( 'GET / HTTP/1.1\r\n\r\n' + 'GET / HTTP/1.1\r\nConnection: upgrade\r\nUpgrade: ws\r\n\r\naaa' From 5e3c6799cb4d8d5ffccf9dce481126a135e7a6ad Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Sun, 18 Nov 2018 01:05:41 +0530 Subject: [PATCH 138/223] http2: elevate v8 namespaces of repeated references PR-URL: https://github.com/nodejs/node/pull/24453 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil --- src/node_http2.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index 0b97e524b3dbc3..3e59c61b8641ac 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -12,11 +12,13 @@ namespace node { using v8::ArrayBuffer; +using v8::ArrayBufferCreationMode; using v8::Boolean; using v8::Context; using v8::Float64Array; using v8::Function; using v8::Integer; +using v8::NewStringType; using v8::Number; using v8::ObjectTemplate; using v8::String; @@ -1411,11 +1413,11 @@ void Http2Session::HandleAltSvcFrame(const nghttp2_frame* frame) { Integer::New(isolate, id), String::NewFromOneByte(isolate, altsvc->origin, - v8::NewStringType::kNormal, + NewStringType::kNormal, altsvc->origin_len).ToLocalChecked(), String::NewFromOneByte(isolate, altsvc->field_value, - v8::NewStringType::kNormal, + NewStringType::kNormal, altsvc->field_value_len).ToLocalChecked(), }; @@ -1445,7 +1447,7 @@ void Http2Session::HandleOriginFrame(const nghttp2_frame* frame) { argv[j++] = String::NewFromOneByte(isolate, entry.origin, - v8::NewStringType::kNormal, + NewStringType::kNormal, entry.origin_len).ToLocalChecked(); } if (j > 0) @@ -2330,7 +2332,7 @@ void HttpErrorString(const FunctionCallbackInfo& args) { String::NewFromOneByte( env->isolate(), reinterpret_cast(nghttp2_strerror(val)), - v8::NewStringType::kInternalized).ToLocalChecked()); + NewStringType::kInternalized).ToLocalChecked()); } From 518bc9679d960b4f78f7af463eddce2156493219 Mon Sep 17 00:00:00 2001 From: Pushkal B Date: Sat, 17 Nov 2018 18:19:08 +0530 Subject: [PATCH 139/223] test: use arrow functions for callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24444 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-stream-pipe-flow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream-pipe-flow.js b/test/parallel/test-stream-pipe-flow.js index 1f8564182a3107..b696821c0d51fb 100644 --- a/test/parallel/test-stream-pipe-flow.js +++ b/test/parallel/test-stream-pipe-flow.js @@ -41,17 +41,17 @@ const { Readable, Writable, PassThrough } = require('stream'); .pipe(new PassThrough({ objectMode: true, highWaterMark: 2 })) .pipe(new PassThrough({ objectMode: true, highWaterMark: 2 })); - pt.on('end', function() { + pt.on('end', () => { wrapper.push(null); }); const wrapper = new Readable({ objectMode: true, read: () => { - process.nextTick(function() { + process.nextTick(() => { let data = pt.read(); if (data === null) { - pt.once('readable', function() { + pt.once('readable', () => { data = pt.read(); if (data !== null) wrapper.push(data); }); From cf7bf27325f5c67a53f1b86ce6b0ef4785cf0e5c Mon Sep 17 00:00:00 2001 From: potham Date: Sat, 17 Nov 2018 17:41:00 +0530 Subject: [PATCH 140/223] test: replace callback functions with arrow functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24432 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-http-client-timeout-option-with-agent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-client-timeout-option-with-agent.js b/test/parallel/test-http-client-timeout-option-with-agent.js index 26c93ec55bc903..7f20eb4e139e56 100644 --- a/test/parallel/test-http-client-timeout-option-with-agent.js +++ b/test/parallel/test-http-client-timeout-option-with-agent.js @@ -24,7 +24,7 @@ const server = http.createServer(() => { // Never respond. }); -server.listen(0, options.host, function() { +server.listen(0, options.host, () => { doRequest(); }); @@ -50,7 +50,7 @@ function doRequest() { })); req.end(); - setTimeout(function() { + setTimeout(() => { req.destroy(); assert.strictEqual(timeout_events, 1); // Ensure the `timeout` event fired only once. From f4c2d9efbc53dae38caba1985b1ee93cc8ae1596 Mon Sep 17 00:00:00 2001 From: Jayasankar Date: Sat, 17 Nov 2018 17:36:44 +0530 Subject: [PATCH 141/223] test:replace anonymous closure for test-http-expect-handling.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24423 Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-http-expect-handling.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-expect-handling.js b/test/parallel/test-http-expect-handling.js index 11d2b6ecf4e614..0a39d49d923474 100644 --- a/test/parallel/test-http-expect-handling.js +++ b/test/parallel/test-http-expect-handling.js @@ -9,7 +9,7 @@ const tests = [417, 417]; let testsComplete = 0; let testIdx = 0; -const s = http.createServer(function(req, res) { +const s = http.createServer((req, res) => { throw new Error('this should never be executed'); }); @@ -34,13 +34,13 @@ function nextTest() { })); } - http.get(options, function(response) { + http.get(options, (response) => { console.log(`client: expected status: ${test}`); console.log(`client: statusCode: ${response.statusCode}`); assert.strictEqual(response.statusCode, test); assert.strictEqual(response.statusMessage, 'Expectation Failed'); - response.on('end', function() { + response.on('end', () => { testsComplete++; testIdx++; nextTest(); @@ -50,6 +50,6 @@ function nextTest() { } -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(testsComplete, 2); }); From 39a561b3bc63c7639ae6b6c5514669339c63201a Mon Sep 17 00:00:00 2001 From: Lakshmi Shanmugam Date: Sat, 17 Nov 2018 17:32:09 +0530 Subject: [PATCH 142/223] test: change callback function to arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24421 Reviewed-By: Ouyang Yadong Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-stream-unshift-empty-chunk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream-unshift-empty-chunk.js b/test/parallel/test-stream-unshift-empty-chunk.js index 9c2c12a41a3958..0f0a13722cab14 100644 --- a/test/parallel/test-stream-unshift-empty-chunk.js +++ b/test/parallel/test-stream-unshift-empty-chunk.js @@ -32,14 +32,14 @@ let nChunks = 10; const chunk = Buffer.alloc(10, 'x'); r._read = function(n) { - setImmediate(function() { + setImmediate(() => { r.push(--nChunks === 0 ? null : chunk); }); }; let readAll = false; const seen = []; -r.on('readable', function() { +r.on('readable', () => { let chunk; while (chunk = r.read()) { seen.push(chunk.toString()); @@ -74,7 +74,7 @@ const expect = 'xxxxxxxxxx', 'yyyyy' ]; -r.on('end', function() { +r.on('end', () => { assert.deepStrictEqual(seen, expect); console.log('ok'); }); From be14283bcda84d8bd29a61e460a6970227554b78 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 22 Oct 2018 08:48:40 +0200 Subject: [PATCH 143/223] src: use smart pointers in cares_wrap.cc PR-URL: https://github.com/nodejs/node/pull/23813 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- src/cares_wrap.cc | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index ad5284c2ba4171..d227fb8cda1c13 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1796,14 +1796,16 @@ static void Query(const FunctionCallbackInfo& args) { Local req_wrap_obj = args[0].As(); Local string = args[1].As(); - Wrap* wrap = new Wrap(channel, req_wrap_obj); + auto wrap = std::make_unique(channel, req_wrap_obj); node::Utf8Value name(env->isolate(), string); channel->ModifyActivityQueryCount(1); int err = wrap->Send(*name); if (err) { channel->ModifyActivityQueryCount(-1); - delete wrap; + } else { + // Release ownership of the pointer allowing the ownership to be transferred + USE(wrap.release()); } args.GetReturnValue().Set(err); @@ -1811,7 +1813,8 @@ static void Query(const FunctionCallbackInfo& args) { void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { - GetAddrInfoReqWrap* req_wrap = static_cast(req->data); + std::unique_ptr req_wrap { + static_cast(req->data)}; Environment* env = req_wrap->env(); HandleScope handle_scope(env->isolate()); @@ -1868,13 +1871,11 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { uv_freeaddrinfo(res); TRACE_EVENT_NESTABLE_ASYNC_END2( - TRACING_CATEGORY_NODE2(dns, native), "lookup", req_wrap, + TRACING_CATEGORY_NODE2(dns, native), "lookup", req_wrap.get(), "count", n, "verbatim", verbatim); // Make the callback into JavaScript req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); - - delete req_wrap; } @@ -1882,7 +1883,8 @@ void AfterGetNameInfo(uv_getnameinfo_t* req, int status, const char* hostname, const char* service) { - GetNameInfoReqWrap* req_wrap = static_cast(req->data); + std::unique_ptr req_wrap { + static_cast(req->data)}; Environment* env = req_wrap->env(); HandleScope handle_scope(env->isolate()); @@ -1903,14 +1905,12 @@ void AfterGetNameInfo(uv_getnameinfo_t* req, } TRACE_EVENT_NESTABLE_ASYNC_END2( - TRACING_CATEGORY_NODE2(dns, native), "lookupService", req_wrap, + TRACING_CATEGORY_NODE2(dns, native), "lookupService", req_wrap.get(), "hostname", TRACE_STR_COPY(hostname), "service", TRACE_STR_COPY(service)); // Make the callback into JavaScript req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); - - delete req_wrap; } using ParseIPResult = decltype(static_cast(0)->addr); @@ -1970,7 +1970,9 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { CHECK(0 && "bad address family"); } - auto req_wrap = new GetAddrInfoReqWrap(env, req_wrap_obj, args[4]->IsTrue()); + auto req_wrap = std::make_unique(env, + req_wrap_obj, + args[4]->IsTrue()); struct addrinfo hints; memset(&hints, 0, sizeof(struct addrinfo)); @@ -1979,7 +1981,7 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { hints.ai_flags = flags; TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( - TRACING_CATEGORY_NODE2(dns, native), "lookup", req_wrap, + TRACING_CATEGORY_NODE2(dns, native), "lookup", req_wrap.get(), "hostname", TRACE_STR_COPY(*hostname), "family", family == AF_INET ? "ipv4" : family == AF_INET6 ? "ipv6" : "unspec"); @@ -1989,8 +1991,9 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { *hostname, nullptr, &hints); - if (err) - delete req_wrap; + if (err == 0) + // Release ownership of the pointer allowing the ownership to be transferred + USE(req_wrap.release()); args.GetReturnValue().Set(err); } @@ -2010,18 +2013,19 @@ void GetNameInfo(const FunctionCallbackInfo& args) { CHECK(uv_ip4_addr(*ip, port, reinterpret_cast(&addr)) == 0 || uv_ip6_addr(*ip, port, reinterpret_cast(&addr)) == 0); - GetNameInfoReqWrap* req_wrap = new GetNameInfoReqWrap(env, req_wrap_obj); + auto req_wrap = std::make_unique(env, req_wrap_obj); TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( - TRACING_CATEGORY_NODE2(dns, native), "lookupService", req_wrap, + TRACING_CATEGORY_NODE2(dns, native), "lookupService", req_wrap.get(), "ip", TRACE_STR_COPY(*ip), "port", port); int err = req_wrap->Dispatch(uv_getnameinfo, AfterGetNameInfo, reinterpret_cast(&addr), NI_NAMEREQD); - if (err) - delete req_wrap; + if (err == 0) + // Release ownership of the pointer allowing the ownership to be transferred + USE(req_wrap.release()); args.GetReturnValue().Set(err); } From d2d6287355aa028a2152c9fba63478c71c825a7a Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 15 Nov 2018 05:37:55 +0100 Subject: [PATCH 144/223] test: skip test that use --tls-v1.x flags Currently, configuring --without-ssl will cause the following test to fail: === release test-https-agent-additional-options === Path: parallel/test-https-agent-additional-options out/Release/node: bad option: --tls-v1.1 Command: out/Release/node --tls-v1.1 /node/test/parallel/test-https-agent-additional-options.js === release test-https-agent-session-eviction === Path: parallel/test-https-agent-session-eviction out/Release/node: bad option: --tls-v1.0 Command: out/Release/node --tls-v1.0 /node/test/parallel/test-https-agent-session-eviction.js This commit adds a check for the --tls-v.x flags and skips them if node was built without crypto support. PR-URL: https://github.com/nodejs/node/pull/24376 Reviewed-By: Refael Ackermann Reviewed-By: Ben Noordhuis Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Franziska Hinkelmann Reviewed-By: Rod Vagg --- test/testpy/__init__.py | 18 +++++++++++------- tools/test.py | 12 +++++++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index 27d7124bf2ed16..7ba9674d7d6e57 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -61,7 +61,7 @@ def GetCommand(self): source = open(self.file).read() flags_match = FLAGS_PATTERN.search(source) if flags_match: - flag = flags_match.group(1).strip().split() + flags = flags_match.group(1).strip().split() # The following block reads config.gypi to extract the v8_enable_inspector # value. This is done to check if the inspector is disabled in which case # the '--inspect' flag cannot be passed to the node process as it will @@ -71,13 +71,17 @@ def GetCommand(self): # inspector related tests). Also, if there is no ssl support the options # '--use-bundled-ca' and '--use-openssl-ca' will also cause a similar # failure so such tests are also skipped. - if ('--inspect' in flag[0] or \ - '--use-bundled-ca' in flag[0] or \ - '--use-openssl-ca' in flag[0]) and \ - self.context.v8_enable_inspector == 0: - print('Skipping as node was configured --without-ssl') + if (any(flag.startswith('--inspect') for flag in flags) and + not self.context.v8_enable_inspector): + print('Skipping as node was compiled without inspector support') + elif (('--use-bundled-ca' in flags or + '--use-openssl-ca' in flags or + '--tls-v1.0' in flags or + '--tls-v1.1' in flags) and + not self.context.node_has_crypto): + print('Skipping as node was compiled without crypto support') else: - result += flag + result += flags files_match = FILES_PATTERN.search(source); additional_files = [] if files_match: diff --git a/tools/test.py b/tools/test.py index 3a464be61da1b3..67b8cb917e0db6 100755 --- a/tools/test.py +++ b/tools/test.py @@ -907,6 +907,7 @@ def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail, self.repeat = repeat self.abort_on_timeout = abort_on_timeout self.v8_enable_inspector = True + self.node_has_crypto = True def GetVm(self, arch, mode): if arch == 'none': @@ -1632,9 +1633,14 @@ def Main(): # We want to skip the inspector tests if node was built without the inspector. has_inspector = Execute([vm, - "-p", "process.config.variables.v8_enable_inspector"], context) - if has_inspector.stdout.rstrip() == "0": - context.v8_enable_inspector = False + '-p', 'process.config.variables.v8_enable_inspector'], context) + if has_inspector.stdout.rstrip() == '0': + context.v8_enable_inspector = False + + has_crypto = Execute([vm, + '-p', 'process.versions.openssl'], context) + if has_crypto.stdout.rstrip() == 'undefined': + context.node_has_crypto = False if options.cat: visited = set() From bfde244576bd8ff5418716591d4523a940feb499 Mon Sep 17 00:00:00 2001 From: Shubham Urkade Date: Sat, 17 Nov 2018 17:49:53 +0530 Subject: [PATCH 145/223] src: elevate repeated use of v8 namespaced type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24427 Reviewed-By: Michaël Zasso Reviewed-By: Refael Ackermann Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- src/inspector_agent.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 48a3e2e2be6e51..dde6bda4b5f0e7 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -36,6 +36,7 @@ using v8::Function; using v8::HandleScope; using v8::Isolate; using v8::Local; +using v8::Message; using v8::Object; using v8::String; using v8::Value; @@ -361,7 +362,7 @@ class SameThreadInspectorSession : public InspectorSession { }; void NotifyClusterWorkersDebugEnabled(Environment* env) { - v8::Isolate* isolate = env->isolate(); + Isolate* isolate = env->isolate(); HandleScope handle_scope(isolate); auto context = env->context(); @@ -511,7 +512,7 @@ class NodeInspectorClient : public V8InspectorClient { } } - void FatalException(Local error, Local message) { + void FatalException(Local error, Local message) { Isolate* isolate = env_->isolate(); Local context = env_->context(); @@ -761,7 +762,7 @@ void Agent::WaitForDisconnect() { } } -void Agent::FatalException(Local error, Local message) { +void Agent::FatalException(Local error, Local message) { if (!IsListening()) return; client_->FatalException(error, message); @@ -773,8 +774,8 @@ void Agent::PauseOnNextJavascriptStatement(const std::string& reason) { } void Agent::RegisterAsyncHook(Isolate* isolate, - v8::Local enable_function, - v8::Local disable_function) { + Local enable_function, + Local disable_function) { enable_async_hook_function_.Reset(isolate, enable_function); disable_async_hook_function_.Reset(isolate, disable_function); if (pending_enable_async_hook_) { @@ -849,7 +850,7 @@ void Agent::RequestIoThreadStart() { // continuous JS code) and to wake up libuv thread (in case Node is waiting // for IO events) uv_async_send(&start_io_thread_async); - v8::Isolate* isolate = parent_env_->isolate(); + Isolate* isolate = parent_env_->isolate(); v8::Platform* platform = parent_env_->isolate_data()->platform(); platform->CallOnForegroundThread(isolate, new StartIoTask(this)); isolate->RequestInterrupt(StartIoInterrupt, this); From a7c1d0908a7deb308cfe3b1ad9a54f7bc630905b Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 17 Nov 2018 00:18:55 +0800 Subject: [PATCH 146/223] stream: do not use crypto.DEFAULT_ENCODING in lazy_transform.js The default encoding can be retrieved via `require('internal/crypto/util').getDefaultEncoding` instead of the deprecated crypto.DEFAULT_ENCODING which triggers a warning. Background: The require chain goes like this: ``` internal/streams/lazy_transform.js -> crypto.js -> internal/crypto/cipher.js (uses LazyTransform in the global scope) -> internal/streams/lazy_transform.js ``` So when `internal/streams/lazy_transform.js` is required before `lib/crypto.js`, we have a circular dependency and since `internal/crypto/cipher.js` uses destructuring to use LazyTransform we will get an error. And it can also trigger a warning if lazy_transform.js is the first file that touches crypto.DEFAULT_ENCODING. PR-URL: https://github.com/nodejs/node/pull/24396 Reviewed-By: Refael Ackermann Reviewed-By: Sam Roberts Reviewed-By: Anna Henningsen Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Colin Ihrig --- lib/internal/streams/lazy_transform.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/internal/streams/lazy_transform.js b/lib/internal/streams/lazy_transform.js index 80e0bacf29df7c..c4d8c64b3dd041 100644 --- a/lib/internal/streams/lazy_transform.js +++ b/lib/internal/streams/lazy_transform.js @@ -5,7 +5,10 @@ const stream = require('stream'); const util = require('util'); -const crypto = require('crypto'); + +const { + getDefaultEncoding +} = require('internal/crypto/util'); module.exports = LazyTransform; @@ -22,7 +25,7 @@ function makeGetter(name) { this._writableState.decodeStrings = false; if (!this._options || !this._options.defaultEncoding) { - this._writableState.defaultEncoding = crypto.DEFAULT_ENCODING; + this._writableState.defaultEncoding = getDefaultEncoding(); } return this[name]; From bf3bed56db856eaea0debb27050dbfa6aa47b8b5 Mon Sep 17 00:00:00 2001 From: Nikhil M Date: Sat, 17 Nov 2018 17:57:34 +0530 Subject: [PATCH 147/223] test: swap actual&optional params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24426 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Ujjwal Sharma --- test/pummel/test-stream-pipe-multi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pummel/test-stream-pipe-multi.js b/test/pummel/test-stream-pipe-multi.js index c89d9cc6353713..2767028c4b393b 100644 --- a/test/pummel/test-stream-pipe-multi.js +++ b/test/pummel/test-stream-pipe-multi.js @@ -66,8 +66,8 @@ FakeStream.prototype.close = function() { // expect all streams to close properly. process.on('exit', function() { - assert.strictEqual(cnt, wclosed); - assert.strictEqual(cnt, rclosed); + assert.strictEqual(wclosed, cnt); + assert.strictEqual(rclosed, cnt); }); for (let i = 0; i < chunkSize; i++) { From 62a5679ca36febd64a2edcf6fac610793b0ffe98 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 17 Nov 2018 01:44:34 +0800 Subject: [PATCH 148/223] lib: set stderr._destroy to dummyDestroy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This seems to be typo: we are setting stdout._destroy instead of stderr._destroy in the getter of stderr. PR-URL: https://github.com/nodejs/node/pull/24398 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso --- lib/internal/process/stdio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/process/stdio.js b/lib/internal/process/stdio.js index 826a2a9916e297..b769ea2bca04b9 100644 --- a/lib/internal/process/stdio.js +++ b/lib/internal/process/stdio.js @@ -32,7 +32,7 @@ function getMainThreadStdio() { stderr = createWritableStdioStream(2); stderr.destroySoon = stderr.destroy; // Override _destroy so that the fd is never actually closed. - stdout._destroy = dummyDestroy; + stderr._destroy = dummyDestroy; if (stderr.isTTY) { process.on('SIGWINCH', () => stderr._refreshSize()); } From c29c510b5a7c6274d10ce08ce4cb4bbfacb6b074 Mon Sep 17 00:00:00 2001 From: Selvaraj Date: Sat, 17 Nov 2018 17:07:09 +0530 Subject: [PATCH 149/223] test: fix actual parameter order for 'assert.strictEqual' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24428 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Ujjwal Sharma --- test/pummel/test-net-throttle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js index fb060c9d76d9d5..acd8e0cc003547 100644 --- a/test/pummel/test-net-throttle.js +++ b/test/pummel/test-net-throttle.js @@ -58,7 +58,7 @@ server.listen(common.PORT, function() { console.log('pause'); const x = chars_recved; setTimeout(function() { - assert.strictEqual(x, chars_recved); + assert.strictEqual(chars_recved, x); client.resume(); console.log('resume'); paused = false; From 7fd4ef7df1fb2b6f456b426d12c8430e2a7f7b78 Mon Sep 17 00:00:00 2001 From: Mayank Asthana Date: Mon, 5 Nov 2018 20:55:47 +0530 Subject: [PATCH 150/223] doc: update crypto examples to not use deprecated api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated Cipher and Decipher examples to not use deprecated `crypto.createCipher` and `crypto.createDecipher` in examples and instead use `createCipheriv` and `createDecipheriv`. Fixes: https://github.com/nodejs/node/issues/24046 PR-URL: https://github.com/nodejs/node/pull/24107 Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Ujjwal Sharma --- doc/api/crypto.md | 77 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 10 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 985c368f678e0e..a23b1fe5d4fa0a 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -185,7 +185,18 @@ Example: Using `Cipher` objects as streams: ```js const crypto = require('crypto'); -const cipher = crypto.createCipher('aes192', 'a password'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Key length is dependent on the algorithm. In this case for aes192, it is +// 24 bytes (192 bits). +// Use async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes()` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); let encrypted = ''; cipher.on('readable', () => { @@ -195,7 +206,7 @@ cipher.on('readable', () => { }); cipher.on('end', () => { console.log(encrypted); - // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 + // Prints: e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa }); cipher.write('some clear text data'); @@ -207,7 +218,16 @@ Example: Using `Cipher` and piped streams: ```js const crypto = require('crypto'); const fs = require('fs'); -const cipher = crypto.createCipher('aes192', 'a password'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes()` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); const input = fs.createReadStream('test.js'); const output = fs.createWriteStream('test.enc'); @@ -219,12 +239,21 @@ Example: Using the [`cipher.update()`][] and [`cipher.final()`][] methods: ```js const crypto = require('crypto'); -const cipher = crypto.createCipher('aes192', 'a password'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); encrypted += cipher.final('hex'); console.log(encrypted); -// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +// Prints: e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa ``` ### cipher.final([outputEncoding]) @@ -340,7 +369,17 @@ Example: Using `Decipher` objects as streams: ```js const crypto = require('crypto'); -const decipher = crypto.createDecipher('aes192', 'a password'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Key length is dependent on the algorithm. In this case for aes192, it is +// 24 bytes (192 bits). +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); let decrypted = ''; decipher.on('readable', () => { @@ -353,8 +392,9 @@ decipher.on('end', () => { // Prints: some clear text data }); +// Encrypted with same algorithm, key and iv. const encrypted = - 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; + 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; decipher.write(encrypted, 'hex'); decipher.end(); ``` @@ -364,7 +404,15 @@ Example: Using `Decipher` and piped streams: ```js const crypto = require('crypto'); const fs = require('fs'); -const decipher = crypto.createDecipher('aes192', 'a password'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); const input = fs.createReadStream('test.enc'); const output = fs.createWriteStream('test.js'); @@ -376,10 +424,19 @@ Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods: ```js const crypto = require('crypto'); -const decipher = crypto.createDecipher('aes192', 'a password'); +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); + +// Encrypted using same algorithm, key and iv. const encrypted = - 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; + 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; let decrypted = decipher.update(encrypted, 'hex', 'utf8'); decrypted += decipher.final('utf8'); console.log(decrypted); From 2d25cddbc1ae00fc5448a72558dfde47cdbbbce8 Mon Sep 17 00:00:00 2001 From: Simon Bruce Date: Sat, 17 Nov 2018 15:58:39 +1030 Subject: [PATCH 151/223] test: remove unused function arguments in async-hooks tests Remove unused function arguments in three async-hooks tests and improve test consistancy. PR-URL: https://github.com/nodejs/node/pull/24406 Reviewed-By: Weijia Wang Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- ...promise.chain-promise-before-init-hooks.js | 4 ++-- test/async-hooks/test-promise.js | 22 +++++++++---------- .../test-promise.promise-before-init-hooks.js | 4 ++-- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js index 9046bc3514abfc..341b7b4c5dfd89 100644 --- a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js +++ b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js @@ -8,11 +8,11 @@ const { checkInvocations } = require('./hook-checks'); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different async IDs'); -const p = new Promise(common.mustCall(function executor(resolve, reject) { +const p = new Promise(common.mustCall(function executor(resolve) { resolve(5); })); -p.then(function afterresolution(val) { +p.then(function afterResolution(val) { assert.strictEqual(val, 5); return val; }); diff --git a/test/async-hooks/test-promise.js b/test/async-hooks/test-promise.js index 729704b7928f7d..417cb3c80d6298 100644 --- a/test/async-hooks/test-promise.js +++ b/test/async-hooks/test-promise.js @@ -13,24 +13,22 @@ const hooks = initHooks(); hooks.enable(); -const p = (new Promise(common.mustCall(executor))); -p.then(afterresolution); - -function executor(resolve, reject) { - const as = hooks.activitiesOfTypes('PROMISE'); - assert.strictEqual(as.length, 1); - const a = as[0]; - checkInvocations(a, { init: 1 }, 'while in promise executor'); - resolve(5); -} - -function afterresolution(val) { +const p = new Promise(common.mustCall(executor)); +p.then(function afterResolution(val) { assert.strictEqual(val, 5); const as = hooks.activitiesOfTypes('PROMISE'); assert.strictEqual(as.length, 2); checkInvocations(as[0], { init: 1 }, 'after resolution parent promise'); checkInvocations(as[1], { init: 1, before: 1 }, 'after resolution child promise'); +}); + +function executor(resolve) { + const as = hooks.activitiesOfTypes('PROMISE'); + assert.strictEqual(as.length, 1); + const a = as[0]; + checkInvocations(a, { init: 1 }, 'while in promise executor'); + resolve(5); } process.on('exit', onexit); diff --git a/test/async-hooks/test-promise.promise-before-init-hooks.js b/test/async-hooks/test-promise.promise-before-init-hooks.js index 957d1a75e49f70..f9ba24c044298f 100644 --- a/test/async-hooks/test-promise.promise-before-init-hooks.js +++ b/test/async-hooks/test-promise.promise-before-init-hooks.js @@ -5,7 +5,7 @@ const assert = require('assert'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); -const p = new Promise(common.mustCall(function executor(resolve, reject) { +const p = new Promise(common.mustCall(function executor(resolve) { resolve(5); })); @@ -13,7 +13,7 @@ const p = new Promise(common.mustCall(function executor(resolve, reject) { const hooks = initHooks({ allowNoInit: true }); hooks.enable(); -p.then(function afterresolution(val) { +p.then(function afterResolution(val) { assert.strictEqual(val, 5); const as = hooks.activitiesOfTypes('PROMISE'); assert.strictEqual(as.length, 1); From 52259d71d60bc6120a4350a74f40587d5793a89a Mon Sep 17 00:00:00 2001 From: NoSkillGirl Date: Sat, 17 Nov 2018 17:23:28 +0530 Subject: [PATCH 152/223] test: assertion equality fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In test-net-write-callback.js, when process exits, we check callback count against the expected value. The assertion is written with the expected value first and actual value second, but that is the opposite of the documented argument order. Reverse them to be consistent with documentation. PR-URL: https://github.com/nodejs/node/pull/24422 Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Ouyang Yadong Reviewed-By: Colin Ihrig --- test/pummel/test-net-write-callbacks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pummel/test-net-write-callbacks.js b/test/pummel/test-net-write-callbacks.js index a4a6096d633165..0bcc9e2dec121a 100644 --- a/test/pummel/test-net-write-callbacks.js +++ b/test/pummel/test-net-write-callbacks.js @@ -67,5 +67,5 @@ server.listen(common.PORT, function() { }); process.on('exit', function() { - assert.strictEqual(N, cbcount); + assert.strictEqual(cbcount, N); }); From a620c25c76781586d70524768eedd30ba42a797b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 15 Nov 2018 20:18:36 -0800 Subject: [PATCH 153/223] doc: udpate list item spacing in changelogs Minor formatting adjustments to two changelog files in preparation for a markdown lint rule. PR-URL: https://github.com/nodejs/node/pull/24391 Reviewed-By: James M Snell Reviewed-By: Daijiro Wachi --- doc/changelogs/CHANGELOG_V5.md | 2 +- doc/changelogs/CHANGELOG_V6.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/changelogs/CHANGELOG_V5.md b/doc/changelogs/CHANGELOG_V5.md index 1e98cd39c3d572..09385c64a4952b 100644 --- a/doc/changelogs/CHANGELOG_V5.md +++ b/doc/changelogs/CHANGELOG_V5.md @@ -418,7 +418,7 @@ https://github.com/nodejs/node/pull/5655 * **timers**: Internal Node.js timeouts now use the same logic path as those created with `setTimeout()` (Jeremiah Senkpiel) [#4007](https://github.com/nodejs/node/pull/4007) * This may cause a slightly different performance profile in some situations. So far, it has shown to be positive in most cases. * **v8**: backport fb4ccae from v8 upstream (Vladimir Krivosheev) #4231 - - breakout events from v8 to offer better support for external debuggers + - breakout events from v8 to offer better support for external debuggers * **zlib**: add support for concatenated members (Kári Tristan Helgason) https://github.com/nodejs/node/pull/5120 * Previously, if multiple members were in the same archive, only the first would be read. The others are no longer thrown away. diff --git a/doc/changelogs/CHANGELOG_V6.md b/doc/changelogs/CHANGELOG_V6.md index a4083920eb10f9..eb0b081071fd5d 100644 --- a/doc/changelogs/CHANGELOG_V6.md +++ b/doc/changelogs/CHANGELOG_V6.md @@ -2167,16 +2167,16 @@ This LTS release comes with 168 commits. This includes 85 which are test related The SEMVER-MINOR changes include: -* **crypto**: allow adding extra certs to well-known CAs (Sam Roberts) [#9139](https://github.com/nodejs/node/pull/9139) -* **deps**: Upgrade INTL ICU to version 58 (Steven R. Loomis) [#9234](https://github.com/nodejs/node/pull/9234) -* **process**: add `process.memoryUsage.external` (Fedor Indutny) [#9587](https://github.com/nodejs/node/pull/9587) -* **src**: add wrapper for process.emitWarning() (Sam Roberts) [#9139](https://github.com/nodejs/node/pull/9139) +* **crypto**: allow adding extra certs to well-known CAs (Sam Roberts) [#9139](https://github.com/nodejs/node/pull/9139) +* **deps**: Upgrade INTL ICU to version 58 (Steven R. Loomis) [#9234](https://github.com/nodejs/node/pull/9234) +* **process**: add `process.memoryUsage.external` (Fedor Indutny) [#9587](https://github.com/nodejs/node/pull/9587) +* **src**: add wrapper for process.emitWarning() (Sam Roberts) [#9139](https://github.com/nodejs/node/pull/9139) Notable SEMVER-PATCH changes include: -* **fs**: cache non-symlinks in realpathSync. (Jeremy Yallop) [#10253](https://github.com/nodejs/node/pull/10253) -* **repl**: allow autocompletion for scoped packages (Evan Lucas) [#10296](https://github.com/nodejs/node/pull/10296) +* **fs**: cache non-symlinks in realpathSync. (Jeremy Yallop) [#10253](https://github.com/nodejs/node/pull/10253) +* **repl**: allow autocompletion for scoped packages (Evan Lucas) [#10296](https://github.com/nodejs/node/pull/10296) ### Commits From cc4d8666971648d452c0762ae6064a7b6aee46b7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 15 Nov 2018 23:30:19 -0800 Subject: [PATCH 154/223] tools: update to remark-lint-preset-node@1.2.0 Adds linting for number of spaces after a list indicator. (Expects exactly 1 space.) PR-URL: https://github.com/nodejs/node/pull/24391 Reviewed-By: James M Snell Reviewed-By: Daijiro Wachi --- tools/lint-md.js | 829 +++++++++--------- .../node-lint-md-cli-rollup/package-lock.json | 19 +- tools/node-lint-md-cli-rollup/package.json | 2 +- 3 files changed, 450 insertions(+), 400 deletions(-) diff --git a/tools/lint-md.js b/tools/lint-md.js index f13c25fca78913..79391bed3cc41f 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -30708,97 +30708,64 @@ var remark = unified_1() .use(remarkStringify) .freeze(); -const _from = "remark@^10.0.0"; -const _id = "remark@10.0.0"; -const _inBundle = false; -const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ=="; -const _location = "/remark"; -const _phantomChildren = {}; -const _requested = {"type":"range","registry":true,"raw":"remark@^10.0.0","name":"remark","escapedName":"remark","rawSpec":"^10.0.0","saveSpec":null,"fetchSpec":"^10.0.0"}; -const _requiredBy = ["/"]; -const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz"; -const _shasum = "4d94ae09d0e81e52fe40a31e89a0103c553f509e"; -const _spec = "remark@^10.0.0"; -const _where = "/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"; -const author = {"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}; -const bugs = {"url":"https://github.com/remarkjs/remark/issues"}; -const bundleDependencies = false; -const contributors = [{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}]; -const dependencies = {"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"}; -const deprecated$1 = false; +const name = "remark"; +const version$1 = "10.0.0"; const description = "Markdown processor powered by plugins"; -const devDependencies = {"tape":"^4.9.1"}; -const files = ["index.js"]; -const homepage = "http://remark.js.org"; -const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; const license = "MIT"; -const name = "remark"; -const repository = {"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"}; +const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"]; +const homepage = "http://remark.js.org"; +const repository = "https://github.com/remarkjs/remark/tree/master/packages/remark"; +const bugs = "https://github.com/remarkjs/remark/issues"; +const author = "Titus Wormer (http://wooorm.com)"; +const contributors = ["Titus Wormer (http://wooorm.com)"]; +const files = ["index.js"]; +const dependencies = {"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"}; +const devDependencies = {"tape":"^4.9.1"}; const scripts = {"test":"tape test.js"}; -const version$1 = "10.0.0"; const xo = false; +const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz"; +const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ=="; +const _from = "remark@10.0.0"; var _package = { - _from: _from, - _id: _id, - _inBundle: _inBundle, - _integrity: _integrity, - _location: _location, - _phantomChildren: _phantomChildren, - _requested: _requested, - _requiredBy: _requiredBy, - _resolved: _resolved, - _shasum: _shasum, - _spec: _spec, - _where: _where, - author: author, + name: name, + version: version$1, + description: description, + license: license, + keywords: keywords, + homepage: homepage, + repository: repository, bugs: bugs, - bundleDependencies: bundleDependencies, + author: author, contributors: contributors, + files: files, dependencies: dependencies, - deprecated: deprecated$1, - description: description, devDependencies: devDependencies, - files: files, - homepage: homepage, - keywords: keywords, - license: license, - name: name, - repository: repository, scripts: scripts, - version: version$1, - xo: xo + xo: xo, + _resolved: _resolved, + _integrity: _integrity, + _from: _from }; var _package$1 = Object.freeze({ - _from: _from, - _id: _id, - _inBundle: _inBundle, - _integrity: _integrity, - _location: _location, - _phantomChildren: _phantomChildren, - _requested: _requested, - _requiredBy: _requiredBy, - _resolved: _resolved, - _shasum: _shasum, - _spec: _spec, - _where: _where, - author: author, + name: name, + version: version$1, + description: description, + license: license, + keywords: keywords, + homepage: homepage, + repository: repository, bugs: bugs, - bundleDependencies: bundleDependencies, + author: author, contributors: contributors, + files: files, dependencies: dependencies, - deprecated: deprecated$1, - description: description, devDependencies: devDependencies, - files: files, - homepage: homepage, - keywords: keywords, - license: license, - name: name, - repository: repository, scripts: scripts, - version: version$1, xo: xo, + _resolved: _resolved, + _integrity: _integrity, + _from: _from, default: _package }); @@ -30806,7 +30773,7 @@ const name$1 = "node-lint-md-cli-rollup"; const description$1 = "remark packaged for node markdown linting"; const version$2 = "1.0.0"; const devDependencies$1 = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"}; -const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.1.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; +const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.2.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"}; const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."}; var _package$2 = { name: name$1, @@ -32047,222 +32014,6 @@ function hardBreakSpaces(tree, file) { } } -var mdastUtilToString = toString$6; - -/* Get the text content of a node. If the node itself - * does not expose plain-text fields, `toString` will - * recursivly try its children. */ -function toString$6(node) { - return ( - valueOf$1(node) || - (node.children && node.children.map(toString$6).join('')) || - '' - ) -} - -/* Get the value of `node`. Checks, `value`, - * `alt`, and `title`, in that order. */ -function valueOf$1(node) { - return ( - (node && node.value ? node.value : node.alt ? node.alt : node.title) || '' - ) -} - -var remarkLintNoAutoLinkWithoutProtocol = unifiedLintRule( - 'remark-lint:no-auto-link-without-protocol', - noAutoLinkWithoutProtocol -); - -var start$3 = unistUtilPosition.start; -var end$2 = unistUtilPosition.end; - -/* Protocol expression. See: - * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ -var protocol$2 = /^[a-z][a-z+.-]+:\/?/i; - -var reason$3 = 'All automatic links must start with a protocol'; - -function noAutoLinkWithoutProtocol(tree, file) { - unistUtilVisit(tree, 'link', visitor); - - function visitor(node) { - var children; - - if (!unistUtilGenerated(node)) { - children = node.children; - - if ( - start$3(node).column === start$3(children[0]).column - 1 && - end$2(node).column === end$2(children[children.length - 1]).column + 1 && - !protocol$2.test(mdastUtilToString(node)) - ) { - file.message(reason$3, node); - } - } - } -} - -var remarkLintNoBlockquoteWithoutCaret = unifiedLintRule('remark-lint:no-blockquote-without-caret', noBlockquoteWithoutCaret); - -function noBlockquoteWithoutCaret(ast, file) { - var contents = file.toString(); - var location = vfileLocation(file); - var last = contents.length; - - unistUtilVisit(ast, 'blockquote', visitor); - - function visitor(node) { - var start = unistUtilPosition.start(node).line; - var indent = node.position && node.position.indent; - - if (unistUtilGenerated(node) || !indent || indent.length === 0) { - return; - } - - indent.forEach(eachLine); - - function eachLine(column, n) { - var character; - var line = start + n + 1; - var offset = location.toOffset({ - line: line, - column: column - }) - 1; - - while (++offset < last) { - character = contents.charAt(offset); - - if (character === '>') { - return; - } - - /* istanbul ignore else - just for safety */ - if (character !== ' ' && character !== '\t') { - break; - } - } - - file.message('Missing caret in blockquote', { - line: line, - column: column - }); - } - } -} - -var remarkLintNoDuplicateDefinitions = unifiedLintRule( - 'remark-lint:no-duplicate-definitions', - noDuplicateDefinitions -); - -var reason$4 = 'Do not use definitions with the same identifier'; - -function noDuplicateDefinitions(tree, file) { - var map = {}; - - unistUtilVisit(tree, ['definition', 'footnoteDefinition'], validate); - - function validate(node) { - var identifier; - var duplicate; - - if (!unistUtilGenerated(node)) { - identifier = node.identifier; - duplicate = map[identifier]; - - if (duplicate && duplicate.type) { - file.message( - reason$4 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')', - node - ); - } - - map[identifier] = node; - } - } -} - -var remarkLintNoFileNameArticles = unifiedLintRule('remark-lint:no-file-name-articles', noFileNameArticles); - -function noFileNameArticles(tree, file) { - var match = file.stem && file.stem.match(/^(the|teh|an?)\b/i); - - if (match) { - file.message('Do not start file names with `' + match[0] + '`'); - } -} - -var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule( - 'remark-lint:no-file-name-consecutive-dashes', - noFileNameConsecutiveDashes -); - -var reason$5 = 'Do not use consecutive dashes in a file name'; - -function noFileNameConsecutiveDashes(tree, file) { - if (file.stem && /-{2,}/.test(file.stem)) { - file.message(reason$5); - } -} - -var remarkLintNoFileNameOuterDashes = unifiedLintRule( - 'remark-lint:no-file-name-outer-dashes', - noFileNameOuterDashes -); - -var reason$6 = 'Do not use initial or final dashes in a file name'; - -function noFileNameOuterDashes(tree, file) { - if (file.stem && /^-|-$/.test(file.stem)) { - file.message(reason$6); - } -} - -var mdastUtilHeadingStyle = style; - -function style(node, relative) { - var last = node.children[node.children.length - 1]; - var depth = node.depth; - var pos = node && node.position && node.position.end; - var final = last && last.position && last.position.end; - - if (!pos) { - return null - } - - /* This can only occur for `'atx'` and `'atx-closed'` - * headings. This might incorrectly match `'atx'` - * headings with lots of trailing white space as an - * `'atx-closed'` heading. */ - if (!last) { - if (pos.column - 1 <= depth * 2) { - return consolidate(depth, relative) - } - - return 'atx-closed' - } - - if (final.line + 1 === pos.line) { - return 'setext' - } - - if (final.column + depth < pos.column) { - return 'atx-closed' - } - - return consolidate(depth, relative) -} - -/* Get the probable style of an atx-heading, depending on - * preferred style. */ -function consolidate(depth, relative) { - return depth < 3 - ? 'atx' - : relative === 'atx' || relative === 'setext' - ? relative - : null -} - const addendum = "addenda"; const aircraft = "aircraft"; const alga = "algae"; @@ -32744,13 +32495,371 @@ module.exports = (word, plural, count) => { }; }); +var remarkLintListItemIndent = unifiedLintRule('remark-lint:list-item-indent', listItemIndent); + +var start$3 = unistUtilPosition.start; + +var styles = {'tab-size': true, mixed: true, space: true}; + +function listItemIndent(tree, file, pref) { + var contents = String(file); + + pref = typeof pref === 'string' ? pref : 'tab-size'; + + if (styles[pref] !== true) { + file.fail( + 'Invalid list-item indent style `' + + pref + + "`: use either `'tab-size'`, `'space'`, or `'mixed'`" + ); + } + + unistUtilVisit(tree, 'list', visitor); + + function visitor(node) { + var spread = node.spread || node.loose; + + if (!unistUtilGenerated(node)) { + node.children.forEach(visitItem); + } + + function visitItem(item) { + var head = item.children[0]; + var final = start$3(head); + var marker; + var bulletSize; + var style; + var diff; + var reason; + + marker = contents + .slice(start$3(item).offset, final.offset) + .replace(/\[[x ]?]\s*$/i, ''); + + bulletSize = marker.trimRight().length; + + style = + pref === 'tab-size' || (pref === 'mixed' && spread) + ? Math.ceil(bulletSize / 4) * 4 + : bulletSize + 1; + + if (marker.length !== style) { + diff = style - marker.length; + + reason = + 'Incorrect list-item indent: ' + + (diff > 0 ? 'add' : 'remove') + + ' ' + + Math.abs(diff) + + ' ' + + plur('space', diff); + + file.message(reason, final); + } + } + } +} + +var remarkLintMaximumLineLength = unifiedLintRule('remark-lint:maximum-line-length', maximumLineLength); + +var start$4 = unistUtilPosition.start; +var end$2 = unistUtilPosition.end; + +function maximumLineLength(tree, file, pref) { + var style = typeof pref === 'number' && !isNaN(pref) ? pref : 80; + var content = String(file); + var lines = content.split(/\r?\n/); + var length = lines.length; + var index = -1; + var lineLength; + + unistUtilVisit(tree, ['heading', 'table', 'code', 'definition'], ignore); + unistUtilVisit(tree, ['link', 'image', 'inlineCode'], inline); + + /* Iterate over every line, and warn for violating lines. */ + while (++index < length) { + lineLength = lines[index].length; + + if (lineLength > style) { + file.message('Line must be at most ' + style + ' characters', { + line: index + 1, + column: lineLength + 1 + }); + } + } + + /* Finally, whitelist some inline spans, but only if they occur at or after + * the wrap. However, when they do, and there’s white-space after it, they + * are not whitelisted. */ + function inline(node, pos, parent) { + var next = parent.children[pos + 1]; + var initial; + var final; + + /* istanbul ignore if - Nothing to whitelist when generated. */ + if (unistUtilGenerated(node)) { + return + } + + initial = start$4(node); + final = end$2(node); + + /* No whitelisting when starting after the border, or ending before it. */ + if (initial.column > style || final.column < style) { + return + } + + /* No whitelisting when there’s white-space after + * the link. */ + if ( + next && + start$4(next).line === initial.line && + (!next.value || /^(.+?[ \t].+?)/.test(next.value)) + ) { + return + } + + whitelist(initial.line - 1, final.line); + } + + function ignore(node) { + /* istanbul ignore else - Hard to test, as we only run this case on `position: true` */ + if (!unistUtilGenerated(node)) { + whitelist(start$4(node).line - 1, end$2(node).line); + } + } + + /* Whitelist from `initial` to `final`, zero-based. */ + function whitelist(initial, final) { + while (initial < final) { + lines[initial++] = ''; + } + } +} + +var mdastUtilToString = toString$6; + +/* Get the text content of a node. If the node itself + * does not expose plain-text fields, `toString` will + * recursivly try its children. */ +function toString$6(node) { + return ( + valueOf$1(node) || + (node.children && node.children.map(toString$6).join('')) || + '' + ) +} + +/* Get the value of `node`. Checks, `value`, + * `alt`, and `title`, in that order. */ +function valueOf$1(node) { + return ( + (node && node.value ? node.value : node.alt ? node.alt : node.title) || '' + ) +} + +var remarkLintNoAutoLinkWithoutProtocol = unifiedLintRule( + 'remark-lint:no-auto-link-without-protocol', + noAutoLinkWithoutProtocol +); + +var start$5 = unistUtilPosition.start; +var end$3 = unistUtilPosition.end; + +/* Protocol expression. See: + * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ +var protocol$2 = /^[a-z][a-z+.-]+:\/?/i; + +var reason$3 = 'All automatic links must start with a protocol'; + +function noAutoLinkWithoutProtocol(tree, file) { + unistUtilVisit(tree, 'link', visitor); + + function visitor(node) { + var children; + + if (!unistUtilGenerated(node)) { + children = node.children; + + if ( + start$5(node).column === start$5(children[0]).column - 1 && + end$3(node).column === end$3(children[children.length - 1]).column + 1 && + !protocol$2.test(mdastUtilToString(node)) + ) { + file.message(reason$3, node); + } + } + } +} + +var remarkLintNoBlockquoteWithoutCaret = unifiedLintRule('remark-lint:no-blockquote-without-caret', noBlockquoteWithoutCaret); + +function noBlockquoteWithoutCaret(ast, file) { + var contents = file.toString(); + var location = vfileLocation(file); + var last = contents.length; + + unistUtilVisit(ast, 'blockquote', visitor); + + function visitor(node) { + var start = unistUtilPosition.start(node).line; + var indent = node.position && node.position.indent; + + if (unistUtilGenerated(node) || !indent || indent.length === 0) { + return; + } + + indent.forEach(eachLine); + + function eachLine(column, n) { + var character; + var line = start + n + 1; + var offset = location.toOffset({ + line: line, + column: column + }) - 1; + + while (++offset < last) { + character = contents.charAt(offset); + + if (character === '>') { + return; + } + + /* istanbul ignore else - just for safety */ + if (character !== ' ' && character !== '\t') { + break; + } + } + + file.message('Missing caret in blockquote', { + line: line, + column: column + }); + } + } +} + +var remarkLintNoDuplicateDefinitions = unifiedLintRule( + 'remark-lint:no-duplicate-definitions', + noDuplicateDefinitions +); + +var reason$4 = 'Do not use definitions with the same identifier'; + +function noDuplicateDefinitions(tree, file) { + var map = {}; + + unistUtilVisit(tree, ['definition', 'footnoteDefinition'], validate); + + function validate(node) { + var identifier; + var duplicate; + + if (!unistUtilGenerated(node)) { + identifier = node.identifier; + duplicate = map[identifier]; + + if (duplicate && duplicate.type) { + file.message( + reason$4 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')', + node + ); + } + + map[identifier] = node; + } + } +} + +var remarkLintNoFileNameArticles = unifiedLintRule('remark-lint:no-file-name-articles', noFileNameArticles); + +function noFileNameArticles(tree, file) { + var match = file.stem && file.stem.match(/^(the|teh|an?)\b/i); + + if (match) { + file.message('Do not start file names with `' + match[0] + '`'); + } +} + +var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule( + 'remark-lint:no-file-name-consecutive-dashes', + noFileNameConsecutiveDashes +); + +var reason$5 = 'Do not use consecutive dashes in a file name'; + +function noFileNameConsecutiveDashes(tree, file) { + if (file.stem && /-{2,}/.test(file.stem)) { + file.message(reason$5); + } +} + +var remarkLintNoFileNameOuterDashes = unifiedLintRule( + 'remark-lint:no-file-name-outer-dashes', + noFileNameOuterDashes +); + +var reason$6 = 'Do not use initial or final dashes in a file name'; + +function noFileNameOuterDashes(tree, file) { + if (file.stem && /^-|-$/.test(file.stem)) { + file.message(reason$6); + } +} + +var mdastUtilHeadingStyle = style; + +function style(node, relative) { + var last = node.children[node.children.length - 1]; + var depth = node.depth; + var pos = node && node.position && node.position.end; + var final = last && last.position && last.position.end; + + if (!pos) { + return null + } + + /* This can only occur for `'atx'` and `'atx-closed'` + * headings. This might incorrectly match `'atx'` + * headings with lots of trailing white space as an + * `'atx-closed'` heading. */ + if (!last) { + if (pos.column - 1 <= depth * 2) { + return consolidate(depth, relative) + } + + return 'atx-closed' + } + + if (final.line + 1 === pos.line) { + return 'setext' + } + + if (final.column + depth < pos.column) { + return 'atx-closed' + } + + return consolidate(depth, relative) +} + +/* Get the probable style of an atx-heading, depending on + * preferred style. */ +function consolidate(depth, relative) { + return depth < 3 + ? 'atx' + : relative === 'atx' || relative === 'setext' + ? relative + : null +} + var remarkLintNoHeadingContentIndent = unifiedLintRule( 'remark-lint:no-heading-content-indent', noHeadingContentIndent ); -var start$4 = unistUtilPosition.start; -var end$3 = unistUtilPosition.end; +var start$6 = unistUtilPosition.start; +var end$4 = unistUtilPosition.end; function noHeadingContentIndent(tree, file) { var contents = String(file); @@ -32778,7 +32887,7 @@ function noHeadingContentIndent(tree, file) { type = mdastUtilHeadingStyle(node, 'atx'); if (type === 'atx' || type === 'atx-closed') { - initial = start$4(node); + initial = start$6(node); index = initial.offset; char = contents.charAt(index); @@ -32792,7 +32901,7 @@ function noHeadingContentIndent(tree, file) { } index = depth + (index - initial.offset); - head = start$4(children[0]).column; + head = start$6(children[0]).column; /* Ignore empty headings. */ if (!head) { @@ -32810,7 +32919,7 @@ function noHeadingContentIndent(tree, file) { plur('space', diff) + ' before this heading’s content'; - file.message(reason, start$4(children[0])); + file.message(reason, start$6(children[0])); } } @@ -32818,8 +32927,8 @@ function noHeadingContentIndent(tree, file) { * between their content and the final hashes, * thus, there is no `add x spaces`. */ if (type === 'atx-closed') { - final = end$3(children[children.length - 1]); - diff = end$3(node).column - final.column - 1 - depth; + final = end$4(children[children.length - 1]); + diff = end$4(node).column - final.column - 1 - depth; if (diff) { reason = @@ -32837,7 +32946,7 @@ function noHeadingContentIndent(tree, file) { var remarkLintNoHeadingIndent = unifiedLintRule('remark-lint:no-heading-indent', noHeadingIndent); -var start$5 = unistUtilPosition.start; +var start$7 = unistUtilPosition.start; function noHeadingIndent(tree, file) { var contents = String(file); @@ -32856,7 +32965,7 @@ function noHeadingIndent(tree, file) { return } - initial = start$5(node); + initial = start$7(node); begin = initial.offset; index = begin - 1; @@ -32903,84 +33012,7 @@ function noInlinePadding(tree, file) { } } -var remarkLintMaximumLineLength = unifiedLintRule('remark-lint:maximum-line-length', maximumLineLength); - -var start$6 = unistUtilPosition.start; -var end$4 = unistUtilPosition.end; - -function maximumLineLength(tree, file, pref) { - var style = typeof pref === 'number' && !isNaN(pref) ? pref : 80; - var content = String(file); - var lines = content.split(/\r?\n/); - var length = lines.length; - var index = -1; - var lineLength; - - unistUtilVisit(tree, ['heading', 'table', 'code', 'definition'], ignore); - unistUtilVisit(tree, ['link', 'image', 'inlineCode'], inline); - - /* Iterate over every line, and warn for violating lines. */ - while (++index < length) { - lineLength = lines[index].length; - - if (lineLength > style) { - file.message('Line must be at most ' + style + ' characters', { - line: index + 1, - column: lineLength + 1 - }); - } - } - - /* Finally, whitelist some inline spans, but only if they occur at or after - * the wrap. However, when they do, and there’s white-space after it, they - * are not whitelisted. */ - function inline(node, pos, parent) { - var next = parent.children[pos + 1]; - var initial; - var final; - - /* istanbul ignore if - Nothing to whitelist when generated. */ - if (unistUtilGenerated(node)) { - return - } - - initial = start$6(node); - final = end$4(node); - - /* No whitelisting when starting after the border, or ending before it. */ - if (initial.column > style || final.column < style) { - return - } - - /* No whitelisting when there’s white-space after - * the link. */ - if ( - next && - start$6(next).line === initial.line && - (!next.value || /^(.+?[ \t].+?)/.test(next.value)) - ) { - return - } - - whitelist(initial.line - 1, final.line); - } - - function ignore(node) { - /* istanbul ignore else - Hard to test, as we only run this case on `position: true` */ - if (!unistUtilGenerated(node)) { - whitelist(start$6(node).line - 1, end$4(node).line); - } - } - - /* Whitelist from `initial` to `final`, zero-based. */ - function whitelist(initial, final) { - while (initial < final) { - lines[initial++] = ''; - } - } -} - -var start$7 = unistUtilPosition.start; +var start$8 = unistUtilPosition.start; @@ -33003,7 +33035,7 @@ function noMultipleToplevelHeadings(tree, file, pref) { node ); } else { - duplicate = unistUtilStringifyPosition(start$7(node)); + duplicate = unistUtilStringifyPosition(start$8(node)); } } } @@ -33165,7 +33197,7 @@ var rule$1 = unifiedLintRule; var remarkLintRuleStyle = rule$1('remark-lint:rule-style', ruleStyle); -var start$8 = unistUtilPosition.start; +var start$9 = unistUtilPosition.start; var end$5 = unistUtilPosition.end; function ruleStyle(tree, file, pref) { @@ -33182,7 +33214,7 @@ function ruleStyle(tree, file, pref) { unistUtilVisit(tree, 'thematicBreak', visitor); function visitor(node) { - var initial = start$8(node).offset; + var initial = start$9(node).offset; var final = end$5(node).offset; var rule; @@ -33202,7 +33234,7 @@ function ruleStyle(tree, file, pref) { var remarkLintTablePipes = unifiedLintRule('remark-lint:table-pipes', tablePipes); -var start$9 = unistUtilPosition.start; +var start$10 = unistUtilPosition.start; var end$6 = unistUtilPosition.end; var reasonStart = 'Missing initial pipe in table fence'; @@ -33231,11 +33263,11 @@ function tablePipes(tree, file) { cells = row.children; head = cells[0]; tail = cells[cells.length - 1]; - initial = contents.slice(start$9(row).offset, start$9(head).offset); + initial = contents.slice(start$10(row).offset, start$10(head).offset); final = contents.slice(end$6(tail).offset, end$6(row).offset); if (initial.indexOf('|') === -1) { - file.message(reasonStart, start$9(row)); + file.message(reasonStart, start$10(row)); } if (final.indexOf('|') === -1) { @@ -33301,7 +33333,7 @@ var remarkLintCheckboxCharacterStyle = unifiedLintRule( checkboxCharacterStyle ); -var start$10 = unistUtilPosition.start; +var start$11 = unistUtilPosition.start; var end$7 = unistUtilPosition.end; var checked = {x: true, X: true}; @@ -33347,8 +33379,8 @@ function checkboxCharacterStyle(tree, file, pref) { } type = types[node.checked]; - initial = start$10(node).offset; - final = (node.children.length ? start$10(node.children[0]) : end$7(node)).offset; + initial = start$11(node).offset; + final = (node.children.length ? start$11(node.children[0]) : end$7(node)).offset; /* For a checkbox to be parsed, it must be followed by a white space. */ value = contents @@ -33382,17 +33414,17 @@ function checkboxCharacterStyle(tree, file, pref) { var remarkLintCodeBlockStyle = unifiedLintRule('remark-lint:code-block-style', codeBlockStyle); -var start$11 = unistUtilPosition.start; +var start$12 = unistUtilPosition.start; var end$8 = unistUtilPosition.end; -var styles = {null: true, fenced: true, indented: true}; +var styles$1 = {null: true, fenced: true, indented: true}; function codeBlockStyle(tree, file, pref) { var contents = String(file); pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; - if (styles[pref] !== true) { + if (styles$1[pref] !== true) { file.fail( 'Invalid code block style `' + pref + @@ -33416,7 +33448,7 @@ function codeBlockStyle(tree, file, pref) { /* Get the style of `node`. */ function check(node) { - var initial = start$11(node).offset; + var initial = start$12(node).offset; var final = end$8(node).offset; if (unistUtilGenerated(node)) { @@ -33612,17 +33644,17 @@ function strongMarker(tree, file, pref) { var remarkLintTableCellPadding = unifiedLintRule('remark-lint:table-cell-padding', tableCellPadding); -var start$12 = unistUtilPosition.start; +var start$13 = unistUtilPosition.start; var end$9 = unistUtilPosition.end; -var styles$1 = {null: true, padded: true, compact: true}; +var styles$2 = {null: true, padded: true, compact: true}; function tableCellPadding(tree, file, pref) { var contents = String(file); pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null; - if (styles$1[pref] !== true) { + if (styles$2[pref] !== true) { file.fail('Invalid table-cell-padding style `' + pref + '`'); } @@ -33661,8 +33693,8 @@ function tableCellPadding(tree, file, pref) { next = cells[column + 1]; fence = contents.slice( - cell ? end$9(cell).offset : start$12(row).offset, - next ? start$12(next).offset : end$9(row).offset + cell ? end$9(cell).offset : start$13(row).offset, + next ? start$13(next).offset : end$9(row).offset ); pos = fence.indexOf('|'); @@ -33739,7 +33771,7 @@ function tableCellPadding(tree, file, pref) { } function size(node) { - return end$9(node).offset - start$12(node).offset + return end$9(node).offset - start$13(node).offset } var plugins$1 = [ @@ -33750,6 +33782,12 @@ var plugins$1 = [ remarkLintFinalDefinition, remarkLintFinalNewline, remarkLintHardBreakSpaces, + remarkLintHardBreakSpaces, + [ + remarkLintListItemIndent, + 'space' + ], + remarkLintMaximumLineLength, remarkLintNoAutoLinkWithoutProtocol, remarkLintNoBlockquoteWithoutCaret, remarkLintNoDuplicateDefinitions, @@ -33759,7 +33797,6 @@ var plugins$1 = [ remarkLintNoHeadingContentIndent, remarkLintNoHeadingIndent, remarkLintNoInlinePadding, - remarkLintMaximumLineLength, remarkLintNoMultipleToplevelHeadings, remarkLintNoShellDollars, remarkLintNoShortcutReferenceImage, diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index f49f22797d2b8c..e0010d99ef293d 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -2108,6 +2108,18 @@ "unist-util-visit": "^1.1.1" } }, + "remark-lint-list-item-indent": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-1.0.3.tgz", + "integrity": "sha512-/IcVUPIxQ2X/oCKzqiAtH85CS8An3xQbcMD0DRBHZjBrIUO0Ot7lBiQedSHwCg9lnh7pDOTvHrmNS3FaWjVQqw==", + "requires": { + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + } + }, "remark-lint-maximum-line-length": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remark-lint-maximum-line-length/-/remark-lint-maximum-line-length-1.1.0.tgz", @@ -2363,9 +2375,9 @@ } }, "remark-preset-lint-node": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-1.1.0.tgz", - "integrity": "sha512-wT37p0rYGgSy92XNjd7S5WZmtzRLq5iYT9mhVo/p3dVG9oF5NjOjFNUFu/6JBYgGBmZllftWvhrUpKNg+QXqug==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-1.2.0.tgz", + "integrity": "sha512-1gcp5BMCIPA9DalVlBva+9s9KaB0mCs3mGaJf3lUvDwqGI2TPTovU/2Nxi4Vr9r2iSo/2qVNyXA0v8JqADU70A==", "requires": { "remark-lint": "^6.0.0", "remark-lint-blockquote-indentation": "^1.0.0", @@ -2381,6 +2393,7 @@ "remark-lint-first-heading-level": "^1.0.0", "remark-lint-hard-break-spaces": "^1.0.1", "remark-lint-heading-style": "^1.0.0", + "remark-lint-list-item-indent": "^1.0.3", "remark-lint-maximum-line-length": "^1.1.0", "remark-lint-no-auto-link-without-protocol": "^1.0.0", "remark-lint-no-blockquote-without-caret": "^1.0.0", diff --git a/tools/node-lint-md-cli-rollup/package.json b/tools/node-lint-md-cli-rollup/package.json index 3fec3f64e72de4..212b3c97f1211f 100644 --- a/tools/node-lint-md-cli-rollup/package.json +++ b/tools/node-lint-md-cli-rollup/package.json @@ -12,7 +12,7 @@ "markdown-extensions": "^1.1.0", "remark": "^10.0.0", "remark-lint": "^6.0.3", - "remark-preset-lint-node": "^1.1.0", + "remark-preset-lint-node": "^1.2.0", "unified-args": "^6.0.0", "unified-engine": "^5.1.0" }, From 5ad224d6aefde7037831b827598d122596eeb59e Mon Sep 17 00:00:00 2001 From: apoorvanand Date: Sat, 17 Nov 2018 18:09:30 +0530 Subject: [PATCH 155/223] test: fix the arguments order in `assert.strictEqual` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24431 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Ouyang Yadong Reviewed-By: James M Snell --- test/parallel/test-buffer-alloc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index feca44881192f6..284ce224b67484 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -326,7 +326,7 @@ assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu'); 'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ' + 'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm' + '5hbCBwbGVhc3VyZS4='; - assert.strictEqual(expected, (Buffer.from(quote)).toString('base64')); + assert.strictEqual((Buffer.from(quote)).toString('base64'), expected); let b = Buffer.allocUnsafe(1024); let bytesWritten = b.write(expected, 0, 'base64'); From 380da0473afd548d038b5b74af3faf66d4875c3f Mon Sep 17 00:00:00 2001 From: Jay Arthanareeswaran Date: Sat, 17 Nov 2018 17:20:51 +0530 Subject: [PATCH 156/223] test: change callback function to arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24419 Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Ouyang Yadong Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- test/parallel/test-zlib-invalid-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js index 1b081d919e9068..10c0f3622790d0 100644 --- a/test/parallel/test-zlib-invalid-input.js +++ b/test/parallel/test-zlib-invalid-input.js @@ -43,7 +43,7 @@ const unzips = [ nonStringInputs.forEach(common.mustCall((input) => { // zlib.gunzip should not throw an error when called with bad input. - zlib.gunzip(input, function(err, buffer) { + zlib.gunzip(input, (err, buffer) => { // zlib.gunzip should pass the error to the callback. assert.ok(err); }); From 94d200fe4657cc5834b7f2fa3b19cab625057dc3 Mon Sep 17 00:00:00 2001 From: Amanpreet Date: Sat, 17 Nov 2018 18:14:58 +0530 Subject: [PATCH 157/223] test: replace closure with arrow functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24438 Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Ouyang Yadong Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat --- .../test-stream2-readable-empty-buffer-no-eof.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js index d2ef827b12ee89..219a902c71fd56 100644 --- a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js +++ b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js @@ -46,17 +46,17 @@ function test1() { r._read = function(n) { switch (reads--) { case 5: - return setImmediate(function() { + return setImmediate(() => { return r.push(buf); }); case 4: - setImmediate(function() { + setImmediate(() => { return r.push(Buffer.alloc(0)); }); return setImmediate(r.read.bind(r, 0)); case 3: setImmediate(r.read.bind(r, 0)); - return process.nextTick(function() { + return process.nextTick(() => { return r.push(Buffer.alloc(0)); }); case 2: @@ -78,12 +78,12 @@ function test1() { results.push(String(chunk)); } r.on('readable', flow); - r.on('end', function() { + r.on('end', () => { results.push('EOF'); }); flow(); - process.on('exit', function() { + process.on('exit', () => { assert.deepStrictEqual(results, [ 'xxxxx', 'xxxxx', 'EOF' ]); console.log('ok'); }); @@ -106,12 +106,12 @@ function test2() { results.push(String(chunk)); } r.on('readable', flow); - r.on('end', function() { + r.on('end', () => { results.push('EOF'); }); flow(); - process.on('exit', function() { + process.on('exit', () => { assert.deepStrictEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]); console.log('ok'); }); From be56fb7ab91fe021f2c73b75019610e4b22d96aa Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Sun, 11 Nov 2018 19:31:22 +0800 Subject: [PATCH 158/223] events: extract listener check as a function PR-URL: https://github.com/nodejs/node/pull/24303 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Denys Otrishko Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell --- lib/events.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/events.js b/lib/events.js index e59ff3f04dd93b..5dfa34469b09af 100644 --- a/lib/events.js +++ b/lib/events.js @@ -48,6 +48,13 @@ function lazyErrors() { return errors; } +function checkListener(listener) { + if (typeof listener !== 'function') { + const errors = lazyErrors(); + throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); + } +} + Object.defineProperty(EventEmitter, 'defaultMaxListeners', { enumerable: true, get: function() { @@ -195,10 +202,7 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') { - const errors = lazyErrors(); - throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); - } + checkListener(listener); events = target._events; if (events === undefined) { @@ -283,20 +287,16 @@ function _onceWrap(target, type, listener) { } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') { - const errors = lazyErrors(); - throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); - } + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') { - const errors = lazyErrors(); - throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); - } + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -306,10 +306,7 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') { - const errors = lazyErrors(); - throw new errors.ERR_INVALID_ARG_TYPE('listener', 'Function', listener); - } + checkListener(listener); events = this._events; if (events === undefined) From abe9778ea452c9c7e93f7430d31b2bbe7f906a3f Mon Sep 17 00:00:00 2001 From: Jay Arthanareeswaran Date: Sat, 17 Nov 2018 16:58:38 +0530 Subject: [PATCH 159/223] test: fix the arguments order in `assert.strictEqual` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24416 Reviewed-By: Ouyang Yadong Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/pummel/test-http-many-keep-alive-connections.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pummel/test-http-many-keep-alive-connections.js b/test/pummel/test-http-many-keep-alive-connections.js index cb9f9946844912..59eccc328d5f03 100644 --- a/test/pummel/test-http-many-keep-alive-connections.js +++ b/test/pummel/test-http-many-keep-alive-connections.js @@ -64,6 +64,6 @@ server.listen(common.PORT, function connect() { }); process.on('exit', function() { - assert.strictEqual(expected, responses); - assert.strictEqual(expected, requests); + assert.strictEqual(responses, expected); + assert.strictEqual(requests, expected); }); From 644a9d6919b78d349be3b453fa4a77877e57cad2 Mon Sep 17 00:00:00 2001 From: kanishk30 Date: Sat, 17 Nov 2018 16:46:20 +0530 Subject: [PATCH 160/223] test: fix arguments order in napi test_exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24413 Reviewed-By: Michaël Zasso Reviewed-By: Ouyang Yadong Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/addons-napi/test_exception/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/addons-napi/test_exception/test.js b/test/addons-napi/test_exception/test.js index b9311add6c92d7..c572b459e6027d 100644 --- a/test/addons-napi/test_exception/test.js +++ b/test/addons-napi/test_exception/test.js @@ -26,7 +26,7 @@ const test_exception = (function() { // Test that the native side successfully captures the exception let returnedError = test_exception.returnException(throwTheError); - assert.strictEqual(theError, returnedError); + assert.strictEqual(returnedError, theError); // Test that the native side passes the exception through assert.throws( From 8f7326c369258a635d5351fd0274427e09f4181c Mon Sep 17 00:00:00 2001 From: Amanpreet Date: Sat, 17 Nov 2018 18:08:08 +0530 Subject: [PATCH 161/223] test: replace anonymous closure functions with arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24417 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell --- test/parallel/test-error-reporting.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-error-reporting.js b/test/parallel/test-error-reporting.js index b9d78b181aef47..f56f1e4bdca67d 100644 --- a/test/parallel/test-error-reporting.js +++ b/test/parallel/test-error-reporting.js @@ -27,7 +27,7 @@ const fixtures = require('../common/fixtures'); function errExec(script, callback) { const cmd = `"${process.argv[0]}" "${fixtures.path(script)}"`; - return exec(cmd, function(err, stdout, stderr) { + return exec(cmd, (err, stdout, stderr) => { // There was some error assert.ok(err); @@ -43,39 +43,39 @@ const syntaxErrorMessage = /\bSyntaxError\b/; // Simple throw error -errExec('throws_error.js', common.mustCall(function(err, stdout, stderr) { +errExec('throws_error.js', common.mustCall((err, stdout, stderr) => { assert.ok(/blah/.test(stderr)); })); // Trying to JSON.parse(undefined) -errExec('throws_error2.js', common.mustCall(function(err, stdout, stderr) { +errExec('throws_error2.js', common.mustCall((err, stdout, stderr) => { assert.ok(syntaxErrorMessage.test(stderr)); })); // Trying to JSON.parse(undefined) in nextTick -errExec('throws_error3.js', common.mustCall(function(err, stdout, stderr) { +errExec('throws_error3.js', common.mustCall((err, stdout, stderr) => { assert.ok(syntaxErrorMessage.test(stderr)); })); // throw ILLEGAL error -errExec('throws_error4.js', common.mustCall(function(err, stdout, stderr) { +errExec('throws_error4.js', common.mustCall((err, stdout, stderr) => { assert.ok(syntaxErrorMessage.test(stderr)); })); // Specific long exception line doesn't result in stack overflow -errExec('throws_error5.js', common.mustCall(function(err, stdout, stderr) { +errExec('throws_error5.js', common.mustCall((err, stdout, stderr) => { assert.ok(syntaxErrorMessage.test(stderr)); })); // Long exception line with length > errorBuffer doesn't result in assertion -errExec('throws_error6.js', common.mustCall(function(err, stdout, stderr) { +errExec('throws_error6.js', common.mustCall((err, stdout, stderr) => { assert.ok(syntaxErrorMessage.test(stderr)); })); // Object that throws in toString() doesn't print garbage -errExec('throws_error7.js', common.mustCall(function(err, stdout, stderr) { +errExec('throws_error7.js', common.mustCall((err, stdout, stderr) => { assert.ok(/ Date: Sat, 17 Nov 2018 17:32:26 +0530 Subject: [PATCH 162/223] test: favor arrow functions in callbacks PR-URL: https://github.com/nodejs/node/pull/24425 Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Ujjwal Sharma Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-https-agent-servername.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-https-agent-servername.js b/test/parallel/test-https-agent-servername.js index df14d113994f89..aa3f75894b8e64 100644 --- a/test/parallel/test-https-agent-servername.js +++ b/test/parallel/test-https-agent-servername.js @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) common.skip('missing crypto'); @@ -14,7 +15,7 @@ const options = { }; -const server = https.Server(options, function(req, res) { +const server = https.Server(options, (req, res) => { res.writeHead(200); res.end('hello world\n'); }); @@ -27,11 +28,11 @@ server.listen(0, function() { rejectUnauthorized: true, servername: 'agent1', ca: options.ca - }, function(res) { + }, (res) => { res.resume(); - console.log(res.statusCode); + assert.strictEqual(res.statusCode, 200); server.close(); - }).on('error', function(e) { + }).on('error', (e) => { console.log(e.message); process.exit(1); }); From 40773c0f2ab73ddca244753c1e485ce7309fc4ed Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 19 Nov 2018 11:53:08 +0100 Subject: [PATCH 163/223] test: use print() function on both Python 2 and 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24485 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: Michaël Zasso --- test/message/testcfg.py | 23 ++++++++++++----------- test/pseudo-tty/testcfg.py | 23 ++++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/test/message/testcfg.py b/test/message/testcfg.py index 7e8d73bb39acd7..62776bcb7af0e2 100644 --- a/test/message/testcfg.py +++ b/test/message/testcfg.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Copyright 2008 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 @@ -67,22 +68,22 @@ def IsFailureOutput(self, output): raw_lines = (output.stdout + output.stderr).split('\n') outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ] if len(outlines) != len(patterns): - print "length differs." - print "expect=%d" % len(patterns) - print "actual=%d" % len(outlines) - print "patterns:" + print("length differs.") + print("expect=%d" % len(patterns)) + print("actual=%d" % len(outlines)) + print("patterns:") for i in xrange(len(patterns)): - print "pattern = %s" % patterns[i] - print "outlines:" + print("pattern = %s" % patterns[i]) + print("outlines:") for i in xrange(len(outlines)): - print "outline = %s" % outlines[i] + print("outline = %s" % outlines[i]) return True for i in xrange(len(patterns)): if not re.match(patterns[i], outlines[i]): - print "match failed" - print "line=%d" % i - print "expect=%s" % patterns[i] - print "actual=%s" % outlines[i] + print("match failed") + print("line=%d" % i) + print("expect=%s" % patterns[i]) + print("actual=%s" % outlines[i]) return True return False diff --git a/test/pseudo-tty/testcfg.py b/test/pseudo-tty/testcfg.py index a5b7917bc05a46..9289ce4f10d33a 100644 --- a/test/pseudo-tty/testcfg.py +++ b/test/pseudo-tty/testcfg.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Copyright 2008 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 @@ -65,22 +66,22 @@ def IsFailureOutput(self, output): raw_lines = (output.stdout + output.stderr).split('\n') outlines = [ s.strip() for s in raw_lines if not self.IgnoreLine(s) ] if len(outlines) != len(patterns): - print "length differs." - print "expect=%d" % len(patterns) - print "actual=%d" % len(outlines) - print "patterns:" + print("length differs.") + print("expect=%d" % len(patterns)) + print("actual=%d" % len(outlines)) + print("patterns:") for i in xrange(len(patterns)): - print "pattern = %s" % patterns[i] - print "outlines:" + print("pattern = %s" % patterns[i]) + print("outlines:") for i in xrange(len(outlines)): - print "outline = %s" % outlines[i] + print("outline = %s" % outlines[i]) return True for i in xrange(len(patterns)): if not re.match(patterns[i], outlines[i]): - print "match failed" - print "line=%d" % i - print "expect=%s" % patterns[i] - print "actual=%s" % outlines[i] + print("match failed") + print("line=%d" % i) + print("expect=%s" % patterns[i]) + print("actual=%s" % outlines[i]) return True return False From 5c3736a7720f37004e343ff80d3cd13d357c753f Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 19 Nov 2018 11:43:52 +0100 Subject: [PATCH 164/223] build: use print() function in configure.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24484 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: Michaël Zasso --- configure.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 0a7ffba5e069b0..b62be2302c846d 100755 --- a/configure.py +++ b/configure.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import json import sys import errno @@ -608,7 +610,7 @@ def print_verbose(x): if not options.verbose: return if type(x) is str: - print x + print(x) else: pprint.pprint(x, indent=2) From 44259264529a19e77967cfae14bf54125194068d Mon Sep 17 00:00:00 2001 From: Namit Bhalla Date: Sat, 17 Nov 2018 17:20:03 +0530 Subject: [PATCH 165/223] test: change anonymous closure functions to arrow functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24418 Reviewed-By: Ouyang Yadong Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-http-res-write-end-dont-take-array.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-res-write-end-dont-take-array.js b/test/parallel/test-http-res-write-end-dont-take-array.js index fbe71bd6fcbb67..72268efcae3a84 100644 --- a/test/parallel/test-http-res-write-end-dont-take-array.js +++ b/test/parallel/test-http-res-write-end-dont-take-array.js @@ -62,10 +62,10 @@ server.once('request', common.mustCall((req, res) => { server.listen(0, function() { // just make a request, other tests handle responses - http.get({ port: this.address().port }, function(res) { + http.get({ port: this.address().port }, (res) => { res.resume(); // do it again to test .end(Buffer); - http.get({ port: server.address().port }, function(res) { + http.get({ port: server.address().port }, (res) => { res.resume(); server.close(); }); From 94553b2ea573a93fabbb7c2f38d7434162c56676 Mon Sep 17 00:00:00 2001 From: Matteo Date: Fri, 16 Nov 2018 20:30:05 +0100 Subject: [PATCH 166/223] test: add typeerror test for EC crypto keygen PR-URL: https://github.com/nodejs/node/pull/24400 Reviewed-By: Refael Ackermann Reviewed-By: Matteo Collina Reviewed-By: James M Snell --- test/parallel/test-crypto-keygen.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index 072f69565af98e..241e4aa73ac684 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -625,6 +625,22 @@ function convertDERToPEM(label, der) { message: 'Invalid ECDH curve name' }); + // Test error type when curve is not a string + for (const namedCurve of [true, {}, [], 123]) { + common.expectsError(() => { + generateKeyPairSync('ec', { + namedCurve, + publicKeyEncoding: { type: 'spki', format: 'pem' }, + privateKeyEncoding: { type: 'sec1', format: 'pem' } + }); + }, { + type: TypeError, + code: 'ERR_INVALID_OPT_VALUE', + message: `The value "${namedCurve}" is invalid for option ` + + '"namedCurve"' + }); + } + // It should recognize both NIST and standard curve names. generateKeyPair('ec', { namedCurve: 'P-192', From 492e2a4d117aed60b5118f9e9b09c40dbb99884c Mon Sep 17 00:00:00 2001 From: Dara Hayes Date: Tue, 13 Nov 2018 16:28:07 +0000 Subject: [PATCH 167/223] doc: add filehandle.write(string[, position[, encoding]]) Add missing docs for filehandle.write(string[, position[, encoding]]) In the fs.promises API. Fixes: https://github.com/nodejs/node/issues/20406 PR-URL: https://github.com/nodejs/node/pull/23224 Reviewed-By: Sakthipriyan Vairamani --- doc/api/fs.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 16cede54dba598..1978fcb61cbfab 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3941,6 +3941,37 @@ On Linux, positional writes do not work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file. +#### filehandle.write(string[, position[, encoding]]) + + +* `string` {string} +* `position` {integer} +* `encoding` {string} **Default:** `'utf8'` +* Returns: {Promise} + +Write `string` to the file. If `string` is not a string, then +the value will be coerced to one. + +The `Promise` is resolved with an object containing a `bytesWritten` property +identifying the number of bytes written, and a `buffer` property containing +a reference to the `string` written. + +`position` refers to the offset from the beginning of the file where this data +should be written. If the type of `position` is not a `number` the data +will be written at the current position. See pwrite(2). + +`encoding` is the expected string encoding. + +It is unsafe to use `filehandle.write()` multiple times on the same file +without waiting for the `Promise` to be resolved (or rejected). For this +scenario, [`fs.createWriteStream()`][] is strongly recommended. + +On Linux, positional writes do not work when the file is opened in append mode. +The kernel ignores the position argument and always appends the data to +the end of the file. + #### filehandle.writeFile(data, options) -* Returns: {string} +* Returns: {string|null} Returns a string containing the negotiated SSL/TLS protocol version of the current connection. The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process. The value `null` will be returned for server sockets or disconnected client sockets. -Example responses include: +Protocol versions are: -* `TLSv1` -* `TLSv1.1` -* `TLSv1.2` -* `unknown` +* `'TLSv1'` +* `'TLSv1.1'` +* `'TLSv1.2'` +* `'SSLv3'` See for more information. From 5516fbf1d7e7ae6a9540a56ac4ddbb18cc0250c3 Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Sat, 17 Nov 2018 12:50:04 +0800 Subject: [PATCH 177/223] http2: order declarations in http2.js PR-URL: https://github.com/nodejs/node/pull/24411 Reviewed-By: Sam Roberts Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- lib/http2.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/http2.js b/lib/http2.js index 1f770ff4c734cd..c3ecd82072ee53 100644 --- a/lib/http2.js +++ b/lib/http2.js @@ -1,25 +1,25 @@ 'use strict'; const { + connect, constants, + createServer, + createSecureServer, getDefaultSettings, getPackedSettings, getUnpackedSettings, - createServer, - createSecureServer, - connect, Http2ServerRequest, Http2ServerResponse } = require('internal/http2/core'); module.exports = { + connect, constants, + createServer, + createSecureServer, getDefaultSettings, getPackedSettings, getUnpackedSettings, - createServer, - createSecureServer, - connect, - Http2ServerResponse, - Http2ServerRequest + Http2ServerRequest, + Http2ServerResponse }; From e7d41c0312918c592831e14d11e4487afcfb79a7 Mon Sep 17 00:00:00 2001 From: Mrityunjoy Saha Date: Sat, 17 Nov 2018 18:02:25 +0530 Subject: [PATCH 178/223] test: modify order of parameters for assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24430 Reviewed-By: Ruben Bridgewater Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani --- test/parallel/test-promises-unhandled-rejections.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index 93ac186a3b45f6..fdbf17b9594656 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -634,8 +634,8 @@ asyncTest( const e = new Error('error'); const domainError = new Error('domain error'); onUnhandledSucceed(done, function(reason, promise) { - assert.strictEqual(e, reason); - assert.strictEqual(domainError, domainReceivedError); + assert.strictEqual(reason, e); + assert.strictEqual(domainReceivedError, domainError); }); Promise.reject(e); process.nextTick(function() { From 4b82aa80fe892e43335889d3c02d67a25d085742 Mon Sep 17 00:00:00 2001 From: Maya Anilson Date: Sat, 17 Nov 2018 17:59:15 +0530 Subject: [PATCH 179/223] src: elevate namespaces of repeated artifacts PR-URL: https://github.com/nodejs/node/pull/24429 Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani --- src/node_i18n.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 5966e3ff678e34..38be4576706f3b 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -91,6 +91,7 @@ using v8::Int32; using v8::Isolate; using v8::Local; using v8::MaybeLocal; +using v8::NewStringType; using v8::Object; using v8::ObjectTemplate; using v8::String; @@ -257,7 +258,7 @@ class ConverterObject : public BaseObject, Converter { protected: ConverterObject(Environment* env, - v8::Local wrap, + Local wrap, UConverter* converter, bool ignoreBOM, const char* sub = nullptr) : @@ -506,7 +507,7 @@ void ICUErrorName(const FunctionCallbackInfo& args) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), u_errorName(status), - v8::NewStringType::kNormal).ToLocalChecked()); + NewStringType::kNormal).ToLocalChecked()); } #define TYPE_ICU "icu" @@ -552,7 +553,7 @@ void GetVersion(const FunctionCallbackInfo& args) { TYPE_ICU "," TYPE_UNICODE "," TYPE_CLDR "," - TYPE_TZ, v8::NewStringType::kNormal).ToLocalChecked()); + TYPE_TZ, NewStringType::kNormal).ToLocalChecked()); } else { CHECK_GE(args.Length(), 1); CHECK(args[0]->IsString()); @@ -565,7 +566,7 @@ void GetVersion(const FunctionCallbackInfo& args) { // Success. args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), - versionString, v8::NewStringType::kNormal).ToLocalChecked()); + versionString, NewStringType::kNormal).ToLocalChecked()); } } } @@ -722,7 +723,7 @@ static void ToUnicode(const FunctionCallbackInfo& args) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), *buf, - v8::NewStringType::kNormal, + NewStringType::kNormal, len).ToLocalChecked()); } @@ -745,7 +746,7 @@ static void ToASCII(const FunctionCallbackInfo& args) { args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), *buf, - v8::NewStringType::kNormal, + NewStringType::kNormal, len).ToLocalChecked()); } From 8df4a168b3a86b1b9d3c245a7715b48234898b8c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 16 Nov 2018 15:51:07 -0800 Subject: [PATCH 180/223] http2: replace unreachable error with assertion "That particular `emit('error', ...)` is largely defensively coded and should not ever actually happen." Sounds like an assertion rather than an error event. The code in question has no test coverage because it is believed to be unreachable. Fixes: https://github.com/nodejs/node/issues/20673 PR-URL: https://github.com/nodejs/node/pull/24407 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- lib/internal/http2/compat.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 40276d87234865..2fb96ea113eed4 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -1,5 +1,6 @@ 'use strict'; +const assert = require('assert'); const Stream = require('stream'); const Readable = Stream.Readable; const binding = process.binding('http2'); @@ -331,15 +332,12 @@ class Http2ServerRequest extends Readable { _read(nread) { const state = this[kState]; - if (!state.closed) { - if (!state.didRead) { - state.didRead = true; - this[kStream].on('data', onStreamData); - } else { - process.nextTick(resumeStream, this[kStream]); - } + assert(!state.closed); + if (!state.didRead) { + state.didRead = true; + this[kStream].on('data', onStreamData); } else { - this.emit('error', new ERR_HTTP2_INVALID_STREAM()); + process.nextTick(resumeStream, this[kStream]); } } From 3ef68d8d971b0a3d13c3a821f062488821c4872d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 15 Nov 2018 15:47:44 -0500 Subject: [PATCH 181/223] cli: add missing env vars to --help This adds NODE_TLS_REJECT_UNAUTHORIZED, SSL_CERT_DIR, SSL_CERT_FILE, and UV_THREADPOOL_SIZE to the --help menu. PR-URL: https://github.com/nodejs/node/pull/24383 Reviewed-By: Anna Henningsen Reviewed-By: Sam Roberts Reviewed-By: Richard Lau Reviewed-By: Ouyang Yadong Reviewed-By: Weijia Wang Reviewed-By: Franziska Hinkelmann Reviewed-By: Vse Mozhet Byt Reviewed-By: Michael Dawson --- lib/internal/print_help.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/internal/print_help.js b/lib/internal/print_help.js index c453562c5c40bf..c1baa643e70db2 100644 --- a/lib/internal/print_help.js +++ b/lib/internal/print_help.js @@ -29,9 +29,17 @@ const envVars = new Map([ 'of stderr' }], ['NODE_REPL_HISTORY', { helpText: 'path to the persistent REPL ' + 'history file' }], + ['NODE_TLS_REJECT_UNAUTHORIZED', { helpText: 'set to 0 to disable TLS ' + + 'certificate validation' }], ['NODE_V8_COVERAGE', { helpText: 'directory to output v8 coverage JSON ' + 'to' }], - ['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }] + ['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }], + ['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' + + 'certificates when used in conjunction with --use-openssl-ca' }], + ['SSL_CERT_FILE', { helpText: 'sets OpenSSL\'s trusted certificate file ' + + 'when used in conjunction with --use-openssl-ca' }], + ['UV_THREADPOOL_SIZE', { helpText: 'sets the number of threads used in ' + + 'libuv\'s threadpool' }] ].concat(hasIntl ? [ ['NODE_ICU_DATA', { helpText: 'data path for ICU (Intl object) data' + hasSmallICU ? '' : ' (will extend linked-in data)' }] From ef1056f4bd52105ba156cd5e9d164e3637116380 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 15 Nov 2018 16:33:23 -0500 Subject: [PATCH 182/223] doc: add missing env variables to man page This commit adds the missing environment variables NODE_DEBUG_NATIVE, NODE_PRESERVE_SYMLINKS, NODE_TLS_REJECT_UNAUTHORIZED, NODE_V8_COVERAGE, and UV_THREADPOOL_SIZE to the man page. PR-URL: https://github.com/nodejs/node/pull/24383 Reviewed-By: Anna Henningsen Reviewed-By: Sam Roberts Reviewed-By: Richard Lau Reviewed-By: Ouyang Yadong Reviewed-By: Weijia Wang Reviewed-By: Franziska Hinkelmann Reviewed-By: Vse Mozhet Byt Reviewed-By: Michael Dawson --- doc/node.1 | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/node.1 b/doc/node.1 index 3d2344822df261..0c351032174476 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -278,6 +278,9 @@ Print node's version. .It Ev NODE_DEBUG Ar modules... Comma-separated list of core modules that should print debug information. . +.It Ev NODE_DEBUG_NATIVE Ar modules... +Comma-separated list of C++ core modules that should print debug information. +. .It Ev NODE_DISABLE_COLORS When set to .Ar 1 , @@ -326,6 +329,11 @@ When set to .Ar 1 , emit pending deprecation warnings. . +.It Ev NODE_PRESERVE_SYMLINKS +When set to +.Ar 1 , +the module loader preserves symbolic links when resolving and caching modules. +. .It Ev NODE_REDIRECT_WARNINGS Ar file Write process warnings to the given .Ar file @@ -342,6 +350,15 @@ The default path is which is overridden by this variable. Setting the value to an empty string ("" or " ") will disable persistent REPL history. . +.It Ev NODE_TLS_REJECT_UNAUTHORIZED +When set to +.Ar 0 , +TLS certificate validation is disabled. +. +.It Ev NODE_V8_COVERAGE Ar dir +When set, Node.js writes JavaScript code coverage information to +.Ar dir . +. .It Ev OPENSSL_CONF Ar file Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with @@ -360,8 +377,12 @@ is enabled, this overrides and sets OpenSSL's directory containing trusted certi If .Fl -use-openssl-ca is enabled, this overrides and sets OpenSSL's file containing trusted certificates. -.El . +.It Ev UV_THREADPOOL_SIZE Ar size +Sets the number of threads used in libuv's threadpool to +.Ar size . +. +.El .\"===================================================================== .Sh BUGS Bugs are tracked in GitHub Issues: From 6bb860cd20ff988e8f5963b13ac6dd07e55634ec Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 15 Nov 2018 16:40:06 -0500 Subject: [PATCH 183/223] doc: add NODE_DEBUG_NATIVE to API docs This commit adds the missing environment variable NODE_DEBUG_NATIVE to the CLI API docs. PR-URL: https://github.com/nodejs/node/pull/24383 Reviewed-By: Anna Henningsen Reviewed-By: Sam Roberts Reviewed-By: Richard Lau Reviewed-By: Ouyang Yadong Reviewed-By: Weijia Wang Reviewed-By: Franziska Hinkelmann Reviewed-By: Vse Mozhet Byt Reviewed-By: Michael Dawson --- doc/api/cli.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/cli.md b/doc/api/cli.md index 87a93a70bab36b..7563515b9f9b21 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -530,6 +530,10 @@ added: v0.1.32 `','`-separated list of core modules that should print debug information. +### `NODE_DEBUG_NATIVE=module[,…]` + +`','`-separated list of core C++ modules that should print debug information. + ### `NODE_DISABLE_COLORS=1` + +* {boolean} + +Is `true` if it is safe to call [`writable.write()`][]. + ##### writable.writableHighWaterMark + +* {boolean} + +Is `true` if it is safe to call [`readable.read()`][]. + ##### readable.readableHighWaterMark -* Returns: {number} +* {number} Returns the value of `highWaterMark` passed when constructing this `Readable`. @@ -1028,7 +1046,7 @@ Returns the value of `highWaterMark` passed when constructing this added: v9.4.0 --> -* Returns: {number} +* {number} This property contains the number of bytes (or objects) in the queue ready to be read. The value provides introspection data regarding From 98ef097f76c6c129105b52fe1ba67602f4d5da94 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 21 Nov 2018 11:00:52 -0800 Subject: [PATCH 198/223] doc: revise `author ready` explanation Improve the `author ready` text in the COLLABORATOR_GUIDE for scannability, readability, etc. PR-URL: https://github.com/nodejs/node/pull/24558 Reviewed-By: Richard Lau Reviewed-By: Vse Mozhet Byt --- COLLABORATOR_GUIDE.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 4d0be355d5881d..9e4b72ea2e0724 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -69,12 +69,15 @@ issues and pull requests can always be re-opened if necessary. ### Author ready pull requests -A pull request that is still awaiting the minimum review time is considered -_author ready_ as soon as the CI has been started, it has at least two approvals -(one Collaborator approval is enough if the pull request has been open for more -than 7 days), and it has no outstanding review comments. Please always make sure -to add the `author ready` label to the PR in that case and remove it again as -soon as that condition is not met anymore. +A pull request is _author ready_ when: + +* There is a CI run in progress or completed. +* There are at least two Collaborator approvals, or at least one approval if the + pull request is older than 7 days. +* There are no outstanding review comments. + +Please always add the `author ready` label to the PR in that case. Please always +remove it again as soon as the conditions are not met anymore. ### Handling own pull requests From fa910378fc9581f76430f402494509e9263a3f5f Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sun, 26 Aug 2018 22:24:22 +0200 Subject: [PATCH 199/223] build: fix Python detection when depot_tools are in PATH in Windows PR-URL: https://github.com/nodejs/node/pull/22539 Reviewed-By: Bartosz Sosnowski Reviewed-By: Refael Ackermann --- tools/msvs/find_python.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/msvs/find_python.cmd b/tools/msvs/find_python.cmd index 1692ec1c30ad7e..c918be052711fc 100644 --- a/tools/msvs/find_python.cmd +++ b/tools/msvs/find_python.cmd @@ -2,7 +2,7 @@ echo Looking for Python 2.x SETLOCAL :: If python.exe is in %Path%, just validate -FOR /F "delims=" %%a IN ('where python 2^> NUL') DO ( +FOR /F "delims=" %%a IN ('where python.exe 2^> NUL') DO ( SET need_path=0 SET p=%%~dpa IF NOT ERRORLEVEL 1 GOTO :validate From b827db0ef3f8c2b925265cec5565b0d6ba5d8fef Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Thu, 22 Nov 2018 00:38:05 +0200 Subject: [PATCH 200/223] doc,meta: update PR approving info Refs: https://github.com/nodejs/node/pull/22255 PR-URL: https://github.com/nodejs/node/pull/24561 Reviewed-By: Rich Trott Reviewed-By: Anatoli Papirovski --- doc/guides/contributing/pull-requests.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/guides/contributing/pull-requests.md b/doc/guides/contributing/pull-requests.md index cd2bc4d5ebdcb8..33c2872f534f97 100644 --- a/doc/guides/contributing/pull-requests.md +++ b/doc/guides/contributing/pull-requests.md @@ -416,7 +416,8 @@ unhelpful is likely safe to ignore. ### Step 10: Landing In order to land, a Pull Request needs to be reviewed and [approved][] by -at least one Node.js Collaborator and pass a +at least two Node.js Collaborators (one Collaborator approval is enough if the +pull request has been open for more than 7 days) and pass a [CI (Continuous Integration) test run][]. After that, as long as there are no objections from other contributors, the Pull Request can be merged. If you find your Pull Request waiting longer than you expect, see the From 44d9084f66d063eced1281b5d74fb6d000dfd8ca Mon Sep 17 00:00:00 2001 From: Sarath Govind K K Date: Mon, 19 Nov 2018 11:07:23 +0530 Subject: [PATCH 201/223] test: replcae anonymous closure with arrow function PR-URL: https://github.com/nodejs/node/pull/24476 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani --- test/known_issues/test-http-path-contains-unicode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/known_issues/test-http-path-contains-unicode.js b/test/known_issues/test-http-path-contains-unicode.js index a51b07210214b9..d899fab07c43bb 100644 --- a/test/known_issues/test-http-path-contains-unicode.js +++ b/test/known_issues/test-http-path-contains-unicode.js @@ -23,9 +23,9 @@ const server = http.createServer(common.mustCall(function(req, res) { })); -server.listen(0, function() { +server.listen(0, () => { http.request({ - port: this.address().port, + port: server.address().port, path: expected, method: 'GET' }, common.mustCall(function(res) { From 7e96c7f55bc1a17828f36b0af5b1a34d6be9d36d Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Sun, 18 Nov 2018 12:27:43 -0500 Subject: [PATCH 202/223] doc: clarify who may land on an LTS staging branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current language is a bit confusing PR-URL: https://github.com/nodejs/node/pull/24465 Refs: https://github.com/nodejs/node/pull/24344#issuecomment-439658596 Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Gus Caplan Reviewed-By: Ali Ijaz Sheikh Reviewed-By: Michael Dawson Reviewed-By: Trivikram Kamat Reviewed-By: Matteo Collina --- COLLABORATOR_GUIDE.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 9e4b72ea2e0724..0be47023ea7263 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -803,9 +803,8 @@ pulled from the staging branch into the LTS branch only when a release is being prepared and may be pulled into the LTS branch in a different order than they were landed in staging. -Any Collaborator may land commits into a staging branch, but only the release -team should land commits into the LTS branch while preparing a new -LTS release. +Only the members of the @nodejs/backporters team should land commits onto +LTS staging branches. #### How can I help? From 636de369cec6de645100afd1e7f7ddf35e5b8f5f Mon Sep 17 00:00:00 2001 From: sreepurnajasti Date: Mon, 19 Nov 2018 19:20:11 +0530 Subject: [PATCH 203/223] test: replace callback with arrow functions PR-URL: https://github.com/nodejs/node/pull/24490 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Ruben Bridgewater --- test/pummel/test-keep-alive.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index b62d731c7b4006..0fec1ff877b89b 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -32,7 +32,7 @@ const http = require('http'); const url = require('url'); const body = 'hello world\n'; -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Length': body.length, 'Content-Type': 'text/plain' @@ -45,7 +45,7 @@ let keepAliveReqSec = 0; let normalReqSec = 0; -function runAb(opts, callback) { +const runAb = (opts, callback) => { const args = [ '-c', opts.concurrent || 100, '-t', opts.threads || 2, @@ -66,11 +66,9 @@ function runAb(opts, callback) { let stdout; - child.stdout.on('data', function(data) { - stdout += data; - }); + child.stdout.on('data', (data) => stdout += data); - child.on('close', function(code, signal) { + child.on('close', (code, signal) => { if (code) { console.error(code, signal); process.exit(code); @@ -90,20 +88,20 @@ function runAb(opts, callback) { callback(reqSec, keepAliveRequests); }); -} +}; server.listen(common.PORT, () => { runAb({ keepalive: true }, (reqSec) => { keepAliveReqSec = reqSec; - runAb({ keepalive: false }, function(reqSec) { + runAb({ keepalive: false }, (reqSec) => { normalReqSec = reqSec; server.close(); }); }); }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual( normalReqSec > 50, true, From fe96ecd7468545dc1023f8d267b52cc815b7677a Mon Sep 17 00:00:00 2001 From: suman-mitra Date: Mon, 19 Nov 2018 00:58:49 -0800 Subject: [PATCH 204/223] test: replace anonymous closure with arrow func PR-URL: https://github.com/nodejs/node/pull/24480 Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- test/parallel/test-stream2-unpipe-drain.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-stream2-unpipe-drain.js b/test/parallel/test-stream2-unpipe-drain.js index 582ab61b06fb96..ac2a3a5b062c9d 100644 --- a/test/parallel/test-stream2-unpipe-drain.js +++ b/test/parallel/test-stream2-unpipe-drain.js @@ -51,13 +51,13 @@ const src2 = new TestReader(); src1.pipe(dest); -src1.once('readable', function() { - process.nextTick(function() { +src1.once('readable', () => { + process.nextTick(() => { src2.pipe(dest); - src2.once('readable', function() { - process.nextTick(function() { + src2.once('readable', () => { + process.nextTick(() => { src1.unpipe(dest); }); @@ -66,7 +66,7 @@ src1.once('readable', function() { }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(src1.reads, 2); assert.strictEqual(src2.reads, 2); }); From 8bd239936c0fe68ff7849118fbfd10c97ed1c6ac Mon Sep 17 00:00:00 2001 From: NoSkillGirl Date: Wed, 21 Nov 2018 05:14:49 +0530 Subject: [PATCH 205/223] test: using arrow functions - Using arrow functions in test-tls-client-resume.js - Fixed error, Expected parentheses around arrow function argument arrow-parens PR-URL: https://github.com/nodejs/node/pull/24436 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/parallel/test-tls-client-resume.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-tls-client-resume.js b/test/parallel/test-tls-client-resume.js index 296df88e9f9152..db4c898d746790 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -38,7 +38,7 @@ const options = { }; // create server -const server = tls.Server(options, common.mustCall(function(socket) { +const server = tls.Server(options, common.mustCall((socket) => { socket.end('Goodbye'); }, 2)); @@ -49,13 +49,13 @@ server.listen(0, function() { const client1 = tls.connect({ port: this.address().port, rejectUnauthorized: false - }, function() { + }, () => { console.log('connect1'); assert.ok(!client1.isSessionReused(), 'Session *should not* be reused.'); session1 = client1.getSession(); }); - client1.on('close', function() { + client1.on('close', () => { console.log('close1'); const opts = { @@ -64,12 +64,12 @@ server.listen(0, function() { session: session1 }; - const client2 = tls.connect(opts, function() { + const client2 = tls.connect(opts, () => { console.log('connect2'); assert.ok(client2.isSessionReused(), 'Session *should* be reused.'); }); - client2.on('close', function() { + client2.on('close', () => { console.log('close2'); server.close(); }); From 31511c5a6629acc1b0baf1416c515f5df7845d7c Mon Sep 17 00:00:00 2001 From: Maya Anilson Date: Sat, 17 Nov 2018 17:59:15 +0530 Subject: [PATCH 206/223] test: replace closure with arrow function PR-URL: https://github.com/nodejs/node/pull/24489 Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/pummel/test-net-timeout.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/pummel/test-net-timeout.js b/test/pummel/test-net-timeout.js index e87cdc0b8edf51..524322440a1ea6 100644 --- a/test/pummel/test-net-timeout.js +++ b/test/pummel/test-net-timeout.js @@ -29,46 +29,46 @@ let starttime = null; let timeouttime = null; const timeout = 1000; -const echo_server = net.createServer(function(socket) { +const echo_server = net.createServer((socket) => { socket.setTimeout(timeout); - socket.on('timeout', function() { + socket.on('timeout', () => { console.log('server timeout'); timeouttime = new Date(); console.dir(timeouttime); socket.destroy(); }); - socket.on('error', function(e) { + socket.on('error', (e) => { throw new Error( 'Server side socket should not get error. We disconnect willingly.'); }); - socket.on('data', function(d) { + socket.on('data', (d) => { console.log(d); socket.write(d); }); - socket.on('end', function() { + socket.on('end', () => { socket.end(); }); }); -echo_server.listen(common.PORT, function() { +echo_server.listen(common.PORT, () => { console.log(`server listening at ${common.PORT}`); const client = net.createConnection(common.PORT); client.setEncoding('UTF8'); client.setTimeout(0); // disable the timeout for client - client.on('connect', function() { + client.on('connect', () => { console.log('client connected.'); client.write('hello\r\n'); }); - client.on('data', function(chunk) { + client.on('data', (chunk) => { assert.strictEqual(chunk, 'hello\r\n'); if (exchanges++ < 5) { - setTimeout(function() { + setTimeout(() => { console.log('client write "hello"'); client.write('hello\r\n'); }, 500); @@ -81,22 +81,22 @@ echo_server.listen(common.PORT, function() { } }); - client.on('timeout', function() { + client.on('timeout', () => { throw new Error("client timeout - this shouldn't happen"); }); - client.on('end', function() { + client.on('end', () => { console.log('client end'); client.end(); }); - client.on('close', function() { + client.on('close', () => { console.log('client disconnect'); echo_server.close(); }); }); -process.on('exit', function() { +process.on('exit', () => { assert.ok(starttime != null); assert.ok(timeouttime != null); From 952842b05f6bd108f6885bfcb1e161509f19fcf2 Mon Sep 17 00:00:00 2001 From: sagirk Date: Mon, 19 Nov 2018 14:50:15 +0530 Subject: [PATCH 207/223] test: refactor test to use arrow functions In `test/parallel/test-cluster-send-deadlock.js`, callbacks use anonymous closure functions. It is safe to replace them with arrow functions since these callbacks don't contain references to `this`, `super` or `arguments`. This results in shorter functions. PR-URL: https://github.com/nodejs/node/pull/24479 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-cluster-send-deadlock.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-cluster-send-deadlock.js b/test/parallel/test-cluster-send-deadlock.js index b02837e7fb1793..b34eb892adb464 100644 --- a/test/parallel/test-cluster-send-deadlock.js +++ b/test/parallel/test-cluster-send-deadlock.js @@ -30,31 +30,31 @@ const net = require('net'); if (cluster.isMaster) { const worker = cluster.fork(); - worker.on('exit', function(code, signal) { + worker.on('exit', (code, signal) => { assert.strictEqual(code, 0, `Worker exited with an error code: ${code}`); assert(!signal, `Worker exited by a signal: ${signal}`); server.close(); }); - const server = net.createServer(function(socket) { + const server = net.createServer((socket) => { worker.send('handle', socket); }); - server.listen(0, function() { + server.listen(0, () => { worker.send({ message: 'listen', port: server.address().port }); }); } else { - process.on('message', function(msg, handle) { + process.on('message', (msg, handle) => { if (msg.message && msg.message === 'listen') { assert(msg.port); const client1 = net.connect({ host: 'localhost', port: msg.port - }, function() { + }, () => { const client2 = net.connect({ host: 'localhost', port: msg.port - }, function() { + }, () => { client1.on('close', onclose); client2.on('close', onclose); client1.end(); @@ -62,10 +62,10 @@ if (cluster.isMaster) { }); }); let waiting = 2; - function onclose() { + const onclose = () => { if (--waiting === 0) cluster.worker.disconnect(); - } + }; } else { process.send('reply', handle); } From b332a78a4b55960c1e0aad44d5a04d80941931ba Mon Sep 17 00:00:00 2001 From: Dan Foley Date: Tue, 20 Nov 2018 20:07:16 -0800 Subject: [PATCH 208/223] test: remove unused reject handlers PR-URL: https://github.com/nodejs/node/pull/24540 Reviewed-By: Rich Trott Reviewed-By: Anatoli Papirovski --- test/common/inspector-helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 7cac2b29f9c90c..75b87e9cf91372 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -416,7 +416,7 @@ class NodeInstance extends EventEmitter { async connectInspectorSession() { console.log('[test]', 'Connecting to a child Node process'); const upgradeRequest = await this.sendUpgradeRequest(); - return new Promise((resolve, reject) => { + return new Promise((resolve) => { upgradeRequest .on('upgrade', (message, socket) => resolve(new InspectorSession(socket, this))) @@ -427,7 +427,7 @@ class NodeInstance extends EventEmitter { async expectConnectionDeclined() { console.log('[test]', 'Checking upgrade is not possible'); const upgradeRequest = await this.sendUpgradeRequest(); - return new Promise((resolve, reject) => { + return new Promise((resolve) => { upgradeRequest .on('upgrade', common.mustNotCall('Upgrade was received')) .on('response', (response) => From d41c988a11fd46446a07c138a4ba60ee95761b50 Mon Sep 17 00:00:00 2001 From: Pranay Kothapalli Date: Wed, 21 Nov 2018 11:31:53 +0530 Subject: [PATCH 209/223] test: favor arrow function in callback PR-URL: https://github.com/nodejs/node/pull/24542 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-zlib-close-after-write.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-zlib-close-after-write.js b/test/parallel/test-zlib-close-after-write.js index d89102ed8c7fd9..211318dc5ad6cc 100644 --- a/test/parallel/test-zlib-close-after-write.js +++ b/test/parallel/test-zlib-close-after-write.js @@ -23,7 +23,7 @@ const common = require('../common'); const zlib = require('zlib'); -zlib.gzip('hello', common.mustCall(function(err, out) { +zlib.gzip('hello', common.mustCall((err, out) => { const unzip = zlib.createGunzip(); unzip.write(out); unzip.close(common.mustCall()); From 9c29288fc8d585fc64cbeb0d7519a533e808b86b Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:57:21 +0530 Subject: [PATCH 210/223] test: replace anonymous function with arrow function PR-URL: https://github.com/nodejs/node/pull/24529 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-child-process-fork-dgram.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index 4aa36261dbb24b..a25b4ad1186821 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -38,10 +38,10 @@ const assert = require('assert'); if (process.argv[2] === 'child') { let childServer; - process.once('message', function(msg, clusterServer) { + process.once('message', (msg, clusterServer) => { childServer = clusterServer; - childServer.once('message', function() { + childServer.once('message', () => { process.send('gotMessage'); childServer.close(); }); @@ -59,15 +59,15 @@ if (process.argv[2] === 'child') { let childGotMessage = false; let parentGotMessage = false; - parentServer.once('message', function(msg, rinfo) { + parentServer.once('message', (msg, rinfo) => { parentGotMessage = true; parentServer.close(); }); - parentServer.on('listening', function() { + parentServer.on('listening', () => { child.send('server', parentServer); - child.on('message', function(msg) { + child.on('message', (msg) => { if (msg === 'gotMessage') { childGotMessage = true; } else if (msg = 'handlReceived') { @@ -79,7 +79,7 @@ if (process.argv[2] === 'child') { function sendMessages() { const serverPort = parentServer.address().port; - const timer = setInterval(function() { + const timer = setInterval(() => { /* * Both the parent and the child got at least one message, * test passed, clean up everything. @@ -94,7 +94,7 @@ if (process.argv[2] === 'child') { msg.length, serverPort, '127.0.0.1', - function(err) { + (err) => { assert.ifError(err); } ); @@ -104,7 +104,7 @@ if (process.argv[2] === 'child') { parentServer.bind(0, '127.0.0.1'); - process.once('exit', function() { + process.once('exit', () => { assert(parentGotMessage); assert(childGotMessage); }); From 6ef3ec0ed8220782536b4c3965f32c591d972d3c Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 20 Nov 2018 23:34:55 +0530 Subject: [PATCH 211/223] test: replace closure functions with arrow functions PR-URL: https://github.com/nodejs/node/pull/24522 Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen --- test/parallel/test-http-write-callbacks.js | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/parallel/test-http-write-callbacks.js b/test/parallel/test-http-write-callbacks.js index 440807a2df7ca0..401017592b67a1 100644 --- a/test/parallel/test-http-write-callbacks.js +++ b/test/parallel/test-http-write-callbacks.js @@ -33,7 +33,7 @@ let clientEndCb = false; let clientIncoming = ''; const clientIncomingExpect = 'asdffoobar'; -process.on('exit', function() { +process.on('exit', () => { assert(serverEndCb); assert.strictEqual(serverIncoming, serverIncomingExpect); assert(clientEndCb); @@ -42,22 +42,22 @@ process.on('exit', function() { }); // Verify that we get a callback when we do res.write(..., cb) -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { res.statusCode = 400; res.end('Bad Request.\nMust send Expect:100-continue\n'); }); -server.on('checkContinue', function(req, res) { +server.on('checkContinue', (req, res) => { server.close(); assert.strictEqual(req.method, 'PUT'); - res.writeContinue(function() { + res.writeContinue(() => { // continue has been written - req.on('end', function() { - res.write('asdf', function(er) { + req.on('end', () => { + res.write('asdf', (er) => { assert.ifError(er); - res.write('foo', 'ascii', function(er) { + res.write('foo', 'ascii', (er) => { assert.ifError(er); - res.end(Buffer.from('bar'), 'buffer', function(er) { + res.end(Buffer.from('bar'), 'buffer', (er) => { serverEndCb = true; }); }); @@ -66,7 +66,7 @@ server.on('checkContinue', function(req, res) { }); req.setEncoding('ascii'); - req.on('data', function(c) { + req.on('data', (c) => { serverIncoming += c; }); }); @@ -77,24 +77,24 @@ server.listen(0, function() { method: 'PUT', headers: { 'expect': '100-continue' } }); - req.on('continue', function() { + req.on('continue', () => { // ok, good to go. - req.write('YmF6', 'base64', function(er) { + req.write('YmF6', 'base64', (er) => { assert.ifError(er); - req.write(Buffer.from('quux'), function(er) { + req.write(Buffer.from('quux'), (er) => { assert.ifError(er); - req.end('626c657267', 'hex', function(er) { + req.end('626c657267', 'hex', (er) => { assert.ifError(er); clientEndCb = true; }); }); }); }); - req.on('response', function(res) { + req.on('response', (res) => { // this should not come until after the end is flushed out assert(clientEndCb); res.setEncoding('ascii'); - res.on('data', function(c) { + res.on('data', (c) => { clientIncoming += c; }); }); From 6b3b7698ebe3bc9f73034a4b2ba4ce23e8de0d63 Mon Sep 17 00:00:00 2001 From: Nethra Ravindran Date: Sat, 17 Nov 2018 17:42:29 +0530 Subject: [PATCH 212/223] test: change anonymous closure function to arrow function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/24433 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- test/parallel/test-net-connect-options-port.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js index afdfc2ac615ad6..c22630d43354a5 100644 --- a/test/parallel/test-net-connect-options-port.js +++ b/test/parallel/test-net-connect-options-port.js @@ -76,15 +76,15 @@ const net = require('net'); const expectedConnections = 72; let serverConnected = 0; - const server = net.createServer(common.mustCall(function(socket) { + const server = net.createServer(common.mustCall((socket) => { socket.end('ok'); if (++serverConnected === expectedConnections) { server.close(); } }, expectedConnections)); - server.listen(0, 'localhost', common.mustCall(function() { - const port = this.address().port; + server.listen(0, 'localhost', common.mustCall(() => { + const port = server.address().port; // Total connections = 3 * 4(canConnect) * 6(doConnect) = 72 canConnect(port); @@ -93,7 +93,7 @@ const net = require('net'); })); // Try connecting to random ports, but do so once the server is closed - server.on('close', function() { + server.on('close', () => { asyncFailToConnect(0); asyncFailToConnect(/* undefined */); }); @@ -193,7 +193,7 @@ function canConnect(port) { } function asyncFailToConnect(port) { - const onError = () => common.mustCall(function(err) { + const onError = () => common.mustCall((err) => { const regexp = /^Error: connect E\w+.+$/; assert(regexp.test(String(err)), String(err)); }); From a7ab8f8aa28de81422d37238aef6c4a184b9baca Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 20 Nov 2018 23:53:56 +0530 Subject: [PATCH 213/223] test: replace anonymous function with arrow func PR-URL: https://github.com/nodejs/node/pull/24525 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-https-client-resume.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js index 301cb63dc70310..04a89364fe0e94 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -38,7 +38,7 @@ const options = { }; // create server -const server = https.createServer(options, common.mustCall(function(req, res) { +const server = https.createServer(options, common.mustCall((req, res) => { res.end('Goodbye'); }, 2)); @@ -49,7 +49,7 @@ server.listen(0, function() { const client1 = tls.connect({ port: this.address().port, rejectUnauthorized: false - }, function() { + }, () => { console.log('connect1'); assert.ok(!client1.isSessionReused(), 'Session *should not* be reused.'); session1 = client1.getSession(); @@ -58,7 +58,7 @@ server.listen(0, function() { '\r\n'); }); - client1.on('close', function() { + client1.on('close', () => { console.log('close1'); const opts = { @@ -67,7 +67,7 @@ server.listen(0, function() { session: session1 }; - const client2 = tls.connect(opts, function() { + const client2 = tls.connect(opts, () => { console.log('connect2'); assert.ok(client2.isSessionReused(), 'Session *should* be reused.'); client2.write('GET / HTTP/1.0\r\n' + @@ -75,7 +75,7 @@ server.listen(0, function() { '\r\n'); }); - client2.on('close', function() { + client2.on('close', () => { console.log('close2'); server.close(); }); From 546af692c009f6660d8974cdce579b3506f4524b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 22 Nov 2018 03:33:05 -0800 Subject: [PATCH 214/223] test: add information to assertion test-fs-stat-bigint.js failed once in CI but there wasn't enough information to know what was giong on. Adding a bit of information to the assertion that failed in case it fails again. PR-URL: https://github.com/nodejs/node/pull/24566 Refs: https://github.com/nodejs/node/issues/24565 Reviewed-By: Anna Henningsen Reviewed-By: Daniel Bevenius --- test/parallel/test-fs-stat-bigint.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-fs-stat-bigint.js b/test/parallel/test-fs-stat-bigint.js index 4691b2dd9d267e..e5c21138a2ffe4 100644 --- a/test/parallel/test-fs-stat-bigint.js +++ b/test/parallel/test-fs-stat-bigint.js @@ -7,6 +7,7 @@ const promiseFs = require('fs').promises; const path = require('path'); const tmpdir = require('../common/tmpdir'); const { isDate } = require('util').types; +const { inspect } = require('util'); tmpdir.refresh(); @@ -62,7 +63,11 @@ function verifyStats(bigintStats, numStats) { assert.strictEqual(bigintStats[key], undefined); assert.strictEqual(numStats[key], undefined); } else if (Number.isSafeInteger(val)) { - assert.strictEqual(bigintStats[key], BigInt(val)); + assert.strictEqual( + bigintStats[key], BigInt(val), + `${inspect(bigintStats[key])} !== ${inspect(BigInt(val))}\n` + + `key=${key}, val=${val}` + ); } else { assert( Math.abs(Number(bigintStats[key]) - val) < 1, From 4ffc1e636497fc2b2d27a77546a2a0d1aa2b39d1 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:09:06 +0530 Subject: [PATCH 215/223] test: replace anonymous function with arrow PR-URL: https://github.com/nodejs/node/pull/24526 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-pipe-file-to-http.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index 3d326a77a49bc7..4bc71069da413f 100644 --- a/test/parallel/test-pipe-file-to-http.js +++ b/test/parallel/test-pipe-file-to-http.js @@ -32,20 +32,20 @@ tmpdir.refresh(); const filename = path.join(tmpdir.path || '/tmp', 'big'); let count = 0; -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { let timeoutId; assert.strictEqual(req.method, 'POST'); req.pause(); - setTimeout(function() { + setTimeout(() => { req.resume(); }, 1000); - req.on('data', function(chunk) { + req.on('data', (chunk) => { count += chunk.length; }); - req.on('end', function() { + req.on('end', () => { if (timeoutId) { clearTimeout(timeoutId); } @@ -55,7 +55,7 @@ const server = http.createServer(function(req, res) { }); server.listen(0); -server.on('listening', function() { +server.on('listening', () => { common.createZeroFilledFile(filename); makeRequest(); }); @@ -73,14 +73,14 @@ function makeRequest() { assert.ifError(err); })); - req.on('response', function(res) { + req.on('response', (res) => { res.resume(); - res.on('end', function() { + res.on('end', () => { server.close(); }); }); } -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(count, 1024 * 10240); }); From af6de291d73204ae70fc93654e66cc6e8fb75e19 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:17:42 +0530 Subject: [PATCH 216/223] test: replace anonymous function with arrow PR-URL: https://github.com/nodejs/node/pull/24527 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- test/parallel/test-tls-peer-certificate-encoding.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-tls-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 19c7cde42cdc16..154c31c0a1386b 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -35,14 +35,14 @@ const options = { ca: [ fixtures.readKey('ca2-cert.pem') ] }; -const server = tls.createServer(options, function(cleartext) { +const server = tls.createServer(options, (cleartext) => { cleartext.end('World'); }); server.listen(0, common.mustCall(function() { const socket = tls.connect({ port: this.address().port, rejectUnauthorized: false - }, common.mustCall(function() { + }, common.mustCall(() => { const peerCert = socket.getPeerCertificate(); console.error(util.inspect(peerCert)); From c65063d7106590b740d760de67873f4d2ceb03ec Mon Sep 17 00:00:00 2001 From: potham Date: Wed, 21 Nov 2018 00:36:10 +0530 Subject: [PATCH 217/223] test: replace callback with arrow function PR-URL: https://github.com/nodejs/node/pull/24531 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig --- test/parallel/test-child-process-kill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-kill.js b/test/parallel/test-child-process-kill.js index 6f986c0ffa932f..00aab44dd1318d 100644 --- a/test/parallel/test-child-process-kill.js +++ b/test/parallel/test-child-process-kill.js @@ -29,7 +29,7 @@ cat.stdout.on('end', common.mustCall()); cat.stderr.on('data', common.mustNotCall()); cat.stderr.on('end', common.mustCall()); -cat.on('exit', common.mustCall(function(code, signal) { +cat.on('exit', common.mustCall((code, signal) => { assert.strictEqual(code, null); assert.strictEqual(signal, 'SIGTERM'); })); From 8efb16ad52e121f50e0a049dcbd27f316cbba900 Mon Sep 17 00:00:00 2001 From: sreepurnajasti Date: Tue, 20 Nov 2018 12:49:01 +0530 Subject: [PATCH 218/223] test: replace callback with arrow functions PR-URL: https://github.com/nodejs/node/pull/24541 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/pummel/test-net-throttle.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js index acd8e0cc003547..190c242d6e1636 100644 --- a/test/pummel/test-net-throttle.js +++ b/test/pummel/test-net-throttle.js @@ -34,7 +34,7 @@ const body = 'C'.repeat(N); console.log(`start server on port ${common.PORT}`); -const server = net.createServer(function(connection) { +const server = net.createServer((connection) => { connection.write(body.slice(0, part_N)); connection.write(body.slice(part_N, 2 * part_N)); assert.strictEqual(connection.write(body.slice(2 * part_N, N)), false); @@ -44,11 +44,11 @@ const server = net.createServer(function(connection) { connection.end(); }); -server.listen(common.PORT, function() { +server.listen(common.PORT, () => { let paused = false; const client = net.createConnection(common.PORT); client.setEncoding('ascii'); - client.on('data', function(d) { + client.on('data', (d) => { chars_recved += d.length; console.log(`got ${chars_recved}`); if (!paused) { @@ -57,7 +57,7 @@ server.listen(common.PORT, function() { paused = true; console.log('pause'); const x = chars_recved; - setTimeout(function() { + setTimeout(() => { assert.strictEqual(chars_recved, x); client.resume(); console.log('resume'); @@ -66,14 +66,14 @@ server.listen(common.PORT, function() { } }); - client.on('end', function() { + client.on('end', () => { server.close(); client.end(); }); }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(chars_recved, N); assert.strictEqual(npauses > 2, true); }); From 559ca1c3c3f0e6fdfb466e1574973f363a8f5e27 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Tue, 20 Nov 2018 22:49:51 +0800 Subject: [PATCH 219/223] test: fix test case in test-child-process-fork-dgram.js PR-URL: https://github.com/nodejs/node/pull/24459 Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/parallel/test-child-process-fork-dgram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index a25b4ad1186821..6552a162636aa8 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -70,7 +70,7 @@ if (process.argv[2] === 'child') { child.on('message', (msg) => { if (msg === 'gotMessage') { childGotMessage = true; - } else if (msg = 'handlReceived') { + } else if (msg === 'handleReceived') { sendMessages(); } }); From 106a1a159091a7ea8f46aecf0125b2d8876e94ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Sat, 17 Nov 2018 16:38:44 -0500 Subject: [PATCH 220/223] test: use destructuring on require PR-URL: https://github.com/nodejs/node/pull/24455 Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen --- .../test-tick-processor-polyfill-brokenfile.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js index d0a6eb9f81806e..f61bdbe9a12510 100644 --- a/test/tick-processor/test-tick-processor-polyfill-brokenfile.js +++ b/test/tick-processor/test-tick-processor-polyfill-brokenfile.js @@ -17,9 +17,9 @@ if (isCPPSymbolsNotMapped) { const assert = require('assert'); -const cp = require('child_process'); +const { spawn, spawnSync } = require('child_process'); const path = require('path'); -const fs = require('fs'); +const { writeFileSync } = require('fs'); const LOG_FILE = path.join(tmpdir.path, 'tick-processor.log'); const RETRY_TIMEOUT = 150; @@ -33,7 +33,7 @@ const code = `function f() { }; f();`; -const proc = cp.spawn(process.execPath, [ +const proc = spawn(process.execPath, [ '--no_logfile_per_isolate', '--logfile=-', '--prof', @@ -49,8 +49,8 @@ proc.stdout.on('data', (chunk) => ticks += chunk); function runPolyfill(content) { proc.kill(); content += BROKEN_PART; - fs.writeFileSync(LOG_FILE, content); - const child = cp.spawnSync( + writeFileSync(LOG_FILE, content); + const child = spawnSync( `${process.execPath}`, [ '--prof-process', LOG_FILE From adb5d4feea9d7221d0e33f9da2a1cd048c597e9b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 13 Dec 2018 22:58:39 -0800 Subject: [PATCH 221/223] test: mark test-cli-node-options flaky on arm Refs: https://github.com/nodejs/node/issues/25028 PR-URL: https://github.com/nodejs/node/pull/25032 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Daijiro Wachi --- test/parallel/parallel.status | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index b45e4448d97c06..208fe2e8ca8ba3 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -18,6 +18,8 @@ test-worker-syntax-error-file: PASS,FLAKY [$system==macos] [$arch==arm || $arch==arm64] +# https://github.com/nodejs/node/issues/25028 +test-cli-node-options: PASS,FLAKY [$system==solaris] # Also applies to SmartOS From 297c9d1aa9dd97692a33e9c1e863ea9d053c6d58 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 15 Jan 2019 09:33:39 -0800 Subject: [PATCH 222/223] 2019-01-29, Version 10.15.1 'Dubnium' (LTS) * doc: * add oyyd to collaborators (Ouyang Yadong) [#24300](https://github.com/nodejs/node/pull/24300) * tls: * throw if protocol too long (Andre Jodat-Danbrani) [#23606](https://github.com/nodejs/node/pull/23606) PR-URL: https://github.com/nodejs/node/pull/25346 --- CHANGELOG.md | 3 +- doc/changelogs/CHANGELOG_V10.md | 236 ++++++++++++++++++++++++++++++++ src/node_version.h | 2 +- 3 files changed, 239 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5482c756de5422..5a6db4ac97f80b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,8 @@ release. -10.15.0
+10.15.1
+10.15.0
10.14.2
10.14.1
10.14.0
diff --git a/doc/changelogs/CHANGELOG_V10.md b/doc/changelogs/CHANGELOG_V10.md index 9a3c2920a356f6..067020f5c76992 100644 --- a/doc/changelogs/CHANGELOG_V10.md +++ b/doc/changelogs/CHANGELOG_V10.md @@ -10,6 +10,7 @@ +10.15.1
10.15.0
10.14.2
10.14.1
@@ -48,6 +49,241 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2019-01-29, Version 10.15.1 'Dubnium' (LTS), @codebytere + +### Notable Changes + +* **doc**: + * add oyyd to collaborators (Ouyang Yadong) [#24300](https://github.com/nodejs/node/pull/24300) + +* **tls**: + * throw if protocol too long (Andre Jodat-Danbrani) [#23606](https://github.com/nodejs/node/pull/23606) + +### Commits + +* [[`fbf5321dcf`](https://github.com/nodejs/node/commit/fbf5321dcf)] - **async_hooks**: add HandleScopes to C++ embedder/addon API (Anna Henningsen) [#24285](https://github.com/nodejs/node/pull/24285) +* [[`0c206e0d6d`](https://github.com/nodejs/node/commit/0c206e0d6d)] - **benchmark**: support more options in startup benchmark (Joyee Cheung) [#24220](https://github.com/nodejs/node/pull/24220) +* [[`9a64ceca39`](https://github.com/nodejs/node/commit/9a64ceca39)] - **buffer**: fix writeUInt16BE range check (Brian White) [#24208](https://github.com/nodejs/node/pull/24208) +* [[`0b81054d17`](https://github.com/nodejs/node/commit/0b81054d17)] - **build**: fix Python detection when depot\_tools are in PATH in Windows (Guy Bedford) [#22539](https://github.com/nodejs/node/pull/22539) +* [[`b61a51c4f5`](https://github.com/nodejs/node/commit/b61a51c4f5)] - **build**: remove sudo:false from .travis.yml (Rich Trott) [#24511](https://github.com/nodejs/node/pull/24511) +* [[`5c3736a772`](https://github.com/nodejs/node/commit/5c3736a772)] - **build**: use print() function in configure.py (cclauss) [#24484](https://github.com/nodejs/node/pull/24484) +* [[`5d2dadccff`](https://github.com/nodejs/node/commit/5d2dadccff)] - **build**: check minimum ICU in configure for system-icu (Steven R. Loomis) [#24255](https://github.com/nodejs/node/pull/24255) +* [[`31376d9a97`](https://github.com/nodejs/node/commit/31376d9a97)] - **build**: remove unnecessary prerequisite in Makefile (Rich Trott) [#24342](https://github.com/nodejs/node/pull/24342) +* [[`33fd13c5ce`](https://github.com/nodejs/node/commit/33fd13c5ce)] - **build**: fix benchmark tests on CI (Rich Trott) [#24307](https://github.com/nodejs/node/pull/24307) +* [[`07b7db2f81`](https://github.com/nodejs/node/commit/07b7db2f81)] - **build**: use BUILDTYPE in bench-addons-build targets (Daniel Bevenius) [#24033](https://github.com/nodejs/node/pull/24033) +* [[`4e21eb4004`](https://github.com/nodejs/node/commit/4e21eb4004)] - **build**: lint commit message in separate Travis job (Richard Lau) [#24254](https://github.com/nodejs/node/pull/24254) +* [[`042749fd23`](https://github.com/nodejs/node/commit/042749fd23)] - **build**: only try to find node when it's needed by the target (Joyee Cheung) [#24115](https://github.com/nodejs/node/pull/24115) +* [[`72d2d2cd8e`](https://github.com/nodejs/node/commit/72d2d2cd8e)] - **build**: expose more openssl categories for addons (Jonathan Cardoso Machado) [#23344](https://github.com/nodejs/node/pull/23344) +* [[`dc5647f71b`](https://github.com/nodejs/node/commit/dc5647f71b)] - **build,tools**: update make-v8.sh for ppc64le (Refael Ackermann) [#24293](https://github.com/nodejs/node/pull/24293) +* [[`5dfc1bb46c`](https://github.com/nodejs/node/commit/5dfc1bb46c)] - **build,tools**: update make-v8.sh for s390x (Refael Ackermann) [#23839](https://github.com/nodejs/node/pull/23839) +* [[`04f8d6bffd`](https://github.com/nodejs/node/commit/04f8d6bffd)] - **child_process**: allow 'http\_parser' monkey patching again (Jimb Esser) [#24006](https://github.com/nodejs/node/pull/24006) +* [[`3ef68d8d97`](https://github.com/nodejs/node/commit/3ef68d8d97)] - **cli**: add missing env vars to --help (cjihrig) [#24383](https://github.com/nodejs/node/pull/24383) +* [[`4f13ac7941`](https://github.com/nodejs/node/commit/4f13ac7941)] - **console**: improve code readability (gengjiawen) [#24412](https://github.com/nodejs/node/pull/24412) +* [[`07b9a663e0`](https://github.com/nodejs/node/commit/07b9a663e0)] - **console**: cover .assert with single argument (Morgan Roderick) [#24188](https://github.com/nodejs/node/pull/24188) +* [[`4749640b2e`](https://github.com/nodejs/node/commit/4749640b2e)] - **crypto**: reduce memory usage of SignFinal (Tobias Nießen) [#23427](https://github.com/nodejs/node/pull/23427) +* [[`733cb1ef84`](https://github.com/nodejs/node/commit/733cb1ef84)] - **deps**: cherry-pick b87d408 from upstream V8 (Peter Marshall) [#24272](https://github.com/nodejs/node/pull/24272) +* [[`17b55bf1a4`](https://github.com/nodejs/node/commit/17b55bf1a4)] - **deps**: V8: cherry-pick 52a9e67 (Ali Ijaz Sheikh) [#25027](https://github.com/nodejs/node/pull/25027) +* [[`185ccedf7c`](https://github.com/nodejs/node/commit/185ccedf7c)] - **doc**: clarify who may land on an LTS staging branch (Myles Borins) [#24465](https://github.com/nodejs/node/pull/24465) +* [[`3283186934`](https://github.com/nodejs/node/commit/3283186934)] - **doc**: revise `author ready` explanation (Rich Trott) [#24558](https://github.com/nodejs/node/pull/24558) +* [[`f918ad8e98`](https://github.com/nodejs/node/commit/f918ad8e98)] - **doc**: add readable and writable property to Readable and Writable (Dexter Leng) [#23933](https://github.com/nodejs/node/pull/23933) +* [[`d288a395f6`](https://github.com/nodejs/node/commit/d288a395f6)] - **doc**: move trott to tsc emeritus (Rich Trott) [#24492](https://github.com/nodejs/node/pull/24492) +* [[`f0602f8df3`](https://github.com/nodejs/node/commit/f0602f8df3)] - **doc**: add Ruben Bridgewater to release team (Ruben Bridgewater) [#23432](https://github.com/nodejs/node/pull/23432) +* [[`b1bbedd701`](https://github.com/nodejs/node/commit/b1bbedd701)] - **doc**: edit COLLABORATOR\_GUIDE.md on closing issues (Rich Trott) [#24477](https://github.com/nodejs/node/pull/24477) +* [[`08284dcdd8`](https://github.com/nodejs/node/commit/08284dcdd8)] - **doc**: move Timothy to TSC emeritus (Timothy Gu) [#24535](https://github.com/nodejs/node/pull/24535) +* [[`6bb860cd20`](https://github.com/nodejs/node/commit/6bb860cd20)] - **doc**: add NODE\_DEBUG\_NATIVE to API docs (cjihrig) [#24383](https://github.com/nodejs/node/pull/24383) +* [[`ef1056f4bd`](https://github.com/nodejs/node/commit/ef1056f4bd)] - **doc**: add missing env variables to man page (cjihrig) [#24383](https://github.com/nodejs/node/pull/24383) +* [[`40c9ee028b`](https://github.com/nodejs/node/commit/40c9ee028b)] - **doc**: minor cleanup of tls.getProtocol() (Sam Roberts) [#24533](https://github.com/nodejs/node/pull/24533) +* [[`c16b93233c`](https://github.com/nodejs/node/commit/c16b93233c)] - **doc**: add Beth Griggs to release team (Beth Griggs) [#24532](https://github.com/nodejs/node/pull/24532) +* [[`492e2a4d11`](https://github.com/nodejs/node/commit/492e2a4d11)] - **doc**: add filehandle.write(string\[, position\[, encoding\]\]) (Dara Hayes) [#23224](https://github.com/nodejs/node/pull/23224) +* [[`a620c25c76`](https://github.com/nodejs/node/commit/a620c25c76)] - **doc**: udpate list item spacing in changelogs (Rich Trott) [#24391](https://github.com/nodejs/node/pull/24391) +* [[`7fd4ef7df1`](https://github.com/nodejs/node/commit/7fd4ef7df1)] - **doc**: update crypto examples to not use deprecated api (Mayank Asthana) [#24107](https://github.com/nodejs/node/pull/24107) +* [[`2734c20bd9`](https://github.com/nodejs/node/commit/2734c20bd9)] - **doc**: simplify first-time contributors section of Collaborator Guide (Rich Trott) [#24387](https://github.com/nodejs/node/pull/24387) +* [[`e11d46cb84`](https://github.com/nodejs/node/commit/e11d46cb84)] - **doc**: adjusting formatting when printing (Thomas Hunter II) [#24325](https://github.com/nodejs/node/pull/24325) +* [[`c19d6e26a3`](https://github.com/nodejs/node/commit/c19d6e26a3)] - **doc**: better linkage to node-addon-api (Michael Dawson) [#24371](https://github.com/nodejs/node/pull/24371) +* [[`ae3a19486f`](https://github.com/nodejs/node/commit/ae3a19486f)] - **doc**: update collaborator guide with LTS labels (Charalampos Fanoulis) [#24379](https://github.com/nodejs/node/pull/24379) +* [[`e111d71e60`](https://github.com/nodejs/node/commit/e111d71e60)] - **doc**: document http request.finished boolean (Thomas Watson) [#24319](https://github.com/nodejs/node/pull/24319) +* [[`1ca3c9d3e2`](https://github.com/nodejs/node/commit/1ca3c9d3e2)] - **doc**: document NODE\_TLS\_REJECT\_UNAUTHORIZED (cjihrig) [#24289](https://github.com/nodejs/node/pull/24289) +* [[`68aecff860`](https://github.com/nodejs/node/commit/68aecff860)] - **doc**: clarify issues and pull requests guidance (Rich Trott) [#24316](https://github.com/nodejs/node/pull/24316) +* [[`ac3e264f1c`](https://github.com/nodejs/node/commit/ac3e264f1c)] - **doc**: fix comma splices in process.md (Rich Trott) [#24357](https://github.com/nodejs/node/pull/24357) +* [[`672879f406`](https://github.com/nodejs/node/commit/672879f406)] - **doc**: use real protocol names in ALPN example (Sam Roberts) [#24232](https://github.com/nodejs/node/pull/24232) +* [[`8a60798f4c`](https://github.com/nodejs/node/commit/8a60798f4c)] - **doc**: update core-validate-commit url (Daijiro Wachi) [#24331](https://github.com/nodejs/node/pull/24331) +* [[`a9a6cb1b06`](https://github.com/nodejs/node/commit/a9a6cb1b06)] - **doc**: fix echo example programs (Sam Roberts) [#24235](https://github.com/nodejs/node/pull/24235) +* [[`90f3f5e88f`](https://github.com/nodejs/node/commit/90f3f5e88f)] - **doc**: clarify allowed encoding parameter types (Sam Roberts) [#24230](https://github.com/nodejs/node/pull/24230) +* [[`4209e122b7`](https://github.com/nodejs/node/commit/4209e122b7)] - **doc**: correct async\_hooks resource names (Gerhard Stoebich) [#24001](https://github.com/nodejs/node/pull/24001) +* [[`d2cc9d72b6`](https://github.com/nodejs/node/commit/d2cc9d72b6)] - **doc**: sort bottom-of-file markdown links (Sam Roberts) [#24679](https://github.com/nodejs/node/pull/24679) +* [[`b4c1d8273c`](https://github.com/nodejs/node/commit/b4c1d8273c)] - **doc**: update fs.open() changes record for optional 'flags' (Rod Vagg) [#24240](https://github.com/nodejs/node/pull/24240) +* [[`cf209171c9`](https://github.com/nodejs/node/commit/cf209171c9)] - **doc**: add links to Stream section (Dmitry Igrishin) [#24301](https://github.com/nodejs/node/pull/24301) +* [[`0260db525a`](https://github.com/nodejs/node/commit/0260db525a)] - **doc**: correct async\_hooks sample outputs (Gerhard Stoebich) [#24050](https://github.com/nodejs/node/pull/24050) +* [[`c8d2635ed1`](https://github.com/nodejs/node/commit/c8d2635ed1)] - **doc**: add oyyd to collaborators (Ouyang Yadong) [#24300](https://github.com/nodejs/node/pull/24300) +* [[`b305db8634`](https://github.com/nodejs/node/commit/b305db8634)] - **doc**: edit BUILDING.md (Rich Trott) [#24243](https://github.com/nodejs/node/pull/24243) +* [[`abe3edad48`](https://github.com/nodejs/node/commit/abe3edad48)] - **doc**: fix code examples in stream.md (Grant Carthew) [#24112](https://github.com/nodejs/node/pull/24112) +* [[`31441f42c4`](https://github.com/nodejs/node/commit/31441f42c4)] - **doc**: describe what tls servername is for (Sam Roberts) [#24236](https://github.com/nodejs/node/pull/24236) +* [[`cc688bb23f`](https://github.com/nodejs/node/commit/cc688bb23f)] - **doc**: fix some inconsistent use of hostname (Sam Roberts) [#24199](https://github.com/nodejs/node/pull/24199) +* [[`6f3bc0d28a`](https://github.com/nodejs/node/commit/6f3bc0d28a)] - **doc, test**: document and test vm timeout escapes (James M Snell) [#23743](https://github.com/nodejs/node/pull/23743) +* [[`ef8c1deda6`](https://github.com/nodejs/node/commit/ef8c1deda6)] - **doc,meta**: update PR approving info (Vse Mozhet Byt) [#24561](https://github.com/nodejs/node/pull/24561) +* [[`be56fb7ab9`](https://github.com/nodejs/node/commit/be56fb7ab9)] - **events**: extract listener check as a function (ZYSzys) [#24303](https://github.com/nodejs/node/pull/24303) +* [[`4a16a4da45`](https://github.com/nodejs/node/commit/4a16a4da45)] - **fs**: inline typeof check (dexterleng) [#24390](https://github.com/nodejs/node/pull/24390) +* [[`35d2397ae5`](https://github.com/nodejs/node/commit/35d2397ae5)] - **http**: remove obsolete function escapeHeaderValue (Lauri Piisang) [#24173](https://github.com/nodejs/node/pull/24173) +* [[`8df4a168b3`](https://github.com/nodejs/node/commit/8df4a168b3)] - **http2**: replace unreachable error with assertion (Rich Trott) [#24407](https://github.com/nodejs/node/pull/24407) +* [[`5516fbf1d7`](https://github.com/nodejs/node/commit/5516fbf1d7)] - **http2**: order declarations in http2.js (ZYSzys) [#24411](https://github.com/nodejs/node/pull/24411) +* [[`5e3c6799cb`](https://github.com/nodejs/node/commit/5e3c6799cb)] - **http2**: elevate v8 namespaces of repeated references (Gagandeep Singh) [#24453](https://github.com/nodejs/node/pull/24453) +* [[`4246a40b30`](https://github.com/nodejs/node/commit/4246a40b30)] - **lib**: move encodeStr function to internal for reusable (ZYSzys) [#24242](https://github.com/nodejs/node/pull/24242) +* [[`6bd055f7de`](https://github.com/nodejs/node/commit/6bd055f7de)] - **lib**: refactor setupInspector in bootstrap/node.js (leeight) [#24446](https://github.com/nodejs/node/pull/24446) +* [[`62a5679ca3`](https://github.com/nodejs/node/commit/62a5679ca3)] - **lib**: set stderr.\_destroy to dummyDestroy (Joyee Cheung) [#24398](https://github.com/nodejs/node/pull/24398) +* [[`3450a4c536`](https://github.com/nodejs/node/commit/3450a4c536)] - **lib**: gather all errors constant in the same place for consistency (ZYSzys) [#24038](https://github.com/nodejs/node/pull/24038) +* [[`5c2c5b9094`](https://github.com/nodejs/node/commit/5c2c5b9094)] - **lib**: improved conditional check in zlib (Dan Corman) [#24190](https://github.com/nodejs/node/pull/24190) +* [[`7527632235`](https://github.com/nodejs/node/commit/7527632235)] - **lib**: adjust params from uvExceptionWithHostPort (msmichellegar) [#24159](https://github.com/nodejs/node/pull/24159) +* [[`3966b698f6`](https://github.com/nodejs/node/commit/3966b698f6)] - **lib**: combine contructor, tag, Object into a function (Paul Isache) [#24171](https://github.com/nodejs/node/pull/24171) +* [[`c84b420457`](https://github.com/nodejs/node/commit/c84b420457)] - ***Revert*** "**net**: partially revert "simplify Socket.prototype.\_final"" (Anna Henningsen) [#24290](https://github.com/nodejs/node/pull/24290) +* [[`0c2d1d57e8`](https://github.com/nodejs/node/commit/0c2d1d57e8)] - **net**: add comments explaining error check (Steven Gabarro) [#24222](https://github.com/nodejs/node/pull/24222) +* [[`2d0105c751`](https://github.com/nodejs/node/commit/2d0105c751)] - **net**: remove unreachable check in internalConnect (Philipp Dunkel) [#24158](https://github.com/nodejs/node/pull/24158) +* [[`897114bf94`](https://github.com/nodejs/node/commit/897114bf94)] - **net**: partially revert "simplify Socket.prototype.\_final" (Anna Henningsen) [#24288](https://github.com/nodejs/node/pull/24288) +* [[`10a27277ad`](https://github.com/nodejs/node/commit/10a27277ad)] - **net**: simplify Socket.prototype.\_final (Anna Henningsen) [#24075](https://github.com/nodejs/node/pull/24075) +* [[`b7876ba6e1`](https://github.com/nodejs/node/commit/b7876ba6e1)] - **src**: elevate namespaces for repeated entities (Sarath Govind K K) [#24475](https://github.com/nodejs/node/pull/24475) +* [[`4b82aa80fe`](https://github.com/nodejs/node/commit/4b82aa80fe)] - **src**: elevate namespaces of repeated artifacts (Maya Anilson) [#24429](https://github.com/nodejs/node/pull/24429) +* [[`bfde244576`](https://github.com/nodejs/node/commit/bfde244576)] - **src**: elevate repeated use of v8 namespaced type (Shubham Urkade) [#24427](https://github.com/nodejs/node/pull/24427) +* [[`be14283bcd`](https://github.com/nodejs/node/commit/be14283bcd)] - **src**: use smart pointers in cares\_wrap.cc (Daniel Bevenius) [#23813](https://github.com/nodejs/node/pull/23813) +* [[`fa52ba621b`](https://github.com/nodejs/node/commit/fa52ba621b)] - **src**: elevate v8 namespaces of referenced artifacts (Kanika Singhal) [#24424](https://github.com/nodejs/node/pull/24424) +* [[`9a69d030ce`](https://github.com/nodejs/node/commit/9a69d030ce)] - **src**: reuse std::make\_unique (alyssaq) [#24132](https://github.com/nodejs/node/pull/24132) +* [[`44a1993e9d`](https://github.com/nodejs/node/commit/44a1993e9d)] - **src**: avoid extra `Persistent` in `DefaultTriggerAsyncIdScope` (Anna Henningsen) [#23844](https://github.com/nodejs/node/pull/23844) +* [[`15d05bbf02`](https://github.com/nodejs/node/commit/15d05bbf02)] - **src**: simplify `TimerFunctionCall()` in `node\_perf.cc` (Anna Henningsen) [#23782](https://github.com/nodejs/node/pull/23782) +* [[`383d512ed7`](https://github.com/nodejs/node/commit/383d512ed7)] - **src**: memory management using smart pointer (Uttam Pawar) [#23628](https://github.com/nodejs/node/pull/23628) +* [[`ffb4087def`](https://github.com/nodejs/node/commit/ffb4087def)] - **src**: remove function hasTextDecoder in encoding.js (Chi-chi Wang) [#23625](https://github.com/nodejs/node/pull/23625) +* [[`fa60eb83be`](https://github.com/nodejs/node/commit/fa60eb83be)] - **stream**: correctly pause and resume after once('readable') (Matteo Collina) [#24366](https://github.com/nodejs/node/pull/24366) +* [[`a7c1d0908a`](https://github.com/nodejs/node/commit/a7c1d0908a)] - **stream**: do not use crypto.DEFAULT\_ENCODING in lazy\_transform.js (Joyee Cheung) [#24396](https://github.com/nodejs/node/pull/24396) +* [[`965098a8ca`](https://github.com/nodejs/node/commit/965098a8ca)] - **stream**: change comment on duplex stream options (Jesse W. Collins) [#24247](https://github.com/nodejs/node/pull/24247) +* [[`6ce4ef3387`](https://github.com/nodejs/node/commit/6ce4ef3387)] - **stream**: make `.destroy()` interact better with write queue (Anna Henningsen) [#24062](https://github.com/nodejs/node/pull/24062) +* [[`bdab2e98f1`](https://github.com/nodejs/node/commit/bdab2e98f1)] - **test**: mark test-cli-node-options flaky on arm (Rich Trott) [#25032](https://github.com/nodejs/node/pull/25032) +* [[`e5c4759eab`](https://github.com/nodejs/node/commit/e5c4759eab)] - **test**: use destructuring on require (Juan José Arboleda) [#24455](https://github.com/nodejs/node/pull/24455) +* [[`cb860870cd`](https://github.com/nodejs/node/commit/cb860870cd)] - **test**: fix test case in test-child-process-fork-dgram.js (gengjiawen) [#24459](https://github.com/nodejs/node/pull/24459) +* [[`9d7cb1f6d7`](https://github.com/nodejs/node/commit/9d7cb1f6d7)] - **test**: replace callback with arrow functions (sreepurnajasti) [#24541](https://github.com/nodejs/node/pull/24541) +* [[`a9795f701d`](https://github.com/nodejs/node/commit/a9795f701d)] - **test**: replace callback with arrow function (potham) [#24531](https://github.com/nodejs/node/pull/24531) +* [[`088b0db932`](https://github.com/nodejs/node/commit/088b0db932)] - **test**: replace anonymous function with arrow (Gagandeep Singh) [#24527](https://github.com/nodejs/node/pull/24527) +* [[`083925def0`](https://github.com/nodejs/node/commit/083925def0)] - **test**: replace anonymous function with arrow (Gagandeep Singh) [#24526](https://github.com/nodejs/node/pull/24526) +* [[`95ba7615d1`](https://github.com/nodejs/node/commit/95ba7615d1)] - **test**: add information to assertion (Rich Trott) [#24566](https://github.com/nodejs/node/pull/24566) +* [[`313eaf958d`](https://github.com/nodejs/node/commit/313eaf958d)] - **test**: replace anonymous function with arrow func (Gagandeep Singh) [#24525](https://github.com/nodejs/node/pull/24525) +* [[`6b904f6799`](https://github.com/nodejs/node/commit/6b904f6799)] - **test**: change anonymous closure function to arrow function (Nethra Ravindran) [#24433](https://github.com/nodejs/node/pull/24433) +* [[`46e63a2a78`](https://github.com/nodejs/node/commit/46e63a2a78)] - **test**: replace closure functions with arrow functions (Gagandeep Singh) [#24522](https://github.com/nodejs/node/pull/24522) +* [[`8e6729bb82`](https://github.com/nodejs/node/commit/8e6729bb82)] - **test**: replace anonymous function with arrow function (Gagandeep Singh) [#24529](https://github.com/nodejs/node/pull/24529) +* [[`54abfda5d3`](https://github.com/nodejs/node/commit/54abfda5d3)] - **test**: favor arrow function in callback (Pranay Kothapalli) [#24542](https://github.com/nodejs/node/pull/24542) +* [[`d82c0de250`](https://github.com/nodejs/node/commit/d82c0de250)] - **test**: remove unused reject handlers (Dan Foley) [#24540](https://github.com/nodejs/node/pull/24540) +* [[`e0a11142b4`](https://github.com/nodejs/node/commit/e0a11142b4)] - **test**: refactor test to use arrow functions (sagirk) [#24479](https://github.com/nodejs/node/pull/24479) +* [[`7dd64858c2`](https://github.com/nodejs/node/commit/7dd64858c2)] - **test**: replace closure with arrow function (Maya Anilson) [#24489](https://github.com/nodejs/node/pull/24489) +* [[`d71a607a09`](https://github.com/nodejs/node/commit/d71a607a09)] - **test**: using arrow functions (NoSkillGirl) [#24436](https://github.com/nodejs/node/pull/24436) +* [[`5b1fd6e246`](https://github.com/nodejs/node/commit/5b1fd6e246)] - **test**: replace anonymous closure with arrow func (suman-mitra) [#24480](https://github.com/nodejs/node/pull/24480) +* [[`b7b6c12510`](https://github.com/nodejs/node/commit/b7b6c12510)] - **test**: replace callback with arrow functions (sreepurnajasti) [#24490](https://github.com/nodejs/node/pull/24490) +* [[`e02d553f7b`](https://github.com/nodejs/node/commit/e02d553f7b)] - **test**: replcae anonymous closure with arrow function (Sarath Govind K K) [#24476](https://github.com/nodejs/node/pull/24476) +* [[`351e69d5c5`](https://github.com/nodejs/node/commit/351e69d5c5)] - **test**: refactor test-http-write-empty-string to use arrow functions (sagirk) [#24483](https://github.com/nodejs/node/pull/24483) +* [[`d245f53db4`](https://github.com/nodejs/node/commit/d245f53db4)] - **test**: replace anonymous closure with arrow functions (suman-mitra) [#24481](https://github.com/nodejs/node/pull/24481) +* [[`8734c679f8`](https://github.com/nodejs/node/commit/8734c679f8)] - **test**: add whatwg-encoding TextDecoder custom inspection with showHidden (ZauberNerd) [#24166](https://github.com/nodejs/node/pull/24166) +* [[`7920e7bfb4`](https://github.com/nodejs/node/commit/7920e7bfb4)] - **test**: replace anonymous closure functions with arrow functions (sagirk) [#24478](https://github.com/nodejs/node/pull/24478) +* [[`283a6b86bb`](https://github.com/nodejs/node/commit/283a6b86bb)] - **test**: replace anonymous closure functions with arrow function (Abhishek Dixit) [#24420](https://github.com/nodejs/node/pull/24420) +* [[`66c3dcab72`](https://github.com/nodejs/node/commit/66c3dcab72)] - **test**: replace anonymous closure with arrow funct (Prabu Subra) [#24439](https://github.com/nodejs/node/pull/24439) +* [[`e7d41c0312`](https://github.com/nodejs/node/commit/e7d41c0312)] - **test**: modify order of parameters for assertion (Mrityunjoy Saha) [#24430](https://github.com/nodejs/node/pull/24430) +* [[`164069cdb0`](https://github.com/nodejs/node/commit/164069cdb0)] - **test**: replace closure with arrow functions (kanishk30) [#24440](https://github.com/nodejs/node/pull/24440) +* [[`f129e2c063`](https://github.com/nodejs/node/commit/f129e2c063)] - **test**: replace anonymous closure function with arrow function (Kunda Sunil Kumar) [#24435](https://github.com/nodejs/node/pull/24435) +* [[`94553b2ea5`](https://github.com/nodejs/node/commit/94553b2ea5)] - **test**: add typeerror test for EC crypto keygen (Matteo) [#24400](https://github.com/nodejs/node/pull/24400) +* [[`1ec6923276`](https://github.com/nodejs/node/commit/1ec6923276)] - **test**: compare objects not identical by reference (Marie Terrier) [#24189](https://github.com/nodejs/node/pull/24189) +* [[`4425926452`](https://github.com/nodejs/node/commit/4425926452)] - **test**: change anonymous closure functions to arrow functions (Namit Bhalla) [#24418](https://github.com/nodejs/node/pull/24418) +* [[`40773c0f2a`](https://github.com/nodejs/node/commit/40773c0f2a)] - **test**: use print() function on both Python 2 and 3 (cclauss) [#24485](https://github.com/nodejs/node/pull/24485) +* [[`2ffbde3963`](https://github.com/nodejs/node/commit/2ffbde3963)] - **test**: favor arrow functions in callbacks (UjjwalUpadhyay) [#24425](https://github.com/nodejs/node/pull/24425) +* [[`8f7326c369`](https://github.com/nodejs/node/commit/8f7326c369)] - **test**: replace anonymous closure functions with arrow function (Amanpreet) [#24417](https://github.com/nodejs/node/pull/24417) +* [[`644a9d6919`](https://github.com/nodejs/node/commit/644a9d6919)] - **test**: fix arguments order in napi test\_exception (kanishk30) [#24413](https://github.com/nodejs/node/pull/24413) +* [[`abe9778ea4`](https://github.com/nodejs/node/commit/abe9778ea4)] - **test**: fix the arguments order in `assert.strictEqual` (Jay Arthanareeswaran) [#24416](https://github.com/nodejs/node/pull/24416) +* [[`94d200fe46`](https://github.com/nodejs/node/commit/94d200fe46)] - **test**: replace closure with arrow functions (Amanpreet) [#24438](https://github.com/nodejs/node/pull/24438) +* [[`380da0473a`](https://github.com/nodejs/node/commit/380da0473a)] - **test**: change callback function to arrow function (Jay Arthanareeswaran) [#24419](https://github.com/nodejs/node/pull/24419) +* [[`5ad224d6ae`](https://github.com/nodejs/node/commit/5ad224d6ae)] - **test**: fix the arguments order in `assert.strictEqual` (apoorvanand) [#24431](https://github.com/nodejs/node/pull/24431) +* [[`52259d71d6`](https://github.com/nodejs/node/commit/52259d71d6)] - **test**: assertion equality fix (NoSkillGirl) [#24422](https://github.com/nodejs/node/pull/24422) +* [[`2d25cddbc1`](https://github.com/nodejs/node/commit/2d25cddbc1)] - **test**: remove unused function arguments in async-hooks tests (Simon Bruce) [#24406](https://github.com/nodejs/node/pull/24406) +* [[`c29c510b5a`](https://github.com/nodejs/node/commit/c29c510b5a)] - **test**: fix actual parameter order for 'assert.strictEqual' (Selvaraj) [#24428](https://github.com/nodejs/node/pull/24428) +* [[`bf3bed56db`](https://github.com/nodejs/node/commit/bf3bed56db)] - **test**: swap actual&optional params (Nikhil M) [#24426](https://github.com/nodejs/node/pull/24426) +* [[`d2d6287355`](https://github.com/nodejs/node/commit/d2d6287355)] - **test**: skip test that use --tls-v1.x flags (Daniel Bevenius) [#24376](https://github.com/nodejs/node/pull/24376) +* [[`39a561b3bc`](https://github.com/nodejs/node/commit/39a561b3bc)] - **test**: change callback function to arrow function (Lakshmi Shanmugam) [#24421](https://github.com/nodejs/node/pull/24421) +* [[`f4c2d9efbc`](https://github.com/nodejs/node/commit/f4c2d9efbc)] - **test**: replace anonymous closure for test-http-expect-handling.js (Jayasankar) [#24423](https://github.com/nodejs/node/pull/24423) +* [[`cf7bf27325`](https://github.com/nodejs/node/commit/cf7bf27325)] - **test**: replace callback functions with arrow functions (potham) [#24432](https://github.com/nodejs/node/pull/24432) +* [[`518bc9679d`](https://github.com/nodejs/node/commit/518bc9679d)] - **test**: use arrow functions for callbacks (Pushkal B) [#24444](https://github.com/nodejs/node/pull/24444) +* [[`53973fde9d`](https://github.com/nodejs/node/commit/53973fde9d)] - **test**: replace anonymous closure function (Jayasankar) [#24415](https://github.com/nodejs/node/pull/24415) +* [[`555ef65042`](https://github.com/nodejs/node/commit/555ef65042)] - **test**: fixed the arguments order in `assert.strictEqual` (Lakshmi Shanmugam) [#24414](https://github.com/nodejs/node/pull/24414) +* [[`3b6135ff2c`](https://github.com/nodejs/node/commit/3b6135ff2c)] - **test**: use destructuring and remove unused arguments (Julia) [#24375](https://github.com/nodejs/node/pull/24375) +* [[`8c8199211b`](https://github.com/nodejs/node/commit/8c8199211b)] - **test**: https agent clientcertengine coverage (Osmond van Hemert) [#24248](https://github.com/nodejs/node/pull/24248) +* [[`987df276cb`](https://github.com/nodejs/node/commit/987df276cb)] - **test**: remove unused function arguments in async-hooks tests (Rich Trott) [#24368](https://github.com/nodejs/node/pull/24368) +* [[`585db59b0a`](https://github.com/nodejs/node/commit/585db59b0a)] - **test**: add typeerror for vm/compileFunction params (Dan Corman) [#24179](https://github.com/nodejs/node/pull/24179) +* [[`6cad1b6877`](https://github.com/nodejs/node/commit/6cad1b6877)] - **test**: deep object to table not covered (Osmond van Hemert) [#24257](https://github.com/nodejs/node/pull/24257) +* [[`916ead940d`](https://github.com/nodejs/node/commit/916ead940d)] - **test**: add tests for Socket.setNoDelay (James Herrington) [#24250](https://github.com/nodejs/node/pull/24250) +* [[`fbdfd608dd`](https://github.com/nodejs/node/commit/fbdfd608dd)] - **test**: add process no deprecation (razvanbh) [#24196](https://github.com/nodejs/node/pull/24196) +* [[`b29b23546d`](https://github.com/nodejs/node/commit/b29b23546d)] - **test**: fix arguments order in assertions (Emanuel Kluge) [#24149](https://github.com/nodejs/node/pull/24149) +* [[`d4fd76a782`](https://github.com/nodejs/node/commit/d4fd76a782)] - **test**: remove unused parameters in function definition (Paul Hodgson) [#24268](https://github.com/nodejs/node/pull/24268) +* [[`817d871327`](https://github.com/nodejs/node/commit/817d871327)] - **test**: esm loader unknown builtin module (Fran Herrero) [#24183](https://github.com/nodejs/node/pull/24183) +* [[`8728361533`](https://github.com/nodejs/node/commit/8728361533)] - **test**: fixed order of actual and expected arguments (kiyomizumia) [#24178](https://github.com/nodejs/node/pull/24178) +* [[`e21d784cf8`](https://github.com/nodejs/node/commit/e21d784cf8)] - **test**: add else and error case for TextDecoder (Lauri Piisang) [#24162](https://github.com/nodejs/node/pull/24162) +* [[`aba7b47e5c`](https://github.com/nodejs/node/commit/aba7b47e5c)] - **test**: url format path ending hashchar not covered (Osmond van Hemert) [#24259](https://github.com/nodejs/node/pull/24259) +* [[`9970d562c6`](https://github.com/nodejs/node/commit/9970d562c6)] - **test**: test add and remove for lib/domain (Petar Dodev) [#24163](https://github.com/nodejs/node/pull/24163) +* [[`51643c208e`](https://github.com/nodejs/node/commit/51643c208e)] - **test**: fix args order in process-getactiverequests (Vladyslav Kopylash) [#24186](https://github.com/nodejs/node/pull/24186) +* [[`454ede2d90`](https://github.com/nodejs/node/commit/454ede2d90)] - **test**: check control characters replacing (Alessandro Gatti) [#24182](https://github.com/nodejs/node/pull/24182) +* [[`4d1a80363a`](https://github.com/nodejs/node/commit/4d1a80363a)] - **test**: fix v8 Set/Get compiler warnings (Daniel Bevenius) [#24246](https://github.com/nodejs/node/pull/24246) +* [[`a30f5a02b8`](https://github.com/nodejs/node/commit/a30f5a02b8)] - **test**: fix flaky test-vm-timeout-escape-nexttick (Rich Trott) [#24251](https://github.com/nodejs/node/pull/24251) +* [[`1bceb9d397`](https://github.com/nodejs/node/commit/1bceb9d397)] - **test**: fix test-repl-envvars (Anna Henningsen) [#25226](https://github.com/nodejs/node/pull/25226) +* [[`d04c3c2718`](https://github.com/nodejs/node/commit/d04c3c2718)] - **test**: move benchmark tests out of main test suite (Rich Trott) [#24265](https://github.com/nodejs/node/pull/24265) +* [[`09bb49165f`](https://github.com/nodejs/node/commit/09bb49165f)] - **test**: fix strictEqual argument order (Martin Kask) [#24153](https://github.com/nodejs/node/pull/24153) +* [[`704d886000`](https://github.com/nodejs/node/commit/704d886000)] - **test**: correct order of args in assert.strictEqual() (Natalie Cluer) [#24157](https://github.com/nodejs/node/pull/24157) +* [[`63dc2214f9`](https://github.com/nodejs/node/commit/63dc2214f9)] - **test**: add test case for completion bash flag (Aivo Paas) [#24168](https://github.com/nodejs/node/pull/24168) +* [[`dd67f39ae2`](https://github.com/nodejs/node/commit/dd67f39ae2)] - **test**: add test for deepEqual Float32Array (Yehiyam Livneh) [#24164](https://github.com/nodejs/node/pull/24164) +* [[`2359273868`](https://github.com/nodejs/node/commit/2359273868)] - **test**: fix arguments order in assert.strictEqual() (Ulises Santana Suárez) [#24192](https://github.com/nodejs/node/pull/24192) +* [[`3bb63721e3`](https://github.com/nodejs/node/commit/3bb63721e3)] - **test**: fix assert.strictEqual argument order (John Mc Quillan) [#24172](https://github.com/nodejs/node/pull/24172) +* [[`a6f786dee9`](https://github.com/nodejs/node/commit/a6f786dee9)] - **test**: replacing fixture directory with temp (saurabhSiddhu) [#24077](https://github.com/nodejs/node/pull/24077) +* [[`704b68aee4`](https://github.com/nodejs/node/commit/704b68aee4)] - **test**: increase coverage internal readline (Berry de Witte) [#24150](https://github.com/nodejs/node/pull/24150) +* [[`d8ac55a012`](https://github.com/nodejs/node/commit/d8ac55a012)] - **test**: use NULL instead of 0 in common.h (Daniel Bevenius) [#24104](https://github.com/nodejs/node/pull/24104) +* [[`4b9518dba3`](https://github.com/nodejs/node/commit/4b9518dba3)] - **test**: move test-fs-watch-system-limit from sequential to pummel (Marcus Scott) [#23692](https://github.com/nodejs/node/pull/23692) +* [[`4054c24cac`](https://github.com/nodejs/node/commit/4054c24cac)] - **test**: fix uses of deprecated assert.fail with multiple args (ivan.filenko) [#23673](https://github.com/nodejs/node/pull/23673) +* [[`c417c7a89a`](https://github.com/nodejs/node/commit/c417c7a89a)] - **test**: use assert.strictEqual instead of assert.equal (ivan.filenko) [#23673](https://github.com/nodejs/node/pull/23673) +* [[`1b5b1cc08b`](https://github.com/nodejs/node/commit/1b5b1cc08b)] - **test**: add test for strictDeepEqual (Nikita Malyschkin) [#24197](https://github.com/nodejs/node/pull/24197) +* [[`cd2dedfa4f`](https://github.com/nodejs/node/commit/cd2dedfa4f)] - **test**: add coverage for systemerror set name (Amer Alimanović) [#24200](https://github.com/nodejs/node/pull/24200) +* [[`9fa71468f5`](https://github.com/nodejs/node/commit/9fa71468f5)] - **test**: fix order of arguments in assert.strictEqual (Alex Seifert) [#24145](https://github.com/nodejs/node/pull/24145) +* [[`2d6e942035`](https://github.com/nodejs/node/commit/2d6e942035)] - **test**: add test for 'ERR\_INVALID\_CALLBACK' (razvanbh) [#24224](https://github.com/nodejs/node/pull/24224) +* [[`540b741ae2`](https://github.com/nodejs/node/commit/540b741ae2)] - **test**: add coverage for escape key switch case (Artur Daschevici) [#24194](https://github.com/nodejs/node/pull/24194) +* [[`53b12c3731`](https://github.com/nodejs/node/commit/53b12c3731)] - **test**: fix NewFromUtf8 compiler warning (Daniel Bevenius) [#24216](https://github.com/nodejs/node/pull/24216) +* [[`8e9ff69d7f`](https://github.com/nodejs/node/commit/8e9ff69d7f)] - **test**: add error code tests in dgram test (Mark Arranz) [#24215](https://github.com/nodejs/node/pull/24215) +* [[`e57a5c3734`](https://github.com/nodejs/node/commit/e57a5c3734)] - **test**: fix order of arguments in test-delayed-require assertion (reineke-fox) [#24165](https://github.com/nodejs/node/pull/24165) +* [[`d7a3a3bd9f`](https://github.com/nodejs/node/commit/d7a3a3bd9f)] - **test**: change arguments order in strictEqual (Paul Isache) [#24156](https://github.com/nodejs/node/pull/24156) +* [[`efd697bc57`](https://github.com/nodejs/node/commit/efd697bc57)] - **test**: switch order of strictEqual arguments (Jonah Polack) [#24185](https://github.com/nodejs/node/pull/24185) +* [[`9052a22dd1`](https://github.com/nodejs/node/commit/9052a22dd1)] - **test**: fix the arguments order in `assert.strictEqual` (mzucker) [#24227](https://github.com/nodejs/node/pull/24227) +* [[`d7722dd9d8`](https://github.com/nodejs/node/commit/d7722dd9d8)] - **test**: fix the arguments order in `assert.strictEqual` (mzucker) [#24226](https://github.com/nodejs/node/pull/24226) +* [[`2e0d3c9de9`](https://github.com/nodejs/node/commit/2e0d3c9de9)] - **test**: fix order in assert.strictEqual to actual, expected (Kevin Seidel) [#24184](https://github.com/nodejs/node/pull/24184) +* [[`b63e9cb3fe`](https://github.com/nodejs/node/commit/b63e9cb3fe)] - **test**: fix arguments order in assert.strictEqual (szabolcsit) [#24143](https://github.com/nodejs/node/pull/24143) +* [[`e0c6f5cbf7`](https://github.com/nodejs/node/commit/e0c6f5cbf7)] - **test**: fix assert argument order (Manish Poddar) [#24160](https://github.com/nodejs/node/pull/24160) +* [[`fc84ccd0f0`](https://github.com/nodejs/node/commit/fc84ccd0f0)] - **test**: removed extraneous argument 's' (Jackson Chui) [#24213](https://github.com/nodejs/node/pull/24213) +* [[`90f98905f1`](https://github.com/nodejs/node/commit/90f98905f1)] - **test**: fix arguments order in test-fs-write-buffer (razvanbh) [#24155](https://github.com/nodejs/node/pull/24155) +* [[`1588fba73f`](https://github.com/nodejs/node/commit/1588fba73f)] - **test**: fix argument order in assert.strictEqual() (Clement) [#24147](https://github.com/nodejs/node/pull/24147) +* [[`f46fa9072a`](https://github.com/nodejs/node/commit/f46fa9072a)] - **test**: switch arguments in strictEqual (Mathieu Pavageau) [#24141](https://github.com/nodejs/node/pull/24141) +* [[`8f2bdaca69`](https://github.com/nodejs/node/commit/8f2bdaca69)] - **test**: fix arguments order (Simona Cotin) [#24151](https://github.com/nodejs/node/pull/24151) +* [[`380789eb68`](https://github.com/nodejs/node/commit/380789eb68)] - **test**: fixe argument order in assert.strictEqual (Marc Posth) [#24140](https://github.com/nodejs/node/pull/24140) +* [[`cd07b02472`](https://github.com/nodejs/node/commit/cd07b02472)] - **test**: fixing arguments order in `assert.strictEqual()` (G. Carcaci) [#24152](https://github.com/nodejs/node/pull/24152) +* [[`6e8fa5361a`](https://github.com/nodejs/node/commit/6e8fa5361a)] - **test**: add tests for OutgoingMessage setTimeout (Robin Drexler) [#24148](https://github.com/nodejs/node/pull/24148) +* [[`abf9bd15db`](https://github.com/nodejs/node/commit/abf9bd15db)] - **test**: swap expected and actual in assert.strictEqual (Florin-Daniel BÎLBÎE) [#24146](https://github.com/nodejs/node/pull/24146) +* [[`f0eee63ee0`](https://github.com/nodejs/node/commit/f0eee63ee0)] - **test**: fix assert parameter order (Roland Broekema) [#24144](https://github.com/nodejs/node/pull/24144) +* [[`78a320130d`](https://github.com/nodejs/node/commit/78a320130d)] - **test**: change order of assert.strictEqual() (Remy Parzinski) [#24142](https://github.com/nodejs/node/pull/24142) +* [[`64fd19f102`](https://github.com/nodejs/node/commit/64fd19f102)] - **test**: fix invalid argument order in test-http-expect-continue.js (Morgan Roderick) [#24138](https://github.com/nodejs/node/pull/24138) +* [[`2d88af354f`](https://github.com/nodejs/node/commit/2d88af354f)] - **test**: strictEqual argument order (actual, expected) (Ahmad Nassri) [#24137](https://github.com/nodejs/node/pull/24137) +* [[`11a84a7b32`](https://github.com/nodejs/node/commit/11a84a7b32)] - **test**: swap the order of arguments (Musa Hamwala) [#24134](https://github.com/nodejs/node/pull/24134) +* [[`e599889649`](https://github.com/nodejs/node/commit/e599889649)] - **test**: fs readfile, swap arguments in strictEqual (Petar Dodev) [#24133](https://github.com/nodejs/node/pull/24133) +* [[`c37b3196b6`](https://github.com/nodejs/node/commit/c37b3196b6)] - **test**: fix arguments order (Fran Herrero) [#24131](https://github.com/nodejs/node/pull/24131) +* [[`74f1dad613`](https://github.com/nodejs/node/commit/74f1dad613)] - **test**: http-client-timeout error assert arguments (Tadhg Creedon) [#24130](https://github.com/nodejs/node/pull/24130) +* [[`b16311b19f`](https://github.com/nodejs/node/commit/b16311b19f)] - **test**: mark test-vm-timeout-\* known issue tests flaky (James M Snell) [#23743](https://github.com/nodejs/node/pull/23743) +* [[`0f6a9524f8`](https://github.com/nodejs/node/commit/0f6a9524f8)] - **tls**: destroy TLS socket if StreamWrap is destroyed (Anna Henningsen) [#24290](https://github.com/nodejs/node/pull/24290) +* [[`0c73221699`](https://github.com/nodejs/node/commit/0c73221699)] - **tls**: do not rely on 'drain' handlers in StreamWrap (Anna Henningsen) [#24290](https://github.com/nodejs/node/pull/24290) +* [[`3170cb49d8`](https://github.com/nodejs/node/commit/3170cb49d8)] - **tls**: throw if protocol too long (Andre Jodat-Danbrani) [#23606](https://github.com/nodejs/node/pull/23606) +* [[`cc4d866697`](https://github.com/nodejs/node/commit/cc4d866697)] - **tools**: update to remark-lint-preset-node@1.2.0 (Rich Trott) [#24391](https://github.com/nodejs/node/pull/24391) +* [[`21843c7659`](https://github.com/nodejs/node/commit/21843c7659)] - **tools**: fix `make lint-md-rollup` and run it (Daijiro Wachi) [#24333](https://github.com/nodejs/node/pull/24333) +* [[`e8e93df148`](https://github.com/nodejs/node/commit/e8e93df148)] - **tools**: update remark-lint to v6.0.3 from v6.0.2 (Daijiro Wachi) [#24333](https://github.com/nodejs/node/pull/24333) +* [[`2bed68f341`](https://github.com/nodejs/node/commit/2bed68f341)] - **tools**: update remark version to v10 from v8 (Daijiro Wachi) [#24333](https://github.com/nodejs/node/pull/24333) +* [[`39ccf1461e`](https://github.com/nodejs/node/commit/39ccf1461e)] - **tools**: update ESLint to 5.9.0 (cjihrig) [#24280](https://github.com/nodejs/node/pull/24280) +* [[`a1d7ed7de6`](https://github.com/nodejs/node/commit/a1d7ed7de6)] - **tracing**: fix static destruction order issue (Anna Henningsen) [#24123](https://github.com/nodejs/node/pull/24123) +* [[`8c107a37f9`](https://github.com/nodejs/node/commit/8c107a37f9)] - **url**: make the context non-enumerable (Joyee Cheung) [#24218](https://github.com/nodejs/node/pull/24218) +* [[`eeb4715a56`](https://github.com/nodejs/node/commit/eeb4715a56)] - **util**: remove unreachable branch (rahulshuklab4u) [#24447](https://github.com/nodejs/node/pull/24447) +* [[`7576a518b8`](https://github.com/nodejs/node/commit/7576a518b8)] - **util**: deleted unreachable code from util.inspect (kiyomizumia) [#24187](https://github.com/nodejs/node/pull/24187) +* [[`c6a43fa2ef`](https://github.com/nodejs/node/commit/c6a43fa2ef)] - **zlib**: do not leak on destroy (Mathias Buus) [#23734](https://github.com/nodejs/node/pull/23734) + ## 2018-12-26, Version 10.15.0 'Dubnium' (LTS), @MylesBorins diff --git a/src/node_version.h b/src/node_version.h index 4178e3f30b1987..2cf43fb89f96e5 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -29,7 +29,7 @@ #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Dubnium" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) From 7840f713ce1aad3fa3933032aabc25df2718bc98 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 29 Jan 2019 09:56:48 -0800 Subject: [PATCH 223/223] Working on v10.15.2 PR-URL: https://github.com/nodejs/node/pull/25346 --- src/node_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_version.h b/src/node_version.h index 2cf43fb89f96e5..1250c9240b8c9f 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -24,12 +24,12 @@ #define NODE_MAJOR_VERSION 10 #define NODE_MINOR_VERSION 15 -#define NODE_PATCH_VERSION 1 +#define NODE_PATCH_VERSION 2 #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Dubnium" -#define NODE_VERSION_IS_RELEASE 1 +#define NODE_VERSION_IS_RELEASE 0 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)