From f5c0e282ccf98e17f295c11850649ad19a6fff51 Mon Sep 17 00:00:00 2001 From: Alba Mendez Date: Fri, 7 Aug 2020 12:54:08 +0200 Subject: [PATCH 01/25] http2: allow Host in HTTP/2 requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HTTP/2 spec allows Host to be used instead of :authority in requests, and this is in fact *preferred* when converting from HTTP/1. We erroneously treated Host as a connection header, thus disallowing it in requests. The patch corrects this, aligning Node.js behaviour with the HTTP/2 spec and with nghttp2: - Treat Host as a single-value header instead of a connection header. - Don't autofill :authority if Host is present. - The compatibility API (request.authority) falls back to using Host if :authority is not present. This is semver-major because requests are no longer guaranteed to have :authority set. An explanatory note was added to the docs. Fixes: https://github.com/nodejs/node/issues/29858 PR-URL: https://github.com/nodejs/node/pull/34664 Reviewed-By: James M Snell Reviewed-By: Gerhard Stöbich Reviewed-By: Yongsheng Zhang Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- doc/api/http2.md | 25 +++++++- lib/internal/http2/compat.js | 5 +- lib/internal/http2/core.js | 9 +-- lib/internal/http2/util.js | 16 ++++- .../test-http2-compat-serverrequest-host.js | 63 +++++++++++++++++++ test/parallel/test-http2-util-headers-list.js | 21 ++++++- 6 files changed, 125 insertions(+), 14 deletions(-) create mode 100644 test/parallel/test-http2-compat-serverrequest-host.js diff --git a/doc/api/http2.md b/doc/api/http2.md index c8c51ed92ef247..5adf84e27f8b53 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2,6 +2,10 @@ * `socket` {QuicSocket} A `QuicSocket` instance to move this session to. +* `natRebinding` {boolean} When `true`, indicates that the local address is to + be changed without triggering address validation. This will be rare and will + typically be used only to test resiliency in NAT rebind scenarios. + **Default**: `false`. * Returns: {Promise} Migrates the `QuicClientSession` to the given `QuicSocket` instance. If the new From 240592228bc794918443d46a8fcee85fe25a80d7 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 7 Aug 2020 13:05:46 -0700 Subject: [PATCH 11/25] quic: fixup session ticket app data todo comments PR-URL: https://github.com/nodejs/node/pull/34741 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/quic/node_quic_session.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/quic/node_quic_session.h b/src/quic/node_quic_session.h index c41d58125b9f70..7fd9d853bbcfbc 100644 --- a/src/quic/node_quic_session.h +++ b/src/quic/node_quic_session.h @@ -616,20 +616,17 @@ class QuicApplication : public MemoryRetainer, virtual void ResumeStream(int64_t stream_id) {} - virtual void SetSessionTicketAppData(const SessionTicketAppData& app_data) { - // TODO(@jasnell): Different QUIC applications may wish to set some - // application data in the session ticket (e.g. http/3 would set - // server settings in the application data). For now, doing nothing - // as I'm just adding the basic mechanism. - } - + // Different QUIC applications may set some application data in + // the session ticket (e.g. http/3 would set server settings in the + // application data). By default, there's nothing to set. + virtual void SetSessionTicketAppData(const SessionTicketAppData& app_data) {} + + // Different QUIC applications may set some application data in + // the session ticket (e.g. http/3 would set server settings in the + // application data). By default, there's nothing to get. virtual SessionTicketAppData::Status GetSessionTicketAppData( const SessionTicketAppData& app_data, SessionTicketAppData::Flag flag) { - // TODO(@jasnell): Different QUIC application may wish to set some - // application data in the session ticket (e.g. http/3 would set - // server settings in the application data). For now, doing nothing - // as I'm just adding the basic mechanism. return flag == SessionTicketAppData::Flag::STATUS_RENEW ? SessionTicketAppData::Status::TICKET_USE_RENEW : SessionTicketAppData::Status::TICKET_USE; From 19e712b9b2982404bbb4b8e1f9e1700ee8048d6f Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 7 Aug 2020 13:07:25 -0700 Subject: [PATCH 12/25] quic: resolve InitializeSecureContext TODO comment Using a static label is sufficient. PR-URL: https://github.com/nodejs/node/pull/34741 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/quic/node_quic_crypto.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/quic/node_quic_crypto.cc b/src/quic/node_quic_crypto.cc index 8f1f433525ecc3..b073ca9c381487 100644 --- a/src/quic/node_quic_crypto.cc +++ b/src/quic/node_quic_crypto.cc @@ -602,8 +602,6 @@ void InitializeSecureContext( BaseObjectPtr sc, bool early_data, ngtcp2_crypto_side side) { - // TODO(@jasnell): Using a static value for this at the moment but - // we need to determine if a non-static or per-session value is better. constexpr static unsigned char session_id_ctx[] = "node.js quic server"; switch (side) { case NGTCP2_CRYPTO_SIDE_SERVER: From 94aa29134830b7ff1f99211ecd3ef0d12b32a793 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 10 Aug 2020 13:21:31 -0700 Subject: [PATCH 13/25] quic: clarify TODO statements PR-URL: https://github.com/nodejs/node/pull/34741 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/quic/node_quic_session.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/quic/node_quic_session.cc b/src/quic/node_quic_session.cc index e75d33e636e4e1..b1748c8f728001 100644 --- a/src/quic/node_quic_session.cc +++ b/src/quic/node_quic_session.cc @@ -263,6 +263,16 @@ void QuicSessionConfig::Set( // TODO(@jasnell): QUIC allows both IPv4 and IPv6 addresses to be // specified. Here we're specifying one or the other. Need to // determine if that's what we want or should we support both. + // + // TODO(@jasnell): Currently, this is specified as a single value + // that is used for all connections. In the future, it may be + // necessary to determine the preferred address based on the + // remote address. The trick, however, is that the preferred + // address must be selected before the QuicSession is created, + // before the handshake can be started. That is, it may need + // to be an optional callback on QuicSocket. That would incur + // a performance penalty so we'd really have to be sure of the + // utility. if (preferred_addr != nullptr) { transport_params.preferred_address_present = 1; switch (preferred_addr->sa_family) { From bfc35354c1290d7c1061c35fbd507aa129acc9d2 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 10 Aug 2020 14:28:34 -0700 Subject: [PATCH 14/25] quic: consolidate stats collecting in QuicSession PR-URL: https://github.com/nodejs/node/pull/34741 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/quic/node_quic_http3_application.cc | 9 ++++----- src/quic/node_quic_session.cc | 21 +++++++-------------- src/quic/node_quic_session.h | 7 ++++--- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/quic/node_quic_http3_application.cc b/src/quic/node_quic_http3_application.cc index e05ad316341c66..82cd677d1ce558 100644 --- a/src/quic/node_quic_http3_application.cc +++ b/src/quic/node_quic_http3_application.cc @@ -79,11 +79,10 @@ Http3Application::Http3Application( // Push streams in HTTP/3 are a bit complicated. // First, it's important to know that only an HTTP/3 server can // create a push stream. -// Second, it's important to recognize that a push stream is -// essentially an *assumed* request. For instance, if a client -// requests a webpage that has links to css and js files, and -// the server expects the client to send subsequent requests -// for those css and js files, the server can shortcut the +// Second, a push stream is essentially an *assumed* request. For +// instance, if a client requests a webpage that has links to css +// and js files, and the server expects the client to send subsequent +// requests for those css and js files, the server can shortcut the // process by opening a push stream for each additional resource // it assumes the client to make. // Third, a push stream can only be opened within the context diff --git a/src/quic/node_quic_session.cc b/src/quic/node_quic_session.cc index b1748c8f728001..59f80c77057598 100644 --- a/src/quic/node_quic_session.cc +++ b/src/quic/node_quic_session.cc @@ -2098,7 +2098,6 @@ bool QuicSession::Receive( UpdateIdleTimer(); SendPendingData(); - UpdateRecoveryStats(); Debug(this, "Successfully processed received packet"); return true; } @@ -2893,19 +2892,6 @@ void QuicSessionOnCertDone(const FunctionCallbackInfo& args) { } } // namespace -// Recovery stats are used to allow user code to keep track of -// important round-trip timing statistics that are updated through -// the lifetime of a connection. Effectively, these communicate how -// much time (from the perspective of the local peer) is being taken -// to exchange data reliably with the remote peer. -// TODO(@jasnell): Revisit -void QuicSession::UpdateRecoveryStats() { - ngtcp2_conn_stat stat; - ngtcp2_conn_get_conn_stat(connection(), &stat); - SetStat(&QuicSessionStats::min_rtt, stat.min_rtt); - SetStat(&QuicSessionStats::latest_rtt, stat.latest_rtt); - SetStat(&QuicSessionStats::smoothed_rtt, stat.smoothed_rtt); -} // Data stats are used to allow user code to keep track of important // statistics such as amount of data in flight through the lifetime @@ -2918,6 +2904,13 @@ void QuicSession::UpdateDataStats() { ngtcp2_conn_stat stat; ngtcp2_conn_get_conn_stat(connection(), &stat); + SetStat(&QuicSessionStats::latest_rtt, stat.latest_rtt); + SetStat(&QuicSessionStats::min_rtt, stat.min_rtt); + SetStat(&QuicSessionStats::smoothed_rtt, stat.smoothed_rtt); + SetStat(&QuicSessionStats::receive_rate, stat.recv_rate_sec); + SetStat(&QuicSessionStats::send_rate, stat.delivery_rate_sec); + SetStat(&QuicSessionStats::cwnd, stat.cwnd); + state_->bytes_in_flight = stat.bytes_in_flight; // The max_bytes_in_flight is a highwater mark that can be used // in performance analysis operations. diff --git a/src/quic/node_quic_session.h b/src/quic/node_quic_session.h index 7fd9d853bbcfbc..05c7606e8b54f7 100644 --- a/src/quic/node_quic_session.h +++ b/src/quic/node_quic_session.h @@ -204,7 +204,10 @@ enum QuicSessionStateFields { V(BLOCK_COUNT, block_count, "Block Count") \ V(MIN_RTT, min_rtt, "Minimum RTT") \ V(LATEST_RTT, latest_rtt, "Latest RTT") \ - V(SMOOTHED_RTT, smoothed_rtt, "Smoothed RTT") + V(SMOOTHED_RTT, smoothed_rtt, "Smoothed RTT") \ + V(CWND, cwnd, "Cwnd") \ + V(RECEIVE_RATE, receive_rate, "Receive Rate / Sec") \ + V(SEND_RATE, send_rate, "Send Rate Sec") #define V(name, _, __) IDX_QUIC_SESSION_STATS_##name, enum QuicSessionStatsIdx : int { @@ -1272,8 +1275,6 @@ class QuicSession final : public AsyncWrap, bool WritePackets(const char* diagnostic_label = nullptr); - void UpdateRecoveryStats(); - void UpdateConnectionID( int type, const QuicCID& cid, From 1c14810edc68cc460d32da80fc52284c079d20ff Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 11 Aug 2020 15:45:26 -0700 Subject: [PATCH 15/25] src: allow instances of net.BlockList to be created internally Initial PR had it so that user code would create BlockList instances. This sets it up so that instances can be created internally by Node.js PR-URL: https://github.com/nodejs/node/pull/34741 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- lib/internal/blocklist.js | 9 +++++++-- src/env.h | 2 ++ src/node_sockaddr.cc | 14 ++++++++++++++ src/node_sockaddr.h | 1 + tools/doc/type-parser.js | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/internal/blocklist.js b/lib/internal/blocklist.js index d4074ab41c2150..0ad58373b746b2 100644 --- a/lib/internal/blocklist.js +++ b/lib/internal/blocklist.js @@ -26,8 +26,13 @@ const { } = require('internal/errors').codes; class BlockList { - constructor() { - this[kHandle] = new BlockListHandle(); + constructor(handle = new BlockListHandle()) { + // The handle argument is an intentionally undocumented + // internal API. User code will not be able to create + // a BlockListHandle object directly. + if (!(handle instanceof BlockListHandle)) + throw new ERR_INVALID_ARG_TYPE('handle', 'BlockListHandle', handle); + this[kHandle] = handle; this[kHandle][owner_symbol] = this; } diff --git a/src/env.h b/src/env.h index d99bb63db6fb29..b1367c2660f4fa 100644 --- a/src/env.h +++ b/src/env.h @@ -182,6 +182,7 @@ constexpr size_t kFsStatsBufferLength = V(asn1curve_string, "asn1Curve") \ V(async_ids_stack_string, "async_ids_stack") \ V(bits_string, "bits") \ + V(block_list_string, "blockList") \ V(buffer_string, "buffer") \ V(bytes_parsed_string, "bytesParsed") \ V(bytes_read_string, "bytesRead") \ @@ -423,6 +424,7 @@ constexpr size_t kFsStatsBufferLength = V(async_wrap_object_ctor_template, v8::FunctionTemplate) \ V(base_object_ctor_template, v8::FunctionTemplate) \ V(binding_data_ctor_template, v8::FunctionTemplate) \ + V(blocklist_instance_template, v8::ObjectTemplate) \ V(compiled_fn_entry_template, v8::ObjectTemplate) \ V(dir_instance_template, v8::ObjectTemplate) \ V(fd_constructor_template, v8::ObjectTemplate) \ diff --git a/src/node_sockaddr.cc b/src/node_sockaddr.cc index 8ba82ff68535a6..58d03eefa6e6e6 100644 --- a/src/node_sockaddr.cc +++ b/src/node_sockaddr.cc @@ -524,6 +524,19 @@ SocketAddressBlockListWrap::SocketAddressBlockListWrap( MakeWeak(); } +BaseObjectPtr SocketAddressBlockListWrap::New( + Environment* env) { + Local obj; + if (!env->blocklist_instance_template() + ->NewInstance(env->context()).ToLocal(&obj)) { + return {}; + } + BaseObjectPtr wrap = + MakeDetachedBaseObject(env, obj); + CHECK(wrap); + return wrap; +} + void SocketAddressBlockListWrap::New( const FunctionCallbackInfo& args) { CHECK(args.IsConstructCall()); @@ -673,6 +686,7 @@ void SocketAddressBlockListWrap::Initialize( env->SetProtoMethod(t, "check", SocketAddressBlockListWrap::Check); env->SetProtoMethod(t, "getRules", SocketAddressBlockListWrap::GetRules); + env->set_blocklist_instance_template(t->InstanceTemplate()); target->Set(env->context(), name, t->GetFunction(env->context()).ToLocalChecked()).FromJust(); diff --git a/src/node_sockaddr.h b/src/node_sockaddr.h index f539cf6555f798..69a370afa32e81 100644 --- a/src/node_sockaddr.h +++ b/src/node_sockaddr.h @@ -280,6 +280,7 @@ class SocketAddressBlockListWrap : v8::Local context, void* priv); + static BaseObjectPtr New(Environment* env); static void New(const v8::FunctionCallbackInfo& args); static void AddAddress(const v8::FunctionCallbackInfo& args); static void AddRange(const v8::FunctionCallbackInfo& args); diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 6441b5eef70fda..9e54e92aeee687 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -122,6 +122,7 @@ const customTypesMap = { 'require': 'modules.html#modules_require_id', 'Handle': 'net.html#net_server_listen_handle_backlog_callback', + 'net.BlockList': 'net.html#net_class_net_blocklist', 'net.Server': 'net.html#net_class_net_server', 'net.Socket': 'net.html#net_class_net_socket', From c855c3e8ca5142e7b7f4a4e6adbf43e0ab18439b Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 11 Aug 2020 15:46:25 -0700 Subject: [PATCH 16/25] quic: use net.BlockList for limiting access to a QuicSocket PR-URL: https://github.com/nodejs/node/pull/34741 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- doc/api/quic.md | 18 ++++++++++ lib/internal/quic/core.js | 11 ++++++ src/quic/node_quic_session.h | 2 +- src/quic/node_quic_socket.cc | 13 +++++++ src/quic/node_quic_socket.h | 1 + test/parallel/test-quic-blocklist.js | 52 ++++++++++++++++++++++++++++ 6 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-quic-blocklist.js diff --git a/doc/api/quic.md b/doc/api/quic.md index 84484357b72fb4..486c8ee6d6848e 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -1445,6 +1445,24 @@ error will be thrown if `quicsock.addEndpoint()` is called either after the `QuicSocket` has already started binding to the local ports, or after the `QuicSocket` has been destroyed. +#### `quicsocket.blockList` + + +* Type: {net.BlockList} + +A {net.BlockList} instance used to define rules for remote IPv4 or IPv6 +addresses that this `QuicSocket` is not permitted to interact with. The +rules can be specified as either specific individual addresses, ranges +of addresses, or CIDR subnet ranges. + +When listening as a server, if a packet is received from a blocked address, +the packet will be ignored. + +When connecting as a client, if the remote IP address is blocked, the +connection attempt will be rejected. + #### `quicsocket.bound`

Gold Sponsors

-

Shopify Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

+

Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

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

+

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

## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/rules/comma-dangle.js b/tools/node_modules/eslint/lib/rules/comma-dangle.js index 9ca5efa632315c..e22b7f3551e114 100644 --- a/tools/node_modules/eslint/lib/rules/comma-dangle.js +++ b/tools/node_modules/eslint/lib/rules/comma-dangle.js @@ -124,8 +124,7 @@ module.exports = { } ] } - ], - additionalItems: false + ] }, messages: { diff --git a/tools/node_modules/eslint/lib/rules/indent.js b/tools/node_modules/eslint/lib/rules/indent.js index 22b633845b596e..1c0dccc5c9891f 100644 --- a/tools/node_modules/eslint/lib/rules/indent.js +++ b/tools/node_modules/eslint/lib/rules/indent.js @@ -1084,16 +1084,17 @@ module.exports = { }, ArrowFunctionExpression(node) { - const firstToken = sourceCode.getFirstToken(node); + const maybeOpeningParen = sourceCode.getFirstToken(node, { skip: node.async ? 1 : 0 }); - if (astUtils.isOpeningParenToken(firstToken)) { - const openingParen = firstToken; + if (astUtils.isOpeningParenToken(maybeOpeningParen)) { + const openingParen = maybeOpeningParen; const closingParen = sourceCode.getTokenBefore(node.body, astUtils.isClosingParenToken); parameterParens.add(openingParen); parameterParens.add(closingParen); addElementListIndent(node.params, openingParen, closingParen, options.FunctionExpression.parameters); } + addBlocklessNodeIndent(node.body); }, diff --git a/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js b/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js index cac594e10047e8..87d2336fa4a40f 100644 --- a/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js +++ b/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js @@ -1,5 +1,5 @@ /** - * @fileoverview Rule to flag trailing underscores in variable declarations. + * @fileoverview Rule to flag dangling underscores in variable declarations. * @author Matt DuVall */ @@ -45,6 +45,10 @@ module.exports = { enforceInMethodNames: { type: "boolean", default: false + }, + allowFunctionParams: { + type: "boolean", + default: true } }, additionalProperties: false @@ -64,6 +68,7 @@ module.exports = { const allowAfterSuper = typeof options.allowAfterSuper !== "undefined" ? options.allowAfterSuper : false; const allowAfterThisConstructor = typeof options.allowAfterThisConstructor !== "undefined" ? options.allowAfterThisConstructor : false; const enforceInMethodNames = typeof options.enforceInMethodNames !== "undefined" ? options.enforceInMethodNames : false; + const allowFunctionParams = typeof options.allowFunctionParams !== "undefined" ? options.allowFunctionParams : true; //------------------------------------------------------------------------- // Helpers @@ -80,12 +85,12 @@ module.exports = { } /** - * Check if identifier has a underscore at the end + * Check if identifier has a dangling underscore * @param {string} identifier name of the node * @returns {boolean} true if its is present * @private */ - function hasTrailingUnderscore(identifier) { + function hasDanglingUnderscore(identifier) { const len = identifier.length; return identifier !== "_" && (identifier[0] === "_" || identifier[len - 1] === "_"); @@ -126,16 +131,53 @@ module.exports = { } /** - * Check if function has a underscore at the end + * Check if function parameter has a dangling underscore. + * @param {ASTNode} node function node to evaluate + * @returns {void} + * @private + */ + function checkForDanglingUnderscoreInFunctionParameters(node) { + if (!allowFunctionParams) { + node.params.forEach(param => { + const { type } = param; + let nodeToCheck; + + if (type === "RestElement") { + nodeToCheck = param.argument; + } else if (type === "AssignmentPattern") { + nodeToCheck = param.left; + } else { + nodeToCheck = param; + } + + if (nodeToCheck.type === "Identifier") { + const identifier = nodeToCheck.name; + + if (hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { + context.report({ + node: param, + messageId: "unexpectedUnderscore", + data: { + identifier + } + }); + } + } + }); + } + } + + /** + * Check if function has a dangling underscore * @param {ASTNode} node node to evaluate * @returns {void} * @private */ - function checkForTrailingUnderscoreInFunctionDeclaration(node) { - if (node.id) { + function checkForDanglingUnderscoreInFunction(node) { + if (node.type === "FunctionDeclaration" && node.id) { const identifier = node.id.name; - if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) && !isAllowed(identifier)) { + if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { context.report({ node, messageId: "unexpectedUnderscore", @@ -145,18 +187,19 @@ module.exports = { }); } } + checkForDanglingUnderscoreInFunctionParameters(node); } /** - * Check if variable expression has a underscore at the end + * Check if variable expression has a dangling underscore * @param {ASTNode} node node to evaluate * @returns {void} * @private */ - function checkForTrailingUnderscoreInVariableExpression(node) { + function checkForDanglingUnderscoreInVariableExpression(node) { const identifier = node.id.name; - if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) && + if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && !isSpecialCaseIdentifierInVariableExpression(identifier) && !isAllowed(identifier)) { context.report({ node, @@ -169,18 +212,18 @@ module.exports = { } /** - * Check if member expression has a underscore at the end + * Check if member expression has a dangling underscore * @param {ASTNode} node node to evaluate * @returns {void} * @private */ - function checkForTrailingUnderscoreInMemberExpression(node) { + function checkForDanglingUnderscoreInMemberExpression(node) { const identifier = node.property.name, isMemberOfThis = node.object.type === "ThisExpression", isMemberOfSuper = node.object.type === "Super", isMemberOfThisConstructor = isThisConstructorReference(node); - if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) && + if (typeof identifier !== "undefined" && hasDanglingUnderscore(identifier) && !(isMemberOfThis && allowAfterThis) && !(isMemberOfSuper && allowAfterSuper) && !(isMemberOfThisConstructor && allowAfterThisConstructor) && @@ -196,16 +239,16 @@ module.exports = { } /** - * Check if method declaration or method property has a underscore at the end + * Check if method declaration or method property has a dangling underscore * @param {ASTNode} node node to evaluate * @returns {void} * @private */ - function checkForTrailingUnderscoreInMethod(node) { + function checkForDanglingUnderscoreInMethod(node) { const identifier = node.key.name; const isMethod = node.type === "MethodDefinition" || node.type === "Property" && node.method; - if (typeof identifier !== "undefined" && enforceInMethodNames && isMethod && hasTrailingUnderscore(identifier) && !isAllowed(identifier)) { + if (typeof identifier !== "undefined" && enforceInMethodNames && isMethod && hasDanglingUnderscore(identifier) && !isAllowed(identifier)) { context.report({ node, messageId: "unexpectedUnderscore", @@ -221,11 +264,13 @@ module.exports = { //-------------------------------------------------------------------------- return { - FunctionDeclaration: checkForTrailingUnderscoreInFunctionDeclaration, - VariableDeclarator: checkForTrailingUnderscoreInVariableExpression, - MemberExpression: checkForTrailingUnderscoreInMemberExpression, - MethodDefinition: checkForTrailingUnderscoreInMethod, - Property: checkForTrailingUnderscoreInMethod + FunctionDeclaration: checkForDanglingUnderscoreInFunction, + VariableDeclarator: checkForDanglingUnderscoreInVariableExpression, + MemberExpression: checkForDanglingUnderscoreInMemberExpression, + MethodDefinition: checkForDanglingUnderscoreInMethod, + Property: checkForDanglingUnderscoreInMethod, + FunctionExpression: checkForDanglingUnderscoreInFunction, + ArrowFunctionExpression: checkForDanglingUnderscoreInFunction }; } diff --git a/tools/node_modules/eslint/node_modules/acorn/LICENSE b/tools/node_modules/eslint/node_modules/acorn/LICENSE index 2c0632b6a7c63b..cc5272c966db45 100644 --- a/tools/node_modules/eslint/node_modules/acorn/LICENSE +++ b/tools/node_modules/eslint/node_modules/acorn/LICENSE @@ -1,3 +1,5 @@ +MIT License + Copyright (C) 2012-2018 by various contributors (see AUTHORS) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/tools/node_modules/eslint/node_modules/acorn/README.md b/tools/node_modules/eslint/node_modules/acorn/README.md index 585f2736fc05b5..52d2e9b71c51d6 100644 --- a/tools/node_modules/eslint/node_modules/acorn/README.md +++ b/tools/node_modules/eslint/node_modules/acorn/README.md @@ -266,5 +266,4 @@ Plugins for ECMAScript proposals: - [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling: - [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields) - [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta) - - [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator) - [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js index f4c2404143dc51..798c66795385d7 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js @@ -2385,7 +2385,7 @@ var node = this.startNode(); node.value = value; node.raw = this.input.slice(this.start, this.end); - if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1); } + if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); } this.next(); return this.finishNode(node, "Literal") }; @@ -4551,7 +4551,13 @@ pp$9.readToken_pipe_amp = function(code) { // '|&' var next = this.input.charCodeAt(this.pos + 1); - if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) } + if (next === code) { + if (this.options.ecmaVersion >= 12) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 === 61) { return this.finishOp(types.assign, 3) } + } + return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) + } if (next === 61) { return this.finishOp(types.assign, 2) } return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1) }; @@ -4608,13 +4614,20 @@ }; pp$9.readToken_question = function() { // '?' - if (this.options.ecmaVersion >= 11) { + var ecmaVersion = this.options.ecmaVersion; + if (ecmaVersion >= 11) { var next = this.input.charCodeAt(this.pos + 1); if (next === 46) { var next2 = this.input.charCodeAt(this.pos + 2); if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) } } - if (next === 63) { return this.finishOp(types.coalesce, 2) } + if (next === 63) { + if (ecmaVersion >= 12) { + var next2$1 = this.input.charCodeAt(this.pos + 2); + if (next2$1 === 61) { return this.finishOp(types.assign, 3) } + } + return this.finishOp(types.coalesce, 2) + } } return this.finishOp(types.question, 1) }; @@ -4743,30 +4756,67 @@ // were read, the integer value otherwise. When `len` is given, this // will return `null` unless the integer has exactly `len` digits. - pp$9.readInt = function(radix, len) { - var start = this.pos, total = 0; - for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) { + pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { + // `len` is used for character escape sequences. In that case, disallow separators. + var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined; + + // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b) + // and isn't fraction part nor exponent part. In that case, if the first digit + // is zero then disallow separators. + var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; + + var start = this.pos, total = 0, lastCode = 0; + for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) { var code = this.input.charCodeAt(this.pos), val = (void 0); + + if (allowSeparators && code === 95) { + if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); } + if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); } + if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); } + lastCode = code; + continue + } + if (code >= 97) { val = code - 97 + 10; } // a else if (code >= 65) { val = code - 65 + 10; } // A else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9 else { val = Infinity; } if (val >= radix) { break } - ++this.pos; + lastCode = code; total = total * radix + val; } + + if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); } if (this.pos === start || len != null && this.pos - start !== len) { return null } return total }; + function stringToNumber(str, isLegacyOctalNumericLiteral) { + if (isLegacyOctalNumericLiteral) { + return parseInt(str, 8) + } + + // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value. + return parseFloat(str.replace(/_/g, "")) + } + + function stringToBigInt(str) { + if (typeof BigInt !== "function") { + return null + } + + // `BigInt(value)` throws syntax error if the string contains numeric separators. + return BigInt(str.replace(/_/g, "")) + } + pp$9.readRadixNumber = function(radix) { var start = this.pos; this.pos += 2; // 0x var val = this.readInt(radix); if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); } if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) { - val = typeof BigInt !== "undefined" ? BigInt(this.input.slice(start, this.pos)) : null; + val = stringToBigInt(this.input.slice(start, this.pos)); ++this.pos; } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types.num, val) @@ -4776,13 +4826,12 @@ pp$9.readNumber = function(startsWithDot) { var start = this.pos; - if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); } + if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); } var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48; if (octal && this.strict) { this.raise(start, "Invalid number"); } var next = this.input.charCodeAt(this.pos); if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { - var str$1 = this.input.slice(start, this.pos); - var val$1 = typeof BigInt !== "undefined" ? BigInt(str$1) : null; + var val$1 = stringToBigInt(this.input.slice(start, this.pos)); ++this.pos; if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types.num, val$1) @@ -4800,8 +4849,7 @@ } if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } - var str = this.input.slice(start, this.pos); - var val = octal ? parseInt(str, 8) : parseFloat(str); + var val = stringToNumber(this.input.slice(start, this.pos), octal); return this.finishToken(types.num, val) }; @@ -5060,7 +5108,7 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript. - var version = "7.3.1"; + var version = "7.4.0"; Parser.acorn = { Parser: Parser, diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs index 643601104ddd76..2e4f989456b64a 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs @@ -2379,7 +2379,7 @@ pp$3.parseLiteral = function(value) { var node = this.startNode(); node.value = value; node.raw = this.input.slice(this.start, this.end); - if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1); } + if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); } this.next(); return this.finishNode(node, "Literal") }; @@ -4545,7 +4545,13 @@ pp$9.readToken_mult_modulo_exp = function(code) { // '%*' pp$9.readToken_pipe_amp = function(code) { // '|&' var next = this.input.charCodeAt(this.pos + 1); - if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) } + if (next === code) { + if (this.options.ecmaVersion >= 12) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 === 61) { return this.finishOp(types.assign, 3) } + } + return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) + } if (next === 61) { return this.finishOp(types.assign, 2) } return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1) }; @@ -4602,13 +4608,20 @@ pp$9.readToken_eq_excl = function(code) { // '=!' }; pp$9.readToken_question = function() { // '?' - if (this.options.ecmaVersion >= 11) { + var ecmaVersion = this.options.ecmaVersion; + if (ecmaVersion >= 11) { var next = this.input.charCodeAt(this.pos + 1); if (next === 46) { var next2 = this.input.charCodeAt(this.pos + 2); if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) } } - if (next === 63) { return this.finishOp(types.coalesce, 2) } + if (next === 63) { + if (ecmaVersion >= 12) { + var next2$1 = this.input.charCodeAt(this.pos + 2); + if (next2$1 === 61) { return this.finishOp(types.assign, 3) } + } + return this.finishOp(types.coalesce, 2) + } } return this.finishOp(types.question, 1) }; @@ -4737,30 +4750,67 @@ pp$9.readRegexp = function() { // were read, the integer value otherwise. When `len` is given, this // will return `null` unless the integer has exactly `len` digits. -pp$9.readInt = function(radix, len) { - var start = this.pos, total = 0; - for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) { +pp$9.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { + // `len` is used for character escape sequences. In that case, disallow separators. + var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined; + + // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b) + // and isn't fraction part nor exponent part. In that case, if the first digit + // is zero then disallow separators. + var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; + + var start = this.pos, total = 0, lastCode = 0; + for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) { var code = this.input.charCodeAt(this.pos), val = (void 0); + + if (allowSeparators && code === 95) { + if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); } + if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); } + if (i === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); } + lastCode = code; + continue + } + if (code >= 97) { val = code - 97 + 10; } // a else if (code >= 65) { val = code - 65 + 10; } // A else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9 else { val = Infinity; } if (val >= radix) { break } - ++this.pos; + lastCode = code; total = total * radix + val; } + + if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); } if (this.pos === start || len != null && this.pos - start !== len) { return null } return total }; +function stringToNumber(str, isLegacyOctalNumericLiteral) { + if (isLegacyOctalNumericLiteral) { + return parseInt(str, 8) + } + + // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value. + return parseFloat(str.replace(/_/g, "")) +} + +function stringToBigInt(str) { + if (typeof BigInt !== "function") { + return null + } + + // `BigInt(value)` throws syntax error if the string contains numeric separators. + return BigInt(str.replace(/_/g, "")) +} + pp$9.readRadixNumber = function(radix) { var start = this.pos; this.pos += 2; // 0x var val = this.readInt(radix); if (val == null) { this.raise(this.start + 2, "Expected number in radix " + radix); } if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) { - val = typeof BigInt !== "undefined" ? BigInt(this.input.slice(start, this.pos)) : null; + val = stringToBigInt(this.input.slice(start, this.pos)); ++this.pos; } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types.num, val) @@ -4770,13 +4820,12 @@ pp$9.readRadixNumber = function(radix) { pp$9.readNumber = function(startsWithDot) { var start = this.pos; - if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); } + if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); } var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48; if (octal && this.strict) { this.raise(start, "Invalid number"); } var next = this.input.charCodeAt(this.pos); if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { - var str$1 = this.input.slice(start, this.pos); - var val$1 = typeof BigInt !== "undefined" ? BigInt(str$1) : null; + var val$1 = stringToBigInt(this.input.slice(start, this.pos)); ++this.pos; if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types.num, val$1) @@ -4794,8 +4843,7 @@ pp$9.readNumber = function(startsWithDot) { } if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } - var str = this.input.slice(start, this.pos); - var val = octal ? parseInt(str, 8) : parseFloat(str); + var val = stringToNumber(this.input.slice(start, this.pos), octal); return this.finishToken(types.num, val) }; @@ -5054,7 +5102,7 @@ pp$9.readWord = function() { // Acorn is a tiny, fast JavaScript parser written in JavaScript. -var version = "7.3.1"; +var version = "7.4.0"; Parser.acorn = { Parser: Parser, diff --git a/tools/node_modules/eslint/node_modules/acorn/package.json b/tools/node_modules/eslint/node_modules/acorn/package.json index 1f8fc64675c9e0..c326a7cb899940 100644 --- a/tools/node_modules/eslint/node_modules/acorn/package.json +++ b/tools/node_modules/eslint/node_modules/acorn/package.json @@ -40,5 +40,5 @@ "prepare": "cd ..; npm run build:main && npm run build:bin" }, "types": "dist/acorn.d.ts", - "version": "7.3.1" + "version": "7.4.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js index b7db020775eb2d..93225bb0c4013e 100644 --- a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js +++ b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js @@ -84,6 +84,7 @@ BreakStatement: 'BreakStatement', CallExpression: 'CallExpression', CatchClause: 'CatchClause', + ChainExpression: 'ChainExpression', ClassBody: 'ClassBody', ClassDeclaration: 'ClassDeclaration', ClassExpression: 'ClassExpression', @@ -159,6 +160,7 @@ BreakStatement: ['label'], CallExpression: ['callee', 'arguments'], CatchClause: ['param', 'body'], + ChainExpression: ['expression'], ClassBody: ['body'], ClassDeclaration: ['id', 'superClass', 'body'], ClassExpression: ['id', 'superClass', 'body'], diff --git a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json index 8affb3d09038a3..4d336a00e8b526 100644 --- a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json +++ b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json @@ -41,5 +41,5 @@ "test": "npm run-script lint && npm run-script unit-test", "unit-test": "mocha --compilers js:babel-register" }, - "version": "5.1.0" + "version": "5.2.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/lodash/README.md b/tools/node_modules/eslint/node_modules/lodash/README.md index a57334908b3817..e1c99503300407 100644 --- a/tools/node_modules/eslint/node_modules/lodash/README.md +++ b/tools/node_modules/eslint/node_modules/lodash/README.md @@ -1,4 +1,4 @@ -# lodash v4.17.19 +# lodash v4.17.20 The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. @@ -28,7 +28,7 @@ var at = require('lodash/at'); var curryN = require('lodash/fp/curryN'); ``` -See the [package source](https://github.com/lodash/lodash/tree/4.17.19-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.17.20-npm) for more details. **Note:**
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. diff --git a/tools/node_modules/eslint/node_modules/lodash/_baseClone.js b/tools/node_modules/eslint/node_modules/lodash/_baseClone.js index 290de9275def00..69f87054c56611 100644 --- a/tools/node_modules/eslint/node_modules/lodash/_baseClone.js +++ b/tools/node_modules/eslint/node_modules/lodash/_baseClone.js @@ -18,7 +18,8 @@ var Stack = require('./_Stack'), isMap = require('./isMap'), isObject = require('./isObject'), isSet = require('./isSet'), - keys = require('./keys'); + keys = require('./keys'), + keysIn = require('./keysIn'); /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, diff --git a/tools/node_modules/eslint/node_modules/lodash/_baseOrderBy.js b/tools/node_modules/eslint/node_modules/lodash/_baseOrderBy.js index d8a46ab20a2c5d..775a01741ede20 100644 --- a/tools/node_modules/eslint/node_modules/lodash/_baseOrderBy.js +++ b/tools/node_modules/eslint/node_modules/lodash/_baseOrderBy.js @@ -1,10 +1,12 @@ var arrayMap = require('./_arrayMap'), + baseGet = require('./_baseGet'), baseIteratee = require('./_baseIteratee'), baseMap = require('./_baseMap'), baseSortBy = require('./_baseSortBy'), baseUnary = require('./_baseUnary'), compareMultiple = require('./_compareMultiple'), - identity = require('./identity'); + identity = require('./identity'), + isArray = require('./isArray'); /** * The base implementation of `_.orderBy` without param guards. @@ -16,8 +18,21 @@ var arrayMap = require('./_arrayMap'), * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); + iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { diff --git a/tools/node_modules/eslint/node_modules/lodash/_baseSet.js b/tools/node_modules/eslint/node_modules/lodash/_baseSet.js index 612a24cc85791f..99f4fbf9c347a7 100644 --- a/tools/node_modules/eslint/node_modules/lodash/_baseSet.js +++ b/tools/node_modules/eslint/node_modules/lodash/_baseSet.js @@ -29,6 +29,10 @@ function baseSet(object, path, value, customizer) { var key = toKey(path[index]), newValue = value; + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; diff --git a/tools/node_modules/eslint/node_modules/lodash/_baseSortedIndexBy.js b/tools/node_modules/eslint/node_modules/lodash/_baseSortedIndexBy.js index bb22e36dcdf620..c247b377ff5b1a 100644 --- a/tools/node_modules/eslint/node_modules/lodash/_baseSortedIndexBy.js +++ b/tools/node_modules/eslint/node_modules/lodash/_baseSortedIndexBy.js @@ -22,11 +22,14 @@ var nativeFloor = Math.floor, * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { - value = iteratee(value); - var low = 0, - high = array == null ? 0 : array.length, - valIsNaN = value !== value, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined; diff --git a/tools/node_modules/eslint/node_modules/lodash/_equalArrays.js b/tools/node_modules/eslint/node_modules/lodash/_equalArrays.js index f6a3b7c9f27640..824228c78cb8ab 100644 --- a/tools/node_modules/eslint/node_modules/lodash/_equalArrays.js +++ b/tools/node_modules/eslint/node_modules/lodash/_equalArrays.js @@ -27,10 +27,11 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } - // Assume cyclic values are equal. - var stacked = stack.get(array); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; } var index = -1, result = true, diff --git a/tools/node_modules/eslint/node_modules/lodash/_equalObjects.js b/tools/node_modules/eslint/node_modules/lodash/_equalObjects.js index 17421f374c9986..cdaacd2dfd8895 100644 --- a/tools/node_modules/eslint/node_modules/lodash/_equalObjects.js +++ b/tools/node_modules/eslint/node_modules/lodash/_equalObjects.js @@ -39,10 +39,11 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { return false; } } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); diff --git a/tools/node_modules/eslint/node_modules/lodash/core.js b/tools/node_modules/eslint/node_modules/lodash/core.js index 31a2bc01b866a5..6d70dcaf87035b 100644 --- a/tools/node_modules/eslint/node_modules/lodash/core.js +++ b/tools/node_modules/eslint/node_modules/lodash/core.js @@ -1,7 +1,7 @@ /** * @license * Lodash (Custom Build) - * Build: `lodash core exports="node" -o ./npm-package/core.js` + * Build: `lodash core -o ./dist/lodash.core.js` * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.15'; + var VERSION = '4.17.20'; /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -1183,6 +1183,12 @@ if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; + } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; @@ -1293,6 +1299,12 @@ return false; } } + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } var result = true; var skipCtor = isPartial; @@ -1935,6 +1947,10 @@ * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { return baseFilter(collection, baseIteratee(predicate)); @@ -2188,15 +2204,15 @@ * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, + * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ function sortBy(collection, iteratee) { var index = 0; @@ -3503,6 +3519,9 @@ * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.0.0 @@ -3518,6 +3537,10 @@ * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(assign({}, source)); @@ -3826,10 +3849,29 @@ /*--------------------------------------------------------------------------*/ - if (freeModule) { + // Some AMD build optimizers, like r.js, check for condition patterns like: + if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { + // Expose Lodash on the global object to prevent errors when Lodash is + // loaded by a script tag in the presence of an AMD loader. + // See http://requirejs.org/docs/errors.html#mismatch for more details. + // Use `_.noConflict` to remove Lodash from the global object. + root._ = lodash; + + // Define as an anonymous module so, through path mapping, it can be + // referenced as the "underscore" module. + define(function() { + return lodash; + }); + } + // Check for `exports` after `define` in case a build optimizer adds it. + else if (freeModule) { // Export for Node.js. (freeModule.exports = lodash)._ = lodash; // Export for CommonJS support. freeExports._ = lodash; } + else { + // Export to the global object. + root._ = lodash; + } }.call(this)); diff --git a/tools/node_modules/eslint/node_modules/lodash/core.min.js b/tools/node_modules/eslint/node_modules/lodash/core.min.js index 64f14e48bfe41b..f40952565b2e65 100644 --- a/tools/node_modules/eslint/node_modules/lodash/core.min.js +++ b/tools/node_modules/eslint/node_modules/lodash/core.min.js @@ -1,29 +1,30 @@ /** * @license * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE - * Build: `lodash core exports="node" -o ./npm-package/core.js` + * Build: `lodash core -o ./dist/lodash.core.js` */ -;(function(){function n(n){return H(n)&&pn.call(n,"callee")&&!yn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?Z:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return j(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function"); -return setTimeout(function(){n.apply(Z,r)},t)}function f(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function a(n,t,r){for(var e=-1,u=n.length;++et}function b(n,t,r,e,u){return n===t||(null==n||null==t||!H(n)&&!H(t)?n!==n&&t!==t:y(n,t,r,e,b,u))}function y(n,t,r,e,u,o){var i=Nn(n),c=Nn(t),f=i?"[object Array]":hn.call(n),a=c?"[object Array]":hn.call(t),f="[object Arguments]"==f?"[object Object]":f,a="[object Arguments]"==a?"[object Object]":a,l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){ -return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=T(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 1&r||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=B(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t, -r=u(i,f,r,e,o),o.pop(),r)}function g(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?d:r)(n)}function _(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;for(var c=-1,f=true,a=2&r?[]:Z;++cr?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,mn)}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Fn(n), -function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){return n===t||n!==n&&t!==t}function M(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1=t),t&&!U(n)}function U(n){return!!V(n)&&(n=hn.call(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function V(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function H(n){return null!=n&&typeof n=="object"}function K(n){ -return typeof n=="number"||H(n)&&"[object Number]"==hn.call(n)}function L(n){return typeof n=="string"||!Nn(n)&&H(n)&&"[object String]"==hn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return null==n?[]:u(n,Dn(n))}function X(n){return n}function Y(n,r,e){var u=Dn(r),o=h(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=h(r,Dn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(n);return mn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__; -if(i||r){var e=n(this.__wrapped__);return(e.__actions__=A(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var Z,nn=1/0,tn=/[&<>"']/g,rn=RegExp(tn.source),en=/^(?:0|[1-9]\d*)$/,un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){ -return function(t){return null==n?Z:n[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,bn=Object.create,yn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return V(t)?bn?bn(t):(n.prototype=t,t=new n,n.prototype=Z,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i; -var mn=function(n,t){return function(r,e){if(null==r)return r;if(!M(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=jn(e+r,0));n:{for(t=g(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r0&&e(f)?r>1?y(f,r-1,e,u,o):n(o,f):u||(o[o.length]=f)}return o}function g(n,t){return n&&Vt(n,t,cr)}function _(n,t){return v(t,function(t){return Tn(n[t])})}function b(n){return W(n)}function j(n,t){return n>t}function d(n){return In(n)&&b(n)==ht}function m(n,t,r,e,u){return n===t||(null==n||null==t||!In(n)&&!In(t)?n!==n&&t!==t:O(n,t,r,e,m,u))}function O(n,t,r,e,u,o){ +var i=Zt(n),c=Zt(t),f=i?lt:b(n),a=c?lt:b(t);f=f==at?bt:f,a=a==at?bt:a;var l=f==bt,p=a==bt,s=f==a;o||(o=[]);var h=Lt(o,function(t){return t[0]==n}),v=Lt(o,function(n){return n[0]==t});if(h&&v)return h[1]==t;if(o.push([n,t]),o.push([t,n]),s&&!l){var y=i?J(n,t,r,e,u,o):M(n,t,f,r,e,u,o);return o.pop(),y}if(!(r&et)){var g=l&&Rt.call(n,"__wrapped__"),_=p&&Rt.call(t,"__wrapped__");if(g||_){var j=g?n.value():n,d=_?t.value():t,y=u(j,d,r,e,o);return o.pop(),y}}if(!s)return false;var y=U(n,t,r,e,u,o);return o.pop(), +y}function x(n){return In(n)&&b(n)==dt}function w(n){return typeof n=="function"?n:null==n?Hn:(typeof n=="object"?N:r)(n)}function A(n,t){return nu?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(u);++et||o&&i&&f&&!c&&!a||e&&i&&f||!r&&f||!u)return 1; +if(!e&&!o&&!a&&n1?r[u-1]:nt;for(o=n.length>3&&typeof o=="function"?(u--,o):nt,t=Object(t);++e-1?u[o?t[i]:i]:nt}}function G(n,t,r,e){function u(){for(var t=-1,c=arguments.length,f=-1,a=e.length,l=Array(a+c),p=this&&this!==kt&&this instanceof u?i:n;++fc))return false;var a=o.get(n),l=o.get(t);if(a&&l)return a==t&&l==n;for(var p=-1,s=true,h=r&ut?[]:nt;++p-1&&n%1==0&&n0&&(r=t.apply(this,arguments)),n<=1&&(t=nt),r}}function mn(n){if(typeof n!="function")throw new TypeError(rt);return function(){return!n.apply(this,arguments)}; +}function On(n){return dn(2,n)}function xn(n){return Bn(n)?Zt(n)?S(n):$(n,Gt(n)):n}function wn(n,t){return n===t||n!==n&&t!==t}function An(n){return null!=n&&Sn(n.length)&&!Tn(n)}function En(n){return n===true||n===false||In(n)&&b(n)==st}function Nn(n){return An(n)&&(Zt(n)||Dn(n)||Tn(n.splice)||Yt(n))?!n.length:!Gt(n).length}function kn(n,t){return m(n,t)}function Fn(n){return typeof n=="number"&&Ct(n)}function Tn(n){if(!Bn(n))return false;var t=b(n);return t==yt||t==gt||t==pt||t==jt}function Sn(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=ft; +}function Bn(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function In(n){return null!=n&&typeof n=="object"}function Rn(n){return qn(n)&&n!=+n}function $n(n){return null===n}function qn(n){return typeof n=="number"||In(n)&&b(n)==_t}function Dn(n){return typeof n=="string"||!Zt(n)&&In(n)&&b(n)==mt}function Pn(n){return n===nt}function zn(n){return An(n)?n.length?S(n):[]:Un(n)}function Cn(n){return typeof n=="string"?n:null==n?"":n+""}function Gn(n,t){var r=Mt(n);return null==t?r:ur(r,t); +}function Jn(n,t){return null!=n&&Rt.call(n,t)}function Mn(n,t,r){var e=null==n?nt:n[t];return e===nt&&(e=r),Tn(e)?e.call(n):e}function Un(n){return null==n?[]:o(n,cr(n))}function Vn(n){return n=Cn(n),n&&xt.test(n)?n.replace(Ot,St):n}function Hn(n){return n}function Kn(n){return N(ur({},n))}function Ln(t,r,e){var u=cr(r),o=_(r,u);null!=e||Bn(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=_(r,cr(r)));var i=!(Bn(e)&&"chain"in e&&!e.chain),c=Tn(t);return Ut(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){ +var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=S(this.__actions__)).push({func:u,args:arguments,thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}function Qn(){return kt._===this&&(kt._=Dt),this}function Wn(){}function Xn(n){var t=++$t;return Cn(n)+t}function Yn(n){return n&&n.length?h(n,Hn,j):nt}function Zn(n){return n&&n.length?h(n,Hn,A):nt}var nt,tt="4.17.20",rt="Expected a function",et=1,ut=2,ot=1,it=32,ct=1/0,ft=9007199254740991,at="[object Arguments]",lt="[object Array]",pt="[object AsyncFunction]",st="[object Boolean]",ht="[object Date]",vt="[object Error]",yt="[object Function]",gt="[object GeneratorFunction]",_t="[object Number]",bt="[object Object]",jt="[object Proxy]",dt="[object RegExp]",mt="[object String]",Ot=/[&<>"']/g,xt=RegExp(Ot.source),wt=/^(?:0|[1-9]\d*)$/,At={ +"&":"&","<":"<",">":">",'"':""","'":"'"},Et=typeof global=="object"&&global&&global.Object===Object&&global,Nt=typeof self=="object"&&self&&self.Object===Object&&self,kt=Et||Nt||Function("return this")(),Ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tt=Ft&&typeof module=="object"&&module&&!module.nodeType&&module,St=e(At),Bt=Array.prototype,It=Object.prototype,Rt=It.hasOwnProperty,$t=0,qt=It.toString,Dt=kt._,Pt=Object.create,zt=It.propertyIsEnumerable,Ct=kt.isFinite,Gt=i(Object.keys,Object),Jt=Math.max,Mt=function(){ +function n(){}return function(t){if(!Bn(t))return{};if(Pt)return Pt(t);n.prototype=t;var r=new n;return n.prototype=nt,r}}();f.prototype=Mt(c.prototype),f.prototype.constructor=f;var Ut=D(g),Vt=P(),Ht=Wn,Kt=Hn,Lt=C(nn),Qt=F(function(n,t,r){return G(n,ot|it,t,r)}),Wt=F(function(n,t){return p(n,1,t)}),Xt=F(function(n,t,r){return p(n,er(t)||0,r)}),Yt=Ht(function(){return arguments}())?Ht:function(n){return In(n)&&Rt.call(n,"callee")&&!zt.call(n,"callee")},Zt=Array.isArray,nr=d,tr=x,rr=Number,er=Number,ur=q(function(n,t){ +$(t,Gt(t),n)}),or=q(function(n,t){$(t,Q(t),n)}),ir=F(function(n,t){n=Object(n);var r=-1,e=t.length,u=e>2?t[2]:nt;for(u&&L(t[0],t[1],u)&&(e=1);++r objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; diff --git a/tools/node_modules/eslint/node_modules/lodash/lodash.js b/tools/node_modules/eslint/node_modules/lodash/lodash.js index ab6dbe20adaa2c..1fd7116f426a28 100644 --- a/tools/node_modules/eslint/node_modules/lodash/lodash.js +++ b/tools/node_modules/eslint/node_modules/lodash/lodash.js @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.19'; + var VERSION = '4.17.20'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -15588,7 +15588,7 @@ * // => [{ 'a': 4, 'b': 5, 'c': 6 }] * * // Checking for several possible values - * _.filter(users, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { @@ -15625,7 +15625,7 @@ * // => { 'a': 4, 'b': 5, 'c': 6 } * * // Checking for several possible values - * _.filter(users, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); + * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matchesProperty(path, srcValue) { diff --git a/tools/node_modules/eslint/node_modules/lodash/lodash.min.js b/tools/node_modules/eslint/node_modules/lodash/lodash.min.js index e23037163698e4..a078dd9317619a 100644 --- a/tools/node_modules/eslint/node_modules/lodash/lodash.min.js +++ b/tools/node_modules/eslint/node_modules/lodash/lodash.min.js @@ -12,7 +12,7 @@ return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;) for(var u=r-1,i=n.length;++u-1;);return r}function W(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;return e}function C(n){return"\\"+Gr[n]}function U(n,t){ return null==n?Y:n[t]}function B(n){return Dr.test(n)}function T(n){return Mr.test(n)}function $(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function D(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function M(n,t){return function(r){return n(t(r))}}function F(n,t){for(var r=-1,e=n.length,u=0,i=[];++r>>1,Un=[["ary",dn],["bind",sn],["bindKey",hn],["curry",_n],["curryRight",vn],["flip",wn],["partial",gn],["partialRight",yn],["rearg",bn]],Bn="[object Arguments]",Tn="[object Array]",$n="[object AsyncFunction]",Dn="[object Boolean]",Mn="[object Date]",Fn="[object DOMException]",Nn="[object Error]",Pn="[object Function]",qn="[object GeneratorFunction]",Zn="[object Map]",Kn="[object Number]",Vn="[object Null]",Gn="[object Object]",Hn="[object Promise]",Jn="[object Proxy]",Yn="[object RegExp]",Qn="[object Set]",Xn="[object String]",nt="[object Symbol]",tt="[object Undefined]",rt="[object WeakMap]",et="[object WeakSet]",ut="[object ArrayBuffer]",it="[object DataView]",ot="[object Float32Array]",ft="[object Float64Array]",ct="[object Int8Array]",at="[object Int16Array]",lt="[object Int32Array]",st="[object Uint8Array]",ht="[object Uint8ClampedArray]",pt="[object Uint16Array]",_t="[object Uint32Array]",vt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,dt=/&(?:amp|lt|gt|quot|#39);/g,bt=/[&<>"']/g,wt=RegExp(dt.source),mt=RegExp(bt.source),xt=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,At=/<%=([\s\S]+?)%>/g,kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ot=/^\w*$/,It=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,zt=RegExp(Rt.source),Et=/^\s+|\s+$/g,St=/^\s+/,Wt=/\s+$/,Lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ct=/\{\n\/\* \[wrapped with (.+)\] \*/,Ut=/,? & /,Bt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Tt=/\\(\\)?/g,$t=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Dt=/\w*$/,Mt=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Nt=/^\[object .+?Constructor\]$/,Pt=/^0o[0-7]+$/i,qt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Vt=/['\n\r\u2028\u2029\\]/g,Gt="\\ud800-\\udfff",Ht="\\u0300-\\u036f",Jt="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Qt=Ht+Jt+Yt,Xt="\\u2700-\\u27bf",nr="a-z\\xdf-\\xf6\\xf8-\\xff",tr="\\xac\\xb1\\xd7\\xf7",rr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",er="\\u2000-\\u206f",ur=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ir="A-Z\\xc0-\\xd6\\xd8-\\xde",or="\\ufe0e\\ufe0f",fr=tr+rr+er+ur,cr="['\u2019]",ar="["+Gt+"]",lr="["+fr+"]",sr="["+Qt+"]",hr="\\d+",pr="["+Xt+"]",_r="["+nr+"]",vr="[^"+Gt+fr+hr+Xt+nr+ir+"]",gr="\\ud83c[\\udffb-\\udfff]",yr="(?:"+sr+"|"+gr+")",dr="[^"+Gt+"]",br="(?:\\ud83c[\\udde6-\\uddff]){2}",wr="[\\ud800-\\udbff][\\udc00-\\udfff]",mr="["+ir+"]",xr="\\u200d",jr="(?:"+_r+"|"+vr+")",Ar="(?:"+mr+"|"+vr+")",kr="(?:"+cr+"(?:d|ll|m|re|s|t|ve))?",Or="(?:"+cr+"(?:D|LL|M|RE|S|T|VE))?",Ir=yr+"?",Rr="["+or+"]?",zr="(?:"+xr+"(?:"+[dr,br,wr].join("|")+")"+Rr+Ir+")*",Er="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Sr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wr=Rr+Ir+zr,Lr="(?:"+[pr,br,wr].join("|")+")"+Wr,Cr="(?:"+[dr+sr+"?",sr,br,wr,ar].join("|")+")",Ur=RegExp(cr,"g"),Br=RegExp(sr,"g"),Tr=RegExp(gr+"(?="+gr+")|"+Cr+Wr,"g"),$r=RegExp([mr+"?"+_r+"+"+kr+"(?="+[lr,mr,"$"].join("|")+")",Ar+"+"+Or+"(?="+[lr,mr+jr,"$"].join("|")+")",mr+"?"+jr+"+"+kr,mr+"+"+Or,Sr,Er,hr,Lr].join("|"),"g"),Dr=RegExp("["+xr+Gt+Qt+or+"]"),Mr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nr=-1,Pr={}; +var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function q(n,t,r){for(var e=r-1,u=n.length;++e>>1,Un=[["ary",dn],["bind",sn],["bindKey",hn],["curry",_n],["curryRight",vn],["flip",wn],["partial",gn],["partialRight",yn],["rearg",bn]],Bn="[object Arguments]",Tn="[object Array]",$n="[object AsyncFunction]",Dn="[object Boolean]",Mn="[object Date]",Fn="[object DOMException]",Nn="[object Error]",Pn="[object Function]",qn="[object GeneratorFunction]",Zn="[object Map]",Kn="[object Number]",Vn="[object Null]",Gn="[object Object]",Hn="[object Promise]",Jn="[object Proxy]",Yn="[object RegExp]",Qn="[object Set]",Xn="[object String]",nt="[object Symbol]",tt="[object Undefined]",rt="[object WeakMap]",et="[object WeakSet]",ut="[object ArrayBuffer]",it="[object DataView]",ot="[object Float32Array]",ft="[object Float64Array]",ct="[object Int8Array]",at="[object Int16Array]",lt="[object Int32Array]",st="[object Uint8Array]",ht="[object Uint8ClampedArray]",pt="[object Uint16Array]",_t="[object Uint32Array]",vt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,dt=/&(?:amp|lt|gt|quot|#39);/g,bt=/[&<>"']/g,wt=RegExp(dt.source),mt=RegExp(bt.source),xt=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,At=/<%=([\s\S]+?)%>/g,kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ot=/^\w*$/,It=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,zt=RegExp(Rt.source),Et=/^\s+|\s+$/g,St=/^\s+/,Wt=/\s+$/,Lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ct=/\{\n\/\* \[wrapped with (.+)\] \*/,Ut=/,? & /,Bt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Tt=/\\(\\)?/g,$t=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Dt=/\w*$/,Mt=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Nt=/^\[object .+?Constructor\]$/,Pt=/^0o[0-7]+$/i,qt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Vt=/['\n\r\u2028\u2029\\]/g,Gt="\\ud800-\\udfff",Ht="\\u0300-\\u036f",Jt="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Qt=Ht+Jt+Yt,Xt="\\u2700-\\u27bf",nr="a-z\\xdf-\\xf6\\xf8-\\xff",tr="\\xac\\xb1\\xd7\\xf7",rr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",er="\\u2000-\\u206f",ur=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ir="A-Z\\xc0-\\xd6\\xd8-\\xde",or="\\ufe0e\\ufe0f",fr=tr+rr+er+ur,cr="['\u2019]",ar="["+Gt+"]",lr="["+fr+"]",sr="["+Qt+"]",hr="\\d+",pr="["+Xt+"]",_r="["+nr+"]",vr="[^"+Gt+fr+hr+Xt+nr+ir+"]",gr="\\ud83c[\\udffb-\\udfff]",yr="(?:"+sr+"|"+gr+")",dr="[^"+Gt+"]",br="(?:\\ud83c[\\udde6-\\uddff]){2}",wr="[\\ud800-\\udbff][\\udc00-\\udfff]",mr="["+ir+"]",xr="\\u200d",jr="(?:"+_r+"|"+vr+")",Ar="(?:"+mr+"|"+vr+")",kr="(?:"+cr+"(?:d|ll|m|re|s|t|ve))?",Or="(?:"+cr+"(?:D|LL|M|RE|S|T|VE))?",Ir=yr+"?",Rr="["+or+"]?",zr="(?:"+xr+"(?:"+[dr,br,wr].join("|")+")"+Rr+Ir+")*",Er="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Sr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wr=Rr+Ir+zr,Lr="(?:"+[pr,br,wr].join("|")+")"+Wr,Cr="(?:"+[dr+sr+"?",sr,br,wr,ar].join("|")+")",Ur=RegExp(cr,"g"),Br=RegExp(sr,"g"),Tr=RegExp(gr+"(?="+gr+")|"+Cr+Wr,"g"),$r=RegExp([mr+"?"+_r+"+"+kr+"(?="+[lr,mr,"$"].join("|")+")",Ar+"+"+Or+"(?="+[lr,mr+jr,"$"].join("|")+")",mr+"?"+jr+"+"+kr,mr+"+"+Or,Sr,Er,hr,Lr].join("|"),"g"),Dr=RegExp("["+xr+Gt+Qt+or+"]"),Mr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nr=-1,Pr={}; Pr[ot]=Pr[ft]=Pr[ct]=Pr[at]=Pr[lt]=Pr[st]=Pr[ht]=Pr[pt]=Pr[_t]=!0,Pr[Bn]=Pr[Tn]=Pr[ut]=Pr[Dn]=Pr[it]=Pr[Mn]=Pr[Nn]=Pr[Pn]=Pr[Zn]=Pr[Kn]=Pr[Gn]=Pr[Yn]=Pr[Qn]=Pr[Xn]=Pr[rt]=!1;var qr={};qr[Bn]=qr[Tn]=qr[ut]=qr[it]=qr[Dn]=qr[Mn]=qr[ot]=qr[ft]=qr[ct]=qr[at]=qr[lt]=qr[Zn]=qr[Kn]=qr[Gn]=qr[Yn]=qr[Qn]=qr[Xn]=qr[nt]=qr[st]=qr[ht]=qr[pt]=qr[_t]=!0,qr[Nn]=qr[Pn]=qr[rt]=!1;var Zr={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a", "\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae", "\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g", diff --git a/tools/node_modules/eslint/node_modules/lodash/matches.js b/tools/node_modules/eslint/node_modules/lodash/matches.js index 11145db37f4fa1..e10b35198b8517 100644 --- a/tools/node_modules/eslint/node_modules/lodash/matches.js +++ b/tools/node_modules/eslint/node_modules/lodash/matches.js @@ -16,6 +16,9 @@ var CLONE_DEEP_FLAG = 1; * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.0.0 @@ -31,6 +34,10 @@ var CLONE_DEEP_FLAG = 1; * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); diff --git a/tools/node_modules/eslint/node_modules/lodash/matchesProperty.js b/tools/node_modules/eslint/node_modules/lodash/matchesProperty.js index cc062ac99378e9..e6f1a882d610a8 100644 --- a/tools/node_modules/eslint/node_modules/lodash/matchesProperty.js +++ b/tools/node_modules/eslint/node_modules/lodash/matchesProperty.js @@ -13,6 +13,9 @@ var CLONE_DEEP_FLAG = 1; * `srcValue` values against any array or object value, respectively. See * `_.isEqual` for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.2.0 @@ -29,6 +32,10 @@ var CLONE_DEEP_FLAG = 1; * * _.find(objects, _.matchesProperty('a', 4)); * // => { 'a': 4, 'b': 5, 'c': 6 } + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); diff --git a/tools/node_modules/eslint/node_modules/lodash/overEvery.js b/tools/node_modules/eslint/node_modules/lodash/overEvery.js index c115d15384c866..fb19d13ed987e1 100644 --- a/tools/node_modules/eslint/node_modules/lodash/overEvery.js +++ b/tools/node_modules/eslint/node_modules/lodash/overEvery.js @@ -5,6 +5,10 @@ var arrayEvery = require('./_arrayEvery'), * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 diff --git a/tools/node_modules/eslint/node_modules/lodash/overSome.js b/tools/node_modules/eslint/node_modules/lodash/overSome.js index f902907a954114..414ab66b925d1a 100644 --- a/tools/node_modules/eslint/node_modules/lodash/overSome.js +++ b/tools/node_modules/eslint/node_modules/lodash/overSome.js @@ -5,6 +5,10 @@ var arraySome = require('./_arraySome'), * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 @@ -24,6 +28,9 @@ var arraySome = require('./_arraySome'), * * func(NaN); * // => false + * + * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) + * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) */ var overSome = createOver(arraySome); diff --git a/tools/node_modules/eslint/node_modules/lodash/package.json b/tools/node_modules/eslint/node_modules/lodash/package.json index 425f8427508101..7acee17382cd2b 100644 --- a/tools/node_modules/eslint/node_modules/lodash/package.json +++ b/tools/node_modules/eslint/node_modules/lodash/package.json @@ -36,5 +36,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" }, - "version": "4.17.19" + "version": "4.17.20" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/lodash/sortBy.js b/tools/node_modules/eslint/node_modules/lodash/sortBy.js index 4ba8f7a0ed9bb5..d756aba6c5ebd3 100644 --- a/tools/node_modules/eslint/node_modules/lodash/sortBy.js +++ b/tools/node_modules/eslint/node_modules/lodash/sortBy.js @@ -22,15 +22,15 @@ var baseFlatten = require('./_baseFlatten'), * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, + * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { diff --git a/tools/node_modules/eslint/node_modules/lodash/template.js b/tools/node_modules/eslint/node_modules/lodash/template.js index f71d13024982f0..1556a099afe4e4 100644 --- a/tools/node_modules/eslint/node_modules/lodash/template.js +++ b/tools/node_modules/eslint/node_modules/lodash/template.js @@ -169,11 +169,11 @@ function template(string, options, guard) { // Use a sourceURL for easier debugging. // The sourceURL gets injected into the source that's eval-ed, so be careful - // with lookup (in case of e.g. prototype pollution), and strip newlines if any. - // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. + // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in + // and escape the comment, thus injecting code that gets evaled. var sourceURL = hasOwnProperty.call(options, 'sourceURL') ? ('//# sourceURL=' + - (options.sourceURL + '').replace(/[\r\n]/g, ' ') + + (options.sourceURL + '').replace(/\s/g, ' ') + '\n') : ''; @@ -206,8 +206,6 @@ function template(string, options, guard) { // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. - // Like with sourceURL, we take care to not check the option's prototype, - // as this configuration is a code injection vector. var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index a0b031f6e9baf1..8fb23ff29b9c47 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -79,7 +79,6 @@ "karma-mocha": "^1.3.0", "karma-mocha-reporter": "^2.2.3", "karma-webpack": "^4.0.0-rc.6", - "leche": "^2.2.3", "lint-staged": "^10.1.2", "load-perf": "^0.2.0", "markdownlint": "^0.19.0", @@ -153,5 +152,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.6.0" + "version": "7.7.0" } \ No newline at end of file From c62cf1d9c50aa4d152f28f61df86a6faafa45093 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 14 Aug 2020 15:19:51 -0700 Subject: [PATCH 20/25] doc: edit filehandle.close() entry in fs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34782 Reviewed-By: Richard Lau Reviewed-By: Harshitha K P Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- doc/api/fs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 4e5ff93e91e9a4..434b8dd577f2bd 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4548,8 +4548,8 @@ added: v10.0.0 file descriptor is closed, or will be rejected if an error occurs while closing. -Closes the file handle. Will wait for any pending operation on the handle -to complete before completing. +Closes the file handle after waiting for any pending operation on the handle to +complete. ```js const fsPromises = require('fs').promises; From 6726246dbb83e3251f080fc4729154d492f7e340 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Fri, 26 Jun 2020 13:14:48 +0300 Subject: [PATCH 21/25] lib: allow to validate enums with validateOneOf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34070 Reviewed-By: Zeyu Yang Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- lib/_http_agent.js | 7 +- lib/dns.js | 4 +- lib/internal/child_process.js | 10 +-- lib/internal/dns/promises.js | 6 +- lib/internal/validators.js | 17 +++++ lib/vm.js | 26 ++----- ...st-child-process-advanced-serialization.js | 3 +- test/parallel/test-dns-lookup.js | 3 +- test/parallel/test-http-agent-scheduling.js | 3 +- .../test-internal-validators-validateoneof.js | 69 +++++++++++++++++++ 10 files changed, 108 insertions(+), 40 deletions(-) create mode 100644 test/parallel/test-internal-validators-validateoneof.js diff --git a/lib/_http_agent.js b/lib/_http_agent.js index c4430e86ec3aca..fc20260baf642c 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -39,12 +39,11 @@ const { async_id_symbol } = require('internal/async_hooks').symbols; const { codes: { ERR_INVALID_ARG_TYPE, - ERR_INVALID_OPT_VALUE, ERR_OUT_OF_RANGE, }, } = require('internal/errors'); const { once } = require('internal/util'); -const { validateNumber } = require('internal/validators'); +const { validateNumber, validateOneOf } = require('internal/validators'); const kOnKeylog = Symbol('onkeylog'); const kRequestOptions = Symbol('requestOptions'); @@ -99,9 +98,7 @@ function Agent(options) { this.maxTotalSockets = this.options.maxTotalSockets; this.totalSocketCount = 0; - if (this.scheduling !== 'fifo' && this.scheduling !== 'lifo') { - throw new ERR_INVALID_OPT_VALUE('scheduling', this.scheduling); - } + validateOneOf(this.scheduling, 'scheduling', ['fifo', 'lifo'], true); if (this.maxTotalSockets !== undefined) { validateNumber(this.maxTotalSockets, 'maxTotalSockets'); diff --git a/lib/dns.js b/lib/dns.js index 92b70c73effbf2..0393069f811711 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -49,6 +49,7 @@ const { const { validatePort, validateString, + validateOneOf, } = require('internal/validators'); const { @@ -114,8 +115,7 @@ function lookup(hostname, options, callback) { family = options >>> 0; } - if (family !== 0 && family !== 4 && family !== 6) - throw new ERR_INVALID_OPT_VALUE('family', family); + validateOneOf(family, 'family', [0, 4, 6], true); if (!hostname) { emitInvalidHostnameWarning(hostname); diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 1295950f5d51ae..b068a740817c60 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -21,7 +21,7 @@ const { ERR_MISSING_ARGS } } = require('internal/errors'); -const { validateString } = require('internal/validators'); +const { validateString, validateOneOf } = require('internal/validators'); const EventEmitter = require('events'); const net = require('net'); const dgram = require('dgram'); @@ -345,13 +345,9 @@ ChildProcess.prototype.spawn = function(options) { const ipcFd = stdio.ipcFd; stdio = options.stdio = stdio.stdio; - if (options.serialization !== undefined && - options.serialization !== 'json' && - options.serialization !== 'advanced') { - throw new ERR_INVALID_OPT_VALUE('options.serialization', - options.serialization); - } + validateOneOf(options.serialization, 'options.serialization', + [undefined, 'json', 'advanced'], true); const serialization = options.serialization || 'json'; if (ipc !== undefined) { diff --git a/lib/internal/dns/promises.js b/lib/internal/dns/promises.js index 16cd97e06ac5ca..19ad6e5bfb3a6b 100644 --- a/lib/internal/dns/promises.js +++ b/lib/internal/dns/promises.js @@ -31,7 +31,8 @@ const { } = codes; const { validatePort, - validateString + validateString, + validateOneOf, } = require('internal/validators'); function onlookup(err, addresses) { @@ -116,8 +117,7 @@ function lookup(hostname, options) { family = options >>> 0; } - if (family !== 0 && family !== 4 && family !== 6) - throw new ERR_INVALID_OPT_VALUE('family', family); + validateOneOf(family, 'family', [0, 4, 6], true); return createLookupPromise(family, hostname, all, hints, verbatim); } diff --git a/lib/internal/validators.js b/lib/internal/validators.js index deab53d4b8221e..71726f700518e3 100644 --- a/lib/internal/validators.js +++ b/lib/internal/validators.js @@ -13,6 +13,7 @@ const { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, + ERR_INVALID_OPT_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL, ERR_INVALID_CALLBACK, @@ -126,6 +127,21 @@ function validateNumber(value, name) { throw new ERR_INVALID_ARG_TYPE(name, 'number', value); } +const validateOneOf = hideStackFrames((value, name, oneOf, option = false) => { + if (!oneOf.includes(value)) { + const allowed = oneOf + .map((v) => (typeof v === 'string' ? `'${v}'` : String(v))) + .join(', '); + if (!option) { + const reason = 'must be one of: ' + allowed; + throw new ERR_INVALID_ARG_VALUE(name, value, reason); + } else { + const reason = 'Must be one of: ' + allowed; + throw new ERR_INVALID_OPT_VALUE(name, value, reason); + } + } +}); + function validateBoolean(value, name) { if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value); @@ -212,6 +228,7 @@ module.exports = { validateInteger, validateNumber, validateObject, + validateOneOf, validatePort, validateSignalName, validateString, diff --git a/lib/vm.js b/lib/vm.js index ca7bdb2259dd8e..45a2edf0bb20b3 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -39,7 +39,6 @@ const { const { ERR_CONTEXT_NOT_INITIALIZED, ERR_INVALID_ARG_TYPE, - ERR_INVALID_ARG_VALUE, } = require('internal/errors').codes; const { isArrayBufferView, @@ -52,6 +51,7 @@ const { validateBoolean, validateBuffer, validateObject, + validateOneOf, } = require('internal/validators'); const { kVmBreakFirstLineSymbol, @@ -246,17 +246,11 @@ function createContext(contextObject = {}, options = {}) { let microtaskQueue = null; if (microtaskMode !== undefined) { - validateString(microtaskMode, 'options.microtaskMode'); + validateOneOf(microtaskMode, 'options.microtaskMode', + ['afterEvaluate', undefined]); - if (microtaskMode === 'afterEvaluate') { + if (microtaskMode === 'afterEvaluate') microtaskQueue = new MicrotaskQueue(); - } else { - throw new ERR_INVALID_ARG_VALUE( - 'options.microtaskQueue', - microtaskQueue, - 'must be \'afterEvaluate\' or undefined' - ); - } } makeContext(contextObject, name, origin, strings, wasm, microtaskQueue); @@ -395,16 +389,8 @@ function measureMemory(options = {}) { emitExperimentalWarning('vm.measureMemory'); validateObject(options, 'options'); const { mode = 'summary', execution = 'default' } = options; - if (mode !== 'summary' && mode !== 'detailed') { - throw new ERR_INVALID_ARG_VALUE( - 'options.mode', options.mode, - 'must be either \'summary\' or \'detailed\''); - } - if (execution !== 'default' && execution !== 'eager') { - throw new ERR_INVALID_ARG_VALUE( - 'options.execution', options.execution, - 'must be either \'default\' or \'eager\''); - } + validateOneOf(mode, 'options.mode', ['summary', 'detailed']); + validateOneOf(execution, 'options.execution', ['default', 'eager']); const result = _measureMemory(measureMemoryModes[mode], measureMemoryExecutions[execution]); if (result === undefined) { diff --git a/test/parallel/test-child-process-advanced-serialization.js b/test/parallel/test-child-process-advanced-serialization.js index 0303fc719d331c..d75f0b59989bc6 100644 --- a/test/parallel/test-child-process-advanced-serialization.js +++ b/test/parallel/test-child-process-advanced-serialization.js @@ -11,7 +11,8 @@ if (process.argv[2] !== 'child') { }, { code: 'ERR_INVALID_OPT_VALUE', message: `The value "${value}" is invalid ` + - 'for option "options.serialization"' + 'for option "options.serialization". ' + + "Must be one of: undefined, 'json', 'advanced'" }); } diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index c50218068301cd..7a1917c7003ccd 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -72,7 +72,8 @@ assert.throws(() => { const err = { code: 'ERR_INVALID_OPT_VALUE', name: 'TypeError', - message: 'The value "20" is invalid for option "family"' + message: 'The value "20" is invalid for option "family". ' + + 'Must be one of: 0, 4, 6' }; const options = { hints: 0, diff --git a/test/parallel/test-http-agent-scheduling.js b/test/parallel/test-http-agent-scheduling.js index bcf07863b0fb61..7214ef5f877d7e 100644 --- a/test/parallel/test-http-agent-scheduling.js +++ b/test/parallel/test-http-agent-scheduling.js @@ -137,7 +137,8 @@ function badSchedulingOptionTest() { assert.strictEqual(err.code, 'ERR_INVALID_OPT_VALUE'); assert.strictEqual( err.message, - 'The value "filo" is invalid for option "scheduling"' + 'The value "filo" is invalid for option "scheduling". ' + + "Must be one of: 'fifo', 'lifo'" ); } } diff --git a/test/parallel/test-internal-validators-validateoneof.js b/test/parallel/test-internal-validators-validateoneof.js new file mode 100644 index 00000000000000..38a79a05151241 --- /dev/null +++ b/test/parallel/test-internal-validators-validateoneof.js @@ -0,0 +1,69 @@ +// Flags: --expose-internals +'use strict'; + +require('../common'); +const assert = require('assert'); +const { validateOneOf } = require('internal/validators'); + +{ + // validateOneOf number incorrect. + const allowed = [2, 3]; + assert.throws(() => validateOneOf(1, 'name', allowed), { + code: 'ERR_INVALID_ARG_VALUE', + // eslint-disable-next-line quotes + message: `The argument 'name' must be one of: 2, 3. Received 1` + }); + assert.throws(() => validateOneOf(1, 'name', allowed, true), { + code: 'ERR_INVALID_OPT_VALUE', + message: 'The value "1" is invalid for option "name". ' + + 'Must be one of: 2, 3' + }); +} + +{ + // validateOneOf number correct. + validateOneOf(2, 'name', [1, 2]); +} + +{ + // validateOneOf string incorrect. + const allowed = ['b', 'c']; + assert.throws(() => validateOneOf('a', 'name', allowed), { + code: 'ERR_INVALID_ARG_VALUE', + // eslint-disable-next-line quotes + message: `The argument 'name' must be one of: 'b', 'c'. Received 'a'` + }); + assert.throws(() => validateOneOf('a', 'name', allowed, true), { + code: 'ERR_INVALID_OPT_VALUE', + // eslint-disable-next-line quotes + message: `The value "a" is invalid for option "name". ` + + "Must be one of: 'b', 'c'", + }); +} + +{ + // validateOneOf string correct. + validateOneOf('two', 'name', ['one', 'two']); +} + +{ + // validateOneOf Symbol incorrect. + const allowed = [Symbol.for('b'), Symbol.for('c')]; + assert.throws(() => validateOneOf(Symbol.for('a'), 'name', allowed), { + code: 'ERR_INVALID_ARG_VALUE', + // eslint-disable-next-line quotes + message: `The argument 'name' must be one of: Symbol(b), Symbol(c). ` + + 'Received Symbol(a)' + }); + assert.throws(() => validateOneOf(Symbol.for('a'), 'name', allowed, true), { + code: 'ERR_INVALID_OPT_VALUE', + message: 'The value "Symbol(a)" is invalid for option "name". ' + + 'Must be one of: Symbol(b), Symbol(c)', + }); +} + +{ + // validateOneOf Symbol correct. + const allowed = [Symbol.for('b'), Symbol.for('c')]; + validateOneOf(Symbol.for('b'), 'name', allowed); +} From 15fdd9861bead2facc413f86b347a224c494fb47 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 15 Aug 2020 16:00:12 -0700 Subject: [PATCH 22/25] doc,lib: remove unused error code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As best as I can tell, ERR_V8BREAKITERATOR is unused anywhere in our code base and dependencies. Move to legacy errors. PR-URL: https://github.com/nodejs/node/pull/34792 Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- doc/api/errors.md | 10 +++++----- lib/internal/errors.js | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 210e36ff5b932d..6c4ed78488c7e8 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2139,11 +2139,6 @@ import 'package-name'; // supported `import` with URL schemes other than `file` and `data` is unsupported. - -### `ERR_V8BREAKITERATOR` - -The V8 `BreakIterator` API was used but the full ICU data set is not installed. - ### `ERR_VALID_PERFORMANCE_ENTRY_TYPE` @@ -2555,6 +2550,11 @@ An attempt was made to launch a Node.js process with an unknown `stdout` or `stderr` file type. This error is usually an indication of a bug within Node.js itself, although it is possible for user code to trigger it. + +### `ERR_V8BREAKITERATOR` + +The V8 `BreakIterator` API was used but the full ICU data set is not installed. + ### `ERR_VALUE_OUT_OF_RANGE` + +Type: Documentation-only + +The [`crypto.Certificate()` constructor][] is deprecated. Use +[static methods of `crypto.Certificate()`][] instead. + [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`--throw-deprecation`]: cli.html#cli_throw_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_static_method_buffer_allocunsafeslow_size @@ -2798,6 +2812,7 @@ Type: Documentation-only [`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.Certificate()` constructor]: crypto.html#crypto_legacy_api [`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 @@ -2897,3 +2912,4 @@ Type: Documentation-only [from_arraybuffer]: buffer.html#buffer_static_method_buffer_from_arraybuffer_byteoffset_length [from_string_encoding]: buffer.html#buffer_static_method_buffer_from_string_encoding [legacy `urlObject`]: url.html#url_legacy_urlobject +[static methods of `crypto.Certificate()`]: crypto.html#crypto_class_certificate