From e314681420b8ba79ce9e4ddf74b92ac3375ebad6 Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Tue, 12 Feb 2019 02:38:13 -0500 Subject: [PATCH 001/213] src: use more stable cast where possible PR-URL: https://github.com/nodejs/node/pull/26052 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Anto Aravinth Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau --- src/tracing/node_trace_buffer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tracing/node_trace_buffer.cc b/src/tracing/node_trace_buffer.cc index 796c9f529288e5..d2cfd02366583b 100644 --- a/src/tracing/node_trace_buffer.cc +++ b/src/tracing/node_trace_buffer.cc @@ -160,7 +160,7 @@ bool NodeTraceBuffer::TryLoadAvailableBuffer() { // static void NodeTraceBuffer::NonBlockingFlushSignalCb(uv_async_t* signal) { - NodeTraceBuffer* buffer = reinterpret_cast(signal->data); + NodeTraceBuffer* buffer = static_cast(signal->data); if (buffer->buffer1_.IsFull() && !buffer->buffer1_.IsFlushing()) { buffer->buffer1_.Flush(false); } From 143b844db275b2a020849eb53bb71cd3125923db Mon Sep 17 00:00:00 2001 From: jasnell Date: Thu, 14 Feb 2019 09:43:38 -0800 Subject: [PATCH 002/213] meta: moving jasnell temporarily to TSC emeritus Moving myself temporarily to TSC emertus status. Expecting to take a two month hiatus from TSC duties while I focus on some NearForm internal business. PR-URL: https://github.com/nodejs/node/pull/26106 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Matteo Collina --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7bc71da80fbc4e..91baaad51543fc 100644 --- a/README.md +++ b/README.md @@ -184,8 +184,6 @@ For information about the governance of the Node.js project, see **Jeremiah Senkpiel** <fishrock123@rocketmail.com> * [gabrielschulhof](https://github.com/gabrielschulhof) - **Gabriel Schulhof** <gabriel.schulhof@intel.com> -* [jasnell](https://github.com/jasnell) - -**James M Snell** <jasnell@gmail.com> (he/him) * [joyeecheung](https://github.com/joyeecheung) - **Joyee Cheung** <joyeec9h3@gmail.com> (she/her) * [mcollina](https://github.com/mcollina) - @@ -219,6 +217,8 @@ For information about the governance of the Node.js project, see **Fedor Indutny** <fedor.indutny@gmail.com> * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <i@izs.me> +* [jasnell](https://github.com/jasnell) - +**James M Snell** <jasnell@gmail.com> (he/him) * [joshgav](https://github.com/joshgav) - **Josh Gavant** <josh.gavant@outlook.com> * [mscdex](https://github.com/mscdex) - From 1766b8c341a12d2224dd638c399b66b828bc1ca6 Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Mon, 10 Dec 2018 20:44:18 +0000 Subject: [PATCH 003/213] trace_events: fix trace events JS API writing The Trace Events JS API isn't functional if none of --trace-events-enabled or --trace-event-categories is passed as a CLI argument. This commit fixes that. In addition, we currently don't test the trace_events JS API in the casewhere no CLI args are provided. This commit adds that test. Fixes https://github.com/nodejs/node/issues/24944 PR-URL: https://github.com/nodejs/node/pull/24945 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Ali Ijaz Sheikh --- src/node_trace_events.cc | 3 +++ src/node_v8_platform-inl.h | 16 ++++++++++---- src/tracing/agent.h | 6 ++++++ test/parallel/test-trace-events-api.js | 30 +++++++++++++++++++++----- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 9538e75d2c54ed..6a0d4f037a76c4 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -74,6 +74,9 @@ void NodeCategorySet::Enable(const FunctionCallbackInfo& args) { CHECK_NOT_NULL(category_set); const auto& categories = category_set->GetCategories(); if (!category_set->enabled_ && !categories.empty()) { + // Starts the Tracing Agent if it wasn't started already (e.g. through + // a command line flag.) + StartTracingAgent(); GetTracingAgentWriter()->Enable(categories); category_set->enabled_ = true; } diff --git a/src/node_v8_platform-inl.h b/src/node_v8_platform-inl.h index ed91ee3a022551..2c89ee9e5244b5 100644 --- a/src/node_v8_platform-inl.h +++ b/src/node_v8_platform-inl.h @@ -85,7 +85,11 @@ struct V8Platform { tracing_agent_->GetTracingController(); trace_state_observer_.reset(new NodeTraceStateObserver(controller)); controller->AddTraceStateObserver(trace_state_observer_.get()); - StartTracingAgent(); + tracing_file_writer_ = tracing_agent_->DefaultHandle(); + // Only start the tracing agent if we enabled any tracing categories. + if (!per_process::cli_options->trace_event_categories.empty()) { + StartTracingAgent(); + } // Tracing must be initialized before platform threads are created. platform_ = new NodePlatform(thread_pool_size, controller); v8::V8::InitializePlatform(platform_); @@ -111,9 +115,9 @@ struct V8Platform { } inline void StartTracingAgent() { - if (per_process::cli_options->trace_event_categories.empty()) { - tracing_file_writer_ = tracing_agent_->DefaultHandle(); - } else { + // Attach a new NodeTraceWriter only if this function hasn't been called + // before. + if (tracing_file_writer_.IsDefaultHandle()) { std::vector categories = SplitString(per_process::cli_options->trace_event_categories, ','); @@ -163,6 +167,10 @@ namespace per_process { extern struct V8Platform v8_platform; } +inline void StartTracingAgent() { + return per_process::v8_platform.StartTracingAgent(); +} + inline tracing::AgentWriterHandle* GetTracingAgentWriter() { return per_process::v8_platform.GetTracingAgentWriter(); } diff --git a/src/tracing/agent.h b/src/tracing/agent.h index 2e95e38582f7eb..0039cc36793054 100644 --- a/src/tracing/agent.h +++ b/src/tracing/agent.h @@ -59,6 +59,8 @@ class AgentWriterHandle { inline void Enable(const std::set& categories); inline void Disable(const std::set& categories); + inline bool IsDefaultHandle(); + inline Agent* agent() { return agent_; } inline v8::TracingController* GetTracingController(); @@ -175,6 +177,10 @@ void AgentWriterHandle::Disable(const std::set& categories) { if (agent_ != nullptr) agent_->Disable(id_, categories); } +bool AgentWriterHandle::IsDefaultHandle() { + return agent_ != nullptr && id_ == Agent::kDefaultHandleId; +} + inline v8::TracingController* AgentWriterHandle::GetTracingController() { return agent_ != nullptr ? agent_->GetTracingController() : nullptr; } diff --git a/test/parallel/test-trace-events-api.js b/test/parallel/test-trace-events-api.js index 346f943b9c36c5..cf11daa6edf869 100644 --- a/test/parallel/test-trace-events-api.js +++ b/test/parallel/test-trace-events-api.js @@ -17,8 +17,17 @@ const { getEnabledCategories } = require('trace_events'); +function getEnabledCategoriesFromCommandLine() { + const indexOfCatFlag = process.execArgv.indexOf('--trace-event-categories'); + if (indexOfCatFlag === -1) { + return undefined; + } else { + return process.execArgv[indexOfCatFlag + 1]; + } +} + const isChild = process.argv[2] === 'child'; -const enabledCategories = isChild ? 'foo' : undefined; +const enabledCategories = getEnabledCategoriesFromCommandLine(); assert.strictEqual(getEnabledCategories(), enabledCategories); [1, 'foo', true, false, null, undefined].forEach((i) => { @@ -51,7 +60,9 @@ tracing.enable(); // purposefully enable twice to test calling twice assert.strictEqual(tracing.enabled, true); assert.strictEqual(getEnabledCategories(), - isChild ? 'foo,node.perf' : 'node.perf'); + [ + ...[enabledCategories].filter((_) => !!_), 'node.perf' + ].join(',')); tracing.disable(); assert.strictEqual(tracing.enabled, false); @@ -106,7 +117,15 @@ if (isChild) { } } + testApiInChildProcess([], () => { + testApiInChildProcess(['--trace-event-categories', 'foo']); + }); +} + +function testApiInChildProcess(execArgs, cb) { tmpdir.refresh(); + // Save the current directory so we can chdir back to it later + const parentDir = process.cwd(); process.chdir(tmpdir.path); const expectedMarks = ['A', 'B']; @@ -121,15 +140,14 @@ if (isChild) { const proc = cp.fork(__filename, ['child'], - { execArgv: [ '--expose-gc', - '--trace-event-categories', - 'foo' ] }); + { execArgv: [ '--expose-gc', ...execArgs ] }); proc.once('exit', common.mustCall(() => { const file = path.join(tmpdir.path, 'node_trace.1.log'); assert(fs.existsSync(file)); fs.readFile(file, common.mustCall((err, data) => { + assert.ifError(err); const traces = JSON.parse(data.toString()).traceEvents .filter((trace) => trace.cat !== '__metadata'); assert.strictEqual(traces.length, @@ -160,6 +178,8 @@ if (isChild) { assert.fail('Unexpected trace event phase'); } }); + process.chdir(parentDir); + cb && process.nextTick(cb); })); })); } From dd60cd60b37b29c424993f89c1c51c0f7d4996b6 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 14 Feb 2019 09:32:47 -0500 Subject: [PATCH 004/213] test: add arg to narrow http benchmark test PR-URL: https://github.com/nodejs/node/pull/26101 Reviewed-By: Weijia Wang Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- test/benchmark/test-benchmark-http.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/benchmark/test-benchmark-http.js b/test/benchmark/test-benchmark-http.js index 65165c41135301..d0c9ef175530bc 100644 --- a/test/benchmark/test-benchmark-http.js +++ b/test/benchmark/test-benchmark-http.js @@ -29,7 +29,8 @@ runBenchmark('http', 'n=1', 'res=normal', 'type=asc', - 'value=X-Powered-By' + 'value=X-Powered-By', + 'headerDuplicates=1', ], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1, From 2d0242a69b9e99dcc8bfd2de80c360e03ca07f5e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 12 Feb 2019 19:22:41 -0800 Subject: [PATCH 005/213] test: increase coverage for assertion_error.js Add a test for long strings and assert.notDeepEqual() to cover code that truncates output when it is longer than 1024 characters. PR-URL: https://github.com/nodejs/node/pull/26065 Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani --- test/parallel/test-assert-deep.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index f495e51ef603de..bd04bef701c23b 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -659,16 +659,22 @@ assertDeepAndStrictEqual(-0, -0); assert.deepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)); -assert.throws(() => assert.deepEqual(new Date(), new Date(2000, 3, 14)), +assert.throws(() => { assert.deepEqual(new Date(), new Date(2000, 3, 14)); }, AssertionError, 'deepEqual(new Date(), new Date(2000, 3, 14))'); assert.throws( - () => assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)), + () => { assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)); }, AssertionError, 'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))' ); +assert.throws( + () => { assert.notDeepEqual('a'.repeat(1024), 'a'.repeat(1024)); }, + AssertionError, + 'notDeepEqual("a".repeat(1024), "a".repeat(1024))' +); + assert.notDeepEqual(new Date(), new Date(2000, 3, 14)); assertDeepAndStrictEqual(/a/, /a/); From 14cf22f86081232e0d4fe9158f6f7b539f436918 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Tue, 12 Feb 2019 15:39:10 +0000 Subject: [PATCH 006/213] fs, src, lib: fix `blksize` & `blocks` on Windows libuv returns values for `blksize` and `blocks` on stat calls so do not coerce them into `undefined` on Windows. PR-URL: https://github.com/nodejs/node/pull/26056 Fixes: https://github.com/nodejs/node/issues/25913 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung Reviewed-By: James M Snell --- doc/api/fs.md | 3 +-- lib/internal/fs/utils.js | 4 ++-- src/node_file.h | 8 -------- test/parallel/test-fs-stat-bigint.js | 3 --- test/parallel/test-fs-stat.js | 9 +++------ test/parallel/test-fs-watchfile-bigint.js | 4 ++-- test/parallel/test-fs-watchfile.js | 4 ++-- 7 files changed, 10 insertions(+), 25 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index e5f02e9cf51cc3..b5fd6702f6fbd4 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3414,8 +3414,7 @@ to compare `curr.mtime` and `prev.mtime`. When an `fs.watchFile` operation results in an `ENOENT` error, it will invoke the listener once, with all the fields zeroed (or, for dates, the -Unix Epoch). In Windows, `blksize` and `blocks` fields will be `undefined`, -instead of zero. If the file is created later on, the listener will be called +Unix Epoch). If the file is created later on, the listener will be called again, with the latest stat objects. This is a change in functionality since v0.10. diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index 0062bd435530d0..fb36a173c3bff5 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -315,9 +315,9 @@ Stats.prototype.isSocket = function() { function getStatsFromBinding(stats, offset = 0) { return new Stats(stats[0 + offset], stats[1 + offset], stats[2 + offset], stats[3 + offset], stats[4 + offset], stats[5 + offset], - isWindows ? undefined : stats[6 + offset], // blksize + stats[6 + offset], // blksize stats[7 + offset], stats[8 + offset], - isWindows ? undefined : stats[9 + offset], // blocks + stats[9 + offset], // blocks stats[10 + offset], stats[11 + offset], stats[12 + offset], stats[13 + offset]); } diff --git a/src/node_file.h b/src/node_file.h index 5ae01df9ef6106..034e3c0427da3d 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -199,18 +199,10 @@ constexpr void FillStatsArray(AliasedBuffer* fields, fields->SetValue(offset + 3, s->st_uid); fields->SetValue(offset + 4, s->st_gid); fields->SetValue(offset + 5, s->st_rdev); -#if defined(__POSIX__) fields->SetValue(offset + 6, s->st_blksize); -#else - fields->SetValue(offset + 6, 0); -#endif fields->SetValue(offset + 7, s->st_ino); fields->SetValue(offset + 8, s->st_size); -#if defined(__POSIX__) fields->SetValue(offset + 9, s->st_blocks); -#else - fields->SetValue(offset + 9, 0); -#endif // Dates. fields->SetValue(offset + 10, ToNative(s->st_atim)); fields->SetValue(offset + 11, ToNative(s->st_mtim)); diff --git a/test/parallel/test-fs-stat-bigint.js b/test/parallel/test-fs-stat-bigint.js index e5c21138a2ffe4..d00411268010f6 100644 --- a/test/parallel/test-fs-stat-bigint.js +++ b/test/parallel/test-fs-stat-bigint.js @@ -59,9 +59,6 @@ function verifyStats(bigintStats, numStats) { bigintStats.isSymbolicLink(), numStats.isSymbolicLink() ); - } else if (common.isWindows && (key === 'blksize' || key === 'blocks')) { - assert.strictEqual(bigintStats[key], undefined); - assert.strictEqual(numStats[key], undefined); } else if (Number.isSafeInteger(val)) { assert.strictEqual( bigintStats[key], BigInt(val), diff --git a/test/parallel/test-fs-stat.js b/test/parallel/test-fs-stat.js index 1003890bb8f459..a44e2ce3a75830 100644 --- a/test/parallel/test-fs-stat.js +++ b/test/parallel/test-fs-stat.js @@ -94,16 +94,13 @@ fs.stat(__filename, common.mustCall(function(err, s) { assert.strictEqual(s.isSymbolicLink(), false); const keys = [ 'dev', 'mode', 'nlink', 'uid', - 'gid', 'rdev', 'ino', 'size', + 'gid', 'rdev', 'blksize', 'ino', 'size', 'blocks', 'atime', 'mtime', 'ctime', 'birthtime', 'atimeMs', 'mtimeMs', 'ctimeMs', 'birthtimeMs' ]; - if (!common.isWindows) { - keys.push('blocks', 'blksize'); - } const numberFields = [ - 'dev', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'ino', 'size', - 'atimeMs', 'mtimeMs', 'ctimeMs', 'birthtimeMs' + 'dev', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'blksize', 'ino', 'size', + 'blocks', 'atimeMs', 'mtimeMs', 'ctimeMs', 'birthtimeMs' ]; const dateFields = ['atime', 'mtime', 'ctime', 'birthtime']; keys.forEach(function(k) { diff --git a/test/parallel/test-fs-watchfile-bigint.js b/test/parallel/test-fs-watchfile-bigint.js index 89cefd12e0443f..76c619260e00d8 100644 --- a/test/parallel/test-fs-watchfile-bigint.js +++ b/test/parallel/test-fs-watchfile-bigint.js @@ -15,10 +15,10 @@ const expectedStatObject = new fs.Stats( 0n, // uid 0n, // gid 0n, // rdev - common.isWindows ? undefined : 0n, // blksize + 0n, // blksize 0n, // ino 0n, // size - common.isWindows ? undefined : 0n, // blocks + 0n, // blocks 0n, // atim_msec 0n, // mtim_msec 0n, // ctim_msec diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index ba4becb2627c87..b3618792cdc756 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -38,10 +38,10 @@ const expectedStatObject = new fs.Stats( 0, // uid 0, // gid 0, // rdev - common.isWindows ? undefined : 0, // blksize + 0, // blksize 0, // ino 0, // size - common.isWindows ? undefined : 0, // blocks + 0, // blocks Date.UTC(1970, 0, 1, 0, 0, 0), // atime Date.UTC(1970, 0, 1, 0, 0, 0), // mtime Date.UTC(1970, 0, 1, 0, 0, 0), // ctime From f408d78914fe1b4151915f59c91cccb06d8436d8 Mon Sep 17 00:00:00 2001 From: Thang Tran Date: Wed, 6 Feb 2019 02:58:43 +0100 Subject: [PATCH 007/213] build: fixed clang's warning when building openssl clang doesn't seem to support 'Wno-old-style-declaration', this is a work-around. Fixes: https://github.com/nodejs/node/issues/25550 Refs: https://github.com/nodejs/node-v0.x-archive/issues/4186 PR-URL: https://github.com/nodejs/node/pull/25954 Reviewed-By: Refael Ackermann Reviewed-By: Daniel Bevenius Reviewed-By: Richard Lau Reviewed-By: James M Snell --- deps/openssl/openssl_common.gypi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/deps/openssl/openssl_common.gypi b/deps/openssl/openssl_common.gypi index 75002e87c2690f..c4b95c20aea5d4 100644 --- a/deps/openssl/openssl_common.gypi +++ b/deps/openssl/openssl_common.gypi @@ -57,14 +57,17 @@ ], }, { # linux and others - 'cflags': ['-Wno-missing-field-initializers', - ## TODO: check gcc_version>=4.3 - '-Wno-old-style-declaration'], + 'cflags': ['-Wno-missing-field-initializers',], 'defines': [ 'OPENSSLDIR="/etc/ssl"', 'ENGINESDIR="/dev/null"', 'TERMIOS', ], + 'conditions': [ + [ 'llvm_version==0', { + 'cflags': ['-Wno-old-style-declaration',], + }], + ], }], ] } From 77a944cdeec8f03edd3fb7267429030936cb1469 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 13 Feb 2019 21:26:59 +0100 Subject: [PATCH 008/213] worker: use fake MessageEvent for port.onmessage Instead of passing the payload for Workers directly to `.onmessage`, perform something more similar to what the browser API provides, namely create an event object with a `.data` property. This does not make `MessagePort` implement the `EventTarget` API, nor does it implement the full `MessageEvent` API, but it would make such extensions non-breaking changes if we desire them at some point in the future. (This would be a breaking change if Workers were not experimental. Currently, this method is also undocumented and only exists with the idea of enabling some degree of Web compatibility.) PR-URL: https://github.com/nodejs/node/pull/26082 Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Denys Otrishko --- lib/internal/worker/io.js | 8 +++--- src/env.h | 3 +++ src/node_messaging.cc | 27 +++++++++++++++---- .../test-worker-message-port-transfer-self.js | 2 +- test/parallel/test-worker-message-port.js | 5 ++-- test/parallel/test-worker-onmessage.js | 2 +- 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/lib/internal/worker/io.js b/lib/internal/worker/io.js index 9aa8c199588050..a72868916ca6cc 100644 --- a/lib/internal/worker/io.js +++ b/lib/internal/worker/io.js @@ -61,11 +61,11 @@ MessagePort.prototype.unref = MessagePortPrototype.unref; // uv_async_t) which can receive information from other threads and emits // .onmessage events, and a function used for sending data to a MessagePort // in some other thread. -MessagePort.prototype[kOnMessageListener] = function onmessage(payload) { - if (payload.type !== messageTypes.STDIO_WANTS_MORE_DATA) - debug(`[${threadId}] received message`, payload); +MessagePort.prototype[kOnMessageListener] = function onmessage(event) { + if (event.data && event.data.type !== messageTypes.STDIO_WANTS_MORE_DATA) + debug(`[${threadId}] received message`, event); // Emit the deserialized object to userland. - this.emit('message', payload); + this.emit('message', event.data); }; // This is for compatibility with the Web's MessagePort API. It makes sense to diff --git a/src/env.h b/src/env.h index 48aaa63a39cab4..749ad22b67267f 100644 --- a/src/env.h +++ b/src/env.h @@ -146,6 +146,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(crypto_ec_string, "ec") \ V(crypto_rsa_string, "rsa") \ V(cwd_string, "cwd") \ + V(data_string, "data") \ V(dest_string, "dest") \ V(destroyed_string, "destroyed") \ V(detached_string, "detached") \ @@ -291,6 +292,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(subject_string, "subject") \ V(subjectaltname_string, "subjectaltname") \ V(syscall_string, "syscall") \ + V(target_string, "target") \ V(thread_id_string, "threadId") \ V(ticketkeycallback_string, "onticketkeycallback") \ V(timeout_string, "timeout") \ @@ -359,6 +361,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(inspector_console_extension_installer, v8::Function) \ V(libuv_stream_wrap_ctor_template, v8::FunctionTemplate) \ V(message_port, v8::Object) \ + V(message_event_object_template, v8::ObjectTemplate) \ V(message_port_constructor_template, v8::FunctionTemplate) \ V(native_module_require, v8::Function) \ V(performance_entry_callback, v8::Function) \ diff --git a/src/node_messaging.cc b/src/node_messaging.cc index 896f43cd23d372..62f333bab0db98 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -25,6 +25,7 @@ using v8::Maybe; using v8::MaybeLocal; using v8::Nothing; using v8::Object; +using v8::ObjectTemplate; using v8::SharedArrayBuffer; using v8::String; using v8::Value; @@ -589,12 +590,19 @@ void MessagePort::OnMessage() { // Call the JS .onmessage() callback. HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(context); - Local args[] = { - received.Deserialize(env(), context).FromMaybe(Local()) - }; - if (args[0].IsEmpty() || - MakeCallback(env()->onmessage_string(), 1, args).IsEmpty()) { + Local event; + Local payload; + Local cb_args[1]; + if (!received.Deserialize(env(), context).ToLocal(&payload) || + !env()->message_event_object_template()->NewInstance(context) + .ToLocal(&event) || + event->Set(context, env()->data_string(), payload).IsNothing() || + event->Set(context, env()->target_string(), object()).IsNothing() || + (cb_args[0] = event, false) || + MakeCallback(env()->onmessage_string(), + arraysize(cb_args), + cb_args).IsEmpty()) { // Re-schedule OnMessage() execution in case of failure. if (data_) TriggerAsync(); @@ -763,6 +771,8 @@ MaybeLocal GetMessagePortConstructor( if (!templ.IsEmpty()) return templ->GetFunction(context); + Isolate* isolate = env->isolate(); + { Local m = env->NewFunctionTemplate(MessagePort::New); m->SetClassName(env->message_port_constructor_string()); @@ -775,6 +785,13 @@ MaybeLocal GetMessagePortConstructor( env->SetProtoMethod(m, "drain", MessagePort::Drain); env->set_message_port_constructor_template(m); + + Local event_ctor = FunctionTemplate::New(isolate); + event_ctor->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "MessageEvent")); + Local e = event_ctor->InstanceTemplate(); + e->Set(env->data_string(), Null(isolate)); + e->Set(env->target_string(), Null(isolate)); + env->set_message_event_object_template(e); } return GetMessagePortConstructor(env, context); diff --git a/test/parallel/test-worker-message-port-transfer-self.js b/test/parallel/test-worker-message-port-transfer-self.js index f076d3cb70f733..f02f06eaaea53f 100644 --- a/test/parallel/test-worker-message-port-transfer-self.js +++ b/test/parallel/test-worker-message-port-transfer-self.js @@ -25,7 +25,7 @@ assert.throws(common.mustCall(() => { // The failed transfer should not affect the ports in anyway. port2.onmessage = common.mustCall((message) => { - assert.strictEqual(message, 2); + assert.strictEqual(message.data, 2); const inspectedPort1 = util.inspect(port1); const inspectedPort2 = util.inspect(port2); diff --git a/test/parallel/test-worker-message-port.js b/test/parallel/test-worker-message-port.js index 47a8ddf6653c53..dce9da0b3063f5 100644 --- a/test/parallel/test-worker-message-port.js +++ b/test/parallel/test-worker-message-port.js @@ -21,14 +21,15 @@ const { MessageChannel, MessagePort } = require('worker_threads'); const { port1, port2 } = new MessageChannel(); port1.onmessage = common.mustCall((message) => { - assert.strictEqual(message, 4); + assert.strictEqual(message.data, 4); + assert.strictEqual(message.target, port1); port2.close(common.mustCall()); }); port1.postMessage(2); port2.onmessage = common.mustCall((message) => { - port2.postMessage(message * 2); + port2.postMessage(message.data * 2); }); } diff --git a/test/parallel/test-worker-onmessage.js b/test/parallel/test-worker-onmessage.js index 47f6324aad6933..f315b0d2019a9a 100644 --- a/test/parallel/test-worker-onmessage.js +++ b/test/parallel/test-worker-onmessage.js @@ -14,6 +14,6 @@ if (!process.env.HAS_STARTED_WORKER) { w.postMessage(2); } else { parentPort.onmessage = common.mustCall((message) => { - parentPort.postMessage(message * 2); + parentPort.postMessage(message.data * 2); }); } From d1e3724b5d5e37084349a30ebd1009607900c1ab Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 13 Feb 2019 22:01:55 +0100 Subject: [PATCH 009/213] test,worker: add more tests for worker.ref()/.unref() PR-URL: https://github.com/nodejs/node/pull/26083 Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/parallel/test-worker-ref-onexit.js | 10 +++++++++ test/parallel/test-worker-ref.js | 29 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 test/parallel/test-worker-ref-onexit.js create mode 100644 test/parallel/test-worker-ref.js diff --git a/test/parallel/test-worker-ref-onexit.js b/test/parallel/test-worker-ref-onexit.js new file mode 100644 index 00000000000000..0250c592ce91ae --- /dev/null +++ b/test/parallel/test-worker-ref-onexit.js @@ -0,0 +1,10 @@ +'use strict'; +const common = require('../common'); +const { Worker } = require('worker_threads'); + +// Check that worker.unref() makes the 'exit' event not be emitted, if it is +// the only thing we would otherwise be waiting for. + +const w = new Worker('', { eval: true }); +w.unref(); +w.on('exit', common.mustNotCall()); diff --git a/test/parallel/test-worker-ref.js b/test/parallel/test-worker-ref.js new file mode 100644 index 00000000000000..645fc0fbad8e37 --- /dev/null +++ b/test/parallel/test-worker-ref.js @@ -0,0 +1,29 @@ +'use strict'; +const common = require('../common'); +const { Worker } = require('worker_threads'); + +// Test that calling worker.unref() leads to 'beforeExit' being emitted, and +// that we can resurrect the worker using worker.ref() from there. + +const w = new Worker(` +const { parentPort } = require('worker_threads'); +parentPort.once('message', (msg) => { + parentPort.postMessage(msg); +}); +`, { eval: true }); + +process.once('beforeExit', common.mustCall(() => { + console.log('beforeExit'); + w.ref(); + w.postMessage({ hello: 'world' }); +})); + +w.once('message', common.mustCall((msg) => { + console.log('message', msg); +})); + +w.on('exit', common.mustCall(() => { + console.log('exit'); +})); + +w.unref(); From 497d9d8ab21a5f4b1fcd13ef3cda58428d6675a1 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Mon, 11 Feb 2019 22:47:05 +0800 Subject: [PATCH 010/213] src: use same parameter name in node_report.cc PR-URL: https://github.com/nodejs/node/pull/26046 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- src/node_report.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_report.cc b/src/node_report.cc index 8f882b9887424e..d4e332f607ab42 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -71,7 +71,7 @@ static void WriteNodeReport(Isolate* isolate, const std::string& filename, std::ostream& out, Local stackstr, - TIME_TYPE* time); + TIME_TYPE* tm_struct); static void PrintVersionInformation(JSONWriter* writer); static void PrintJavaScriptStack(JSONWriter* writer, Isolate* isolate, From a920721175ceb0b17788b548616de86cf7251ba6 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 13 Feb 2019 05:58:36 +0100 Subject: [PATCH 011/213] test: silence compiler warning in openssl-binding Currently, this test generated the following compiler warning: ../binding.cc:33:30: warning: 'TLSv1_2_server_method' is deprecated [-Wdeprecated-declarations] const SSL_METHOD* method = TLSv1_2_server_method(); ^ /node/deps/openssl/openssl/include/openssl/ssl.h:1877:1: note: 'TLSv1_2_server_method' has been explicitly marked deprecated here DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) ^ 1 warning generated. This commit adds -Wno-deprecated-declarations to silence this warning for this test. PR-URL: https://github.com/nodejs/node/pull/26067 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Sakthipriyan Vairamani --- test/addons/openssl-binding/binding.gyp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/addons/openssl-binding/binding.gyp b/test/addons/openssl-binding/binding.gyp index 38a7c10d672d92..3a30a7e86922a4 100644 --- a/test/addons/openssl-binding/binding.gyp +++ b/test/addons/openssl-binding/binding.gyp @@ -8,6 +8,15 @@ 'sources': ['binding.cc'], 'include_dirs': ['../../../deps/openssl/openssl/include'], }], + ['OS=="mac"', { + 'xcode_settings': { + 'OTHER_CFLAGS+': [ + '-Wno-deprecated-declarations', + ], + }, + }, { + 'cflags': ['-Wno-deprecated-declarations'], + }], ], }, ] From 69298713af872a09f684e22c4a86cad74e658ea8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 13 Feb 2019 19:48:18 -0800 Subject: [PATCH 012/213] worker: switch to internal assert module PR-URL: https://github.com/nodejs/node/pull/26091 Reviewed-By: Daniel Bevenius Reviewed-By: Gus Caplan Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca --- lib/internal/worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/worker.js b/lib/internal/worker.js index f43a9610495ac0..c81e1a5cd72771 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -1,7 +1,7 @@ 'use strict'; const EventEmitter = require('events'); -const assert = require('assert'); +const assert = require('internal/assert'); const path = require('path'); const util = require('util'); const { From 8045e409175a961d48c83cde55f7b03b9d5d3862 Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Thu, 14 Feb 2019 11:38:44 -0500 Subject: [PATCH 013/213] worker: remove duplicate call `Environment::RunCleanup` is invoked twice in a row, remove one. PR-URL: https://github.com/nodejs/node/pull/26104 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau --- src/node_worker.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/node_worker.cc b/src/node_worker.cc index f38b187c18c5b8..53789de1e89550 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -217,8 +217,6 @@ void Worker::Run() { stopped_ = true; } - env_->RunCleanup(); - // This call needs to be made while the `Environment` is still alive // because we assume that it is available for async tracking in the // NodePlatform implementation. From 2ff1644b346a9c721d417507ba239ed8e9ac0647 Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 15 Feb 2019 14:19:18 +0100 Subject: [PATCH 014/213] doc: fix notable changes list format for 11.9.0 & 11.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26129 Reviewed-By: Vse Mozhet Byt Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Сковорода Никита Андреевич --- doc/changelogs/CHANGELOG_V11.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/changelogs/CHANGELOG_V11.md b/doc/changelogs/CHANGELOG_V11.md index 7df5634c31b977..1b2593e3a82351 100644 --- a/doc/changelogs/CHANGELOG_V11.md +++ b/doc/changelogs/CHANGELOG_V11.md @@ -64,18 +64,18 @@ A fix for the following CVE is included in this release: ### Notable Changes -**deps** +* **deps** * Updated libuv to 1.26.0. [#26037](https://github.com/nodejs/node/pull/26037) * Updated npm to 6.7.0. [#25804](https://github.com/nodejs/node/pull/25804) -**http, http2** +* **http, http2** * `response.writeHead` now returns the response object. [#25974](https://github.com/nodejs/node/pull/25974) -**perf_hooks** +* **perf_hooks** * Implemented a histogram based API. [#25378](https://github.com/nodejs/node/pull/25378) -**process** +* **process** * Exposed `process.features.inspector`. [#25819](https://github.com/nodejs/node/pull/25378) -**repl** +* **repl** * Added `repl.setupHistory` for programmatic repl. [#25895](https://github.com/nodejs/node/pull/25895) -**tls** +* **tls** * Introduced client "session" event. [#25831](https://github.com/nodejs/node/pull/25831) ### Commits @@ -308,7 +308,7 @@ A fix for the following CVE is included in this release: ### Notable Changes -**deps**: +* **deps**: * OpenSSL has been updated to 1.1.1a, which is API/ABI compatible with the previous OpenSSL 1.1.0j. Note that while OpenSSL 1.1.1a supports TLS1.3, Node.js still does not. [#25381](https://github.com/nodejs/node/pull/25582)) From 0c4353a4441fb6b91b81c1d91f6b4c368b885d68 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 01:18:10 +0100 Subject: [PATCH 015/213] inspector: make sure timer handles are cleaned up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not obvious that timer handles are cleaned up properly when the current `Environment` exits, nor that the `Environment` knows to keep track of the closing handles. This change may not be necessary, because timer handles close without non-trivial delay (i.e. at the end of the current event loop term), and JS-based inspector sessions (which are the only ones we can easily test) are destroyed when cleaning up, closing the timers as a result. I don’t know what happens for other kinds of inspector sessions, though. PR-URL: https://github.com/nodejs/node/pull/26088 Reviewed-By: Eugene Ostroukhov Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel --- src/inspector_agent.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 8d7aad70e600e4..ef5646eb56695f 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -301,22 +301,30 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel, class InspectorTimer { public: - InspectorTimer(uv_loop_t* loop, + InspectorTimer(Environment* env, double interval_s, V8InspectorClient::TimerCallback callback, - void* data) : timer_(), + void* data) : env_(env), callback_(callback), data_(data) { - uv_timer_init(loop, &timer_); + uv_timer_init(env->event_loop(), &timer_); int64_t interval_ms = 1000 * interval_s; uv_timer_start(&timer_, OnTimer, interval_ms, interval_ms); + timer_.data = this; + + env->AddCleanupHook(CleanupHook, this); } InspectorTimer(const InspectorTimer&) = delete; void Stop() { - uv_timer_stop(&timer_); - uv_close(reinterpret_cast(&timer_), TimerClosedCb); + env_->RemoveCleanupHook(CleanupHook, this); + + if (timer_.data == this) { + timer_.data = nullptr; + uv_timer_stop(&timer_); + env_->CloseHandle(reinterpret_cast(&timer_), TimerClosedCb); + } } private: @@ -325,6 +333,10 @@ class InspectorTimer { timer->callback_(timer->data_); } + static void CleanupHook(void* data) { + static_cast(data)->Stop(); + } + static void TimerClosedCb(uv_handle_t* uvtimer) { std::unique_ptr timer( node::ContainerOf(&InspectorTimer::timer_, @@ -334,6 +346,7 @@ class InspectorTimer { ~InspectorTimer() {} + Environment* env_; uv_timer_t timer_; V8InspectorClient::TimerCallback callback_; void* data_; @@ -343,9 +356,9 @@ class InspectorTimer { class InspectorTimerHandle { public: - InspectorTimerHandle(uv_loop_t* loop, double interval_s, + InspectorTimerHandle(Environment* env, double interval_s, V8InspectorClient::TimerCallback callback, void* data) { - timer_ = new InspectorTimer(loop, interval_s, callback, data); + timer_ = new InspectorTimer(env, interval_s, callback, data); } InspectorTimerHandle(const InspectorTimerHandle&) = delete; @@ -540,7 +553,7 @@ class NodeInspectorClient : public V8InspectorClient { TimerCallback callback, void* data) override { timers_.emplace(std::piecewise_construct, std::make_tuple(data), - std::make_tuple(env_->event_loop(), interval_s, callback, + std::make_tuple(env_, interval_s, callback, data)); } From b5fe27ccc97a5e36ffa5e8535b13dda8de6515ce Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 10 Feb 2019 19:00:54 +0800 Subject: [PATCH 016/213] process: delay setup of global exception handlers Since bootstrap/node.js performs the setup synchronously, the process exception handlers do not have to setup so early in the bootstrap process - any fatal errors thrown before user code execution should simply crash the process, and we do not care about any clean up at that point. We don't care about emitting any events if the process crash upon bootstrap either. PR-URL: https://github.com/nodejs/node/pull/26061 Reviewed-By: Anna Henningsen Reviewed-By: Minwoo Jung Reviewed-By: Gus Caplan --- lib/internal/bootstrap/node.js | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index ca9d6c60cf3868..e3f85ec0afe38c 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -46,24 +46,6 @@ setupTraceCategoryState(); setupProcessObject(); -// TODO(joyeecheung): this does not have to done so early, any fatal errors -// thrown before user code execution should simply crash the process -// and we do not care about any clean up at that point. We don't care -// about emitting any events if the process crash upon bootstrap either. -{ - const { - fatalException, - setUncaughtExceptionCaptureCallback, - hasUncaughtExceptionCaptureCallback - } = NativeModule.require('internal/process/execution'); - - process._fatalException = fatalException; - process.setUncaughtExceptionCaptureCallback = - setUncaughtExceptionCaptureCallback; - process.hasUncaughtExceptionCaptureCallback = - hasUncaughtExceptionCaptureCallback; -} - setupGlobalProxy(); setupBuffer(); @@ -303,6 +285,20 @@ Object.defineProperty(process, 'features', { } }); +{ + const { + fatalException, + setUncaughtExceptionCaptureCallback, + hasUncaughtExceptionCaptureCallback + } = NativeModule.require('internal/process/execution'); + + process._fatalException = fatalException; + process.setUncaughtExceptionCaptureCallback = + setUncaughtExceptionCaptureCallback; + process.hasUncaughtExceptionCaptureCallback = + hasUncaughtExceptionCaptureCallback; +} + // User-facing NODE_V8_COVERAGE environment variable that writes // ScriptCoverage to a specified file. if (process.env.NODE_V8_COVERAGE) { From 3971510b66b814d58c03f381e27eb1e9785b33c5 Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Thu, 14 Feb 2019 18:07:14 -0500 Subject: [PATCH 017/213] doc: fix changelog entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26114 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Yuta Hiroto Reviewed-By: Сковорода Никита Андреевич --- doc/changelogs/CHANGELOG_V11.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelogs/CHANGELOG_V11.md b/doc/changelogs/CHANGELOG_V11.md index 1b2593e3a82351..167a19f69aa720 100644 --- a/doc/changelogs/CHANGELOG_V11.md +++ b/doc/changelogs/CHANGELOG_V11.md @@ -72,7 +72,7 @@ A fix for the following CVE is included in this release: * **perf_hooks** * Implemented a histogram based API. [#25378](https://github.com/nodejs/node/pull/25378) * **process** - * Exposed `process.features.inspector`. [#25819](https://github.com/nodejs/node/pull/25378) + * Exposed `process.features.inspector`. [#25819](https://github.com/nodejs/node/pull/25819) * **repl** * Added `repl.setupHistory` for programmatic repl. [#25895](https://github.com/nodejs/node/pull/25895) * **tls** From 82bc68b08e35bf4862c7678020db2d2b31af0d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 15 Feb 2019 15:11:40 +0100 Subject: [PATCH 018/213] doc: fix notable changes in v11 changelog --- doc/changelogs/CHANGELOG_V11.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/changelogs/CHANGELOG_V11.md b/doc/changelogs/CHANGELOG_V11.md index 167a19f69aa720..52878539c65687 100644 --- a/doc/changelogs/CHANGELOG_V11.md +++ b/doc/changelogs/CHANGELOG_V11.md @@ -64,18 +64,18 @@ A fix for the following CVE is included in this release: ### Notable Changes -* **deps** +* **deps**: * Updated libuv to 1.26.0. [#26037](https://github.com/nodejs/node/pull/26037) * Updated npm to 6.7.0. [#25804](https://github.com/nodejs/node/pull/25804) -* **http, http2** +* **http, http2**: * `response.writeHead` now returns the response object. [#25974](https://github.com/nodejs/node/pull/25974) -* **perf_hooks** +* **perf_hooks**: * Implemented a histogram based API. [#25378](https://github.com/nodejs/node/pull/25378) -* **process** +* **process**: * Exposed `process.features.inspector`. [#25819](https://github.com/nodejs/node/pull/25819) -* **repl** +* **repl**: * Added `repl.setupHistory` for programmatic repl. [#25895](https://github.com/nodejs/node/pull/25895) -* **tls** +* **tls**: * Introduced client "session" event. [#25831](https://github.com/nodejs/node/pull/25831) ### Commits @@ -311,7 +311,7 @@ A fix for the following CVE is included in this release: * **deps**: * OpenSSL has been updated to 1.1.1a, which is API/ABI compatible with the previous OpenSSL 1.1.0j. Note that while OpenSSL 1.1.1a supports TLS1.3, - Node.js still does not. [#25381](https://github.com/nodejs/node/pull/25582)) + Node.js still does not. [#25381](https://github.com/nodejs/node/pull/25381) ### Commits From a9c44372e1cb4f353a548eb4ed41404391b2936b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 13 Feb 2019 23:44:14 -0800 Subject: [PATCH 019/213] doc: consolidate N-API material in Collaborator Guide Consolidate the N-API material in the Collaborator Guide to be succinct and direct. PR-URL: https://github.com/nodejs/node/pull/26094 Reviewed-By: James M Snell Reviewed-By: Bryan English --- COLLABORATOR_GUIDE.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index aa1406a990b91f..726cc4bd65f4c3 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -312,15 +312,10 @@ For pull requests introducing new core modules: ### Additions to N-API -N-API provides an ABI-stable API guaranteed for future Node.js versions. -Existing N-API APIs cannot change or disappear, even in semver-major releases. -Thus, N-API additions call for unusual care and scrutiny. - -This -[guide](https://github.com/nodejs/node/blob/master/doc/guides/adding-new-napi-api.md) -outlines the requirements and principles that we should follow when -approving and landing new N-API APIs (any additions to `node_api.h` and -`node_api_types.h`). +N-API provides an ABI-stable API guaranteed for future Node.js versions. N-API +additions call for unusual care and scrutiny. If a change adds to `node_api.h` +or `node_api_types.h`, consult [the relevant +guide](https://github.com/nodejs/node/blob/master/doc/guides/adding-new-napi-api.md). ### Deprecations From 0408966a9dfd2e567bb4fbeef9b7f673fe87bd46 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 13 Feb 2019 20:50:39 +0800 Subject: [PATCH 020/213] src: remove unused macro in node_file.cc PR-URL: https://github.com/nodejs/node/pull/26073 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- src/node_file.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index 606900f2273866..960fd052e88014 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -74,10 +74,6 @@ using v8::Uint32; using v8::Undefined; using v8::Value; -#ifndef MIN -# define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - #ifndef S_ISDIR # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif From 24debc9d5c50e76bc16c6b54c015832d6aee4a50 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 21:46:50 +0100 Subject: [PATCH 021/213] worker: do not add removed methods to MessagePort Do not put the `.stop()` and `.drain()` methods on the `MessagePort` prototype if we are going to remove them later on anyway. PR-URL: https://github.com/nodejs/node/pull/26109 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- lib/internal/worker/io.js | 20 +++++++------------- src/node_messaging.cc | 13 +++++++++---- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/internal/worker/io.js b/lib/internal/worker/io.js index a72868916ca6cc..e88991aaaba0f0 100644 --- a/lib/internal/worker/io.js +++ b/lib/internal/worker/io.js @@ -6,7 +6,9 @@ const { } = internalBinding('symbols'); const { MessagePort, - MessageChannel + MessageChannel, + drainMessagePort, + stopMessagePort } = internalBinding('messaging'); const { threadId } = internalBinding('worker'); @@ -33,13 +35,6 @@ const messageTypes = { LOAD_SCRIPT: 'loadScript' }; -// Original drain from C++ -const originalDrain = MessagePort.prototype.drain; - -function drainMessagePort(port) { - return originalDrain.call(port); -} - // We have to mess with the MessagePort prototype a bit, so that a) we can make // it inherit from EventEmitter, even though it is a C++ class, and b) we do // not provide methods that are not present in the Browser and not documented @@ -51,9 +46,8 @@ const MessagePortPrototype = Object.create( // Set up the new inheritance chain. Object.setPrototypeOf(MessagePort, EventEmitter); Object.setPrototypeOf(MessagePort.prototype, EventEmitter.prototype); -// Finally, purge methods we don't want to be public. -delete MessagePort.prototype.stop; -delete MessagePort.prototype.drain; +// Copy methods that are inherited from HandleWrap, because +// changing the prototype of MessagePort.prototype implicitly removed them. MessagePort.prototype.ref = MessagePortPrototype.ref; MessagePort.prototype.unref = MessagePortPrototype.unref; @@ -84,7 +78,7 @@ Object.defineProperty(MessagePort.prototype, 'onmessage', { MessagePortPrototype.start.call(this); } else { this.unref(); - MessagePortPrototype.stop.call(this); + stopMessagePort(this); } } }); @@ -152,7 +146,7 @@ function setupPortReferencing(port, eventEmitter, eventName) { }); eventEmitter.on('removeListener', (name) => { if (name === eventName && eventEmitter.listenerCount(eventName) === 0) { - MessagePortPrototype.stop.call(port); + stopMessagePort(port); port.unref(); } }); diff --git a/src/node_messaging.cc b/src/node_messaging.cc index 62f333bab0db98..50d84f01d679d4 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -741,7 +741,8 @@ void MessagePort::Start(const FunctionCallbackInfo& args) { void MessagePort::Stop(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); MessagePort* port; - ASSIGN_OR_RETURN_UNWRAP(&port, args.This()); + CHECK(args[0]->IsObject()); + ASSIGN_OR_RETURN_UNWRAP(&port, args[0].As()); if (!port->data_) { THROW_ERR_CLOSED_MESSAGE_PORT(env); return; @@ -751,7 +752,8 @@ void MessagePort::Stop(const FunctionCallbackInfo& args) { void MessagePort::Drain(const FunctionCallbackInfo& args) { MessagePort* port; - ASSIGN_OR_RETURN_UNWRAP(&port, args.This()); + CHECK(args[0]->IsObject()); + ASSIGN_OR_RETURN_UNWRAP(&port, args[0].As()); port->OnMessage(); } @@ -781,8 +783,6 @@ MaybeLocal GetMessagePortConstructor( env->SetProtoMethod(m, "postMessage", MessagePort::PostMessage); env->SetProtoMethod(m, "start", MessagePort::Start); - env->SetProtoMethod(m, "stop", MessagePort::Stop); - env->SetProtoMethod(m, "drain", MessagePort::Drain); env->set_message_port_constructor_template(m); @@ -848,6 +848,11 @@ static void InitMessaging(Local target, .FromJust(); env->SetMethod(target, "registerDOMException", RegisterDOMException); + + // These are not methods on the MessagePort prototype, because + // the browser equivalents do not provide them. + env->SetMethod(target, "stopMessagePort", MessagePort::Stop); + env->SetMethod(target, "drainMessagePort", MessagePort::Drain); } } // anonymous namespace From 7d66d47dba9e6f93f4d270afc721276166cf4fa0 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 23:40:41 +0100 Subject: [PATCH 022/213] vm: do not overwrite error when creating context An empty `Local<>` already indicates that an exception is pending, so there is no need to throw an exception. In the case of Workers, this could override a `.terminate()` call. PR-URL: https://github.com/nodejs/node/pull/26112 Reviewed-By: Colin Ihrig Reviewed-By: Gus Caplan Reviewed-By: James M Snell --- src/node_contextify.cc | 1 - .../test-worker-vm-context-terminate.js | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-worker-vm-context-terminate.js diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 952acfe06f4b85..343342408b1a75 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -171,7 +171,6 @@ MaybeLocal ContextifyContext::CreateV8Context( Local ctx = NewContext(env->isolate(), object_template); if (ctx.IsEmpty()) { - env->ThrowError("Could not instantiate context"); return MaybeLocal(); } diff --git a/test/parallel/test-worker-vm-context-terminate.js b/test/parallel/test-worker-vm-context-terminate.js new file mode 100644 index 00000000000000..23b58ba4db14d5 --- /dev/null +++ b/test/parallel/test-worker-vm-context-terminate.js @@ -0,0 +1,19 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const vm = require('vm'); +const { Worker } = require('worker_threads'); + +// Do not use isMainThread so that this test itself can be run inside a Worker. +if (!process.env.HAS_STARTED_WORKER) { + process.env.HAS_STARTED_WORKER = 1; + const w = new Worker(__filename); + w.on('online', common.mustCall(() => { + setTimeout(() => w.terminate(), 50); + })); + w.on('error', common.mustNotCall()); + w.on('exit', common.mustCall((code) => assert.strictEqual(code, 1))); +} else { + while (true) + vm.runInNewContext(''); +} From be671c3bf51e704da26b5ae2378347de5d63188d Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 23:56:50 +0100 Subject: [PATCH 023/213] inspector: forward errors from InspectorConsoleCall Do not assume that entering JS cannot fail. PR-URL: https://github.com/nodejs/node/pull/26113 Reviewed-By: Joyee Cheung Reviewed-By: Eugene Ostroukhov Reviewed-By: Minwoo Jung Reviewed-By: James M Snell --- src/inspector_js_api.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 73493a81cf0573..4a3272e9204995 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -158,16 +158,22 @@ void InspectorConsoleCall(const FunctionCallbackInfo& info) { CHECK(config_value->IsObject()); Local config_object = config_value.As(); Local in_call_key = FIXED_ONE_BYTE_STRING(isolate, "in_call"); - if (!config_object->Has(context, in_call_key).FromMaybe(false)) { - CHECK(config_object->Set(context, - in_call_key, - v8::True(isolate)).FromJust()); - CHECK(!inspector_method.As()->Call(context, - info.Holder(), - call_args.length(), - call_args.out()).IsEmpty()); + bool has_in_call; + if (!config_object->Has(context, in_call_key).To(&has_in_call)) + return; + if (!has_in_call) { + if (config_object->Set(context, + in_call_key, + v8::True(isolate)).IsNothing() || + inspector_method.As()->Call(context, + info.Holder(), + call_args.length(), + call_args.out()).IsEmpty()) { + return; + } } - CHECK(config_object->Delete(context, in_call_key).FromJust()); + if (config_object->Delete(context, in_call_key).IsNothing()) + return; } Local node_method = info[1]; From cbd3cf083a7a4bffa499ed080dfbe457b5e27bec Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 15 Feb 2019 11:25:02 +0100 Subject: [PATCH 024/213] src: add debug CHECKs against empty handles These checks were useful while investigating other issues; using empty `Local<>`s can be very un-debuggable, because that typically does not lead to assertions with debugging information but rather crashes based on accessing invalid memory. PR-URL: https://github.com/nodejs/node/pull/26125 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/api/callback.cc | 5 +++++ src/node_errors.cc | 1 + 2 files changed, 6 insertions(+) diff --git a/src/api/callback.cc b/src/api/callback.cc index 885134799fe019..4bcccb960c5556 100644 --- a/src/api/callback.cc +++ b/src/api/callback.cc @@ -139,6 +139,11 @@ MaybeLocal InternalMakeCallback(Environment* env, Local argv[], async_context asyncContext) { CHECK(!recv.IsEmpty()); +#ifdef DEBUG + for (int i = 0; i < argc; i++) + CHECK(!argv[i].IsEmpty()); +#endif + InternalCallbackScope scope(env, recv, asyncContext); if (scope.Failed()) { return MaybeLocal(); diff --git a/src/node_errors.cc b/src/node_errors.cc index 42e19f690514ff..39673abf7f0e41 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -710,6 +710,7 @@ void DecorateErrorStack(Environment* env, void FatalException(Isolate* isolate, Local error, Local message) { + CHECK(!error.IsEmpty()); HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); From 1ce5e63987358a7166bdba0dc82d6d03c5fc341a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 15 Feb 2019 11:48:56 +0100 Subject: [PATCH 025/213] n-api: do not call into JS when that is not allowed Check whether calling into JS is allowed before doing so. PR-URL: https://github.com/nodejs/node/pull/26127 Reviewed-By: Gus Caplan Reviewed-By: Michael Dawson --- src/js_native_api_v8.h | 14 ++++--- src/node_api.cc | 5 +++ .../test_worker_terminate/binding.gyp | 8 ++++ test/node-api/test_worker_terminate/test.js | 23 +++++++++++ .../test_worker_terminate.c | 39 +++++++++++++++++++ 5 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 test/node-api/test_worker_terminate/binding.gyp create mode 100644 test/node-api/test_worker_terminate/test.js create mode 100644 test/node-api/test_worker_terminate/test_worker_terminate.c diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 81b00f2aa59b8f..094fc4afcc044c 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -11,6 +11,7 @@ struct napi_env__ { context_persistent(isolate, context) { CHECK_EQ(isolate, context->GetIsolate()); } + virtual ~napi_env__() {} v8::Isolate* const isolate; // Shortcut for context()->GetIsolate() v8impl::Persistent context_persistent; @@ -21,6 +22,8 @@ struct napi_env__ { inline void Ref() { refs++; } inline void Unref() { if ( --refs == 0) delete this; } + virtual bool can_call_into_js() const { return true; } + v8impl::Persistent last_exception; napi_extended_error_info last_error; int open_handle_scopes = 0; @@ -68,11 +71,12 @@ napi_status napi_set_last_error(napi_env env, napi_status error_code, RETURN_STATUS_IF_FALSE((env), !((maybe).IsEmpty()), (status)) // NAPI_PREAMBLE is not wrapped in do..while: try_catch must have function scope -#define NAPI_PREAMBLE(env) \ - CHECK_ENV((env)); \ - RETURN_STATUS_IF_FALSE((env), (env)->last_exception.IsEmpty(), \ - napi_pending_exception); \ - napi_clear_last_error((env)); \ +#define NAPI_PREAMBLE(env) \ + CHECK_ENV((env)); \ + RETURN_STATUS_IF_FALSE((env), \ + (env)->last_exception.IsEmpty() && (env)->can_call_into_js(), \ + napi_pending_exception); \ + napi_clear_last_error((env)); \ v8impl::TryCatch try_catch((env)) #define CHECK_TO_TYPE(env, type, context, result, src, status) \ diff --git a/src/node_api.cc b/src/node_api.cc index ff2e12f571a0f3..010fb3fe0ff840 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -12,9 +12,14 @@ struct node_napi_env__ : public napi_env__ { napi_env__(context) { CHECK_NOT_NULL(node_env()); } + inline node::Environment* node_env() const { return node::Environment::GetCurrent(context()); } + + bool can_call_into_js() const override { + return node_env()->can_call_into_js(); + } }; typedef node_napi_env__* node_napi_env; diff --git a/test/node-api/test_worker_terminate/binding.gyp b/test/node-api/test_worker_terminate/binding.gyp new file mode 100644 index 00000000000000..3a9465c7454148 --- /dev/null +++ b/test/node-api/test_worker_terminate/binding.gyp @@ -0,0 +1,8 @@ +{ + "targets": [ + { + "target_name": "test_worker_terminate", + "sources": [ "test_worker_terminate.c" ] + } + ] +} diff --git a/test/node-api/test_worker_terminate/test.js b/test/node-api/test_worker_terminate/test.js new file mode 100644 index 00000000000000..2bfaab8e8eb0a9 --- /dev/null +++ b/test/node-api/test_worker_terminate/test.js @@ -0,0 +1,23 @@ +'use strict'; +const common = require('../../common'); +const assert = require('assert'); +const { Worker, isMainThread, workerData } = require('worker_threads'); + +if (isMainThread) { + const counter = new Int32Array(new SharedArrayBuffer(4)); + const worker = new Worker(__filename, { workerData: { counter } }); + worker.on('exit', common.mustCall(() => { + assert.strictEqual(counter[0], 1); + })); + worker.on('error', common.mustNotCall()); +} else { + const { Test } = require(`./build/${common.buildType}/test_worker_terminate`); + + const { counter } = workerData; + // Test() tries to call a function twice and asserts that the second call does + // not work because of a pending exception. + Test(() => { + Atomics.add(counter, 0, 1); + process.exit(); + }); +} diff --git a/test/node-api/test_worker_terminate/test_worker_terminate.c b/test/node-api/test_worker_terminate/test_worker_terminate.c new file mode 100644 index 00000000000000..a88d936293e2a8 --- /dev/null +++ b/test/node-api/test_worker_terminate/test_worker_terminate.c @@ -0,0 +1,39 @@ +#include +#include +#include +#include "../../js-native-api/common.h" + +napi_value Test(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value recv; + napi_value argv[1]; + napi_status status; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &recv, NULL)); + NAPI_ASSERT(env, argc >= 1, "Not enough arguments, expected 1."); + + napi_valuetype t; + NAPI_CALL(env, napi_typeof(env, argv[0], &t)); + NAPI_ASSERT(env, t == napi_function, + "Wrong first argument, function expected."); + + status = napi_call_function(env, recv, argv[0], 0, NULL, NULL); + assert(status == napi_ok); + status = napi_call_function(env, recv, argv[0], 0, NULL, NULL); + assert(status == napi_pending_exception); + + return NULL; +} + +napi_value Init(napi_env env, napi_value exports) { + napi_property_descriptor properties[] = { + DECLARE_NAPI_PROPERTY("Test", Test) + }; + + NAPI_CALL(env, napi_define_properties( + env, exports, sizeof(properties) / sizeof(*properties), properties)); + + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) From 2335bcd6e66f2a9ac2b1c23f6deb8e3a1e9c28b3 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 15 Feb 2019 11:57:19 +0100 Subject: [PATCH 026/213] n-api: turn NAPI_CALL_INTO_MODULE into a function These do not need to be macros. PR-URL: https://github.com/nodejs/node/pull/26128 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/js_native_api_v8.cc | 7 ++++--- src/js_native_api_v8.h | 35 +++++++++++++++++++---------------- src/node_api.cc | 26 ++++++++++++++------------ 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 287142e2658907..fd3ed2af6afe06 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -303,11 +303,12 @@ class Reference : private Finalizer { napi_env env = reference->_env; if (reference->_finalize_callback != nullptr) { - NAPI_CALL_INTO_MODULE_THROW(env, + NapiCallIntoModuleThrow(env, [&]() { reference->_finalize_callback( reference->_env, reference->_finalize_data, - reference->_finalize_hint)); + reference->_finalize_hint); + }); } // this is safe because if a request to delete the reference @@ -448,7 +449,7 @@ class CallbackWrapperBase : public CallbackWrapper { napi_callback cb = _bundle->*FunctionField; napi_value result; - NAPI_CALL_INTO_MODULE_THROW(env, result = cb(env, cbinfo_wrapper)); + NapiCallIntoModuleThrow(env, [&]() { result = cb(env, cbinfo_wrapper); }); if (result != nullptr) { this->SetReturnValue(result); diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 094fc4afcc044c..d746660df42fd5 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -113,23 +113,26 @@ napi_status napi_set_last_error(napi_env env, napi_status error_code, } \ } while (0) -#define NAPI_CALL_INTO_MODULE(env, call, handle_exception) \ - do { \ - int open_handle_scopes = (env)->open_handle_scopes; \ - int open_callback_scopes = (env)->open_callback_scopes; \ - napi_clear_last_error((env)); \ - call; \ - CHECK_EQ((env)->open_handle_scopes, open_handle_scopes); \ - CHECK_EQ((env)->open_callback_scopes, open_callback_scopes); \ - if (!(env)->last_exception.IsEmpty()) { \ - handle_exception( \ - v8::Local::New((env)->isolate, (env)->last_exception)); \ - (env)->last_exception.Reset(); \ - } \ - } while (0) +template +void NapiCallIntoModule(napi_env env, T&& call, U&& handle_exception) { + int open_handle_scopes = env->open_handle_scopes; + int open_callback_scopes = env->open_callback_scopes; + napi_clear_last_error(env); + call(); + CHECK_EQ(env->open_handle_scopes, open_handle_scopes); + CHECK_EQ(env->open_callback_scopes, open_callback_scopes); + if (!env->last_exception.IsEmpty()) { + handle_exception(env->last_exception.Get(env->isolate)); + env->last_exception.Reset(); + } +} -#define NAPI_CALL_INTO_MODULE_THROW(env, call) \ - NAPI_CALL_INTO_MODULE((env), call, (env)->isolate->ThrowException) +template +void NapiCallIntoModuleThrow(napi_env env, T&& call) { + NapiCallIntoModule(env, call, [&](v8::Local value) { + env->isolate->ThrowException(value); + }); +} namespace v8impl { diff --git a/src/node_api.cc b/src/node_api.cc index 010fb3fe0ff840..282ef255dcaab4 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -34,11 +34,12 @@ class BufferFinalizer: private Finalizer { static void FinalizeBufferCallback(char* data, void* hint) { BufferFinalizer* finalizer = static_cast(hint); if (finalizer->_finalize_callback != nullptr) { - NAPI_CALL_INTO_MODULE_THROW(finalizer->_env, + NapiCallIntoModuleThrow(finalizer->_env, [&]() { finalizer->_finalize_callback( finalizer->_env, data, - finalizer->_finalize_hint)); + finalizer->_finalize_hint); + }); } Delete(finalizer); @@ -465,8 +466,9 @@ void napi_module_register_by_symbol(v8::Local exports, napi_env env = v8impl::GetEnv(context); napi_value _exports; - NAPI_CALL_INTO_MODULE_THROW(env, - _exports = init(env, v8impl::JsValueFromV8LocalValue(exports))); + NapiCallIntoModuleThrow(env, [&]() { + _exports = init(env, v8impl::JsValueFromV8LocalValue(exports)); + }); // If register function returned a non-null exports object different from // the exports object we passed it, set that as the "exports" property of @@ -874,14 +876,14 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork { // stored. napi_env env = _env; - NAPI_CALL_INTO_MODULE(env, - _complete(_env, ConvertUVErrorCode(status), _data), - [env] (v8::Local local_err) { - // If there was an unhandled exception in the complete callback, - // report it as a fatal exception. (There is no JavaScript on the - // callstack that can possibly handle it.) - v8impl::trigger_fatal_exception(env, local_err); - }); + NapiCallIntoModule(env, [&]() { + _complete(_env, ConvertUVErrorCode(status), _data); + }, [env](v8::Local local_err) { + // If there was an unhandled exception in the complete callback, + // report it as a fatal exception. (There is no JavaScript on the + // callstack that can possibly handle it.) + v8impl::trigger_fatal_exception(env, local_err); + }); // Note: Don't access `work` after this point because it was // likely deleted by the complete callback. From f44f33569d5c6021253b37c7eb9038cfe24143d4 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 13 Feb 2019 04:59:48 +0100 Subject: [PATCH 027/213] src: extract common sockaddr creation code This commit extracts code to create sockaddr which is shared by both UDPWrap::DoBind and UDPWrap::DoSend. PR-URL: https://github.com/nodejs/node/pull/26070 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Richard Lau --- src/udp_wrap.cc | 51 ++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index e4aca28c89500e..be1f59d2c52863 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -175,6 +175,19 @@ void UDPWrap::GetFD(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(fd); } +int sockaddr_for_family(int address_family, + const char* address, + const unsigned short port, + struct sockaddr_storage* addr) { + switch (address_family) { + case AF_INET: + return uv_ip4_addr(address, port, reinterpret_cast(addr)); + case AF_INET6: + return uv_ip6_addr(address, port, reinterpret_cast(addr)); + default: + CHECK(0 && "unexpected address family"); + } +} void UDPWrap::DoBind(const FunctionCallbackInfo& args, int family) { UDPWrap* wrap; @@ -191,24 +204,11 @@ void UDPWrap::DoBind(const FunctionCallbackInfo& args, int family) { if (!args[1]->Uint32Value(ctx).To(&port) || !args[2]->Uint32Value(ctx).To(&flags)) return; - char addr[sizeof(sockaddr_in6)]; - int err; - - switch (family) { - case AF_INET: - err = uv_ip4_addr(*address, port, reinterpret_cast(&addr)); - break; - case AF_INET6: - err = uv_ip6_addr(*address, port, reinterpret_cast(&addr)); - break; - default: - CHECK(0 && "unexpected address family"); - ABORT(); - } - + struct sockaddr_storage addr_storage; + int err = sockaddr_for_family(family, address.out(), port, &addr_storage); if (err == 0) { err = uv_udp_bind(&wrap->handle_, - reinterpret_cast(&addr), + reinterpret_cast(&addr_storage), flags); } @@ -392,27 +392,14 @@ void UDPWrap::DoSend(const FunctionCallbackInfo& args, int family) { req_wrap->msg_size = msg_size; - char addr[sizeof(sockaddr_in6)]; - int err; - - switch (family) { - case AF_INET: - err = uv_ip4_addr(*address, port, reinterpret_cast(&addr)); - break; - case AF_INET6: - err = uv_ip6_addr(*address, port, reinterpret_cast(&addr)); - break; - default: - CHECK(0 && "unexpected address family"); - ABORT(); - } - + struct sockaddr_storage addr_storage; + int err = sockaddr_for_family(family, address.out(), port, &addr_storage); if (err == 0) { err = req_wrap->Dispatch(uv_udp_send, &wrap->handle_, *bufs, count, - reinterpret_cast(&addr), + reinterpret_cast(&addr_storage), OnSend); } From d3525d75058ff0b4c2ef59d4bc75a28ddfd24fca Mon Sep 17 00:00:00 2001 From: Yang Guo Date: Wed, 13 Feb 2019 13:38:32 +0100 Subject: [PATCH 028/213] test: add --test-root option to test.py This way we can specify a custom path for the test folder, e.g. when building addons separately from the source tree. PR-URL: https://github.com/nodejs/node/pull/26093 Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- tools/test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/test.py b/tools/test.py index e6fc7be73f11b1..bf99c499024b00 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1393,6 +1393,8 @@ def BuildOptions(): default="") result.add_option('--temp-dir', help='Optional path to change directory used for tests', default=False) + result.add_option('--test-root', + help='Optional path to change test directory', dest='test_root', default=None) result.add_option('--repeat', help='Number of times to repeat given tests', default=1, type="int") @@ -1576,8 +1578,10 @@ def Main(): workspace = abspath(join(dirname(sys.argv[0]), '..')) test_root = join(workspace, 'test') + if options.test_root is not None: + test_root = options.test_root suites = GetSuites(test_root) - repositories = [TestRepository(join(workspace, 'test', name)) for name in suites] + repositories = [TestRepository(join(test_root, name)) for name in suites] repositories += [TestRepository(a) for a in options.suite] root = LiteralTestSuite(repositories, test_root) From a18b847d18567eb930deb5c4e85414844c03a5c1 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 22:10:03 +0100 Subject: [PATCH 029/213] doc: improve worker_threads documentation This adds a few examples and clarifications. PR-URL: https://github.com/nodejs/node/pull/26110 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Anto Aravinth Reviewed-By: James M Snell Reviewed-By: Vse Mozhet Byt --- doc/api/worker_threads.md | 117 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 112 insertions(+), 5 deletions(-) diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 840b831c903f6d..95cdae5f9a81af 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -4,8 +4,8 @@ > Stability: 1 - Experimental -The `worker_threads` module enables the use of threads with message channels -between them. To access it: +The `worker_threads` module enables the use of threads that execute JS code +in parallel. To access it: ```js const worker = require('worker_threads'); @@ -58,6 +58,18 @@ added: v10.5.0 Is `true` if this code is not running inside of a [`Worker`][] thread. +```js +const { Worker, isMainThread } = require('worker_threads'); + +if (isMainThread) { + // This re-loads the current file inside a Worker instance. + new Worker(__filename); +} else { + console.log('Inside Worker!'); + console.log(isMainThread); // Prints 'false'. +} +``` + ## worker.parentPort + +
+ +
+Nicholas C. Zakas +
+
+ +
+Kevin Partington +
+
+ +
+Ilya Volodin +
+
+ +
+Brandon Mills +
+
+ +
+Toru Nagashima +
+
+ +
+Gyandeep Singh +
+
+ +
+Kai Cataldo +
+
+ +
+Teddy Katz +
+
### Committers The people who review and fix bugs and help triage issues. - - - - - - - -
- -
- 薛定谔的猫
-
- -
- Pig Fang
-
- - -### Alumni - -Former TSC members and committers who previously helped maintain ESLint. - - - - - - - - - - - - - - - - - - - - - - - -
- -
- Mathias Schreck
-
- -
- Jamund Ferguson
-
- -
- Ian VanSchooten
-
- -
- Burak Yiğit Kaya
-
- -
- Michael Ficarra
-
- -
- Mark Pedrotti
-
- -
- Oleg Gaidarenko
-
- -
- Mike Sherov
-
- -
- Henry Zhu
-
- -
- Marat Dulin
-
- -
- Alexej Yaroshevich
-
- -
- Vitor Balocco
-
- -
- James Henry
-
- -
- Reyad Attiyat
-
- -
- Victor Hom
-
+ + +
+ +
+薛定谔的猫 +
+
+ +
+Pig Fang +
+
## Sponsors +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://opencollective.com/eslint) to get your logo on our README and website. + + + +

Gold Sponsors

+

Facebook Open Source Airbnb

Silver Sponsors

+

AMP Project

Bronze Sponsors

+

Faithlife

+ + +## Technology Sponsors + * Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com) diff --git a/tools/node_modules/eslint/lib/cli-engine.js b/tools/node_modules/eslint/lib/cli-engine.js index d7de2592a16d8f..dbf1abd00430c6 100644 --- a/tools/node_modules/eslint/lib/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine.js @@ -455,6 +455,9 @@ class CLIEngine { if (this.options.rules && Object.keys(this.options.rules).length) { const loadedRules = this.linter.getRules(); + // Ajv validator with default schema will mutate original object, so we must clone it recursively. + this.options.rules = lodash.cloneDeep(this.options.rules); + Object.keys(this.options.rules).forEach(name => { validator.validateRuleOptions(loadedRules.get(name), name, this.options.rules[name], "CLI"); }); diff --git a/tools/node_modules/eslint/lib/config/config-file.js b/tools/node_modules/eslint/lib/config/config-file.js index dde79cb40c87d9..f76b92830c447c 100644 --- a/tools/node_modules/eslint/lib/config/config-file.js +++ b/tools/node_modules/eslint/lib/config/config-file.js @@ -280,15 +280,38 @@ function writeYAMLConfigFile(config, filePath) { * Writes a configuration file in JavaScript format. * @param {Object} config The configuration object to write. * @param {string} filePath The filename to write to. + * @throws {Error} If an error occurs linting the config file contents. * @returns {void} * @private */ function writeJSConfigFile(config, filePath) { debug(`Writing JS config file: ${filePath}`); - const content = `module.exports = ${stringify(config, { cmp: sortByKey, space: 4 })};`; + let contentToWrite; + const stringifiedContent = `module.exports = ${stringify(config, { cmp: sortByKey, space: 4 })};`; - fs.writeFileSync(filePath, content, "utf8"); + try { + const CLIEngine = require("../cli-engine"); + const linter = new CLIEngine({ + baseConfig: config, + fix: true, + useEslintrc: false + }); + const report = linter.executeOnText(stringifiedContent); + + contentToWrite = report.results[0].output || stringifiedContent; + } catch (e) { + debug("Error linting JavaScript config file, writing unlinted version"); + const errorMessage = e.message; + + contentToWrite = stringifiedContent; + e.message = "An error occurred while generating your JavaScript config file. "; + e.message += "A config file was still generated, but the config file itself may not follow your linting rules."; + e.message += `\nError: ${errorMessage}`; + throw e; + } finally { + fs.writeFileSync(filePath, contentToWrite, "utf8"); + } } /** diff --git a/tools/node_modules/eslint/lib/config/config-initializer.js b/tools/node_modules/eslint/lib/config/config-initializer.js index a6791ba85307d2..b8126d4735c3c1 100644 --- a/tools/node_modules/eslint/lib/config/config-initializer.js +++ b/tools/node_modules/eslint/lib/config/config-initializer.js @@ -3,6 +3,7 @@ * @author Ilya Volodin */ + "use strict"; //------------------------------------------------------------------------------ @@ -28,6 +29,8 @@ const debug = require("debug")("eslint:config-initializer"); // Private //------------------------------------------------------------------------------ +const DEFAULT_ECMA_VERSION = 2018; + /* istanbul ignore next: hard to test fs function */ /** * Create .eslintrc file in the current working directory @@ -239,43 +242,65 @@ function configureRules(answers, config) { * @returns {Object} config object */ function processAnswers(answers) { - let config = { rules: {}, env: {}, parserOptions: {} }; + let config = { + rules: {}, + env: {}, + parserOptions: {}, + extends: [] + }; - config.parserOptions.ecmaVersion = answers.ecmaVersion; - if (answers.ecmaVersion >= 2015) { - if (answers.modules) { - config.parserOptions.sourceType = "module"; - } - config.env.es6 = true; - } + // set the latest ECMAScript version + config.parserOptions.ecmaVersion = DEFAULT_ECMA_VERSION; + config.env.es6 = true; + config.globals = { + Atomics: "readonly", + SharedArrayBuffer: "readonly" + }; - if (answers.commonjs) { + // set the module type + if (answers.moduleType === "esm") { + config.parserOptions.sourceType = "module"; + } else if (answers.moduleType === "commonjs") { config.env.commonjs = true; } + + // add in browser and node environments if necessary answers.env.forEach(env => { config.env[env] = true; }); - if (answers.jsx) { - config.parserOptions = config.parserOptions || {}; - config.parserOptions.ecmaFeatures = config.parserOptions.ecmaFeatures || {}; - config.parserOptions.ecmaFeatures.jsx = true; - if (answers.react) { - config.plugins = ["react"]; - config.parserOptions.ecmaVersion = 2018; - } + + // add in library information + if (answers.framework === "react") { + config.parserOptions.ecmaFeatures = { + jsx: true + }; + config.plugins = ["react"]; + } else if (answers.framework === "vue") { + config.plugins = ["vue"]; + config.extends.push("plugin:vue/essential"); } - if (answers.source === "prompt") { - config.extends = "eslint:recommended"; - config.rules.indent = ["error", answers.indent]; - config.rules.quotes = ["error", answers.quotes]; - config.rules["linebreak-style"] = ["error", answers.linebreak]; - config.rules.semi = ["error", answers.semi ? "always" : "never"]; + // setup rules based on problems/style enforcement preferences + if (answers.purpose === "problems") { + config.extends.unshift("eslint:recommended"); + } else if (answers.purpose === "style") { + if (answers.source === "prompt") { + config.extends.unshift("eslint:recommended"); + config.rules.indent = ["error", answers.indent]; + config.rules.quotes = ["error", answers.quotes]; + config.rules["linebreak-style"] = ["error", answers.linebreak]; + config.rules.semi = ["error", answers.semi ? "always" : "never"]; + } else if (answers.source === "auto") { + config = configureRules(answers, config); + config = autoconfig.extendFromRecommended(config); + } } - if (answers.source === "auto") { - config = configureRules(answers, config); - config = autoconfig.extendFromRecommended(config); + // normalize extends + if (config.extends.length === 0) { + delete config.extends; + } else if (config.extends.length === 1) { + config.extends = config.extends[0]; } ConfigOps.normalizeToStrings(config); @@ -324,7 +349,7 @@ function getLocalESLintVersion() { * @returns {string} The shareable config name. */ function getStyleGuideName(answers) { - if (answers.styleguide === "airbnb" && !answers.airbnbReact) { + if (answers.styleguide === "airbnb" && answers.framework !== "react") { return "airbnb-base"; } return answers.styleguide; @@ -417,16 +442,62 @@ function askInstallModules(modules, packageJsonExists) { function promptUser() { return inquirer.prompt([ + { + type: "list", + name: "purpose", + message: "How would you like to use ESLint?", + default: "problems", + choices: [ + { name: "To check syntax only", value: "syntax" }, + { name: "To check syntax and find problems", value: "problems" }, + { name: "To check syntax, find problems, and enforce code style", value: "style" } + ] + }, + { + type: "list", + name: "moduleType", + message: "What type of modules does your project use?", + default: "esm", + choices: [ + { name: "JavaScript modules (import/export)", value: "esm" }, + { name: "CommonJS (require/exports)", value: "commonjs" }, + { name: "None of these", value: "none" } + ] + }, + { + type: "list", + name: "framework", + message: "Which framework does your project use?", + default: "react", + choices: [ + { name: "React", value: "react" }, + { name: "Vue.js", value: "vue" }, + { name: "None of these", value: "none" } + ] + }, + { + type: "checkbox", + name: "env", + message: "Where does your code run?", + default: ["browser"], + choices: [ + { name: "Browser", value: "browser" }, + { name: "Node", value: "node" } + ] + }, { type: "list", name: "source", - message: "How would you like to configure ESLint?", - default: "prompt", + message: "How would you like to define a style for your project?", + default: "guide", choices: [ { name: "Use a popular style guide", value: "guide" }, { name: "Answer questions about your style", value: "prompt" }, { name: "Inspect your JavaScript file(s)", value: "auto" } - ] + ], + when(answers) { + return answers.purpose === "style"; + } }, { type: "list", @@ -442,15 +513,6 @@ function promptUser() { return answers.source === "guide" && answers.packageJsonExists; } }, - { - type: "confirm", - name: "airbnbReact", - message: "Do you use React?", - default: false, - when(answers) { - return answers.styleguide === "airbnb"; - } - }, { type: "input", name: "patterns", @@ -470,10 +532,7 @@ function promptUser() { name: "format", message: "What format do you want your config file to be in?", default: "JavaScript", - choices: ["JavaScript", "YAML", "JSON"], - when(answers) { - return ((answers.source === "guide" && answers.packageJsonExists) || answers.source === "auto"); - } + choices: ["JavaScript", "YAML", "JSON"] }, { type: "confirm", @@ -492,6 +551,15 @@ function promptUser() { } ]).then(earlyAnswers => { + // early exit if no style guide is necessary + if (earlyAnswers.purpose !== "style") { + const config = processAnswers(earlyAnswers); + const modules = getModulesList(config); + + return askInstallModules(modules, earlyAnswers.packageJsonExists) + .then(() => writeFile(config, earlyAnswers.format)); + } + // early exit if you are using a style guide if (earlyAnswers.source === "guide") { if (!earlyAnswers.packageJsonExists) { @@ -501,130 +569,69 @@ function promptUser() { if (earlyAnswers.installESLint === false && !semver.satisfies(earlyAnswers.localESLintVersion, earlyAnswers.requiredESLintVersionRange)) { log.info(`Note: it might not work since ESLint's version is mismatched with the ${earlyAnswers.styleguide} config.`); } - if (earlyAnswers.styleguide === "airbnb" && !earlyAnswers.airbnbReact) { + if (earlyAnswers.styleguide === "airbnb" && earlyAnswers.framework !== "react") { earlyAnswers.styleguide = "airbnb-base"; } - const config = getConfigForStyleGuide(earlyAnswers.styleguide); + const config = ConfigOps.merge(processAnswers(earlyAnswers), getConfigForStyleGuide(earlyAnswers.styleguide)); const modules = getModulesList(config); return askInstallModules(modules, earlyAnswers.packageJsonExists) .then(() => writeFile(config, earlyAnswers.format)); + } - // continue with the questions otherwise... + if (earlyAnswers.source === "auto") { + const combinedAnswers = Object.assign({}, earlyAnswers); + const config = processAnswers(combinedAnswers); + const modules = getModulesList(config); + + return askInstallModules(modules).then(() => writeFile(config, earlyAnswers.format)); + } + + // continue with the style questions otherwise... return inquirer.prompt([ { type: "list", - name: "ecmaVersion", - message: "Which version of ECMAScript do you use?", - choices: [ - { name: "ES3", value: 3 }, - { name: "ES5", value: 5 }, - { name: "ES2015", value: 2015 }, - { name: "ES2016", value: 2016 }, - { name: "ES2017", value: 2017 }, - { name: "ES2018", value: 2018 } - ], - default: 1 // This is the index in the choices list + name: "indent", + message: "What style of indentation do you use?", + default: "tab", + choices: [{ name: "Tabs", value: "tab" }, { name: "Spaces", value: 4 }] }, { - type: "confirm", - name: "modules", - message: "Are you using ES6 modules?", - default: false, - when(answers) { - return answers.ecmaVersion >= 2015; - } - }, - { - type: "checkbox", - name: "env", - message: "Where will your code run?", - default: ["browser"], - choices: [{ name: "Browser", value: "browser" }, { name: "Node", value: "node" }] + type: "list", + name: "quotes", + message: "What quotes do you use for strings?", + default: "double", + choices: [{ name: "Double", value: "double" }, { name: "Single", value: "single" }] }, { - type: "confirm", - name: "commonjs", - message: "Do you use CommonJS?", - default: false, - when(answers) { - return answers.env.some(env => env === "browser"); - } + type: "list", + name: "linebreak", + message: "What line endings do you use?", + default: "unix", + choices: [{ name: "Unix", value: "unix" }, { name: "Windows", value: "windows" }] }, { type: "confirm", - name: "jsx", - message: "Do you use JSX?", - default: false + name: "semi", + message: "Do you require semicolons?", + default: true }, { - type: "confirm", - name: "react", - message: "Do you use React?", - default: false, - when(answers) { - return answers.jsx; - } - } - ]).then(secondAnswers => { - - // early exit if you are using automatic style generation - if (earlyAnswers.source === "auto") { - const combinedAnswers = Object.assign({}, earlyAnswers, secondAnswers); - - const config = processAnswers(combinedAnswers); - - const modules = getModulesList(config); - - return askInstallModules(modules).then(() => writeFile(config, earlyAnswers.format)); + type: "list", + name: "format", + message: "What format do you want your config file to be in?", + default: "JavaScript", + choices: ["JavaScript", "YAML", "JSON"] } + ]).then(answers => { + const totalAnswers = Object.assign({}, earlyAnswers, answers); - // continue with the style questions otherwise... - return inquirer.prompt([ - { - type: "list", - name: "indent", - message: "What style of indentation do you use?", - default: "tab", - choices: [{ name: "Tabs", value: "tab" }, { name: "Spaces", value: 4 }] - }, - { - type: "list", - name: "quotes", - message: "What quotes do you use for strings?", - default: "double", - choices: [{ name: "Double", value: "double" }, { name: "Single", value: "single" }] - }, - { - type: "list", - name: "linebreak", - message: "What line endings do you use?", - default: "unix", - choices: [{ name: "Unix", value: "unix" }, { name: "Windows", value: "windows" }] - }, - { - type: "confirm", - name: "semi", - message: "Do you require semicolons?", - default: true - }, - { - type: "list", - name: "format", - message: "What format do you want your config file to be in?", - default: "JavaScript", - choices: ["JavaScript", "YAML", "JSON"] - } - ]).then(answers => { - const totalAnswers = Object.assign({}, earlyAnswers, secondAnswers, answers); - - const config = processAnswers(totalAnswers); - const modules = getModulesList(config); + const config = processAnswers(totalAnswers); + const modules = getModulesList(config); - return askInstallModules(modules).then(() => writeFile(config, answers.format)); - }); + return askInstallModules(modules).then(() => writeFile(config, answers.format)); }); }); } diff --git a/tools/node_modules/eslint/lib/config/config-ops.js b/tools/node_modules/eslint/lib/config/config-ops.js index 48f38b490528a8..b38cdf7d7ca1f4 100644 --- a/tools/node_modules/eslint/lib/config/config-ops.js +++ b/tools/node_modules/eslint/lib/config/config-ops.js @@ -386,12 +386,14 @@ module.exports = { case true: case "true": case "writeable": + case "writable": return "writeable"; case null: case false: case "false": case "readable": + case "readonly": return "readable"; // Fallback to minimize compatibility impact diff --git a/tools/node_modules/eslint/lib/rules/accessor-pairs.js b/tools/node_modules/eslint/lib/rules/accessor-pairs.js index 032e89430571fa..aca231848633ad 100644 --- a/tools/node_modules/eslint/lib/rules/accessor-pairs.js +++ b/tools/node_modules/eslint/lib/rules/accessor-pairs.js @@ -85,10 +85,12 @@ module.exports = { type: "object", properties: { getWithoutSet: { - type: "boolean" + type: "boolean", + default: false }, setWithoutGet: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/array-bracket-newline.js b/tools/node_modules/eslint/lib/rules/array-bracket-newline.js index a458e69f761687..b98fa9d27ca1b6 100644 --- a/tools/node_modules/eslint/lib/rules/array-bracket-newline.js +++ b/tools/node_modules/eslint/lib/rules/array-bracket-newline.js @@ -34,11 +34,13 @@ module.exports = { type: "object", properties: { multiline: { - type: "boolean" + type: "boolean", + default: true }, minItems: { type: ["integer", "null"], - minimum: 0 + minimum: 0, + default: null } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/array-callback-return.js b/tools/node_modules/eslint/lib/rules/array-callback-return.js index bfee39b037bc7d..f88f4b8bfaeddd 100644 --- a/tools/node_modules/eslint/lib/rules/array-callback-return.js +++ b/tools/node_modules/eslint/lib/rules/array-callback-return.js @@ -155,7 +155,8 @@ module.exports = { type: "object", properties: { allowImplicit: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/array-element-newline.js b/tools/node_modules/eslint/lib/rules/array-element-newline.js index dadb26fdd226de..0efceedd27e691 100644 --- a/tools/node_modules/eslint/lib/rules/array-element-newline.js +++ b/tools/node_modules/eslint/lib/rules/array-element-newline.js @@ -34,11 +34,13 @@ module.exports = { type: "object", properties: { multiline: { - type: "boolean" + type: "boolean", + default: false }, minItems: { type: ["integer", "null"], - minimum: 0 + minimum: 0, + default: null } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/arrow-body-style.js b/tools/node_modules/eslint/lib/rules/arrow-body-style.js index c2ce3b59e4f436..83fc28aba06fab 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-body-style.js +++ b/tools/node_modules/eslint/lib/rules/arrow-body-style.js @@ -46,7 +46,7 @@ module.exports = { { type: "object", properties: { - requireReturnForObjectLiteral: { type: "boolean" } + requireReturnForObjectLiteral: { type: "boolean", default: false } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/arrow-parens.js b/tools/node_modules/eslint/lib/rules/arrow-parens.js index 637a0c1f1f13a5..217a9b60e13cbb 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-parens.js +++ b/tools/node_modules/eslint/lib/rules/arrow-parens.js @@ -35,7 +35,8 @@ module.exports = { type: "object", properties: { requireForBlockBody: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/arrow-spacing.js b/tools/node_modules/eslint/lib/rules/arrow-spacing.js index 87d381840a95dc..95acb78772584b 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-spacing.js +++ b/tools/node_modules/eslint/lib/rules/arrow-spacing.js @@ -32,10 +32,12 @@ module.exports = { type: "object", properties: { before: { - type: "boolean" + type: "boolean", + default: true }, after: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -54,11 +56,10 @@ module.exports = { create(context) { // merge rules with default - const rule = { before: true, after: true }, - option = context.options[0] || {}; + const rule = Object.assign({}, context.options[0]); - rule.before = option.before !== false; - rule.after = option.after !== false; + rule.before = rule.before !== false; + rule.after = rule.after !== false; const sourceCode = context.getSourceCode(); diff --git a/tools/node_modules/eslint/lib/rules/brace-style.js b/tools/node_modules/eslint/lib/rules/brace-style.js index d172124d2f48f7..17a5c7fdf9a37f 100644 --- a/tools/node_modules/eslint/lib/rules/brace-style.js +++ b/tools/node_modules/eslint/lib/rules/brace-style.js @@ -30,7 +30,8 @@ module.exports = { type: "object", properties: { allowSingleLine: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/camelcase.js b/tools/node_modules/eslint/lib/rules/camelcase.js index a8341c84b67bc1..6dd3793f665ed2 100644 --- a/tools/node_modules/eslint/lib/rules/camelcase.js +++ b/tools/node_modules/eslint/lib/rules/camelcase.js @@ -25,7 +25,8 @@ module.exports = { type: "object", properties: { ignoreDestructuring: { - type: "boolean" + type: "boolean", + default: false }, properties: { enum: ["always", "never"] @@ -54,7 +55,7 @@ module.exports = { const options = context.options[0] || {}; let properties = options.properties || ""; - const ignoreDestructuring = options.ignoreDestructuring || false; + const ignoreDestructuring = options.ignoreDestructuring; const allow = options.allow || []; if (properties !== "always" && properties !== "never") { diff --git a/tools/node_modules/eslint/lib/rules/capitalized-comments.js b/tools/node_modules/eslint/lib/rules/capitalized-comments.js index 7947833b270444..285f856379d487 100644 --- a/tools/node_modules/eslint/lib/rules/capitalized-comments.js +++ b/tools/node_modules/eslint/lib/rules/capitalized-comments.js @@ -17,12 +17,7 @@ const astUtils = require("../util/ast-utils"); const DEFAULT_IGNORE_PATTERN = astUtils.COMMENTS_IGNORE_PATTERN, WHITESPACE = /\s/g, - MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/, // TODO: Combine w/ max-len pattern? - DEFAULTS = { - ignorePattern: null, - ignoreInlineComments: false, - ignoreConsecutiveComments: false - }; + MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/; // TODO: Combine w/ max-len pattern? /* * Base schema body for defining the basic capitalization rule, ignorePattern, @@ -33,17 +28,27 @@ const SCHEMA_BODY = { type: "object", properties: { ignorePattern: { - type: "string" + type: "string", + default: "" }, ignoreInlineComments: { - type: "boolean" + type: "boolean", + default: false }, ignoreConsecutiveComments: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false }; +const DEFAULTS = Object.keys(SCHEMA_BODY.properties).reduce( + (obj, current) => { + obj[current] = SCHEMA_BODY.properties[current].default; + return obj; + }, + {} +); /** * Get normalized options for either block or line comments from the given @@ -59,11 +64,7 @@ const SCHEMA_BODY = { * @param {string} which Either "line" or "block". * @returns {Object} The normalized options. */ -function getNormalizedOptions(rawOptions, which) { - if (!rawOptions) { - return Object.assign({}, DEFAULTS); - } - +function getNormalizedOptions(rawOptions = {}, which) { return Object.assign({}, DEFAULTS, rawOptions[which] || rawOptions); } diff --git a/tools/node_modules/eslint/lib/rules/class-methods-use-this.js b/tools/node_modules/eslint/lib/rules/class-methods-use-this.js index a15ab6b89e480f..0eb1da87f4c227 100644 --- a/tools/node_modules/eslint/lib/rules/class-methods-use-this.js +++ b/tools/node_modules/eslint/lib/rules/class-methods-use-this.js @@ -38,7 +38,7 @@ module.exports = { } }, create(context) { - const config = context.options[0] ? Object.assign({}, context.options[0]) : {}; + const config = Object.assign({}, context.options[0]); const exceptMethods = new Set(config.exceptMethods || []); const stack = []; diff --git a/tools/node_modules/eslint/lib/rules/comma-spacing.js b/tools/node_modules/eslint/lib/rules/comma-spacing.js index 2db0035b545348..a9f89676a4a3cd 100644 --- a/tools/node_modules/eslint/lib/rules/comma-spacing.js +++ b/tools/node_modules/eslint/lib/rules/comma-spacing.js @@ -28,10 +28,12 @@ module.exports = { type: "object", properties: { before: { - type: "boolean" + type: "boolean", + default: false }, after: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -50,8 +52,8 @@ module.exports = { const tokensAndComments = sourceCode.tokensAndComments; const options = { - before: context.options[0] ? !!context.options[0].before : false, - after: context.options[0] ? !!context.options[0].after : true + before: context.options[0] ? context.options[0].before : false, + after: context.options[0] ? context.options[0].after : true }; //-------------------------------------------------------------------------- @@ -118,6 +120,10 @@ module.exports = { report(reportItem, "before", tokens.left); } + if (tokens.right && astUtils.isClosingParenToken(tokens.right)) { + return; + } + if (tokens.right && !options.after && tokens.right.type === "Line") { return; } diff --git a/tools/node_modules/eslint/lib/rules/complexity.js b/tools/node_modules/eslint/lib/rules/complexity.js index af583c02791dd0..9f791e6de7c49a 100644 --- a/tools/node_modules/eslint/lib/rules/complexity.js +++ b/tools/node_modules/eslint/lib/rules/complexity.js @@ -41,11 +41,13 @@ module.exports = { properties: { maximum: { type: "integer", - minimum: 0 + minimum: 0, + default: 20 }, max: { type: "integer", - minimum: 0 + minimum: 0, + default: 20 } }, additionalProperties: false @@ -63,13 +65,9 @@ module.exports = { const option = context.options[0]; let THRESHOLD = 20; - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") { - THRESHOLD = option.maximum; - } - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") { - THRESHOLD = option.max; - } - if (typeof option === "number") { + if (typeof option === "object") { + THRESHOLD = option.maximum || option.max; + } else if (typeof option === "number") { THRESHOLD = option; } diff --git a/tools/node_modules/eslint/lib/rules/consistent-return.js b/tools/node_modules/eslint/lib/rules/consistent-return.js index ffd7ef20589490..68f9f9d8fbcad4 100644 --- a/tools/node_modules/eslint/lib/rules/consistent-return.js +++ b/tools/node_modules/eslint/lib/rules/consistent-return.js @@ -66,7 +66,8 @@ module.exports = { type: "object", properties: { treatUndefinedAsUnspecified: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/dot-notation.js b/tools/node_modules/eslint/lib/rules/dot-notation.js index 55ccea4ce38f4c..a1b091da0ea90d 100644 --- a/tools/node_modules/eslint/lib/rules/dot-notation.js +++ b/tools/node_modules/eslint/lib/rules/dot-notation.js @@ -33,10 +33,12 @@ module.exports = { type: "object", properties: { allowKeywords: { - type: "boolean" + type: "boolean", + default: true }, allowPattern: { - type: "string" + type: "string", + default: "" } }, additionalProperties: false @@ -53,7 +55,7 @@ module.exports = { create(context) { const options = context.options[0] || {}; - const allowKeywords = options.allowKeywords === void 0 || !!options.allowKeywords; + const allowKeywords = options.allowKeywords === void 0 || options.allowKeywords; const sourceCode = context.getSourceCode(); let allowPattern; diff --git a/tools/node_modules/eslint/lib/rules/eqeqeq.js b/tools/node_modules/eslint/lib/rules/eqeqeq.js index 3e8a392cf6983e..a52de67d750e95 100644 --- a/tools/node_modules/eslint/lib/rules/eqeqeq.js +++ b/tools/node_modules/eslint/lib/rules/eqeqeq.js @@ -38,7 +38,8 @@ module.exports = { type: "object", properties: { null: { - enum: ["always", "never", "ignore"] + enum: ["always", "never", "ignore"], + default: "always" } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/func-call-spacing.js b/tools/node_modules/eslint/lib/rules/func-call-spacing.js index c49aa9e59f7e9c..62bba144e6ff97 100644 --- a/tools/node_modules/eslint/lib/rules/func-call-spacing.js +++ b/tools/node_modules/eslint/lib/rules/func-call-spacing.js @@ -50,7 +50,8 @@ module.exports = { type: "object", properties: { allowNewlines: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/func-style.js b/tools/node_modules/eslint/lib/rules/func-style.js index b7e368cbd2ea08..e150b1a76f26a6 100644 --- a/tools/node_modules/eslint/lib/rules/func-style.js +++ b/tools/node_modules/eslint/lib/rules/func-style.js @@ -27,7 +27,8 @@ module.exports = { type: "object", properties: { allowArrowFunctions: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -43,7 +44,7 @@ module.exports = { create(context) { const style = context.options[0], - allowArrowFunctions = context.options[1] && context.options[1].allowArrowFunctions === true, + allowArrowFunctions = context.options[1] && context.options[1].allowArrowFunctions, enforceDeclarations = (style === "declaration"), stack = []; diff --git a/tools/node_modules/eslint/lib/rules/getter-return.js b/tools/node_modules/eslint/lib/rules/getter-return.js index dc3d9d6b627e62..a1806c357b1afa 100644 --- a/tools/node_modules/eslint/lib/rules/getter-return.js +++ b/tools/node_modules/eslint/lib/rules/getter-return.js @@ -60,7 +60,8 @@ module.exports = { type: "object", properties: { allowImplicit: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/id-length.js b/tools/node_modules/eslint/lib/rules/id-length.js index 1f9c696e2a93b1..c8586ea3481895 100644 --- a/tools/node_modules/eslint/lib/rules/id-length.js +++ b/tools/node_modules/eslint/lib/rules/id-length.js @@ -26,10 +26,11 @@ module.exports = { type: "object", properties: { min: { - type: "number" + type: "integer", + default: 2 }, max: { - type: "number" + type: "integer" }, exceptions: { type: "array", diff --git a/tools/node_modules/eslint/lib/rules/id-match.js b/tools/node_modules/eslint/lib/rules/id-match.js index 5dc86f8dbfd7ac..3978a5ef684b7f 100644 --- a/tools/node_modules/eslint/lib/rules/id-match.js +++ b/tools/node_modules/eslint/lib/rules/id-match.js @@ -28,13 +28,16 @@ module.exports = { type: "object", properties: { properties: { - type: "boolean" + type: "boolean", + default: false }, onlyDeclarations: { - type: "boolean" + type: "boolean", + default: false }, ignoreDestructuring: { - type: "boolean" + type: "boolean", + default: false } } } diff --git a/tools/node_modules/eslint/lib/rules/indent.js b/tools/node_modules/eslint/lib/rules/indent.js index c30d1f1e7bccc9..08b9250f05c09d 100644 --- a/tools/node_modules/eslint/lib/rules/indent.js +++ b/tools/node_modules/eslint/lib/rules/indent.js @@ -518,7 +518,8 @@ module.exports = { properties: { SwitchCase: { type: "integer", - minimum: 0 + minimum: 0, + default: 0 }, VariableDeclarator: { oneOf: [ @@ -582,7 +583,8 @@ module.exports = { ObjectExpression: ELEMENT_LIST_SCHEMA, ImportDeclaration: ELEMENT_LIST_SCHEMA, flatTernaryExpressions: { - type: "boolean" + type: "boolean", + default: false }, ignoredNodes: { type: "array", @@ -594,7 +596,8 @@ module.exports = { } }, ignoreComments: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -650,7 +653,7 @@ module.exports = { } if (context.options[1]) { - lodash.merge(options, context.options[1]); + Object.assign(options, context.options[1]); if (typeof options.VariableDeclarator === "number" || options.VariableDeclarator === "first") { options.VariableDeclarator = { diff --git a/tools/node_modules/eslint/lib/rules/init-declarations.js b/tools/node_modules/eslint/lib/rules/init-declarations.js index 65197358e60df8..484cbef0a57c4c 100644 --- a/tools/node_modules/eslint/lib/rules/init-declarations.js +++ b/tools/node_modules/eslint/lib/rules/init-declarations.js @@ -75,7 +75,8 @@ module.exports = { type: "object", properties: { ignoreForLoopInit: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/key-spacing.js b/tools/node_modules/eslint/lib/rules/key-spacing.js index c52a74d499f9ad..31ba9522e9bb72 100644 --- a/tools/node_modules/eslint/lib/rules/key-spacing.js +++ b/tools/node_modules/eslint/lib/rules/key-spacing.js @@ -148,16 +148,20 @@ module.exports = { type: "object", properties: { mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, on: { - enum: ["colon", "value"] + enum: ["colon", "value"], + default: "colon" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -165,13 +169,16 @@ module.exports = { ] }, mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -183,13 +190,16 @@ module.exports = { type: "object", properties: { mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -206,16 +216,20 @@ module.exports = { type: "object", properties: { mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, on: { - enum: ["colon", "value"] + enum: ["colon", "value"], + default: "colon" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -223,13 +237,16 @@ module.exports = { ] }, mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -244,13 +261,16 @@ module.exports = { type: "object", properties: { mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -259,13 +279,16 @@ module.exports = { type: "object", properties: { mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -274,16 +297,20 @@ module.exports = { type: "object", properties: { mode: { - enum: ["strict", "minimum"] + enum: ["strict", "minimum"], + default: "strict" }, on: { - enum: ["colon", "value"] + enum: ["colon", "value"], + default: "colon" }, beforeColon: { - type: "boolean" + type: "boolean", + default: false }, afterColon: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/keyword-spacing.js b/tools/node_modules/eslint/lib/rules/keyword-spacing.js index 833092e4160c48..83ad6282688bab 100644 --- a/tools/node_modules/eslint/lib/rules/keyword-spacing.js +++ b/tools/node_modules/eslint/lib/rules/keyword-spacing.js @@ -80,16 +80,16 @@ module.exports = { { type: "object", properties: { - before: { type: "boolean" }, - after: { type: "boolean" }, + before: { type: "boolean", default: true }, + after: { type: "boolean", default: true }, overrides: { type: "object", properties: KEYS.reduce((retv, key) => { retv[key] = { type: "object", properties: { - before: { type: "boolean" }, - after: { type: "boolean" } + before: { type: "boolean", default: true }, + after: { type: "boolean", default: true } }, additionalProperties: false }; @@ -228,9 +228,9 @@ module.exports = { * Keys are keywords (there are for every keyword). * Values are instances of `{"before": function, "after": function}`. */ - function parseOptions(options) { - const before = !options || options.before !== false; - const after = !options || options.after !== false; + function parseOptions(options = {}) { + const before = options.before !== false; + const after = options.after !== false; const defaultValue = { before: before ? expectSpaceBefore : unexpectSpaceBefore, after: after ? expectSpaceAfter : unexpectSpaceAfter diff --git a/tools/node_modules/eslint/lib/rules/line-comment-position.js b/tools/node_modules/eslint/lib/rules/line-comment-position.js index 6d0ac6d2ba8c4e..132a8ad875f558 100644 --- a/tools/node_modules/eslint/lib/rules/line-comment-position.js +++ b/tools/node_modules/eslint/lib/rules/line-comment-position.js @@ -31,16 +31,19 @@ module.exports = { type: "object", properties: { position: { - enum: ["above", "beside"] + enum: ["above", "beside"], + default: "above" }, ignorePattern: { type: "string" }, applyDefaultPatterns: { - type: "boolean" + type: "boolean", + default: true }, applyDefaultIgnorePatterns: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -69,9 +72,9 @@ module.exports = { ignorePattern = options.ignorePattern; if (Object.prototype.hasOwnProperty.call(options, "applyDefaultIgnorePatterns")) { - applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns !== false; + applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns; } else { - applyDefaultIgnorePatterns = options.applyDefaultPatterns !== false; + applyDefaultIgnorePatterns = options.applyDefaultPatterns; } } diff --git a/tools/node_modules/eslint/lib/rules/lines-around-comment.js b/tools/node_modules/eslint/lib/rules/lines-around-comment.js index 62bef94831d281..0f9851f7241180 100644 --- a/tools/node_modules/eslint/lib/rules/lines-around-comment.js +++ b/tools/node_modules/eslint/lib/rules/lines-around-comment.js @@ -68,22 +68,28 @@ module.exports = { type: "object", properties: { beforeBlockComment: { - type: "boolean" + type: "boolean", + default: true }, afterBlockComment: { - type: "boolean" + type: "boolean", + default: false }, beforeLineComment: { - type: "boolean" + type: "boolean", + default: false }, afterLineComment: { - type: "boolean" + type: "boolean", + default: false }, allowBlockStart: { - type: "boolean" + type: "boolean", + default: false }, allowBlockEnd: { - type: "boolean" + type: "boolean", + default: false }, allowClassStart: { type: "boolean" @@ -121,19 +127,13 @@ module.exports = { create(context) { - const options = context.options[0] ? Object.assign({}, context.options[0]) : {}; + const options = Object.assign({}, context.options[0]); const ignorePattern = options.ignorePattern; const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN; const customIgnoreRegExp = new RegExp(ignorePattern); const applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns !== false; - - options.beforeLineComment = options.beforeLineComment || false; - options.afterLineComment = options.afterLineComment || false; options.beforeBlockComment = typeof options.beforeBlockComment !== "undefined" ? options.beforeBlockComment : true; - options.afterBlockComment = options.afterBlockComment || false; - options.allowBlockStart = options.allowBlockStart || false; - options.allowBlockEnd = options.allowBlockEnd || false; const sourceCode = context.getSourceCode(); diff --git a/tools/node_modules/eslint/lib/rules/lines-between-class-members.js b/tools/node_modules/eslint/lib/rules/lines-between-class-members.js index 2937d24f81f1bc..19ae8a6a292c27 100644 --- a/tools/node_modules/eslint/lib/rules/lines-between-class-members.js +++ b/tools/node_modules/eslint/lib/rules/lines-between-class-members.js @@ -31,7 +31,8 @@ module.exports = { type: "object", properties: { exceptAfterSingleLine: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/max-depth.js b/tools/node_modules/eslint/lib/rules/max-depth.js index 500e9318817d41..3b997e21bc6384 100644 --- a/tools/node_modules/eslint/lib/rules/max-depth.js +++ b/tools/node_modules/eslint/lib/rules/max-depth.js @@ -32,11 +32,13 @@ module.exports = { properties: { maximum: { type: "integer", - minimum: 0 + minimum: 0, + default: 4 }, max: { type: "integer", - minimum: 0 + minimum: 0, + default: 4 } }, additionalProperties: false @@ -59,11 +61,8 @@ module.exports = { option = context.options[0]; let maxDepth = 4; - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") { - maxDepth = option.maximum; - } - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") { - maxDepth = option.max; + if (typeof option === "object") { + maxDepth = option.maximum || option.max; } if (typeof option === "number") { maxDepth = option; diff --git a/tools/node_modules/eslint/lib/rules/max-len.js b/tools/node_modules/eslint/lib/rules/max-len.js index d74373e9ea85e3..f6f0b6d3ac093d 100644 --- a/tools/node_modules/eslint/lib/rules/max-len.js +++ b/tools/node_modules/eslint/lib/rules/max-len.js @@ -14,7 +14,8 @@ const OPTIONS_SCHEMA = { properties: { code: { type: "integer", - minimum: 0 + minimum: 0, + default: 80 }, comments: { type: "integer", @@ -22,28 +23,35 @@ const OPTIONS_SCHEMA = { }, tabWidth: { type: "integer", - minimum: 0 + minimum: 0, + default: 4 }, ignorePattern: { type: "string" }, ignoreComments: { - type: "boolean" + type: "boolean", + default: false }, ignoreStrings: { - type: "boolean" + type: "boolean", + default: false }, ignoreUrls: { - type: "boolean" + type: "boolean", + default: false }, ignoreTemplateLiterals: { - type: "boolean" + type: "boolean", + default: false }, ignoreRegExpLiterals: { - type: "boolean" + type: "boolean", + default: false }, ignoreTrailingComments: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -121,8 +129,7 @@ module.exports = { } // The options object must be the last option specified… - const lastOption = context.options[context.options.length - 1]; - const options = typeof lastOption === "object" ? Object.create(lastOption) : {}; + const options = Object.assign({}, context.options[context.options.length - 1]); // …but max code length… if (typeof context.options[0] === "number") { diff --git a/tools/node_modules/eslint/lib/rules/max-lines-per-function.js b/tools/node_modules/eslint/lib/rules/max-lines-per-function.js index d1e4597a2218b1..2a0e1a645a375b 100644 --- a/tools/node_modules/eslint/lib/rules/max-lines-per-function.js +++ b/tools/node_modules/eslint/lib/rules/max-lines-per-function.js @@ -19,16 +19,20 @@ const OPTIONS_SCHEMA = { properties: { max: { type: "integer", - minimum: 0 + minimum: 0, + default: 50 }, skipComments: { - type: "boolean" + type: "boolean", + default: false }, skipBlankLines: { - type: "boolean" + type: "boolean", + default: false }, IIFEs: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -97,18 +101,10 @@ module.exports = { let IIFEs = false; if (typeof option === "object") { - if (typeof option.max === "number") { - maxLines = option.max; - } - if (typeof option.skipComments === "boolean") { - skipComments = option.skipComments; - } - if (typeof option.skipBlankLines === "boolean") { - skipBlankLines = option.skipBlankLines; - } - if (typeof option.IIFEs === "boolean") { - IIFEs = option.IIFEs; - } + maxLines = option.max; + skipComments = option.skipComments; + skipBlankLines = option.skipBlankLines; + IIFEs = option.IIFEs; } else if (typeof option === "number") { maxLines = option; } diff --git a/tools/node_modules/eslint/lib/rules/max-lines.js b/tools/node_modules/eslint/lib/rules/max-lines.js index da7ddd8a88fca0..0fae4ec2fa13fa 100644 --- a/tools/node_modules/eslint/lib/rules/max-lines.js +++ b/tools/node_modules/eslint/lib/rules/max-lines.js @@ -38,13 +38,16 @@ module.exports = { properties: { max: { type: "integer", - minimum: 0 + minimum: 0, + default: 300 }, skipComments: { - type: "boolean" + type: "boolean", + default: false }, skipBlankLines: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -61,11 +64,9 @@ module.exports = { const option = context.options[0]; let max = 300; - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") { + if (typeof option === "object") { max = option.max; - } - - if (typeof option === "number") { + } else if (typeof option === "number") { max = option; } @@ -86,7 +87,7 @@ module.exports = { /** * Returns the line numbers of a comment that don't have any code on the same line * @param {Node} comment The comment node to check - * @returns {int[]} The line numbers + * @returns {number[]} The line numbers */ function getLinesWithoutCode(comment) { let start = comment.loc.start.line; diff --git a/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js b/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js index 754fa168d39ab2..cbbb0ed6c70d9a 100644 --- a/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js +++ b/tools/node_modules/eslint/lib/rules/max-nested-callbacks.js @@ -32,11 +32,13 @@ module.exports = { properties: { maximum: { type: "integer", - minimum: 0 + minimum: 0, + default: 10 }, max: { type: "integer", - minimum: 0 + minimum: 0, + default: 10 } }, additionalProperties: false @@ -57,13 +59,9 @@ module.exports = { const option = context.options[0]; let THRESHOLD = 10; - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") { - THRESHOLD = option.maximum; - } - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") { - THRESHOLD = option.max; - } - if (typeof option === "number") { + if (typeof option === "object") { + THRESHOLD = option.maximum || option.max; + } else if (typeof option === "number") { THRESHOLD = option; } diff --git a/tools/node_modules/eslint/lib/rules/max-params.js b/tools/node_modules/eslint/lib/rules/max-params.js index e082ec8e980cec..5e1e558ab53e0b 100644 --- a/tools/node_modules/eslint/lib/rules/max-params.js +++ b/tools/node_modules/eslint/lib/rules/max-params.js @@ -40,11 +40,13 @@ module.exports = { properties: { maximum: { type: "integer", - minimum: 0 + minimum: 0, + default: 3 }, max: { type: "integer", - minimum: 0 + minimum: 0, + default: 3 } }, additionalProperties: false @@ -62,11 +64,8 @@ module.exports = { const option = context.options[0]; let numParams = 3; - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") { - numParams = option.maximum; - } - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") { - numParams = option.max; + if (typeof option === "object") { + numParams = option.maximum || option.max; } if (typeof option === "number") { numParams = option; diff --git a/tools/node_modules/eslint/lib/rules/max-statements-per-line.js b/tools/node_modules/eslint/lib/rules/max-statements-per-line.js index b834cedc03f318..444bdfa21aa1b0 100644 --- a/tools/node_modules/eslint/lib/rules/max-statements-per-line.js +++ b/tools/node_modules/eslint/lib/rules/max-statements-per-line.js @@ -31,7 +31,8 @@ module.exports = { properties: { max: { type: "integer", - minimum: 1 + minimum: 1, + default: 1 } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/max-statements.js b/tools/node_modules/eslint/lib/rules/max-statements.js index b33ca429824e45..cd0e50ae399910 100644 --- a/tools/node_modules/eslint/lib/rules/max-statements.js +++ b/tools/node_modules/eslint/lib/rules/max-statements.js @@ -40,11 +40,13 @@ module.exports = { properties: { maximum: { type: "integer", - minimum: 0 + minimum: 0, + default: 10 }, max: { type: "integer", - minimum: 0 + minimum: 0, + default: 10 } }, additionalProperties: false @@ -78,13 +80,9 @@ module.exports = { topLevelFunctions = []; let maxStatements = 10; - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") { - maxStatements = option.maximum; - } - if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") { - maxStatements = option.max; - } - if (typeof option === "number") { + if (typeof option === "object") { + maxStatements = option.maximum || option.max; + } else if (typeof option === "number") { maxStatements = option; } diff --git a/tools/node_modules/eslint/lib/rules/new-cap.js b/tools/node_modules/eslint/lib/rules/new-cap.js index 4a01dcfa7f385b..ab70fcfadd5e13 100644 --- a/tools/node_modules/eslint/lib/rules/new-cap.js +++ b/tools/node_modules/eslint/lib/rules/new-cap.js @@ -88,10 +88,12 @@ module.exports = { type: "object", properties: { newIsCap: { - type: "boolean" + type: "boolean", + default: true }, capIsNew: { - type: "boolean" + type: "boolean", + default: true }, newIsCapExceptions: { type: "array", @@ -112,7 +114,8 @@ module.exports = { type: "string" }, properties: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -126,7 +129,7 @@ module.exports = { create(context) { - const config = context.options[0] ? Object.assign({}, context.options[0]) : {}; + const config = Object.assign({}, context.options[0]); config.newIsCap = config.newIsCap !== false; config.capIsNew = config.capIsNew !== false; diff --git a/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js b/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js index 0bf2365de5aa11..90b540c484d495 100644 --- a/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js +++ b/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js @@ -31,7 +31,8 @@ module.exports = { ignoreChainWithDepth: { type: "integer", minimum: 1, - maximum: 10 + maximum: 10, + default: 2 } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-bitwise.js b/tools/node_modules/eslint/lib/rules/no-bitwise.js index df492937c0b5bb..a9c3360a7c5b42 100644 --- a/tools/node_modules/eslint/lib/rules/no-bitwise.js +++ b/tools/node_modules/eslint/lib/rules/no-bitwise.js @@ -43,7 +43,8 @@ module.exports = { uniqueItems: true }, int32Hint: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js b/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js index f18ec194530c19..79df9a5138759a 100644 --- a/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js +++ b/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js @@ -41,7 +41,7 @@ module.exports = { schema: [{ type: "object", properties: { - allowParens: { type: "boolean" } + allowParens: { type: "boolean", default: false } }, additionalProperties: false }], diff --git a/tools/node_modules/eslint/lib/rules/no-constant-condition.js b/tools/node_modules/eslint/lib/rules/no-constant-condition.js index fb36207ebbb741..d6d04174298cff 100644 --- a/tools/node_modules/eslint/lib/rules/no-constant-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-constant-condition.js @@ -32,7 +32,8 @@ module.exports = { type: "object", properties: { checkLoops: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js b/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js index 7d35b41b4d49ad..03b5e2c12393ae 100644 --- a/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js +++ b/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js @@ -113,7 +113,8 @@ module.exports = { type: "object", properties: { includeExports: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-else-return.js b/tools/node_modules/eslint/lib/rules/no-else-return.js index 5ba02de29136f8..5c21fb1b3fc21e 100644 --- a/tools/node_modules/eslint/lib/rules/no-else-return.js +++ b/tools/node_modules/eslint/lib/rules/no-else-return.js @@ -31,7 +31,8 @@ module.exports = { type: "object", properties: { allowElseIf: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-empty.js b/tools/node_modules/eslint/lib/rules/no-empty.js index 9d72969e67eb6f..2d55dee66596a3 100644 --- a/tools/node_modules/eslint/lib/rules/no-empty.js +++ b/tools/node_modules/eslint/lib/rules/no-empty.js @@ -30,7 +30,8 @@ module.exports = { type: "object", properties: { allowEmptyCatch: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-eval.js b/tools/node_modules/eslint/lib/rules/no-eval.js index 39d91e776e9c79..d4b79468f194a4 100644 --- a/tools/node_modules/eslint/lib/rules/no-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-eval.js @@ -89,7 +89,7 @@ module.exports = { { type: "object", properties: { - allowIndirect: { type: "boolean" } + allowIndirect: { type: "boolean", default: false } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/no-extra-parens.js b/tools/node_modules/eslint/lib/rules/no-extra-parens.js index 3a21b69580b820..9f16e0e6ccc622 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js @@ -44,11 +44,11 @@ module.exports = { { type: "object", properties: { - conditionalAssign: { type: "boolean" }, - nestedBinaryExpressions: { type: "boolean" }, - returnAssign: { type: "boolean" }, + conditionalAssign: { type: "boolean", default: true }, + nestedBinaryExpressions: { type: "boolean", default: true }, + returnAssign: { type: "boolean", default: true }, ignoreJSX: { enum: ["none", "all", "single-line", "multi-line"] }, - enforceForArrowConditionals: { type: "boolean" } + enforceForArrowConditionals: { type: "boolean", default: true } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/no-fallthrough.js b/tools/node_modules/eslint/lib/rules/no-fallthrough.js index 79cbe81c0bbc8e..dfd9d8541587b2 100644 --- a/tools/node_modules/eslint/lib/rules/no-fallthrough.js +++ b/tools/node_modules/eslint/lib/rules/no-fallthrough.js @@ -69,7 +69,8 @@ module.exports = { type: "object", properties: { commentPattern: { - type: "string" + type: "string", + default: "" } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js b/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js index 826d9398cab56e..d54c578646d555 100644 --- a/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js +++ b/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js @@ -21,9 +21,9 @@ const ALLOWABLE_OPERATORS = ["~", "!!", "+", "*"]; */ function parseOptions(options) { return { - boolean: "boolean" in options ? Boolean(options.boolean) : true, - number: "number" in options ? Boolean(options.number) : true, - string: "string" in options ? Boolean(options.string) : true, + boolean: "boolean" in options ? options.boolean : true, + number: "number" in options ? options.number : true, + string: "string" in options ? options.string : true, allow: options.allow || [] }; } @@ -167,13 +167,16 @@ module.exports = { type: "object", properties: { boolean: { - type: "boolean" + type: "boolean", + default: true }, number: { - type: "boolean" + type: "boolean", + default: true }, string: { - type: "boolean" + type: "boolean", + default: true }, allow: { type: "array", diff --git a/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js b/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js index 90d1a79a1c349a..ddbfd1c91cc88d 100644 --- a/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js +++ b/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js @@ -41,16 +41,20 @@ module.exports = { type: "object", properties: { skipComments: { - type: "boolean" + type: "boolean", + default: false }, skipStrings: { - type: "boolean" + type: "boolean", + default: true }, skipTemplates: { - type: "boolean" + type: "boolean", + default: false }, skipRegExps: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-labels.js b/tools/node_modules/eslint/lib/rules/no-labels.js index 34db20725b0af3..29580bd236bbd8 100644 --- a/tools/node_modules/eslint/lib/rules/no-labels.js +++ b/tools/node_modules/eslint/lib/rules/no-labels.js @@ -30,10 +30,12 @@ module.exports = { type: "object", properties: { allowLoop: { - type: "boolean" + type: "boolean", + default: false }, allowSwitch: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -43,8 +45,8 @@ module.exports = { create(context) { const options = context.options[0]; - const allowLoop = Boolean(options && options.allowLoop); - const allowSwitch = Boolean(options && options.allowSwitch); + const allowLoop = options && options.allowLoop; + const allowSwitch = options && options.allowSwitch; let scopeInfo = null; /** diff --git a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js index 84c08dfb08e717..2c6ea61e283315 100644 --- a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js +++ b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js @@ -24,10 +24,12 @@ module.exports = { type: "object", properties: { detectObjects: { - type: "boolean" + type: "boolean", + default: false }, enforceConst: { - type: "boolean" + type: "boolean", + default: false }, ignore: { type: "array", @@ -37,7 +39,8 @@ module.exports = { uniqueItems: true }, ignoreArrayIndexes: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-mixed-operators.js b/tools/node_modules/eslint/lib/rules/no-mixed-operators.js index 22ed65f5b1f0fd..2b603a86df5571 100644 --- a/tools/node_modules/eslint/lib/rules/no-mixed-operators.js +++ b/tools/node_modules/eslint/lib/rules/no-mixed-operators.js @@ -42,10 +42,10 @@ const TARGET_NODE_TYPE = /^(?:Binary|Logical)Expression$/; * @param {Object|undefined} options - A options object to normalize. * @returns {Object} Normalized option object. */ -function normalizeOptions(options) { - const hasGroups = (options && options.groups && options.groups.length > 0); +function normalizeOptions(options = {}) { + const hasGroups = options.groups && options.groups.length > 0; const groups = hasGroups ? options.groups : DEFAULT_GROUPS; - const allowSamePrecedence = (options && options.allowSamePrecedence) !== false; + const allowSamePrecedence = options.allowSamePrecedence !== false; return { groups, @@ -95,7 +95,8 @@ module.exports = { uniqueItems: true }, allowSamePrecedence: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-mixed-requires.js b/tools/node_modules/eslint/lib/rules/no-mixed-requires.js index 438ac668a805af..5b07a5f2938753 100644 --- a/tools/node_modules/eslint/lib/rules/no-mixed-requires.js +++ b/tools/node_modules/eslint/lib/rules/no-mixed-requires.js @@ -30,10 +30,12 @@ module.exports = { type: "object", properties: { grouping: { - type: "boolean" + type: "boolean", + default: false }, allowCall: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-multi-spaces.js b/tools/node_modules/eslint/lib/rules/no-multi-spaces.js index f1792c31ed7e7e..c5fb07403421af 100644 --- a/tools/node_modules/eslint/lib/rules/no-multi-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-multi-spaces.js @@ -38,7 +38,8 @@ module.exports = { additionalProperties: false }, ignoreEOLComments: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-param-reassign.js b/tools/node_modules/eslint/lib/rules/no-param-reassign.js index 349345c148a76b..83760edb8c2fec 100644 --- a/tools/node_modules/eslint/lib/rules/no-param-reassign.js +++ b/tools/node_modules/eslint/lib/rules/no-param-reassign.js @@ -55,7 +55,7 @@ module.exports = { }, create(context) { - const props = context.options[0] && Boolean(context.options[0].props); + const props = context.options[0] && context.options[0].props; const ignoredPropertyAssignmentsFor = context.options[0] && context.options[0].ignorePropertyModificationsFor || []; /** diff --git a/tools/node_modules/eslint/lib/rules/no-plusplus.js b/tools/node_modules/eslint/lib/rules/no-plusplus.js index 4c854de1a06ff7..1d122dcd31f086 100644 --- a/tools/node_modules/eslint/lib/rules/no-plusplus.js +++ b/tools/node_modules/eslint/lib/rules/no-plusplus.js @@ -26,7 +26,8 @@ module.exports = { type: "object", properties: { allowForLoopAfterthoughts: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-redeclare.js b/tools/node_modules/eslint/lib/rules/no-redeclare.js index e88436d7c57b73..4d689cc6138716 100644 --- a/tools/node_modules/eslint/lib/rules/no-redeclare.js +++ b/tools/node_modules/eslint/lib/rules/no-redeclare.js @@ -24,7 +24,7 @@ module.exports = { { type: "object", properties: { - builtinGlobals: { type: "boolean" } + builtinGlobals: { type: "boolean", default: false } }, additionalProperties: false } @@ -33,7 +33,7 @@ module.exports = { create(context) { const options = { - builtinGlobals: Boolean(context.options[0] && context.options[0].builtinGlobals) + builtinGlobals: context.options[0] && context.options[0].builtinGlobals }; /** diff --git a/tools/node_modules/eslint/lib/rules/no-self-assign.js b/tools/node_modules/eslint/lib/rules/no-self-assign.js index d493855efe9c68..8bc7afbe38e9b8 100644 --- a/tools/node_modules/eslint/lib/rules/no-self-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-self-assign.js @@ -179,7 +179,8 @@ module.exports = { type: "object", properties: { props: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js b/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js index 9bdd50868042c3..f09f3767da4257 100644 --- a/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +++ b/tools/node_modules/eslint/lib/rules/no-shadow-restricted-names.js @@ -4,6 +4,19 @@ */ "use strict"; +/** + * Determines if a variable safely shadows undefined. + * This is the case when a variable named `undefined` is never assigned to a value (i.e. it always shares the same value + * as the global). + * @param {eslintScope.Variable} variable The variable to check + * @returns {boolean} true if this variable safely shadows `undefined` + */ +function safelyShadowsUndefined(variable) { + return variable.name === "undefined" && + variable.references.every(ref => !ref.isWrite()) && + variable.defs.every(def => def.node.type === "VariableDeclarator" && def.node.init === null); +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -24,12 +37,13 @@ module.exports = { create(context) { - const RESTRICTED = ["undefined", "NaN", "Infinity", "arguments", "eval"]; + + const RESTRICTED = new Set(["undefined", "NaN", "Infinity", "arguments", "eval"]); return { "VariableDeclaration, :function, CatchClause"(node) { for (const variable of context.getDeclaredVariables(node)) { - if (variable.defs.length > 0 && RESTRICTED.includes(variable.name)) { + if (variable.defs.length > 0 && RESTRICTED.has(variable.name) && !safelyShadowsUndefined(variable)) { context.report({ node: variable.defs[0].name, message: "Shadowing of global property '{{idName}}'.", diff --git a/tools/node_modules/eslint/lib/rules/no-shadow.js b/tools/node_modules/eslint/lib/rules/no-shadow.js index f910230d6a27f3..5f617e52a74ba0 100644 --- a/tools/node_modules/eslint/lib/rules/no-shadow.js +++ b/tools/node_modules/eslint/lib/rules/no-shadow.js @@ -30,8 +30,8 @@ module.exports = { { type: "object", properties: { - builtinGlobals: { type: "boolean" }, - hoist: { enum: ["all", "functions", "never"] }, + builtinGlobals: { type: "boolean", default: false }, + hoist: { enum: ["all", "functions", "never"], default: "functions" }, allow: { type: "array", items: { @@ -47,7 +47,7 @@ module.exports = { create(context) { const options = { - builtinGlobals: Boolean(context.options[0] && context.options[0].builtinGlobals), + builtinGlobals: context.options[0] && context.options[0].builtinGlobals, hoist: (context.options[0] && context.options[0].hoist) || "functions", allow: (context.options[0] && context.options[0].allow) || [] }; diff --git a/tools/node_modules/eslint/lib/rules/no-sync.js b/tools/node_modules/eslint/lib/rules/no-sync.js index a0096e3d04313f..578bac96d3d061 100644 --- a/tools/node_modules/eslint/lib/rules/no-sync.js +++ b/tools/node_modules/eslint/lib/rules/no-sync.js @@ -27,7 +27,8 @@ module.exports = { type: "object", properties: { allowAtRootLevel: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-tabs.js b/tools/node_modules/eslint/lib/rules/no-tabs.js index 0002f5592900c1..91fb000796f369 100644 --- a/tools/node_modules/eslint/lib/rules/no-tabs.js +++ b/tools/node_modules/eslint/lib/rules/no-tabs.js @@ -30,7 +30,8 @@ module.exports = { type: "object", properties: { allowIndentationTabs: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js b/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js index 18f0340ef011c7..1f0b53aca2abad 100644 --- a/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js @@ -32,10 +32,12 @@ module.exports = { type: "object", properties: { skipBlankLines: { - type: "boolean" + type: "boolean", + default: false }, ignoreComments: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -52,7 +54,7 @@ module.exports = { const options = context.options[0] || {}, skipBlankLines = options.skipBlankLines || false, - ignoreComments = typeof options.ignoreComments === "boolean" && options.ignoreComments; + ignoreComments = options.ignoreComments || false; /** * Report the error message diff --git a/tools/node_modules/eslint/lib/rules/no-undef.js b/tools/node_modules/eslint/lib/rules/no-undef.js index e6cd152761fca7..6b5140819bbd30 100644 --- a/tools/node_modules/eslint/lib/rules/no-undef.js +++ b/tools/node_modules/eslint/lib/rules/no-undef.js @@ -39,7 +39,8 @@ module.exports = { type: "object", properties: { typeof: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false 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 926803b992d98a..3f59815b575f84 100644 --- a/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js +++ b/tools/node_modules/eslint/lib/rules/no-underscore-dangle.js @@ -31,13 +31,16 @@ module.exports = { } }, allowAfterThis: { - type: "boolean" + type: "boolean", + default: false }, allowAfterSuper: { - type: "boolean" + type: "boolean", + default: false }, enforceInMethodNames: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js b/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js index 3a7dd5fad7db19..e75a36430fe8aa 100644 --- a/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js +++ b/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js @@ -38,7 +38,8 @@ module.exports = { type: "object", properties: { defaultAssignment: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-unused-expressions.js b/tools/node_modules/eslint/lib/rules/no-unused-expressions.js index 854298b411978b..25c21775b0de05 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-expressions.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-expressions.js @@ -24,13 +24,16 @@ module.exports = { type: "object", properties: { allowShortCircuit: { - type: "boolean" + type: "boolean", + default: false }, allowTernary: { - type: "boolean" + type: "boolean", + default: false }, allowTaggedTemplates: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/no-unused-vars.js b/tools/node_modules/eslint/lib/rules/no-unused-vars.js index e76e3251038c00..e56ba221bbc841 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-vars.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-vars.js @@ -37,22 +37,26 @@ module.exports = { type: "object", properties: { vars: { - enum: ["all", "local"] + enum: ["all", "local"], + default: "all" }, varsIgnorePattern: { type: "string" }, args: { - enum: ["all", "after-used", "none"] + enum: ["all", "after-used", "none"], + default: "after-used" }, ignoreRestSiblings: { - type: "boolean" + type: "boolean", + default: false }, argsIgnorePattern: { type: "string" }, caughtErrors: { - enum: ["all", "none"] + enum: ["all", "none"], + default: "none" }, caughtErrorsIgnorePattern: { type: "string" diff --git a/tools/node_modules/eslint/lib/rules/no-use-before-define.js b/tools/node_modules/eslint/lib/rules/no-use-before-define.js index 500cd3a4103672..e0b2d23a7e6c94 100644 --- a/tools/node_modules/eslint/lib/rules/no-use-before-define.js +++ b/tools/node_modules/eslint/lib/rules/no-use-before-define.js @@ -154,9 +154,9 @@ module.exports = { { type: "object", properties: { - functions: { type: "boolean" }, - classes: { type: "boolean" }, - variables: { type: "boolean" } + functions: { type: "boolean", default: true }, + classes: { type: "boolean", default: true }, + variables: { type: "boolean", default: true } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/no-useless-rename.js b/tools/node_modules/eslint/lib/rules/no-useless-rename.js index 337f875b4564d8..c1860645ea698e 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-rename.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-rename.js @@ -26,9 +26,9 @@ module.exports = { { type: "object", properties: { - ignoreDestructuring: { type: "boolean" }, - ignoreImport: { type: "boolean" }, - ignoreExport: { type: "boolean" } + ignoreDestructuring: { type: "boolean", default: false }, + ignoreImport: { type: "boolean", default: false }, + ignoreExport: { type: "boolean", default: false } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/object-curly-newline.js b/tools/node_modules/eslint/lib/rules/object-curly-newline.js index d1a6bc20f6361e..d45620d53c568f 100644 --- a/tools/node_modules/eslint/lib/rules/object-curly-newline.js +++ b/tools/node_modules/eslint/lib/rules/object-curly-newline.js @@ -26,14 +26,16 @@ const OPTION_VALUE = { type: "object", properties: { multiline: { - type: "boolean" + type: "boolean", + default: false }, minProperties: { type: "integer", minimum: 0 }, consistent: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false, @@ -59,9 +61,9 @@ function normalizeOptionValue(value) { } else if (value === "never") { minProperties = Number.POSITIVE_INFINITY; } else { - multiline = Boolean(value.multiline); + multiline = value.multiline; minProperties = value.minProperties || Number.POSITIVE_INFINITY; - consistent = Boolean(value.consistent); + consistent = value.consistent; } } else { consistent = true; diff --git a/tools/node_modules/eslint/lib/rules/object-property-newline.js b/tools/node_modules/eslint/lib/rules/object-property-newline.js index 3e2c0171577594..bf777b5ff65ba2 100644 --- a/tools/node_modules/eslint/lib/rules/object-property-newline.js +++ b/tools/node_modules/eslint/lib/rules/object-property-newline.js @@ -25,10 +25,12 @@ module.exports = { type: "object", properties: { allowAllPropertiesOnSameLine: { - type: "boolean" + type: "boolean", + default: false }, allowMultiplePropertiesPerLine: { // Deprecated - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -40,7 +42,7 @@ module.exports = { create(context) { const allowSameLine = context.options[0] && ( - (Boolean(context.options[0].allowAllPropertiesOnSameLine) || Boolean(context.options[0].allowMultiplePropertiesPerLine)) // Deprecated + (context.options[0].allowAllPropertiesOnSameLine || context.options[0].allowMultiplePropertiesPerLine /* Deprecated */) ); const errorMessage = allowSameLine ? "Object properties must go on a new line if they aren't all on the same line." diff --git a/tools/node_modules/eslint/lib/rules/object-shorthand.js b/tools/node_modules/eslint/lib/rules/object-shorthand.js index 31010f0e7386db..98917fb6ee20ce 100644 --- a/tools/node_modules/eslint/lib/rules/object-shorthand.js +++ b/tools/node_modules/eslint/lib/rules/object-shorthand.js @@ -57,7 +57,8 @@ module.exports = { type: "object", properties: { avoidQuotes: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -76,13 +77,16 @@ module.exports = { type: "object", properties: { ignoreConstructors: { - type: "boolean" + type: "boolean", + default: false }, avoidQuotes: { - type: "boolean" + type: "boolean", + default: false }, avoidExplicitReturnArrows: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/one-var.js b/tools/node_modules/eslint/lib/rules/one-var.js index 0e9dff416588f7..5a5c71b1874e01 100644 --- a/tools/node_modules/eslint/lib/rules/one-var.js +++ b/tools/node_modules/eslint/lib/rules/one-var.js @@ -32,16 +32,20 @@ module.exports = { type: "object", properties: { separateRequires: { - type: "boolean" + type: "boolean", + default: false }, var: { - enum: ["always", "never", "consecutive"] + enum: ["always", "never", "consecutive"], + default: "always" }, let: { - enum: ["always", "never", "consecutive"] + enum: ["always", "never", "consecutive"], + default: "always" }, const: { - enum: ["always", "never", "consecutive"] + enum: ["always", "never", "consecutive"], + default: "always" } }, additionalProperties: false @@ -76,42 +80,16 @@ module.exports = { options.let = { uninitialized: mode, initialized: mode }; options.const = { uninitialized: mode, initialized: mode }; } else if (typeof mode === "object") { // options configuration is an object - if (Object.prototype.hasOwnProperty.call(mode, "separateRequires")) { - options.separateRequires = !!mode.separateRequires; - } - if (Object.prototype.hasOwnProperty.call(mode, "var")) { - options.var = { uninitialized: mode.var, initialized: mode.var }; - } - if (Object.prototype.hasOwnProperty.call(mode, "let")) { - options.let = { uninitialized: mode.let, initialized: mode.let }; - } - if (Object.prototype.hasOwnProperty.call(mode, "const")) { - options.const = { uninitialized: mode.const, initialized: mode.const }; - } + options.separateRequires = mode.separateRequires; + options.var = { uninitialized: mode.var, initialized: mode.var }; + options.let = { uninitialized: mode.let, initialized: mode.let }; + options.const = { uninitialized: mode.const, initialized: mode.const }; if (Object.prototype.hasOwnProperty.call(mode, "uninitialized")) { - if (!options.var) { - options.var = {}; - } - if (!options.let) { - options.let = {}; - } - if (!options.const) { - options.const = {}; - } options.var.uninitialized = mode.uninitialized; options.let.uninitialized = mode.uninitialized; options.const.uninitialized = mode.uninitialized; } if (Object.prototype.hasOwnProperty.call(mode, "initialized")) { - if (!options.var) { - options.var = {}; - } - if (!options.let) { - options.let = {}; - } - if (!options.const) { - options.const = {}; - } options.var.initialized = mode.initialized; options.let.initialized = mode.initialized; options.const.initialized = mode.initialized; @@ -257,7 +235,9 @@ module.exports = { if (currentOptions.uninitialized === MODE_ALWAYS && currentOptions.initialized === MODE_ALWAYS) { if (currentScope.uninitialized || currentScope.initialized) { - return false; + if (!hasRequires) { + return false; + } } } @@ -268,7 +248,9 @@ module.exports = { } if (declarationCounts.initialized > 0) { if (currentOptions.initialized === MODE_ALWAYS && currentScope.initialized) { - return false; + if (!hasRequires) { + return false; + } } } if (currentScope.required && hasRequires) { @@ -340,7 +322,11 @@ module.exports = { * y` * ^ afterComma */ - if (afterComma.loc.start.line > tokenAfterDeclarator.loc.end.line || afterComma.type === "Line" || afterComma.type === "Block") { + if ( + afterComma.loc.start.line > tokenAfterDeclarator.loc.end.line || + afterComma.type === "Line" || + afterComma.type === "Block" + ) { let lastComment = afterComma; while (lastComment.type === "Line" || lastComment.type === "Block") { @@ -349,7 +335,7 @@ module.exports = { return fixer.replaceTextRange( [tokenAfterDeclarator.range[0], lastComment.range[0]], - `;\n${sourceCode.text.slice(tokenAfterDeclarator.range[1], lastComment.range[0])}\n${declaration.kind} ` + `;${sourceCode.text.slice(tokenAfterDeclarator.range[1], lastComment.range[0])}${declaration.kind} ` ); } diff --git a/tools/node_modules/eslint/lib/rules/padded-blocks.js b/tools/node_modules/eslint/lib/rules/padded-blocks.js index 7c0b56ba7f8553..e4dd37f4cdb42e 100644 --- a/tools/node_modules/eslint/lib/rules/padded-blocks.js +++ b/tools/node_modules/eslint/lib/rules/padded-blocks.js @@ -5,6 +5,12 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("../util/ast-utils"); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -45,32 +51,45 @@ module.exports = { minProperties: 1 } ] + }, + { + type: "object", + properties: { + allowSingleLineBlocks: { + type: "boolean" + } + } } ] }, create(context) { const options = {}; - const config = context.options[0] || "always"; + const typeOptions = context.options[0] || "always"; + const exceptOptions = context.options[1] || {}; - if (typeof config === "string") { - const shouldHavePadding = config === "always"; + if (typeof typeOptions === "string") { + const shouldHavePadding = typeOptions === "always"; options.blocks = shouldHavePadding; options.switches = shouldHavePadding; options.classes = shouldHavePadding; } else { - if (Object.prototype.hasOwnProperty.call(config, "blocks")) { - options.blocks = config.blocks === "always"; + if (Object.prototype.hasOwnProperty.call(typeOptions, "blocks")) { + options.blocks = typeOptions.blocks === "always"; } - if (Object.prototype.hasOwnProperty.call(config, "switches")) { - options.switches = config.switches === "always"; + if (Object.prototype.hasOwnProperty.call(typeOptions, "switches")) { + options.switches = typeOptions.switches === "always"; } - if (Object.prototype.hasOwnProperty.call(config, "classes")) { - options.classes = config.classes === "always"; + if (Object.prototype.hasOwnProperty.call(typeOptions, "classes")) { + options.classes = typeOptions.classes === "always"; } } + if (Object.prototype.hasOwnProperty.call(exceptOptions, "allowSingleLineBlocks")) { + options.allowSingleLineBlocks = exceptOptions.allowSingleLineBlocks === true; + } + const ALWAYS_MESSAGE = "Block must be padded by blank lines.", NEVER_MESSAGE = "Block must not be padded by blank lines."; @@ -177,6 +196,10 @@ module.exports = { blockHasTopPadding = isPaddingBetweenTokens(tokenBeforeFirst, firstBlockToken), blockHasBottomPadding = isPaddingBetweenTokens(lastBlockToken, tokenAfterLast); + if (options.allowSingleLineBlocks && astUtils.isTokenOnSameLine(tokenBeforeFirst, tokenAfterLast)) { + return; + } + if (requirePaddingFor(node)) { if (!blockHasTopPadding) { context.report({ diff --git a/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js b/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js index b4bbf33f296ab8..a0957399ea5ad1 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js +++ b/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js @@ -146,10 +146,12 @@ module.exports = { type: "object", properties: { allowNamedFunctions: { - type: "boolean" + type: "boolean", + default: false }, allowUnboundThis: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/prefer-const.js b/tools/node_modules/eslint/lib/rules/prefer-const.js index 5f75376c95c343..023f69cbd32a30 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-const.js +++ b/tools/node_modules/eslint/lib/rules/prefer-const.js @@ -345,8 +345,8 @@ module.exports = { { type: "object", properties: { - destructuring: { enum: ["any", "all"] }, - ignoreReadBeforeAssign: { type: "boolean" } + destructuring: { enum: ["any", "all"], default: "any" }, + ignoreReadBeforeAssign: { type: "boolean", default: false } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index 119fae560895e7..c30c9170cd9cd2 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -19,6 +19,8 @@ module.exports = { url: "https://eslint.org/docs/rules/prefer-destructuring" }, + fixable: "code", + schema: [ { @@ -34,10 +36,12 @@ module.exports = { type: "object", properties: { array: { - type: "boolean" + type: "boolean", + default: true }, object: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -46,10 +50,12 @@ module.exports = { type: "object", properties: { array: { - type: "boolean" + type: "boolean", + default: true }, object: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -61,10 +67,12 @@ module.exports = { type: "object", properties: { array: { - type: "boolean" + type: "boolean", + default: true }, object: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -75,7 +83,8 @@ module.exports = { type: "object", properties: { enforceForRenamedProperties: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -130,10 +139,55 @@ module.exports = { * * @param {ASTNode} reportNode the node to report * @param {string} type the type of destructuring that should have been done + * @param {Function|null} fix the fix function or null to pass to context.report * @returns {void} */ - function report(reportNode, type) { - context.report({ node: reportNode, message: "Use {{type}} destructuring.", data: { type } }); + function report(reportNode, type, fix) { + context.report({ + node: reportNode, + message: "Use {{type}} destructuring.", + data: { type }, + fix + }); + } + + /** + * Determines if a node should be fixed into object destructuring + * + * The fixer only fixes the simplest case of object destructuring, + * like: `let x = a.x`; + * + * Assignment expression is not fixed. + * Array destructuring is not fixed. + * Renamed property is not fixed. + * + * @param {ASTNode} node the the node to evaluate + * @returns {boolean} whether or not the node should be fixed + */ + function shouldFix(node) { + return node.type === "VariableDeclarator" && + node.id.type === "Identifier" && + node.init.type === "MemberExpression" && + node.id.name === node.init.property.name; + } + + /** + * Fix a node into object destructuring. + * This function only handles the simplest case of object destructuring, + * see {@link shouldFix}. + * + * @param {SourceCodeFixer} fixer the fixer object + * @param {ASTNode} node the node to be fixed. + * @returns {Object} a fix for the node + */ + function fixIntoObjectDestructuring(fixer, node) { + const rightNode = node.init; + const sourceCode = context.getSourceCode(); + + return fixer.replaceText( + node, + `{${rightNode.property.name}} = ${sourceCode.getText(rightNode.object)}` + ); } /** @@ -155,13 +209,17 @@ module.exports = { if (isArrayIndexAccess(rightNode)) { if (shouldCheck(reportNode.type, "array")) { - report(reportNode, "array"); + report(reportNode, "array", null); } return; } + const fix = shouldFix(reportNode) + ? fixer => fixIntoObjectDestructuring(fixer, reportNode) + : null; + if (shouldCheck(reportNode.type, "object") && enforceForRenamedProperties) { - report(reportNode, "object"); + report(reportNode, "object", fix); return; } @@ -172,7 +230,7 @@ module.exports = { (property.type === "Literal" && leftNode.name === property.value) || (property.type === "Identifier" && leftNode.name === property.name && !rightNode.computed) ) { - report(reportNode, "object"); + report(reportNode, "object", fix); } } } diff --git a/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js b/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js index 0db5ae874cfd9f..275e705f6d5ca7 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +++ b/tools/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js @@ -27,7 +27,7 @@ module.exports = { { type: "object", properties: { - allowEmptyReject: { type: "boolean" } + allowEmptyReject: { type: "boolean", default: false } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/prefer-spread.js b/tools/node_modules/eslint/lib/rules/prefer-spread.js index 790fd3b82aab41..5f3a477329b700 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-spread.js +++ b/tools/node_modules/eslint/lib/rules/prefer-spread.js @@ -59,7 +59,7 @@ module.exports = { }, schema: [], - fixable: "code" + fixable: null }, create(context) { @@ -78,18 +78,7 @@ module.exports = { if (isValidThisArg(expectedThis, thisArg, sourceCode)) { context.report({ node, - message: "Use the spread operator instead of '.apply()'.", - fix(fixer) { - if (expectedThis && expectedThis.type !== "Identifier") { - - // Don't fix cases where the `this` value could be a computed expression. - return null; - } - - const propertyDot = sourceCode.getFirstTokenBetween(applied, node.callee.property, token => token.value === "."); - - return fixer.replaceTextRange([propertyDot.range[0], node.range[1]], `(...${sourceCode.getText(node.arguments[1])})`); - } + message: "Use the spread operator instead of '.apply()'." }); } } diff --git a/tools/node_modules/eslint/lib/rules/quote-props.js b/tools/node_modules/eslint/lib/rules/quote-props.js index 7184bd34d35fd1..f4582dd1f4a87c 100644 --- a/tools/node_modules/eslint/lib/rules/quote-props.js +++ b/tools/node_modules/eslint/lib/rules/quote-props.js @@ -32,7 +32,8 @@ module.exports = { type: "array", items: [ { - enum: ["always", "as-needed", "consistent", "consistent-as-needed"] + enum: ["always", "as-needed", "consistent", "consistent-as-needed"], + default: "always" } ], minItems: 0, @@ -42,19 +43,23 @@ module.exports = { type: "array", items: [ { - enum: ["always", "as-needed", "consistent", "consistent-as-needed"] + enum: ["always", "as-needed", "consistent", "consistent-as-needed"], + default: "always" }, { type: "object", properties: { keywords: { - type: "boolean" + type: "boolean", + default: false }, unnecessary: { - type: "boolean" + type: "boolean", + default: true }, numbers: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/quotes.js b/tools/node_modules/eslint/lib/rules/quotes.js index c3c077822462b8..e0797f9e8be3bb 100644 --- a/tools/node_modules/eslint/lib/rules/quotes.js +++ b/tools/node_modules/eslint/lib/rules/quotes.js @@ -100,10 +100,12 @@ module.exports = { type: "object", properties: { avoidEscape: { - type: "boolean" + type: "boolean", + default: false }, allowTemplateLiterals: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/require-jsdoc.js b/tools/node_modules/eslint/lib/rules/require-jsdoc.js index 389bfb692bbae8..416a22ce6c4375 100644 --- a/tools/node_modules/eslint/lib/rules/require-jsdoc.js +++ b/tools/node_modules/eslint/lib/rules/require-jsdoc.js @@ -23,22 +23,28 @@ module.exports = { type: "object", properties: { ClassDeclaration: { - type: "boolean" + type: "boolean", + default: false }, MethodDefinition: { - type: "boolean" + type: "boolean", + default: false }, FunctionDeclaration: { - type: "boolean" + type: "boolean", + default: true }, ArrowFunctionExpression: { - type: "boolean" + type: "boolean", + default: false }, FunctionExpression: { - type: "boolean" + type: "boolean", + default: false } }, - additionalProperties: false + additionalProperties: false, + default: {} } }, additionalProperties: false @@ -58,7 +64,7 @@ module.exports = { ArrowFunctionExpression: false, FunctionExpression: false }; - const options = Object.assign(DEFAULT_OPTIONS, context.options[0] && context.options[0].require || {}); + const options = Object.assign(DEFAULT_OPTIONS, context.options[0] && context.options[0].require); /** * Report the error message diff --git a/tools/node_modules/eslint/lib/rules/semi-spacing.js b/tools/node_modules/eslint/lib/rules/semi-spacing.js index 56ae687d8560a0..3a6d8a052a343b 100644 --- a/tools/node_modules/eslint/lib/rules/semi-spacing.js +++ b/tools/node_modules/eslint/lib/rules/semi-spacing.js @@ -29,10 +29,12 @@ module.exports = { type: "object", properties: { before: { - type: "boolean" + type: "boolean", + default: false }, after: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false @@ -48,12 +50,8 @@ module.exports = { requireSpaceAfter = true; if (typeof config === "object") { - if (Object.prototype.hasOwnProperty.call(config, "before")) { - requireSpaceBefore = config.before; - } - if (Object.prototype.hasOwnProperty.call(config, "after")) { - requireSpaceAfter = config.after; - } + requireSpaceBefore = config.before; + requireSpaceAfter = config.after; } /** diff --git a/tools/node_modules/eslint/lib/rules/semi.js b/tools/node_modules/eslint/lib/rules/semi.js index e8f4c959d4c7df..f7bc0f5fd66198 100644 --- a/tools/node_modules/eslint/lib/rules/semi.js +++ b/tools/node_modules/eslint/lib/rules/semi.js @@ -40,7 +40,8 @@ module.exports = { type: "object", properties: { beforeStatementContinuationChars: { - enum: ["always", "any", "never"] + enum: ["always", "any", "never"], + default: "any" } }, additionalProperties: false @@ -58,7 +59,7 @@ module.exports = { { type: "object", properties: { - omitLastInOneLineBlock: { type: "boolean" } + omitLastInOneLineBlock: { type: "boolean", default: false } }, additionalProperties: false } @@ -75,8 +76,8 @@ module.exports = { const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` const options = context.options[1]; const never = context.options[0] === "never"; - const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock); - const beforeStatementContinuationChars = (options && options.beforeStatementContinuationChars) || "any"; + const exceptOneLine = options && options.omitLastInOneLineBlock; + const beforeStatementContinuationChars = options && options.beforeStatementContinuationChars; const sourceCode = context.getSourceCode(); //-------------------------------------------------------------------------- diff --git a/tools/node_modules/eslint/lib/rules/sort-imports.js b/tools/node_modules/eslint/lib/rules/sort-imports.js index 1c0d134046d9f4..05e643ca0611d5 100644 --- a/tools/node_modules/eslint/lib/rules/sort-imports.js +++ b/tools/node_modules/eslint/lib/rules/sort-imports.js @@ -25,7 +25,8 @@ module.exports = { type: "object", properties: { ignoreCase: { - type: "boolean" + type: "boolean", + default: false }, memberSyntaxSortOrder: { type: "array", @@ -37,10 +38,12 @@ module.exports = { maxItems: 4 }, ignoreDeclarationSort: { - type: "boolean" + type: "boolean", + default: false }, ignoreMemberSort: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/sort-keys.js b/tools/node_modules/eslint/lib/rules/sort-keys.js index 0668e617d3c785..08bfcdf3d8335b 100644 --- a/tools/node_modules/eslint/lib/rules/sort-keys.js +++ b/tools/node_modules/eslint/lib/rules/sort-keys.js @@ -90,10 +90,12 @@ module.exports = { type: "object", properties: { caseSensitive: { - type: "boolean" + type: "boolean", + default: true }, natural: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -106,8 +108,8 @@ module.exports = { // Parse options. const order = context.options[0] || "asc"; const options = context.options[1]; - const insensitive = (options && options.caseSensitive) === false; - const natual = Boolean(options && options.natural); + const insensitive = options && options.caseSensitive === false; + const natual = options && options.natural; const isValidOrder = isValidOrders[ order + (insensitive ? "I" : "") + (natual ? "N" : "") ]; @@ -127,8 +129,12 @@ module.exports = { stack = stack.upper; }, + SpreadElement() { + stack.prevName = null; + }, + Property(node) { - if (node.parent.type === "ObjectPattern" || node.parent.properties.some(n => n.type === "SpreadElement")) { + if (node.parent.type === "ObjectPattern") { return; } diff --git a/tools/node_modules/eslint/lib/rules/sort-vars.js b/tools/node_modules/eslint/lib/rules/sort-vars.js index b6a2c86779c095..e85c6534e3a189 100644 --- a/tools/node_modules/eslint/lib/rules/sort-vars.js +++ b/tools/node_modules/eslint/lib/rules/sort-vars.js @@ -25,7 +25,8 @@ module.exports = { type: "object", properties: { ignoreCase: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/space-before-function-paren.js b/tools/node_modules/eslint/lib/rules/space-before-function-paren.js index 64ba72bf9ead29..c0d8e509fddd63 100644 --- a/tools/node_modules/eslint/lib/rules/space-before-function-paren.js +++ b/tools/node_modules/eslint/lib/rules/space-before-function-paren.js @@ -37,13 +37,16 @@ module.exports = { type: "object", properties: { anonymous: { - enum: ["always", "never", "ignore"] + enum: ["always", "never", "ignore"], + default: "always" }, named: { - enum: ["always", "never", "ignore"] + enum: ["always", "never", "ignore"], + default: "always" }, asyncArrow: { - enum: ["always", "never", "ignore"] + enum: ["always", "never", "ignore"], + default: "always" } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/space-infix-ops.js b/tools/node_modules/eslint/lib/rules/space-infix-ops.js index 254616d998d40d..8d1d172c6697b6 100644 --- a/tools/node_modules/eslint/lib/rules/space-infix-ops.js +++ b/tools/node_modules/eslint/lib/rules/space-infix-ops.js @@ -26,7 +26,8 @@ module.exports = { type: "object", properties: { int32Hint: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/space-unary-ops.js b/tools/node_modules/eslint/lib/rules/space-unary-ops.js index 046be22bec8644..779697b5b39b08 100644 --- a/tools/node_modules/eslint/lib/rules/space-unary-ops.js +++ b/tools/node_modules/eslint/lib/rules/space-unary-ops.js @@ -32,10 +32,12 @@ module.exports = { type: "object", properties: { words: { - type: "boolean" + type: "boolean", + default: true }, nonwords: { - type: "boolean" + type: "boolean", + default: false }, overrides: { type: "object", @@ -58,7 +60,7 @@ module.exports = { }, create(context) { - const options = context.options && Array.isArray(context.options) && context.options[0] || { words: true, nonwords: false }; + const options = context.options[0] || { words: true, nonwords: false }; const sourceCode = context.getSourceCode(); diff --git a/tools/node_modules/eslint/lib/rules/spaced-comment.js b/tools/node_modules/eslint/lib/rules/spaced-comment.js index d4c86d27cf8fc7..63177eb1c7f4f4 100644 --- a/tools/node_modules/eslint/lib/rules/spaced-comment.js +++ b/tools/node_modules/eslint/lib/rules/spaced-comment.js @@ -215,7 +215,8 @@ module.exports = { } }, balanced: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js b/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js index 9c7c0d589e0552..40154862d19215 100644 --- a/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js +++ b/tools/node_modules/eslint/lib/rules/switch-colon-spacing.js @@ -30,8 +30,8 @@ module.exports = { { type: "object", properties: { - before: { type: "boolean" }, - after: { type: "boolean" } + before: { type: "boolean", default: false }, + after: { type: "boolean", default: true } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/valid-jsdoc.js b/tools/node_modules/eslint/lib/rules/valid-jsdoc.js index 515ba78b1d4fcf..46eb02211a4872 100644 --- a/tools/node_modules/eslint/lib/rules/valid-jsdoc.js +++ b/tools/node_modules/eslint/lib/rules/valid-jsdoc.js @@ -42,22 +42,27 @@ module.exports = { } }, requireReturn: { - type: "boolean" + type: "boolean", + default: true }, requireParamDescription: { - type: "boolean" + type: "boolean", + default: true }, requireReturnDescription: { - type: "boolean" + type: "boolean", + default: true }, matchDescription: { type: "string" }, requireReturnType: { - type: "boolean" + type: "boolean", + default: true }, requireParamType: { - type: "boolean" + type: "boolean", + default: true } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/valid-typeof.js b/tools/node_modules/eslint/lib/rules/valid-typeof.js index 7fa2b89bd051a5..16b2a47d371ca6 100644 --- a/tools/node_modules/eslint/lib/rules/valid-typeof.js +++ b/tools/node_modules/eslint/lib/rules/valid-typeof.js @@ -24,7 +24,8 @@ module.exports = { type: "object", properties: { requireStringLiterals: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/rules/wrap-iife.js b/tools/node_modules/eslint/lib/rules/wrap-iife.js index 628ebf532e0254..0e54157f102f7d 100644 --- a/tools/node_modules/eslint/lib/rules/wrap-iife.js +++ b/tools/node_modules/eslint/lib/rules/wrap-iife.js @@ -34,7 +34,8 @@ module.exports = { type: "object", properties: { functionPrototypeMethods: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false @@ -52,7 +53,7 @@ module.exports = { create(context) { const style = context.options[0] || "outside"; - const includeFunctionPrototypeMethods = (context.options[1] && context.options[1].functionPrototypeMethods) || false; + const includeFunctionPrototypeMethods = context.options[1] && context.options[1].functionPrototypeMethods; const sourceCode = context.getSourceCode(); diff --git a/tools/node_modules/eslint/lib/rules/yield-star-spacing.js b/tools/node_modules/eslint/lib/rules/yield-star-spacing.js index 20b8e9ea91eb2e..17124dd6ec7c7d 100644 --- a/tools/node_modules/eslint/lib/rules/yield-star-spacing.js +++ b/tools/node_modules/eslint/lib/rules/yield-star-spacing.js @@ -31,8 +31,8 @@ module.exports = { { type: "object", properties: { - before: { type: "boolean" }, - after: { type: "boolean" } + before: { type: "boolean", default: false }, + after: { type: "boolean", default: true } }, additionalProperties: false } diff --git a/tools/node_modules/eslint/lib/rules/yoda.js b/tools/node_modules/eslint/lib/rules/yoda.js index 83c435a4f74c3a..825634a79f6899 100644 --- a/tools/node_modules/eslint/lib/rules/yoda.js +++ b/tools/node_modules/eslint/lib/rules/yoda.js @@ -169,10 +169,12 @@ module.exports = { type: "object", properties: { exceptRange: { - type: "boolean" + type: "boolean", + default: false }, onlyEquality: { - type: "boolean" + type: "boolean", + default: false } }, additionalProperties: false diff --git a/tools/node_modules/eslint/lib/util/ajv.js b/tools/node_modules/eslint/lib/util/ajv.js index 285176da87dc42..ecf0ebd172cd51 100644 --- a/tools/node_modules/eslint/lib/util/ajv.js +++ b/tools/node_modules/eslint/lib/util/ajv.js @@ -17,6 +17,7 @@ const Ajv = require("ajv"), const ajv = new Ajv({ meta: false, + useDefaults: true, validateSchema: false, missingRefs: "ignore", verbose: true, diff --git a/tools/node_modules/eslint/node_modules/acorn/README.md b/tools/node_modules/eslint/node_modules/acorn/README.md index e66dac31de22b2..3e5f58d95dea95 100644 --- a/tools/node_modules/eslint/node_modules/acorn/README.md +++ b/tools/node_modules/eslint/node_modules/acorn/README.md @@ -5,7 +5,7 @@ A tiny, fast JavaScript parser written in JavaScript. ## Community Acorn is open source software released under an -[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE). +[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE). You are welcome to [report bugs](https://github.com/acornjs/acorn/issues) or create pull 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 e4a0fe3a3bc3b3..44d95c5fae74db 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js @@ -254,7 +254,7 @@ function isNewLine(code, ecma2019String) { return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029)) } -var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; +var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; @@ -272,6 +272,10 @@ var isArray = Array.isArray || (function (obj) { return ( toString.call(obj) === "[object Array]" ); }); +function wordsRegexp(words) { + return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$") +} + // These are used when `options.locations` is on, for the // `startLoc` and `endLoc` properties. @@ -460,24 +464,20 @@ var BIND_FUNCTION = 3; var BIND_SIMPLE_CATCH = 4; var BIND_OUTSIDE = 5; // Special case for function names as bound inside the function -function keywordRegexp(words) { - return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$") -} - var Parser = function Parser(options, input, startPos) { this.options = options = getOptions(options); this.sourceFile = options.sourceFile; - this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5]); + this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5]); var reserved = ""; if (!options.allowReserved) { for (var v = options.ecmaVersion;; v--) { if (reserved = reservedWords[v]) { break } } if (options.sourceType === "module") { reserved += " await"; } } - this.reservedWords = keywordRegexp(reserved); + this.reservedWords = wordsRegexp(reserved); var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; - this.reservedWordsStrict = keywordRegexp(reservedStrict); - this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind); + this.reservedWordsStrict = wordsRegexp(reservedStrict); + this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); this.input = String(input); // Used to signal to callers of `readWord1` whether the word @@ -526,9 +526,11 @@ var Parser = function Parser(options, input, startPos) { this.potentialArrowAt = -1; // Positions to delayed-check that yield/await does not exist in default parameters. - this.yieldPos = this.awaitPos = 0; + this.yieldPos = this.awaitPos = this.awaitIdentPos = 0; // Labels in scope. this.labels = []; + // Thus-far undefined exports. + this.undefinedExports = {}; // If enabled, skip leading hashbang line. if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") @@ -605,7 +607,7 @@ pp.strictDirective = function(start) { // Skip semicolon, if any. skipWhiteSpace.lastIndex = start; start += skipWhiteSpace.exec(this$1.input)[0].length; - if (this$1.input[start] === ';') + if (this$1.input[start] === ";") { start++; } } }; @@ -747,6 +749,13 @@ pp$1.parseTopLevel = function(node) { var stmt = this$1.parseStatement(null, true, exports); node.body.push(stmt); } + if (this.inModule) + { for (var i = 0, list = Object.keys(this$1.undefinedExports); i < list.length; i += 1) + { + var name = list[i]; + + this$1.raiseRecoverable(this$1.undefinedExports[name].start, ("Export '" + name + "' is not defined")); + } } this.adaptDirectivePrologue(node.body); this.next(); if (this.options.ecmaVersion >= 6) { @@ -1238,8 +1247,9 @@ var FUNC_HANGING_STATEMENT = 2; var FUNC_NULLABLE_ID = 4; // Parse a function declaration or literal (depending on the -// `isStatement` parameter). +// `statement & FUNC_STATEMENT`). +// Remove `allowExpressionBody` for 7.0.0, as it is only called with false pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync) { this.initFunction(node); if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { @@ -1260,19 +1270,21 @@ pp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync) { { this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); } } - var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos; + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.yieldPos = 0; this.awaitPos = 0; + this.awaitIdentPos = 0; this.enterScope(functionFlags(node.async, node.generator)); if (!(statement & FUNC_STATEMENT)) { node.id = this.type === types.name ? this.parseIdent() : null; } this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody); + this.parseFunctionBody(node, allowExpressionBody, false); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression") }; @@ -1415,7 +1427,7 @@ pp$1.parseExport = function(node, exports) { var fNode = this.startNode(); this.next(); if (isAsync) { this.next(); } - node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync, true); + node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); } else if (this.type === types._class) { var cNode = this.startNode(); node.declaration = this.parseClass(cNode, "nullableID"); @@ -1441,11 +1453,13 @@ pp$1.parseExport = function(node, exports) { if (this.type !== types.string) { this.unexpected(); } node.source = this.parseExprAtom(); } else { - // check for keywords used as local names for (var i = 0, list = node.specifiers; i < list.length; i += 1) { + // check for keywords used as local names var spec = list[i]; this$1.checkUnreserved(spec.local); + // check if export is defined + this$1.checkLocalExport(spec.local); } node.source = null; @@ -1624,7 +1638,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) { switch (node.type) { case "Identifier": if (this.inAsync && node.name === "await") - { this.raise(node.start, "Can not use 'await' as identifier inside an async function"); } + { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); } break case "ObjectPattern": @@ -2125,42 +2139,53 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) { var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async"; - for (var computed = (void 0);;) { - if ((computed = this$1.eat(types.bracketL)) || this$1.eat(types.dot)) { - var node = this$1.startNodeAt(startPos, startLoc); - node.object = base; - node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true); - node.computed = !!computed; - if (computed) { this$1.expect(types.bracketR); } - base = this$1.finishNode(node, "MemberExpression"); - } else if (!noCalls && this$1.eat(types.parenL)) { - var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos; - this$1.yieldPos = 0; - this$1.awaitPos = 0; - var exprList = this$1.parseExprList(types.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors); - if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(types.arrow)) { - this$1.checkPatternErrors(refDestructuringErrors, false); - this$1.checkYieldAwaitInDefaultParams(); - this$1.yieldPos = oldYieldPos; - this$1.awaitPos = oldAwaitPos; - return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true) - } - this$1.checkExpressionErrors(refDestructuringErrors, true); - this$1.yieldPos = oldYieldPos || this$1.yieldPos; - this$1.awaitPos = oldAwaitPos || this$1.awaitPos; - var node$1 = this$1.startNodeAt(startPos, startLoc); - node$1.callee = base; - node$1.arguments = exprList; - base = this$1.finishNode(node$1, "CallExpression"); - } else if (this$1.type === types.backQuote) { - var node$2 = this$1.startNodeAt(startPos, startLoc); - node$2.tag = base; - node$2.quasi = this$1.parseTemplate({isTagged: true}); - base = this$1.finishNode(node$2, "TaggedTemplateExpression"); - } else { - return base + while (true) { + var element = this$1.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow); + if (element === base || element.type === "ArrowFunctionExpression") { return element } + base = element; + } +}; + +pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) { + var computed = this.eat(types.bracketL); + if (computed || this.eat(types.dot)) { + var node = this.startNodeAt(startPos, startLoc); + node.object = base; + node.property = computed ? this.parseExpression() : this.parseIdent(true); + node.computed = !!computed; + if (computed) { this.expect(types.bracketR); } + base = this.finishNode(node, "MemberExpression"); + } else if (!noCalls && this.eat(types.parenL)) { + var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); + if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + if (this.awaitIdentPos > 0) + { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); } + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true) } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.callee = base; + node$1.arguments = exprList; + base = this.finishNode(node$1, "CallExpression"); + } else if (this.type === types.backQuote) { + var node$2 = this.startNodeAt(startPos, startLoc); + node$2.tag = base; + node$2.quasi = this.parseTemplate({isTagged: true}); + base = this.finishNode(node$2, "TaggedTemplateExpression"); } + return base }; // Parse an atomic expression — either a single token that is an @@ -2199,14 +2224,14 @@ pp$3.parseExprAtom = function(refDestructuringErrors) { case types.name: var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; - var id = this.parseIdent(this.type !== types.name); + var id = this.parseIdent(false); if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) { return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true) } if (canBeArrow && !this.canInsertSemicolon()) { if (this.eat(types.arrow)) { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) } if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc) { - id = this.parseIdent(); + id = this.parseIdent(false); if (this.canInsertSemicolon() || !this.eat(types.arrow)) { this.unexpected(); } return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true) @@ -2295,6 +2320,7 @@ pp$3.parseParenAndDistinguishExpression = function(canBeArrow) { var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart; this.yieldPos = 0; this.awaitPos = 0; + // Do not save awaitIdentPos to allow checking awaits nested in parameters while (this.type !== types.parenR) { first ? first = false : this$1.expect(types.comma); if (allowTrailingComma && this$1.afterTrailingComma(types.parenR, true)) { @@ -2538,7 +2564,10 @@ pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); } } } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { + if (isGenerator || isAsync) { this.unexpected(); } this.checkUnreserved(prop.key); + if (prop.key.name === "await" && !this.awaitIdentPos) + { this.awaitIdentPos = startPos; } prop.kind = "init"; if (isPattern) { prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); @@ -2578,7 +2607,7 @@ pp$3.initFunction = function(node) { // Parse object or class method. pp$3.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { - var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos; + var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.initFunction(node); if (this.options.ecmaVersion >= 6) @@ -2588,22 +2617,24 @@ pp$3.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { this.yieldPos = 0; this.awaitPos = 0; + this.awaitIdentPos = 0; this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); this.expect(types.parenL); node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8); this.checkYieldAwaitInDefaultParams(); - this.parseFunctionBody(node, false); + this.parseFunctionBody(node, false, true); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; return this.finishNode(node, "FunctionExpression") }; // Parse arrow function expression with given parameters. pp$3.parseArrowExpression = function(node, params, isAsync) { - var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos; + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); this.initFunction(node); @@ -2611,18 +2642,20 @@ pp$3.parseArrowExpression = function(node, params, isAsync) { this.yieldPos = 0; this.awaitPos = 0; + this.awaitIdentPos = 0; node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true); + this.parseFunctionBody(node, true, false); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; return this.finishNode(node, "ArrowFunctionExpression") }; // Parse function body and check parameters. -pp$3.parseFunctionBody = function(node, isArrowFunction) { +pp$3.parseFunctionBody = function(node, isArrowFunction, isMethod) { var isExpression = isArrowFunction && this.type !== types.braceL; var oldStrict = this.strict, useStrict = false; @@ -2648,7 +2681,7 @@ pp$3.parseFunctionBody = function(node, isArrowFunction) { // Add the params to varDeclaredNames to ensure that an error is thrown // if a let/const declaration in the function clashes with one of the params. - this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params)); + this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); node.body = this.parseBlock(false); node.expression = false; this.adaptDirectivePrologue(node.body.body); @@ -2723,9 +2756,9 @@ pp$3.checkUnreserved = function(ref) { var name = ref.name; if (this.inGenerator && name === "yield") - { this.raiseRecoverable(start, "Can not use 'yield' as identifier inside a generator"); } + { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); } if (this.inAsync && name === "await") - { this.raiseRecoverable(start, "Can not use 'await' as identifier inside an async function"); } + { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); } if (this.keywords.test(name)) { this.raise(start, ("Unexpected keyword '" + name + "'")); } if (this.options.ecmaVersion < 6 && @@ -2733,7 +2766,7 @@ pp$3.checkUnreserved = function(ref) { var re = this.strict ? this.reservedWordsStrict : this.reservedWords; if (re.test(name)) { if (!this.inAsync && name === "await") - { this.raiseRecoverable(start, "Can not use keyword 'await' outside an async function"); } + { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); } this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved")); } }; @@ -2763,7 +2796,11 @@ pp$3.parseIdent = function(liberal, isBinding) { } this.next(); this.finishNode(node, "Identifier"); - if (!liberal) { this.checkUnreserved(node); } + if (!liberal) { + this.checkUnreserved(node); + if (node.name === "await" && !this.awaitIdentPos) + { this.awaitIdentPos = node.start; } + } return node }; @@ -2843,7 +2880,7 @@ pp$5.exitScope = function() { // > At the top level of a function, or script, function declarations are // > treated like var declarations rather than like lexical declarations. pp$5.treatFunctionsAsVarInScope = function(scope) { - return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP); + return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP) }; pp$5.declareName = function(name, bindingType, pos) { @@ -2854,6 +2891,8 @@ pp$5.declareName = function(name, bindingType, pos) { var scope = this.currentScope(); redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1; scope.lexical.push(name); + if (this.inModule && (scope.flags & SCOPE_TOP)) + { delete this.undefinedExports[name]; } } else if (bindingType === BIND_SIMPLE_CATCH) { var scope$1 = this.currentScope(); scope$1.lexical.push(name); @@ -2867,18 +2906,28 @@ pp$5.declareName = function(name, bindingType, pos) { } else { for (var i = this.scopeStack.length - 1; i >= 0; --i) { var scope$3 = this$1.scopeStack[i]; - if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name || + if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) || !this$1.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { redeclared = true; break } scope$3.var.push(name); + if (this$1.inModule && (scope$3.flags & SCOPE_TOP)) + { delete this$1.undefinedExports[name]; } if (scope$3.flags & SCOPE_VAR) { break } } } if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); } }; +pp$5.checkLocalExport = function(id) { + // scope.functions must be empty as Module code is always strict. + if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && + this.scopeStack[0].var.indexOf(id.name) === -1) { + this.undefinedExports[id.name] = id; + } +}; + pp$5.currentScope = function() { return this.scopeStack[this.scopeStack.length - 1] }; @@ -3094,473 +3143,51 @@ types.name.updateContext = function(prevType) { this.exprAllowed = allowed; }; -var data = { - "$LONE": [ - "ASCII", - "ASCII_Hex_Digit", - "AHex", - "Alphabetic", - "Alpha", - "Any", - "Assigned", - "Bidi_Control", - "Bidi_C", - "Bidi_Mirrored", - "Bidi_M", - "Case_Ignorable", - "CI", - "Cased", - "Changes_When_Casefolded", - "CWCF", - "Changes_When_Casemapped", - "CWCM", - "Changes_When_Lowercased", - "CWL", - "Changes_When_NFKC_Casefolded", - "CWKCF", - "Changes_When_Titlecased", - "CWT", - "Changes_When_Uppercased", - "CWU", - "Dash", - "Default_Ignorable_Code_Point", - "DI", - "Deprecated", - "Dep", - "Diacritic", - "Dia", - "Emoji", - "Emoji_Component", - "Emoji_Modifier", - "Emoji_Modifier_Base", - "Emoji_Presentation", - "Extender", - "Ext", - "Grapheme_Base", - "Gr_Base", - "Grapheme_Extend", - "Gr_Ext", - "Hex_Digit", - "Hex", - "IDS_Binary_Operator", - "IDSB", - "IDS_Trinary_Operator", - "IDST", - "ID_Continue", - "IDC", - "ID_Start", - "IDS", - "Ideographic", - "Ideo", - "Join_Control", - "Join_C", - "Logical_Order_Exception", - "LOE", - "Lowercase", - "Lower", - "Math", - "Noncharacter_Code_Point", - "NChar", - "Pattern_Syntax", - "Pat_Syn", - "Pattern_White_Space", - "Pat_WS", - "Quotation_Mark", - "QMark", - "Radical", - "Regional_Indicator", - "RI", - "Sentence_Terminal", - "STerm", - "Soft_Dotted", - "SD", - "Terminal_Punctuation", - "Term", - "Unified_Ideograph", - "UIdeo", - "Uppercase", - "Upper", - "Variation_Selector", - "VS", - "White_Space", - "space", - "XID_Continue", - "XIDC", - "XID_Start", - "XIDS" - ], - "General_Category": [ - "Cased_Letter", - "LC", - "Close_Punctuation", - "Pe", - "Connector_Punctuation", - "Pc", - "Control", - "Cc", - "cntrl", - "Currency_Symbol", - "Sc", - "Dash_Punctuation", - "Pd", - "Decimal_Number", - "Nd", - "digit", - "Enclosing_Mark", - "Me", - "Final_Punctuation", - "Pf", - "Format", - "Cf", - "Initial_Punctuation", - "Pi", - "Letter", - "L", - "Letter_Number", - "Nl", - "Line_Separator", - "Zl", - "Lowercase_Letter", - "Ll", - "Mark", - "M", - "Combining_Mark", - "Math_Symbol", - "Sm", - "Modifier_Letter", - "Lm", - "Modifier_Symbol", - "Sk", - "Nonspacing_Mark", - "Mn", - "Number", - "N", - "Open_Punctuation", - "Ps", - "Other", - "C", - "Other_Letter", - "Lo", - "Other_Number", - "No", - "Other_Punctuation", - "Po", - "Other_Symbol", - "So", - "Paragraph_Separator", - "Zp", - "Private_Use", - "Co", - "Punctuation", - "P", - "punct", - "Separator", - "Z", - "Space_Separator", - "Zs", - "Spacing_Mark", - "Mc", - "Surrogate", - "Cs", - "Symbol", - "S", - "Titlecase_Letter", - "Lt", - "Unassigned", - "Cn", - "Uppercase_Letter", - "Lu" - ], - "Script": [ - "Adlam", - "Adlm", - "Ahom", - "Anatolian_Hieroglyphs", - "Hluw", - "Arabic", - "Arab", - "Armenian", - "Armn", - "Avestan", - "Avst", - "Balinese", - "Bali", - "Bamum", - "Bamu", - "Bassa_Vah", - "Bass", - "Batak", - "Batk", - "Bengali", - "Beng", - "Bhaiksuki", - "Bhks", - "Bopomofo", - "Bopo", - "Brahmi", - "Brah", - "Braille", - "Brai", - "Buginese", - "Bugi", - "Buhid", - "Buhd", - "Canadian_Aboriginal", - "Cans", - "Carian", - "Cari", - "Caucasian_Albanian", - "Aghb", - "Chakma", - "Cakm", - "Cham", - "Cherokee", - "Cher", - "Common", - "Zyyy", - "Coptic", - "Copt", - "Qaac", - "Cuneiform", - "Xsux", - "Cypriot", - "Cprt", - "Cyrillic", - "Cyrl", - "Deseret", - "Dsrt", - "Devanagari", - "Deva", - "Duployan", - "Dupl", - "Egyptian_Hieroglyphs", - "Egyp", - "Elbasan", - "Elba", - "Ethiopic", - "Ethi", - "Georgian", - "Geor", - "Glagolitic", - "Glag", - "Gothic", - "Goth", - "Grantha", - "Gran", - "Greek", - "Grek", - "Gujarati", - "Gujr", - "Gurmukhi", - "Guru", - "Han", - "Hani", - "Hangul", - "Hang", - "Hanunoo", - "Hano", - "Hatran", - "Hatr", - "Hebrew", - "Hebr", - "Hiragana", - "Hira", - "Imperial_Aramaic", - "Armi", - "Inherited", - "Zinh", - "Qaai", - "Inscriptional_Pahlavi", - "Phli", - "Inscriptional_Parthian", - "Prti", - "Javanese", - "Java", - "Kaithi", - "Kthi", - "Kannada", - "Knda", - "Katakana", - "Kana", - "Kayah_Li", - "Kali", - "Kharoshthi", - "Khar", - "Khmer", - "Khmr", - "Khojki", - "Khoj", - "Khudawadi", - "Sind", - "Lao", - "Laoo", - "Latin", - "Latn", - "Lepcha", - "Lepc", - "Limbu", - "Limb", - "Linear_A", - "Lina", - "Linear_B", - "Linb", - "Lisu", - "Lycian", - "Lyci", - "Lydian", - "Lydi", - "Mahajani", - "Mahj", - "Malayalam", - "Mlym", - "Mandaic", - "Mand", - "Manichaean", - "Mani", - "Marchen", - "Marc", - "Masaram_Gondi", - "Gonm", - "Meetei_Mayek", - "Mtei", - "Mende_Kikakui", - "Mend", - "Meroitic_Cursive", - "Merc", - "Meroitic_Hieroglyphs", - "Mero", - "Miao", - "Plrd", - "Modi", - "Mongolian", - "Mong", - "Mro", - "Mroo", - "Multani", - "Mult", - "Myanmar", - "Mymr", - "Nabataean", - "Nbat", - "New_Tai_Lue", - "Talu", - "Newa", - "Nko", - "Nkoo", - "Nushu", - "Nshu", - "Ogham", - "Ogam", - "Ol_Chiki", - "Olck", - "Old_Hungarian", - "Hung", - "Old_Italic", - "Ital", - "Old_North_Arabian", - "Narb", - "Old_Permic", - "Perm", - "Old_Persian", - "Xpeo", - "Old_South_Arabian", - "Sarb", - "Old_Turkic", - "Orkh", - "Oriya", - "Orya", - "Osage", - "Osge", - "Osmanya", - "Osma", - "Pahawh_Hmong", - "Hmng", - "Palmyrene", - "Palm", - "Pau_Cin_Hau", - "Pauc", - "Phags_Pa", - "Phag", - "Phoenician", - "Phnx", - "Psalter_Pahlavi", - "Phlp", - "Rejang", - "Rjng", - "Runic", - "Runr", - "Samaritan", - "Samr", - "Saurashtra", - "Saur", - "Sharada", - "Shrd", - "Shavian", - "Shaw", - "Siddham", - "Sidd", - "SignWriting", - "Sgnw", - "Sinhala", - "Sinh", - "Sora_Sompeng", - "Sora", - "Soyombo", - "Soyo", - "Sundanese", - "Sund", - "Syloti_Nagri", - "Sylo", - "Syriac", - "Syrc", - "Tagalog", - "Tglg", - "Tagbanwa", - "Tagb", - "Tai_Le", - "Tale", - "Tai_Tham", - "Lana", - "Tai_Viet", - "Tavt", - "Takri", - "Takr", - "Tamil", - "Taml", - "Tangut", - "Tang", - "Telugu", - "Telu", - "Thaana", - "Thaa", - "Thai", - "Tibetan", - "Tibt", - "Tifinagh", - "Tfng", - "Tirhuta", - "Tirh", - "Ugaritic", - "Ugar", - "Vai", - "Vaii", - "Warang_Citi", - "Wara", - "Yi", - "Yiii", - "Zanabazar_Square", - "Zanb" - ] -}; -Array.prototype.push.apply(data.$LONE, data.General_Category); -data.gc = data.General_Category; -data.sc = data.Script_Extensions = data.scx = data.Script; +// This file contains Unicode properties extracted from the ECMAScript +// specification. The lists are extracted like so: +// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText) + +// #table-binary-unicode-properties +var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"; +var unicodeBinaryProperties = { + 9: ecma9BinaryProperties, + 10: ecma9BinaryProperties + " Extended_Pictographic" +}; + +// #table-unicode-general-category-values +var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu"; + +// #table-unicode-script-values +var ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"; +var unicodeScriptValues = { + 9: ecma9ScriptValues, + 10: ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd" +}; + +var data = {}; +function buildUnicodeData(ecmaVersion) { + var d = data[ecmaVersion] = { + binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), + nonBinary: { + General_Category: wordsRegexp(unicodeGeneralCategoryValues), + Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) + } + }; + d.nonBinary.Script_Extensions = d.nonBinary.Script; + + d.nonBinary.gc = d.nonBinary.General_Category; + d.nonBinary.sc = d.nonBinary.Script; + d.nonBinary.scx = d.nonBinary.Script_Extensions; +} +buildUnicodeData(9); +buildUnicodeData(10); var pp$9 = Parser.prototype; var RegExpValidationState = function RegExpValidationState(parser) { this.parser = parser; this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : ""); + this.unicodeProperties = data[parser.options.ecmaVersion >= 10 ? 10 : parser.options.ecmaVersion]; this.source = ""; this.flags = ""; this.start = 0; @@ -4344,14 +3971,14 @@ pp$9.regexp_eatUnicodePropertyValueExpression = function(state) { return false }; pp$9.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) { - if (!data.hasOwnProperty(name) || data[name].indexOf(value) === -1) { - state.raise("Invalid property name"); - } + if (!has(state.unicodeProperties.nonBinary, name)) + { state.raise("Invalid property name"); } + if (!state.unicodeProperties.nonBinary[name].test(value)) + { state.raise("Invalid property value"); } }; pp$9.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { - if (data.$LONE.indexOf(nameOrValue) === -1) { - state.raise("Invalid property name"); - } + if (!state.unicodeProperties.binary.test(nameOrValue)) + { state.raise("Invalid property name"); } }; // UnicodePropertyName :: @@ -5334,7 +4961,7 @@ pp$8.readWord = function() { // // [walk]: util/walk.js -var version = "6.0.6"; +var version = "6.1.0"; // The main exported interface (under `self.acorn` when in the // browser) is a `parse` function that takes a code string and diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js.map b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js.map index 63bbd1d8fb4fc7..219dac5954a3be 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js.map +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js.map @@ -1 +1 @@ -{"version":3,"file":"acorn.js","sources":["../src/identifier.js","../src/tokentype.js","../src/whitespace.js","../src/util.js","../src/locutil.js","../src/options.js","../src/scopeflags.js","../src/state.js","../src/parseutil.js","../src/statement.js","../src/lval.js","../src/expression.js","../src/location.js","../src/scope.js","../src/node.js","../src/tokencontext.js","../src/unicode-property-data.js","../src/regexp.js","../src/tokenize.js","../src/index.js"],"sourcesContent":["// Reserved word lists for various dialects of the language\n\nexport const reservedWords = {\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\n 5: \"class enum extends super const export import\",\n 6: \"enum\",\n strict: \"implements interface let package private protected public static yield\",\n strictBind: \"eval arguments\"\n}\n\n// And the keywords\n\nconst ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\"\n\nexport const keywords = {\n 5: ecma5AndLessKeywords,\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\n}\n\nexport const keywordRelationalOperator = /^in(stanceof)?$/\n\n// ## Character categories\n\n// Big ugly regular expressions that match characters in the\n// whitespace, identifier, and identifier-start categories. These\n// are only applied when a character is found to actually have a\n// code point above 128.\n// Generated by `bin/generate-identifier-regex.js`.\n\nlet nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05d0-\\u05ea\\u05ef-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086a\\u08a0-\\u08b4\\u08b6-\\u08bd\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u09fc\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1878\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c88\\u1c90-\\u1cba\\u1cbd-\\u1cbf\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fef\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7b9\\ua7f7-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua8fe\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab65\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\"\nlet nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u07fd\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u08d3-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u09fe\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0afa-\\u0aff\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c04\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0d00-\\u0d03\\u0d3b\\u0d3c\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf2-\\u1cf4\\u1cf7-\\u1cf9\\u1dc0-\\u1df9\\u1dfb-\\u1dff\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua8ff-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\"\n\nconst nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\")\nconst nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\")\n\nnonASCIIidentifierStartChars = nonASCIIidentifierChars = null\n\n// These are a run-length and offset encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range. They were\n// generated by bin/generate-identifier-regex.js\n\n// eslint-disable-next-line comma-spacing\nconst astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,190,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,26,230,43,117,63,32,0,257,0,11,39,8,0,22,0,12,39,3,3,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,68,12,0,67,12,65,1,31,6129,15,754,9486,286,82,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541]\n\n// eslint-disable-next-line comma-spacing\nconst astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,280,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239]\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code, set) {\n let pos = 0x10000\n for (let i = 0; i < set.length; i += 2) {\n pos += set[i]\n if (pos > code) return false\n pos += set[i + 1]\n if (pos >= code) return true\n }\n}\n\n// Test whether a given character code starts an identifier.\n\nexport function isIdentifierStart(code, astral) {\n if (code < 65) return code === 36\n if (code < 91) return true\n if (code < 97) return code === 95\n if (code < 123) return true\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))\n if (astral === false) return false\n return isInAstralSet(code, astralIdentifierStartCodes)\n}\n\n// Test whether a given character is part of an identifier.\n\nexport function isIdentifierChar(code, astral) {\n if (code < 48) return code === 36\n if (code < 58) return true\n if (code < 65) return false\n if (code < 91) return true\n if (code < 97) return code === 95\n if (code < 123) return true\n if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))\n if (astral === false) return false\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\n}\n","// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between regular\n// expressions and divisions. It is set on all token types that can\n// be followed by an expression (thus, a slash after them would be a\n// regular expression).\n//\n// The `startsExpr` property is used to check if the token ends a\n// `yield` expression. It is set on all token types that either can\n// directly start an expression (like a quotation mark) or can\n// continue an expression (like the body of a string).\n//\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nexport class TokenType {\n constructor(label, conf = {}) {\n this.label = label\n this.keyword = conf.keyword\n this.beforeExpr = !!conf.beforeExpr\n this.startsExpr = !!conf.startsExpr\n this.isLoop = !!conf.isLoop\n this.isAssign = !!conf.isAssign\n this.prefix = !!conf.prefix\n this.postfix = !!conf.postfix\n this.binop = conf.binop || null\n this.updateContext = null\n }\n}\n\nfunction binop(name, prec) {\n return new TokenType(name, {beforeExpr: true, binop: prec})\n}\nconst beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}\n\n// Map keyword names to token types.\n\nexport const keywords = {}\n\n// Succinct definitions of keyword token types\nfunction kw(name, options = {}) {\n options.keyword = name\n return keywords[name] = new TokenType(name, options)\n}\n\nexport const types = {\n num: new TokenType(\"num\", startsExpr),\n regexp: new TokenType(\"regexp\", startsExpr),\n string: new TokenType(\"string\", startsExpr),\n name: new TokenType(\"name\", startsExpr),\n eof: new TokenType(\"eof\"),\n\n // Punctuation token types.\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\n bracketR: new TokenType(\"]\"),\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\n braceR: new TokenType(\"}\"),\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\n parenR: new TokenType(\")\"),\n comma: new TokenType(\",\", beforeExpr),\n semi: new TokenType(\";\", beforeExpr),\n colon: new TokenType(\":\", beforeExpr),\n dot: new TokenType(\".\"),\n question: new TokenType(\"?\", beforeExpr),\n arrow: new TokenType(\"=>\", beforeExpr),\n template: new TokenType(\"template\"),\n invalidTemplate: new TokenType(\"invalidTemplate\"),\n ellipsis: new TokenType(\"...\", beforeExpr),\n backQuote: new TokenType(\"`\", startsExpr),\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\n prefix: new TokenType(\"!/~\", {beforeExpr: true, prefix: true, startsExpr: true}),\n logicalOR: binop(\"||\", 1),\n logicalAND: binop(\"&&\", 2),\n bitwiseOR: binop(\"|\", 3),\n bitwiseXOR: binop(\"^\", 4),\n bitwiseAND: binop(\"&\", 5),\n equality: binop(\"==/!=/===/!==\", 6),\n relational: binop(\"/<=/>=\", 7),\n bitShift: binop(\"<>/>>>\", 8),\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\n modulo: binop(\"%\", 10),\n star: binop(\"*\", 10),\n slash: binop(\"/\", 10),\n starstar: new TokenType(\"**\", {beforeExpr: true}),\n\n // Keyword token types.\n _break: kw(\"break\"),\n _case: kw(\"case\", beforeExpr),\n _catch: kw(\"catch\"),\n _continue: kw(\"continue\"),\n _debugger: kw(\"debugger\"),\n _default: kw(\"default\", beforeExpr),\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\n _else: kw(\"else\", beforeExpr),\n _finally: kw(\"finally\"),\n _for: kw(\"for\", {isLoop: true}),\n _function: kw(\"function\", startsExpr),\n _if: kw(\"if\"),\n _return: kw(\"return\", beforeExpr),\n _switch: kw(\"switch\"),\n _throw: kw(\"throw\", beforeExpr),\n _try: kw(\"try\"),\n _var: kw(\"var\"),\n _const: kw(\"const\"),\n _while: kw(\"while\", {isLoop: true}),\n _with: kw(\"with\"),\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\n _this: kw(\"this\", startsExpr),\n _super: kw(\"super\", startsExpr),\n _class: kw(\"class\", startsExpr),\n _extends: kw(\"extends\", beforeExpr),\n _export: kw(\"export\"),\n _import: kw(\"import\"),\n _null: kw(\"null\", startsExpr),\n _true: kw(\"true\", startsExpr),\n _false: kw(\"false\", startsExpr),\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\n}\n","// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\nexport const lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/\nexport const lineBreakG = new RegExp(lineBreak.source, \"g\")\n\nexport function isNewLine(code, ecma2019String) {\n return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))\n}\n\nexport const nonASCIIwhitespace = /[\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/\n\nexport const skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g\n","const {hasOwnProperty, toString} = Object.prototype\n\n// Checks if an object has a property.\n\nexport function has(obj, propName) {\n return hasOwnProperty.call(obj, propName)\n}\n\nexport const isArray = Array.isArray || ((obj) => (\n toString.call(obj) === \"[object Array]\"\n))\n","import {lineBreakG} from \"./whitespace\"\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nexport class Position {\n constructor(line, col) {\n this.line = line\n this.column = col\n }\n\n offset(n) {\n return new Position(this.line, this.column + n)\n }\n}\n\nexport class SourceLocation {\n constructor(p, start, end) {\n this.start = start\n this.end = end\n if (p.sourceFile !== null) this.source = p.sourceFile\n }\n}\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nexport function getLineInfo(input, offset) {\n for (let line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur\n let match = lineBreakG.exec(input)\n if (match && match.index < offset) {\n ++line\n cur = match.index + match[0].length\n } else {\n return new Position(line, offset - cur)\n }\n }\n}\n","import {has, isArray} from \"./util\"\nimport {SourceLocation} from \"./locutil\"\n\n// A second optional argument can be given to further configure\n// the parser process. These options are recognized:\n\nexport const defaultOptions = {\n // `ecmaVersion` indicates the ECMAScript version to parse. Must be\n // either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10\n // (2019). This influences support for strict mode, the set of\n // reserved words, and support for new syntax features. The default\n // is 9.\n ecmaVersion: 9,\n // `sourceType` indicates the mode the code should be parsed in.\n // Can be either `\"script\"` or `\"module\"`. This influences global\n // strict mode and parsing of `import` and `export` declarations.\n sourceType: \"script\",\n // `onInsertedSemicolon` can be a callback that will be called\n // when a semicolon is automatically inserted. It will be passed\n // the position of the comma as an offset, and if `locations` is\n // enabled, it is given the location as a `{line, column}` object\n // as second argument.\n onInsertedSemicolon: null,\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\n // trailing commas.\n onTrailingComma: null,\n // By default, reserved words are only enforced if ecmaVersion >= 5.\n // Set `allowReserved` to a boolean value to explicitly turn this on\n // an off. When this option has the value \"never\", reserved words\n // and keywords can also not be used as property names.\n allowReserved: null,\n // When enabled, a return at the top level is not considered an\n // error.\n allowReturnOutsideFunction: false,\n // When enabled, import/export statements are not constrained to\n // appearing at the top of the program.\n allowImportExportEverywhere: false,\n // When enabled, await identifiers are allowed to appear at the top-level scope,\n // but they are still not allowed in non-async functions.\n allowAwaitOutsideFunction: false,\n // When enabled, hashbang directive in the beginning of file\n // is allowed and treated as a line comment.\n allowHashBang: false,\n // When `locations` is on, `loc` properties holding objects with\n // `start` and `end` properties in `{line, column}` form (with\n // line being 1-based and column 0-based) will be attached to the\n // nodes.\n locations: false,\n // A function can be passed as `onToken` option, which will\n // cause Acorn to call that function with object in the same\n // format as tokens returned from `tokenizer().getToken()`. Note\n // that you are not allowed to call the parser from the\n // callback—that will corrupt its internal state.\n onToken: null,\n // A function can be passed as `onComment` option, which will\n // cause Acorn to call that function with `(block, text, start,\n // end)` parameters whenever a comment is skipped. `block` is a\n // boolean indicating whether this is a block (`/* */`) comment,\n // `text` is the content of the comment, and `start` and `end` are\n // character offsets that denote the start and end of the comment.\n // When the `locations` option is on, two more parameters are\n // passed, the full `{line, column}` locations of the start and\n // end of the comments. Note that you are not allowed to call the\n // parser from the callback—that will corrupt its internal state.\n onComment: null,\n // Nodes have their start and end characters offsets recorded in\n // `start` and `end` properties (directly on the node, rather than\n // the `loc` object, which holds line/column data. To also add a\n // [semi-standardized][range] `range` property holding a `[start,\n // end]` array with the same numbers, set the `ranges` option to\n // `true`.\n //\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n ranges: false,\n // It is possible to parse multiple files into a single AST by\n // passing the tree produced by parsing the first file as\n // `program` option in subsequent parses. This will add the\n // toplevel forms of the parsed file to the `Program` (top) node\n // of an existing parse tree.\n program: null,\n // When `locations` is on, you can pass this to record the source\n // file in every node's `loc` object.\n sourceFile: null,\n // This value, if given, is stored in every node, whether\n // `locations` is on or off.\n directSourceFile: null,\n // When enabled, parenthesized expressions are represented by\n // (non-standard) ParenthesizedExpression nodes\n preserveParens: false\n}\n\n// Interpret and default an options object\n\nexport function getOptions(opts) {\n let options = {}\n\n for (let opt in defaultOptions)\n options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]\n\n if (options.ecmaVersion >= 2015)\n options.ecmaVersion -= 2009\n\n if (options.allowReserved == null)\n options.allowReserved = options.ecmaVersion < 5\n\n if (isArray(options.onToken)) {\n let tokens = options.onToken\n options.onToken = (token) => tokens.push(token)\n }\n if (isArray(options.onComment))\n options.onComment = pushComment(options, options.onComment)\n\n return options\n}\n\nfunction pushComment(options, array) {\n return function(block, text, start, end, startLoc, endLoc) {\n let comment = {\n type: block ? \"Block\" : \"Line\",\n value: text,\n start: start,\n end: end\n }\n if (options.locations)\n comment.loc = new SourceLocation(this, startLoc, endLoc)\n if (options.ranges)\n comment.range = [start, end]\n array.push(comment)\n }\n}\n","// Each scope gets a bitset that may contain these flags\nexport const\n SCOPE_TOP = 1,\n SCOPE_FUNCTION = 2,\n SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,\n SCOPE_ASYNC = 4,\n SCOPE_GENERATOR = 8,\n SCOPE_ARROW = 16,\n SCOPE_SIMPLE_CATCH = 32,\n SCOPE_SUPER = 64,\n SCOPE_DIRECT_SUPER = 128\n\nexport function functionFlags(async, generator) {\n return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)\n}\n\n// Used in checkLVal and declareName to determine the type of a binding\nexport const\n BIND_NONE = 0, // Not a binding\n BIND_VAR = 1, // Var-style binding\n BIND_LEXICAL = 2, // Let- or const-style binding\n BIND_FUNCTION = 3, // Function declaration\n BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding\n BIND_OUTSIDE = 5 // Special case for function names as bound inside the function\n","import {reservedWords, keywords} from \"./identifier\"\nimport {types as tt} from \"./tokentype\"\nimport {lineBreak} from \"./whitespace\"\nimport {getOptions} from \"./options\"\nimport {SCOPE_TOP, SCOPE_FUNCTION, SCOPE_ASYNC, SCOPE_GENERATOR, SCOPE_SUPER, SCOPE_DIRECT_SUPER} from \"./scopeflags\"\n\nfunction keywordRegexp(words) {\n return new RegExp(\"^(?:\" + words.replace(/ /g, \"|\") + \")$\")\n}\n\nexport class Parser {\n constructor(options, input, startPos) {\n this.options = options = getOptions(options)\n this.sourceFile = options.sourceFile\n this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])\n let reserved = \"\"\n if (!options.allowReserved) {\n for (let v = options.ecmaVersion;; v--)\n if (reserved = reservedWords[v]) break\n if (options.sourceType === \"module\") reserved += \" await\"\n }\n this.reservedWords = keywordRegexp(reserved)\n let reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict\n this.reservedWordsStrict = keywordRegexp(reservedStrict)\n this.reservedWordsStrictBind = keywordRegexp(reservedStrict + \" \" + reservedWords.strictBind)\n this.input = String(input)\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n this.containsEsc = false\n\n // Set up token state\n\n // The current position of the tokenizer in the input.\n if (startPos) {\n this.pos = startPos\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1\n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length\n } else {\n this.pos = this.lineStart = 0\n this.curLine = 1\n }\n\n // Properties of the current token:\n // Its type\n this.type = tt.eof\n // For tokens that include more information than their type, the value\n this.value = null\n // Its start and end offset\n this.start = this.end = this.pos\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n this.startLoc = this.endLoc = this.curPosition()\n\n // Position information for the previous token\n this.lastTokEndLoc = this.lastTokStartLoc = null\n this.lastTokStart = this.lastTokEnd = this.pos\n\n // The context stack is used to superficially track syntactic\n // context to predict whether a regular expression is allowed in a\n // given position.\n this.context = this.initialContext()\n this.exprAllowed = true\n\n // Figure out if it's a module code.\n this.inModule = options.sourceType === \"module\"\n this.strict = this.inModule || this.strictDirective(this.pos)\n\n // Used to signify the start of a potential arrow function\n this.potentialArrowAt = -1\n\n // Positions to delayed-check that yield/await does not exist in default parameters.\n this.yieldPos = this.awaitPos = 0\n // Labels in scope.\n this.labels = []\n\n // If enabled, skip leading hashbang line.\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === \"#!\")\n this.skipLineComment(2)\n\n // Scope tracking for duplicate variable names (see scope.js)\n this.scopeStack = []\n this.enterScope(SCOPE_TOP)\n\n // For RegExp validation\n this.regexpState = null\n }\n\n parse() {\n let node = this.options.program || this.startNode()\n this.nextToken()\n return this.parseTopLevel(node)\n }\n\n get inFunction() { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 }\n get inGenerator() { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 }\n get inAsync() { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 }\n get allowSuper() { return (this.currentThisScope().flags & SCOPE_SUPER) > 0 }\n get allowDirectSuper() { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 }\n get treatFunctionsAsVar() { return this.treatFunctionsAsVarInScope(this.currentScope()) }\n\n // Switch to a getter for 7.0.0.\n inNonArrowFunction() { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0 }\n\n static extend(...plugins) {\n let cls = this\n for (let i = 0; i < plugins.length; i++) cls = plugins[i](cls)\n return cls\n }\n\n static parse(input, options) {\n return new this(options, input).parse()\n }\n\n static parseExpressionAt(input, pos, options) {\n let parser = new this(options, input, pos)\n parser.nextToken()\n return parser.parseExpression()\n }\n\n static tokenizer(input, options) {\n return new this(options, input)\n }\n}\n","import {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {lineBreak, skipWhiteSpace} from \"./whitespace\"\n\nconst pp = Parser.prototype\n\n// ## Parser utilities\n\nconst literal = /^(?:'((?:\\\\.|[^'])*?)'|\"((?:\\\\.|[^\"])*?)\")/\npp.strictDirective = function(start) {\n for (;;) {\n // Try to find string literal.\n skipWhiteSpace.lastIndex = start\n start += skipWhiteSpace.exec(this.input)[0].length\n let match = literal.exec(this.input.slice(start))\n if (!match) return false\n if ((match[1] || match[2]) === \"use strict\") return true\n start += match[0].length\n\n // Skip semicolon, if any.\n skipWhiteSpace.lastIndex = start\n start += skipWhiteSpace.exec(this.input)[0].length\n if (this.input[start] === ';')\n start++\n }\n}\n\n// Predicate that tests whether the next token is of the given\n// type, and if yes, consumes it as a side effect.\n\npp.eat = function(type) {\n if (this.type === type) {\n this.next()\n return true\n } else {\n return false\n }\n}\n\n// Tests whether parsed token is a contextual keyword.\n\npp.isContextual = function(name) {\n return this.type === tt.name && this.value === name && !this.containsEsc\n}\n\n// Consumes contextual keyword if possible.\n\npp.eatContextual = function(name) {\n if (!this.isContextual(name)) return false\n this.next()\n return true\n}\n\n// Asserts that following token is given contextual keyword.\n\npp.expectContextual = function(name) {\n if (!this.eatContextual(name)) this.unexpected()\n}\n\n// Test whether a semicolon can be inserted at the current position.\n\npp.canInsertSemicolon = function() {\n return this.type === tt.eof ||\n this.type === tt.braceR ||\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n}\n\npp.insertSemicolon = function() {\n if (this.canInsertSemicolon()) {\n if (this.options.onInsertedSemicolon)\n this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)\n return true\n }\n}\n\n// Consume a semicolon, or, failing that, see if we are allowed to\n// pretend that there is a semicolon at this position.\n\npp.semicolon = function() {\n if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()\n}\n\npp.afterTrailingComma = function(tokType, notNext) {\n if (this.type === tokType) {\n if (this.options.onTrailingComma)\n this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)\n if (!notNext)\n this.next()\n return true\n }\n}\n\n// Expect a token of a given type. If found, consume it, otherwise,\n// raise an unexpected token error.\n\npp.expect = function(type) {\n this.eat(type) || this.unexpected()\n}\n\n// Raise an unexpected token error.\n\npp.unexpected = function(pos) {\n this.raise(pos != null ? pos : this.start, \"Unexpected token\")\n}\n\nexport function DestructuringErrors() {\n this.shorthandAssign =\n this.trailingComma =\n this.parenthesizedAssign =\n this.parenthesizedBind =\n this.doubleProto =\n -1\n}\n\npp.checkPatternErrors = function(refDestructuringErrors, isAssign) {\n if (!refDestructuringErrors) return\n if (refDestructuringErrors.trailingComma > -1)\n this.raiseRecoverable(refDestructuringErrors.trailingComma, \"Comma is not permitted after the rest element\")\n let parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind\n if (parens > -1) this.raiseRecoverable(parens, \"Parenthesized pattern\")\n}\n\npp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\n if (!refDestructuringErrors) return false\n let {shorthandAssign, doubleProto} = refDestructuringErrors\n if (!andThrow) return shorthandAssign >= 0 || doubleProto >= 0\n if (shorthandAssign >= 0)\n this.raise(shorthandAssign, \"Shorthand property assignments are valid only in destructuring patterns\")\n if (doubleProto >= 0)\n this.raiseRecoverable(doubleProto, \"Redefinition of __proto__ property\")\n}\n\npp.checkYieldAwaitInDefaultParams = function() {\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\n this.raise(this.yieldPos, \"Yield expression cannot be a default value\")\n if (this.awaitPos)\n this.raise(this.awaitPos, \"Await expression cannot be a default value\")\n}\n\npp.isSimpleAssignTarget = function(expr) {\n if (expr.type === \"ParenthesizedExpression\")\n return this.isSimpleAssignTarget(expr.expression)\n return expr.type === \"Identifier\" || expr.type === \"MemberExpression\"\n}\n","import {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {lineBreak, skipWhiteSpace} from \"./whitespace\"\nimport {isIdentifierStart, isIdentifierChar, keywordRelationalOperator} from \"./identifier\"\nimport {has} from \"./util\"\nimport {DestructuringErrors} from \"./parseutil\"\nimport {functionFlags, SCOPE_SIMPLE_CATCH, BIND_SIMPLE_CATCH, BIND_LEXICAL, BIND_VAR, BIND_FUNCTION} from \"./scopeflags\"\n\nconst pp = Parser.prototype\n\n// ### Statement parsing\n\n// Parse a program. Initializes the parser, reads any number of\n// statements, and wraps them in a Program node. Optionally takes a\n// `program` argument. If present, the statements will be appended\n// to its body instead of creating a new node.\n\npp.parseTopLevel = function(node) {\n let exports = {}\n if (!node.body) node.body = []\n while (this.type !== tt.eof) {\n let stmt = this.parseStatement(null, true, exports)\n node.body.push(stmt)\n }\n this.adaptDirectivePrologue(node.body)\n this.next()\n if (this.options.ecmaVersion >= 6) {\n node.sourceType = this.options.sourceType\n }\n return this.finishNode(node, \"Program\")\n}\n\nconst loopLabel = {kind: \"loop\"}, switchLabel = {kind: \"switch\"}\n\npp.isLet = function(context) {\n if (this.options.ecmaVersion < 6 || !this.isContextual(\"let\")) return false\n skipWhiteSpace.lastIndex = this.pos\n let skip = skipWhiteSpace.exec(this.input)\n let next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next)\n // For ambiguous cases, determine if a LexicalDeclaration (or only a\n // Statement) is allowed here. If context is not empty then only a Statement\n // is allowed. However, `let [` is an explicit negative lookahead for\n // ExpressionStatement, so special-case it first.\n if (nextCh === 91) return true // '['\n if (context) return false\n\n if (nextCh === 123) return true // '{'\n if (isIdentifierStart(nextCh, true)) {\n let pos = next + 1\n while (isIdentifierChar(this.input.charCodeAt(pos), true)) ++pos\n let ident = this.input.slice(next, pos)\n if (!keywordRelationalOperator.test(ident)) return true\n }\n return false\n}\n\n// check 'async [no LineTerminator here] function'\n// - 'async /*foo*/ function' is OK.\n// - 'async /*\\n*/ function' is invalid.\npp.isAsyncFunction = function() {\n if (this.options.ecmaVersion < 8 || !this.isContextual(\"async\"))\n return false\n\n skipWhiteSpace.lastIndex = this.pos\n let skip = skipWhiteSpace.exec(this.input)\n let next = this.pos + skip[0].length\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\n this.input.slice(next, next + 8) === \"function\" &&\n (next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))\n}\n\n// Parse a single statement.\n//\n// If expecting a statement and finding a slash operator, parse a\n// regular expression literal. This is to handle cases like\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\n// does not help.\n\npp.parseStatement = function(context, topLevel, exports) {\n let starttype = this.type, node = this.startNode(), kind\n\n if (this.isLet(context)) {\n starttype = tt._var\n kind = \"let\"\n }\n\n // Most types of statements are recognized by the keyword they\n // start with. Many are trivial to parse, some require a bit of\n // complexity.\n\n switch (starttype) {\n case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\n case tt._debugger: return this.parseDebuggerStatement(node)\n case tt._do: return this.parseDoStatement(node)\n case tt._for: return this.parseForStatement(node)\n case tt._function:\n // Function as sole body of either an if statement or a labeled statement\n // works, but not when it is part of a labeled statement that is the sole\n // body of an if statement.\n if ((context && (this.strict || context !== \"if\" && context !== \"label\")) && this.options.ecmaVersion >= 6) this.unexpected()\n return this.parseFunctionStatement(node, false, !context)\n case tt._class:\n if (context) this.unexpected()\n return this.parseClass(node, true)\n case tt._if: return this.parseIfStatement(node)\n case tt._return: return this.parseReturnStatement(node)\n case tt._switch: return this.parseSwitchStatement(node)\n case tt._throw: return this.parseThrowStatement(node)\n case tt._try: return this.parseTryStatement(node)\n case tt._const: case tt._var:\n kind = kind || this.value\n if (context && kind !== \"var\") this.unexpected()\n return this.parseVarStatement(node, kind)\n case tt._while: return this.parseWhileStatement(node)\n case tt._with: return this.parseWithStatement(node)\n case tt.braceL: return this.parseBlock(true, node)\n case tt.semi: return this.parseEmptyStatement(node)\n case tt._export:\n case tt._import:\n if (!this.options.allowImportExportEverywhere) {\n if (!topLevel)\n this.raise(this.start, \"'import' and 'export' may only appear at the top level\")\n if (!this.inModule)\n this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\")\n }\n return starttype === tt._import ? this.parseImport(node) : this.parseExport(node, exports)\n\n // If the statement does not start with a statement keyword or a\n // brace, it's an ExpressionStatement or LabeledStatement. We\n // simply start parsing an expression, and afterwards, if the\n // next token is a colon and the expression was a simple\n // Identifier node, we switch to interpreting it as a label.\n default:\n if (this.isAsyncFunction()) {\n if (context) this.unexpected()\n this.next()\n return this.parseFunctionStatement(node, true, !context)\n }\n\n let maybeName = this.value, expr = this.parseExpression()\n if (starttype === tt.name && expr.type === \"Identifier\" && this.eat(tt.colon))\n return this.parseLabeledStatement(node, maybeName, expr, context)\n else return this.parseExpressionStatement(node, expr)\n }\n}\n\npp.parseBreakContinueStatement = function(node, keyword) {\n let isBreak = keyword === \"break\"\n this.next()\n if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null\n else if (this.type !== tt.name) this.unexpected()\n else {\n node.label = this.parseIdent()\n this.semicolon()\n }\n\n // Verify that there is an actual destination to break or\n // continue to.\n let i = 0\n for (; i < this.labels.length; ++i) {\n let lab = this.labels[i]\n if (node.label == null || lab.name === node.label.name) {\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) break\n if (node.label && isBreak) break\n }\n }\n if (i === this.labels.length) this.raise(node.start, \"Unsyntactic \" + keyword)\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\n}\n\npp.parseDebuggerStatement = function(node) {\n this.next()\n this.semicolon()\n return this.finishNode(node, \"DebuggerStatement\")\n}\n\npp.parseDoStatement = function(node) {\n this.next()\n this.labels.push(loopLabel)\n node.body = this.parseStatement(\"do\")\n this.labels.pop()\n this.expect(tt._while)\n node.test = this.parseParenExpression()\n if (this.options.ecmaVersion >= 6)\n this.eat(tt.semi)\n else\n this.semicolon()\n return this.finishNode(node, \"DoWhileStatement\")\n}\n\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\n// loop is non-trivial. Basically, we have to parse the init `var`\n// statement or expression, disallowing the `in` operator (see\n// the second parameter to `parseExpression`), and then check\n// whether the next token is `in` or `of`. When there is no init\n// part (semicolon immediately after the opening parenthesis), it\n// is a regular `for` loop.\n\npp.parseForStatement = function(node) {\n this.next()\n let awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual(\"await\")) ? this.lastTokStart : -1\n this.labels.push(loopLabel)\n this.enterScope(0)\n this.expect(tt.parenL)\n if (this.type === tt.semi) {\n if (awaitAt > -1) this.unexpected(awaitAt)\n return this.parseFor(node, null)\n }\n let isLet = this.isLet()\n if (this.type === tt._var || this.type === tt._const || isLet) {\n let init = this.startNode(), kind = isLet ? \"let\" : this.value\n this.next()\n this.parseVar(init, true, kind)\n this.finishNode(init, \"VariableDeclaration\")\n if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init.declarations.length === 1 &&\n !(kind !== \"var\" && init.declarations[0].init)) {\n if (this.options.ecmaVersion >= 9) {\n if (this.type === tt._in) {\n if (awaitAt > -1) this.unexpected(awaitAt)\n } else node.await = awaitAt > -1\n }\n return this.parseForIn(node, init)\n }\n if (awaitAt > -1) this.unexpected(awaitAt)\n return this.parseFor(node, init)\n }\n let refDestructuringErrors = new DestructuringErrors\n let init = this.parseExpression(true, refDestructuringErrors)\n if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\n if (this.options.ecmaVersion >= 9) {\n if (this.type === tt._in) {\n if (awaitAt > -1) this.unexpected(awaitAt)\n } else node.await = awaitAt > -1\n }\n this.toAssignable(init, false, refDestructuringErrors)\n this.checkLVal(init)\n return this.parseForIn(node, init)\n } else {\n this.checkExpressionErrors(refDestructuringErrors, true)\n }\n if (awaitAt > -1) this.unexpected(awaitAt)\n return this.parseFor(node, init)\n}\n\npp.parseFunctionStatement = function(node, isAsync, declarationPosition) {\n this.next()\n return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)\n}\n\npp.parseIfStatement = function(node) {\n this.next()\n node.test = this.parseParenExpression()\n // allow function declarations in branches, but only in non-strict mode\n node.consequent = this.parseStatement(\"if\")\n node.alternate = this.eat(tt._else) ? this.parseStatement(\"if\") : null\n return this.finishNode(node, \"IfStatement\")\n}\n\npp.parseReturnStatement = function(node) {\n if (!this.inFunction && !this.options.allowReturnOutsideFunction)\n this.raise(this.start, \"'return' outside of function\")\n this.next()\n\n // In `return` (and `break`/`continue`), the keywords with\n // optional arguments, we eagerly look for a semicolon or the\n // possibility to insert one.\n\n if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null\n else { node.argument = this.parseExpression(); this.semicolon() }\n return this.finishNode(node, \"ReturnStatement\")\n}\n\npp.parseSwitchStatement = function(node) {\n this.next()\n node.discriminant = this.parseParenExpression()\n node.cases = []\n this.expect(tt.braceL)\n this.labels.push(switchLabel)\n this.enterScope(0)\n\n // Statements under must be grouped (by label) in SwitchCase\n // nodes. `cur` is used to keep the node that we are currently\n // adding statements to.\n\n let cur\n for (let sawDefault = false; this.type !== tt.braceR;) {\n if (this.type === tt._case || this.type === tt._default) {\n let isCase = this.type === tt._case\n if (cur) this.finishNode(cur, \"SwitchCase\")\n node.cases.push(cur = this.startNode())\n cur.consequent = []\n this.next()\n if (isCase) {\n cur.test = this.parseExpression()\n } else {\n if (sawDefault) this.raiseRecoverable(this.lastTokStart, \"Multiple default clauses\")\n sawDefault = true\n cur.test = null\n }\n this.expect(tt.colon)\n } else {\n if (!cur) this.unexpected()\n cur.consequent.push(this.parseStatement(null))\n }\n }\n this.exitScope()\n if (cur) this.finishNode(cur, \"SwitchCase\")\n this.next() // Closing brace\n this.labels.pop()\n return this.finishNode(node, \"SwitchStatement\")\n}\n\npp.parseThrowStatement = function(node) {\n this.next()\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\n this.raise(this.lastTokEnd, \"Illegal newline after throw\")\n node.argument = this.parseExpression()\n this.semicolon()\n return this.finishNode(node, \"ThrowStatement\")\n}\n\n// Reused empty array added for node fields that are always empty.\n\nconst empty = []\n\npp.parseTryStatement = function(node) {\n this.next()\n node.block = this.parseBlock()\n node.handler = null\n if (this.type === tt._catch) {\n let clause = this.startNode()\n this.next()\n if (this.eat(tt.parenL)) {\n clause.param = this.parseBindingAtom()\n let simple = clause.param.type === \"Identifier\"\n this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0)\n this.checkLVal(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL)\n this.expect(tt.parenR)\n } else {\n if (this.options.ecmaVersion < 10) this.unexpected()\n clause.param = null\n this.enterScope(0)\n }\n clause.body = this.parseBlock(false)\n this.exitScope()\n node.handler = this.finishNode(clause, \"CatchClause\")\n }\n node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null\n if (!node.handler && !node.finalizer)\n this.raise(node.start, \"Missing catch or finally clause\")\n return this.finishNode(node, \"TryStatement\")\n}\n\npp.parseVarStatement = function(node, kind) {\n this.next()\n this.parseVar(node, false, kind)\n this.semicolon()\n return this.finishNode(node, \"VariableDeclaration\")\n}\n\npp.parseWhileStatement = function(node) {\n this.next()\n node.test = this.parseParenExpression()\n this.labels.push(loopLabel)\n node.body = this.parseStatement(\"while\")\n this.labels.pop()\n return this.finishNode(node, \"WhileStatement\")\n}\n\npp.parseWithStatement = function(node) {\n if (this.strict) this.raise(this.start, \"'with' in strict mode\")\n this.next()\n node.object = this.parseParenExpression()\n node.body = this.parseStatement(\"with\")\n return this.finishNode(node, \"WithStatement\")\n}\n\npp.parseEmptyStatement = function(node) {\n this.next()\n return this.finishNode(node, \"EmptyStatement\")\n}\n\npp.parseLabeledStatement = function(node, maybeName, expr, context) {\n for (let label of this.labels)\n if (label.name === maybeName)\n this.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\")\n let kind = this.type.isLoop ? \"loop\" : this.type === tt._switch ? \"switch\" : null\n for (let i = this.labels.length - 1; i >= 0; i--) {\n let label = this.labels[i]\n if (label.statementStart === node.start) {\n // Update information about previous labels on this node\n label.statementStart = this.start\n label.kind = kind\n } else break\n }\n this.labels.push({name: maybeName, kind, statementStart: this.start})\n node.body = this.parseStatement(context ? context.indexOf(\"label\") === -1 ? context + \"label\" : context : \"label\")\n this.labels.pop()\n node.label = expr\n return this.finishNode(node, \"LabeledStatement\")\n}\n\npp.parseExpressionStatement = function(node, expr) {\n node.expression = expr\n this.semicolon()\n return this.finishNode(node, \"ExpressionStatement\")\n}\n\n// Parse a semicolon-enclosed block of statements, handling `\"use\n// strict\"` declarations when `allowStrict` is true (used for\n// function bodies).\n\npp.parseBlock = function(createNewLexicalScope = true, node = this.startNode()) {\n node.body = []\n this.expect(tt.braceL)\n if (createNewLexicalScope) this.enterScope(0)\n while (!this.eat(tt.braceR)) {\n let stmt = this.parseStatement(null)\n node.body.push(stmt)\n }\n if (createNewLexicalScope) this.exitScope()\n return this.finishNode(node, \"BlockStatement\")\n}\n\n// Parse a regular `for` loop. The disambiguation code in\n// `parseStatement` will already have parsed the init statement or\n// expression.\n\npp.parseFor = function(node, init) {\n node.init = init\n this.expect(tt.semi)\n node.test = this.type === tt.semi ? null : this.parseExpression()\n this.expect(tt.semi)\n node.update = this.type === tt.parenR ? null : this.parseExpression()\n this.expect(tt.parenR)\n node.body = this.parseStatement(\"for\")\n this.exitScope()\n this.labels.pop()\n return this.finishNode(node, \"ForStatement\")\n}\n\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\n// same from parser's perspective.\n\npp.parseForIn = function(node, init) {\n let type = this.type === tt._in ? \"ForInStatement\" : \"ForOfStatement\"\n this.next()\n if (type === \"ForInStatement\") {\n if (init.type === \"AssignmentPattern\" ||\n (init.type === \"VariableDeclaration\" && init.declarations[0].init != null &&\n (this.strict || init.declarations[0].id.type !== \"Identifier\")))\n this.raise(init.start, \"Invalid assignment in for-in loop head\")\n }\n node.left = init\n node.right = type === \"ForInStatement\" ? this.parseExpression() : this.parseMaybeAssign()\n this.expect(tt.parenR)\n node.body = this.parseStatement(\"for\")\n this.exitScope()\n this.labels.pop()\n return this.finishNode(node, type)\n}\n\n// Parse a list of variable declarations.\n\npp.parseVar = function(node, isFor, kind) {\n node.declarations = []\n node.kind = kind\n for (;;) {\n let decl = this.startNode()\n this.parseVarId(decl, kind)\n if (this.eat(tt.eq)) {\n decl.init = this.parseMaybeAssign(isFor)\n } else if (kind === \"const\" && !(this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\")))) {\n this.unexpected()\n } else if (decl.id.type !== \"Identifier\" && !(isFor && (this.type === tt._in || this.isContextual(\"of\")))) {\n this.raise(this.lastTokEnd, \"Complex binding patterns require an initialization value\")\n } else {\n decl.init = null\n }\n node.declarations.push(this.finishNode(decl, \"VariableDeclarator\"))\n if (!this.eat(tt.comma)) break\n }\n return node\n}\n\npp.parseVarId = function(decl, kind) {\n if ((kind === \"const\" || kind === \"let\") && this.isContextual(\"let\")) {\n this.raiseRecoverable(this.start, \"let is disallowed as a lexically bound name\");\n }\n decl.id = this.parseBindingAtom()\n this.checkLVal(decl.id, kind === \"var\" ? BIND_VAR : BIND_LEXICAL, false)\n}\n\nconst FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4\n\n// Parse a function declaration or literal (depending on the\n// `isStatement` parameter).\n\npp.parseFunction = function(node, statement, allowExpressionBody, isAsync) {\n this.initFunction(node)\n if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {\n if (this.type === tt.star && (statement & FUNC_HANGING_STATEMENT))\n this.unexpected()\n node.generator = this.eat(tt.star)\n }\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n if (statement & FUNC_STATEMENT) {\n node.id = (statement & FUNC_NULLABLE_ID) && this.type !== tt.name ? null : this.parseIdent()\n if (node.id && !(statement & FUNC_HANGING_STATEMENT))\n // If it is a regular function declaration in sloppy mode, then it is\n // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding\n // mode depends on properties of the current scope (see\n // treatFunctionsAsVar).\n this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);\n }\n\n let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n this.yieldPos = 0\n this.awaitPos = 0\n this.enterScope(functionFlags(node.async, node.generator))\n\n if (!(statement & FUNC_STATEMENT))\n node.id = this.type === tt.name ? this.parseIdent() : null\n\n this.parseFunctionParams(node)\n this.parseFunctionBody(node, allowExpressionBody)\n\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.finishNode(node, (statement & FUNC_STATEMENT) ? \"FunctionDeclaration\" : \"FunctionExpression\")\n}\n\npp.parseFunctionParams = function(node) {\n this.expect(tt.parenL)\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)\n this.checkYieldAwaitInDefaultParams()\n}\n\n// Parse a class declaration or literal (depending on the\n// `isStatement` parameter).\n\npp.parseClass = function(node, isStatement) {\n this.next()\n\n // ecma-262 14.6 Class Definitions\n // A class definition is always strict mode code.\n const oldStrict = this.strict;\n this.strict = true;\n\n this.parseClassId(node, isStatement)\n this.parseClassSuper(node)\n let classBody = this.startNode()\n let hadConstructor = false\n classBody.body = []\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n const element = this.parseClassElement(node.superClass !== null)\n if (element) {\n classBody.body.push(element)\n if (element.type === \"MethodDefinition\" && element.kind === \"constructor\") {\n if (hadConstructor) this.raise(element.start, \"Duplicate constructor in the same class\")\n hadConstructor = true\n }\n }\n }\n node.body = this.finishNode(classBody, \"ClassBody\")\n this.strict = oldStrict;\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\n}\n\npp.parseClassElement = function(constructorAllowsSuper) {\n if (this.eat(tt.semi)) return null\n\n let method = this.startNode()\n const tryContextual = (k, noLineBreak = false) => {\n const start = this.start, startLoc = this.startLoc\n if (!this.eatContextual(k)) return false\n if (this.type !== tt.parenL && (!noLineBreak || !this.canInsertSemicolon())) return true\n if (method.key) this.unexpected()\n method.computed = false\n method.key = this.startNodeAt(start, startLoc)\n method.key.name = k\n this.finishNode(method.key, \"Identifier\")\n return false\n }\n\n method.kind = \"method\"\n method.static = tryContextual(\"static\")\n let isGenerator = this.eat(tt.star)\n let isAsync = false\n if (!isGenerator) {\n if (this.options.ecmaVersion >= 8 && tryContextual(\"async\", true)) {\n isAsync = true\n isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)\n } else if (tryContextual(\"get\")) {\n method.kind = \"get\"\n } else if (tryContextual(\"set\")) {\n method.kind = \"set\"\n }\n }\n if (!method.key) this.parsePropertyName(method)\n let {key} = method\n let allowsDirectSuper = false\n if (!method.computed && !method.static && (key.type === \"Identifier\" && key.name === \"constructor\" ||\n key.type === \"Literal\" && key.value === \"constructor\")) {\n if (method.kind !== \"method\") this.raise(key.start, \"Constructor can't have get/set modifier\")\n if (isGenerator) this.raise(key.start, \"Constructor can't be a generator\")\n if (isAsync) this.raise(key.start, \"Constructor can't be an async method\")\n method.kind = \"constructor\"\n allowsDirectSuper = constructorAllowsSuper\n } else if (method.static && key.type === \"Identifier\" && key.name === \"prototype\") {\n this.raise(key.start, \"Classes may not have a static property named prototype\")\n }\n this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper)\n if (method.kind === \"get\" && method.value.params.length !== 0)\n this.raiseRecoverable(method.value.start, \"getter should have no params\")\n if (method.kind === \"set\" && method.value.params.length !== 1)\n this.raiseRecoverable(method.value.start, \"setter should have exactly one param\")\n if (method.kind === \"set\" && method.value.params[0].type === \"RestElement\")\n this.raiseRecoverable(method.value.params[0].start, \"Setter cannot use rest params\")\n return method\n}\n\npp.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {\n method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper)\n return this.finishNode(method, \"MethodDefinition\")\n}\n\npp.parseClassId = function(node, isStatement) {\n if (this.type === tt.name) {\n node.id = this.parseIdent();\n if (isStatement === true)\n this.checkLVal(node.id, BIND_LEXICAL, false)\n } else {\n if (isStatement === true)\n this.unexpected();\n node.id = null;\n }\n}\n\npp.parseClassSuper = function(node) {\n node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null\n}\n\n// Parses module export declaration.\n\npp.parseExport = function(node, exports) {\n this.next()\n // export * from '...'\n if (this.eat(tt.star)) {\n this.expectContextual(\"from\")\n if (this.type !== tt.string) this.unexpected()\n node.source = this.parseExprAtom()\n this.semicolon()\n return this.finishNode(node, \"ExportAllDeclaration\")\n }\n if (this.eat(tt._default)) { // export default ...\n this.checkExport(exports, \"default\", this.lastTokStart)\n let isAsync\n if (this.type === tt._function || (isAsync = this.isAsyncFunction())) {\n let fNode = this.startNode()\n this.next()\n if (isAsync) this.next()\n node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync, true)\n } else if (this.type === tt._class) {\n let cNode = this.startNode()\n node.declaration = this.parseClass(cNode, \"nullableID\")\n } else {\n node.declaration = this.parseMaybeAssign()\n this.semicolon()\n }\n return this.finishNode(node, \"ExportDefaultDeclaration\")\n }\n // export var|const|let|function|class ...\n if (this.shouldParseExportStatement()) {\n node.declaration = this.parseStatement(null)\n if (node.declaration.type === \"VariableDeclaration\")\n this.checkVariableExport(exports, node.declaration.declarations)\n else\n this.checkExport(exports, node.declaration.id.name, node.declaration.id.start)\n node.specifiers = []\n node.source = null\n } else { // export { x, y as z } [from '...']\n node.declaration = null\n node.specifiers = this.parseExportSpecifiers(exports)\n if (this.eatContextual(\"from\")) {\n if (this.type !== tt.string) this.unexpected()\n node.source = this.parseExprAtom()\n } else {\n // check for keywords used as local names\n for (let spec of node.specifiers) {\n this.checkUnreserved(spec.local)\n }\n\n node.source = null\n }\n this.semicolon()\n }\n return this.finishNode(node, \"ExportNamedDeclaration\")\n}\n\npp.checkExport = function(exports, name, pos) {\n if (!exports) return\n if (has(exports, name))\n this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\")\n exports[name] = true\n}\n\npp.checkPatternExport = function(exports, pat) {\n let type = pat.type\n if (type === \"Identifier\")\n this.checkExport(exports, pat.name, pat.start)\n else if (type === \"ObjectPattern\")\n for (let prop of pat.properties)\n this.checkPatternExport(exports, prop)\n else if (type === \"ArrayPattern\")\n for (let elt of pat.elements) {\n if (elt) this.checkPatternExport(exports, elt)\n }\n else if (type === \"Property\")\n this.checkPatternExport(exports, pat.value)\n else if (type === \"AssignmentPattern\")\n this.checkPatternExport(exports, pat.left)\n else if (type === \"RestElement\")\n this.checkPatternExport(exports, pat.argument)\n else if (type === \"ParenthesizedExpression\")\n this.checkPatternExport(exports, pat.expression)\n}\n\npp.checkVariableExport = function(exports, decls) {\n if (!exports) return\n for (let decl of decls)\n this.checkPatternExport(exports, decl.id)\n}\n\npp.shouldParseExportStatement = function() {\n return this.type.keyword === \"var\" ||\n this.type.keyword === \"const\" ||\n this.type.keyword === \"class\" ||\n this.type.keyword === \"function\" ||\n this.isLet() ||\n this.isAsyncFunction()\n}\n\n// Parses a comma-separated list of module exports.\n\npp.parseExportSpecifiers = function(exports) {\n let nodes = [], first = true\n // export { x, y as z } [from '...']\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this.expect(tt.comma)\n if (this.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n let node = this.startNode()\n node.local = this.parseIdent(true)\n node.exported = this.eatContextual(\"as\") ? this.parseIdent(true) : node.local\n this.checkExport(exports, node.exported.name, node.exported.start)\n nodes.push(this.finishNode(node, \"ExportSpecifier\"))\n }\n return nodes\n}\n\n// Parses import declaration.\n\npp.parseImport = function(node) {\n this.next()\n // import '...'\n if (this.type === tt.string) {\n node.specifiers = empty\n node.source = this.parseExprAtom()\n } else {\n node.specifiers = this.parseImportSpecifiers()\n this.expectContextual(\"from\")\n node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()\n }\n this.semicolon()\n return this.finishNode(node, \"ImportDeclaration\")\n}\n\n// Parses a comma-separated list of module imports.\n\npp.parseImportSpecifiers = function() {\n let nodes = [], first = true\n if (this.type === tt.name) {\n // import defaultObj, { x, y as z } from '...'\n let node = this.startNode()\n node.local = this.parseIdent()\n this.checkLVal(node.local, BIND_LEXICAL)\n nodes.push(this.finishNode(node, \"ImportDefaultSpecifier\"))\n if (!this.eat(tt.comma)) return nodes\n }\n if (this.type === tt.star) {\n let node = this.startNode()\n this.next()\n this.expectContextual(\"as\")\n node.local = this.parseIdent()\n this.checkLVal(node.local, BIND_LEXICAL)\n nodes.push(this.finishNode(node, \"ImportNamespaceSpecifier\"))\n return nodes\n }\n this.expect(tt.braceL)\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this.expect(tt.comma)\n if (this.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n let node = this.startNode()\n node.imported = this.parseIdent(true)\n if (this.eatContextual(\"as\")) {\n node.local = this.parseIdent()\n } else {\n this.checkUnreserved(node.imported)\n node.local = node.imported\n }\n this.checkLVal(node.local, BIND_LEXICAL)\n nodes.push(this.finishNode(node, \"ImportSpecifier\"))\n }\n return nodes\n}\n\n// Set `ExpressionStatement#directive` property for directive prologues.\npp.adaptDirectivePrologue = function(statements) {\n for (let i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {\n statements[i].directive = statements[i].expression.raw.slice(1, -1)\n }\n}\npp.isDirectiveCandidate = function(statement) {\n return (\n statement.type === \"ExpressionStatement\" &&\n statement.expression.type === \"Literal\" &&\n typeof statement.expression.value === \"string\" &&\n // Reject parenthesized strings.\n (this.input[statement.start] === \"\\\"\" || this.input[statement.start] === \"'\")\n )\n}\n","import {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {has} from \"./util\"\nimport {BIND_NONE, BIND_OUTSIDE} from \"./scopeflags\"\n\nconst pp = Parser.prototype\n\n// Convert existing expression atom to assignable pattern\n// if possible.\n\npp.toAssignable = function(node, isBinding, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 6 && node) {\n switch (node.type) {\n case \"Identifier\":\n if (this.inAsync && node.name === \"await\")\n this.raise(node.start, \"Can not use 'await' as identifier inside an async function\")\n break\n\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n case \"RestElement\":\n break\n\n case \"ObjectExpression\":\n node.type = \"ObjectPattern\"\n if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true)\n for (let prop of node.properties) {\n this.toAssignable(prop, isBinding)\n // Early error:\n // AssignmentRestProperty[Yield, Await] :\n // `...` DestructuringAssignmentTarget[Yield, Await]\n //\n // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.\n if (\n prop.type === \"RestElement\" &&\n (prop.argument.type === \"ArrayPattern\" || prop.argument.type === \"ObjectPattern\")\n ) {\n this.raise(prop.argument.start, \"Unexpected token\")\n }\n }\n break\n\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n if (node.kind !== \"init\") this.raise(node.key.start, \"Object pattern can't contain getter or setter\")\n this.toAssignable(node.value, isBinding)\n break\n\n case \"ArrayExpression\":\n node.type = \"ArrayPattern\"\n if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true)\n this.toAssignableList(node.elements, isBinding)\n break\n\n case \"SpreadElement\":\n node.type = \"RestElement\"\n this.toAssignable(node.argument, isBinding)\n if (node.argument.type === \"AssignmentPattern\")\n this.raise(node.argument.start, \"Rest elements cannot have a default value\")\n break\n\n case \"AssignmentExpression\":\n if (node.operator !== \"=\") this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\")\n node.type = \"AssignmentPattern\"\n delete node.operator\n this.toAssignable(node.left, isBinding)\n // falls through to AssignmentPattern\n\n case \"AssignmentPattern\":\n break\n\n case \"ParenthesizedExpression\":\n this.toAssignable(node.expression, isBinding, refDestructuringErrors)\n break\n\n case \"MemberExpression\":\n if (!isBinding) break\n\n default:\n this.raise(node.start, \"Assigning to rvalue\")\n }\n } else if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true)\n return node\n}\n\n// Convert list of expression atoms to binding list.\n\npp.toAssignableList = function(exprList, isBinding) {\n let end = exprList.length\n for (let i = 0; i < end; i++) {\n let elt = exprList[i]\n if (elt) this.toAssignable(elt, isBinding)\n }\n if (end) {\n let last = exprList[end - 1]\n if (this.options.ecmaVersion === 6 && isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\n this.unexpected(last.argument.start)\n }\n return exprList\n}\n\n// Parses spread element.\n\npp.parseSpread = function(refDestructuringErrors) {\n let node = this.startNode()\n this.next()\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors)\n return this.finishNode(node, \"SpreadElement\")\n}\n\npp.parseRestBinding = function() {\n let node = this.startNode()\n this.next()\n\n // RestElement inside of a function parameter must be an identifier\n if (this.options.ecmaVersion === 6 && this.type !== tt.name)\n this.unexpected()\n\n node.argument = this.parseBindingAtom()\n\n return this.finishNode(node, \"RestElement\")\n}\n\n// Parses lvalue (assignable) atom.\n\npp.parseBindingAtom = function() {\n if (this.options.ecmaVersion >= 6) {\n switch (this.type) {\n case tt.bracketL:\n let node = this.startNode()\n this.next()\n node.elements = this.parseBindingList(tt.bracketR, true, true)\n return this.finishNode(node, \"ArrayPattern\")\n\n case tt.braceL:\n return this.parseObj(true)\n }\n }\n return this.parseIdent()\n}\n\npp.parseBindingList = function(close, allowEmpty, allowTrailingComma) {\n let elts = [], first = true\n while (!this.eat(close)) {\n if (first) first = false\n else this.expect(tt.comma)\n if (allowEmpty && this.type === tt.comma) {\n elts.push(null)\n } else if (allowTrailingComma && this.afterTrailingComma(close)) {\n break\n } else if (this.type === tt.ellipsis) {\n let rest = this.parseRestBinding()\n this.parseBindingListItem(rest)\n elts.push(rest)\n if (this.type === tt.comma) this.raise(this.start, \"Comma is not permitted after the rest element\")\n this.expect(close)\n break\n } else {\n let elem = this.parseMaybeDefault(this.start, this.startLoc)\n this.parseBindingListItem(elem)\n elts.push(elem)\n }\n }\n return elts\n}\n\npp.parseBindingListItem = function(param) {\n return param\n}\n\n// Parses assignment pattern around given atom if possible.\n\npp.parseMaybeDefault = function(startPos, startLoc, left) {\n left = left || this.parseBindingAtom()\n if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left\n let node = this.startNodeAt(startPos, startLoc)\n node.left = left\n node.right = this.parseMaybeAssign()\n return this.finishNode(node, \"AssignmentPattern\")\n}\n\n// Verify that a node is an lval — something that can be assigned\n// to.\n// bindingType can be either:\n// 'var' indicating that the lval creates a 'var' binding\n// 'let' indicating that the lval creates a lexical ('let' or 'const') binding\n// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references\n\npp.checkLVal = function(expr, bindingType = BIND_NONE, checkClashes) {\n switch (expr.type) {\n case \"Identifier\":\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\n this.raiseRecoverable(expr.start, (bindingType ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\")\n if (checkClashes) {\n if (has(checkClashes, expr.name))\n this.raiseRecoverable(expr.start, \"Argument name clash\")\n checkClashes[expr.name] = true\n }\n if (bindingType !== BIND_NONE && bindingType !== BIND_OUTSIDE) this.declareName(expr.name, bindingType, expr.start)\n break\n\n case \"MemberExpression\":\n if (bindingType) this.raiseRecoverable(expr.start, \"Binding member expression\")\n break\n\n case \"ObjectPattern\":\n for (let prop of expr.properties)\n this.checkLVal(prop, bindingType, checkClashes)\n break\n\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n this.checkLVal(expr.value, bindingType, checkClashes)\n break\n\n case \"ArrayPattern\":\n for (let elem of expr.elements) {\n if (elem) this.checkLVal(elem, bindingType, checkClashes)\n }\n break\n\n case \"AssignmentPattern\":\n this.checkLVal(expr.left, bindingType, checkClashes)\n break\n\n case \"RestElement\":\n this.checkLVal(expr.argument, bindingType, checkClashes)\n break\n\n case \"ParenthesizedExpression\":\n this.checkLVal(expr.expression, bindingType, checkClashes)\n break\n\n default:\n this.raise(expr.start, (bindingType ? \"Binding\" : \"Assigning to\") + \" rvalue\")\n }\n}\n","// A recursive descent parser operates by defining functions for all\n// syntactic elements, and recursively calling those, each function\n// advancing the input stream and returning an AST node. Precedence\n// of constructs (for example, the fact that `!x[1]` means `!(x[1])`\n// instead of `(!x)[1]` is handled by the fact that the parser\n// function that parses unary prefix operators is called first, and\n// in turn calls the function that parses `[]` subscripts — that\n// way, it'll receive the node for `x[1]` already parsed, and wraps\n// *that* in the unary operator node.\n//\n// Acorn uses an [operator precedence parser][opp] to handle binary\n// operator precedence, because it is much more compact than using\n// the technique outlined above, which uses different, nesting\n// functions to specify precedence, for all of the ten binary\n// precedence levels that JavaScript defines.\n//\n// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser\n\nimport {types as tt} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {DestructuringErrors} from \"./parseutil\"\nimport {lineBreak} from \"./whitespace\"\nimport {functionFlags, SCOPE_ARROW, SCOPE_SUPER, SCOPE_DIRECT_SUPER, BIND_OUTSIDE, BIND_VAR} from \"./scopeflags\"\n\nconst pp = Parser.prototype\n\n// Check if property name clashes with already added.\n// Object/class getters and setters are not allowed to clash —\n// either with each other or with an init property — and in\n// strict mode, init properties are also not allowed to be repeated.\n\npp.checkPropClash = function(prop, propHash, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 9 && prop.type === \"SpreadElement\")\n return\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\n return\n let {key} = prop, name\n switch (key.type) {\n case \"Identifier\": name = key.name; break\n case \"Literal\": name = String(key.value); break\n default: return\n }\n let {kind} = prop\n if (this.options.ecmaVersion >= 6) {\n if (name === \"__proto__\" && kind === \"init\") {\n if (propHash.proto) {\n if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start\n // Backwards-compat kludge. Can be removed in version 6.0\n else this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\")\n }\n propHash.proto = true\n }\n return\n }\n name = \"$\" + name\n let other = propHash[name]\n if (other) {\n let redefinition\n if (kind === \"init\") {\n redefinition = this.strict && other.init || other.get || other.set\n } else {\n redefinition = other.init || other[kind]\n }\n if (redefinition)\n this.raiseRecoverable(key.start, \"Redefinition of property\")\n } else {\n other = propHash[name] = {\n init: false,\n get: false,\n set: false\n }\n }\n other[kind] = true\n}\n\n// ### Expression parsing\n\n// These nest, from the most general expression type at the top to\n// 'atomic', nondivisible expression types at the bottom. Most of\n// the functions will simply let the function(s) below them parse,\n// and, *if* the syntactic construct they handle is present, wrap\n// the AST node that the inner parser gave them in another node.\n\n// Parse a full expression. The optional arguments are used to\n// forbid the `in` operator (in for loops initalization expressions)\n// and provide reference for storing '=' operator inside shorthand\n// property assignment in contexts where both object expression\n// and object pattern might appear (so it's possible to raise\n// delayed syntax error at correct position).\n\npp.parseExpression = function(noIn, refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseMaybeAssign(noIn, refDestructuringErrors)\n if (this.type === tt.comma) {\n let node = this.startNodeAt(startPos, startLoc)\n node.expressions = [expr]\n while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors))\n return this.finishNode(node, \"SequenceExpression\")\n }\n return expr\n}\n\n// Parse an assignment expression. This includes applications of\n// operators like `+=`.\n\npp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {\n if (this.isContextual(\"yield\")) {\n if (this.inGenerator) return this.parseYield(noIn)\n // The tokenizer will assume an expression is allowed after\n // `yield`, but this isn't that kind of yield\n else this.exprAllowed = false\n }\n\n let ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldShorthandAssign = -1\n if (refDestructuringErrors) {\n oldParenAssign = refDestructuringErrors.parenthesizedAssign\n oldTrailingComma = refDestructuringErrors.trailingComma\n oldShorthandAssign = refDestructuringErrors.shorthandAssign\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.shorthandAssign = -1\n } else {\n refDestructuringErrors = new DestructuringErrors\n ownDestructuringErrors = true\n }\n\n let startPos = this.start, startLoc = this.startLoc\n if (this.type === tt.parenL || this.type === tt.name)\n this.potentialArrowAt = this.start\n let left = this.parseMaybeConditional(noIn, refDestructuringErrors)\n if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)\n if (this.type.isAssign) {\n let node = this.startNodeAt(startPos, startLoc)\n node.operator = this.value\n node.left = this.type === tt.eq ? this.toAssignable(left, false, refDestructuringErrors) : left\n if (!ownDestructuringErrors) DestructuringErrors.call(refDestructuringErrors)\n refDestructuringErrors.shorthandAssign = -1 // reset because shorthand default was used correctly\n this.checkLVal(left)\n this.next()\n node.right = this.parseMaybeAssign(noIn)\n return this.finishNode(node, \"AssignmentExpression\")\n } else {\n if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true)\n }\n if (oldParenAssign > -1) refDestructuringErrors.parenthesizedAssign = oldParenAssign\n if (oldTrailingComma > -1) refDestructuringErrors.trailingComma = oldTrailingComma\n if (oldShorthandAssign > -1) refDestructuringErrors.shorthandAssign = oldShorthandAssign\n return left\n}\n\n// Parse a ternary conditional (`?:`) operator.\n\npp.parseMaybeConditional = function(noIn, refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseExprOps(noIn, refDestructuringErrors)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n if (this.eat(tt.question)) {\n let node = this.startNodeAt(startPos, startLoc)\n node.test = expr\n node.consequent = this.parseMaybeAssign()\n this.expect(tt.colon)\n node.alternate = this.parseMaybeAssign(noIn)\n return this.finishNode(node, \"ConditionalExpression\")\n }\n return expr\n}\n\n// Start the precedence parser.\n\npp.parseExprOps = function(noIn, refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseMaybeUnary(refDestructuringErrors, false)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n return expr.start === startPos && expr.type === \"ArrowFunctionExpression\" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)\n}\n\n// Parse binary operators with the operator precedence parsing\n// algorithm. `left` is the left-hand side of the operator.\n// `minPrec` provides context that allows the function to stop and\n// defer further parser to one of its callers when it encounters an\n// operator that has a lower precedence than the set it is parsing.\n\npp.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {\n let prec = this.type.binop\n if (prec != null && (!noIn || this.type !== tt._in)) {\n if (prec > minPrec) {\n let logical = this.type === tt.logicalOR || this.type === tt.logicalAND\n let op = this.value\n this.next()\n let startPos = this.start, startLoc = this.startLoc\n let right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn)\n let node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical)\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)\n }\n }\n return left\n}\n\npp.buildBinary = function(startPos, startLoc, left, right, op, logical) {\n let node = this.startNodeAt(startPos, startLoc)\n node.left = left\n node.operator = op\n node.right = right\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\n}\n\n// Parse unary operators, both prefix and postfix.\n\npp.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {\n let startPos = this.start, startLoc = this.startLoc, expr\n if (this.isContextual(\"await\") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {\n expr = this.parseAwait()\n sawUnary = true\n } else if (this.type.prefix) {\n let node = this.startNode(), update = this.type === tt.incDec\n node.operator = this.value\n node.prefix = true\n this.next()\n node.argument = this.parseMaybeUnary(null, true)\n this.checkExpressionErrors(refDestructuringErrors, true)\n if (update) this.checkLVal(node.argument)\n else if (this.strict && node.operator === \"delete\" &&\n node.argument.type === \"Identifier\")\n this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\")\n else sawUnary = true\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\")\n } else {\n expr = this.parseExprSubscripts(refDestructuringErrors)\n if (this.checkExpressionErrors(refDestructuringErrors)) return expr\n while (this.type.postfix && !this.canInsertSemicolon()) {\n let node = this.startNodeAt(startPos, startLoc)\n node.operator = this.value\n node.prefix = false\n node.argument = expr\n this.checkLVal(expr)\n this.next()\n expr = this.finishNode(node, \"UpdateExpression\")\n }\n }\n\n if (!sawUnary && this.eat(tt.starstar))\n return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), \"**\", false)\n else\n return expr\n}\n\n// Parse call, dot, and `[]`-subscript expressions.\n\npp.parseExprSubscripts = function(refDestructuringErrors) {\n let startPos = this.start, startLoc = this.startLoc\n let expr = this.parseExprAtom(refDestructuringErrors)\n let skipArrowSubscripts = expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\"\n if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr\n let result = this.parseSubscripts(expr, startPos, startLoc)\n if (refDestructuringErrors && result.type === \"MemberExpression\") {\n if (refDestructuringErrors.parenthesizedAssign >= result.start) refDestructuringErrors.parenthesizedAssign = -1\n if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1\n }\n return result\n}\n\npp.parseSubscripts = function(base, startPos, startLoc, noCalls) {\n let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" &&\n this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === \"async\"\n for (let computed;;) {\n if ((computed = this.eat(tt.bracketL)) || this.eat(tt.dot)) {\n let node = this.startNodeAt(startPos, startLoc)\n node.object = base\n node.property = computed ? this.parseExpression() : this.parseIdent(true)\n node.computed = !!computed\n if (computed) this.expect(tt.bracketR)\n base = this.finishNode(node, \"MemberExpression\")\n } else if (!noCalls && this.eat(tt.parenL)) {\n let refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n this.yieldPos = 0\n this.awaitPos = 0\n let exprList = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors)\n if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false)\n this.checkYieldAwaitInDefaultParams()\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)\n }\n this.checkExpressionErrors(refDestructuringErrors, true)\n this.yieldPos = oldYieldPos || this.yieldPos\n this.awaitPos = oldAwaitPos || this.awaitPos\n let node = this.startNodeAt(startPos, startLoc)\n node.callee = base\n node.arguments = exprList\n base = this.finishNode(node, \"CallExpression\")\n } else if (this.type === tt.backQuote) {\n let node = this.startNodeAt(startPos, startLoc)\n node.tag = base\n node.quasi = this.parseTemplate({isTagged: true})\n base = this.finishNode(node, \"TaggedTemplateExpression\")\n } else {\n return base\n }\n }\n}\n\n// Parse an atomic expression — either a single token that is an\n// expression, an expression started by a keyword like `function` or\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\n// or `{}`.\n\npp.parseExprAtom = function(refDestructuringErrors) {\n // If a division operator appears in an expression position, the\n // tokenizer got confused, and we force it to read a regexp instead.\n if (this.type === tt.slash) this.readRegexp()\n\n let node, canBeArrow = this.potentialArrowAt === this.start\n switch (this.type) {\n case tt._super:\n if (!this.allowSuper)\n this.raise(this.start, \"'super' keyword outside a method\")\n node = this.startNode()\n this.next()\n if (this.type === tt.parenL && !this.allowDirectSuper)\n this.raise(node.start, \"super() call outside constructor of a subclass\")\n // The `super` keyword can appear at below:\n // SuperProperty:\n // super [ Expression ]\n // super . IdentifierName\n // SuperCall:\n // super Arguments\n if (this.type !== tt.dot && this.type !== tt.bracketL && this.type !== tt.parenL)\n this.unexpected()\n return this.finishNode(node, \"Super\")\n\n case tt._this:\n node = this.startNode()\n this.next()\n return this.finishNode(node, \"ThisExpression\")\n\n case tt.name:\n let startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc\n let id = this.parseIdent(this.type !== tt.name)\n if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(tt._function))\n return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true)\n if (canBeArrow && !this.canInsertSemicolon()) {\n if (this.eat(tt.arrow))\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false)\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === tt.name && !containsEsc) {\n id = this.parseIdent()\n if (this.canInsertSemicolon() || !this.eat(tt.arrow))\n this.unexpected()\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)\n }\n }\n return id\n\n case tt.regexp:\n let value = this.value\n node = this.parseLiteral(value.value)\n node.regex = {pattern: value.pattern, flags: value.flags}\n return node\n\n case tt.num: case tt.string:\n return this.parseLiteral(this.value)\n\n case tt._null: case tt._true: case tt._false:\n node = this.startNode()\n node.value = this.type === tt._null ? null : this.type === tt._true\n node.raw = this.type.keyword\n this.next()\n return this.finishNode(node, \"Literal\")\n\n case tt.parenL:\n let start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow)\n if (refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))\n refDestructuringErrors.parenthesizedAssign = start\n if (refDestructuringErrors.parenthesizedBind < 0)\n refDestructuringErrors.parenthesizedBind = start\n }\n return expr\n\n case tt.bracketL:\n node = this.startNode()\n this.next()\n node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors)\n return this.finishNode(node, \"ArrayExpression\")\n\n case tt.braceL:\n return this.parseObj(false, refDestructuringErrors)\n\n case tt._function:\n node = this.startNode()\n this.next()\n return this.parseFunction(node, 0)\n\n case tt._class:\n return this.parseClass(this.startNode(), false)\n\n case tt._new:\n return this.parseNew()\n\n case tt.backQuote:\n return this.parseTemplate()\n\n default:\n this.unexpected()\n }\n}\n\npp.parseLiteral = function(value) {\n let node = this.startNode()\n node.value = value\n node.raw = this.input.slice(this.start, this.end)\n this.next()\n return this.finishNode(node, \"Literal\")\n}\n\npp.parseParenExpression = function() {\n this.expect(tt.parenL)\n let val = this.parseExpression()\n this.expect(tt.parenR)\n return val\n}\n\npp.parseParenAndDistinguishExpression = function(canBeArrow) {\n let startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8\n if (this.options.ecmaVersion >= 6) {\n this.next()\n\n let innerStartPos = this.start, innerStartLoc = this.startLoc\n let exprList = [], first = true, lastIsComma = false\n let refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart\n this.yieldPos = 0\n this.awaitPos = 0\n while (this.type !== tt.parenR) {\n first ? first = false : this.expect(tt.comma)\n if (allowTrailingComma && this.afterTrailingComma(tt.parenR, true)) {\n lastIsComma = true\n break\n } else if (this.type === tt.ellipsis) {\n spreadStart = this.start\n exprList.push(this.parseParenItem(this.parseRestBinding()))\n if (this.type === tt.comma) this.raise(this.start, \"Comma is not permitted after the rest element\")\n break\n } else {\n exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem))\n }\n }\n let innerEndPos = this.start, innerEndLoc = this.startLoc\n this.expect(tt.parenR)\n\n if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false)\n this.checkYieldAwaitInDefaultParams()\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.parseParenArrowList(startPos, startLoc, exprList)\n }\n\n if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart)\n if (spreadStart) this.unexpected(spreadStart)\n this.checkExpressionErrors(refDestructuringErrors, true)\n this.yieldPos = oldYieldPos || this.yieldPos\n this.awaitPos = oldAwaitPos || this.awaitPos\n\n if (exprList.length > 1) {\n val = this.startNodeAt(innerStartPos, innerStartLoc)\n val.expressions = exprList\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc)\n } else {\n val = exprList[0]\n }\n } else {\n val = this.parseParenExpression()\n }\n\n if (this.options.preserveParens) {\n let par = this.startNodeAt(startPos, startLoc)\n par.expression = val\n return this.finishNode(par, \"ParenthesizedExpression\")\n } else {\n return val\n }\n}\n\npp.parseParenItem = function(item) {\n return item\n}\n\npp.parseParenArrowList = function(startPos, startLoc, exprList) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)\n}\n\n// New's precedence is slightly tricky. It must allow its argument to\n// be a `[]` or dot subscript expression, but not a call — at least,\n// not without wrapping it in parentheses. Thus, it uses the noCalls\n// argument to parseSubscripts to prevent it from consuming the\n// argument list.\n\nconst empty = []\n\npp.parseNew = function() {\n let node = this.startNode()\n let meta = this.parseIdent(true)\n if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {\n node.meta = meta\n let containsEsc = this.containsEsc\n node.property = this.parseIdent(true)\n if (node.property.name !== \"target\" || containsEsc)\n this.raiseRecoverable(node.property.start, \"The only valid meta property for new is new.target\")\n if (!this.inNonArrowFunction())\n this.raiseRecoverable(node.start, \"new.target can only be used in functions\")\n return this.finishNode(node, \"MetaProperty\")\n }\n let startPos = this.start, startLoc = this.startLoc\n node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)\n if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false)\n else node.arguments = empty\n return this.finishNode(node, \"NewExpression\")\n}\n\n// Parse template expression.\n\npp.parseTemplateElement = function({isTagged}) {\n let elem = this.startNode()\n if (this.type === tt.invalidTemplate) {\n if (!isTagged) {\n this.raiseRecoverable(this.start, \"Bad escape sequence in untagged template literal\")\n }\n elem.value = {\n raw: this.value,\n cooked: null\n }\n } else {\n elem.value = {\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, \"\\n\"),\n cooked: this.value\n }\n }\n this.next()\n elem.tail = this.type === tt.backQuote\n return this.finishNode(elem, \"TemplateElement\")\n}\n\npp.parseTemplate = function({isTagged = false} = {}) {\n let node = this.startNode()\n this.next()\n node.expressions = []\n let curElt = this.parseTemplateElement({isTagged})\n node.quasis = [curElt]\n while (!curElt.tail) {\n if (this.type === tt.eof) this.raise(this.pos, \"Unterminated template literal\")\n this.expect(tt.dollarBraceL)\n node.expressions.push(this.parseExpression())\n this.expect(tt.braceR)\n node.quasis.push(curElt = this.parseTemplateElement({isTagged}))\n }\n this.next()\n return this.finishNode(node, \"TemplateLiteral\")\n}\n\npp.isAsyncProp = function(prop) {\n return !prop.computed && prop.key.type === \"Identifier\" && prop.key.name === \"async\" &&\n (this.type === tt.name || this.type === tt.num || this.type === tt.string || this.type === tt.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === tt.star)) &&\n !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n}\n\n// Parse an object literal or binding pattern.\n\npp.parseObj = function(isPattern, refDestructuringErrors) {\n let node = this.startNode(), first = true, propHash = {}\n node.properties = []\n this.next()\n while (!this.eat(tt.braceR)) {\n if (!first) {\n this.expect(tt.comma)\n if (this.afterTrailingComma(tt.braceR)) break\n } else first = false\n\n const prop = this.parseProperty(isPattern, refDestructuringErrors)\n if (!isPattern) this.checkPropClash(prop, propHash, refDestructuringErrors)\n node.properties.push(prop)\n }\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\n}\n\npp.parseProperty = function(isPattern, refDestructuringErrors) {\n let prop = this.startNode(), isGenerator, isAsync, startPos, startLoc\n if (this.options.ecmaVersion >= 9 && this.eat(tt.ellipsis)) {\n if (isPattern) {\n prop.argument = this.parseIdent(false)\n if (this.type === tt.comma) {\n this.raise(this.start, \"Comma is not permitted after the rest element\")\n }\n return this.finishNode(prop, \"RestElement\")\n }\n // To disallow parenthesized identifier via `this.toAssignable()`.\n if (this.type === tt.parenL && refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0) {\n refDestructuringErrors.parenthesizedAssign = this.start\n }\n if (refDestructuringErrors.parenthesizedBind < 0) {\n refDestructuringErrors.parenthesizedBind = this.start\n }\n }\n // Parse argument.\n prop.argument = this.parseMaybeAssign(false, refDestructuringErrors)\n // To disallow trailing comma via `this.toAssignable()`.\n if (this.type === tt.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {\n refDestructuringErrors.trailingComma = this.start\n }\n // Finish\n return this.finishNode(prop, \"SpreadElement\")\n }\n if (this.options.ecmaVersion >= 6) {\n prop.method = false\n prop.shorthand = false\n if (isPattern || refDestructuringErrors) {\n startPos = this.start\n startLoc = this.startLoc\n }\n if (!isPattern)\n isGenerator = this.eat(tt.star)\n }\n let containsEsc = this.containsEsc\n this.parsePropertyName(prop)\n if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {\n isAsync = true\n isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)\n this.parsePropertyName(prop, refDestructuringErrors)\n } else {\n isAsync = false\n }\n this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc)\n return this.finishNode(prop, \"Property\")\n}\n\npp.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {\n if ((isGenerator || isAsync) && this.type === tt.colon)\n this.unexpected()\n\n if (this.eat(tt.colon)) {\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors)\n prop.kind = \"init\"\n } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {\n if (isPattern) this.unexpected()\n prop.kind = \"init\"\n prop.method = true\n prop.value = this.parseMethod(isGenerator, isAsync)\n } else if (!isPattern && !containsEsc &&\n this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\n (this.type !== tt.comma && this.type !== tt.braceR)) {\n if (isGenerator || isAsync) this.unexpected()\n prop.kind = prop.key.name\n this.parsePropertyName(prop)\n prop.value = this.parseMethod(false)\n let paramCount = prop.kind === \"get\" ? 0 : 1\n if (prop.value.params.length !== paramCount) {\n let start = prop.value.start\n if (prop.kind === \"get\")\n this.raiseRecoverable(start, \"getter should have no params\")\n else\n this.raiseRecoverable(start, \"setter should have exactly one param\")\n } else {\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\n this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\")\n }\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\n this.checkUnreserved(prop.key)\n prop.kind = \"init\"\n if (isPattern) {\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\n } else if (this.type === tt.eq && refDestructuringErrors) {\n if (refDestructuringErrors.shorthandAssign < 0)\n refDestructuringErrors.shorthandAssign = this.start\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)\n } else {\n prop.value = prop.key\n }\n prop.shorthand = true\n } else this.unexpected()\n}\n\npp.parsePropertyName = function(prop) {\n if (this.options.ecmaVersion >= 6) {\n if (this.eat(tt.bracketL)) {\n prop.computed = true\n prop.key = this.parseMaybeAssign()\n this.expect(tt.bracketR)\n return prop.key\n } else {\n prop.computed = false\n }\n }\n return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true)\n}\n\n// Initialize empty function node.\n\npp.initFunction = function(node) {\n node.id = null\n if (this.options.ecmaVersion >= 6) node.generator = node.expression = false\n if (this.options.ecmaVersion >= 8) node.async = false\n}\n\n// Parse object or class method.\n\npp.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {\n let node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n\n this.initFunction(node)\n if (this.options.ecmaVersion >= 6)\n node.generator = isGenerator\n if (this.options.ecmaVersion >= 8)\n node.async = !!isAsync\n\n this.yieldPos = 0\n this.awaitPos = 0\n this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0))\n\n this.expect(tt.parenL)\n node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)\n this.checkYieldAwaitInDefaultParams()\n this.parseFunctionBody(node, false)\n\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.finishNode(node, \"FunctionExpression\")\n}\n\n// Parse arrow function expression with given parameters.\n\npp.parseArrowExpression = function(node, params, isAsync) {\n let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos\n\n this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW)\n this.initFunction(node)\n if (this.options.ecmaVersion >= 8) node.async = !!isAsync\n\n this.yieldPos = 0\n this.awaitPos = 0\n\n node.params = this.toAssignableList(params, true)\n this.parseFunctionBody(node, true)\n\n this.yieldPos = oldYieldPos\n this.awaitPos = oldAwaitPos\n return this.finishNode(node, \"ArrowFunctionExpression\")\n}\n\n// Parse function body and check parameters.\n\npp.parseFunctionBody = function(node, isArrowFunction) {\n let isExpression = isArrowFunction && this.type !== tt.braceL\n let oldStrict = this.strict, useStrict = false\n\n if (isExpression) {\n node.body = this.parseMaybeAssign()\n node.expression = true\n this.checkParams(node, false)\n } else {\n let nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params)\n if (!oldStrict || nonSimple) {\n useStrict = this.strictDirective(this.end)\n // If this is a strict mode function, verify that argument names\n // are not repeated, and it does not try to bind the words `eval`\n // or `arguments`.\n if (useStrict && nonSimple)\n this.raiseRecoverable(node.start, \"Illegal 'use strict' directive in function with non-simple parameter list\")\n }\n // Start a new scope with regard to labels and the `inFunction`\n // flag (restore them to their old value afterwards).\n let oldLabels = this.labels\n this.labels = []\n if (useStrict) this.strict = true\n\n // Add the params to varDeclaredNames to ensure that an error is thrown\n // if a let/const declaration in the function clashes with one of the params.\n this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params))\n node.body = this.parseBlock(false)\n node.expression = false\n this.adaptDirectivePrologue(node.body.body)\n this.labels = oldLabels\n }\n this.exitScope()\n\n // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'\n if (this.strict && node.id) this.checkLVal(node.id, BIND_OUTSIDE)\n this.strict = oldStrict\n}\n\npp.isSimpleParamList = function(params) {\n for (let param of params)\n if (param.type !== \"Identifier\") return false\n return true\n}\n\n// Checks function params for various disallowed patterns such as using \"eval\"\n// or \"arguments\" and duplicate parameters.\n\npp.checkParams = function(node, allowDuplicates) {\n let nameHash = {}\n for (let param of node.params)\n this.checkLVal(param, BIND_VAR, allowDuplicates ? null : nameHash)\n}\n\n// Parses a comma-separated list of expressions, and returns them as\n// an array. `close` is the token type that ends the list, and\n// `allowEmpty` can be turned on to allow subsequent commas with\n// nothing in between them to be parsed as `null` (which is needed\n// for array literals).\n\npp.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\n let elts = [], first = true\n while (!this.eat(close)) {\n if (!first) {\n this.expect(tt.comma)\n if (allowTrailingComma && this.afterTrailingComma(close)) break\n } else first = false\n\n let elt\n if (allowEmpty && this.type === tt.comma)\n elt = null\n else if (this.type === tt.ellipsis) {\n elt = this.parseSpread(refDestructuringErrors)\n if (refDestructuringErrors && this.type === tt.comma && refDestructuringErrors.trailingComma < 0)\n refDestructuringErrors.trailingComma = this.start\n } else {\n elt = this.parseMaybeAssign(false, refDestructuringErrors)\n }\n elts.push(elt)\n }\n return elts\n}\n\npp.checkUnreserved = function({start, end, name}) {\n if (this.inGenerator && name === \"yield\")\n this.raiseRecoverable(start, \"Can not use 'yield' as identifier inside a generator\")\n if (this.inAsync && name === \"await\")\n this.raiseRecoverable(start, \"Can not use 'await' as identifier inside an async function\")\n if (this.keywords.test(name))\n this.raise(start, `Unexpected keyword '${name}'`)\n if (this.options.ecmaVersion < 6 &&\n this.input.slice(start, end).indexOf(\"\\\\\") !== -1) return\n const re = this.strict ? this.reservedWordsStrict : this.reservedWords\n if (re.test(name)) {\n if (!this.inAsync && name === \"await\")\n this.raiseRecoverable(start, \"Can not use keyword 'await' outside an async function\")\n this.raiseRecoverable(start, `The keyword '${name}' is reserved`)\n }\n}\n\n// Parse the next token as an identifier. If `liberal` is true (used\n// when parsing properties), it will also convert keywords into\n// identifiers.\n\npp.parseIdent = function(liberal, isBinding) {\n let node = this.startNode()\n if (liberal && this.options.allowReserved === \"never\") liberal = false\n if (this.type === tt.name) {\n node.name = this.value\n } else if (this.type.keyword) {\n node.name = this.type.keyword\n\n // To fix https://github.com/acornjs/acorn/issues/575\n // `class` and `function` keywords push new context into this.context.\n // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.\n // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword\n if ((node.name === \"class\" || node.name === \"function\") &&\n (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {\n this.context.pop()\n }\n } else {\n this.unexpected()\n }\n this.next()\n this.finishNode(node, \"Identifier\")\n if (!liberal) this.checkUnreserved(node)\n return node\n}\n\n// Parses yield expression inside generator.\n\npp.parseYield = function(noIn) {\n if (!this.yieldPos) this.yieldPos = this.start\n\n let node = this.startNode()\n this.next()\n if (this.type === tt.semi || this.canInsertSemicolon() || (this.type !== tt.star && !this.type.startsExpr)) {\n node.delegate = false\n node.argument = null\n } else {\n node.delegate = this.eat(tt.star)\n node.argument = this.parseMaybeAssign(noIn)\n }\n return this.finishNode(node, \"YieldExpression\")\n}\n\npp.parseAwait = function() {\n if (!this.awaitPos) this.awaitPos = this.start\n\n let node = this.startNode()\n this.next()\n node.argument = this.parseMaybeUnary(null, true)\n return this.finishNode(node, \"AwaitExpression\")\n}\n","import {Parser} from \"./state\"\nimport {Position, getLineInfo} from \"./locutil\"\n\nconst pp = Parser.prototype\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\npp.raise = function(pos, message) {\n let loc = getLineInfo(this.input, pos)\n message += \" (\" + loc.line + \":\" + loc.column + \")\"\n let err = new SyntaxError(message)\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos\n throw err\n}\n\npp.raiseRecoverable = pp.raise\n\npp.curPosition = function() {\n if (this.options.locations) {\n return new Position(this.curLine, this.pos - this.lineStart)\n }\n}\n","import {Parser} from \"./state\"\nimport {SCOPE_VAR, SCOPE_FUNCTION, SCOPE_TOP, SCOPE_ARROW, SCOPE_SIMPLE_CATCH, BIND_LEXICAL, BIND_SIMPLE_CATCH, BIND_FUNCTION} from \"./scopeflags\"\n\nconst pp = Parser.prototype\n\nclass Scope {\n constructor(flags) {\n this.flags = flags\n // A list of var-declared names in the current lexical scope\n this.var = []\n // A list of lexically-declared names in the current lexical scope\n this.lexical = []\n // A list of lexically-declared FunctionDeclaration names in the current lexical scope\n this.functions = []\n }\n}\n\n// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.\n\npp.enterScope = function(flags) {\n this.scopeStack.push(new Scope(flags))\n}\n\npp.exitScope = function() {\n this.scopeStack.pop()\n}\n\n// The spec says:\n// > At the top level of a function, or script, function declarations are\n// > treated like var declarations rather than like lexical declarations.\npp.treatFunctionsAsVarInScope = function(scope) {\n return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP);\n}\n\npp.declareName = function(name, bindingType, pos) {\n let redeclared = false\n if (bindingType === BIND_LEXICAL) {\n const scope = this.currentScope()\n redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1\n scope.lexical.push(name)\n } else if (bindingType === BIND_SIMPLE_CATCH) {\n const scope = this.currentScope()\n scope.lexical.push(name)\n } else if (bindingType === BIND_FUNCTION) {\n const scope = this.currentScope()\n if (this.treatFunctionsAsVar)\n redeclared = scope.lexical.indexOf(name) > -1;\n else\n redeclared = scope.lexical.indexOf(name) > -1 || scope.var.indexOf(name) > -1\n scope.functions.push(name)\n } else {\n for (let i = this.scopeStack.length - 1; i >= 0; --i) {\n const scope = this.scopeStack[i]\n if (scope.lexical.indexOf(name) > -1 && !(scope.flags & SCOPE_SIMPLE_CATCH) && scope.lexical[0] === name ||\n !this.treatFunctionsAsVarInScope(scope) && scope.functions.indexOf(name) > -1) {\n redeclared = true\n break\n }\n scope.var.push(name)\n if (scope.flags & SCOPE_VAR) break\n }\n }\n if (redeclared) this.raiseRecoverable(pos, `Identifier '${name}' has already been declared`)\n}\n\npp.currentScope = function() {\n return this.scopeStack[this.scopeStack.length - 1]\n}\n\npp.currentVarScope = function() {\n for (let i = this.scopeStack.length - 1;; i--) {\n let scope = this.scopeStack[i]\n if (scope.flags & SCOPE_VAR) return scope\n }\n}\n\n// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.\npp.currentThisScope = function() {\n for (let i = this.scopeStack.length - 1;; i--) {\n let scope = this.scopeStack[i]\n if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) return scope\n }\n}\n","import {Parser} from \"./state\"\nimport {SourceLocation} from \"./locutil\"\n\nexport class Node {\n constructor(parser, pos, loc) {\n this.type = \"\"\n this.start = pos\n this.end = 0\n if (parser.options.locations)\n this.loc = new SourceLocation(parser, loc)\n if (parser.options.directSourceFile)\n this.sourceFile = parser.options.directSourceFile\n if (parser.options.ranges)\n this.range = [pos, 0]\n }\n}\n\n// Start an AST node, attaching a start offset.\n\nconst pp = Parser.prototype\n\npp.startNode = function() {\n return new Node(this, this.start, this.startLoc)\n}\n\npp.startNodeAt = function(pos, loc) {\n return new Node(this, pos, loc)\n}\n\n// Finish an AST node, adding `type` and `end` properties.\n\nfunction finishNodeAt(node, type, pos, loc) {\n node.type = type\n node.end = pos\n if (this.options.locations)\n node.loc.end = loc\n if (this.options.ranges)\n node.range[1] = pos\n return node\n}\n\npp.finishNode = function(node, type) {\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\n}\n\n// Finish node at given position\n\npp.finishNodeAt = function(node, type, pos, loc) {\n return finishNodeAt.call(this, node, type, pos, loc)\n}\n","// The algorithm used to determine whether a regexp can appear at a\n// given point in the program is loosely based on sweet.js' approach.\n// See https://github.com/mozilla/sweet.js/wiki/design\n\nimport {Parser} from \"./state\"\nimport {types as tt} from \"./tokentype\"\nimport {lineBreak} from \"./whitespace\"\n\nexport class TokContext {\n constructor(token, isExpr, preserveSpace, override, generator) {\n this.token = token\n this.isExpr = !!isExpr\n this.preserveSpace = !!preserveSpace\n this.override = override\n this.generator = !!generator\n }\n}\n\nexport const types = {\n b_stat: new TokContext(\"{\", false),\n b_expr: new TokContext(\"{\", true),\n b_tmpl: new TokContext(\"${\", false),\n p_stat: new TokContext(\"(\", false),\n p_expr: new TokContext(\"(\", true),\n q_tmpl: new TokContext(\"`\", true, true, p => p.tryReadTemplateToken()),\n f_stat: new TokContext(\"function\", false),\n f_expr: new TokContext(\"function\", true),\n f_expr_gen: new TokContext(\"function\", true, false, null, true),\n f_gen: new TokContext(\"function\", false, false, null, true)\n}\n\nconst pp = Parser.prototype\n\npp.initialContext = function() {\n return [types.b_stat]\n}\n\npp.braceIsBlock = function(prevType) {\n let parent = this.curContext()\n if (parent === types.f_expr || parent === types.f_stat)\n return true\n if (prevType === tt.colon && (parent === types.b_stat || parent === types.b_expr))\n return !parent.isExpr\n\n // The check for `tt.name && exprAllowed` detects whether we are\n // after a `yield` or `of` construct. See the `updateContext` for\n // `tt.name`.\n if (prevType === tt._return || prevType === tt.name && this.exprAllowed)\n return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR || prevType === tt.arrow)\n return true\n if (prevType === tt.braceL)\n return parent === types.b_stat\n if (prevType === tt._var || prevType === tt._const || prevType === tt.name)\n return false\n return !this.exprAllowed\n}\n\npp.inGeneratorContext = function() {\n for (let i = this.context.length - 1; i >= 1; i--) {\n let context = this.context[i]\n if (context.token === \"function\")\n return context.generator\n }\n return false\n}\n\npp.updateContext = function(prevType) {\n let update, type = this.type\n if (type.keyword && prevType === tt.dot)\n this.exprAllowed = false\n else if (update = type.updateContext)\n update.call(this, prevType)\n else\n this.exprAllowed = type.beforeExpr\n}\n\n// Token-specific context update code\n\ntt.parenR.updateContext = tt.braceR.updateContext = function() {\n if (this.context.length === 1) {\n this.exprAllowed = true\n return\n }\n let out = this.context.pop()\n if (out === types.b_stat && this.curContext().token === \"function\") {\n out = this.context.pop()\n }\n this.exprAllowed = !out.isExpr\n}\n\ntt.braceL.updateContext = function(prevType) {\n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)\n this.exprAllowed = true\n}\n\ntt.dollarBraceL.updateContext = function() {\n this.context.push(types.b_tmpl)\n this.exprAllowed = true\n}\n\ntt.parenL.updateContext = function(prevType) {\n let statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while\n this.context.push(statementParens ? types.p_stat : types.p_expr)\n this.exprAllowed = true\n}\n\ntt.incDec.updateContext = function() {\n // tokExprAllowed stays unchanged\n}\n\ntt._function.updateContext = tt._class.updateContext = function(prevType) {\n if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&\n !(prevType === tt._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&\n !((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))\n this.context.push(types.f_expr)\n else\n this.context.push(types.f_stat)\n this.exprAllowed = false\n}\n\ntt.backQuote.updateContext = function() {\n if (this.curContext() === types.q_tmpl)\n this.context.pop()\n else\n this.context.push(types.q_tmpl)\n this.exprAllowed = false\n}\n\ntt.star.updateContext = function(prevType) {\n if (prevType === tt._function) {\n let index = this.context.length - 1\n if (this.context[index] === types.f_expr)\n this.context[index] = types.f_expr_gen\n else\n this.context[index] = types.f_gen\n }\n this.exprAllowed = true\n}\n\ntt.name.updateContext = function(prevType) {\n let allowed = false\n if (this.options.ecmaVersion >= 6 && prevType !== tt.dot) {\n if (this.value === \"of\" && !this.exprAllowed ||\n this.value === \"yield\" && this.inGeneratorContext())\n allowed = true\n }\n this.exprAllowed = allowed\n}\n","const data = {\n \"$LONE\": [\n \"ASCII\",\n \"ASCII_Hex_Digit\",\n \"AHex\",\n \"Alphabetic\",\n \"Alpha\",\n \"Any\",\n \"Assigned\",\n \"Bidi_Control\",\n \"Bidi_C\",\n \"Bidi_Mirrored\",\n \"Bidi_M\",\n \"Case_Ignorable\",\n \"CI\",\n \"Cased\",\n \"Changes_When_Casefolded\",\n \"CWCF\",\n \"Changes_When_Casemapped\",\n \"CWCM\",\n \"Changes_When_Lowercased\",\n \"CWL\",\n \"Changes_When_NFKC_Casefolded\",\n \"CWKCF\",\n \"Changes_When_Titlecased\",\n \"CWT\",\n \"Changes_When_Uppercased\",\n \"CWU\",\n \"Dash\",\n \"Default_Ignorable_Code_Point\",\n \"DI\",\n \"Deprecated\",\n \"Dep\",\n \"Diacritic\",\n \"Dia\",\n \"Emoji\",\n \"Emoji_Component\",\n \"Emoji_Modifier\",\n \"Emoji_Modifier_Base\",\n \"Emoji_Presentation\",\n \"Extender\",\n \"Ext\",\n \"Grapheme_Base\",\n \"Gr_Base\",\n \"Grapheme_Extend\",\n \"Gr_Ext\",\n \"Hex_Digit\",\n \"Hex\",\n \"IDS_Binary_Operator\",\n \"IDSB\",\n \"IDS_Trinary_Operator\",\n \"IDST\",\n \"ID_Continue\",\n \"IDC\",\n \"ID_Start\",\n \"IDS\",\n \"Ideographic\",\n \"Ideo\",\n \"Join_Control\",\n \"Join_C\",\n \"Logical_Order_Exception\",\n \"LOE\",\n \"Lowercase\",\n \"Lower\",\n \"Math\",\n \"Noncharacter_Code_Point\",\n \"NChar\",\n \"Pattern_Syntax\",\n \"Pat_Syn\",\n \"Pattern_White_Space\",\n \"Pat_WS\",\n \"Quotation_Mark\",\n \"QMark\",\n \"Radical\",\n \"Regional_Indicator\",\n \"RI\",\n \"Sentence_Terminal\",\n \"STerm\",\n \"Soft_Dotted\",\n \"SD\",\n \"Terminal_Punctuation\",\n \"Term\",\n \"Unified_Ideograph\",\n \"UIdeo\",\n \"Uppercase\",\n \"Upper\",\n \"Variation_Selector\",\n \"VS\",\n \"White_Space\",\n \"space\",\n \"XID_Continue\",\n \"XIDC\",\n \"XID_Start\",\n \"XIDS\"\n ],\n \"General_Category\": [\n \"Cased_Letter\",\n \"LC\",\n \"Close_Punctuation\",\n \"Pe\",\n \"Connector_Punctuation\",\n \"Pc\",\n \"Control\",\n \"Cc\",\n \"cntrl\",\n \"Currency_Symbol\",\n \"Sc\",\n \"Dash_Punctuation\",\n \"Pd\",\n \"Decimal_Number\",\n \"Nd\",\n \"digit\",\n \"Enclosing_Mark\",\n \"Me\",\n \"Final_Punctuation\",\n \"Pf\",\n \"Format\",\n \"Cf\",\n \"Initial_Punctuation\",\n \"Pi\",\n \"Letter\",\n \"L\",\n \"Letter_Number\",\n \"Nl\",\n \"Line_Separator\",\n \"Zl\",\n \"Lowercase_Letter\",\n \"Ll\",\n \"Mark\",\n \"M\",\n \"Combining_Mark\",\n \"Math_Symbol\",\n \"Sm\",\n \"Modifier_Letter\",\n \"Lm\",\n \"Modifier_Symbol\",\n \"Sk\",\n \"Nonspacing_Mark\",\n \"Mn\",\n \"Number\",\n \"N\",\n \"Open_Punctuation\",\n \"Ps\",\n \"Other\",\n \"C\",\n \"Other_Letter\",\n \"Lo\",\n \"Other_Number\",\n \"No\",\n \"Other_Punctuation\",\n \"Po\",\n \"Other_Symbol\",\n \"So\",\n \"Paragraph_Separator\",\n \"Zp\",\n \"Private_Use\",\n \"Co\",\n \"Punctuation\",\n \"P\",\n \"punct\",\n \"Separator\",\n \"Z\",\n \"Space_Separator\",\n \"Zs\",\n \"Spacing_Mark\",\n \"Mc\",\n \"Surrogate\",\n \"Cs\",\n \"Symbol\",\n \"S\",\n \"Titlecase_Letter\",\n \"Lt\",\n \"Unassigned\",\n \"Cn\",\n \"Uppercase_Letter\",\n \"Lu\"\n ],\n \"Script\": [\n \"Adlam\",\n \"Adlm\",\n \"Ahom\",\n \"Anatolian_Hieroglyphs\",\n \"Hluw\",\n \"Arabic\",\n \"Arab\",\n \"Armenian\",\n \"Armn\",\n \"Avestan\",\n \"Avst\",\n \"Balinese\",\n \"Bali\",\n \"Bamum\",\n \"Bamu\",\n \"Bassa_Vah\",\n \"Bass\",\n \"Batak\",\n \"Batk\",\n \"Bengali\",\n \"Beng\",\n \"Bhaiksuki\",\n \"Bhks\",\n \"Bopomofo\",\n \"Bopo\",\n \"Brahmi\",\n \"Brah\",\n \"Braille\",\n \"Brai\",\n \"Buginese\",\n \"Bugi\",\n \"Buhid\",\n \"Buhd\",\n \"Canadian_Aboriginal\",\n \"Cans\",\n \"Carian\",\n \"Cari\",\n \"Caucasian_Albanian\",\n \"Aghb\",\n \"Chakma\",\n \"Cakm\",\n \"Cham\",\n \"Cherokee\",\n \"Cher\",\n \"Common\",\n \"Zyyy\",\n \"Coptic\",\n \"Copt\",\n \"Qaac\",\n \"Cuneiform\",\n \"Xsux\",\n \"Cypriot\",\n \"Cprt\",\n \"Cyrillic\",\n \"Cyrl\",\n \"Deseret\",\n \"Dsrt\",\n \"Devanagari\",\n \"Deva\",\n \"Duployan\",\n \"Dupl\",\n \"Egyptian_Hieroglyphs\",\n \"Egyp\",\n \"Elbasan\",\n \"Elba\",\n \"Ethiopic\",\n \"Ethi\",\n \"Georgian\",\n \"Geor\",\n \"Glagolitic\",\n \"Glag\",\n \"Gothic\",\n \"Goth\",\n \"Grantha\",\n \"Gran\",\n \"Greek\",\n \"Grek\",\n \"Gujarati\",\n \"Gujr\",\n \"Gurmukhi\",\n \"Guru\",\n \"Han\",\n \"Hani\",\n \"Hangul\",\n \"Hang\",\n \"Hanunoo\",\n \"Hano\",\n \"Hatran\",\n \"Hatr\",\n \"Hebrew\",\n \"Hebr\",\n \"Hiragana\",\n \"Hira\",\n \"Imperial_Aramaic\",\n \"Armi\",\n \"Inherited\",\n \"Zinh\",\n \"Qaai\",\n \"Inscriptional_Pahlavi\",\n \"Phli\",\n \"Inscriptional_Parthian\",\n \"Prti\",\n \"Javanese\",\n \"Java\",\n \"Kaithi\",\n \"Kthi\",\n \"Kannada\",\n \"Knda\",\n \"Katakana\",\n \"Kana\",\n \"Kayah_Li\",\n \"Kali\",\n \"Kharoshthi\",\n \"Khar\",\n \"Khmer\",\n \"Khmr\",\n \"Khojki\",\n \"Khoj\",\n \"Khudawadi\",\n \"Sind\",\n \"Lao\",\n \"Laoo\",\n \"Latin\",\n \"Latn\",\n \"Lepcha\",\n \"Lepc\",\n \"Limbu\",\n \"Limb\",\n \"Linear_A\",\n \"Lina\",\n \"Linear_B\",\n \"Linb\",\n \"Lisu\",\n \"Lycian\",\n \"Lyci\",\n \"Lydian\",\n \"Lydi\",\n \"Mahajani\",\n \"Mahj\",\n \"Malayalam\",\n \"Mlym\",\n \"Mandaic\",\n \"Mand\",\n \"Manichaean\",\n \"Mani\",\n \"Marchen\",\n \"Marc\",\n \"Masaram_Gondi\",\n \"Gonm\",\n \"Meetei_Mayek\",\n \"Mtei\",\n \"Mende_Kikakui\",\n \"Mend\",\n \"Meroitic_Cursive\",\n \"Merc\",\n \"Meroitic_Hieroglyphs\",\n \"Mero\",\n \"Miao\",\n \"Plrd\",\n \"Modi\",\n \"Mongolian\",\n \"Mong\",\n \"Mro\",\n \"Mroo\",\n \"Multani\",\n \"Mult\",\n \"Myanmar\",\n \"Mymr\",\n \"Nabataean\",\n \"Nbat\",\n \"New_Tai_Lue\",\n \"Talu\",\n \"Newa\",\n \"Nko\",\n \"Nkoo\",\n \"Nushu\",\n \"Nshu\",\n \"Ogham\",\n \"Ogam\",\n \"Ol_Chiki\",\n \"Olck\",\n \"Old_Hungarian\",\n \"Hung\",\n \"Old_Italic\",\n \"Ital\",\n \"Old_North_Arabian\",\n \"Narb\",\n \"Old_Permic\",\n \"Perm\",\n \"Old_Persian\",\n \"Xpeo\",\n \"Old_South_Arabian\",\n \"Sarb\",\n \"Old_Turkic\",\n \"Orkh\",\n \"Oriya\",\n \"Orya\",\n \"Osage\",\n \"Osge\",\n \"Osmanya\",\n \"Osma\",\n \"Pahawh_Hmong\",\n \"Hmng\",\n \"Palmyrene\",\n \"Palm\",\n \"Pau_Cin_Hau\",\n \"Pauc\",\n \"Phags_Pa\",\n \"Phag\",\n \"Phoenician\",\n \"Phnx\",\n \"Psalter_Pahlavi\",\n \"Phlp\",\n \"Rejang\",\n \"Rjng\",\n \"Runic\",\n \"Runr\",\n \"Samaritan\",\n \"Samr\",\n \"Saurashtra\",\n \"Saur\",\n \"Sharada\",\n \"Shrd\",\n \"Shavian\",\n \"Shaw\",\n \"Siddham\",\n \"Sidd\",\n \"SignWriting\",\n \"Sgnw\",\n \"Sinhala\",\n \"Sinh\",\n \"Sora_Sompeng\",\n \"Sora\",\n \"Soyombo\",\n \"Soyo\",\n \"Sundanese\",\n \"Sund\",\n \"Syloti_Nagri\",\n \"Sylo\",\n \"Syriac\",\n \"Syrc\",\n \"Tagalog\",\n \"Tglg\",\n \"Tagbanwa\",\n \"Tagb\",\n \"Tai_Le\",\n \"Tale\",\n \"Tai_Tham\",\n \"Lana\",\n \"Tai_Viet\",\n \"Tavt\",\n \"Takri\",\n \"Takr\",\n \"Tamil\",\n \"Taml\",\n \"Tangut\",\n \"Tang\",\n \"Telugu\",\n \"Telu\",\n \"Thaana\",\n \"Thaa\",\n \"Thai\",\n \"Tibetan\",\n \"Tibt\",\n \"Tifinagh\",\n \"Tfng\",\n \"Tirhuta\",\n \"Tirh\",\n \"Ugaritic\",\n \"Ugar\",\n \"Vai\",\n \"Vaii\",\n \"Warang_Citi\",\n \"Wara\",\n \"Yi\",\n \"Yiii\",\n \"Zanabazar_Square\",\n \"Zanb\"\n ]\n}\nArray.prototype.push.apply(data.$LONE, data.General_Category)\ndata.gc = data.General_Category\ndata.sc = data.Script_Extensions = data.scx = data.Script\n\nexport default data\n","import {isIdentifierStart, isIdentifierChar} from \"./identifier.js\"\nimport {Parser} from \"./state.js\"\nimport UNICODE_PROPERTY_VALUES from \"./unicode-property-data.js\"\n\nconst pp = Parser.prototype\n\nexport class RegExpValidationState {\n constructor(parser) {\n this.parser = parser\n this.validFlags = `gim${parser.options.ecmaVersion >= 6 ? \"uy\" : \"\"}${parser.options.ecmaVersion >= 9 ? \"s\" : \"\"}`\n this.source = \"\"\n this.flags = \"\"\n this.start = 0\n this.switchU = false\n this.switchN = false\n this.pos = 0\n this.lastIntValue = 0\n this.lastStringValue = \"\"\n this.lastAssertionIsQuantifiable = false\n this.numCapturingParens = 0\n this.maxBackReference = 0\n this.groupNames = []\n this.backReferenceNames = []\n }\n\n reset(start, pattern, flags) {\n const unicode = flags.indexOf(\"u\") !== -1\n this.start = start | 0\n this.source = pattern + \"\"\n this.flags = flags\n this.switchU = unicode && this.parser.options.ecmaVersion >= 6\n this.switchN = unicode && this.parser.options.ecmaVersion >= 9\n }\n\n raise(message) {\n this.parser.raiseRecoverable(this.start, `Invalid regular expression: /${this.source}/: ${message}`)\n }\n\n // If u flag is given, this returns the code point at the index (it combines a surrogate pair).\n // Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).\n at(i) {\n const s = this.source\n const l = s.length\n if (i >= l) {\n return -1\n }\n const c = s.charCodeAt(i)\n if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {\n return c\n }\n return (c << 10) + s.charCodeAt(i + 1) - 0x35FDC00\n }\n\n nextIndex(i) {\n const s = this.source\n const l = s.length\n if (i >= l) {\n return l\n }\n const c = s.charCodeAt(i)\n if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {\n return i + 1\n }\n return i + 2\n }\n\n current() {\n return this.at(this.pos)\n }\n\n lookahead() {\n return this.at(this.nextIndex(this.pos))\n }\n\n advance() {\n this.pos = this.nextIndex(this.pos)\n }\n\n eat(ch) {\n if (this.current() === ch) {\n this.advance()\n return true\n }\n return false\n }\n}\n\nfunction codePointToString(ch) {\n if (ch <= 0xFFFF) return String.fromCharCode(ch)\n ch -= 0x10000\n return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)\n}\n\n/**\n * Validate the flags part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp.validateRegExpFlags = function(state) {\n const validFlags = state.validFlags\n const flags = state.flags\n\n for (let i = 0; i < flags.length; i++) {\n const flag = flags.charAt(i)\n if (validFlags.indexOf(flag) === -1) {\n this.raise(state.start, \"Invalid regular expression flag\")\n }\n if (flags.indexOf(flag, i + 1) > -1) {\n this.raise(state.start, \"Duplicate regular expression flag\")\n }\n }\n}\n\n/**\n * Validate the pattern part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp.validateRegExpPattern = function(state) {\n this.regexp_pattern(state)\n\n // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of\n // parsing contains a |GroupName|, reparse with the goal symbol\n // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*\n // exception if _P_ did not conform to the grammar, if any elements of _P_\n // were not matched by the parse, or if any Early Error conditions exist.\n if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {\n state.switchN = true\n this.regexp_pattern(state)\n }\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern\npp.regexp_pattern = function(state) {\n state.pos = 0\n state.lastIntValue = 0\n state.lastStringValue = \"\"\n state.lastAssertionIsQuantifiable = false\n state.numCapturingParens = 0\n state.maxBackReference = 0\n state.groupNames.length = 0\n state.backReferenceNames.length = 0\n\n this.regexp_disjunction(state)\n\n if (state.pos !== state.source.length) {\n // Make the same messages as V8.\n if (state.eat(0x29 /* ) */)) {\n state.raise(\"Unmatched ')'\")\n }\n if (state.eat(0x5D /* [ */) || state.eat(0x7D /* } */)) {\n state.raise(\"Lone quantifier brackets\")\n }\n }\n if (state.maxBackReference > state.numCapturingParens) {\n state.raise(\"Invalid escape\")\n }\n for (const name of state.backReferenceNames) {\n if (state.groupNames.indexOf(name) === -1) {\n state.raise(\"Invalid named capture referenced\")\n }\n }\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction\npp.regexp_disjunction = function(state) {\n this.regexp_alternative(state)\n while (state.eat(0x7C /* | */)) {\n this.regexp_alternative(state)\n }\n\n // Make the same message as V8.\n if (this.regexp_eatQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\")\n }\n if (state.eat(0x7B /* { */)) {\n state.raise(\"Lone quantifier brackets\")\n }\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative\npp.regexp_alternative = function(state) {\n while (state.pos < state.source.length && this.regexp_eatTerm(state))\n ;\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term\npp.regexp_eatTerm = function(state) {\n if (this.regexp_eatAssertion(state)) {\n // Handle `QuantifiableAssertion Quantifier` alternative.\n // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion\n // is a QuantifiableAssertion.\n if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {\n // Make the same message as V8.\n if (state.switchU) {\n state.raise(\"Invalid quantifier\")\n }\n }\n return true\n }\n\n if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {\n this.regexp_eatQuantifier(state)\n return true\n }\n\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion\npp.regexp_eatAssertion = function(state) {\n const start = state.pos\n state.lastAssertionIsQuantifiable = false\n\n // ^, $\n if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {\n return true\n }\n\n // \\b \\B\n if (state.eat(0x5C /* \\ */)) {\n if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {\n return true\n }\n state.pos = start\n }\n\n // Lookahead / Lookbehind\n if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {\n let lookbehind = false\n if (this.options.ecmaVersion >= 9) {\n lookbehind = state.eat(0x3C /* < */)\n }\n if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {\n this.regexp_disjunction(state)\n if (!state.eat(0x29 /* ) */)) {\n state.raise(\"Unterminated group\")\n }\n state.lastAssertionIsQuantifiable = !lookbehind\n return true\n }\n }\n\n state.pos = start\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier\npp.regexp_eatQuantifier = function(state, noError = false) {\n if (this.regexp_eatQuantifierPrefix(state, noError)) {\n state.eat(0x3F /* ? */)\n return true\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix\npp.regexp_eatQuantifierPrefix = function(state, noError) {\n return (\n state.eat(0x2A /* * */) ||\n state.eat(0x2B /* + */) ||\n state.eat(0x3F /* ? */) ||\n this.regexp_eatBracedQuantifier(state, noError)\n )\n}\npp.regexp_eatBracedQuantifier = function(state, noError) {\n const start = state.pos\n if (state.eat(0x7B /* { */)) {\n let min = 0, max = -1\n if (this.regexp_eatDecimalDigits(state)) {\n min = state.lastIntValue\n if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {\n max = state.lastIntValue\n }\n if (state.eat(0x7D /* } */)) {\n // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term\n if (max !== -1 && max < min && !noError) {\n state.raise(\"numbers out of order in {} quantifier\")\n }\n return true\n }\n }\n if (state.switchU && !noError) {\n state.raise(\"Incomplete quantifier\")\n }\n state.pos = start\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom\npp.regexp_eatAtom = function(state) {\n return (\n this.regexp_eatPatternCharacters(state) ||\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state)\n )\n}\npp.regexp_eatReverseSolidusAtomEscape = function(state) {\n const start = state.pos\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatAtomEscape(state)) {\n return true\n }\n state.pos = start\n }\n return false\n}\npp.regexp_eatUncapturingGroup = function(state) {\n const start = state.pos\n if (state.eat(0x28 /* ( */)) {\n if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {\n this.regexp_disjunction(state)\n if (state.eat(0x29 /* ) */)) {\n return true\n }\n state.raise(\"Unterminated group\")\n }\n state.pos = start\n }\n return false\n}\npp.regexp_eatCapturingGroup = function(state) {\n if (state.eat(0x28 /* ( */)) {\n if (this.options.ecmaVersion >= 9) {\n this.regexp_groupSpecifier(state)\n } else if (state.current() === 0x3F /* ? */) {\n state.raise(\"Invalid group\")\n }\n this.regexp_disjunction(state)\n if (state.eat(0x29 /* ) */)) {\n state.numCapturingParens += 1\n return true\n }\n state.raise(\"Unterminated group\")\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom\npp.regexp_eatExtendedAtom = function(state) {\n return (\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state) ||\n this.regexp_eatInvalidBracedQuantifier(state) ||\n this.regexp_eatExtendedPatternCharacter(state)\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier\npp.regexp_eatInvalidBracedQuantifier = function(state) {\n if (this.regexp_eatBracedQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\")\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter\npp.regexp_eatSyntaxCharacter = function(state) {\n const ch = state.current()\n if (isSyntaxCharacter(ch)) {\n state.lastIntValue = ch\n state.advance()\n return true\n }\n return false\n}\nfunction isSyntaxCharacter(ch) {\n return (\n ch === 0x24 /* $ */ ||\n ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||\n ch === 0x2E /* . */ ||\n ch === 0x3F /* ? */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter\n// But eat eager.\npp.regexp_eatPatternCharacters = function(state) {\n const start = state.pos\n let ch = 0\n while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {\n state.advance()\n }\n return state.pos !== start\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter\npp.regexp_eatExtendedPatternCharacter = function(state) {\n const ch = state.current()\n if (\n ch !== -1 &&\n ch !== 0x24 /* $ */ &&\n !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&\n ch !== 0x2E /* . */ &&\n ch !== 0x3F /* ? */ &&\n ch !== 0x5B /* [ */ &&\n ch !== 0x5E /* ^ */ &&\n ch !== 0x7C /* | */\n ) {\n state.advance()\n return true\n }\n return false\n}\n\n// GroupSpecifier[U] ::\n// [empty]\n// `?` GroupName[?U]\npp.regexp_groupSpecifier = function(state) {\n if (state.eat(0x3F /* ? */)) {\n if (this.regexp_eatGroupName(state)) {\n if (state.groupNames.indexOf(state.lastStringValue) !== -1) {\n state.raise(\"Duplicate capture group name\")\n }\n state.groupNames.push(state.lastStringValue)\n return\n }\n state.raise(\"Invalid group\")\n }\n}\n\n// GroupName[U] ::\n// `<` RegExpIdentifierName[?U] `>`\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp.regexp_eatGroupName = function(state) {\n state.lastStringValue = \"\"\n if (state.eat(0x3C /* < */)) {\n if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {\n return true\n }\n state.raise(\"Invalid capture group name\")\n }\n return false\n}\n\n// RegExpIdentifierName[U] ::\n// RegExpIdentifierStart[?U]\n// RegExpIdentifierName[?U] RegExpIdentifierPart[?U]\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp.regexp_eatRegExpIdentifierName = function(state) {\n state.lastStringValue = \"\"\n if (this.regexp_eatRegExpIdentifierStart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue)\n while (this.regexp_eatRegExpIdentifierPart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue)\n }\n return true\n }\n return false\n}\n\n// RegExpIdentifierStart[U] ::\n// UnicodeIDStart\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[?U]\npp.regexp_eatRegExpIdentifierStart = function(state) {\n const start = state.pos\n let ch = state.current()\n state.advance()\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {\n ch = state.lastIntValue\n }\n if (isRegExpIdentifierStart(ch)) {\n state.lastIntValue = ch\n return true\n }\n\n state.pos = start\n return false\n}\nfunction isRegExpIdentifierStart(ch) {\n return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */\n}\n\n// RegExpIdentifierPart[U] ::\n// UnicodeIDContinue\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[?U]\n// \n// \npp.regexp_eatRegExpIdentifierPart = function(state) {\n const start = state.pos\n let ch = state.current()\n state.advance()\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {\n ch = state.lastIntValue\n }\n if (isRegExpIdentifierPart(ch)) {\n state.lastIntValue = ch\n return true\n }\n\n state.pos = start\n return false\n}\nfunction isRegExpIdentifierPart(ch) {\n return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* */ || ch === 0x200D /* */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape\npp.regexp_eatAtomEscape = function(state) {\n if (\n this.regexp_eatBackReference(state) ||\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state) ||\n (state.switchN && this.regexp_eatKGroupName(state))\n ) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n if (state.current() === 0x63 /* c */) {\n state.raise(\"Invalid unicode escape\")\n }\n state.raise(\"Invalid escape\")\n }\n return false\n}\npp.regexp_eatBackReference = function(state) {\n const start = state.pos\n if (this.regexp_eatDecimalEscape(state)) {\n const n = state.lastIntValue\n if (state.switchU) {\n // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape\n if (n > state.maxBackReference) {\n state.maxBackReference = n\n }\n return true\n }\n if (n <= state.numCapturingParens) {\n return true\n }\n state.pos = start\n }\n return false\n}\npp.regexp_eatKGroupName = function(state) {\n if (state.eat(0x6B /* k */)) {\n if (this.regexp_eatGroupName(state)) {\n state.backReferenceNames.push(state.lastStringValue)\n return true\n }\n state.raise(\"Invalid named reference\")\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape\npp.regexp_eatCharacterEscape = function(state) {\n return (\n this.regexp_eatControlEscape(state) ||\n this.regexp_eatCControlLetter(state) ||\n this.regexp_eatZero(state) ||\n this.regexp_eatHexEscapeSequence(state) ||\n this.regexp_eatRegExpUnicodeEscapeSequence(state) ||\n (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||\n this.regexp_eatIdentityEscape(state)\n )\n}\npp.regexp_eatCControlLetter = function(state) {\n const start = state.pos\n if (state.eat(0x63 /* c */)) {\n if (this.regexp_eatControlLetter(state)) {\n return true\n }\n state.pos = start\n }\n return false\n}\npp.regexp_eatZero = function(state) {\n if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {\n state.lastIntValue = 0\n state.advance()\n return true\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape\npp.regexp_eatControlEscape = function(state) {\n const ch = state.current()\n if (ch === 0x74 /* t */) {\n state.lastIntValue = 0x09 /* \\t */\n state.advance()\n return true\n }\n if (ch === 0x6E /* n */) {\n state.lastIntValue = 0x0A /* \\n */\n state.advance()\n return true\n }\n if (ch === 0x76 /* v */) {\n state.lastIntValue = 0x0B /* \\v */\n state.advance()\n return true\n }\n if (ch === 0x66 /* f */) {\n state.lastIntValue = 0x0C /* \\f */\n state.advance()\n return true\n }\n if (ch === 0x72 /* r */) {\n state.lastIntValue = 0x0D /* \\r */\n state.advance()\n return true\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter\npp.regexp_eatControlLetter = function(state) {\n const ch = state.current()\n if (isControlLetter(ch)) {\n state.lastIntValue = ch % 0x20\n state.advance()\n return true\n }\n return false\n}\nfunction isControlLetter(ch) {\n return (\n (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||\n (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence\npp.regexp_eatRegExpUnicodeEscapeSequence = function(state) {\n const start = state.pos\n\n if (state.eat(0x75 /* u */)) {\n if (this.regexp_eatFixedHexDigits(state, 4)) {\n const lead = state.lastIntValue\n if (state.switchU && lead >= 0xD800 && lead <= 0xDBFF) {\n const leadSurrogateEnd = state.pos\n if (state.eat(0x5C /* \\ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {\n const trail = state.lastIntValue\n if (trail >= 0xDC00 && trail <= 0xDFFF) {\n state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000\n return true\n }\n }\n state.pos = leadSurrogateEnd\n state.lastIntValue = lead\n }\n return true\n }\n if (\n state.switchU &&\n state.eat(0x7B /* { */) &&\n this.regexp_eatHexDigits(state) &&\n state.eat(0x7D /* } */) &&\n isValidUnicode(state.lastIntValue)\n ) {\n return true\n }\n if (state.switchU) {\n state.raise(\"Invalid unicode escape\")\n }\n state.pos = start\n }\n\n return false\n}\nfunction isValidUnicode(ch) {\n return ch >= 0 && ch <= 0x10FFFF\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape\npp.regexp_eatIdentityEscape = function(state) {\n if (state.switchU) {\n if (this.regexp_eatSyntaxCharacter(state)) {\n return true\n }\n if (state.eat(0x2F /* / */)) {\n state.lastIntValue = 0x2F /* / */\n return true\n }\n return false\n }\n\n const ch = state.current()\n if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {\n state.lastIntValue = ch\n state.advance()\n return true\n }\n\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape\npp.regexp_eatDecimalEscape = function(state) {\n state.lastIntValue = 0\n let ch = state.current()\n if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {\n do {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */)\n state.advance()\n } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)\n return true\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape\npp.regexp_eatCharacterClassEscape = function(state) {\n const ch = state.current()\n\n if (isCharacterClassEscape(ch)) {\n state.lastIntValue = -1\n state.advance()\n return true\n }\n\n if (\n state.switchU &&\n this.options.ecmaVersion >= 9 &&\n (ch === 0x50 /* P */ || ch === 0x70 /* p */)\n ) {\n state.lastIntValue = -1\n state.advance()\n if (\n state.eat(0x7B /* { */) &&\n this.regexp_eatUnicodePropertyValueExpression(state) &&\n state.eat(0x7D /* } */)\n ) {\n return true\n }\n state.raise(\"Invalid property name\")\n }\n\n return false\n}\nfunction isCharacterClassEscape(ch) {\n return (\n ch === 0x64 /* d */ ||\n ch === 0x44 /* D */ ||\n ch === 0x73 /* s */ ||\n ch === 0x53 /* S */ ||\n ch === 0x77 /* w */ ||\n ch === 0x57 /* W */\n )\n}\n\n// UnicodePropertyValueExpression ::\n// UnicodePropertyName `=` UnicodePropertyValue\n// LoneUnicodePropertyNameOrValue\npp.regexp_eatUnicodePropertyValueExpression = function(state) {\n const start = state.pos\n\n // UnicodePropertyName `=` UnicodePropertyValue\n if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {\n const name = state.lastStringValue\n if (this.regexp_eatUnicodePropertyValue(state)) {\n const value = state.lastStringValue\n this.regexp_validateUnicodePropertyNameAndValue(state, name, value)\n return true\n }\n }\n state.pos = start\n\n // LoneUnicodePropertyNameOrValue\n if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {\n const nameOrValue = state.lastStringValue\n this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)\n return true\n }\n return false\n}\npp.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {\n if (!UNICODE_PROPERTY_VALUES.hasOwnProperty(name) || UNICODE_PROPERTY_VALUES[name].indexOf(value) === -1) {\n state.raise(\"Invalid property name\")\n }\n}\npp.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {\n if (UNICODE_PROPERTY_VALUES.$LONE.indexOf(nameOrValue) === -1) {\n state.raise(\"Invalid property name\")\n }\n}\n\n// UnicodePropertyName ::\n// UnicodePropertyNameCharacters\npp.regexp_eatUnicodePropertyName = function(state) {\n let ch = 0\n state.lastStringValue = \"\"\n while (isUnicodePropertyNameCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch)\n state.advance()\n }\n return state.lastStringValue !== \"\"\n}\nfunction isUnicodePropertyNameCharacter(ch) {\n return isControlLetter(ch) || ch === 0x5F /* _ */\n}\n\n// UnicodePropertyValue ::\n// UnicodePropertyValueCharacters\npp.regexp_eatUnicodePropertyValue = function(state) {\n let ch = 0\n state.lastStringValue = \"\"\n while (isUnicodePropertyValueCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch)\n state.advance()\n }\n return state.lastStringValue !== \"\"\n}\nfunction isUnicodePropertyValueCharacter(ch) {\n return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)\n}\n\n// LoneUnicodePropertyNameOrValue ::\n// UnicodePropertyValueCharacters\npp.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {\n return this.regexp_eatUnicodePropertyValue(state)\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass\npp.regexp_eatCharacterClass = function(state) {\n if (state.eat(0x5B /* [ */)) {\n state.eat(0x5E /* ^ */)\n this.regexp_classRanges(state)\n if (state.eat(0x5D /* [ */)) {\n return true\n }\n // Unreachable since it threw \"unterminated regular expression\" error before.\n state.raise(\"Unterminated character class\")\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash\npp.regexp_classRanges = function(state) {\n while (this.regexp_eatClassAtom(state)) {\n const left = state.lastIntValue\n if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {\n const right = state.lastIntValue\n if (state.switchU && (left === -1 || right === -1)) {\n state.raise(\"Invalid character class\")\n }\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\")\n }\n }\n }\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash\npp.regexp_eatClassAtom = function(state) {\n const start = state.pos\n\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatClassEscape(state)) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n const ch = state.current()\n if (ch === 0x63 /* c */ || isOctalDigit(ch)) {\n state.raise(\"Invalid class escape\")\n }\n state.raise(\"Invalid escape\")\n }\n state.pos = start\n }\n\n const ch = state.current()\n if (ch !== 0x5D /* [ */) {\n state.lastIntValue = ch\n state.advance()\n return true\n }\n\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape\npp.regexp_eatClassEscape = function(state) {\n const start = state.pos\n\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08 /* */\n return true\n }\n\n if (state.switchU && state.eat(0x2D /* - */)) {\n state.lastIntValue = 0x2D /* - */\n return true\n }\n\n if (!state.switchU && state.eat(0x63 /* c */)) {\n if (this.regexp_eatClassControlLetter(state)) {\n return true\n }\n state.pos = start\n }\n\n return (\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state)\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter\npp.regexp_eatClassControlLetter = function(state) {\n const ch = state.current()\n if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {\n state.lastIntValue = ch % 0x20\n state.advance()\n return true\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp.regexp_eatHexEscapeSequence = function(state) {\n const start = state.pos\n if (state.eat(0x78 /* x */)) {\n if (this.regexp_eatFixedHexDigits(state, 2)) {\n return true\n }\n if (state.switchU) {\n state.raise(\"Invalid escape\")\n }\n state.pos = start\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits\npp.regexp_eatDecimalDigits = function(state) {\n const start = state.pos\n let ch = 0\n state.lastIntValue = 0\n while (isDecimalDigit(ch = state.current())) {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */)\n state.advance()\n }\n return state.pos !== start\n}\nfunction isDecimalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits\npp.regexp_eatHexDigits = function(state) {\n const start = state.pos\n let ch = 0\n state.lastIntValue = 0\n while (isHexDigit(ch = state.current())) {\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch)\n state.advance()\n }\n return state.pos !== start\n}\nfunction isHexDigit(ch) {\n return (\n (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||\n (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||\n (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)\n )\n}\nfunction hexToInt(ch) {\n if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {\n return 10 + (ch - 0x41 /* A */)\n }\n if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {\n return 10 + (ch - 0x61 /* a */)\n }\n return ch - 0x30 /* 0 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence\n// Allows only 0-377(octal) i.e. 0-255(decimal).\npp.regexp_eatLegacyOctalEscapeSequence = function(state) {\n if (this.regexp_eatOctalDigit(state)) {\n const n1 = state.lastIntValue\n if (this.regexp_eatOctalDigit(state)) {\n const n2 = state.lastIntValue\n if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {\n state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue\n } else {\n state.lastIntValue = n1 * 8 + n2\n }\n } else {\n state.lastIntValue = n1\n }\n return true\n }\n return false\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit\npp.regexp_eatOctalDigit = function(state) {\n const ch = state.current()\n if (isOctalDigit(ch)) {\n state.lastIntValue = ch - 0x30 /* 0 */\n state.advance()\n return true\n }\n state.lastIntValue = 0\n return false\n}\nfunction isOctalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit\n// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp.regexp_eatFixedHexDigits = function(state, length) {\n const start = state.pos\n state.lastIntValue = 0\n for (let i = 0; i < length; ++i) {\n const ch = state.current()\n if (!isHexDigit(ch)) {\n state.pos = start\n return false\n }\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch)\n state.advance()\n }\n return true\n}\n","import {isIdentifierStart, isIdentifierChar} from \"./identifier\"\nimport {types as tt, keywords as keywordTypes} from \"./tokentype\"\nimport {Parser} from \"./state\"\nimport {SourceLocation} from \"./locutil\"\nimport {RegExpValidationState} from \"./regexp\"\nimport {lineBreak, lineBreakG, isNewLine, nonASCIIwhitespace} from \"./whitespace\"\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nexport class Token {\n constructor(p) {\n this.type = p.type\n this.value = p.value\n this.start = p.start\n this.end = p.end\n if (p.options.locations)\n this.loc = new SourceLocation(p, p.startLoc, p.endLoc)\n if (p.options.ranges)\n this.range = [p.start, p.end]\n }\n}\n\n// ## Tokenizer\n\nconst pp = Parser.prototype\n\n// Move to the next token\n\npp.next = function() {\n if (this.options.onToken)\n this.options.onToken(new Token(this))\n\n this.lastTokEnd = this.end\n this.lastTokStart = this.start\n this.lastTokEndLoc = this.endLoc\n this.lastTokStartLoc = this.startLoc\n this.nextToken()\n}\n\npp.getToken = function() {\n this.next()\n return new Token(this)\n}\n\n// If we're in an ES6 environment, make parsers iterable\nif (typeof Symbol !== \"undefined\")\n pp[Symbol.iterator] = function() {\n return {\n next: () => {\n let token = this.getToken()\n return {\n done: token.type === tt.eof,\n value: token\n }\n }\n }\n }\n\n// Toggle strict mode. Re-reads the next number or string to please\n// pedantic tests (`\"use strict\"; 010;` should fail).\n\npp.curContext = function() {\n return this.context[this.context.length - 1]\n}\n\n// Read a single token, updating the parser object's token-related\n// properties.\n\npp.nextToken = function() {\n let curContext = this.curContext()\n if (!curContext || !curContext.preserveSpace) this.skipSpace()\n\n this.start = this.pos\n if (this.options.locations) this.startLoc = this.curPosition()\n if (this.pos >= this.input.length) return this.finishToken(tt.eof)\n\n if (curContext.override) return curContext.override(this)\n else this.readToken(this.fullCharCodeAtPos())\n}\n\npp.readToken = function(code) {\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\n // identifiers, so '\\' also dispatches to that.\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\n return this.readWord()\n\n return this.getTokenFromCode(code)\n}\n\npp.fullCharCodeAtPos = function() {\n let code = this.input.charCodeAt(this.pos)\n if (code <= 0xd7ff || code >= 0xe000) return code\n let next = this.input.charCodeAt(this.pos + 1)\n return (code << 10) + next - 0x35fdc00\n}\n\npp.skipBlockComment = function() {\n let startLoc = this.options.onComment && this.curPosition()\n let start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2)\n if (end === -1) this.raise(this.pos - 2, \"Unterminated comment\")\n this.pos = end + 2\n if (this.options.locations) {\n lineBreakG.lastIndex = start\n let match\n while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {\n ++this.curLine\n this.lineStart = match.index + match[0].length\n }\n }\n if (this.options.onComment)\n this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\n startLoc, this.curPosition())\n}\n\npp.skipLineComment = function(startSkip) {\n let start = this.pos\n let startLoc = this.options.onComment && this.curPosition()\n let ch = this.input.charCodeAt(this.pos += startSkip)\n while (this.pos < this.input.length && !isNewLine(ch)) {\n ch = this.input.charCodeAt(++this.pos)\n }\n if (this.options.onComment)\n this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\n startLoc, this.curPosition())\n}\n\n// Called at the start of the parse and after every token. Skips\n// whitespace and comments, and.\n\npp.skipSpace = function() {\n loop: while (this.pos < this.input.length) {\n let ch = this.input.charCodeAt(this.pos)\n switch (ch) {\n case 32: case 160: // ' '\n ++this.pos\n break\n case 13:\n if (this.input.charCodeAt(this.pos + 1) === 10) {\n ++this.pos\n }\n case 10: case 8232: case 8233:\n ++this.pos\n if (this.options.locations) {\n ++this.curLine\n this.lineStart = this.pos\n }\n break\n case 47: // '/'\n switch (this.input.charCodeAt(this.pos + 1)) {\n case 42: // '*'\n this.skipBlockComment()\n break\n case 47:\n this.skipLineComment(2)\n break\n default:\n break loop\n }\n break\n default:\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\n ++this.pos\n } else {\n break loop\n }\n }\n }\n}\n\n// Called at the end of every token. Sets `end`, `val`, and\n// maintains `context` and `exprAllowed`, and skips the space after\n// the token, so that the next one's `start` will point at the\n// right position.\n\npp.finishToken = function(type, val) {\n this.end = this.pos\n if (this.options.locations) this.endLoc = this.curPosition()\n let prevType = this.type\n this.type = type\n this.value = val\n\n this.updateContext(prevType)\n}\n\n// ### Token reading\n\n// This is the function that is called to fetch the next token. It\n// is somewhat obscure, because it works in character codes rather\n// than characters, and because operator parsing has been inlined\n// into it.\n//\n// All in the name of speed.\n//\npp.readToken_dot = function() {\n let next = this.input.charCodeAt(this.pos + 1)\n if (next >= 48 && next <= 57) return this.readNumber(true)\n let next2 = this.input.charCodeAt(this.pos + 2)\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\n this.pos += 3\n return this.finishToken(tt.ellipsis)\n } else {\n ++this.pos\n return this.finishToken(tt.dot)\n }\n}\n\npp.readToken_slash = function() { // '/'\n let next = this.input.charCodeAt(this.pos + 1)\n if (this.exprAllowed) { ++this.pos; return this.readRegexp() }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.slash, 1)\n}\n\npp.readToken_mult_modulo_exp = function(code) { // '%*'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n let tokentype = code === 42 ? tt.star : tt.modulo\n\n // exponentiation operator ** and **=\n if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {\n ++size\n tokentype = tt.starstar\n next = this.input.charCodeAt(this.pos + 2)\n }\n\n if (next === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tokentype, size)\n}\n\npp.readToken_pipe_amp = function(code) { // '|&'\n let next = this.input.charCodeAt(this.pos + 1)\n if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2)\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1)\n}\n\npp.readToken_caret = function() { // '^'\n let next = this.input.charCodeAt(this.pos + 1)\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.bitwiseXOR, 1)\n}\n\npp.readToken_plus_min = function(code) { // '+-'\n let next = this.input.charCodeAt(this.pos + 1)\n if (next === code) {\n if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&\n (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {\n // A `-->` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // ` \ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 11, 2017._ \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/write/index.js b/tools/node_modules/eslint/node_modules/write/index.js index f952638d0d4520..b2b4b4380a359c 100644 --- a/tools/node_modules/eslint/node_modules/write/index.js +++ b/tools/node_modules/eslint/node_modules/write/index.js @@ -1,93 +1,160 @@ /*! * write * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. */ 'use strict'; var fs = require('fs'); var path = require('path'); -var mkdir = require('mkdirp'); +var mkdirp = require('mkdirp'); /** - * Asynchronously write a file to disk. Creates any intermediate - * directories if they don't already exist. + * Asynchronously writes data to a file, replacing the file if it already + * exists and creating any intermediate directories if they don't already + * exist. Data can be a string or a buffer. Returns a promise if a callback + * function is not passed. * * ```js * var writeFile = require('write'); - * writeFile('foo.txt', 'This is content to write.', function(err) { + * writeFile('foo.txt', 'This is content...', function(err) { * if (err) console.log(err); * }); + * + * // promise + * writeFile('foo.txt', 'This is content...') + * .then(function() { + * // do stuff + * }); * ``` + * @name writeFile + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {string|Buffer|Uint8Array} `data` String to write to disk. + * @param {object} `options` Options to pass to [fs.writeFile][fs]{#fs_fs_writefile_file_data_options_callback} and/or [mkdirp][] + * @param {Function} `callback` (optional) If no callback is provided, a promise is returned. + * @api public + */ + +function writeFile(filepath, data, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (typeof cb !== 'function') { + return writeFile.promise.apply(null, arguments); + } + + if (typeof filepath !== 'string') { + cb(new TypeError('expected filepath to be a string')); + return; + } + + mkdirp(path.dirname(filepath), options, function(err) { + if (err) { + cb(err); + return; + } + fs.writeFile(filepath, data, options, cb); + }); +}; + +/** + * The promise version of [writeFile](#writefile). Returns a promise. * - * @name writeFile - * @param {String} `dest` Destination file path - * @param {String} `str` String to write to disk. - * @param {Function} `callback` + * ```js + * var writeFile = require('write'); + * writeFile.promise('foo.txt', 'This is content...') + * .then(function() { + * // do stuff + * }); + * ``` + * @name .promise + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {string|Buffer|Uint8Array} `val` String or buffer to write to disk. + * @param {object} `options` Options to pass to [fs.writeFile][fs]{#fs_fs_writefile_file_data_options_callback} and/or [mkdirp][] + * @return {Promise} * @api public */ -module.exports = function writeFile(dest, str, cb) { - var dir = path.dirname(dest); - fs.exists(dir, function (exists) { - if (exists) { - fs.writeFile(dest, str, cb); - } else { - mkdir(dir, function (err) { +writeFile.promise = function(filepath, val, options) { + if (typeof filepath !== 'string') { + return Promise.reject(new TypeError('expected filepath to be a string')); + } + + return new Promise(function(resolve, reject) { + mkdirp(path.dirname(filepath), options, function(err) { + if (err) { + reject(err); + return; + } + + fs.writeFile(filepath, val, options, function(err) { if (err) { - return cb(err); - } else { - fs.writeFile(dest, str, cb); + reject(err); + return; } + resolve(val); }); - } + }); }); }; /** - * Synchronously write files to disk. Creates any intermediate - * directories if they don't already exist. + * The synchronous version of [writeFile](#writefile). Returns undefined. * * ```js * var writeFile = require('write'); - * writeFile.sync('foo.txt', 'This is content to write.'); + * writeFile.sync('foo.txt', 'This is content...'); * ``` - * - * @name writeFile.sync - * @param {String} `dest` Destination file path - * @param {String} `str` String to write to disk. + * @name .sync + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {string|Buffer|Uint8Array} `data` String or buffer to write to disk. + * @param {object} `options` Options to pass to [fs.writeFileSync][fs]{#fs_fs_writefilesync_file_data_options} and/or [mkdirp][] + * @return {undefined} * @api public */ -module.exports.sync = function writeFileSync(dest, str) { - var dir = path.dirname(dest); - if (!fs.existsSync(dir)) { - mkdir.sync(dir); +writeFile.sync = function(filepath, data, options) { + if (typeof filepath !== 'string') { + throw new TypeError('expected filepath to be a string'); } - fs.writeFileSync(dest, str); + mkdirp.sync(path.dirname(filepath), options); + fs.writeFileSync(filepath, data, options); }; /** - * Uses `fs.createWriteStream`, but also creates any intermediate - * directories if they don't already exist. + * Uses `fs.createWriteStream` to write data to a file, replacing the + * file if it already exists and creating any intermediate directories + * if they don't already exist. Data can be a string or a buffer. Returns + * a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) + * object. * * ```js - * var write = require('write'); - * write.stream('foo.txt'); + * var fs = require('fs'); + * var writeFile = require('write'); + * fs.createReadStream('README.md') + * .pipe(writeFile.stream('a/b/c/other-file.md')) + * .on('close', function() { + * // do stuff + * }); * ``` - * - * @name writeFile.stream - * @param {String} `dest` Destination file path - * @return {Stream} Returns a write stream. + * @name .stream + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {object} `options` Options to pass to [mkdirp][] and [fs.createWriteStream][fs]{#fs_fs_createwritestream_path_options} + * @return {Stream} Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. (See [Writable Stream](https://nodejs.org/api/stream.html#stream_class_stream_writable)). * @api public */ -module.exports.stream = function writeFileStream(dest) { - var dir = path.dirname(dest); - if (!fs.existsSync(dir)) { - mkdir.sync(dir); - } - return fs.createWriteStream(dest); +writeFile.stream = function(filepath, options) { + mkdirp.sync(path.dirname(filepath), options); + return fs.createWriteStream(filepath, options); }; + +/** + * Expose `writeFile` + */ + +module.exports = writeFile; diff --git a/tools/node_modules/eslint/node_modules/write/package.json b/tools/node_modules/eslint/node_modules/write/package.json index dd3dc91a5b3796..4805b30afd5c42 100644 --- a/tools/node_modules/eslint/node_modules/write/package.json +++ b/tools/node_modules/eslint/node_modules/write/package.json @@ -7,19 +7,29 @@ "url": "https://github.com/jonschlinkert/write/issues" }, "bundleDependencies": false, + "contributors": [ + { + "name": "Charlike Mike Reagent", + "url": "https://i.am.charlike.online" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + } + ], "dependencies": { "mkdirp": "^0.5.1" }, "deprecated": false, - "description": "Write files to disk, creating intermediate directories if they don't exist.", + "description": "Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods.", "devDependencies": { - "async": "^1.4.0", - "delete": "^0.2.1", - "mocha": "^2.2.5", - "should": "^7.0.2" + "async-each": "^1.0.1", + "delete": "^1.1.0", + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -47,5 +57,32 @@ "scripts": { "test": "mocha" }, - "version": "0.2.1" + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "delete", + "read-data", + "read-yaml", + "write-data", + "write-json", + "write-yaml" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.3" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 4ef338ee35b850..316fa200c454e7 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -12,30 +12,30 @@ "bundleDependencies": false, "dependencies": { "@babel/code-frame": "^7.0.0", - "ajv": "^6.5.3", + "ajv": "^6.9.1", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", "debug": "^4.0.1", - "doctrine": "^2.1.0", + "doctrine": "^3.0.0", "eslint-plugin-markdown": "^1.0.0-rc.1", "eslint-scope": "^4.0.0", "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", - "espree": "^5.0.0", + "espree": "^5.0.1", "esquery": "^1.0.1", "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", + "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", "globals": "^11.7.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^6.1.0", + "inquirer": "^6.2.2", "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.5", + "lodash": "^4.17.11", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", @@ -46,21 +46,22 @@ "semver": "^5.5.1", "strip-ansi": "^4.0.0", "strip-json-comments": "^2.0.1", - "table": "^5.0.2", + "table": "^5.2.3", "text-table": "^0.2.0" }, "deprecated": false, "description": "An AST-based pattern checker for JavaScript.", "devDependencies": { - "babel-core": "^6.26.3", - "babel-polyfill": "^6.26.0", - "babel-preset-es2015": "^6.24.1", - "babelify": "^8.0.0", + "@babel/core": "^7.2.2", + "@babel/polyfill": "^7.2.5", + "@babel/preset-env": "^7.3.1", + "babelify": "^10.0.0", "beefy": "^2.1.8", "brfs": "^2.0.0", "browserify": "^16.2.2", "chai": "^4.0.1", "cheerio": "^0.22.0", + "common-tags": "^1.8.0", "coveralls": "^3.0.1", "dateformat": "^3.0.3", "ejs": "^2.6.1", @@ -69,26 +70,26 @@ "eslint-plugin-rulesdir": "^0.1.0", "eslint-release": "^1.2.0", "eslint-rule-composer": "^0.3.0", - "eslump": "^1.6.2", + "eslump": "^2.0.0", "esprima": "^4.0.1", "istanbul": "^0.4.5", "jsdoc": "^3.5.5", - "karma": "^3.0.0", - "karma-babel-preprocessor": "^7.0.0", + "karma": "^3.1.4", + "karma-babel-preprocessor": "^8.0.0", "karma-chrome-launcher": "^2.2.0", "karma-mocha": "^1.3.0", "karma-mocha-reporter": "^2.2.3", "leche": "^2.2.3", "load-perf": "^0.2.0", - "markdownlint": "^0.11.0", + "markdownlint": "^0.12.0", "mocha": "^5.0.5", - "mock-fs": "^4.6.0", + "mock-fs": "^4.8.0", "npm-license": "^0.3.3", "proxyquire": "^2.0.1", - "puppeteer": "^1.9.0", + "puppeteer": "^1.12.2", "shelljs": "^0.8.2", "sinon": "^3.3.0", - "temp": "^0.8.3", + "temp": "^0.9.0", "through": "^2.3.8" }, "engines": { @@ -133,5 +134,5 @@ "publish-release": "node Makefile.js publishRelease", "test": "node Makefile.js test" }, - "version": "5.13.0" + "version": "5.14.0" } \ No newline at end of file From e6949b4241b518ab223ff39a3b74a02f22b7994b Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Thu, 14 Feb 2019 23:12:43 +0800 Subject: [PATCH 036/213] src: apply clang-tidy rule modernize-use-override PR-URL: https://github.com/nodejs/node/pull/26103 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- src/async_wrap.h | 4 ++-- src/base_object.h | 2 +- src/cares_wrap.cc | 2 +- src/inspector/main_thread_interface.cc | 2 +- src/inspector_agent.cc | 2 +- src/inspector_io.cc | 2 +- src/inspector_socket_server.cc | 2 +- src/module_wrap.h | 2 +- src/node.h | 2 +- src/node_api.cc | 4 ++-- src/node_contextify.h | 2 +- src/node_crypto_bio.h | 2 +- src/node_file.h | 2 +- src/node_internals.h | 6 +++--- src/node_messaging.h | 4 ++-- src/node_options.h | 8 ++++---- src/node_platform.h | 4 ++-- src/node_serdes.cc | 4 ++-- src/node_worker.h | 2 +- src/stream_base.h | 2 +- src/stream_pipe.h | 2 +- src/tracing/node_trace_buffer.h | 2 +- src/tracing/node_trace_writer.h | 2 +- test/cctest/node_test_fixture.h | 4 ++-- test/cctest/test_environment.cc | 2 +- test/cctest/test_inspector_socket.cc | 6 +++--- test/cctest/test_inspector_socket_server.cc | 2 +- 27 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/async_wrap.h b/src/async_wrap.h index f7fc149c941ef0..6d5da4e4ee16db 100644 --- a/src/async_wrap.h +++ b/src/async_wrap.h @@ -109,7 +109,7 @@ class AsyncWrap : public BaseObject { ProviderType provider, double execution_async_id = -1); - virtual ~AsyncWrap(); + ~AsyncWrap() override; static v8::Local GetConstructorTemplate( Environment* env); @@ -169,7 +169,7 @@ class AsyncWrap : public BaseObject { v8::Local* argv); virtual std::string diagnostic_name() const; - virtual std::string MemoryInfoName() const; + std::string MemoryInfoName() const override; static void WeakCallback(const v8::WeakCallbackInfo &info); diff --git a/src/base_object.h b/src/base_object.h index e0f3f27950e7d0..090bb70aebeaf8 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -38,7 +38,7 @@ class BaseObject : public MemoryRetainer { // Associates this object with `object`. It uses the 0th internal field for // that, and in particular aborts if there is no such field. inline BaseObject(Environment* env, v8::Local object); - virtual inline ~BaseObject(); + inline ~BaseObject() override; // Returns the wrapped object. Returns an empty handle when // persistent.IsEmpty() is true. diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index de05123c22cf4a..91226ebdf7c4fb 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -149,7 +149,7 @@ using node_ares_task_list = class ChannelWrap : public AsyncWrap { public: ChannelWrap(Environment* env, Local object); - ~ChannelWrap(); + ~ChannelWrap() override; static void New(const FunctionCallbackInfo& args); diff --git a/src/inspector/main_thread_interface.cc b/src/inspector/main_thread_interface.cc index 25b6270e412464..25a82864c1ee3a 100644 --- a/src/inspector/main_thread_interface.cc +++ b/src/inspector/main_thread_interface.cc @@ -42,7 +42,7 @@ class CreateObjectRequest : public Request { CreateObjectRequest(int object_id, Factory factory) : object_id_(object_id), factory_(std::move(factory)) {} - void Call(MainThreadInterface* thread) { + void Call(MainThreadInterface* thread) override { thread->AddObject(object_id_, WrapInDeletable(factory_(thread))); } diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index ef5646eb56695f..15edf7f00c3ecd 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -228,7 +228,7 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel, worker_agent_->Wire(node_dispatcher_.get()); } - virtual ~ChannelImpl() { + ~ChannelImpl() override { tracing_agent_->disable(); tracing_agent_.reset(); // Dispose before the dispatchers worker_agent_->disable(); diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 7686294b2e2842..42643fa6f6d3d6 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -215,7 +215,7 @@ class InspectorIoDelegate: public node::inspector::SocketServerDelegate { const std::string& target_id, const std::string& script_path, const std::string& script_name); - ~InspectorIoDelegate() { + ~InspectorIoDelegate() override { } void StartSession(int session_id, const std::string& target_id) override; diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc index 5e77ff5b3f403a..7ddbcd38fe299d 100644 --- a/src/inspector_socket_server.cc +++ b/src/inspector_socket_server.cc @@ -184,7 +184,7 @@ class SocketSession { public: Delegate(InspectorSocketServer* server, int session_id) : server_(server), session_id_(session_id) { } - ~Delegate() { + ~Delegate() override { server_->SessionTerminated(session_id_); } void OnHttpGet(const std::string& host, const std::string& path) override; diff --git a/src/module_wrap.h b/src/module_wrap.h index 6d231631d6a69e..372e02bc5d1b83 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -61,7 +61,7 @@ class ModuleWrap : public BaseObject { v8::Local object, v8::Local module, v8::Local url); - ~ModuleWrap(); + ~ModuleWrap() override; static void New(const v8::FunctionCallbackInfo& args); static void Link(const v8::FunctionCallbackInfo& args); diff --git a/src/node.h b/src/node.h index 0bdd37421b150e..53fb5fb51a9b93 100644 --- a/src/node.h +++ b/src/node.h @@ -220,7 +220,7 @@ class Environment; class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { public: - virtual ~MultiIsolatePlatform() { } + ~MultiIsolatePlatform() override { } // Returns true if work was dispatched or executed. New tasks that are // posted during flushing of the queue are postponed until the next // flushing. diff --git a/src/node_api.cc b/src/node_api.cc index 282ef255dcaab4..4e1a779c42e6f6 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -134,7 +134,7 @@ class ThreadSafeFunction : public node::AsyncResource { env->Ref(); } - ~ThreadSafeFunction() { + ~ThreadSafeFunction() override { node::RemoveEnvironmentCleanupHook(env->isolate, Cleanup, this); env->Unref(); } @@ -839,7 +839,7 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork { _complete(complete) { } - virtual ~Work() { } + ~Work() override { } public: static Work* New(node_napi_env env, diff --git a/src/node_contextify.h b/src/node_contextify.h index 71c4bfc0d61f5a..631671cbf1a161 100644 --- a/src/node_contextify.h +++ b/src/node_contextify.h @@ -108,7 +108,7 @@ class ContextifyScript : public BaseObject { SET_SELF_SIZE(ContextifyScript) ContextifyScript(Environment* env, v8::Local object); - ~ContextifyScript(); + ~ContextifyScript() override; static void Init(Environment* env, v8::Local target); static void New(const v8::FunctionCallbackInfo& args); diff --git a/src/node_crypto_bio.h b/src/node_crypto_bio.h index b7f1d4f169edfe..ef7012ba728eb5 100644 --- a/src/node_crypto_bio.h +++ b/src/node_crypto_bio.h @@ -40,7 +40,7 @@ namespace crypto { // (a.k.a. std::unique_ptr). class NodeBIO : public MemoryRetainer { public: - ~NodeBIO(); + ~NodeBIO() override; static BIOPointer New(Environment* env = nullptr); diff --git a/src/node_file.h b/src/node_file.h index 034e3c0427da3d..f0c8f1dfbf6777 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -357,7 +357,7 @@ class FileHandle : public AsyncWrap, public StreamBase { static FileHandle* New(Environment* env, int fd, v8::Local obj = v8::Local()); - virtual ~FileHandle(); + ~FileHandle() override; static void New(const v8::FunctionCallbackInfo& args); diff --git a/src/node_internals.h b/src/node_internals.h index c94be6ebe9155d..6cbad8959415aa 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -105,10 +105,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: inline uint32_t* zero_fill_field() { return &zero_fill_field_; } - virtual void* Allocate(size_t size); // Defined in src/node.cc - virtual void* AllocateUninitialized(size_t size) + void* Allocate(size_t size) override; // Defined in src/node.cc + void* AllocateUninitialized(size_t size) override { return node::UncheckedMalloc(size); } - virtual void Free(void* data, size_t) { free(data); } + void Free(void* data, size_t) override { free(data); } private: uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land. diff --git a/src/node_messaging.h b/src/node_messaging.h index 3c79e24f24b896..e1ced4f3fdedd8 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -78,7 +78,7 @@ class Message : public MemoryRetainer { class MessagePortData : public MemoryRetainer { public: explicit MessagePortData(MessagePort* owner); - ~MessagePortData(); + ~MessagePortData() override; MessagePortData(MessagePortData&& other) = delete; MessagePortData& operator=(MessagePortData&& other) = delete; @@ -138,7 +138,7 @@ class MessagePort : public HandleWrap { MessagePort(Environment* env, v8::Local context, v8::Local wrap); - ~MessagePort(); + ~MessagePort() override; // Create a new message port instance, optionally over an existing // `MessagePortData` object. diff --git a/src/node_options.h b/src/node_options.h index 4a53c5694eee21..4831bde121febc 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -89,7 +89,7 @@ class DebugOptions : public Options { return break_first_line || break_node_first_line; } - void CheckOptions(std::vector* errors); + void CheckOptions(std::vector* errors) override; }; class EnvironmentOptions : public Options { @@ -135,7 +135,7 @@ class EnvironmentOptions : public Options { inline DebugOptions* get_debug_options(); inline const DebugOptions& debug_options() const; - void CheckOptions(std::vector* errors); + void CheckOptions(std::vector* errors) override; private: DebugOptions debug_options_; @@ -156,7 +156,7 @@ class PerIsolateOptions : public Options { bool report_verbose; #endif // NODE_REPORT inline EnvironmentOptions* get_per_env_options(); - void CheckOptions(std::vector* errors); + void CheckOptions(std::vector* errors) override; }; class PerProcessOptions : public Options { @@ -202,7 +202,7 @@ class PerProcessOptions : public Options { #endif // NODE_REPORT inline PerIsolateOptions* get_per_isolate_options(); - void CheckOptions(std::vector* errors); + void CheckOptions(std::vector* errors) override; }; // The actual options parser, as opposed to the structs containing them: diff --git a/src/node_platform.h b/src/node_platform.h index 1308d4df6aa249..ec48296b31e16b 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -56,7 +56,7 @@ class PerIsolatePlatformData : public std::enable_shared_from_this { public: PerIsolatePlatformData(v8::Isolate* isolate, uv_loop_t* loop); - ~PerIsolatePlatformData(); + ~PerIsolatePlatformData() override; void PostTask(std::unique_ptr task) override; void PostIdleTask(std::unique_ptr task) override; @@ -123,7 +123,7 @@ class NodePlatform : public MultiIsolatePlatform { public: NodePlatform(int thread_pool_size, node::tracing::TracingController* tracing_controller); - virtual ~NodePlatform() {} + ~NodePlatform() override {} void DrainTasks(v8::Isolate* isolate) override; void CancelPendingDelayedTasks(v8::Isolate* isolate) override; diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 7934dbb2561e89..09eade4f6f6b31 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -33,7 +33,7 @@ class SerializerContext : public BaseObject, SerializerContext(Environment* env, Local wrap); - ~SerializerContext() {} + ~SerializerContext() override {} void ThrowDataCloneError(Local message) override; Maybe WriteHostObject(Isolate* isolate, Local object) override; @@ -68,7 +68,7 @@ class DeserializerContext : public BaseObject, Local wrap, Local buffer); - ~DeserializerContext() {} + ~DeserializerContext() override {} MaybeLocal ReadHostObject(Isolate* isolate) override; diff --git a/src/node_worker.h b/src/node_worker.h index 68848c859990f0..dad0713fd92df2 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -18,7 +18,7 @@ class Worker : public AsyncWrap { v8::Local wrap, const std::string& url, std::shared_ptr per_isolate_opts); - ~Worker(); + ~Worker() override; // Run the worker. This is only called from the worker thread. void Run(); diff --git a/src/stream_base.h b/src/stream_base.h index cde3343d624fa4..d5b2235f0e6f71 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -82,7 +82,7 @@ class WriteWrap : public StreamReq { v8::Local req_wrap_obj) : StreamReq(stream, req_wrap_obj) { } - ~WriteWrap() { + ~WriteWrap() override { free(storage_); } diff --git a/src/stream_pipe.h b/src/stream_pipe.h index 51a33b7ef69776..ce0077749c868a 100644 --- a/src/stream_pipe.h +++ b/src/stream_pipe.h @@ -10,7 +10,7 @@ namespace node { class StreamPipe : public AsyncWrap { public: StreamPipe(StreamBase* source, StreamBase* sink, v8::Local obj); - ~StreamPipe(); + ~StreamPipe() override; void Unpipe(); diff --git a/src/tracing/node_trace_buffer.h b/src/tracing/node_trace_buffer.h index b59ae4f0a0e4ef..18e4f43efaae3a 100644 --- a/src/tracing/node_trace_buffer.h +++ b/src/tracing/node_trace_buffer.h @@ -51,7 +51,7 @@ class InternalTraceBuffer { class NodeTraceBuffer : public TraceBuffer { public: NodeTraceBuffer(size_t max_chunks, Agent* agent, uv_loop_t* tracing_loop); - ~NodeTraceBuffer(); + ~NodeTraceBuffer() override; TraceObject* AddTraceEvent(uint64_t* handle) override; TraceObject* GetEventByHandle(uint64_t handle) override; diff --git a/src/tracing/node_trace_writer.h b/src/tracing/node_trace_writer.h index f412587ab93219..cd965d77b7859f 100644 --- a/src/tracing/node_trace_writer.h +++ b/src/tracing/node_trace_writer.h @@ -17,7 +17,7 @@ using v8::platform::tracing::TraceWriter; class NodeTraceWriter : public AsyncTraceWriter { public: explicit NodeTraceWriter(const std::string& log_file_pattern); - ~NodeTraceWriter(); + ~NodeTraceWriter() override; void InitializeOnThread(uv_loop_t* loop) override; void AppendTraceEvent(TraceObject* trace_event) override; diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index f4c97b05027895..e34601af99a977 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -84,14 +84,14 @@ class NodeTestFixture : public ::testing::Test { CHECK_EQ(0, uv_loop_close(¤t_loop)); } - virtual void SetUp() { + void SetUp() override { allocator = ArrayBufferUniquePtr(node::CreateArrayBufferAllocator(), &node::FreeArrayBufferAllocator); isolate_ = NewIsolate(allocator.get(), ¤t_loop); CHECK_NE(isolate_, nullptr); } - virtual void TearDown() { + void TearDown() override { isolate_->Dispose(); platform->UnregisterIsolate(isolate_); isolate_ = nullptr; diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index 49dc700bb57716..aba4b719477e03 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -16,7 +16,7 @@ static std::string cb_1_arg; // NOLINT(runtime/string) class EnvironmentTest : public EnvironmentTestFixture { private: - virtual void TearDown() { + void TearDown() override { NodeTestFixture::TearDown(); called_cb_1 = false; called_cb_2 = false; diff --git a/test/cctest/test_inspector_socket.cc b/test/cctest/test_inspector_socket.cc index b96489db1f49d3..09df0fbbcd9406 100644 --- a/test/cctest/test_inspector_socket.cc +++ b/test/cctest/test_inspector_socket.cc @@ -107,7 +107,7 @@ class TestInspectorDelegate : public InspectorSocket::Delegate { handshake_delegate_(stop_if_stop_path), fail_on_ws_frame_(false) { } - ~TestInspectorDelegate() { + ~TestInspectorDelegate() override { assert_is_delegate(this); delegate = nullptr; } @@ -353,7 +353,7 @@ static void on_connection(uv_connect_t* connect, int status) { class InspectorSocketTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { connected = false; GTEST_ASSERT_EQ(0, uv_loop_init(&loop)); server = uv_tcp_t(); @@ -375,7 +375,7 @@ class InspectorSocketTest : public ::testing::Test { really_close(reinterpret_cast(&server)); } - virtual void TearDown() { + void TearDown() override { really_close(reinterpret_cast(&client_socket)); SPIN_WHILE(delegate != nullptr); const int err = uv_loop_close(&loop); diff --git a/test/cctest/test_inspector_socket_server.cc b/test/cctest/test_inspector_socket_server.cc index 349356ef56c9fc..30da5cf3d2ceaa 100644 --- a/test/cctest/test_inspector_socket_server.cc +++ b/test/cctest/test_inspector_socket_server.cc @@ -305,7 +305,7 @@ class TestSocketServerDelegate : public SocketServerDelegate { targets_(target_ids), session_id_(0) {} - ~TestSocketServerDelegate() { + ~TestSocketServerDelegate() override { harness_->Done(); } From 733beb70ae431f958d0a84e3f572d7fc6d73ec24 Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Thu, 14 Feb 2019 17:07:18 +0800 Subject: [PATCH 037/213] lib: convert legacy process.binding to internalBinding PR-URL: https://github.com/nodejs/node/pull/26095 Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: Gus Caplan Reviewed-By: James M Snell --- lib/internal/idna.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/idna.js b/lib/internal/idna.js index 409cabedf10d1a..f57f042888f311 100644 --- a/lib/internal/idna.js +++ b/lib/internal/idna.js @@ -1,6 +1,6 @@ 'use strict'; -if (process.binding('config').hasIntl) { +if (internalBinding('config').hasIntl) { const { toASCII, toUnicode } = internalBinding('icu'); module.exports = { toASCII, toUnicode }; } else { From 4ca07898d79c8d4c633fc8a5f86b1672a8b669b5 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 10 Feb 2019 19:57:21 +0800 Subject: [PATCH 038/213] src: use PauseOnNextJavascriptStatement to implement --inspect-brk-node Instead of using the `debugger;` statement which is visible in the JS source code and makes primordials.js environment-dependent. PR-URL: https://github.com/nodejs/node/pull/26034 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gus Caplan Reviewed-By: James M Snell --- lib/internal/bootstrap/primordials.js | 6 +----- src/node.cc | 10 +++++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/internal/bootstrap/primordials.js b/lib/internal/bootstrap/primordials.js index 85f1f54c1ccf7e..df399dc1736a54 100644 --- a/lib/internal/bootstrap/primordials.js +++ b/lib/internal/bootstrap/primordials.js @@ -1,6 +1,6 @@ 'use strict'; -/* global breakAtBootstrap, primordials */ +/* global primordials */ // This file subclasses and stores the JS builtins that come from the VM // so that Node.js's builtin modules do not need to later look these up from @@ -12,10 +12,6 @@ // `primordials.Object` where `primordials` is a lexical variable passed // by the native module compiler. -if (breakAtBootstrap) { - debugger; // eslint-disable-line no-debugger -} - function copyProps(src, dest) { for (const key of Reflect.ownKeys(src)) { if (!Reflect.getOwnPropertyDescriptor(dest, key)) { diff --git a/src/node.cc b/src/node.cc index 7d9075b5e0a16e..f257495a1351e2 100644 --- a/src/node.cc +++ b/src/node.cc @@ -249,14 +249,18 @@ MaybeLocal RunBootstrapping(Environment* env) { // Store primordials env->set_primordials(Object::New(isolate)); std::vector> primordials_params = { - FIXED_ONE_BYTE_STRING(isolate, "breakAtBootstrap"), env->primordials_string() }; std::vector> primordials_args = { - Boolean::New(isolate, - env->options()->debug_options().break_node_first_line), env->primordials() }; + +#if HAVE_INSPECTOR + if (env->options()->debug_options().break_node_first_line) { + env->inspector_agent()->PauseOnNextJavascriptStatement( + "Break at bootstrap"); + } +#endif // HAVE_INSPECTOR MaybeLocal primordials_ret = ExecuteBootstrapper(env, "internal/bootstrap/primordials", From 778db675c15d4ed308c0e6a8003a4e37d449a2ea Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 15 Feb 2019 19:42:03 +0100 Subject: [PATCH 039/213] src: remove invalid casts in options parser Fixes: https://github.com/nodejs/node/issues/26131 PR-URL: https://github.com/nodejs/node/pull/26139 Reviewed-By: Yang Guo Reviewed-By: Minwoo Jung Reviewed-By: Joyee Cheung --- src/node_options-inl.h | 13 +++++++------ src/node_options.h | 18 ++++++------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/node_options-inl.h b/src/node_options-inl.h index f482bcd36660ed..052c847f7ebdc4 100644 --- a/src/node_options-inl.h +++ b/src/node_options-inl.h @@ -148,7 +148,7 @@ void OptionsParser::Implies(const std::string& from, CHECK_NE(it, options_.end()); CHECK_EQ(it->second.type, kBoolean); implications_.emplace(from, Implication { - std::static_pointer_cast>(it->second.field), true + it->second.field, true }); } @@ -159,7 +159,7 @@ void OptionsParser::ImpliesNot(const std::string& from, CHECK_NE(it, options_.end()); CHECK_EQ(it->second.type, kBoolean); implications_.emplace(from, Implication { - std::static_pointer_cast>(it->second.field), false + it->second.field, false }); } @@ -205,8 +205,7 @@ auto OptionsParser::Convert( typename OptionsParser::Implication original, ChildOptions* (Options::* get_child)()) { return Implication { - std::static_pointer_cast>( - Convert(original.target_field, get_child)), + Convert(original.target_field, get_child), original.target_value }; } @@ -378,8 +377,10 @@ void OptionsParser::Parse( { auto implications = implications_.equal_range(name); - for (auto it = implications.first; it != implications.second; ++it) - *it->second.target_field->Lookup(options) = it->second.target_value; + for (auto it = implications.first; it != implications.second; ++it) { + *it->second.target_field->template Lookup(options) = + it->second.target_value; + } } const OptionInfo& info = it->second; diff --git a/src/node_options.h b/src/node_options.h index 4831bde121febc..b988c53b937fca 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -336,23 +336,17 @@ class OptionsParser { public: virtual ~BaseOptionField() {} virtual void* LookupImpl(Options* options) const = 0; - }; - - // Represents a field of type T within `Options`. - template - class OptionField : public BaseOptionField { - public: - typedef T Type; - T* Lookup(Options* options) const { - return static_cast(this->LookupImpl(options)); + template + inline T* Lookup(Options* options) const { + return static_cast(LookupImpl(options)); } }; // Represents a field of type T within `Options` that can be looked up // as a C++ member field. template - class SimpleOptionField : public OptionField { + class SimpleOptionField : public BaseOptionField { public: explicit SimpleOptionField(T Options::* field) : field_(field) {} void* LookupImpl(Options* options) const override { @@ -366,7 +360,7 @@ class OptionsParser { template inline T* Lookup(std::shared_ptr field, Options* options) const { - return std::static_pointer_cast>(field)->Lookup(options); + return field->template Lookup(options); } // An option consists of: @@ -383,7 +377,7 @@ class OptionsParser { // An implied option is composed of the information on where to store a // specific boolean value (if another specific option is encountered). struct Implication { - std::shared_ptr> target_field; + std::shared_ptr target_field; bool target_value; }; From dab3d71243136cd2e56873001d5e1a05a98e6fe7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 23:30:37 +0100 Subject: [PATCH 040/213] worker: ignore --abort-on-uncaught-exception for terminate() When running Worker threads with `--abort-on-uncaught-exception`, do not abort the process when `worker.terminate()` is called. PR-URL: https://github.com/nodejs/node/pull/26111 Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- src/api/environment.cc | 4 +++- .../test-worker-abort-uncaught-exception.js | 24 +++++++++++++++++++ ...r-abort-on-uncaught-exception-terminate.js | 12 ++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 test/abort/test-worker-abort-uncaught-exception.js create mode 100644 test/parallel/test-worker-abort-on-uncaught-exception-terminate.js diff --git a/src/api/environment.cc b/src/api/environment.cc index a1320c0761d0b5..ee9e623faa6cb6 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -32,7 +32,9 @@ static bool AllowWasmCodeGenerationCallback(Local context, static bool ShouldAbortOnUncaughtException(Isolate* isolate) { HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); - return env != nullptr && env->should_abort_on_uncaught_toggle()[0] && + return env != nullptr && + (env->is_main_thread() || !env->is_stopping_worker()) && + env->should_abort_on_uncaught_toggle()[0] && !env->inside_should_not_abort_on_uncaught_scope(); } diff --git a/test/abort/test-worker-abort-uncaught-exception.js b/test/abort/test-worker-abort-uncaught-exception.js new file mode 100644 index 00000000000000..63f7acdddc7fd7 --- /dev/null +++ b/test/abort/test-worker-abort-uncaught-exception.js @@ -0,0 +1,24 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const { spawn } = require('child_process'); +const { Worker } = require('worker_threads'); + +// Tests that --abort-on-uncaught-exception applies to workers as well. + +if (process.argv[2] === 'child') { + new Worker('throw new Error("foo");', { eval: true }); + return; +} + +const child = spawn(process.execPath, [ + '--abort-on-uncaught-exception', __filename, 'child' +]); +child.on('exit', common.mustCall((code, sig) => { + if (common.isWindows) { + assert.strictEqual(code, 0xC0000005); + } else { + assert(['SIGABRT', 'SIGTRAP', 'SIGILL'].includes(sig), + `Unexpected signal ${sig}`); + } +})); diff --git a/test/parallel/test-worker-abort-on-uncaught-exception-terminate.js b/test/parallel/test-worker-abort-on-uncaught-exception-terminate.js new file mode 100644 index 00000000000000..de73b5e4e34e47 --- /dev/null +++ b/test/parallel/test-worker-abort-on-uncaught-exception-terminate.js @@ -0,0 +1,12 @@ +// Flags: --abort-on-uncaught-exception +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const { Worker } = require('worker_threads'); + +// Tests that --abort-on-uncaught-exception does not apply to +// termination exceptions. + +const w = new Worker('while(true);', { eval: true }); +w.on('online', common.mustCall(() => w.terminate())); +w.on('exit', common.mustCall((code) => assert.strictEqual(code, 1))); From 76c2f4f46b071e7e8d84ec5eaff760811430ec07 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Feb 2019 22:07:58 -0800 Subject: [PATCH 041/213] test: simplify test-worker-syntax-error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove extraneous code from test-worker-syntax-error. Because the worker is called with `eval: true`, there is no need to set an environment variable indicating whether the worker has started and so on. The test file is only ever executed by the main thread. PR-URL: https://github.com/nodejs/node/pull/26144 Reviewed-By: Anna Henningsen Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- test/parallel/test-worker-syntax-error.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-worker-syntax-error.js b/test/parallel/test-worker-syntax-error.js index 5c91eb2d251204..1c1fbf1c1ab3a0 100644 --- a/test/parallel/test-worker-syntax-error.js +++ b/test/parallel/test-worker-syntax-error.js @@ -3,15 +3,9 @@ const common = require('../common'); const assert = require('assert'); const { Worker } = require('worker_threads'); -// Do not use isMainThread so that this test itself can be run inside a Worker. -if (!process.env.HAS_STARTED_WORKER) { - process.env.HAS_STARTED_WORKER = 1; - const w = new Worker('abc)', { eval: true }); - w.on('message', common.mustNotCall()); - w.on('error', common.mustCall((err) => { - assert.strictEqual(err.constructor, SyntaxError); - assert(/SyntaxError/.test(err)); - })); -} else { - throw new Error('foo'); -} +const w = new Worker('abc)', { eval: true }); +w.on('message', common.mustNotCall()); +w.on('error', common.mustCall((err) => { + assert.strictEqual(err.constructor, SyntaxError); + assert(/SyntaxError/.test(err)); +})); From 230e98b54a2e5345155018c1ff2e8530e9011913 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 8 Feb 2019 19:56:08 +0800 Subject: [PATCH 042/213] process: start coverage collection before bootstrap This patch moves the dispatch of `Profiler.takePreciseCoverage` to a point before the bootstrap scripts are run to ensure that we can collect coverage data for all the scripts run after the inspector agent is ready. Before this patch `lib/internal/bootstrap/primordials.js` was not covered by `make coverage`, after this patch it is. PR-URL: https://github.com/nodejs/node/pull/26006 Reviewed-By: Anna Henningsen Reviewed-By: Ben Coe Reviewed-By: James M Snell --- lib/internal/bootstrap/loaders.js | 13 -- lib/internal/coverage-gen/with_profiler.js | 46 +----- src/env.h | 9 +- src/inspector/node_inspector.gypi | 1 + src/inspector_coverage.cc | 168 +++++++++++++++++++++ src/node.cc | 13 ++ src/node_binding.cc | 9 +- src/node_internals.h | 4 +- 8 files changed, 205 insertions(+), 58 deletions(-) create mode 100644 src/inspector_coverage.cc diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index d21fddbf5239a1..28f7f5277b9ee0 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -311,18 +311,5 @@ NativeModule.prototype.compile = function() { } }; -// Coverage must be turned on early, so that we can collect -// it for Node.js' own internal libraries. -if (process.env.NODE_V8_COVERAGE) { - if (internalBinding('config').hasInspector) { - const coverage = - NativeModule.require('internal/coverage-gen/with_profiler'); - // Inform the profiler to start collecting coverage - coverage.startCoverageCollection(); - } else { - process._rawDebug('NODE_V8_COVERAGE cannot be used without inspector'); - } -} - // This will be passed to internal/bootstrap/node.js. return loaderExports; diff --git a/lib/internal/coverage-gen/with_profiler.js b/lib/internal/coverage-gen/with_profiler.js index 6b17073939b658..573d2c3712b281 100644 --- a/lib/internal/coverage-gen/with_profiler.js +++ b/lib/internal/coverage-gen/with_profiler.js @@ -3,14 +3,9 @@ // Implements coverage collection exposed by the `NODE_V8_COVERAGE` // environment variable which can also be used in the user land. -let coverageConnection = null; let coverageDirectory; function writeCoverage() { - if (!coverageConnection && coverageDirectory) { - return; - } - const { join } = require('path'); const { mkdirSync, writeFileSync } = require('fs'); const { threadId } = require('internal/worker'); @@ -28,21 +23,14 @@ function writeCoverage() { const target = join(coverageDirectory, filename); try { disableAllAsyncHooks(); - let msg; - coverageConnection._coverageCallback = function(_msg) { - msg = _msg; - }; - coverageConnection.dispatch(JSON.stringify({ - id: 3, - method: 'Profiler.takePreciseCoverage' - })); - const coverageInfo = JSON.parse(msg).result; - writeFileSync(target, JSON.stringify(coverageInfo)); + internalBinding('coverage').end((msg) => { + const coverageInfo = JSON.parse(msg).result; + if (coverageInfo) { + writeFileSync(target, JSON.stringify(coverageInfo)); + } + }); } catch (err) { console.error(err); - } finally { - coverageConnection.disconnect(); - coverageConnection = null; } } @@ -52,33 +40,11 @@ function disableAllAsyncHooks() { hooks_array.forEach((hook) => { hook.disable(); }); } -function startCoverageCollection() { - const { Connection } = internalBinding('inspector'); - coverageConnection = new Connection((res) => { - if (coverageConnection._coverageCallback) { - coverageConnection._coverageCallback(res); - } - }); - coverageConnection.dispatch(JSON.stringify({ - id: 1, - method: 'Profiler.enable' - })); - coverageConnection.dispatch(JSON.stringify({ - id: 2, - method: 'Profiler.startPreciseCoverage', - params: { - callCount: true, - detailed: true - } - })); -} - function setCoverageDirectory(dir) { coverageDirectory = dir; } module.exports = { - startCoverageCollection, writeCoverage, setCoverageDirectory }; diff --git a/src/env.h b/src/env.h index 749ad22b67267f..626b43121b44ee 100644 --- a/src/env.h +++ b/src/env.h @@ -329,6 +329,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(async_wrap_ctor_template, v8::FunctionTemplate) \ V(async_wrap_object_ctor_template, v8::FunctionTemplate) \ V(buffer_prototype_object, v8::Object) \ + V(coverage_connection, v8::Object) \ V(context, v8::Context) \ V(crypto_key_object_constructor, v8::Function) \ V(domain_callback, v8::Function) \ @@ -364,6 +365,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(message_event_object_template, v8::ObjectTemplate) \ V(message_port_constructor_template, v8::FunctionTemplate) \ V(native_module_require, v8::Function) \ + V(on_coverage_message_function, v8::Function) \ V(performance_entry_callback, v8::Function) \ V(performance_entry_template, v8::Function) \ V(pipe_constructor_template, v8::FunctionTemplate) \ @@ -448,9 +450,10 @@ struct ContextInfo { // Listing the AsyncWrap provider types first enables us to cast directly // from a provider type to a debug category. -#define DEBUG_CATEGORY_NAMES(V) \ - NODE_ASYNC_PROVIDER_TYPES(V) \ - V(INSPECTOR_SERVER) +#define DEBUG_CATEGORY_NAMES(V) \ + NODE_ASYNC_PROVIDER_TYPES(V) \ + V(INSPECTOR_SERVER) \ + V(COVERAGE) enum class DebugCategory { #define V(name) name, diff --git a/src/inspector/node_inspector.gypi b/src/inspector/node_inspector.gypi index 21f98cd9002cab..9483a0712e22bd 100644 --- a/src/inspector/node_inspector.gypi +++ b/src/inspector/node_inspector.gypi @@ -45,6 +45,7 @@ '../../src/inspector_io.cc', '../../src/inspector_agent.h', '../../src/inspector_io.h', + '../../src/inspector_coverage.cc', '../../src/inspector_js_api.cc', '../../src/inspector_socket.cc', '../../src/inspector_socket.h', diff --git a/src/inspector_coverage.cc b/src/inspector_coverage.cc new file mode 100644 index 00000000000000..8cbec586fba718 --- /dev/null +++ b/src/inspector_coverage.cc @@ -0,0 +1,168 @@ +#include "base_object-inl.h" +#include "debug_utils.h" +#include "inspector_agent.h" +#include "node_internals.h" +#include "v8-inspector.h" + +namespace node { +namespace coverage { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::MaybeLocal; +using v8::NewStringType; +using v8::Object; +using v8::ObjectTemplate; +using v8::String; +using v8::Value; + +using v8_inspector::StringBuffer; +using v8_inspector::StringView; + +std::unique_ptr ToProtocolString(Isolate* isolate, + Local value) { + TwoByteValue buffer(isolate, value); + return StringBuffer::create(StringView(*buffer, buffer.length())); +} + +class V8CoverageConnection : public BaseObject { + public: + class V8CoverageSessionDelegate : public inspector::InspectorSessionDelegate { + public: + explicit V8CoverageSessionDelegate(V8CoverageConnection* connection) + : connection_(connection) {} + + void SendMessageToFrontend( + const v8_inspector::StringView& message) override { + Environment* env = connection_->env(); + Local fn = connection_->env()->on_coverage_message_function(); + bool ending = !fn.IsEmpty(); + Debug(env, + DebugCategory::COVERAGE, + "Sending message to frontend, ending = %s\n", + ending ? "true" : "false"); + if (!ending) { + return; + } + Isolate* isolate = env->isolate(); + + HandleScope handle_scope(isolate); + Context::Scope context_scope(env->context()); + MaybeLocal v8string = + String::NewFromTwoByte(isolate, + message.characters16(), + NewStringType::kNormal, + message.length()); + Local args[] = {v8string.ToLocalChecked().As()}; + USE(MakeCallback(isolate, + connection_->object(), + fn, + arraysize(args), + args, + async_context{0, 0})); + } + + private: + V8CoverageConnection* connection_; + }; + + SET_MEMORY_INFO_NAME(V8CoverageConnection) + SET_SELF_SIZE(V8CoverageConnection) + + void MemoryInfo(MemoryTracker* tracker) const override { + tracker->TrackFieldWithSize( + "session", sizeof(*session_), "InspectorSession"); + } + + explicit V8CoverageConnection(Environment* env) + : BaseObject(env, env->coverage_connection()), session_(nullptr) { + inspector::Agent* inspector = env->inspector_agent(); + std::unique_ptr session = inspector->Connect( + std::make_unique(this), false); + session_ = std::move(session); + MakeWeak(); + } + + void Start() { + Debug(this->env(), + DebugCategory::COVERAGE, + "Sending Profiler.startPreciseCoverage\n"); + Isolate* isolate = this->env()->isolate(); + Local enable = FIXED_ONE_BYTE_STRING( + isolate, "{\"id\": 1, \"method\": \"Profiler.enable\"}"); + Local start = FIXED_ONE_BYTE_STRING( + isolate, + "{" + "\"id\": 2," + "\"method\": \"Profiler.startPreciseCoverage\"," + "\"params\": {\"callCount\": true, \"detailed\": true}" + "}"); + session_->Dispatch(ToProtocolString(isolate, enable)->string()); + session_->Dispatch(ToProtocolString(isolate, start)->string()); + } + + void End() { + Debug(this->env(), + DebugCategory::COVERAGE, + "Sending Profiler.takePreciseCoverage\n"); + Isolate* isolate = this->env()->isolate(); + Local end = + FIXED_ONE_BYTE_STRING(isolate, + "{" + "\"id\": 3," + "\"method\": \"Profiler.takePreciseCoverage\"" + "}"); + session_->Dispatch(ToProtocolString(isolate, end)->string()); + } + + friend class V8CoverageSessionDelegate; + + private: + std::unique_ptr session_; +}; + +bool StartCoverageCollection(Environment* env) { + HandleScope scope(env->isolate()); + + Local t = ObjectTemplate::New(env->isolate()); + t->SetInternalFieldCount(1); + Local obj; + if (!t->NewInstance(env->context()).ToLocal(&obj)) { + return false; + } + + obj->SetAlignedPointerInInternalField(0, nullptr); + + CHECK(env->coverage_connection().IsEmpty()); + env->set_coverage_connection(obj); + V8CoverageConnection* connection = new V8CoverageConnection(env); + connection->Start(); + return true; +} + +static void EndCoverageCollection(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + CHECK(args[0]->IsFunction()); + Debug(env, DebugCategory::COVERAGE, "Ending coverage collection\n"); + env->set_on_coverage_message_function(args[0].As()); + V8CoverageConnection* connection = + Unwrap(env->coverage_connection()); + CHECK_NOT_NULL(connection); + connection->End(); +} + +static void Initialize(Local target, + Local unused, + Local context, + void* priv) { + Environment* env = Environment::GetCurrent(context); + env->SetMethod(target, "end", EndCoverageCollection); +} +} // namespace coverage +} // namespace node + +NODE_MODULE_CONTEXT_AWARE_INTERNAL(coverage, node::coverage::Initialize) diff --git a/src/node.cc b/src/node.cc index f257495a1351e2..82282e202bec48 100644 --- a/src/node.cc +++ b/src/node.cc @@ -19,6 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +#include "debug_utils.h" #include "node_binding.h" #include "node_buffer.h" #include "node_constants.h" @@ -230,6 +231,18 @@ MaybeLocal RunBootstrapping(Environment* env) { Isolate* isolate = env->isolate(); Local context = env->context(); + std::string coverage; + bool rc = credentials::SafeGetenv("NODE_V8_COVERAGE", &coverage); + if (rc && !coverage.empty()) { +#if HAVE_INSPECTOR + if (!coverage::StartCoverageCollection(env)) { + return MaybeLocal(); + } +#else + fprintf(stderr, "NODE_V8_COVERAGE cannot be used without inspector"); +#endif // HAVE_INSPECTOR + } + // Add a reference to the global object Local global = context->Global(); diff --git a/src/node_binding.cc b/src/node_binding.cc index 08d55567d4904a..c9ff7be46f80fc 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -21,6 +21,12 @@ #define NODE_BUILTIN_REPORT_MODULES(V) #endif +#if HAVE_INSPECTOR +#define NODE_BUILTIN_COVERAGE_MODULES(V) V(coverage) +#else +#define NODE_BUILTIN_COVERAGE_MODULES(V) +#endif + // A list of built-in modules. In order to do module registration // in node::Init(), need to add built-in modules in the following list. // Then in binding::RegisterBuiltinModules(), it calls modules' registration @@ -77,7 +83,8 @@ NODE_BUILTIN_STANDARD_MODULES(V) \ NODE_BUILTIN_OPENSSL_MODULES(V) \ NODE_BUILTIN_ICU_MODULES(V) \ - NODE_BUILTIN_REPORT_MODULES(V) + NODE_BUILTIN_REPORT_MODULES(V) \ + NODE_BUILTIN_COVERAGE_MODULES(V) // This is used to load built-in modules. Instead of using // __attribute__((constructor)), we call the _register_ diff --git a/src/node_internals.h b/src/node_internals.h index 6cbad8959415aa..01ebd8b40af3a2 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -269,7 +269,9 @@ void DefineZlibConstants(v8::Local target); v8::MaybeLocal RunBootstrapping(Environment* env); v8::MaybeLocal StartExecution(Environment* env, const char* main_script_id); - +namespace coverage { +bool StartCoverageCollection(Environment* env); +} } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS From 82df851bb555b2496019465bec29b145624abc75 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 9 Feb 2019 23:48:14 +0800 Subject: [PATCH 043/213] src: unify uptime base used across the code base This patch joins `per_process::prog_start_time` (a double) and `performance::performance_node_start` (a uint64_t) into a `per_process::node_start_time` (a uint64_t) which gets initialized in `node::Start()`. PR-URL: https://github.com/nodejs/node/pull/26016 Reviewed-By: Anna Henningsen --- src/env.cc | 5 ++--- src/node.cc | 9 +++------ src/node_internals.h | 2 +- src/node_perf.cc | 1 - src/node_perf_common.h | 1 - src/node_process_methods.cc | 11 +++++++---- src/node_report.cc | 21 ++++++++++++--------- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/env.cc b/src/env.cc index 5507fc7b7ba638..7610f2b7622942 100644 --- a/src/env.cc +++ b/src/env.cc @@ -228,9 +228,8 @@ Environment::Environment(IsolateData* isolate_data, performance_state_.reset(new performance::performance_state(isolate())); performance_state_->Mark( performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT); - performance_state_->Mark( - performance::NODE_PERFORMANCE_MILESTONE_NODE_START, - performance::performance_node_start); + performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_NODE_START, + per_process::node_start_time); performance_state_->Mark( performance::NODE_PERFORMANCE_MILESTONE_V8_START, performance::performance_v8_start); diff --git a/src/node.cc b/src/node.cc index 82282e202bec48..b3195b73658a7f 100644 --- a/src/node.cc +++ b/src/node.cc @@ -145,8 +145,8 @@ unsigned int reverted_cve = 0; bool v8_initialized = false; // node_internals.h -// process-relative uptime base, initialized at start-up -double prog_start_time; +// process-relative uptime base in nanoseconds, initialized in node::Start() +uint64_t node_start_time; // Tells whether --prof is passed. bool v8_is_profiling = false; @@ -611,9 +611,6 @@ int ProcessGlobalArgs(std::vector* args, int Init(std::vector* argv, std::vector* exec_argv, std::vector* errors) { - // Initialize prog_start_time to get relative uptime. - per_process::prog_start_time = static_cast(uv_now(uv_default_loop())); - // Register built-in modules binding::RegisterBuiltinModules(); @@ -891,7 +888,7 @@ inline int Start(uv_loop_t* event_loop, int Start(int argc, char** argv) { atexit([] () { uv_tty_reset_mode(); }); PlatformInit(); - performance::performance_node_start = PERFORMANCE_NOW(); + per_process::node_start_time = uv_hrtime(); CHECK_GT(argc, 0); diff --git a/src/node_internals.h b/src/node_internals.h index 01ebd8b40af3a2..367df26c0e74f6 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -55,7 +55,7 @@ class NativeModuleLoader; namespace per_process { extern Mutex env_var_mutex; -extern double prog_start_time; +extern uint64_t node_start_time; extern bool v8_is_profiling; } // namespace per_process diff --git a/src/node_perf.cc b/src/node_perf.cc index b9c0183a83d930..f63dc6abf09005 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -46,7 +46,6 @@ using v8::Value; const uint64_t timeOrigin = PERFORMANCE_NOW(); // https://w3c.github.io/hr-time/#dfn-time-origin-timestamp const double timeOriginTimestamp = GetCurrentTimeInMicroseconds(); -uint64_t performance_node_start; uint64_t performance_v8_start; void performance_state::Mark(enum PerformanceMilestone milestone, diff --git a/src/node_perf_common.h b/src/node_perf_common.h index 1c4cf01c871ad3..5c972c9841ad50 100644 --- a/src/node_perf_common.h +++ b/src/node_perf_common.h @@ -18,7 +18,6 @@ namespace performance { // These occur before the environment is created. Cache them // here and add them to the milestones when the env is init'd. -extern uint64_t performance_node_start; extern uint64_t performance_v8_start; #define NODE_PERFORMANCE_MILESTONES(V) \ diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index be91a11f566baa..dfcc6641a1c5f8 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -44,6 +44,7 @@ using v8::Isolate; using v8::Local; using v8::Name; using v8::NewStringType; +using v8::Number; using v8::Object; using v8::String; using v8::Uint32; @@ -58,6 +59,8 @@ Mutex umask_mutex; #define MICROS_PER_SEC 1e6 // used in Hrtime() below #define NANOS_PER_SEC 1000000000 +// Used in Uptime() +#define NANOS_PER_MICROS 1e3 #ifdef _WIN32 /* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ @@ -239,12 +242,12 @@ static void Umask(const FunctionCallbackInfo& args) { static void Uptime(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - double uptime; uv_update_time(env->event_loop()); - uptime = uv_now(env->event_loop()) - per_process::prog_start_time; - - args.GetReturnValue().Set(uptime / 1000); + double uptime = + static_cast(uv_hrtime() - per_process::node_start_time); + Local result = Number::New(env->isolate(), uptime / NANOS_PER_MICROS); + args.GetReturnValue().Set(result); } static void GetActiveRequests(const FunctionCallbackInfo& args) { diff --git a/src/node_report.cc b/src/node_report.cc index d4e332f607ab42..d4f59de84d8013 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -47,6 +47,9 @@ extern char** environ; #endif +constexpr int NANOS_PER_SEC = 1000 * 1000 * 1000; +constexpr double SEC_PER_MICROS = 1e-6; + namespace report { using node::arraysize; using node::Environment; @@ -489,20 +492,19 @@ static void PrintGCStatistics(JSONWriter* writer, Isolate* isolate) { #ifndef _WIN32 // Report resource usage (Linux/OSX only). static void PrintResourceUsage(JSONWriter* writer) { - time_t current_time; // current time absolute - time(¤t_time); - size_t boot_time = static_cast(node::per_process::prog_start_time / - (1000 * 1000 * 1000)); - auto uptime = difftime(current_time, boot_time); + // Get process uptime in seconds + uint64_t uptime = + (uv_hrtime() - node::per_process::node_start_time) / (NANOS_PER_SEC); if (uptime == 0) uptime = 1; // avoid division by zero. // Process and current thread usage statistics struct rusage stats; writer->json_objectstart("resourceUsage"); if (getrusage(RUSAGE_SELF, &stats) == 0) { - double user_cpu = stats.ru_utime.tv_sec + 0.000001 * stats.ru_utime.tv_usec; + double user_cpu = + stats.ru_utime.tv_sec + SEC_PER_MICROS * stats.ru_utime.tv_usec; double kernel_cpu = - stats.ru_utime.tv_sec + 0.000001 * stats.ru_utime.tv_usec; + stats.ru_utime.tv_sec + SEC_PER_MICROS * stats.ru_utime.tv_usec; writer->json_keyvalue("userCpuSeconds", user_cpu); writer->json_keyvalue("kernelCpuSeconds", kernel_cpu); double cpu_abs = user_cpu + kernel_cpu; @@ -522,9 +524,10 @@ static void PrintResourceUsage(JSONWriter* writer) { #ifdef RUSAGE_THREAD if (getrusage(RUSAGE_THREAD, &stats) == 0) { writer->json_objectstart("uvthreadResourceUsage"); - double user_cpu = stats.ru_utime.tv_sec + 0.000001 * stats.ru_utime.tv_usec; + double user_cpu = + stats.ru_utime.tv_sec + SEC_PER_MICROS * stats.ru_utime.tv_usec; double kernel_cpu = - stats.ru_utime.tv_sec + 0.000001 * stats.ru_utime.tv_usec; + stats.ru_utime.tv_sec + SEC_PER_MICROS * stats.ru_utime.tv_usec; writer->json_keyvalue("userCpuSeconds", user_cpu); writer->json_keyvalue("kernelCpuSeconds", kernel_cpu); double cpu_abs = user_cpu + kernel_cpu; From 38a87d5521f1370c686f63eda98968ddfeddb6ba Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 14 Feb 2019 18:34:53 -0500 Subject: [PATCH 044/213] test: increase coverage of node_report_module.cc PR-URL: https://github.com/nodejs/node/pull/26116 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Beth Griggs --- .../test-api-trigger-with-filename.js | 29 +++++++++++++ .../test-api-trigger-with-options.js | 30 +++++++++++++ .../test-diagnostic-report-verbose.js | 43 +++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 test/node-report/test-api-trigger-with-filename.js create mode 100644 test/node-report/test-api-trigger-with-options.js create mode 100644 test/node-report/test-diagnostic-report-verbose.js diff --git a/test/node-report/test-api-trigger-with-filename.js b/test/node-report/test-api-trigger-with-filename.js new file mode 100644 index 00000000000000..8603c0a7c31b68 --- /dev/null +++ b/test/node-report/test-api-trigger-with-filename.js @@ -0,0 +1,29 @@ +'use strict'; + +// Tests when a report is triggered with a given filename. +const common = require('../common'); +common.skipIfReportDisabled(); +const filename = 'myreport.json'; +if (process.argv[2] === 'child') { + process.report.triggerReport(filename); +} else { + const helper = require('../common/report.js'); + const spawn = require('child_process').spawn; + const assert = require('assert'); + const { join } = require('path'); + const tmpdir = require('../common/tmpdir'); + tmpdir.refresh(); + + const child = spawn(process.execPath, + ['--experimental-report', __filename, 'child'], + { cwd: tmpdir.path }); + child.on('exit', common.mustCall((code) => { + const process_msg = 'Process exited unexpectedly'; + assert.strictEqual(code, 0, process_msg + ':' + code); + const reports = helper.findReports(child.pid, tmpdir.path); + assert.strictEqual(reports.length, 0, + `Found unexpected report ${reports[0]}`); + const report = join(tmpdir.path, filename); + helper.validate(report); + })); +} diff --git a/test/node-report/test-api-trigger-with-options.js b/test/node-report/test-api-trigger-with-options.js new file mode 100644 index 00000000000000..a236fa1305bf46 --- /dev/null +++ b/test/node-report/test-api-trigger-with-options.js @@ -0,0 +1,30 @@ +'use strict'; + +// Tests when a report is triggered with options set. +const common = require('../common'); +common.skipIfReportDisabled(); +const filename = 'myreport.json'; +if (process.argv[2] === 'child') { + process.report.setOptions({ filename: filename }); + process.report.triggerReport(); +} else { + const helper = require('../common/report.js'); + const spawn = require('child_process').spawn; + const assert = require('assert'); + const { join } = require('path'); + const tmpdir = require('../common/tmpdir'); + tmpdir.refresh(); + + const child = spawn(process.execPath, + ['--experimental-report', __filename, 'child'], + { cwd: tmpdir.path }); + child.on('exit', common.mustCall((code) => { + const process_msg = 'Process exited unexpectedly'; + assert.strictEqual(code, 0, process_msg + ':' + code); + const reports = helper.findReports(child.pid, tmpdir.path); + assert.strictEqual(reports.length, 0, + `Found unexpected report ${reports[0]}`); + const report = join(tmpdir.path, filename); + helper.validate(report); + })); +} diff --git a/test/node-report/test-diagnostic-report-verbose.js b/test/node-report/test-diagnostic-report-verbose.js new file mode 100644 index 00000000000000..f59b07d62a9f07 --- /dev/null +++ b/test/node-report/test-diagnostic-report-verbose.js @@ -0,0 +1,43 @@ +'use strict'; + +// Tests --diagnostic-report-verbose option. +const common = require('../common'); +common.skipIfReportDisabled(); +if (process.argv[2] === 'child') { + // no-op +} else { + const helper = require('../common/report.js'); + const spawn = require('child_process').spawn; + const assert = require('assert'); + const tmpdir = require('../common/tmpdir'); + tmpdir.refresh(); + + const expected = [ 'report: initialization complete, event flags:', + 'report_uncaught_exception: 0', + 'report_on_signal: 0', + 'report_on_fatalerror: 0', + 'report_signal:', + 'report_filename:', + 'report_directory:', + 'report_verbose: 1' ]; + + const child = spawn(process.execPath, + ['--experimental-report', + '--diagnostic-report-verbose', + __filename, + 'child', + ], + { cwd: tmpdir.path }); + let stderr; + child.stderr.on('data', (data) => stderr += data); + child.on('exit', common.mustCall((code) => { + const process_msg = 'Process exited unexpectedly'; + assert.strictEqual(code, 0, process_msg + ':' + code); + const reports = helper.findReports(child.pid, tmpdir.path); + assert.strictEqual(reports.length, 0, + `Found unexpected report ${reports[0]}`); + for (const line of expected) { + assert.ok(stderr.includes(line), `'${line}' not found in '${stderr}'`); + } + })); +} From f4955fde603c2b876f4115b4b412f1d8d095d3e9 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 14 Feb 2019 19:50:49 -0500 Subject: [PATCH 045/213] benchmark,test: refactoring PR-URL: https://github.com/nodejs/node/pull/26119 Refs: https://github.com/nodejs/node/pull/26101 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- benchmark/http/create-clientrequest.js | 61 +++++++++++++++----------- benchmark/http/headers.js | 13 +++--- benchmark/http/incoming_headers.js | 6 +-- test/benchmark/test-benchmark-http.js | 8 ++-- 4 files changed, 47 insertions(+), 41 deletions(-) diff --git a/benchmark/http/create-clientrequest.js b/benchmark/http/create-clientrequest.js index 76468a49aa0835..24d6e020c63bc0 100644 --- a/benchmark/http/create-clientrequest.js +++ b/benchmark/http/create-clientrequest.js @@ -1,7 +1,9 @@ 'use strict'; const common = require('../common.js'); -const ClientRequest = require('http').ClientRequest; +const { ClientRequest } = require('http'); +const assert = require('assert'); + const types = Object.keys(common.urls) .filter((i) => common.urls[i] .startsWith('http://')); @@ -15,36 +17,43 @@ const bench = common.createBenchmark(main, { function noop() {} function main({ url: type, arg, e }) { - e = +e; + e = Number(e); const data = common.bakeUrlData(type, e, false, false) .filter((i) => i.startsWith('http://')); const len = data.length; - var result; - var i; - if (arg === 'options') { - const options = data.map((i) => ({ - path: new URL(i).path, createConnection: noop - })); - bench.start(); - for (i = 0; i < len; i++) { - result = new ClientRequest(options[i]); + let result; + switch (arg) { + case 'options': { + const options = data.map((i) => ({ + path: new URL(i).path, createConnection: noop + })); + bench.start(); + for (let i = 0; i < len; i++) { + result = new ClientRequest(options[i]); + } + bench.end(len); + break; + } + case 'URL': { + const options = data.map((i) => new URL(i)); + bench.start(); + for (let i = 0; i < len; i++) { + result = new ClientRequest(options[i], { createConnection: noop }); + } + bench.end(len); + break; } - bench.end(len); - } else if (arg === 'URL') { - const options = data.map((i) => new URL(i)); - bench.start(); - for (i = 0; i < len; i++) { - result = new ClientRequest(options[i], { createConnection: noop }); + case 'string': { + bench.start(); + for (let i = 0; i < len; i++) { + result = new ClientRequest(data[i], { createConnection: noop }); + } + bench.end(len); + break; } - bench.end(len); - } else if (arg === 'string') { - bench.start(); - for (i = 0; i < len; i++) { - result = new ClientRequest(data[i], { createConnection: noop }); + default: { + throw new Error(`Unknown arg type ${arg}`); } - bench.end(len); - } else { - throw new Error(`Unknown arg type ${arg}`); } - require('assert').ok(result); + assert.ok(result); } diff --git a/benchmark/http/headers.js b/benchmark/http/headers.js index 60d800c20cf04f..8f611ae4743c93 100644 --- a/benchmark/http/headers.js +++ b/benchmark/http/headers.js @@ -4,21 +4,20 @@ const common = require('../common.js'); const http = require('http'); const bench = common.createBenchmark(main, { - duplicates: [1, 100], n: [10, 1000], + len: [1, 100], }); -function main({ duplicates, n }) { +function main({ len, n }) { const headers = { 'Connection': 'keep-alive', 'Transfer-Encoding': 'chunked', }; - for (var i = 0; i < n / duplicates; i++) { - headers[`foo${i}`] = []; - for (var j = 0; j < duplicates; j++) { - headers[`foo${i}`].push(`some header value ${i}`); - } + const Is = [ ...Array(n / len).keys() ]; + const Js = [ ...Array(len).keys() ]; + for (const i of Is) { + headers[`foo${i}`] = Js.map(() => `some header value ${i}`); } const server = http.createServer((req, res) => { diff --git a/benchmark/http/incoming_headers.js b/benchmark/http/incoming_headers.js index a1ab57e23876bf..7d9955766c7882 100644 --- a/benchmark/http/incoming_headers.js +++ b/benchmark/http/incoming_headers.js @@ -5,10 +5,10 @@ const http = require('http'); const bench = common.createBenchmark(main, { // unicode confuses ab on os x. c: [50, 500], - headerDuplicates: [0, 5, 20] + n: [0, 5, 20] }); -function main({ c, headerDuplicates }) { +function main({ c, n }) { const server = http.createServer((req, res) => { res.end(); }); @@ -21,7 +21,7 @@ function main({ c, headerDuplicates }) { 'Date': new Date().toString(), 'Cache-Control': 'no-cache' }; - for (let i = 0; i < headerDuplicates; i++) { + for (let i = 0; i < n; i++) { headers[`foo${i}`] = `some header value ${i}`; } bench.http({ diff --git a/test/benchmark/test-benchmark-http.js b/test/benchmark/test-benchmark-http.js index d0c9ef175530bc..ed8423ba4c10cd 100644 --- a/test/benchmark/test-benchmark-http.js +++ b/test/benchmark/test-benchmark-http.js @@ -14,14 +14,12 @@ const runBenchmark = require('../common/benchmark'); runBenchmark('http', [ 'benchmarker=test-double-http', - 'c=1', - 'e=0', - 'url=long', 'arg=string', + 'c=1', 'chunkedEnc=true', 'chunks=0', 'dur=0.1', - 'duplicates=1', + 'e=0', 'input=keep-alive', 'key=""', 'len=1', @@ -29,8 +27,8 @@ runBenchmark('http', 'n=1', 'res=normal', 'type=asc', + 'url=long', 'value=X-Powered-By', - 'headerDuplicates=1', ], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1, From c810ced543c65cc00a715be7a61248bb3eff6e12 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Feb 2019 11:34:31 -0800 Subject: [PATCH 046/213] doc: wrap child_process.md at 80 characters PR-URL: https://github.com/nodejs/node/pull/26141 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell --- doc/api/child_process.md | 117 ++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 56 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index cdfdab1a98d635..62b2ff08c1e8eb 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1,7 +1,6 @@ # Child Process - > Stability: 2 - Stable @@ -44,10 +43,12 @@ and asynchronous alternatives to [`child_process.spawn()`][] and [`child_process.spawnSync()`][]. *Note that each of these alternatives are implemented on top of [`child_process.spawn()`][] or [`child_process.spawnSync()`][].* - * [`child_process.exec()`][]: spawns a shell and runs a command within that shell, - passing the `stdout` and `stderr` to a callback function when complete. - * [`child_process.execFile()`][]: similar to [`child_process.exec()`][] except that - it spawns the command directly without first spawning a shell by default. + * [`child_process.exec()`][]: spawns a shell and runs a command within that + shell, passing the `stdout` and `stderr` to a callback function when + complete. + * [`child_process.execFile()`][]: similar to [`child_process.exec()`][] except + that it spawns the command directly without first spawning a shell by + default. * [`child_process.fork()`][]: spawns a new Node.js process and invokes a specified module with an IPC communication channel established that allows sending messages between parent and child. @@ -72,21 +73,22 @@ implement the Node.js [`EventEmitter`][] API, allowing the parent process to register listener functions that are called when certain events occur during the life cycle of the child process. -The [`child_process.exec()`][] and [`child_process.execFile()`][] methods additionally -allow for an optional `callback` function to be specified that is invoked -when the child process terminates. +The [`child_process.exec()`][] and [`child_process.execFile()`][] methods +additionally allow for an optional `callback` function to be specified that is +invoked when the child process terminates. ### Spawning `.bat` and `.cmd` files on Windows The importance of the distinction between [`child_process.exec()`][] and -[`child_process.execFile()`][] can vary based on platform. On Unix-type operating -systems (Unix, Linux, macOS) [`child_process.execFile()`][] can be more efficient -because it does not spawn a shell by default. On Windows, however, `.bat` and `.cmd` -files are not executable on their own without a terminal, and therefore cannot -be launched using [`child_process.execFile()`][]. When running on Windows, `.bat` -and `.cmd` files can be invoked using [`child_process.spawn()`][] with the `shell` -option set, with [`child_process.exec()`][], or by spawning `cmd.exe` and passing -the `.bat` or `.cmd` file as an argument (which is what the `shell` option and +[`child_process.execFile()`][] can vary based on platform. On Unix-type +operating systems (Unix, Linux, macOS) [`child_process.execFile()`][] can be +more efficient because it does not spawn a shell by default. On Windows, +however, `.bat` and `.cmd` files are not executable on their own without a +terminal, and therefore cannot be launched using [`child_process.execFile()`][]. +When running on Windows, `.bat` and `.cmd` files can be invoked using +[`child_process.spawn()`][] with the `shell` option set, with +[`child_process.exec()`][], or by spawning `cmd.exe` and passing the `.bat` or +`.cmd` file as an argument (which is what the `shell` option and [`child_process.exec()`][] do). In any case, if the script filename contains spaces it needs to be quoted. @@ -267,12 +269,13 @@ changes: * Returns: {ChildProcess} The `child_process.execFile()` function is similar to [`child_process.exec()`][] -except that it does not spawn a shell by default. Rather, the specified executable `file` -is spawned directly as a new process making it slightly more efficient than -[`child_process.exec()`][]. +except that it does not spawn a shell by default. Rather, the specified +executable `file` is spawned directly as a new process making it slightly more +efficient than [`child_process.exec()`][]. -The same options as [`child_process.exec()`][] are supported. Since a shell is not -spawned, behaviors such as I/O redirection and file globbing are not supported. +The same options as [`child_process.exec()`][] are supported. Since a shell is +not spawned, behaviors such as I/O redirection and file globbing are not +supported. ```js const { execFile } = require('child_process'); @@ -350,10 +353,10 @@ changes: The `child_process.fork()` method is a special case of [`child_process.spawn()`][] used specifically to spawn new Node.js processes. -Like [`child_process.spawn()`][], a [`ChildProcess`][] object is returned. The returned -[`ChildProcess`][] will have an additional communication channel built-in that -allows messages to be passed back and forth between the parent and child. See -[`subprocess.send()`][] for details. +Like [`child_process.spawn()`][], a [`ChildProcess`][] object is returned. The +returned [`ChildProcess`][] will have an additional communication channel +built-in that allows messages to be passed back and forth between the parent and +child. See [`subprocess.send()`][] for details. It is important to keep in mind that spawned Node.js child processes are independent of the parent with exception of the IPC communication channel @@ -608,11 +611,12 @@ pipes between the parent and child. The value is one of the following: for fds 0 - 2 are also available as [`subprocess.stdin`][], [`subprocess.stdout`][] and [`subprocess.stderr`][], respectively. 2. `'ipc'` - Create an IPC channel for passing messages/file descriptors - between parent and child. A [`ChildProcess`][] may have at most *one* IPC stdio - file descriptor. Setting this option enables the [`subprocess.send()`][] - method. If the child is a Node.js process, the presence of an IPC channel - will enable [`process.send()`][] and [`process.disconnect()`][] methods, - as well as [`'disconnect'`][] and [`'message'`][] events within the child. + between parent and child. A [`ChildProcess`][] may have at most *one* IPC + stdio file descriptor. Setting this option enables the + [`subprocess.send()`][] method. If the child is a Node.js process, the + presence of an IPC channel will enable [`process.send()`][] and + [`process.disconnect()`][] methods, as well as [`'disconnect'`][] and + [`'message'`][] events within the child. Accessing the IPC channel fd in any way other than [`process.send()`][] or using the IPC channel with a child process that is not a Node.js instance @@ -670,8 +674,8 @@ See also: [`child_process.exec()`][] and [`child_process.fork()`][]. ## Synchronous Process Creation The [`child_process.spawnSync()`][], [`child_process.execSync()`][], and -[`child_process.execFileSync()`][] methods are **synchronous** and **WILL** block -the Node.js event loop, pausing execution of any additional code until the +[`child_process.execFileSync()`][] methods are **synchronous** and **WILL** +block the Node.js event loop, pausing execution of any additional code until the spawned process exits. Blocking calls like these are mostly useful for simplifying general-purpose @@ -728,10 +732,10 @@ changes: * Returns: {Buffer|string} The stdout from the command. The `child_process.execFileSync()` method is generally identical to -[`child_process.execFile()`][] with the exception that the method will not return -until the child process has fully closed. When a timeout has been encountered -and `killSignal` is sent, the method won't return until the process has -completely exited. +[`child_process.execFile()`][] with the exception that the method will not +return until the child process has fully closed. When a timeout has been +encountered and `killSignal` is sent, the method won't return until the process +has completely exited. If the child process intercepts and handles the `SIGTERM` signal and does not exit, the parent process will still wait until the child process has @@ -791,11 +795,11 @@ changes: * Returns: {Buffer|string} The stdout from the command. The `child_process.execSync()` method is generally identical to -[`child_process.exec()`][] with the exception that the method will not return until -the child process has fully closed. When a timeout has been encountered and -`killSignal` is sent, the method won't return until the process has completely -exited. *Note that if the child process intercepts and handles the `SIGTERM` -signal and doesn't exit, the parent process will wait until the child +[`child_process.exec()`][] with the exception that the method will not return +until the child process has fully closed. When a timeout has been encountered +and `killSignal` is sent, the method won't return until the process has +completely exited. *Note that if the child process intercepts and handles the +`SIGTERM` signal and doesn't exit, the parent process will wait until the child process has exited.* If the process times out or has a non-zero exit code, this method ***will*** @@ -885,8 +889,8 @@ arbitrary command execution.** added: v2.2.0 --> -Instances of the `ChildProcess` class are [`EventEmitters`][`EventEmitter`] that represent -spawned child processes. +Instances of the `ChildProcess` class are [`EventEmitters`][`EventEmitter`] that +represent spawned child processes. Instances of `ChildProcess` are not intended to be created directly. Rather, use the [`child_process.spawn()`][], [`child_process.exec()`][], @@ -964,8 +968,8 @@ added: v0.5.9 * `sendHandle` {Handle} A [`net.Socket`][] or [`net.Server`][] object, or undefined. -The `'message'` event is triggered when a child process uses [`process.send()`][] -to send messages. +The `'message'` event is triggered when a child process uses +[`process.send()`][] to send messages. The message goes through serialization and parsing. The resulting message might not be the same as what is originally sent. @@ -1034,11 +1038,11 @@ grep.on('close', (code, signal) => { grep.kill('SIGHUP'); ``` -The [`ChildProcess`][] object may emit an [`'error'`][] event if the signal cannot be -delivered. Sending a signal to a child process that has already exited is not -an error but may have unforeseen consequences. Specifically, if the process -identifier (PID) has been reassigned to another process, the signal will be -delivered to that process instead which can have unexpected results. +The [`ChildProcess`][] object may emit an [`'error'`][] event if the signal +cannot be delivered. Sending a signal to a child process that has already exited +is not an error but may have unforeseen consequences. Specifically, if the +process identifier (PID) has been reassigned to another process, the signal will +be delivered to that process instead which can have unexpected results. Note that while the function is called `kill`, the signal delivered to the child process may not actually terminate the process. @@ -1180,8 +1184,8 @@ process.on('message', (m) => { process.send({ foo: 'bar', baz: NaN }); ``` -Child Node.js processes will have a [`process.send()`][] method of their own that -allows the child to send messages back to the parent. +Child Node.js processes will have a [`process.send()`][] method of their own +that allows the child to send messages back to the parent. There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages containing a `NODE_` prefix in the `cmd` property are reserved for use within @@ -1202,8 +1206,8 @@ sent but before the child may have received it. The function is called with a single argument: `null` on success, or an [`Error`][] object on failure. If no `callback` function is provided and the message cannot be sent, an -`'error'` event will be emitted by the [`ChildProcess`][] object. This can happen, -for instance, when the child process has already exited. +`'error'` event will be emitted by the [`ChildProcess`][] object. This can +happen, for instance, when the child process has already exited. `subprocess.send()` will return `false` if the channel has closed or when the backlog of unsent messages exceeds a threshold that makes it unwise to send @@ -1245,8 +1249,9 @@ can be handled by the parent and some by the child. While the example above uses a server created using the `net` module, `dgram` module servers use exactly the same workflow with the exceptions of listening on -a `'message'` event instead of `'connection'` and using `server.bind()` instead of -`server.listen()`. This is, however, currently only supported on UNIX platforms. +a `'message'` event instead of `'connection'` and using `server.bind()` instead +of `server.listen()`. This is, however, currently only supported on UNIX +platforms. #### Example: sending a socket object From 4d1c87ed6bcfbb0791c52b86f1ec2aece26af20e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Feb 2019 11:43:04 -0800 Subject: [PATCH 047/213] doc: remove all-caps shouting from child_process.md Remove all-caps from child_process.md. PR-URL: https://github.com/nodejs/node/pull/26141 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell --- doc/api/child_process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 62b2ff08c1e8eb..a5579451a7325c 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -674,7 +674,7 @@ See also: [`child_process.exec()`][] and [`child_process.fork()`][]. ## Synchronous Process Creation The [`child_process.spawnSync()`][], [`child_process.execSync()`][], and -[`child_process.execFileSync()`][] methods are **synchronous** and **WILL** +[`child_process.execFileSync()`][] methods are **synchronous** and **will** block the Node.js event loop, pausing execution of any additional code until the spawned process exits. From 789b818ad191022b637e76fff4ac71309f58c15c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Feb 2019 11:45:50 -0800 Subject: [PATCH 048/213] doc: remove unnecessary bold italics from child_process.md PR-URL: https://github.com/nodejs/node/pull/26141 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell --- doc/api/child_process.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index a5579451a7325c..108efb91cef7cd 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -741,8 +741,8 @@ If the child process intercepts and handles the `SIGTERM` signal and does not exit, the parent process will still wait until the child process has exited. -If the process times out or has a non-zero exit code, this method ***will*** -throw an [`Error`][] that will include the full result of the underlying +If the process times out or has a non-zero exit code, this method will throw an +[`Error`][] that will include the full result of the underlying [`child_process.spawnSync()`][]. **If the `shell` option is enabled, do not pass unsanitized user input to this @@ -802,8 +802,8 @@ completely exited. *Note that if the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child process has exited.* -If the process times out or has a non-zero exit code, this method ***will*** -throw. The [`Error`][] object will contain the entire result from +If the process times out or has a non-zero exit code, this method will throw. +The [`Error`][] object will contain the entire result from [`child_process.spawnSync()`][]. **Never pass unsanitized user input to this function. Any input containing shell From b48a04bc322b0a17c140d32ec77a458bf0f0cbc9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Feb 2019 11:48:24 -0800 Subject: [PATCH 049/213] doc: remove unnecessary bold text from child_process.md PR-URL: https://github.com/nodejs/node/pull/26141 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell --- doc/api/child_process.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 108efb91cef7cd..64edf151e3b4e9 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -674,9 +674,9 @@ See also: [`child_process.exec()`][] and [`child_process.fork()`][]. ## Synchronous Process Creation The [`child_process.spawnSync()`][], [`child_process.execSync()`][], and -[`child_process.execFileSync()`][] methods are **synchronous** and **will** -block the Node.js event loop, pausing execution of any additional code until the -spawned process exits. +[`child_process.execFileSync()`][] methods are synchronous and will block the +Node.js event loop, pausing execution of any additional code until the spawned +process exits. Blocking calls like these are mostly useful for simplifying general-purpose scripting tasks and for simplifying the loading/processing of application From e506f6a2d6468df528566e6370b8c57364687d5e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Feb 2019 11:50:41 -0800 Subject: [PATCH 050/213] doc: remove unnecessary italics from child_process.md PR-URL: https://github.com/nodejs/node/pull/26141 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell --- doc/api/child_process.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 64edf151e3b4e9..7af04298163b8d 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -40,8 +40,9 @@ the event loop until the spawned process either exits or is terminated. For convenience, the `child_process` module provides a handful of synchronous and asynchronous alternatives to [`child_process.spawn()`][] and -[`child_process.spawnSync()`][]. *Note that each of these alternatives are -implemented on top of [`child_process.spawn()`][] or [`child_process.spawnSync()`][].* +[`child_process.spawnSync()`][]. Note that each of these alternatives are +implemented on top of [`child_process.spawn()`][] or +[`child_process.spawnSync()`][]. * [`child_process.exec()`][]: spawns a shell and runs a command within that shell, passing the `stdout` and `stderr` to a callback function when @@ -53,9 +54,9 @@ implemented on top of [`child_process.spawn()`][] or [`child_process.spawnSync() specified module with an IPC communication channel established that allows sending messages between parent and child. * [`child_process.execSync()`][]: a synchronous version of - [`child_process.exec()`][] that *will* block the Node.js event loop. + [`child_process.exec()`][] that will block the Node.js event loop. * [`child_process.execFileSync()`][]: a synchronous version of - [`child_process.execFile()`][] that *will* block the Node.js event loop. + [`child_process.execFile()`][] that will block the Node.js event loop. For certain use cases, such as automating shell scripts, the [synchronous counterparts][] may be more convenient. In many cases, however, @@ -527,8 +528,8 @@ added: v0.7.10 On Windows, setting `options.detached` to `true` makes it possible for the child process to continue running after the parent exits. The child will have -its own console window. *Once enabled for a child process, it cannot be -disabled*. +its own console window. Once enabled for a child process, it cannot be +disabled. On non-Windows platforms, if `options.detached` is set to `true`, the child process will be made the leader of a new process group and session. Note that @@ -611,7 +612,7 @@ pipes between the parent and child. The value is one of the following: for fds 0 - 2 are also available as [`subprocess.stdin`][], [`subprocess.stdout`][] and [`subprocess.stderr`][], respectively. 2. `'ipc'` - Create an IPC channel for passing messages/file descriptors - between parent and child. A [`ChildProcess`][] may have at most *one* IPC + between parent and child. A [`ChildProcess`][] may have at most one IPC stdio file descriptor. Setting this option enables the [`subprocess.send()`][] method. If the child is a Node.js process, the presence of an IPC channel will enable [`process.send()`][] and @@ -798,9 +799,9 @@ The `child_process.execSync()` method is generally identical to [`child_process.exec()`][] with the exception that the method will not return until the child process has fully closed. When a timeout has been encountered and `killSignal` is sent, the method won't return until the process has -completely exited. *Note that if the child process intercepts and handles the +completely exited. Note that if the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child -process has exited.* +process has exited. If the process times out or has a non-zero exit code, this method will throw. The [`Error`][] object will contain the entire result from @@ -1329,8 +1330,8 @@ added: v0.1.90 A `Writable Stream` that represents the child process's `stdin`. -*Note that if a child process waits to read all of its input, the child will not -continue until this stream has been closed via `end()`.* +Note that if a child process waits to read all of its input, the child will not +continue until this stream has been closed via `end()`. If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, then this will be `null`. From e108c3286582ad6884c9b5efc9d3713b6e9d15f6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 15 Feb 2019 12:03:53 -0800 Subject: [PATCH 051/213] doc: eliminate use of "note that" from child_process.md PR-URL: https://github.com/nodejs/node/pull/26141 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell --- doc/api/child_process.md | 55 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 7af04298163b8d..9586b662eb17ed 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -40,9 +40,8 @@ the event loop until the spawned process either exits or is terminated. For convenience, the `child_process` module provides a handful of synchronous and asynchronous alternatives to [`child_process.spawn()`][] and -[`child_process.spawnSync()`][]. Note that each of these alternatives are -implemented on top of [`child_process.spawn()`][] or -[`child_process.spawnSync()`][]. +[`child_process.spawnSync()`][]. Each of these alternatives are implemented on +top of [`child_process.spawn()`][] or [`child_process.spawnSync()`][]. * [`child_process.exec()`][]: spawns a shell and runs a command within that shell, passing the `stdout` and `stderr` to a callback function when @@ -532,9 +531,9 @@ its own console window. Once enabled for a child process, it cannot be disabled. On non-Windows platforms, if `options.detached` is set to `true`, the child -process will be made the leader of a new process group and session. Note that -child processes may continue running after the parent exits regardless of -whether they are detached or not. See setsid(2) for more information. +process will be made the leader of a new process group and session. Child +processes may continue running after the parent exits regardless of whether +they are detached or not. See setsid(2) for more information. By default, the parent will wait for the detached child to exit. To prevent the parent from waiting for a given `subprocess` to exit, use the @@ -633,9 +632,9 @@ pipes between the parent and child. The value is one of the following: 5. {Stream} object - Share a readable or writable stream that refers to a tty, file, socket, or a pipe with the child process. The stream's underlying file descriptor is duplicated in the child process to the fd that - corresponds to the index in the `stdio` array. Note that the stream must - have an underlying descriptor (file streams do not until the `'open'` - event has occurred). + corresponds to the index in the `stdio` array. The stream must have an + underlying descriptor (file streams do not until the `'open'` event has + occurred). 6. Positive integer - The integer value is interpreted as a file descriptor that is currently open in the parent process. It is shared with the child process, similar to how {Stream} objects can be shared. @@ -799,9 +798,9 @@ The `child_process.execSync()` method is generally identical to [`child_process.exec()`][] with the exception that the method will not return until the child process has fully closed. When a timeout has been encountered and `killSignal` is sent, the method won't return until the process has -completely exited. Note that if the child process intercepts and handles the -`SIGTERM` signal and doesn't exit, the parent process will wait until the child -process has exited. +completely exited. If the child process intercepts and handles the `SIGTERM` +signal and doesn't exit, the parent process will wait until the child process +has exited. If the process times out or has a non-zero exit code, this method will throw. The [`Error`][] object will contain the entire result from @@ -877,9 +876,9 @@ The `child_process.spawnSync()` method is generally identical to [`child_process.spawn()`][] with the exception that the function will not return until the child process has fully closed. When a timeout has been encountered and `killSignal` is sent, the method won't return until the process has -completely exited. Note that if the process intercepts and handles the -`SIGTERM` signal and doesn't exit, the parent process will wait until the child -process has exited. +completely exited. If the process intercepts and handles the `SIGTERM` signal +and doesn't exit, the parent process will wait until the child process has +exited. **If the `shell` option is enabled, do not pass unsanitized user input to this function. Any input containing shell metacharacters may be used to trigger @@ -950,13 +949,13 @@ exited, `code` is the final exit code of the process, otherwise `null`. If the process terminated due to receipt of a signal, `signal` is the string name of the signal, otherwise `null`. One of the two will always be non-null. -Note that when the `'exit'` event is triggered, child process stdio streams -might still be open. +When the `'exit'` event is triggered, child process stdio streams might still be +open. -Also, note that Node.js establishes signal handlers for `SIGINT` and -`SIGTERM` and Node.js processes will not terminate immediately due to receipt -of those signals. Rather, Node.js will perform a sequence of cleanup actions -and then will re-raise the handled signal. +Node.js establishes signal handlers for `SIGINT` and `SIGTERM` and Node.js +processes will not terminate immediately due to receipt of those signals. +Rather, Node.js will perform a sequence of cleanup actions and then will +re-raise the handled signal. See waitpid(2). @@ -1011,7 +1010,7 @@ The `'disconnect'` event will be emitted when there are no messages in the process of being received. This will most often be triggered immediately after calling `subprocess.disconnect()`. -Note that when the child process is a Node.js instance (e.g. spawned using +When the child process is a Node.js instance (e.g. spawned using [`child_process.fork()`]), the `process.disconnect()` method can be invoked within the child process to close the IPC channel as well. @@ -1045,8 +1044,8 @@ is not an error but may have unforeseen consequences. Specifically, if the process identifier (PID) has been reassigned to another process, the signal will be delivered to that process instead which can have unexpected results. -Note that while the function is called `kill`, the signal delivered to the -child process may not actually terminate the process. +While the function is called `kill`, the signal delivered to the child process +may not actually terminate the process. See kill(2) for reference. @@ -1330,8 +1329,8 @@ added: v0.1.90 A `Writable Stream` that represents the child process's `stdin`. -Note that if a child process waits to read all of its input, the child will not -continue until this stream has been closed via `end()`. +If a child process waits to read all of its input, the child will not continue +until this stream has been closed via `end()`. If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, then this will be `null`. @@ -1348,8 +1347,8 @@ added: v0.7.10 A sparse array of pipes to the child process, corresponding with positions in the [`stdio`][] option passed to [`child_process.spawn()`][] that have been set -to the value `'pipe'`. Note that `subprocess.stdio[0]`, `subprocess.stdio[1]`, -and `subprocess.stdio[2]` are also available as `subprocess.stdin`, +to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and +`subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`, respectively. In the following example, only the child's fd `1` (stdout) is configured as a From 59ca9e9ccfb39bf11a4ed450a293d2406d9c0f86 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 16 Feb 2019 05:01:35 -0800 Subject: [PATCH 052/213] test: consolidate assertions in ipv6only test PR-URL: https://github.com/nodejs/node/pull/26149 Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-cluster-net-listen-ipv6only-rr.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/parallel/test-cluster-net-listen-ipv6only-rr.js b/test/parallel/test-cluster-net-listen-ipv6only-rr.js index de254a4fe9ecd9..e5944ccf602e54 100644 --- a/test/parallel/test-cluster-net-listen-ipv6only-rr.js +++ b/test/parallel/test-cluster-net-listen-ipv6only-rr.js @@ -40,9 +40,7 @@ if (cluster.isMaster) { if (!address) { address = workerAddress; } else { - assert.strictEqual(address.addressType, workerAddress.addressType); - assert.strictEqual(address.host, workerAddress.host); - assert.strictEqual(address.port, workerAddress.port); + assert.deepStrictEqual(workerAddress, address); } countdown.dec(); })); From e5dae20ed6f88f779ae4de02fe4b5368e3bf756c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 16 Feb 2019 15:53:05 -0800 Subject: [PATCH 053/213] doc: remove deprecation definition in Collaborator Guide The Collaborator Guide links to a definition of "deprecation" but also quotes it extensively. Remove the extensive quotes. PR-URL: https://github.com/nodejs/node/pull/26157 Reviewed-By: Gus Caplan Reviewed-By: Richard Lau Reviewed-By: Anto Aravinth Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- COLLABORATOR_GUIDE.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 726cc4bd65f4c3..06840d27e73111 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -319,13 +319,7 @@ guide](https://github.com/nodejs/node/blob/master/doc/guides/adding-new-napi-api ### Deprecations -[_Deprecation_][] is "the discouragement of use of some … feature … or practice, -typically because it has been superseded or is no longer considered efficient or -safe, without completely removing it or prohibiting its use. It can also imply -that a feature, design, or practice will be removed or discontinued entirely in -the future." - -Node.js uses three Deprecation levels: +Node.js uses three [Deprecation][] levels: * *Documentation-Only Deprecation*: A deprecation notice is added to the API documentation but no functional changes are implemented in the code. By @@ -795,9 +789,9 @@ When things need extra attention, are controversial, or `semver-major`: If you cannot find who to cc for a file, `git shortlog -n -s ` may help. ["Merge Pull Request"]: https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-on-github +[Deprecation]: https://en.wikipedia.org/wiki/Deprecation [Stability Index]: doc/api/documentation.md#stability-index [TSC]: https://github.com/nodejs/TSC -[_Deprecation_]: https://en.wikipedia.org/wiki/Deprecation [`--pending-deprecation`]: doc/api/cli.md#--pending-deprecation [`--throw-deprecation`]: doc/api/cli.md#--throw-deprecation [`node-core-utils`]: https://github.com/nodejs/node-core-utils From bf61050e916fcc5dd1560e5ddd4dd4df4ff784e7 Mon Sep 17 00:00:00 2001 From: Abhishek Agarwal Date: Fri, 15 Feb 2019 00:23:13 +0530 Subject: [PATCH 054/213] lib: converted element to lowercase in tty.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Converted the first element "Eterm" in TERM_ENVS array to "eterm" PR-URL: https://github.com/nodejs/node/pull/26121 Fixes: https://github.com/nodejs/node/issues/26077 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Anto Aravinth Reviewed-By: Weijia Wang Reviewed-By: Yuta Hiroto Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Minwoo Jung --- lib/internal/tty.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/tty.js b/lib/internal/tty.js index 1e60909f66a636..ea0bea4bfac94c 100644 --- a/lib/internal/tty.js +++ b/lib/internal/tty.js @@ -37,7 +37,7 @@ const COLORS_16m = 24; // distribution of this file, with or without modification, are permitted // provided the copyright notice and this notice are preserved. const TERM_ENVS = [ - 'Eterm', + 'eterm', 'cons25', 'console', 'cygwin', From 8fac54a22fd1c23be920bf868b7173f036f73700 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 13 Feb 2019 22:11:15 +0800 Subject: [PATCH 055/213] doc: fix code lang in repl.md PR-URL: https://github.com/nodejs/node/pull/26075 Reviewed-By: Lance Ball Reviewed-By: Daniel Bevenius --- doc/api/repl.md | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/doc/api/repl.md b/doc/api/repl.md index 5a817348433790..324b15f3852288 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -42,8 +42,7 @@ The following special commands are supported by all REPL instances: `> .load ./file/to/load.js` * `.editor` - Enter editor mode (`-D` to finish, `-C` to cancel). - -```js +```console > .editor // Entering editor mode (^D to finish, ^C to cancel) function welcome(name) { @@ -78,8 +77,7 @@ evaluation function when the [`repl.REPLServer`][] instance is created. The default evaluator supports direct evaluation of JavaScript expressions: - -```js +```console > 1 + 1 2 > const m = 2 @@ -107,8 +105,7 @@ repl.start('> ').context.m = msg; Properties in the `context` object appear as local within the REPL: - -```js +```console $ node repl_test.js > m 'message' @@ -136,8 +133,7 @@ REPL environment when used. For instance, unless otherwise declared as a global or scoped variable, the input `fs` will be evaluated on-demand as `global.fs = require('fs')`. - -```js +```console > fs.createReadStream('./some/file'); ``` @@ -164,8 +160,7 @@ The default evaluator will, by default, assign the result of the most recently evaluated expression to the special variable `_` (underscore). Explicitly setting `_` to a value will disable this behavior. - -```js +```console > [ 'a', 'b', 'c' ] [ 'a', 'b', 'c' ] > _.length @@ -182,8 +177,7 @@ Expression assignment to _ now disabled. Similarly, `_error` will refer to the last seen error, if there was any. Explicitly setting `_error` to a value will disable this behavior. - -```js +```console > throw new Error('foo'); Error: foo > _error.message @@ -195,8 +189,7 @@ Error: foo With the [`--experimental-repl-await`][] command line option specified, experimental support for the `await` keyword is enabled. - -```js +```console > await Promise.resolve(123) 123 > await Promise.reject(new Error('REPL await')) @@ -341,8 +334,7 @@ r.on('reset', initializeContext); When this code is executed, the global `'m'` variable can be modified but then reset to its initial value using the `.clear` command: - -```js +```console $ ./node example.js > m 'test' @@ -534,8 +526,7 @@ Node.js itself uses the `repl` module to provide its own interactive interface for executing JavaScript. This can be used by executing the Node.js binary without passing any arguments (or by passing the `-i` argument): - -```js +```console $ node > const a = [1, 2, 3]; undefined From 25ddbc9a367b56f0c10d9c25296e87b5c9fc11bf Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Mon, 11 Feb 2019 17:20:52 +0800 Subject: [PATCH 056/213] src: apply clang-tidy rule performance-unnecessary-value-param PR-URL: https://github.com/nodejs/node/pull/26042 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/env-inl.h | 6 ++++-- src/env.h | 7 ++++--- src/node_crypto.cc | 2 +- src/node_messaging.cc | 2 +- src/node_messaging.h | 2 +- src/node_perf.cc | 2 +- src/node_url.h | 8 ++++---- src/sharedarraybuffer_metadata.cc | 4 +++- src/util.h | 3 ++- test/cctest/test_inspector_socket_server.cc | 8 ++++---- 10 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index 60dafc04e16516..b115f9686b7e4d 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -37,6 +37,8 @@ #include #include +#include + namespace node { inline v8::Isolate* IsolateData::isolate() const { @@ -395,7 +397,7 @@ inline uv_loop_t* Environment::event_loop() const { inline void Environment::TryLoadAddon( const char* filename, int flags, - std::function was_loaded) { + const std::function& was_loaded) { loaded_addons_.emplace_back(filename, flags); if (!was_loaded(&loaded_addons_.back())) { loaded_addons_.pop_back(); @@ -597,7 +599,7 @@ inline std::shared_ptr IsolateData::options() { inline void IsolateData::set_options( std::shared_ptr options) { - options_ = options; + options_ = std::move(options); } void Environment::CreateImmediate(native_immediate_callback cb, diff --git a/src/env.h b/src/env.h index 626b43121b44ee..773d12d4a1e15d 100644 --- a/src/env.h +++ b/src/env.h @@ -661,9 +661,10 @@ class Environment { inline v8::Isolate* isolate() const; inline uv_loop_t* event_loop() const; - inline void TryLoadAddon(const char* filename, - int flags, - std::function was_loaded); + inline void TryLoadAddon( + const char* filename, + int flags, + const std::function& was_loaded); static inline Environment* from_timer_handle(uv_timer_t* handle); inline uv_timer_t* timer_handle(); diff --git a/src/node_crypto.cc b/src/node_crypto.cc index bab55a738f3208..dbeb82507d7e08 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2685,7 +2685,7 @@ static ParsePublicKeyResult TryParsePublicKey( const BIOPointer& bp, const char* name, // NOLINTNEXTLINE(runtime/int) - std::function parse) { + const std::function& parse) { unsigned char* der_data; long der_len; // NOLINT(runtime/int) diff --git a/src/node_messaging.cc b/src/node_messaging.cc index 50d84f01d679d4..16e46f9dd02409 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -148,7 +148,7 @@ MaybeLocal Message::Deserialize(Environment* env, } void Message::AddSharedArrayBuffer( - SharedArrayBufferMetadataReference reference) { + const SharedArrayBufferMetadataReference& reference) { shared_array_buffers_.push_back(reference); } diff --git a/src/node_messaging.h b/src/node_messaging.h index e1ced4f3fdedd8..cfda69ae7ff16b 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -43,7 +43,7 @@ class Message : public MemoryRetainer { // Internal method of Message that is called when a new SharedArrayBuffer // object is encountered in the incoming value's structure. - void AddSharedArrayBuffer(SharedArrayBufferMetadataReference ref); + void AddSharedArrayBuffer(const SharedArrayBufferMetadataReference& ref); // Internal method of Message that is called once serialization finishes // and that transfers ownership of `data` to this message. void AddMessagePort(std::unique_ptr&& data); diff --git a/src/node_perf.cc b/src/node_perf.cc index f63dc6abf09005..908c76c2110d26 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -181,7 +181,7 @@ void ClearMark(const FunctionCallbackInfo& args) { } } -inline uint64_t GetPerformanceMark(Environment* env, std::string name) { +inline uint64_t GetPerformanceMark(Environment* env, const std::string& name) { auto marks = env->performance_marks(); auto res = marks->find(name); return res != marks->end() ? res->second : 0; diff --git a/src/node_url.h b/src/node_url.h index 47b859b879bca4..e85b14e2bdf35c 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -109,16 +109,16 @@ class URL { } } - explicit URL(std::string input) : + explicit URL(const std::string& input) : URL(input.c_str(), input.length()) {} - URL(std::string input, const URL* base) : + URL(const std::string& input, const URL* base) : URL(input.c_str(), input.length(), base) {} - URL(std::string input, const URL& base) : + URL(const std::string& input, const URL& base) : URL(input.c_str(), input.length(), &base) {} - URL(std::string input, std::string base) : + URL(const std::string& input, const std::string& base) : URL(input.c_str(), input.length(), base.c_str(), base.length()) {} int32_t flags() { diff --git a/src/sharedarraybuffer_metadata.cc b/src/sharedarraybuffer_metadata.cc index 4e6f5a349d1d57..5c58fac3ccf257 100644 --- a/src/sharedarraybuffer_metadata.cc +++ b/src/sharedarraybuffer_metadata.cc @@ -1,4 +1,6 @@ #include "sharedarraybuffer_metadata.h" + +#include #include "base_object.h" #include "base_object-inl.h" #include "node_errors.h" @@ -43,7 +45,7 @@ class SABLifetimePartner : public BaseObject { Local obj, SharedArrayBufferMetadataReference r) : BaseObject(env, obj), - reference(r) { + reference(std::move(r)) { MakeWeak(); } diff --git a/src/util.h b/src/util.h index b199476aa246bf..312f91e68e8b97 100644 --- a/src/util.h +++ b/src/util.h @@ -40,6 +40,7 @@ #include #include #include +#include namespace node { @@ -450,7 +451,7 @@ template inline void USE(T&&) {} struct OnScopeLeave { std::function fn_; - explicit OnScopeLeave(std::function fn) : fn_(fn) {} + explicit OnScopeLeave(std::function fn) : fn_(std::move(fn)) {} ~OnScopeLeave() { fn_(); } }; diff --git a/test/cctest/test_inspector_socket_server.cc b/test/cctest/test_inspector_socket_server.cc index 30da5cf3d2ceaa..5797708483b6f8 100644 --- a/test/cctest/test_inspector_socket_server.cc +++ b/test/cctest/test_inspector_socket_server.cc @@ -92,7 +92,7 @@ class SocketWrapper { connected_(false), sending_(false) { } - void Connect(std::string host, int port, bool v6 = false) { + void Connect(const std::string& host, int port, bool v6 = false) { closed_ = false; connection_failed_ = false; connected_ = false; @@ -114,7 +114,7 @@ class SocketWrapper { ReadCallback); } - void ExpectFailureToConnect(std::string host, int port) { + void ExpectFailureToConnect(const std::string& host, int port) { connected_ = false; connection_failed_ = false; closed_ = false; @@ -243,7 +243,7 @@ class ServerHolder { : ServerHolder(has_targets, loop, HOST, port, nullptr) { } ServerHolder(bool has_targets, uv_loop_t* loop, - const std::string host, int port, FILE* out); + const std::string& host, int port, FILE* out); InspectorSocketServer* operator->() { return server_.get(); @@ -350,7 +350,7 @@ class TestSocketServerDelegate : public SocketServerDelegate { }; ServerHolder::ServerHolder(bool has_targets, uv_loop_t* loop, - const std::string host, int port, FILE* out) { + const std::string& host, int port, FILE* out) { std::vector targets; if (has_targets) targets = { MAIN_TARGET_ID }; From b338edbb0ab1ae9823d1128ef9baa4295885b9d7 Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Thu, 28 Jun 2018 12:15:15 +0530 Subject: [PATCH 057/213] module: use compileFunction over Module.wrap Use vm.compileFunction (which is a binding for v8::CompileFunctionInContext) instead of Module.wrap internally in Module._compile for the cjs loader. Fixes: https://github.com/nodejs/node/issues/17396 PR-URL: https://github.com/nodejs/node/pull/21573 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Gus Caplan Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen --- lib/internal/modules/cjs/loader.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index c37233ffd45252..bc7ecf9f16c7f8 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -692,19 +692,13 @@ Module.prototype._compile = function(content, filename) { content = stripShebang(content); - // create wrapper function - var wrapper = Module.wrap(content); - - var compiledWrapper = vm.runInThisContext(wrapper, { - filename: filename, - lineOffset: 0, - displayErrors: true, - importModuleDynamically: experimentalModules ? async (specifier) => { - if (asyncESM === undefined) lazyLoadESM(); - const loader = await asyncESM.loaderPromise; - return loader.import(specifier, normalizeReferrerURL(filename)); - } : undefined, - }); + const compiledWrapper = vm.compileFunction(content, [ + 'exports', + 'require', + 'module', + '__filename', + '__dirname', + ], { filename }); var inspectorWrapper = null; if (process._breakFirstLine && process._eval == null) { From 54896a6961060f8e19e0dcf0576e3fd3d62fd33d Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Wed, 7 Nov 2018 22:17:09 +0530 Subject: [PATCH 058/213] module: revert module._compile to original state if module is patched PR-URL: https://github.com/nodejs/node/pull/21573 Fixes: https://github.com/nodejs/node/issues/17396 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Gus Caplan Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen --- lib/assert.js | 11 --- lib/internal/modules/cjs/helpers.js | 11 +++ lib/internal/modules/cjs/loader.js | 100 +++++++++++++++++++++++----- src/env-inl.h | 3 + src/env.cc | 11 +++ src/env.h | 10 +++ src/module_wrap.cc | 2 + src/module_wrap.h | 1 + src/node_contextify.cc | 55 ++++++++++++--- src/node_contextify.h | 2 + test/fixtures/cjs-module-wrap.js | 9 +++ test/parallel/test-module-wrap.js | 9 +++ test/parallel/test-v8-coverage.js | 26 ++++---- 13 files changed, 201 insertions(+), 49 deletions(-) create mode 100644 test/fixtures/cjs-module-wrap.js create mode 100644 test/parallel/test-module-wrap.js diff --git a/lib/assert.js b/lib/assert.js index 013ae6e674faec..94e9406393bf67 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -39,7 +39,6 @@ let isDeepEqual; let isDeepStrictEqual; let parseExpressionAt; let findNodeAround; -let columnOffset = 0; let decoder; function lazyLoadComparison() { @@ -256,16 +255,6 @@ function getErrMessage(message, fn) { const line = call.getLineNumber() - 1; let column = call.getColumnNumber() - 1; - // Line number one reports the wrong column due to being wrapped in a - // function. Remove that offset to get the actual call. - if (line === 0) { - if (columnOffset === 0) { - const { wrapper } = require('internal/modules/cjs/loader'); - columnOffset = wrapper[0].length; - } - column -= columnOffset; - } - const identifier = `${filename}${line}${column}`; if (errorCache.has(identifier)) { diff --git a/lib/internal/modules/cjs/helpers.js b/lib/internal/modules/cjs/helpers.js index 1a2a91c509b011..2e5290b4520a27 100644 --- a/lib/internal/modules/cjs/helpers.js +++ b/lib/internal/modules/cjs/helpers.js @@ -1,6 +1,9 @@ 'use strict'; const { validateString } = require('internal/validators'); +const path = require('path'); +const { pathToFileURL } = require('internal/url'); +const { URL } = require('url'); const { CHAR_LINE_FEED, @@ -145,10 +148,18 @@ function addBuiltinLibsToObject(object) { }); } +function normalizeReferrerURL(referrer) { + if (typeof referrer === 'string' && path.isAbsolute(referrer)) { + return pathToFileURL(referrer).href; + } + return new URL(referrer).href; +} + module.exports = exports = { addBuiltinLibsToObject, builtinLibs, makeRequireFunction, + normalizeReferrerURL, requireDepth: 0, stripBOM, stripShebang diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index bc7ecf9f16c7f8..fd592be8ea4c7e 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -29,7 +29,6 @@ const assert = require('internal/assert'); const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); -const { URL } = require('url'); const { internalModuleReadJSON, internalModuleStat @@ -37,6 +36,7 @@ const { const { safeGetenv } = internalBinding('credentials'); const { makeRequireFunction, + normalizeReferrerURL, requireDepth, stripBOM, stripShebang @@ -48,6 +48,7 @@ const experimentalModules = getOptionValue('--experimental-modules'); const manifest = getOptionValue('--experimental-policy') ? require('internal/process/policy').manifest : null; +const { compileFunction } = internalBinding('contextify'); const { ERR_INVALID_ARG_VALUE, @@ -129,15 +130,52 @@ Module._extensions = Object.create(null); var modulePaths = []; Module.globalPaths = []; -Module.wrap = function(script) { +let patched = false; + +// eslint-disable-next-line func-style +let wrap = function(script) { return Module.wrapper[0] + script + Module.wrapper[1]; }; -Module.wrapper = [ +const wrapper = [ '(function (exports, require, module, __filename, __dirname) { ', '\n});' ]; +let wrapperProxy = new Proxy(wrapper, { + set(target, property, value, receiver) { + patched = true; + return Reflect.set(target, property, value, receiver); + }, + + defineProperty(target, property, descriptor) { + patched = true; + return Object.defineProperty(target, property, descriptor); + } +}); + +Object.defineProperty(Module, 'wrap', { + get() { + return wrap; + }, + + set(value) { + patched = true; + wrap = value; + } +}); + +Object.defineProperty(Module, 'wrapper', { + get() { + return wrapperProxy; + }, + + set(value) { + patched = true; + wrapperProxy = value; + } +}); + const debug = util.debuglog('module'); Module._debug = util.deprecate(debug, 'Module._debug is deprecated.', @@ -672,13 +710,6 @@ Module.prototype.require = function(id) { // (needed for setting breakpoint when called with --inspect-brk) var resolvedArgv; -function normalizeReferrerURL(referrer) { - if (typeof referrer === 'string' && path.isAbsolute(referrer)) { - return pathToFileURL(referrer).href; - } - return new URL(referrer).href; -} - // Run the file contents in the correct scope or sandbox. Expose // the correct helper variables (require, module, exports) to @@ -692,13 +723,48 @@ Module.prototype._compile = function(content, filename) { content = stripShebang(content); - const compiledWrapper = vm.compileFunction(content, [ - 'exports', - 'require', - 'module', - '__filename', - '__dirname', - ], { filename }); + let compiledWrapper; + if (patched) { + const wrapper = Module.wrap(content); + compiledWrapper = vm.runInThisContext(wrapper, { + filename, + lineOffset: 0, + displayErrors: true, + importModuleDynamically: experimentalModules ? async (specifier) => { + if (asyncESM === undefined) lazyLoadESM(); + const loader = await asyncESM.loaderPromise; + return loader.import(specifier, normalizeReferrerURL(filename)); + } : undefined, + }); + } else { + compiledWrapper = compileFunction( + content, + filename, + 0, + 0, + undefined, + false, + undefined, + [], + [ + 'exports', + 'require', + 'module', + '__filename', + '__dirname', + ] + ); + if (experimentalModules) { + const { callbackMap } = internalBinding('module_wrap'); + callbackMap.set(compiledWrapper, { + importModuleDynamically: async (specifier) => { + if (asyncESM === undefined) lazyLoadESM(); + const loader = await asyncESM.loaderPromise; + return loader.import(specifier, normalizeReferrerURL(filename)); + } + }); + } + } var inspectorWrapper = null; if (process._breakFirstLine && process._eval == null) { diff --git a/src/env-inl.h b/src/env-inl.h index b115f9686b7e4d..47331a61954726 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -461,6 +461,9 @@ inline uint32_t Environment::get_next_module_id() { inline uint32_t Environment::get_next_script_id() { return script_id_counter_++; } +inline uint32_t Environment::get_next_function_id() { + return function_id_counter_++; +} Environment::ShouldNotAbortOnUncaughtScope::ShouldNotAbortOnUncaughtScope( Environment* env) diff --git a/src/env.cc b/src/env.cc index 7610f2b7622942..42fe6bdc4b0b0e 100644 --- a/src/env.cc +++ b/src/env.cc @@ -252,6 +252,11 @@ Environment::Environment(IsolateData* isolate_data, isolate()->SetPromiseRejectCallback(task_queue::PromiseRejectCallback); } +CompileFnEntry::CompileFnEntry(Environment* env, uint32_t id) + : env(env), id(id) { + env->compile_fn_entries.insert(this); +} + Environment::~Environment() { isolate()->GetHeapProfiler()->RemoveBuildEmbedderGraphCallback( BuildEmbedderGraph, this); @@ -260,6 +265,12 @@ Environment::~Environment() { // CleanupHandles() should have removed all of them. CHECK(file_handle_read_wrap_freelist_.empty()); + // dispose the Persistent references to the compileFunction + // wrappers used in the dynamic import callback + for (auto& entry : compile_fn_entries) { + delete entry; + } + HandleScope handle_scope(isolate()); #if HAVE_INSPECTOR diff --git a/src/env.h b/src/env.h index 773d12d4a1e15d..a8b3b42d7944ed 100644 --- a/src/env.h +++ b/src/env.h @@ -448,6 +448,12 @@ struct ContextInfo { bool is_default = false; }; +struct CompileFnEntry { + Environment* env; + uint32_t id; + CompileFnEntry(Environment* env, uint32_t id); +}; + // Listing the AsyncWrap provider types first enables us to cast directly // from a provider type to a debug category. #define DEBUG_CATEGORY_NAMES(V) \ @@ -718,9 +724,12 @@ class Environment { std::unordered_map id_to_module_map; std::unordered_map id_to_script_map; + std::unordered_set compile_fn_entries; + std::unordered_map> id_to_function_map; inline uint32_t get_next_module_id(); inline uint32_t get_next_script_id(); + inline uint32_t get_next_function_id(); std::unordered_map package_json_cache; @@ -1010,6 +1019,7 @@ class Environment { uint32_t module_id_counter_ = 0; uint32_t script_id_counter_ = 0; + uint32_t function_id_counter_ = 0; AliasedBuffer should_abort_on_uncaught_toggle_; int should_not_abort_scope_counter_ = 0; diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 4414e874ffa697..f642440bff5a88 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -752,6 +752,8 @@ static MaybeLocal ImportModuleDynamically( } else if (type == ScriptType::kModule) { ModuleWrap* wrap = ModuleWrap::GetFromID(env, id); object = wrap->object(); + } else if (type == ScriptType::kFunction) { + object = env->id_to_function_map.find(id)->second.Get(iso); } else { UNREACHABLE(); } diff --git a/src/module_wrap.h b/src/module_wrap.h index 372e02bc5d1b83..dc34685fedadbc 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -20,6 +20,7 @@ enum PackageMainCheck : bool { enum ScriptType : int { kScript, kModule, + kFunction, }; enum HostDefinedOptions : int { diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 343342408b1a75..61f60576d2f2a4 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -285,6 +285,15 @@ void ContextifyContext::WeakCallback( delete context; } +void ContextifyContext::WeakCallbackCompileFn( + const WeakCallbackInfo& data) { + CompileFnEntry* entry = data.GetParameter(); + if (entry->env->compile_fn_entries.erase(entry) != 0) { + entry->env->id_to_function_map.erase(entry->id); + delete entry; + } +} + // static ContextifyContext* ContextifyContext::ContextFromContextifiedSandbox( Environment* env, @@ -1027,7 +1036,30 @@ void ContextifyContext::CompileFunction( data + cached_data_buf->ByteOffset(), cached_data_buf->ByteLength()); } - ScriptOrigin origin(filename, line_offset, column_offset, True(isolate)); + // Get the function id + uint32_t id = env->get_next_function_id(); + + // Set host_defined_options + Local host_defined_options = + PrimitiveArray::New(isolate, loader::HostDefinedOptions::kLength); + host_defined_options->Set( + isolate, + loader::HostDefinedOptions::kType, + Number::New(isolate, loader::ScriptType::kFunction)); + host_defined_options->Set( + isolate, loader::HostDefinedOptions::kID, Number::New(isolate, id)); + + ScriptOrigin origin(filename, + line_offset, // line offset + column_offset, // column offset + True(isolate), // is cross origin + Local(), // script id + Local(), // source map URL + False(isolate), // is opaque (?) + False(isolate), // is WASM + False(isolate), // is ES Module + host_defined_options); + ScriptCompiler::Source source(code, origin, cached_data); ScriptCompiler::CompileOptions options; if (source.GetCachedData() == nullptr) { @@ -1061,38 +1093,45 @@ void ContextifyContext::CompileFunction( } } - MaybeLocal maybe_fun = ScriptCompiler::CompileFunctionInContext( + MaybeLocal maybe_fn = ScriptCompiler::CompileFunctionInContext( parsing_context, &source, params.size(), params.data(), context_extensions.size(), context_extensions.data(), options); - Local fun; - if (maybe_fun.IsEmpty() || !maybe_fun.ToLocal(&fun)) { + if (maybe_fn.IsEmpty()) { DecorateErrorStack(env, try_catch); try_catch.ReThrow(); return; } + Local fn = maybe_fn.ToLocalChecked(); + env->id_to_function_map.emplace(std::piecewise_construct, + std::make_tuple(id), + std::make_tuple(isolate, fn)); + CompileFnEntry* gc_entry = new CompileFnEntry(env, id); + env->id_to_function_map[id].SetWeak(gc_entry, + WeakCallbackCompileFn, + v8::WeakCallbackType::kParameter); if (produce_cached_data) { const std::unique_ptr cached_data( - ScriptCompiler::CreateCodeCacheForFunction(fun)); + ScriptCompiler::CreateCodeCacheForFunction(fn)); bool cached_data_produced = cached_data != nullptr; if (cached_data_produced) { MaybeLocal buf = Buffer::Copy( env, reinterpret_cast(cached_data->data), cached_data->length); - if (fun->Set( + if (fn->Set( parsing_context, env->cached_data_string(), buf.ToLocalChecked()).IsNothing()) return; } - if (fun->Set( + if (fn->Set( parsing_context, env->cached_data_produced_string(), Boolean::New(isolate, cached_data_produced)).IsNothing()) return; } - args.GetReturnValue().Set(fun); + args.GetReturnValue().Set(fn); } diff --git a/src/node_contextify.h b/src/node_contextify.h index 631671cbf1a161..4186e5190f8ef9 100644 --- a/src/node_contextify.h +++ b/src/node_contextify.h @@ -61,6 +61,8 @@ class ContextifyContext { const v8::FunctionCallbackInfo& args); static void WeakCallback( const v8::WeakCallbackInfo& data); + static void WeakCallbackCompileFn( + const v8::WeakCallbackInfo& data); static void PropertyGetterCallback( v8::Local property, const v8::PropertyCallbackInfo& args); diff --git a/test/fixtures/cjs-module-wrap.js b/test/fixtures/cjs-module-wrap.js new file mode 100644 index 00000000000000..2e11cc1a3b3231 --- /dev/null +++ b/test/fixtures/cjs-module-wrap.js @@ -0,0 +1,9 @@ +const assert = require('assert'); +const m = require('module'); + +global.mwc = 0; +m.wrapper[0] += 'global.mwc = (global.mwc || 0 ) + 1;'; + +require('./not-main-module.js'); +assert.strictEqual(mwc, 1); +delete global.mwc; diff --git a/test/parallel/test-module-wrap.js b/test/parallel/test-module-wrap.js new file mode 100644 index 00000000000000..639300cb6af66a --- /dev/null +++ b/test/parallel/test-module-wrap.js @@ -0,0 +1,9 @@ +'use strict'; +require('../common'); +const fixtures = require('../common/fixtures'); +const { execFileSync } = require('child_process'); + +const cjsModuleWrapTest = fixtures.path('cjs-module-wrap.js'); +const node = process.argv[0]; + +execFileSync(node, [cjsModuleWrapTest], { stdio: 'pipe' }); diff --git a/test/parallel/test-v8-coverage.js b/test/parallel/test-v8-coverage.js index 3db8b81d5504b4..5be68bf4b7947f 100644 --- a/test/parallel/test-v8-coverage.js +++ b/test/parallel/test-v8-coverage.js @@ -27,9 +27,9 @@ function nextdir() { const fixtureCoverage = getFixtureCoverage('basic.js', coverageDirectory); assert.ok(fixtureCoverage); // first branch executed. - assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); + assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // second branch did not execute. - assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); + assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); } // Outputs coverage when process.exit(1) exits process. @@ -43,9 +43,9 @@ function nextdir() { const fixtureCoverage = getFixtureCoverage('exit-1.js', coverageDirectory); assert.ok(fixtureCoverage, 'coverage not found for file'); // first branch executed. - assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); + assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // second branch did not execute. - assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); + assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); } // Outputs coverage when process.kill(process.pid, "SIGINT"); exits process. @@ -61,9 +61,9 @@ function nextdir() { const fixtureCoverage = getFixtureCoverage('sigint.js', coverageDirectory); assert.ok(fixtureCoverage); // first branch executed. - assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); + assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // second branch did not execute. - assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); + assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); } // outputs coverage from subprocess. @@ -78,9 +78,9 @@ function nextdir() { coverageDirectory); assert.ok(fixtureCoverage); // first branch executed. - assert.strictEqual(fixtureCoverage.functions[2].ranges[0].count, 1); + assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); // second branch did not execute. - assert.strictEqual(fixtureCoverage.functions[2].ranges[1].count, 0); + assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); } // outputs coverage from worker. @@ -95,9 +95,9 @@ function nextdir() { coverageDirectory); assert.ok(fixtureCoverage); // first branch executed. - assert.strictEqual(fixtureCoverage.functions[2].ranges[0].count, 1); + assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); // second branch did not execute. - assert.strictEqual(fixtureCoverage.functions[2].ranges[1].count, 0); + assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); } // Does not output coverage if NODE_V8_COVERAGE is empty. @@ -125,7 +125,7 @@ function nextdir() { coverageDirectory); assert.ok(fixtureCoverage); // first branch executed. - assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); + assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); } // Outputs coverage when the coverage directory is not absolute. @@ -144,9 +144,9 @@ function nextdir() { absoluteCoverageDirectory); assert.ok(fixtureCoverage); // first branch executed. - assert.strictEqual(fixtureCoverage.functions[1].ranges[0].count, 1); + assert.strictEqual(fixtureCoverage.functions[0].ranges[0].count, 1); // second branch did not execute. - assert.strictEqual(fixtureCoverage.functions[1].ranges[1].count, 0); + assert.strictEqual(fixtureCoverage.functions[0].ranges[1].count, 0); } // Extracts the coverage object for a given fixture name. From 34c685b406f4292518d72f200a1d1d7498c3012c Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 16 Feb 2019 23:51:02 +0100 Subject: [PATCH 059/213] =?UTF-8?q?tracing:=20use=20=E2=80=98real=E2=80=99?= =?UTF-8?q?=20atomics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use actual atomic operations instead of things that are named as if they were atomics, but aren’t. Refs: https://github.com/nodejs/node/issues/26100 PR-URL: https://github.com/nodejs/node/pull/26156 Reviewed-By: Gus Caplan Reviewed-By: Yang Guo Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Eugene Ostroukhov --- src/tracing/trace_event.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tracing/trace_event.h b/src/tracing/trace_event.h index d5d4befb14600a..590cb592fc054f 100644 --- a/src/tracing/trace_event.h +++ b/src/tracing/trace_event.h @@ -8,6 +8,7 @@ #include "node_platform.h" #include "v8-platform.h" #include "trace_event_common.h" +#include // This header file defines implementation details of how the trace macros in // trace_event_common.h collect and store trace events. Anything not @@ -128,9 +129,10 @@ enum CategoryGroupEnabledFlags { #define TRACE_EVENT_API_ADD_METADATA_EVENT node::tracing::AddMetadataEvent // Defines atomic operations used internally by the tracing system. -#define TRACE_EVENT_API_ATOMIC_WORD intptr_t -#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var) -#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var) = (value) +#define TRACE_EVENT_API_ATOMIC_WORD std::atomic +#define TRACE_EVENT_API_ATOMIC_WORD_VALUE intptr_t +#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var).load() +#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var).store(value) //////////////////////////////////////////////////////////////////////////////// @@ -157,12 +159,12 @@ enum CategoryGroupEnabledFlags { category_group_enabled = \ TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \ TRACE_EVENT_API_ATOMIC_STORE( \ - atomic, reinterpret_cast( \ + atomic, reinterpret_cast( \ category_group_enabled)); \ } #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \ - static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \ + static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) {0}; \ const uint8_t* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \ category_group, INTERNAL_TRACE_EVENT_UID(atomic), \ From 6b7d8369e3920c5c33fedc131eaf5e9e38a0955d Mon Sep 17 00:00:00 2001 From: Uttam Pawar Date: Fri, 15 Feb 2019 09:13:13 -0800 Subject: [PATCH 060/213] src: add missing includes for vtune build `v8-vtune.h` must be included in order to be able to build with vtune support. PR-URL: https://github.com/nodejs/node/pull/26136 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau --- src/api/environment.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/environment.cc b/src/api/environment.cc index ee9e623faa6cb6..91e4495538392f 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -9,6 +9,10 @@ #include "node_v8_platform-inl.h" #include "uv.h" +#ifdef NODE_ENABLE_VTUNE_PROFILING +#include "../deps/v8/src/third_party/vtune/v8-vtune.h" +#endif + namespace node { using v8::Context; using v8::Function; From fde40116c4fe9d991cebcad5f56fa4f7d5b4bf2e Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 20 Feb 2019 01:40:40 +0800 Subject: [PATCH 061/213] process: fix calculation in process.uptime() In https://github.com/nodejs/node/pull/26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: https://github.com/nodejs/node/pull/26016 PR-URL: https://github.com/nodejs/node/pull/26206 Fixes: https://github.com/nodejs/node/issues/26205 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Richard Lau --- src/node_process_methods.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index dfcc6641a1c5f8..80027c26ebcf15 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -57,10 +57,8 @@ Mutex umask_mutex; // Microseconds in a second, as a float, used in CPUUsage() below #define MICROS_PER_SEC 1e6 -// used in Hrtime() below +// used in Hrtime() and Uptime() below #define NANOS_PER_SEC 1000000000 -// Used in Uptime() -#define NANOS_PER_MICROS 1e3 #ifdef _WIN32 /* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ @@ -246,7 +244,7 @@ static void Uptime(const FunctionCallbackInfo& args) { uv_update_time(env->event_loop()); double uptime = static_cast(uv_hrtime() - per_process::node_start_time); - Local result = Number::New(env->isolate(), uptime / NANOS_PER_MICROS); + Local result = Number::New(env->isolate(), uptime / NANOS_PER_SEC); args.GetReturnValue().Set(result); } From cd10e25bd68f4214370ff6c37f221dea59095b73 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 20 Feb 2019 01:43:23 +0800 Subject: [PATCH 062/213] process: move test-process-uptime to parallel In addition, do not make too many assumptions about the startup time and timer latency in test-process-uptime. Instead only test that the value is likely in the correct unit (seconds) and it should be increasing in subsequent calls. PR-URL: https://github.com/nodejs/node/pull/26206 Fixes: https://github.com/nodejs/node/issues/26205 Refs: https://github.com/nodejs/node/pull/26016 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Richard Lau --- test/{pummel => parallel}/test-process-uptime.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename test/{pummel => parallel}/test-process-uptime.js (86%) diff --git a/test/pummel/test-process-uptime.js b/test/parallel/test-process-uptime.js similarity index 86% rename from test/pummel/test-process-uptime.js rename to test/parallel/test-process-uptime.js index 781066371eaa31..eabb6cf2661c87 100644 --- a/test/pummel/test-process-uptime.js +++ b/test/parallel/test-process-uptime.js @@ -24,14 +24,14 @@ require('../common'); const assert = require('assert'); console.error(process.uptime()); -assert.ok(process.uptime() <= 2); +// Add some wiggle room for different platforms. +// Verify that the returned value is in seconds - +// 15 seconds should be a good estimate. +assert.ok(process.uptime() <= 15); const original = process.uptime(); setTimeout(function() { const uptime = process.uptime(); - // some wiggle room to account for timer - // granularity, processor speed, and scheduling - assert.ok(uptime >= original + 2); - assert.ok(uptime <= original + 3); -}, 2000); + assert.ok(original < uptime); +}, 10); From 823f0ce952aa94881b9b2192e556a91816861460 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 17 Feb 2019 18:38:25 -0800 Subject: [PATCH 063/213] doc: revise Style Guide Most important change here is to point people to the YAML material in the docs rather than the previous way we indicated versions that introduced or deprecated APIs. Remove contents about assets as we do not actually have any in the docs. Otherwise, a bunch of stylistic changes, mostly to keep things concise and direct. PR-URL: https://github.com/nodejs/node/pull/26176 Reviewed-By: Richard Lau Reviewed-By: Beth Griggs --- doc/STYLE_GUIDE.md | 50 +++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md index c046d12397ec2f..00abe8e6695ef7 100644 --- a/doc/STYLE_GUIDE.md +++ b/doc/STYLE_GUIDE.md @@ -1,16 +1,15 @@ # Style Guide -* Documentation is written in markdown files with names formatted as +* Documentation is in markdown files with names formatted as `lowercase-with-dashes.md`. - * Underscores in filenames are allowed only when they are present in the - topic the document will describe (e.g. `child_process`). + * Use an underscore in the filename only if the underscore is part of the + topic name (e.g., `child_process`). * Some files, such as top-level markdown files, are exceptions. * Documents should be word-wrapped at 80 characters. -* The formatting described in `.editorconfig` is preferred. - * A [plugin][] is available for some editors to automatically apply these - rules. -* Changes to documentation should be checked with `make lint-md`. -* American English spelling is preferred. +* `.editorconfig` describes the preferred formatting. + * A [plugin][] is available for some editors to apply these rules. +* Check changes to documentation with `make lint-md`. +* Use American English spelling. * OK: _capitalize_, _color_ * NOT OK: _capitalise_, _colour_ * Use [serial commas][]. @@ -19,39 +18,30 @@ * Use gender-neutral pronouns and gender-neutral plural nouns. * OK: _they_, _their_, _them_, _folks_, _people_, _developers_ * NOT OK: _his_, _hers_, _him_, _her_, _guys_, _dudes_ -* When combining wrapping elements (parentheses and quotes), terminal - punctuation should be placed: +* When combining wrapping elements (parentheses and quotes), place terminal + punctuation: * Inside the wrapping element if the wrapping element contains a complete - clause — a subject, verb, and an object. + clause. * Outside of the wrapping element if the wrapping element contains only a fragment of a clause. * Documents must start with a level-one heading. * Prefer affixing links to inlining links — prefer `[a link][]` to `[a link](http://example.com)`. -* When documenting APIs, note the version the API was introduced in at - the end of the section. If an API has been deprecated, also note the first - version that the API appeared deprecated in. -* When using dashes, use [Em dashes][] ("—" or `Option+Shift+"-"` on macOS) - surrounded by spaces, as per [The New York Times Manual of Style and Usage][]. -* Including assets: - * If you wish to add an illustration or full program, add it to the - appropriate sub-directory in the `assets/` dir. - * Link to it like so: `[Asset](/assets/{subdir}/{filename})` for file-based - assets, and `![Asset](/assets/{subdir}/{filename})` for image-based assets. - * For illustrations, prefer SVG to other assets. When SVG is not feasible, - please keep a close eye on the filesize of the asset you're introducing. +* When documenting APIs, update the YAML comment associated with the API as + appropriate. This is especially true when introducing or deprecating an API. +* Use [Em dashes][] ("—" or `Option+Shift+"-"` on macOS) surrounded by spaces, + as per [The New York Times Manual of Style and Usage][]. * For code blocks: * Use language aware fences. ("```js") - * Code need not be complete — treat code blocks as an illustration or aid to + * Code need not be complete. Treat code blocks as an illustration or aid to your point, not as complete running programs. If a complete running program is necessary, include it as an asset in `assets/code-examples` and link to it. -* When using underscores, asterisks, and backticks, please use proper escaping - (`\_`, `\*` and ``\` `` instead of `_`, `*` and `` ` ``). -* References to constructor functions should use PascalCase. -* References to constructor instances should use camelCase. -* References to methods should be used with parentheses: for example, - `socket.end()` instead of `socket.end`. +* When using underscores, asterisks, and backticks, please use + backslash-escaping: `\_`, `\*`, and ``\` ``. +* Constructors should use PascalCase. +* Instances should use camelCase. +* Denote methods with parentheses: `socket.end()` instead of `socket.end`. * Function arguments or object properties should use the following format: * ``` * `name` {type|type2} Optional description. **Default:** `value`. ``` From 818b280a397f0f25a9c9523b4193044fde82fe39 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 17 Feb 2019 18:50:27 -0800 Subject: [PATCH 064/213] test: remove unnecessary default tmpdir value in test `tmpdir.path` will never be falsy so there is no need to guard against that. PR-URL: https://github.com/nodejs/node/pull/26177 Reviewed-By: Richard Lau Reviewed-By: Daniel Bevenius Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Weijia Wang --- test/parallel/test-pipe-file-to-http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index 4bc71069da413f..9b99ddb675de41 100644 --- a/test/parallel/test-pipe-file-to-http.js +++ b/test/parallel/test-pipe-file-to-http.js @@ -29,7 +29,7 @@ const path = require('path'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -const filename = path.join(tmpdir.path || '/tmp', 'big'); +const filename = path.join(tmpdir.path, 'big'); let count = 0; const server = http.createServer((req, res) => { From bd40a127f9191347b238d6482a2024e6955b1a5c Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 15 Feb 2019 14:33:23 +0100 Subject: [PATCH 065/213] src: only call .ReThrow() if not terminating Otherwise, it looks like a `null` exception is being thrown. PR-URL: https://github.com/nodejs/node/pull/26130 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius --- src/module_wrap.cc | 24 ++++++++++--------- src/node_contextify.cc | 17 +++++++++---- .../es-modules/import-process-exit.mjs | 1 + test/fixtures/es-modules/process-exit.mjs | 2 ++ test/parallel/test-worker-esm-exit.js | 10 ++++++++ 5 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 test/fixtures/es-modules/import-process-exit.mjs create mode 100644 test/fixtures/es-modules/process-exit.mjs create mode 100644 test/parallel/test-worker-esm-exit.js diff --git a/src/module_wrap.cc b/src/module_wrap.cc index f642440bff5a88..93e791b52240aa 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -158,12 +158,13 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { Context::Scope context_scope(context); ScriptCompiler::Source source(source_text, origin); if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) { - CHECK(try_catch.HasCaught()); - CHECK(!try_catch.Message().IsEmpty()); - CHECK(!try_catch.Exception().IsEmpty()); - AppendExceptionLine(env, try_catch.Exception(), try_catch.Message(), - ErrorHandlingMode::MODULE_ERROR); - try_catch.ReThrow(); + if (try_catch.HasCaught() && !try_catch.HasTerminated()) { + CHECK(!try_catch.Message().IsEmpty()); + CHECK(!try_catch.Exception().IsEmpty()); + AppendExceptionLine(env, try_catch.Exception(), try_catch.Message(), + ErrorHandlingMode::MODULE_ERROR); + try_catch.ReThrow(); + } return; } } @@ -245,13 +246,12 @@ void ModuleWrap::Instantiate(const FunctionCallbackInfo& args) { Local context = obj->context_.Get(isolate); Local module = obj->module_.Get(isolate); TryCatchScope try_catch(env); - Maybe ok = module->InstantiateModule(context, ResolveCallback); + USE(module->InstantiateModule(context, ResolveCallback)); // clear resolve cache on instantiate obj->resolve_cache_.clear(); - if (!ok.FromMaybe(false)) { - CHECK(try_catch.HasCaught()); + if (try_catch.HasCaught() && !try_catch.HasTerminated()) { CHECK(!try_catch.Message().IsEmpty()); CHECK(!try_catch.Exception().IsEmpty()); AppendExceptionLine(env, try_catch.Exception(), try_catch.Message(), @@ -300,6 +300,8 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo& args) { // Convert the termination exception into a regular exception. if (timed_out || received_signal) { + if (!env->is_main_thread() && env->is_stopping_worker()) + return; env->isolate()->CancelTerminateExecution(); // It is possible that execution was terminated by another timeout in // which this timeout is nested, so check whether one of the watchdogs @@ -312,7 +314,8 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo& args) { } if (try_catch.HasCaught()) { - try_catch.ReThrow(); + if (!try_catch.HasTerminated()) + try_catch.ReThrow(); return; } @@ -375,7 +378,6 @@ void ModuleWrap::GetError(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&obj, args.This()); Local module = obj->module_.Get(isolate); - args.GetReturnValue().Set(module->GetException()); } diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 61f60576d2f2a4..0ba2b1a90cb93b 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -252,7 +252,8 @@ void ContextifyContext::MakeContext(const FunctionCallbackInfo& args) { ContextifyContext* context = new ContextifyContext(env, sandbox, options); if (try_catch.HasCaught()) { - try_catch.ReThrow(); + if (!try_catch.HasTerminated()) + try_catch.ReThrow(); return; } @@ -729,7 +730,8 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { if (v8_script.IsEmpty()) { DecorateErrorStack(env, try_catch); no_abort_scope.Close(); - try_catch.ReThrow(); + if (!try_catch.HasTerminated()) + try_catch.ReThrow(); TRACE_EVENT_NESTABLE_ASYNC_END0( TRACING_CATEGORY_NODE2(vm, script), "ContextifyScript::New", @@ -922,6 +924,8 @@ bool ContextifyScript::EvalMachine(Environment* env, // Convert the termination exception into a regular exception. if (timed_out || received_signal) { + if (!env->is_main_thread() && env->is_stopping_worker()) + return false; env->isolate()->CancelTerminateExecution(); // It is possible that execution was terminated by another timeout in // which this timeout is nested, so check whether one of the watchdogs @@ -944,7 +948,8 @@ bool ContextifyScript::EvalMachine(Environment* env, // letting try_catch catch it. // If execution has been terminated, but not by one of the watchdogs from // this invocation, this will re-throw a `null` value. - try_catch.ReThrow(); + if (!try_catch.HasTerminated()) + try_catch.ReThrow(); return false; } @@ -1098,8 +1103,10 @@ void ContextifyContext::CompileFunction( context_extensions.size(), context_extensions.data(), options); if (maybe_fn.IsEmpty()) { - DecorateErrorStack(env, try_catch); - try_catch.ReThrow(); + if (try_catch.HasCaught() && !try_catch.HasTerminated()) { + DecorateErrorStack(env, try_catch); + try_catch.ReThrow(); + } return; } Local fn = maybe_fn.ToLocalChecked(); diff --git a/test/fixtures/es-modules/import-process-exit.mjs b/test/fixtures/es-modules/import-process-exit.mjs new file mode 100644 index 00000000000000..aa294f1bcbe6df --- /dev/null +++ b/test/fixtures/es-modules/import-process-exit.mjs @@ -0,0 +1 @@ +import exit from "./process-exit.mjs"; diff --git a/test/fixtures/es-modules/process-exit.mjs b/test/fixtures/es-modules/process-exit.mjs new file mode 100644 index 00000000000000..869ce08efa56cb --- /dev/null +++ b/test/fixtures/es-modules/process-exit.mjs @@ -0,0 +1,2 @@ +process.exit(42); +export default null; diff --git a/test/parallel/test-worker-esm-exit.js b/test/parallel/test-worker-esm-exit.js new file mode 100644 index 00000000000000..c0b9d874895725 --- /dev/null +++ b/test/parallel/test-worker-esm-exit.js @@ -0,0 +1,10 @@ +'use strict'; +const common = require('../common'); +const fixtures = require('../common/fixtures'); +const assert = require('assert'); +const { Worker } = require('worker_threads'); + +const w = new Worker(fixtures.path('es-modules/import-process-exit.mjs'), + { execArgv: ['--experimental-modules'] }); +w.on('error', common.mustNotCall()); +w.on('exit', (code) => assert.strictEqual(code, 42)); From a1fcde035e5f851214cdf15c1abec7f0739c7581 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 17 Feb 2019 13:36:22 -0500 Subject: [PATCH 066/213] test: simplify test-api-getreport.js PR-URL: https://github.com/nodejs/node/pull/26169 Reviewed-By: Richard Lau Reviewed-By: Daniel Bevenius Reviewed-By: Weijia Wang Reviewed-By: James M Snell --- test/node-report/test-api-getreport.js | 27 +++++++------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/test/node-report/test-api-getreport.js b/test/node-report/test-api-getreport.js index 49e84d68a67ba9..780a5147b3f100 100644 --- a/test/node-report/test-api-getreport.js +++ b/test/node-report/test-api-getreport.js @@ -1,25 +1,12 @@ +// Flags: --experimental-report 'use strict'; - -// Testcase for returning report as a string via API call const common = require('../common'); common.skipIfReportDisabled(); const assert = require('assert'); -if (process.argv[2] === 'child') { - console.log(process.report.getReport()); -} else { - const helper = require('../common/report.js'); - const spawnSync = require('child_process').spawnSync; - const tmpdir = require('../common/tmpdir'); - tmpdir.refresh(); +const helper = require('../common/report'); - const args = ['--experimental-report', __filename, 'child']; - const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); - const report_msg = 'Found report files'; - const std_msg = 'Found messages on stderr'; - assert.ok(child.stderr.toString().includes( - `(node:${child.pid}) ExperimentalWarning: report is an` + - ' experimental feature. This feature could change at any time'), std_msg); - const reportFiles = helper.findReports(child.pid, tmpdir.path); - assert.deepStrictEqual(reportFiles, [], report_msg); - helper.validateContent(child.stdout); -} +common.expectWarning('ExperimentalWarning', + 'report is an experimental feature. This feature could ' + + 'change at any time'); +helper.validateContent(process.report.getReport()); +assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []); From 633c1eac2991c5a1a71e4968c80b550b6e6b7375 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 17 Feb 2019 16:46:32 -0500 Subject: [PATCH 067/213] report: simplify TriggerNodeReport() PR-URL: https://github.com/nodejs/node/pull/26174 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: James M Snell --- src/node_report.cc | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/node_report.cc b/src/node_report.cc index d4f59de84d8013..59aa0657a97659 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -111,7 +111,6 @@ std::string TriggerNodeReport(Isolate* isolate, // Obtain the current time and the pid (platform dependent) TIME_TYPE tm_struct; LocalTime(&tm_struct); - uv_pid_t pid = uv_os_getpid(); // Determine the required report filename. In order of priority: // 1) supplied on API 2) configured on startup 3) default generated if (!name.empty()) { @@ -123,7 +122,6 @@ std::string TriggerNodeReport(Isolate* isolate, } else { // Construct the report filename, with timestamp, pid and sequence number oss << "report"; - seq++; #ifdef _WIN32 oss << "." << std::setfill('0') << std::setw(4) << tm_struct.wYear; oss << std::setfill('0') << std::setw(2) << tm_struct.wMonth; @@ -131,8 +129,6 @@ std::string TriggerNodeReport(Isolate* isolate, oss << "." << std::setfill('0') << std::setw(2) << tm_struct.wHour; oss << std::setfill('0') << std::setw(2) << tm_struct.wMinute; oss << std::setfill('0') << std::setw(2) << tm_struct.wSecond; - oss << "." << pid; - oss << "." << std::setfill('0') << std::setw(3) << seq.load(); #else // UNIX, OSX oss << "." << std::setfill('0') << std::setw(4) << tm_struct.tm_year + 1900; oss << std::setfill('0') << std::setw(2) << tm_struct.tm_mon + 1; @@ -140,9 +136,9 @@ std::string TriggerNodeReport(Isolate* isolate, oss << "." << std::setfill('0') << std::setw(2) << tm_struct.tm_hour; oss << std::setfill('0') << std::setw(2) << tm_struct.tm_min; oss << std::setfill('0') << std::setw(2) << tm_struct.tm_sec; - oss << "." << pid; - oss << "." << std::setfill('0') << std::setw(3) << seq.load(); #endif + oss << "." << uv_os_getpid(); + oss << "." << std::setfill('0') << std::setw(3) << ++seq; oss << ".json"; } @@ -150,7 +146,7 @@ std::string TriggerNodeReport(Isolate* isolate, // Open the report file stream for writing. Supports stdout/err, // user-specified or (default) generated name std::ofstream outfile; - std::ostream* outstream = &std::cout; + std::ostream* outstream; if (filename == "stdout") { outstream = &std::cout; } else if (filename == "stderr") { @@ -167,21 +163,18 @@ std::string TriggerNodeReport(Isolate* isolate, } // Check for errors on the file open if (!outfile.is_open()) { - if (env != nullptr && options->report_directory.length() > 0) { - std::cerr << std::endl - << "Failed to open Node.js report file: " << filename - << " directory: " << options->report_directory - << " (errno: " << errno << ")" << std::endl; - } else { - std::cerr << std::endl - << "Failed to open Node.js report file: " << filename - << " (errno: " << errno << ")" << std::endl; - } - return ""; - } else { std::cerr << std::endl - << "Writing Node.js report to file: " << filename << std::endl; + << "Failed to open Node.js report file: " << filename; + + if (env != nullptr && options->report_directory.length() > 0) + std::cerr << " directory: " << options->report_directory; + + std::cerr << " (errno: " << errno << ")" << std::endl; + return ""; } + + std::cerr << std::endl + << "Writing Node.js report to file: " << filename << std::endl; } // Pass our stream about by reference, not by copying it. @@ -196,8 +189,7 @@ std::string TriggerNodeReport(Isolate* isolate, } std::cerr << "Node.js report completed" << std::endl; - if (name.empty()) return filename; - return name; + return filename; } // External function to trigger a report, writing to a supplied stream. From a39cd45ce8c77c7428e3b4a539f3b63500ae1be8 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 18 Feb 2019 13:53:12 +0800 Subject: [PATCH 068/213] src: remove `process.binding('config').fipsForced` Instead use `require('internal/options').getOptionValue` to query to value of `--force-fips`. PR-URL: https://github.com/nodejs/node/pull/26178 Reviewed-By: Daniel Bevenius Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: James M Snell --- lib/crypto.js | 6 ++---- src/node_config.cc | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/crypto.js b/lib/crypto.js index 5b83a669c643d7..0c956ecd107b0a 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -37,10 +37,8 @@ const { const constants = internalBinding('constants').crypto; const { getOptionValue } = require('internal/options'); const pendingDeprecation = getOptionValue('--pending-deprecation'); -const { - fipsMode, - fipsForced -} = internalBinding('config'); +const { fipsMode } = internalBinding('config'); +const fipsForced = getOptionValue('--force-fips'); const { getFipsCrypto, setFipsCrypto } = internalBinding('crypto'); const { randomBytes, diff --git a/src/node_config.cc b/src/node_config.cc index 6e443230f74df3..7ecf70fdb6256a 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -40,9 +40,6 @@ static void Initialize(Local target, #ifdef NODE_FIPS_MODE READONLY_TRUE_PROPERTY(target, "fipsMode"); - // TODO(addaleax): Use options parser variable instead. - if (per_process::cli_options->force_fips_crypto) - READONLY_TRUE_PROPERTY(target, "fipsForced"); #endif #ifdef NODE_HAVE_I18N_SUPPORT From 007b2fa198b18f1506d157a9a98ac1fab5497e34 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 17 Feb 2019 20:59:05 +0100 Subject: [PATCH 069/213] test: increase run time in test-worker-prof This test has occasionally been failing on Windows since it was added, with 6 instead of 15 ticks being seen. Increasing the duration of the test should make it more reliable. PR-URL: https://github.com/nodejs/node/pull/26172 Reviewed-By: Luigi Pinca Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- test/parallel/test-worker-prof.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-worker-prof.js b/test/parallel/test-worker-prof.js index 5b0703f5f9b5ca..d4344a8057f06f 100644 --- a/test/parallel/test-worker-prof.js +++ b/test/parallel/test-worker-prof.js @@ -15,7 +15,7 @@ if (!common.isMainThread) if (process.argv[2] === 'child') { const spin = ` const start = Date.now(); - while (Date.now() - start < 200); + while (Date.now() - start < 1000); `; new Worker(spin, { eval: true }); eval(spin); @@ -32,10 +32,10 @@ for (const logfile of logfiles) { const lines = fs.readFileSync(logfile, 'utf8').split('\n'); const ticks = lines.filter((line) => /^tick,/.test(line)).length; - // Test that at least 20 ticks have been recorded for both parent and child + // Test that at least 15 ticks have been recorded for both parent and child // threads. When not tracking Worker threads, only 1 or 2 ticks would // have been recorded. - // When running locally on x64 Linux, this number is usually at least 150 + // When running locally on x64 Linux, this number is usually at least 700 // for both threads, so 15 seems like a very safe threshold. assert(ticks >= 15, `${ticks} >= 15`); } From c6d5af53be7870173c5b5e91a46fa18240b87167 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 16 Feb 2019 13:54:22 +0100 Subject: [PATCH 070/213] src: move req_wrap_queue to base class of ReqWrap Introduce a second base class for `ReqWrap` that does not depend on a template parameter and move the `req_wrap_queue_` field to it. This addresses undefined behaviour that occurs when casting to `ReqWrap` in the `ReqWrap` constructor. Refs: https://github.com/nodejs/node/issues/26131 PR-URL: https://github.com/nodejs/node/pull/26148 Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell --- src/env.cc | 2 +- src/env.h | 3 +-- src/node_postmortem_metadata.cc | 8 +++++--- src/node_process_methods.cc | 3 ++- src/req_wrap-inl.h | 17 +++++++++++------ src/req_wrap.h | 24 +++++++++++++++++++----- 6 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/env.cc b/src/env.cc index 42fe6bdc4b0b0e..619d0ca19908cb 100644 --- a/src/env.cc +++ b/src/env.cc @@ -420,7 +420,7 @@ void Environment::RegisterHandleCleanups() { } void Environment::CleanupHandles() { - for (ReqWrap* request : req_wrap_queue_) + for (ReqWrapBase* request : req_wrap_queue_) request->Cancel(); for (HandleWrap* handle : handle_wrap_queue_) diff --git a/src/env.h b/src/env.h index a8b3b42d7944ed..ad2d9fab08299f 100644 --- a/src/env.h +++ b/src/env.h @@ -877,8 +877,7 @@ class Environment { #endif typedef ListHead HandleWrapQueue; - typedef ListHead, &ReqWrap::req_wrap_queue_> - ReqWrapQueue; + typedef ListHead ReqWrapQueue; inline HandleWrapQueue* handle_wrap_queue() { return &handle_wrap_queue_; } inline ReqWrapQueue* req_wrap_queue() { return &req_wrap_queue_; } diff --git a/src/node_postmortem_metadata.cc b/src/node_postmortem_metadata.cc index 527bfb623e65de..05800f79b09ecc 100644 --- a/src/node_postmortem_metadata.cc +++ b/src/node_postmortem_metadata.cc @@ -28,15 +28,14 @@ V(Environment_HandleWrapQueue, head_, ListNode_HandleWrap, \ Environment::HandleWrapQueue::head_) \ V(ListNode_HandleWrap, next_, uintptr_t, ListNode::next_) \ - V(ReqWrap, req_wrap_queue_, ListNode_ReqWrapQueue, \ - ReqWrap::req_wrap_queue_) \ V(Environment_ReqWrapQueue, head_, ListNode_ReqWrapQueue, \ Environment::ReqWrapQueue::head_) \ - V(ListNode_ReqWrap, next_, uintptr_t, ListNode>::next_) + V(ListNode_ReqWrap, next_, uintptr_t, ListNode::next_) extern "C" { int nodedbg_const_ContextEmbedderIndex__kEnvironment__int; uintptr_t nodedbg_offset_ExternalString__data__uintptr_t; +uintptr_t nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; #define V(Class, Member, Type, Accessor) \ NODE_EXTERN uintptr_t NODEDBG_OFFSET(Class, Member, Type); @@ -51,6 +50,9 @@ int GenDebugSymbols() { ContextEmbedderIndex::kEnvironment; nodedbg_offset_ExternalString__data__uintptr_t = NODE_OFF_EXTSTR_DATA; + nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue = + OffsetOf, ReqWrap>( + &ReqWrap::req_wrap_queue_); #define V(Class, Member, Type, Accessor) \ NODEDBG_OFFSET(Class, Member, Type) = OffsetOf(&Accessor); diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 80027c26ebcf15..ca8a4358053ff2 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -252,7 +252,8 @@ static void GetActiveRequests(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); std::vector> request_v; - for (auto w : *env->req_wrap_queue()) { + for (ReqWrapBase* req_wrap : *env->req_wrap_queue()) { + AsyncWrap* w = req_wrap->GetAsyncWrap(); if (w->persistent().IsEmpty()) continue; request_v.push_back(w->GetOwner()); diff --git a/src/req_wrap-inl.h b/src/req_wrap-inl.h index 4f9da1c4f35d9e..5fb965414838bb 100644 --- a/src/req_wrap-inl.h +++ b/src/req_wrap-inl.h @@ -11,16 +11,16 @@ namespace node { +ReqWrapBase::ReqWrapBase(Environment* env) { + env->req_wrap_queue()->PushBack(this); +} + template ReqWrap::ReqWrap(Environment* env, v8::Local object, AsyncWrap::ProviderType provider) - : AsyncWrap(env, object, provider) { - - // FIXME(bnoordhuis) The fact that a reinterpret_cast is needed is - // arguably a good indicator that there should be more than one queue. - env->req_wrap_queue()->PushBack(reinterpret_cast*>(this)); - + : AsyncWrap(env, object, provider), + ReqWrapBase(env) { Reset(); } @@ -51,6 +51,11 @@ void ReqWrap::Cancel() { uv_cancel(reinterpret_cast(&req_)); } +template +AsyncWrap* ReqWrap::GetAsyncWrap() { + return this; +} + // Below is dark template magic designed to invoke libuv functions that // initialize uv_req_t instances in a unified fashion, to allow easier // tracking of active/inactive requests. diff --git a/src/req_wrap.h b/src/req_wrap.h index 8f8d0cf2885594..890eb6cb61848c 100644 --- a/src/req_wrap.h +++ b/src/req_wrap.h @@ -10,8 +10,24 @@ namespace node { +class ReqWrapBase { + public: + explicit inline ReqWrapBase(Environment* env); + + virtual ~ReqWrapBase() {} + + virtual void Cancel() = 0; + virtual AsyncWrap* GetAsyncWrap() = 0; + + private: + friend int GenDebugSymbols(); + friend class Environment; + + ListNode req_wrap_queue_; +}; + template -class ReqWrap : public AsyncWrap { +class ReqWrap : public AsyncWrap, public ReqWrapBase { public: inline ReqWrap(Environment* env, v8::Local object, @@ -23,7 +39,8 @@ class ReqWrap : public AsyncWrap { // Call this after a request has finished, if re-using this object is planned. inline void Reset(); T* req() { return &req_; } - inline void Cancel(); + inline void Cancel() final; + inline AsyncWrap* GetAsyncWrap() override; static ReqWrap* from_req(T* req); @@ -31,13 +48,10 @@ class ReqWrap : public AsyncWrap { inline int Dispatch(LibuvFunction fn, Args... args); private: - friend class Environment; friend int GenDebugSymbols(); template friend struct MakeLibuvRequestCallback; - ListNode req_wrap_queue_; - typedef void (*callback_t)(); callback_t original_callback_ = nullptr; From 8881c0baaa1d021dc2f7735aa23295b212ac204a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 17 Feb 2019 18:05:55 +0100 Subject: [PATCH 071/213] src: simplify InspectorConsoleCall Instead of a JS object, set the is-in-console-call flag as a boolean in C++. PR-URL: https://github.com/nodejs/node/pull/26168 Reviewed-By: Joyee Cheung Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Eugene Ostroukhov --- lib/internal/util/inspector.js | 4 +--- src/env-inl.h | 10 ++++++++++ src/env.h | 4 ++++ src/inspector_js_api.cc | 25 ++++++++----------------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lib/internal/util/inspector.js b/lib/internal/util/inspector.js index e237db16a64800..579f93d540faa3 100644 --- a/lib/internal/util/inspector.js +++ b/lib/internal/util/inspector.js @@ -33,7 +33,6 @@ function installConsoleExtensions(commandLineApi) { // Wrap a console implemented by Node.js with features from the VM inspector function wrapConsole(consoleFromNode, consoleFromVM) { - const config = {}; const { consoleCall } = internalBinding('inspector'); for (const key of Object.keys(consoleFromVM)) { // If global console has the same method as inspector console, @@ -42,8 +41,7 @@ function wrapConsole(consoleFromNode, consoleFromVM) { if (consoleFromNode.hasOwnProperty(key)) { consoleFromNode[key] = consoleCall.bind(consoleFromNode, consoleFromVM[key], - consoleFromNode[key], - config); + consoleFromNode[key]); } else { // Add additional console APIs from the inspector consoleFromNode[key] = consoleFromVM[key]; diff --git a/src/env-inl.h b/src/env-inl.h index 47331a61954726..1f66380cf4ca82 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -404,6 +404,16 @@ inline void Environment::TryLoadAddon( } } +#if HAVE_INSPECTOR +inline bool Environment::is_in_inspector_console_call() const { + return is_in_inspector_console_call_; +} + +inline void Environment::set_is_in_inspector_console_call(bool value) { + is_in_inspector_console_call_ = value; +} +#endif + inline Environment::AsyncHooks* Environment::async_hooks() { return &async_hooks_; } diff --git a/src/env.h b/src/env.h index ad2d9fab08299f..c4b3175d6a9ce1 100644 --- a/src/env.h +++ b/src/env.h @@ -874,6 +874,9 @@ class Environment { inline inspector::Agent* inspector_agent() const { return inspector_agent_.get(); } + + inline bool is_in_inspector_console_call() const; + inline void set_is_in_inspector_console_call(bool value); #endif typedef ListHead HandleWrapQueue; @@ -1043,6 +1046,7 @@ class Environment { #if HAVE_INSPECTOR std::unique_ptr inspector_agent_; + bool is_in_inspector_console_call_ = false; #endif // handle_wrap_queue_ and req_wrap_queue_ needs to be at a fixed offset from diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 4a3272e9204995..746cd68ac90c66 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -149,31 +149,22 @@ void InspectorConsoleCall(const FunctionCallbackInfo& info) { Environment* env = Environment::GetCurrent(info); Isolate* isolate = env->isolate(); Local context = isolate->GetCurrentContext(); - CHECK_LT(2, info.Length()); - SlicedArguments call_args(info, /* start */ 3); + CHECK_GE(info.Length(), 2); + SlicedArguments call_args(info, /* start */ 2); if (InspectorEnabled(env)) { Local inspector_method = info[0]; CHECK(inspector_method->IsFunction()); - Local config_value = info[2]; - CHECK(config_value->IsObject()); - Local config_object = config_value.As(); - Local in_call_key = FIXED_ONE_BYTE_STRING(isolate, "in_call"); - bool has_in_call; - if (!config_object->Has(context, in_call_key).To(&has_in_call)) - return; - if (!has_in_call) { - if (config_object->Set(context, - in_call_key, - v8::True(isolate)).IsNothing() || + if (!env->is_in_inspector_console_call()) { + env->set_is_in_inspector_console_call(true); + MaybeLocal ret = inspector_method.As()->Call(context, info.Holder(), call_args.length(), - call_args.out()).IsEmpty()) { + call_args.out()); + env->set_is_in_inspector_console_call(false); + if (ret.IsEmpty()) return; - } } - if (config_object->Delete(context, in_call_key).IsNothing()) - return; } Local node_method = info[1]; From fbf6dd558a53e2d6e1bc8ac3602b9d8b3543c2df Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 01:22:17 +0100 Subject: [PATCH 072/213] test,inspector: add heap allocation tracker test This provides coverage for the `InspectorTimer` instances created as part of heap allocation tracking. PR-URL: https://github.com/nodejs/node/pull/26089 Reviewed-By: Eugene Ostroukhov Reviewed-By: James M Snell --- .../test-inspector-heap-allocation-tracker.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/parallel/test-inspector-heap-allocation-tracker.js diff --git a/test/parallel/test-inspector-heap-allocation-tracker.js b/test/parallel/test-inspector-heap-allocation-tracker.js new file mode 100644 index 00000000000000..0003a8fb694f1d --- /dev/null +++ b/test/parallel/test-inspector-heap-allocation-tracker.js @@ -0,0 +1,46 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const assert = require('assert'); +const inspector = require('inspector'); +const stream = require('stream'); +const { Worker, workerData } = require('worker_threads'); + +const session = new inspector.Session(); +session.connect(); +session.post('HeapProfiler.enable'); +session.post('HeapProfiler.startTrackingHeapObjects', + { trackAllocations: true }); + +// Perform some silly heap allocations for the next 100 ms. +const interval = setInterval(() => { + new stream.PassThrough().end('abc').on('data', common.mustCall()); +}, 1); + +setTimeout(() => { + clearInterval(interval); + + // Once the main test is done, we re-run it from inside a Worker thread + // and stop early, as that is a good way to make sure the timer handles + // internally created by the inspector are cleaned up properly. + if (workerData === 'stopEarly') + process.exit(); + + let data = ''; + session.on('HeapProfiler.addHeapSnapshotChunk', + common.mustCallAtLeast((event) => { + data += event.params.chunk; + })); + + // TODO(addaleax): Using `{ reportProgress: true }` crashes the process + // because the progress indication event would mean calling into JS while + // a heap snapshot is being taken, which is forbidden. + // What can we do about that? + session.post('HeapProfiler.stopTrackingHeapObjects'); + + assert(data.includes('PassThrough'), data); + + new Worker(__filename, { workerData: 'stopEarly' }); +}, 100); From dff0149d57637dc3d98b89d8eacc511d4aed66e8 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 18 Feb 2019 12:23:02 -0500 Subject: [PATCH 073/213] tools: update ESLint to 5.14.1 Update ESLint to 5.14.1 PR-URL: https://github.com/nodejs/node/pull/26190 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Ruben Bridgewater --- tools/node_modules/eslint/lib/rules/sort-keys.js | 6 ++++-- tools/node_modules/eslint/package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/node_modules/eslint/lib/rules/sort-keys.js b/tools/node_modules/eslint/lib/rules/sort-keys.js index 08bfcdf3d8335b..fd5dd8a13bce84 100644 --- a/tools/node_modules/eslint/lib/rules/sort-keys.js +++ b/tools/node_modules/eslint/lib/rules/sort-keys.js @@ -129,8 +129,10 @@ module.exports = { stack = stack.upper; }, - SpreadElement() { - stack.prevName = null; + SpreadElement(node) { + if (node.parent.type === "ObjectExpression") { + stack.prevName = null; + } }, Property(node) { diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 316fa200c454e7..6712e948440010 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -134,5 +134,5 @@ "publish-release": "node Makefile.js publishRelease", "test": "node Makefile.js test" }, - "version": "5.14.0" + "version": "5.14.1" } \ No newline at end of file From 0e89d7add6e75ac1ac35d63bc5c76922f630c3bf Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 18 Feb 2019 13:19:57 -0500 Subject: [PATCH 074/213] report: simplify OnFatalError() handling PR-URL: https://github.com/nodejs/node/pull/26191 Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- src/node_errors.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/node_errors.cc b/src/node_errors.cc index 39673abf7f0e41..a17012b5b373fe 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -316,15 +316,9 @@ void OnFatalError(const char* location, const char* message) { Isolate* isolate = Isolate::GetCurrent(); HandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); - if (env != nullptr) { - std::shared_ptr options = env->isolate_data()->options(); - if (options->report_on_fatalerror) { - report::TriggerNodeReport( - isolate, env, message, __func__, "", Local()); - } - } else { + if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) { report::TriggerNodeReport( - isolate, nullptr, message, __func__, "", Local()); + isolate, env, message, __func__, "", Local()); } #endif // NODE_REPORT fflush(stderr); From 8a404686357d8eeb8a4997fe4626e2aed46f9c78 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 18 Feb 2019 14:01:12 -0500 Subject: [PATCH 075/213] report: remove verbose setting This commit removes the --diagnostic-report-verbose CLI option and all associated logic. The flag is currently only used in one place, and only reflects the settings at startup. Additionally, Node tends to use the NODE_DEBUG mechanism for adding verbose output. PR-URL: https://github.com/nodejs/node/pull/26195 Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api/cli.md | 8 ---- doc/api/process.md | 5 --- doc/api/report.md | 11 +---- doc/node.1 | 5 --- lib/internal/process/report.js | 10 +---- src/node_options.cc | 10 ----- src/node_options.h | 1 - src/node_report_module.cc | 34 --------------- .../test-diagnostic-report-verbose.js | 43 ------------------- 9 files changed, 3 insertions(+), 124 deletions(-) delete mode 100644 test/node-report/test-diagnostic-report-verbose.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 300e0182205810..71e36a4c12b561 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -126,13 +126,6 @@ Enables report to be generated on un-caught exceptions, if `--experimental-report` is enabled. Useful when inspecting JavaScript stack in conjunction with native stack and other runtime environment data. -### `--diagnostic-report-verbose` - - -Flag that enables additional information to be printed during report generation. - ### `--enable-fips` -* {string} The request path. Read-only. +* {string} The request path. ### request.removeHeader(name) ` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // ` + +> Stability: 1 - Experimental + +```C +napi_status napi_create_date(napi_env env, + double time, + napi_value* result); +``` + +- `[in] env`: The environment that the API is invoked under. +- `[in] time`: ECMAScript time value in milliseconds since 01 January, 1970 UTC. +- `[out] result`: A `napi_value` representing a JavaScript `Date`. + +Returns `napi_ok` if the API succeeded. + +This API allocates a JavaScript `Date` object. + +JavaScript `Date` objects are described in +[Section 20.3][] of the ECMAScript Language Specification. + #### napi_create_external + +> Stability: 1 - Experimental + +```C +napi_status napi_get_date_value(napi_env env, + napi_value value, + double* result) +``` + +- `[in] env`: The environment that the API is invoked under. +- `[in] value`: `napi_value` representing a JavaScript `Date`. +- `[out] result`: Time value as a `double` represented as milliseconds +since midnight at the beginning of 01 January, 1970 UTC. + +Returns `napi_ok` if the API succeeded. If a non-date `napi_value` is passed +in it returns `napi_date_expected`. + +This API returns the C double primitive of time value for the given JavaScript +`Date`. + #### napi_get_value_bool + +> Stability: 1 - Experimental + +```C +napi_status napi_is_date(napi_env env, napi_value value, bool* result) +``` + +- `[in] env`: The environment that the API is invoked under. +- `[in] value`: The JavaScript value to check. +- `[out] result`: Whether the given `napi_value` represents a JavaScript `Date` +object. + +Returns `napi_ok` if the API succeeded. + +This API checks if the `Object` passed in is a date. + ### napi_is_error ` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // ` - -### anyTypeAnnotation -```javascript -t.anyTypeAnnotation() -``` - -See also `t.isAnyTypeAnnotation(node, opts)` and `t.assertAnyTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### arrayExpression -```javascript -t.arrayExpression(elements) -``` - -See also `t.isArrayExpression(node, opts)` and `t.assertArrayExpression(node, opts)`. - -Aliases: `Expression` - - - `elements`: `Array` (default: `[]`) - ---- - -### arrayPattern -```javascript -t.arrayPattern(elements) -``` - -See also `t.isArrayPattern(node, opts)` and `t.assertArrayPattern(node, opts)`. - -Aliases: `Pattern`, `PatternLike`, `LVal` - - - `elements`: `Array` (required) - - `decorators`: `Array` (default: `null`) - - `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - ---- - -### arrayTypeAnnotation -```javascript -t.arrayTypeAnnotation(elementType) -``` - -See also `t.isArrayTypeAnnotation(node, opts)` and `t.assertArrayTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `elementType` (required) - ---- - -### arrowFunctionExpression -```javascript -t.arrowFunctionExpression(params, body, async) -``` - -See also `t.isArrowFunctionExpression(node, opts)` and `t.assertArrowFunctionExpression(node, opts)`. - -Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish` - - - `params`: `Array` (required) - - `body`: `BlockStatement | Expression` (required) - - `async`: `boolean` (default: `false`) - - `expression`: `boolean` (default: `null`) - - `generator`: `boolean` (default: `false`) - - `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - - `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`) - ---- - -### assignmentExpression -```javascript -t.assignmentExpression(operator, left, right) -``` - -See also `t.isAssignmentExpression(node, opts)` and `t.assertAssignmentExpression(node, opts)`. - -Aliases: `Expression` - - - `operator`: `string` (required) - - `left`: `LVal` (required) - - `right`: `Expression` (required) - ---- - -### assignmentPattern -```javascript -t.assignmentPattern(left, right) -``` - -See also `t.isAssignmentPattern(node, opts)` and `t.assertAssignmentPattern(node, opts)`. - -Aliases: `Pattern`, `PatternLike`, `LVal` - - - `left`: `Identifier | ObjectPattern | ArrayPattern` (required) - - `right`: `Expression` (required) - - `decorators`: `Array` (default: `null`) - - `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - ---- - -### awaitExpression -```javascript -t.awaitExpression(argument) -``` - -See also `t.isAwaitExpression(node, opts)` and `t.assertAwaitExpression(node, opts)`. - -Aliases: `Expression`, `Terminatorless` - - - `argument`: `Expression` (required) - ---- - -### binaryExpression -```javascript -t.binaryExpression(operator, left, right) -``` - -See also `t.isBinaryExpression(node, opts)` and `t.assertBinaryExpression(node, opts)`. - -Aliases: `Binary`, `Expression` - - - `operator`: `'+' | '-' | '/' | '%' | '*' | '**' | '&' | '|' | '>>' | '>>>' | '<<' | '^' | '==' | '===' | '!=' | '!==' | 'in' | 'instanceof' | '>' | '<' | '>=' | '<='` (required) - - `left`: `Expression` (required) - - `right`: `Expression` (required) - ---- - -### bindExpression -```javascript -t.bindExpression(object, callee) -``` - -See also `t.isBindExpression(node, opts)` and `t.assertBindExpression(node, opts)`. - -Aliases: `Expression` - - - `object` (required) - - `callee` (required) - ---- - -### blockStatement -```javascript -t.blockStatement(body, directives) -``` - -See also `t.isBlockStatement(node, opts)` and `t.assertBlockStatement(node, opts)`. - -Aliases: `Scopable`, `BlockParent`, `Block`, `Statement` - - - `body`: `Array` (required) - - `directives`: `Array` (default: `[]`) - ---- - -### booleanLiteral -```javascript -t.booleanLiteral(value) -``` - -See also `t.isBooleanLiteral(node, opts)` and `t.assertBooleanLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - - `value`: `boolean` (required) - ---- - -### booleanLiteralTypeAnnotation -```javascript -t.booleanLiteralTypeAnnotation() -``` - -See also `t.isBooleanLiteralTypeAnnotation(node, opts)` and `t.assertBooleanLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - ---- - -### booleanTypeAnnotation -```javascript -t.booleanTypeAnnotation() -``` - -See also `t.isBooleanTypeAnnotation(node, opts)` and `t.assertBooleanTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### breakStatement -```javascript -t.breakStatement(label) -``` - -See also `t.isBreakStatement(node, opts)` and `t.assertBreakStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `label`: `Identifier` (default: `null`) - ---- - -### callExpression -```javascript -t.callExpression(callee, arguments) -``` - -See also `t.isCallExpression(node, opts)` and `t.assertCallExpression(node, opts)`. - -Aliases: `Expression` - - - `callee`: `Expression` (required) - - `arguments`: `Array` (required) - - `optional`: `true | false` (default: `null`) - - `typeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`) - ---- - -### catchClause -```javascript -t.catchClause(param, body) -``` - -See also `t.isCatchClause(node, opts)` and `t.assertCatchClause(node, opts)`. - -Aliases: `Scopable`, `BlockParent` - - - `param`: `Identifier` (default: `null`) - - `body`: `BlockStatement` (required) - ---- - -### classBody -```javascript -t.classBody(body) -``` - -See also `t.isClassBody(node, opts)` and `t.assertClassBody(node, opts)`. - - - `body`: `Array` (required) - ---- - -### classDeclaration -```javascript -t.classDeclaration(id, superClass, body, decorators) -``` - -See also `t.isClassDeclaration(node, opts)` and `t.assertClassDeclaration(node, opts)`. - -Aliases: `Scopable`, `Class`, `Statement`, `Declaration`, `Pureish` - - - `id`: `Identifier` (default: `null`) - - `superClass`: `Expression` (default: `null`) - - `body`: `ClassBody` (required) - - `decorators`: `Array` (default: `null`) - - `abstract`: `boolean` (default: `null`) - - `declare`: `boolean` (default: `null`) - - `implements`: `Array` (default: `null`) - - `mixins` (default: `null`) - - `superTypeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`) - - `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`) - ---- - -### classExpression -```javascript -t.classExpression(id, superClass, body, decorators) -``` - -See also `t.isClassExpression(node, opts)` and `t.assertClassExpression(node, opts)`. - -Aliases: `Scopable`, `Class`, `Expression`, `Pureish` - - - `id`: `Identifier` (default: `null`) - - `superClass`: `Expression` (default: `null`) - - `body`: `ClassBody` (required) - - `decorators`: `Array` (default: `null`) - - `implements`: `Array` (default: `null`) - - `mixins` (default: `null`) - - `superTypeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`) - - `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`) - ---- - -### classImplements -```javascript -t.classImplements(id, typeParameters) -``` - -See also `t.isClassImplements(node, opts)` and `t.assertClassImplements(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `typeParameters` (required) - ---- - -### classMethod -```javascript -t.classMethod(kind, key, params, body, computed, static) -``` - -See also `t.isClassMethod(node, opts)` and `t.assertClassMethod(node, opts)`. - -Aliases: `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method` - - - `kind`: `"get" | "set" | "method" | "constructor"` (default: `'method'`) - - `key`: if computed then `Expression` else `Identifier | Literal` (required) - - `params`: `Array` (required) - - `body`: `BlockStatement` (required) - - `computed`: `boolean` (default: `false`) - - `static`: `boolean` (default: `null`) - - `abstract`: `boolean` (default: `null`) - - `access`: `"public" | "private" | "protected"` (default: `null`) - - `accessibility`: `"public" | "private" | "protected"` (default: `null`) - - `async`: `boolean` (default: `false`) - - `decorators`: `Array` (default: `null`) - - `generator`: `boolean` (default: `false`) - - `optional`: `boolean` (default: `null`) - - `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - - `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`) - ---- - -### classProperty -```javascript -t.classProperty(key, value, typeAnnotation, decorators, computed) -``` - -See also `t.isClassProperty(node, opts)` and `t.assertClassProperty(node, opts)`. - -Aliases: `Property` - - - `key` (required) - - `value`: `Expression` (default: `null`) - - `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - - `decorators`: `Array` (default: `null`) - - `computed`: `boolean` (default: `false`) - - `abstract`: `boolean` (default: `null`) - - `accessibility`: `"public" | "private" | "protected"` (default: `null`) - - `optional`: `boolean` (default: `null`) - - `readonly`: `boolean` (default: `null`) - - `static`: `boolean` (default: `null`) - ---- - -### conditionalExpression -```javascript -t.conditionalExpression(test, consequent, alternate) -``` - -See also `t.isConditionalExpression(node, opts)` and `t.assertConditionalExpression(node, opts)`. - -Aliases: `Expression`, `Conditional` - - - `test`: `Expression` (required) - - `consequent`: `Expression` (required) - - `alternate`: `Expression` (required) - ---- - -### continueStatement -```javascript -t.continueStatement(label) -``` - -See also `t.isContinueStatement(node, opts)` and `t.assertContinueStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `label`: `Identifier` (default: `null`) - ---- - -### debuggerStatement -```javascript -t.debuggerStatement() -``` - -See also `t.isDebuggerStatement(node, opts)` and `t.assertDebuggerStatement(node, opts)`. - -Aliases: `Statement` - - ---- - -### declareClass -```javascript -t.declareClass(id, typeParameters, extends, body) -``` - -See also `t.isDeclareClass(node, opts)` and `t.assertDeclareClass(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `extends` (required) - - `body` (required) - ---- - -### declareExportAllDeclaration -```javascript -t.declareExportAllDeclaration(source) -``` - -See also `t.isDeclareExportAllDeclaration(node, opts)` and `t.assertDeclareExportAllDeclaration(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `source` (required) - ---- - -### declareExportDeclaration -```javascript -t.declareExportDeclaration(declaration, specifiers, source) -``` - -See also `t.isDeclareExportDeclaration(node, opts)` and `t.assertDeclareExportDeclaration(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `declaration` (required) - - `specifiers` (required) - - `source` (required) - ---- - -### declareFunction -```javascript -t.declareFunction(id) -``` - -See also `t.isDeclareFunction(node, opts)` and `t.assertDeclareFunction(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - ---- - -### declareInterface -```javascript -t.declareInterface(id, typeParameters, extends, body) -``` - -See also `t.isDeclareInterface(node, opts)` and `t.assertDeclareInterface(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `extends` (required) - - `body` (required) - ---- - -### declareModule -```javascript -t.declareModule(id, body) -``` - -See also `t.isDeclareModule(node, opts)` and `t.assertDeclareModule(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `body` (required) - ---- - -### declareModuleExports -```javascript -t.declareModuleExports(typeAnnotation) -``` - -See also `t.isDeclareModuleExports(node, opts)` and `t.assertDeclareModuleExports(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `typeAnnotation` (required) - ---- - -### declareOpaqueType -```javascript -t.declareOpaqueType(id, typeParameters, supertype) -``` - -See also `t.isDeclareOpaqueType(node, opts)` and `t.assertDeclareOpaqueType(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `supertype` (required) - ---- - -### declareTypeAlias -```javascript -t.declareTypeAlias(id, typeParameters, right) -``` - -See also `t.isDeclareTypeAlias(node, opts)` and `t.assertDeclareTypeAlias(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `right` (required) - ---- - -### declareVariable -```javascript -t.declareVariable(id) -``` - -See also `t.isDeclareVariable(node, opts)` and `t.assertDeclareVariable(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - ---- - -### declaredPredicate -```javascript -t.declaredPredicate(value) -``` - -See also `t.isDeclaredPredicate(node, opts)` and `t.assertDeclaredPredicate(node, opts)`. - -Aliases: `Flow`, `FlowPredicate` - - - `value` (required) - ---- - -### decorator -```javascript -t.decorator(expression) -``` - -See also `t.isDecorator(node, opts)` and `t.assertDecorator(node, opts)`. - - - `expression`: `Expression` (required) - ---- - -### directive -```javascript -t.directive(value) -``` - -See also `t.isDirective(node, opts)` and `t.assertDirective(node, opts)`. - - - `value`: `DirectiveLiteral` (required) - ---- - -### directiveLiteral -```javascript -t.directiveLiteral(value) -``` - -See also `t.isDirectiveLiteral(node, opts)` and `t.assertDirectiveLiteral(node, opts)`. - - - `value`: `string` (required) - ---- - -### doExpression -```javascript -t.doExpression(body) -``` - -See also `t.isDoExpression(node, opts)` and `t.assertDoExpression(node, opts)`. - -Aliases: `Expression` - - - `body`: `BlockStatement` (required) - ---- - -### doWhileStatement -```javascript -t.doWhileStatement(test, body) -``` - -See also `t.isDoWhileStatement(node, opts)` and `t.assertDoWhileStatement(node, opts)`. +or using yarn: -Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable` - - - `test`: `Expression` (required) - - `body`: `Statement` (required) - ---- - -### emptyStatement -```javascript -t.emptyStatement() +```sh +yarn add @babel/types --dev ``` - -See also `t.isEmptyStatement(node, opts)` and `t.assertEmptyStatement(node, opts)`. - -Aliases: `Statement` - - ---- - -### emptyTypeAnnotation -```javascript -t.emptyTypeAnnotation() -``` - -See also `t.isEmptyTypeAnnotation(node, opts)` and `t.assertEmptyTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### existsTypeAnnotation -```javascript -t.existsTypeAnnotation() -``` - -See also `t.isExistsTypeAnnotation(node, opts)` and `t.assertExistsTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - ---- - -### exportAllDeclaration -```javascript -t.exportAllDeclaration(source) -``` - -See also `t.isExportAllDeclaration(node, opts)` and `t.assertExportAllDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` - - - `source`: `StringLiteral` (required) - ---- - -### exportDefaultDeclaration -```javascript -t.exportDefaultDeclaration(declaration) -``` - -See also `t.isExportDefaultDeclaration(node, opts)` and `t.assertExportDefaultDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` - - - `declaration`: `FunctionDeclaration | TSDeclareFunction | ClassDeclaration | Expression` (required) - ---- - -### exportDefaultSpecifier -```javascript -t.exportDefaultSpecifier(exported) -``` - -See also `t.isExportDefaultSpecifier(node, opts)` and `t.assertExportDefaultSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `exported`: `Identifier` (required) - ---- - -### exportNamedDeclaration -```javascript -t.exportNamedDeclaration(declaration, specifiers, source) -``` - -See also `t.isExportNamedDeclaration(node, opts)` and `t.assertExportNamedDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` - - - `declaration`: `Declaration` (default: `null`) - - `specifiers`: `Array` (required) - - `source`: `StringLiteral` (default: `null`) - ---- - -### exportNamespaceSpecifier -```javascript -t.exportNamespaceSpecifier(exported) -``` - -See also `t.isExportNamespaceSpecifier(node, opts)` and `t.assertExportNamespaceSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `exported`: `Identifier` (required) - ---- - -### exportSpecifier -```javascript -t.exportSpecifier(local, exported) -``` - -See also `t.isExportSpecifier(node, opts)` and `t.assertExportSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - - `exported`: `Identifier` (required) - ---- - -### expressionStatement -```javascript -t.expressionStatement(expression) -``` - -See also `t.isExpressionStatement(node, opts)` and `t.assertExpressionStatement(node, opts)`. - -Aliases: `Statement`, `ExpressionWrapper` - - - `expression`: `Expression` (required) - ---- - -### file -```javascript -t.file(program, comments, tokens) -``` - -See also `t.isFile(node, opts)` and `t.assertFile(node, opts)`. - - - `program`: `Program` (required) - - `comments` (required) - - `tokens` (required) - ---- - -### forInStatement -```javascript -t.forInStatement(left, right, body) -``` - -See also `t.isForInStatement(node, opts)` and `t.assertForInStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` - - - `left`: `VariableDeclaration | LVal` (required) - - `right`: `Expression` (required) - - `body`: `Statement` (required) - ---- - -### forOfStatement -```javascript -t.forOfStatement(left, right, body) -``` - -See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` - - - `left`: `VariableDeclaration | LVal` (required) - - `right`: `Expression` (required) - - `body`: `Statement` (required) - - `await`: `boolean` (default: `false`) - ---- - -### forStatement -```javascript -t.forStatement(init, test, update, body) -``` - -See also `t.isForStatement(node, opts)` and `t.assertForStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop` - - - `init`: `VariableDeclaration | Expression` (default: `null`) - - `test`: `Expression` (default: `null`) - - `update`: `Expression` (default: `null`) - - `body`: `Statement` (required) - ---- - -### functionDeclaration -```javascript -t.functionDeclaration(id, params, body, generator, async) -``` - -See also `t.isFunctionDeclaration(node, opts)` and `t.assertFunctionDeclaration(node, opts)`. - -Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Statement`, `Pureish`, `Declaration` - - - `id`: `Identifier` (default: `null`) - - `params`: `Array` (required) - - `body`: `BlockStatement` (required) - - `generator`: `boolean` (default: `false`) - - `async`: `boolean` (default: `false`) - - `declare`: `boolean` (default: `null`) - - `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - - `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`) - ---- - -### functionExpression -```javascript -t.functionExpression(id, params, body, generator, async) -``` - -See also `t.isFunctionExpression(node, opts)` and `t.assertFunctionExpression(node, opts)`. - -Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish` - - - `id`: `Identifier` (default: `null`) - - `params`: `Array` (required) - - `body`: `BlockStatement` (required) - - `generator`: `boolean` (default: `false`) - - `async`: `boolean` (default: `false`) - - `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - - `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`) - ---- - -### functionTypeAnnotation -```javascript -t.functionTypeAnnotation(typeParameters, params, rest, returnType) -``` - -See also `t.isFunctionTypeAnnotation(node, opts)` and `t.assertFunctionTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `typeParameters` (required) - - `params` (required) - - `rest` (required) - - `returnType` (required) - ---- - -### functionTypeParam -```javascript -t.functionTypeParam(name, typeAnnotation) -``` - -See also `t.isFunctionTypeParam(node, opts)` and `t.assertFunctionTypeParam(node, opts)`. - -Aliases: `Flow` - - - `name` (required) - - `typeAnnotation` (required) - ---- - -### genericTypeAnnotation -```javascript -t.genericTypeAnnotation(id, typeParameters) -``` - -See also `t.isGenericTypeAnnotation(node, opts)` and `t.assertGenericTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `typeParameters` (required) - ---- - -### identifier -```javascript -t.identifier(name) -``` - -See also `t.isIdentifier(node, opts)` and `t.assertIdentifier(node, opts)`. - -Aliases: `Expression`, `PatternLike`, `LVal`, `TSEntityName` - - - `name`: `string` (required) - - `decorators`: `Array` (default: `null`) - - `optional`: `boolean` (default: `null`) - - `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - ---- - -### ifStatement -```javascript -t.ifStatement(test, consequent, alternate) -``` - -See also `t.isIfStatement(node, opts)` and `t.assertIfStatement(node, opts)`. - -Aliases: `Statement`, `Conditional` - - - `test`: `Expression` (required) - - `consequent`: `Statement` (required) - - `alternate`: `Statement` (default: `null`) - ---- - -### import -```javascript -t.import() -``` - -See also `t.isImport(node, opts)` and `t.assertImport(node, opts)`. - -Aliases: `Expression` - - ---- - -### importDeclaration -```javascript -t.importDeclaration(specifiers, source) -``` - -See also `t.isImportDeclaration(node, opts)` and `t.assertImportDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration` - - - `specifiers`: `Array` (required) - - `source`: `StringLiteral` (required) - ---- - -### importDefaultSpecifier -```javascript -t.importDefaultSpecifier(local) -``` - -See also `t.isImportDefaultSpecifier(node, opts)` and `t.assertImportDefaultSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - ---- - -### importNamespaceSpecifier -```javascript -t.importNamespaceSpecifier(local) -``` - -See also `t.isImportNamespaceSpecifier(node, opts)` and `t.assertImportNamespaceSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - ---- - -### importSpecifier -```javascript -t.importSpecifier(local, imported) -``` - -See also `t.isImportSpecifier(node, opts)` and `t.assertImportSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - - `imported`: `Identifier` (required) - - `importKind`: `null | 'type' | 'typeof'` (default: `null`) - ---- - -### inferredPredicate -```javascript -t.inferredPredicate() -``` - -See also `t.isInferredPredicate(node, opts)` and `t.assertInferredPredicate(node, opts)`. - -Aliases: `Flow`, `FlowPredicate` - - ---- - -### interfaceDeclaration -```javascript -t.interfaceDeclaration(id, typeParameters, extends, body) -``` - -See also `t.isInterfaceDeclaration(node, opts)` and `t.assertInterfaceDeclaration(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `extends` (required) - - `body` (required) - ---- - -### interfaceExtends -```javascript -t.interfaceExtends(id, typeParameters) -``` - -See also `t.isInterfaceExtends(node, opts)` and `t.assertInterfaceExtends(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `typeParameters` (required) - ---- - -### intersectionTypeAnnotation -```javascript -t.intersectionTypeAnnotation(types) -``` - -See also `t.isIntersectionTypeAnnotation(node, opts)` and `t.assertIntersectionTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `types` (required) - ---- - -### jSXAttribute -```javascript -t.jSXAttribute(name, value) -``` - -See also `t.isJSXAttribute(node, opts)` and `t.assertJSXAttribute(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `name`: `JSXIdentifier | JSXNamespacedName` (required) - - `value`: `JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer` (default: `null`) - ---- - -### jSXClosingElement -```javascript -t.jSXClosingElement(name) -``` - -See also `t.isJSXClosingElement(node, opts)` and `t.assertJSXClosingElement(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `name`: `JSXIdentifier | JSXMemberExpression` (required) - ---- - -### jSXClosingFragment -```javascript -t.jSXClosingFragment() -``` - -See also `t.isJSXClosingFragment(node, opts)` and `t.assertJSXClosingFragment(node, opts)`. - -Aliases: `JSX`, `Immutable` - - ---- - -### jSXElement -```javascript -t.jSXElement(openingElement, closingElement, children, selfClosing) -``` - -See also `t.isJSXElement(node, opts)` and `t.assertJSXElement(node, opts)`. - -Aliases: `JSX`, `Immutable`, `Expression` - - - `openingElement`: `JSXOpeningElement` (required) - - `closingElement`: `JSXClosingElement` (default: `null`) - - `children`: `Array` (required) - - `selfClosing` (required) - ---- - -### jSXEmptyExpression -```javascript -t.jSXEmptyExpression() -``` - -See also `t.isJSXEmptyExpression(node, opts)` and `t.assertJSXEmptyExpression(node, opts)`. - -Aliases: `JSX` - - ---- - -### jSXExpressionContainer -```javascript -t.jSXExpressionContainer(expression) -``` - -See also `t.isJSXExpressionContainer(node, opts)` and `t.assertJSXExpressionContainer(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `expression`: `Expression` (required) - ---- - -### jSXFragment -```javascript -t.jSXFragment(openingFragment, closingFragment, children) -``` - -See also `t.isJSXFragment(node, opts)` and `t.assertJSXFragment(node, opts)`. - -Aliases: `JSX`, `Immutable`, `Expression` - - - `openingFragment`: `JSXOpeningFragment` (required) - - `closingFragment`: `JSXClosingFragment` (required) - - `children`: `Array` (required) - ---- - -### jSXIdentifier -```javascript -t.jSXIdentifier(name) -``` - -See also `t.isJSXIdentifier(node, opts)` and `t.assertJSXIdentifier(node, opts)`. - -Aliases: `JSX` - - - `name`: `string` (required) - ---- - -### jSXMemberExpression -```javascript -t.jSXMemberExpression(object, property) -``` - -See also `t.isJSXMemberExpression(node, opts)` and `t.assertJSXMemberExpression(node, opts)`. - -Aliases: `JSX` - - - `object`: `JSXMemberExpression | JSXIdentifier` (required) - - `property`: `JSXIdentifier` (required) - ---- - -### jSXNamespacedName -```javascript -t.jSXNamespacedName(namespace, name) -``` - -See also `t.isJSXNamespacedName(node, opts)` and `t.assertJSXNamespacedName(node, opts)`. - -Aliases: `JSX` - - - `namespace`: `JSXIdentifier` (required) - - `name`: `JSXIdentifier` (required) - ---- - -### jSXOpeningElement -```javascript -t.jSXOpeningElement(name, attributes, selfClosing) -``` - -See also `t.isJSXOpeningElement(node, opts)` and `t.assertJSXOpeningElement(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `name`: `JSXIdentifier | JSXMemberExpression` (required) - - `attributes`: `Array` (required) - - `selfClosing`: `boolean` (default: `false`) - ---- - -### jSXOpeningFragment -```javascript -t.jSXOpeningFragment() -``` - -See also `t.isJSXOpeningFragment(node, opts)` and `t.assertJSXOpeningFragment(node, opts)`. - -Aliases: `JSX`, `Immutable` - - ---- - -### jSXSpreadAttribute -```javascript -t.jSXSpreadAttribute(argument) -``` - -See also `t.isJSXSpreadAttribute(node, opts)` and `t.assertJSXSpreadAttribute(node, opts)`. - -Aliases: `JSX` - - - `argument`: `Expression` (required) - ---- - -### jSXSpreadChild -```javascript -t.jSXSpreadChild(expression) -``` - -See also `t.isJSXSpreadChild(node, opts)` and `t.assertJSXSpreadChild(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `expression`: `Expression` (required) - ---- - -### jSXText -```javascript -t.jSXText(value) -``` - -See also `t.isJSXText(node, opts)` and `t.assertJSXText(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `value`: `string` (required) - ---- - -### labeledStatement -```javascript -t.labeledStatement(label, body) -``` - -See also `t.isLabeledStatement(node, opts)` and `t.assertLabeledStatement(node, opts)`. - -Aliases: `Statement` - - - `label`: `Identifier` (required) - - `body`: `Statement` (required) - ---- - -### logicalExpression -```javascript -t.logicalExpression(operator, left, right) -``` - -See also `t.isLogicalExpression(node, opts)` and `t.assertLogicalExpression(node, opts)`. - -Aliases: `Binary`, `Expression` - - - `operator`: `'||' | '&&' | '??'` (required) - - `left`: `Expression` (required) - - `right`: `Expression` (required) - ---- - -### memberExpression -```javascript -t.memberExpression(object, property, computed, optional) -``` - -See also `t.isMemberExpression(node, opts)` and `t.assertMemberExpression(node, opts)`. - -Aliases: `Expression`, `LVal` - - - `object`: `Expression` (required) - - `property`: if computed then `Expression` else `Identifier` (required) - - `computed`: `boolean` (default: `false`) - - `optional`: `true | false` (default: `null`) - ---- - -### metaProperty -```javascript -t.metaProperty(meta, property) -``` - -See also `t.isMetaProperty(node, opts)` and `t.assertMetaProperty(node, opts)`. - -Aliases: `Expression` - - - `meta`: `Identifier` (required) - - `property`: `Identifier` (required) - ---- - -### mixedTypeAnnotation -```javascript -t.mixedTypeAnnotation() -``` - -See also `t.isMixedTypeAnnotation(node, opts)` and `t.assertMixedTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### newExpression -```javascript -t.newExpression(callee, arguments) -``` - -See also `t.isNewExpression(node, opts)` and `t.assertNewExpression(node, opts)`. - -Aliases: `Expression` - - - `callee`: `Expression` (required) - - `arguments`: `Array` (required) - - `optional`: `true | false` (default: `null`) - - `typeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`) - ---- - -### noop -```javascript -t.noop() -``` - -See also `t.isNoop(node, opts)` and `t.assertNoop(node, opts)`. - - ---- - -### nullLiteral -```javascript -t.nullLiteral() -``` - -See also `t.isNullLiteral(node, opts)` and `t.assertNullLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - ---- - -### nullLiteralTypeAnnotation -```javascript -t.nullLiteralTypeAnnotation() -``` - -See also `t.isNullLiteralTypeAnnotation(node, opts)` and `t.assertNullLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### nullableTypeAnnotation -```javascript -t.nullableTypeAnnotation(typeAnnotation) -``` - -See also `t.isNullableTypeAnnotation(node, opts)` and `t.assertNullableTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `typeAnnotation` (required) - ---- - -### numberLiteralTypeAnnotation -```javascript -t.numberLiteralTypeAnnotation() -``` - -See also `t.isNumberLiteralTypeAnnotation(node, opts)` and `t.assertNumberLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - ---- - -### numberTypeAnnotation -```javascript -t.numberTypeAnnotation() -``` - -See also `t.isNumberTypeAnnotation(node, opts)` and `t.assertNumberTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### numericLiteral -```javascript -t.numericLiteral(value) -``` - -See also `t.isNumericLiteral(node, opts)` and `t.assertNumericLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - - `value`: `number` (required) - ---- - -### objectExpression -```javascript -t.objectExpression(properties) -``` - -See also `t.isObjectExpression(node, opts)` and `t.assertObjectExpression(node, opts)`. - -Aliases: `Expression` - - - `properties`: `Array` (required) - ---- - -### objectMethod -```javascript -t.objectMethod(kind, key, params, body, computed) -``` - -See also `t.isObjectMethod(node, opts)` and `t.assertObjectMethod(node, opts)`. - -Aliases: `UserWhitespacable`, `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`, `ObjectMember` - - - `kind`: `"method" | "get" | "set"` (default: `'method'`) - - `key`: if computed then `Expression` else `Identifier | Literal` (required) - - `params`: `Array` (required) - - `body`: `BlockStatement` (required) - - `computed`: `boolean` (default: `false`) - - `async`: `boolean` (default: `false`) - - `decorators`: `Array` (default: `null`) - - `generator`: `boolean` (default: `false`) - - `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - - `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`) - ---- - -### objectPattern -```javascript -t.objectPattern(properties) -``` - -See also `t.isObjectPattern(node, opts)` and `t.assertObjectPattern(node, opts)`. - -Aliases: `Pattern`, `PatternLike`, `LVal` - - - `properties`: `Array` (required) - - `decorators`: `Array` (default: `null`) - - `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - ---- - -### objectProperty -```javascript -t.objectProperty(key, value, computed, shorthand, decorators) -``` - -See also `t.isObjectProperty(node, opts)` and `t.assertObjectProperty(node, opts)`. - -Aliases: `UserWhitespacable`, `Property`, `ObjectMember` - - - `key`: if computed then `Expression` else `Identifier | Literal` (required) - - `value`: `Expression | PatternLike` (required) - - `computed`: `boolean` (default: `false`) - - `shorthand`: `boolean` (default: `false`) - - `decorators`: `Array` (default: `null`) - ---- - -### objectTypeAnnotation -```javascript -t.objectTypeAnnotation(properties, indexers, callProperties) -``` - -See also `t.isObjectTypeAnnotation(node, opts)` and `t.assertObjectTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `properties` (required) - - `indexers` (required) - - `callProperties` (required) - ---- - -### objectTypeCallProperty -```javascript -t.objectTypeCallProperty(value) -``` - -See also `t.isObjectTypeCallProperty(node, opts)` and `t.assertObjectTypeCallProperty(node, opts)`. - -Aliases: `Flow`, `UserWhitespacable` - - - `value` (required) - ---- - -### objectTypeIndexer -```javascript -t.objectTypeIndexer(id, key, value) -``` - -See also `t.isObjectTypeIndexer(node, opts)` and `t.assertObjectTypeIndexer(node, opts)`. - -Aliases: `Flow`, `UserWhitespacable` - - - `id` (required) - - `key` (required) - - `value` (required) - ---- - -### objectTypeProperty -```javascript -t.objectTypeProperty(key, value) -``` - -See also `t.isObjectTypeProperty(node, opts)` and `t.assertObjectTypeProperty(node, opts)`. - -Aliases: `Flow`, `UserWhitespacable` - - - `key` (required) - - `value` (required) - ---- - -### objectTypeSpreadProperty -```javascript -t.objectTypeSpreadProperty(argument) -``` - -See also `t.isObjectTypeSpreadProperty(node, opts)` and `t.assertObjectTypeSpreadProperty(node, opts)`. - -Aliases: `Flow`, `UserWhitespacable` - - - `argument` (required) - ---- - -### opaqueType -```javascript -t.opaqueType(id, typeParameters, supertype, impltype) -``` - -See also `t.isOpaqueType(node, opts)` and `t.assertOpaqueType(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `supertype` (required) - - `impltype` (required) - ---- - -### parenthesizedExpression -```javascript -t.parenthesizedExpression(expression) -``` - -See also `t.isParenthesizedExpression(node, opts)` and `t.assertParenthesizedExpression(node, opts)`. - -Aliases: `Expression`, `ExpressionWrapper` - - - `expression`: `Expression` (required) - ---- - -### program -```javascript -t.program(body, directives, sourceType) -``` - -See also `t.isProgram(node, opts)` and `t.assertProgram(node, opts)`. - -Aliases: `Scopable`, `BlockParent`, `Block` - - - `body`: `Array` (required) - - `directives`: `Array` (default: `[]`) - - `sourceType`: `'script' | 'module'` (default: `'script'`) - - `sourceFile`: `string` (default: `null`) - ---- - -### qualifiedTypeIdentifier -```javascript -t.qualifiedTypeIdentifier(id, qualification) -``` - -See also `t.isQualifiedTypeIdentifier(node, opts)` and `t.assertQualifiedTypeIdentifier(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `qualification` (required) - ---- - -### regExpLiteral -```javascript -t.regExpLiteral(pattern, flags) -``` - -See also `t.isRegExpLiteral(node, opts)` and `t.assertRegExpLiteral(node, opts)`. - -Aliases: `Expression`, `Literal` - - - `pattern`: `string` (required) - - `flags`: `string` (default: `''`) - ---- - -### restElement -```javascript -t.restElement(argument) -``` - -See also `t.isRestElement(node, opts)` and `t.assertRestElement(node, opts)`. - -Aliases: `LVal`, `PatternLike` - - - `argument`: `LVal` (required) - - `decorators`: `Array` (default: `null`) - - `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`) - ---- - -### returnStatement -```javascript -t.returnStatement(argument) -``` - -See also `t.isReturnStatement(node, opts)` and `t.assertReturnStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `argument`: `Expression` (default: `null`) - ---- - -### sequenceExpression -```javascript -t.sequenceExpression(expressions) -``` - -See also `t.isSequenceExpression(node, opts)` and `t.assertSequenceExpression(node, opts)`. - -Aliases: `Expression` - - - `expressions`: `Array` (required) - ---- - -### spreadElement -```javascript -t.spreadElement(argument) -``` - -See also `t.isSpreadElement(node, opts)` and `t.assertSpreadElement(node, opts)`. - -Aliases: `UnaryLike` - - - `argument`: `Expression` (required) - ---- - -### stringLiteral -```javascript -t.stringLiteral(value) -``` - -See also `t.isStringLiteral(node, opts)` and `t.assertStringLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - - `value`: `string` (required) - ---- - -### stringLiteralTypeAnnotation -```javascript -t.stringLiteralTypeAnnotation() -``` - -See also `t.isStringLiteralTypeAnnotation(node, opts)` and `t.assertStringLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - ---- - -### stringTypeAnnotation -```javascript -t.stringTypeAnnotation() -``` - -See also `t.isStringTypeAnnotation(node, opts)` and `t.assertStringTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### super -```javascript -t.super() -``` - -See also `t.isSuper(node, opts)` and `t.assertSuper(node, opts)`. - -Aliases: `Expression` - - ---- - -### switchCase -```javascript -t.switchCase(test, consequent) -``` - -See also `t.isSwitchCase(node, opts)` and `t.assertSwitchCase(node, opts)`. - - - `test`: `Expression` (default: `null`) - - `consequent`: `Array` (required) - ---- - -### switchStatement -```javascript -t.switchStatement(discriminant, cases) -``` - -See also `t.isSwitchStatement(node, opts)` and `t.assertSwitchStatement(node, opts)`. - -Aliases: `Statement`, `BlockParent`, `Scopable` - - - `discriminant`: `Expression` (required) - - `cases`: `Array` (required) - ---- - -### tSAnyKeyword -```javascript -t.tSAnyKeyword() -``` - -See also `t.isTSAnyKeyword(node, opts)` and `t.assertTSAnyKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSArrayType -```javascript -t.tSArrayType(elementType) -``` - -See also `t.isTSArrayType(node, opts)` and `t.assertTSArrayType(node, opts)`. - -Aliases: `TSType` - - - `elementType`: `TSType` (required) - ---- - -### tSAsExpression -```javascript -t.tSAsExpression(expression, typeAnnotation) -``` - -See also `t.isTSAsExpression(node, opts)` and `t.assertTSAsExpression(node, opts)`. - -Aliases: `Expression` - - - `expression`: `Expression` (required) - - `typeAnnotation`: `TSType` (required) - ---- - -### tSBooleanKeyword -```javascript -t.tSBooleanKeyword() -``` - -See also `t.isTSBooleanKeyword(node, opts)` and `t.assertTSBooleanKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSCallSignatureDeclaration -```javascript -t.tSCallSignatureDeclaration(typeParameters, parameters, typeAnnotation) -``` - -See also `t.isTSCallSignatureDeclaration(node, opts)` and `t.assertTSCallSignatureDeclaration(node, opts)`. - -Aliases: `TSTypeElement` - - - `typeParameters`: `TSTypeParameterDeclaration` (default: `null`) - - `parameters`: `Array` (default: `null`) - - `typeAnnotation`: `TSTypeAnnotation` (default: `null`) - ---- - -### tSConstructSignatureDeclaration -```javascript -t.tSConstructSignatureDeclaration(typeParameters, parameters, typeAnnotation) -``` - -See also `t.isTSConstructSignatureDeclaration(node, opts)` and `t.assertTSConstructSignatureDeclaration(node, opts)`. - -Aliases: `TSTypeElement` - - - `typeParameters`: `TSTypeParameterDeclaration` (default: `null`) - - `parameters`: `Array` (default: `null`) - - `typeAnnotation`: `TSTypeAnnotation` (default: `null`) - ---- - -### tSConstructorType -```javascript -t.tSConstructorType(typeParameters, typeAnnotation) -``` - -See also `t.isTSConstructorType(node, opts)` and `t.assertTSConstructorType(node, opts)`. - -Aliases: `TSType` - - - `typeParameters`: `TSTypeParameterDeclaration` (default: `null`) - - `typeAnnotation`: `TSTypeAnnotation` (default: `null`) - - `parameters`: `Array` (default: `null`) - ---- - -### tSDeclareFunction -```javascript -t.tSDeclareFunction(id, typeParameters, params, returnType) -``` - -See also `t.isTSDeclareFunction(node, opts)` and `t.assertTSDeclareFunction(node, opts)`. - -Aliases: `Statement`, `Declaration` - - - `id`: `Identifier` (default: `null`) - - `typeParameters`: `TSTypeParameterDeclaration | Noop` (default: `null`) - - `params`: `Array` (required) - - `returnType`: `TSTypeAnnotation | Noop` (default: `null`) - - `async`: `boolean` (default: `false`) - - `declare`: `boolean` (default: `null`) - - `generator`: `boolean` (default: `false`) - ---- - -### tSDeclareMethod -```javascript -t.tSDeclareMethod(decorators, key, typeParameters, params, returnType) -``` - -See also `t.isTSDeclareMethod(node, opts)` and `t.assertTSDeclareMethod(node, opts)`. - - - `decorators`: `Array` (default: `null`) - - `key` (required) - - `typeParameters`: `TSTypeParameterDeclaration | Noop` (default: `null`) - - `params`: `Array` (required) - - `returnType`: `TSTypeAnnotation | Noop` (default: `null`) - - `abstract`: `boolean` (default: `null`) - - `access`: `"public" | "private" | "protected"` (default: `null`) - - `accessibility`: `"public" | "private" | "protected"` (default: `null`) - - `async`: `boolean` (default: `false`) - - `computed`: `boolean` (default: `false`) - - `generator`: `boolean` (default: `false`) - - `kind`: `"get" | "set" | "method" | "constructor"` (default: `'method'`) - - `optional`: `boolean` (default: `null`) - - `static`: `boolean` (default: `null`) - ---- - -### tSEnumDeclaration -```javascript -t.tSEnumDeclaration(id, members) -``` - -See also `t.isTSEnumDeclaration(node, opts)` and `t.assertTSEnumDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration` - - - `id`: `Identifier` (required) - - `members`: `Array` (required) - - `const`: `boolean` (default: `null`) - - `declare`: `boolean` (default: `null`) - - `initializer`: `Expression` (default: `null`) - ---- - -### tSEnumMember -```javascript -t.tSEnumMember(id, initializer) -``` - -See also `t.isTSEnumMember(node, opts)` and `t.assertTSEnumMember(node, opts)`. - - - `id`: `Identifier | StringLiteral` (required) - - `initializer`: `Expression` (default: `null`) - ---- - -### tSExportAssignment -```javascript -t.tSExportAssignment(expression) -``` - -See also `t.isTSExportAssignment(node, opts)` and `t.assertTSExportAssignment(node, opts)`. - -Aliases: `Statement` - - - `expression`: `Expression` (required) - ---- - -### tSExpressionWithTypeArguments -```javascript -t.tSExpressionWithTypeArguments(expression, typeParameters) -``` - -See also `t.isTSExpressionWithTypeArguments(node, opts)` and `t.assertTSExpressionWithTypeArguments(node, opts)`. - -Aliases: `TSType` - - - `expression`: `TSEntityName` (required) - - `typeParameters`: `TSTypeParameterInstantiation` (default: `null`) - ---- - -### tSExternalModuleReference -```javascript -t.tSExternalModuleReference(expression) -``` - -See also `t.isTSExternalModuleReference(node, opts)` and `t.assertTSExternalModuleReference(node, opts)`. - - - `expression`: `StringLiteral` (required) - ---- - -### tSFunctionType -```javascript -t.tSFunctionType(typeParameters, typeAnnotation) -``` - -See also `t.isTSFunctionType(node, opts)` and `t.assertTSFunctionType(node, opts)`. - -Aliases: `TSType` - - - `typeParameters`: `TSTypeParameterDeclaration` (default: `null`) - - `typeAnnotation`: `TSTypeAnnotation` (default: `null`) - - `parameters`: `Array` (default: `null`) - ---- - -### tSImportEqualsDeclaration -```javascript -t.tSImportEqualsDeclaration(id, moduleReference) -``` - -See also `t.isTSImportEqualsDeclaration(node, opts)` and `t.assertTSImportEqualsDeclaration(node, opts)`. - -Aliases: `Statement` - - - `id`: `Identifier` (required) - - `moduleReference`: `TSEntityName | TSExternalModuleReference` (required) - - `isExport`: `boolean` (default: `null`) - ---- - -### tSIndexSignature -```javascript -t.tSIndexSignature(parameters, typeAnnotation) -``` - -See also `t.isTSIndexSignature(node, opts)` and `t.assertTSIndexSignature(node, opts)`. - -Aliases: `TSTypeElement` - - - `parameters`: `Array` (required) - - `typeAnnotation`: `TSTypeAnnotation` (default: `null`) - - `readonly`: `boolean` (default: `null`) - ---- - -### tSIndexedAccessType -```javascript -t.tSIndexedAccessType(objectType, indexType) -``` - -See also `t.isTSIndexedAccessType(node, opts)` and `t.assertTSIndexedAccessType(node, opts)`. - -Aliases: `TSType` - - - `objectType`: `TSType` (required) - - `indexType`: `TSType` (required) - ---- - -### tSInterfaceBody -```javascript -t.tSInterfaceBody(body) -``` - -See also `t.isTSInterfaceBody(node, opts)` and `t.assertTSInterfaceBody(node, opts)`. - - - `body`: `Array` (required) - ---- - -### tSInterfaceDeclaration -```javascript -t.tSInterfaceDeclaration(id, typeParameters, extends, body) -``` - -See also `t.isTSInterfaceDeclaration(node, opts)` and `t.assertTSInterfaceDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration` - - - `id`: `Identifier` (required) - - `typeParameters`: `TSTypeParameterDeclaration` (default: `null`) - - `extends`: `Array` (default: `null`) - - `body`: `TSInterfaceBody` (required) - - `declare`: `boolean` (default: `null`) - ---- - -### tSIntersectionType -```javascript -t.tSIntersectionType(types) -``` - -See also `t.isTSIntersectionType(node, opts)` and `t.assertTSIntersectionType(node, opts)`. - -Aliases: `TSType` - - - `types`: `Array` (required) - ---- - -### tSLiteralType -```javascript -t.tSLiteralType(literal) -``` - -See also `t.isTSLiteralType(node, opts)` and `t.assertTSLiteralType(node, opts)`. - -Aliases: `TSType` - - - `literal`: `NumericLiteral | StringLiteral | BooleanLiteral` (required) - ---- - -### tSMappedType -```javascript -t.tSMappedType(typeParameter, typeAnnotation) -``` - -See also `t.isTSMappedType(node, opts)` and `t.assertTSMappedType(node, opts)`. - -Aliases: `TSType` - - - `typeParameter`: `TSTypeParameter` (required) - - `typeAnnotation`: `TSType` (default: `null`) - - `optional`: `boolean` (default: `null`) - - `readonly`: `boolean` (default: `null`) - ---- - -### tSMethodSignature -```javascript -t.tSMethodSignature(key, typeParameters, parameters, typeAnnotation) -``` - -See also `t.isTSMethodSignature(node, opts)` and `t.assertTSMethodSignature(node, opts)`. - -Aliases: `TSTypeElement` - - - `key`: `Expression` (required) - - `typeParameters`: `TSTypeParameterDeclaration` (default: `null`) - - `parameters`: `Array` (default: `null`) - - `typeAnnotation`: `TSTypeAnnotation` (default: `null`) - - `computed`: `boolean` (default: `null`) - - `optional`: `boolean` (default: `null`) - ---- - -### tSModuleBlock -```javascript -t.tSModuleBlock(body) -``` - -See also `t.isTSModuleBlock(node, opts)` and `t.assertTSModuleBlock(node, opts)`. - - - `body`: `Array` (required) - ---- - -### tSModuleDeclaration -```javascript -t.tSModuleDeclaration(id, body) -``` - -See also `t.isTSModuleDeclaration(node, opts)` and `t.assertTSModuleDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration` - - - `id`: `Identifier | StringLiteral` (required) - - `body`: `TSModuleBlock | TSModuleDeclaration` (required) - - `declare`: `boolean` (default: `null`) - - `global`: `boolean` (default: `null`) - ---- - -### tSNamespaceExportDeclaration -```javascript -t.tSNamespaceExportDeclaration(id) -``` - -See also `t.isTSNamespaceExportDeclaration(node, opts)` and `t.assertTSNamespaceExportDeclaration(node, opts)`. - -Aliases: `Statement` - - - `id`: `Identifier` (required) - ---- - -### tSNeverKeyword -```javascript -t.tSNeverKeyword() -``` - -See also `t.isTSNeverKeyword(node, opts)` and `t.assertTSNeverKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSNonNullExpression -```javascript -t.tSNonNullExpression(expression) -``` - -See also `t.isTSNonNullExpression(node, opts)` and `t.assertTSNonNullExpression(node, opts)`. - -Aliases: `Expression` - - - `expression`: `Expression` (required) - ---- - -### tSNullKeyword -```javascript -t.tSNullKeyword() -``` - -See also `t.isTSNullKeyword(node, opts)` and `t.assertTSNullKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSNumberKeyword -```javascript -t.tSNumberKeyword() -``` - -See also `t.isTSNumberKeyword(node, opts)` and `t.assertTSNumberKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSObjectKeyword -```javascript -t.tSObjectKeyword() -``` - -See also `t.isTSObjectKeyword(node, opts)` and `t.assertTSObjectKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSParameterProperty -```javascript -t.tSParameterProperty(parameter) -``` - -See also `t.isTSParameterProperty(node, opts)` and `t.assertTSParameterProperty(node, opts)`. - -Aliases: `LVal` - - - `parameter`: `Identifier | AssignmentPattern` (required) - - `accessibility`: `'public' | 'private' | 'protected'` (default: `null`) - - `readonly`: `boolean` (default: `null`) - ---- - -### tSParenthesizedType -```javascript -t.tSParenthesizedType(typeAnnotation) -``` - -See also `t.isTSParenthesizedType(node, opts)` and `t.assertTSParenthesizedType(node, opts)`. - -Aliases: `TSType` - - - `typeAnnotation`: `TSType` (required) - ---- - -### tSPropertySignature -```javascript -t.tSPropertySignature(key, typeAnnotation, initializer) -``` - -See also `t.isTSPropertySignature(node, opts)` and `t.assertTSPropertySignature(node, opts)`. - -Aliases: `TSTypeElement` - - - `key`: `Expression` (required) - - `typeAnnotation`: `TSTypeAnnotation` (default: `null`) - - `initializer`: `Expression` (default: `null`) - - `computed`: `boolean` (default: `null`) - - `optional`: `boolean` (default: `null`) - - `readonly`: `boolean` (default: `null`) - ---- - -### tSQualifiedName -```javascript -t.tSQualifiedName(left, right) -``` - -See also `t.isTSQualifiedName(node, opts)` and `t.assertTSQualifiedName(node, opts)`. - -Aliases: `TSEntityName` - - - `left`: `TSEntityName` (required) - - `right`: `Identifier` (required) - ---- - -### tSStringKeyword -```javascript -t.tSStringKeyword() -``` - -See also `t.isTSStringKeyword(node, opts)` and `t.assertTSStringKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSSymbolKeyword -```javascript -t.tSSymbolKeyword() -``` - -See also `t.isTSSymbolKeyword(node, opts)` and `t.assertTSSymbolKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSThisType -```javascript -t.tSThisType() -``` - -See also `t.isTSThisType(node, opts)` and `t.assertTSThisType(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSTupleType -```javascript -t.tSTupleType(elementTypes) -``` - -See also `t.isTSTupleType(node, opts)` and `t.assertTSTupleType(node, opts)`. - -Aliases: `TSType` - - - `elementTypes`: `Array` (required) - ---- - -### tSTypeAliasDeclaration -```javascript -t.tSTypeAliasDeclaration(id, typeParameters, typeAnnotation) -``` - -See also `t.isTSTypeAliasDeclaration(node, opts)` and `t.assertTSTypeAliasDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration` - - - `id`: `Identifier` (required) - - `typeParameters`: `TSTypeParameterDeclaration` (default: `null`) - - `typeAnnotation`: `TSType` (required) - - `declare`: `boolean` (default: `null`) - ---- - -### tSTypeAnnotation -```javascript -t.tSTypeAnnotation(typeAnnotation) -``` - -See also `t.isTSTypeAnnotation(node, opts)` and `t.assertTSTypeAnnotation(node, opts)`. - - - `typeAnnotation`: `TSType` (required) - ---- - -### tSTypeAssertion -```javascript -t.tSTypeAssertion(typeAnnotation, expression) -``` - -See also `t.isTSTypeAssertion(node, opts)` and `t.assertTSTypeAssertion(node, opts)`. - -Aliases: `Expression` - - - `typeAnnotation`: `TSType` (required) - - `expression`: `Expression` (required) - ---- - -### tSTypeLiteral -```javascript -t.tSTypeLiteral(members) -``` - -See also `t.isTSTypeLiteral(node, opts)` and `t.assertTSTypeLiteral(node, opts)`. - -Aliases: `TSType` - - - `members`: `Array` (required) - ---- - -### tSTypeOperator -```javascript -t.tSTypeOperator(typeAnnotation) -``` - -See also `t.isTSTypeOperator(node, opts)` and `t.assertTSTypeOperator(node, opts)`. - -Aliases: `TSType` - - - `typeAnnotation`: `TSType` (required) - - `operator`: `string` (default: `null`) - ---- - -### tSTypeParameter -```javascript -t.tSTypeParameter(constraint, default) -``` - -See also `t.isTSTypeParameter(node, opts)` and `t.assertTSTypeParameter(node, opts)`. - - - `constraint`: `TSType` (default: `null`) - - `default`: `TSType` (default: `null`) - - `name`: `string` (default: `null`) - ---- - -### tSTypeParameterDeclaration -```javascript -t.tSTypeParameterDeclaration(params) -``` - -See also `t.isTSTypeParameterDeclaration(node, opts)` and `t.assertTSTypeParameterDeclaration(node, opts)`. - - - `params`: `Array` (required) - ---- - -### tSTypeParameterInstantiation -```javascript -t.tSTypeParameterInstantiation(params) -``` - -See also `t.isTSTypeParameterInstantiation(node, opts)` and `t.assertTSTypeParameterInstantiation(node, opts)`. - - - `params`: `Array` (required) - ---- - -### tSTypePredicate -```javascript -t.tSTypePredicate(parameterName, typeAnnotation) -``` - -See also `t.isTSTypePredicate(node, opts)` and `t.assertTSTypePredicate(node, opts)`. - -Aliases: `TSType` - - - `parameterName`: `Identifier | TSThisType` (required) - - `typeAnnotation`: `TSTypeAnnotation` (required) - ---- - -### tSTypeQuery -```javascript -t.tSTypeQuery(exprName) -``` - -See also `t.isTSTypeQuery(node, opts)` and `t.assertTSTypeQuery(node, opts)`. - -Aliases: `TSType` - - - `exprName`: `TSEntityName` (required) - ---- - -### tSTypeReference -```javascript -t.tSTypeReference(typeName, typeParameters) -``` - -See also `t.isTSTypeReference(node, opts)` and `t.assertTSTypeReference(node, opts)`. - -Aliases: `TSType` - - - `typeName`: `TSEntityName` (required) - - `typeParameters`: `TSTypeParameterInstantiation` (default: `null`) - ---- - -### tSUndefinedKeyword -```javascript -t.tSUndefinedKeyword() -``` - -See also `t.isTSUndefinedKeyword(node, opts)` and `t.assertTSUndefinedKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### tSUnionType -```javascript -t.tSUnionType(types) -``` - -See also `t.isTSUnionType(node, opts)` and `t.assertTSUnionType(node, opts)`. - -Aliases: `TSType` - - - `types`: `Array` (required) - ---- - -### tSVoidKeyword -```javascript -t.tSVoidKeyword() -``` - -See also `t.isTSVoidKeyword(node, opts)` and `t.assertTSVoidKeyword(node, opts)`. - -Aliases: `TSType` - - ---- - -### taggedTemplateExpression -```javascript -t.taggedTemplateExpression(tag, quasi) -``` - -See also `t.isTaggedTemplateExpression(node, opts)` and `t.assertTaggedTemplateExpression(node, opts)`. - -Aliases: `Expression` - - - `tag`: `Expression` (required) - - `quasi`: `TemplateLiteral` (required) - ---- - -### templateElement -```javascript -t.templateElement(value, tail) -``` - -See also `t.isTemplateElement(node, opts)` and `t.assertTemplateElement(node, opts)`. - - - `value` (required) - - `tail`: `boolean` (default: `false`) - ---- - -### templateLiteral -```javascript -t.templateLiteral(quasis, expressions) -``` - -See also `t.isTemplateLiteral(node, opts)` and `t.assertTemplateLiteral(node, opts)`. - -Aliases: `Expression`, `Literal` - - - `quasis`: `Array` (required) - - `expressions`: `Array` (required) - ---- - -### thisExpression -```javascript -t.thisExpression() -``` - -See also `t.isThisExpression(node, opts)` and `t.assertThisExpression(node, opts)`. - -Aliases: `Expression` - - ---- - -### thisTypeAnnotation -```javascript -t.thisTypeAnnotation() -``` - -See also `t.isThisTypeAnnotation(node, opts)` and `t.assertThisTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### throwStatement -```javascript -t.throwStatement(argument) -``` - -See also `t.isThrowStatement(node, opts)` and `t.assertThrowStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `argument`: `Expression` (required) - ---- - -### tryStatement -```javascript -t.tryStatement(block, handler, finalizer) -``` - -See also `t.isTryStatement(node, opts)` and `t.assertTryStatement(node, opts)`. - -Aliases: `Statement` - - - `block`: `BlockStatement` (required) - - `handler`: `CatchClause` (default: `null`) - - `finalizer`: `BlockStatement` (default: `null`) - ---- - -### tupleTypeAnnotation -```javascript -t.tupleTypeAnnotation(types) -``` - -See also `t.isTupleTypeAnnotation(node, opts)` and `t.assertTupleTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `types` (required) - ---- - -### typeAlias -```javascript -t.typeAlias(id, typeParameters, right) -``` - -See also `t.isTypeAlias(node, opts)` and `t.assertTypeAlias(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `right` (required) - ---- - -### typeAnnotation -```javascript -t.typeAnnotation(typeAnnotation) -``` - -See also `t.isTypeAnnotation(node, opts)` and `t.assertTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `typeAnnotation`: `Flow` (required) - ---- - -### typeCastExpression -```javascript -t.typeCastExpression(expression, typeAnnotation) -``` - -See also `t.isTypeCastExpression(node, opts)` and `t.assertTypeCastExpression(node, opts)`. - -Aliases: `Flow`, `ExpressionWrapper`, `Expression` - - - `expression` (required) - - `typeAnnotation` (required) - ---- - -### typeParameter -```javascript -t.typeParameter(bound, default) -``` - -See also `t.isTypeParameter(node, opts)` and `t.assertTypeParameter(node, opts)`. - -Aliases: `Flow` - - - `bound`: `TypeAnnotation` (default: `null`) - - `default`: `Flow` (default: `null`) - - `name`: `string` (default: `null`) - ---- - -### typeParameterDeclaration -```javascript -t.typeParameterDeclaration(params) -``` - -See also `t.isTypeParameterDeclaration(node, opts)` and `t.assertTypeParameterDeclaration(node, opts)`. - -Aliases: `Flow` - - - `params`: `Array` (required) - ---- - -### typeParameterInstantiation -```javascript -t.typeParameterInstantiation(params) -``` - -See also `t.isTypeParameterInstantiation(node, opts)` and `t.assertTypeParameterInstantiation(node, opts)`. - -Aliases: `Flow` - - - `params`: `Array` (required) - ---- - -### typeofTypeAnnotation -```javascript -t.typeofTypeAnnotation(argument) -``` - -See also `t.isTypeofTypeAnnotation(node, opts)` and `t.assertTypeofTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `argument` (required) - ---- - -### unaryExpression -```javascript -t.unaryExpression(operator, argument, prefix) -``` - -See also `t.isUnaryExpression(node, opts)` and `t.assertUnaryExpression(node, opts)`. - -Aliases: `UnaryLike`, `Expression` - - - `operator`: `'void' | 'throw' | 'delete' | '!' | '+' | '-' | '~' | 'typeof'` (required) - - `argument`: `Expression` (required) - - `prefix`: `boolean` (default: `true`) - ---- - -### unionTypeAnnotation -```javascript -t.unionTypeAnnotation(types) -``` - -See also `t.isUnionTypeAnnotation(node, opts)` and `t.assertUnionTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `types` (required) - ---- - -### updateExpression -```javascript -t.updateExpression(operator, argument, prefix) -``` - -See also `t.isUpdateExpression(node, opts)` and `t.assertUpdateExpression(node, opts)`. - -Aliases: `Expression` - - - `operator`: `'++' | '--'` (required) - - `argument`: `Expression` (required) - - `prefix`: `boolean` (default: `false`) - ---- - -### variableDeclaration -```javascript -t.variableDeclaration(kind, declarations) -``` - -See also `t.isVariableDeclaration(node, opts)` and `t.assertVariableDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration` - - - `kind`: `"var" | "let" | "const"` (required) - - `declarations`: `Array` (required) - - `declare`: `boolean` (default: `null`) - ---- - -### variableDeclarator -```javascript -t.variableDeclarator(id, init) -``` - -See also `t.isVariableDeclarator(node, opts)` and `t.assertVariableDeclarator(node, opts)`. - - - `id`: `LVal` (required) - - `init`: `Expression` (default: `null`) - ---- - -### voidTypeAnnotation -```javascript -t.voidTypeAnnotation() -``` - -See also `t.isVoidTypeAnnotation(node, opts)` and `t.assertVoidTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### whileStatement -```javascript -t.whileStatement(test, body) -``` - -See also `t.isWhileStatement(node, opts)` and `t.assertWhileStatement(node, opts)`. - -Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable` - - - `test`: `Expression` (required) - - `body`: `BlockStatement | Statement` (required) - ---- - -### withStatement -```javascript -t.withStatement(object, body) -``` - -See also `t.isWithStatement(node, opts)` and `t.assertWithStatement(node, opts)`. - -Aliases: `Statement` - - - `object`: `Expression` (required) - - `body`: `BlockStatement | Statement` (required) - ---- - -### yieldExpression -```javascript -t.yieldExpression(argument, delegate) -``` - -See also `t.isYieldExpression(node, opts)` and `t.assertYieldExpression(node, opts)`. - -Aliases: `Expression`, `Terminatorless` - - - `argument`: `Expression` (default: `null`) - - `delegate`: `boolean` (default: `false`) - ---- - - - - diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/assertNode.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/assertNode.js index 783ee0dbccfae8..194ec716814276 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/assertNode.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/assertNode.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = assertNode; var _isNode = _interopRequireDefault(require("../validators/isNode")); @@ -9,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function assertNode(node) { if (!(0, _isNode.default)(node)) { - var type = node && node.type || JSON.stringify(node); - throw new TypeError("Not a valid node of type \"" + type + "\""); + const type = node && node.type || JSON.stringify(node); + throw new TypeError(`Not a valid node of type "${type}"`); } } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/generated/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/generated/index.js index 8c2b91eed30430..5b5659a1552e69 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/generated/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/asserts/generated/index.js @@ -1,9 +1,12 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.assertArrayExpression = assertArrayExpression; exports.assertAssignmentExpression = assertAssignmentExpression; exports.assertBinaryExpression = assertBinaryExpression; +exports.assertInterpreterDirective = assertInterpreterDirective; exports.assertDirective = assertDirective; exports.assertDirectiveLiteral = assertDirectiveLiteral; exports.assertBlockStatement = assertBlockStatement; @@ -98,6 +101,7 @@ exports.assertGenericTypeAnnotation = assertGenericTypeAnnotation; exports.assertInferredPredicate = assertInferredPredicate; exports.assertInterfaceExtends = assertInterfaceExtends; exports.assertInterfaceDeclaration = assertInterfaceDeclaration; +exports.assertInterfaceTypeAnnotation = assertInterfaceTypeAnnotation; exports.assertIntersectionTypeAnnotation = assertIntersectionTypeAnnotation; exports.assertMixedTypeAnnotation = assertMixedTypeAnnotation; exports.assertEmptyTypeAnnotation = assertEmptyTypeAnnotation; @@ -105,6 +109,7 @@ exports.assertNullableTypeAnnotation = assertNullableTypeAnnotation; exports.assertNumberLiteralTypeAnnotation = assertNumberLiteralTypeAnnotation; exports.assertNumberTypeAnnotation = assertNumberTypeAnnotation; exports.assertObjectTypeAnnotation = assertObjectTypeAnnotation; +exports.assertObjectTypeInternalSlot = assertObjectTypeInternalSlot; exports.assertObjectTypeCallProperty = assertObjectTypeCallProperty; exports.assertObjectTypeIndexer = assertObjectTypeIndexer; exports.assertObjectTypeProperty = assertObjectTypeProperty; @@ -123,6 +128,7 @@ exports.assertTypeParameter = assertTypeParameter; exports.assertTypeParameterDeclaration = assertTypeParameterDeclaration; exports.assertTypeParameterInstantiation = assertTypeParameterInstantiation; exports.assertUnionTypeAnnotation = assertUnionTypeAnnotation; +exports.assertVariance = assertVariance; exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation; exports.assertJSXAttribute = assertJSXAttribute; exports.assertJSXClosingElement = assertJSXClosingElement; @@ -144,11 +150,20 @@ exports.assertParenthesizedExpression = assertParenthesizedExpression; exports.assertAwaitExpression = assertAwaitExpression; exports.assertBindExpression = assertBindExpression; exports.assertClassProperty = assertClassProperty; +exports.assertOptionalMemberExpression = assertOptionalMemberExpression; +exports.assertPipelineTopicExpression = assertPipelineTopicExpression; +exports.assertPipelineBareFunction = assertPipelineBareFunction; +exports.assertPipelinePrimaryTopicReference = assertPipelinePrimaryTopicReference; +exports.assertOptionalCallExpression = assertOptionalCallExpression; +exports.assertClassPrivateProperty = assertClassPrivateProperty; +exports.assertClassPrivateMethod = assertClassPrivateMethod; exports.assertImport = assertImport; exports.assertDecorator = assertDecorator; exports.assertDoExpression = assertDoExpression; exports.assertExportDefaultSpecifier = assertExportDefaultSpecifier; exports.assertExportNamespaceSpecifier = assertExportNamespaceSpecifier; +exports.assertPrivateName = assertPrivateName; +exports.assertBigIntLiteral = assertBigIntLiteral; exports.assertTSParameterProperty = assertTSParameterProperty; exports.assertTSDeclareFunction = assertTSDeclareFunction; exports.assertTSDeclareMethod = assertTSDeclareMethod; @@ -159,6 +174,7 @@ exports.assertTSPropertySignature = assertTSPropertySignature; exports.assertTSMethodSignature = assertTSMethodSignature; exports.assertTSIndexSignature = assertTSIndexSignature; exports.assertTSAnyKeyword = assertTSAnyKeyword; +exports.assertTSUnknownKeyword = assertTSUnknownKeyword; exports.assertTSNumberKeyword = assertTSNumberKeyword; exports.assertTSObjectKeyword = assertTSObjectKeyword; exports.assertTSBooleanKeyword = assertTSBooleanKeyword; @@ -177,8 +193,12 @@ exports.assertTSTypeQuery = assertTSTypeQuery; exports.assertTSTypeLiteral = assertTSTypeLiteral; exports.assertTSArrayType = assertTSArrayType; exports.assertTSTupleType = assertTSTupleType; +exports.assertTSOptionalType = assertTSOptionalType; +exports.assertTSRestType = assertTSRestType; exports.assertTSUnionType = assertTSUnionType; exports.assertTSIntersectionType = assertTSIntersectionType; +exports.assertTSConditionalType = assertTSConditionalType; +exports.assertTSInferType = assertTSInferType; exports.assertTSParenthesizedType = assertTSParenthesizedType; exports.assertTSTypeOperator = assertTSTypeOperator; exports.assertTSIndexedAccessType = assertTSIndexedAccessType; @@ -194,6 +214,7 @@ exports.assertTSEnumDeclaration = assertTSEnumDeclaration; exports.assertTSEnumMember = assertTSEnumMember; exports.assertTSModuleDeclaration = assertTSModuleDeclaration; exports.assertTSModuleBlock = assertTSModuleBlock; +exports.assertTSImportType = assertTSImportType; exports.assertTSImportEqualsDeclaration = assertTSImportEqualsDeclaration; exports.assertTSExternalModuleReference = assertTSExternalModuleReference; exports.assertTSNonNullExpression = assertTSNonNullExpression; @@ -237,10 +258,12 @@ exports.assertModuleDeclaration = assertModuleDeclaration; exports.assertExportDeclaration = assertExportDeclaration; exports.assertModuleSpecifier = assertModuleSpecifier; exports.assertFlow = assertFlow; +exports.assertFlowType = assertFlowType; exports.assertFlowBaseAnnotation = assertFlowBaseAnnotation; exports.assertFlowDeclaration = assertFlowDeclaration; exports.assertFlowPredicate = assertFlowPredicate; exports.assertJSX = assertJSX; +exports.assertPrivate = assertPrivate; exports.assertTSTypeElement = assertTSTypeElement; exports.assertTSType = assertTSType; exports.assertNumberLiteral = assertNumberLiteral; @@ -254,1943 +277,1059 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function assert(type, node, opts) { if (!(0, _is.default)(type, node, opts)) { - throw new Error("Expected type \"" + type + "\" with option " + JSON.stringify(opts) + ", but instead got \"" + node.type + "\"."); + throw new Error(`Expected type "${type}" with option ${JSON.stringify(opts)}, but instead got "${node.type}".`); } } -function assertArrayExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertArrayExpression(node, opts = {}) { assert("ArrayExpression", node, opts); } -function assertAssignmentExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertAssignmentExpression(node, opts = {}) { assert("AssignmentExpression", node, opts); } -function assertBinaryExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBinaryExpression(node, opts = {}) { assert("BinaryExpression", node, opts); } -function assertDirective(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertInterpreterDirective(node, opts = {}) { + assert("InterpreterDirective", node, opts); +} +function assertDirective(node, opts = {}) { assert("Directive", node, opts); } -function assertDirectiveLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDirectiveLiteral(node, opts = {}) { assert("DirectiveLiteral", node, opts); } -function assertBlockStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBlockStatement(node, opts = {}) { assert("BlockStatement", node, opts); } -function assertBreakStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBreakStatement(node, opts = {}) { assert("BreakStatement", node, opts); } -function assertCallExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertCallExpression(node, opts = {}) { assert("CallExpression", node, opts); } -function assertCatchClause(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertCatchClause(node, opts = {}) { assert("CatchClause", node, opts); } -function assertConditionalExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertConditionalExpression(node, opts = {}) { assert("ConditionalExpression", node, opts); } -function assertContinueStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertContinueStatement(node, opts = {}) { assert("ContinueStatement", node, opts); } -function assertDebuggerStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDebuggerStatement(node, opts = {}) { assert("DebuggerStatement", node, opts); } -function assertDoWhileStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDoWhileStatement(node, opts = {}) { assert("DoWhileStatement", node, opts); } -function assertEmptyStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertEmptyStatement(node, opts = {}) { assert("EmptyStatement", node, opts); } -function assertExpressionStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExpressionStatement(node, opts = {}) { assert("ExpressionStatement", node, opts); } -function assertFile(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFile(node, opts = {}) { assert("File", node, opts); } -function assertForInStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertForInStatement(node, opts = {}) { assert("ForInStatement", node, opts); } -function assertForStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertForStatement(node, opts = {}) { assert("ForStatement", node, opts); } -function assertFunctionDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFunctionDeclaration(node, opts = {}) { assert("FunctionDeclaration", node, opts); } -function assertFunctionExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFunctionExpression(node, opts = {}) { assert("FunctionExpression", node, opts); } -function assertIdentifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertIdentifier(node, opts = {}) { assert("Identifier", node, opts); } -function assertIfStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertIfStatement(node, opts = {}) { assert("IfStatement", node, opts); } -function assertLabeledStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertLabeledStatement(node, opts = {}) { assert("LabeledStatement", node, opts); } -function assertStringLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertStringLiteral(node, opts = {}) { assert("StringLiteral", node, opts); } -function assertNumericLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNumericLiteral(node, opts = {}) { assert("NumericLiteral", node, opts); } -function assertNullLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNullLiteral(node, opts = {}) { assert("NullLiteral", node, opts); } -function assertBooleanLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBooleanLiteral(node, opts = {}) { assert("BooleanLiteral", node, opts); } -function assertRegExpLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertRegExpLiteral(node, opts = {}) { assert("RegExpLiteral", node, opts); } -function assertLogicalExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertLogicalExpression(node, opts = {}) { assert("LogicalExpression", node, opts); } -function assertMemberExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertMemberExpression(node, opts = {}) { assert("MemberExpression", node, opts); } -function assertNewExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNewExpression(node, opts = {}) { assert("NewExpression", node, opts); } -function assertProgram(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertProgram(node, opts = {}) { assert("Program", node, opts); } -function assertObjectExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectExpression(node, opts = {}) { assert("ObjectExpression", node, opts); } -function assertObjectMethod(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectMethod(node, opts = {}) { assert("ObjectMethod", node, opts); } -function assertObjectProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectProperty(node, opts = {}) { assert("ObjectProperty", node, opts); } -function assertRestElement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertRestElement(node, opts = {}) { assert("RestElement", node, opts); } -function assertReturnStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertReturnStatement(node, opts = {}) { assert("ReturnStatement", node, opts); } -function assertSequenceExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertSequenceExpression(node, opts = {}) { assert("SequenceExpression", node, opts); } -function assertSwitchCase(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertSwitchCase(node, opts = {}) { assert("SwitchCase", node, opts); } -function assertSwitchStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertSwitchStatement(node, opts = {}) { assert("SwitchStatement", node, opts); } -function assertThisExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertThisExpression(node, opts = {}) { assert("ThisExpression", node, opts); } -function assertThrowStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertThrowStatement(node, opts = {}) { assert("ThrowStatement", node, opts); } -function assertTryStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTryStatement(node, opts = {}) { assert("TryStatement", node, opts); } -function assertUnaryExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertUnaryExpression(node, opts = {}) { assert("UnaryExpression", node, opts); } -function assertUpdateExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertUpdateExpression(node, opts = {}) { assert("UpdateExpression", node, opts); } -function assertVariableDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertVariableDeclaration(node, opts = {}) { assert("VariableDeclaration", node, opts); } -function assertVariableDeclarator(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertVariableDeclarator(node, opts = {}) { assert("VariableDeclarator", node, opts); } -function assertWhileStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertWhileStatement(node, opts = {}) { assert("WhileStatement", node, opts); } -function assertWithStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertWithStatement(node, opts = {}) { assert("WithStatement", node, opts); } -function assertAssignmentPattern(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertAssignmentPattern(node, opts = {}) { assert("AssignmentPattern", node, opts); } -function assertArrayPattern(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertArrayPattern(node, opts = {}) { assert("ArrayPattern", node, opts); } -function assertArrowFunctionExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertArrowFunctionExpression(node, opts = {}) { assert("ArrowFunctionExpression", node, opts); } -function assertClassBody(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertClassBody(node, opts = {}) { assert("ClassBody", node, opts); } -function assertClassDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertClassDeclaration(node, opts = {}) { assert("ClassDeclaration", node, opts); } -function assertClassExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertClassExpression(node, opts = {}) { assert("ClassExpression", node, opts); } -function assertExportAllDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExportAllDeclaration(node, opts = {}) { assert("ExportAllDeclaration", node, opts); } -function assertExportDefaultDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExportDefaultDeclaration(node, opts = {}) { assert("ExportDefaultDeclaration", node, opts); } -function assertExportNamedDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExportNamedDeclaration(node, opts = {}) { assert("ExportNamedDeclaration", node, opts); } -function assertExportSpecifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExportSpecifier(node, opts = {}) { assert("ExportSpecifier", node, opts); } -function assertForOfStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertForOfStatement(node, opts = {}) { assert("ForOfStatement", node, opts); } -function assertImportDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertImportDeclaration(node, opts = {}) { assert("ImportDeclaration", node, opts); } -function assertImportDefaultSpecifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertImportDefaultSpecifier(node, opts = {}) { assert("ImportDefaultSpecifier", node, opts); } -function assertImportNamespaceSpecifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertImportNamespaceSpecifier(node, opts = {}) { assert("ImportNamespaceSpecifier", node, opts); } -function assertImportSpecifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertImportSpecifier(node, opts = {}) { assert("ImportSpecifier", node, opts); } -function assertMetaProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertMetaProperty(node, opts = {}) { assert("MetaProperty", node, opts); } -function assertClassMethod(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertClassMethod(node, opts = {}) { assert("ClassMethod", node, opts); } -function assertObjectPattern(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectPattern(node, opts = {}) { assert("ObjectPattern", node, opts); } -function assertSpreadElement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertSpreadElement(node, opts = {}) { assert("SpreadElement", node, opts); } -function assertSuper(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertSuper(node, opts = {}) { assert("Super", node, opts); } -function assertTaggedTemplateExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTaggedTemplateExpression(node, opts = {}) { assert("TaggedTemplateExpression", node, opts); } -function assertTemplateElement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTemplateElement(node, opts = {}) { assert("TemplateElement", node, opts); } -function assertTemplateLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTemplateLiteral(node, opts = {}) { assert("TemplateLiteral", node, opts); } -function assertYieldExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertYieldExpression(node, opts = {}) { assert("YieldExpression", node, opts); } -function assertAnyTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertAnyTypeAnnotation(node, opts = {}) { assert("AnyTypeAnnotation", node, opts); } -function assertArrayTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertArrayTypeAnnotation(node, opts = {}) { assert("ArrayTypeAnnotation", node, opts); } -function assertBooleanTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBooleanTypeAnnotation(node, opts = {}) { assert("BooleanTypeAnnotation", node, opts); } -function assertBooleanLiteralTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBooleanLiteralTypeAnnotation(node, opts = {}) { assert("BooleanLiteralTypeAnnotation", node, opts); } -function assertNullLiteralTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNullLiteralTypeAnnotation(node, opts = {}) { assert("NullLiteralTypeAnnotation", node, opts); } -function assertClassImplements(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertClassImplements(node, opts = {}) { assert("ClassImplements", node, opts); } -function assertDeclareClass(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareClass(node, opts = {}) { assert("DeclareClass", node, opts); } -function assertDeclareFunction(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareFunction(node, opts = {}) { assert("DeclareFunction", node, opts); } -function assertDeclareInterface(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareInterface(node, opts = {}) { assert("DeclareInterface", node, opts); } -function assertDeclareModule(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareModule(node, opts = {}) { assert("DeclareModule", node, opts); } -function assertDeclareModuleExports(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareModuleExports(node, opts = {}) { assert("DeclareModuleExports", node, opts); } -function assertDeclareTypeAlias(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareTypeAlias(node, opts = {}) { assert("DeclareTypeAlias", node, opts); } -function assertDeclareOpaqueType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareOpaqueType(node, opts = {}) { assert("DeclareOpaqueType", node, opts); } -function assertDeclareVariable(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareVariable(node, opts = {}) { assert("DeclareVariable", node, opts); } -function assertDeclareExportDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareExportDeclaration(node, opts = {}) { assert("DeclareExportDeclaration", node, opts); } -function assertDeclareExportAllDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclareExportAllDeclaration(node, opts = {}) { assert("DeclareExportAllDeclaration", node, opts); } -function assertDeclaredPredicate(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclaredPredicate(node, opts = {}) { assert("DeclaredPredicate", node, opts); } -function assertExistsTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExistsTypeAnnotation(node, opts = {}) { assert("ExistsTypeAnnotation", node, opts); } -function assertFunctionTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFunctionTypeAnnotation(node, opts = {}) { assert("FunctionTypeAnnotation", node, opts); } -function assertFunctionTypeParam(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFunctionTypeParam(node, opts = {}) { assert("FunctionTypeParam", node, opts); } -function assertGenericTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertGenericTypeAnnotation(node, opts = {}) { assert("GenericTypeAnnotation", node, opts); } -function assertInferredPredicate(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertInferredPredicate(node, opts = {}) { assert("InferredPredicate", node, opts); } -function assertInterfaceExtends(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertInterfaceExtends(node, opts = {}) { assert("InterfaceExtends", node, opts); } -function assertInterfaceDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertInterfaceDeclaration(node, opts = {}) { assert("InterfaceDeclaration", node, opts); } -function assertIntersectionTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertInterfaceTypeAnnotation(node, opts = {}) { + assert("InterfaceTypeAnnotation", node, opts); +} +function assertIntersectionTypeAnnotation(node, opts = {}) { assert("IntersectionTypeAnnotation", node, opts); } -function assertMixedTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertMixedTypeAnnotation(node, opts = {}) { assert("MixedTypeAnnotation", node, opts); } -function assertEmptyTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertEmptyTypeAnnotation(node, opts = {}) { assert("EmptyTypeAnnotation", node, opts); } -function assertNullableTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNullableTypeAnnotation(node, opts = {}) { assert("NullableTypeAnnotation", node, opts); } -function assertNumberLiteralTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNumberLiteralTypeAnnotation(node, opts = {}) { assert("NumberLiteralTypeAnnotation", node, opts); } -function assertNumberTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNumberTypeAnnotation(node, opts = {}) { assert("NumberTypeAnnotation", node, opts); } -function assertObjectTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectTypeAnnotation(node, opts = {}) { assert("ObjectTypeAnnotation", node, opts); } -function assertObjectTypeCallProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertObjectTypeInternalSlot(node, opts = {}) { + assert("ObjectTypeInternalSlot", node, opts); +} +function assertObjectTypeCallProperty(node, opts = {}) { assert("ObjectTypeCallProperty", node, opts); } -function assertObjectTypeIndexer(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectTypeIndexer(node, opts = {}) { assert("ObjectTypeIndexer", node, opts); } -function assertObjectTypeProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectTypeProperty(node, opts = {}) { assert("ObjectTypeProperty", node, opts); } -function assertObjectTypeSpreadProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectTypeSpreadProperty(node, opts = {}) { assert("ObjectTypeSpreadProperty", node, opts); } -function assertOpaqueType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertOpaqueType(node, opts = {}) { assert("OpaqueType", node, opts); } -function assertQualifiedTypeIdentifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertQualifiedTypeIdentifier(node, opts = {}) { assert("QualifiedTypeIdentifier", node, opts); } -function assertStringLiteralTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertStringLiteralTypeAnnotation(node, opts = {}) { assert("StringLiteralTypeAnnotation", node, opts); } -function assertStringTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertStringTypeAnnotation(node, opts = {}) { assert("StringTypeAnnotation", node, opts); } -function assertThisTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertThisTypeAnnotation(node, opts = {}) { assert("ThisTypeAnnotation", node, opts); } -function assertTupleTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTupleTypeAnnotation(node, opts = {}) { assert("TupleTypeAnnotation", node, opts); } -function assertTypeofTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTypeofTypeAnnotation(node, opts = {}) { assert("TypeofTypeAnnotation", node, opts); } -function assertTypeAlias(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTypeAlias(node, opts = {}) { assert("TypeAlias", node, opts); } -function assertTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTypeAnnotation(node, opts = {}) { assert("TypeAnnotation", node, opts); } -function assertTypeCastExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTypeCastExpression(node, opts = {}) { assert("TypeCastExpression", node, opts); } -function assertTypeParameter(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTypeParameter(node, opts = {}) { assert("TypeParameter", node, opts); } -function assertTypeParameterDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTypeParameterDeclaration(node, opts = {}) { assert("TypeParameterDeclaration", node, opts); } -function assertTypeParameterInstantiation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTypeParameterInstantiation(node, opts = {}) { assert("TypeParameterInstantiation", node, opts); } -function assertUnionTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertUnionTypeAnnotation(node, opts = {}) { assert("UnionTypeAnnotation", node, opts); } -function assertVoidTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertVariance(node, opts = {}) { + assert("Variance", node, opts); +} +function assertVoidTypeAnnotation(node, opts = {}) { assert("VoidTypeAnnotation", node, opts); } -function assertJSXAttribute(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXAttribute(node, opts = {}) { assert("JSXAttribute", node, opts); } -function assertJSXClosingElement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXClosingElement(node, opts = {}) { assert("JSXClosingElement", node, opts); } -function assertJSXElement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXElement(node, opts = {}) { assert("JSXElement", node, opts); } -function assertJSXEmptyExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXEmptyExpression(node, opts = {}) { assert("JSXEmptyExpression", node, opts); } -function assertJSXExpressionContainer(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXExpressionContainer(node, opts = {}) { assert("JSXExpressionContainer", node, opts); } -function assertJSXSpreadChild(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXSpreadChild(node, opts = {}) { assert("JSXSpreadChild", node, opts); } -function assertJSXIdentifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXIdentifier(node, opts = {}) { assert("JSXIdentifier", node, opts); } -function assertJSXMemberExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXMemberExpression(node, opts = {}) { assert("JSXMemberExpression", node, opts); } -function assertJSXNamespacedName(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXNamespacedName(node, opts = {}) { assert("JSXNamespacedName", node, opts); } -function assertJSXOpeningElement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXOpeningElement(node, opts = {}) { assert("JSXOpeningElement", node, opts); } -function assertJSXSpreadAttribute(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXSpreadAttribute(node, opts = {}) { assert("JSXSpreadAttribute", node, opts); } -function assertJSXText(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXText(node, opts = {}) { assert("JSXText", node, opts); } -function assertJSXFragment(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXFragment(node, opts = {}) { assert("JSXFragment", node, opts); } -function assertJSXOpeningFragment(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXOpeningFragment(node, opts = {}) { assert("JSXOpeningFragment", node, opts); } -function assertJSXClosingFragment(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSXClosingFragment(node, opts = {}) { assert("JSXClosingFragment", node, opts); } -function assertNoop(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertNoop(node, opts = {}) { assert("Noop", node, opts); } -function assertParenthesizedExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertParenthesizedExpression(node, opts = {}) { assert("ParenthesizedExpression", node, opts); } -function assertAwaitExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertAwaitExpression(node, opts = {}) { assert("AwaitExpression", node, opts); } -function assertBindExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBindExpression(node, opts = {}) { assert("BindExpression", node, opts); } -function assertClassProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertClassProperty(node, opts = {}) { assert("ClassProperty", node, opts); } -function assertImport(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertOptionalMemberExpression(node, opts = {}) { + assert("OptionalMemberExpression", node, opts); +} - assert("Import", node, opts); +function assertPipelineTopicExpression(node, opts = {}) { + assert("PipelineTopicExpression", node, opts); } -function assertDecorator(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertPipelineBareFunction(node, opts = {}) { + assert("PipelineBareFunction", node, opts); +} - assert("Decorator", node, opts); +function assertPipelinePrimaryTopicReference(node, opts = {}) { + assert("PipelinePrimaryTopicReference", node, opts); } -function assertDoExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertOptionalCallExpression(node, opts = {}) { + assert("OptionalCallExpression", node, opts); +} - assert("DoExpression", node, opts); +function assertClassPrivateProperty(node, opts = {}) { + assert("ClassPrivateProperty", node, opts); } -function assertExportDefaultSpecifier(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertClassPrivateMethod(node, opts = {}) { + assert("ClassPrivateMethod", node, opts); +} - assert("ExportDefaultSpecifier", node, opts); +function assertImport(node, opts = {}) { + assert("Import", node, opts); } -function assertExportNamespaceSpecifier(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertDecorator(node, opts = {}) { + assert("Decorator", node, opts); +} + +function assertDoExpression(node, opts = {}) { + assert("DoExpression", node, opts); +} +function assertExportDefaultSpecifier(node, opts = {}) { + assert("ExportDefaultSpecifier", node, opts); +} + +function assertExportNamespaceSpecifier(node, opts = {}) { assert("ExportNamespaceSpecifier", node, opts); } -function assertTSParameterProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertPrivateName(node, opts = {}) { + assert("PrivateName", node, opts); +} - assert("TSParameterProperty", node, opts); +function assertBigIntLiteral(node, opts = {}) { + assert("BigIntLiteral", node, opts); } -function assertTSDeclareFunction(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertTSParameterProperty(node, opts = {}) { + assert("TSParameterProperty", node, opts); +} +function assertTSDeclareFunction(node, opts = {}) { assert("TSDeclareFunction", node, opts); } -function assertTSDeclareMethod(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSDeclareMethod(node, opts = {}) { assert("TSDeclareMethod", node, opts); } -function assertTSQualifiedName(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSQualifiedName(node, opts = {}) { assert("TSQualifiedName", node, opts); } -function assertTSCallSignatureDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSCallSignatureDeclaration(node, opts = {}) { assert("TSCallSignatureDeclaration", node, opts); } -function assertTSConstructSignatureDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSConstructSignatureDeclaration(node, opts = {}) { assert("TSConstructSignatureDeclaration", node, opts); } -function assertTSPropertySignature(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSPropertySignature(node, opts = {}) { assert("TSPropertySignature", node, opts); } -function assertTSMethodSignature(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSMethodSignature(node, opts = {}) { assert("TSMethodSignature", node, opts); } -function assertTSIndexSignature(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSIndexSignature(node, opts = {}) { assert("TSIndexSignature", node, opts); } -function assertTSAnyKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSAnyKeyword(node, opts = {}) { assert("TSAnyKeyword", node, opts); } -function assertTSNumberKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertTSUnknownKeyword(node, opts = {}) { + assert("TSUnknownKeyword", node, opts); +} +function assertTSNumberKeyword(node, opts = {}) { assert("TSNumberKeyword", node, opts); } -function assertTSObjectKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSObjectKeyword(node, opts = {}) { assert("TSObjectKeyword", node, opts); } -function assertTSBooleanKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSBooleanKeyword(node, opts = {}) { assert("TSBooleanKeyword", node, opts); } -function assertTSStringKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSStringKeyword(node, opts = {}) { assert("TSStringKeyword", node, opts); } -function assertTSSymbolKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSSymbolKeyword(node, opts = {}) { assert("TSSymbolKeyword", node, opts); } -function assertTSVoidKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSVoidKeyword(node, opts = {}) { assert("TSVoidKeyword", node, opts); } -function assertTSUndefinedKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSUndefinedKeyword(node, opts = {}) { assert("TSUndefinedKeyword", node, opts); } -function assertTSNullKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSNullKeyword(node, opts = {}) { assert("TSNullKeyword", node, opts); } -function assertTSNeverKeyword(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSNeverKeyword(node, opts = {}) { assert("TSNeverKeyword", node, opts); } -function assertTSThisType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSThisType(node, opts = {}) { assert("TSThisType", node, opts); } -function assertTSFunctionType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSFunctionType(node, opts = {}) { assert("TSFunctionType", node, opts); } -function assertTSConstructorType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSConstructorType(node, opts = {}) { assert("TSConstructorType", node, opts); } -function assertTSTypeReference(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeReference(node, opts = {}) { assert("TSTypeReference", node, opts); } -function assertTSTypePredicate(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypePredicate(node, opts = {}) { assert("TSTypePredicate", node, opts); } -function assertTSTypeQuery(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeQuery(node, opts = {}) { assert("TSTypeQuery", node, opts); } -function assertTSTypeLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeLiteral(node, opts = {}) { assert("TSTypeLiteral", node, opts); } -function assertTSArrayType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSArrayType(node, opts = {}) { assert("TSArrayType", node, opts); } -function assertTSTupleType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTupleType(node, opts = {}) { assert("TSTupleType", node, opts); } -function assertTSUnionType(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertTSOptionalType(node, opts = {}) { + assert("TSOptionalType", node, opts); +} - assert("TSUnionType", node, opts); +function assertTSRestType(node, opts = {}) { + assert("TSRestType", node, opts); } -function assertTSIntersectionType(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertTSUnionType(node, opts = {}) { + assert("TSUnionType", node, opts); +} +function assertTSIntersectionType(node, opts = {}) { assert("TSIntersectionType", node, opts); } -function assertTSParenthesizedType(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertTSConditionalType(node, opts = {}) { + assert("TSConditionalType", node, opts); +} - assert("TSParenthesizedType", node, opts); +function assertTSInferType(node, opts = {}) { + assert("TSInferType", node, opts); } -function assertTSTypeOperator(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertTSParenthesizedType(node, opts = {}) { + assert("TSParenthesizedType", node, opts); +} +function assertTSTypeOperator(node, opts = {}) { assert("TSTypeOperator", node, opts); } -function assertTSIndexedAccessType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSIndexedAccessType(node, opts = {}) { assert("TSIndexedAccessType", node, opts); } -function assertTSMappedType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSMappedType(node, opts = {}) { assert("TSMappedType", node, opts); } -function assertTSLiteralType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSLiteralType(node, opts = {}) { assert("TSLiteralType", node, opts); } -function assertTSExpressionWithTypeArguments(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSExpressionWithTypeArguments(node, opts = {}) { assert("TSExpressionWithTypeArguments", node, opts); } -function assertTSInterfaceDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSInterfaceDeclaration(node, opts = {}) { assert("TSInterfaceDeclaration", node, opts); } -function assertTSInterfaceBody(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSInterfaceBody(node, opts = {}) { assert("TSInterfaceBody", node, opts); } -function assertTSTypeAliasDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeAliasDeclaration(node, opts = {}) { assert("TSTypeAliasDeclaration", node, opts); } -function assertTSAsExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSAsExpression(node, opts = {}) { assert("TSAsExpression", node, opts); } -function assertTSTypeAssertion(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeAssertion(node, opts = {}) { assert("TSTypeAssertion", node, opts); } -function assertTSEnumDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSEnumDeclaration(node, opts = {}) { assert("TSEnumDeclaration", node, opts); } -function assertTSEnumMember(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSEnumMember(node, opts = {}) { assert("TSEnumMember", node, opts); } -function assertTSModuleDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSModuleDeclaration(node, opts = {}) { assert("TSModuleDeclaration", node, opts); } -function assertTSModuleBlock(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSModuleBlock(node, opts = {}) { assert("TSModuleBlock", node, opts); } -function assertTSImportEqualsDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertTSImportType(node, opts = {}) { + assert("TSImportType", node, opts); +} +function assertTSImportEqualsDeclaration(node, opts = {}) { assert("TSImportEqualsDeclaration", node, opts); } -function assertTSExternalModuleReference(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSExternalModuleReference(node, opts = {}) { assert("TSExternalModuleReference", node, opts); } -function assertTSNonNullExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSNonNullExpression(node, opts = {}) { assert("TSNonNullExpression", node, opts); } -function assertTSExportAssignment(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSExportAssignment(node, opts = {}) { assert("TSExportAssignment", node, opts); } -function assertTSNamespaceExportDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSNamespaceExportDeclaration(node, opts = {}) { assert("TSNamespaceExportDeclaration", node, opts); } -function assertTSTypeAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeAnnotation(node, opts = {}) { assert("TSTypeAnnotation", node, opts); } -function assertTSTypeParameterInstantiation(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeParameterInstantiation(node, opts = {}) { assert("TSTypeParameterInstantiation", node, opts); } -function assertTSTypeParameterDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeParameterDeclaration(node, opts = {}) { assert("TSTypeParameterDeclaration", node, opts); } -function assertTSTypeParameter(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSTypeParameter(node, opts = {}) { assert("TSTypeParameter", node, opts); } -function assertExpression(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExpression(node, opts = {}) { assert("Expression", node, opts); } -function assertBinary(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBinary(node, opts = {}) { assert("Binary", node, opts); } -function assertScopable(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertScopable(node, opts = {}) { assert("Scopable", node, opts); } -function assertBlockParent(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBlockParent(node, opts = {}) { assert("BlockParent", node, opts); } -function assertBlock(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertBlock(node, opts = {}) { assert("Block", node, opts); } -function assertStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertStatement(node, opts = {}) { assert("Statement", node, opts); } -function assertTerminatorless(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTerminatorless(node, opts = {}) { assert("Terminatorless", node, opts); } -function assertCompletionStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertCompletionStatement(node, opts = {}) { assert("CompletionStatement", node, opts); } -function assertConditional(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertConditional(node, opts = {}) { assert("Conditional", node, opts); } -function assertLoop(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertLoop(node, opts = {}) { assert("Loop", node, opts); } -function assertWhile(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertWhile(node, opts = {}) { assert("While", node, opts); } -function assertExpressionWrapper(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExpressionWrapper(node, opts = {}) { assert("ExpressionWrapper", node, opts); } -function assertFor(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFor(node, opts = {}) { assert("For", node, opts); } -function assertForXStatement(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertForXStatement(node, opts = {}) { assert("ForXStatement", node, opts); } -function assertFunction(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFunction(node, opts = {}) { assert("Function", node, opts); } -function assertFunctionParent(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFunctionParent(node, opts = {}) { assert("FunctionParent", node, opts); } -function assertPureish(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertPureish(node, opts = {}) { assert("Pureish", node, opts); } -function assertDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertDeclaration(node, opts = {}) { assert("Declaration", node, opts); } -function assertPatternLike(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertPatternLike(node, opts = {}) { assert("PatternLike", node, opts); } -function assertLVal(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertLVal(node, opts = {}) { assert("LVal", node, opts); } -function assertTSEntityName(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSEntityName(node, opts = {}) { assert("TSEntityName", node, opts); } -function assertLiteral(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertLiteral(node, opts = {}) { assert("Literal", node, opts); } -function assertImmutable(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertImmutable(node, opts = {}) { assert("Immutable", node, opts); } -function assertUserWhitespacable(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertUserWhitespacable(node, opts = {}) { assert("UserWhitespacable", node, opts); } -function assertMethod(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertMethod(node, opts = {}) { assert("Method", node, opts); } -function assertObjectMember(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertObjectMember(node, opts = {}) { assert("ObjectMember", node, opts); } -function assertProperty(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertProperty(node, opts = {}) { assert("Property", node, opts); } -function assertUnaryLike(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertUnaryLike(node, opts = {}) { assert("UnaryLike", node, opts); } -function assertPattern(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertPattern(node, opts = {}) { assert("Pattern", node, opts); } -function assertClass(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertClass(node, opts = {}) { assert("Class", node, opts); } -function assertModuleDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertModuleDeclaration(node, opts = {}) { assert("ModuleDeclaration", node, opts); } -function assertExportDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertExportDeclaration(node, opts = {}) { assert("ExportDeclaration", node, opts); } -function assertModuleSpecifier(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertModuleSpecifier(node, opts = {}) { assert("ModuleSpecifier", node, opts); } -function assertFlow(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFlow(node, opts = {}) { assert("Flow", node, opts); } -function assertFlowBaseAnnotation(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertFlowType(node, opts = {}) { + assert("FlowType", node, opts); +} +function assertFlowBaseAnnotation(node, opts = {}) { assert("FlowBaseAnnotation", node, opts); } -function assertFlowDeclaration(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFlowDeclaration(node, opts = {}) { assert("FlowDeclaration", node, opts); } -function assertFlowPredicate(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertFlowPredicate(node, opts = {}) { assert("FlowPredicate", node, opts); } -function assertJSX(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertJSX(node, opts = {}) { assert("JSX", node, opts); } -function assertTSTypeElement(node, opts) { - if (opts === void 0) { - opts = {}; - } +function assertPrivate(node, opts = {}) { + assert("Private", node, opts); +} +function assertTSTypeElement(node, opts = {}) { assert("TSTypeElement", node, opts); } -function assertTSType(node, opts) { - if (opts === void 0) { - opts = {}; - } - +function assertTSType(node, opts = {}) { assert("TSType", node, opts); } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/builder.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/builder.js index 4adf87032d41f1..50d1b2a95f5bbf 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/builder.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/builder.js @@ -1,9 +1,19 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = builder; -var _clone = _interopRequireDefault(require("lodash/clone")); +function _clone() { + const data = _interopRequireDefault(require("lodash/clone")); + + _clone = function () { + return data; + }; + + return data; +} var _definitions = require("../definitions"); @@ -11,32 +21,28 @@ var _validate = _interopRequireDefault(require("../validators/validate")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function builder(type) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var keys = _definitions.BUILDER_KEYS[type]; - var countArgs = args.length; +function builder(type, ...args) { + const keys = _definitions.BUILDER_KEYS[type]; + const countArgs = args.length; if (countArgs > keys.length) { - throw new Error(type + ": Too many arguments passed. Received " + countArgs + " but can receive no more than " + keys.length); + throw new Error(`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`); } - var node = { - type: type + const node = { + type }; - var i = 0; - keys.forEach(function (key) { - var field = _definitions.NODE_FIELDS[type][key]; - var arg; + let i = 0; + keys.forEach(key => { + const field = _definitions.NODE_FIELDS[type][key]; + let arg; if (i < countArgs) arg = args[i]; - if (arg === undefined) arg = (0, _clone.default)(field.default); + if (arg === undefined) arg = (0, _clone().default)(field.default); node[key] = arg; i++; }); - for (var key in node) { + for (const key in node) { (0, _validate.default)(node, key, node[key]); } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js index bff3b99b3f62e5..4724335f2ab71e 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = createTypeAnnotationBasedOnTypeof; var _generated = require("../generated"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createUnionTypeAnnotation.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createUnionTypeAnnotation.js index 932e45972962ce..df76b0107ff09f 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createUnionTypeAnnotation.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/flow/createUnionTypeAnnotation.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = createUnionTypeAnnotation; var _generated = require("../generated"); @@ -10,7 +12,7 @@ var _removeTypeDuplicates = _interopRequireDefault(require("../../modifications/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function createUnionTypeAnnotation(types) { - var flattened = (0, _removeTypeDuplicates.default)(types); + const flattened = (0, _removeTypeDuplicates.default)(types); if (flattened.length === 1) { return flattened[0]; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/generated/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/generated/index.js index 632b628f8dd6bb..e77a2dd345fe92 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/generated/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/generated/index.js @@ -1,9 +1,12 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.arrayExpression = exports.ArrayExpression = ArrayExpression; exports.assignmentExpression = exports.AssignmentExpression = AssignmentExpression; exports.binaryExpression = exports.BinaryExpression = BinaryExpression; +exports.interpreterDirective = exports.InterpreterDirective = InterpreterDirective; exports.directive = exports.Directive = Directive; exports.directiveLiteral = exports.DirectiveLiteral = DirectiveLiteral; exports.blockStatement = exports.BlockStatement = BlockStatement; @@ -98,6 +101,7 @@ exports.genericTypeAnnotation = exports.GenericTypeAnnotation = GenericTypeAnnot exports.inferredPredicate = exports.InferredPredicate = InferredPredicate; exports.interfaceExtends = exports.InterfaceExtends = InterfaceExtends; exports.interfaceDeclaration = exports.InterfaceDeclaration = InterfaceDeclaration; +exports.interfaceTypeAnnotation = exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation; exports.intersectionTypeAnnotation = exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation; exports.mixedTypeAnnotation = exports.MixedTypeAnnotation = MixedTypeAnnotation; exports.emptyTypeAnnotation = exports.EmptyTypeAnnotation = EmptyTypeAnnotation; @@ -105,6 +109,7 @@ exports.nullableTypeAnnotation = exports.NullableTypeAnnotation = NullableTypeAn exports.numberLiteralTypeAnnotation = exports.NumberLiteralTypeAnnotation = NumberLiteralTypeAnnotation; exports.numberTypeAnnotation = exports.NumberTypeAnnotation = NumberTypeAnnotation; exports.objectTypeAnnotation = exports.ObjectTypeAnnotation = ObjectTypeAnnotation; +exports.objectTypeInternalSlot = exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot; exports.objectTypeCallProperty = exports.ObjectTypeCallProperty = ObjectTypeCallProperty; exports.objectTypeIndexer = exports.ObjectTypeIndexer = ObjectTypeIndexer; exports.objectTypeProperty = exports.ObjectTypeProperty = ObjectTypeProperty; @@ -123,6 +128,7 @@ exports.typeParameter = exports.TypeParameter = TypeParameter; exports.typeParameterDeclaration = exports.TypeParameterDeclaration = TypeParameterDeclaration; exports.typeParameterInstantiation = exports.TypeParameterInstantiation = TypeParameterInstantiation; exports.unionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; +exports.variance = exports.Variance = Variance; exports.voidTypeAnnotation = exports.VoidTypeAnnotation = VoidTypeAnnotation; exports.jSXAttribute = exports.jsxAttribute = exports.JSXAttribute = JSXAttribute; exports.jSXClosingElement = exports.jsxClosingElement = exports.JSXClosingElement = JSXClosingElement; @@ -144,11 +150,20 @@ exports.parenthesizedExpression = exports.ParenthesizedExpression = Parenthesize exports.awaitExpression = exports.AwaitExpression = AwaitExpression; exports.bindExpression = exports.BindExpression = BindExpression; exports.classProperty = exports.ClassProperty = ClassProperty; +exports.optionalMemberExpression = exports.OptionalMemberExpression = OptionalMemberExpression; +exports.pipelineTopicExpression = exports.PipelineTopicExpression = PipelineTopicExpression; +exports.pipelineBareFunction = exports.PipelineBareFunction = PipelineBareFunction; +exports.pipelinePrimaryTopicReference = exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference; +exports.optionalCallExpression = exports.OptionalCallExpression = OptionalCallExpression; +exports.classPrivateProperty = exports.ClassPrivateProperty = ClassPrivateProperty; +exports.classPrivateMethod = exports.ClassPrivateMethod = ClassPrivateMethod; exports.import = exports.Import = Import; exports.decorator = exports.Decorator = Decorator; exports.doExpression = exports.DoExpression = DoExpression; exports.exportDefaultSpecifier = exports.ExportDefaultSpecifier = ExportDefaultSpecifier; exports.exportNamespaceSpecifier = exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; +exports.privateName = exports.PrivateName = PrivateName; +exports.bigIntLiteral = exports.BigIntLiteral = BigIntLiteral; exports.tSParameterProperty = exports.tsParameterProperty = exports.TSParameterProperty = TSParameterProperty; exports.tSDeclareFunction = exports.tsDeclareFunction = exports.TSDeclareFunction = TSDeclareFunction; exports.tSDeclareMethod = exports.tsDeclareMethod = exports.TSDeclareMethod = TSDeclareMethod; @@ -159,6 +174,7 @@ exports.tSPropertySignature = exports.tsPropertySignature = exports.TSPropertySi exports.tSMethodSignature = exports.tsMethodSignature = exports.TSMethodSignature = TSMethodSignature; exports.tSIndexSignature = exports.tsIndexSignature = exports.TSIndexSignature = TSIndexSignature; exports.tSAnyKeyword = exports.tsAnyKeyword = exports.TSAnyKeyword = TSAnyKeyword; +exports.tSUnknownKeyword = exports.tsUnknownKeyword = exports.TSUnknownKeyword = TSUnknownKeyword; exports.tSNumberKeyword = exports.tsNumberKeyword = exports.TSNumberKeyword = TSNumberKeyword; exports.tSObjectKeyword = exports.tsObjectKeyword = exports.TSObjectKeyword = TSObjectKeyword; exports.tSBooleanKeyword = exports.tsBooleanKeyword = exports.TSBooleanKeyword = TSBooleanKeyword; @@ -177,8 +193,12 @@ exports.tSTypeQuery = exports.tsTypeQuery = exports.TSTypeQuery = TSTypeQuery; exports.tSTypeLiteral = exports.tsTypeLiteral = exports.TSTypeLiteral = TSTypeLiteral; exports.tSArrayType = exports.tsArrayType = exports.TSArrayType = TSArrayType; exports.tSTupleType = exports.tsTupleType = exports.TSTupleType = TSTupleType; +exports.tSOptionalType = exports.tsOptionalType = exports.TSOptionalType = TSOptionalType; +exports.tSRestType = exports.tsRestType = exports.TSRestType = TSRestType; exports.tSUnionType = exports.tsUnionType = exports.TSUnionType = TSUnionType; exports.tSIntersectionType = exports.tsIntersectionType = exports.TSIntersectionType = TSIntersectionType; +exports.tSConditionalType = exports.tsConditionalType = exports.TSConditionalType = TSConditionalType; +exports.tSInferType = exports.tsInferType = exports.TSInferType = TSInferType; exports.tSParenthesizedType = exports.tsParenthesizedType = exports.TSParenthesizedType = TSParenthesizedType; exports.tSTypeOperator = exports.tsTypeOperator = exports.TSTypeOperator = TSTypeOperator; exports.tSIndexedAccessType = exports.tsIndexedAccessType = exports.TSIndexedAccessType = TSIndexedAccessType; @@ -194,6 +214,7 @@ exports.tSEnumDeclaration = exports.tsEnumDeclaration = exports.TSEnumDeclaratio exports.tSEnumMember = exports.tsEnumMember = exports.TSEnumMember = TSEnumMember; exports.tSModuleDeclaration = exports.tsModuleDeclaration = exports.TSModuleDeclaration = TSModuleDeclaration; exports.tSModuleBlock = exports.tsModuleBlock = exports.TSModuleBlock = TSModuleBlock; +exports.tSImportType = exports.tsImportType = exports.TSImportType = TSImportType; exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration; exports.tSExternalModuleReference = exports.tsExternalModuleReference = exports.TSExternalModuleReference = TSExternalModuleReference; exports.tSNonNullExpression = exports.tsNonNullExpression = exports.TSNonNullExpression = TSNonNullExpression; @@ -212,1658 +233,906 @@ var _builder = _interopRequireDefault(require("../builder")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function ArrayExpression() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return _builder.default.apply(void 0, ["ArrayExpression"].concat(args)); +function ArrayExpression(...args) { + return (0, _builder.default)("ArrayExpression", ...args); } -function AssignmentExpression() { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - return _builder.default.apply(void 0, ["AssignmentExpression"].concat(args)); +function AssignmentExpression(...args) { + return (0, _builder.default)("AssignmentExpression", ...args); } -function BinaryExpression() { - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - return _builder.default.apply(void 0, ["BinaryExpression"].concat(args)); +function BinaryExpression(...args) { + return (0, _builder.default)("BinaryExpression", ...args); } -function Directive() { - for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - args[_key4] = arguments[_key4]; - } - - return _builder.default.apply(void 0, ["Directive"].concat(args)); +function InterpreterDirective(...args) { + return (0, _builder.default)("InterpreterDirective", ...args); } -function DirectiveLiteral() { - for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { - args[_key5] = arguments[_key5]; - } - - return _builder.default.apply(void 0, ["DirectiveLiteral"].concat(args)); +function Directive(...args) { + return (0, _builder.default)("Directive", ...args); } -function BlockStatement() { - for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - args[_key6] = arguments[_key6]; - } - - return _builder.default.apply(void 0, ["BlockStatement"].concat(args)); +function DirectiveLiteral(...args) { + return (0, _builder.default)("DirectiveLiteral", ...args); } -function BreakStatement() { - for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { - args[_key7] = arguments[_key7]; - } - - return _builder.default.apply(void 0, ["BreakStatement"].concat(args)); +function BlockStatement(...args) { + return (0, _builder.default)("BlockStatement", ...args); } -function CallExpression() { - for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { - args[_key8] = arguments[_key8]; - } - - return _builder.default.apply(void 0, ["CallExpression"].concat(args)); +function BreakStatement(...args) { + return (0, _builder.default)("BreakStatement", ...args); } -function CatchClause() { - for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { - args[_key9] = arguments[_key9]; - } - - return _builder.default.apply(void 0, ["CatchClause"].concat(args)); +function CallExpression(...args) { + return (0, _builder.default)("CallExpression", ...args); } -function ConditionalExpression() { - for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { - args[_key10] = arguments[_key10]; - } - - return _builder.default.apply(void 0, ["ConditionalExpression"].concat(args)); +function CatchClause(...args) { + return (0, _builder.default)("CatchClause", ...args); } -function ContinueStatement() { - for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { - args[_key11] = arguments[_key11]; - } - - return _builder.default.apply(void 0, ["ContinueStatement"].concat(args)); +function ConditionalExpression(...args) { + return (0, _builder.default)("ConditionalExpression", ...args); } -function DebuggerStatement() { - for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { - args[_key12] = arguments[_key12]; - } - - return _builder.default.apply(void 0, ["DebuggerStatement"].concat(args)); +function ContinueStatement(...args) { + return (0, _builder.default)("ContinueStatement", ...args); } -function DoWhileStatement() { - for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) { - args[_key13] = arguments[_key13]; - } - - return _builder.default.apply(void 0, ["DoWhileStatement"].concat(args)); +function DebuggerStatement(...args) { + return (0, _builder.default)("DebuggerStatement", ...args); } -function EmptyStatement() { - for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) { - args[_key14] = arguments[_key14]; - } - - return _builder.default.apply(void 0, ["EmptyStatement"].concat(args)); +function DoWhileStatement(...args) { + return (0, _builder.default)("DoWhileStatement", ...args); } -function ExpressionStatement() { - for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) { - args[_key15] = arguments[_key15]; - } - - return _builder.default.apply(void 0, ["ExpressionStatement"].concat(args)); +function EmptyStatement(...args) { + return (0, _builder.default)("EmptyStatement", ...args); } -function File() { - for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) { - args[_key16] = arguments[_key16]; - } - - return _builder.default.apply(void 0, ["File"].concat(args)); +function ExpressionStatement(...args) { + return (0, _builder.default)("ExpressionStatement", ...args); } -function ForInStatement() { - for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) { - args[_key17] = arguments[_key17]; - } - - return _builder.default.apply(void 0, ["ForInStatement"].concat(args)); +function File(...args) { + return (0, _builder.default)("File", ...args); } -function ForStatement() { - for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) { - args[_key18] = arguments[_key18]; - } - - return _builder.default.apply(void 0, ["ForStatement"].concat(args)); +function ForInStatement(...args) { + return (0, _builder.default)("ForInStatement", ...args); } -function FunctionDeclaration() { - for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) { - args[_key19] = arguments[_key19]; - } - - return _builder.default.apply(void 0, ["FunctionDeclaration"].concat(args)); +function ForStatement(...args) { + return (0, _builder.default)("ForStatement", ...args); } -function FunctionExpression() { - for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) { - args[_key20] = arguments[_key20]; - } - - return _builder.default.apply(void 0, ["FunctionExpression"].concat(args)); +function FunctionDeclaration(...args) { + return (0, _builder.default)("FunctionDeclaration", ...args); } -function Identifier() { - for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) { - args[_key21] = arguments[_key21]; - } - - return _builder.default.apply(void 0, ["Identifier"].concat(args)); +function FunctionExpression(...args) { + return (0, _builder.default)("FunctionExpression", ...args); } -function IfStatement() { - for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) { - args[_key22] = arguments[_key22]; - } - - return _builder.default.apply(void 0, ["IfStatement"].concat(args)); +function Identifier(...args) { + return (0, _builder.default)("Identifier", ...args); } -function LabeledStatement() { - for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) { - args[_key23] = arguments[_key23]; - } - - return _builder.default.apply(void 0, ["LabeledStatement"].concat(args)); +function IfStatement(...args) { + return (0, _builder.default)("IfStatement", ...args); } -function StringLiteral() { - for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) { - args[_key24] = arguments[_key24]; - } - - return _builder.default.apply(void 0, ["StringLiteral"].concat(args)); +function LabeledStatement(...args) { + return (0, _builder.default)("LabeledStatement", ...args); } -function NumericLiteral() { - for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) { - args[_key25] = arguments[_key25]; - } - - return _builder.default.apply(void 0, ["NumericLiteral"].concat(args)); +function StringLiteral(...args) { + return (0, _builder.default)("StringLiteral", ...args); } -function NullLiteral() { - for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) { - args[_key26] = arguments[_key26]; - } - - return _builder.default.apply(void 0, ["NullLiteral"].concat(args)); +function NumericLiteral(...args) { + return (0, _builder.default)("NumericLiteral", ...args); } -function BooleanLiteral() { - for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) { - args[_key27] = arguments[_key27]; - } - - return _builder.default.apply(void 0, ["BooleanLiteral"].concat(args)); +function NullLiteral(...args) { + return (0, _builder.default)("NullLiteral", ...args); } -function RegExpLiteral() { - for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) { - args[_key28] = arguments[_key28]; - } - - return _builder.default.apply(void 0, ["RegExpLiteral"].concat(args)); +function BooleanLiteral(...args) { + return (0, _builder.default)("BooleanLiteral", ...args); } -function LogicalExpression() { - for (var _len29 = arguments.length, args = new Array(_len29), _key29 = 0; _key29 < _len29; _key29++) { - args[_key29] = arguments[_key29]; - } - - return _builder.default.apply(void 0, ["LogicalExpression"].concat(args)); +function RegExpLiteral(...args) { + return (0, _builder.default)("RegExpLiteral", ...args); } -function MemberExpression() { - for (var _len30 = arguments.length, args = new Array(_len30), _key30 = 0; _key30 < _len30; _key30++) { - args[_key30] = arguments[_key30]; - } - - return _builder.default.apply(void 0, ["MemberExpression"].concat(args)); +function LogicalExpression(...args) { + return (0, _builder.default)("LogicalExpression", ...args); } -function NewExpression() { - for (var _len31 = arguments.length, args = new Array(_len31), _key31 = 0; _key31 < _len31; _key31++) { - args[_key31] = arguments[_key31]; - } - - return _builder.default.apply(void 0, ["NewExpression"].concat(args)); +function MemberExpression(...args) { + return (0, _builder.default)("MemberExpression", ...args); } -function Program() { - for (var _len32 = arguments.length, args = new Array(_len32), _key32 = 0; _key32 < _len32; _key32++) { - args[_key32] = arguments[_key32]; - } - - return _builder.default.apply(void 0, ["Program"].concat(args)); +function NewExpression(...args) { + return (0, _builder.default)("NewExpression", ...args); } -function ObjectExpression() { - for (var _len33 = arguments.length, args = new Array(_len33), _key33 = 0; _key33 < _len33; _key33++) { - args[_key33] = arguments[_key33]; - } - - return _builder.default.apply(void 0, ["ObjectExpression"].concat(args)); +function Program(...args) { + return (0, _builder.default)("Program", ...args); } -function ObjectMethod() { - for (var _len34 = arguments.length, args = new Array(_len34), _key34 = 0; _key34 < _len34; _key34++) { - args[_key34] = arguments[_key34]; - } - - return _builder.default.apply(void 0, ["ObjectMethod"].concat(args)); +function ObjectExpression(...args) { + return (0, _builder.default)("ObjectExpression", ...args); } -function ObjectProperty() { - for (var _len35 = arguments.length, args = new Array(_len35), _key35 = 0; _key35 < _len35; _key35++) { - args[_key35] = arguments[_key35]; - } - - return _builder.default.apply(void 0, ["ObjectProperty"].concat(args)); +function ObjectMethod(...args) { + return (0, _builder.default)("ObjectMethod", ...args); } -function RestElement() { - for (var _len36 = arguments.length, args = new Array(_len36), _key36 = 0; _key36 < _len36; _key36++) { - args[_key36] = arguments[_key36]; - } - - return _builder.default.apply(void 0, ["RestElement"].concat(args)); +function ObjectProperty(...args) { + return (0, _builder.default)("ObjectProperty", ...args); } -function ReturnStatement() { - for (var _len37 = arguments.length, args = new Array(_len37), _key37 = 0; _key37 < _len37; _key37++) { - args[_key37] = arguments[_key37]; - } - - return _builder.default.apply(void 0, ["ReturnStatement"].concat(args)); +function RestElement(...args) { + return (0, _builder.default)("RestElement", ...args); } -function SequenceExpression() { - for (var _len38 = arguments.length, args = new Array(_len38), _key38 = 0; _key38 < _len38; _key38++) { - args[_key38] = arguments[_key38]; - } - - return _builder.default.apply(void 0, ["SequenceExpression"].concat(args)); +function ReturnStatement(...args) { + return (0, _builder.default)("ReturnStatement", ...args); } -function SwitchCase() { - for (var _len39 = arguments.length, args = new Array(_len39), _key39 = 0; _key39 < _len39; _key39++) { - args[_key39] = arguments[_key39]; - } - - return _builder.default.apply(void 0, ["SwitchCase"].concat(args)); +function SequenceExpression(...args) { + return (0, _builder.default)("SequenceExpression", ...args); } -function SwitchStatement() { - for (var _len40 = arguments.length, args = new Array(_len40), _key40 = 0; _key40 < _len40; _key40++) { - args[_key40] = arguments[_key40]; - } - - return _builder.default.apply(void 0, ["SwitchStatement"].concat(args)); +function SwitchCase(...args) { + return (0, _builder.default)("SwitchCase", ...args); } -function ThisExpression() { - for (var _len41 = arguments.length, args = new Array(_len41), _key41 = 0; _key41 < _len41; _key41++) { - args[_key41] = arguments[_key41]; - } - - return _builder.default.apply(void 0, ["ThisExpression"].concat(args)); +function SwitchStatement(...args) { + return (0, _builder.default)("SwitchStatement", ...args); } -function ThrowStatement() { - for (var _len42 = arguments.length, args = new Array(_len42), _key42 = 0; _key42 < _len42; _key42++) { - args[_key42] = arguments[_key42]; - } - - return _builder.default.apply(void 0, ["ThrowStatement"].concat(args)); +function ThisExpression(...args) { + return (0, _builder.default)("ThisExpression", ...args); } -function TryStatement() { - for (var _len43 = arguments.length, args = new Array(_len43), _key43 = 0; _key43 < _len43; _key43++) { - args[_key43] = arguments[_key43]; - } - - return _builder.default.apply(void 0, ["TryStatement"].concat(args)); +function ThrowStatement(...args) { + return (0, _builder.default)("ThrowStatement", ...args); } -function UnaryExpression() { - for (var _len44 = arguments.length, args = new Array(_len44), _key44 = 0; _key44 < _len44; _key44++) { - args[_key44] = arguments[_key44]; - } - - return _builder.default.apply(void 0, ["UnaryExpression"].concat(args)); +function TryStatement(...args) { + return (0, _builder.default)("TryStatement", ...args); } -function UpdateExpression() { - for (var _len45 = arguments.length, args = new Array(_len45), _key45 = 0; _key45 < _len45; _key45++) { - args[_key45] = arguments[_key45]; - } - - return _builder.default.apply(void 0, ["UpdateExpression"].concat(args)); +function UnaryExpression(...args) { + return (0, _builder.default)("UnaryExpression", ...args); } -function VariableDeclaration() { - for (var _len46 = arguments.length, args = new Array(_len46), _key46 = 0; _key46 < _len46; _key46++) { - args[_key46] = arguments[_key46]; - } - - return _builder.default.apply(void 0, ["VariableDeclaration"].concat(args)); +function UpdateExpression(...args) { + return (0, _builder.default)("UpdateExpression", ...args); } -function VariableDeclarator() { - for (var _len47 = arguments.length, args = new Array(_len47), _key47 = 0; _key47 < _len47; _key47++) { - args[_key47] = arguments[_key47]; - } - - return _builder.default.apply(void 0, ["VariableDeclarator"].concat(args)); +function VariableDeclaration(...args) { + return (0, _builder.default)("VariableDeclaration", ...args); } -function WhileStatement() { - for (var _len48 = arguments.length, args = new Array(_len48), _key48 = 0; _key48 < _len48; _key48++) { - args[_key48] = arguments[_key48]; - } - - return _builder.default.apply(void 0, ["WhileStatement"].concat(args)); +function VariableDeclarator(...args) { + return (0, _builder.default)("VariableDeclarator", ...args); } -function WithStatement() { - for (var _len49 = arguments.length, args = new Array(_len49), _key49 = 0; _key49 < _len49; _key49++) { - args[_key49] = arguments[_key49]; - } - - return _builder.default.apply(void 0, ["WithStatement"].concat(args)); +function WhileStatement(...args) { + return (0, _builder.default)("WhileStatement", ...args); } -function AssignmentPattern() { - for (var _len50 = arguments.length, args = new Array(_len50), _key50 = 0; _key50 < _len50; _key50++) { - args[_key50] = arguments[_key50]; - } - - return _builder.default.apply(void 0, ["AssignmentPattern"].concat(args)); +function WithStatement(...args) { + return (0, _builder.default)("WithStatement", ...args); } -function ArrayPattern() { - for (var _len51 = arguments.length, args = new Array(_len51), _key51 = 0; _key51 < _len51; _key51++) { - args[_key51] = arguments[_key51]; - } - - return _builder.default.apply(void 0, ["ArrayPattern"].concat(args)); +function AssignmentPattern(...args) { + return (0, _builder.default)("AssignmentPattern", ...args); } -function ArrowFunctionExpression() { - for (var _len52 = arguments.length, args = new Array(_len52), _key52 = 0; _key52 < _len52; _key52++) { - args[_key52] = arguments[_key52]; - } - - return _builder.default.apply(void 0, ["ArrowFunctionExpression"].concat(args)); +function ArrayPattern(...args) { + return (0, _builder.default)("ArrayPattern", ...args); } -function ClassBody() { - for (var _len53 = arguments.length, args = new Array(_len53), _key53 = 0; _key53 < _len53; _key53++) { - args[_key53] = arguments[_key53]; - } - - return _builder.default.apply(void 0, ["ClassBody"].concat(args)); +function ArrowFunctionExpression(...args) { + return (0, _builder.default)("ArrowFunctionExpression", ...args); } -function ClassDeclaration() { - for (var _len54 = arguments.length, args = new Array(_len54), _key54 = 0; _key54 < _len54; _key54++) { - args[_key54] = arguments[_key54]; - } - - return _builder.default.apply(void 0, ["ClassDeclaration"].concat(args)); +function ClassBody(...args) { + return (0, _builder.default)("ClassBody", ...args); } -function ClassExpression() { - for (var _len55 = arguments.length, args = new Array(_len55), _key55 = 0; _key55 < _len55; _key55++) { - args[_key55] = arguments[_key55]; - } - - return _builder.default.apply(void 0, ["ClassExpression"].concat(args)); +function ClassDeclaration(...args) { + return (0, _builder.default)("ClassDeclaration", ...args); } -function ExportAllDeclaration() { - for (var _len56 = arguments.length, args = new Array(_len56), _key56 = 0; _key56 < _len56; _key56++) { - args[_key56] = arguments[_key56]; - } - - return _builder.default.apply(void 0, ["ExportAllDeclaration"].concat(args)); +function ClassExpression(...args) { + return (0, _builder.default)("ClassExpression", ...args); } -function ExportDefaultDeclaration() { - for (var _len57 = arguments.length, args = new Array(_len57), _key57 = 0; _key57 < _len57; _key57++) { - args[_key57] = arguments[_key57]; - } - - return _builder.default.apply(void 0, ["ExportDefaultDeclaration"].concat(args)); +function ExportAllDeclaration(...args) { + return (0, _builder.default)("ExportAllDeclaration", ...args); } -function ExportNamedDeclaration() { - for (var _len58 = arguments.length, args = new Array(_len58), _key58 = 0; _key58 < _len58; _key58++) { - args[_key58] = arguments[_key58]; - } - - return _builder.default.apply(void 0, ["ExportNamedDeclaration"].concat(args)); +function ExportDefaultDeclaration(...args) { + return (0, _builder.default)("ExportDefaultDeclaration", ...args); } -function ExportSpecifier() { - for (var _len59 = arguments.length, args = new Array(_len59), _key59 = 0; _key59 < _len59; _key59++) { - args[_key59] = arguments[_key59]; - } - - return _builder.default.apply(void 0, ["ExportSpecifier"].concat(args)); +function ExportNamedDeclaration(...args) { + return (0, _builder.default)("ExportNamedDeclaration", ...args); } -function ForOfStatement() { - for (var _len60 = arguments.length, args = new Array(_len60), _key60 = 0; _key60 < _len60; _key60++) { - args[_key60] = arguments[_key60]; - } - - return _builder.default.apply(void 0, ["ForOfStatement"].concat(args)); +function ExportSpecifier(...args) { + return (0, _builder.default)("ExportSpecifier", ...args); } -function ImportDeclaration() { - for (var _len61 = arguments.length, args = new Array(_len61), _key61 = 0; _key61 < _len61; _key61++) { - args[_key61] = arguments[_key61]; - } - - return _builder.default.apply(void 0, ["ImportDeclaration"].concat(args)); +function ForOfStatement(...args) { + return (0, _builder.default)("ForOfStatement", ...args); } -function ImportDefaultSpecifier() { - for (var _len62 = arguments.length, args = new Array(_len62), _key62 = 0; _key62 < _len62; _key62++) { - args[_key62] = arguments[_key62]; - } - - return _builder.default.apply(void 0, ["ImportDefaultSpecifier"].concat(args)); +function ImportDeclaration(...args) { + return (0, _builder.default)("ImportDeclaration", ...args); } -function ImportNamespaceSpecifier() { - for (var _len63 = arguments.length, args = new Array(_len63), _key63 = 0; _key63 < _len63; _key63++) { - args[_key63] = arguments[_key63]; - } - - return _builder.default.apply(void 0, ["ImportNamespaceSpecifier"].concat(args)); +function ImportDefaultSpecifier(...args) { + return (0, _builder.default)("ImportDefaultSpecifier", ...args); } -function ImportSpecifier() { - for (var _len64 = arguments.length, args = new Array(_len64), _key64 = 0; _key64 < _len64; _key64++) { - args[_key64] = arguments[_key64]; - } - - return _builder.default.apply(void 0, ["ImportSpecifier"].concat(args)); +function ImportNamespaceSpecifier(...args) { + return (0, _builder.default)("ImportNamespaceSpecifier", ...args); } -function MetaProperty() { - for (var _len65 = arguments.length, args = new Array(_len65), _key65 = 0; _key65 < _len65; _key65++) { - args[_key65] = arguments[_key65]; - } - - return _builder.default.apply(void 0, ["MetaProperty"].concat(args)); +function ImportSpecifier(...args) { + return (0, _builder.default)("ImportSpecifier", ...args); } -function ClassMethod() { - for (var _len66 = arguments.length, args = new Array(_len66), _key66 = 0; _key66 < _len66; _key66++) { - args[_key66] = arguments[_key66]; - } - - return _builder.default.apply(void 0, ["ClassMethod"].concat(args)); +function MetaProperty(...args) { + return (0, _builder.default)("MetaProperty", ...args); } -function ObjectPattern() { - for (var _len67 = arguments.length, args = new Array(_len67), _key67 = 0; _key67 < _len67; _key67++) { - args[_key67] = arguments[_key67]; - } - - return _builder.default.apply(void 0, ["ObjectPattern"].concat(args)); +function ClassMethod(...args) { + return (0, _builder.default)("ClassMethod", ...args); } -function SpreadElement() { - for (var _len68 = arguments.length, args = new Array(_len68), _key68 = 0; _key68 < _len68; _key68++) { - args[_key68] = arguments[_key68]; - } - - return _builder.default.apply(void 0, ["SpreadElement"].concat(args)); +function ObjectPattern(...args) { + return (0, _builder.default)("ObjectPattern", ...args); } -function Super() { - for (var _len69 = arguments.length, args = new Array(_len69), _key69 = 0; _key69 < _len69; _key69++) { - args[_key69] = arguments[_key69]; - } - - return _builder.default.apply(void 0, ["Super"].concat(args)); +function SpreadElement(...args) { + return (0, _builder.default)("SpreadElement", ...args); } -function TaggedTemplateExpression() { - for (var _len70 = arguments.length, args = new Array(_len70), _key70 = 0; _key70 < _len70; _key70++) { - args[_key70] = arguments[_key70]; - } - - return _builder.default.apply(void 0, ["TaggedTemplateExpression"].concat(args)); +function Super(...args) { + return (0, _builder.default)("Super", ...args); } -function TemplateElement() { - for (var _len71 = arguments.length, args = new Array(_len71), _key71 = 0; _key71 < _len71; _key71++) { - args[_key71] = arguments[_key71]; - } - - return _builder.default.apply(void 0, ["TemplateElement"].concat(args)); +function TaggedTemplateExpression(...args) { + return (0, _builder.default)("TaggedTemplateExpression", ...args); } -function TemplateLiteral() { - for (var _len72 = arguments.length, args = new Array(_len72), _key72 = 0; _key72 < _len72; _key72++) { - args[_key72] = arguments[_key72]; - } - - return _builder.default.apply(void 0, ["TemplateLiteral"].concat(args)); +function TemplateElement(...args) { + return (0, _builder.default)("TemplateElement", ...args); } -function YieldExpression() { - for (var _len73 = arguments.length, args = new Array(_len73), _key73 = 0; _key73 < _len73; _key73++) { - args[_key73] = arguments[_key73]; - } - - return _builder.default.apply(void 0, ["YieldExpression"].concat(args)); +function TemplateLiteral(...args) { + return (0, _builder.default)("TemplateLiteral", ...args); } -function AnyTypeAnnotation() { - for (var _len74 = arguments.length, args = new Array(_len74), _key74 = 0; _key74 < _len74; _key74++) { - args[_key74] = arguments[_key74]; - } - - return _builder.default.apply(void 0, ["AnyTypeAnnotation"].concat(args)); +function YieldExpression(...args) { + return (0, _builder.default)("YieldExpression", ...args); } -function ArrayTypeAnnotation() { - for (var _len75 = arguments.length, args = new Array(_len75), _key75 = 0; _key75 < _len75; _key75++) { - args[_key75] = arguments[_key75]; - } - - return _builder.default.apply(void 0, ["ArrayTypeAnnotation"].concat(args)); +function AnyTypeAnnotation(...args) { + return (0, _builder.default)("AnyTypeAnnotation", ...args); } -function BooleanTypeAnnotation() { - for (var _len76 = arguments.length, args = new Array(_len76), _key76 = 0; _key76 < _len76; _key76++) { - args[_key76] = arguments[_key76]; - } - - return _builder.default.apply(void 0, ["BooleanTypeAnnotation"].concat(args)); +function ArrayTypeAnnotation(...args) { + return (0, _builder.default)("ArrayTypeAnnotation", ...args); } -function BooleanLiteralTypeAnnotation() { - for (var _len77 = arguments.length, args = new Array(_len77), _key77 = 0; _key77 < _len77; _key77++) { - args[_key77] = arguments[_key77]; - } - - return _builder.default.apply(void 0, ["BooleanLiteralTypeAnnotation"].concat(args)); +function BooleanTypeAnnotation(...args) { + return (0, _builder.default)("BooleanTypeAnnotation", ...args); } -function NullLiteralTypeAnnotation() { - for (var _len78 = arguments.length, args = new Array(_len78), _key78 = 0; _key78 < _len78; _key78++) { - args[_key78] = arguments[_key78]; - } - - return _builder.default.apply(void 0, ["NullLiteralTypeAnnotation"].concat(args)); +function BooleanLiteralTypeAnnotation(...args) { + return (0, _builder.default)("BooleanLiteralTypeAnnotation", ...args); } -function ClassImplements() { - for (var _len79 = arguments.length, args = new Array(_len79), _key79 = 0; _key79 < _len79; _key79++) { - args[_key79] = arguments[_key79]; - } - - return _builder.default.apply(void 0, ["ClassImplements"].concat(args)); +function NullLiteralTypeAnnotation(...args) { + return (0, _builder.default)("NullLiteralTypeAnnotation", ...args); } -function DeclareClass() { - for (var _len80 = arguments.length, args = new Array(_len80), _key80 = 0; _key80 < _len80; _key80++) { - args[_key80] = arguments[_key80]; - } - - return _builder.default.apply(void 0, ["DeclareClass"].concat(args)); +function ClassImplements(...args) { + return (0, _builder.default)("ClassImplements", ...args); } -function DeclareFunction() { - for (var _len81 = arguments.length, args = new Array(_len81), _key81 = 0; _key81 < _len81; _key81++) { - args[_key81] = arguments[_key81]; - } - - return _builder.default.apply(void 0, ["DeclareFunction"].concat(args)); +function DeclareClass(...args) { + return (0, _builder.default)("DeclareClass", ...args); } -function DeclareInterface() { - for (var _len82 = arguments.length, args = new Array(_len82), _key82 = 0; _key82 < _len82; _key82++) { - args[_key82] = arguments[_key82]; - } - - return _builder.default.apply(void 0, ["DeclareInterface"].concat(args)); +function DeclareFunction(...args) { + return (0, _builder.default)("DeclareFunction", ...args); } -function DeclareModule() { - for (var _len83 = arguments.length, args = new Array(_len83), _key83 = 0; _key83 < _len83; _key83++) { - args[_key83] = arguments[_key83]; - } - - return _builder.default.apply(void 0, ["DeclareModule"].concat(args)); +function DeclareInterface(...args) { + return (0, _builder.default)("DeclareInterface", ...args); } -function DeclareModuleExports() { - for (var _len84 = arguments.length, args = new Array(_len84), _key84 = 0; _key84 < _len84; _key84++) { - args[_key84] = arguments[_key84]; - } - - return _builder.default.apply(void 0, ["DeclareModuleExports"].concat(args)); +function DeclareModule(...args) { + return (0, _builder.default)("DeclareModule", ...args); } -function DeclareTypeAlias() { - for (var _len85 = arguments.length, args = new Array(_len85), _key85 = 0; _key85 < _len85; _key85++) { - args[_key85] = arguments[_key85]; - } - - return _builder.default.apply(void 0, ["DeclareTypeAlias"].concat(args)); +function DeclareModuleExports(...args) { + return (0, _builder.default)("DeclareModuleExports", ...args); } -function DeclareOpaqueType() { - for (var _len86 = arguments.length, args = new Array(_len86), _key86 = 0; _key86 < _len86; _key86++) { - args[_key86] = arguments[_key86]; - } - - return _builder.default.apply(void 0, ["DeclareOpaqueType"].concat(args)); +function DeclareTypeAlias(...args) { + return (0, _builder.default)("DeclareTypeAlias", ...args); } -function DeclareVariable() { - for (var _len87 = arguments.length, args = new Array(_len87), _key87 = 0; _key87 < _len87; _key87++) { - args[_key87] = arguments[_key87]; - } - - return _builder.default.apply(void 0, ["DeclareVariable"].concat(args)); +function DeclareOpaqueType(...args) { + return (0, _builder.default)("DeclareOpaqueType", ...args); } -function DeclareExportDeclaration() { - for (var _len88 = arguments.length, args = new Array(_len88), _key88 = 0; _key88 < _len88; _key88++) { - args[_key88] = arguments[_key88]; - } - - return _builder.default.apply(void 0, ["DeclareExportDeclaration"].concat(args)); +function DeclareVariable(...args) { + return (0, _builder.default)("DeclareVariable", ...args); } -function DeclareExportAllDeclaration() { - for (var _len89 = arguments.length, args = new Array(_len89), _key89 = 0; _key89 < _len89; _key89++) { - args[_key89] = arguments[_key89]; - } - - return _builder.default.apply(void 0, ["DeclareExportAllDeclaration"].concat(args)); +function DeclareExportDeclaration(...args) { + return (0, _builder.default)("DeclareExportDeclaration", ...args); } -function DeclaredPredicate() { - for (var _len90 = arguments.length, args = new Array(_len90), _key90 = 0; _key90 < _len90; _key90++) { - args[_key90] = arguments[_key90]; - } - - return _builder.default.apply(void 0, ["DeclaredPredicate"].concat(args)); +function DeclareExportAllDeclaration(...args) { + return (0, _builder.default)("DeclareExportAllDeclaration", ...args); } -function ExistsTypeAnnotation() { - for (var _len91 = arguments.length, args = new Array(_len91), _key91 = 0; _key91 < _len91; _key91++) { - args[_key91] = arguments[_key91]; - } - - return _builder.default.apply(void 0, ["ExistsTypeAnnotation"].concat(args)); +function DeclaredPredicate(...args) { + return (0, _builder.default)("DeclaredPredicate", ...args); } -function FunctionTypeAnnotation() { - for (var _len92 = arguments.length, args = new Array(_len92), _key92 = 0; _key92 < _len92; _key92++) { - args[_key92] = arguments[_key92]; - } - - return _builder.default.apply(void 0, ["FunctionTypeAnnotation"].concat(args)); +function ExistsTypeAnnotation(...args) { + return (0, _builder.default)("ExistsTypeAnnotation", ...args); } -function FunctionTypeParam() { - for (var _len93 = arguments.length, args = new Array(_len93), _key93 = 0; _key93 < _len93; _key93++) { - args[_key93] = arguments[_key93]; - } - - return _builder.default.apply(void 0, ["FunctionTypeParam"].concat(args)); +function FunctionTypeAnnotation(...args) { + return (0, _builder.default)("FunctionTypeAnnotation", ...args); } -function GenericTypeAnnotation() { - for (var _len94 = arguments.length, args = new Array(_len94), _key94 = 0; _key94 < _len94; _key94++) { - args[_key94] = arguments[_key94]; - } - - return _builder.default.apply(void 0, ["GenericTypeAnnotation"].concat(args)); +function FunctionTypeParam(...args) { + return (0, _builder.default)("FunctionTypeParam", ...args); } -function InferredPredicate() { - for (var _len95 = arguments.length, args = new Array(_len95), _key95 = 0; _key95 < _len95; _key95++) { - args[_key95] = arguments[_key95]; - } - - return _builder.default.apply(void 0, ["InferredPredicate"].concat(args)); +function GenericTypeAnnotation(...args) { + return (0, _builder.default)("GenericTypeAnnotation", ...args); } -function InterfaceExtends() { - for (var _len96 = arguments.length, args = new Array(_len96), _key96 = 0; _key96 < _len96; _key96++) { - args[_key96] = arguments[_key96]; - } - - return _builder.default.apply(void 0, ["InterfaceExtends"].concat(args)); +function InferredPredicate(...args) { + return (0, _builder.default)("InferredPredicate", ...args); } -function InterfaceDeclaration() { - for (var _len97 = arguments.length, args = new Array(_len97), _key97 = 0; _key97 < _len97; _key97++) { - args[_key97] = arguments[_key97]; - } - - return _builder.default.apply(void 0, ["InterfaceDeclaration"].concat(args)); +function InterfaceExtends(...args) { + return (0, _builder.default)("InterfaceExtends", ...args); } -function IntersectionTypeAnnotation() { - for (var _len98 = arguments.length, args = new Array(_len98), _key98 = 0; _key98 < _len98; _key98++) { - args[_key98] = arguments[_key98]; - } - - return _builder.default.apply(void 0, ["IntersectionTypeAnnotation"].concat(args)); +function InterfaceDeclaration(...args) { + return (0, _builder.default)("InterfaceDeclaration", ...args); } -function MixedTypeAnnotation() { - for (var _len99 = arguments.length, args = new Array(_len99), _key99 = 0; _key99 < _len99; _key99++) { - args[_key99] = arguments[_key99]; - } - - return _builder.default.apply(void 0, ["MixedTypeAnnotation"].concat(args)); +function InterfaceTypeAnnotation(...args) { + return (0, _builder.default)("InterfaceTypeAnnotation", ...args); } -function EmptyTypeAnnotation() { - for (var _len100 = arguments.length, args = new Array(_len100), _key100 = 0; _key100 < _len100; _key100++) { - args[_key100] = arguments[_key100]; - } - - return _builder.default.apply(void 0, ["EmptyTypeAnnotation"].concat(args)); +function IntersectionTypeAnnotation(...args) { + return (0, _builder.default)("IntersectionTypeAnnotation", ...args); } -function NullableTypeAnnotation() { - for (var _len101 = arguments.length, args = new Array(_len101), _key101 = 0; _key101 < _len101; _key101++) { - args[_key101] = arguments[_key101]; - } - - return _builder.default.apply(void 0, ["NullableTypeAnnotation"].concat(args)); +function MixedTypeAnnotation(...args) { + return (0, _builder.default)("MixedTypeAnnotation", ...args); } -function NumberLiteralTypeAnnotation() { - for (var _len102 = arguments.length, args = new Array(_len102), _key102 = 0; _key102 < _len102; _key102++) { - args[_key102] = arguments[_key102]; - } - - return _builder.default.apply(void 0, ["NumberLiteralTypeAnnotation"].concat(args)); +function EmptyTypeAnnotation(...args) { + return (0, _builder.default)("EmptyTypeAnnotation", ...args); } -function NumberTypeAnnotation() { - for (var _len103 = arguments.length, args = new Array(_len103), _key103 = 0; _key103 < _len103; _key103++) { - args[_key103] = arguments[_key103]; - } - - return _builder.default.apply(void 0, ["NumberTypeAnnotation"].concat(args)); +function NullableTypeAnnotation(...args) { + return (0, _builder.default)("NullableTypeAnnotation", ...args); } -function ObjectTypeAnnotation() { - for (var _len104 = arguments.length, args = new Array(_len104), _key104 = 0; _key104 < _len104; _key104++) { - args[_key104] = arguments[_key104]; - } - - return _builder.default.apply(void 0, ["ObjectTypeAnnotation"].concat(args)); +function NumberLiteralTypeAnnotation(...args) { + return (0, _builder.default)("NumberLiteralTypeAnnotation", ...args); } -function ObjectTypeCallProperty() { - for (var _len105 = arguments.length, args = new Array(_len105), _key105 = 0; _key105 < _len105; _key105++) { - args[_key105] = arguments[_key105]; - } - - return _builder.default.apply(void 0, ["ObjectTypeCallProperty"].concat(args)); +function NumberTypeAnnotation(...args) { + return (0, _builder.default)("NumberTypeAnnotation", ...args); } -function ObjectTypeIndexer() { - for (var _len106 = arguments.length, args = new Array(_len106), _key106 = 0; _key106 < _len106; _key106++) { - args[_key106] = arguments[_key106]; - } - - return _builder.default.apply(void 0, ["ObjectTypeIndexer"].concat(args)); +function ObjectTypeAnnotation(...args) { + return (0, _builder.default)("ObjectTypeAnnotation", ...args); } -function ObjectTypeProperty() { - for (var _len107 = arguments.length, args = new Array(_len107), _key107 = 0; _key107 < _len107; _key107++) { - args[_key107] = arguments[_key107]; - } - - return _builder.default.apply(void 0, ["ObjectTypeProperty"].concat(args)); +function ObjectTypeInternalSlot(...args) { + return (0, _builder.default)("ObjectTypeInternalSlot", ...args); } -function ObjectTypeSpreadProperty() { - for (var _len108 = arguments.length, args = new Array(_len108), _key108 = 0; _key108 < _len108; _key108++) { - args[_key108] = arguments[_key108]; - } - - return _builder.default.apply(void 0, ["ObjectTypeSpreadProperty"].concat(args)); +function ObjectTypeCallProperty(...args) { + return (0, _builder.default)("ObjectTypeCallProperty", ...args); } -function OpaqueType() { - for (var _len109 = arguments.length, args = new Array(_len109), _key109 = 0; _key109 < _len109; _key109++) { - args[_key109] = arguments[_key109]; - } - - return _builder.default.apply(void 0, ["OpaqueType"].concat(args)); +function ObjectTypeIndexer(...args) { + return (0, _builder.default)("ObjectTypeIndexer", ...args); } -function QualifiedTypeIdentifier() { - for (var _len110 = arguments.length, args = new Array(_len110), _key110 = 0; _key110 < _len110; _key110++) { - args[_key110] = arguments[_key110]; - } - - return _builder.default.apply(void 0, ["QualifiedTypeIdentifier"].concat(args)); +function ObjectTypeProperty(...args) { + return (0, _builder.default)("ObjectTypeProperty", ...args); } -function StringLiteralTypeAnnotation() { - for (var _len111 = arguments.length, args = new Array(_len111), _key111 = 0; _key111 < _len111; _key111++) { - args[_key111] = arguments[_key111]; - } - - return _builder.default.apply(void 0, ["StringLiteralTypeAnnotation"].concat(args)); +function ObjectTypeSpreadProperty(...args) { + return (0, _builder.default)("ObjectTypeSpreadProperty", ...args); } -function StringTypeAnnotation() { - for (var _len112 = arguments.length, args = new Array(_len112), _key112 = 0; _key112 < _len112; _key112++) { - args[_key112] = arguments[_key112]; - } - - return _builder.default.apply(void 0, ["StringTypeAnnotation"].concat(args)); +function OpaqueType(...args) { + return (0, _builder.default)("OpaqueType", ...args); } -function ThisTypeAnnotation() { - for (var _len113 = arguments.length, args = new Array(_len113), _key113 = 0; _key113 < _len113; _key113++) { - args[_key113] = arguments[_key113]; - } - - return _builder.default.apply(void 0, ["ThisTypeAnnotation"].concat(args)); +function QualifiedTypeIdentifier(...args) { + return (0, _builder.default)("QualifiedTypeIdentifier", ...args); } -function TupleTypeAnnotation() { - for (var _len114 = arguments.length, args = new Array(_len114), _key114 = 0; _key114 < _len114; _key114++) { - args[_key114] = arguments[_key114]; - } - - return _builder.default.apply(void 0, ["TupleTypeAnnotation"].concat(args)); +function StringLiteralTypeAnnotation(...args) { + return (0, _builder.default)("StringLiteralTypeAnnotation", ...args); } -function TypeofTypeAnnotation() { - for (var _len115 = arguments.length, args = new Array(_len115), _key115 = 0; _key115 < _len115; _key115++) { - args[_key115] = arguments[_key115]; - } - - return _builder.default.apply(void 0, ["TypeofTypeAnnotation"].concat(args)); +function StringTypeAnnotation(...args) { + return (0, _builder.default)("StringTypeAnnotation", ...args); } -function TypeAlias() { - for (var _len116 = arguments.length, args = new Array(_len116), _key116 = 0; _key116 < _len116; _key116++) { - args[_key116] = arguments[_key116]; - } - - return _builder.default.apply(void 0, ["TypeAlias"].concat(args)); +function ThisTypeAnnotation(...args) { + return (0, _builder.default)("ThisTypeAnnotation", ...args); } -function TypeAnnotation() { - for (var _len117 = arguments.length, args = new Array(_len117), _key117 = 0; _key117 < _len117; _key117++) { - args[_key117] = arguments[_key117]; - } - - return _builder.default.apply(void 0, ["TypeAnnotation"].concat(args)); +function TupleTypeAnnotation(...args) { + return (0, _builder.default)("TupleTypeAnnotation", ...args); } -function TypeCastExpression() { - for (var _len118 = arguments.length, args = new Array(_len118), _key118 = 0; _key118 < _len118; _key118++) { - args[_key118] = arguments[_key118]; - } - - return _builder.default.apply(void 0, ["TypeCastExpression"].concat(args)); +function TypeofTypeAnnotation(...args) { + return (0, _builder.default)("TypeofTypeAnnotation", ...args); } -function TypeParameter() { - for (var _len119 = arguments.length, args = new Array(_len119), _key119 = 0; _key119 < _len119; _key119++) { - args[_key119] = arguments[_key119]; - } - - return _builder.default.apply(void 0, ["TypeParameter"].concat(args)); +function TypeAlias(...args) { + return (0, _builder.default)("TypeAlias", ...args); } -function TypeParameterDeclaration() { - for (var _len120 = arguments.length, args = new Array(_len120), _key120 = 0; _key120 < _len120; _key120++) { - args[_key120] = arguments[_key120]; - } - - return _builder.default.apply(void 0, ["TypeParameterDeclaration"].concat(args)); +function TypeAnnotation(...args) { + return (0, _builder.default)("TypeAnnotation", ...args); } -function TypeParameterInstantiation() { - for (var _len121 = arguments.length, args = new Array(_len121), _key121 = 0; _key121 < _len121; _key121++) { - args[_key121] = arguments[_key121]; - } - - return _builder.default.apply(void 0, ["TypeParameterInstantiation"].concat(args)); +function TypeCastExpression(...args) { + return (0, _builder.default)("TypeCastExpression", ...args); } -function UnionTypeAnnotation() { - for (var _len122 = arguments.length, args = new Array(_len122), _key122 = 0; _key122 < _len122; _key122++) { - args[_key122] = arguments[_key122]; - } - - return _builder.default.apply(void 0, ["UnionTypeAnnotation"].concat(args)); +function TypeParameter(...args) { + return (0, _builder.default)("TypeParameter", ...args); } -function VoidTypeAnnotation() { - for (var _len123 = arguments.length, args = new Array(_len123), _key123 = 0; _key123 < _len123; _key123++) { - args[_key123] = arguments[_key123]; - } - - return _builder.default.apply(void 0, ["VoidTypeAnnotation"].concat(args)); +function TypeParameterDeclaration(...args) { + return (0, _builder.default)("TypeParameterDeclaration", ...args); } -function JSXAttribute() { - for (var _len124 = arguments.length, args = new Array(_len124), _key124 = 0; _key124 < _len124; _key124++) { - args[_key124] = arguments[_key124]; - } - - return _builder.default.apply(void 0, ["JSXAttribute"].concat(args)); +function TypeParameterInstantiation(...args) { + return (0, _builder.default)("TypeParameterInstantiation", ...args); } -function JSXClosingElement() { - for (var _len125 = arguments.length, args = new Array(_len125), _key125 = 0; _key125 < _len125; _key125++) { - args[_key125] = arguments[_key125]; - } - - return _builder.default.apply(void 0, ["JSXClosingElement"].concat(args)); +function UnionTypeAnnotation(...args) { + return (0, _builder.default)("UnionTypeAnnotation", ...args); } -function JSXElement() { - for (var _len126 = arguments.length, args = new Array(_len126), _key126 = 0; _key126 < _len126; _key126++) { - args[_key126] = arguments[_key126]; - } - - return _builder.default.apply(void 0, ["JSXElement"].concat(args)); +function Variance(...args) { + return (0, _builder.default)("Variance", ...args); } -function JSXEmptyExpression() { - for (var _len127 = arguments.length, args = new Array(_len127), _key127 = 0; _key127 < _len127; _key127++) { - args[_key127] = arguments[_key127]; - } - - return _builder.default.apply(void 0, ["JSXEmptyExpression"].concat(args)); +function VoidTypeAnnotation(...args) { + return (0, _builder.default)("VoidTypeAnnotation", ...args); } -function JSXExpressionContainer() { - for (var _len128 = arguments.length, args = new Array(_len128), _key128 = 0; _key128 < _len128; _key128++) { - args[_key128] = arguments[_key128]; - } - - return _builder.default.apply(void 0, ["JSXExpressionContainer"].concat(args)); +function JSXAttribute(...args) { + return (0, _builder.default)("JSXAttribute", ...args); } -function JSXSpreadChild() { - for (var _len129 = arguments.length, args = new Array(_len129), _key129 = 0; _key129 < _len129; _key129++) { - args[_key129] = arguments[_key129]; - } - - return _builder.default.apply(void 0, ["JSXSpreadChild"].concat(args)); +function JSXClosingElement(...args) { + return (0, _builder.default)("JSXClosingElement", ...args); } -function JSXIdentifier() { - for (var _len130 = arguments.length, args = new Array(_len130), _key130 = 0; _key130 < _len130; _key130++) { - args[_key130] = arguments[_key130]; - } - - return _builder.default.apply(void 0, ["JSXIdentifier"].concat(args)); +function JSXElement(...args) { + return (0, _builder.default)("JSXElement", ...args); } -function JSXMemberExpression() { - for (var _len131 = arguments.length, args = new Array(_len131), _key131 = 0; _key131 < _len131; _key131++) { - args[_key131] = arguments[_key131]; - } - - return _builder.default.apply(void 0, ["JSXMemberExpression"].concat(args)); +function JSXEmptyExpression(...args) { + return (0, _builder.default)("JSXEmptyExpression", ...args); } -function JSXNamespacedName() { - for (var _len132 = arguments.length, args = new Array(_len132), _key132 = 0; _key132 < _len132; _key132++) { - args[_key132] = arguments[_key132]; - } - - return _builder.default.apply(void 0, ["JSXNamespacedName"].concat(args)); +function JSXExpressionContainer(...args) { + return (0, _builder.default)("JSXExpressionContainer", ...args); } -function JSXOpeningElement() { - for (var _len133 = arguments.length, args = new Array(_len133), _key133 = 0; _key133 < _len133; _key133++) { - args[_key133] = arguments[_key133]; - } - - return _builder.default.apply(void 0, ["JSXOpeningElement"].concat(args)); +function JSXSpreadChild(...args) { + return (0, _builder.default)("JSXSpreadChild", ...args); } -function JSXSpreadAttribute() { - for (var _len134 = arguments.length, args = new Array(_len134), _key134 = 0; _key134 < _len134; _key134++) { - args[_key134] = arguments[_key134]; - } - - return _builder.default.apply(void 0, ["JSXSpreadAttribute"].concat(args)); +function JSXIdentifier(...args) { + return (0, _builder.default)("JSXIdentifier", ...args); } -function JSXText() { - for (var _len135 = arguments.length, args = new Array(_len135), _key135 = 0; _key135 < _len135; _key135++) { - args[_key135] = arguments[_key135]; - } - - return _builder.default.apply(void 0, ["JSXText"].concat(args)); +function JSXMemberExpression(...args) { + return (0, _builder.default)("JSXMemberExpression", ...args); } -function JSXFragment() { - for (var _len136 = arguments.length, args = new Array(_len136), _key136 = 0; _key136 < _len136; _key136++) { - args[_key136] = arguments[_key136]; - } - - return _builder.default.apply(void 0, ["JSXFragment"].concat(args)); +function JSXNamespacedName(...args) { + return (0, _builder.default)("JSXNamespacedName", ...args); } -function JSXOpeningFragment() { - for (var _len137 = arguments.length, args = new Array(_len137), _key137 = 0; _key137 < _len137; _key137++) { - args[_key137] = arguments[_key137]; - } - - return _builder.default.apply(void 0, ["JSXOpeningFragment"].concat(args)); +function JSXOpeningElement(...args) { + return (0, _builder.default)("JSXOpeningElement", ...args); } -function JSXClosingFragment() { - for (var _len138 = arguments.length, args = new Array(_len138), _key138 = 0; _key138 < _len138; _key138++) { - args[_key138] = arguments[_key138]; - } - - return _builder.default.apply(void 0, ["JSXClosingFragment"].concat(args)); +function JSXSpreadAttribute(...args) { + return (0, _builder.default)("JSXSpreadAttribute", ...args); } -function Noop() { - for (var _len139 = arguments.length, args = new Array(_len139), _key139 = 0; _key139 < _len139; _key139++) { - args[_key139] = arguments[_key139]; - } - - return _builder.default.apply(void 0, ["Noop"].concat(args)); +function JSXText(...args) { + return (0, _builder.default)("JSXText", ...args); } -function ParenthesizedExpression() { - for (var _len140 = arguments.length, args = new Array(_len140), _key140 = 0; _key140 < _len140; _key140++) { - args[_key140] = arguments[_key140]; - } - - return _builder.default.apply(void 0, ["ParenthesizedExpression"].concat(args)); +function JSXFragment(...args) { + return (0, _builder.default)("JSXFragment", ...args); } -function AwaitExpression() { - for (var _len141 = arguments.length, args = new Array(_len141), _key141 = 0; _key141 < _len141; _key141++) { - args[_key141] = arguments[_key141]; - } - - return _builder.default.apply(void 0, ["AwaitExpression"].concat(args)); +function JSXOpeningFragment(...args) { + return (0, _builder.default)("JSXOpeningFragment", ...args); } -function BindExpression() { - for (var _len142 = arguments.length, args = new Array(_len142), _key142 = 0; _key142 < _len142; _key142++) { - args[_key142] = arguments[_key142]; - } - - return _builder.default.apply(void 0, ["BindExpression"].concat(args)); +function JSXClosingFragment(...args) { + return (0, _builder.default)("JSXClosingFragment", ...args); } -function ClassProperty() { - for (var _len143 = arguments.length, args = new Array(_len143), _key143 = 0; _key143 < _len143; _key143++) { - args[_key143] = arguments[_key143]; - } - - return _builder.default.apply(void 0, ["ClassProperty"].concat(args)); +function Noop(...args) { + return (0, _builder.default)("Noop", ...args); } -function Import() { - for (var _len144 = arguments.length, args = new Array(_len144), _key144 = 0; _key144 < _len144; _key144++) { - args[_key144] = arguments[_key144]; - } - - return _builder.default.apply(void 0, ["Import"].concat(args)); +function ParenthesizedExpression(...args) { + return (0, _builder.default)("ParenthesizedExpression", ...args); } -function Decorator() { - for (var _len145 = arguments.length, args = new Array(_len145), _key145 = 0; _key145 < _len145; _key145++) { - args[_key145] = arguments[_key145]; - } - - return _builder.default.apply(void 0, ["Decorator"].concat(args)); +function AwaitExpression(...args) { + return (0, _builder.default)("AwaitExpression", ...args); } -function DoExpression() { - for (var _len146 = arguments.length, args = new Array(_len146), _key146 = 0; _key146 < _len146; _key146++) { - args[_key146] = arguments[_key146]; - } - - return _builder.default.apply(void 0, ["DoExpression"].concat(args)); +function BindExpression(...args) { + return (0, _builder.default)("BindExpression", ...args); } -function ExportDefaultSpecifier() { - for (var _len147 = arguments.length, args = new Array(_len147), _key147 = 0; _key147 < _len147; _key147++) { - args[_key147] = arguments[_key147]; - } - - return _builder.default.apply(void 0, ["ExportDefaultSpecifier"].concat(args)); +function ClassProperty(...args) { + return (0, _builder.default)("ClassProperty", ...args); } -function ExportNamespaceSpecifier() { - for (var _len148 = arguments.length, args = new Array(_len148), _key148 = 0; _key148 < _len148; _key148++) { - args[_key148] = arguments[_key148]; - } - - return _builder.default.apply(void 0, ["ExportNamespaceSpecifier"].concat(args)); +function OptionalMemberExpression(...args) { + return (0, _builder.default)("OptionalMemberExpression", ...args); } -function TSParameterProperty() { - for (var _len149 = arguments.length, args = new Array(_len149), _key149 = 0; _key149 < _len149; _key149++) { - args[_key149] = arguments[_key149]; - } - - return _builder.default.apply(void 0, ["TSParameterProperty"].concat(args)); +function PipelineTopicExpression(...args) { + return (0, _builder.default)("PipelineTopicExpression", ...args); } -function TSDeclareFunction() { - for (var _len150 = arguments.length, args = new Array(_len150), _key150 = 0; _key150 < _len150; _key150++) { - args[_key150] = arguments[_key150]; - } - - return _builder.default.apply(void 0, ["TSDeclareFunction"].concat(args)); +function PipelineBareFunction(...args) { + return (0, _builder.default)("PipelineBareFunction", ...args); } -function TSDeclareMethod() { - for (var _len151 = arguments.length, args = new Array(_len151), _key151 = 0; _key151 < _len151; _key151++) { - args[_key151] = arguments[_key151]; - } - - return _builder.default.apply(void 0, ["TSDeclareMethod"].concat(args)); +function PipelinePrimaryTopicReference(...args) { + return (0, _builder.default)("PipelinePrimaryTopicReference", ...args); } -function TSQualifiedName() { - for (var _len152 = arguments.length, args = new Array(_len152), _key152 = 0; _key152 < _len152; _key152++) { - args[_key152] = arguments[_key152]; - } - - return _builder.default.apply(void 0, ["TSQualifiedName"].concat(args)); +function OptionalCallExpression(...args) { + return (0, _builder.default)("OptionalCallExpression", ...args); } -function TSCallSignatureDeclaration() { - for (var _len153 = arguments.length, args = new Array(_len153), _key153 = 0; _key153 < _len153; _key153++) { - args[_key153] = arguments[_key153]; - } - - return _builder.default.apply(void 0, ["TSCallSignatureDeclaration"].concat(args)); +function ClassPrivateProperty(...args) { + return (0, _builder.default)("ClassPrivateProperty", ...args); } -function TSConstructSignatureDeclaration() { - for (var _len154 = arguments.length, args = new Array(_len154), _key154 = 0; _key154 < _len154; _key154++) { - args[_key154] = arguments[_key154]; - } - - return _builder.default.apply(void 0, ["TSConstructSignatureDeclaration"].concat(args)); +function ClassPrivateMethod(...args) { + return (0, _builder.default)("ClassPrivateMethod", ...args); } -function TSPropertySignature() { - for (var _len155 = arguments.length, args = new Array(_len155), _key155 = 0; _key155 < _len155; _key155++) { - args[_key155] = arguments[_key155]; - } - - return _builder.default.apply(void 0, ["TSPropertySignature"].concat(args)); +function Import(...args) { + return (0, _builder.default)("Import", ...args); } -function TSMethodSignature() { - for (var _len156 = arguments.length, args = new Array(_len156), _key156 = 0; _key156 < _len156; _key156++) { - args[_key156] = arguments[_key156]; - } - - return _builder.default.apply(void 0, ["TSMethodSignature"].concat(args)); +function Decorator(...args) { + return (0, _builder.default)("Decorator", ...args); } -function TSIndexSignature() { - for (var _len157 = arguments.length, args = new Array(_len157), _key157 = 0; _key157 < _len157; _key157++) { - args[_key157] = arguments[_key157]; - } - - return _builder.default.apply(void 0, ["TSIndexSignature"].concat(args)); +function DoExpression(...args) { + return (0, _builder.default)("DoExpression", ...args); } -function TSAnyKeyword() { - for (var _len158 = arguments.length, args = new Array(_len158), _key158 = 0; _key158 < _len158; _key158++) { - args[_key158] = arguments[_key158]; - } - - return _builder.default.apply(void 0, ["TSAnyKeyword"].concat(args)); +function ExportDefaultSpecifier(...args) { + return (0, _builder.default)("ExportDefaultSpecifier", ...args); } -function TSNumberKeyword() { - for (var _len159 = arguments.length, args = new Array(_len159), _key159 = 0; _key159 < _len159; _key159++) { - args[_key159] = arguments[_key159]; - } - - return _builder.default.apply(void 0, ["TSNumberKeyword"].concat(args)); +function ExportNamespaceSpecifier(...args) { + return (0, _builder.default)("ExportNamespaceSpecifier", ...args); } -function TSObjectKeyword() { - for (var _len160 = arguments.length, args = new Array(_len160), _key160 = 0; _key160 < _len160; _key160++) { - args[_key160] = arguments[_key160]; - } - - return _builder.default.apply(void 0, ["TSObjectKeyword"].concat(args)); +function PrivateName(...args) { + return (0, _builder.default)("PrivateName", ...args); } -function TSBooleanKeyword() { - for (var _len161 = arguments.length, args = new Array(_len161), _key161 = 0; _key161 < _len161; _key161++) { - args[_key161] = arguments[_key161]; - } - - return _builder.default.apply(void 0, ["TSBooleanKeyword"].concat(args)); +function BigIntLiteral(...args) { + return (0, _builder.default)("BigIntLiteral", ...args); } -function TSStringKeyword() { - for (var _len162 = arguments.length, args = new Array(_len162), _key162 = 0; _key162 < _len162; _key162++) { - args[_key162] = arguments[_key162]; - } - - return _builder.default.apply(void 0, ["TSStringKeyword"].concat(args)); +function TSParameterProperty(...args) { + return (0, _builder.default)("TSParameterProperty", ...args); } -function TSSymbolKeyword() { - for (var _len163 = arguments.length, args = new Array(_len163), _key163 = 0; _key163 < _len163; _key163++) { - args[_key163] = arguments[_key163]; - } - - return _builder.default.apply(void 0, ["TSSymbolKeyword"].concat(args)); +function TSDeclareFunction(...args) { + return (0, _builder.default)("TSDeclareFunction", ...args); } -function TSVoidKeyword() { - for (var _len164 = arguments.length, args = new Array(_len164), _key164 = 0; _key164 < _len164; _key164++) { - args[_key164] = arguments[_key164]; - } - - return _builder.default.apply(void 0, ["TSVoidKeyword"].concat(args)); +function TSDeclareMethod(...args) { + return (0, _builder.default)("TSDeclareMethod", ...args); } -function TSUndefinedKeyword() { - for (var _len165 = arguments.length, args = new Array(_len165), _key165 = 0; _key165 < _len165; _key165++) { - args[_key165] = arguments[_key165]; - } - - return _builder.default.apply(void 0, ["TSUndefinedKeyword"].concat(args)); +function TSQualifiedName(...args) { + return (0, _builder.default)("TSQualifiedName", ...args); } -function TSNullKeyword() { - for (var _len166 = arguments.length, args = new Array(_len166), _key166 = 0; _key166 < _len166; _key166++) { - args[_key166] = arguments[_key166]; - } - - return _builder.default.apply(void 0, ["TSNullKeyword"].concat(args)); +function TSCallSignatureDeclaration(...args) { + return (0, _builder.default)("TSCallSignatureDeclaration", ...args); } -function TSNeverKeyword() { - for (var _len167 = arguments.length, args = new Array(_len167), _key167 = 0; _key167 < _len167; _key167++) { - args[_key167] = arguments[_key167]; - } - - return _builder.default.apply(void 0, ["TSNeverKeyword"].concat(args)); +function TSConstructSignatureDeclaration(...args) { + return (0, _builder.default)("TSConstructSignatureDeclaration", ...args); } -function TSThisType() { - for (var _len168 = arguments.length, args = new Array(_len168), _key168 = 0; _key168 < _len168; _key168++) { - args[_key168] = arguments[_key168]; - } - - return _builder.default.apply(void 0, ["TSThisType"].concat(args)); +function TSPropertySignature(...args) { + return (0, _builder.default)("TSPropertySignature", ...args); } -function TSFunctionType() { - for (var _len169 = arguments.length, args = new Array(_len169), _key169 = 0; _key169 < _len169; _key169++) { - args[_key169] = arguments[_key169]; - } - - return _builder.default.apply(void 0, ["TSFunctionType"].concat(args)); +function TSMethodSignature(...args) { + return (0, _builder.default)("TSMethodSignature", ...args); } -function TSConstructorType() { - for (var _len170 = arguments.length, args = new Array(_len170), _key170 = 0; _key170 < _len170; _key170++) { - args[_key170] = arguments[_key170]; - } - - return _builder.default.apply(void 0, ["TSConstructorType"].concat(args)); +function TSIndexSignature(...args) { + return (0, _builder.default)("TSIndexSignature", ...args); } -function TSTypeReference() { - for (var _len171 = arguments.length, args = new Array(_len171), _key171 = 0; _key171 < _len171; _key171++) { - args[_key171] = arguments[_key171]; - } - - return _builder.default.apply(void 0, ["TSTypeReference"].concat(args)); +function TSAnyKeyword(...args) { + return (0, _builder.default)("TSAnyKeyword", ...args); } -function TSTypePredicate() { - for (var _len172 = arguments.length, args = new Array(_len172), _key172 = 0; _key172 < _len172; _key172++) { - args[_key172] = arguments[_key172]; - } - - return _builder.default.apply(void 0, ["TSTypePredicate"].concat(args)); +function TSUnknownKeyword(...args) { + return (0, _builder.default)("TSUnknownKeyword", ...args); } -function TSTypeQuery() { - for (var _len173 = arguments.length, args = new Array(_len173), _key173 = 0; _key173 < _len173; _key173++) { - args[_key173] = arguments[_key173]; - } - - return _builder.default.apply(void 0, ["TSTypeQuery"].concat(args)); +function TSNumberKeyword(...args) { + return (0, _builder.default)("TSNumberKeyword", ...args); } -function TSTypeLiteral() { - for (var _len174 = arguments.length, args = new Array(_len174), _key174 = 0; _key174 < _len174; _key174++) { - args[_key174] = arguments[_key174]; - } - - return _builder.default.apply(void 0, ["TSTypeLiteral"].concat(args)); +function TSObjectKeyword(...args) { + return (0, _builder.default)("TSObjectKeyword", ...args); } -function TSArrayType() { - for (var _len175 = arguments.length, args = new Array(_len175), _key175 = 0; _key175 < _len175; _key175++) { - args[_key175] = arguments[_key175]; - } - - return _builder.default.apply(void 0, ["TSArrayType"].concat(args)); +function TSBooleanKeyword(...args) { + return (0, _builder.default)("TSBooleanKeyword", ...args); } -function TSTupleType() { - for (var _len176 = arguments.length, args = new Array(_len176), _key176 = 0; _key176 < _len176; _key176++) { - args[_key176] = arguments[_key176]; - } - - return _builder.default.apply(void 0, ["TSTupleType"].concat(args)); +function TSStringKeyword(...args) { + return (0, _builder.default)("TSStringKeyword", ...args); } -function TSUnionType() { - for (var _len177 = arguments.length, args = new Array(_len177), _key177 = 0; _key177 < _len177; _key177++) { - args[_key177] = arguments[_key177]; - } - - return _builder.default.apply(void 0, ["TSUnionType"].concat(args)); +function TSSymbolKeyword(...args) { + return (0, _builder.default)("TSSymbolKeyword", ...args); } -function TSIntersectionType() { - for (var _len178 = arguments.length, args = new Array(_len178), _key178 = 0; _key178 < _len178; _key178++) { - args[_key178] = arguments[_key178]; - } - - return _builder.default.apply(void 0, ["TSIntersectionType"].concat(args)); +function TSVoidKeyword(...args) { + return (0, _builder.default)("TSVoidKeyword", ...args); } -function TSParenthesizedType() { - for (var _len179 = arguments.length, args = new Array(_len179), _key179 = 0; _key179 < _len179; _key179++) { - args[_key179] = arguments[_key179]; - } - - return _builder.default.apply(void 0, ["TSParenthesizedType"].concat(args)); +function TSUndefinedKeyword(...args) { + return (0, _builder.default)("TSUndefinedKeyword", ...args); } -function TSTypeOperator() { - for (var _len180 = arguments.length, args = new Array(_len180), _key180 = 0; _key180 < _len180; _key180++) { - args[_key180] = arguments[_key180]; - } - - return _builder.default.apply(void 0, ["TSTypeOperator"].concat(args)); +function TSNullKeyword(...args) { + return (0, _builder.default)("TSNullKeyword", ...args); } -function TSIndexedAccessType() { - for (var _len181 = arguments.length, args = new Array(_len181), _key181 = 0; _key181 < _len181; _key181++) { - args[_key181] = arguments[_key181]; - } - - return _builder.default.apply(void 0, ["TSIndexedAccessType"].concat(args)); +function TSNeverKeyword(...args) { + return (0, _builder.default)("TSNeverKeyword", ...args); } -function TSMappedType() { - for (var _len182 = arguments.length, args = new Array(_len182), _key182 = 0; _key182 < _len182; _key182++) { - args[_key182] = arguments[_key182]; - } - - return _builder.default.apply(void 0, ["TSMappedType"].concat(args)); +function TSThisType(...args) { + return (0, _builder.default)("TSThisType", ...args); } -function TSLiteralType() { - for (var _len183 = arguments.length, args = new Array(_len183), _key183 = 0; _key183 < _len183; _key183++) { - args[_key183] = arguments[_key183]; - } - - return _builder.default.apply(void 0, ["TSLiteralType"].concat(args)); +function TSFunctionType(...args) { + return (0, _builder.default)("TSFunctionType", ...args); } -function TSExpressionWithTypeArguments() { - for (var _len184 = arguments.length, args = new Array(_len184), _key184 = 0; _key184 < _len184; _key184++) { - args[_key184] = arguments[_key184]; - } +function TSConstructorType(...args) { + return (0, _builder.default)("TSConstructorType", ...args); +} - return _builder.default.apply(void 0, ["TSExpressionWithTypeArguments"].concat(args)); +function TSTypeReference(...args) { + return (0, _builder.default)("TSTypeReference", ...args); } -function TSInterfaceDeclaration() { - for (var _len185 = arguments.length, args = new Array(_len185), _key185 = 0; _key185 < _len185; _key185++) { - args[_key185] = arguments[_key185]; - } +function TSTypePredicate(...args) { + return (0, _builder.default)("TSTypePredicate", ...args); +} - return _builder.default.apply(void 0, ["TSInterfaceDeclaration"].concat(args)); +function TSTypeQuery(...args) { + return (0, _builder.default)("TSTypeQuery", ...args); } -function TSInterfaceBody() { - for (var _len186 = arguments.length, args = new Array(_len186), _key186 = 0; _key186 < _len186; _key186++) { - args[_key186] = arguments[_key186]; - } +function TSTypeLiteral(...args) { + return (0, _builder.default)("TSTypeLiteral", ...args); +} - return _builder.default.apply(void 0, ["TSInterfaceBody"].concat(args)); +function TSArrayType(...args) { + return (0, _builder.default)("TSArrayType", ...args); } -function TSTypeAliasDeclaration() { - for (var _len187 = arguments.length, args = new Array(_len187), _key187 = 0; _key187 < _len187; _key187++) { - args[_key187] = arguments[_key187]; - } +function TSTupleType(...args) { + return (0, _builder.default)("TSTupleType", ...args); +} - return _builder.default.apply(void 0, ["TSTypeAliasDeclaration"].concat(args)); +function TSOptionalType(...args) { + return (0, _builder.default)("TSOptionalType", ...args); } -function TSAsExpression() { - for (var _len188 = arguments.length, args = new Array(_len188), _key188 = 0; _key188 < _len188; _key188++) { - args[_key188] = arguments[_key188]; - } +function TSRestType(...args) { + return (0, _builder.default)("TSRestType", ...args); +} - return _builder.default.apply(void 0, ["TSAsExpression"].concat(args)); +function TSUnionType(...args) { + return (0, _builder.default)("TSUnionType", ...args); } -function TSTypeAssertion() { - for (var _len189 = arguments.length, args = new Array(_len189), _key189 = 0; _key189 < _len189; _key189++) { - args[_key189] = arguments[_key189]; - } +function TSIntersectionType(...args) { + return (0, _builder.default)("TSIntersectionType", ...args); +} - return _builder.default.apply(void 0, ["TSTypeAssertion"].concat(args)); +function TSConditionalType(...args) { + return (0, _builder.default)("TSConditionalType", ...args); } -function TSEnumDeclaration() { - for (var _len190 = arguments.length, args = new Array(_len190), _key190 = 0; _key190 < _len190; _key190++) { - args[_key190] = arguments[_key190]; - } +function TSInferType(...args) { + return (0, _builder.default)("TSInferType", ...args); +} - return _builder.default.apply(void 0, ["TSEnumDeclaration"].concat(args)); +function TSParenthesizedType(...args) { + return (0, _builder.default)("TSParenthesizedType", ...args); } -function TSEnumMember() { - for (var _len191 = arguments.length, args = new Array(_len191), _key191 = 0; _key191 < _len191; _key191++) { - args[_key191] = arguments[_key191]; - } +function TSTypeOperator(...args) { + return (0, _builder.default)("TSTypeOperator", ...args); +} - return _builder.default.apply(void 0, ["TSEnumMember"].concat(args)); +function TSIndexedAccessType(...args) { + return (0, _builder.default)("TSIndexedAccessType", ...args); } -function TSModuleDeclaration() { - for (var _len192 = arguments.length, args = new Array(_len192), _key192 = 0; _key192 < _len192; _key192++) { - args[_key192] = arguments[_key192]; - } +function TSMappedType(...args) { + return (0, _builder.default)("TSMappedType", ...args); +} - return _builder.default.apply(void 0, ["TSModuleDeclaration"].concat(args)); +function TSLiteralType(...args) { + return (0, _builder.default)("TSLiteralType", ...args); } -function TSModuleBlock() { - for (var _len193 = arguments.length, args = new Array(_len193), _key193 = 0; _key193 < _len193; _key193++) { - args[_key193] = arguments[_key193]; - } +function TSExpressionWithTypeArguments(...args) { + return (0, _builder.default)("TSExpressionWithTypeArguments", ...args); +} - return _builder.default.apply(void 0, ["TSModuleBlock"].concat(args)); +function TSInterfaceDeclaration(...args) { + return (0, _builder.default)("TSInterfaceDeclaration", ...args); } -function TSImportEqualsDeclaration() { - for (var _len194 = arguments.length, args = new Array(_len194), _key194 = 0; _key194 < _len194; _key194++) { - args[_key194] = arguments[_key194]; - } +function TSInterfaceBody(...args) { + return (0, _builder.default)("TSInterfaceBody", ...args); +} - return _builder.default.apply(void 0, ["TSImportEqualsDeclaration"].concat(args)); +function TSTypeAliasDeclaration(...args) { + return (0, _builder.default)("TSTypeAliasDeclaration", ...args); } -function TSExternalModuleReference() { - for (var _len195 = arguments.length, args = new Array(_len195), _key195 = 0; _key195 < _len195; _key195++) { - args[_key195] = arguments[_key195]; - } +function TSAsExpression(...args) { + return (0, _builder.default)("TSAsExpression", ...args); +} - return _builder.default.apply(void 0, ["TSExternalModuleReference"].concat(args)); +function TSTypeAssertion(...args) { + return (0, _builder.default)("TSTypeAssertion", ...args); } -function TSNonNullExpression() { - for (var _len196 = arguments.length, args = new Array(_len196), _key196 = 0; _key196 < _len196; _key196++) { - args[_key196] = arguments[_key196]; - } +function TSEnumDeclaration(...args) { + return (0, _builder.default)("TSEnumDeclaration", ...args); +} - return _builder.default.apply(void 0, ["TSNonNullExpression"].concat(args)); +function TSEnumMember(...args) { + return (0, _builder.default)("TSEnumMember", ...args); } -function TSExportAssignment() { - for (var _len197 = arguments.length, args = new Array(_len197), _key197 = 0; _key197 < _len197; _key197++) { - args[_key197] = arguments[_key197]; - } +function TSModuleDeclaration(...args) { + return (0, _builder.default)("TSModuleDeclaration", ...args); +} - return _builder.default.apply(void 0, ["TSExportAssignment"].concat(args)); +function TSModuleBlock(...args) { + return (0, _builder.default)("TSModuleBlock", ...args); } -function TSNamespaceExportDeclaration() { - for (var _len198 = arguments.length, args = new Array(_len198), _key198 = 0; _key198 < _len198; _key198++) { - args[_key198] = arguments[_key198]; - } +function TSImportType(...args) { + return (0, _builder.default)("TSImportType", ...args); +} - return _builder.default.apply(void 0, ["TSNamespaceExportDeclaration"].concat(args)); +function TSImportEqualsDeclaration(...args) { + return (0, _builder.default)("TSImportEqualsDeclaration", ...args); } -function TSTypeAnnotation() { - for (var _len199 = arguments.length, args = new Array(_len199), _key199 = 0; _key199 < _len199; _key199++) { - args[_key199] = arguments[_key199]; - } +function TSExternalModuleReference(...args) { + return (0, _builder.default)("TSExternalModuleReference", ...args); +} - return _builder.default.apply(void 0, ["TSTypeAnnotation"].concat(args)); +function TSNonNullExpression(...args) { + return (0, _builder.default)("TSNonNullExpression", ...args); } -function TSTypeParameterInstantiation() { - for (var _len200 = arguments.length, args = new Array(_len200), _key200 = 0; _key200 < _len200; _key200++) { - args[_key200] = arguments[_key200]; - } +function TSExportAssignment(...args) { + return (0, _builder.default)("TSExportAssignment", ...args); +} - return _builder.default.apply(void 0, ["TSTypeParameterInstantiation"].concat(args)); +function TSNamespaceExportDeclaration(...args) { + return (0, _builder.default)("TSNamespaceExportDeclaration", ...args); } -function TSTypeParameterDeclaration() { - for (var _len201 = arguments.length, args = new Array(_len201), _key201 = 0; _key201 < _len201; _key201++) { - args[_key201] = arguments[_key201]; - } +function TSTypeAnnotation(...args) { + return (0, _builder.default)("TSTypeAnnotation", ...args); +} - return _builder.default.apply(void 0, ["TSTypeParameterDeclaration"].concat(args)); +function TSTypeParameterInstantiation(...args) { + return (0, _builder.default)("TSTypeParameterInstantiation", ...args); } -function TSTypeParameter() { - for (var _len202 = arguments.length, args = new Array(_len202), _key202 = 0; _key202 < _len202; _key202++) { - args[_key202] = arguments[_key202]; - } +function TSTypeParameterDeclaration(...args) { + return (0, _builder.default)("TSTypeParameterDeclaration", ...args); +} - return _builder.default.apply(void 0, ["TSTypeParameter"].concat(args)); +function TSTypeParameter(...args) { + return (0, _builder.default)("TSTypeParameter", ...args); } -function NumberLiteral() { +function NumberLiteral(...args) { console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); - - for (var _len203 = arguments.length, args = new Array(_len203), _key203 = 0; _key203 < _len203; _key203++) { - args[_key203] = arguments[_key203]; - } - - return NumberLiteral.apply(void 0, ["NumberLiteral"].concat(args)); + return NumberLiteral("NumberLiteral", ...args); } -function RegexLiteral() { +function RegexLiteral(...args) { console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); - - for (var _len204 = arguments.length, args = new Array(_len204), _key204 = 0; _key204 < _len204; _key204++) { - args[_key204] = arguments[_key204]; - } - - return RegexLiteral.apply(void 0, ["RegexLiteral"].concat(args)); + return RegexLiteral("RegexLiteral", ...args); } -function RestProperty() { +function RestProperty(...args) { console.trace("The node type RestProperty has been renamed to RestElement"); - - for (var _len205 = arguments.length, args = new Array(_len205), _key205 = 0; _key205 < _len205; _key205++) { - args[_key205] = arguments[_key205]; - } - - return RestProperty.apply(void 0, ["RestProperty"].concat(args)); + return RestProperty("RestProperty", ...args); } -function SpreadProperty() { +function SpreadProperty(...args) { console.trace("The node type SpreadProperty has been renamed to SpreadElement"); - - for (var _len206 = arguments.length, args = new Array(_len206), _key206 = 0; _key206 < _len206; _key206++) { - args[_key206] = arguments[_key206]; - } - - return SpreadProperty.apply(void 0, ["SpreadProperty"].concat(args)); + return SpreadProperty("SpreadProperty", ...args); } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/react/buildChildren.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/react/buildChildren.js index 26c3068fd38658..91e7cbd9cabd9d 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/react/buildChildren.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/react/buildChildren.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = buildChildren; var _generated = require("../../validators/generated"); @@ -10,10 +12,10 @@ var _cleanJSXElementLiteralChild = _interopRequireDefault(require("../../utils/r function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function buildChildren(node) { - var elements = []; + const elements = []; - for (var i = 0; i < node.children.length; i++) { - var child = node.children[i]; + for (let i = 0; i < node.children.length; i++) { + let child = node.children[i]; if ((0, _generated.isJSXText)(child)) { (0, _cleanJSXElementLiteralChild.default)(child, elements); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/clone.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/clone.js index 2677f9023a063d..9595f6e25cfdee 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/clone.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/clone.js @@ -1,14 +1,14 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = clone; +var _cloneNode = _interopRequireDefault(require("./cloneNode")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function clone(node) { - if (!node) return node; - var newNode = {}; - Object.keys(node).forEach(function (key) { - if (key[0] === "_") return; - newNode[key] = node[key]; - }); - return newNode; + return (0, _cloneNode.default)(node, false); } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneDeep.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneDeep.js index 4212edd2bc7482..eb29c536227bc8 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneDeep.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneDeep.js @@ -1,24 +1,14 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = cloneDeep; -function cloneDeep(node) { - if (!node) return node; - var newNode = {}; - Object.keys(node).forEach(function (key) { - if (key[0] === "_") return; - var val = node[key]; +var _cloneNode = _interopRequireDefault(require("./cloneNode")); - if (val) { - if (val.type) { - val = cloneDeep(val); - } else if (Array.isArray(val)) { - val = val.map(cloneDeep); - } - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - newNode[key] = val; - }); - return newNode; +function cloneDeep(node) { + return (0, _cloneNode.default)(node); } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneNode.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneNode.js new file mode 100644 index 00000000000000..bcccddcf475327 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneNode.js @@ -0,0 +1,78 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = cloneNode; + +var _definitions = require("../definitions"); + +const has = Function.call.bind(Object.prototype.hasOwnProperty); + +function cloneIfNode(obj, deep) { + if (obj && typeof obj.type === "string" && obj.type !== "CommentLine" && obj.type !== "CommentBlock") { + return cloneNode(obj, deep); + } + + return obj; +} + +function cloneIfNodeOrArray(obj, deep) { + if (Array.isArray(obj)) { + return obj.map(node => cloneIfNode(node, deep)); + } + + return cloneIfNode(obj, deep); +} + +function cloneNode(node, deep = true) { + if (!node) return node; + const { + type + } = node; + const newNode = { + type + }; + + if (type === "Identifier") { + newNode.name = node.name; + + if (has(node, "optional") && typeof node.optional === "boolean") { + newNode.optional = node.optional; + } + + if (has(node, "typeAnnotation")) { + newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true) : node.typeAnnotation; + } + } else if (!has(_definitions.NODE_FIELDS, type)) { + throw new Error(`Unknown node type: "${type}"`); + } else { + for (const field of Object.keys(_definitions.NODE_FIELDS[type])) { + if (has(node, field)) { + newNode[field] = deep ? cloneIfNodeOrArray(node[field], true) : node[field]; + } + } + } + + if (has(node, "loc")) { + newNode.loc = node.loc; + } + + if (has(node, "leadingComments")) { + newNode.leadingComments = node.leadingComments; + } + + if (has(node, "innerComments")) { + newNode.innerComments = node.innerCmments; + } + + if (has(node, "trailingComments")) { + newNode.trailingComments = node.trailingComments; + } + + if (has(node, "extra")) { + newNode.extra = Object.assign({}, node.extra); + } + + return newNode; +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js index a32214294208dc..5622af7b0220d7 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = cloneWithoutLoc; var _clone = _interopRequireDefault(require("./clone")); @@ -8,7 +10,7 @@ var _clone = _interopRequireDefault(require("./clone")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function cloneWithoutLoc(node) { - var newNode = (0, _clone.default)(node); + const newNode = (0, _clone.default)(node); newNode.loc = null; return newNode; } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComment.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComment.js index bbe3c969549b34..ff586514e7eb4d 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComment.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComment.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = addComment; var _addComments = _interopRequireDefault(require("./addComments")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComments.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComments.js index 1f7c52931da182..f3a61df7131657 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComments.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/addComments.js @@ -1,11 +1,13 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = addComments; function addComments(node, type, comments) { if (!comments || !node) return node; - var key = type + "Comments"; + const key = `${type}Comments`; if (node[key]) { if (type === "leading") { diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritInnerComments.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritInnerComments.js index 02f1ad5092e29e..fbe59dec623663 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritInnerComments.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritInnerComments.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = inheritInnerComments; var _inherit = _interopRequireDefault(require("../utils/inherit")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritLeadingComments.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritLeadingComments.js index f5c213be1fcddd..ccb02ec55bef0e 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritLeadingComments.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = inheritLeadingComments; var _inherit = _interopRequireDefault(require("../utils/inherit")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritTrailingComments.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritTrailingComments.js index 81d60f74148d4e..bce1e2d9ac77a6 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritTrailingComments.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = inheritTrailingComments; var _inherit = _interopRequireDefault(require("../utils/inherit")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritsComments.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritsComments.js index f0446776df81ac..fd942d86cdc54b 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritsComments.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/inheritsComments.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = inheritsComments; var _inheritTrailingComments = _interopRequireDefault(require("./inheritTrailingComments")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/removeComments.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/removeComments.js index 30319b1c9c5144..fe34f1a8905b31 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/removeComments.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/comments/removeComments.js @@ -1,12 +1,14 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = removeComments; var _constants = require("../constants"); function removeComments(node) { - _constants.COMMENT_KEYS.forEach(function (key) { + _constants.COMMENT_KEYS.forEach(key => { node[key] = null; }); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/generated/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/generated/index.js index 20f182ed1def1f..6072495e206be0 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/generated/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/generated/index.js @@ -1,87 +1,93 @@ "use strict"; -exports.__esModule = true; -exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.JSX_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.FLOW_TYPES = exports.MODULESPECIFIER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = exports.CLASS_TYPES = exports.PATTERN_TYPES = exports.UNARYLIKE_TYPES = exports.PROPERTY_TYPES = exports.OBJECTMEMBER_TYPES = exports.METHOD_TYPES = exports.USERWHITESPACABLE_TYPES = exports.IMMUTABLE_TYPES = exports.LITERAL_TYPES = exports.TSENTITYNAME_TYPES = exports.LVAL_TYPES = exports.PATTERNLIKE_TYPES = exports.DECLARATION_TYPES = exports.PUREISH_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FUNCTION_TYPES = exports.FORXSTATEMENT_TYPES = exports.FOR_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.WHILE_TYPES = exports.LOOP_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.SCOPABLE_TYPES = exports.BINARY_TYPES = exports.EXPRESSION_TYPES = void 0; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.PRIVATE_TYPES = exports.JSX_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.FLOWTYPE_TYPES = exports.FLOW_TYPES = exports.MODULESPECIFIER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = exports.CLASS_TYPES = exports.PATTERN_TYPES = exports.UNARYLIKE_TYPES = exports.PROPERTY_TYPES = exports.OBJECTMEMBER_TYPES = exports.METHOD_TYPES = exports.USERWHITESPACABLE_TYPES = exports.IMMUTABLE_TYPES = exports.LITERAL_TYPES = exports.TSENTITYNAME_TYPES = exports.LVAL_TYPES = exports.PATTERNLIKE_TYPES = exports.DECLARATION_TYPES = exports.PUREISH_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FUNCTION_TYPES = exports.FORXSTATEMENT_TYPES = exports.FOR_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.WHILE_TYPES = exports.LOOP_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.SCOPABLE_TYPES = exports.BINARY_TYPES = exports.EXPRESSION_TYPES = void 0; var _definitions = require("../../definitions"); -var EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"]; +const EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"]; exports.EXPRESSION_TYPES = EXPRESSION_TYPES; -var BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"]; +const BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"]; exports.BINARY_TYPES = BINARY_TYPES; -var SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"]; +const SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"]; exports.SCOPABLE_TYPES = SCOPABLE_TYPES; -var BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"]; +const BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"]; exports.BLOCKPARENT_TYPES = BLOCKPARENT_TYPES; -var BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"]; +const BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"]; exports.BLOCK_TYPES = BLOCK_TYPES; -var STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"]; +const STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"]; exports.STATEMENT_TYPES = STATEMENT_TYPES; -var TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"]; +const TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"]; exports.TERMINATORLESS_TYPES = TERMINATORLESS_TYPES; -var COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"]; +const COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"]; exports.COMPLETIONSTATEMENT_TYPES = COMPLETIONSTATEMENT_TYPES; -var CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"]; +const CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"]; exports.CONDITIONAL_TYPES = CONDITIONAL_TYPES; -var LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"]; +const LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"]; exports.LOOP_TYPES = LOOP_TYPES; -var WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"]; +const WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"]; exports.WHILE_TYPES = WHILE_TYPES; -var EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"]; +const EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"]; exports.EXPRESSIONWRAPPER_TYPES = EXPRESSIONWRAPPER_TYPES; -var FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"]; +const FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"]; exports.FOR_TYPES = FOR_TYPES; -var FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"]; +const FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"]; exports.FORXSTATEMENT_TYPES = FORXSTATEMENT_TYPES; -var FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"]; +const FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"]; exports.FUNCTION_TYPES = FUNCTION_TYPES; -var FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"]; +const FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"]; exports.FUNCTIONPARENT_TYPES = FUNCTIONPARENT_TYPES; -var PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"]; +const PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"]; exports.PUREISH_TYPES = PUREISH_TYPES; -var DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"]; +const DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"]; exports.DECLARATION_TYPES = DECLARATION_TYPES; -var PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"]; +const PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"]; exports.PATTERNLIKE_TYPES = PATTERNLIKE_TYPES; -var LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"]; +const LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"]; exports.LVAL_TYPES = LVAL_TYPES; -var TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"]; +const TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"]; exports.TSENTITYNAME_TYPES = TSENTITYNAME_TYPES; -var LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"]; +const LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"]; exports.LITERAL_TYPES = LITERAL_TYPES; -var IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"]; +const IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"]; exports.IMMUTABLE_TYPES = IMMUTABLE_TYPES; -var USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"]; +const USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"]; exports.USERWHITESPACABLE_TYPES = USERWHITESPACABLE_TYPES; -var METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"]; +const METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"]; exports.METHOD_TYPES = METHOD_TYPES; -var OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"]; +const OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"]; exports.OBJECTMEMBER_TYPES = OBJECTMEMBER_TYPES; -var PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"]; +const PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"]; exports.PROPERTY_TYPES = PROPERTY_TYPES; -var UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"]; +const UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"]; exports.UNARYLIKE_TYPES = UNARYLIKE_TYPES; -var PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"]; +const PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"]; exports.PATTERN_TYPES = PATTERN_TYPES; -var CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"]; +const CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"]; exports.CLASS_TYPES = CLASS_TYPES; -var MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"]; +const MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"]; exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES; -var EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"]; +const EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"]; exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES; -var MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"]; +const MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"]; exports.MODULESPECIFIER_TYPES = MODULESPECIFIER_TYPES; -var FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"]; +const FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"]; exports.FLOW_TYPES = FLOW_TYPES; -var FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; +const FLOWTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowType"]; +exports.FLOWTYPE_TYPES = FLOWTYPE_TYPES; +const FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; exports.FLOWBASEANNOTATION_TYPES = FLOWBASEANNOTATION_TYPES; -var FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"]; +const FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"]; exports.FLOWDECLARATION_TYPES = FLOWDECLARATION_TYPES; -var FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"]; +const FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"]; exports.FLOWPREDICATE_TYPES = FLOWPREDICATE_TYPES; -var JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"]; +const JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"]; exports.JSX_TYPES = JSX_TYPES; -var TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"]; +const PRIVATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Private"]; +exports.PRIVATE_TYPES = PRIVATE_TYPES; +const TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"]; exports.TSTYPEELEMENT_TYPES = TSTYPEELEMENT_TYPES; -var TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"]; +const TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"]; exports.TSTYPE_TYPES = TSTYPE_TYPES; \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/index.js index f8eb31b9eed64c..a60b106fdad394 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/constants/index.js @@ -1,45 +1,47 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = void 0; -var STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; +const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS; -var FLATTENABLE_KEYS = ["body", "expressions"]; +const FLATTENABLE_KEYS = ["body", "expressions"]; exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS; -var FOR_INIT_KEYS = ["left", "init"]; +const FOR_INIT_KEYS = ["left", "init"]; exports.FOR_INIT_KEYS = FOR_INIT_KEYS; -var COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; +const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; exports.COMMENT_KEYS = COMMENT_KEYS; -var LOGICAL_OPERATORS = ["||", "&&", "??"]; +const LOGICAL_OPERATORS = ["||", "&&", "??"]; exports.LOGICAL_OPERATORS = LOGICAL_OPERATORS; -var UPDATE_OPERATORS = ["++", "--"]; +const UPDATE_OPERATORS = ["++", "--"]; exports.UPDATE_OPERATORS = UPDATE_OPERATORS; -var BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; +const BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS; -var EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; +const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS; -var COMPARISON_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS.concat(["in", "instanceof"]); +const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"]; exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS; -var BOOLEAN_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS.concat(BOOLEAN_NUMBER_BINARY_OPERATORS); +const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS]; exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS; -var NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; +const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS; -var BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS); +const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS]; exports.BINARY_OPERATORS = BINARY_OPERATORS; -var BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; +const BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS; -var NUMBER_UNARY_OPERATORS = ["+", "-", "~"]; +const NUMBER_UNARY_OPERATORS = ["+", "-", "~"]; exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS; -var STRING_UNARY_OPERATORS = ["typeof"]; +const STRING_UNARY_OPERATORS = ["typeof"]; exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS; -var UNARY_OPERATORS = ["void", "throw"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS); +const UNARY_OPERATORS = ["void", "throw", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS]; exports.UNARY_OPERATORS = UNARY_OPERATORS; -var INHERIT_KEYS = { +const INHERIT_KEYS = { optional: ["typeAnnotation", "typeParameters", "returnType"], force: ["start", "loc", "end"] }; exports.INHERIT_KEYS = INHERIT_KEYS; -var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); +const BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); exports.BLOCK_SCOPED_SYMBOL = BLOCK_SCOPED_SYMBOL; -var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); +const NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); exports.NOT_LOCAL_BINDING = NOT_LOCAL_BINDING; \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/ensureBlock.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/ensureBlock.js index da69103d9ef20b..2836b3657814f7 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/ensureBlock.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/ensureBlock.js @@ -1,16 +1,14 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = ensureBlock; var _toBlock = _interopRequireDefault(require("./toBlock")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function ensureBlock(node, key) { - if (key === void 0) { - key = "body"; - } - +function ensureBlock(node, key = "body") { return node[key] = (0, _toBlock.default)(node[key], node); } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js index 0e07cbe18f0e3e..2d05485b80e042 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = gatherSequenceExpressions; var _getBindingIdentifiers = _interopRequireDefault(require("../retrievers/getBindingIdentifiers")); @@ -9,43 +11,31 @@ var _generated = require("../validators/generated"); var _generated2 = require("../builders/generated"); +var _cloneNode = _interopRequireDefault(require("../clone/cloneNode")); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function gatherSequenceExpressions(nodes, scope, declars) { - var exprs = []; - var ensureLastUndefined = true; - - for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } + const exprs = []; + let ensureLastUndefined = true; - var _node = _ref; + for (const node of nodes) { ensureLastUndefined = false; - if ((0, _generated.isExpression)(_node)) { - exprs.push(_node); - } else if ((0, _generated.isExpressionStatement)(_node)) { - exprs.push(_node.expression); - } else if ((0, _generated.isVariableDeclaration)(_node)) { - if (_node.kind !== "var") return; - var _arr = _node.declarations; + if ((0, _generated.isExpression)(node)) { + exprs.push(node); + } else if ((0, _generated.isExpressionStatement)(node)) { + exprs.push(node.expression); + } else if ((0, _generated.isVariableDeclaration)(node)) { + if (node.kind !== "var") return; - for (var _i2 = 0; _i2 < _arr.length; _i2++) { - var declar = _arr[_i2]; - var bindings = (0, _getBindingIdentifiers.default)(declar); + for (const declar of node.declarations) { + const bindings = (0, _getBindingIdentifiers.default)(declar); - for (var key in bindings) { + for (const key in bindings) { declars.push({ - kind: _node.kind, - id: bindings[key] + kind: node.kind, + id: (0, _cloneNode.default)(bindings[key]) }); } @@ -55,16 +45,16 @@ function gatherSequenceExpressions(nodes, scope, declars) { } ensureLastUndefined = true; - } else if ((0, _generated.isIfStatement)(_node)) { - var consequent = _node.consequent ? gatherSequenceExpressions([_node.consequent], scope, declars) : scope.buildUndefinedNode(); - var alternate = _node.alternate ? gatherSequenceExpressions([_node.alternate], scope, declars) : scope.buildUndefinedNode(); + } else if ((0, _generated.isIfStatement)(node)) { + const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode(); + const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode(); if (!consequent || !alternate) return; - exprs.push((0, _generated2.conditionalExpression)(_node.test, consequent, alternate)); - } else if ((0, _generated.isBlockStatement)(_node)) { - var body = gatherSequenceExpressions(_node.body, scope, declars); + exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate)); + } else if ((0, _generated.isBlockStatement)(node)) { + const body = gatherSequenceExpressions(node.body, scope, declars); if (!body) return; exprs.push(body); - } else if ((0, _generated.isEmptyStatement)(_node)) { + } else if ((0, _generated.isEmptyStatement)(node)) { ensureLastUndefined = true; } else { return; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js index 3bda98aa834e10..b9d165b6fd1d20 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toBindingIdentifierName; var _toIdentifier = _interopRequireDefault(require("./toIdentifier")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBlock.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBlock.js index 542ff552103516..19886833fa300e 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBlock.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toBlock.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toBlock; var _generated = require("../validators/generated"); @@ -12,7 +14,7 @@ function toBlock(node, parent) { return node; } - var blockNodes = []; + let blockNodes = []; if ((0, _generated.isEmptyStatement)(node)) { blockNodes = []; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toComputedKey.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toComputedKey.js index 71bd8e4a6628cb..31e6770f6f770f 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toComputedKey.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toComputedKey.js @@ -1,17 +1,15 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toComputedKey; var _generated = require("../validators/generated"); var _generated2 = require("../builders/generated"); -function toComputedKey(node, key) { - if (key === void 0) { - key = node.key || node.property; - } - +function toComputedKey(node, key = node.key || node.property) { if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name); return key; } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toExpression.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toExpression.js index dfb5bb87b84743..6e58b0de4d6e60 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toExpression.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toExpression.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toExpression; var _generated = require("../validators/generated"); @@ -21,7 +23,7 @@ function toExpression(node) { } if (!(0, _generated.isExpression)(node)) { - throw new Error("cannot turn " + node.type + " to an expression"); + throw new Error(`cannot turn ${node.type} to an expression`); } return node; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toIdentifier.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toIdentifier.js index d929872af5e553..e55db41fc4fd17 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toIdentifier.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toIdentifier.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toIdentifier; var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier")); @@ -16,7 +18,7 @@ function toIdentifier(name) { }); if (!(0, _isValidIdentifier.default)(name)) { - name = "_" + name; + name = `_${name}`; } return name || "_"; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toKeyAlias.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toKeyAlias.js index 88aa30ed979b77..c48fd0e7f319e2 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toKeyAlias.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toKeyAlias.js @@ -1,22 +1,20 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toKeyAlias; var _generated = require("../validators/generated"); -var _cloneDeep = _interopRequireDefault(require("../clone/cloneDeep")); +var _cloneNode = _interopRequireDefault(require("../clone/cloneNode")); var _removePropertiesDeep = _interopRequireDefault(require("../modifications/removePropertiesDeep")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function toKeyAlias(node, key) { - if (key === void 0) { - key = node.key; - } - - var alias; +function toKeyAlias(node, key = node.key) { + let alias; if (node.kind === "method") { return toKeyAlias.increment() + ""; @@ -25,15 +23,15 @@ function toKeyAlias(node, key) { } else if ((0, _generated.isStringLiteral)(key)) { alias = JSON.stringify(key.value); } else { - alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneDeep.default)(key))); + alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key))); } if (node.computed) { - alias = "[" + alias + "]"; + alias = `[${alias}]`; } if (node.static) { - alias = "static:" + alias; + alias = `static:${alias}`; } return alias; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toSequenceExpression.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toSequenceExpression.js index c5488ef9d5526f..2e221db4e07042 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toSequenceExpression.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toSequenceExpression.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toSequenceExpression; var _gatherSequenceExpressions = _interopRequireDefault(require("./gatherSequenceExpressions")); @@ -9,12 +11,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function toSequenceExpression(nodes, scope) { if (!nodes || !nodes.length) return; - var declars = []; - var result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars); + const declars = []; + const result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars); if (!result) return; - for (var _i = 0; _i < declars.length; _i++) { - var declar = declars[_i]; + for (const declar of declars) { scope.push(declar); } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toStatement.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toStatement.js index 8fa5a97e20d9cc..69b22ae09cc6ce 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toStatement.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/toStatement.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = toStatement; var _generated = require("../validators/generated"); @@ -12,8 +14,8 @@ function toStatement(node, ignore) { return node; } - var mustHaveId = false; - var newType; + let mustHaveId = false; + let newType; if ((0, _generated.isClass)(node)) { mustHaveId = true; @@ -33,7 +35,7 @@ function toStatement(node, ignore) { if (ignore) { return false; } else { - throw new Error("cannot turn " + node.type + " to a statement"); + throw new Error(`cannot turn ${node.type} to a statement`); } } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/valueToNode.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/valueToNode.js index d8f82ffd05e606..a7456ebfb0c785 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/valueToNode.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/converters/valueToNode.js @@ -1,11 +1,29 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = valueToNode; -var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject")); +function _isPlainObject() { + const data = _interopRequireDefault(require("lodash/isPlainObject")); -var _isRegExp = _interopRequireDefault(require("lodash/isRegExp")); + _isPlainObject = function () { + return data; + }; + + return data; +} + +function _isRegExp() { + const data = _interopRequireDefault(require("lodash/isRegExp")); + + _isRegExp = function () { + return data; + }; + + return data; +} var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier")); @@ -31,12 +49,32 @@ function valueToNode(value) { } if (typeof value === "number") { - return (0, _generated.numericLiteral)(value); + let result; + + if (Number.isFinite(value)) { + result = (0, _generated.numericLiteral)(Math.abs(value)); + } else { + let numerator; + + if (Number.isNaN(value)) { + numerator = (0, _generated.numericLiteral)(0); + } else { + numerator = (0, _generated.numericLiteral)(1); + } + + result = (0, _generated.binaryExpression)("/", numerator, (0, _generated.numericLiteral)(0)); + } + + if (value < 0 || Object.is(value, -0)) { + result = (0, _generated.unaryExpression)("-", result); + } + + return result; } - if ((0, _isRegExp.default)(value)) { - var pattern = value.source; - var flags = value.toString().match(/\/([a-z]+|)$/)[1]; + if ((0, _isRegExp().default)(value)) { + const pattern = value.source; + const flags = value.toString().match(/\/([a-z]+|)$/)[1]; return (0, _generated.regExpLiteral)(pattern, flags); } @@ -44,11 +82,11 @@ function valueToNode(value) { return (0, _generated.arrayExpression)(value.map(valueToNode)); } - if ((0, _isPlainObject.default)(value)) { - var props = []; + if ((0, _isPlainObject().default)(value)) { + const props = []; - for (var key in value) { - var nodeKey = void 0; + for (const key in value) { + let nodeKey; if ((0, _isValidIdentifier.default)(key)) { nodeKey = (0, _generated.identifier)(key); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/core.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/core.js index d8abe51f151946..b2bcbd9c2ff6ea 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/core.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/core.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionTypeAnnotationCommon = exports.functionCommon = void 0; var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier")); @@ -43,7 +45,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de builder: ["operator", "left", "right"], fields: { operator: { - validate: _utils.assertOneOf.apply(void 0, _constants.BINARY_OPERATORS) + validate: (0, _utils.assertOneOf)(..._constants.BINARY_OPERATORS) }, left: { validate: (0, _utils.assertNodeType)("Expression") @@ -55,6 +57,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de visitor: ["left", "right"], aliases: ["Binary", "Expression"] }); +(0, _utils.default)("InterpreterDirective", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + } +}); (0, _utils.default)("Directive", { visitor: ["value"], fields: { @@ -96,7 +106,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de aliases: ["Statement", "Terminatorless", "CompletionStatement"] }); (0, _utils.default)("CallExpression", { - visitor: ["callee", "arguments", "typeParameters"], + visitor: ["callee", "arguments", "typeParameters", "typeArguments"], builder: ["callee", "arguments"], aliases: ["Expression"], fields: { @@ -110,8 +120,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de validate: (0, _utils.assertOneOf)(true, false), optional: true }, + typeArguments: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"), + optional: true + }, typeParameters: { - validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"), optional: true } } @@ -226,9 +240,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de } } }); -var functionCommon = { +const functionCommon = { params: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("LVal"))) + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty"))) }, generator: { default: false, @@ -240,7 +254,7 @@ var functionCommon = { } }; exports.functionCommon = functionCommon; -var functionTypeAnnotationCommon = { +const functionTypeAnnotationCommon = { returnType: { validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), optional: true @@ -251,7 +265,7 @@ var functionTypeAnnotationCommon = { } }; exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon; -var functionDeclarationCommon = Object.assign({}, functionCommon, { +const functionDeclarationCommon = Object.assign({}, functionCommon, { declare: { validate: (0, _utils.assertValueType)("boolean"), optional: true @@ -285,7 +299,7 @@ exports.functionDeclarationCommon = functionDeclarationCommon; } }) }); -var patternLikeCommon = { +const patternLikeCommon = { typeAnnotation: { validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), optional: true @@ -297,13 +311,13 @@ var patternLikeCommon = { exports.patternLikeCommon = patternLikeCommon; (0, _utils.default)("Identifier", { builder: ["name"], - visitor: ["typeAnnotation"], + visitor: ["typeAnnotation", "decorators"], aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"], fields: Object.assign({}, patternLikeCommon, { name: { - validate: function validate(node, key, val) { + validate: (0, _utils.chain)(function (node, key, val) { if (!(0, _isValidIdentifier.default)(val)) {} - } + }, (0, _utils.assertValueType)("string")) }, optional: { validate: (0, _utils.assertValueType)("boolean"), @@ -390,7 +404,7 @@ exports.patternLikeCommon = patternLikeCommon; aliases: ["Binary", "Expression"], fields: { operator: { - validate: _utils.assertOneOf.apply(void 0, _constants.LOGICAL_OPERATORS) + validate: (0, _utils.assertOneOf)(..._constants.LOGICAL_OPERATORS) }, left: { validate: (0, _utils.assertNodeType)("Expression") @@ -410,10 +424,10 @@ exports.patternLikeCommon = patternLikeCommon; }, property: { validate: function () { - var normal = (0, _utils.assertNodeType)("Identifier"); - var computed = (0, _utils.assertNodeType)("Expression"); + const normal = (0, _utils.assertNodeType)("Identifier", "PrivateName"); + const computed = (0, _utils.assertNodeType)("Expression"); return function (node, key, val) { - var validator = node.computed ? computed : normal; + const validator = node.computed ? computed : normal; validator(node, key, val); }; }() @@ -432,7 +446,7 @@ exports.patternLikeCommon = patternLikeCommon; }); (0, _utils.default)("Program", { visitor: ["directives", "body"], - builder: ["body", "directives", "sourceType"], + builder: ["body", "directives", "sourceType", "interpreter"], fields: { sourceFile: { validate: (0, _utils.assertValueType)("string") @@ -441,6 +455,11 @@ exports.patternLikeCommon = patternLikeCommon; validate: (0, _utils.assertOneOf)("script", "module"), default: "script" }, + interpreter: { + validate: (0, _utils.assertNodeType)("InterpreterDirective"), + default: null, + optional: true + }, directives: { validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))), default: [] @@ -473,10 +492,10 @@ exports.patternLikeCommon = patternLikeCommon; }, key: { validate: function () { - var normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); - var computed = (0, _utils.assertNodeType)("Expression"); + const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); + const computed = (0, _utils.assertNodeType)("Expression"); return function (node, key, val) { - var validator = node.computed ? computed : normal; + const validator = node.computed ? computed : normal; validator(node, key, val); }; }() @@ -500,10 +519,10 @@ exports.patternLikeCommon = patternLikeCommon; }, key: { validate: function () { - var normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); - var computed = (0, _utils.assertNodeType)("Expression"); + const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); + const computed = (0, _utils.assertNodeType)("Expression"); return function (node, key, val) { - var validator = node.computed ? computed : normal; + const validator = node.computed ? computed : normal; validator(node, key, val); }; }() @@ -616,7 +635,7 @@ exports.patternLikeCommon = patternLikeCommon; validate: (0, _utils.assertNodeType)("Expression") }, operator: { - validate: _utils.assertOneOf.apply(void 0, _constants.UNARY_OPERATORS) + validate: (0, _utils.assertOneOf)(..._constants.UNARY_OPERATORS) } }, visitor: ["argument"], @@ -632,7 +651,7 @@ exports.patternLikeCommon = patternLikeCommon; validate: (0, _utils.assertNodeType)("Expression") }, operator: { - validate: _utils.assertOneOf.apply(void 0, _constants.UPDATE_OPERATORS) + validate: (0, _utils.assertOneOf)(..._constants.UPDATE_OPERATORS) } }, visitor: ["argument"], @@ -661,6 +680,10 @@ exports.patternLikeCommon = patternLikeCommon; id: { validate: (0, _utils.assertNodeType)("LVal") }, + definite: { + optional: true, + validate: (0, _utils.assertValueType)("boolean") + }, init: { optional: true, validate: (0, _utils.assertNodeType)("Expression") diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/es2015.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/es2015.js index 62e2b4b0c27848..b4ce6fa04d99af 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/es2015.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/es2015.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.classMethodOrDeclareMethodCommon = exports.classMethodOrPropertyCommon = void 0; var _utils = _interopRequireWildcard(require("./utils")); @@ -10,7 +12,7 @@ var _core = require("./core"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } (0, _utils.default)("AssignmentPattern", { - visitor: ["left", "right"], + visitor: ["left", "right", "decorators"], builder: ["left", "right"], aliases: ["Pattern", "PatternLike", "LVal"], fields: Object.assign({}, _core.patternLikeCommon, { @@ -55,11 +57,11 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; visitor: ["body"], fields: { body: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ClassMethod", "ClassProperty", "TSDeclareMethod", "TSIndexSignature"))) + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassPrivateProperty", "TSDeclareMethod", "TSIndexSignature"))) } } }); -var classCommon = { +const classCommon = { typeParameters: { validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), optional: true @@ -76,7 +78,7 @@ var classCommon = { optional: true }, implements: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "FlowClassImplements"))), + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))), optional: true } }; @@ -199,6 +201,10 @@ var classCommon = { }, source: { validate: (0, _utils.assertNodeType)("StringLiteral") + }, + importKind: { + validate: (0, _utils.assertOneOf)("type", "typeof", "value"), + optional: true } } }); @@ -231,7 +237,8 @@ var classCommon = { validate: (0, _utils.assertNodeType)("Identifier") }, importKind: { - validate: (0, _utils.assertOneOf)(null, "type", "typeof") + validate: (0, _utils.assertOneOf)("type", "typeof"), + optional: true } } }); @@ -247,7 +254,7 @@ var classCommon = { } } }); -var classMethodOrPropertyCommon = { +const classMethodOrPropertyCommon = { abstract: { validate: (0, _utils.assertValueType)("boolean"), optional: true @@ -269,18 +276,18 @@ var classMethodOrPropertyCommon = { optional: true }, key: { - validate: function () { - var normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); - var computed = (0, _utils.assertNodeType)("Expression"); + validate: (0, _utils.chain)(function () { + const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); + const computed = (0, _utils.assertNodeType)("Expression"); return function (node, key, val) { - var validator = node.computed ? computed : normal; + const validator = node.computed ? computed : normal; validator(node, key, val); }; - }() + }(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression")) } }; exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon; -var classMethodOrDeclareMethodCommon = Object.assign({}, _core.functionCommon, classMethodOrPropertyCommon, { +const classMethodOrDeclareMethodCommon = Object.assign({}, _core.functionCommon, classMethodOrPropertyCommon, { kind: { validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("get", "set", "method", "constructor")), default: "method" @@ -306,7 +313,7 @@ exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon; }) }); (0, _utils.default)("ObjectPattern", { - visitor: ["properties", "typeAnnotation"], + visitor: ["properties", "typeAnnotation", "decorators"], builder: ["properties"], aliases: ["Pattern", "PatternLike", "LVal"], fields: Object.assign({}, _core.patternLikeCommon, { @@ -337,6 +344,10 @@ exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon; }, quasi: { validate: (0, _utils.assertNodeType)("TemplateLiteral") + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true } } }); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/experimental.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/experimental.js index 968f3009d868b9..e31b9fb7b93168 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/experimental.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/experimental.js @@ -30,6 +30,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; validate: (0, _utils.assertNodeType)("Expression"), optional: true }, + definite: { + validate: (0, _utils.assertValueType)("boolean"), + optional: true + }, typeAnnotation: { validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), optional: true @@ -44,6 +48,104 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } }) }); +(0, _utils.default)("OptionalMemberExpression", { + builder: ["object", "property", "computed", "optional"], + visitor: ["object", "property"], + aliases: ["Expression"], + fields: { + object: { + validate: (0, _utils.assertNodeType)("Expression") + }, + property: { + validate: function () { + const normal = (0, _utils.assertNodeType)("Identifier"); + const computed = (0, _utils.assertNodeType)("Expression"); + return function (node, key, val) { + const validator = node.computed ? computed : normal; + validator(node, key, val); + }; + }() + }, + computed: { + default: false + }, + optional: { + validate: (0, _utils.assertValueType)("boolean") + } + } +}); +(0, _utils.default)("PipelineTopicExpression", { + builder: ["expression"], + visitor: ["expression"], + fields: { + expression: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +(0, _utils.default)("PipelineBareFunction", { + builder: ["callee"], + visitor: ["callee"], + fields: { + callee: { + validate: (0, _utils.assertNodeType)("Expression") + } + } +}); +(0, _utils.default)("PipelinePrimaryTopicReference", { + aliases: ["Expression"] +}); +(0, _utils.default)("OptionalCallExpression", { + visitor: ["callee", "arguments", "typeParameters", "typeArguments"], + builder: ["callee", "arguments", "optional"], + aliases: ["Expression"], + fields: { + callee: { + validate: (0, _utils.assertNodeType)("Expression") + }, + arguments: { + validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName"))) + }, + optional: { + validate: (0, _utils.assertValueType)("boolean") + }, + typeArguments: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"), + optional: true + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"), + optional: true + } + } +}); +(0, _utils.default)("ClassPrivateProperty", { + visitor: ["key", "value"], + builder: ["key", "value"], + aliases: ["Property", "Private"], + fields: { + key: { + validate: (0, _utils.assertNodeType)("PrivateName") + }, + value: { + validate: (0, _utils.assertNodeType)("Expression"), + optional: true + } + } +}); +(0, _utils.default)("ClassPrivateMethod", { + builder: ["kind", "key", "params", "body", "static"], + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"], + fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, { + key: { + validate: (0, _utils.assertNodeType)("PrivateName") + }, + body: { + validate: (0, _utils.assertNodeType)("BlockStatement") + } + }) +}); (0, _utils.default)("Import", { aliases: ["Expression"] }); @@ -81,4 +183,22 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; validate: (0, _utils.assertNodeType)("Identifier") } } +}); +(0, _utils.default)("PrivateName", { + visitor: ["id"], + aliases: ["Private"], + fields: { + id: { + validate: (0, _utils.assertNodeType)("Identifier") + } + } +}); +(0, _utils.default)("BigIntLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _utils.assertValueType)("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] }); \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/flow.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/flow.js index db54ee1a953b9e..6969237dfa3dbc 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/flow.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/flow.js @@ -4,260 +4,383 @@ var _utils = _interopRequireWildcard(require("./utils")); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } +const defineInterfaceishType = (name, typeParameterType = "TypeParameterDeclaration") => { + (0, _utils.default)(name, { + builder: ["id", "typeParameters", "extends", "body"], + visitor: ["id", "typeParameters", "extends", "mixins", "implements", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)(typeParameterType), + extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")), + mixins: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")), + implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")), + body: (0, _utils.validateType)("ObjectTypeAnnotation") + } + }); +}; + (0, _utils.default)("AnyTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("ArrayTypeAnnotation", { visitor: ["elementType"], - aliases: ["Flow"], - fields: {} + aliases: ["Flow", "FlowType"], + fields: { + elementType: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("BooleanTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("BooleanLiteralTypeAnnotation", { - aliases: ["Flow"], - fields: {} + builder: ["value"], + aliases: ["Flow", "FlowType"], + fields: { + value: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } }); (0, _utils.default)("NullLiteralTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("ClassImplements", { visitor: ["id", "typeParameters"], aliases: ["Flow"], - fields: {} -}); -(0, _utils.default)("DeclareClass", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation") + } }); +defineInterfaceishType("DeclareClass"); (0, _utils.default)("DeclareFunction", { visitor: ["id"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); -(0, _utils.default)("DeclareInterface", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier"), + predicate: (0, _utils.validateOptionalType)("DeclaredPredicate") + } }); +defineInterfaceishType("DeclareInterface"); (0, _utils.default)("DeclareModule", { + builder: ["id", "body", "kind"], visitor: ["id", "body"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + body: (0, _utils.validateType)("BlockStatement"), + kind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("CommonJS", "ES")) + } }); (0, _utils.default)("DeclareModuleExports", { visitor: ["typeAnnotation"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + typeAnnotation: (0, _utils.validateType)("TypeAnnotation") + } }); (0, _utils.default)("DeclareTypeAlias", { visitor: ["id", "typeParameters", "right"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + right: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("DeclareOpaqueType", { visitor: ["id", "typeParameters", "supertype"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + supertype: (0, _utils.validateOptionalType)("FlowType") + } }); (0, _utils.default)("DeclareVariable", { visitor: ["id"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier") + } }); (0, _utils.default)("DeclareExportDeclaration", { visitor: ["declaration", "specifiers", "source"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + declaration: (0, _utils.validateOptionalType)("Flow"), + specifiers: (0, _utils.validateOptional)((0, _utils.arrayOfType)(["ExportSpecifier", "ExportNamespaceSpecifier"])), + source: (0, _utils.validateOptionalType)("StringLiteral"), + default: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean")) + } }); (0, _utils.default)("DeclareExportAllDeclaration", { visitor: ["source"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + source: (0, _utils.validateType)("StringLiteral"), + exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)(["type", "value"])) + } }); (0, _utils.default)("DeclaredPredicate", { visitor: ["value"], aliases: ["Flow", "FlowPredicate"], - fields: {} + fields: { + value: (0, _utils.validateType)("Flow") + } }); (0, _utils.default)("ExistsTypeAnnotation", { - aliases: ["Flow"] + aliases: ["Flow", "FlowType"] }); (0, _utils.default)("FunctionTypeAnnotation", { visitor: ["typeParameters", "params", "rest", "returnType"], - aliases: ["Flow"], - fields: {} + aliases: ["Flow", "FlowType"], + fields: { + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + params: (0, _utils.validate)((0, _utils.arrayOfType)("FunctionTypeParam")), + rest: (0, _utils.validateOptionalType)("FunctionTypeParam"), + returnType: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("FunctionTypeParam", { visitor: ["name", "typeAnnotation"], aliases: ["Flow"], - fields: {} + fields: { + name: (0, _utils.validateOptionalType)("Identifier"), + typeAnnotation: (0, _utils.validateType)("FlowType"), + optional: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean")) + } }); (0, _utils.default)("GenericTypeAnnotation", { visitor: ["id", "typeParameters"], - aliases: ["Flow"], - fields: {} + aliases: ["Flow", "FlowType"], + fields: { + id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation") + } }); (0, _utils.default)("InferredPredicate", { - aliases: ["Flow", "FlowPredicate"], - fields: {} + aliases: ["Flow", "FlowPredicate"] }); (0, _utils.default)("InterfaceExtends", { visitor: ["id", "typeParameters"], aliases: ["Flow"], - fields: {} + fields: { + id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation") + } }); -(0, _utils.default)("InterfaceDeclaration", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} +defineInterfaceishType("InterfaceDeclaration"); +(0, _utils.default)("InterfaceTypeAnnotation", { + visitor: ["extends", "body"], + aliases: ["Flow", "FlowType"], + fields: { + extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")), + body: (0, _utils.validateType)("ObjectTypeAnnotation") + } }); (0, _utils.default)("IntersectionTypeAnnotation", { visitor: ["types"], - aliases: ["Flow"], - fields: {} + aliases: ["Flow", "FlowType"], + fields: { + types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) + } }); (0, _utils.default)("MixedTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("EmptyTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("NullableTypeAnnotation", { visitor: ["typeAnnotation"], - aliases: ["Flow"], - fields: {} + aliases: ["Flow", "FlowType"], + fields: { + typeAnnotation: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("NumberLiteralTypeAnnotation", { - aliases: ["Flow"], - fields: {} + builder: ["value"], + aliases: ["Flow", "FlowType"], + fields: { + value: (0, _utils.validate)((0, _utils.assertValueType)("number")) + } }); (0, _utils.default)("NumberTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("ObjectTypeAnnotation", { - visitor: ["properties", "indexers", "callProperties"], - aliases: ["Flow"], - fields: {} + visitor: ["properties", "indexers", "callProperties", "internalSlots"], + aliases: ["Flow", "FlowType"], + builder: ["properties", "indexers", "callProperties", "internalSlots", "exact"], + fields: { + properties: (0, _utils.validate)((0, _utils.arrayOfType)(["ObjectTypeProperty", "ObjectTypeSpreadProperty"])), + indexers: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeIndexer")), + callProperties: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeCallProperty")), + internalSlots: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeInternalSlot")), + exact: { + validate: (0, _utils.assertValueType)("boolean"), + default: false + }, + inexact: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean")) + } +}); +(0, _utils.default)("ObjectTypeInternalSlot", { + visitor: ["id", "value", "optional", "static", "method"], + aliases: ["Flow", "UserWhitespacable"], + fields: { + id: (0, _utils.validateType)("Identifier"), + value: (0, _utils.validateType)("FlowType"), + optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + method: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } }); (0, _utils.default)("ObjectTypeCallProperty", { visitor: ["value"], aliases: ["Flow", "UserWhitespacable"], - fields: {} + fields: { + value: (0, _utils.validateType)("FlowType"), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")) + } }); (0, _utils.default)("ObjectTypeIndexer", { - visitor: ["id", "key", "value"], + visitor: ["id", "key", "value", "variance"], aliases: ["Flow", "UserWhitespacable"], - fields: {} + fields: { + id: (0, _utils.validateOptionalType)("Identifier"), + key: (0, _utils.validateType)("FlowType"), + value: (0, _utils.validateType)("FlowType"), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + variance: (0, _utils.validateOptionalType)("Variance") + } }); (0, _utils.default)("ObjectTypeProperty", { - visitor: ["key", "value"], + visitor: ["key", "value", "variance"], aliases: ["Flow", "UserWhitespacable"], - fields: {} + fields: { + key: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + value: (0, _utils.validateType)("FlowType"), + kind: (0, _utils.validate)((0, _utils.assertOneOf)("init", "get", "set")), + static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + proto: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")), + variance: (0, _utils.validateOptionalType)("Variance") + } }); (0, _utils.default)("ObjectTypeSpreadProperty", { visitor: ["argument"], aliases: ["Flow", "UserWhitespacable"], - fields: {} + fields: { + argument: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("OpaqueType", { visitor: ["id", "typeParameters", "supertype", "impltype"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + supertype: (0, _utils.validateOptionalType)("FlowType"), + impltype: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("QualifiedTypeIdentifier", { visitor: ["id", "qualification"], aliases: ["Flow"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier"), + qualification: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]) + } }); (0, _utils.default)("StringLiteralTypeAnnotation", { - aliases: ["Flow"], - fields: {} + builder: ["value"], + aliases: ["Flow", "FlowType"], + fields: { + value: (0, _utils.validate)((0, _utils.assertValueType)("string")) + } }); (0, _utils.default)("StringTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("ThisTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); (0, _utils.default)("TupleTypeAnnotation", { visitor: ["types"], - aliases: ["Flow"], - fields: {} + aliases: ["Flow", "FlowType"], + fields: { + types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) + } }); (0, _utils.default)("TypeofTypeAnnotation", { visitor: ["argument"], - aliases: ["Flow"], - fields: {} + aliases: ["Flow", "FlowType"], + fields: { + argument: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("TypeAlias", { visitor: ["id", "typeParameters", "right"], aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} + fields: { + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"), + right: (0, _utils.validateType)("FlowType") + } }); (0, _utils.default)("TypeAnnotation", { aliases: ["Flow"], visitor: ["typeAnnotation"], fields: { - typeAnnotation: { - validate: (0, _utils.assertNodeType)("Flow") - } + typeAnnotation: (0, _utils.validateType)("FlowType") } }); (0, _utils.default)("TypeCastExpression", { visitor: ["expression", "typeAnnotation"], aliases: ["Flow", "ExpressionWrapper", "Expression"], - fields: {} + fields: { + expression: (0, _utils.validateType)("Expression"), + typeAnnotation: (0, _utils.validateType)("TypeAnnotation") + } }); (0, _utils.default)("TypeParameter", { aliases: ["Flow"], - visitor: ["bound", "default"], + visitor: ["bound", "default", "variance"], fields: { - name: { - validate: (0, _utils.assertValueType)("string") - }, - bound: { - validate: (0, _utils.assertNodeType)("TypeAnnotation"), - optional: true - }, - default: { - validate: (0, _utils.assertNodeType)("Flow"), - optional: true - } + name: (0, _utils.validate)((0, _utils.assertValueType)("string")), + bound: (0, _utils.validateOptionalType)("TypeAnnotation"), + default: (0, _utils.validateOptionalType)("FlowType"), + variance: (0, _utils.validateOptionalType)("Variance") } }); (0, _utils.default)("TypeParameterDeclaration", { aliases: ["Flow"], visitor: ["params"], fields: { - params: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TypeParameter"))) - } + params: (0, _utils.validate)((0, _utils.arrayOfType)("TypeParameter")) } }); (0, _utils.default)("TypeParameterInstantiation", { aliases: ["Flow"], visitor: ["params"], fields: { - params: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Flow"))) - } + params: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) } }); (0, _utils.default)("UnionTypeAnnotation", { visitor: ["types"], + aliases: ["Flow", "FlowType"], + fields: { + types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType")) + } +}); +(0, _utils.default)("Variance", { aliases: ["Flow"], - fields: {} + builder: ["kind"], + fields: { + kind: (0, _utils.validate)((0, _utils.assertOneOf)("minus", "plus")) + } }); (0, _utils.default)("VoidTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + aliases: ["Flow", "FlowType", "FlowBaseAnnotation"] }); \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/index.js index a0bbfb84678026..ddb9e5101f3e50 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/index.js @@ -1,9 +1,55 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "VISITOR_KEYS", { + enumerable: true, + get: function () { + return _utils.VISITOR_KEYS; + } +}); +Object.defineProperty(exports, "ALIAS_KEYS", { + enumerable: true, + get: function () { + return _utils.ALIAS_KEYS; + } +}); +Object.defineProperty(exports, "FLIPPED_ALIAS_KEYS", { + enumerable: true, + get: function () { + return _utils.FLIPPED_ALIAS_KEYS; + } +}); +Object.defineProperty(exports, "NODE_FIELDS", { + enumerable: true, + get: function () { + return _utils.NODE_FIELDS; + } +}); +Object.defineProperty(exports, "BUILDER_KEYS", { + enumerable: true, + get: function () { + return _utils.BUILDER_KEYS; + } +}); +Object.defineProperty(exports, "DEPRECATED_KEYS", { + enumerable: true, + get: function () { + return _utils.DEPRECATED_KEYS; + } +}); exports.TYPES = void 0; -var _toFastProperties = _interopRequireDefault(require("to-fast-properties")); +function _toFastProperties() { + const data = _interopRequireDefault(require("to-fast-properties")); + + _toFastProperties = function () { + return data; + }; + + return data; +} require("./core"); @@ -21,20 +67,13 @@ require("./typescript"); var _utils = require("./utils"); -exports.VISITOR_KEYS = _utils.VISITOR_KEYS; -exports.ALIAS_KEYS = _utils.ALIAS_KEYS; -exports.FLIPPED_ALIAS_KEYS = _utils.FLIPPED_ALIAS_KEYS; -exports.NODE_FIELDS = _utils.NODE_FIELDS; -exports.BUILDER_KEYS = _utils.BUILDER_KEYS; -exports.DEPRECATED_KEYS = _utils.DEPRECATED_KEYS; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -(0, _toFastProperties.default)(_utils.VISITOR_KEYS); -(0, _toFastProperties.default)(_utils.ALIAS_KEYS); -(0, _toFastProperties.default)(_utils.FLIPPED_ALIAS_KEYS); -(0, _toFastProperties.default)(_utils.NODE_FIELDS); -(0, _toFastProperties.default)(_utils.BUILDER_KEYS); -(0, _toFastProperties.default)(_utils.DEPRECATED_KEYS); -var TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS)); +(0, _toFastProperties().default)(_utils.VISITOR_KEYS); +(0, _toFastProperties().default)(_utils.ALIAS_KEYS); +(0, _toFastProperties().default)(_utils.FLIPPED_ALIAS_KEYS); +(0, _toFastProperties().default)(_utils.NODE_FIELDS); +(0, _toFastProperties().default)(_utils.BUILDER_KEYS); +(0, _toFastProperties().default)(_utils.DEPRECATED_KEYS); +const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS)); exports.TYPES = TYPES; \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/jsx.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/jsx.js index 0ed8978b12e168..60d37e98ca16ee 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/jsx.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/jsx.js @@ -51,7 +51,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; aliases: ["JSX", "Immutable"], fields: { expression: { - validate: (0, _utils.assertNodeType)("Expression") + validate: (0, _utils.assertNodeType)("Expression", "JSXEmptyExpression") } } }); @@ -111,6 +111,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; }, attributes: { validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXAttribute", "JSXSpreadAttribute"))) + }, + typeParameters: { + validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true } } }); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/typescript.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/typescript.js index 90dca181f26981..0e5f905512064c 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/typescript.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/typescript.js @@ -8,49 +8,8 @@ var _es = require("./es2015"); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } -var bool = (0, _utils.assertValueType)("boolean"); - -function validate(validate) { - return { - validate: validate - }; -} - -function typeIs(typeName) { - return typeof typeName === "string" ? (0, _utils.assertNodeType)(typeName) : _utils.assertNodeType.apply(void 0, typeName); -} - -function validateType(name) { - return validate(typeIs(name)); -} - -function validateOptional(validate) { - return { - validate: validate, - optional: true - }; -} - -function validateOptionalType(typeName) { - return { - validate: typeIs(typeName), - optional: true - }; -} - -function arrayOf(elementType) { - return (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)(elementType)); -} - -function arrayOfType(nodeTypeName) { - return arrayOf(typeIs(nodeTypeName)); -} - -function validateArrayOfType(nodeTypeName) { - return validate(arrayOfType(nodeTypeName)); -} - -var tSFunctionTypeAnnotationCommon = { +const bool = (0, _utils.assertValueType)("boolean"); +const tSFunctionTypeAnnotationCommon = { returnType: { validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"), optional: true @@ -90,34 +49,34 @@ var tSFunctionTypeAnnotationCommon = { aliases: ["TSEntityName"], visitor: ["left", "right"], fields: { - left: validateType("TSEntityName"), - right: validateType("Identifier") + left: (0, _utils.validateType)("TSEntityName"), + right: (0, _utils.validateType)("Identifier") } }); -var signatureDeclarationCommon = { - typeParameters: validateOptionalType("TSTypeParameterDeclaration"), - parameters: validateArrayOfType(["Identifier", "RestElement"]), - typeAnnotation: validateOptionalType("TSTypeAnnotation") +const signatureDeclarationCommon = { + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), + parameters: (0, _utils.validateArrayOfType)(["Identifier", "RestElement"]), + typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation") }; -var callConstructSignatureDeclaration = { +const callConstructSignatureDeclaration = { aliases: ["TSTypeElement"], visitor: ["typeParameters", "parameters", "typeAnnotation"], fields: signatureDeclarationCommon }; (0, _utils.default)("TSCallSignatureDeclaration", callConstructSignatureDeclaration); (0, _utils.default)("TSConstructSignatureDeclaration", callConstructSignatureDeclaration); -var namedTypeElementCommon = { - key: validateType("Expression"), - computed: validate(bool), - optional: validateOptional(bool) +const namedTypeElementCommon = { + key: (0, _utils.validateType)("Expression"), + computed: (0, _utils.validate)(bool), + optional: (0, _utils.validateOptional)(bool) }; (0, _utils.default)("TSPropertySignature", { aliases: ["TSTypeElement"], visitor: ["key", "typeAnnotation", "initializer"], fields: Object.assign({}, namedTypeElementCommon, { - readonly: validateOptional(bool), - typeAnnotation: validateOptionalType("TSTypeAnnotation"), - initializer: validateOptionalType("Expression") + readonly: (0, _utils.validateOptional)(bool), + typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"), + initializer: (0, _utils.validateOptionalType)("Expression") }) }); (0, _utils.default)("TSMethodSignature", { @@ -129,15 +88,14 @@ var namedTypeElementCommon = { aliases: ["TSTypeElement"], visitor: ["parameters", "typeAnnotation"], fields: { - readonly: validateOptional(bool), - parameters: validateArrayOfType("Identifier"), - typeAnnotation: validateOptionalType("TSTypeAnnotation") + readonly: (0, _utils.validateOptional)(bool), + parameters: (0, _utils.validateArrayOfType)("Identifier"), + typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation") } }); -var tsKeywordTypes = ["TSAnyKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSBooleanKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSVoidKeyword", "TSUndefinedKeyword", "TSNullKeyword", "TSNeverKeyword"]; +const tsKeywordTypes = ["TSAnyKeyword", "TSUnknownKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSBooleanKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSVoidKeyword", "TSUndefinedKeyword", "TSNullKeyword", "TSNeverKeyword"]; -for (var _i = 0; _i < tsKeywordTypes.length; _i++) { - var type = tsKeywordTypes[_i]; +for (const type of tsKeywordTypes) { (0, _utils.default)(type, { aliases: ["TSType"], visitor: [], @@ -150,7 +108,7 @@ for (var _i = 0; _i < tsKeywordTypes.length; _i++) { visitor: [], fields: {} }); -var fnOrCtr = { +const fnOrCtr = { aliases: ["TSType"], visitor: ["typeParameters", "typeAnnotation"], fields: signatureDeclarationCommon @@ -161,214 +119,254 @@ var fnOrCtr = { aliases: ["TSType"], visitor: ["typeName", "typeParameters"], fields: { - typeName: validateType("TSEntityName"), - typeParameters: validateOptionalType("TSTypeParameterInstantiation") + typeName: (0, _utils.validateType)("TSEntityName"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") } }); (0, _utils.default)("TSTypePredicate", { aliases: ["TSType"], visitor: ["parameterName", "typeAnnotation"], fields: { - parameterName: validateType(["Identifier", "TSThisType"]), - typeAnnotation: validateType("TSTypeAnnotation") + parameterName: (0, _utils.validateType)(["Identifier", "TSThisType"]), + typeAnnotation: (0, _utils.validateType)("TSTypeAnnotation") } }); (0, _utils.default)("TSTypeQuery", { aliases: ["TSType"], visitor: ["exprName"], fields: { - exprName: validateType("TSEntityName") + exprName: (0, _utils.validateType)(["TSEntityName", "TSImportType"]) } }); (0, _utils.default)("TSTypeLiteral", { aliases: ["TSType"], visitor: ["members"], fields: { - members: validateArrayOfType("TSTypeElement") + members: (0, _utils.validateArrayOfType)("TSTypeElement") } }); (0, _utils.default)("TSArrayType", { aliases: ["TSType"], visitor: ["elementType"], fields: { - elementType: validateType("TSType") + elementType: (0, _utils.validateType)("TSType") } }); (0, _utils.default)("TSTupleType", { aliases: ["TSType"], visitor: ["elementTypes"], fields: { - elementTypes: validateArrayOfType("TSType") + elementTypes: (0, _utils.validateArrayOfType)("TSType") } }); -var unionOrIntersection = { +(0, _utils.default)("TSOptionalType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: (0, _utils.validateType)("TSType") + } +}); +(0, _utils.default)("TSRestType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: (0, _utils.validateType)("TSType") + } +}); +const unionOrIntersection = { aliases: ["TSType"], visitor: ["types"], fields: { - types: validateArrayOfType("TSType") + types: (0, _utils.validateArrayOfType)("TSType") } }; (0, _utils.default)("TSUnionType", unionOrIntersection); (0, _utils.default)("TSIntersectionType", unionOrIntersection); +(0, _utils.default)("TSConditionalType", { + aliases: ["TSType"], + visitor: ["checkType", "extendsType", "trueType", "falseType"], + fields: { + checkType: (0, _utils.validateType)("TSType"), + extendsType: (0, _utils.validateType)("TSType"), + trueType: (0, _utils.validateType)("TSType"), + falseType: (0, _utils.validateType)("TSType") + } +}); +(0, _utils.default)("TSInferType", { + aliases: ["TSType"], + visitor: ["typeParameter"], + fields: { + typeParameter: (0, _utils.validateType)("TSTypeParameter") + } +}); (0, _utils.default)("TSParenthesizedType", { aliases: ["TSType"], visitor: ["typeAnnotation"], fields: { - typeAnnotation: validateType("TSType") + typeAnnotation: (0, _utils.validateType)("TSType") } }); (0, _utils.default)("TSTypeOperator", { aliases: ["TSType"], visitor: ["typeAnnotation"], fields: { - operator: validate((0, _utils.assertValueType)("string")), - typeAnnotation: validateType("TSType") + operator: (0, _utils.validate)((0, _utils.assertValueType)("string")), + typeAnnotation: (0, _utils.validateType)("TSType") } }); (0, _utils.default)("TSIndexedAccessType", { aliases: ["TSType"], visitor: ["objectType", "indexType"], fields: { - objectType: validateType("TSType"), - indexType: validateType("TSType") + objectType: (0, _utils.validateType)("TSType"), + indexType: (0, _utils.validateType)("TSType") } }); (0, _utils.default)("TSMappedType", { aliases: ["TSType"], visitor: ["typeParameter", "typeAnnotation"], fields: { - readonly: validateOptional(bool), - typeParameter: validateType("TSTypeParameter"), - optional: validateOptional(bool), - typeAnnotation: validateOptionalType("TSType") + readonly: (0, _utils.validateOptional)(bool), + typeParameter: (0, _utils.validateType)("TSTypeParameter"), + optional: (0, _utils.validateOptional)(bool), + typeAnnotation: (0, _utils.validateOptionalType)("TSType") } }); (0, _utils.default)("TSLiteralType", { aliases: ["TSType"], visitor: ["literal"], fields: { - literal: validateType(["NumericLiteral", "StringLiteral", "BooleanLiteral"]) + literal: (0, _utils.validateType)(["NumericLiteral", "StringLiteral", "BooleanLiteral"]) } }); (0, _utils.default)("TSExpressionWithTypeArguments", { aliases: ["TSType"], visitor: ["expression", "typeParameters"], fields: { - expression: validateType("TSEntityName"), - typeParameters: validateOptionalType("TSTypeParameterInstantiation") + expression: (0, _utils.validateType)("TSEntityName"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") } }); (0, _utils.default)("TSInterfaceDeclaration", { aliases: ["Statement", "Declaration"], visitor: ["id", "typeParameters", "extends", "body"], fields: { - declare: validateOptional(bool), - id: validateType("Identifier"), - typeParameters: validateOptionalType("TSTypeParameterDeclaration"), - extends: validateOptional(arrayOfType("TSExpressionWithTypeArguments")), - body: validateType("TSInterfaceBody") + declare: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), + extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("TSExpressionWithTypeArguments")), + body: (0, _utils.validateType)("TSInterfaceBody") } }); (0, _utils.default)("TSInterfaceBody", { visitor: ["body"], fields: { - body: validateArrayOfType("TSTypeElement") + body: (0, _utils.validateArrayOfType)("TSTypeElement") } }); (0, _utils.default)("TSTypeAliasDeclaration", { aliases: ["Statement", "Declaration"], visitor: ["id", "typeParameters", "typeAnnotation"], fields: { - declare: validateOptional(bool), - id: validateType("Identifier"), - typeParameters: validateOptionalType("TSTypeParameterDeclaration"), - typeAnnotation: validateType("TSType") + declare: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)("Identifier"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), + typeAnnotation: (0, _utils.validateType)("TSType") } }); (0, _utils.default)("TSAsExpression", { aliases: ["Expression"], visitor: ["expression", "typeAnnotation"], fields: { - expression: validateType("Expression"), - typeAnnotation: validateType("TSType") + expression: (0, _utils.validateType)("Expression"), + typeAnnotation: (0, _utils.validateType)("TSType") } }); (0, _utils.default)("TSTypeAssertion", { aliases: ["Expression"], visitor: ["typeAnnotation", "expression"], fields: { - typeAnnotation: validateType("TSType"), - expression: validateType("Expression") + typeAnnotation: (0, _utils.validateType)("TSType"), + expression: (0, _utils.validateType)("Expression") } }); (0, _utils.default)("TSEnumDeclaration", { aliases: ["Statement", "Declaration"], visitor: ["id", "members"], fields: { - declare: validateOptional(bool), - const: validateOptional(bool), - id: validateType("Identifier"), - members: validateArrayOfType("TSEnumMember"), - initializer: validateOptionalType("Expression") + declare: (0, _utils.validateOptional)(bool), + const: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)("Identifier"), + members: (0, _utils.validateArrayOfType)("TSEnumMember"), + initializer: (0, _utils.validateOptionalType)("Expression") } }); (0, _utils.default)("TSEnumMember", { visitor: ["id", "initializer"], fields: { - id: validateType(["Identifier", "StringLiteral"]), - initializer: validateOptionalType("Expression") + id: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + initializer: (0, _utils.validateOptionalType)("Expression") } }); (0, _utils.default)("TSModuleDeclaration", { aliases: ["Statement", "Declaration"], visitor: ["id", "body"], fields: { - declare: validateOptional(bool), - global: validateOptional(bool), - id: validateType(["Identifier", "StringLiteral"]), - body: validateType(["TSModuleBlock", "TSModuleDeclaration"]) + declare: (0, _utils.validateOptional)(bool), + global: (0, _utils.validateOptional)(bool), + id: (0, _utils.validateType)(["Identifier", "StringLiteral"]), + body: (0, _utils.validateType)(["TSModuleBlock", "TSModuleDeclaration"]) } }); (0, _utils.default)("TSModuleBlock", { visitor: ["body"], fields: { - body: validateArrayOfType("Statement") + body: (0, _utils.validateArrayOfType)("Statement") + } +}); +(0, _utils.default)("TSImportType", { + aliases: ["TSType"], + visitor: ["argument", "qualifier", "typeParameters"], + fields: { + argument: (0, _utils.validateType)("StringLiteral"), + qualifier: (0, _utils.validateOptionalType)("TSEntityName"), + typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation") } }); (0, _utils.default)("TSImportEqualsDeclaration", { aliases: ["Statement"], visitor: ["id", "moduleReference"], fields: { - isExport: validate(bool), - id: validateType("Identifier"), - moduleReference: validateType(["TSEntityName", "TSExternalModuleReference"]) + isExport: (0, _utils.validate)(bool), + id: (0, _utils.validateType)("Identifier"), + moduleReference: (0, _utils.validateType)(["TSEntityName", "TSExternalModuleReference"]) } }); (0, _utils.default)("TSExternalModuleReference", { visitor: ["expression"], fields: { - expression: validateType("StringLiteral") + expression: (0, _utils.validateType)("StringLiteral") } }); (0, _utils.default)("TSNonNullExpression", { aliases: ["Expression"], visitor: ["expression"], fields: { - expression: validateType("Expression") + expression: (0, _utils.validateType)("Expression") } }); (0, _utils.default)("TSExportAssignment", { aliases: ["Statement"], visitor: ["expression"], fields: { - expression: validateType("Expression") + expression: (0, _utils.validateType)("Expression") } }); (0, _utils.default)("TSNamespaceExportDeclaration", { aliases: ["Statement"], visitor: ["id"], fields: { - id: validateType("Identifier") + id: (0, _utils.validateType)("Identifier") } }); (0, _utils.default)("TSTypeAnnotation", { diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/utils.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/utils.js index 6d323768cea5c0..c8fee08c52c033 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/utils.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/utils.js @@ -1,6 +1,16 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.validate = validate; +exports.typeIs = typeIs; +exports.validateType = validateType; +exports.validateOptional = validateOptional; +exports.validateOptionalType = validateOptionalType; +exports.arrayOf = arrayOf; +exports.arrayOfType = arrayOfType; +exports.validateArrayOfType = validateArrayOfType; exports.assertEach = assertEach; exports.assertOneOf = assertOneOf; exports.assertNodeType = assertNodeType; @@ -14,17 +24,17 @@ var _is = _interopRequireDefault(require("../validators/is")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var VISITOR_KEYS = {}; +const VISITOR_KEYS = {}; exports.VISITOR_KEYS = VISITOR_KEYS; -var ALIAS_KEYS = {}; +const ALIAS_KEYS = {}; exports.ALIAS_KEYS = ALIAS_KEYS; -var FLIPPED_ALIAS_KEYS = {}; +const FLIPPED_ALIAS_KEYS = {}; exports.FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS; -var NODE_FIELDS = {}; +const NODE_FIELDS = {}; exports.NODE_FIELDS = NODE_FIELDS; -var BUILDER_KEYS = {}; +const BUILDER_KEYS = {}; exports.BUILDER_KEYS = BUILDER_KEYS; -var DEPRECATED_KEYS = {}; +const DEPRECATED_KEYS = {}; exports.DEPRECATED_KEYS = DEPRECATED_KEYS; function getType(val) { @@ -39,12 +49,52 @@ function getType(val) { } } +function validate(validate) { + return { + validate + }; +} + +function typeIs(typeName) { + return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName); +} + +function validateType(typeName) { + return validate(typeIs(typeName)); +} + +function validateOptional(validate) { + return { + validate, + optional: true + }; +} + +function validateOptionalType(typeName) { + return { + validate: typeIs(typeName), + optional: true + }; +} + +function arrayOf(elementType) { + return chain(assertValueType("array"), assertEach(elementType)); +} + +function arrayOfType(typeName) { + return arrayOf(typeIs(typeName)); +} + +function validateArrayOfType(typeName) { + return validate(arrayOfType(typeName)); +} + function assertEach(callback) { function validator(node, key, val) { if (!Array.isArray(val)) return; - for (var i = 0; i < val.length; i++) { - callback(node, key + "[" + i + "]", val[i]); + for (let i = 0; i < val.length; i++) { + callback(node, `${key}[${i}]`, val[i]); } } @@ -52,14 +102,10 @@ function assertEach(callback) { return validator; } -function assertOneOf() { - for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { - values[_key] = arguments[_key]; - } - +function assertOneOf(...values) { function validate(node, key, val) { if (values.indexOf(val) < 0) { - throw new TypeError("Property " + key + " expected value to be one of " + JSON.stringify(values) + " but got " + JSON.stringify(val)); + throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`); } } @@ -67,17 +113,11 @@ function assertOneOf() { return validate; } -function assertNodeType() { - for (var _len2 = arguments.length, types = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - types[_key2] = arguments[_key2]; - } - +function assertNodeType(...types) { function validate(node, key, val) { - var valid = false; - - for (var _i = 0; _i < types.length; _i++) { - var type = types[_i]; + let valid = false; + for (const type of types) { if ((0, _is.default)(type, val)) { valid = true; break; @@ -85,7 +125,7 @@ function assertNodeType() { } if (!valid) { - throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + JSON.stringify(types) + " " + ("but instead got " + JSON.stringify(val && val.type))); + throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`); } } @@ -93,17 +133,11 @@ function assertNodeType() { return validate; } -function assertNodeOrValueType() { - for (var _len3 = arguments.length, types = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - types[_key3] = arguments[_key3]; - } - +function assertNodeOrValueType(...types) { function validate(node, key, val) { - var valid = false; - - for (var _i2 = 0; _i2 < types.length; _i2++) { - var type = types[_i2]; + let valid = false; + for (const type of types) { if (getType(val) === type || (0, _is.default)(type, val)) { valid = true; break; @@ -111,7 +145,7 @@ function assertNodeOrValueType() { } if (!valid) { - throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + JSON.stringify(types) + " " + ("but instead got " + JSON.stringify(val && val.type))); + throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`); } } @@ -121,10 +155,10 @@ function assertNodeOrValueType() { function assertValueType(type) { function validate(node, key, val) { - var valid = getType(val) === type; + const valid = getType(val) === type; if (!valid) { - throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType(val)); + throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); } } @@ -132,15 +166,10 @@ function assertValueType(type) { return validate; } -function chain() { - for (var _len4 = arguments.length, fns = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - fns[_key4] = arguments[_key4]; - } - - function validate() { - for (var _i3 = 0; _i3 < fns.length; _i3++) { - var fn = fns[_i3]; - fn.apply(void 0, arguments); +function chain(...fns) { + function validate(...args) { + for (const fn of fns) { + fn(...args); } } @@ -148,32 +177,25 @@ function chain() { return validate; } -function defineType(type, opts) { - if (opts === void 0) { - opts = {}; - } - - var inherits = opts.inherits && store[opts.inherits] || {}; - var fields = opts.fields || inherits.fields || {}; - var visitor = opts.visitor || inherits.visitor || []; - var aliases = opts.aliases || inherits.aliases || []; - var builder = opts.builder || inherits.builder || opts.visitor || []; +function defineType(type, opts = {}) { + const inherits = opts.inherits && store[opts.inherits] || {}; + const fields = opts.fields || inherits.fields || {}; + const visitor = opts.visitor || inherits.visitor || []; + const aliases = opts.aliases || inherits.aliases || []; + const builder = opts.builder || inherits.builder || opts.visitor || []; if (opts.deprecatedAlias) { DEPRECATED_KEYS[opts.deprecatedAlias] = type; } - var _arr = visitor.concat(builder); - - for (var _i4 = 0; _i4 < _arr.length; _i4++) { - var key = _arr[_i4]; + for (const key of visitor.concat(builder)) { fields[key] = fields[key] || {}; } - for (var _key5 in fields) { - var field = fields[_key5]; + for (const key in fields) { + const field = fields[key]; - if (builder.indexOf(_key5) === -1) { + if (builder.indexOf(key) === -1) { field.optional = true; } @@ -188,11 +210,11 @@ function defineType(type, opts) { BUILDER_KEYS[type] = opts.builder = builder; NODE_FIELDS[type] = opts.fields = fields; ALIAS_KEYS[type] = opts.aliases = aliases; - aliases.forEach(function (alias) { + aliases.forEach(alias => { FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || []; FLIPPED_ALIAS_KEYS[alias].push(type); }); store[type] = opts; } -var store = {}; \ No newline at end of file +const store = {}; \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.d.ts b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.d.ts new file mode 100644 index 00000000000000..753269b8360331 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.d.ts @@ -0,0 +1,2058 @@ +// NOTE: This file is autogenerated. Do not modify. +// See packages/babel-types/scripts/generators/typescript.js for script used. + +interface BaseComment { + value: string; + start: number; + end: number; + loc: SourceLocation; + type: "CommentBlock" | "CommentLine"; +} + +export interface CommentBlock extends BaseComment { + type: "CommentBlock"; +} + +export interface CommentLine extends BaseComment { + type: "CommentLine"; +} + +export type Comment = CommentBlock | CommentLine; + +export interface SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +interface BaseNode { + leadingComments: ReadonlyArray | null; + innerComments: ReadonlyArray | null; + trailingComments: ReadonlyArray | null; + start: number | null; + end: number | null; + loc: SourceLocation | null; + type: Node["type"]; +} + +export type Node = AnyTypeAnnotation | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | MemberExpression | MetaProperty | Method | MixedTypeAnnotation | ModuleDeclaration | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | SequenceExpression | SpreadElement | SpreadProperty | Statement | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | TSAnyKeyword | TSArrayType | TSAsExpression | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TryStatement | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression; + +export interface ArrayExpression extends BaseNode { + type: "ArrayExpression"; + elements: Array; +} + +export interface AssignmentExpression extends BaseNode { + type: "AssignmentExpression"; + operator: string; + left: LVal; + right: Expression; +} + +export interface BinaryExpression extends BaseNode { + type: "BinaryExpression"; + operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<="; + left: Expression; + right: Expression; +} + +export interface InterpreterDirective extends BaseNode { + type: "InterpreterDirective"; + value: string; +} + +export interface Directive extends BaseNode { + type: "Directive"; + value: DirectiveLiteral; +} + +export interface DirectiveLiteral extends BaseNode { + type: "DirectiveLiteral"; + value: string; +} + +export interface BlockStatement extends BaseNode { + type: "BlockStatement"; + body: Array; + directives: Array; +} + +export interface BreakStatement extends BaseNode { + type: "BreakStatement"; + label: Identifier | null; +} + +export interface CallExpression extends BaseNode { + type: "CallExpression"; + callee: Expression; + arguments: Array; + optional: true | false | null; + typeArguments: TypeParameterInstantiation | null; + typeParameters: TSTypeParameterInstantiation | null; +} + +export interface CatchClause extends BaseNode { + type: "CatchClause"; + param: Identifier | null; + body: BlockStatement; +} + +export interface ConditionalExpression extends BaseNode { + type: "ConditionalExpression"; + test: Expression; + consequent: Expression; + alternate: Expression; +} + +export interface ContinueStatement extends BaseNode { + type: "ContinueStatement"; + label: Identifier | null; +} + +export interface DebuggerStatement extends BaseNode { + type: "DebuggerStatement"; +} + +export interface DoWhileStatement extends BaseNode { + type: "DoWhileStatement"; + test: Expression; + body: Statement; +} + +export interface EmptyStatement extends BaseNode { + type: "EmptyStatement"; +} + +export interface ExpressionStatement extends BaseNode { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface File extends BaseNode { + type: "File"; + program: Program; + comments: any; + tokens: any; +} + +export interface ForInStatement extends BaseNode { + type: "ForInStatement"; + left: VariableDeclaration | LVal; + right: Expression; + body: Statement; +} + +export interface ForStatement extends BaseNode { + type: "ForStatement"; + init: VariableDeclaration | Expression | null; + test: Expression | null; + update: Expression | null; + body: Statement; +} + +export interface FunctionDeclaration extends BaseNode { + type: "FunctionDeclaration"; + id: Identifier | null; + params: Array; + body: BlockStatement; + generator: boolean; + async: boolean; + declare: boolean | null; + returnType: TypeAnnotation | TSTypeAnnotation | Noop | null; + typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; +} + +export interface FunctionExpression extends BaseNode { + type: "FunctionExpression"; + id: Identifier | null; + params: Array; + body: BlockStatement; + generator: boolean; + async: boolean; + returnType: TypeAnnotation | TSTypeAnnotation | Noop | null; + typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; +} + +export interface Identifier extends BaseNode { + type: "Identifier"; + name: string; + decorators: Array | null; + optional: boolean | null; + typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; +} + +export interface IfStatement extends BaseNode { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate: Statement | null; +} + +export interface LabeledStatement extends BaseNode { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface StringLiteral extends BaseNode { + type: "StringLiteral"; + value: string; +} + +export interface NumericLiteral extends BaseNode { + type: "NumericLiteral"; + value: number; +} + +export interface NullLiteral extends BaseNode { + type: "NullLiteral"; +} + +export interface BooleanLiteral extends BaseNode { + type: "BooleanLiteral"; + value: boolean; +} + +export interface RegExpLiteral extends BaseNode { + type: "RegExpLiteral"; + pattern: string; + flags: string; +} + +export interface LogicalExpression extends BaseNode { + type: "LogicalExpression"; + operator: "||" | "&&" | "??"; + left: Expression; + right: Expression; +} + +export interface MemberExpression extends BaseNode { + type: "MemberExpression"; + object: Expression; + property: any; + computed: boolean; + optional: true | false | null; +} + +export interface NewExpression extends BaseNode { + type: "NewExpression"; + callee: Expression; + arguments: Array; + optional: true | false | null; + typeArguments: TypeParameterInstantiation | null; + typeParameters: TSTypeParameterInstantiation | null; +} + +export interface Program extends BaseNode { + type: "Program"; + body: Array; + directives: Array; + sourceType: "script" | "module"; + interpreter: InterpreterDirective | null; + sourceFile: string | null; +} + +export interface ObjectExpression extends BaseNode { + type: "ObjectExpression"; + properties: Array; +} + +export interface ObjectMethod extends BaseNode { + type: "ObjectMethod"; + kind: "method" | "get" | "set"; + key: any; + params: Array; + body: BlockStatement; + computed: boolean; + async: boolean; + decorators: Array | null; + generator: boolean; + returnType: TypeAnnotation | TSTypeAnnotation | Noop | null; + typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; +} + +export interface ObjectProperty extends BaseNode { + type: "ObjectProperty"; + key: any; + value: Expression | PatternLike; + computed: boolean; + shorthand: boolean; + decorators: Array | null; +} + +export interface RestElement extends BaseNode { + type: "RestElement"; + argument: LVal; + decorators: Array | null; + typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; +} + +export interface ReturnStatement extends BaseNode { + type: "ReturnStatement"; + argument: Expression | null; +} + +export interface SequenceExpression extends BaseNode { + type: "SequenceExpression"; + expressions: Array; +} + +export interface SwitchCase extends BaseNode { + type: "SwitchCase"; + test: Expression | null; + consequent: Array; +} + +export interface SwitchStatement extends BaseNode { + type: "SwitchStatement"; + discriminant: Expression; + cases: Array; +} + +export interface ThisExpression extends BaseNode { + type: "ThisExpression"; +} + +export interface ThrowStatement extends BaseNode { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends BaseNode { + type: "TryStatement"; + block: BlockStatement; + handler: CatchClause | null; + finalizer: BlockStatement | null; +} + +export interface UnaryExpression extends BaseNode { + type: "UnaryExpression"; + operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof"; + argument: Expression; + prefix: boolean; +} + +export interface UpdateExpression extends BaseNode { + type: "UpdateExpression"; + operator: "++" | "--"; + argument: Expression; + prefix: boolean; +} + +export interface VariableDeclaration extends BaseNode { + type: "VariableDeclaration"; + kind: "var" | "let" | "const"; + declarations: Array; + declare: boolean | null; +} + +export interface VariableDeclarator extends BaseNode { + type: "VariableDeclarator"; + id: LVal; + init: Expression | null; + definite: boolean | null; +} + +export interface WhileStatement extends BaseNode { + type: "WhileStatement"; + test: Expression; + body: BlockStatement | Statement; +} + +export interface WithStatement extends BaseNode { + type: "WithStatement"; + object: Expression; + body: BlockStatement | Statement; +} + +export interface AssignmentPattern extends BaseNode { + type: "AssignmentPattern"; + left: Identifier | ObjectPattern | ArrayPattern; + right: Expression; + decorators: Array | null; + typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; +} + +export interface ArrayPattern extends BaseNode { + type: "ArrayPattern"; + elements: Array; + decorators: Array | null; + typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; +} + +export interface ArrowFunctionExpression extends BaseNode { + type: "ArrowFunctionExpression"; + params: Array; + body: BlockStatement | Expression; + async: boolean; + expression: boolean | null; + generator: boolean; + returnType: TypeAnnotation | TSTypeAnnotation | Noop | null; + typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; +} + +export interface ClassBody extends BaseNode { + type: "ClassBody"; + body: Array; +} + +export interface ClassDeclaration extends BaseNode { + type: "ClassDeclaration"; + id: Identifier | null; + superClass: Expression | null; + body: ClassBody; + decorators: Array | null; + abstract: boolean | null; + declare: boolean | null; + implements: Array | null; + mixins: any | null; + superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation | null; + typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; +} + +export interface ClassExpression extends BaseNode { + type: "ClassExpression"; + id: Identifier | null; + superClass: Expression | null; + body: ClassBody; + decorators: Array | null; + implements: Array | null; + mixins: any | null; + superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation | null; + typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; +} + +export interface ExportAllDeclaration extends BaseNode { + type: "ExportAllDeclaration"; + source: StringLiteral; +} + +export interface ExportDefaultDeclaration extends BaseNode { + type: "ExportDefaultDeclaration"; + declaration: FunctionDeclaration | TSDeclareFunction | ClassDeclaration | Expression; +} + +export interface ExportNamedDeclaration extends BaseNode { + type: "ExportNamedDeclaration"; + declaration: Declaration | null; + specifiers: Array; + source: StringLiteral | null; +} + +export interface ExportSpecifier extends BaseNode { + type: "ExportSpecifier"; + local: Identifier; + exported: Identifier; +} + +export interface ForOfStatement extends BaseNode { + type: "ForOfStatement"; + left: VariableDeclaration | LVal; + right: Expression; + body: Statement; + await: boolean; +} + +export interface ImportDeclaration extends BaseNode { + type: "ImportDeclaration"; + specifiers: Array; + source: StringLiteral; + importKind: "type" | "typeof" | "value" | null; +} + +export interface ImportDefaultSpecifier extends BaseNode { + type: "ImportDefaultSpecifier"; + local: Identifier; +} + +export interface ImportNamespaceSpecifier extends BaseNode { + type: "ImportNamespaceSpecifier"; + local: Identifier; +} + +export interface ImportSpecifier extends BaseNode { + type: "ImportSpecifier"; + local: Identifier; + imported: Identifier; + importKind: "type" | "typeof" | null; +} + +export interface MetaProperty extends BaseNode { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export interface ClassMethod extends BaseNode { + type: "ClassMethod"; + kind: "get" | "set" | "method" | "constructor"; + key: Identifier | StringLiteral | NumericLiteral | Expression; + params: Array; + body: BlockStatement; + computed: boolean; + static: boolean | null; + abstract: boolean | null; + access: "public" | "private" | "protected" | null; + accessibility: "public" | "private" | "protected" | null; + async: boolean; + decorators: Array | null; + generator: boolean; + optional: boolean | null; + returnType: TypeAnnotation | TSTypeAnnotation | Noop | null; + typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; +} + +export interface ObjectPattern extends BaseNode { + type: "ObjectPattern"; + properties: Array; + decorators: Array | null; + typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; +} + +export interface SpreadElement extends BaseNode { + type: "SpreadElement"; + argument: Expression; +} + +export interface Super extends BaseNode { + type: "Super"; +} + +export interface TaggedTemplateExpression extends BaseNode { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; + typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation | null; +} + +export interface TemplateElement extends BaseNode { + type: "TemplateElement"; + value: any; + tail: boolean; +} + +export interface TemplateLiteral extends BaseNode { + type: "TemplateLiteral"; + quasis: Array; + expressions: Array; +} + +export interface YieldExpression extends BaseNode { + type: "YieldExpression"; + argument: Expression | null; + delegate: boolean; +} + +export interface AnyTypeAnnotation extends BaseNode { + type: "AnyTypeAnnotation"; +} + +export interface ArrayTypeAnnotation extends BaseNode { + type: "ArrayTypeAnnotation"; + elementType: FlowType; +} + +export interface BooleanTypeAnnotation extends BaseNode { + type: "BooleanTypeAnnotation"; +} + +export interface BooleanLiteralTypeAnnotation extends BaseNode { + type: "BooleanLiteralTypeAnnotation"; + value: boolean; +} + +export interface NullLiteralTypeAnnotation extends BaseNode { + type: "NullLiteralTypeAnnotation"; +} + +export interface ClassImplements extends BaseNode { + type: "ClassImplements"; + id: Identifier; + typeParameters: TypeParameterInstantiation | null; +} + +export interface DeclareClass extends BaseNode { + type: "DeclareClass"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + extends: Array | null; + body: ObjectTypeAnnotation; + implements: Array | null; + mixins: Array | null; +} + +export interface DeclareFunction extends BaseNode { + type: "DeclareFunction"; + id: Identifier; + predicate: DeclaredPredicate | null; +} + +export interface DeclareInterface extends BaseNode { + type: "DeclareInterface"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + extends: Array | null; + body: ObjectTypeAnnotation; + implements: Array | null; + mixins: Array | null; +} + +export interface DeclareModule extends BaseNode { + type: "DeclareModule"; + id: Identifier | StringLiteral; + body: BlockStatement; + kind: "CommonJS" | "ES" | null; +} + +export interface DeclareModuleExports extends BaseNode { + type: "DeclareModuleExports"; + typeAnnotation: TypeAnnotation; +} + +export interface DeclareTypeAlias extends BaseNode { + type: "DeclareTypeAlias"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + right: FlowType; +} + +export interface DeclareOpaqueType extends BaseNode { + type: "DeclareOpaqueType"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + supertype: FlowType | null; +} + +export interface DeclareVariable extends BaseNode { + type: "DeclareVariable"; + id: Identifier; +} + +export interface DeclareExportDeclaration extends BaseNode { + type: "DeclareExportDeclaration"; + declaration: Flow | null; + specifiers: Array | null; + source: StringLiteral | null; + default: boolean | null; +} + +export interface DeclareExportAllDeclaration extends BaseNode { + type: "DeclareExportAllDeclaration"; + source: StringLiteral; + exportKind: ["type","value"] | null; +} + +export interface DeclaredPredicate extends BaseNode { + type: "DeclaredPredicate"; + value: Flow; +} + +export interface ExistsTypeAnnotation extends BaseNode { + type: "ExistsTypeAnnotation"; +} + +export interface FunctionTypeAnnotation extends BaseNode { + type: "FunctionTypeAnnotation"; + typeParameters: TypeParameterDeclaration | null; + params: Array; + rest: FunctionTypeParam | null; + returnType: FlowType; +} + +export interface FunctionTypeParam extends BaseNode { + type: "FunctionTypeParam"; + name: Identifier | null; + typeAnnotation: FlowType; + optional: boolean | null; +} + +export interface GenericTypeAnnotation extends BaseNode { + type: "GenericTypeAnnotation"; + id: Identifier | QualifiedTypeIdentifier; + typeParameters: TypeParameterInstantiation | null; +} + +export interface InferredPredicate extends BaseNode { + type: "InferredPredicate"; +} + +export interface InterfaceExtends extends BaseNode { + type: "InterfaceExtends"; + id: Identifier | QualifiedTypeIdentifier; + typeParameters: TypeParameterInstantiation | null; +} + +export interface InterfaceDeclaration extends BaseNode { + type: "InterfaceDeclaration"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + extends: Array | null; + body: ObjectTypeAnnotation; + implements: Array | null; + mixins: Array | null; +} + +export interface InterfaceTypeAnnotation extends BaseNode { + type: "InterfaceTypeAnnotation"; + extends: Array | null; + body: ObjectTypeAnnotation; +} + +export interface IntersectionTypeAnnotation extends BaseNode { + type: "IntersectionTypeAnnotation"; + types: Array; +} + +export interface MixedTypeAnnotation extends BaseNode { + type: "MixedTypeAnnotation"; +} + +export interface EmptyTypeAnnotation extends BaseNode { + type: "EmptyTypeAnnotation"; +} + +export interface NullableTypeAnnotation extends BaseNode { + type: "NullableTypeAnnotation"; + typeAnnotation: FlowType; +} + +export interface NumberLiteralTypeAnnotation extends BaseNode { + type: "NumberLiteralTypeAnnotation"; + value: number; +} + +export interface NumberTypeAnnotation extends BaseNode { + type: "NumberTypeAnnotation"; +} + +export interface ObjectTypeAnnotation extends BaseNode { + type: "ObjectTypeAnnotation"; + properties: Array; + indexers: Array | null; + callProperties: Array | null; + internalSlots: Array | null; + exact: boolean; + inexact: boolean | null; +} + +export interface ObjectTypeInternalSlot extends BaseNode { + type: "ObjectTypeInternalSlot"; + id: Identifier; + value: FlowType; + optional: boolean; + static: boolean; + method: boolean; +} + +export interface ObjectTypeCallProperty extends BaseNode { + type: "ObjectTypeCallProperty"; + value: FlowType; + static: boolean | null; +} + +export interface ObjectTypeIndexer extends BaseNode { + type: "ObjectTypeIndexer"; + id: Identifier | null; + key: FlowType; + value: FlowType; + variance: Variance | null; + static: boolean | null; +} + +export interface ObjectTypeProperty extends BaseNode { + type: "ObjectTypeProperty"; + key: Identifier | StringLiteral; + value: FlowType; + variance: Variance | null; + kind: "init" | "get" | "set" | null; + optional: boolean | null; + proto: boolean | null; + static: boolean | null; +} + +export interface ObjectTypeSpreadProperty extends BaseNode { + type: "ObjectTypeSpreadProperty"; + argument: FlowType; +} + +export interface OpaqueType extends BaseNode { + type: "OpaqueType"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + supertype: FlowType | null; + impltype: FlowType; +} + +export interface QualifiedTypeIdentifier extends BaseNode { + type: "QualifiedTypeIdentifier"; + id: Identifier; + qualification: Identifier | QualifiedTypeIdentifier; +} + +export interface StringLiteralTypeAnnotation extends BaseNode { + type: "StringLiteralTypeAnnotation"; + value: string; +} + +export interface StringTypeAnnotation extends BaseNode { + type: "StringTypeAnnotation"; +} + +export interface ThisTypeAnnotation extends BaseNode { + type: "ThisTypeAnnotation"; +} + +export interface TupleTypeAnnotation extends BaseNode { + type: "TupleTypeAnnotation"; + types: Array; +} + +export interface TypeofTypeAnnotation extends BaseNode { + type: "TypeofTypeAnnotation"; + argument: FlowType; +} + +export interface TypeAlias extends BaseNode { + type: "TypeAlias"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + right: FlowType; +} + +export interface TypeAnnotation extends BaseNode { + type: "TypeAnnotation"; + typeAnnotation: FlowType; +} + +export interface TypeCastExpression extends BaseNode { + type: "TypeCastExpression"; + expression: Expression; + typeAnnotation: TypeAnnotation; +} + +export interface TypeParameter extends BaseNode { + type: "TypeParameter"; + bound: TypeAnnotation | null; + default: FlowType | null; + variance: Variance | null; + name: string | null; +} + +export interface TypeParameterDeclaration extends BaseNode { + type: "TypeParameterDeclaration"; + params: Array; +} + +export interface TypeParameterInstantiation extends BaseNode { + type: "TypeParameterInstantiation"; + params: Array; +} + +export interface UnionTypeAnnotation extends BaseNode { + type: "UnionTypeAnnotation"; + types: Array; +} + +export interface Variance extends BaseNode { + type: "Variance"; + kind: "minus" | "plus"; +} + +export interface VoidTypeAnnotation extends BaseNode { + type: "VoidTypeAnnotation"; +} + +export interface JSXAttribute extends BaseNode { + type: "JSXAttribute"; + name: JSXIdentifier | JSXNamespacedName; + value: JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer | null; +} + +export interface JSXClosingElement extends BaseNode { + type: "JSXClosingElement"; + name: JSXIdentifier | JSXMemberExpression; +} + +export interface JSXElement extends BaseNode { + type: "JSXElement"; + openingElement: JSXOpeningElement; + closingElement: JSXClosingElement | null; + children: Array; + selfClosing: any; +} + +export interface JSXEmptyExpression extends BaseNode { + type: "JSXEmptyExpression"; +} + +export interface JSXExpressionContainer extends BaseNode { + type: "JSXExpressionContainer"; + expression: Expression | JSXEmptyExpression; +} + +export interface JSXSpreadChild extends BaseNode { + type: "JSXSpreadChild"; + expression: Expression; +} + +export interface JSXIdentifier extends BaseNode { + type: "JSXIdentifier"; + name: string; +} + +export interface JSXMemberExpression extends BaseNode { + type: "JSXMemberExpression"; + object: JSXMemberExpression | JSXIdentifier; + property: JSXIdentifier; +} + +export interface JSXNamespacedName extends BaseNode { + type: "JSXNamespacedName"; + namespace: JSXIdentifier; + name: JSXIdentifier; +} + +export interface JSXOpeningElement extends BaseNode { + type: "JSXOpeningElement"; + name: JSXIdentifier | JSXMemberExpression; + attributes: Array; + selfClosing: boolean; + typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation | null; +} + +export interface JSXSpreadAttribute extends BaseNode { + type: "JSXSpreadAttribute"; + argument: Expression; +} + +export interface JSXText extends BaseNode { + type: "JSXText"; + value: string; +} + +export interface JSXFragment extends BaseNode { + type: "JSXFragment"; + openingFragment: JSXOpeningFragment; + closingFragment: JSXClosingFragment; + children: Array; +} + +export interface JSXOpeningFragment extends BaseNode { + type: "JSXOpeningFragment"; +} + +export interface JSXClosingFragment extends BaseNode { + type: "JSXClosingFragment"; +} + +export interface Noop extends BaseNode { + type: "Noop"; +} + +export interface ParenthesizedExpression extends BaseNode { + type: "ParenthesizedExpression"; + expression: Expression; +} + +export interface AwaitExpression extends BaseNode { + type: "AwaitExpression"; + argument: Expression; +} + +export interface BindExpression extends BaseNode { + type: "BindExpression"; + object: any; + callee: any; +} + +export interface ClassProperty extends BaseNode { + type: "ClassProperty"; + key: Identifier | StringLiteral | NumericLiteral | Expression; + value: Expression | null; + typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; + decorators: Array | null; + computed: boolean; + abstract: boolean | null; + accessibility: "public" | "private" | "protected" | null; + definite: boolean | null; + optional: boolean | null; + readonly: boolean | null; + static: boolean | null; +} + +export interface OptionalMemberExpression extends BaseNode { + type: "OptionalMemberExpression"; + object: Expression; + property: any; + computed: boolean; + optional: boolean; +} + +export interface PipelineTopicExpression extends BaseNode { + type: "PipelineTopicExpression"; + expression: Expression; +} + +export interface PipelineBareFunction extends BaseNode { + type: "PipelineBareFunction"; + callee: Expression; +} + +export interface PipelinePrimaryTopicReference extends BaseNode { + type: "PipelinePrimaryTopicReference"; +} + +export interface OptionalCallExpression extends BaseNode { + type: "OptionalCallExpression"; + callee: Expression; + arguments: Array; + optional: boolean; + typeArguments: TypeParameterInstantiation | null; + typeParameters: TSTypeParameterInstantiation | null; +} + +export interface ClassPrivateProperty extends BaseNode { + type: "ClassPrivateProperty"; + key: PrivateName; + value: Expression | null; +} + +export interface ClassPrivateMethod extends BaseNode { + type: "ClassPrivateMethod"; + kind: "get" | "set" | "method" | "constructor"; + key: PrivateName; + params: Array; + body: BlockStatement; + static: boolean | null; + abstract: boolean | null; + access: "public" | "private" | "protected" | null; + accessibility: "public" | "private" | "protected" | null; + async: boolean; + computed: boolean; + decorators: Array | null; + generator: boolean; + optional: boolean | null; + returnType: any | null; + typeParameters: any | null; +} + +export interface Import extends BaseNode { + type: "Import"; +} + +export interface Decorator extends BaseNode { + type: "Decorator"; + expression: Expression; +} + +export interface DoExpression extends BaseNode { + type: "DoExpression"; + body: BlockStatement; +} + +export interface ExportDefaultSpecifier extends BaseNode { + type: "ExportDefaultSpecifier"; + exported: Identifier; +} + +export interface ExportNamespaceSpecifier extends BaseNode { + type: "ExportNamespaceSpecifier"; + exported: Identifier; +} + +export interface PrivateName extends BaseNode { + type: "PrivateName"; + id: Identifier; +} + +export interface BigIntLiteral extends BaseNode { + type: "BigIntLiteral"; + value: string; +} + +export interface TSParameterProperty extends BaseNode { + type: "TSParameterProperty"; + parameter: Identifier | AssignmentPattern; + accessibility: "public" | "private" | "protected" | null; + readonly: boolean | null; +} + +export interface TSDeclareFunction extends BaseNode { + type: "TSDeclareFunction"; + id: Identifier | null; + typeParameters: TSTypeParameterDeclaration | Noop | null; + params: Array; + returnType: TSTypeAnnotation | Noop | null; + async: boolean; + declare: boolean | null; + generator: boolean; +} + +export interface TSDeclareMethod extends BaseNode { + type: "TSDeclareMethod"; + decorators: Array | null; + key: Identifier | StringLiteral | NumericLiteral | Expression; + typeParameters: TSTypeParameterDeclaration | Noop | null; + params: Array; + returnType: TSTypeAnnotation | Noop | null; + abstract: boolean | null; + access: "public" | "private" | "protected" | null; + accessibility: "public" | "private" | "protected" | null; + async: boolean; + computed: boolean; + generator: boolean; + kind: "get" | "set" | "method" | "constructor"; + optional: boolean | null; + static: boolean | null; +} + +export interface TSQualifiedName extends BaseNode { + type: "TSQualifiedName"; + left: TSEntityName; + right: Identifier; +} + +export interface TSCallSignatureDeclaration extends BaseNode { + type: "TSCallSignatureDeclaration"; + typeParameters: TSTypeParameterDeclaration | null; + parameters: Array | null; + typeAnnotation: TSTypeAnnotation | null; +} + +export interface TSConstructSignatureDeclaration extends BaseNode { + type: "TSConstructSignatureDeclaration"; + typeParameters: TSTypeParameterDeclaration | null; + parameters: Array | null; + typeAnnotation: TSTypeAnnotation | null; +} + +export interface TSPropertySignature extends BaseNode { + type: "TSPropertySignature"; + key: Expression; + typeAnnotation: TSTypeAnnotation | null; + initializer: Expression | null; + computed: boolean | null; + optional: boolean | null; + readonly: boolean | null; +} + +export interface TSMethodSignature extends BaseNode { + type: "TSMethodSignature"; + key: Expression; + typeParameters: TSTypeParameterDeclaration | null; + parameters: Array | null; + typeAnnotation: TSTypeAnnotation | null; + computed: boolean | null; + optional: boolean | null; +} + +export interface TSIndexSignature extends BaseNode { + type: "TSIndexSignature"; + parameters: Array; + typeAnnotation: TSTypeAnnotation | null; + readonly: boolean | null; +} + +export interface TSAnyKeyword extends BaseNode { + type: "TSAnyKeyword"; +} + +export interface TSUnknownKeyword extends BaseNode { + type: "TSUnknownKeyword"; +} + +export interface TSNumberKeyword extends BaseNode { + type: "TSNumberKeyword"; +} + +export interface TSObjectKeyword extends BaseNode { + type: "TSObjectKeyword"; +} + +export interface TSBooleanKeyword extends BaseNode { + type: "TSBooleanKeyword"; +} + +export interface TSStringKeyword extends BaseNode { + type: "TSStringKeyword"; +} + +export interface TSSymbolKeyword extends BaseNode { + type: "TSSymbolKeyword"; +} + +export interface TSVoidKeyword extends BaseNode { + type: "TSVoidKeyword"; +} + +export interface TSUndefinedKeyword extends BaseNode { + type: "TSUndefinedKeyword"; +} + +export interface TSNullKeyword extends BaseNode { + type: "TSNullKeyword"; +} + +export interface TSNeverKeyword extends BaseNode { + type: "TSNeverKeyword"; +} + +export interface TSThisType extends BaseNode { + type: "TSThisType"; +} + +export interface TSFunctionType extends BaseNode { + type: "TSFunctionType"; + typeParameters: TSTypeParameterDeclaration | null; + typeAnnotation: TSTypeAnnotation | null; + parameters: Array | null; +} + +export interface TSConstructorType extends BaseNode { + type: "TSConstructorType"; + typeParameters: TSTypeParameterDeclaration | null; + typeAnnotation: TSTypeAnnotation | null; + parameters: Array | null; +} + +export interface TSTypeReference extends BaseNode { + type: "TSTypeReference"; + typeName: TSEntityName; + typeParameters: TSTypeParameterInstantiation | null; +} + +export interface TSTypePredicate extends BaseNode { + type: "TSTypePredicate"; + parameterName: Identifier | TSThisType; + typeAnnotation: TSTypeAnnotation; +} + +export interface TSTypeQuery extends BaseNode { + type: "TSTypeQuery"; + exprName: TSEntityName | TSImportType; +} + +export interface TSTypeLiteral extends BaseNode { + type: "TSTypeLiteral"; + members: Array; +} + +export interface TSArrayType extends BaseNode { + type: "TSArrayType"; + elementType: TSType; +} + +export interface TSTupleType extends BaseNode { + type: "TSTupleType"; + elementTypes: Array; +} + +export interface TSOptionalType extends BaseNode { + type: "TSOptionalType"; + typeAnnotation: TSType; +} + +export interface TSRestType extends BaseNode { + type: "TSRestType"; + typeAnnotation: TSType; +} + +export interface TSUnionType extends BaseNode { + type: "TSUnionType"; + types: Array; +} + +export interface TSIntersectionType extends BaseNode { + type: "TSIntersectionType"; + types: Array; +} + +export interface TSConditionalType extends BaseNode { + type: "TSConditionalType"; + checkType: TSType; + extendsType: TSType; + trueType: TSType; + falseType: TSType; +} + +export interface TSInferType extends BaseNode { + type: "TSInferType"; + typeParameter: TSTypeParameter; +} + +export interface TSParenthesizedType extends BaseNode { + type: "TSParenthesizedType"; + typeAnnotation: TSType; +} + +export interface TSTypeOperator extends BaseNode { + type: "TSTypeOperator"; + typeAnnotation: TSType; + operator: string | null; +} + +export interface TSIndexedAccessType extends BaseNode { + type: "TSIndexedAccessType"; + objectType: TSType; + indexType: TSType; +} + +export interface TSMappedType extends BaseNode { + type: "TSMappedType"; + typeParameter: TSTypeParameter; + typeAnnotation: TSType | null; + optional: boolean | null; + readonly: boolean | null; +} + +export interface TSLiteralType extends BaseNode { + type: "TSLiteralType"; + literal: NumericLiteral | StringLiteral | BooleanLiteral; +} + +export interface TSExpressionWithTypeArguments extends BaseNode { + type: "TSExpressionWithTypeArguments"; + expression: TSEntityName; + typeParameters: TSTypeParameterInstantiation | null; +} + +export interface TSInterfaceDeclaration extends BaseNode { + type: "TSInterfaceDeclaration"; + id: Identifier; + typeParameters: TSTypeParameterDeclaration | null; + extends: Array | null; + body: TSInterfaceBody; + declare: boolean | null; +} + +export interface TSInterfaceBody extends BaseNode { + type: "TSInterfaceBody"; + body: Array; +} + +export interface TSTypeAliasDeclaration extends BaseNode { + type: "TSTypeAliasDeclaration"; + id: Identifier; + typeParameters: TSTypeParameterDeclaration | null; + typeAnnotation: TSType; + declare: boolean | null; +} + +export interface TSAsExpression extends BaseNode { + type: "TSAsExpression"; + expression: Expression; + typeAnnotation: TSType; +} + +export interface TSTypeAssertion extends BaseNode { + type: "TSTypeAssertion"; + typeAnnotation: TSType; + expression: Expression; +} + +export interface TSEnumDeclaration extends BaseNode { + type: "TSEnumDeclaration"; + id: Identifier; + members: Array; + const: boolean | null; + declare: boolean | null; + initializer: Expression | null; +} + +export interface TSEnumMember extends BaseNode { + type: "TSEnumMember"; + id: Identifier | StringLiteral; + initializer: Expression | null; +} + +export interface TSModuleDeclaration extends BaseNode { + type: "TSModuleDeclaration"; + id: Identifier | StringLiteral; + body: TSModuleBlock | TSModuleDeclaration; + declare: boolean | null; + global: boolean | null; +} + +export interface TSModuleBlock extends BaseNode { + type: "TSModuleBlock"; + body: Array; +} + +export interface TSImportType extends BaseNode { + type: "TSImportType"; + argument: StringLiteral; + qualifier: TSEntityName | null; + typeParameters: TSTypeParameterInstantiation | null; +} + +export interface TSImportEqualsDeclaration extends BaseNode { + type: "TSImportEqualsDeclaration"; + id: Identifier; + moduleReference: TSEntityName | TSExternalModuleReference; + isExport: boolean | null; +} + +export interface TSExternalModuleReference extends BaseNode { + type: "TSExternalModuleReference"; + expression: StringLiteral; +} + +export interface TSNonNullExpression extends BaseNode { + type: "TSNonNullExpression"; + expression: Expression; +} + +export interface TSExportAssignment extends BaseNode { + type: "TSExportAssignment"; + expression: Expression; +} + +export interface TSNamespaceExportDeclaration extends BaseNode { + type: "TSNamespaceExportDeclaration"; + id: Identifier; +} + +export interface TSTypeAnnotation extends BaseNode { + type: "TSTypeAnnotation"; + typeAnnotation: TSType; +} + +export interface TSTypeParameterInstantiation extends BaseNode { + type: "TSTypeParameterInstantiation"; + params: Array; +} + +export interface TSTypeParameterDeclaration extends BaseNode { + type: "TSTypeParameterDeclaration"; + params: Array; +} + +export interface TSTypeParameter extends BaseNode { + type: "TSTypeParameter"; + constraint: TSType | null; + default: TSType | null; + name: string | null; +} + +/** + * @deprecated Use `NumericLiteral` + */ +export type NumberLiteral = NumericLiteral; + +/** + * @deprecated Use `RegExpLiteral` + */ +export type RegexLiteral = RegExpLiteral; + +/** + * @deprecated Use `RestElement` + */ +export type RestProperty = RestElement; + +/** + * @deprecated Use `SpreadElement` + */ +export type SpreadProperty = SpreadElement; + +export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | TypeCastExpression | JSXElement | JSXFragment | ParenthesizedExpression | AwaitExpression | BindExpression | OptionalMemberExpression | PipelinePrimaryTopicReference | OptionalCallExpression | Import | DoExpression | BigIntLiteral | TSAsExpression | TSTypeAssertion | TSNonNullExpression; +export type Binary = BinaryExpression | LogicalExpression; +export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassDeclaration | ClassExpression | ForOfStatement | ClassMethod | ClassPrivateMethod; +export type BlockParent = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ForOfStatement | ClassMethod | ClassPrivateMethod; +export type Block = BlockStatement | Program; +export type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForStatement | FunctionDeclaration | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration | WhileStatement | WithStatement | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ForOfStatement | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias | TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSImportEqualsDeclaration | TSExportAssignment | TSNamespaceExportDeclaration; +export type Terminatorless = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | YieldExpression | AwaitExpression; +export type CompletionStatement = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement; +export type Conditional = ConditionalExpression | IfStatement; +export type Loop = DoWhileStatement | ForInStatement | ForStatement | WhileStatement | ForOfStatement; +export type While = DoWhileStatement | WhileStatement; +export type ExpressionWrapper = ExpressionStatement | TypeCastExpression | ParenthesizedExpression; +export type For = ForInStatement | ForStatement | ForOfStatement; +export type ForXStatement = ForInStatement | ForOfStatement; +export type Function = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod | ClassPrivateMethod; +export type FunctionParent = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod | ClassPrivateMethod; +export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | ArrowFunctionExpression | ClassDeclaration | ClassExpression | BigIntLiteral; +export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias | TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration; +export type PatternLike = Identifier | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern; +export type LVal = Identifier | MemberExpression | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern | TSParameterProperty; +export type TSEntityName = Identifier | TSQualifiedName; +export type Literal = StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | TemplateLiteral | BigIntLiteral; +export type Immutable = StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | JSXAttribute | JSXClosingElement | JSXElement | JSXExpressionContainer | JSXSpreadChild | JSXOpeningElement | JSXText | JSXFragment | JSXOpeningFragment | JSXClosingFragment | BigIntLiteral; +export type UserWhitespacable = ObjectMethod | ObjectProperty | ObjectTypeInternalSlot | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty | ObjectTypeSpreadProperty; +export type Method = ObjectMethod | ClassMethod | ClassPrivateMethod; +export type ObjectMember = ObjectMethod | ObjectProperty; +export type Property = ObjectProperty | ClassProperty | ClassPrivateProperty; +export type UnaryLike = UnaryExpression | SpreadElement; +export type Pattern = AssignmentPattern | ArrayPattern | ObjectPattern; +export type Class = ClassDeclaration | ClassExpression; +export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration; +export type ExportDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration; +export type ModuleSpecifier = ExportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier; +export type Flow = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullLiteralTypeAnnotation | ClassImplements | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | DeclaredPredicate | ExistsTypeAnnotation | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | InferredPredicate | InterfaceExtends | InterfaceDeclaration | InterfaceTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | ObjectTypeAnnotation | ObjectTypeInternalSlot | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | QualifiedTypeIdentifier | StringLiteralTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | UnionTypeAnnotation | Variance | VoidTypeAnnotation; +export type FlowType = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullLiteralTypeAnnotation | ExistsTypeAnnotation | FunctionTypeAnnotation | GenericTypeAnnotation | InterfaceTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | ObjectTypeAnnotation | StringLiteralTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | UnionTypeAnnotation | VoidTypeAnnotation; +export type FlowBaseAnnotation = AnyTypeAnnotation | BooleanTypeAnnotation | NullLiteralTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NumberTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | VoidTypeAnnotation; +export type FlowDeclaration = DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias; +export type FlowPredicate = DeclaredPredicate | InferredPredicate; +export type JSX = JSXAttribute | JSXClosingElement | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXSpreadChild | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXSpreadAttribute | JSXText | JSXFragment | JSXOpeningFragment | JSXClosingFragment; +export type Private = ClassPrivateProperty | ClassPrivateMethod | PrivateName; +export type TSTypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature; +export type TSType = TSAnyKeyword | TSUnknownKeyword | TSNumberKeyword | TSObjectKeyword | TSBooleanKeyword | TSStringKeyword | TSSymbolKeyword | TSVoidKeyword | TSUndefinedKeyword | TSNullKeyword | TSNeverKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSLiteralType | TSExpressionWithTypeArguments | TSImportType; + +export interface Aliases { + Expression: Expression; + Binary: Binary; + Scopable: Scopable; + BlockParent: BlockParent; + Block: Block; + Statement: Statement; + Terminatorless: Terminatorless; + CompletionStatement: CompletionStatement; + Conditional: Conditional; + Loop: Loop; + While: While; + ExpressionWrapper: ExpressionWrapper; + For: For; + ForXStatement: ForXStatement; + Function: Function; + FunctionParent: FunctionParent; + Pureish: Pureish; + Declaration: Declaration; + PatternLike: PatternLike; + LVal: LVal; + TSEntityName: TSEntityName; + Literal: Literal; + Immutable: Immutable; + UserWhitespacable: UserWhitespacable; + Method: Method; + ObjectMember: ObjectMember; + Property: Property; + UnaryLike: UnaryLike; + Pattern: Pattern; + Class: Class; + ModuleDeclaration: ModuleDeclaration; + ExportDeclaration: ExportDeclaration; + ModuleSpecifier: ModuleSpecifier; + Flow: Flow; + FlowType: FlowType; + FlowBaseAnnotation: FlowBaseAnnotation; + FlowDeclaration: FlowDeclaration; + FlowPredicate: FlowPredicate; + JSX: JSX; + Private: Private; + TSTypeElement: TSTypeElement; + TSType: TSType; +} + +export function arrayExpression(elements?: Array): ArrayExpression; +export function assignmentExpression(operator: string, left: LVal, right: Expression): AssignmentExpression; +export function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", left: Expression, right: Expression): BinaryExpression; +export function interpreterDirective(value: string): InterpreterDirective; +export function directive(value: DirectiveLiteral): Directive; +export function directiveLiteral(value: string): DirectiveLiteral; +export function blockStatement(body: Array, directives?: Array): BlockStatement; +export function breakStatement(label?: Identifier | null): BreakStatement; +export function callExpression(callee: Expression, _arguments: Array, optional?: true | false | null, typeArguments?: TypeParameterInstantiation | null, typeParameters?: TSTypeParameterInstantiation | null): CallExpression; +export function catchClause(param: Identifier | null | undefined, body: BlockStatement): CatchClause; +export function conditionalExpression(test: Expression, consequent: Expression, alternate: Expression): ConditionalExpression; +export function continueStatement(label?: Identifier | null): ContinueStatement; +export function debuggerStatement(): DebuggerStatement; +export function doWhileStatement(test: Expression, body: Statement): DoWhileStatement; +export function emptyStatement(): EmptyStatement; +export function expressionStatement(expression: Expression): ExpressionStatement; +export function file(program: Program, comments: any, tokens: any): File; +export function forInStatement(left: VariableDeclaration | LVal, right: Expression, body: Statement): ForInStatement; +export function forStatement(init: VariableDeclaration | Expression | null | undefined, test: Expression | null | undefined, update: Expression | null | undefined, body: Statement): ForStatement; +export function functionDeclaration(id: Identifier | null | undefined, params: Array, body: BlockStatement, generator?: boolean, async?: boolean, declare?: boolean | null, returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null, typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null): FunctionDeclaration; +export function functionExpression(id: Identifier | null | undefined, params: Array, body: BlockStatement, generator?: boolean, async?: boolean, returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null, typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null): FunctionExpression; +export function identifier(name: string, decorators?: Array | null, optional?: boolean | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null): Identifier; +export function ifStatement(test: Expression, consequent: Statement, alternate?: Statement | null): IfStatement; +export function labeledStatement(label: Identifier, body: Statement): LabeledStatement; +export function stringLiteral(value: string): StringLiteral; +export function numericLiteral(value: number): NumericLiteral; +export function nullLiteral(): NullLiteral; +export function booleanLiteral(value: boolean): BooleanLiteral; +export function regExpLiteral(pattern: string, flags?: string): RegExpLiteral; +export function logicalExpression(operator: "||" | "&&" | "??", left: Expression, right: Expression): LogicalExpression; +export function memberExpression(object: Expression, property: any, computed?: boolean, optional?: true | false | null): MemberExpression; +export function newExpression(callee: Expression, _arguments: Array, optional?: true | false | null, typeArguments?: TypeParameterInstantiation | null, typeParameters?: TSTypeParameterInstantiation | null): NewExpression; +export function program(body: Array, directives?: Array, sourceType?: "script" | "module", interpreter?: InterpreterDirective | null, sourceFile?: string | null): Program; +export function objectExpression(properties: Array): ObjectExpression; +export function objectMethod(kind: "method" | "get" | "set" | undefined, key: any, params: Array, body: BlockStatement, computed?: boolean, async?: boolean, decorators?: Array | null, generator?: boolean, returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null, typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null): ObjectMethod; +export function objectProperty(key: any, value: Expression | PatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array | null): ObjectProperty; +export function restElement(argument: LVal, decorators?: Array | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null): RestElement; +export function returnStatement(argument?: Expression | null): ReturnStatement; +export function sequenceExpression(expressions: Array): SequenceExpression; +export function switchCase(test: Expression | null | undefined, consequent: Array): SwitchCase; +export function switchStatement(discriminant: Expression, cases: Array): SwitchStatement; +export function thisExpression(): ThisExpression; +export function throwStatement(argument: Expression): ThrowStatement; +export function tryStatement(block: BlockStatement, handler?: CatchClause | null, finalizer?: BlockStatement | null): TryStatement; +export function unaryExpression(operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof", argument: Expression, prefix?: boolean): UnaryExpression; +export function updateExpression(operator: "++" | "--", argument: Expression, prefix?: boolean): UpdateExpression; +export function variableDeclaration(kind: "var" | "let" | "const", declarations: Array, declare?: boolean | null): VariableDeclaration; +export function variableDeclarator(id: LVal, init?: Expression | null, definite?: boolean | null): VariableDeclarator; +export function whileStatement(test: Expression, body: BlockStatement | Statement): WhileStatement; +export function withStatement(object: Expression, body: BlockStatement | Statement): WithStatement; +export function assignmentPattern(left: Identifier | ObjectPattern | ArrayPattern, right: Expression, decorators?: Array | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null): AssignmentPattern; +export function arrayPattern(elements: Array, decorators?: Array | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null): ArrayPattern; +export function arrowFunctionExpression(params: Array, body: BlockStatement | Expression, async?: boolean, expression?: boolean | null, generator?: boolean, returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null, typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null): ArrowFunctionExpression; +export function classBody(body: Array): ClassBody; +export function classDeclaration(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Array | null, abstract?: boolean | null, declare?: boolean | null, _implements?: Array | null, mixins?: any | null, superTypeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null, typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null): ClassDeclaration; +export function classExpression(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Array | null, _implements?: Array | null, mixins?: any | null, superTypeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null, typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null): ClassExpression; +export function exportAllDeclaration(source: StringLiteral): ExportAllDeclaration; +export function exportDefaultDeclaration(declaration: FunctionDeclaration | TSDeclareFunction | ClassDeclaration | Expression): ExportDefaultDeclaration; +export function exportNamedDeclaration(declaration: Declaration | null | undefined, specifiers: Array, source?: StringLiteral | null): ExportNamedDeclaration; +export function exportSpecifier(local: Identifier, exported: Identifier): ExportSpecifier; +export function forOfStatement(left: VariableDeclaration | LVal, right: Expression, body: Statement, _await?: boolean): ForOfStatement; +export function importDeclaration(specifiers: Array, source: StringLiteral, importKind?: "type" | "typeof" | "value" | null): ImportDeclaration; +export function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifier; +export function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier; +export function importSpecifier(local: Identifier, imported: Identifier, importKind?: "type" | "typeof" | null): ImportSpecifier; +export function metaProperty(meta: Identifier, property: Identifier): MetaProperty; +export function classMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: Identifier | StringLiteral | NumericLiteral | Expression, params: Array, body: BlockStatement, computed?: boolean, _static?: boolean | null, abstract?: boolean | null, access?: "public" | "private" | "protected" | null, accessibility?: "public" | "private" | "protected" | null, async?: boolean, decorators?: Array | null, generator?: boolean, optional?: boolean | null, returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null, typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null): ClassMethod; +export function objectPattern(properties: Array, decorators?: Array | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null): ObjectPattern; +export function spreadElement(argument: Expression): SpreadElement; +export function taggedTemplateExpression(tag: Expression, quasi: TemplateLiteral, typeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null): TaggedTemplateExpression; +export function templateElement(value: any, tail?: boolean): TemplateElement; +export function templateLiteral(quasis: Array, expressions: Array): TemplateLiteral; +export function yieldExpression(argument?: Expression | null, delegate?: boolean): YieldExpression; +export function anyTypeAnnotation(): AnyTypeAnnotation; +export function arrayTypeAnnotation(elementType: FlowType): ArrayTypeAnnotation; +export function booleanTypeAnnotation(): BooleanTypeAnnotation; +export function booleanLiteralTypeAnnotation(value: boolean): BooleanLiteralTypeAnnotation; +export function nullLiteralTypeAnnotation(): NullLiteralTypeAnnotation; +export function classImplements(id: Identifier, typeParameters?: TypeParameterInstantiation | null): ClassImplements; +export function declareClass(id: Identifier, typeParameters: TypeParameterDeclaration | null | undefined, _extends: Array | null | undefined, body: ObjectTypeAnnotation, _implements?: Array | null, mixins?: Array | null): DeclareClass; +export function declareFunction(id: Identifier, predicate?: DeclaredPredicate | null): DeclareFunction; +export function declareInterface(id: Identifier, typeParameters: TypeParameterDeclaration | null | undefined, _extends: Array | null | undefined, body: ObjectTypeAnnotation, _implements?: Array | null, mixins?: Array | null): DeclareInterface; +export function declareModule(id: Identifier | StringLiteral, body: BlockStatement, kind?: "CommonJS" | "ES" | null): DeclareModule; +export function declareModuleExports(typeAnnotation: TypeAnnotation): DeclareModuleExports; +export function declareTypeAlias(id: Identifier, typeParameters: TypeParameterDeclaration | null | undefined, right: FlowType): DeclareTypeAlias; +export function declareOpaqueType(id: Identifier, typeParameters?: TypeParameterDeclaration | null, supertype?: FlowType | null): DeclareOpaqueType; +export function declareVariable(id: Identifier): DeclareVariable; +export function declareExportDeclaration(declaration?: Flow | null, specifiers?: Array | null, source?: StringLiteral | null, _default?: boolean | null): DeclareExportDeclaration; +export function declareExportAllDeclaration(source: StringLiteral, exportKind?: ["type","value"] | null): DeclareExportAllDeclaration; +export function declaredPredicate(value: Flow): DeclaredPredicate; +export function existsTypeAnnotation(): ExistsTypeAnnotation; +export function functionTypeAnnotation(typeParameters: TypeParameterDeclaration | null | undefined, params: Array, rest: FunctionTypeParam | null | undefined, returnType: FlowType): FunctionTypeAnnotation; +export function functionTypeParam(name: Identifier | null | undefined, typeAnnotation: FlowType, optional?: boolean | null): FunctionTypeParam; +export function genericTypeAnnotation(id: Identifier | QualifiedTypeIdentifier, typeParameters?: TypeParameterInstantiation | null): GenericTypeAnnotation; +export function inferredPredicate(): InferredPredicate; +export function interfaceExtends(id: Identifier | QualifiedTypeIdentifier, typeParameters?: TypeParameterInstantiation | null): InterfaceExtends; +export function interfaceDeclaration(id: Identifier, typeParameters: TypeParameterDeclaration | null | undefined, _extends: Array | null | undefined, body: ObjectTypeAnnotation, _implements?: Array | null, mixins?: Array | null): InterfaceDeclaration; +export function interfaceTypeAnnotation(_extends: Array | null | undefined, body: ObjectTypeAnnotation): InterfaceTypeAnnotation; +export function intersectionTypeAnnotation(types: Array): IntersectionTypeAnnotation; +export function mixedTypeAnnotation(): MixedTypeAnnotation; +export function emptyTypeAnnotation(): EmptyTypeAnnotation; +export function nullableTypeAnnotation(typeAnnotation: FlowType): NullableTypeAnnotation; +export function numberLiteralTypeAnnotation(value: number): NumberLiteralTypeAnnotation; +export function numberTypeAnnotation(): NumberTypeAnnotation; +export function objectTypeAnnotation(properties: Array, indexers?: Array | null, callProperties?: Array | null, internalSlots?: Array | null, exact?: boolean, inexact?: boolean | null): ObjectTypeAnnotation; +export function objectTypeInternalSlot(id: Identifier, value: FlowType, optional: boolean, _static: boolean, method: boolean): ObjectTypeInternalSlot; +export function objectTypeCallProperty(value: FlowType, _static?: boolean | null): ObjectTypeCallProperty; +export function objectTypeIndexer(id: Identifier | null | undefined, key: FlowType, value: FlowType, variance?: Variance | null, _static?: boolean | null): ObjectTypeIndexer; +export function objectTypeProperty(key: Identifier | StringLiteral, value: FlowType, variance?: Variance | null, kind?: "init" | "get" | "set" | null, optional?: boolean | null, proto?: boolean | null, _static?: boolean | null): ObjectTypeProperty; +export function objectTypeSpreadProperty(argument: FlowType): ObjectTypeSpreadProperty; +export function opaqueType(id: Identifier, typeParameters: TypeParameterDeclaration | null | undefined, supertype: FlowType | null | undefined, impltype: FlowType): OpaqueType; +export function qualifiedTypeIdentifier(id: Identifier, qualification: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier; +export function stringLiteralTypeAnnotation(value: string): StringLiteralTypeAnnotation; +export function stringTypeAnnotation(): StringTypeAnnotation; +export function thisTypeAnnotation(): ThisTypeAnnotation; +export function tupleTypeAnnotation(types: Array): TupleTypeAnnotation; +export function typeofTypeAnnotation(argument: FlowType): TypeofTypeAnnotation; +export function typeAlias(id: Identifier, typeParameters: TypeParameterDeclaration | null | undefined, right: FlowType): TypeAlias; +export function typeAnnotation(typeAnnotation: FlowType): TypeAnnotation; +export function typeCastExpression(expression: Expression, typeAnnotation: TypeAnnotation): TypeCastExpression; +export function typeParameter(bound?: TypeAnnotation | null, _default?: FlowType | null, variance?: Variance | null, name?: string | null): TypeParameter; +export function typeParameterDeclaration(params: Array): TypeParameterDeclaration; +export function typeParameterInstantiation(params: Array): TypeParameterInstantiation; +export function unionTypeAnnotation(types: Array): UnionTypeAnnotation; +export function variance(kind: "minus" | "plus"): Variance; +export function voidTypeAnnotation(): VoidTypeAnnotation; +export function jsxAttribute(name: JSXIdentifier | JSXNamespacedName, value?: JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer | null): JSXAttribute; +export function jsxClosingElement(name: JSXIdentifier | JSXMemberExpression): JSXClosingElement; +export function jsxElement(openingElement: JSXOpeningElement, closingElement: JSXClosingElement | null | undefined, children: Array, selfClosing: any): JSXElement; +export function jsxEmptyExpression(): JSXEmptyExpression; +export function jsxExpressionContainer(expression: Expression | JSXEmptyExpression): JSXExpressionContainer; +export function jsxSpreadChild(expression: Expression): JSXSpreadChild; +export function jsxIdentifier(name: string): JSXIdentifier; +export function jsxMemberExpression(object: JSXMemberExpression | JSXIdentifier, property: JSXIdentifier): JSXMemberExpression; +export function jsxNamespacedName(namespace: JSXIdentifier, name: JSXIdentifier): JSXNamespacedName; +export function jsxOpeningElement(name: JSXIdentifier | JSXMemberExpression, attributes: Array, selfClosing?: boolean, typeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null): JSXOpeningElement; +export function jsxSpreadAttribute(argument: Expression): JSXSpreadAttribute; +export function jsxText(value: string): JSXText; +export function jsxFragment(openingFragment: JSXOpeningFragment, closingFragment: JSXClosingFragment, children: Array): JSXFragment; +export function jsxOpeningFragment(): JSXOpeningFragment; +export function jsxClosingFragment(): JSXClosingFragment; +export function noop(): Noop; +export function parenthesizedExpression(expression: Expression): ParenthesizedExpression; +export function awaitExpression(argument: Expression): AwaitExpression; +export function bindExpression(object: any, callee: any): BindExpression; +export function classProperty(key: Identifier | StringLiteral | NumericLiteral | Expression, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array | null, computed?: boolean, abstract?: boolean | null, accessibility?: "public" | "private" | "protected" | null, definite?: boolean | null, optional?: boolean | null, readonly?: boolean | null, _static?: boolean | null): ClassProperty; +export function optionalMemberExpression(object: Expression, property: any, computed: boolean | undefined, optional: boolean): OptionalMemberExpression; +export function pipelineTopicExpression(expression: Expression): PipelineTopicExpression; +export function pipelineBareFunction(callee: Expression): PipelineBareFunction; +export function pipelinePrimaryTopicReference(): PipelinePrimaryTopicReference; +export function optionalCallExpression(callee: Expression, _arguments: Array, optional: boolean, typeArguments?: TypeParameterInstantiation | null, typeParameters?: TSTypeParameterInstantiation | null): OptionalCallExpression; +export function classPrivateProperty(key: PrivateName, value?: Expression | null): ClassPrivateProperty; +export function classPrivateMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: PrivateName, params: Array, body: BlockStatement, _static?: boolean | null, abstract?: boolean | null, access?: "public" | "private" | "protected" | null, accessibility?: "public" | "private" | "protected" | null, async?: boolean, computed?: boolean, decorators?: Array | null, generator?: boolean, optional?: boolean | null, returnType?: any | null, typeParameters?: any | null): ClassPrivateMethod; +export function decorator(expression: Expression): Decorator; +export function doExpression(body: BlockStatement): DoExpression; +export function exportDefaultSpecifier(exported: Identifier): ExportDefaultSpecifier; +export function exportNamespaceSpecifier(exported: Identifier): ExportNamespaceSpecifier; +export function privateName(id: Identifier): PrivateName; +export function bigIntLiteral(value: string): BigIntLiteral; +export function tsParameterProperty(parameter: Identifier | AssignmentPattern, accessibility?: "public" | "private" | "protected" | null, readonly?: boolean | null): TSParameterProperty; +export function tsDeclareFunction(id: Identifier | null | undefined, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array, returnType?: TSTypeAnnotation | Noop | null, async?: boolean, declare?: boolean | null, generator?: boolean): TSDeclareFunction; +export function tsDeclareMethod(decorators: Array | null | undefined, key: Identifier | StringLiteral | NumericLiteral | Expression, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array, returnType?: TSTypeAnnotation | Noop | null, abstract?: boolean | null, access?: "public" | "private" | "protected" | null, accessibility?: "public" | "private" | "protected" | null, async?: boolean, computed?: boolean, generator?: boolean, kind?: "get" | "set" | "method" | "constructor", optional?: boolean | null, _static?: boolean | null): TSDeclareMethod; +export function tsQualifiedName(left: TSEntityName, right: Identifier): TSQualifiedName; +export function tsCallSignatureDeclaration(typeParameters?: TSTypeParameterDeclaration | null, parameters?: Array | null, typeAnnotation?: TSTypeAnnotation | null): TSCallSignatureDeclaration; +export function tsConstructSignatureDeclaration(typeParameters?: TSTypeParameterDeclaration | null, parameters?: Array | null, typeAnnotation?: TSTypeAnnotation | null): TSConstructSignatureDeclaration; +export function tsPropertySignature(key: Expression, typeAnnotation?: TSTypeAnnotation | null, initializer?: Expression | null, computed?: boolean | null, optional?: boolean | null, readonly?: boolean | null): TSPropertySignature; +export function tsMethodSignature(key: Expression, typeParameters?: TSTypeParameterDeclaration | null, parameters?: Array | null, typeAnnotation?: TSTypeAnnotation | null, computed?: boolean | null, optional?: boolean | null): TSMethodSignature; +export function tsIndexSignature(parameters: Array, typeAnnotation?: TSTypeAnnotation | null, readonly?: boolean | null): TSIndexSignature; +export function tsAnyKeyword(): TSAnyKeyword; +export function tsUnknownKeyword(): TSUnknownKeyword; +export function tsNumberKeyword(): TSNumberKeyword; +export function tsObjectKeyword(): TSObjectKeyword; +export function tsBooleanKeyword(): TSBooleanKeyword; +export function tsStringKeyword(): TSStringKeyword; +export function tsSymbolKeyword(): TSSymbolKeyword; +export function tsVoidKeyword(): TSVoidKeyword; +export function tsUndefinedKeyword(): TSUndefinedKeyword; +export function tsNullKeyword(): TSNullKeyword; +export function tsNeverKeyword(): TSNeverKeyword; +export function tsThisType(): TSThisType; +export function tsFunctionType(typeParameters?: TSTypeParameterDeclaration | null, typeAnnotation?: TSTypeAnnotation | null, parameters?: Array | null): TSFunctionType; +export function tsConstructorType(typeParameters?: TSTypeParameterDeclaration | null, typeAnnotation?: TSTypeAnnotation | null, parameters?: Array | null): TSConstructorType; +export function tsTypeReference(typeName: TSEntityName, typeParameters?: TSTypeParameterInstantiation | null): TSTypeReference; +export function tsTypePredicate(parameterName: Identifier | TSThisType, typeAnnotation: TSTypeAnnotation): TSTypePredicate; +export function tsTypeQuery(exprName: TSEntityName | TSImportType): TSTypeQuery; +export function tsTypeLiteral(members: Array): TSTypeLiteral; +export function tsArrayType(elementType: TSType): TSArrayType; +export function tsTupleType(elementTypes: Array): TSTupleType; +export function tsOptionalType(typeAnnotation: TSType): TSOptionalType; +export function tsRestType(typeAnnotation: TSType): TSRestType; +export function tsUnionType(types: Array): TSUnionType; +export function tsIntersectionType(types: Array): TSIntersectionType; +export function tsConditionalType(checkType: TSType, extendsType: TSType, trueType: TSType, falseType: TSType): TSConditionalType; +export function tsInferType(typeParameter: TSTypeParameter): TSInferType; +export function tsParenthesizedType(typeAnnotation: TSType): TSParenthesizedType; +export function tsTypeOperator(typeAnnotation: TSType, operator?: string | null): TSTypeOperator; +export function tsIndexedAccessType(objectType: TSType, indexType: TSType): TSIndexedAccessType; +export function tsMappedType(typeParameter: TSTypeParameter, typeAnnotation?: TSType | null, optional?: boolean | null, readonly?: boolean | null): TSMappedType; +export function tsLiteralType(literal: NumericLiteral | StringLiteral | BooleanLiteral): TSLiteralType; +export function tsExpressionWithTypeArguments(expression: TSEntityName, typeParameters?: TSTypeParameterInstantiation | null): TSExpressionWithTypeArguments; +export function tsInterfaceDeclaration(id: Identifier, typeParameters: TSTypeParameterDeclaration | null | undefined, _extends: Array | null | undefined, body: TSInterfaceBody, declare?: boolean | null): TSInterfaceDeclaration; +export function tsInterfaceBody(body: Array): TSInterfaceBody; +export function tsTypeAliasDeclaration(id: Identifier, typeParameters: TSTypeParameterDeclaration | null | undefined, typeAnnotation: TSType, declare?: boolean | null): TSTypeAliasDeclaration; +export function tsAsExpression(expression: Expression, typeAnnotation: TSType): TSAsExpression; +export function tsTypeAssertion(typeAnnotation: TSType, expression: Expression): TSTypeAssertion; +export function tsEnumDeclaration(id: Identifier, members: Array, _const?: boolean | null, declare?: boolean | null, initializer?: Expression | null): TSEnumDeclaration; +export function tsEnumMember(id: Identifier | StringLiteral, initializer?: Expression | null): TSEnumMember; +export function tsModuleDeclaration(id: Identifier | StringLiteral, body: TSModuleBlock | TSModuleDeclaration, declare?: boolean | null, global?: boolean | null): TSModuleDeclaration; +export function tsModuleBlock(body: Array): TSModuleBlock; +export function tsImportType(argument: StringLiteral, qualifier?: TSEntityName | null, typeParameters?: TSTypeParameterInstantiation | null): TSImportType; +export function tsImportEqualsDeclaration(id: Identifier, moduleReference: TSEntityName | TSExternalModuleReference, isExport?: boolean | null): TSImportEqualsDeclaration; +export function tsExternalModuleReference(expression: StringLiteral): TSExternalModuleReference; +export function tsNonNullExpression(expression: Expression): TSNonNullExpression; +export function tsExportAssignment(expression: Expression): TSExportAssignment; +export function tsNamespaceExportDeclaration(id: Identifier): TSNamespaceExportDeclaration; +export function tsTypeAnnotation(typeAnnotation: TSType): TSTypeAnnotation; +export function tsTypeParameterInstantiation(params: Array): TSTypeParameterInstantiation; +export function tsTypeParameterDeclaration(params: Array): TSTypeParameterDeclaration; +export function tsTypeParameter(constraint?: TSType | null, _default?: TSType | null, name?: string | null): TSTypeParameter; +export function isAnyTypeAnnotation(node: object | null | undefined, opts?: object | null): node is AnyTypeAnnotation; +export function isArrayExpression(node: object | null | undefined, opts?: object | null): node is ArrayExpression; +export function isArrayPattern(node: object | null | undefined, opts?: object | null): node is ArrayPattern; +export function isArrayTypeAnnotation(node: object | null | undefined, opts?: object | null): node is ArrayTypeAnnotation; +export function isArrowFunctionExpression(node: object | null | undefined, opts?: object | null): node is ArrowFunctionExpression; +export function isAssignmentExpression(node: object | null | undefined, opts?: object | null): node is AssignmentExpression; +export function isAssignmentPattern(node: object | null | undefined, opts?: object | null): node is AssignmentPattern; +export function isAwaitExpression(node: object | null | undefined, opts?: object | null): node is AwaitExpression; +export function isBigIntLiteral(node: object | null | undefined, opts?: object | null): node is BigIntLiteral; +export function isBinary(node: object | null | undefined, opts?: object | null): node is Binary; +export function isBinaryExpression(node: object | null | undefined, opts?: object | null): node is BinaryExpression; +export function isBindExpression(node: object | null | undefined, opts?: object | null): node is BindExpression; +export function isBlock(node: object | null | undefined, opts?: object | null): node is Block; +export function isBlockParent(node: object | null | undefined, opts?: object | null): node is BlockParent; +export function isBlockStatement(node: object | null | undefined, opts?: object | null): node is BlockStatement; +export function isBooleanLiteral(node: object | null | undefined, opts?: object | null): node is BooleanLiteral; +export function isBooleanLiteralTypeAnnotation(node: object | null | undefined, opts?: object | null): node is BooleanLiteralTypeAnnotation; +export function isBooleanTypeAnnotation(node: object | null | undefined, opts?: object | null): node is BooleanTypeAnnotation; +export function isBreakStatement(node: object | null | undefined, opts?: object | null): node is BreakStatement; +export function isCallExpression(node: object | null | undefined, opts?: object | null): node is CallExpression; +export function isCatchClause(node: object | null | undefined, opts?: object | null): node is CatchClause; +export function isClass(node: object | null | undefined, opts?: object | null): node is Class; +export function isClassBody(node: object | null | undefined, opts?: object | null): node is ClassBody; +export function isClassDeclaration(node: object | null | undefined, opts?: object | null): node is ClassDeclaration; +export function isClassExpression(node: object | null | undefined, opts?: object | null): node is ClassExpression; +export function isClassImplements(node: object | null | undefined, opts?: object | null): node is ClassImplements; +export function isClassMethod(node: object | null | undefined, opts?: object | null): node is ClassMethod; +export function isClassPrivateMethod(node: object | null | undefined, opts?: object | null): node is ClassPrivateMethod; +export function isClassPrivateProperty(node: object | null | undefined, opts?: object | null): node is ClassPrivateProperty; +export function isClassProperty(node: object | null | undefined, opts?: object | null): node is ClassProperty; +export function isCompletionStatement(node: object | null | undefined, opts?: object | null): node is CompletionStatement; +export function isConditional(node: object | null | undefined, opts?: object | null): node is Conditional; +export function isConditionalExpression(node: object | null | undefined, opts?: object | null): node is ConditionalExpression; +export function isContinueStatement(node: object | null | undefined, opts?: object | null): node is ContinueStatement; +export function isDebuggerStatement(node: object | null | undefined, opts?: object | null): node is DebuggerStatement; +export function isDeclaration(node: object | null | undefined, opts?: object | null): node is Declaration; +export function isDeclareClass(node: object | null | undefined, opts?: object | null): node is DeclareClass; +export function isDeclareExportAllDeclaration(node: object | null | undefined, opts?: object | null): node is DeclareExportAllDeclaration; +export function isDeclareExportDeclaration(node: object | null | undefined, opts?: object | null): node is DeclareExportDeclaration; +export function isDeclareFunction(node: object | null | undefined, opts?: object | null): node is DeclareFunction; +export function isDeclareInterface(node: object | null | undefined, opts?: object | null): node is DeclareInterface; +export function isDeclareModule(node: object | null | undefined, opts?: object | null): node is DeclareModule; +export function isDeclareModuleExports(node: object | null | undefined, opts?: object | null): node is DeclareModuleExports; +export function isDeclareOpaqueType(node: object | null | undefined, opts?: object | null): node is DeclareOpaqueType; +export function isDeclareTypeAlias(node: object | null | undefined, opts?: object | null): node is DeclareTypeAlias; +export function isDeclareVariable(node: object | null | undefined, opts?: object | null): node is DeclareVariable; +export function isDeclaredPredicate(node: object | null | undefined, opts?: object | null): node is DeclaredPredicate; +export function isDecorator(node: object | null | undefined, opts?: object | null): node is Decorator; +export function isDirective(node: object | null | undefined, opts?: object | null): node is Directive; +export function isDirectiveLiteral(node: object | null | undefined, opts?: object | null): node is DirectiveLiteral; +export function isDoExpression(node: object | null | undefined, opts?: object | null): node is DoExpression; +export function isDoWhileStatement(node: object | null | undefined, opts?: object | null): node is DoWhileStatement; +export function isEmptyStatement(node: object | null | undefined, opts?: object | null): node is EmptyStatement; +export function isEmptyTypeAnnotation(node: object | null | undefined, opts?: object | null): node is EmptyTypeAnnotation; +export function isExistsTypeAnnotation(node: object | null | undefined, opts?: object | null): node is ExistsTypeAnnotation; +export function isExportAllDeclaration(node: object | null | undefined, opts?: object | null): node is ExportAllDeclaration; +export function isExportDeclaration(node: object | null | undefined, opts?: object | null): node is ExportDeclaration; +export function isExportDefaultDeclaration(node: object | null | undefined, opts?: object | null): node is ExportDefaultDeclaration; +export function isExportDefaultSpecifier(node: object | null | undefined, opts?: object | null): node is ExportDefaultSpecifier; +export function isExportNamedDeclaration(node: object | null | undefined, opts?: object | null): node is ExportNamedDeclaration; +export function isExportNamespaceSpecifier(node: object | null | undefined, opts?: object | null): node is ExportNamespaceSpecifier; +export function isExportSpecifier(node: object | null | undefined, opts?: object | null): node is ExportSpecifier; +export function isExpression(node: object | null | undefined, opts?: object | null): node is Expression; +export function isExpressionStatement(node: object | null | undefined, opts?: object | null): node is ExpressionStatement; +export function isExpressionWrapper(node: object | null | undefined, opts?: object | null): node is ExpressionWrapper; +export function isFile(node: object | null | undefined, opts?: object | null): node is File; +export function isFlow(node: object | null | undefined, opts?: object | null): node is Flow; +export function isFlowBaseAnnotation(node: object | null | undefined, opts?: object | null): node is FlowBaseAnnotation; +export function isFlowDeclaration(node: object | null | undefined, opts?: object | null): node is FlowDeclaration; +export function isFlowPredicate(node: object | null | undefined, opts?: object | null): node is FlowPredicate; +export function isFlowType(node: object | null | undefined, opts?: object | null): node is FlowType; +export function isFor(node: object | null | undefined, opts?: object | null): node is For; +export function isForInStatement(node: object | null | undefined, opts?: object | null): node is ForInStatement; +export function isForOfStatement(node: object | null | undefined, opts?: object | null): node is ForOfStatement; +export function isForStatement(node: object | null | undefined, opts?: object | null): node is ForStatement; +export function isForXStatement(node: object | null | undefined, opts?: object | null): node is ForXStatement; +export function isFunction(node: object | null | undefined, opts?: object | null): node is Function; +export function isFunctionDeclaration(node: object | null | undefined, opts?: object | null): node is FunctionDeclaration; +export function isFunctionExpression(node: object | null | undefined, opts?: object | null): node is FunctionExpression; +export function isFunctionParent(node: object | null | undefined, opts?: object | null): node is FunctionParent; +export function isFunctionTypeAnnotation(node: object | null | undefined, opts?: object | null): node is FunctionTypeAnnotation; +export function isFunctionTypeParam(node: object | null | undefined, opts?: object | null): node is FunctionTypeParam; +export function isGenericTypeAnnotation(node: object | null | undefined, opts?: object | null): node is GenericTypeAnnotation; +export function isIdentifier(node: object | null | undefined, opts?: object | null): node is Identifier; +export function isIfStatement(node: object | null | undefined, opts?: object | null): node is IfStatement; +export function isImmutable(node: object | null | undefined, opts?: object | null): node is Immutable; +export function isImport(node: object | null | undefined, opts?: object | null): node is Import; +export function isImportDeclaration(node: object | null | undefined, opts?: object | null): node is ImportDeclaration; +export function isImportDefaultSpecifier(node: object | null | undefined, opts?: object | null): node is ImportDefaultSpecifier; +export function isImportNamespaceSpecifier(node: object | null | undefined, opts?: object | null): node is ImportNamespaceSpecifier; +export function isImportSpecifier(node: object | null | undefined, opts?: object | null): node is ImportSpecifier; +export function isInferredPredicate(node: object | null | undefined, opts?: object | null): node is InferredPredicate; +export function isInterfaceDeclaration(node: object | null | undefined, opts?: object | null): node is InterfaceDeclaration; +export function isInterfaceExtends(node: object | null | undefined, opts?: object | null): node is InterfaceExtends; +export function isInterfaceTypeAnnotation(node: object | null | undefined, opts?: object | null): node is InterfaceTypeAnnotation; +export function isInterpreterDirective(node: object | null | undefined, opts?: object | null): node is InterpreterDirective; +export function isIntersectionTypeAnnotation(node: object | null | undefined, opts?: object | null): node is IntersectionTypeAnnotation; +export function isJSX(node: object | null | undefined, opts?: object | null): node is JSX; +export function isJSXAttribute(node: object | null | undefined, opts?: object | null): node is JSXAttribute; +export function isJSXClosingElement(node: object | null | undefined, opts?: object | null): node is JSXClosingElement; +export function isJSXClosingFragment(node: object | null | undefined, opts?: object | null): node is JSXClosingFragment; +export function isJSXElement(node: object | null | undefined, opts?: object | null): node is JSXElement; +export function isJSXEmptyExpression(node: object | null | undefined, opts?: object | null): node is JSXEmptyExpression; +export function isJSXExpressionContainer(node: object | null | undefined, opts?: object | null): node is JSXExpressionContainer; +export function isJSXFragment(node: object | null | undefined, opts?: object | null): node is JSXFragment; +export function isJSXIdentifier(node: object | null | undefined, opts?: object | null): node is JSXIdentifier; +export function isJSXMemberExpression(node: object | null | undefined, opts?: object | null): node is JSXMemberExpression; +export function isJSXNamespacedName(node: object | null | undefined, opts?: object | null): node is JSXNamespacedName; +export function isJSXOpeningElement(node: object | null | undefined, opts?: object | null): node is JSXOpeningElement; +export function isJSXOpeningFragment(node: object | null | undefined, opts?: object | null): node is JSXOpeningFragment; +export function isJSXSpreadAttribute(node: object | null | undefined, opts?: object | null): node is JSXSpreadAttribute; +export function isJSXSpreadChild(node: object | null | undefined, opts?: object | null): node is JSXSpreadChild; +export function isJSXText(node: object | null | undefined, opts?: object | null): node is JSXText; +export function isLVal(node: object | null | undefined, opts?: object | null): node is LVal; +export function isLabeledStatement(node: object | null | undefined, opts?: object | null): node is LabeledStatement; +export function isLiteral(node: object | null | undefined, opts?: object | null): node is Literal; +export function isLogicalExpression(node: object | null | undefined, opts?: object | null): node is LogicalExpression; +export function isLoop(node: object | null | undefined, opts?: object | null): node is Loop; +export function isMemberExpression(node: object | null | undefined, opts?: object | null): node is MemberExpression; +export function isMetaProperty(node: object | null | undefined, opts?: object | null): node is MetaProperty; +export function isMethod(node: object | null | undefined, opts?: object | null): node is Method; +export function isMixedTypeAnnotation(node: object | null | undefined, opts?: object | null): node is MixedTypeAnnotation; +export function isModuleDeclaration(node: object | null | undefined, opts?: object | null): node is ModuleDeclaration; +export function isModuleSpecifier(node: object | null | undefined, opts?: object | null): node is ModuleSpecifier; +export function isNewExpression(node: object | null | undefined, opts?: object | null): node is NewExpression; +export function isNoop(node: object | null | undefined, opts?: object | null): node is Noop; +export function isNullLiteral(node: object | null | undefined, opts?: object | null): node is NullLiteral; +export function isNullLiteralTypeAnnotation(node: object | null | undefined, opts?: object | null): node is NullLiteralTypeAnnotation; +export function isNullableTypeAnnotation(node: object | null | undefined, opts?: object | null): node is NullableTypeAnnotation; +export function isNumberLiteral(node: object | null | undefined, opts?: object | null): boolean; +export function isNumberLiteralTypeAnnotation(node: object | null | undefined, opts?: object | null): node is NumberLiteralTypeAnnotation; +export function isNumberTypeAnnotation(node: object | null | undefined, opts?: object | null): node is NumberTypeAnnotation; +export function isNumericLiteral(node: object | null | undefined, opts?: object | null): node is NumericLiteral; +export function isObjectExpression(node: object | null | undefined, opts?: object | null): node is ObjectExpression; +export function isObjectMember(node: object | null | undefined, opts?: object | null): node is ObjectMember; +export function isObjectMethod(node: object | null | undefined, opts?: object | null): node is ObjectMethod; +export function isObjectPattern(node: object | null | undefined, opts?: object | null): node is ObjectPattern; +export function isObjectProperty(node: object | null | undefined, opts?: object | null): node is ObjectProperty; +export function isObjectTypeAnnotation(node: object | null | undefined, opts?: object | null): node is ObjectTypeAnnotation; +export function isObjectTypeCallProperty(node: object | null | undefined, opts?: object | null): node is ObjectTypeCallProperty; +export function isObjectTypeIndexer(node: object | null | undefined, opts?: object | null): node is ObjectTypeIndexer; +export function isObjectTypeInternalSlot(node: object | null | undefined, opts?: object | null): node is ObjectTypeInternalSlot; +export function isObjectTypeProperty(node: object | null | undefined, opts?: object | null): node is ObjectTypeProperty; +export function isObjectTypeSpreadProperty(node: object | null | undefined, opts?: object | null): node is ObjectTypeSpreadProperty; +export function isOpaqueType(node: object | null | undefined, opts?: object | null): node is OpaqueType; +export function isOptionalCallExpression(node: object | null | undefined, opts?: object | null): node is OptionalCallExpression; +export function isOptionalMemberExpression(node: object | null | undefined, opts?: object | null): node is OptionalMemberExpression; +export function isParenthesizedExpression(node: object | null | undefined, opts?: object | null): node is ParenthesizedExpression; +export function isPattern(node: object | null | undefined, opts?: object | null): node is Pattern; +export function isPatternLike(node: object | null | undefined, opts?: object | null): node is PatternLike; +export function isPipelineBareFunction(node: object | null | undefined, opts?: object | null): node is PipelineBareFunction; +export function isPipelinePrimaryTopicReference(node: object | null | undefined, opts?: object | null): node is PipelinePrimaryTopicReference; +export function isPipelineTopicExpression(node: object | null | undefined, opts?: object | null): node is PipelineTopicExpression; +export function isPrivate(node: object | null | undefined, opts?: object | null): node is Private; +export function isPrivateName(node: object | null | undefined, opts?: object | null): node is PrivateName; +export function isProgram(node: object | null | undefined, opts?: object | null): node is Program; +export function isProperty(node: object | null | undefined, opts?: object | null): node is Property; +export function isPureish(node: object | null | undefined, opts?: object | null): node is Pureish; +export function isQualifiedTypeIdentifier(node: object | null | undefined, opts?: object | null): node is QualifiedTypeIdentifier; +export function isRegExpLiteral(node: object | null | undefined, opts?: object | null): node is RegExpLiteral; +export function isRegexLiteral(node: object | null | undefined, opts?: object | null): boolean; +export function isRestElement(node: object | null | undefined, opts?: object | null): node is RestElement; +export function isRestProperty(node: object | null | undefined, opts?: object | null): boolean; +export function isReturnStatement(node: object | null | undefined, opts?: object | null): node is ReturnStatement; +export function isScopable(node: object | null | undefined, opts?: object | null): node is Scopable; +export function isSequenceExpression(node: object | null | undefined, opts?: object | null): node is SequenceExpression; +export function isSpreadElement(node: object | null | undefined, opts?: object | null): node is SpreadElement; +export function isSpreadProperty(node: object | null | undefined, opts?: object | null): boolean; +export function isStatement(node: object | null | undefined, opts?: object | null): node is Statement; +export function isStringLiteral(node: object | null | undefined, opts?: object | null): node is StringLiteral; +export function isStringLiteralTypeAnnotation(node: object | null | undefined, opts?: object | null): node is StringLiteralTypeAnnotation; +export function isStringTypeAnnotation(node: object | null | undefined, opts?: object | null): node is StringTypeAnnotation; +export function isSuper(node: object | null | undefined, opts?: object | null): node is Super; +export function isSwitchCase(node: object | null | undefined, opts?: object | null): node is SwitchCase; +export function isSwitchStatement(node: object | null | undefined, opts?: object | null): node is SwitchStatement; +export function isTSAnyKeyword(node: object | null | undefined, opts?: object | null): node is TSAnyKeyword; +export function isTSArrayType(node: object | null | undefined, opts?: object | null): node is TSArrayType; +export function isTSAsExpression(node: object | null | undefined, opts?: object | null): node is TSAsExpression; +export function isTSBooleanKeyword(node: object | null | undefined, opts?: object | null): node is TSBooleanKeyword; +export function isTSCallSignatureDeclaration(node: object | null | undefined, opts?: object | null): node is TSCallSignatureDeclaration; +export function isTSConditionalType(node: object | null | undefined, opts?: object | null): node is TSConditionalType; +export function isTSConstructSignatureDeclaration(node: object | null | undefined, opts?: object | null): node is TSConstructSignatureDeclaration; +export function isTSConstructorType(node: object | null | undefined, opts?: object | null): node is TSConstructorType; +export function isTSDeclareFunction(node: object | null | undefined, opts?: object | null): node is TSDeclareFunction; +export function isTSDeclareMethod(node: object | null | undefined, opts?: object | null): node is TSDeclareMethod; +export function isTSEntityName(node: object | null | undefined, opts?: object | null): node is TSEntityName; +export function isTSEnumDeclaration(node: object | null | undefined, opts?: object | null): node is TSEnumDeclaration; +export function isTSEnumMember(node: object | null | undefined, opts?: object | null): node is TSEnumMember; +export function isTSExportAssignment(node: object | null | undefined, opts?: object | null): node is TSExportAssignment; +export function isTSExpressionWithTypeArguments(node: object | null | undefined, opts?: object | null): node is TSExpressionWithTypeArguments; +export function isTSExternalModuleReference(node: object | null | undefined, opts?: object | null): node is TSExternalModuleReference; +export function isTSFunctionType(node: object | null | undefined, opts?: object | null): node is TSFunctionType; +export function isTSImportEqualsDeclaration(node: object | null | undefined, opts?: object | null): node is TSImportEqualsDeclaration; +export function isTSImportType(node: object | null | undefined, opts?: object | null): node is TSImportType; +export function isTSIndexSignature(node: object | null | undefined, opts?: object | null): node is TSIndexSignature; +export function isTSIndexedAccessType(node: object | null | undefined, opts?: object | null): node is TSIndexedAccessType; +export function isTSInferType(node: object | null | undefined, opts?: object | null): node is TSInferType; +export function isTSInterfaceBody(node: object | null | undefined, opts?: object | null): node is TSInterfaceBody; +export function isTSInterfaceDeclaration(node: object | null | undefined, opts?: object | null): node is TSInterfaceDeclaration; +export function isTSIntersectionType(node: object | null | undefined, opts?: object | null): node is TSIntersectionType; +export function isTSLiteralType(node: object | null | undefined, opts?: object | null): node is TSLiteralType; +export function isTSMappedType(node: object | null | undefined, opts?: object | null): node is TSMappedType; +export function isTSMethodSignature(node: object | null | undefined, opts?: object | null): node is TSMethodSignature; +export function isTSModuleBlock(node: object | null | undefined, opts?: object | null): node is TSModuleBlock; +export function isTSModuleDeclaration(node: object | null | undefined, opts?: object | null): node is TSModuleDeclaration; +export function isTSNamespaceExportDeclaration(node: object | null | undefined, opts?: object | null): node is TSNamespaceExportDeclaration; +export function isTSNeverKeyword(node: object | null | undefined, opts?: object | null): node is TSNeverKeyword; +export function isTSNonNullExpression(node: object | null | undefined, opts?: object | null): node is TSNonNullExpression; +export function isTSNullKeyword(node: object | null | undefined, opts?: object | null): node is TSNullKeyword; +export function isTSNumberKeyword(node: object | null | undefined, opts?: object | null): node is TSNumberKeyword; +export function isTSObjectKeyword(node: object | null | undefined, opts?: object | null): node is TSObjectKeyword; +export function isTSOptionalType(node: object | null | undefined, opts?: object | null): node is TSOptionalType; +export function isTSParameterProperty(node: object | null | undefined, opts?: object | null): node is TSParameterProperty; +export function isTSParenthesizedType(node: object | null | undefined, opts?: object | null): node is TSParenthesizedType; +export function isTSPropertySignature(node: object | null | undefined, opts?: object | null): node is TSPropertySignature; +export function isTSQualifiedName(node: object | null | undefined, opts?: object | null): node is TSQualifiedName; +export function isTSRestType(node: object | null | undefined, opts?: object | null): node is TSRestType; +export function isTSStringKeyword(node: object | null | undefined, opts?: object | null): node is TSStringKeyword; +export function isTSSymbolKeyword(node: object | null | undefined, opts?: object | null): node is TSSymbolKeyword; +export function isTSThisType(node: object | null | undefined, opts?: object | null): node is TSThisType; +export function isTSTupleType(node: object | null | undefined, opts?: object | null): node is TSTupleType; +export function isTSType(node: object | null | undefined, opts?: object | null): node is TSType; +export function isTSTypeAliasDeclaration(node: object | null | undefined, opts?: object | null): node is TSTypeAliasDeclaration; +export function isTSTypeAnnotation(node: object | null | undefined, opts?: object | null): node is TSTypeAnnotation; +export function isTSTypeAssertion(node: object | null | undefined, opts?: object | null): node is TSTypeAssertion; +export function isTSTypeElement(node: object | null | undefined, opts?: object | null): node is TSTypeElement; +export function isTSTypeLiteral(node: object | null | undefined, opts?: object | null): node is TSTypeLiteral; +export function isTSTypeOperator(node: object | null | undefined, opts?: object | null): node is TSTypeOperator; +export function isTSTypeParameter(node: object | null | undefined, opts?: object | null): node is TSTypeParameter; +export function isTSTypeParameterDeclaration(node: object | null | undefined, opts?: object | null): node is TSTypeParameterDeclaration; +export function isTSTypeParameterInstantiation(node: object | null | undefined, opts?: object | null): node is TSTypeParameterInstantiation; +export function isTSTypePredicate(node: object | null | undefined, opts?: object | null): node is TSTypePredicate; +export function isTSTypeQuery(node: object | null | undefined, opts?: object | null): node is TSTypeQuery; +export function isTSTypeReference(node: object | null | undefined, opts?: object | null): node is TSTypeReference; +export function isTSUndefinedKeyword(node: object | null | undefined, opts?: object | null): node is TSUndefinedKeyword; +export function isTSUnionType(node: object | null | undefined, opts?: object | null): node is TSUnionType; +export function isTSUnknownKeyword(node: object | null | undefined, opts?: object | null): node is TSUnknownKeyword; +export function isTSVoidKeyword(node: object | null | undefined, opts?: object | null): node is TSVoidKeyword; +export function isTaggedTemplateExpression(node: object | null | undefined, opts?: object | null): node is TaggedTemplateExpression; +export function isTemplateElement(node: object | null | undefined, opts?: object | null): node is TemplateElement; +export function isTemplateLiteral(node: object | null | undefined, opts?: object | null): node is TemplateLiteral; +export function isTerminatorless(node: object | null | undefined, opts?: object | null): node is Terminatorless; +export function isThisExpression(node: object | null | undefined, opts?: object | null): node is ThisExpression; +export function isThisTypeAnnotation(node: object | null | undefined, opts?: object | null): node is ThisTypeAnnotation; +export function isThrowStatement(node: object | null | undefined, opts?: object | null): node is ThrowStatement; +export function isTryStatement(node: object | null | undefined, opts?: object | null): node is TryStatement; +export function isTupleTypeAnnotation(node: object | null | undefined, opts?: object | null): node is TupleTypeAnnotation; +export function isTypeAlias(node: object | null | undefined, opts?: object | null): node is TypeAlias; +export function isTypeAnnotation(node: object | null | undefined, opts?: object | null): node is TypeAnnotation; +export function isTypeCastExpression(node: object | null | undefined, opts?: object | null): node is TypeCastExpression; +export function isTypeParameter(node: object | null | undefined, opts?: object | null): node is TypeParameter; +export function isTypeParameterDeclaration(node: object | null | undefined, opts?: object | null): node is TypeParameterDeclaration; +export function isTypeParameterInstantiation(node: object | null | undefined, opts?: object | null): node is TypeParameterInstantiation; +export function isTypeofTypeAnnotation(node: object | null | undefined, opts?: object | null): node is TypeofTypeAnnotation; +export function isUnaryExpression(node: object | null | undefined, opts?: object | null): node is UnaryExpression; +export function isUnaryLike(node: object | null | undefined, opts?: object | null): node is UnaryLike; +export function isUnionTypeAnnotation(node: object | null | undefined, opts?: object | null): node is UnionTypeAnnotation; +export function isUpdateExpression(node: object | null | undefined, opts?: object | null): node is UpdateExpression; +export function isUserWhitespacable(node: object | null | undefined, opts?: object | null): node is UserWhitespacable; +export function isVariableDeclaration(node: object | null | undefined, opts?: object | null): node is VariableDeclaration; +export function isVariableDeclarator(node: object | null | undefined, opts?: object | null): node is VariableDeclarator; +export function isVariance(node: object | null | undefined, opts?: object | null): node is Variance; +export function isVoidTypeAnnotation(node: object | null | undefined, opts?: object | null): node is VoidTypeAnnotation; +export function isWhile(node: object | null | undefined, opts?: object | null): node is While; +export function isWhileStatement(node: object | null | undefined, opts?: object | null): node is WhileStatement; +export function isWithStatement(node: object | null | undefined, opts?: object | null): node is WithStatement; +export function isYieldExpression(node: object | null | undefined, opts?: object | null): node is YieldExpression; +export function validate(n: Node, key: string, value: any): void; +export function clone(n: T): T; +export function cloneDeep(n: T): T; +export function removeProperties( + n: Node, + opts?: { preserveComments: boolean } | null +): void; +export function removePropertiesDeep( + n: T, + opts?: { preserveComments: boolean } | null +): T; +export type TraversalAncestors = ReadonlyArray<{ + node: Node, + key: string, + index?: number, +}>; +export type TraversalHandler = (node: Node, parent: TraversalAncestors, type: T) => void; +export type TraversalHandlers = { + enter?: TraversalHandler, + exit?: TraversalHandler, +}; +export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.js index dc6952d70657ab..8d9df04d7ba4a9 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.js @@ -1,10 +1,14 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); var _exportNames = { + react: true, assertNode: true, createTypeAnnotationBasedOnTypeof: true, createUnionTypeAnnotation: true, + cloneNode: true, clone: true, cloneDeep: true, cloneWithoutLoc: true, @@ -52,10 +56,321 @@ var _exportNames = { isVar: true, matchesPattern: true, validate: true, - buildMatchMemberExpression: true, - react: true + buildMatchMemberExpression: true }; -exports.react = exports.buildMatchMemberExpression = exports.validate = exports.matchesPattern = exports.isVar = exports.isValidIdentifier = exports.isValidES3Identifier = exports.isType = exports.isSpecifierDefault = exports.isScope = exports.isReferenced = exports.isNodesEquivalent = exports.isNode = exports.isLet = exports.isImmutable = exports.isBlockScoped = exports.isBinding = exports.is = exports.shallowEqual = exports.traverseFast = exports.traverse = exports.getOuterBindingIdentifiers = exports.getBindingIdentifiers = exports.removeTypeDuplicates = exports.removePropertiesDeep = exports.removeProperties = exports.prependToMemberExpression = exports.inherits = exports.appendToMemberExpression = exports.valueToNode = exports.toStatement = exports.toSequenceExpression = exports.toKeyAlias = exports.toIdentifier = exports.toExpression = exports.toComputedKey = exports.toBlock = exports.toBindingIdentifierName = exports.ensureBlock = exports.removeComments = exports.inheritTrailingComments = exports.inheritsComments = exports.inheritLeadingComments = exports.inheritInnerComments = exports.addComments = exports.addComment = exports.cloneWithoutLoc = exports.cloneDeep = exports.clone = exports.createUnionTypeAnnotation = exports.createTypeAnnotationBasedOnTypeof = exports.assertNode = void 0; +Object.defineProperty(exports, "assertNode", { + enumerable: true, + get: function () { + return _assertNode.default; + } +}); +Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", { + enumerable: true, + get: function () { + return _createTypeAnnotationBasedOnTypeof.default; + } +}); +Object.defineProperty(exports, "createUnionTypeAnnotation", { + enumerable: true, + get: function () { + return _createUnionTypeAnnotation.default; + } +}); +Object.defineProperty(exports, "cloneNode", { + enumerable: true, + get: function () { + return _cloneNode.default; + } +}); +Object.defineProperty(exports, "clone", { + enumerable: true, + get: function () { + return _clone.default; + } +}); +Object.defineProperty(exports, "cloneDeep", { + enumerable: true, + get: function () { + return _cloneDeep.default; + } +}); +Object.defineProperty(exports, "cloneWithoutLoc", { + enumerable: true, + get: function () { + return _cloneWithoutLoc.default; + } +}); +Object.defineProperty(exports, "addComment", { + enumerable: true, + get: function () { + return _addComment.default; + } +}); +Object.defineProperty(exports, "addComments", { + enumerable: true, + get: function () { + return _addComments.default; + } +}); +Object.defineProperty(exports, "inheritInnerComments", { + enumerable: true, + get: function () { + return _inheritInnerComments.default; + } +}); +Object.defineProperty(exports, "inheritLeadingComments", { + enumerable: true, + get: function () { + return _inheritLeadingComments.default; + } +}); +Object.defineProperty(exports, "inheritsComments", { + enumerable: true, + get: function () { + return _inheritsComments.default; + } +}); +Object.defineProperty(exports, "inheritTrailingComments", { + enumerable: true, + get: function () { + return _inheritTrailingComments.default; + } +}); +Object.defineProperty(exports, "removeComments", { + enumerable: true, + get: function () { + return _removeComments.default; + } +}); +Object.defineProperty(exports, "ensureBlock", { + enumerable: true, + get: function () { + return _ensureBlock.default; + } +}); +Object.defineProperty(exports, "toBindingIdentifierName", { + enumerable: true, + get: function () { + return _toBindingIdentifierName.default; + } +}); +Object.defineProperty(exports, "toBlock", { + enumerable: true, + get: function () { + return _toBlock.default; + } +}); +Object.defineProperty(exports, "toComputedKey", { + enumerable: true, + get: function () { + return _toComputedKey.default; + } +}); +Object.defineProperty(exports, "toExpression", { + enumerable: true, + get: function () { + return _toExpression.default; + } +}); +Object.defineProperty(exports, "toIdentifier", { + enumerable: true, + get: function () { + return _toIdentifier.default; + } +}); +Object.defineProperty(exports, "toKeyAlias", { + enumerable: true, + get: function () { + return _toKeyAlias.default; + } +}); +Object.defineProperty(exports, "toSequenceExpression", { + enumerable: true, + get: function () { + return _toSequenceExpression.default; + } +}); +Object.defineProperty(exports, "toStatement", { + enumerable: true, + get: function () { + return _toStatement.default; + } +}); +Object.defineProperty(exports, "valueToNode", { + enumerable: true, + get: function () { + return _valueToNode.default; + } +}); +Object.defineProperty(exports, "appendToMemberExpression", { + enumerable: true, + get: function () { + return _appendToMemberExpression.default; + } +}); +Object.defineProperty(exports, "inherits", { + enumerable: true, + get: function () { + return _inherits.default; + } +}); +Object.defineProperty(exports, "prependToMemberExpression", { + enumerable: true, + get: function () { + return _prependToMemberExpression.default; + } +}); +Object.defineProperty(exports, "removeProperties", { + enumerable: true, + get: function () { + return _removeProperties.default; + } +}); +Object.defineProperty(exports, "removePropertiesDeep", { + enumerable: true, + get: function () { + return _removePropertiesDeep.default; + } +}); +Object.defineProperty(exports, "removeTypeDuplicates", { + enumerable: true, + get: function () { + return _removeTypeDuplicates.default; + } +}); +Object.defineProperty(exports, "getBindingIdentifiers", { + enumerable: true, + get: function () { + return _getBindingIdentifiers.default; + } +}); +Object.defineProperty(exports, "getOuterBindingIdentifiers", { + enumerable: true, + get: function () { + return _getOuterBindingIdentifiers.default; + } +}); +Object.defineProperty(exports, "traverse", { + enumerable: true, + get: function () { + return _traverse.default; + } +}); +Object.defineProperty(exports, "traverseFast", { + enumerable: true, + get: function () { + return _traverseFast.default; + } +}); +Object.defineProperty(exports, "shallowEqual", { + enumerable: true, + get: function () { + return _shallowEqual.default; + } +}); +Object.defineProperty(exports, "is", { + enumerable: true, + get: function () { + return _is.default; + } +}); +Object.defineProperty(exports, "isBinding", { + enumerable: true, + get: function () { + return _isBinding.default; + } +}); +Object.defineProperty(exports, "isBlockScoped", { + enumerable: true, + get: function () { + return _isBlockScoped.default; + } +}); +Object.defineProperty(exports, "isImmutable", { + enumerable: true, + get: function () { + return _isImmutable.default; + } +}); +Object.defineProperty(exports, "isLet", { + enumerable: true, + get: function () { + return _isLet.default; + } +}); +Object.defineProperty(exports, "isNode", { + enumerable: true, + get: function () { + return _isNode.default; + } +}); +Object.defineProperty(exports, "isNodesEquivalent", { + enumerable: true, + get: function () { + return _isNodesEquivalent.default; + } +}); +Object.defineProperty(exports, "isReferenced", { + enumerable: true, + get: function () { + return _isReferenced.default; + } +}); +Object.defineProperty(exports, "isScope", { + enumerable: true, + get: function () { + return _isScope.default; + } +}); +Object.defineProperty(exports, "isSpecifierDefault", { + enumerable: true, + get: function () { + return _isSpecifierDefault.default; + } +}); +Object.defineProperty(exports, "isType", { + enumerable: true, + get: function () { + return _isType.default; + } +}); +Object.defineProperty(exports, "isValidES3Identifier", { + enumerable: true, + get: function () { + return _isValidES3Identifier.default; + } +}); +Object.defineProperty(exports, "isValidIdentifier", { + enumerable: true, + get: function () { + return _isValidIdentifier.default; + } +}); +Object.defineProperty(exports, "isVar", { + enumerable: true, + get: function () { + return _isVar.default; + } +}); +Object.defineProperty(exports, "matchesPattern", { + enumerable: true, + get: function () { + return _matchesPattern.default; + } +}); +Object.defineProperty(exports, "validate", { + enumerable: true, + get: function () { + return _validate.default; + } +}); +Object.defineProperty(exports, "buildMatchMemberExpression", { + enumerable: true, + get: function () { + return _buildMatchMemberExpression.default; + } +}); +exports.react = void 0; var _isReactComponent = _interopRequireDefault(require("./validators/react/isReactComponent")); @@ -65,78 +380,69 @@ var _buildChildren = _interopRequireDefault(require("./builders/react/buildChild var _assertNode = _interopRequireDefault(require("./asserts/assertNode")); -exports.assertNode = _assertNode.default; - var _generated = require("./asserts/generated"); Object.keys(_generated).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - exports[key] = _generated[key]; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _generated[key]; + } + }); }); var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(require("./builders/flow/createTypeAnnotationBasedOnTypeof")); -exports.createTypeAnnotationBasedOnTypeof = _createTypeAnnotationBasedOnTypeof.default; - var _createUnionTypeAnnotation = _interopRequireDefault(require("./builders/flow/createUnionTypeAnnotation")); -exports.createUnionTypeAnnotation = _createUnionTypeAnnotation.default; - var _generated2 = require("./builders/generated"); Object.keys(_generated2).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - exports[key] = _generated2[key]; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _generated2[key]; + } + }); }); -var _clone = _interopRequireDefault(require("./clone/clone")); +var _cloneNode = _interopRequireDefault(require("./clone/cloneNode")); -exports.clone = _clone.default; +var _clone = _interopRequireDefault(require("./clone/clone")); var _cloneDeep = _interopRequireDefault(require("./clone/cloneDeep")); -exports.cloneDeep = _cloneDeep.default; - var _cloneWithoutLoc = _interopRequireDefault(require("./clone/cloneWithoutLoc")); -exports.cloneWithoutLoc = _cloneWithoutLoc.default; - var _addComment = _interopRequireDefault(require("./comments/addComment")); -exports.addComment = _addComment.default; - var _addComments = _interopRequireDefault(require("./comments/addComments")); -exports.addComments = _addComments.default; - var _inheritInnerComments = _interopRequireDefault(require("./comments/inheritInnerComments")); -exports.inheritInnerComments = _inheritInnerComments.default; - var _inheritLeadingComments = _interopRequireDefault(require("./comments/inheritLeadingComments")); -exports.inheritLeadingComments = _inheritLeadingComments.default; - var _inheritsComments = _interopRequireDefault(require("./comments/inheritsComments")); -exports.inheritsComments = _inheritsComments.default; - var _inheritTrailingComments = _interopRequireDefault(require("./comments/inheritTrailingComments")); -exports.inheritTrailingComments = _inheritTrailingComments.default; - var _removeComments = _interopRequireDefault(require("./comments/removeComments")); -exports.removeComments = _removeComments.default; - var _generated3 = require("./constants/generated"); Object.keys(_generated3).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - exports[key] = _generated3[key]; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _generated3[key]; + } + }); }); var _constants = require("./constants"); @@ -144,180 +450,119 @@ var _constants = require("./constants"); Object.keys(_constants).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - exports[key] = _constants[key]; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _constants[key]; + } + }); }); var _ensureBlock = _interopRequireDefault(require("./converters/ensureBlock")); -exports.ensureBlock = _ensureBlock.default; - var _toBindingIdentifierName = _interopRequireDefault(require("./converters/toBindingIdentifierName")); -exports.toBindingIdentifierName = _toBindingIdentifierName.default; - var _toBlock = _interopRequireDefault(require("./converters/toBlock")); -exports.toBlock = _toBlock.default; - var _toComputedKey = _interopRequireDefault(require("./converters/toComputedKey")); -exports.toComputedKey = _toComputedKey.default; - var _toExpression = _interopRequireDefault(require("./converters/toExpression")); -exports.toExpression = _toExpression.default; - var _toIdentifier = _interopRequireDefault(require("./converters/toIdentifier")); -exports.toIdentifier = _toIdentifier.default; - var _toKeyAlias = _interopRequireDefault(require("./converters/toKeyAlias")); -exports.toKeyAlias = _toKeyAlias.default; - var _toSequenceExpression = _interopRequireDefault(require("./converters/toSequenceExpression")); -exports.toSequenceExpression = _toSequenceExpression.default; - var _toStatement = _interopRequireDefault(require("./converters/toStatement")); -exports.toStatement = _toStatement.default; - var _valueToNode = _interopRequireDefault(require("./converters/valueToNode")); -exports.valueToNode = _valueToNode.default; - var _definitions = require("./definitions"); Object.keys(_definitions).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - exports[key] = _definitions[key]; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _definitions[key]; + } + }); }); var _appendToMemberExpression = _interopRequireDefault(require("./modifications/appendToMemberExpression")); -exports.appendToMemberExpression = _appendToMemberExpression.default; - var _inherits = _interopRequireDefault(require("./modifications/inherits")); -exports.inherits = _inherits.default; - var _prependToMemberExpression = _interopRequireDefault(require("./modifications/prependToMemberExpression")); -exports.prependToMemberExpression = _prependToMemberExpression.default; - var _removeProperties = _interopRequireDefault(require("./modifications/removeProperties")); -exports.removeProperties = _removeProperties.default; - var _removePropertiesDeep = _interopRequireDefault(require("./modifications/removePropertiesDeep")); -exports.removePropertiesDeep = _removePropertiesDeep.default; - var _removeTypeDuplicates = _interopRequireDefault(require("./modifications/flow/removeTypeDuplicates")); -exports.removeTypeDuplicates = _removeTypeDuplicates.default; - var _getBindingIdentifiers = _interopRequireDefault(require("./retrievers/getBindingIdentifiers")); -exports.getBindingIdentifiers = _getBindingIdentifiers.default; - var _getOuterBindingIdentifiers = _interopRequireDefault(require("./retrievers/getOuterBindingIdentifiers")); -exports.getOuterBindingIdentifiers = _getOuterBindingIdentifiers.default; - var _traverse = _interopRequireDefault(require("./traverse/traverse")); -exports.traverse = _traverse.default; - var _traverseFast = _interopRequireDefault(require("./traverse/traverseFast")); -exports.traverseFast = _traverseFast.default; - var _shallowEqual = _interopRequireDefault(require("./utils/shallowEqual")); -exports.shallowEqual = _shallowEqual.default; - var _is = _interopRequireDefault(require("./validators/is")); -exports.is = _is.default; - var _isBinding = _interopRequireDefault(require("./validators/isBinding")); -exports.isBinding = _isBinding.default; - var _isBlockScoped = _interopRequireDefault(require("./validators/isBlockScoped")); -exports.isBlockScoped = _isBlockScoped.default; - var _isImmutable = _interopRequireDefault(require("./validators/isImmutable")); -exports.isImmutable = _isImmutable.default; - var _isLet = _interopRequireDefault(require("./validators/isLet")); -exports.isLet = _isLet.default; - var _isNode = _interopRequireDefault(require("./validators/isNode")); -exports.isNode = _isNode.default; - var _isNodesEquivalent = _interopRequireDefault(require("./validators/isNodesEquivalent")); -exports.isNodesEquivalent = _isNodesEquivalent.default; - var _isReferenced = _interopRequireDefault(require("./validators/isReferenced")); -exports.isReferenced = _isReferenced.default; - var _isScope = _interopRequireDefault(require("./validators/isScope")); -exports.isScope = _isScope.default; - var _isSpecifierDefault = _interopRequireDefault(require("./validators/isSpecifierDefault")); -exports.isSpecifierDefault = _isSpecifierDefault.default; - var _isType = _interopRequireDefault(require("./validators/isType")); -exports.isType = _isType.default; - var _isValidES3Identifier = _interopRequireDefault(require("./validators/isValidES3Identifier")); -exports.isValidES3Identifier = _isValidES3Identifier.default; - var _isValidIdentifier = _interopRequireDefault(require("./validators/isValidIdentifier")); -exports.isValidIdentifier = _isValidIdentifier.default; - var _isVar = _interopRequireDefault(require("./validators/isVar")); -exports.isVar = _isVar.default; - var _matchesPattern = _interopRequireDefault(require("./validators/matchesPattern")); -exports.matchesPattern = _matchesPattern.default; - var _validate = _interopRequireDefault(require("./validators/validate")); -exports.validate = _validate.default; - var _buildMatchMemberExpression = _interopRequireDefault(require("./validators/buildMatchMemberExpression")); -exports.buildMatchMemberExpression = _buildMatchMemberExpression.default; - var _generated4 = require("./validators/generated"); Object.keys(_generated4).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; - exports[key] = _generated4[key]; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _generated4[key]; + } + }); }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var react = { +const react = { isReactComponent: _isReactComponent.default, isCompatTag: _isCompatTag.default, buildChildren: _buildChildren.default diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.js.flow b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.js.flow new file mode 100644 index 00000000000000..f3e3e39df963ed --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/index.js.flow @@ -0,0 +1,1960 @@ +// NOTE: This file is autogenerated. Do not modify. +// See packages/babel-types/scripts/generators/flow.js for script used. + +declare class BabelNodeComment { + value: string; + start: number; + end: number; + loc: BabelNodeSourceLocation; +} + +declare class BabelNodeCommentBlock extends BabelNodeComment { + type: "CommentBlock"; +} + +declare class BabelNodeCommentLine extends BabelNodeComment { + type: "CommentLine"; +} + +declare class BabelNodeSourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +declare class BabelNode { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation; +} + +declare class BabelNodeArrayExpression extends BabelNode { + type: "ArrayExpression"; + elements?: Array; +} + +declare class BabelNodeAssignmentExpression extends BabelNode { + type: "AssignmentExpression"; + operator: string; + left: BabelNodeLVal; + right: BabelNodeExpression; +} + +declare class BabelNodeBinaryExpression extends BabelNode { + type: "BinaryExpression"; + operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<="; + left: BabelNodeExpression; + right: BabelNodeExpression; +} + +declare class BabelNodeInterpreterDirective extends BabelNode { + type: "InterpreterDirective"; + value: string; +} + +declare class BabelNodeDirective extends BabelNode { + type: "Directive"; + value: BabelNodeDirectiveLiteral; +} + +declare class BabelNodeDirectiveLiteral extends BabelNode { + type: "DirectiveLiteral"; + value: string; +} + +declare class BabelNodeBlockStatement extends BabelNode { + type: "BlockStatement"; + body: Array; + directives?: Array; +} + +declare class BabelNodeBreakStatement extends BabelNode { + type: "BreakStatement"; + label?: BabelNodeIdentifier; +} + +declare class BabelNodeCallExpression extends BabelNode { + type: "CallExpression"; + callee: BabelNodeExpression; + arguments: Array; + optional?: true | false; + typeArguments?: BabelNodeTypeParameterInstantiation; + typeParameters?: BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeCatchClause extends BabelNode { + type: "CatchClause"; + param?: BabelNodeIdentifier; + body: BabelNodeBlockStatement; +} + +declare class BabelNodeConditionalExpression extends BabelNode { + type: "ConditionalExpression"; + test: BabelNodeExpression; + consequent: BabelNodeExpression; + alternate: BabelNodeExpression; +} + +declare class BabelNodeContinueStatement extends BabelNode { + type: "ContinueStatement"; + label?: BabelNodeIdentifier; +} + +declare class BabelNodeDebuggerStatement extends BabelNode { + type: "DebuggerStatement"; +} + +declare class BabelNodeDoWhileStatement extends BabelNode { + type: "DoWhileStatement"; + test: BabelNodeExpression; + body: BabelNodeStatement; +} + +declare class BabelNodeEmptyStatement extends BabelNode { + type: "EmptyStatement"; +} + +declare class BabelNodeExpressionStatement extends BabelNode { + type: "ExpressionStatement"; + expression: BabelNodeExpression; +} + +declare class BabelNodeFile extends BabelNode { + type: "File"; + program: BabelNodeProgram; + comments: any; + tokens: any; +} + +declare class BabelNodeForInStatement extends BabelNode { + type: "ForInStatement"; + left: BabelNodeVariableDeclaration | BabelNodeLVal; + right: BabelNodeExpression; + body: BabelNodeStatement; +} + +declare class BabelNodeForStatement extends BabelNode { + type: "ForStatement"; + init?: BabelNodeVariableDeclaration | BabelNodeExpression; + test?: BabelNodeExpression; + update?: BabelNodeExpression; + body: BabelNodeStatement; +} + +declare class BabelNodeFunctionDeclaration extends BabelNode { + type: "FunctionDeclaration"; + id?: BabelNodeIdentifier; + params: Array; + body: BabelNodeBlockStatement; + generator?: boolean; + async?: boolean; + declare?: boolean; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; +} + +declare class BabelNodeFunctionExpression extends BabelNode { + type: "FunctionExpression"; + id?: BabelNodeIdentifier; + params: Array; + body: BabelNodeBlockStatement; + generator?: boolean; + async?: boolean; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; +} + +declare class BabelNodeIdentifier extends BabelNode { + type: "Identifier"; + name: string; + decorators?: Array; + optional?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; +} + +declare class BabelNodeIfStatement extends BabelNode { + type: "IfStatement"; + test: BabelNodeExpression; + consequent: BabelNodeStatement; + alternate?: BabelNodeStatement; +} + +declare class BabelNodeLabeledStatement extends BabelNode { + type: "LabeledStatement"; + label: BabelNodeIdentifier; + body: BabelNodeStatement; +} + +declare class BabelNodeStringLiteral extends BabelNode { + type: "StringLiteral"; + value: string; +} + +declare class BabelNodeNumericLiteral extends BabelNode { + type: "NumericLiteral"; + value: number; +} + +declare class BabelNodeNullLiteral extends BabelNode { + type: "NullLiteral"; +} + +declare class BabelNodeBooleanLiteral extends BabelNode { + type: "BooleanLiteral"; + value: boolean; +} + +declare class BabelNodeRegExpLiteral extends BabelNode { + type: "RegExpLiteral"; + pattern: string; + flags?: string; +} + +declare class BabelNodeLogicalExpression extends BabelNode { + type: "LogicalExpression"; + operator: "||" | "&&" | "??"; + left: BabelNodeExpression; + right: BabelNodeExpression; +} + +declare class BabelNodeMemberExpression extends BabelNode { + type: "MemberExpression"; + object: BabelNodeExpression; + property: any; + computed?: boolean; + optional?: true | false; +} + +declare class BabelNodeNewExpression extends BabelNode { + type: "NewExpression"; + callee: BabelNodeExpression; + arguments: Array; + optional?: true | false; + typeArguments?: BabelNodeTypeParameterInstantiation; + typeParameters?: BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeProgram extends BabelNode { + type: "Program"; + body: Array; + directives?: Array; + sourceType?: "script" | "module"; + interpreter?: BabelNodeInterpreterDirective; + sourceFile?: string; +} + +declare class BabelNodeObjectExpression extends BabelNode { + type: "ObjectExpression"; + properties: Array; +} + +declare class BabelNodeObjectMethod extends BabelNode { + type: "ObjectMethod"; + kind?: "method" | "get" | "set"; + key: any; + params: Array; + body: BabelNodeBlockStatement; + computed?: boolean; + async?: boolean; + decorators?: Array; + generator?: boolean; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; +} + +declare class BabelNodeObjectProperty extends BabelNode { + type: "ObjectProperty"; + key: any; + value: BabelNodeExpression | BabelNodePatternLike; + computed?: boolean; + shorthand?: boolean; + decorators?: Array; +} + +declare class BabelNodeRestElement extends BabelNode { + type: "RestElement"; + argument: BabelNodeLVal; + decorators?: Array; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; +} + +declare class BabelNodeReturnStatement extends BabelNode { + type: "ReturnStatement"; + argument?: BabelNodeExpression; +} + +declare class BabelNodeSequenceExpression extends BabelNode { + type: "SequenceExpression"; + expressions: Array; +} + +declare class BabelNodeSwitchCase extends BabelNode { + type: "SwitchCase"; + test?: BabelNodeExpression; + consequent: Array; +} + +declare class BabelNodeSwitchStatement extends BabelNode { + type: "SwitchStatement"; + discriminant: BabelNodeExpression; + cases: Array; +} + +declare class BabelNodeThisExpression extends BabelNode { + type: "ThisExpression"; +} + +declare class BabelNodeThrowStatement extends BabelNode { + type: "ThrowStatement"; + argument: BabelNodeExpression; +} + +declare class BabelNodeTryStatement extends BabelNode { + type: "TryStatement"; + block: BabelNodeBlockStatement; + handler?: BabelNodeCatchClause; + finalizer?: BabelNodeBlockStatement; +} + +declare class BabelNodeUnaryExpression extends BabelNode { + type: "UnaryExpression"; + operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof"; + argument: BabelNodeExpression; + prefix?: boolean; +} + +declare class BabelNodeUpdateExpression extends BabelNode { + type: "UpdateExpression"; + operator: "++" | "--"; + argument: BabelNodeExpression; + prefix?: boolean; +} + +declare class BabelNodeVariableDeclaration extends BabelNode { + type: "VariableDeclaration"; + kind: "var" | "let" | "const"; + declarations: Array; + declare?: boolean; +} + +declare class BabelNodeVariableDeclarator extends BabelNode { + type: "VariableDeclarator"; + id: BabelNodeLVal; + init?: BabelNodeExpression; + definite?: boolean; +} + +declare class BabelNodeWhileStatement extends BabelNode { + type: "WhileStatement"; + test: BabelNodeExpression; + body: BabelNodeBlockStatement | BabelNodeStatement; +} + +declare class BabelNodeWithStatement extends BabelNode { + type: "WithStatement"; + object: BabelNodeExpression; + body: BabelNodeBlockStatement | BabelNodeStatement; +} + +declare class BabelNodeAssignmentPattern extends BabelNode { + type: "AssignmentPattern"; + left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern; + right: BabelNodeExpression; + decorators?: Array; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; +} + +declare class BabelNodeArrayPattern extends BabelNode { + type: "ArrayPattern"; + elements: Array; + decorators?: Array; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; +} + +declare class BabelNodeArrowFunctionExpression extends BabelNode { + type: "ArrowFunctionExpression"; + params: Array; + body: BabelNodeBlockStatement | BabelNodeExpression; + async?: boolean; + expression?: boolean; + generator?: boolean; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; +} + +declare class BabelNodeClassBody extends BabelNode { + type: "ClassBody"; + body: Array; +} + +declare class BabelNodeClassDeclaration extends BabelNode { + type: "ClassDeclaration"; + id?: BabelNodeIdentifier; + superClass?: BabelNodeExpression; + body: BabelNodeClassBody; + decorators?: Array; + abstract?: boolean; + declare?: boolean; + mixins?: any; + superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; +} + +declare class BabelNodeClassExpression extends BabelNode { + type: "ClassExpression"; + id?: BabelNodeIdentifier; + superClass?: BabelNodeExpression; + body: BabelNodeClassBody; + decorators?: Array; + mixins?: any; + superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; +} + +declare class BabelNodeExportAllDeclaration extends BabelNode { + type: "ExportAllDeclaration"; + source: BabelNodeStringLiteral; +} + +declare class BabelNodeExportDefaultDeclaration extends BabelNode { + type: "ExportDefaultDeclaration"; + declaration: BabelNodeFunctionDeclaration | BabelNodeTSDeclareFunction | BabelNodeClassDeclaration | BabelNodeExpression; +} + +declare class BabelNodeExportNamedDeclaration extends BabelNode { + type: "ExportNamedDeclaration"; + declaration?: BabelNodeDeclaration; + specifiers: Array; + source?: BabelNodeStringLiteral; +} + +declare class BabelNodeExportSpecifier extends BabelNode { + type: "ExportSpecifier"; + local: BabelNodeIdentifier; + exported: BabelNodeIdentifier; +} + +declare class BabelNodeForOfStatement extends BabelNode { + type: "ForOfStatement"; + left: BabelNodeVariableDeclaration | BabelNodeLVal; + right: BabelNodeExpression; + body: BabelNodeStatement; +} + +declare class BabelNodeImportDeclaration extends BabelNode { + type: "ImportDeclaration"; + specifiers: Array; + source: BabelNodeStringLiteral; + importKind?: "type" | "typeof" | "value"; +} + +declare class BabelNodeImportDefaultSpecifier extends BabelNode { + type: "ImportDefaultSpecifier"; + local: BabelNodeIdentifier; +} + +declare class BabelNodeImportNamespaceSpecifier extends BabelNode { + type: "ImportNamespaceSpecifier"; + local: BabelNodeIdentifier; +} + +declare class BabelNodeImportSpecifier extends BabelNode { + type: "ImportSpecifier"; + local: BabelNodeIdentifier; + imported: BabelNodeIdentifier; + importKind?: "type" | "typeof"; +} + +declare class BabelNodeMetaProperty extends BabelNode { + type: "MetaProperty"; + meta: BabelNodeIdentifier; + property: BabelNodeIdentifier; +} + +declare class BabelNodeClassMethod extends BabelNode { + type: "ClassMethod"; + kind?: "get" | "set" | "method" | "constructor"; + key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression; + params: Array; + body: BabelNodeBlockStatement; + computed?: boolean; + abstract?: boolean; + access?: "public" | "private" | "protected"; + accessibility?: "public" | "private" | "protected"; + async?: boolean; + decorators?: Array; + generator?: boolean; + optional?: boolean; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; +} + +declare class BabelNodeObjectPattern extends BabelNode { + type: "ObjectPattern"; + properties: Array; + decorators?: Array; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; +} + +declare class BabelNodeSpreadElement extends BabelNode { + type: "SpreadElement"; + argument: BabelNodeExpression; +} + +declare class BabelNodeSuper extends BabelNode { + type: "Super"; +} + +declare class BabelNodeTaggedTemplateExpression extends BabelNode { + type: "TaggedTemplateExpression"; + tag: BabelNodeExpression; + quasi: BabelNodeTemplateLiteral; + typeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeTemplateElement extends BabelNode { + type: "TemplateElement"; + value: any; + tail?: boolean; +} + +declare class BabelNodeTemplateLiteral extends BabelNode { + type: "TemplateLiteral"; + quasis: Array; + expressions: Array; +} + +declare class BabelNodeYieldExpression extends BabelNode { + type: "YieldExpression"; + argument?: BabelNodeExpression; + delegate?: boolean; +} + +declare class BabelNodeAnyTypeAnnotation extends BabelNode { + type: "AnyTypeAnnotation"; +} + +declare class BabelNodeArrayTypeAnnotation extends BabelNode { + type: "ArrayTypeAnnotation"; + elementType: BabelNodeFlowType; +} + +declare class BabelNodeBooleanTypeAnnotation extends BabelNode { + type: "BooleanTypeAnnotation"; +} + +declare class BabelNodeBooleanLiteralTypeAnnotation extends BabelNode { + type: "BooleanLiteralTypeAnnotation"; + value: boolean; +} + +declare class BabelNodeNullLiteralTypeAnnotation extends BabelNode { + type: "NullLiteralTypeAnnotation"; +} + +declare class BabelNodeClassImplements extends BabelNode { + type: "ClassImplements"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterInstantiation; +} + +declare class BabelNodeDeclareClass extends BabelNode { + type: "DeclareClass"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + body: BabelNodeObjectTypeAnnotation; + mixins?: Array; +} + +declare class BabelNodeDeclareFunction extends BabelNode { + type: "DeclareFunction"; + id: BabelNodeIdentifier; + predicate?: BabelNodeDeclaredPredicate; +} + +declare class BabelNodeDeclareInterface extends BabelNode { + type: "DeclareInterface"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + body: BabelNodeObjectTypeAnnotation; + mixins?: Array; +} + +declare class BabelNodeDeclareModule extends BabelNode { + type: "DeclareModule"; + id: BabelNodeIdentifier | BabelNodeStringLiteral; + body: BabelNodeBlockStatement; + kind?: "CommonJS" | "ES"; +} + +declare class BabelNodeDeclareModuleExports extends BabelNode { + type: "DeclareModuleExports"; + typeAnnotation: BabelNodeTypeAnnotation; +} + +declare class BabelNodeDeclareTypeAlias extends BabelNode { + type: "DeclareTypeAlias"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + right: BabelNodeFlowType; +} + +declare class BabelNodeDeclareOpaqueType extends BabelNode { + type: "DeclareOpaqueType"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + supertype?: BabelNodeFlowType; +} + +declare class BabelNodeDeclareVariable extends BabelNode { + type: "DeclareVariable"; + id: BabelNodeIdentifier; +} + +declare class BabelNodeDeclareExportDeclaration extends BabelNode { + type: "DeclareExportDeclaration"; + declaration?: BabelNodeFlow; + specifiers?: Array; + source?: BabelNodeStringLiteral; +} + +declare class BabelNodeDeclareExportAllDeclaration extends BabelNode { + type: "DeclareExportAllDeclaration"; + source: BabelNodeStringLiteral; + exportKind?: ["type","value"]; +} + +declare class BabelNodeDeclaredPredicate extends BabelNode { + type: "DeclaredPredicate"; + value: BabelNodeFlow; +} + +declare class BabelNodeExistsTypeAnnotation extends BabelNode { + type: "ExistsTypeAnnotation"; +} + +declare class BabelNodeFunctionTypeAnnotation extends BabelNode { + type: "FunctionTypeAnnotation"; + typeParameters?: BabelNodeTypeParameterDeclaration; + params: Array; + rest?: BabelNodeFunctionTypeParam; + returnType: BabelNodeFlowType; +} + +declare class BabelNodeFunctionTypeParam extends BabelNode { + type: "FunctionTypeParam"; + name?: BabelNodeIdentifier; + typeAnnotation: BabelNodeFlowType; + optional?: boolean; +} + +declare class BabelNodeGenericTypeAnnotation extends BabelNode { + type: "GenericTypeAnnotation"; + id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; + typeParameters?: BabelNodeTypeParameterInstantiation; +} + +declare class BabelNodeInferredPredicate extends BabelNode { + type: "InferredPredicate"; +} + +declare class BabelNodeInterfaceExtends extends BabelNode { + type: "InterfaceExtends"; + id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; + typeParameters?: BabelNodeTypeParameterInstantiation; +} + +declare class BabelNodeInterfaceDeclaration extends BabelNode { + type: "InterfaceDeclaration"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + body: BabelNodeObjectTypeAnnotation; + mixins?: Array; +} + +declare class BabelNodeInterfaceTypeAnnotation extends BabelNode { + type: "InterfaceTypeAnnotation"; + body: BabelNodeObjectTypeAnnotation; +} + +declare class BabelNodeIntersectionTypeAnnotation extends BabelNode { + type: "IntersectionTypeAnnotation"; + types: Array; +} + +declare class BabelNodeMixedTypeAnnotation extends BabelNode { + type: "MixedTypeAnnotation"; +} + +declare class BabelNodeEmptyTypeAnnotation extends BabelNode { + type: "EmptyTypeAnnotation"; +} + +declare class BabelNodeNullableTypeAnnotation extends BabelNode { + type: "NullableTypeAnnotation"; + typeAnnotation: BabelNodeFlowType; +} + +declare class BabelNodeNumberLiteralTypeAnnotation extends BabelNode { + type: "NumberLiteralTypeAnnotation"; + value: number; +} + +declare class BabelNodeNumberTypeAnnotation extends BabelNode { + type: "NumberTypeAnnotation"; +} + +declare class BabelNodeObjectTypeAnnotation extends BabelNode { + type: "ObjectTypeAnnotation"; + properties: Array; + indexers?: Array; + callProperties?: Array; + internalSlots?: Array; + exact?: boolean; + inexact?: boolean; +} + +declare class BabelNodeObjectTypeInternalSlot extends BabelNode { + type: "ObjectTypeInternalSlot"; + id: BabelNodeIdentifier; + value: BabelNodeFlowType; + optional: boolean; + method: boolean; +} + +declare class BabelNodeObjectTypeCallProperty extends BabelNode { + type: "ObjectTypeCallProperty"; + value: BabelNodeFlowType; +} + +declare class BabelNodeObjectTypeIndexer extends BabelNode { + type: "ObjectTypeIndexer"; + id?: BabelNodeIdentifier; + key: BabelNodeFlowType; + value: BabelNodeFlowType; + variance?: BabelNodeVariance; +} + +declare class BabelNodeObjectTypeProperty extends BabelNode { + type: "ObjectTypeProperty"; + key: BabelNodeIdentifier | BabelNodeStringLiteral; + value: BabelNodeFlowType; + variance?: BabelNodeVariance; + kind?: "init" | "get" | "set"; + optional?: boolean; + proto?: boolean; +} + +declare class BabelNodeObjectTypeSpreadProperty extends BabelNode { + type: "ObjectTypeSpreadProperty"; + argument: BabelNodeFlowType; +} + +declare class BabelNodeOpaqueType extends BabelNode { + type: "OpaqueType"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + supertype?: BabelNodeFlowType; + impltype: BabelNodeFlowType; +} + +declare class BabelNodeQualifiedTypeIdentifier extends BabelNode { + type: "QualifiedTypeIdentifier"; + id: BabelNodeIdentifier; + qualification: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; +} + +declare class BabelNodeStringLiteralTypeAnnotation extends BabelNode { + type: "StringLiteralTypeAnnotation"; + value: string; +} + +declare class BabelNodeStringTypeAnnotation extends BabelNode { + type: "StringTypeAnnotation"; +} + +declare class BabelNodeThisTypeAnnotation extends BabelNode { + type: "ThisTypeAnnotation"; +} + +declare class BabelNodeTupleTypeAnnotation extends BabelNode { + type: "TupleTypeAnnotation"; + types: Array; +} + +declare class BabelNodeTypeofTypeAnnotation extends BabelNode { + type: "TypeofTypeAnnotation"; + argument: BabelNodeFlowType; +} + +declare class BabelNodeTypeAlias extends BabelNode { + type: "TypeAlias"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + right: BabelNodeFlowType; +} + +declare class BabelNodeTypeAnnotation extends BabelNode { + type: "TypeAnnotation"; + typeAnnotation: BabelNodeFlowType; +} + +declare class BabelNodeTypeCastExpression extends BabelNode { + type: "TypeCastExpression"; + expression: BabelNodeExpression; + typeAnnotation: BabelNodeTypeAnnotation; +} + +declare class BabelNodeTypeParameter extends BabelNode { + type: "TypeParameter"; + bound?: BabelNodeTypeAnnotation; + variance?: BabelNodeVariance; + name?: string; +} + +declare class BabelNodeTypeParameterDeclaration extends BabelNode { + type: "TypeParameterDeclaration"; + params: Array; +} + +declare class BabelNodeTypeParameterInstantiation extends BabelNode { + type: "TypeParameterInstantiation"; + params: Array; +} + +declare class BabelNodeUnionTypeAnnotation extends BabelNode { + type: "UnionTypeAnnotation"; + types: Array; +} + +declare class BabelNodeVariance extends BabelNode { + type: "Variance"; + kind: "minus" | "plus"; +} + +declare class BabelNodeVoidTypeAnnotation extends BabelNode { + type: "VoidTypeAnnotation"; +} + +declare class BabelNodeJSXAttribute extends BabelNode { + type: "JSXAttribute"; + name: BabelNodeJSXIdentifier | BabelNodeJSXNamespacedName; + value?: BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeStringLiteral | BabelNodeJSXExpressionContainer; +} + +declare class BabelNodeJSXClosingElement extends BabelNode { + type: "JSXClosingElement"; + name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression; +} + +declare class BabelNodeJSXElement extends BabelNode { + type: "JSXElement"; + openingElement: BabelNodeJSXOpeningElement; + closingElement?: BabelNodeJSXClosingElement; + children: Array; + selfClosing: any; +} + +declare class BabelNodeJSXEmptyExpression extends BabelNode { + type: "JSXEmptyExpression"; +} + +declare class BabelNodeJSXExpressionContainer extends BabelNode { + type: "JSXExpressionContainer"; + expression: BabelNodeExpression | BabelNodeJSXEmptyExpression; +} + +declare class BabelNodeJSXSpreadChild extends BabelNode { + type: "JSXSpreadChild"; + expression: BabelNodeExpression; +} + +declare class BabelNodeJSXIdentifier extends BabelNode { + type: "JSXIdentifier"; + name: string; +} + +declare class BabelNodeJSXMemberExpression extends BabelNode { + type: "JSXMemberExpression"; + object: BabelNodeJSXMemberExpression | BabelNodeJSXIdentifier; + property: BabelNodeJSXIdentifier; +} + +declare class BabelNodeJSXNamespacedName extends BabelNode { + type: "JSXNamespacedName"; + namespace: BabelNodeJSXIdentifier; + name: BabelNodeJSXIdentifier; +} + +declare class BabelNodeJSXOpeningElement extends BabelNode { + type: "JSXOpeningElement"; + name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression; + attributes: Array; + selfClosing?: boolean; + typeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeJSXSpreadAttribute extends BabelNode { + type: "JSXSpreadAttribute"; + argument: BabelNodeExpression; +} + +declare class BabelNodeJSXText extends BabelNode { + type: "JSXText"; + value: string; +} + +declare class BabelNodeJSXFragment extends BabelNode { + type: "JSXFragment"; + openingFragment: BabelNodeJSXOpeningFragment; + closingFragment: BabelNodeJSXClosingFragment; + children: Array; +} + +declare class BabelNodeJSXOpeningFragment extends BabelNode { + type: "JSXOpeningFragment"; +} + +declare class BabelNodeJSXClosingFragment extends BabelNode { + type: "JSXClosingFragment"; +} + +declare class BabelNodeNoop extends BabelNode { + type: "Noop"; +} + +declare class BabelNodeParenthesizedExpression extends BabelNode { + type: "ParenthesizedExpression"; + expression: BabelNodeExpression; +} + +declare class BabelNodeAwaitExpression extends BabelNode { + type: "AwaitExpression"; + argument: BabelNodeExpression; +} + +declare class BabelNodeBindExpression extends BabelNode { + type: "BindExpression"; + object: any; + callee: any; +} + +declare class BabelNodeClassProperty extends BabelNode { + type: "ClassProperty"; + key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression; + value?: BabelNodeExpression; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + decorators?: Array; + computed?: boolean; + abstract?: boolean; + accessibility?: "public" | "private" | "protected"; + definite?: boolean; + optional?: boolean; + readonly?: boolean; +} + +declare class BabelNodeOptionalMemberExpression extends BabelNode { + type: "OptionalMemberExpression"; + object: BabelNodeExpression; + property: any; + computed?: boolean; + optional: boolean; +} + +declare class BabelNodePipelineTopicExpression extends BabelNode { + type: "PipelineTopicExpression"; + expression: BabelNodeExpression; +} + +declare class BabelNodePipelineBareFunction extends BabelNode { + type: "PipelineBareFunction"; + callee: BabelNodeExpression; +} + +declare class BabelNodePipelinePrimaryTopicReference extends BabelNode { + type: "PipelinePrimaryTopicReference"; +} + +declare class BabelNodeOptionalCallExpression extends BabelNode { + type: "OptionalCallExpression"; + callee: BabelNodeExpression; + arguments: Array; + optional: boolean; + typeArguments?: BabelNodeTypeParameterInstantiation; + typeParameters?: BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeClassPrivateProperty extends BabelNode { + type: "ClassPrivateProperty"; + key: BabelNodePrivateName; + value?: BabelNodeExpression; +} + +declare class BabelNodeClassPrivateMethod extends BabelNode { + type: "ClassPrivateMethod"; + kind?: "get" | "set" | "method" | "constructor"; + key: BabelNodePrivateName; + params: Array; + body: BabelNodeBlockStatement; + abstract?: boolean; + access?: "public" | "private" | "protected"; + accessibility?: "public" | "private" | "protected"; + async?: boolean; + computed?: boolean; + decorators?: Array; + generator?: boolean; + optional?: boolean; + returnType?: any; + typeParameters?: any; +} + +declare class BabelNodeImport extends BabelNode { + type: "Import"; +} + +declare class BabelNodeDecorator extends BabelNode { + type: "Decorator"; + expression: BabelNodeExpression; +} + +declare class BabelNodeDoExpression extends BabelNode { + type: "DoExpression"; + body: BabelNodeBlockStatement; +} + +declare class BabelNodeExportDefaultSpecifier extends BabelNode { + type: "ExportDefaultSpecifier"; + exported: BabelNodeIdentifier; +} + +declare class BabelNodeExportNamespaceSpecifier extends BabelNode { + type: "ExportNamespaceSpecifier"; + exported: BabelNodeIdentifier; +} + +declare class BabelNodePrivateName extends BabelNode { + type: "PrivateName"; + id: BabelNodeIdentifier; +} + +declare class BabelNodeBigIntLiteral extends BabelNode { + type: "BigIntLiteral"; + value: string; +} + +declare class BabelNodeTSParameterProperty extends BabelNode { + type: "TSParameterProperty"; + parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern; + accessibility?: "public" | "private" | "protected"; + readonly?: boolean; +} + +declare class BabelNodeTSDeclareFunction extends BabelNode { + type: "TSDeclareFunction"; + id?: BabelNodeIdentifier; + typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + params: Array; + returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; + async?: boolean; + declare?: boolean; + generator?: boolean; +} + +declare class BabelNodeTSDeclareMethod extends BabelNode { + type: "TSDeclareMethod"; + decorators?: Array; + key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression; + typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + params: Array; + returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; + abstract?: boolean; + access?: "public" | "private" | "protected"; + accessibility?: "public" | "private" | "protected"; + async?: boolean; + computed?: boolean; + generator?: boolean; + kind?: "get" | "set" | "method" | "constructor"; + optional?: boolean; +} + +declare class BabelNodeTSQualifiedName extends BabelNode { + type: "TSQualifiedName"; + left: BabelNodeTSEntityName; + right: BabelNodeIdentifier; +} + +declare class BabelNodeTSCallSignatureDeclaration extends BabelNode { + type: "TSCallSignatureDeclaration"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters?: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; +} + +declare class BabelNodeTSConstructSignatureDeclaration extends BabelNode { + type: "TSConstructSignatureDeclaration"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters?: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; +} + +declare class BabelNodeTSPropertySignature extends BabelNode { + type: "TSPropertySignature"; + key: BabelNodeExpression; + typeAnnotation?: BabelNodeTSTypeAnnotation; + initializer?: BabelNodeExpression; + computed?: boolean; + optional?: boolean; + readonly?: boolean; +} + +declare class BabelNodeTSMethodSignature extends BabelNode { + type: "TSMethodSignature"; + key: BabelNodeExpression; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters?: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + computed?: boolean; + optional?: boolean; +} + +declare class BabelNodeTSIndexSignature extends BabelNode { + type: "TSIndexSignature"; + parameters: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + readonly?: boolean; +} + +declare class BabelNodeTSAnyKeyword extends BabelNode { + type: "TSAnyKeyword"; +} + +declare class BabelNodeTSUnknownKeyword extends BabelNode { + type: "TSUnknownKeyword"; +} + +declare class BabelNodeTSNumberKeyword extends BabelNode { + type: "TSNumberKeyword"; +} + +declare class BabelNodeTSObjectKeyword extends BabelNode { + type: "TSObjectKeyword"; +} + +declare class BabelNodeTSBooleanKeyword extends BabelNode { + type: "TSBooleanKeyword"; +} + +declare class BabelNodeTSStringKeyword extends BabelNode { + type: "TSStringKeyword"; +} + +declare class BabelNodeTSSymbolKeyword extends BabelNode { + type: "TSSymbolKeyword"; +} + +declare class BabelNodeTSVoidKeyword extends BabelNode { + type: "TSVoidKeyword"; +} + +declare class BabelNodeTSUndefinedKeyword extends BabelNode { + type: "TSUndefinedKeyword"; +} + +declare class BabelNodeTSNullKeyword extends BabelNode { + type: "TSNullKeyword"; +} + +declare class BabelNodeTSNeverKeyword extends BabelNode { + type: "TSNeverKeyword"; +} + +declare class BabelNodeTSThisType extends BabelNode { + type: "TSThisType"; +} + +declare class BabelNodeTSFunctionType extends BabelNode { + type: "TSFunctionType"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + typeAnnotation?: BabelNodeTSTypeAnnotation; + parameters?: Array; +} + +declare class BabelNodeTSConstructorType extends BabelNode { + type: "TSConstructorType"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + typeAnnotation?: BabelNodeTSTypeAnnotation; + parameters?: Array; +} + +declare class BabelNodeTSTypeReference extends BabelNode { + type: "TSTypeReference"; + typeName: BabelNodeTSEntityName; + typeParameters?: BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeTSTypePredicate extends BabelNode { + type: "TSTypePredicate"; + parameterName: BabelNodeIdentifier | BabelNodeTSThisType; + typeAnnotation: BabelNodeTSTypeAnnotation; +} + +declare class BabelNodeTSTypeQuery extends BabelNode { + type: "TSTypeQuery"; + exprName: BabelNodeTSEntityName | BabelNodeTSImportType; +} + +declare class BabelNodeTSTypeLiteral extends BabelNode { + type: "TSTypeLiteral"; + members: Array; +} + +declare class BabelNodeTSArrayType extends BabelNode { + type: "TSArrayType"; + elementType: BabelNodeTSType; +} + +declare class BabelNodeTSTupleType extends BabelNode { + type: "TSTupleType"; + elementTypes: Array; +} + +declare class BabelNodeTSOptionalType extends BabelNode { + type: "TSOptionalType"; + typeAnnotation: BabelNodeTSType; +} + +declare class BabelNodeTSRestType extends BabelNode { + type: "TSRestType"; + typeAnnotation: BabelNodeTSType; +} + +declare class BabelNodeTSUnionType extends BabelNode { + type: "TSUnionType"; + types: Array; +} + +declare class BabelNodeTSIntersectionType extends BabelNode { + type: "TSIntersectionType"; + types: Array; +} + +declare class BabelNodeTSConditionalType extends BabelNode { + type: "TSConditionalType"; + checkType: BabelNodeTSType; + extendsType: BabelNodeTSType; + trueType: BabelNodeTSType; + falseType: BabelNodeTSType; +} + +declare class BabelNodeTSInferType extends BabelNode { + type: "TSInferType"; + typeParameter: BabelNodeTSTypeParameter; +} + +declare class BabelNodeTSParenthesizedType extends BabelNode { + type: "TSParenthesizedType"; + typeAnnotation: BabelNodeTSType; +} + +declare class BabelNodeTSTypeOperator extends BabelNode { + type: "TSTypeOperator"; + typeAnnotation: BabelNodeTSType; + operator?: string; +} + +declare class BabelNodeTSIndexedAccessType extends BabelNode { + type: "TSIndexedAccessType"; + objectType: BabelNodeTSType; + indexType: BabelNodeTSType; +} + +declare class BabelNodeTSMappedType extends BabelNode { + type: "TSMappedType"; + typeParameter: BabelNodeTSTypeParameter; + typeAnnotation?: BabelNodeTSType; + optional?: boolean; + readonly?: boolean; +} + +declare class BabelNodeTSLiteralType extends BabelNode { + type: "TSLiteralType"; + literal: BabelNodeNumericLiteral | BabelNodeStringLiteral | BabelNodeBooleanLiteral; +} + +declare class BabelNodeTSExpressionWithTypeArguments extends BabelNode { + type: "TSExpressionWithTypeArguments"; + expression: BabelNodeTSEntityName; + typeParameters?: BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeTSInterfaceDeclaration extends BabelNode { + type: "TSInterfaceDeclaration"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + body: BabelNodeTSInterfaceBody; + declare?: boolean; +} + +declare class BabelNodeTSInterfaceBody extends BabelNode { + type: "TSInterfaceBody"; + body: Array; +} + +declare class BabelNodeTSTypeAliasDeclaration extends BabelNode { + type: "TSTypeAliasDeclaration"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + typeAnnotation: BabelNodeTSType; + declare?: boolean; +} + +declare class BabelNodeTSAsExpression extends BabelNode { + type: "TSAsExpression"; + expression: BabelNodeExpression; + typeAnnotation: BabelNodeTSType; +} + +declare class BabelNodeTSTypeAssertion extends BabelNode { + type: "TSTypeAssertion"; + typeAnnotation: BabelNodeTSType; + expression: BabelNodeExpression; +} + +declare class BabelNodeTSEnumDeclaration extends BabelNode { + type: "TSEnumDeclaration"; + id: BabelNodeIdentifier; + members: Array; + declare?: boolean; + initializer?: BabelNodeExpression; +} + +declare class BabelNodeTSEnumMember extends BabelNode { + type: "TSEnumMember"; + id: BabelNodeIdentifier | BabelNodeStringLiteral; + initializer?: BabelNodeExpression; +} + +declare class BabelNodeTSModuleDeclaration extends BabelNode { + type: "TSModuleDeclaration"; + id: BabelNodeIdentifier | BabelNodeStringLiteral; + body: BabelNodeTSModuleBlock | BabelNodeTSModuleDeclaration; + declare?: boolean; + global?: boolean; +} + +declare class BabelNodeTSModuleBlock extends BabelNode { + type: "TSModuleBlock"; + body: Array; +} + +declare class BabelNodeTSImportType extends BabelNode { + type: "TSImportType"; + argument: BabelNodeStringLiteral; + qualifier?: BabelNodeTSEntityName; + typeParameters?: BabelNodeTSTypeParameterInstantiation; +} + +declare class BabelNodeTSImportEqualsDeclaration extends BabelNode { + type: "TSImportEqualsDeclaration"; + id: BabelNodeIdentifier; + moduleReference: BabelNodeTSEntityName | BabelNodeTSExternalModuleReference; + isExport?: boolean; +} + +declare class BabelNodeTSExternalModuleReference extends BabelNode { + type: "TSExternalModuleReference"; + expression: BabelNodeStringLiteral; +} + +declare class BabelNodeTSNonNullExpression extends BabelNode { + type: "TSNonNullExpression"; + expression: BabelNodeExpression; +} + +declare class BabelNodeTSExportAssignment extends BabelNode { + type: "TSExportAssignment"; + expression: BabelNodeExpression; +} + +declare class BabelNodeTSNamespaceExportDeclaration extends BabelNode { + type: "TSNamespaceExportDeclaration"; + id: BabelNodeIdentifier; +} + +declare class BabelNodeTSTypeAnnotation extends BabelNode { + type: "TSTypeAnnotation"; + typeAnnotation: BabelNodeTSType; +} + +declare class BabelNodeTSTypeParameterInstantiation extends BabelNode { + type: "TSTypeParameterInstantiation"; + params: Array; +} + +declare class BabelNodeTSTypeParameterDeclaration extends BabelNode { + type: "TSTypeParameterDeclaration"; + params: Array; +} + +declare class BabelNodeTSTypeParameter extends BabelNode { + type: "TSTypeParameter"; + constraint?: BabelNodeTSType; + name?: string; +} + +type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeTypeCastExpression | BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeParenthesizedExpression | BabelNodeAwaitExpression | BabelNodeBindExpression | BabelNodeOptionalMemberExpression | BabelNodePipelinePrimaryTopicReference | BabelNodeOptionalCallExpression | BabelNodeImport | BabelNodeDoExpression | BabelNodeBigIntLiteral | BabelNodeTSAsExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; +type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression; +type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression | BabelNodeForOfStatement | BabelNodeClassMethod | BabelNodeClassPrivateMethod; +type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod | BabelNodeClassPrivateMethod; +type BabelNodeBlock = BabelNodeBlockStatement | BabelNodeProgram; +type BabelNodeStatement = BabelNodeBlockStatement | BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeDebuggerStatement | BabelNodeDoWhileStatement | BabelNodeEmptyStatement | BabelNodeExpressionStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeIfStatement | BabelNodeLabeledStatement | BabelNodeReturnStatement | BabelNodeSwitchStatement | BabelNodeThrowStatement | BabelNodeTryStatement | BabelNodeVariableDeclaration | BabelNodeWhileStatement | BabelNodeWithStatement | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeForOfStatement | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration | BabelNodeTSImportEqualsDeclaration | BabelNodeTSExportAssignment | BabelNodeTSNamespaceExportDeclaration; +type BabelNodeTerminatorless = BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeReturnStatement | BabelNodeThrowStatement | BabelNodeYieldExpression | BabelNodeAwaitExpression; +type BabelNodeCompletionStatement = BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeReturnStatement | BabelNodeThrowStatement; +type BabelNodeConditional = BabelNodeConditionalExpression | BabelNodeIfStatement; +type BabelNodeLoop = BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeWhileStatement | BabelNodeForOfStatement; +type BabelNodeWhile = BabelNodeDoWhileStatement | BabelNodeWhileStatement; +type BabelNodeExpressionWrapper = BabelNodeExpressionStatement | BabelNodeTypeCastExpression | BabelNodeParenthesizedExpression; +type BabelNodeFor = BabelNodeForInStatement | BabelNodeForStatement | BabelNodeForOfStatement; +type BabelNodeForXStatement = BabelNodeForInStatement | BabelNodeForOfStatement; +type BabelNodeFunction = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod; +type BabelNodeFunctionParent = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod; +type BabelNodePureish = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression | BabelNodeBigIntLiteral; +type BabelNodeDeclaration = BabelNodeFunctionDeclaration | BabelNodeVariableDeclaration | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration; +type BabelNodePatternLike = BabelNodeIdentifier | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern; +type BabelNodeLVal = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeTSParameterProperty; +type BabelNodeTSEntityName = BabelNodeIdentifier | BabelNodeTSQualifiedName; +type BabelNodeLiteral = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeTemplateLiteral | BabelNodeBigIntLiteral; +type BabelNodeImmutable = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXOpeningElement | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment | BabelNodeBigIntLiteral; +type BabelNodeUserWhitespacable = BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty; +type BabelNodeMethod = BabelNodeObjectMethod | BabelNodeClassMethod | BabelNodeClassPrivateMethod; +type BabelNodeObjectMember = BabelNodeObjectMethod | BabelNodeObjectProperty; +type BabelNodeProperty = BabelNodeObjectProperty | BabelNodeClassProperty | BabelNodeClassPrivateProperty; +type BabelNodeUnaryLike = BabelNodeUnaryExpression | BabelNodeSpreadElement; +type BabelNodePattern = BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern; +type BabelNodeClass = BabelNodeClassDeclaration | BabelNodeClassExpression; +type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; +type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration; +type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier; +type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeDeclaredPredicate | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInferredPredicate | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty | BabelNodeOpaqueType | BabelNodeQualifiedTypeIdentifier | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameter | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeUnionTypeAnnotation | BabelNodeVariance | BabelNodeVoidTypeAnnotation; +type BabelNodeFlowType = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation; +type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeVoidTypeAnnotation; +type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias; +type BabelNodeFlowPredicate = BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; +type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment; +type BabelNodePrivate = BabelNodeClassPrivateProperty | BabelNodeClassPrivateMethod | BabelNodePrivateName; +type BabelNodeTSTypeElement = BabelNodeTSCallSignatureDeclaration | BabelNodeTSConstructSignatureDeclaration | BabelNodeTSPropertySignature | BabelNodeTSMethodSignature | BabelNodeTSIndexSignature; +type BabelNodeTSType = BabelNodeTSAnyKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSVoidKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSNullKeyword | BabelNodeTSNeverKeyword | BabelNodeTSThisType | BabelNodeTSFunctionType | BabelNodeTSConstructorType | BabelNodeTSTypeReference | BabelNodeTSTypePredicate | BabelNodeTSTypeQuery | BabelNodeTSTypeLiteral | BabelNodeTSArrayType | BabelNodeTSTupleType | BabelNodeTSOptionalType | BabelNodeTSRestType | BabelNodeTSUnionType | BabelNodeTSIntersectionType | BabelNodeTSConditionalType | BabelNodeTSInferType | BabelNodeTSParenthesizedType | BabelNodeTSTypeOperator | BabelNodeTSIndexedAccessType | BabelNodeTSMappedType | BabelNodeTSLiteralType | BabelNodeTSExpressionWithTypeArguments | BabelNodeTSImportType; + +declare module "@babel/types" { + declare function arrayExpression(elements?: Array): BabelNodeArrayExpression; + declare function assignmentExpression(operator: string, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression; + declare function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression; + declare function interpreterDirective(value: string): BabelNodeInterpreterDirective; + declare function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective; + declare function directiveLiteral(value: string): BabelNodeDirectiveLiteral; + declare function blockStatement(body: Array, directives?: Array): BabelNodeBlockStatement; + declare function breakStatement(label?: BabelNodeIdentifier): BabelNodeBreakStatement; + declare function callExpression(callee: BabelNodeExpression, _arguments: Array, optional?: true | false, typeArguments?: BabelNodeTypeParameterInstantiation, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeCallExpression; + declare function catchClause(param?: BabelNodeIdentifier, body: BabelNodeBlockStatement): BabelNodeCatchClause; + declare function conditionalExpression(test: BabelNodeExpression, consequent: BabelNodeExpression, alternate: BabelNodeExpression): BabelNodeConditionalExpression; + declare function continueStatement(label?: BabelNodeIdentifier): BabelNodeContinueStatement; + declare function debuggerStatement(): BabelNodeDebuggerStatement; + declare function doWhileStatement(test: BabelNodeExpression, body: BabelNodeStatement): BabelNodeDoWhileStatement; + declare function emptyStatement(): BabelNodeEmptyStatement; + declare function expressionStatement(expression: BabelNodeExpression): BabelNodeExpressionStatement; + declare function file(program: BabelNodeProgram, comments: any, tokens: any): BabelNodeFile; + declare function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement; + declare function forStatement(init?: BabelNodeVariableDeclaration | BabelNodeExpression, test?: BabelNodeExpression, update?: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement; + declare function functionDeclaration(id?: BabelNodeIdentifier, params: Array, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, declare?: boolean, returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop): BabelNodeFunctionDeclaration; + declare function functionExpression(id?: BabelNodeIdentifier, params: Array, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop): BabelNodeFunctionExpression; + declare function identifier(name: string, decorators?: Array, optional?: boolean, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeIdentifier; + declare function ifStatement(test: BabelNodeExpression, consequent: BabelNodeStatement, alternate?: BabelNodeStatement): BabelNodeIfStatement; + declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement; + declare function stringLiteral(value: string): BabelNodeStringLiteral; + declare function numericLiteral(value: number): BabelNodeNumericLiteral; + declare function nullLiteral(): BabelNodeNullLiteral; + declare function booleanLiteral(value: boolean): BabelNodeBooleanLiteral; + declare function regExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral; + declare function logicalExpression(operator: "||" | "&&" | "??", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression; + declare function memberExpression(object: BabelNodeExpression, property: any, computed?: boolean, optional?: true | false): BabelNodeMemberExpression; + declare function newExpression(callee: BabelNodeExpression, _arguments: Array, optional?: true | false, typeArguments?: BabelNodeTypeParameterInstantiation, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeNewExpression; + declare function program(body: Array, directives?: Array, sourceType?: "script" | "module", interpreter?: BabelNodeInterpreterDirective, sourceFile?: string): BabelNodeProgram; + declare function objectExpression(properties: Array): BabelNodeObjectExpression; + declare function objectMethod(kind?: "method" | "get" | "set", key: any, params: Array, body: BabelNodeBlockStatement, computed?: boolean, async?: boolean, decorators?: Array, generator?: boolean, returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop): BabelNodeObjectMethod; + declare function objectProperty(key: any, value: BabelNodeExpression | BabelNodePatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array): BabelNodeObjectProperty; + declare function restElement(argument: BabelNodeLVal, decorators?: Array, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeRestElement; + declare function returnStatement(argument?: BabelNodeExpression): BabelNodeReturnStatement; + declare function sequenceExpression(expressions: Array): BabelNodeSequenceExpression; + declare function switchCase(test?: BabelNodeExpression, consequent: Array): BabelNodeSwitchCase; + declare function switchStatement(discriminant: BabelNodeExpression, cases: Array): BabelNodeSwitchStatement; + declare function thisExpression(): BabelNodeThisExpression; + declare function throwStatement(argument: BabelNodeExpression): BabelNodeThrowStatement; + declare function tryStatement(block: BabelNodeBlockStatement, handler?: BabelNodeCatchClause, finalizer?: BabelNodeBlockStatement): BabelNodeTryStatement; + declare function unaryExpression(operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUnaryExpression; + declare function updateExpression(operator: "++" | "--", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUpdateExpression; + declare function variableDeclaration(kind: "var" | "let" | "const", declarations: Array, declare?: boolean): BabelNodeVariableDeclaration; + declare function variableDeclarator(id: BabelNodeLVal, init?: BabelNodeExpression, definite?: boolean): BabelNodeVariableDeclarator; + declare function whileStatement(test: BabelNodeExpression, body: BabelNodeBlockStatement | BabelNodeStatement): BabelNodeWhileStatement; + declare function withStatement(object: BabelNodeExpression, body: BabelNodeBlockStatement | BabelNodeStatement): BabelNodeWithStatement; + declare function assignmentPattern(left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern, right: BabelNodeExpression, decorators?: Array, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeAssignmentPattern; + declare function arrayPattern(elements: Array, decorators?: Array, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeArrayPattern; + declare function arrowFunctionExpression(params: Array, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean, expression?: boolean, generator?: boolean, returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop): BabelNodeArrowFunctionExpression; + declare function classBody(body: Array): BabelNodeClassBody; + declare function classDeclaration(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array, abstract?: boolean, declare?: boolean, _implements?: Array, mixins?: any, superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation, typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop): BabelNodeClassDeclaration; + declare function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array, _implements?: Array, mixins?: any, superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation, typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop): BabelNodeClassExpression; + declare function exportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeExportAllDeclaration; + declare function exportDefaultDeclaration(declaration: BabelNodeFunctionDeclaration | BabelNodeTSDeclareFunction | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration; + declare function exportNamedDeclaration(declaration?: BabelNodeDeclaration, specifiers: Array, source?: BabelNodeStringLiteral): BabelNodeExportNamedDeclaration; + declare function exportSpecifier(local: BabelNodeIdentifier, exported: BabelNodeIdentifier): BabelNodeExportSpecifier; + declare function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement, _await?: boolean): BabelNodeForOfStatement; + declare function importDeclaration(specifiers: Array, source: BabelNodeStringLiteral, importKind?: "type" | "typeof" | "value"): BabelNodeImportDeclaration; + declare function importDefaultSpecifier(local: BabelNodeIdentifier): BabelNodeImportDefaultSpecifier; + declare function importNamespaceSpecifier(local: BabelNodeIdentifier): BabelNodeImportNamespaceSpecifier; + declare function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier, importKind?: "type" | "typeof"): BabelNodeImportSpecifier; + declare function metaProperty(meta: BabelNodeIdentifier, property: BabelNodeIdentifier): BabelNodeMetaProperty; + declare function classMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, params: Array, body: BabelNodeBlockStatement, computed?: boolean, _static?: boolean, abstract?: boolean, access?: "public" | "private" | "protected", accessibility?: "public" | "private" | "protected", async?: boolean, decorators?: Array, generator?: boolean, optional?: boolean, returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop): BabelNodeClassMethod; + declare function objectPattern(properties: Array, decorators?: Array, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeObjectPattern; + declare function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement; + declare function taggedTemplateExpression(tag: BabelNodeExpression, quasi: BabelNodeTemplateLiteral, typeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation): BabelNodeTaggedTemplateExpression; + declare function templateElement(value: any, tail?: boolean): BabelNodeTemplateElement; + declare function templateLiteral(quasis: Array, expressions: Array): BabelNodeTemplateLiteral; + declare function yieldExpression(argument?: BabelNodeExpression, delegate?: boolean): BabelNodeYieldExpression; + declare function anyTypeAnnotation(): BabelNodeAnyTypeAnnotation; + declare function arrayTypeAnnotation(elementType: BabelNodeFlowType): BabelNodeArrayTypeAnnotation; + declare function booleanTypeAnnotation(): BabelNodeBooleanTypeAnnotation; + declare function booleanLiteralTypeAnnotation(value: boolean): BabelNodeBooleanLiteralTypeAnnotation; + declare function nullLiteralTypeAnnotation(): BabelNodeNullLiteralTypeAnnotation; + declare function classImplements(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeClassImplements; + declare function declareClass(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array, body: BabelNodeObjectTypeAnnotation, _implements?: Array, mixins?: Array): BabelNodeDeclareClass; + declare function declareFunction(id: BabelNodeIdentifier, predicate?: BabelNodeDeclaredPredicate): BabelNodeDeclareFunction; + declare function declareInterface(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array, body: BabelNodeObjectTypeAnnotation, _implements?: Array, mixins?: Array): BabelNodeDeclareInterface; + declare function declareModule(id: BabelNodeIdentifier | BabelNodeStringLiteral, body: BabelNodeBlockStatement, kind?: "CommonJS" | "ES"): BabelNodeDeclareModule; + declare function declareModuleExports(typeAnnotation: BabelNodeTypeAnnotation): BabelNodeDeclareModuleExports; + declare function declareTypeAlias(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, right: BabelNodeFlowType): BabelNodeDeclareTypeAlias; + declare function declareOpaqueType(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, supertype?: BabelNodeFlowType): BabelNodeDeclareOpaqueType; + declare function declareVariable(id: BabelNodeIdentifier): BabelNodeDeclareVariable; + declare function declareExportDeclaration(declaration?: BabelNodeFlow, specifiers?: Array, source?: BabelNodeStringLiteral, _default?: boolean): BabelNodeDeclareExportDeclaration; + declare function declareExportAllDeclaration(source: BabelNodeStringLiteral, exportKind?: ["type","value"]): BabelNodeDeclareExportAllDeclaration; + declare function declaredPredicate(value: BabelNodeFlow): BabelNodeDeclaredPredicate; + declare function existsTypeAnnotation(): BabelNodeExistsTypeAnnotation; + declare function functionTypeAnnotation(typeParameters?: BabelNodeTypeParameterDeclaration, params: Array, rest?: BabelNodeFunctionTypeParam, returnType: BabelNodeFlowType): BabelNodeFunctionTypeAnnotation; + declare function functionTypeParam(name?: BabelNodeIdentifier, typeAnnotation: BabelNodeFlowType, optional?: boolean): BabelNodeFunctionTypeParam; + declare function genericTypeAnnotation(id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeGenericTypeAnnotation; + declare function inferredPredicate(): BabelNodeInferredPredicate; + declare function interfaceExtends(id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier, typeParameters?: BabelNodeTypeParameterInstantiation): BabelNodeInterfaceExtends; + declare function interfaceDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, _extends?: Array, body: BabelNodeObjectTypeAnnotation, _implements?: Array, mixins?: Array): BabelNodeInterfaceDeclaration; + declare function interfaceTypeAnnotation(_extends?: Array, body: BabelNodeObjectTypeAnnotation): BabelNodeInterfaceTypeAnnotation; + declare function intersectionTypeAnnotation(types: Array): BabelNodeIntersectionTypeAnnotation; + declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation; + declare function emptyTypeAnnotation(): BabelNodeEmptyTypeAnnotation; + declare function nullableTypeAnnotation(typeAnnotation: BabelNodeFlowType): BabelNodeNullableTypeAnnotation; + declare function numberLiteralTypeAnnotation(value: number): BabelNodeNumberLiteralTypeAnnotation; + declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation; + declare function objectTypeAnnotation(properties: Array, indexers?: Array, callProperties?: Array, internalSlots?: Array, exact?: boolean, inexact?: boolean): BabelNodeObjectTypeAnnotation; + declare function objectTypeInternalSlot(id: BabelNodeIdentifier, value: BabelNodeFlowType, optional: boolean, _static: boolean, method: boolean): BabelNodeObjectTypeInternalSlot; + declare function objectTypeCallProperty(value: BabelNodeFlowType, _static?: boolean): BabelNodeObjectTypeCallProperty; + declare function objectTypeIndexer(id?: BabelNodeIdentifier, key: BabelNodeFlowType, value: BabelNodeFlowType, variance?: BabelNodeVariance, _static?: boolean): BabelNodeObjectTypeIndexer; + declare function objectTypeProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral, value: BabelNodeFlowType, variance?: BabelNodeVariance, kind?: "init" | "get" | "set", optional?: boolean, proto?: boolean, _static?: boolean): BabelNodeObjectTypeProperty; + declare function objectTypeSpreadProperty(argument: BabelNodeFlowType): BabelNodeObjectTypeSpreadProperty; + declare function opaqueType(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, supertype?: BabelNodeFlowType, impltype: BabelNodeFlowType): BabelNodeOpaqueType; + declare function qualifiedTypeIdentifier(id: BabelNodeIdentifier, qualification: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier): BabelNodeQualifiedTypeIdentifier; + declare function stringLiteralTypeAnnotation(value: string): BabelNodeStringLiteralTypeAnnotation; + declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation; + declare function thisTypeAnnotation(): BabelNodeThisTypeAnnotation; + declare function tupleTypeAnnotation(types: Array): BabelNodeTupleTypeAnnotation; + declare function typeofTypeAnnotation(argument: BabelNodeFlowType): BabelNodeTypeofTypeAnnotation; + declare function typeAlias(id: BabelNodeIdentifier, typeParameters?: BabelNodeTypeParameterDeclaration, right: BabelNodeFlowType): BabelNodeTypeAlias; + declare function typeAnnotation(typeAnnotation: BabelNodeFlowType): BabelNodeTypeAnnotation; + declare function typeCastExpression(expression: BabelNodeExpression, typeAnnotation: BabelNodeTypeAnnotation): BabelNodeTypeCastExpression; + declare function typeParameter(bound?: BabelNodeTypeAnnotation, _default?: BabelNodeFlowType, variance?: BabelNodeVariance, name?: string): BabelNodeTypeParameter; + declare function typeParameterDeclaration(params: Array): BabelNodeTypeParameterDeclaration; + declare function typeParameterInstantiation(params: Array): BabelNodeTypeParameterInstantiation; + declare function unionTypeAnnotation(types: Array): BabelNodeUnionTypeAnnotation; + declare function variance(kind: "minus" | "plus"): BabelNodeVariance; + declare function voidTypeAnnotation(): BabelNodeVoidTypeAnnotation; + declare function jsxAttribute(name: BabelNodeJSXIdentifier | BabelNodeJSXNamespacedName, value?: BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeStringLiteral | BabelNodeJSXExpressionContainer): BabelNodeJSXAttribute; + declare function jsxClosingElement(name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression): BabelNodeJSXClosingElement; + declare function jsxElement(openingElement: BabelNodeJSXOpeningElement, closingElement?: BabelNodeJSXClosingElement, children: Array, selfClosing: any): BabelNodeJSXElement; + declare function jsxEmptyExpression(): BabelNodeJSXEmptyExpression; + declare function jsxExpressionContainer(expression: BabelNodeExpression | BabelNodeJSXEmptyExpression): BabelNodeJSXExpressionContainer; + declare function jsxSpreadChild(expression: BabelNodeExpression): BabelNodeJSXSpreadChild; + declare function jsxIdentifier(name: string): BabelNodeJSXIdentifier; + declare function jsxMemberExpression(object: BabelNodeJSXMemberExpression | BabelNodeJSXIdentifier, property: BabelNodeJSXIdentifier): BabelNodeJSXMemberExpression; + declare function jsxNamespacedName(namespace: BabelNodeJSXIdentifier, name: BabelNodeJSXIdentifier): BabelNodeJSXNamespacedName; + declare function jsxOpeningElement(name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression, attributes: Array, selfClosing?: boolean, typeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation): BabelNodeJSXOpeningElement; + declare function jsxSpreadAttribute(argument: BabelNodeExpression): BabelNodeJSXSpreadAttribute; + declare function jsxText(value: string): BabelNodeJSXText; + declare function jsxFragment(openingFragment: BabelNodeJSXOpeningFragment, closingFragment: BabelNodeJSXClosingFragment, children: Array): BabelNodeJSXFragment; + declare function jsxOpeningFragment(): BabelNodeJSXOpeningFragment; + declare function jsxClosingFragment(): BabelNodeJSXClosingFragment; + declare function noop(): BabelNodeNoop; + declare function parenthesizedExpression(expression: BabelNodeExpression): BabelNodeParenthesizedExpression; + declare function awaitExpression(argument: BabelNodeExpression): BabelNodeAwaitExpression; + declare function bindExpression(object: any, callee: any): BabelNodeBindExpression; + declare function classProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, value?: BabelNodeExpression, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, decorators?: Array, computed?: boolean, abstract?: boolean, accessibility?: "public" | "private" | "protected", definite?: boolean, optional?: boolean, readonly?: boolean, _static?: boolean): BabelNodeClassProperty; + declare function optionalMemberExpression(object: BabelNodeExpression, property: any, computed?: boolean, optional: boolean): BabelNodeOptionalMemberExpression; + declare function pipelineTopicExpression(expression: BabelNodeExpression): BabelNodePipelineTopicExpression; + declare function pipelineBareFunction(callee: BabelNodeExpression): BabelNodePipelineBareFunction; + declare function pipelinePrimaryTopicReference(): BabelNodePipelinePrimaryTopicReference; + declare function optionalCallExpression(callee: BabelNodeExpression, _arguments: Array, optional: boolean, typeArguments?: BabelNodeTypeParameterInstantiation, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeOptionalCallExpression; + declare function classPrivateProperty(key: BabelNodePrivateName, value?: BabelNodeExpression): BabelNodeClassPrivateProperty; + declare function classPrivateMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodePrivateName, params: Array, body: BabelNodeBlockStatement, _static?: boolean, abstract?: boolean, access?: "public" | "private" | "protected", accessibility?: "public" | "private" | "protected", async?: boolean, computed?: boolean, decorators?: Array, generator?: boolean, optional?: boolean, returnType?: any, typeParameters?: any): BabelNodeClassPrivateMethod; + declare function decorator(expression: BabelNodeExpression): BabelNodeDecorator; + declare function doExpression(body: BabelNodeBlockStatement): BabelNodeDoExpression; + declare function exportDefaultSpecifier(exported: BabelNodeIdentifier): BabelNodeExportDefaultSpecifier; + declare function exportNamespaceSpecifier(exported: BabelNodeIdentifier): BabelNodeExportNamespaceSpecifier; + declare function privateName(id: BabelNodeIdentifier): BabelNodePrivateName; + declare function bigIntLiteral(value: string): BabelNodeBigIntLiteral; + declare function tsParameterProperty(parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern, accessibility?: "public" | "private" | "protected", readonly?: boolean): BabelNodeTSParameterProperty; + declare function tsDeclareFunction(id?: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop, async?: boolean, declare?: boolean, generator?: boolean): BabelNodeTSDeclareFunction; + declare function tsDeclareMethod(decorators?: Array, key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop, abstract?: boolean, access?: "public" | "private" | "protected", accessibility?: "public" | "private" | "protected", async?: boolean, computed?: boolean, generator?: boolean, kind?: "get" | "set" | "method" | "constructor", optional?: boolean, _static?: boolean): BabelNodeTSDeclareMethod; + declare function tsQualifiedName(left: BabelNodeTSEntityName, right: BabelNodeIdentifier): BabelNodeTSQualifiedName; + declare function tsCallSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters?: Array, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSCallSignatureDeclaration; + declare function tsConstructSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters?: Array, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSConstructSignatureDeclaration; + declare function tsPropertySignature(key: BabelNodeExpression, typeAnnotation?: BabelNodeTSTypeAnnotation, initializer?: BabelNodeExpression, computed?: boolean, optional?: boolean, readonly?: boolean): BabelNodeTSPropertySignature; + declare function tsMethodSignature(key: BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters?: Array, typeAnnotation?: BabelNodeTSTypeAnnotation, computed?: boolean, optional?: boolean): BabelNodeTSMethodSignature; + declare function tsIndexSignature(parameters: Array, typeAnnotation?: BabelNodeTSTypeAnnotation, readonly?: boolean): BabelNodeTSIndexSignature; + declare function tsAnyKeyword(): BabelNodeTSAnyKeyword; + declare function tsUnknownKeyword(): BabelNodeTSUnknownKeyword; + declare function tsNumberKeyword(): BabelNodeTSNumberKeyword; + declare function tsObjectKeyword(): BabelNodeTSObjectKeyword; + declare function tsBooleanKeyword(): BabelNodeTSBooleanKeyword; + declare function tsStringKeyword(): BabelNodeTSStringKeyword; + declare function tsSymbolKeyword(): BabelNodeTSSymbolKeyword; + declare function tsVoidKeyword(): BabelNodeTSVoidKeyword; + declare function tsUndefinedKeyword(): BabelNodeTSUndefinedKeyword; + declare function tsNullKeyword(): BabelNodeTSNullKeyword; + declare function tsNeverKeyword(): BabelNodeTSNeverKeyword; + declare function tsThisType(): BabelNodeTSThisType; + declare function tsFunctionType(typeParameters?: BabelNodeTSTypeParameterDeclaration, typeAnnotation?: BabelNodeTSTypeAnnotation, parameters?: Array): BabelNodeTSFunctionType; + declare function tsConstructorType(typeParameters?: BabelNodeTSTypeParameterDeclaration, typeAnnotation?: BabelNodeTSTypeAnnotation, parameters?: Array): BabelNodeTSConstructorType; + declare function tsTypeReference(typeName: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSTypeReference; + declare function tsTypePredicate(parameterName: BabelNodeIdentifier | BabelNodeTSThisType, typeAnnotation: BabelNodeTSTypeAnnotation): BabelNodeTSTypePredicate; + declare function tsTypeQuery(exprName: BabelNodeTSEntityName | BabelNodeTSImportType): BabelNodeTSTypeQuery; + declare function tsTypeLiteral(members: Array): BabelNodeTSTypeLiteral; + declare function tsArrayType(elementType: BabelNodeTSType): BabelNodeTSArrayType; + declare function tsTupleType(elementTypes: Array): BabelNodeTSTupleType; + declare function tsOptionalType(typeAnnotation: BabelNodeTSType): BabelNodeTSOptionalType; + declare function tsRestType(typeAnnotation: BabelNodeTSType): BabelNodeTSRestType; + declare function tsUnionType(types: Array): BabelNodeTSUnionType; + declare function tsIntersectionType(types: Array): BabelNodeTSIntersectionType; + declare function tsConditionalType(checkType: BabelNodeTSType, extendsType: BabelNodeTSType, trueType: BabelNodeTSType, falseType: BabelNodeTSType): BabelNodeTSConditionalType; + declare function tsInferType(typeParameter: BabelNodeTSTypeParameter): BabelNodeTSInferType; + declare function tsParenthesizedType(typeAnnotation: BabelNodeTSType): BabelNodeTSParenthesizedType; + declare function tsTypeOperator(typeAnnotation: BabelNodeTSType, operator?: string): BabelNodeTSTypeOperator; + declare function tsIndexedAccessType(objectType: BabelNodeTSType, indexType: BabelNodeTSType): BabelNodeTSIndexedAccessType; + declare function tsMappedType(typeParameter: BabelNodeTSTypeParameter, typeAnnotation?: BabelNodeTSType, optional?: boolean, readonly?: boolean): BabelNodeTSMappedType; + declare function tsLiteralType(literal: BabelNodeNumericLiteral | BabelNodeStringLiteral | BabelNodeBooleanLiteral): BabelNodeTSLiteralType; + declare function tsExpressionWithTypeArguments(expression: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSExpressionWithTypeArguments; + declare function tsInterfaceDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration, _extends?: Array, body: BabelNodeTSInterfaceBody, declare?: boolean): BabelNodeTSInterfaceDeclaration; + declare function tsInterfaceBody(body: Array): BabelNodeTSInterfaceBody; + declare function tsTypeAliasDeclaration(id: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration, typeAnnotation: BabelNodeTSType, declare?: boolean): BabelNodeTSTypeAliasDeclaration; + declare function tsAsExpression(expression: BabelNodeExpression, typeAnnotation: BabelNodeTSType): BabelNodeTSAsExpression; + declare function tsTypeAssertion(typeAnnotation: BabelNodeTSType, expression: BabelNodeExpression): BabelNodeTSTypeAssertion; + declare function tsEnumDeclaration(id: BabelNodeIdentifier, members: Array, _const?: boolean, declare?: boolean, initializer?: BabelNodeExpression): BabelNodeTSEnumDeclaration; + declare function tsEnumMember(id: BabelNodeIdentifier | BabelNodeStringLiteral, initializer?: BabelNodeExpression): BabelNodeTSEnumMember; + declare function tsModuleDeclaration(id: BabelNodeIdentifier | BabelNodeStringLiteral, body: BabelNodeTSModuleBlock | BabelNodeTSModuleDeclaration, declare?: boolean, global?: boolean): BabelNodeTSModuleDeclaration; + declare function tsModuleBlock(body: Array): BabelNodeTSModuleBlock; + declare function tsImportType(argument: BabelNodeStringLiteral, qualifier?: BabelNodeTSEntityName, typeParameters?: BabelNodeTSTypeParameterInstantiation): BabelNodeTSImportType; + declare function tsImportEqualsDeclaration(id: BabelNodeIdentifier, moduleReference: BabelNodeTSEntityName | BabelNodeTSExternalModuleReference, isExport?: boolean): BabelNodeTSImportEqualsDeclaration; + declare function tsExternalModuleReference(expression: BabelNodeStringLiteral): BabelNodeTSExternalModuleReference; + declare function tsNonNullExpression(expression: BabelNodeExpression): BabelNodeTSNonNullExpression; + declare function tsExportAssignment(expression: BabelNodeExpression): BabelNodeTSExportAssignment; + declare function tsNamespaceExportDeclaration(id: BabelNodeIdentifier): BabelNodeTSNamespaceExportDeclaration; + declare function tsTypeAnnotation(typeAnnotation: BabelNodeTSType): BabelNodeTSTypeAnnotation; + declare function tsTypeParameterInstantiation(params: Array): BabelNodeTSTypeParameterInstantiation; + declare function tsTypeParameterDeclaration(params: Array): BabelNodeTSTypeParameterDeclaration; + declare function tsTypeParameter(constraint?: BabelNodeTSType, _default?: BabelNodeTSType, name?: string): BabelNodeTSTypeParameter; + declare function isArrayExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayExpression) + declare function isAssignmentExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentExpression) + declare function isBinaryExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBinaryExpression) + declare function isInterpreterDirective(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterpreterDirective) + declare function isDirective(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirective) + declare function isDirectiveLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDirectiveLiteral) + declare function isBlockStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBlockStatement) + declare function isBreakStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBreakStatement) + declare function isCallExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCallExpression) + declare function isCatchClause(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeCatchClause) + declare function isConditionalExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeConditionalExpression) + declare function isContinueStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeContinueStatement) + declare function isDebuggerStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDebuggerStatement) + declare function isDoWhileStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoWhileStatement) + declare function isEmptyStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyStatement) + declare function isExpressionStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExpressionStatement) + declare function isFile(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFile) + declare function isForInStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForInStatement) + declare function isForStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForStatement) + declare function isFunctionDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionDeclaration) + declare function isFunctionExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionExpression) + declare function isIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIdentifier) + declare function isIfStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIfStatement) + declare function isLabeledStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLabeledStatement) + declare function isStringLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteral) + declare function isNumericLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumericLiteral) + declare function isNullLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteral) + declare function isBooleanLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteral) + declare function isRegExpLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRegExpLiteral) + declare function isLogicalExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeLogicalExpression) + declare function isMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMemberExpression) + declare function isNewExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNewExpression) + declare function isProgram(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeProgram) + declare function isObjectExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectExpression) + declare function isObjectMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectMethod) + declare function isObjectProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectProperty) + declare function isRestElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeRestElement) + declare function isReturnStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeReturnStatement) + declare function isSequenceExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSequenceExpression) + declare function isSwitchCase(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchCase) + declare function isSwitchStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSwitchStatement) + declare function isThisExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisExpression) + declare function isThrowStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThrowStatement) + declare function isTryStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTryStatement) + declare function isUnaryExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnaryExpression) + declare function isUpdateExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUpdateExpression) + declare function isVariableDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclaration) + declare function isVariableDeclarator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariableDeclarator) + declare function isWhileStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWhileStatement) + declare function isWithStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeWithStatement) + declare function isAssignmentPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAssignmentPattern) + declare function isArrayPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayPattern) + declare function isArrowFunctionExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrowFunctionExpression) + declare function isClassBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassBody) + declare function isClassDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassDeclaration) + declare function isClassExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassExpression) + declare function isExportAllDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportAllDeclaration) + declare function isExportDefaultDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultDeclaration) + declare function isExportNamedDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamedDeclaration) + declare function isExportSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportSpecifier) + declare function isForOfStatement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeForOfStatement) + declare function isImportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDeclaration) + declare function isImportDefaultSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportDefaultSpecifier) + declare function isImportNamespaceSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportNamespaceSpecifier) + declare function isImportSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImportSpecifier) + declare function isMetaProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMetaProperty) + declare function isClassMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassMethod) + declare function isObjectPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectPattern) + declare function isSpreadElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSpreadElement) + declare function isSuper(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeSuper) + declare function isTaggedTemplateExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTaggedTemplateExpression) + declare function isTemplateElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateElement) + declare function isTemplateLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTemplateLiteral) + declare function isYieldExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeYieldExpression) + declare function isAnyTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAnyTypeAnnotation) + declare function isArrayTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeArrayTypeAnnotation) + declare function isBooleanTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanTypeAnnotation) + declare function isBooleanLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBooleanLiteralTypeAnnotation) + declare function isNullLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullLiteralTypeAnnotation) + declare function isClassImplements(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassImplements) + declare function isDeclareClass(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareClass) + declare function isDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareFunction) + declare function isDeclareInterface(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareInterface) + declare function isDeclareModule(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModule) + declare function isDeclareModuleExports(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareModuleExports) + declare function isDeclareTypeAlias(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareTypeAlias) + declare function isDeclareOpaqueType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareOpaqueType) + declare function isDeclareVariable(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareVariable) + declare function isDeclareExportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportDeclaration) + declare function isDeclareExportAllDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclareExportAllDeclaration) + declare function isDeclaredPredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDeclaredPredicate) + declare function isExistsTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExistsTypeAnnotation) + declare function isFunctionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeAnnotation) + declare function isFunctionTypeParam(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeFunctionTypeParam) + declare function isGenericTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeGenericTypeAnnotation) + declare function isInferredPredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInferredPredicate) + declare function isInterfaceExtends(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceExtends) + declare function isInterfaceDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceDeclaration) + declare function isInterfaceTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeInterfaceTypeAnnotation) + declare function isIntersectionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeIntersectionTypeAnnotation) + declare function isMixedTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeMixedTypeAnnotation) + declare function isEmptyTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeEmptyTypeAnnotation) + declare function isNullableTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNullableTypeAnnotation) + declare function isNumberLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberLiteralTypeAnnotation) + declare function isNumberTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNumberTypeAnnotation) + declare function isObjectTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeAnnotation) + declare function isObjectTypeInternalSlot(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeInternalSlot) + declare function isObjectTypeCallProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeCallProperty) + declare function isObjectTypeIndexer(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeIndexer) + declare function isObjectTypeProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeProperty) + declare function isObjectTypeSpreadProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeObjectTypeSpreadProperty) + declare function isOpaqueType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOpaqueType) + declare function isQualifiedTypeIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeQualifiedTypeIdentifier) + declare function isStringLiteralTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringLiteralTypeAnnotation) + declare function isStringTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeStringTypeAnnotation) + declare function isThisTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeThisTypeAnnotation) + declare function isTupleTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTupleTypeAnnotation) + declare function isTypeofTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeofTypeAnnotation) + declare function isTypeAlias(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAlias) + declare function isTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeAnnotation) + declare function isTypeCastExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeCastExpression) + declare function isTypeParameter(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameter) + declare function isTypeParameterDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterDeclaration) + declare function isTypeParameterInstantiation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTypeParameterInstantiation) + declare function isUnionTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeUnionTypeAnnotation) + declare function isVariance(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVariance) + declare function isVoidTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVoidTypeAnnotation) + declare function isJSXAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXAttribute) + declare function isJSXClosingElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXClosingElement) + declare function isJSXElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXElement) + declare function isJSXEmptyExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXEmptyExpression) + declare function isJSXExpressionContainer(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXExpressionContainer) + declare function isJSXSpreadChild(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadChild) + declare function isJSXIdentifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXIdentifier) + declare function isJSXMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXMemberExpression) + declare function isJSXNamespacedName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXNamespacedName) + declare function isJSXOpeningElement(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXOpeningElement) + declare function isJSXSpreadAttribute(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXSpreadAttribute) + declare function isJSXText(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXText) + declare function isJSXFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXFragment) + declare function isJSXOpeningFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXOpeningFragment) + declare function isJSXClosingFragment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeJSXClosingFragment) + declare function isNoop(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeNoop) + declare function isParenthesizedExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeParenthesizedExpression) + declare function isAwaitExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeAwaitExpression) + declare function isBindExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBindExpression) + declare function isClassProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassProperty) + declare function isOptionalMemberExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOptionalMemberExpression) + declare function isPipelineTopicExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelineTopicExpression) + declare function isPipelineBareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelineBareFunction) + declare function isPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelinePrimaryTopicReference) + declare function isOptionalCallExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeOptionalCallExpression) + declare function isClassPrivateProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassPrivateProperty) + declare function isClassPrivateMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeClassPrivateMethod) + declare function isImport(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeImport) + declare function isDecorator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDecorator) + declare function isDoExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeDoExpression) + declare function isExportDefaultSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportDefaultSpecifier) + declare function isExportNamespaceSpecifier(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeExportNamespaceSpecifier) + declare function isPrivateName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePrivateName) + declare function isBigIntLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeBigIntLiteral) + declare function isTSParameterProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParameterProperty) + declare function isTSDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareFunction) + declare function isTSDeclareMethod(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareMethod) + declare function isTSQualifiedName(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSQualifiedName) + declare function isTSCallSignatureDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSCallSignatureDeclaration) + declare function isTSConstructSignatureDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructSignatureDeclaration) + declare function isTSPropertySignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSPropertySignature) + declare function isTSMethodSignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMethodSignature) + declare function isTSIndexSignature(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexSignature) + declare function isTSAnyKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAnyKeyword) + declare function isTSUnknownKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUnknownKeyword) + declare function isTSNumberKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNumberKeyword) + declare function isTSObjectKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSObjectKeyword) + declare function isTSBooleanKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSBooleanKeyword) + declare function isTSStringKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSStringKeyword) + declare function isTSSymbolKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSSymbolKeyword) + declare function isTSVoidKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSVoidKeyword) + declare function isTSUndefinedKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUndefinedKeyword) + declare function isTSNullKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNullKeyword) + declare function isTSNeverKeyword(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNeverKeyword) + declare function isTSThisType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSThisType) + declare function isTSFunctionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSFunctionType) + declare function isTSConstructorType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConstructorType) + declare function isTSTypeReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeReference) + declare function isTSTypePredicate(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypePredicate) + declare function isTSTypeQuery(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeQuery) + declare function isTSTypeLiteral(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeLiteral) + declare function isTSArrayType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSArrayType) + declare function isTSTupleType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTupleType) + declare function isTSOptionalType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSOptionalType) + declare function isTSRestType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSRestType) + declare function isTSUnionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSUnionType) + declare function isTSIntersectionType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIntersectionType) + declare function isTSConditionalType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSConditionalType) + declare function isTSInferType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInferType) + declare function isTSParenthesizedType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParenthesizedType) + declare function isTSTypeOperator(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeOperator) + declare function isTSIndexedAccessType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSIndexedAccessType) + declare function isTSMappedType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSMappedType) + declare function isTSLiteralType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSLiteralType) + declare function isTSExpressionWithTypeArguments(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExpressionWithTypeArguments) + declare function isTSInterfaceDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceDeclaration) + declare function isTSInterfaceBody(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSInterfaceBody) + declare function isTSTypeAliasDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAliasDeclaration) + declare function isTSAsExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSAsExpression) + declare function isTSTypeAssertion(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAssertion) + declare function isTSEnumDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumDeclaration) + declare function isTSEnumMember(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSEnumMember) + declare function isTSModuleDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleDeclaration) + declare function isTSModuleBlock(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSModuleBlock) + declare function isTSImportType(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSImportType) + declare function isTSImportEqualsDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSImportEqualsDeclaration) + declare function isTSExternalModuleReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExternalModuleReference) + declare function isTSNonNullExpression(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNonNullExpression) + declare function isTSExportAssignment(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSExportAssignment) + declare function isTSNamespaceExportDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSNamespaceExportDeclaration) + declare function isTSTypeAnnotation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeAnnotation) + declare function isTSTypeParameterInstantiation(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterInstantiation) + declare function isTSTypeParameterDeclaration(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameterDeclaration) + declare function isTSTypeParameter(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSTypeParameter) + declare function isExpression(node: ?Object, opts?: ?Object): boolean + declare function isBinary(node: ?Object, opts?: ?Object): boolean + declare function isScopable(node: ?Object, opts?: ?Object): boolean + declare function isBlockParent(node: ?Object, opts?: ?Object): boolean + declare function isBlock(node: ?Object, opts?: ?Object): boolean + declare function isStatement(node: ?Object, opts?: ?Object): boolean + declare function isTerminatorless(node: ?Object, opts?: ?Object): boolean + declare function isCompletionStatement(node: ?Object, opts?: ?Object): boolean + declare function isConditional(node: ?Object, opts?: ?Object): boolean + declare function isLoop(node: ?Object, opts?: ?Object): boolean + declare function isWhile(node: ?Object, opts?: ?Object): boolean + declare function isExpressionWrapper(node: ?Object, opts?: ?Object): boolean + declare function isFor(node: ?Object, opts?: ?Object): boolean + declare function isForXStatement(node: ?Object, opts?: ?Object): boolean + declare function isFunction(node: ?Object, opts?: ?Object): boolean + declare function isFunctionParent(node: ?Object, opts?: ?Object): boolean + declare function isPureish(node: ?Object, opts?: ?Object): boolean + declare function isDeclaration(node: ?Object, opts?: ?Object): boolean + declare function isPatternLike(node: ?Object, opts?: ?Object): boolean + declare function isLVal(node: ?Object, opts?: ?Object): boolean + declare function isTSEntityName(node: ?Object, opts?: ?Object): boolean + declare function isLiteral(node: ?Object, opts?: ?Object): boolean + declare function isImmutable(node: ?Object, opts?: ?Object): boolean + declare function isUserWhitespacable(node: ?Object, opts?: ?Object): boolean + declare function isMethod(node: ?Object, opts?: ?Object): boolean + declare function isObjectMember(node: ?Object, opts?: ?Object): boolean + declare function isProperty(node: ?Object, opts?: ?Object): boolean + declare function isUnaryLike(node: ?Object, opts?: ?Object): boolean + declare function isPattern(node: ?Object, opts?: ?Object): boolean + declare function isClass(node: ?Object, opts?: ?Object): boolean + declare function isModuleDeclaration(node: ?Object, opts?: ?Object): boolean + declare function isExportDeclaration(node: ?Object, opts?: ?Object): boolean + declare function isModuleSpecifier(node: ?Object, opts?: ?Object): boolean + declare function isFlow(node: ?Object, opts?: ?Object): boolean + declare function isFlowType(node: ?Object, opts?: ?Object): boolean + declare function isFlowBaseAnnotation(node: ?Object, opts?: ?Object): boolean + declare function isFlowDeclaration(node: ?Object, opts?: ?Object): boolean + declare function isFlowPredicate(node: ?Object, opts?: ?Object): boolean + declare function isJSX(node: ?Object, opts?: ?Object): boolean + declare function isPrivate(node: ?Object, opts?: ?Object): boolean + declare function isTSTypeElement(node: ?Object, opts?: ?Object): boolean + declare function isTSType(node: ?Object, opts?: ?Object): boolean + declare function isNumberLiteral(node: ?Object, opts?: ?Object): boolean + declare function isRegexLiteral(node: ?Object, opts?: ?Object): boolean + declare function isRestProperty(node: ?Object, opts?: ?Object): boolean + declare function isSpreadProperty(node: ?Object, opts?: ?Object): boolean + declare function validate(n: BabelNode, key: string, value: mixed): void; + declare function clone(n: T): T; + declare function cloneDeep(n: T): T; + declare function removeProperties(n: T, opts: ?{}): void; + declare function removePropertiesDeep(n: T, opts: ?{}): T; + declare type TraversalAncestors = Array<{ + node: BabelNode, + key: string, + index?: number, + }>; + declare type TraversalHandler = (BabelNode, TraversalAncestors, T) => void; + declare type TraversalHandlers = { + enter?: TraversalHandler, + exit?: TraversalHandler, + }; + declare function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void; +} diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js index f9d971c6237d1c..6a0ac93c5cf9b1 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js @@ -1,15 +1,13 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = appendToMemberExpression; var _generated = require("../builders/generated"); -function appendToMemberExpression(member, append, computed) { - if (computed === void 0) { - computed = false; - } - +function appendToMemberExpression(member, append, computed = false) { member.object = (0, _generated.memberExpression)(member.object, member.property, member.computed); member.property = append; member.computed = !!computed; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js index c0f402088c52ce..089179e2579ab5 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js @@ -1,18 +1,20 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = removeTypeDuplicates; var _generated = require("../../validators/generated"); function removeTypeDuplicates(nodes) { - var generics = {}; - var bases = {}; - var typeGroups = []; - var types = []; + const generics = {}; + const bases = {}; + const typeGroups = []; + const types = []; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; + for (let i = 0; i < nodes.length; i++) { + const node = nodes[i]; if (!node) continue; if (types.indexOf(node) >= 0) { @@ -38,10 +40,10 @@ function removeTypeDuplicates(nodes) { } if ((0, _generated.isGenericTypeAnnotation)(node)) { - var name = node.id.name; + const name = node.id.name; if (generics[name]) { - var existing = generics[name]; + let existing = generics[name]; if (existing.typeParameters) { if (node.typeParameters) { @@ -60,12 +62,12 @@ function removeTypeDuplicates(nodes) { types.push(node); } - for (var type in bases) { + for (const type in bases) { types.push(bases[type]); } - for (var _name in generics) { - types.push(generics[_name]); + for (const name in generics) { + types.push(generics[name]); } return types; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/inherits.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/inherits.js index 195f714cf3afd3..452811d37682f8 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/inherits.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/inherits.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = inherits; var _constants = require("../constants"); @@ -11,25 +13,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function inherits(child, parent) { if (!child || !parent) return child; - var _arr = _constants.INHERIT_KEYS.optional; - - for (var _i = 0; _i < _arr.length; _i++) { - var key = _arr[_i]; + for (const key of _constants.INHERIT_KEYS.optional) { if (child[key] == null) { child[key] = parent[key]; } } - for (var _key in parent) { - if (_key[0] === "_" && _key !== "__clone") child[_key] = parent[_key]; + for (const key in parent) { + if (key[0] === "_" && key !== "__clone") child[key] = parent[key]; } - var _arr2 = _constants.INHERIT_KEYS.force; - - for (var _i2 = 0; _i2 < _arr2.length; _i2++) { - var _key2 = _arr2[_i2]; - child[_key2] = parent[_key2]; + for (const key of _constants.INHERIT_KEYS.force) { + child[key] = parent[key]; } (0, _inheritsComments.default)(child, parent); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js index 9b0f8aef69a1c7..ee6de0ec332885 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = prependToMemberExpression; var _generated = require("../builders/generated"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removeProperties.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removeProperties.js index 0f3a5c31b8be4c..913598168801c8 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removeProperties.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removeProperties.js @@ -1,56 +1,30 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = removeProperties; var _constants = require("../constants"); -var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; +const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; -var CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); +const CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); -function removeProperties(node, opts) { - if (opts === void 0) { - opts = {}; - } - - var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; - - for (var _iterator = map, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; +function removeProperties(node, opts = {}) { + const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var _key2 = _ref; - if (node[_key2] != null) node[_key2] = undefined; + for (const key of map) { + if (node[key] != null) node[key] = undefined; } - for (var _key in node) { - if (_key[0] === "_" && node[_key] != null) node[_key] = undefined; + for (const key in node) { + if (key[0] === "_" && node[key] != null) node[key] = undefined; } - var symbols = Object.getOwnPropertySymbols(node); - - for (var _iterator2 = symbols, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } + const symbols = Object.getOwnPropertySymbols(node); - var _sym = _ref2; - node[_sym] = null; + for (const sym of symbols) { + node[sym] = null; } } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js index 78453469680298..d11a84a8327c62 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = removePropertiesDeep; var _traverseFast = _interopRequireDefault(require("../traverse/traverseFast")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js index 689b15e6a4cc38..189f4b8eb3be51 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js @@ -1,22 +1,24 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = getBindingIdentifiers; var _generated = require("../validators/generated"); function getBindingIdentifiers(node, duplicates, outerOnly) { - var search = [].concat(node); - var ids = Object.create(null); + let search = [].concat(node); + const ids = Object.create(null); while (search.length) { - var id = search.shift(); + const id = search.shift(); if (!id) continue; - var keys = getBindingIdentifiers.keys[id.type]; + const keys = getBindingIdentifiers.keys[id.type]; if ((0, _generated.isIdentifier)(id)) { if (duplicates) { - var _ids = ids[id.name] = ids[id.name] || []; + const _ids = ids[id.name] = ids[id.name] || []; _ids.push(id); } else { @@ -46,8 +48,8 @@ function getBindingIdentifiers(node, duplicates, outerOnly) { } if (keys) { - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; if (id[key]) { search = search.concat(id[key]); @@ -64,6 +66,9 @@ getBindingIdentifiers.keys = { DeclareFunction: ["id"], DeclareModule: ["id"], DeclareVariable: ["id"], + DeclareInterface: ["id"], + DeclareTypeAlias: ["id"], + DeclareOpaqueType: ["id"], InterfaceDeclaration: ["id"], TypeAlias: ["id"], OpaqueType: ["id"], @@ -80,6 +85,9 @@ getBindingIdentifiers.keys = { ExportDefaultSpecifier: ["exported"], FunctionDeclaration: ["id", "params"], FunctionExpression: ["id", "params"], + ArrowFunctionExpression: ["params"], + ObjectMethod: ["params"], + ClassMethod: ["params"], ForInStatement: ["left"], ForOfStatement: ["left"], ClassDeclaration: ["id"], diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js index 367f2d87a523eb..8e1e3cb200d864 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = getOuterBindingIdentifiers; var _getBindingIdentifiers = _interopRequireDefault(require("./getBindingIdentifiers")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverse.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverse.js index b51ed99de03a7e..775aed1eede16c 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverse.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverse.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = traverse; var _definitions = require("../definitions"); @@ -12,39 +14,28 @@ function traverse(node, handlers, state) { }; } - var _ref = handlers, - enter = _ref.enter, - exit = _ref.exit; + const { + enter, + exit + } = handlers; traverseSimpleImpl(node, enter, exit, state, []); } function traverseSimpleImpl(node, enter, exit, state, ancestors) { - var keys = _definitions.VISITOR_KEYS[node.type]; + const keys = _definitions.VISITOR_KEYS[node.type]; if (!keys) return; if (enter) enter(node, ancestors, state); - for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref2; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref2 = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref2 = _i.value; - } - - var _key2 = _ref2; - var subNode = node[_key2]; + for (const key of keys) { + const subNode = node[key]; if (Array.isArray(subNode)) { - for (var i = 0; i < subNode.length; i++) { - var child = subNode[i]; + for (let i = 0; i < subNode.length; i++) { + const child = subNode[i]; if (!child) continue; ancestors.push({ - node: node, - key: _key2, + node, + key, index: i }); traverseSimpleImpl(child, enter, exit, state, ancestors); @@ -52,8 +43,8 @@ function traverseSimpleImpl(node, enter, exit, state, ancestors) { } } else if (subNode) { ancestors.push({ - node: node, - key: _key2 + node, + key }); traverseSimpleImpl(subNode, enter, exit, state, ancestors); ancestors.pop(); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverseFast.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverseFast.js index 1ccd727f367aa7..f038dd835ed939 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverseFast.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/traverse/traverseFast.js @@ -1,47 +1,25 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = traverseFast; var _definitions = require("../definitions"); function traverseFast(node, enter, opts) { if (!node) return; - var keys = _definitions.VISITOR_KEYS[node.type]; + const keys = _definitions.VISITOR_KEYS[node.type]; if (!keys) return; opts = opts || {}; enter(node, opts); - for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var _key = _ref; - var subNode = node[_key]; + for (const key of keys) { + const subNode = node[key]; if (Array.isArray(subNode)) { - for (var _iterator2 = subNode, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - var _node2 = _ref2; - traverseFast(_node2, enter, opts); + for (const node of subNode) { + traverseFast(node, enter, opts); } } else { traverseFast(subNode, enter, opts); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/inherit.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/inherit.js index 6c57f50d239af4..46b32efe8a5ce5 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/inherit.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/inherit.js @@ -1,14 +1,24 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = inherit; -var _uniq = _interopRequireDefault(require("lodash/uniq")); +function _uniq() { + const data = _interopRequireDefault(require("lodash/uniq")); + + _uniq = function () { + return data; + }; + + return data; +} function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function inherit(key, child, parent) { if (child && parent) { - child[key] = (0, _uniq.default)([].concat(child[key], parent[key]).filter(Boolean)); + child[key] = (0, _uniq().default)([].concat(child[key], parent[key]).filter(Boolean)); } } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js index 84de7435c9aa11..f0ca13369be108 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js @@ -1,28 +1,30 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = cleanJSXElementLiteralChild; var _generated = require("../../builders/generated"); function cleanJSXElementLiteralChild(child, args) { - var lines = child.value.split(/\r\n|\n|\r/); - var lastNonEmptyLine = 0; + const lines = child.value.split(/\r\n|\n|\r/); + let lastNonEmptyLine = 0; - for (var i = 0; i < lines.length; i++) { + for (let i = 0; i < lines.length; i++) { if (lines[i].match(/[^ \t]/)) { lastNonEmptyLine = i; } } - var str = ""; + let str = ""; - for (var _i = 0; _i < lines.length; _i++) { - var line = lines[_i]; - var isFirstLine = _i === 0; - var isLastLine = _i === lines.length - 1; - var isLastNonEmptyLine = _i === lastNonEmptyLine; - var trimmedLine = line.replace(/\t/g, " "); + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + const isFirstLine = i === 0; + const isLastLine = i === lines.length - 1; + const isLastNonEmptyLine = i === lastNonEmptyLine; + let trimmedLine = line.replace(/\t/g, " "); if (!isFirstLine) { trimmedLine = trimmedLine.replace(/^[ ]+/, ""); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/shallowEqual.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/shallowEqual.js index 8969d543a854d7..fae259e4fc5311 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/shallowEqual.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/shallowEqual.js @@ -1,15 +1,14 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = shallowEqual; function shallowEqual(actual, expected) { - var keys = Object.keys(expected); - var _arr = keys; - - for (var _i = 0; _i < _arr.length; _i++) { - var key = _arr[_i]; + const keys = Object.keys(expected); + for (const key of keys) { if (actual[key] !== expected[key]) { return false; } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js index 5c5d242d196852..0faa29c5d610d4 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = buildMatchMemberExpression; var _matchesPattern = _interopRequireDefault(require("./matchesPattern")); @@ -8,8 +10,6 @@ var _matchesPattern = _interopRequireDefault(require("./matchesPattern")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function buildMatchMemberExpression(match, allowPartial) { - var parts = match.split("."); - return function (member) { - return (0, _matchesPattern.default)(member, parts, allowPartial); - }; + const parts = match.split("."); + return member => (0, _matchesPattern.default)(member, parts, allowPartial); } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/generated/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/generated/index.js index 684966d41dfe06..93edeab2de0293 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/generated/index.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/generated/index.js @@ -1,9 +1,12 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.isArrayExpression = isArrayExpression; exports.isAssignmentExpression = isAssignmentExpression; exports.isBinaryExpression = isBinaryExpression; +exports.isInterpreterDirective = isInterpreterDirective; exports.isDirective = isDirective; exports.isDirectiveLiteral = isDirectiveLiteral; exports.isBlockStatement = isBlockStatement; @@ -98,6 +101,7 @@ exports.isGenericTypeAnnotation = isGenericTypeAnnotation; exports.isInferredPredicate = isInferredPredicate; exports.isInterfaceExtends = isInterfaceExtends; exports.isInterfaceDeclaration = isInterfaceDeclaration; +exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation; exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation; exports.isMixedTypeAnnotation = isMixedTypeAnnotation; exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation; @@ -105,6 +109,7 @@ exports.isNullableTypeAnnotation = isNullableTypeAnnotation; exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation; exports.isNumberTypeAnnotation = isNumberTypeAnnotation; exports.isObjectTypeAnnotation = isObjectTypeAnnotation; +exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot; exports.isObjectTypeCallProperty = isObjectTypeCallProperty; exports.isObjectTypeIndexer = isObjectTypeIndexer; exports.isObjectTypeProperty = isObjectTypeProperty; @@ -123,6 +128,7 @@ exports.isTypeParameter = isTypeParameter; exports.isTypeParameterDeclaration = isTypeParameterDeclaration; exports.isTypeParameterInstantiation = isTypeParameterInstantiation; exports.isUnionTypeAnnotation = isUnionTypeAnnotation; +exports.isVariance = isVariance; exports.isVoidTypeAnnotation = isVoidTypeAnnotation; exports.isJSXAttribute = isJSXAttribute; exports.isJSXClosingElement = isJSXClosingElement; @@ -144,11 +150,20 @@ exports.isParenthesizedExpression = isParenthesizedExpression; exports.isAwaitExpression = isAwaitExpression; exports.isBindExpression = isBindExpression; exports.isClassProperty = isClassProperty; +exports.isOptionalMemberExpression = isOptionalMemberExpression; +exports.isPipelineTopicExpression = isPipelineTopicExpression; +exports.isPipelineBareFunction = isPipelineBareFunction; +exports.isPipelinePrimaryTopicReference = isPipelinePrimaryTopicReference; +exports.isOptionalCallExpression = isOptionalCallExpression; +exports.isClassPrivateProperty = isClassPrivateProperty; +exports.isClassPrivateMethod = isClassPrivateMethod; exports.isImport = isImport; exports.isDecorator = isDecorator; exports.isDoExpression = isDoExpression; exports.isExportDefaultSpecifier = isExportDefaultSpecifier; exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier; +exports.isPrivateName = isPrivateName; +exports.isBigIntLiteral = isBigIntLiteral; exports.isTSParameterProperty = isTSParameterProperty; exports.isTSDeclareFunction = isTSDeclareFunction; exports.isTSDeclareMethod = isTSDeclareMethod; @@ -159,6 +174,7 @@ exports.isTSPropertySignature = isTSPropertySignature; exports.isTSMethodSignature = isTSMethodSignature; exports.isTSIndexSignature = isTSIndexSignature; exports.isTSAnyKeyword = isTSAnyKeyword; +exports.isTSUnknownKeyword = isTSUnknownKeyword; exports.isTSNumberKeyword = isTSNumberKeyword; exports.isTSObjectKeyword = isTSObjectKeyword; exports.isTSBooleanKeyword = isTSBooleanKeyword; @@ -177,8 +193,12 @@ exports.isTSTypeQuery = isTSTypeQuery; exports.isTSTypeLiteral = isTSTypeLiteral; exports.isTSArrayType = isTSArrayType; exports.isTSTupleType = isTSTupleType; +exports.isTSOptionalType = isTSOptionalType; +exports.isTSRestType = isTSRestType; exports.isTSUnionType = isTSUnionType; exports.isTSIntersectionType = isTSIntersectionType; +exports.isTSConditionalType = isTSConditionalType; +exports.isTSInferType = isTSInferType; exports.isTSParenthesizedType = isTSParenthesizedType; exports.isTSTypeOperator = isTSTypeOperator; exports.isTSIndexedAccessType = isTSIndexedAccessType; @@ -194,6 +214,7 @@ exports.isTSEnumDeclaration = isTSEnumDeclaration; exports.isTSEnumMember = isTSEnumMember; exports.isTSModuleDeclaration = isTSModuleDeclaration; exports.isTSModuleBlock = isTSModuleBlock; +exports.isTSImportType = isTSImportType; exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration; exports.isTSExternalModuleReference = isTSExternalModuleReference; exports.isTSNonNullExpression = isTSNonNullExpression; @@ -237,10 +258,12 @@ exports.isModuleDeclaration = isModuleDeclaration; exports.isExportDeclaration = isExportDeclaration; exports.isModuleSpecifier = isModuleSpecifier; exports.isFlow = isFlow; +exports.isFlowType = isFlowType; exports.isFlowBaseAnnotation = isFlowBaseAnnotation; exports.isFlowDeclaration = isFlowDeclaration; exports.isFlowPredicate = isFlowPredicate; exports.isJSX = isJSX; +exports.isPrivate = isPrivate; exports.isTSTypeElement = isTSTypeElement; exports.isTSType = isTSType; exports.isNumberLiteral = isNumberLiteral; @@ -248,994 +271,4015 @@ exports.isRegexLiteral = isRegexLiteral; exports.isRestProperty = isRestProperty; exports.isSpreadProperty = isSpreadProperty; -var _is = _interopRequireDefault(require("../is")); +var _shallowEqual = _interopRequireDefault(require("../../utils/shallowEqual")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function isArrayExpression(node, opts) { - return (0, _is.default)("ArrayExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ArrayExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isAssignmentExpression(node, opts) { - return (0, _is.default)("AssignmentExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "AssignmentExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBinaryExpression(node, opts) { - return (0, _is.default)("BinaryExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BinaryExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isInterpreterDirective(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "InterpreterDirective") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDirective(node, opts) { - return (0, _is.default)("Directive", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Directive") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDirectiveLiteral(node, opts) { - return (0, _is.default)("DirectiveLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DirectiveLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBlockStatement(node, opts) { - return (0, _is.default)("BlockStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BlockStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBreakStatement(node, opts) { - return (0, _is.default)("BreakStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BreakStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isCallExpression(node, opts) { - return (0, _is.default)("CallExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "CallExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isCatchClause(node, opts) { - return (0, _is.default)("CatchClause", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "CatchClause") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isConditionalExpression(node, opts) { - return (0, _is.default)("ConditionalExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ConditionalExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isContinueStatement(node, opts) { - return (0, _is.default)("ContinueStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ContinueStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDebuggerStatement(node, opts) { - return (0, _is.default)("DebuggerStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DebuggerStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDoWhileStatement(node, opts) { - return (0, _is.default)("DoWhileStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DoWhileStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isEmptyStatement(node, opts) { - return (0, _is.default)("EmptyStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "EmptyStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExpressionStatement(node, opts) { - return (0, _is.default)("ExpressionStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExpressionStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFile(node, opts) { - return (0, _is.default)("File", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "File") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isForInStatement(node, opts) { - return (0, _is.default)("ForInStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ForInStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isForStatement(node, opts) { - return (0, _is.default)("ForStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ForStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFunctionDeclaration(node, opts) { - return (0, _is.default)("FunctionDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FunctionDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFunctionExpression(node, opts) { - return (0, _is.default)("FunctionExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FunctionExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isIdentifier(node, opts) { - return (0, _is.default)("Identifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Identifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isIfStatement(node, opts) { - return (0, _is.default)("IfStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "IfStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isLabeledStatement(node, opts) { - return (0, _is.default)("LabeledStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "LabeledStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isStringLiteral(node, opts) { - return (0, _is.default)("StringLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "StringLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNumericLiteral(node, opts) { - return (0, _is.default)("NumericLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NumericLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNullLiteral(node, opts) { - return (0, _is.default)("NullLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NullLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBooleanLiteral(node, opts) { - return (0, _is.default)("BooleanLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BooleanLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isRegExpLiteral(node, opts) { - return (0, _is.default)("RegExpLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "RegExpLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isLogicalExpression(node, opts) { - return (0, _is.default)("LogicalExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "LogicalExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isMemberExpression(node, opts) { - return (0, _is.default)("MemberExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "MemberExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNewExpression(node, opts) { - return (0, _is.default)("NewExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NewExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isProgram(node, opts) { - return (0, _is.default)("Program", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Program") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectExpression(node, opts) { - return (0, _is.default)("ObjectExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectMethod(node, opts) { - return (0, _is.default)("ObjectMethod", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectMethod") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectProperty(node, opts) { - return (0, _is.default)("ObjectProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isRestElement(node, opts) { - return (0, _is.default)("RestElement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "RestElement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isReturnStatement(node, opts) { - return (0, _is.default)("ReturnStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ReturnStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isSequenceExpression(node, opts) { - return (0, _is.default)("SequenceExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "SequenceExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isSwitchCase(node, opts) { - return (0, _is.default)("SwitchCase", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "SwitchCase") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isSwitchStatement(node, opts) { - return (0, _is.default)("SwitchStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "SwitchStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isThisExpression(node, opts) { - return (0, _is.default)("ThisExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ThisExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isThrowStatement(node, opts) { - return (0, _is.default)("ThrowStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ThrowStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTryStatement(node, opts) { - return (0, _is.default)("TryStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TryStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isUnaryExpression(node, opts) { - return (0, _is.default)("UnaryExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "UnaryExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isUpdateExpression(node, opts) { - return (0, _is.default)("UpdateExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "UpdateExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isVariableDeclaration(node, opts) { - return (0, _is.default)("VariableDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "VariableDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isVariableDeclarator(node, opts) { - return (0, _is.default)("VariableDeclarator", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "VariableDeclarator") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isWhileStatement(node, opts) { - return (0, _is.default)("WhileStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "WhileStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isWithStatement(node, opts) { - return (0, _is.default)("WithStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "WithStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isAssignmentPattern(node, opts) { - return (0, _is.default)("AssignmentPattern", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "AssignmentPattern") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isArrayPattern(node, opts) { - return (0, _is.default)("ArrayPattern", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ArrayPattern") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isArrowFunctionExpression(node, opts) { - return (0, _is.default)("ArrowFunctionExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ArrowFunctionExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isClassBody(node, opts) { - return (0, _is.default)("ClassBody", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassBody") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isClassDeclaration(node, opts) { - return (0, _is.default)("ClassDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isClassExpression(node, opts) { - return (0, _is.default)("ClassExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExportAllDeclaration(node, opts) { - return (0, _is.default)("ExportAllDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExportAllDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExportDefaultDeclaration(node, opts) { - return (0, _is.default)("ExportDefaultDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExportDefaultDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExportNamedDeclaration(node, opts) { - return (0, _is.default)("ExportNamedDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExportNamedDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExportSpecifier(node, opts) { - return (0, _is.default)("ExportSpecifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExportSpecifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isForOfStatement(node, opts) { - return (0, _is.default)("ForOfStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ForOfStatement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isImportDeclaration(node, opts) { - return (0, _is.default)("ImportDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ImportDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isImportDefaultSpecifier(node, opts) { - return (0, _is.default)("ImportDefaultSpecifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ImportDefaultSpecifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isImportNamespaceSpecifier(node, opts) { - return (0, _is.default)("ImportNamespaceSpecifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ImportNamespaceSpecifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isImportSpecifier(node, opts) { - return (0, _is.default)("ImportSpecifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ImportSpecifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isMetaProperty(node, opts) { - return (0, _is.default)("MetaProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "MetaProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isClassMethod(node, opts) { - return (0, _is.default)("ClassMethod", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassMethod") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectPattern(node, opts) { - return (0, _is.default)("ObjectPattern", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectPattern") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isSpreadElement(node, opts) { - return (0, _is.default)("SpreadElement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "SpreadElement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isSuper(node, opts) { - return (0, _is.default)("Super", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Super") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTaggedTemplateExpression(node, opts) { - return (0, _is.default)("TaggedTemplateExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TaggedTemplateExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTemplateElement(node, opts) { - return (0, _is.default)("TemplateElement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TemplateElement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTemplateLiteral(node, opts) { - return (0, _is.default)("TemplateLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TemplateLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isYieldExpression(node, opts) { - return (0, _is.default)("YieldExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "YieldExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isAnyTypeAnnotation(node, opts) { - return (0, _is.default)("AnyTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "AnyTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isArrayTypeAnnotation(node, opts) { - return (0, _is.default)("ArrayTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ArrayTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBooleanTypeAnnotation(node, opts) { - return (0, _is.default)("BooleanTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BooleanTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBooleanLiteralTypeAnnotation(node, opts) { - return (0, _is.default)("BooleanLiteralTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BooleanLiteralTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNullLiteralTypeAnnotation(node, opts) { - return (0, _is.default)("NullLiteralTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NullLiteralTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isClassImplements(node, opts) { - return (0, _is.default)("ClassImplements", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassImplements") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareClass(node, opts) { - return (0, _is.default)("DeclareClass", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareClass") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareFunction(node, opts) { - return (0, _is.default)("DeclareFunction", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareFunction") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareInterface(node, opts) { - return (0, _is.default)("DeclareInterface", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareInterface") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareModule(node, opts) { - return (0, _is.default)("DeclareModule", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareModule") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareModuleExports(node, opts) { - return (0, _is.default)("DeclareModuleExports", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareModuleExports") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareTypeAlias(node, opts) { - return (0, _is.default)("DeclareTypeAlias", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareTypeAlias") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareOpaqueType(node, opts) { - return (0, _is.default)("DeclareOpaqueType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareOpaqueType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareVariable(node, opts) { - return (0, _is.default)("DeclareVariable", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareVariable") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareExportDeclaration(node, opts) { - return (0, _is.default)("DeclareExportDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareExportDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclareExportAllDeclaration(node, opts) { - return (0, _is.default)("DeclareExportAllDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclareExportAllDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclaredPredicate(node, opts) { - return (0, _is.default)("DeclaredPredicate", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DeclaredPredicate") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExistsTypeAnnotation(node, opts) { - return (0, _is.default)("ExistsTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExistsTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFunctionTypeAnnotation(node, opts) { - return (0, _is.default)("FunctionTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FunctionTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFunctionTypeParam(node, opts) { - return (0, _is.default)("FunctionTypeParam", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FunctionTypeParam") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isGenericTypeAnnotation(node, opts) { - return (0, _is.default)("GenericTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "GenericTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isInferredPredicate(node, opts) { - return (0, _is.default)("InferredPredicate", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "InferredPredicate") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isInterfaceExtends(node, opts) { - return (0, _is.default)("InterfaceExtends", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "InterfaceExtends") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isInterfaceDeclaration(node, opts) { - return (0, _is.default)("InterfaceDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "InterfaceDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isInterfaceTypeAnnotation(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "InterfaceTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isIntersectionTypeAnnotation(node, opts) { - return (0, _is.default)("IntersectionTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "IntersectionTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isMixedTypeAnnotation(node, opts) { - return (0, _is.default)("MixedTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "MixedTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isEmptyTypeAnnotation(node, opts) { - return (0, _is.default)("EmptyTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "EmptyTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNullableTypeAnnotation(node, opts) { - return (0, _is.default)("NullableTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NullableTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNumberLiteralTypeAnnotation(node, opts) { - return (0, _is.default)("NumberLiteralTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NumberLiteralTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNumberTypeAnnotation(node, opts) { - return (0, _is.default)("NumberTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NumberTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectTypeAnnotation(node, opts) { - return (0, _is.default)("ObjectTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isObjectTypeInternalSlot(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectTypeInternalSlot") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectTypeCallProperty(node, opts) { - return (0, _is.default)("ObjectTypeCallProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectTypeCallProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectTypeIndexer(node, opts) { - return (0, _is.default)("ObjectTypeIndexer", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectTypeIndexer") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectTypeProperty(node, opts) { - return (0, _is.default)("ObjectTypeProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectTypeProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectTypeSpreadProperty(node, opts) { - return (0, _is.default)("ObjectTypeSpreadProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectTypeSpreadProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isOpaqueType(node, opts) { - return (0, _is.default)("OpaqueType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "OpaqueType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isQualifiedTypeIdentifier(node, opts) { - return (0, _is.default)("QualifiedTypeIdentifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "QualifiedTypeIdentifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isStringLiteralTypeAnnotation(node, opts) { - return (0, _is.default)("StringLiteralTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "StringLiteralTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isStringTypeAnnotation(node, opts) { - return (0, _is.default)("StringTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "StringTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isThisTypeAnnotation(node, opts) { - return (0, _is.default)("ThisTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ThisTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTupleTypeAnnotation(node, opts) { - return (0, _is.default)("TupleTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TupleTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTypeofTypeAnnotation(node, opts) { - return (0, _is.default)("TypeofTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TypeofTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTypeAlias(node, opts) { - return (0, _is.default)("TypeAlias", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TypeAlias") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTypeAnnotation(node, opts) { - return (0, _is.default)("TypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTypeCastExpression(node, opts) { - return (0, _is.default)("TypeCastExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TypeCastExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTypeParameter(node, opts) { - return (0, _is.default)("TypeParameter", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TypeParameter") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTypeParameterDeclaration(node, opts) { - return (0, _is.default)("TypeParameterDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TypeParameterDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTypeParameterInstantiation(node, opts) { - return (0, _is.default)("TypeParameterInstantiation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TypeParameterInstantiation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isUnionTypeAnnotation(node, opts) { - return (0, _is.default)("UnionTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "UnionTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isVariance(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Variance") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isVoidTypeAnnotation(node, opts) { - return (0, _is.default)("VoidTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "VoidTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXAttribute(node, opts) { - return (0, _is.default)("JSXAttribute", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXAttribute") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXClosingElement(node, opts) { - return (0, _is.default)("JSXClosingElement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXClosingElement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXElement(node, opts) { - return (0, _is.default)("JSXElement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXElement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXEmptyExpression(node, opts) { - return (0, _is.default)("JSXEmptyExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXEmptyExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXExpressionContainer(node, opts) { - return (0, _is.default)("JSXExpressionContainer", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXExpressionContainer") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXSpreadChild(node, opts) { - return (0, _is.default)("JSXSpreadChild", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXSpreadChild") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXIdentifier(node, opts) { - return (0, _is.default)("JSXIdentifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXIdentifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXMemberExpression(node, opts) { - return (0, _is.default)("JSXMemberExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXMemberExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXNamespacedName(node, opts) { - return (0, _is.default)("JSXNamespacedName", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXNamespacedName") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXOpeningElement(node, opts) { - return (0, _is.default)("JSXOpeningElement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXOpeningElement") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXSpreadAttribute(node, opts) { - return (0, _is.default)("JSXSpreadAttribute", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXSpreadAttribute") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXText(node, opts) { - return (0, _is.default)("JSXText", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXText") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXFragment(node, opts) { - return (0, _is.default)("JSXFragment", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXFragment") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXOpeningFragment(node, opts) { - return (0, _is.default)("JSXOpeningFragment", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXOpeningFragment") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSXClosingFragment(node, opts) { - return (0, _is.default)("JSXClosingFragment", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSXClosingFragment") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNoop(node, opts) { - return (0, _is.default)("Noop", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Noop") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isParenthesizedExpression(node, opts) { - return (0, _is.default)("ParenthesizedExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ParenthesizedExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isAwaitExpression(node, opts) { - return (0, _is.default)("AwaitExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "AwaitExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBindExpression(node, opts) { - return (0, _is.default)("BindExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BindExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isClassProperty(node, opts) { - return (0, _is.default)("ClassProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isOptionalMemberExpression(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "OptionalMemberExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isPipelineTopicExpression(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "PipelineTopicExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isPipelineBareFunction(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "PipelineBareFunction") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isPipelinePrimaryTopicReference(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "PipelinePrimaryTopicReference") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isOptionalCallExpression(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "OptionalCallExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isClassPrivateProperty(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassPrivateProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isClassPrivateMethod(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ClassPrivateMethod") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isImport(node, opts) { - return (0, _is.default)("Import", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Import") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDecorator(node, opts) { - return (0, _is.default)("Decorator", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Decorator") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDoExpression(node, opts) { - return (0, _is.default)("DoExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "DoExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExportDefaultSpecifier(node, opts) { - return (0, _is.default)("ExportDefaultSpecifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExportDefaultSpecifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExportNamespaceSpecifier(node, opts) { - return (0, _is.default)("ExportNamespaceSpecifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExportNamespaceSpecifier") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isPrivateName(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "PrivateName") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isBigIntLiteral(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BigIntLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSParameterProperty(node, opts) { - return (0, _is.default)("TSParameterProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSParameterProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSDeclareFunction(node, opts) { - return (0, _is.default)("TSDeclareFunction", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSDeclareFunction") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSDeclareMethod(node, opts) { - return (0, _is.default)("TSDeclareMethod", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSDeclareMethod") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSQualifiedName(node, opts) { - return (0, _is.default)("TSQualifiedName", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSQualifiedName") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSCallSignatureDeclaration(node, opts) { - return (0, _is.default)("TSCallSignatureDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSCallSignatureDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSConstructSignatureDeclaration(node, opts) { - return (0, _is.default)("TSConstructSignatureDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSConstructSignatureDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSPropertySignature(node, opts) { - return (0, _is.default)("TSPropertySignature", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSPropertySignature") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSMethodSignature(node, opts) { - return (0, _is.default)("TSMethodSignature", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSMethodSignature") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSIndexSignature(node, opts) { - return (0, _is.default)("TSIndexSignature", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSIndexSignature") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSAnyKeyword(node, opts) { - return (0, _is.default)("TSAnyKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSAnyKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isTSUnknownKeyword(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSUnknownKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSNumberKeyword(node, opts) { - return (0, _is.default)("TSNumberKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSNumberKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSObjectKeyword(node, opts) { - return (0, _is.default)("TSObjectKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSObjectKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSBooleanKeyword(node, opts) { - return (0, _is.default)("TSBooleanKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSBooleanKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSStringKeyword(node, opts) { - return (0, _is.default)("TSStringKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSStringKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSSymbolKeyword(node, opts) { - return (0, _is.default)("TSSymbolKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSSymbolKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSVoidKeyword(node, opts) { - return (0, _is.default)("TSVoidKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSVoidKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSUndefinedKeyword(node, opts) { - return (0, _is.default)("TSUndefinedKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSUndefinedKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSNullKeyword(node, opts) { - return (0, _is.default)("TSNullKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSNullKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSNeverKeyword(node, opts) { - return (0, _is.default)("TSNeverKeyword", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSNeverKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSThisType(node, opts) { - return (0, _is.default)("TSThisType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSThisType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSFunctionType(node, opts) { - return (0, _is.default)("TSFunctionType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSFunctionType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSConstructorType(node, opts) { - return (0, _is.default)("TSConstructorType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSConstructorType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeReference(node, opts) { - return (0, _is.default)("TSTypeReference", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeReference") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypePredicate(node, opts) { - return (0, _is.default)("TSTypePredicate", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypePredicate") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeQuery(node, opts) { - return (0, _is.default)("TSTypeQuery", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeQuery") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeLiteral(node, opts) { - return (0, _is.default)("TSTypeLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSArrayType(node, opts) { - return (0, _is.default)("TSArrayType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSArrayType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTupleType(node, opts) { - return (0, _is.default)("TSTupleType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTupleType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isTSOptionalType(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSOptionalType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isTSRestType(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSRestType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSUnionType(node, opts) { - return (0, _is.default)("TSUnionType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSUnionType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSIntersectionType(node, opts) { - return (0, _is.default)("TSIntersectionType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSIntersectionType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isTSConditionalType(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSConditionalType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isTSInferType(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSInferType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSParenthesizedType(node, opts) { - return (0, _is.default)("TSParenthesizedType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSParenthesizedType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeOperator(node, opts) { - return (0, _is.default)("TSTypeOperator", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeOperator") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSIndexedAccessType(node, opts) { - return (0, _is.default)("TSIndexedAccessType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSIndexedAccessType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSMappedType(node, opts) { - return (0, _is.default)("TSMappedType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSMappedType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSLiteralType(node, opts) { - return (0, _is.default)("TSLiteralType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSLiteralType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSExpressionWithTypeArguments(node, opts) { - return (0, _is.default)("TSExpressionWithTypeArguments", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSExpressionWithTypeArguments") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSInterfaceDeclaration(node, opts) { - return (0, _is.default)("TSInterfaceDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSInterfaceDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSInterfaceBody(node, opts) { - return (0, _is.default)("TSInterfaceBody", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSInterfaceBody") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeAliasDeclaration(node, opts) { - return (0, _is.default)("TSTypeAliasDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeAliasDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSAsExpression(node, opts) { - return (0, _is.default)("TSAsExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSAsExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeAssertion(node, opts) { - return (0, _is.default)("TSTypeAssertion", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeAssertion") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSEnumDeclaration(node, opts) { - return (0, _is.default)("TSEnumDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSEnumDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSEnumMember(node, opts) { - return (0, _is.default)("TSEnumMember", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSEnumMember") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSModuleDeclaration(node, opts) { - return (0, _is.default)("TSModuleDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSModuleDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSModuleBlock(node, opts) { - return (0, _is.default)("TSModuleBlock", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSModuleBlock") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isTSImportType(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSImportType") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSImportEqualsDeclaration(node, opts) { - return (0, _is.default)("TSImportEqualsDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSImportEqualsDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSExternalModuleReference(node, opts) { - return (0, _is.default)("TSExternalModuleReference", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSExternalModuleReference") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSNonNullExpression(node, opts) { - return (0, _is.default)("TSNonNullExpression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSNonNullExpression") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSExportAssignment(node, opts) { - return (0, _is.default)("TSExportAssignment", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSExportAssignment") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSNamespaceExportDeclaration(node, opts) { - return (0, _is.default)("TSNamespaceExportDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSNamespaceExportDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeAnnotation(node, opts) { - return (0, _is.default)("TSTypeAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeAnnotation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeParameterInstantiation(node, opts) { - return (0, _is.default)("TSTypeParameterInstantiation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeParameterInstantiation") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeParameterDeclaration(node, opts) { - return (0, _is.default)("TSTypeParameterDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeParameterDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeParameter(node, opts) { - return (0, _is.default)("TSTypeParameter", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeParameter") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExpression(node, opts) { - return (0, _is.default)("Expression", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "ParenthesizedExpression" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBinary(node, opts) { - return (0, _is.default)("Binary", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isScopable(node, opts) { - return (0, _is.default)("Scopable", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBlockParent(node, opts) { - return (0, _is.default)("BlockParent", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isBlock(node, opts) { - return (0, _is.default)("Block", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isStatement(node, opts) { - return (0, _is.default)("Statement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTerminatorless(node, opts) { - return (0, _is.default)("Terminatorless", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isCompletionStatement(node, opts) { - return (0, _is.default)("CompletionStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isConditional(node, opts) { - return (0, _is.default)("Conditional", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isLoop(node, opts) { - return (0, _is.default)("Loop", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isWhile(node, opts) { - return (0, _is.default)("While", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExpressionWrapper(node, opts) { - return (0, _is.default)("ExpressionWrapper", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "TypeCastExpression" === nodeType || "ParenthesizedExpression" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFor(node, opts) { - return (0, _is.default)("For", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isForXStatement(node, opts) { - return (0, _is.default)("ForXStatement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFunction(node, opts) { - return (0, _is.default)("Function", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFunctionParent(node, opts) { - return (0, _is.default)("FunctionParent", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isPureish(node, opts) { - return (0, _is.default)("Pureish", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "BigIntLiteral" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isDeclaration(node, opts) { - return (0, _is.default)("Declaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isPatternLike(node, opts) { - return (0, _is.default)("PatternLike", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isLVal(node, opts) { - return (0, _is.default)("LVal", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSEntityName(node, opts) { - return (0, _is.default)("TSEntityName", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isLiteral(node, opts) { - return (0, _is.default)("Literal", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isImmutable(node, opts) { - return (0, _is.default)("Immutable", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isUserWhitespacable(node, opts) { - return (0, _is.default)("UserWhitespacable", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isMethod(node, opts) { - return (0, _is.default)("Method", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isObjectMember(node, opts) { - return (0, _is.default)("ObjectMember", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isProperty(node, opts) { - return (0, _is.default)("Property", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isUnaryLike(node, opts) { - return (0, _is.default)("UnaryLike", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isPattern(node, opts) { - return (0, _is.default)("Pattern", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isClass(node, opts) { - return (0, _is.default)("Class", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Class" || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isModuleDeclaration(node, opts) { - return (0, _is.default)("ModuleDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isExportDeclaration(node, opts) { - return (0, _is.default)("ExportDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isModuleSpecifier(node, opts) { - return (0, _is.default)("ModuleSpecifier", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFlow(node, opts) { - return (0, _is.default)("Flow", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isFlowType(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFlowBaseAnnotation(node, opts) { - return (0, _is.default)("FlowBaseAnnotation", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFlowDeclaration(node, opts) { - return (0, _is.default)("FlowDeclaration", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isFlowPredicate(node, opts) { - return (0, _is.default)("FlowPredicate", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isJSX(node, opts) { - return (0, _is.default)("JSX", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; +} + +function isPrivate(node, opts) { + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSTypeElement(node, opts) { - return (0, _is.default)("TSTypeElement", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isTSType(node, opts) { - return (0, _is.default)("TSType", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType || "TSImportType" === nodeType) { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isNumberLiteral(node, opts) { console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); - return (0, _is.default)("NumberLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "NumberLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isRegexLiteral(node, opts) { console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); - return (0, _is.default)("RegexLiteral", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "RegexLiteral") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isRestProperty(node, opts) { console.trace("The node type RestProperty has been renamed to RestElement"); - return (0, _is.default)("RestProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "RestProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } function isSpreadProperty(node, opts) { console.trace("The node type SpreadProperty has been renamed to SpreadElement"); - return (0, _is.default)("SpreadProperty", node, opts); + if (!node) return false; + const nodeType = node.type; + + if (nodeType === "SpreadProperty") { + if (typeof opts === "undefined") { + return true; + } else { + return (0, _shallowEqual.default)(node, opts); + } + } + + return false; } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/is.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/is.js index c1e50d857b94a8..5aa809d25e563a 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/is.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/is.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = is; var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual")); @@ -11,7 +13,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function is(type, node, opts) { if (!node) return false; - var matches = (0, _isType.default)(node.type, type); + const matches = (0, _isType.default)(node.type, type); if (!matches) return false; if (typeof opts === "undefined") { diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBinding.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBinding.js index 3644879cdde3c4..24d781bf042e8c 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBinding.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBinding.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isBinding; var _getBindingIdentifiers = _interopRequireDefault(require("../retrievers/getBindingIdentifiers")); @@ -8,12 +10,12 @@ var _getBindingIdentifiers = _interopRequireDefault(require("../retrievers/getBi function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function isBinding(node, parent) { - var keys = _getBindingIdentifiers.default.keys[parent.type]; + const keys = _getBindingIdentifiers.default.keys[parent.type]; if (keys) { - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var val = parent[key]; + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const val = parent[key]; if (Array.isArray(val)) { if (val.indexOf(node) >= 0) return true; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBlockScoped.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBlockScoped.js index da5c53fce452a4..7e6549e03b1ea4 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBlockScoped.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isBlockScoped.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isBlockScoped; var _generated = require("./generated"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isImmutable.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isImmutable.js index 2ea002713e0de7..b00b23d4ce0997 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isImmutable.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isImmutable.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isImmutable; var _isType = _interopRequireDefault(require("./isType")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isLet.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isLet.js index a3a6169a030fa1..93d75628082195 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isLet.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isLet.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isLet; var _generated = require("./generated"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNode.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNode.js index 641cb9c52b46c2..e88a47aac457f1 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNode.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNode.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isNode; var _definitions = require("../definitions"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNodesEquivalent.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNodesEquivalent.js index 549c0b470ff1d9..01c5c1848ace9f 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isNodesEquivalent.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isNodesEquivalent; var _definitions = require("../definitions"); @@ -14,11 +16,10 @@ function isNodesEquivalent(a, b) { return false; } - var fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type); - - for (var _i = 0; _i < fields.length; _i++) { - var field = fields[_i]; + const fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type); + const visitorKeys = _definitions.VISITOR_KEYS[a.type]; + for (const field of fields) { if (typeof a[field] !== typeof b[field]) { return false; } @@ -32,7 +33,7 @@ function isNodesEquivalent(a, b) { return false; } - for (var i = 0; i < a[field].length; i++) { + for (let i = 0; i < a[field].length; i++) { if (!isNodesEquivalent(a[field][i], b[field][i])) { return false; } @@ -41,6 +42,16 @@ function isNodesEquivalent(a, b) { continue; } + if (typeof a[field] === "object" && (!visitorKeys || !visitorKeys.includes(field))) { + for (const key in a[field]) { + if (a[field][key] !== b[field][key]) { + return false; + } + } + + continue; + } + if (!isNodesEquivalent(a[field], b[field])) { return false; } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isReferenced.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isReferenced.js index 5bb68b4ad44001..26c047efb4f7dd 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isReferenced.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isReferenced.js @@ -1,98 +1,94 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isReferenced; function isReferenced(node, parent) { switch (parent.type) { - case "BindExpression": - return parent.object === node || parent.callee === node; - case "MemberExpression": case "JSXMemberExpression": - if (parent.property === node && parent.computed) { - return true; - } else if (parent.object === node) { - return true; - } else { - return false; + case "OptionalMemberExpression": + if (parent.property === node) { + return !!parent.computed; } - case "MetaProperty": - return false; - - case "ObjectProperty": - if (parent.key === node) { - return parent.computed; - } + return parent.object === node; case "VariableDeclarator": - return parent.id !== node; + return parent.init === node; case "ArrowFunctionExpression": - case "FunctionDeclaration": - case "FunctionExpression": - var _arr = parent.params; - - for (var _i = 0; _i < _arr.length; _i++) { - var param = _arr[_i]; - if (param === node) return false; - } - - return parent.id !== node; + return parent.body === node; case "ExportSpecifier": if (parent.source) { return false; - } else { - return parent.local === node; } - case "ExportNamespaceSpecifier": - case "ExportDefaultSpecifier": - return false; - - case "JSXAttribute": - return parent.name !== node; + return parent.local === node; + case "ObjectProperty": case "ClassProperty": + case "ClassPrivateProperty": + case "ClassMethod": + case "ClassPrivateMethod": + case "ObjectMethod": if (parent.key === node) { - return parent.computed; - } else { - return parent.value === node; + return !!parent.computed; } - case "ImportDefaultSpecifier": - case "ImportNamespaceSpecifier": - case "ImportSpecifier": - return false; + return parent.value === node; case "ClassDeclaration": case "ClassExpression": - return parent.id !== node; + return parent.superClass === node; - case "ClassMethod": - case "ObjectMethod": - return parent.key === node && parent.computed; + case "AssignmentExpression": + return parent.right === node; + + case "AssignmentPattern": + return parent.right === node; case "LabeledStatement": return false; case "CatchClause": - return parent.param !== node; + return false; case "RestElement": return false; - case "AssignmentExpression": - return parent.right === node; + case "BreakStatement": + case "ContinueStatement": + return false; - case "AssignmentPattern": - return parent.right === node; + case "FunctionDeclaration": + case "FunctionExpression": + return false; + + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + return false; + + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + return false; + + case "JSXAttribute": + return false; case "ObjectPattern": case "ArrayPattern": return false; + + case "MetaProperty": + return false; + + case "ObjectTypeProperty": + return parent.key !== node; } return true; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isScope.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isScope.js index 91928ca59ef83a..c808631faf2c61 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isScope.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isScope.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isScope; var _generated = require("./generated"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isSpecifierDefault.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isSpecifierDefault.js index 936d58e9e5b8e0..25431cc2732b34 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isSpecifierDefault.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isSpecifierDefault; var _generated = require("./generated"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isType.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isType.js index 04410ca5d0b878..59d31dfbbfcafd 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isType.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isType.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isType; var _definitions = require("../definitions"); @@ -8,25 +10,13 @@ var _definitions = require("../definitions"); function isType(nodeType, targetType) { if (nodeType === targetType) return true; if (_definitions.ALIAS_KEYS[targetType]) return false; - var aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType]; + const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType]; if (aliases) { if (aliases[0] === nodeType) return true; - for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var _alias = _ref; - if (nodeType === _alias) return true; + for (const alias of aliases) { + if (nodeType === alias) return true; } } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidES3Identifier.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidES3Identifier.js index ce98b3819c748a..8455cab269bae2 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidES3Identifier.js @@ -1,13 +1,15 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isValidES3Identifier; var _isValidIdentifier = _interopRequireDefault(require("./isValidIdentifier")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]); +const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]); function isValidES3Identifier(name) { return (0, _isValidIdentifier.default)(name) && !RESERVED_WORDS_ES3_ONLY.has(name); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidIdentifier.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidIdentifier.js index 981ae2a6473fe4..8c54b7ac8680db 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidIdentifier.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidIdentifier.js @@ -1,18 +1,28 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isValidIdentifier; -var _esutils = _interopRequireDefault(require("esutils")); +function _esutils() { + const data = _interopRequireDefault(require("esutils")); + + _esutils = function () { + return data; + }; + + return data; +} function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function isValidIdentifier(name) { - if (typeof name !== "string" || _esutils.default.keyword.isReservedWordES6(name, true)) { + if (typeof name !== "string" || _esutils().default.keyword.isReservedWordES6(name, true)) { return false; } else if (name === "await") { return false; } else { - return _esutils.default.keyword.isIdentifierNameES6(name); + return _esutils().default.keyword.isIdentifierNameES6(name); } } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isVar.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isVar.js index df6b20731c833f..a34801d18fe375 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isVar.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isVar.js @@ -1,6 +1,8 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isVar; var _generated = require("./generated"); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/matchesPattern.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/matchesPattern.js index b2cf579423a404..538e011f4ca257 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/matchesPattern.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/matchesPattern.js @@ -1,15 +1,17 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = matchesPattern; var _generated = require("./generated"); function matchesPattern(member, match, allowPartial) { if (!(0, _generated.isMemberExpression)(member)) return false; - var parts = Array.isArray(match) ? match : match.split("."); - var nodes = []; - var node; + const parts = Array.isArray(match) ? match : match.split("."); + const nodes = []; + let node; for (node = member; (0, _generated.isMemberExpression)(node); node = node.object) { nodes.push(node.property); @@ -19,14 +21,14 @@ function matchesPattern(member, match, allowPartial) { if (nodes.length < parts.length) return false; if (!allowPartial && nodes.length > parts.length) return false; - for (var i = 0, j = nodes.length - 1; i < parts.length; i++, j--) { - var _node = nodes[j]; - var value = void 0; + for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) { + const node = nodes[j]; + let value; - if ((0, _generated.isIdentifier)(_node)) { - value = _node.name; - } else if ((0, _generated.isStringLiteral)(_node)) { - value = _node.value; + if ((0, _generated.isIdentifier)(node)) { + value = node.name; + } else if ((0, _generated.isStringLiteral)(node)) { + value = node.value; } else { return false; } diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isCompatTag.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isCompatTag.js index f5dc829a9b9529..57761c2b1b15bd 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isCompatTag.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isCompatTag.js @@ -1,8 +1,10 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = isCompatTag; function isCompatTag(tagName) { - return !!tagName && /^[a-z]|-/.test(tagName); + return !!tagName && /^[a-z]/.test(tagName); } \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isReactComponent.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isReactComponent.js index af7abc2b0719a6..33b30d71e9700d 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isReactComponent.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/react/isReactComponent.js @@ -1,12 +1,14 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = void 0; var _buildMatchMemberExpression = _interopRequireDefault(require("../buildMatchMemberExpression")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component"); +const isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component"); var _default = isReactComponent; exports.default = _default; \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/validate.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/validate.js index ab96408b3a7760..1fe1c1c9b80d57 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/validate.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/validate.js @@ -1,15 +1,17 @@ "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); exports.default = validate; var _definitions = require("../definitions"); function validate(node, key, val) { if (!node) return; - var fields = _definitions.NODE_FIELDS[node.type]; + const fields = _definitions.NODE_FIELDS[node.type]; if (!fields) return; - var field = fields[key]; + const field = fields[key]; if (!field || !field.validate) return; if (field.optional && val == null) return; field.validate(node, key, val); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/types/package.json index af3128ee9f3589..b365bb91f11e3c 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/package.json +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/package.json @@ -1,32 +1,4 @@ { - "_from": "@babel/types@7.0.0-beta.36", - "_id": "@babel/types@7.0.0-beta.36", - "_inBundle": false, - "_integrity": "sha512-PyAORDO9um9tfnrddXgmWN9e6Sq9qxraQIt5ynqBOSXKA5qvK1kUr+Q3nSzKFdzorsiK+oqcUnAFvEoKxv9D+Q==", - "_location": "/babel-eslint/@babel/types", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@babel/types@7.0.0-beta.36", - "name": "@babel/types", - "escapedName": "@babel%2ftypes", - "scope": "@babel", - "rawSpec": "7.0.0-beta.36", - "saveSpec": null, - "fetchSpec": "7.0.0-beta.36" - }, - "_requiredBy": [ - "/babel-eslint", - "/babel-eslint/@babel/helper-function-name", - "/babel-eslint/@babel/helper-get-function-arity", - "/babel-eslint/@babel/template", - "/babel-eslint/@babel/traverse" - ], - "_resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.36.tgz", - "_shasum": "64f2004353de42adb72f9ebb4665fc35b5499d23", - "_spec": "@babel/types@7.0.0-beta.36", - "_where": "/home/mzasso/git/nodejs/node/tools/babel-eslint-tmp/node_modules/babel-eslint", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" @@ -34,15 +6,16 @@ "bundleDependencies": false, "dependencies": { "esutils": "^2.0.2", - "lodash": "^4.2.0", + "lodash": "^4.17.11", "to-fast-properties": "^2.0.0" }, "deprecated": false, "description": "Babel Types is a Lodash-esque utility library for AST nodes", "devDependencies": { - "@babel/generator": "7.0.0-beta.36", - "babylon": "7.0.0-beta.36" + "@babel/generator": "^7.3.4", + "@babel/parser": "^7.3.4" }, + "gitHead": "1f6454cc90fe33e0a32260871212e2f719f35741", "homepage": "https://babeljs.io/", "license": "MIT", "main": "lib/index.js", @@ -51,5 +24,6 @@ "type": "git", "url": "https://github.com/babel/babel/tree/master/packages/babel-types" }, - "version": "7.0.0-beta.36" -} + "types": "lib/index.d.ts", + "version": "7.3.4" +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generateTypeHelpers.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generateTypeHelpers.js index e122145c3ca1f7..794b214adff561 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generateTypeHelpers.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generateTypeHelpers.js @@ -1,6 +1,7 @@ "use strict"; const fs = require("fs"); const path = require("path"); +const chalk = require("chalk"); const generateBuilders = require("./generators/generateBuilders"); const generateValidators = require("./generators/generateValidators"); const generateAsserts = require("./generators/generateAsserts"); @@ -26,6 +27,13 @@ function writeFile(content, location) { console.log("Generating @babel/types dynamic functions"); writeFile(generateBuilders(), "builders/generated/index.js"); +console.log(` ${chalk.green("✔")} Generated builders`); + writeFile(generateValidators(), "validators/generated/index.js"); +console.log(` ${chalk.green("✔")} Generated validators`); + writeFile(generateAsserts(), "asserts/generated/index.js"); +console.log(` ${chalk.green("✔")} Generated asserts`); + writeFile(generateConstants(), "constants/generated/index.js"); +console.log(` ${chalk.green("✔")} Generated constants`); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/docs.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/docs.js new file mode 100644 index 00000000000000..3bbb52362400bb --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/docs.js @@ -0,0 +1,117 @@ +"use strict"; + +const util = require("util"); +const stringifyValidator = require("../utils/stringifyValidator"); +const toFunctionName = require("../utils/toFunctionName"); + +const types = require("../../"); + +const readme = [ + `# @babel/types + +> This module contains methods for building ASTs manually and for checking the types of AST nodes. + +## Install + +\`\`\`sh +npm install --save-dev @babel/types +\`\`\` + +## API`, +]; + +const customTypes = { + ClassMethod: { + key: "if computed then `Expression` else `Identifier | Literal`", + }, + Identifier: { + name: "`string`", + }, + MemberExpression: { + property: "if computed then `Expression` else `Identifier`", + }, + ObjectMethod: { + key: "if computed then `Expression` else `Identifier | Literal`", + }, + ObjectProperty: { + key: "if computed then `Expression` else `Identifier | Literal`", + }, +}; +Object.keys(types.BUILDER_KEYS) + .sort() + .forEach(function(key) { + readme.push("### " + key[0].toLowerCase() + key.substr(1)); + readme.push("```javascript"); + readme.push( + "t." + + toFunctionName(key) + + "(" + + types.BUILDER_KEYS[key].join(", ") + + ")" + ); + readme.push("```"); + readme.push(""); + readme.push( + "See also `t.is" + + key + + "(node, opts)` and `t.assert" + + key + + "(node, opts)`." + ); + readme.push(""); + if (types.ALIAS_KEYS[key] && types.ALIAS_KEYS[key].length) { + readme.push( + "Aliases: " + + types.ALIAS_KEYS[key] + .map(function(key) { + return "`" + key + "`"; + }) + .join(", ") + ); + readme.push(""); + } + Object.keys(types.NODE_FIELDS[key]) + .sort(function(fieldA, fieldB) { + const indexA = types.BUILDER_KEYS[key].indexOf(fieldA); + const indexB = types.BUILDER_KEYS[key].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }) + .forEach(function(field) { + const defaultValue = types.NODE_FIELDS[key][field].default; + const fieldDescription = ["`" + field + "`"]; + const validator = types.NODE_FIELDS[key][field].validate; + if (customTypes[key] && customTypes[key][field]) { + fieldDescription.push(`: ${customTypes[key][field]}`); + } else if (validator) { + try { + fieldDescription.push( + ": `" + stringifyValidator(validator, "") + "`" + ); + } catch (ex) { + if (ex.code === "UNEXPECTED_VALIDATOR_TYPE") { + console.log( + "Unrecognised validator type for " + key + "." + field + ); + console.dir(ex.validator, { depth: 10, colors: true }); + } + } + } + if (defaultValue !== null || types.NODE_FIELDS[key][field].optional) { + fieldDescription.push( + " (default: `" + util.inspect(defaultValue) + "`)" + ); + } else { + fieldDescription.push(" (required)"); + } + readme.push(" - " + fieldDescription.join("")); + }); + + readme.push(""); + readme.push("---"); + readme.push(""); + }); + +process.stdout.write(readme.join("\n")); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/flow.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/flow.js new file mode 100644 index 00000000000000..daab2411d74235 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/flow.js @@ -0,0 +1,153 @@ +"use strict"; + +const t = require("../../"); +const stringifyValidator = require("../utils/stringifyValidator"); +const toFunctionName = require("../utils/toFunctionName"); + +const NODE_PREFIX = "BabelNode"; + +let code = `// NOTE: This file is autogenerated. Do not modify. +// See packages/babel-types/scripts/generators/flow.js for script used. + +declare class ${NODE_PREFIX}Comment { + value: string; + start: number; + end: number; + loc: ${NODE_PREFIX}SourceLocation; +} + +declare class ${NODE_PREFIX}CommentBlock extends ${NODE_PREFIX}Comment { + type: "CommentBlock"; +} + +declare class ${NODE_PREFIX}CommentLine extends ${NODE_PREFIX}Comment { + type: "CommentLine"; +} + +declare class ${NODE_PREFIX}SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +declare class ${NODE_PREFIX} { + leadingComments?: Array<${NODE_PREFIX}Comment>; + innerComments?: Array<${NODE_PREFIX}Comment>; + trailingComments?: Array<${NODE_PREFIX}Comment>; + start: ?number; + end: ?number; + loc: ?${NODE_PREFIX}SourceLocation; +}\n\n`; + +// + +const lines = []; + +for (const type in t.NODE_FIELDS) { + const fields = t.NODE_FIELDS[type]; + + const struct = ['type: "' + type + '";']; + const args = []; + + Object.keys(t.NODE_FIELDS[type]) + .sort((fieldA, fieldB) => { + const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); + const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }) + .forEach(fieldName => { + const field = fields[fieldName]; + + let suffix = ""; + if (field.optional || field.default != null) suffix += "?"; + + let typeAnnotation = "any"; + + const validate = field.validate; + if (validate) { + typeAnnotation = stringifyValidator(validate, NODE_PREFIX); + } + + if (typeAnnotation) { + suffix += ": " + typeAnnotation; + } + + args.push(t.toBindingIdentifierName(fieldName) + suffix); + + if (t.isValidIdentifier(fieldName)) { + struct.push(fieldName + suffix + ";"); + } + }); + + code += `declare class ${NODE_PREFIX}${type} extends ${NODE_PREFIX} { + ${struct.join("\n ").trim()} +}\n\n`; + + // Flow chokes on super() and import() :/ + if (type !== "Super" && type !== "Import") { + lines.push( + `declare function ${toFunctionName(type)}(${args.join( + ", " + )}): ${NODE_PREFIX}${type};` + ); + } +} + +for (let i = 0; i < t.TYPES.length; i++) { + let decl = `declare function is${ + t.TYPES[i] + }(node: ?Object, opts?: ?Object): boolean`; + + if (t.NODE_FIELDS[t.TYPES[i]]) { + decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`; + } + + lines.push(decl); +} + +lines.push( + `declare function validate(n: BabelNode, key: string, value: mixed): void;`, + `declare function clone(n: T): T;`, + `declare function cloneDeep(n: T): T;`, + `declare function removeProperties(n: T, opts: ?{}): void;`, + `declare function removePropertiesDeep(n: T, opts: ?{}): T;`, + `declare type TraversalAncestors = Array<{ + node: BabelNode, + key: string, + index?: number, + }>; + declare type TraversalHandler = (BabelNode, TraversalAncestors, T) => void; + declare type TraversalHandlers = { + enter?: TraversalHandler, + exit?: TraversalHandler, + };`.replace(/(^|\n) {2}/g, "$1"), + // eslint-disable-next-line + `declare function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;` +); + +for (const type in t.FLIPPED_ALIAS_KEYS) { + const types = t.FLIPPED_ALIAS_KEYS[type]; + code += `type ${NODE_PREFIX}${type} = ${types + .map(type => `${NODE_PREFIX}${type}`) + .join(" | ")};\n`; +} + +code += `\ndeclare module "@babel/types" { + ${lines + .join("\n") + .replace(/\n/g, "\n ") + .trim()} +}\n`; + +// + +process.stdout.write(code); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/generateValidators.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/generateValidators.js index b523d6adc85354..1e1ed321be6288 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/generateValidators.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/generateValidators.js @@ -1,9 +1,31 @@ "use strict"; const definitions = require("../../lib/definitions"); -function addIsHelper(type) { - return `export function is${type}(node: Object, opts?: Object): boolean { - return is("${type}", node, opts) } +function addIsHelper(type, aliasKeys, deprecated) { + const targetType = JSON.stringify(type); + let aliasSource = ""; + if (aliasKeys) { + aliasSource = + " || " + + aliasKeys.map(JSON.stringify).join(" === nodeType || ") + + " === nodeType"; + } + + return `export function is${type}(node: ?Object, opts?: Object): boolean { + ${deprecated || ""} + if (!node) return false; + + const nodeType = node.type; + if (nodeType === ${targetType}${aliasSource}) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; + } `; } @@ -13,22 +35,20 @@ module.exports = function generateValidators() { * This file is auto-generated! Do not modify it directly. * To re-generate run 'make build' */ -import is from "../is";\n\n`; +import shallowEqual from "../../utils/shallowEqual";\n\n`; Object.keys(definitions.VISITOR_KEYS).forEach(type => { output += addIsHelper(type); }); Object.keys(definitions.FLIPPED_ALIAS_KEYS).forEach(type => { - output += addIsHelper(type); + output += addIsHelper(type, definitions.FLIPPED_ALIAS_KEYS[type]); }); Object.keys(definitions.DEPRECATED_KEYS).forEach(type => { const newType = definitions.DEPRECATED_KEYS[type]; - output += `export function is${type}(node: Object, opts: Object): boolean { - console.trace("The node type ${type} has been renamed to ${newType}"); - return is("${type}", node, opts); -}\n`; + const deprecated = `console.trace("The node type ${type} has been renamed to ${newType}");`; + output += addIsHelper(type, null, deprecated); }); return output; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/typescript.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/typescript.js new file mode 100644 index 00000000000000..b6019ec373240d --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/typescript.js @@ -0,0 +1,200 @@ +"use strict"; + +const t = require("../../"); +const stringifyValidator = require("../utils/stringifyValidator"); +const toFunctionName = require("../utils/toFunctionName"); + +let code = `// NOTE: This file is autogenerated. Do not modify. +// See packages/babel-types/scripts/generators/typescript.js for script used. + +interface BaseComment { + value: string; + start: number; + end: number; + loc: SourceLocation; + type: "CommentBlock" | "CommentLine"; +} + +export interface CommentBlock extends BaseComment { + type: "CommentBlock"; +} + +export interface CommentLine extends BaseComment { + type: "CommentLine"; +} + +export type Comment = CommentBlock | CommentLine; + +export interface SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +interface BaseNode { + leadingComments: ReadonlyArray | null; + innerComments: ReadonlyArray | null; + trailingComments: ReadonlyArray | null; + start: number | null; + end: number | null; + loc: SourceLocation | null; + type: Node["type"]; +} + +export type Node = ${t.TYPES.sort().join(" | ")};\n\n`; + +// + +const lines = []; + +for (const type in t.NODE_FIELDS) { + const fields = t.NODE_FIELDS[type]; + const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); + + const struct = ['type: "' + type + '";']; + const args = []; + + fieldNames.forEach(fieldName => { + const field = fields[fieldName]; + let typeAnnotation = stringifyValidator(field.validate, ""); + + if (isNullable(field) && !hasDefault(field)) { + typeAnnotation += " | null"; + } + + if (areAllRemainingFieldsNullable(fieldName, fieldNames, fields)) { + args.push( + `${t.toBindingIdentifierName(fieldName)}${ + isNullable(field) ? "?:" : ":" + } ${typeAnnotation}` + ); + } else { + args.push( + `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ + isNullable(field) ? " | undefined" : "" + }` + ); + } + + const alphaNumeric = /^\w+$/; + + if (t.isValidIdentifier(fieldName) || alphaNumeric.test(fieldName)) { + struct.push(`${fieldName}: ${typeAnnotation};`); + } else { + struct.push(`"${fieldName}": ${typeAnnotation};`); + } + }); + + code += `export interface ${type} extends BaseNode { + ${struct.join("\n ").trim()} +}\n\n`; + + // super and import are reserved words in JavaScript + if (type !== "Super" && type !== "Import") { + lines.push( + `export function ${toFunctionName(type)}(${args.join(", ")}): ${type};` + ); + } +} + +for (let i = 0; i < t.TYPES.length; i++) { + let decl = `export function is${ + t.TYPES[i] + }(node: object | null | undefined, opts?: object | null): `; + + if (t.NODE_FIELDS[t.TYPES[i]]) { + decl += `node is ${t.TYPES[i]};`; + } else if (t.FLIPPED_ALIAS_KEYS[t.TYPES[i]]) { + decl += `node is ${t.TYPES[i]};`; + } else { + decl += `boolean;`; + } + + lines.push(decl); +} + +lines.push( + `export function validate(n: Node, key: string, value: any): void;`, + `export function clone(n: T): T;`, + `export function cloneDeep(n: T): T;`, + `export function removeProperties( + n: Node, + opts?: { preserveComments: boolean } | null +): void;`, + `export function removePropertiesDeep( + n: T, + opts?: { preserveComments: boolean } | null +): T;`, + `export type TraversalAncestors = ReadonlyArray<{ + node: Node, + key: string, + index?: number, + }>; + export type TraversalHandler = (node: Node, parent: TraversalAncestors, type: T) => void; + export type TraversalHandlers = { + enter?: TraversalHandler, + exit?: TraversalHandler, + };`.replace(/(^|\n) {2}/g, "$1"), + // eslint-disable-next-line + `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;` +); + +for (const type in t.DEPRECATED_KEYS) { + code += `/** + * @deprecated Use \`${t.DEPRECATED_KEYS[type]}\` + */ +export type ${type} = ${t.DEPRECATED_KEYS[type]};\n +`; +} + +for (const type in t.FLIPPED_ALIAS_KEYS) { + const types = t.FLIPPED_ALIAS_KEYS[type]; + code += `export type ${type} = ${types + .map(type => `${type}`) + .join(" | ")};\n`; +} +code += "\n"; + +code += "export interface Aliases {\n"; +for (const type in t.FLIPPED_ALIAS_KEYS) { + code += ` ${type}: ${type};\n`; +} +code += "}\n\n"; + +code += lines.join("\n") + "\n"; + +// + +process.stdout.write(code); + +// + +function areAllRemainingFieldsNullable(fieldName, fieldNames, fields) { + const index = fieldNames.indexOf(fieldName); + return fieldNames.slice(index).every(_ => isNullable(fields[_])); +} + +function hasDefault(field) { + return field.default != null; +} + +function isNullable(field) { + return field.optional || hasDefault(field); +} + +function sortFieldNames(fields, type) { + return fields.sort((fieldA, fieldB) => { + const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); + const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); + if (indexA === indexB) return fieldA < fieldB ? -1 : 1; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + return indexA - indexB; + }); +} diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/formatCode.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/formatCode.js index 9d279e6e49ec41..1ed327bd82bf77 100644 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/formatCode.js +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/formatCode.js @@ -4,6 +4,8 @@ const prettier = require("prettier"); module.exports = function formatCode(code, filename) { filename = filename || __filename; const prettierConfig = prettier.resolveConfig.sync(filename); + prettierConfig.filepath = filename; + prettierConfig.parser = "babylon"; return prettier.format(code, prettierConfig); }; diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/stringifyValidator.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/stringifyValidator.js new file mode 100644 index 00000000000000..ff33e8e25ade29 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/stringifyValidator.js @@ -0,0 +1,43 @@ +module.exports = function stringifyValidator(validator, nodePrefix) { + if (validator === undefined) { + return "any"; + } + + if (validator.each) { + return `Array<${stringifyValidator(validator.each, nodePrefix)}>`; + } + + if (validator.chainOf) { + return stringifyValidator(validator.chainOf[1], nodePrefix); + } + + if (validator.oneOf) { + return validator.oneOf.map(JSON.stringify).join(" | "); + } + + if (validator.oneOfNodeTypes) { + return validator.oneOfNodeTypes.map(_ => nodePrefix + _).join(" | "); + } + + if (validator.oneOfNodeOrValueTypes) { + return validator.oneOfNodeOrValueTypes + .map(_ => { + return isValueType(_) ? _ : nodePrefix + _; + }) + .join(" | "); + } + + if (validator.type) { + return validator.type; + } + + return ["any"]; +}; + +/** + * Heuristic to decide whether or not the given type is a value type (eg. "null") + * or a Node type (eg. "Expression"). + */ +function isValueType(type) { + return type.charAt(0).toLowerCase() === type.charAt(0); +} diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/toFunctionName.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/toFunctionName.js new file mode 100644 index 00000000000000..627c9a7d8f0156 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/utils/toFunctionName.js @@ -0,0 +1,4 @@ +module.exports = function toFunctionName(typeName) { + const _ = typeName.replace(/^TS/, "ts").replace(/^JSX/, "jsx"); + return _.slice(0, 1).toLowerCase() + _.slice(1); +}; diff --git a/tools/node_modules/babel-eslint/node_modules/ansi-styles/index.js b/tools/node_modules/babel-eslint/node_modules/ansi-styles/index.js index 3d3baa66d75d1c..90a871c4d78f6f 100644 --- a/tools/node_modules/babel-eslint/node_modules/ansi-styles/index.js +++ b/tools/node_modules/babel-eslint/node_modules/ansi-styles/index.js @@ -102,30 +102,43 @@ function assembleStyles() { }); } + const ansi2ansi = n => n; const rgb2rgb = (r, g, b) => [r, g, b]; styles.color.close = '\u001B[39m'; styles.bgColor.close = '\u001B[49m'; - styles.color.ansi = {}; - styles.color.ansi256 = {}; + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; styles.color.ansi16m = { rgb: wrapAnsi16m(rgb2rgb, 0) }; - styles.bgColor.ansi = {}; - styles.bgColor.ansi256 = {}; + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; styles.bgColor.ansi16m = { rgb: wrapAnsi16m(rgb2rgb, 10) }; - for (const key of Object.keys(colorConvert)) { + for (let key of Object.keys(colorConvert)) { if (typeof colorConvert[key] !== 'object') { continue; } const suite = colorConvert[key]; + if (key === 'ansi16') { + key = 'ansi'; + } + if ('ansi16' in suite) { styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); diff --git a/tools/node_modules/babel-eslint/node_modules/ansi-styles/package.json b/tools/node_modules/babel-eslint/node_modules/ansi-styles/package.json index 6e9e19423b4668..5663ace24b4607 100644 --- a/tools/node_modules/babel-eslint/node_modules/ansi-styles/package.json +++ b/tools/node_modules/babel-eslint/node_modules/ansi-styles/package.json @@ -1,27 +1,4 @@ { - "_from": "ansi-styles@^3.1.0", - "_id": "ansi-styles@3.2.0", - "_inBundle": false, - "_integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "_location": "/babel-eslint/ansi-styles", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-styles@^3.1.0", - "name": "ansi-styles", - "escapedName": "ansi-styles", - "rawSpec": "^3.1.0", - "saveSpec": null, - "fetchSpec": "^3.1.0" - }, - "_requiredBy": [ - "/babel-eslint/chalk" - ], - "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "_shasum": "c159b8d5be0f9e5a6f346dab94f16ce022161b88", - "_spec": "ansi-styles@^3.1.0", - "_where": "/home/mzasso/git/nodejs/node/tools/babel-eslint-tmp/node_modules/babel-eslint/node_modules/chalk", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -42,6 +19,7 @@ "devDependencies": { "ava": "*", "babel-polyfill": "^6.23.0", + "svg-term-cli": "^2.1.1", "xo": "*" }, "engines": { @@ -80,7 +58,8 @@ "url": "git+https://github.com/chalk/ansi-styles.git" }, "scripts": { + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", "test": "xo && ava" }, - "version": "3.2.0" -} + "version": "3.2.1" +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/ansi-styles/readme.md b/tools/node_modules/babel-eslint/node_modules/ansi-styles/readme.md index dce368742b42af..3158e2df59ce66 100644 --- a/tools/node_modules/babel-eslint/node_modules/ansi-styles/readme.md +++ b/tools/node_modules/babel-eslint/node_modules/ansi-styles/readme.md @@ -4,7 +4,7 @@ You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. -![](screenshot.png) + ## Install diff --git a/tools/node_modules/babel-eslint/node_modules/babylon/README.md b/tools/node_modules/babel-eslint/node_modules/babylon/README.md deleted file mode 100644 index 78dd00be332591..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/babylon/README.md +++ /dev/null @@ -1,163 +0,0 @@ -

- babylon -

- -

- Babylon is a JavaScript parser used in Babel. -

- - - The latest ECMAScript version enabled by default (ES2017). - - Comment attachment. - - Support for JSX, Flow, Typescript. - - Support for experimental language proposals (accepting PRs for anything at least [stage-0](https://github.com/tc39/proposals/blob/master/stage-0-proposals.md)). - -## Credits - -Heavily based on [acorn](https://github.com/marijnh/acorn) and [acorn-jsx](https://github.com/RReverser/acorn-jsx), -thanks to the awesome work of [@RReverser](https://github.com/RReverser) and [@marijnh](https://github.com/marijnh). - -## API - -### `babylon.parse(code, [options])` - -### `babylon.parseExpression(code, [options])` - -`parse()` parses the provided `code` as an entire ECMAScript program, while -`parseExpression()` tries to parse a single Expression with performance in -mind. When in doubt, use `.parse()`. - -### Options - -- **allowImportExportEverywhere**: By default, `import` and `export` - declarations can only appear at a program's top level. Setting this - option to `true` allows them anywhere where a statement is allowed. - -- **allowReturnOutsideFunction**: By default, a return statement at - the top level raises an error. Set this to `true` to accept such - code. - -- **allowSuperOutsideMethod**: TODO - -- **sourceType**: Indicate the mode the code should be parsed in. Can be - one of `"script"`, `"module"`, or `"unambiguous"`. Defaults to `"script"`. `"unambiguous"` will make Babylon attempt to _guess_, based on the presence of ES6 `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`. - -- **sourceFilename**: Correlate output AST nodes with their source filename. Useful when generating code and source maps from the ASTs of multiple input files. - -- **startLine**: By default, the first line of code parsed is treated as line 1. You can provide a line number to alternatively start with. Useful for integration with other source tools. - -- **plugins**: Array containing the plugins that you want to enable. - -- **strictMode**: TODO - -- **ranges**: Adds a `ranges` property to each node: `[node.start, node.end]` - -- **tokens**: Adds all parsed tokens to a `tokens` property on the `File` node - -### Output - -Babylon generates AST according to [Babel AST format][]. -It is based on [ESTree spec][] with the following deviations: - -> There is now an `estree` plugin which reverts these deviations - -- [Literal][] token is replaced with [StringLiteral][], [NumericLiteral][], [BooleanLiteral][], [NullLiteral][], [RegExpLiteral][] -- [Property][] token is replaced with [ObjectProperty][] and [ObjectMethod][] -- [MethodDefinition][] is replaced with [ClassMethod][] -- [Program][] and [BlockStatement][] contain additional `directives` field with [Directive][] and [DirectiveLiteral][] -- [ClassMethod][], [ObjectProperty][], and [ObjectMethod][] value property's properties in [FunctionExpression][] is coerced/brought into the main method node. - -AST for JSX code is based on [Facebook JSX AST][] with the addition of one node type: - -- `JSXText` - -[Babel AST format]: https://github.com/babel/babylon/blob/master/ast/spec.md -[ESTree spec]: https://github.com/estree/estree - -[Literal]: https://github.com/estree/estree/blob/master/es5.md#literal -[Property]: https://github.com/estree/estree/blob/master/es5.md#property -[MethodDefinition]: https://github.com/estree/estree/blob/master/es2015.md#methoddefinition - -[StringLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#stringliteral -[NumericLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#numericliteral -[BooleanLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#booleanliteral -[NullLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#nullliteral -[RegExpLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#regexpliteral -[ObjectProperty]: https://github.com/babel/babylon/blob/master/ast/spec.md#objectproperty -[ObjectMethod]: https://github.com/babel/babylon/blob/master/ast/spec.md#objectmethod -[ClassMethod]: https://github.com/babel/babylon/blob/master/ast/spec.md#classmethod -[Program]: https://github.com/babel/babylon/blob/master/ast/spec.md#programs -[BlockStatement]: https://github.com/babel/babylon/blob/master/ast/spec.md#blockstatement -[Directive]: https://github.com/babel/babylon/blob/master/ast/spec.md#directive -[DirectiveLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#directiveliteral -[FunctionExpression]: https://github.com/babel/babylon/blob/master/ast/spec.md#functionexpression - -[Facebook JSX AST]: https://github.com/facebook/jsx/blob/master/AST.md - -### Semver - -Babylon follows semver in most situations. The only thing to note is that some spec-compliancy bug fixes may be released under patch versions. - -For example: We push a fix to early error on something like [#107](https://github.com/babel/babylon/pull/107) - multiple default exports per file. That would be considered a bug fix even though it would cause a build to fail. - -### Example - -```javascript -require("babylon").parse("code", { - // parse in strict mode and allow module declarations - sourceType: "module", - - plugins: [ - // enable jsx and flow syntax - "jsx", - "flow" - ] -}); -``` - -### Plugins - -| Name | Code Example | -|------|--------------| -| `estree` ([repo](https://github.com/estree/estree)) | n/a | -| `jsx` ([repo](https://facebook.github.io/jsx/)) | `{s}` | -| `flow` ([repo](https://github.com/facebook/flow)) | `var a: string = "";` | -| `typescript` ([repo](https://github.com/Microsoft/TypeScript)) | `var a: string = "";` | -| `doExpressions` | `var a = do { if (true) { 'hi'; } };` | -| `objectRestSpread` ([proposal](https://github.com/tc39/proposal-object-rest-spread)) | `var a = { b, ...c };` | -| `decorators` (Stage 1) and `decorators2` (Stage 2 [proposal](https://github.com/tc39/proposal-decorators)) | `@a class A {}` | -| `classProperties` ([proposal](https://github.com/tc39/proposal-class-public-fields)) | `class A { b = 1; }` | -| `classPrivateProperties` ([proposal](https://github.com/tc39/proposal-private-fields)) | `class A { #b = 1; }` | -| `classPrivateMethods` ([proposal](https://github.com/tc39/proposal-private-methods)) | `class A { #c() {} }` | -| `exportExtensions` ([proposal 1](https://github.com/leebyron/ecmascript-export-default-from)), ([proposal 2](https://github.com/leebyron/ecmascript-export-ns-from)) | Proposal 1: `export v from "mod"` Proposal 2: `export * as ns from "mod"` | -| `asyncGenerators` ([proposal](https://github.com/tc39/proposal-async-iteration)) | `async function*() {}`, `for await (let a of b) {}` | -| `functionBind` ([proposal](https://github.com/zenparsing/es-function-bind)) | `a::b`, `::console.log` | -| `functionSent` | `function.sent` | -| `dynamicImport` ([proposal](https://github.com/tc39/proposal-dynamic-import)) | `import('./guy').then(a)` | -| `numericSeparator` ([proposal](https://github.com/samuelgoto/proposal-numeric-separator)) | `1_000_000` | -| `optionalChaining` ([proposal](https://github.com/tc39/proposal-optional-chaining)) | `a?.b` | -| `importMeta` ([proposal](https://github.com/tc39/proposal-import-meta)) | `import.meta.url` | -| `bigInt` ([proposal](https://github.com/tc39/proposal-bigint)) | `100n` | -| `optionalCatchBinding` ([proposal](https://github.com/babel/proposals/issues/7)) | `try {throw 0;} catch{do();}` | -| `throwExpressions` ([proposal](https://github.com/babel/proposals/issues/23)) | `() => throw new Error("")` | -| `pipelineOperator` ([proposal](https://github.com/babel/proposals/issues/29)) | `a \|> b` | -| `nullishCoalescingOperator` ([proposal](https://github.com/babel/proposals/issues/14)) | `a ?? b` | - -### FAQ - -#### Will Babylon support a plugin system? - -Previous issues: [babel/babel#1351](https://github.com/babel/babel/issues/1351), [#500](https://github.com/babel/babylon/issues/500). - -We currently aren't willing to commit to supporting the API for plugins or the resulting ecosystem (there is already enough work maintaining Babel's own plugin system). It's not clear how to make that API effective, and it would limit out ability to refactor and optimize the codebase. - -Our current recommendation for those that want to create their own custom syntax is for users to fork Babylon. - -To consume your custom parser, you can add to your `.babelrc` via its npm package name or require it if using JavaScript, - -```json -{ - "parserOpts": { - "parser": "custom-fork-of-babylon-on-npm-here" - } -} -``` diff --git a/tools/node_modules/babel-eslint/node_modules/babylon/lib/index.js b/tools/node_modules/babel-eslint/node_modules/babylon/lib/index.js deleted file mode 100644 index 901202fd4d02b9..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/babylon/lib/index.js +++ /dev/null @@ -1,10635 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; -} - -// A second optional argument can be given to further configure -// the parser process. These options are recognized: -var defaultOptions = { - // Source type ("script" or "module") for different semantics - sourceType: "script", - // Source filename. - sourceFilename: undefined, - // Line from which to start counting source. Useful for - // integration with other tools. - startLine: 1, - // When enabled, a return at the top level is not considered an - // error. - allowReturnOutsideFunction: false, - // When enabled, import/export statements are not constrained to - // appearing at the top of the program. - allowImportExportEverywhere: false, - // TODO - allowSuperOutsideMethod: false, - // An array of plugins to enable - plugins: [], - // TODO - strictMode: null, - // Nodes have their start and end characters offsets recorded in - // `start` and `end` properties (directly on the node, rather than - // the `loc` object, which holds line/column data. To also add a - // [semi-standardized][range] `range` property holding a `[start, - // end]` array with the same numbers, set the `ranges` option to - // `true`. - // - // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 - ranges: false, - // Adds all parsed tokens to a `tokens` property on the `File` node - tokens: false -}; // Interpret and default an options object - -function getOptions(opts) { - var options = {}; - - for (var key in defaultOptions) { - options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key]; - } - - return options; -} - -// ## Token types -// The assignment of fine-grained, information-carrying type objects -// allows the tokenizer to store the information it has about a -// token in a way that is very cheap for the parser to look up. -// All token type variables start with an underscore, to make them -// easy to recognize. -// The `beforeExpr` property is used to disambiguate between regular -// expressions and divisions. It is set on all token types that can -// be followed by an expression (thus, a slash after them would be a -// regular expression). -// -// `isLoop` marks a keyword as starting a loop, which is important -// to know when parsing a label, in order to allow or disallow -// continue jumps to that label. -var beforeExpr = true; -var startsExpr = true; -var isLoop = true; -var isAssign = true; -var prefix = true; -var postfix = true; -var TokenType = function TokenType(label, conf) { - if (conf === void 0) { - conf = {}; - } - - this.label = label; - this.keyword = conf.keyword; - this.beforeExpr = !!conf.beforeExpr; - this.startsExpr = !!conf.startsExpr; - this.rightAssociative = !!conf.rightAssociative; - this.isLoop = !!conf.isLoop; - this.isAssign = !!conf.isAssign; - this.prefix = !!conf.prefix; - this.postfix = !!conf.postfix; - this.binop = conf.binop === 0 ? 0 : conf.binop || null; - this.updateContext = null; -}; - -var KeywordTokenType = -/*#__PURE__*/ -function (_TokenType) { - _inheritsLoose(KeywordTokenType, _TokenType); - - function KeywordTokenType(name, options) { - if (options === void 0) { - options = {}; - } - - options.keyword = name; - return _TokenType.call(this, name, options) || this; - } - - return KeywordTokenType; -}(TokenType); - -var BinopTokenType = -/*#__PURE__*/ -function (_TokenType2) { - _inheritsLoose(BinopTokenType, _TokenType2); - - function BinopTokenType(name, prec) { - return _TokenType2.call(this, name, { - beforeExpr, - binop: prec - }) || this; - } - - return BinopTokenType; -}(TokenType); -var types = { - num: new TokenType("num", { - startsExpr - }), - bigint: new TokenType("bigint", { - startsExpr - }), - regexp: new TokenType("regexp", { - startsExpr - }), - string: new TokenType("string", { - startsExpr - }), - name: new TokenType("name", { - startsExpr - }), - eof: new TokenType("eof"), - // Punctuation token types. - bracketL: new TokenType("[", { - beforeExpr, - startsExpr - }), - bracketR: new TokenType("]"), - braceL: new TokenType("{", { - beforeExpr, - startsExpr - }), - braceBarL: new TokenType("{|", { - beforeExpr, - startsExpr - }), - braceR: new TokenType("}"), - braceBarR: new TokenType("|}"), - parenL: new TokenType("(", { - beforeExpr, - startsExpr - }), - parenR: new TokenType(")"), - comma: new TokenType(",", { - beforeExpr - }), - semi: new TokenType(";", { - beforeExpr - }), - colon: new TokenType(":", { - beforeExpr - }), - doubleColon: new TokenType("::", { - beforeExpr - }), - dot: new TokenType("."), - question: new TokenType("?", { - beforeExpr - }), - questionDot: new TokenType("?."), - arrow: new TokenType("=>", { - beforeExpr - }), - template: new TokenType("template"), - ellipsis: new TokenType("...", { - beforeExpr - }), - backQuote: new TokenType("`", { - startsExpr - }), - dollarBraceL: new TokenType("${", { - beforeExpr, - startsExpr - }), - at: new TokenType("@"), - hash: new TokenType("#"), - // Operators. These carry several kinds of properties to help the - // parser use them properly (the presence of these properties is - // what categorizes them as operators). - // - // `binop`, when present, specifies that this operator is a binary - // operator, and will refer to its precedence. - // - // `prefix` and `postfix` mark the operator as a prefix or postfix - // unary operator. - // - // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as - // binary operators with a very low precedence, that should result - // in AssignmentExpression nodes. - eq: new TokenType("=", { - beforeExpr, - isAssign - }), - assign: new TokenType("_=", { - beforeExpr, - isAssign - }), - incDec: new TokenType("++/--", { - prefix, - postfix, - startsExpr - }), - bang: new TokenType("!", { - beforeExpr, - prefix, - startsExpr - }), - tilde: new TokenType("~", { - beforeExpr, - prefix, - startsExpr - }), - pipeline: new BinopTokenType("|>", 0), - nullishCoalescing: new BinopTokenType("??", 1), - logicalOR: new BinopTokenType("||", 1), - logicalAND: new BinopTokenType("&&", 2), - bitwiseOR: new BinopTokenType("|", 3), - bitwiseXOR: new BinopTokenType("^", 4), - bitwiseAND: new BinopTokenType("&", 5), - equality: new BinopTokenType("==/!=", 6), - relational: new BinopTokenType("", 7), - bitShift: new BinopTokenType("<>", 8), - plusMin: new TokenType("+/-", { - beforeExpr, - binop: 9, - prefix, - startsExpr - }), - modulo: new BinopTokenType("%", 10), - star: new BinopTokenType("*", 10), - slash: new BinopTokenType("/", 10), - exponent: new TokenType("**", { - beforeExpr, - binop: 11, - rightAssociative: true - }) -}; -var keywords = { - break: new KeywordTokenType("break"), - case: new KeywordTokenType("case", { - beforeExpr - }), - catch: new KeywordTokenType("catch"), - continue: new KeywordTokenType("continue"), - debugger: new KeywordTokenType("debugger"), - default: new KeywordTokenType("default", { - beforeExpr - }), - do: new KeywordTokenType("do", { - isLoop, - beforeExpr - }), - else: new KeywordTokenType("else", { - beforeExpr - }), - finally: new KeywordTokenType("finally"), - for: new KeywordTokenType("for", { - isLoop - }), - function: new KeywordTokenType("function", { - startsExpr - }), - if: new KeywordTokenType("if"), - return: new KeywordTokenType("return", { - beforeExpr - }), - switch: new KeywordTokenType("switch"), - throw: new KeywordTokenType("throw", { - beforeExpr, - prefix, - startsExpr - }), - try: new KeywordTokenType("try"), - var: new KeywordTokenType("var"), - let: new KeywordTokenType("let"), - const: new KeywordTokenType("const"), - while: new KeywordTokenType("while", { - isLoop - }), - with: new KeywordTokenType("with"), - new: new KeywordTokenType("new", { - beforeExpr, - startsExpr - }), - this: new KeywordTokenType("this", { - startsExpr - }), - super: new KeywordTokenType("super", { - startsExpr - }), - class: new KeywordTokenType("class"), - extends: new KeywordTokenType("extends", { - beforeExpr - }), - export: new KeywordTokenType("export"), - import: new KeywordTokenType("import", { - startsExpr - }), - yield: new KeywordTokenType("yield", { - beforeExpr, - startsExpr - }), - null: new KeywordTokenType("null", { - startsExpr - }), - true: new KeywordTokenType("true", { - startsExpr - }), - false: new KeywordTokenType("false", { - startsExpr - }), - in: new KeywordTokenType("in", { - beforeExpr, - binop: 7 - }), - instanceof: new KeywordTokenType("instanceof", { - beforeExpr, - binop: 7 - }), - typeof: new KeywordTokenType("typeof", { - beforeExpr, - prefix, - startsExpr - }), - void: new KeywordTokenType("void", { - beforeExpr, - prefix, - startsExpr - }), - delete: new KeywordTokenType("delete", { - beforeExpr, - prefix, - startsExpr - }) -}; // Map keyword names to token types. - -Object.keys(keywords).forEach(function (name) { - types["_" + name] = keywords[name]; -}); - -/* eslint max-len: 0 */ -function makePredicate(words) { - var wordsArr = words.split(" "); - return function (str) { - return wordsArr.indexOf(str) >= 0; - }; -} // Reserved word lists for various dialects of the language - - -var reservedWords = { - "6": makePredicate("enum await"), - strict: makePredicate("implements interface let package private protected public static yield"), - strictBind: makePredicate("eval arguments") -}; // And the keywords - -var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"); // ## Character categories -// Big ugly regular expressions that match characters in the -// whitespace, identifier, and identifier-start categories. These -// are only applied when a character is found to actually have a -// code point above 128. -// Generated by `bin/generate-identifier-regex.js`. - -/* prettier-ignore */ - -var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u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a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312e\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fea\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ae\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; -/* prettier-ignore */ - -var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d4-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; // These are a run-length and offset encoded representation of the -// >0xffff code points that are a valid part of identifiers. The -// offset starts at 0x10000, and each pair of numbers represents an -// offset to the next range, and then a size of the range. They were -// generated by `bin/generate-identifier-regex.js`. - -/* prettier-ignore */ - -var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 257, 0, 11, 39, 8, 0, 22, 0, 12, 39, 3, 3, 55, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 698, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 1, 31, 6124, 20, 754, 9486, 286, 82, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541]; -/* prettier-ignore */ - -var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 280, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 19719, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239]; // This has a complexity linear to the value of the code. The -// assumption is that looking up astral identifier characters is -// rare. - -function isInAstralSet(code, set) { - var pos = 0x10000; - - for (var i = 0; i < set.length; i += 2) { - pos += set[i]; - if (pos > code) return false; - pos += set[i + 1]; - if (pos >= code) return true; - } - - return false; -} // Test whether a given character code starts an identifier. - - -function isIdentifierStart(code) { - if (code < 65) return code === 36; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - - if (code <= 0xffff) { - return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); - } - - return isInAstralSet(code, astralIdentifierStartCodes); -} // Test whether a given character is part of an identifier. - -function isIdentifierChar(code) { - if (code < 48) return code === 36; - if (code < 58) return true; - if (code < 65) return false; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - - if (code <= 0xffff) { - return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); - } - - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); -} - -// Matches a whole line break (where CRLF is considered a single -// line break). Used to count lines. -var lineBreak = /\r\n?|\n|\u2028|\u2029/; -var lineBreakG = new RegExp(lineBreak.source, "g"); -function isNewLine(code) { - return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; -} -var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; - -// The algorithm used to determine whether a regexp can appear at a -// given point in the program is loosely based on sweet.js' approach. -// See https://github.com/mozilla/sweet.js/wiki/design -var TokContext = function TokContext(token, isExpr, preserveSpace, override) // Takes a Tokenizer as a this-parameter, and returns void. -{ - this.token = token; - this.isExpr = !!isExpr; - this.preserveSpace = !!preserveSpace; - this.override = override; -}; -var types$1 = { - braceStatement: new TokContext("{", false), - braceExpression: new TokContext("{", true), - templateQuasi: new TokContext("${", true), - parenStatement: new TokContext("(", false), - parenExpression: new TokContext("(", true), - template: new TokContext("`", true, true, function (p) { - return p.readTmplToken(); - }), - functionExpression: new TokContext("function", true) -}; // Token-specific context update code - -types.parenR.updateContext = types.braceR.updateContext = function () { - if (this.state.context.length === 1) { - this.state.exprAllowed = true; - return; - } - - var out = this.state.context.pop(); - - if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) { - this.state.context.pop(); - this.state.exprAllowed = false; - } else if (out === types$1.templateQuasi) { - this.state.exprAllowed = true; - } else { - this.state.exprAllowed = !out.isExpr; - } -}; - -types.name.updateContext = function (prevType) { - if (this.state.value === "of" && this.curContext() === types$1.parenStatement) { - this.state.exprAllowed = !prevType.beforeExpr; - return; - } - - this.state.exprAllowed = false; - - if (prevType === types._let || prevType === types._const || prevType === types._var) { - if (lineBreak.test(this.input.slice(this.state.end))) { - this.state.exprAllowed = true; - } - } -}; - -types.braceL.updateContext = function (prevType) { - this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression); - this.state.exprAllowed = true; -}; - -types.dollarBraceL.updateContext = function () { - this.state.context.push(types$1.templateQuasi); - this.state.exprAllowed = true; -}; - -types.parenL.updateContext = function (prevType) { - var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; - this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression); - this.state.exprAllowed = true; -}; - -types.incDec.updateContext = function () {// tokExprAllowed stays unchanged -}; - -types._function.updateContext = function () { - if (this.curContext() !== types$1.braceStatement) { - this.state.context.push(types$1.functionExpression); - } - - this.state.exprAllowed = false; -}; - -types.backQuote.updateContext = function () { - if (this.curContext() === types$1.template) { - this.state.context.pop(); - } else { - this.state.context.push(types$1.template); - } - - this.state.exprAllowed = false; -}; - -// These are used when `options.locations` is on, for the -// `startLoc` and `endLoc` properties. -var Position = function Position(line, col) { - this.line = line; - this.column = col; -}; -var SourceLocation = function SourceLocation(start, end) { - this.start = start; // $FlowIgnore (may start as null, but initialized later) - - this.end = end; -}; // The `getLineInfo` function is mostly useful when the -// `locations` option is off (for performance reasons) and you -// want to find the line/column position for a given character -// offset. `input` should be the code string that the offset refers -// into. - -function getLineInfo(input, offset) { - for (var line = 1, cur = 0;;) { - lineBreakG.lastIndex = cur; - var match = lineBreakG.exec(input); - - if (match && match.index < offset) { - ++line; - cur = match.index + match[0].length; - } else { - return new Position(line, offset - cur); - } - } // istanbul ignore next - - - throw new Error("Unreachable"); -} - -var BaseParser = -/*#__PURE__*/ -function () { - function BaseParser() {} - - var _proto = BaseParser.prototype; - - // Properties set by constructor in index.js - // Initialized by Tokenizer - _proto.isReservedWord = function isReservedWord(word) { - if (word === "await") { - return this.inModule; - } else { - return reservedWords[6](word); - } - }; - - _proto.hasPlugin = function hasPlugin(name) { - return !!this.plugins[name]; - }; - - return BaseParser; -}(); - -/* eslint max-len: 0 */ - -/** - * Based on the comment attachment algorithm used in espree and estraverse. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -function last(stack) { - return stack[stack.length - 1]; -} - -var CommentsParser = -/*#__PURE__*/ -function (_BaseParser) { - _inheritsLoose(CommentsParser, _BaseParser); - - function CommentsParser() { - return _BaseParser.apply(this, arguments) || this; - } - - var _proto = CommentsParser.prototype; - - _proto.addComment = function addComment(comment) { - if (this.filename) comment.loc.filename = this.filename; - this.state.trailingComments.push(comment); - this.state.leadingComments.push(comment); - }; - - _proto.processComment = function processComment(node) { - if (node.type === "Program" && node.body.length > 0) return; - var stack = this.state.commentStack; - var firstChild, lastChild, trailingComments, i, j; - - if (this.state.trailingComments.length > 0) { - // If the first comment in trailingComments comes after the - // current node, then we're good - all comments in the array will - // come after the node and so it's safe to add them as official - // trailingComments. - if (this.state.trailingComments[0].start >= node.end) { - trailingComments = this.state.trailingComments; - this.state.trailingComments = []; - } else { - // Otherwise, if the first comment doesn't come after the - // current node, that means we have a mix of leading and trailing - // comments in the array and that leadingComments contains the - // same items as trailingComments. Reset trailingComments to - // zero items and we'll handle this by evaluating leadingComments - // later. - this.state.trailingComments.length = 0; - } - } else { - if (stack.length > 0) { - var lastInStack = last(stack); - - if (lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) { - trailingComments = lastInStack.trailingComments; - lastInStack.trailingComments = null; - } - } - } // Eating the stack. - - - if (stack.length > 0 && last(stack).start >= node.start) { - firstChild = stack.pop(); - } - - while (stack.length > 0 && last(stack).start >= node.start) { - lastChild = stack.pop(); - } - - if (!lastChild && firstChild) lastChild = firstChild; // Attach comments that follow a trailing comma on the last - // property in an object literal or a trailing comma in function arguments - // as trailing comments - - if (firstChild && this.state.leadingComments.length > 0) { - var lastComment = last(this.state.leadingComments); - - if (firstChild.type === "ObjectProperty") { - if (lastComment.start >= node.start) { - if (this.state.commentPreviousNode) { - for (j = 0; j < this.state.leadingComments.length; j++) { - if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) { - this.state.leadingComments.splice(j, 1); - j--; - } - } - - if (this.state.leadingComments.length > 0) { - firstChild.trailingComments = this.state.leadingComments; - this.state.leadingComments = []; - } - } - } - } else if (node.type === "CallExpression" && node.arguments && node.arguments.length) { - var lastArg = last(node.arguments); - - if (lastArg && lastComment.start >= lastArg.start && lastComment.end <= node.end) { - if (this.state.commentPreviousNode) { - if (this.state.leadingComments.length > 0) { - lastArg.trailingComments = this.state.leadingComments; - this.state.leadingComments = []; - } - } - } - } - } - - if (lastChild) { - if (lastChild.leadingComments) { - if (lastChild !== node && lastChild.leadingComments.length > 0 && last(lastChild.leadingComments).end <= node.start) { - node.leadingComments = lastChild.leadingComments; - lastChild.leadingComments = null; - } else { - // A leading comment for an anonymous class had been stolen by its first ClassMethod, - // so this takes back the leading comment. - // See also: https://github.com/eslint/espree/issues/158 - for (i = lastChild.leadingComments.length - 2; i >= 0; --i) { - if (lastChild.leadingComments[i].end <= node.start) { - node.leadingComments = lastChild.leadingComments.splice(0, i + 1); - break; - } - } - } - } - } else if (this.state.leadingComments.length > 0) { - if (last(this.state.leadingComments).end <= node.start) { - if (this.state.commentPreviousNode) { - for (j = 0; j < this.state.leadingComments.length; j++) { - if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) { - this.state.leadingComments.splice(j, 1); - j--; - } - } - } - - if (this.state.leadingComments.length > 0) { - node.leadingComments = this.state.leadingComments; - this.state.leadingComments = []; - } - } else { - // https://github.com/eslint/espree/issues/2 - // - // In special cases, such as return (without a value) and - // debugger, all comments will end up as leadingComments and - // will otherwise be eliminated. This step runs when the - // commentStack is empty and there are comments left - // in leadingComments. - // - // This loop figures out the stopping point between the actual - // leading and trailing comments by finding the location of the - // first comment that comes after the given node. - for (i = 0; i < this.state.leadingComments.length; i++) { - if (this.state.leadingComments[i].end > node.start) { - break; - } - } // Split the array based on the location of the first comment - // that comes after the node. Keep in mind that this could - // result in an empty array, and if so, the array must be - // deleted. - - - var leadingComments = this.state.leadingComments.slice(0, i); - node.leadingComments = leadingComments.length === 0 ? null : leadingComments; // Similarly, trailing comments are attached later. The variable - // must be reset to null if there are no trailing comments. - - trailingComments = this.state.leadingComments.slice(i); - - if (trailingComments.length === 0) { - trailingComments = null; - } - } - } - - this.state.commentPreviousNode = node; - - if (trailingComments) { - if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) { - node.innerComments = trailingComments; - } else { - node.trailingComments = trailingComments; - } - } - - stack.push(node); - }; - - return CommentsParser; -}(BaseParser); - -// takes an offset integer (into the current `input`) to indicate -// the location of the error, attaches the position to the end -// of the error message, and then raises a `SyntaxError` with that -// message. - -var LocationParser = -/*#__PURE__*/ -function (_CommentsParser) { - _inheritsLoose(LocationParser, _CommentsParser); - - function LocationParser() { - return _CommentsParser.apply(this, arguments) || this; - } - - var _proto = LocationParser.prototype; - - _proto.raise = function raise(pos, message, missingPluginNames) { - var loc = getLineInfo(this.input, pos); - message += ` (${loc.line}:${loc.column})`; // $FlowIgnore - - var err = new SyntaxError(message); - err.pos = pos; - err.loc = loc; - - if (missingPluginNames) { - err.missingPlugin = missingPluginNames; - } - - throw err; - }; - - return LocationParser; -}(CommentsParser); - -var State = -/*#__PURE__*/ -function () { - function State() {} - - var _proto = State.prototype; - - _proto.init = function init(options, input) { - this.strict = options.strictMode === false ? false : options.sourceType === "module"; - this.input = input; - this.potentialArrowAt = -1; - this.noArrowAt = []; - this.noArrowParamsConversionAt = []; // eslint-disable-next-line max-len - - this.inMethod = this.inFunction = this.inParameters = this.maybeInArrowParameters = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.inClassProperty = this.noAnonFunctionType = false; - this.classLevel = 0; - this.labels = []; - this.decoratorStack = [[]]; - this.yieldInPossibleArrowParameters = null; - this.tokens = []; - this.comments = []; - this.trailingComments = []; - this.leadingComments = []; - this.commentStack = []; // $FlowIgnore - - this.commentPreviousNode = null; - this.pos = this.lineStart = 0; - this.curLine = options.startLine; - this.type = types.eof; - this.value = null; - this.start = this.end = this.pos; - this.startLoc = this.endLoc = this.curPosition(); // $FlowIgnore - - this.lastTokEndLoc = this.lastTokStartLoc = null; - this.lastTokStart = this.lastTokEnd = this.pos; - this.context = [types$1.braceStatement]; - this.exprAllowed = true; - this.containsEsc = this.containsOctal = false; - this.octalPosition = null; - this.invalidTemplateEscapePosition = null; - this.exportedIdentifiers = []; - }; // TODO - - - _proto.curPosition = function curPosition() { - return new Position(this.curLine, this.pos - this.lineStart); - }; - - _proto.clone = function clone(skipArrays) { - var _this = this; - - var state = new State(); - Object.keys(this).forEach(function (key) { - // $FlowIgnore - var val = _this[key]; - - if ((!skipArrays || key === "context") && Array.isArray(val)) { - val = val.slice(); - } // $FlowIgnore - - - state[key] = val; - }); - return state; - }; - - return State; -}(); - -var _isDigit = function isDigit(code) { - return code >= 48 && code <= 57; -}; - -/* eslint max-len: 0 */ -// an immediate sibling of NumericLiteralSeparator _ - -var forbiddenNumericSeparatorSiblings = { - decBinOct: [46, 66, 69, 79, 95, // multiple separators are not allowed - 98, 101, 111], - hex: [46, 88, 95, // multiple separators are not allowed - 120] -}; -var allowedNumericSeparatorSiblings = {}; -allowedNumericSeparatorSiblings.bin = [// 0 - 1 -48, 49]; -allowedNumericSeparatorSiblings.oct = allowedNumericSeparatorSiblings.bin.concat([50, 51, 52, 53, 54, 55]); -allowedNumericSeparatorSiblings.dec = allowedNumericSeparatorSiblings.oct.concat([56, 57]); -allowedNumericSeparatorSiblings.hex = allowedNumericSeparatorSiblings.dec.concat([65, 66, 67, 68, 69, 70, 97, 98, 99, 100, 101, 102]); // Object type used to represent tokens. Note that normally, tokens -// simply exist as properties on the parser object. This is only -// used for the onToken callback and the external tokenizer. - -var Token = function Token(state) { - this.type = state.type; - this.value = state.value; - this.start = state.start; - this.end = state.end; - this.loc = new SourceLocation(state.startLoc, state.endLoc); -}; // ## Tokenizer - -function codePointToString(code) { - // UTF-16 Decoding - if (code <= 0xffff) { - return String.fromCharCode(code); - } else { - return String.fromCharCode((code - 0x10000 >> 10) + 0xd800, (code - 0x10000 & 1023) + 0xdc00); - } -} - -var Tokenizer = -/*#__PURE__*/ -function (_LocationParser) { - _inheritsLoose(Tokenizer, _LocationParser); - - // Forward-declarations - // parser/util.js - function Tokenizer(options, input) { - var _this; - - _this = _LocationParser.call(this) || this; - _this.state = new State(); - - _this.state.init(options, input); - - _this.isLookahead = false; - return _this; - } // Move to the next token - - - var _proto = Tokenizer.prototype; - - _proto.next = function next() { - if (this.options.tokens && !this.isLookahead) { - this.state.tokens.push(new Token(this.state)); - } - - this.state.lastTokEnd = this.state.end; - this.state.lastTokStart = this.state.start; - this.state.lastTokEndLoc = this.state.endLoc; - this.state.lastTokStartLoc = this.state.startLoc; - this.nextToken(); - }; // TODO - - - _proto.eat = function eat(type) { - if (this.match(type)) { - this.next(); - return true; - } else { - return false; - } - }; // TODO - - - _proto.match = function match(type) { - return this.state.type === type; - }; // TODO - - - _proto.isKeyword = function isKeyword$$1(word) { - return isKeyword(word); - }; // TODO - - - _proto.lookahead = function lookahead() { - var old = this.state; - this.state = old.clone(true); - this.isLookahead = true; - this.next(); - this.isLookahead = false; - var curr = this.state; - this.state = old; - return curr; - }; // Toggle strict mode. Re-reads the next number or string to please - // pedantic tests (`"use strict"; 010;` should fail). - - - _proto.setStrict = function setStrict(strict) { - this.state.strict = strict; - if (!this.match(types.num) && !this.match(types.string)) return; - this.state.pos = this.state.start; - - while (this.state.pos < this.state.lineStart) { - this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; - --this.state.curLine; - } - - this.nextToken(); - }; - - _proto.curContext = function curContext() { - return this.state.context[this.state.context.length - 1]; - }; // Read a single token, updating the parser object's token-related - // properties. - - - _proto.nextToken = function nextToken() { - var curContext = this.curContext(); - if (!curContext || !curContext.preserveSpace) this.skipSpace(); - this.state.containsOctal = false; - this.state.octalPosition = null; - this.state.start = this.state.pos; - this.state.startLoc = this.state.curPosition(); - - if (this.state.pos >= this.input.length) { - this.finishToken(types.eof); - return; - } - - if (curContext.override) { - curContext.override(this); - } else { - this.readToken(this.fullCharCodeAtPos()); - } - }; - - _proto.readToken = function readToken(code) { - // Identifier or keyword. '\uXXXX' sequences are allowed in - // identifiers, so '\' also dispatches to that. - if (isIdentifierStart(code) || code === 92) { - this.readWord(); - } else { - this.getTokenFromCode(code); - } - }; - - _proto.fullCharCodeAtPos = function fullCharCodeAtPos() { - var code = this.input.charCodeAt(this.state.pos); - if (code <= 0xd7ff || code >= 0xe000) return code; - var next = this.input.charCodeAt(this.state.pos + 1); - return (code << 10) + next - 0x35fdc00; - }; - - _proto.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { - var comment = { - type: block ? "CommentBlock" : "CommentLine", - value: text, - start: start, - end: end, - loc: new SourceLocation(startLoc, endLoc) - }; - - if (!this.isLookahead) { - if (this.options.tokens) this.state.tokens.push(comment); - this.state.comments.push(comment); - this.addComment(comment); - } - }; - - _proto.skipBlockComment = function skipBlockComment() { - var startLoc = this.state.curPosition(); - var start = this.state.pos; - var end = this.input.indexOf("*/", this.state.pos += 2); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); - this.state.pos = end + 2; - lineBreakG.lastIndex = start; - var match; - - while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) { - ++this.state.curLine; - this.state.lineStart = match.index + match[0].length; - } - - this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); - }; - - _proto.skipLineComment = function skipLineComment(startSkip) { - var start = this.state.pos; - var startLoc = this.state.curPosition(); - var ch = this.input.charCodeAt(this.state.pos += startSkip); - - if (this.state.pos < this.input.length) { - while (ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233 && ++this.state.pos < this.input.length) { - ch = this.input.charCodeAt(this.state.pos); - } - } - - this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); - }; // Called at the start of the parse and after every token. Skips - // whitespace and comments, and. - - - _proto.skipSpace = function skipSpace() { - loop: while (this.state.pos < this.input.length) { - var ch = this.input.charCodeAt(this.state.pos); - - switch (ch) { - case 32: - case 160: - ++this.state.pos; - break; - - case 13: - if (this.input.charCodeAt(this.state.pos + 1) === 10) { - ++this.state.pos; - } - - case 10: - case 8232: - case 8233: - ++this.state.pos; - ++this.state.curLine; - this.state.lineStart = this.state.pos; - break; - - case 47: - switch (this.input.charCodeAt(this.state.pos + 1)) { - case 42: - this.skipBlockComment(); - break; - - case 47: - this.skipLineComment(2); - break; - - default: - break loop; - } - - break; - - default: - if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this.state.pos; - } else { - break loop; - } - - } - } - }; // Called at the end of every token. Sets `end`, `val`, and - // maintains `context` and `exprAllowed`, and skips the space after - // the token, so that the next one's `start` will point at the - // right position. - - - _proto.finishToken = function finishToken(type, val) { - this.state.end = this.state.pos; - this.state.endLoc = this.state.curPosition(); - var prevType = this.state.type; - this.state.type = type; - this.state.value = val; - this.updateContext(prevType); - }; // ### Token reading - // This is the function that is called to fetch the next token. It - // is somewhat obscure, because it works in character codes rather - // than characters, and because operator parsing has been inlined - // into it. - // - // All in the name of speed. - // - - - _proto.readToken_dot = function readToken_dot() { - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next >= 48 && next <= 57) { - this.readNumber(true); - return; - } - - var next2 = this.input.charCodeAt(this.state.pos + 2); - - if (next === 46 && next2 === 46) { - this.state.pos += 3; - this.finishToken(types.ellipsis); - } else { - ++this.state.pos; - this.finishToken(types.dot); - } - }; - - _proto.readToken_slash = function readToken_slash() { - // '/' - if (this.state.exprAllowed) { - ++this.state.pos; - this.readRegexp(); - return; - } - - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === 61) { - this.finishOp(types.assign, 2); - } else { - this.finishOp(types.slash, 1); - } - }; - - _proto.readToken_mult_modulo = function readToken_mult_modulo(code) { - // '%*' - var type = code === 42 ? types.star : types.modulo; - var width = 1; - var next = this.input.charCodeAt(this.state.pos + 1); - var exprAllowed = this.state.exprAllowed; // Exponentiation operator ** - - if (code === 42 && next === 42) { - width++; - next = this.input.charCodeAt(this.state.pos + 2); - type = types.exponent; - } - - if (next === 61 && !exprAllowed) { - width++; - type = types.assign; - } - - this.finishOp(type, width); - }; - - _proto.readToken_pipe_amp = function readToken_pipe_amp(code) { - // '|&' - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === code) { - this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); - return; - } - - if (code === 124) { - // '|>' - if (next === 62) { - this.finishOp(types.pipeline, 2); - return; - } else if (next === 125 && this.hasPlugin("flow")) { - // '|}' - this.finishOp(types.braceBarR, 2); - return; - } - } - - if (next === 61) { - this.finishOp(types.assign, 2); - return; - } - - this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); - }; - - _proto.readToken_caret = function readToken_caret() { - // '^' - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === 61) { - this.finishOp(types.assign, 2); - } else { - this.finishOp(types.bitwiseXOR, 1); - } - }; - - _proto.readToken_plus_min = function readToken_plus_min(code) { - // '+-' - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === code) { - if (next === 45 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { - // A `-->` line comment - this.skipLineComment(3); - this.skipSpace(); - this.nextToken(); - return; - } - - this.finishOp(types.incDec, 2); - return; - } - - if (next === 61) { - this.finishOp(types.assign, 2); - } else { - this.finishOp(types.plusMin, 1); - } - }; - - _proto.readToken_lt_gt = function readToken_lt_gt(code) { - // '<>' - var next = this.input.charCodeAt(this.state.pos + 1); - var size = 1; - - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; - - if (this.input.charCodeAt(this.state.pos + size) === 61) { - this.finishOp(types.assign, size + 1); - return; - } - - this.finishOp(types.bitShift, size); - return; - } - - if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { - // ` + + + +## Table of Contents + +- [Examples](#examples) + - [Consuming a source map](#consuming-a-source-map) + - [Generating a source map](#generating-a-source-map) + - [With SourceNode (high level API)](#with-sourcenode-high-level-api) + - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) +- [API](#api) + - [SourceMapConsumer](#sourcemapconsumer) + - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) + - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) + - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) + - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) + - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) + - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) + - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) + - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) + - [SourceMapGenerator](#sourcemapgenerator) + - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) + - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) + - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) + - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) + - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) + - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) + - [SourceNode](#sourcenode) + - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) + - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) + - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) + - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) + - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) + - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) + - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) + - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) + - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) + - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) + - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) + + + +## Examples + +### Consuming a source map + +```js +var rawSourceMap = { + version: 3, + file: 'min.js', + names: ['bar', 'baz', 'n'], + sources: ['one.js', 'two.js'], + sourceRoot: 'http://example.com/www/js/', + mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' +}; + +var smc = new SourceMapConsumer(rawSourceMap); + +console.log(smc.sources); +// [ 'http://example.com/www/js/one.js', +// 'http://example.com/www/js/two.js' ] + +console.log(smc.originalPositionFor({ + line: 2, + column: 28 +})); +// { source: 'http://example.com/www/js/two.js', +// line: 2, +// column: 10, +// name: 'n' } + +console.log(smc.generatedPositionFor({ + source: 'http://example.com/www/js/two.js', + line: 2, + column: 10 +})); +// { line: 2, column: 28 } + +smc.eachMapping(function (m) { + // ... +}); +``` + +### Generating a source map + +In depth guide: +[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) + +#### With SourceNode (high level API) + +```js +function compile(ast) { + switch (ast.type) { + case 'BinaryExpression': + return new SourceNode( + ast.location.line, + ast.location.column, + ast.location.source, + [compile(ast.left), " + ", compile(ast.right)] + ); + case 'Literal': + return new SourceNode( + ast.location.line, + ast.location.column, + ast.location.source, + String(ast.value) + ); + // ... + default: + throw new Error("Bad AST"); + } +} + +var ast = parse("40 + 2", "add.js"); +console.log(compile(ast).toStringWithSourceMap({ + file: 'add.js' +})); +// { code: '40 + 2', +// map: [object SourceMapGenerator] } +``` + +#### With SourceMapGenerator (low level API) + +```js +var map = new SourceMapGenerator({ + file: "source-mapped.js" +}); + +map.addMapping({ + generated: { + line: 10, + column: 35 + }, + source: "foo.js", + original: { + line: 33, + column: 2 + }, + name: "christopher" +}); + +console.log(map.toString()); +// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' +``` + +## API + +Get a reference to the module: + +```js +// Node.js +var sourceMap = require('source-map'); + +// Browser builds +var sourceMap = window.sourceMap; + +// Inside Firefox +const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); +``` + +### SourceMapConsumer + +A SourceMapConsumer instance represents a parsed source map which we can query +for information about the original file positions by giving it a file position +in the generated source. + +#### new SourceMapConsumer(rawSourceMap) + +The only parameter is the raw source map (either as a string which can be +`JSON.parse`'d, or an object). According to the spec, source maps have the +following attributes: + +* `version`: Which version of the source map spec this map is following. + +* `sources`: An array of URLs to the original source files. + +* `names`: An array of identifiers which can be referenced by individual + mappings. + +* `sourceRoot`: Optional. The URL root from which all sources are relative. + +* `sourcesContent`: Optional. An array of contents of the original source files. + +* `mappings`: A string of base64 VLQs which contain the actual mappings. + +* `file`: Optional. The generated filename this source map is associated with. + +```js +var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); +``` + +#### SourceMapConsumer.prototype.computeColumnSpans() + +Compute the last column for each generated mapping. The last column is +inclusive. + +```js +// Before: +consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1 }, +// { line: 2, +// column: 10 }, +// { line: 2, +// column: 20 } ] + +consumer.computeColumnSpans(); + +// After: +consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1, +// lastColumn: 9 }, +// { line: 2, +// column: 10, +// lastColumn: 19 }, +// { line: 2, +// column: 20, +// lastColumn: Infinity } ] + +``` + +#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) + +Returns the original source, line, and column information for the generated +source's line and column positions provided. The only argument is an object with +the following properties: + +* `line`: The line number in the generated source. + +* `column`: The column number in the generated source. + +* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or + `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest + element that is smaller than or greater than the one we are searching for, + respectively, if the exact element cannot be found. Defaults to + `SourceMapConsumer.GREATEST_LOWER_BOUND`. + +and an object is returned with the following properties: + +* `source`: The original source file, or null if this information is not + available. + +* `line`: The line number in the original source, or null if this information is + not available. + +* `column`: The column number in the original source, or null if this + information is not available. + +* `name`: The original identifier, or null if this information is not available. + +```js +consumer.originalPositionFor({ line: 2, column: 10 }) +// { source: 'foo.coffee', +// line: 2, +// column: 2, +// name: null } + +consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) +// { source: null, +// line: null, +// column: null, +// name: null } +``` + +#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) + +Returns the generated line and column information for the original source, +line, and column positions provided. The only argument is an object with +the following properties: + +* `source`: The filename of the original source. + +* `line`: The line number in the original source. + +* `column`: The column number in the original source. + +and an object is returned with the following properties: + +* `line`: The line number in the generated source, or null. + +* `column`: The column number in the generated source, or null. + +```js +consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) +// { line: 1, +// column: 56 } +``` + +#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) + +Returns all generated line and column information for the original source, line, +and column provided. If no column is provided, returns all mappings +corresponding to a either the line we are searching for or the next closest line +that has any mappings. Otherwise, returns all mappings corresponding to the +given line and either the column we are searching for or the next closest column +that has any offsets. + +The only argument is an object with the following properties: + +* `source`: The filename of the original source. + +* `line`: The line number in the original source. + +* `column`: Optional. The column number in the original source. + +and an array of objects is returned, each with the following properties: + +* `line`: The line number in the generated source, or null. + +* `column`: The column number in the generated source, or null. + +```js +consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1 }, +// { line: 2, +// column: 10 }, +// { line: 2, +// column: 20 } ] +``` + +#### SourceMapConsumer.prototype.hasContentsOfAllSources() + +Return true if we have the embedded source content for every source listed in +the source map, false otherwise. + +In other words, if this method returns `true`, then +`consumer.sourceContentFor(s)` will succeed for every source `s` in +`consumer.sources`. + +```js +// ... +if (consumer.hasContentsOfAllSources()) { + consumerReadyCallback(consumer); +} else { + fetchSources(consumer, consumerReadyCallback); +} +// ... +``` + +#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) + +Returns the original source content for the source provided. The only +argument is the URL of the original source file. + +If the source content for the given source is not found, then an error is +thrown. Optionally, pass `true` as the second param to have `null` returned +instead. + +```js +consumer.sources +// [ "my-cool-lib.clj" ] + +consumer.sourceContentFor("my-cool-lib.clj") +// "..." + +consumer.sourceContentFor("this is not in the source map"); +// Error: "this is not in the source map" is not in the source map + +consumer.sourceContentFor("this is not in the source map", true); +// null +``` + +#### SourceMapConsumer.prototype.eachMapping(callback, context, order) + +Iterate over each mapping between an original source/line/column and a +generated line/column in this source map. + +* `callback`: The function that is called with each mapping. Mappings have the + form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, + name }` + +* `context`: Optional. If specified, this object will be the value of `this` + every time that `callback` is called. + +* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or + `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over + the mappings sorted by the generated file's line/column order or the + original's source/line/column order, respectively. Defaults to + `SourceMapConsumer.GENERATED_ORDER`. + +```js +consumer.eachMapping(function (m) { console.log(m); }) +// ... +// { source: 'illmatic.js', +// generatedLine: 1, +// generatedColumn: 0, +// originalLine: 1, +// originalColumn: 0, +// name: null } +// { source: 'illmatic.js', +// generatedLine: 2, +// generatedColumn: 0, +// originalLine: 2, +// originalColumn: 0, +// name: null } +// ... +``` +### SourceMapGenerator + +An instance of the SourceMapGenerator represents a source map which is being +built incrementally. + +#### new SourceMapGenerator([startOfSourceMap]) + +You may pass an object with the following properties: + +* `file`: The filename of the generated source that this source map is + associated with. + +* `sourceRoot`: A root for all relative URLs in this source map. + +* `skipValidation`: Optional. When `true`, disables validation of mappings as + they are added. This can improve performance but should be used with + discretion, as a last resort. Even then, one should avoid using this flag when + running tests, if possible. + +```js +var generator = new sourceMap.SourceMapGenerator({ + file: "my-generated-javascript-file.js", + sourceRoot: "http://example.com/app/js/" +}); +``` + +#### SourceMapGenerator.fromSourceMap(sourceMapConsumer) + +Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. + +* `sourceMapConsumer` The SourceMap. + +```js +var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer); +``` + +#### SourceMapGenerator.prototype.addMapping(mapping) + +Add a single mapping from original source line and column to the generated +source's line and column for this source map being created. The mapping object +should have the following properties: + +* `generated`: An object with the generated line and column positions. + +* `original`: An object with the original line and column positions. + +* `source`: The original source file (relative to the sourceRoot). + +* `name`: An optional original token name for this mapping. + +```js +generator.addMapping({ + source: "module-one.scm", + original: { line: 128, column: 0 }, + generated: { line: 3, column: 456 } +}) +``` + +#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) + +Set the source content for an original source file. + +* `sourceFile` the URL of the original source file. + +* `sourceContent` the content of the source file. + +```js +generator.setSourceContent("module-one.scm", + fs.readFileSync("path/to/module-one.scm")) +``` + +#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) + +Applies a SourceMap for a source file to the SourceMap. +Each mapping to the supplied source file is rewritten using the +supplied SourceMap. Note: The resolution for the resulting mappings +is the minimum of this map and the supplied map. + +* `sourceMapConsumer`: The SourceMap to be applied. + +* `sourceFile`: Optional. The filename of the source file. + If omitted, sourceMapConsumer.file will be used, if it exists. + Otherwise an error will be thrown. + +* `sourceMapPath`: Optional. The dirname of the path to the SourceMap + to be applied. If relative, it is relative to the SourceMap. + + This parameter is needed when the two SourceMaps aren't in the same + directory, and the SourceMap to be applied contains relative source + paths. If so, those relative source paths need to be rewritten + relative to the SourceMap. + + If omitted, it is assumed that both SourceMaps are in the same directory, + thus not needing any rewriting. (Supplying `'.'` has the same effect.) + +#### SourceMapGenerator.prototype.toString() + +Renders the source map being generated to a string. + +```js +generator.toString() +// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' +``` + +### SourceNode + +SourceNodes provide a way to abstract over interpolating and/or concatenating +snippets of generated JavaScript source code, while maintaining the line and +column information associated between those snippets and the original source +code. This is useful as the final intermediate representation a compiler might +use before outputting the generated JS and source map. + +#### new SourceNode([line, column, source[, chunk[, name]]]) + +* `line`: The original line number associated with this source node, or null if + it isn't associated with an original line. + +* `column`: The original column number associated with this source node, or null + if it isn't associated with an original column. + +* `source`: The original source's filename; null if no filename is provided. + +* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see + below. + +* `name`: Optional. The original identifier. + +```js +var node = new SourceNode(1, 2, "a.cpp", [ + new SourceNode(3, 4, "b.cpp", "extern int status;\n"), + new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), + new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), +]); +``` + +#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) + +Creates a SourceNode from generated code and a SourceMapConsumer. + +* `code`: The generated code + +* `sourceMapConsumer` The SourceMap for the generated code + +* `relativePath` The optional path that relative sources in `sourceMapConsumer` + should be relative to. + +```js +var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); +var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), + consumer); +``` + +#### SourceNode.prototype.add(chunk) + +Add a chunk of generated JS to this source node. + +* `chunk`: A string snippet of generated JS code, another instance of + `SourceNode`, or an array where each member is one of those things. + +```js +node.add(" + "); +node.add(otherNode); +node.add([leftHandOperandNode, " + ", rightHandOperandNode]); +``` + +#### SourceNode.prototype.prepend(chunk) + +Prepend a chunk of generated JS to this source node. + +* `chunk`: A string snippet of generated JS code, another instance of + `SourceNode`, or an array where each member is one of those things. + +```js +node.prepend("/** Build Id: f783haef86324gf **/\n\n"); +``` + +#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) + +Set the source content for a source file. This will be added to the +`SourceMap` in the `sourcesContent` field. + +* `sourceFile`: The filename of the source file + +* `sourceContent`: The content of the source file + +```js +node.setSourceContent("module-one.scm", + fs.readFileSync("path/to/module-one.scm")) +``` + +#### SourceNode.prototype.walk(fn) + +Walk over the tree of JS snippets in this node and its children. The walking +function is called once for each snippet of JS and is passed that snippet and +the its original associated source's line/column location. + +* `fn`: The traversal function. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.walk(function (code, loc) { console.log("WALK:", code, loc); }) +// WALK: uno { source: 'b.js', line: 3, column: 4, name: null } +// WALK: dos { source: 'a.js', line: 1, column: 2, name: null } +// WALK: tres { source: 'a.js', line: 1, column: 2, name: null } +// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } +``` + +#### SourceNode.prototype.walkSourceContents(fn) + +Walk over the tree of SourceNodes. The walking function is called for each +source file content and is passed the filename and source content. + +* `fn`: The traversal function. + +```js +var a = new SourceNode(1, 2, "a.js", "generated from a"); +a.setSourceContent("a.js", "original a"); +var b = new SourceNode(1, 2, "b.js", "generated from b"); +b.setSourceContent("b.js", "original b"); +var c = new SourceNode(1, 2, "c.js", "generated from c"); +c.setSourceContent("c.js", "original c"); + +var node = new SourceNode(null, null, null, [a, b, c]); +node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) +// WALK: a.js : original a +// WALK: b.js : original b +// WALK: c.js : original c +``` + +#### SourceNode.prototype.join(sep) + +Like `Array.prototype.join` except for SourceNodes. Inserts the separator +between each of this source node's children. + +* `sep`: The separator. + +```js +var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); +var operand = new SourceNode(3, 4, "a.rs", "="); +var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); + +var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); +var joinedNode = node.join(" "); +``` + +#### SourceNode.prototype.replaceRight(pattern, replacement) + +Call `String.prototype.replace` on the very right-most source snippet. Useful +for trimming white space from the end of a source node, etc. + +* `pattern`: The pattern to replace. + +* `replacement`: The thing to replace the pattern with. + +```js +// Trim trailing white space. +node.replaceRight(/\s*$/, ""); +``` + +#### SourceNode.prototype.toString() + +Return the string representation of this source node. Walks over the tree and +concatenates all the various snippets together to one string. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.toString() +// 'unodostresquatro' +``` + +#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) + +Returns the string representation of this tree of source nodes, plus a +SourceMapGenerator which contains all the mappings between the generated and +original sources. + +The arguments are the same as those to `new SourceMapGenerator`. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.toStringWithSourceMap({ file: "my-output-file.js" }) +// { code: 'unodostresquatro', +// map: [object SourceMapGenerator] } +``` diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.debug.js b/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.debug.js new file mode 100644 index 00000000000000..b5ab6382abbabc --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.debug.js @@ -0,0 +1,3091 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["sourceMap"] = factory(); + else + root["sourceMap"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ + exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; + exports.SourceNode = __webpack_require__(10).SourceNode; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var base64VLQ = __webpack_require__(2); + var util = __webpack_require__(4); + var ArraySet = __webpack_require__(5).ArraySet; + var MappingList = __webpack_require__(6).MappingList; + + /** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ + function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; + } + + SourceMapGenerator.prototype._version = 3; + + /** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ + SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + + /** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ + SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + + /** + * Set the source content for a source file. + */ + SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + + /** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ + SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + + /** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ + SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + + /** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ + SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + + SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + + /** + * Externalize the source map. + */ + SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + + /** + * Render the source map being generated to a string. + */ + SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + + exports.SourceMapGenerator = SourceMapGenerator; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + var base64 = __webpack_require__(3); + + // A single base 64 digit can contain 6 bits of data. For the base 64 variable + // length quantities we use in the source map spec, the first bit is the sign, + // the next four bits are the actual value, and the 6th bit is the + // continuation bit. The continuation bit tells us whether there are more + // digits in this value following this digit. + // + // Continuation + // | Sign + // | | + // V V + // 101011 + + var VLQ_BASE_SHIFT = 5; + + // binary: 100000 + var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + + // binary: 011111 + var VLQ_BASE_MASK = VLQ_BASE - 1; + + // binary: 100000 + var VLQ_CONTINUATION_BIT = VLQ_BASE; + + /** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ + function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; + } + + /** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ + function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; + } + + /** + * Returns the base 64 VLQ encoded value. + */ + exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; + }; + + /** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ + exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; + }; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + + /** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ + exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); + }; + + /** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ + exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; + }; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + /** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ + function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } + } + exports.getArg = getArg; + + var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; + var dataUrlRegexp = /^data:.+\,.+$/; + + function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; + } + exports.urlParse = urlParse; + + function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; + } + exports.urlGenerate = urlGenerate; + + /** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ + function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; + } + exports.normalize = normalize; + + /** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ + function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; + } + exports.join = join; + + exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); + }; + + /** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ + function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); + } + exports.relative = relative; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ + function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ + function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; + } + exports.compareByOriginalPositions = compareByOriginalPositions; + + /** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ + function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; + } + exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + + function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; + } + + /** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ + function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ + function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * Static method for creating ArraySet instances from an existing array. + */ + ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; + }; + + /** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ + ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; + }; + + /** + * Add the given string to this set. + * + * @param String aStr + */ + ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); + }; + + /** + * What is the element at the given index? + * + * @param Number aIdx + */ + ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); + }; + + /** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ + ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); + }; + + exports.ArraySet = ArraySet; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + + /** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ + function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; + } + + /** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ + function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; + } + + /** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ + MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + + /** + * Add the given source mapping. + * + * @param Object aMapping + */ + MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } + }; + + /** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ + MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; + }; + + exports.MappingList = MappingList; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var binarySearch = __webpack_require__(8); + var ArraySet = __webpack_require__(5).ArraySet; + var base64VLQ = __webpack_require__(2); + var quickSort = __webpack_require__(9).quickSort; + + function SourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap) + : new BasicSourceMapConsumer(sourceMap); + } + + SourceMapConsumer.fromSourceMap = function(aSourceMap) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap); + } + + /** + * The version of the source mapping spec that we are consuming. + */ + SourceMapConsumer.prototype._version = 3; + + // `__generatedMappings` and `__originalMappings` are arrays that hold the + // parsed mapping coordinates from the source map's "mappings" attribute. They + // are lazily instantiated, accessed via the `_generatedMappings` and + // `_originalMappings` getters respectively, and we only parse the mappings + // and create these arrays once queried for a source location. We jump through + // these hoops because there can be many thousands of mappings, and parsing + // them is expensive, so we only want to do it if we must. + // + // Each object in the arrays is of the form: + // + // { + // generatedLine: The line number in the generated code, + // generatedColumn: The column number in the generated code, + // source: The path to the original source file that generated this + // chunk of code, + // originalLine: The line number in the original source that + // corresponds to this chunk of generated code, + // originalColumn: The column number in the original source that + // corresponds to this chunk of generated code, + // name: The name of the original symbol which generated this chunk of + // code. + // } + // + // All properties except for `generatedLine` and `generatedColumn` can be + // `null`. + // + // `_generatedMappings` is ordered by the generated positions. + // + // `_originalMappings` is ordered by the original positions. + + SourceMapConsumer.prototype.__generatedMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } + }); + + SourceMapConsumer.prototype.__originalMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } + }); + + SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + + SourceMapConsumer.GENERATED_ORDER = 1; + SourceMapConsumer.ORIGINAL_ORDER = 2; + + SourceMapConsumer.GREATEST_LOWER_BOUND = 1; + SourceMapConsumer.LEAST_UPPER_BOUND = 2; + + /** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ + SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + if (source != null && sourceRoot != null) { + source = util.join(sourceRoot, source); + } + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + + /** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: Optional. the column number in the original source. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + if (this.sourceRoot != null) { + needle.source = util.relative(this.sourceRoot, needle.source); + } + if (!this._sources.has(needle.source)) { + return []; + } + needle.source = this._sources.indexOf(needle.source); + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + + exports.SourceMapConsumer = SourceMapConsumer; + + /** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The only parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ + function BasicSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this.file = file; + } + + BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @returns BasicSourceMapConsumer + */ + BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + + /** + * The version of the source mapping spec that we are consuming. + */ + BasicSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._sources.toArray().map(function (s) { + return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; + }, this); + } + }); + + /** + * Provide the JIT with a nice shape / hidden class. + */ + function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + + /** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ + BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + + /** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ + BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ + BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + if (this.sourceRoot != null) { + source = util.join(this.sourceRoot, source); + } + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + if (this.sourceRoot != null) { + aSource = util.relative(this.sourceRoot, aSource); + } + + if (this._sources.has(aSource)) { + return this.sourcesContent[this._sources.indexOf(aSource)]; + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + aSource)) { + return this.sourcesContent[this._sources.indexOf("/" + aSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + if (this.sourceRoot != null) { + source = util.relative(this.sourceRoot, source); + } + if (!this._sources.has(source)) { + return { + line: null, + column: null, + lastColumn: null + }; + } + source = this._sources.indexOf(source); + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + + exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + + /** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The only parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ + function IndexedSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map')) + } + }); + } + + IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + + /** + * The version of the source mapping spec that we are consuming. + */ + IndexedSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } + }); + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ + IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + if (section.consumer.sourceRoot !== null) { + source = util.join(section.consumer.sourceRoot, source); + } + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + + exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + exports.GREATEST_LOWER_BOUND = 1; + exports.LEAST_UPPER_BOUND = 2; + + /** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ + function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } + } + + /** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ + exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; + }; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + // It turns out that some (most?) JavaScript engines don't self-host + // `Array.prototype.sort`. This makes sense because C++ will likely remain + // faster than JS when doing raw CPU-intensive sorting. However, when using a + // custom comparator function, calling back and forth between the VM's C++ and + // JIT'd JS is rather slow *and* loses JIT type information, resulting in + // worse generated code for the comparator function than would be optimal. In + // fact, when sorting with a comparator, these costs outweigh the benefits of + // sorting in C++. By using our own JS-implemented Quick Sort (below), we get + // a ~3500ms mean speed-up in `bench/bench.html`. + + /** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ + function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; + } + + /** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ + function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); + } + + /** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ + function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } + } + + /** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ + exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); + }; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + var util = __webpack_require__(4); + + // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other + // operating systems these days (capturing the result). + var REGEX_NEWLINE = /(\r?\n)/; + + // Newline character code for charCodeAt() comparisons + var NEWLINE_CODE = 10; + + // Private symbol for identifying `SourceNode`s when multiple versions of + // the source-map library are loaded. This MUST NOT CHANGE across + // versions! + var isSourceNode = "$$$isSourceNode$$$"; + + /** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ + function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); + } + + /** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ + SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + + /** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } + }; + + /** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ + SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; + }; + + /** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ + SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; + }; + + /** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ + SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + + /** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + + /** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ + SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; + }; + + /** + * Returns the string representation of this source node along with a source + * map. + */ + SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; + }; + + exports.SourceNode = SourceNode; + + +/***/ }) +/******/ ]) +}); +; +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCBlNDczOGZjNzJhN2IyMzAzOTg4OSIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2VicGFjazovLy8uL2xpYi9hcnJheS1zZXQuanMiLCJ3ZWJwYWNrOi8vLy4vbGliL21hcHBpbmctbGlzdC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmluYXJ5LXNlYXJjaC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvcXVpY2stc29ydC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW5vZGUuanMiXSwibmFtZXMiOltdLCJtYXB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B1dGlsLnJlbGF0aXZlKHRoaXMuc291cmNlUm9vdCwgbmVlZGxlLnNvdXJjZSk7XG4gICAgfVxuICAgIGlmICghdGhpcy5fc291cmNlcy5oYXMobmVlZGxlLnNvdXJjZSkpIHtcbiAgICAgIHJldHVybiBbXTtcbiAgICB9XG4gICAgbmVlZGxlLnNvdXJjZSA9IHRoaXMuX3NvdXJjZXMuaW5kZXhPZihuZWVkbGUuc291cmNlKTtcblxuICAgIHZhciBtYXBwaW5ncyA9IFtdO1xuXG4gICAgdmFyIGluZGV4ID0gdGhpcy5fZmluZE1hcHBpbmcobmVlZGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29yaWdpbmFsTWFwcGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJvcmlnaW5hbExpbmVcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXRpbC5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5hcnlTZWFyY2guTEVBU1RfVVBQRVJfQk9VTkQpO1xuICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3NbaW5kZXhdO1xuXG4gICAgICBpZiAoYUFyZ3MuY29sdW1uID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgdmFyIG9yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luYWxMaW5lO1xuXG4gICAgICAgIC8vIEl0ZXJhdGUgdW50aWwgZWl0aGVyIHdlIHJ1biBvdXQgb2YgbWFwcGluZ3MsIG9yIHdlIHJ1biBpbnRvXG4gICAgICAgIC8vIGEgbWFwcGluZyBmb3IgYSBkaWZmZXJlbnQgbGluZSB0aGFu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1hcHBpbmcsICduYW1lJywgbnVsbCk7XG4gICAgICAgIGlmIChuYW1lICE9PSBudWxsKSB7XG4gICAgICAgICAgbmFtZSA9IHRoaXMuX25hbWVzLmF0KG5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICAgICAgbGluZTogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsTGluZScsIG51bGwpLFxuICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsQ29sdW1uJywgbnVsbCksXG4gICAgICAgICAgbmFtZTogbmFtZVxuICAgICAgICB9O1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBzb3VyY2U6IG51bGwsXG4gICAgICBsaW5lOiBudWxsLFxuICAgICAgY29sdW1uOiBudWxsLFxuICAgICAgbmFtZTogbnVsbFxuICAgIH07XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRydWUgaWYgd2UgaGF2ZSB0aGUgc291cmNlIGNvbnRlbnQgZm9yIGV2ZXJ5IHNvdXJjZSBpbiB0aGUgc291cmNlXG4gKiBtYXAsIGZhbHNlIG90aGVyd2lzZS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuaGFzQ29udGVudHNPZkFsbFNvdXJjZXMgPVxuICBmdW5jdGlvbiBCYXNpY1NvdXJjZU1hcENvbnN1bWVyX2hhc0NvbnRlbnRzT2ZBbGxTb3VyY2VzKCkge1xuICAgIGlmICghdGhpcy5zb3VyY2VzQ29udGVudCkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgICByZXR1cm4gdGhpcy5zb3VyY2VzQ29udGVudC5sZW5ndGggPj0gdGhpcy5fc291cmNlcy5zaXplKCkgJiZcbiAgICAgICF0aGlzLnNvdXJjZXNDb250ZW50LnNvbWUoZnVuY3Rpb24gKHNjKSB7I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GaWxlKSB7XG4gICAgICB2YXIgY29udGVudCA9IGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VDb250ZW50Rm9yKHNvdXJjZUZpbGUpO1xuICAgICAgaWYgKGNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgICBpZiAoYVJlbGF0aXZlUGF0aCAhPSBudWxsKSB7XG4gICAgICAgICAgc291cmNlRmlsZSA9IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBzb3VyY2VGaWxlKTtcbiAgICAgICAgfVxuICAgICAgICBub2RlLnNldFNvdXJjZUNvbnRlbnQoc291cmNlRmlsZSwgY29udGVudCk7XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICByZXR1cm4gbm9kZTtcblxuICAgIGZ1bmN0aW9uIGFkZE1hcHBpbmdXaXRoQ29kZShtYXBwaW5nLCBjb2RlKSB7XG4gICAgICBpZiAobWFwcGluZyA9PT0gbnVsbCB8fCBtYXBwaW5nLnNvdXJjZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIG5vZGUuYWRkKGNvZGUpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdmFyIHNvdXJjZSA9IGFSZWxhdGl2ZVBhdGhcbiAgICAgICAgICA/IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBtYXBwaW5nLnNvdXJjZSlcbiAgICAgICAgICA6IG1hcHBpbmcuc291cmNlO1xuICAgICAgICBub2RlLmFkZChuZXcgU291cmNlTm9kZShtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nLm5hbWUpKTtcbiAgICAgIH1cbiAgICB9XG4gIH07XG5cbi8qKlxuICog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G4gICAgfVxuICAgIGZvciAodmFyIGlkeCA9IDAsIGxlbmd0aCA9IGNodW5rLmxlbmd0aDsgaWR4IDwgbGVuZ3RoOyBpZHgrKykge1xuICAgICAgaWYgKGNodW5rLmNoYXJDb2RlQXQoaWR4KSA9PT0gTkVXTElORV9DT0RFKSB7XG4gICAgICAgIGdlbmVyYXRlZC5saW5lKys7XG4gICAgICAgIGdlbmVyYXRlZC5jb2x1bW4gPSAwO1xuICAgICAgICAvLyBNYXBwaW5ncyBlbmQgYXQgZW9sXG4gICAgICAgIGlmIChpZHggKyAxID09PSBsZW5ndGgpIHtcbiAgICAgICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBudWxsO1xuICAgICAgICAgIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIGlmIChzb3VyY2VNYXBwaW5nQWN0aXZlKSB7XG4gICAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgICAgc291cmNlOiBvcmlnaW5hbC5zb3VyY2UsXG4gICAgICAgICAgICBvcmlnaW5hbDoge1xuICAgICAgICAgICAgICBsaW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgICBjb2x1bW46IG9yaWdpbmFsLmNvbHVtblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgICBsaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgICAgICAgICAgY29sdW1uOiBnZW5lcmF0ZWQuY29sdW1uXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbmFtZTogb3JpZ2luYWwubmFtZVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBnZW5lcmF0ZWQuY29sdW1uKys7XG4gICAgICB9XG4gICAgfVxuICB9KTtcbiAgdGhpcy53YWxrU291cmNlQ29udGVudHMoZnVuY3Rpb24gKHNvdXJjZUZpbGUsIHNvdXJjZUNvbnRlbnQpIHtcbiAgICBtYXAuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KTtcbiAgfSk7XG5cbiAgcmV0dXJuIHsgY29kZTogZ2VuZXJhdGVkLmNvZGUsIG1hcDogbWFwIH07XG59O1xuXG5leHBvcnRzLlNvdXJjZU5vZGUgPSBTb3VyY2VOb2RlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW5vZGUuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.js b/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.js new file mode 100644 index 00000000000000..4e630e29434ca5 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.js @@ -0,0 +1,3090 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["sourceMap"] = factory(); + else + root["sourceMap"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + /* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ + exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; + exports.SourceNode = __webpack_require__(10).SourceNode; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var base64VLQ = __webpack_require__(2); + var util = __webpack_require__(4); + var ArraySet = __webpack_require__(5).ArraySet; + var MappingList = __webpack_require__(6).MappingList; + + /** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ + function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; + } + + SourceMapGenerator.prototype._version = 3; + + /** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ + SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + + /** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ + SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + + /** + * Set the source content for a source file. + */ + SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + + /** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ + SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + + /** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ + SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + + /** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ + SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + + SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + + /** + * Externalize the source map. + */ + SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + + /** + * Render the source map being generated to a string. + */ + SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + + exports.SourceMapGenerator = SourceMapGenerator; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + var base64 = __webpack_require__(3); + + // A single base 64 digit can contain 6 bits of data. For the base 64 variable + // length quantities we use in the source map spec, the first bit is the sign, + // the next four bits are the actual value, and the 6th bit is the + // continuation bit. The continuation bit tells us whether there are more + // digits in this value following this digit. + // + // Continuation + // | Sign + // | | + // V V + // 101011 + + var VLQ_BASE_SHIFT = 5; + + // binary: 100000 + var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + + // binary: 011111 + var VLQ_BASE_MASK = VLQ_BASE - 1; + + // binary: 100000 + var VLQ_CONTINUATION_BIT = VLQ_BASE; + + /** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ + function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; + } + + /** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ + function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; + } + + /** + * Returns the base 64 VLQ encoded value. + */ + exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; + }; + + /** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ + exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; + }; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + + /** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ + exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); + }; + + /** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ + exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; + }; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + /** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ + function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } + } + exports.getArg = getArg; + + var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; + var dataUrlRegexp = /^data:.+\,.+$/; + + function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; + } + exports.urlParse = urlParse; + + function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; + } + exports.urlGenerate = urlGenerate; + + /** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ + function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; + } + exports.normalize = normalize; + + /** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ + function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; + } + exports.join = join; + + exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); + }; + + /** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ + function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); + } + exports.relative = relative; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ + function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ + function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; + } + exports.compareByOriginalPositions = compareByOriginalPositions; + + /** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ + function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; + } + exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + + function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; + } + + /** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ + function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); + } + exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ + function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * Static method for creating ArraySet instances from an existing array. + */ + ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; + }; + + /** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ + ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; + }; + + /** + * Add the given string to this set. + * + * @param String aStr + */ + ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); + }; + + /** + * What is the element at the given index? + * + * @param Number aIdx + */ + ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); + }; + + /** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ + ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); + }; + + exports.ArraySet = ArraySet; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + + /** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ + function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; + } + + /** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ + function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; + } + + /** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ + MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + + /** + * Add the given source mapping. + * + * @param Object aMapping + */ + MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } + }; + + /** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ + MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; + }; + + exports.MappingList = MappingList; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var util = __webpack_require__(4); + var binarySearch = __webpack_require__(8); + var ArraySet = __webpack_require__(5).ArraySet; + var base64VLQ = __webpack_require__(2); + var quickSort = __webpack_require__(9).quickSort; + + function SourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap) + : new BasicSourceMapConsumer(sourceMap); + } + + SourceMapConsumer.fromSourceMap = function(aSourceMap) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap); + } + + /** + * The version of the source mapping spec that we are consuming. + */ + SourceMapConsumer.prototype._version = 3; + + // `__generatedMappings` and `__originalMappings` are arrays that hold the + // parsed mapping coordinates from the source map's "mappings" attribute. They + // are lazily instantiated, accessed via the `_generatedMappings` and + // `_originalMappings` getters respectively, and we only parse the mappings + // and create these arrays once queried for a source location. We jump through + // these hoops because there can be many thousands of mappings, and parsing + // them is expensive, so we only want to do it if we must. + // + // Each object in the arrays is of the form: + // + // { + // generatedLine: The line number in the generated code, + // generatedColumn: The column number in the generated code, + // source: The path to the original source file that generated this + // chunk of code, + // originalLine: The line number in the original source that + // corresponds to this chunk of generated code, + // originalColumn: The column number in the original source that + // corresponds to this chunk of generated code, + // name: The name of the original symbol which generated this chunk of + // code. + // } + // + // All properties except for `generatedLine` and `generatedColumn` can be + // `null`. + // + // `_generatedMappings` is ordered by the generated positions. + // + // `_originalMappings` is ordered by the original positions. + + SourceMapConsumer.prototype.__generatedMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } + }); + + SourceMapConsumer.prototype.__originalMappings = null; + Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } + }); + + SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + + SourceMapConsumer.GENERATED_ORDER = 1; + SourceMapConsumer.ORIGINAL_ORDER = 2; + + SourceMapConsumer.GREATEST_LOWER_BOUND = 1; + SourceMapConsumer.LEAST_UPPER_BOUND = 2; + + /** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ + SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + if (source != null && sourceRoot != null) { + source = util.join(sourceRoot, source); + } + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + + /** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: Optional. the column number in the original source. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + if (this.sourceRoot != null) { + needle.source = util.relative(this.sourceRoot, needle.source); + } + if (!this._sources.has(needle.source)) { + return []; + } + needle.source = this._sources.indexOf(needle.source); + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + + exports.SourceMapConsumer = SourceMapConsumer; + + /** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The only parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ + function BasicSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this.file = file; + } + + BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @returns BasicSourceMapConsumer + */ + BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + + /** + * The version of the source mapping spec that we are consuming. + */ + BasicSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._sources.toArray().map(function (s) { + return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; + }, this); + } + }); + + /** + * Provide the JIT with a nice shape / hidden class. + */ + function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + + /** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ + BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + + /** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ + BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ + BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + if (this.sourceRoot != null) { + source = util.join(this.sourceRoot, source); + } + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + if (this.sourceRoot != null) { + aSource = util.relative(this.sourceRoot, aSource); + } + + if (this._sources.has(aSource)) { + return this.sourcesContent[this._sources.indexOf(aSource)]; + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + aSource)) { + return this.sourcesContent[this._sources.indexOf("/" + aSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + if (this.sourceRoot != null) { + source = util.relative(this.sourceRoot, source); + } + if (!this._sources.has(source)) { + return { + line: null, + column: null, + lastColumn: null + }; + } + source = this._sources.indexOf(source); + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + + exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + + /** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The only parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ + function IndexedSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map')) + } + }); + } + + IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); + IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + + /** + * The version of the source mapping spec that we are consuming. + */ + IndexedSourceMapConsumer.prototype._version = 3; + + /** + * The list of original sources. + */ + Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } + }); + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ + IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + if (section.consumer.sourceRoot !== null) { + source = util.join(section.consumer.sourceRoot, source); + } + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + + exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + exports.GREATEST_LOWER_BOUND = 1; + exports.LEAST_UPPER_BOUND = 2; + + /** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ + function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } + } + + /** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ + exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; + }; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + // It turns out that some (most?) JavaScript engines don't self-host + // `Array.prototype.sort`. This makes sense because C++ will likely remain + // faster than JS when doing raw CPU-intensive sorting. However, when using a + // custom comparator function, calling back and forth between the VM's C++ and + // JIT'd JS is rather slow *and* loses JIT type information, resulting in + // worse generated code for the comparator function than would be optimal. In + // fact, when sorting with a comparator, these costs outweigh the benefits of + // sorting in C++. By using our own JS-implemented Quick Sort (below), we get + // a ~3500ms mean speed-up in `bench/bench.html`. + + /** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ + function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; + } + + /** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ + function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); + } + + /** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ + function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } + } + + /** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ + exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); + }; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + /* -*- Mode: js; js-indent-level: 2; -*- */ + /* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + + var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; + var util = __webpack_require__(4); + + // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other + // operating systems these days (capturing the result). + var REGEX_NEWLINE = /(\r?\n)/; + + // Newline character code for charCodeAt() comparisons + var NEWLINE_CODE = 10; + + // Private symbol for identifying `SourceNode`s when multiple versions of + // the source-map library are loaded. This MUST NOT CHANGE across + // versions! + var isSourceNode = "$$$isSourceNode$$$"; + + /** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ + function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); + } + + /** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ + SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + + /** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + }; + + /** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } + }; + + /** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ + SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; + }; + + /** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ + SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; + }; + + /** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ + SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + + /** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ + SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + + /** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ + SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; + }; + + /** + * Returns the string representation of this source node along with a source + * map. + */ + SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; + }; + + exports.SourceNode = SourceNode; + + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.min.js b/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.min.js new file mode 100644 index 00000000000000..f2a46bd02536a3 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.min.js @@ -0,0 +1,2 @@ +!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.sourceMap=n():e.sourceMap=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){n.SourceMapGenerator=r(1).SourceMapGenerator,n.SourceMapConsumer=r(7).SourceMapConsumer,n.SourceNode=r(10).SourceNode},function(e,n,r){function t(e){e||(e={}),this._file=i.getArg(e,"file",null),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._skipValidation=i.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new a,this._sourcesContents=null}var o=r(2),i=r(4),s=r(5).ArraySet,a=r(6).MappingList;t.prototype._version=3,t.fromSourceMap=function(e){var n=e.sourceRoot,r=new t({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=i.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)}),e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&r.setSourceContent(n,t)}),r},t.prototype.addMapping=function(e){var n=i.getArg(e,"generated"),r=i.getArg(e,"original",null),t=i.getArg(e,"source",null),o=i.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,t,o),null!=t&&(t=String(t),this._sources.has(t)||this._sources.add(t)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:t,name:o})},t.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=i.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[i.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},t.prototype.applySourceMap=function(e,n,r){var t=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var o=this._sourceRoot;null!=o&&(t=i.relative(o,t));var a=new s,u=new s;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var s=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=s.source&&(n.source=s.source,null!=r&&(n.source=i.join(r,n.source)),null!=o&&(n.source=i.relative(o,n.source)),n.originalLine=s.line,n.originalColumn=s.column,null!=s.name&&(n.name=s.name))}var l=n.source;null==l||a.has(l)||a.add(l);var c=n.name;null==c||u.has(c)||u.add(c)},this),this._sources=a,this._names=u,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=r&&(n=i.join(r,n)),null!=o&&(n=i.relative(o,n)),this.setSourceContent(n,t))},this)},t.prototype._validateMapping=function(e,n,r,t){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||n||r||t)&&!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:t}))},t.prototype._serializeMappings=function(){for(var e,n,r,t,s=0,a=1,u=0,l=0,c=0,g=0,p="",h=this._mappings.toArray(),f=0,d=h.length;f0){if(!i.compareByGeneratedPositionsInflated(n,h[f-1]))continue;e+=","}e+=o.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(t=this._sources.indexOf(n.source),e+=o.encode(t-g),g=t,e+=o.encode(n.originalLine-1-l),l=n.originalLine-1,e+=o.encode(n.originalColumn-u),u=n.originalColumn,null!=n.name&&(r=this._names.indexOf(n.name),e+=o.encode(r-c),c=r)),p+=e}return p},t.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=i.relative(n,e));var r=i.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},t.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},t.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=t},function(e,n,r){function t(e){return e<0?(-e<<1)+1:(e<<1)+0}function o(e){var n=1===(1&e),r=e>>1;return n?-r:r}var i=r(3),s=5,a=1<>>=s,o>0&&(n|=l),r+=i.encode(n);while(o>0);return r},n.decode=function(e,n,r){var t,a,c=e.length,g=0,p=0;do{if(n>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(a=i.decode(e.charCodeAt(n++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));t=!!(a&l),a&=u,g+=a<=0;c--)s=u[c],"."===s?u.splice(c,1):".."===s?l++:l>0&&(""===s?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return r=u.join("/"),""===r&&(r=a?"/":"."),i?(i.path=r,o(i)):r}function s(e,n){""===e&&(e="."),""===n&&(n=".");var r=t(n),s=t(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),o(r);if(r||n.match(_))return n;if(s&&!s.host&&!s.path)return s.host=n,o(s);var a="/"===n.charAt(0)?n:i(e.replace(/\/+$/,"")+"/"+n);return s?(s.path=a,o(s)):a}function a(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==n.indexOf(e+"/");){var t=e.lastIndexOf("/");if(t<0)return n;if(e=e.slice(0,t),e.match(/^([^\/]+:\/)?\/*$/))return n;++r}return Array(r+1).join("../")+n.substr(e.length+1)}function u(e){return e}function l(e){return g(e)?"$"+e:e}function c(e){return g(e)?e.slice(1):e}function g(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(e,n,r){var t=e.source-n.source;return 0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t||r?t:(t=e.generatedColumn-n.generatedColumn,0!==t?t:(t=e.generatedLine-n.generatedLine,0!==t?t:e.name-n.name))))}function h(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:(t=e.generatedColumn-n.generatedColumn,0!==t||r?t:(t=e.source-n.source,0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t?t:e.name-n.name))))}function f(e,n){return e===n?0:e>n?1:-1}function d(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=f(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:f(e.name,n.name)))))}n.getArg=r;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,_=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=o,n.normalize=i,n.join=s,n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},n.relative=a;var v=function(){var e=Object.create(null);return!("__proto__"in e)}();n.toSetString=v?u:l,n.fromSetString=v?u:c,n.compareByOriginalPositions=p,n.compareByGeneratedPositionsDeflated=h,n.compareByGeneratedPositionsInflated=d},function(e,n,r){function t(){this._array=[],this._set=s?new Map:Object.create(null)}var o=r(4),i=Object.prototype.hasOwnProperty,s="undefined"!=typeof Map;t.fromArray=function(e,n){for(var r=new t,o=0,i=e.length;o=0)return n}else{var r=o.toSetString(e);if(i.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},t.prototype.at=function(e){if(e>=0&&er||t==r&&s>=o||i.compareByGeneratedPositionsInflated(e,n)<=0}function o(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=r(4);o.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},o.prototype.add=function(e){t(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},o.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=o},function(e,n,r){function t(e){var n=e;return"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=n.sections?new s(n):new o(n)}function o(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=a.getArg(n,"version"),t=a.getArg(n,"sources"),o=a.getArg(n,"names",[]),i=a.getArg(n,"sourceRoot",null),s=a.getArg(n,"sourcesContent",null),u=a.getArg(n,"mappings"),c=a.getArg(n,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);t=t.map(String).map(a.normalize).map(function(e){return i&&a.isAbsolute(i)&&a.isAbsolute(e)?a.relative(i,e):e}),this._names=l.fromArray(o.map(String),!0),this._sources=l.fromArray(t,!0),this.sourceRoot=i,this.sourcesContent=s,this._mappings=u,this.file=c}function i(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=a.getArg(n,"version"),o=a.getArg(n,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new l,this._names=new l;var i={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var n=a.getArg(e,"offset"),r=a.getArg(n,"line"),o=a.getArg(n,"column");if(r=0){var i=this._originalMappings[o];if(void 0===e.column)for(var s=i.originalLine;i&&i.originalLine===s;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var l=i.originalColumn;i&&i.originalLine===n&&i.originalColumn==l;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return t},n.SourceMapConsumer=t,o.prototype=Object.create(t.prototype),o.prototype.consumer=t,o.fromSourceMap=function(e){var n=Object.create(o.prototype),r=n._names=l.fromArray(e._names.toArray(),!0),t=n._sources=l.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var s=e._mappings.toArray().slice(),u=n.__generatedMappings=[],c=n.__originalMappings=[],p=0,h=s.length;p1&&(r.source=d+o[1],d+=o[1],r.originalLine=h+o[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+o[3],f=r.originalColumn,o.length>4&&(r.name=m+o[4],m+=o[4])),S.push(r),"number"==typeof r.originalLine&&A.push(r)}g(S,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,g(A,a.compareByOriginalPositions),this.__originalMappings=A},o.prototype._findMapping=function(e,n,r,t,o,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[t]);return u.search(e,n,o,i)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=a.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=a.join(this.sourceRoot,i)));var s=a.getArg(o,"name",null);return null!==s&&(s=this._names.at(s)),{source:i,line:a.getArg(o,"originalLine",null),column:a.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},o.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=a.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=a.urlParse(this.sourceRoot))){var t=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(t))return this.sourcesContent[this._sources.indexOf(t)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){var n=a.getArg(e,"source");if(null!=this.sourceRoot&&(n=a.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};n=this._sources.indexOf(n);var r={source:n,originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",t.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=o,s.prototype=Object.create(t.prototype),s.prototype.constructor=t,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],n=0;n0?t-u>1?r(u,t,o,i,s,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,o,i,s,a):a==n.LEAST_UPPER_BOUND?u:e<0?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,o,i){if(0===t.length)return-1;var s=r(-1,t.length,e,t,o,i||n.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===o(t[s],t[s-1],!0);)--s;return s}},function(e,n){function r(e,n,r){var t=e[n];e[n]=e[r],e[r]=t}function t(e,n){return Math.round(e+Math.random()*(n-e))}function o(e,n,i,s){if(i=0;n--)this.prepend(e[n]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},t.prototype.walk=function(e){for(var n,r=0,t=this.children.length;r0){for(n=[],r=0;r 0 && aGenerated.column >= 0\n\t && !aOriginal && !aSource && !aName) {\n\t // Case 1.\n\t return;\n\t }\n\t else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n\t && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n\t && aGenerated.line > 0 && aGenerated.column >= 0\n\t && aOriginal.line > 0 && aOriginal.column >= 0\n\t && aSource) {\n\t // Cases 2 and 3.\n\t return;\n\t }\n\t else {\n\t throw new Error('Invalid mapping: ' + JSON.stringify({\n\t generated: aGenerated,\n\t source: aSource,\n\t original: aOriginal,\n\t name: aName\n\t }));\n\t }\n\t };\n\t\n\t/**\n\t * Serialize the accumulated mappings in to the stream of base 64 VLQs\n\t * specified by the source map format.\n\t */\n\tSourceMapGenerator.prototype._serializeMappings =\n\t function SourceMapGenerator_serializeMappings() {\n\t var previousGeneratedColumn = 0;\n\t var previousGeneratedLine = 1;\n\t var previousOriginalColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousName = 0;\n\t var previousSource = 0;\n\t var result = '';\n\t var next;\n\t var mapping;\n\t var nameIdx;\n\t var sourceIdx;\n\t\n\t var mappings = this._mappings.toArray();\n\t for (var i = 0, len = mappings.length; i < len; i++) {\n\t mapping = mappings[i];\n\t next = ''\n\t\n\t if (mapping.generatedLine !== previousGeneratedLine) {\n\t previousGeneratedColumn = 0;\n\t while (mapping.generatedLine !== previousGeneratedLine) {\n\t next += ';';\n\t previousGeneratedLine++;\n\t }\n\t }\n\t else {\n\t if (i > 0) {\n\t if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n\t continue;\n\t }\n\t next += ',';\n\t }\n\t }\n\t\n\t next += base64VLQ.encode(mapping.generatedColumn\n\t - previousGeneratedColumn);\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (mapping.source != null) {\n\t sourceIdx = this._sources.indexOf(mapping.source);\n\t next += base64VLQ.encode(sourceIdx - previousSource);\n\t previousSource = sourceIdx;\n\t\n\t // lines are stored 0-based in SourceMap spec version 3\n\t next += base64VLQ.encode(mapping.originalLine - 1\n\t - previousOriginalLine);\n\t previousOriginalLine = mapping.originalLine - 1;\n\t\n\t next += base64VLQ.encode(mapping.originalColumn\n\t - previousOriginalColumn);\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (mapping.name != null) {\n\t nameIdx = this._names.indexOf(mapping.name);\n\t next += base64VLQ.encode(nameIdx - previousName);\n\t previousName = nameIdx;\n\t }\n\t }\n\t\n\t result += next;\n\t }\n\t\n\t return result;\n\t };\n\t\n\tSourceMapGenerator.prototype._generateSourcesContent =\n\t function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n\t return aSources.map(function (source) {\n\t if (!this._sourcesContents) {\n\t return null;\n\t }\n\t if (aSourceRoot != null) {\n\t source = util.relative(aSourceRoot, source);\n\t }\n\t var key = util.toSetString(source);\n\t return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n\t ? this._sourcesContents[key]\n\t : null;\n\t }, this);\n\t };\n\t\n\t/**\n\t * Externalize the source map.\n\t */\n\tSourceMapGenerator.prototype.toJSON =\n\t function SourceMapGenerator_toJSON() {\n\t var map = {\n\t version: this._version,\n\t sources: this._sources.toArray(),\n\t names: this._names.toArray(),\n\t mappings: this._serializeMappings()\n\t };\n\t if (this._file != null) {\n\t map.file = this._file;\n\t }\n\t if (this._sourceRoot != null) {\n\t map.sourceRoot = this._sourceRoot;\n\t }\n\t if (this._sourcesContents) {\n\t map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n\t }\n\t\n\t return map;\n\t };\n\t\n\t/**\n\t * Render the source map being generated to a string.\n\t */\n\tSourceMapGenerator.prototype.toString =\n\t function SourceMapGenerator_toString() {\n\t return JSON.stringify(this.toJSON());\n\t };\n\t\n\texports.SourceMapGenerator = SourceMapGenerator;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t *\n\t * Based on the Base 64 VLQ implementation in Closure Compiler:\n\t * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n\t *\n\t * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n\t * Redistribution and use in source and binary forms, with or without\n\t * modification, are permitted provided that the following conditions are\n\t * met:\n\t *\n\t * * Redistributions of source code must retain the above copyright\n\t * notice, this list of conditions and the following disclaimer.\n\t * * Redistributions in binary form must reproduce the above\n\t * copyright notice, this list of conditions and the following\n\t * disclaimer in the documentation and/or other materials provided\n\t * with the distribution.\n\t * * Neither the name of Google Inc. nor the names of its\n\t * contributors may be used to endorse or promote products derived\n\t * from this software without specific prior written permission.\n\t *\n\t * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\t * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\t * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\t * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\t * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\t * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\t * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\t * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\t * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t */\n\t\n\tvar base64 = __webpack_require__(3);\n\t\n\t// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n\t// length quantities we use in the source map spec, the first bit is the sign,\n\t// the next four bits are the actual value, and the 6th bit is the\n\t// continuation bit. The continuation bit tells us whether there are more\n\t// digits in this value following this digit.\n\t//\n\t// Continuation\n\t// | Sign\n\t// | |\n\t// V V\n\t// 101011\n\t\n\tvar VLQ_BASE_SHIFT = 5;\n\t\n\t// binary: 100000\n\tvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\t\n\t// binary: 011111\n\tvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\t\n\t// binary: 100000\n\tvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\t\n\t/**\n\t * Converts from a two-complement value to a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n\t * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n\t */\n\tfunction toVLQSigned(aValue) {\n\t return aValue < 0\n\t ? ((-aValue) << 1) + 1\n\t : (aValue << 1) + 0;\n\t}\n\t\n\t/**\n\t * Converts to a two-complement value from a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n\t * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n\t */\n\tfunction fromVLQSigned(aValue) {\n\t var isNegative = (aValue & 1) === 1;\n\t var shifted = aValue >> 1;\n\t return isNegative\n\t ? -shifted\n\t : shifted;\n\t}\n\t\n\t/**\n\t * Returns the base 64 VLQ encoded value.\n\t */\n\texports.encode = function base64VLQ_encode(aValue) {\n\t var encoded = \"\";\n\t var digit;\n\t\n\t var vlq = toVLQSigned(aValue);\n\t\n\t do {\n\t digit = vlq & VLQ_BASE_MASK;\n\t vlq >>>= VLQ_BASE_SHIFT;\n\t if (vlq > 0) {\n\t // There are still more digits in this value, so we must make sure the\n\t // continuation bit is marked.\n\t digit |= VLQ_CONTINUATION_BIT;\n\t }\n\t encoded += base64.encode(digit);\n\t } while (vlq > 0);\n\t\n\t return encoded;\n\t};\n\t\n\t/**\n\t * Decodes the next base 64 VLQ value from the given string and returns the\n\t * value and the rest of the string via the out parameter.\n\t */\n\texports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n\t var strLen = aStr.length;\n\t var result = 0;\n\t var shift = 0;\n\t var continuation, digit;\n\t\n\t do {\n\t if (aIndex >= strLen) {\n\t throw new Error(\"Expected more digits in base 64 VLQ value.\");\n\t }\n\t\n\t digit = base64.decode(aStr.charCodeAt(aIndex++));\n\t if (digit === -1) {\n\t throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n\t }\n\t\n\t continuation = !!(digit & VLQ_CONTINUATION_BIT);\n\t digit &= VLQ_BASE_MASK;\n\t result = result + (digit << shift);\n\t shift += VLQ_BASE_SHIFT;\n\t } while (continuation);\n\t\n\t aOutParam.value = fromVLQSigned(result);\n\t aOutParam.rest = aIndex;\n\t};\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\t\n\t/**\n\t * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n\t */\n\texports.encode = function (number) {\n\t if (0 <= number && number < intToCharMap.length) {\n\t return intToCharMap[number];\n\t }\n\t throw new TypeError(\"Must be between 0 and 63: \" + number);\n\t};\n\t\n\t/**\n\t * Decode a single base 64 character code digit to an integer. Returns -1 on\n\t * failure.\n\t */\n\texports.decode = function (charCode) {\n\t var bigA = 65; // 'A'\n\t var bigZ = 90; // 'Z'\n\t\n\t var littleA = 97; // 'a'\n\t var littleZ = 122; // 'z'\n\t\n\t var zero = 48; // '0'\n\t var nine = 57; // '9'\n\t\n\t var plus = 43; // '+'\n\t var slash = 47; // '/'\n\t\n\t var littleOffset = 26;\n\t var numberOffset = 52;\n\t\n\t // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\t if (bigA <= charCode && charCode <= bigZ) {\n\t return (charCode - bigA);\n\t }\n\t\n\t // 26 - 51: abcdefghijklmnopqrstuvwxyz\n\t if (littleA <= charCode && charCode <= littleZ) {\n\t return (charCode - littleA + littleOffset);\n\t }\n\t\n\t // 52 - 61: 0123456789\n\t if (zero <= charCode && charCode <= nine) {\n\t return (charCode - zero + numberOffset);\n\t }\n\t\n\t // 62: +\n\t if (charCode == plus) {\n\t return 62;\n\t }\n\t\n\t // 63: /\n\t if (charCode == slash) {\n\t return 63;\n\t }\n\t\n\t // Invalid base64 digit.\n\t return -1;\n\t};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t/**\n\t * This is a helper function for getting values from parameter/options\n\t * objects.\n\t *\n\t * @param args The object we are extracting values from\n\t * @param name The name of the property we are getting.\n\t * @param defaultValue An optional value to return if the property is missing\n\t * from the object. If this is not specified and the property is missing, an\n\t * error will be thrown.\n\t */\n\tfunction getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}\n\texports.getArg = getArg;\n\t\n\tvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\n\tvar dataUrlRegexp = /^data:.+\\,.+$/;\n\t\n\tfunction urlParse(aUrl) {\n\t var match = aUrl.match(urlRegexp);\n\t if (!match) {\n\t return null;\n\t }\n\t return {\n\t scheme: match[1],\n\t auth: match[2],\n\t host: match[3],\n\t port: match[4],\n\t path: match[5]\n\t };\n\t}\n\texports.urlParse = urlParse;\n\t\n\tfunction urlGenerate(aParsedUrl) {\n\t var url = '';\n\t if (aParsedUrl.scheme) {\n\t url += aParsedUrl.scheme + ':';\n\t }\n\t url += '//';\n\t if (aParsedUrl.auth) {\n\t url += aParsedUrl.auth + '@';\n\t }\n\t if (aParsedUrl.host) {\n\t url += aParsedUrl.host;\n\t }\n\t if (aParsedUrl.port) {\n\t url += \":\" + aParsedUrl.port\n\t }\n\t if (aParsedUrl.path) {\n\t url += aParsedUrl.path;\n\t }\n\t return url;\n\t}\n\texports.urlGenerate = urlGenerate;\n\t\n\t/**\n\t * Normalizes a path, or the path portion of a URL:\n\t *\n\t * - Replaces consecutive slashes with one slash.\n\t * - Removes unnecessary '.' parts.\n\t * - Removes unnecessary '/..' parts.\n\t *\n\t * Based on code in the Node.js 'path' core module.\n\t *\n\t * @param aPath The path or url to normalize.\n\t */\n\tfunction normalize(aPath) {\n\t var path = aPath;\n\t var url = urlParse(aPath);\n\t if (url) {\n\t if (!url.path) {\n\t return aPath;\n\t }\n\t path = url.path;\n\t }\n\t var isAbsolute = exports.isAbsolute(path);\n\t\n\t var parts = path.split(/\\/+/);\n\t for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n\t part = parts[i];\n\t if (part === '.') {\n\t parts.splice(i, 1);\n\t } else if (part === '..') {\n\t up++;\n\t } else if (up > 0) {\n\t if (part === '') {\n\t // The first part is blank if the path is absolute. Trying to go\n\t // above the root is a no-op. Therefore we can remove all '..' parts\n\t // directly after the root.\n\t parts.splice(i + 1, up);\n\t up = 0;\n\t } else {\n\t parts.splice(i, 2);\n\t up--;\n\t }\n\t }\n\t }\n\t path = parts.join('/');\n\t\n\t if (path === '') {\n\t path = isAbsolute ? '/' : '.';\n\t }\n\t\n\t if (url) {\n\t url.path = path;\n\t return urlGenerate(url);\n\t }\n\t return path;\n\t}\n\texports.normalize = normalize;\n\t\n\t/**\n\t * Joins two paths/URLs.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be joined with the root.\n\t *\n\t * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n\t * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n\t * first.\n\t * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n\t * is updated with the result and aRoot is returned. Otherwise the result\n\t * is returned.\n\t * - If aPath is absolute, the result is aPath.\n\t * - Otherwise the two paths are joined with a slash.\n\t * - Joining for example 'http://' and 'www.example.com' is also supported.\n\t */\n\tfunction join(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t if (aPath === \"\") {\n\t aPath = \".\";\n\t }\n\t var aPathUrl = urlParse(aPath);\n\t var aRootUrl = urlParse(aRoot);\n\t if (aRootUrl) {\n\t aRoot = aRootUrl.path || '/';\n\t }\n\t\n\t // `join(foo, '//www.example.org')`\n\t if (aPathUrl && !aPathUrl.scheme) {\n\t if (aRootUrl) {\n\t aPathUrl.scheme = aRootUrl.scheme;\n\t }\n\t return urlGenerate(aPathUrl);\n\t }\n\t\n\t if (aPathUrl || aPath.match(dataUrlRegexp)) {\n\t return aPath;\n\t }\n\t\n\t // `join('http://', 'www.example.com')`\n\t if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n\t aRootUrl.host = aPath;\n\t return urlGenerate(aRootUrl);\n\t }\n\t\n\t var joined = aPath.charAt(0) === '/'\n\t ? aPath\n\t : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\t\n\t if (aRootUrl) {\n\t aRootUrl.path = joined;\n\t return urlGenerate(aRootUrl);\n\t }\n\t return joined;\n\t}\n\texports.join = join;\n\t\n\texports.isAbsolute = function (aPath) {\n\t return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);\n\t};\n\t\n\t/**\n\t * Make a path relative to a URL or another path.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be made relative to aRoot.\n\t */\n\tfunction relative(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t\n\t aRoot = aRoot.replace(/\\/$/, '');\n\t\n\t // It is possible for the path to be above the root. In this case, simply\n\t // checking whether the root is a prefix of the path won't work. Instead, we\n\t // need to remove components from the root one by one, until either we find\n\t // a prefix that fits, or we run out of components to remove.\n\t var level = 0;\n\t while (aPath.indexOf(aRoot + '/') !== 0) {\n\t var index = aRoot.lastIndexOf(\"/\");\n\t if (index < 0) {\n\t return aPath;\n\t }\n\t\n\t // If the only part of the root that is left is the scheme (i.e. http://,\n\t // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n\t // have exhausted all components, so the path is not relative to the root.\n\t aRoot = aRoot.slice(0, index);\n\t if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n\t return aPath;\n\t }\n\t\n\t ++level;\n\t }\n\t\n\t // Make sure we add a \"../\" for each component we removed from the root.\n\t return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n\t}\n\texports.relative = relative;\n\t\n\tvar supportsNullProto = (function () {\n\t var obj = Object.create(null);\n\t return !('__proto__' in obj);\n\t}());\n\t\n\tfunction identity (s) {\n\t return s;\n\t}\n\t\n\t/**\n\t * Because behavior goes wacky when you set `__proto__` on objects, we\n\t * have to prefix all the strings in our set with an arbitrary character.\n\t *\n\t * See https://github.com/mozilla/source-map/pull/31 and\n\t * https://github.com/mozilla/source-map/issues/30\n\t *\n\t * @param String aStr\n\t */\n\tfunction toSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return '$' + aStr;\n\t }\n\t\n\t return aStr;\n\t}\n\texports.toSetString = supportsNullProto ? identity : toSetString;\n\t\n\tfunction fromSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return aStr.slice(1);\n\t }\n\t\n\t return aStr;\n\t}\n\texports.fromSetString = supportsNullProto ? identity : fromSetString;\n\t\n\tfunction isProtoString(s) {\n\t if (!s) {\n\t return false;\n\t }\n\t\n\t var length = s.length;\n\t\n\t if (length < 9 /* \"__proto__\".length */) {\n\t return false;\n\t }\n\t\n\t if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n\t s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n\t s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n\t s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 9) !== 95 /* '_' */) {\n\t return false;\n\t }\n\t\n\t for (var i = length - 10; i >= 0; i--) {\n\t if (s.charCodeAt(i) !== 36 /* '$' */) {\n\t return false;\n\t }\n\t }\n\t\n\t return true;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings where the original positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same original source/line/column, but different generated\n\t * line and column the same. Useful when searching for a mapping with a\n\t * stubbed out mapping.\n\t */\n\tfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n\t var cmp = mappingA.source - mappingB.source;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0 || onlyCompareOriginal) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return mappingA.name - mappingB.name;\n\t}\n\texports.compareByOriginalPositions = compareByOriginalPositions;\n\t\n\t/**\n\t * Comparator between two mappings with deflated source and name indices where\n\t * the generated positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same generated line and column, but different\n\t * source/name/original line and column the same. Useful when searching for a\n\t * mapping with a stubbed out mapping.\n\t */\n\tfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0 || onlyCompareGenerated) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.source - mappingB.source;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return mappingA.name - mappingB.name;\n\t}\n\texports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\t\n\tfunction strcmp(aStr1, aStr2) {\n\t if (aStr1 === aStr2) {\n\t return 0;\n\t }\n\t\n\t if (aStr1 > aStr2) {\n\t return 1;\n\t }\n\t\n\t return -1;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings with inflated source and name strings where\n\t * the generated positions are compared.\n\t */\n\tfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar hasNativeMap = typeof Map !== \"undefined\";\n\t\n\t/**\n\t * A data structure which is a combination of an array and a set. Adding a new\n\t * member is O(1), testing for membership is O(1), and finding the index of an\n\t * element is O(1). Removing elements from the set is not supported. Only\n\t * strings are supported for membership.\n\t */\n\tfunction ArraySet() {\n\t this._array = [];\n\t this._set = hasNativeMap ? new Map() : Object.create(null);\n\t}\n\t\n\t/**\n\t * Static method for creating ArraySet instances from an existing array.\n\t */\n\tArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n\t var set = new ArraySet();\n\t for (var i = 0, len = aArray.length; i < len; i++) {\n\t set.add(aArray[i], aAllowDuplicates);\n\t }\n\t return set;\n\t};\n\t\n\t/**\n\t * Return how many unique items are in this ArraySet. If duplicates have been\n\t * added, than those do not count towards the size.\n\t *\n\t * @returns Number\n\t */\n\tArraySet.prototype.size = function ArraySet_size() {\n\t return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n\t};\n\t\n\t/**\n\t * Add the given string to this set.\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n\t var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n\t var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n\t var idx = this._array.length;\n\t if (!isDuplicate || aAllowDuplicates) {\n\t this._array.push(aStr);\n\t }\n\t if (!isDuplicate) {\n\t if (hasNativeMap) {\n\t this._set.set(aStr, idx);\n\t } else {\n\t this._set[sStr] = idx;\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Is the given string a member of this set?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.has = function ArraySet_has(aStr) {\n\t if (hasNativeMap) {\n\t return this._set.has(aStr);\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t return has.call(this._set, sStr);\n\t }\n\t};\n\t\n\t/**\n\t * What is the index of the given string in the array?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n\t if (hasNativeMap) {\n\t var idx = this._set.get(aStr);\n\t if (idx >= 0) {\n\t return idx;\n\t }\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t if (has.call(this._set, sStr)) {\n\t return this._set[sStr];\n\t }\n\t }\n\t\n\t throw new Error('\"' + aStr + '\" is not in the set.');\n\t};\n\t\n\t/**\n\t * What is the element at the given index?\n\t *\n\t * @param Number aIdx\n\t */\n\tArraySet.prototype.at = function ArraySet_at(aIdx) {\n\t if (aIdx >= 0 && aIdx < this._array.length) {\n\t return this._array[aIdx];\n\t }\n\t throw new Error('No element indexed by ' + aIdx);\n\t};\n\t\n\t/**\n\t * Returns the array representation of this set (which has the proper indices\n\t * indicated by indexOf). Note that this is a copy of the internal array used\n\t * for storing the members so that no one can mess with internal state.\n\t */\n\tArraySet.prototype.toArray = function ArraySet_toArray() {\n\t return this._array.slice();\n\t};\n\t\n\texports.ArraySet = ArraySet;\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2014 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\t\n\t/**\n\t * Determine whether mappingB is after mappingA with respect to generated\n\t * position.\n\t */\n\tfunction generatedPositionAfter(mappingA, mappingB) {\n\t // Optimized for most common case\n\t var lineA = mappingA.generatedLine;\n\t var lineB = mappingB.generatedLine;\n\t var columnA = mappingA.generatedColumn;\n\t var columnB = mappingB.generatedColumn;\n\t return lineB > lineA || lineB == lineA && columnB >= columnA ||\n\t util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n\t}\n\t\n\t/**\n\t * A data structure to provide a sorted view of accumulated mappings in a\n\t * performance conscious manner. It trades a neglibable overhead in general\n\t * case for a large speedup in case of mappings being added in order.\n\t */\n\tfunction MappingList() {\n\t this._array = [];\n\t this._sorted = true;\n\t // Serves as infimum\n\t this._last = {generatedLine: -1, generatedColumn: 0};\n\t}\n\t\n\t/**\n\t * Iterate through internal items. This method takes the same arguments that\n\t * `Array.prototype.forEach` takes.\n\t *\n\t * NOTE: The order of the mappings is NOT guaranteed.\n\t */\n\tMappingList.prototype.unsortedForEach =\n\t function MappingList_forEach(aCallback, aThisArg) {\n\t this._array.forEach(aCallback, aThisArg);\n\t };\n\t\n\t/**\n\t * Add the given source mapping.\n\t *\n\t * @param Object aMapping\n\t */\n\tMappingList.prototype.add = function MappingList_add(aMapping) {\n\t if (generatedPositionAfter(this._last, aMapping)) {\n\t this._last = aMapping;\n\t this._array.push(aMapping);\n\t } else {\n\t this._sorted = false;\n\t this._array.push(aMapping);\n\t }\n\t};\n\t\n\t/**\n\t * Returns the flat, sorted array of mappings. The mappings are sorted by\n\t * generated position.\n\t *\n\t * WARNING: This method returns internal data without copying, for\n\t * performance. The return value must NOT be mutated, and should be treated as\n\t * an immutable borrow. If you want to take ownership, you must make your own\n\t * copy.\n\t */\n\tMappingList.prototype.toArray = function MappingList_toArray() {\n\t if (!this._sorted) {\n\t this._array.sort(util.compareByGeneratedPositionsInflated);\n\t this._sorted = true;\n\t }\n\t return this._array;\n\t};\n\t\n\texports.MappingList = MappingList;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar binarySearch = __webpack_require__(8);\n\tvar ArraySet = __webpack_require__(5).ArraySet;\n\tvar base64VLQ = __webpack_require__(2);\n\tvar quickSort = __webpack_require__(9).quickSort;\n\t\n\tfunction SourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t return sourceMap.sections != null\n\t ? new IndexedSourceMapConsumer(sourceMap)\n\t : new BasicSourceMapConsumer(sourceMap);\n\t}\n\t\n\tSourceMapConsumer.fromSourceMap = function(aSourceMap) {\n\t return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n\t}\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tSourceMapConsumer.prototype._version = 3;\n\t\n\t// `__generatedMappings` and `__originalMappings` are arrays that hold the\n\t// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n\t// are lazily instantiated, accessed via the `_generatedMappings` and\n\t// `_originalMappings` getters respectively, and we only parse the mappings\n\t// and create these arrays once queried for a source location. We jump through\n\t// these hoops because there can be many thousands of mappings, and parsing\n\t// them is expensive, so we only want to do it if we must.\n\t//\n\t// Each object in the arrays is of the form:\n\t//\n\t// {\n\t// generatedLine: The line number in the generated code,\n\t// generatedColumn: The column number in the generated code,\n\t// source: The path to the original source file that generated this\n\t// chunk of code,\n\t// originalLine: The line number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// originalColumn: The column number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// name: The name of the original symbol which generated this chunk of\n\t// code.\n\t// }\n\t//\n\t// All properties except for `generatedLine` and `generatedColumn` can be\n\t// `null`.\n\t//\n\t// `_generatedMappings` is ordered by the generated positions.\n\t//\n\t// `_originalMappings` is ordered by the original positions.\n\t\n\tSourceMapConsumer.prototype.__generatedMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n\t get: function () {\n\t if (!this.__generatedMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__generatedMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype.__originalMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n\t get: function () {\n\t if (!this.__originalMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__originalMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype._charIsMappingSeparator =\n\t function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n\t var c = aStr.charAt(index);\n\t return c === \";\" || c === \",\";\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t throw new Error(\"Subclasses must implement _parseMappings\");\n\t };\n\t\n\tSourceMapConsumer.GENERATED_ORDER = 1;\n\tSourceMapConsumer.ORIGINAL_ORDER = 2;\n\t\n\tSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n\tSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Iterate over each mapping between an original source/line/column and a\n\t * generated line/column in this source map.\n\t *\n\t * @param Function aCallback\n\t * The function that is called with each mapping.\n\t * @param Object aContext\n\t * Optional. If specified, this object will be the value of `this` every\n\t * time that `aCallback` is called.\n\t * @param aOrder\n\t * Either `SourceMapConsumer.GENERATED_ORDER` or\n\t * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n\t * iterate over the mappings sorted by the generated file's line/column\n\t * order or the original's source/line/column order, respectively. Defaults to\n\t * `SourceMapConsumer.GENERATED_ORDER`.\n\t */\n\tSourceMapConsumer.prototype.eachMapping =\n\t function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n\t var context = aContext || null;\n\t var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\t\n\t var mappings;\n\t switch (order) {\n\t case SourceMapConsumer.GENERATED_ORDER:\n\t mappings = this._generatedMappings;\n\t break;\n\t case SourceMapConsumer.ORIGINAL_ORDER:\n\t mappings = this._originalMappings;\n\t break;\n\t default:\n\t throw new Error(\"Unknown order of iteration.\");\n\t }\n\t\n\t var sourceRoot = this.sourceRoot;\n\t mappings.map(function (mapping) {\n\t var source = mapping.source === null ? null : this._sources.at(mapping.source);\n\t if (source != null && sourceRoot != null) {\n\t source = util.join(sourceRoot, source);\n\t }\n\t return {\n\t source: source,\n\t generatedLine: mapping.generatedLine,\n\t generatedColumn: mapping.generatedColumn,\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: mapping.name === null ? null : this._names.at(mapping.name)\n\t };\n\t }, this).forEach(aCallback, context);\n\t };\n\t\n\t/**\n\t * Returns all generated line and column information for the original source,\n\t * line, and column provided. If no column is provided, returns all mappings\n\t * corresponding to a either the line we are searching for or the next\n\t * closest line that has any mappings. Otherwise, returns all mappings\n\t * corresponding to the given line and either the column we are searching for\n\t * or the next closest column that has any offsets.\n\t *\n\t * The only argument is an object with the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: Optional. the column number in the original source.\n\t *\n\t * and an array of objects is returned, each with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\tSourceMapConsumer.prototype.allGeneratedPositionsFor =\n\t function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n\t var line = util.getArg(aArgs, 'line');\n\t\n\t // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n\t // returns the index of the closest mapping less than the needle. By\n\t // setting needle.originalColumn to 0, we thus find the last mapping for\n\t // the given line, provided such a mapping exists.\n\t var needle = {\n\t source: util.getArg(aArgs, 'source'),\n\t originalLine: line,\n\t originalColumn: util.getArg(aArgs, 'column', 0)\n\t };\n\t\n\t if (this.sourceRoot != null) {\n\t needle.source = util.relative(this.sourceRoot, needle.source);\n\t }\n\t if (!this._sources.has(needle.source)) {\n\t return [];\n\t }\n\t needle.source = this._sources.indexOf(needle.source);\n\t\n\t var mappings = [];\n\t\n\t var index = this._findMapping(needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t binarySearch.LEAST_UPPER_BOUND);\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (aArgs.column === undefined) {\n\t var originalLine = mapping.originalLine;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we found. Since\n\t // mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we found.\n\t while (mapping && mapping.originalLine === originalLine) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t } else {\n\t var originalColumn = mapping.originalColumn;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we were searching for.\n\t // Since mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we are searching for.\n\t while (mapping &&\n\t mapping.originalLine === line &&\n\t mapping.originalColumn == originalColumn) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t }\n\t }\n\t\n\t return mappings;\n\t };\n\t\n\texports.SourceMapConsumer = SourceMapConsumer;\n\t\n\t/**\n\t * A BasicSourceMapConsumer instance represents a parsed source map which we can\n\t * query for information about the original file positions by giving it a file\n\t * position in the generated source.\n\t *\n\t * The only parameter is the raw source map (either as a JSON string, or\n\t * already parsed to an object). According to the spec, source maps have the\n\t * following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - sources: An array of URLs to the original source files.\n\t * - names: An array of identifiers which can be referrenced by individual mappings.\n\t * - sourceRoot: Optional. The URL root from which all sources are relative.\n\t * - sourcesContent: Optional. An array of contents of the original source files.\n\t * - mappings: A string of base64 VLQs which contain the actual mappings.\n\t * - file: Optional. The generated file this source map is associated with.\n\t *\n\t * Here is an example source map, taken from the source map spec[0]:\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"out.js\",\n\t * sourceRoot : \"\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AA,AB;;ABCDE;\"\n\t * }\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n\t */\n\tfunction BasicSourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sources = util.getArg(sourceMap, 'sources');\n\t // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n\t // requires the array) to play nice here.\n\t var names = util.getArg(sourceMap, 'names', []);\n\t var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n\t var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n\t var mappings = util.getArg(sourceMap, 'mappings');\n\t var file = util.getArg(sourceMap, 'file', null);\n\t\n\t // Once again, Sass deviates from the spec and supplies the version as a\n\t // string rather than a number, so we use loose equality checking here.\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t sources = sources\n\t .map(String)\n\t // Some source maps produce relative source paths like \"./foo.js\" instead of\n\t // \"foo.js\". Normalize these first so that future comparisons will succeed.\n\t // See bugzil.la/1090768.\n\t .map(util.normalize)\n\t // Always ensure that absolute sources are internally stored relative to\n\t // the source root, if the source root is absolute. Not doing this would\n\t // be particularly problematic when the source root is a prefix of the\n\t // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n\t .map(function (source) {\n\t return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n\t ? util.relative(sourceRoot, source)\n\t : source;\n\t });\n\t\n\t // Pass `true` below to allow duplicate names and sources. While source maps\n\t // are intended to be compressed and deduplicated, the TypeScript compiler\n\t // sometimes generates source maps with duplicates in them. See Github issue\n\t // #72 and bugzil.la/889492.\n\t this._names = ArraySet.fromArray(names.map(String), true);\n\t this._sources = ArraySet.fromArray(sources, true);\n\t\n\t this.sourceRoot = sourceRoot;\n\t this.sourcesContent = sourcesContent;\n\t this._mappings = mappings;\n\t this.file = file;\n\t}\n\t\n\tBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\t\n\t/**\n\t * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n\t *\n\t * @param SourceMapGenerator aSourceMap\n\t * The source map that will be consumed.\n\t * @returns BasicSourceMapConsumer\n\t */\n\tBasicSourceMapConsumer.fromSourceMap =\n\t function SourceMapConsumer_fromSourceMap(aSourceMap) {\n\t var smc = Object.create(BasicSourceMapConsumer.prototype);\n\t\n\t var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n\t var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n\t smc.sourceRoot = aSourceMap._sourceRoot;\n\t smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n\t smc.sourceRoot);\n\t smc.file = aSourceMap._file;\n\t\n\t // Because we are modifying the entries (by converting string sources and\n\t // names to indices into the sources and names ArraySets), we have to make\n\t // a copy of the entry or else bad things happen. Shared mutable state\n\t // strikes again! See github issue #191.\n\t\n\t var generatedMappings = aSourceMap._mappings.toArray().slice();\n\t var destGeneratedMappings = smc.__generatedMappings = [];\n\t var destOriginalMappings = smc.__originalMappings = [];\n\t\n\t for (var i = 0, length = generatedMappings.length; i < length; i++) {\n\t var srcMapping = generatedMappings[i];\n\t var destMapping = new Mapping;\n\t destMapping.generatedLine = srcMapping.generatedLine;\n\t destMapping.generatedColumn = srcMapping.generatedColumn;\n\t\n\t if (srcMapping.source) {\n\t destMapping.source = sources.indexOf(srcMapping.source);\n\t destMapping.originalLine = srcMapping.originalLine;\n\t destMapping.originalColumn = srcMapping.originalColumn;\n\t\n\t if (srcMapping.name) {\n\t destMapping.name = names.indexOf(srcMapping.name);\n\t }\n\t\n\t destOriginalMappings.push(destMapping);\n\t }\n\t\n\t destGeneratedMappings.push(destMapping);\n\t }\n\t\n\t quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\t\n\t return smc;\n\t };\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tBasicSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t return this._sources.toArray().map(function (s) {\n\t return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;\n\t }, this);\n\t }\n\t});\n\t\n\t/**\n\t * Provide the JIT with a nice shape / hidden class.\n\t */\n\tfunction Mapping() {\n\t this.generatedLine = 0;\n\t this.generatedColumn = 0;\n\t this.source = null;\n\t this.originalLine = null;\n\t this.originalColumn = null;\n\t this.name = null;\n\t}\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tBasicSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t var generatedLine = 1;\n\t var previousGeneratedColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousOriginalColumn = 0;\n\t var previousSource = 0;\n\t var previousName = 0;\n\t var length = aStr.length;\n\t var index = 0;\n\t var cachedSegments = {};\n\t var temp = {};\n\t var originalMappings = [];\n\t var generatedMappings = [];\n\t var mapping, str, segment, end, value;\n\t\n\t while (index < length) {\n\t if (aStr.charAt(index) === ';') {\n\t generatedLine++;\n\t index++;\n\t previousGeneratedColumn = 0;\n\t }\n\t else if (aStr.charAt(index) === ',') {\n\t index++;\n\t }\n\t else {\n\t mapping = new Mapping();\n\t mapping.generatedLine = generatedLine;\n\t\n\t // Because each offset is encoded relative to the previous one,\n\t // many segments often have the same encoding. We can exploit this\n\t // fact by caching the parsed variable length fields of each segment,\n\t // allowing us to avoid a second parse if we encounter the same\n\t // segment again.\n\t for (end = index; end < length; end++) {\n\t if (this._charIsMappingSeparator(aStr, end)) {\n\t break;\n\t }\n\t }\n\t str = aStr.slice(index, end);\n\t\n\t segment = cachedSegments[str];\n\t if (segment) {\n\t index += str.length;\n\t } else {\n\t segment = [];\n\t while (index < end) {\n\t base64VLQ.decode(aStr, index, temp);\n\t value = temp.value;\n\t index = temp.rest;\n\t segment.push(value);\n\t }\n\t\n\t if (segment.length === 2) {\n\t throw new Error('Found a source, but no line and column');\n\t }\n\t\n\t if (segment.length === 3) {\n\t throw new Error('Found a source and line, but no column');\n\t }\n\t\n\t cachedSegments[str] = segment;\n\t }\n\t\n\t // Generated column.\n\t mapping.generatedColumn = previousGeneratedColumn + segment[0];\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (segment.length > 1) {\n\t // Original source.\n\t mapping.source = previousSource + segment[1];\n\t previousSource += segment[1];\n\t\n\t // Original line.\n\t mapping.originalLine = previousOriginalLine + segment[2];\n\t previousOriginalLine = mapping.originalLine;\n\t // Lines are stored 0-based\n\t mapping.originalLine += 1;\n\t\n\t // Original column.\n\t mapping.originalColumn = previousOriginalColumn + segment[3];\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (segment.length > 4) {\n\t // Original name.\n\t mapping.name = previousName + segment[4];\n\t previousName += segment[4];\n\t }\n\t }\n\t\n\t generatedMappings.push(mapping);\n\t if (typeof mapping.originalLine === 'number') {\n\t originalMappings.push(mapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t this.__generatedMappings = generatedMappings;\n\t\n\t quickSort(originalMappings, util.compareByOriginalPositions);\n\t this.__originalMappings = originalMappings;\n\t };\n\t\n\t/**\n\t * Find the mapping that best matches the hypothetical \"needle\" mapping that\n\t * we are searching for in the given \"haystack\" of mappings.\n\t */\n\tBasicSourceMapConsumer.prototype._findMapping =\n\t function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n\t aColumnName, aComparator, aBias) {\n\t // To return the position we are searching for, we must first find the\n\t // mapping for the given position and then return the opposite position it\n\t // points to. Because the mappings are sorted, we can use binary search to\n\t // find the best mapping.\n\t\n\t if (aNeedle[aLineName] <= 0) {\n\t throw new TypeError('Line must be greater than or equal to 1, got '\n\t + aNeedle[aLineName]);\n\t }\n\t if (aNeedle[aColumnName] < 0) {\n\t throw new TypeError('Column must be greater than or equal to 0, got '\n\t + aNeedle[aColumnName]);\n\t }\n\t\n\t return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n\t };\n\t\n\t/**\n\t * Compute the last column for each generated mapping. The last column is\n\t * inclusive.\n\t */\n\tBasicSourceMapConsumer.prototype.computeColumnSpans =\n\t function SourceMapConsumer_computeColumnSpans() {\n\t for (var index = 0; index < this._generatedMappings.length; ++index) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t // Mappings do not contain a field for the last generated columnt. We\n\t // can come up with an optimistic estimate, however, by assuming that\n\t // mappings are contiguous (i.e. given two consecutive mappings, the\n\t // first mapping ends where the second one starts).\n\t if (index + 1 < this._generatedMappings.length) {\n\t var nextMapping = this._generatedMappings[index + 1];\n\t\n\t if (mapping.generatedLine === nextMapping.generatedLine) {\n\t mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n\t continue;\n\t }\n\t }\n\t\n\t // The last mapping for each line spans the entire line.\n\t mapping.lastGeneratedColumn = Infinity;\n\t }\n\t };\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source.\n\t * - column: The column number in the generated source.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null.\n\t * - column: The column number in the original source, or null.\n\t * - name: The original identifier, or null.\n\t */\n\tBasicSourceMapConsumer.prototype.originalPositionFor =\n\t function SourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._generatedMappings,\n\t \"generatedLine\",\n\t \"generatedColumn\",\n\t util.compareByGeneratedPositionsDeflated,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t if (mapping.generatedLine === needle.generatedLine) {\n\t var source = util.getArg(mapping, 'source', null);\n\t if (source !== null) {\n\t source = this._sources.at(source);\n\t if (this.sourceRoot != null) {\n\t source = util.join(this.sourceRoot, source);\n\t }\n\t }\n\t var name = util.getArg(mapping, 'name', null);\n\t if (name !== null) {\n\t name = this._names.at(name);\n\t }\n\t return {\n\t source: source,\n\t line: util.getArg(mapping, 'originalLine', null),\n\t column: util.getArg(mapping, 'originalColumn', null),\n\t name: name\n\t };\n\t }\n\t }\n\t\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function BasicSourceMapConsumer_hasContentsOfAllSources() {\n\t if (!this.sourcesContent) {\n\t return false;\n\t }\n\t return this.sourcesContent.length >= this._sources.size() &&\n\t !this.sourcesContent.some(function (sc) { return sc == null; });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tBasicSourceMapConsumer.prototype.sourceContentFor =\n\t function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t if (!this.sourcesContent) {\n\t return null;\n\t }\n\t\n\t if (this.sourceRoot != null) {\n\t aSource = util.relative(this.sourceRoot, aSource);\n\t }\n\t\n\t if (this._sources.has(aSource)) {\n\t return this.sourcesContent[this._sources.indexOf(aSource)];\n\t }\n\t\n\t var url;\n\t if (this.sourceRoot != null\n\t && (url = util.urlParse(this.sourceRoot))) {\n\t // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n\t // many users. We can help them out when they expect file:// URIs to\n\t // behave like it would if they were running a local HTTP server. See\n\t // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n\t var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n\t if (url.scheme == \"file\"\n\t && this._sources.has(fileUriAbsPath)) {\n\t return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n\t }\n\t\n\t if ((!url.path || url.path == \"/\")\n\t && this._sources.has(\"/\" + aSource)) {\n\t return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n\t }\n\t }\n\t\n\t // This function is used recursively from\n\t // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n\t // don't want to throw if we can't find the source - we just want to\n\t // return null, so we provide a flag to exit gracefully.\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: The column number in the original source.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\tBasicSourceMapConsumer.prototype.generatedPositionFor =\n\t function SourceMapConsumer_generatedPositionFor(aArgs) {\n\t var source = util.getArg(aArgs, 'source');\n\t if (this.sourceRoot != null) {\n\t source = util.relative(this.sourceRoot, source);\n\t }\n\t if (!this._sources.has(source)) {\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t }\n\t source = this._sources.indexOf(source);\n\t\n\t var needle = {\n\t source: source,\n\t originalLine: util.getArg(aArgs, 'line'),\n\t originalColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (mapping.source === needle.source) {\n\t return {\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t };\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t };\n\t\n\texports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\t\n\t/**\n\t * An IndexedSourceMapConsumer instance represents a parsed source map which\n\t * we can query for information. It differs from BasicSourceMapConsumer in\n\t * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n\t * input.\n\t *\n\t * The only parameter is a raw source map (either as a JSON string, or already\n\t * parsed to an object). According to the spec for indexed source maps, they\n\t * have the following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - file: Optional. The generated file this source map is associated with.\n\t * - sections: A list of section definitions.\n\t *\n\t * Each value under the \"sections\" field has two fields:\n\t * - offset: The offset into the original specified at which this section\n\t * begins to apply, defined as an object with a \"line\" and \"column\"\n\t * field.\n\t * - map: A source map definition. This source map could also be indexed,\n\t * but doesn't have to be.\n\t *\n\t * Instead of the \"map\" field, it's also possible to have a \"url\" field\n\t * specifying a URL to retrieve a source map from, but that's currently\n\t * unsupported.\n\t *\n\t * Here's an example source map, taken from the source map spec[0], but\n\t * modified to omit a section which uses the \"url\" field.\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"app.js\",\n\t * sections: [{\n\t * offset: {line:100, column:10},\n\t * map: {\n\t * version : 3,\n\t * file: \"section.js\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AAAA,E;;ABCDE;\"\n\t * }\n\t * }],\n\t * }\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n\t */\n\tfunction IndexedSourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sections = util.getArg(sourceMap, 'sections');\n\t\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t this._sources = new ArraySet();\n\t this._names = new ArraySet();\n\t\n\t var lastOffset = {\n\t line: -1,\n\t column: 0\n\t };\n\t this._sections = sections.map(function (s) {\n\t if (s.url) {\n\t // The url field will require support for asynchronicity.\n\t // See https://github.com/mozilla/source-map/issues/16\n\t throw new Error('Support for url field in sections not implemented.');\n\t }\n\t var offset = util.getArg(s, 'offset');\n\t var offsetLine = util.getArg(offset, 'line');\n\t var offsetColumn = util.getArg(offset, 'column');\n\t\n\t if (offsetLine < lastOffset.line ||\n\t (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n\t throw new Error('Section offsets must be ordered and non-overlapping.');\n\t }\n\t lastOffset = offset;\n\t\n\t return {\n\t generatedOffset: {\n\t // The offset fields are 0-based, but we use 1-based indices when\n\t // encoding/decoding from VLQ.\n\t generatedLine: offsetLine + 1,\n\t generatedColumn: offsetColumn + 1\n\t },\n\t consumer: new SourceMapConsumer(util.getArg(s, 'map'))\n\t }\n\t });\n\t}\n\t\n\tIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tIndexedSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t var sources = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n\t sources.push(this._sections[i].consumer.sources[j]);\n\t }\n\t }\n\t return sources;\n\t }\n\t});\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source.\n\t * - column: The column number in the generated source.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null.\n\t * - column: The column number in the original source, or null.\n\t * - name: The original identifier, or null.\n\t */\n\tIndexedSourceMapConsumer.prototype.originalPositionFor =\n\t function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t // Find the section containing the generated position we're trying to map\n\t // to an original position.\n\t var sectionIndex = binarySearch.search(needle, this._sections,\n\t function(needle, section) {\n\t var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n\t if (cmp) {\n\t return cmp;\n\t }\n\t\n\t return (needle.generatedColumn -\n\t section.generatedOffset.generatedColumn);\n\t });\n\t var section = this._sections[sectionIndex];\n\t\n\t if (!section) {\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t }\n\t\n\t return section.consumer.originalPositionFor({\n\t line: needle.generatedLine -\n\t (section.generatedOffset.generatedLine - 1),\n\t column: needle.generatedColumn -\n\t (section.generatedOffset.generatedLine === needle.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t bias: aArgs.bias\n\t });\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n\t return this._sections.every(function (s) {\n\t return s.consumer.hasContentsOfAllSources();\n\t });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tIndexedSourceMapConsumer.prototype.sourceContentFor =\n\t function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t var content = section.consumer.sourceContentFor(aSource, true);\n\t if (content) {\n\t return content;\n\t }\n\t }\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: The column number in the original source.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\tIndexedSourceMapConsumer.prototype.generatedPositionFor =\n\t function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t // Only consider this section if the requested source is in the list of\n\t // sources of the consumer.\n\t if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {\n\t continue;\n\t }\n\t var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n\t if (generatedPosition) {\n\t var ret = {\n\t line: generatedPosition.line +\n\t (section.generatedOffset.generatedLine - 1),\n\t column: generatedPosition.column +\n\t (section.generatedOffset.generatedLine === generatedPosition.line\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0)\n\t };\n\t return ret;\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null\n\t };\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tIndexedSourceMapConsumer.prototype._parseMappings =\n\t function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t this.__generatedMappings = [];\n\t this.__originalMappings = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t var sectionMappings = section.consumer._generatedMappings;\n\t for (var j = 0; j < sectionMappings.length; j++) {\n\t var mapping = sectionMappings[j];\n\t\n\t var source = section.consumer._sources.at(mapping.source);\n\t if (section.consumer.sourceRoot !== null) {\n\t source = util.join(section.consumer.sourceRoot, source);\n\t }\n\t this._sources.add(source);\n\t source = this._sources.indexOf(source);\n\t\n\t var name = section.consumer._names.at(mapping.name);\n\t this._names.add(name);\n\t name = this._names.indexOf(name);\n\t\n\t // The mappings coming from the consumer for the section have\n\t // generated positions relative to the start of the section, so we\n\t // need to offset them to be relative to the start of the concatenated\n\t // generated file.\n\t var adjustedMapping = {\n\t source: source,\n\t generatedLine: mapping.generatedLine +\n\t (section.generatedOffset.generatedLine - 1),\n\t generatedColumn: mapping.generatedColumn +\n\t (section.generatedOffset.generatedLine === mapping.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: name\n\t };\n\t\n\t this.__generatedMappings.push(adjustedMapping);\n\t if (typeof adjustedMapping.originalLine === 'number') {\n\t this.__originalMappings.push(adjustedMapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t quickSort(this.__originalMappings, util.compareByOriginalPositions);\n\t };\n\t\n\texports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\texports.GREATEST_LOWER_BOUND = 1;\n\texports.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Recursive implementation of binary search.\n\t *\n\t * @param aLow Indices here and lower do not contain the needle.\n\t * @param aHigh Indices here and higher do not contain the needle.\n\t * @param aNeedle The element being searched for.\n\t * @param aHaystack The non-empty array being searched.\n\t * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t */\n\tfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n\t // This function terminates when one of the following is true:\n\t //\n\t // 1. We find the exact element we are looking for.\n\t //\n\t // 2. We did not find the exact element, but we can return the index of\n\t // the next-closest element.\n\t //\n\t // 3. We did not find the exact element, and there is no next-closest\n\t // element than the one we are searching for, so we return -1.\n\t var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n\t var cmp = aCompare(aNeedle, aHaystack[mid], true);\n\t if (cmp === 0) {\n\t // Found the element we are looking for.\n\t return mid;\n\t }\n\t else if (cmp > 0) {\n\t // Our needle is greater than aHaystack[mid].\n\t if (aHigh - mid > 1) {\n\t // The element is in the upper half.\n\t return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // The exact needle element was not found in this haystack. Determine if\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return aHigh < aHaystack.length ? aHigh : -1;\n\t } else {\n\t return mid;\n\t }\n\t }\n\t else {\n\t // Our needle is less than aHaystack[mid].\n\t if (mid - aLow > 1) {\n\t // The element is in the lower half.\n\t return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return mid;\n\t } else {\n\t return aLow < 0 ? -1 : aLow;\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * This is an implementation of binary search which will always try and return\n\t * the index of the closest element if there is no exact hit. This is because\n\t * mappings between original and generated line/col pairs are single points,\n\t * and there is an implicit region between each of them, so a miss just means\n\t * that you aren't on the very start of a region.\n\t *\n\t * @param aNeedle The element you are looking for.\n\t * @param aHaystack The array that is being searched.\n\t * @param aCompare A function which takes the needle and an element in the\n\t * array and returns -1, 0, or 1 depending on whether the needle is less\n\t * than, equal to, or greater than the element, respectively.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n\t */\n\texports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n\t if (aHaystack.length === 0) {\n\t return -1;\n\t }\n\t\n\t var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n\t aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n\t if (index < 0) {\n\t return -1;\n\t }\n\t\n\t // We have found either the exact element, or the next-closest element than\n\t // the one we are searching for. However, there may be more than one such\n\t // element. Make sure we always return the smallest of these.\n\t while (index - 1 >= 0) {\n\t if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n\t break;\n\t }\n\t --index;\n\t }\n\t\n\t return index;\n\t};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t// It turns out that some (most?) JavaScript engines don't self-host\n\t// `Array.prototype.sort`. This makes sense because C++ will likely remain\n\t// faster than JS when doing raw CPU-intensive sorting. However, when using a\n\t// custom comparator function, calling back and forth between the VM's C++ and\n\t// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n\t// worse generated code for the comparator function than would be optimal. In\n\t// fact, when sorting with a comparator, these costs outweigh the benefits of\n\t// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n\t// a ~3500ms mean speed-up in `bench/bench.html`.\n\t\n\t/**\n\t * Swap the elements indexed by `x` and `y` in the array `ary`.\n\t *\n\t * @param {Array} ary\n\t * The array.\n\t * @param {Number} x\n\t * The index of the first item.\n\t * @param {Number} y\n\t * The index of the second item.\n\t */\n\tfunction swap(ary, x, y) {\n\t var temp = ary[x];\n\t ary[x] = ary[y];\n\t ary[y] = temp;\n\t}\n\t\n\t/**\n\t * Returns a random integer within the range `low .. high` inclusive.\n\t *\n\t * @param {Number} low\n\t * The lower bound on the range.\n\t * @param {Number} high\n\t * The upper bound on the range.\n\t */\n\tfunction randomIntInRange(low, high) {\n\t return Math.round(low + (Math.random() * (high - low)));\n\t}\n\t\n\t/**\n\t * The Quick Sort algorithm.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t * @param {Number} p\n\t * Start index of the array\n\t * @param {Number} r\n\t * End index of the array\n\t */\n\tfunction doQuickSort(ary, comparator, p, r) {\n\t // If our lower bound is less than our upper bound, we (1) partition the\n\t // array into two pieces and (2) recurse on each half. If it is not, this is\n\t // the empty array and our base case.\n\t\n\t if (p < r) {\n\t // (1) Partitioning.\n\t //\n\t // The partitioning chooses a pivot between `p` and `r` and moves all\n\t // elements that are less than or equal to the pivot to the before it, and\n\t // all the elements that are greater than it after it. The effect is that\n\t // once partition is done, the pivot is in the exact place it will be when\n\t // the array is put in sorted order, and it will not need to be moved\n\t // again. This runs in O(n) time.\n\t\n\t // Always choose a random pivot so that an input array which is reverse\n\t // sorted does not cause O(n^2) running time.\n\t var pivotIndex = randomIntInRange(p, r);\n\t var i = p - 1;\n\t\n\t swap(ary, pivotIndex, r);\n\t var pivot = ary[r];\n\t\n\t // Immediately after `j` is incremented in this loop, the following hold\n\t // true:\n\t //\n\t // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n\t //\n\t // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n\t for (var j = p; j < r; j++) {\n\t if (comparator(ary[j], pivot) <= 0) {\n\t i += 1;\n\t swap(ary, i, j);\n\t }\n\t }\n\t\n\t swap(ary, i + 1, j);\n\t var q = i + 1;\n\t\n\t // (2) Recurse on each half.\n\t\n\t doQuickSort(ary, comparator, p, q - 1);\n\t doQuickSort(ary, comparator, q + 1, r);\n\t }\n\t}\n\t\n\t/**\n\t * Sort the given array in-place with the given comparator function.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t */\n\texports.quickSort = function (ary, comparator) {\n\t doQuickSort(ary, comparator, 0, ary.length - 1);\n\t};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\tvar util = __webpack_require__(4);\n\t\n\t// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n\t// operating systems these days (capturing the result).\n\tvar REGEX_NEWLINE = /(\\r?\\n)/;\n\t\n\t// Newline character code for charCodeAt() comparisons\n\tvar NEWLINE_CODE = 10;\n\t\n\t// Private symbol for identifying `SourceNode`s when multiple versions of\n\t// the source-map library are loaded. This MUST NOT CHANGE across\n\t// versions!\n\tvar isSourceNode = \"$$$isSourceNode$$$\";\n\t\n\t/**\n\t * SourceNodes provide a way to abstract over interpolating/concatenating\n\t * snippets of generated JavaScript source code while maintaining the line and\n\t * column information associated with the original source code.\n\t *\n\t * @param aLine The original line number.\n\t * @param aColumn The original column number.\n\t * @param aSource The original source's filename.\n\t * @param aChunks Optional. An array of strings which are snippets of\n\t * generated JS, or other SourceNodes.\n\t * @param aName The original identifier.\n\t */\n\tfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n\t this.children = [];\n\t this.sourceContents = {};\n\t this.line = aLine == null ? null : aLine;\n\t this.column = aColumn == null ? null : aColumn;\n\t this.source = aSource == null ? null : aSource;\n\t this.name = aName == null ? null : aName;\n\t this[isSourceNode] = true;\n\t if (aChunks != null) this.add(aChunks);\n\t}\n\t\n\t/**\n\t * Creates a SourceNode from generated code and a SourceMapConsumer.\n\t *\n\t * @param aGeneratedCode The generated code\n\t * @param aSourceMapConsumer The SourceMap for the generated code\n\t * @param aRelativePath Optional. The path that relative sources in the\n\t * SourceMapConsumer should be relative to.\n\t */\n\tSourceNode.fromStringWithSourceMap =\n\t function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n\t // The SourceNode we want to fill with the generated code\n\t // and the SourceMap\n\t var node = new SourceNode();\n\t\n\t // All even indices of this array are one line of the generated code,\n\t // while all odd indices are the newlines between two adjacent lines\n\t // (since `REGEX_NEWLINE` captures its match).\n\t // Processed fragments are accessed by calling `shiftNextLine`.\n\t var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n\t var remainingLinesIndex = 0;\n\t var shiftNextLine = function() {\n\t var lineContents = getNextLine();\n\t // The last line of a file might not have a newline.\n\t var newLine = getNextLine() || \"\";\n\t return lineContents + newLine;\n\t\n\t function getNextLine() {\n\t return remainingLinesIndex < remainingLines.length ?\n\t remainingLines[remainingLinesIndex++] : undefined;\n\t }\n\t };\n\t\n\t // We need to remember the position of \"remainingLines\"\n\t var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\t\n\t // The generate SourceNodes we need a code range.\n\t // To extract it current and last mapping is used.\n\t // Here we store the last mapping.\n\t var lastMapping = null;\n\t\n\t aSourceMapConsumer.eachMapping(function (mapping) {\n\t if (lastMapping !== null) {\n\t // We add the code from \"lastMapping\" to \"mapping\":\n\t // First check if there is a new line in between.\n\t if (lastGeneratedLine < mapping.generatedLine) {\n\t // Associate first line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t lastGeneratedLine++;\n\t lastGeneratedColumn = 0;\n\t // The remaining code is added without mapping\n\t } else {\n\t // There is no new line in between.\n\t // Associate the code between \"lastGeneratedColumn\" and\n\t // \"mapping.generatedColumn\" with \"lastMapping\"\n\t var nextLine = remainingLines[remainingLinesIndex];\n\t var code = nextLine.substr(0, mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t addMappingWithCode(lastMapping, code);\n\t // No more remaining code, continue\n\t lastMapping = mapping;\n\t return;\n\t }\n\t }\n\t // We add the generated code until the first mapping\n\t // to the SourceNode without any mapping.\n\t // Each line is added as separate string.\n\t while (lastGeneratedLine < mapping.generatedLine) {\n\t node.add(shiftNextLine());\n\t lastGeneratedLine++;\n\t }\n\t if (lastGeneratedColumn < mapping.generatedColumn) {\n\t var nextLine = remainingLines[remainingLinesIndex];\n\t node.add(nextLine.substr(0, mapping.generatedColumn));\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t }\n\t lastMapping = mapping;\n\t }, this);\n\t // We have processed all mappings.\n\t if (remainingLinesIndex < remainingLines.length) {\n\t if (lastMapping) {\n\t // Associate the remaining code in the current line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t }\n\t // and add the remaining lines without any mapping\n\t node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n\t }\n\t\n\t // Copy sourcesContent into SourceNode\n\t aSourceMapConsumer.sources.forEach(function (sourceFile) {\n\t var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n\t if (content != null) {\n\t if (aRelativePath != null) {\n\t sourceFile = util.join(aRelativePath, sourceFile);\n\t }\n\t node.setSourceContent(sourceFile, content);\n\t }\n\t });\n\t\n\t return node;\n\t\n\t function addMappingWithCode(mapping, code) {\n\t if (mapping === null || mapping.source === undefined) {\n\t node.add(code);\n\t } else {\n\t var source = aRelativePath\n\t ? util.join(aRelativePath, mapping.source)\n\t : mapping.source;\n\t node.add(new SourceNode(mapping.originalLine,\n\t mapping.originalColumn,\n\t source,\n\t code,\n\t mapping.name));\n\t }\n\t }\n\t };\n\t\n\t/**\n\t * Add a chunk of generated JS to this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.add = function SourceNode_add(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t aChunk.forEach(function (chunk) {\n\t this.add(chunk);\n\t }, this);\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t if (aChunk) {\n\t this.children.push(aChunk);\n\t }\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Add a chunk of generated JS to the beginning of this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t for (var i = aChunk.length-1; i >= 0; i--) {\n\t this.prepend(aChunk[i]);\n\t }\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t this.children.unshift(aChunk);\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Walk over the tree of JS snippets in this node and its children. The\n\t * walking function is called once for each snippet of JS and is passed that\n\t * snippet and the its original associated source's line/column location.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n\t var chunk;\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t chunk = this.children[i];\n\t if (chunk[isSourceNode]) {\n\t chunk.walk(aFn);\n\t }\n\t else {\n\t if (chunk !== '') {\n\t aFn(chunk, { source: this.source,\n\t line: this.line,\n\t column: this.column,\n\t name: this.name });\n\t }\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n\t * each of `this.children`.\n\t *\n\t * @param aSep The separator.\n\t */\n\tSourceNode.prototype.join = function SourceNode_join(aSep) {\n\t var newChildren;\n\t var i;\n\t var len = this.children.length;\n\t if (len > 0) {\n\t newChildren = [];\n\t for (i = 0; i < len-1; i++) {\n\t newChildren.push(this.children[i]);\n\t newChildren.push(aSep);\n\t }\n\t newChildren.push(this.children[i]);\n\t this.children = newChildren;\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Call String.prototype.replace on the very right-most source snippet. Useful\n\t * for trimming whitespace from the end of a source node, etc.\n\t *\n\t * @param aPattern The pattern to replace.\n\t * @param aReplacement The thing to replace the pattern with.\n\t */\n\tSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n\t var lastChild = this.children[this.children.length - 1];\n\t if (lastChild[isSourceNode]) {\n\t lastChild.replaceRight(aPattern, aReplacement);\n\t }\n\t else if (typeof lastChild === 'string') {\n\t this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n\t }\n\t else {\n\t this.children.push(''.replace(aPattern, aReplacement));\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Set the source content for a source file. This will be added to the SourceMapGenerator\n\t * in the sourcesContent field.\n\t *\n\t * @param aSourceFile The filename of the source file\n\t * @param aSourceContent The content of the source file\n\t */\n\tSourceNode.prototype.setSourceContent =\n\t function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n\t this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n\t };\n\t\n\t/**\n\t * Walk over the tree of SourceNodes. The walking function is called for each\n\t * source file content and is passed the filename and source content.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walkSourceContents =\n\t function SourceNode_walkSourceContents(aFn) {\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t if (this.children[i][isSourceNode]) {\n\t this.children[i].walkSourceContents(aFn);\n\t }\n\t }\n\t\n\t var sources = Object.keys(this.sourceContents);\n\t for (var i = 0, len = sources.length; i < len; i++) {\n\t aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n\t }\n\t };\n\t\n\t/**\n\t * Return the string representation of this source node. Walks over the tree\n\t * and concatenates all the various snippets together to one string.\n\t */\n\tSourceNode.prototype.toString = function SourceNode_toString() {\n\t var str = \"\";\n\t this.walk(function (chunk) {\n\t str += chunk;\n\t });\n\t return str;\n\t};\n\t\n\t/**\n\t * Returns the string representation of this source node along with a source\n\t * map.\n\t */\n\tSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n\t var generated = {\n\t code: \"\",\n\t line: 1,\n\t column: 0\n\t };\n\t var map = new SourceMapGenerator(aArgs);\n\t var sourceMappingActive = false;\n\t var lastOriginalSource = null;\n\t var lastOriginalLine = null;\n\t var lastOriginalColumn = null;\n\t var lastOriginalName = null;\n\t this.walk(function (chunk, original) {\n\t generated.code += chunk;\n\t if (original.source !== null\n\t && original.line !== null\n\t && original.column !== null) {\n\t if(lastOriginalSource !== original.source\n\t || lastOriginalLine !== original.line\n\t || lastOriginalColumn !== original.column\n\t || lastOriginalName !== original.name) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t lastOriginalSource = original.source;\n\t lastOriginalLine = original.line;\n\t lastOriginalColumn = original.column;\n\t lastOriginalName = original.name;\n\t sourceMappingActive = true;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t }\n\t });\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t }\n\t for (var idx = 0, length = chunk.length; idx < length; idx++) {\n\t if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n\t generated.line++;\n\t generated.column = 0;\n\t // Mappings end at eol\n\t if (idx + 1 === length) {\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t } else {\n\t generated.column++;\n\t }\n\t }\n\t });\n\t this.walkSourceContents(function (sourceFile, sourceContent) {\n\t map.setSourceContent(sourceFile, sourceContent);\n\t });\n\t\n\t return { code: generated.code, map: map };\n\t};\n\t\n\texports.SourceNode = SourceNode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// source-map.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 42c329f865e32e011afb","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./source-map.js\n// module id = 0\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-generator.js\n// module id = 1\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64-vlq.js\n// module id = 2\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64.js\n// module id = 3\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nfunction normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n}\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/util.js\n// module id = 4\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/array-set.js\n// module id = 5\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/mapping-list.js\n// module id = 6\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap)\n : new BasicSourceMapConsumer(sourceMap);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n if (source != null && sourceRoot != null) {\n source = util.join(sourceRoot, source);\n }\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: Optional. the column number in the original source.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n if (this.sourceRoot != null) {\n needle.source = util.relative(this.sourceRoot, needle.source);\n }\n if (!this._sources.has(needle.source)) {\n return [];\n }\n needle.source = this._sources.indexOf(needle.source);\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The only parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._sources.toArray().map(function (s) {\n return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;\n }, this);\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n if (this.sourceRoot != null) {\n source = util.join(this.sourceRoot, source);\n }\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n if (this.sourceRoot != null) {\n aSource = util.relative(this.sourceRoot, aSource);\n }\n\n if (this._sources.has(aSource)) {\n return this.sourcesContent[this._sources.indexOf(aSource)];\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + aSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n if (this.sourceRoot != null) {\n source = util.relative(this.sourceRoot, source);\n }\n if (!this._sources.has(source)) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n source = this._sources.indexOf(source);\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The only parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'))\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n if (section.consumer.sourceRoot !== null) {\n source = util.join(section.consumer.sourceRoot, source);\n }\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-consumer.js\n// module id = 7\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/binary-search.js\n// module id = 8\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/quick-sort.js\n// module id = 9\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex];\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex];\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-node.js\n// module id = 10\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/array-set.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/array-set.js new file mode 100644 index 00000000000000..fbd5c81cae66fa --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/array-set.js @@ -0,0 +1,121 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); +var has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; + +exports.ArraySet = ArraySet; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64-vlq.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64-vlq.js new file mode 100644 index 00000000000000..612b404018ece9 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64-vlq.js @@ -0,0 +1,140 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var base64 = require('./base64'); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +var VLQ_BASE_SHIFT = 5; + +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; + +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64.js new file mode 100644 index 00000000000000..8aa86b30264363 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64.js @@ -0,0 +1,67 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; + +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; +}; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/binary-search.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/binary-search.js new file mode 100644 index 00000000000000..010ac941e1568d --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/binary-search.js @@ -0,0 +1,111 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; + +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } +} + +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; +}; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/mapping-list.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/mapping-list.js new file mode 100644 index 00000000000000..06d1274a025a8a --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/mapping-list.js @@ -0,0 +1,79 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} + +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; + +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; +}; + +exports.MappingList = MappingList; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/quick-sort.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/quick-sort.js new file mode 100644 index 00000000000000..6a7caadbbdbea1 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/quick-sort.js @@ -0,0 +1,114 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. + +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} + +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} + +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } +} + +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ +exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); +}; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-consumer.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-consumer.js new file mode 100644 index 00000000000000..6abcc280eea160 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-consumer.js @@ -0,0 +1,1082 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); +var binarySearch = require('./binary-search'); +var ArraySet = require('./array-set').ArraySet; +var base64VLQ = require('./base64-vlq'); +var quickSort = require('./quick-sort').quickSort; + +function SourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap) + : new BasicSourceMapConsumer(sourceMap); +} + +SourceMapConsumer.fromSourceMap = function(aSourceMap) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap); +} + +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; + +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. +// +// Each object in the arrays is of the form: +// +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } +// +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. + +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } +}); + +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } +}); + +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; + +/** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + if (source != null && sourceRoot != null) { + source = util.join(sourceRoot, source); + } + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: Optional. the column number in the original source. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + if (this.sourceRoot != null) { + needle.source = util.relative(this.sourceRoot, needle.source); + } + if (!this._sources.has(needle.source)) { + return []; + } + needle.source = this._sources.indexOf(needle.source); + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The only parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this.file = file; +} + +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + +/** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @returns BasicSourceMapConsumer + */ +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + +/** + * The version of the source mapping spec that we are consuming. + */ +BasicSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._sources.toArray().map(function (s) { + return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; + }, this); + } +}); + +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + +/** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + +/** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + if (this.sourceRoot != null) { + source = util.join(this.sourceRoot, source); + } + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + if (this.sourceRoot != null) { + aSource = util.relative(this.sourceRoot, aSource); + } + + if (this._sources.has(aSource)) { + return this.sourcesContent[this._sources.indexOf(aSource)]; + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + aSource)) { + return this.sourcesContent[this._sources.indexOf("/" + aSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + if (this.sourceRoot != null) { + source = util.relative(this.sourceRoot, source); + } + if (!this._sources.has(source)) { + return { + line: null, + column: null, + lastColumn: null + }; + } + source = this._sources.indexOf(source); + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + +exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The only parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +function IndexedSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map')) + } + }); +} + +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + +/** + * The version of the source mapping spec that we are consuming. + */ +IndexedSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } +}); + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + if (section.consumer.sourceRoot !== null) { + source = util.join(section.consumer.sourceRoot, source); + } + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + +exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-generator.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-generator.js new file mode 100644 index 00000000000000..aff1e7fb268acc --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-generator.js @@ -0,0 +1,416 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var base64VLQ = require('./base64-vlq'); +var util = require('./util'); +var ArraySet = require('./array-set').ArraySet; +var MappingList = require('./mapping-list').MappingList; + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + +/** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + +/** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + +/** + * Externalize the source map. + */ +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + +/** + * Render the source map being generated to a string. + */ +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + +exports.SourceMapGenerator = SourceMapGenerator; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-node.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-node.js new file mode 100644 index 00000000000000..d196a53f8c0eda --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-node.js @@ -0,0 +1,413 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; +var util = require('./util'); + +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +var REGEX_NEWLINE = /(\r?\n)/; + +// Newline character code for charCodeAt() comparisons +var NEWLINE_CODE = 10; + +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +var isSourceNode = "$$$isSourceNode$$$"; + +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); +} + +/** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ +SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + +/** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } +}; + +/** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ +SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; +}; + +/** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ +SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; +}; + +/** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ +SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + +/** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + +/** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ +SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; +}; + +/** + * Returns the string representation of this source node along with a source + * map. + */ +SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; +}; + +exports.SourceNode = SourceNode; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/util.js b/tools/node_modules/babel-eslint/node_modules/source-map/lib/util.js new file mode 100644 index 00000000000000..44e0e45205233e --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/lib/util.js @@ -0,0 +1,417 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +} +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/package.json b/tools/node_modules/babel-eslint/node_modules/source-map/package.json new file mode 100644 index 00000000000000..9e2674cec8bd3c --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/package.json @@ -0,0 +1,188 @@ +{ + "author": { + "name": "Nick Fitzgerald", + "email": "nfitzgerald@mozilla.com" + }, + "bugs": { + "url": "https://github.com/mozilla/source-map/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Tobias Koppers", + "email": "tobias.koppers@googlemail.com" + }, + { + "name": "Duncan Beevers", + "email": "duncan@dweebd.com" + }, + { + "name": "Stephen Crane", + "email": "scrane@mozilla.com" + }, + { + "name": "Ryan Seddon", + "email": "seddon.ryan@gmail.com" + }, + { + "name": "Miles Elam", + "email": "miles.elam@deem.com" + }, + { + "name": "Mihai Bazon", + "email": "mihai.bazon@gmail.com" + }, + { + "name": "Michael Ficarra", + "email": "github.public.email@michael.ficarra.me" + }, + { + "name": "Todd Wolfson", + "email": "todd@twolfson.com" + }, + { + "name": "Alexander Solovyov", + "email": "alexander@solovyov.net" + }, + { + "name": "Felix Gnass", + "email": "fgnass@gmail.com" + }, + { + "name": "Conrad Irwin", + "email": "conrad.irwin@gmail.com" + }, + { + "name": "usrbincc", + "email": "usrbincc@yahoo.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Chase Douglas", + "email": "chase@newrelic.com" + }, + { + "name": "Evan Wallace", + "email": "evan.exe@gmail.com" + }, + { + "name": "Heather Arthur", + "email": "fayearthur@gmail.com" + }, + { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Simon Lydell", + "email": "simon.lydell@gmail.com" + }, + { + "name": "Jmeas Smith", + "email": "jellyes2@gmail.com" + }, + { + "name": "Michael Z Goddard", + "email": "mzgoddard@gmail.com" + }, + { + "name": "azu", + "email": "azu@users.noreply.github.com" + }, + { + "name": "John Gozde", + "email": "john@gozde.ca" + }, + { + "name": "Adam Kirkton", + "email": "akirkton@truefitinnovation.com" + }, + { + "name": "Chris Montgomery", + "email": "christopher.montgomery@dowjones.com" + }, + { + "name": "J. Ryan Stinnett", + "email": "jryans@gmail.com" + }, + { + "name": "Jack Herrington", + "email": "jherrington@walmartlabs.com" + }, + { + "name": "Chris Truter", + "email": "jeffpalentine@gmail.com" + }, + { + "name": "Daniel Espeset", + "email": "daniel@danielespeset.com" + }, + { + "name": "Jamie Wong", + "email": "jamie.lf.wong@gmail.com" + }, + { + "name": "Eddy Bruël", + "email": "ejpbruel@mozilla.com" + }, + { + "name": "Hawken Rives", + "email": "hawkrives@gmail.com" + }, + { + "name": "Gilad Peleg", + "email": "giladp007@gmail.com" + }, + { + "name": "djchie", + "email": "djchie.dev@gmail.com" + }, + { + "name": "Gary Ye", + "email": "garysye@gmail.com" + }, + { + "name": "Nicolas Lalevée", + "email": "nicolas.lalevee@hibnet.org" + } + ], + "deprecated": false, + "description": "Generates and consumes source maps", + "devDependencies": { + "doctoc": "^0.15.0", + "webpack": "^1.12.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "source-map.js", + "lib/", + "dist/source-map.debug.js", + "dist/source-map.js", + "dist/source-map.min.js", + "dist/source-map.min.js.map" + ], + "homepage": "https://github.com/mozilla/source-map", + "license": "BSD-3-Clause", + "main": "./source-map.js", + "name": "source-map", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/mozilla/source-map.git" + }, + "scripts": { + "build": "webpack --color", + "test": "npm run build && node test/run-tests.js", + "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" + }, + "typings": "source-map", + "version": "0.5.7" +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/source-map.js b/tools/node_modules/babel-eslint/node_modules/source-map/source-map.js new file mode 100644 index 00000000000000..bc88fe820c87a2 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/source-map/source-map.js @@ -0,0 +1,8 @@ +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ +exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; +exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; +exports.SourceNode = require('./lib/source-node').SourceNode; diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/browser.js b/tools/node_modules/babel-eslint/node_modules/supports-color/browser.js index ae7c87b17cc486..62afa3a7425dc6 100644 --- a/tools/node_modules/babel-eslint/node_modules/supports-color/browser.js +++ b/tools/node_modules/babel-eslint/node_modules/supports-color/browser.js @@ -1,2 +1,5 @@ 'use strict'; -module.exports = false; +module.exports = { + stdout: false, + stderr: false +}; diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/index.js b/tools/node_modules/babel-eslint/node_modules/supports-color/index.js index 20a29230e8fd63..1704131bdf6c8f 100644 --- a/tools/node_modules/babel-eslint/node_modules/supports-color/index.js +++ b/tools/node_modules/babel-eslint/node_modules/supports-color/index.js @@ -4,7 +4,22 @@ const hasFlag = require('has-flag'); const env = process.env; -const support = level => { +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { if (level === 0) { return false; } @@ -15,12 +30,10 @@ const support = level => { has256: level >= 2, has16m: level >= 3 }; -}; +} -let supportLevel = (() => { - if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { +function supportsColor(stream) { + if (forceColor === false) { return 0; } @@ -34,30 +47,26 @@ let supportLevel = (() => { return 2; } - if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - return 1; - } - - if (process.stdout && !process.stdout.isTTY) { + if (stream && !stream.isTTY && forceColor !== true) { return 0; } + const min = forceColor ? 1 : 0; + if (process.platform === 'win32') { // Node.js 7.5.0 is the first version of Node.js to include a patch to // libuv that enables 256 color output on Windows. Anything earlier and it // won't work. However, here we target Node.js 8 at minimum as it is an LTS // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. const osRelease = os.release().split('.'); if ( Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ) { - return 2; + return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; @@ -68,21 +77,23 @@ let supportLevel = (() => { return 1; } - return 0; + return min; } if ('TEAMCITY_VERSION' in env) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } + if (env.COLORTERM === 'truecolor') { + return 3; + } + if ('TERM_PROGRAM' in env) { const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); switch (env.TERM_PROGRAM) { case 'iTerm.app': return version >= 3 ? 3 : 2; - case 'Hyper': - return 3; case 'Apple_Terminal': return 2; // No default @@ -93,7 +104,7 @@ let supportLevel = (() => { return 2; } - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } @@ -102,14 +113,19 @@ let supportLevel = (() => { } if (env.TERM === 'dumb') { - return 0; + return min; } - return 0; -})(); + return min; +} -if ('FORCE_COLOR' in env) { - supportLevel = parseInt(env.FORCE_COLOR, 10) === 0 ? 0 : (supportLevel || 1); +function getSupportLevel(stream) { + const level = supportsColor(stream); + return translateLevel(level); } -module.exports = process && support(supportLevel); +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) +}; diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/package.json b/tools/node_modules/babel-eslint/node_modules/supports-color/package.json index f6daea6ce9d83c..9e4eafa8573232 100644 --- a/tools/node_modules/babel-eslint/node_modules/supports-color/package.json +++ b/tools/node_modules/babel-eslint/node_modules/supports-color/package.json @@ -1,27 +1,4 @@ { - "_from": "supports-color@^4.0.0", - "_id": "supports-color@4.5.0", - "_inBundle": false, - "_integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "_location": "/babel-eslint/supports-color", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "supports-color@^4.0.0", - "name": "supports-color", - "escapedName": "supports-color", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/babel-eslint/chalk" - ], - "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "_shasum": "be7a0de484dec5c5cddf8b3d59125044912f635b", - "_spec": "supports-color@^4.0.0", - "_where": "/home/mzasso/git/nodejs/node/tools/babel-eslint-tmp/node_modules/babel-eslint/node_modules/chalk", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -33,14 +10,14 @@ }, "bundleDependencies": false, "dependencies": { - "has-flag": "^2.0.0" + "has-flag": "^3.0.0" }, "deprecated": false, "description": "Detect whether a terminal supports color", "devDependencies": { - "ava": "*", + "ava": "^0.25.0", "import-fresh": "^2.0.0", - "xo": "*" + "xo": "^0.20.0" }, "engines": { "node": ">=4" @@ -81,5 +58,5 @@ "scripts": { "test": "xo && ava" }, - "version": "4.5.0" -} + "version": "5.5.0" +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/readme.md b/tools/node_modules/babel-eslint/node_modules/supports-color/readme.md index 3bef57db0ecf3f..f6e40195730ae8 100644 --- a/tools/node_modules/babel-eslint/node_modules/supports-color/readme.md +++ b/tools/node_modules/babel-eslint/node_modules/supports-color/readme.md @@ -15,25 +15,25 @@ $ npm install supports-color ```js const supportsColor = require('supports-color'); -if (supportsColor) { - console.log('Terminal supports color'); +if (supportsColor.stdout) { + console.log('Terminal stdout supports color'); } -if (supportsColor.has256) { - console.log('Terminal supports 256 colors'); +if (supportsColor.stdout.has256) { + console.log('Terminal stdout supports 256 colors'); } -if (supportsColor.has16m) { - console.log('Terminal supports 16 million colors (truecolor)'); +if (supportsColor.stderr.has16m) { + console.log('Terminal stderr supports 16 million colors (truecolor)'); } ``` ## API -Returns an `Object`, or `false` if color is not supported. +Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported. -The returned object specifies a level of support for color through a `.level` property and a corresponding flag: +The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag: - `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) - `.level = 2` and `.has256 = true`: 256 color support diff --git a/tools/node_modules/babel-eslint/node_modules/to-fast-properties/package.json b/tools/node_modules/babel-eslint/node_modules/to-fast-properties/package.json index f1afc91ae7f7e9..2c80c243891203 100644 --- a/tools/node_modules/babel-eslint/node_modules/to-fast-properties/package.json +++ b/tools/node_modules/babel-eslint/node_modules/to-fast-properties/package.json @@ -1,27 +1,4 @@ { - "_from": "to-fast-properties@^2.0.0", - "_id": "to-fast-properties@2.0.0", - "_inBundle": false, - "_integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "_location": "/babel-eslint/to-fast-properties", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "to-fast-properties@^2.0.0", - "name": "to-fast-properties", - "escapedName": "to-fast-properties", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/babel-eslint/@babel/types" - ], - "_resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "_shasum": "dc5e698cbd079265bc73e0377681a4e4e83f616e", - "_spec": "to-fast-properties@^2.0.0", - "_where": "/home/mzasso/git/nodejs/node/tools/babel-eslint-tmp/node_modules/babel-eslint/node_modules/@babel/types", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -64,4 +41,4 @@ "test": "node --allow-natives-syntax test.js" }, "version": "2.0.0" -} +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/trim-right/index.js b/tools/node_modules/babel-eslint/node_modules/trim-right/index.js new file mode 100644 index 00000000000000..666f4b2f4eeb6a --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/trim-right/index.js @@ -0,0 +1,10 @@ +'use strict'; +module.exports = function (str) { + var tail = str.length; + + while (/[\s\uFEFF\u00A0]/.test(str[tail - 1])) { + tail--; + } + + return str.slice(0, tail); +}; diff --git a/tools/node_modules/babel-eslint/node_modules/object-assign/license b/tools/node_modules/babel-eslint/node_modules/trim-right/license similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/object-assign/license rename to tools/node_modules/babel-eslint/node_modules/trim-right/license diff --git a/tools/node_modules/babel-eslint/node_modules/trim-right/package.json b/tools/node_modules/babel-eslint/node_modules/trim-right/package.json new file mode 100644 index 00000000000000..4ed056783bb584 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/trim-right/package.json @@ -0,0 +1,46 @@ +{ + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/trim-right/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Similar to String#trim() but removes only whitespace on the right", + "devDependencies": { + "ava": "0.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/trim-right#readme", + "keywords": [ + "trim", + "right", + "string", + "str", + "util", + "utils", + "utility", + "whitespace", + "space", + "remove", + "delete" + ], + "license": "MIT", + "name": "trim-right", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/trim-right.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.1" +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/trim-right/readme.md b/tools/node_modules/babel-eslint/node_modules/trim-right/readme.md new file mode 100644 index 00000000000000..0a4438acd7a898 --- /dev/null +++ b/tools/node_modules/babel-eslint/node_modules/trim-right/readme.md @@ -0,0 +1,30 @@ +# trim-right [![Build Status](https://travis-ci.org/sindresorhus/trim-right.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-right) + +> Similar to [`String#trim()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) but removes only whitespace on the right + + +## Install + +``` +$ npm install --save trim-right +``` + + +## Usage + +```js +var trimRight = require('trim-right'); + +trimRight(' unicorn '); +//=> ' unicorn' +``` + + +## Related + +- [`trim-left`](https://github.com/sindresorhus/trim-left) - Similar to `String#trim()` but removes only whitespace on the left + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/tools/node_modules/babel-eslint/package.json b/tools/node_modules/babel-eslint/package.json index acd55ec47591e5..73a82acccd0fbc 100644 --- a/tools/node_modules/babel-eslint/package.json +++ b/tools/node_modules/babel-eslint/package.json @@ -1,28 +1,4 @@ { - "_from": "babel-eslint@latest", - "_id": "babel-eslint@8.2.1", - "_inBundle": false, - "_integrity": "sha512-RzdVOyWKQRUnLXhwLk+eKb4oyW+BykZSkpYwFhM4tnfzAG5OWfvG0w/uyzMp5XKEU0jN82+JefHr39bG2+KhRQ==", - "_location": "/babel-eslint", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "babel-eslint@latest", - "name": "babel-eslint", - "escapedName": "babel-eslint", - "rawSpec": "latest", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-8.2.1.tgz", - "_shasum": "136888f3c109edc65376c23ebf494f36a3e03951", - "_spec": "babel-eslint@latest", - "_where": "/home/mzasso/git/nodejs/node/tools/babel-eslint-tmp", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" @@ -32,32 +8,31 @@ }, "bundleDependencies": false, "dependencies": { - "@babel/code-frame": "7.0.0-beta.36", - "@babel/traverse": "7.0.0-beta.36", - "@babel/types": "7.0.0-beta.36", - "babylon": "7.0.0-beta.36", - "eslint-scope": "~3.7.1", + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@babel/types": "^7.0.0", + "eslint-scope": "3.7.1", "eslint-visitor-keys": "^1.0.0" }, "deprecated": false, "description": "Custom parser for ESLint", "devDependencies": { - "babel-eslint": "^8.0.0", + "babel-eslint": "^8.2.6", "dedent": "^0.7.0", - "eslint": "^4.14.0", + "eslint": "^5.6.0", "eslint-config-babel": "^7.0.1", - "eslint-old": "npm:eslint@4.13.1", "eslint-plugin-flowtype": "^2.30.3", - "eslint-plugin-import": "^2.8.0", + "eslint-plugin-import": "^2.14.0", "eslint-plugin-prettier": "^2.1.2", "espree": "^3.5.2", - "husky": "^0.14.0", - "lint-staged": "^4.0.0", - "mocha": "^4.0.0", + "husky": "^1.0.0-rc.13", + "lint-staged": "^7.2.2", + "mocha": "^5.0.1", "prettier": "^1.4.4" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ "lib" @@ -72,18 +47,21 @@ }, "main": "lib/index.js", "name": "babel-eslint", + "peerDependencies": { + "eslint": ">= 4.12.1" + }, "repository": { "type": "git", "url": "git+https://github.com/babel/babel-eslint.git" }, "scripts": { "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'", - "fix": "eslint index.js babylon-to-espree test --fix", - "lint": "eslint index.js babylon-to-espree test", + "fix": "eslint lib test --fix", + "lint": "eslint lib test", "precommit": "lint-staged", "preversion": "npm test", "test": "npm run lint && npm run test-only", - "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js && mocha --require test/fixtures/use-eslint-old.js" + "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js" }, - "version": "8.2.1" -} + "version": "10.0.1" +} \ No newline at end of file From bc5771ec9142c1fb10f1a5fdb6e830ac47f46ff4 Mon Sep 17 00:00:00 2001 From: Beni von Cheni Date: Tue, 26 Feb 2019 01:30:23 -0500 Subject: [PATCH 181/213] doc: correct typos in various docs PR-URL: https://github.com/nodejs/node/pull/26312 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Beth Griggs Reviewed-By: Luigi Pinca --- doc/api/crypto.md | 4 ++-- doc/api/n-api.md | 4 ++-- doc/api/process.md | 4 ++-- doc/api/v8.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 72d4bc78df9dde..7644ff7d632a22 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2107,7 +2107,7 @@ otherwise `err` will be `null`. By default, the successfully generated thrown if any of the input arguments specify invalid values or types. If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated, -please specify a `digest` explicitely. +please specify a `digest` explicitly. The `iterations` argument must be a number set as high as possible. The higher the number of iterations, the more secure the derived key will be, @@ -2173,7 +2173,7 @@ If an error occurs an `Error` will be thrown, otherwise the derived key will be returned as a [`Buffer`][]. If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated, -please specify a `digest` explicitely. +please specify a `digest` explicitly. The `iterations` argument must be a number set as high as possible. The higher the number of iterations, the more secure the derived key will be, diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 1b90f5cee5b3a1..53d3d07f3af5da 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -378,7 +378,7 @@ typedef void (*napi_finalize)(napi_env env, #### napi_async_execute_callback Function pointer used with functions that support asynchronous -operations. Callback functions must statisfy the following signature: +operations. Callback functions must satisfy the following signature: ```C typedef void (*napi_async_execute_callback)(napi_env env, void* data); @@ -391,7 +391,7 @@ calls should be made in `napi_async_complete_callback` instead. #### napi_async_complete_callback Function pointer used with functions that support asynchronous -operations. Callback functions must statisfy the following signature: +operations. Callback functions must satisfy the following signature: ```C typedef void (*napi_async_complete_callback)(napi_env env, diff --git a/doc/api/process.md b/doc/api/process.md index 1a009bce546473..85239bcc4ff484 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1674,7 +1674,7 @@ reports for the current process. Additional documentation is available in the added: v11.8.0 --> -* `err` {Error} A custom error used for reporting the JavsScript stack. +* `err` {Error} A custom error used for reporting the JavaScript stack. * Returns: {string} Returns a JSON-formatted diagnostic report for the running process. The report's @@ -1734,7 +1734,7 @@ added: v11.8.0 should be a relative path, that will be appended to the directory specified in `process.report.setOptions`, or the current working directory of the Node.js process, if unspecified. -* `err` {Error} A custom error used for reporting the JavsScript stack. +* `err` {Error} A custom error used for reporting the JavaScript stack. * Returns: {string} Returns the filename of the generated report. diff --git a/doc/api/v8.md b/doc/api/v8.md index 92fdf867e2287c..04866d92e39854 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -224,7 +224,7 @@ if a previous write has failed. * `id` {integer} A 32-bit unsigned integer. * `arrayBuffer` {ArrayBuffer} An `ArrayBuffer` instance. -Marks an `ArrayBuffer` as havings its contents transferred out of band. +Marks an `ArrayBuffer` as having its contents transferred out of band. Pass the corresponding `ArrayBuffer` in the deserializing context to [`deserializer.transferArrayBuffer()`][]. @@ -328,7 +328,7 @@ Deserializes a JavaScript value from the buffer and returns it. * `id` {integer} A 32-bit unsigned integer. * `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An `ArrayBuffer` instance. -Marks an `ArrayBuffer` as havings its contents transferred out of band. +Marks an `ArrayBuffer` as having its contents transferred out of band. Pass the corresponding `ArrayBuffer` in the serializing context to [`serializer.transferArrayBuffer()`][] (or return the `id` from [`serializer._getSharedArrayBufferId()`][] in the case of `SharedArrayBuffer`s). From 3f4b27d68102e0c809f417c1d87d23d21bd3ea84 Mon Sep 17 00:00:00 2001 From: Sebastiaan Deckers Date: Tue, 26 Feb 2019 10:03:48 +0800 Subject: [PATCH 182/213] doc: maxReservedRemoteStreams value constraints PR-URL: https://github.com/nodejs/node/pull/26309 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Matteo Collina Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/api/http2.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index da2201d55c99a5..c7a12b75b663f9 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2141,7 +2141,9 @@ changes: * `maxReservedRemoteStreams` {number} Sets the maximum number of reserved push streams the client will accept at any given time. Once the current number of currently reserved push streams exceeds reaches this limit, new push streams - sent by the server will be automatically rejected. + sent by the server will be automatically rejected. The minimum allowed value + is 0. The maximum allowed value is 232-1. A negative value sets + this option to the maximum allowed value. **Default:** `200`. * `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted From d66cb4a11607d2e4ddcdefb17c01305ba40192df Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 21 Jan 2019 01:22:27 +0100 Subject: [PATCH 183/213] benchmark,doc,lib,test: capitalize comments This updates a lot of comments. PR-URL: https://github.com/nodejs/node/pull/26223 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Vse Mozhet Byt Reviewed-By: Anto Aravinth --- .eslintrc.js | 4 ++-- benchmark/_cli.js | 4 ++-- benchmark/crypto/cipher-stream.js | 2 +- benchmark/crypto/hash-stream-creation.js | 4 ++-- benchmark/crypto/hash-stream-throughput.js | 2 +- .../crypto/rsa-encrypt-decrypt-throughput.js | 2 +- .../crypto/rsa-sign-verify-throughput.js | 2 +- benchmark/fs/read-stream-throughput.js | 2 +- benchmark/fs/write-stream-throughput.js | 2 +- benchmark/net/tcp-raw-c2s.js | 4 ++-- benchmark/net/tcp-raw-pipe.js | 2 +- benchmark/net/tcp-raw-s2c.js | 2 +- doc/api/child_process.md | 2 +- doc/api/domain.md | 10 ++++----- doc/api/http.md | 2 +- doc/api/http2.md | 6 ++--- doc/api/inspector.md | 2 +- doc/api/querystring.md | 2 +- doc/api/stream.md | 8 +++---- doc/api/util.md | 2 +- lib/_stream_duplex.js | 2 +- lib/_stream_readable.js | 22 +++++++++---------- lib/_stream_writable.js | 18 +++++++-------- lib/_tls_wrap.js | 2 +- lib/dgram.js | 2 +- lib/domain.js | 2 +- lib/events.js | 2 +- lib/fs.js | 10 ++++----- lib/internal/child_process.js | 8 +++---- lib/internal/cluster/child.js | 2 +- lib/internal/console/constructor.js | 2 +- lib/internal/fs/read_file_context.js | 2 +- lib/internal/fs/streams.js | 4 ++-- lib/internal/http2/core.js | 6 ++--- lib/internal/modules/cjs/loader.js | 4 ++-- lib/internal/process/per_thread.js | 2 +- lib/internal/process/warning.js | 2 +- lib/internal/streams/async_iterator.js | 8 +++---- lib/internal/streams/legacy.js | 4 ++-- lib/internal/timers.js | 2 +- lib/internal/url.js | 4 ++-- lib/net.js | 8 +++---- lib/querystring.js | 2 +- lib/readline.js | 8 +++---- lib/timers.js | 4 ++-- lib/url.js | 18 +++++++-------- lib/util.js | 2 +- test/abort/test-addon-uv-handle-leak.js | 2 +- test/addons/load-long-path/test.js | 2 +- .../addons/openssl-client-cert-engine/test.js | 2 +- test/async-hooks/test-callback-error.js | 2 +- ...promise.chain-promise-before-init-hooks.js | 2 +- test/common/index.js | 2 +- .../test-dgram-broadcast-multi-process.js | 4 ++-- test/internet/test-dns-promises-resolve.js | 2 +- test/js-native-api/test_array/test.js | 2 +- test/js-native-api/test_typedarray/test.js | 2 +- ...st-dgram-bind-shared-ports-after-port-0.js | 2 +- .../test-inspector-cluster-port-clash.js | 4 ++-- test/parallel/test-buffer-alloc.js | 12 +++++----- test/parallel/test-buffer-bytelength.js | 2 +- test/parallel/test-buffer-copy.js | 6 ++--- test/parallel/test-buffer-includes.js | 2 +- test/parallel/test-buffer-indexof.js | 4 ++-- test/parallel/test-buffer-read.js | 4 ++-- test/parallel/test-buffer-slow.js | 2 +- test/parallel/test-buffer-tostring-range.js | 8 +++---- .../parallel/test-child-process-disconnect.js | 2 +- test/parallel/test-child-process-fork-net.js | 2 +- test/parallel/test-child-process-silent.js | 2 +- .../test-child-process-stdout-flush-exit.js | 2 +- .../test-child-process-validate-stdio.js | 4 ++-- test/parallel/test-cli-syntax-eval.js | 2 +- test/parallel/test-cli-syntax-piped-bad.js | 2 +- test/parallel/test-cli-syntax-piped-good.js | 2 +- .../test-cluster-disconnect-idle-worker.js | 2 +- test/parallel/test-cluster-disconnect.js | 2 +- test/parallel/test-cluster-eaccess.js | 8 +++---- test/parallel/test-cluster-master-kill.js | 2 +- test/parallel/test-cluster-worker-kill.js | 2 +- test/parallel/test-cluster-worker-no-exit.js | 2 +- .../test-cluster-worker-wait-server-close.js | 2 +- test/parallel/test-console.js | 2 +- test/parallel/test-constants.js | 2 +- test/parallel/test-crypto-authenticated.js | 4 ++-- test/parallel/test-crypto-binary-default.js | 4 ++-- test/parallel/test-crypto-cipher-decipher.js | 4 ++-- test/parallel/test-crypto-dh.js | 2 +- test/parallel/test-crypto-from-binary.js | 2 +- test/parallel/test-crypto-hash.js | 2 +- test/parallel/test-crypto-random.js | 2 +- test/parallel/test-domain-http-server.js | 4 ++-- test/parallel/test-fs-append-file-sync.js | 6 ++--- test/parallel/test-fs-long-path.js | 2 +- test/parallel/test-fs-mkdir.js | 4 ++-- test/parallel/test-fs-promises.js | 6 ++--- test/parallel/test-fs-readfile-pipe-large.js | 2 +- test/parallel/test-fs-readfile-pipe.js | 2 +- .../test-fs-readfile-zero-byte-liar.js | 2 +- .../test-fs-readfilesync-pipe-large.js | 2 +- test/parallel/test-fs-watchfile-bigint.js | 4 ++-- test/parallel/test-fs-watchfile.js | 4 ++-- test/parallel/test-fs-write-file.js | 2 +- .../test-http-addrequest-localaddress.js | 9 ++++---- .../test-http-agent-destroyed-socket.js | 2 +- test/parallel/test-http-agent-keepalive.js | 2 +- test/parallel/test-http-client-pipe-end.js | 2 +- .../test-http-incoming-matchKnownFields.js | 2 +- ...-http-incoming-pipelined-socket-destroy.js | 4 ++-- test/parallel/test-http-outgoing-finish.js | 2 +- .../parallel/test-http-outgoing-settimeout.js | 2 +- .../parallel/test-http-readable-data-event.js | 2 +- ...test-http-res-write-end-dont-take-array.js | 2 +- test/parallel/test-http-set-timeout-server.js | 6 ++--- test/parallel/test-http-set-trailers.js | 2 +- test/parallel/test-http-upgrade-server2.js | 2 +- ...p-url.parse-auth-with-header-in-request.js | 2 +- test/parallel/test-http-url.parse-auth.js | 2 +- test/parallel/test-http-url.parse-basic.js | 4 ++-- .../test-http-url.parse-https.request.js | 2 +- test/parallel/test-http-write-head.js | 2 +- test/parallel/test-http2-client-destroy.js | 2 +- .../test-http2-client-onconnect-errors.js | 2 +- .../test-http2-client-set-priority.js | 2 +- .../test-http2-compat-serverrequest-end.js | 2 +- ...ompat-serverresponse-createpushresponse.js | 2 +- .../test-http2-compat-serverresponse-end.js | 2 +- test/parallel/test-http2-connect.js | 2 +- test/parallel/test-http2-dont-lose-data.js | 2 +- .../test-http2-info-headers-errors.js | 2 +- .../test-http2-misbehaving-multiplex.js | 2 +- .../test-http2-respond-with-fd-errors.js | 2 +- test/parallel/test-http2-server-errors.js | 2 +- test/parallel/test-http2-window-size.js | 2 +- .../parallel/test-https-set-timeout-server.js | 6 ++--- test/parallel/test-https-strict.js | 2 +- test/parallel/test-listen-fd-cluster.js | 2 +- test/parallel/test-net-keepalive.js | 2 +- .../parallel/test-net-persistent-keepalive.js | 2 +- .../parallel/test-net-socket-local-address.js | 2 +- test/parallel/test-path-resolve.js | 2 +- test/parallel/test-preload.js | 8 +++---- test/parallel/test-priority-queue.js | 4 ++-- .../test-process-env-allowed-flags.js | 2 +- ...test-process-external-stdio-close-spawn.js | 2 +- .../test-process-external-stdio-close.js | 2 +- test/parallel/test-process-really-exit.js | 2 +- test/parallel/test-process-umask.js | 2 +- test/parallel/test-punycode.js | 6 ++--- test/parallel/test-querystring.js | 8 +++---- test/parallel/test-readline-interface.js | 8 +++---- test/parallel/test-readline-keys.js | 6 ++--- test/parallel/test-readline-set-raw-mode.js | 4 ++-- test/parallel/test-repl-context.js | 4 ++-- test/parallel/test-repl-end-emits-exit.js | 4 ++-- test/parallel/test-repl-save-load.js | 4 ++-- test/parallel/test-repl-tab-complete.js | 10 ++++----- test/parallel/test-repl-tab.js | 2 +- test/parallel/test-repl.js | 4 ++-- test/parallel/test-require-long-path.js | 2 +- test/parallel/test-stream-duplex-destroy.js | 2 +- test/parallel/test-stream-ispaused.js | 2 +- .../test-stream-pipe-unpipe-streams.js | 2 +- test/parallel/test-stream-pipeline.js | 2 +- test/parallel/test-stream-readable-destroy.js | 2 +- test/parallel/test-stream-readable-event.js | 6 ++--- .../test-stream-readable-flow-recursion.js | 2 +- ...est-stream-readable-reading-readingMore.js | 2 +- .../parallel/test-stream-transform-destroy.js | 2 +- ...st-stream-transform-split-highwatermark.js | 2 +- test/parallel/test-stream-writable-destroy.js | 2 +- test/parallel/test-stream-writev.js | 2 +- test/parallel/test-stream2-transform.js | 4 ++-- test/parallel/test-stream2-unpipe-drain.js | 2 +- test/parallel/test-stream3-cork-end.js | 4 ++-- test/parallel/test-stream3-cork-uncork.js | 4 ++-- test/parallel/test-string-decoder-end.js | 2 +- test/parallel/test-stringbytes-external.js | 12 +++++----- test/parallel/test-tls-getcipher.js | 2 +- test/parallel/test-trace-events-api.js | 4 ++-- .../test-trace-events-category-used.js | 4 ++-- test/parallel/test-url-parse-format.js | 2 +- test/parallel/test-v8-coverage.js | 2 +- .../test-vm-global-property-interceptors.js | 2 +- .../test-windows-failed-heap-allocation.js | 2 +- .../test-zlib-deflate-raw-inherits.js | 2 +- test/parallel/test-zlib-destroy.js | 2 +- test/parallel/test-zlib-dictionary.js | 2 +- test/parallel/test-zlib.js | 2 +- test/sequential/test-cli-syntax-bad.js | 8 +++---- .../test-cli-syntax-file-not-found.js | 4 ++-- test/sequential/test-cli-syntax-good.js | 6 ++--- test/sequential/test-debugger-debug-brk.js | 2 +- .../test-dgram-bind-shared-ports.js | 2 +- test/sequential/test-http-econnrefused.js | 2 +- test/sequential/test-inspector.js | 6 ++--- test/sequential/test-module-loading.js | 6 ++--- .../test-net-listen-shared-ports.js | 2 +- test/sequential/test-stream2-stderr-sync.js | 2 +- .../test-timers-blocking-callback.js | 2 +- tools/eslint-rules/no-duplicate-requires.js | 2 +- tools/eslint-rules/required-modules.js | 4 ++-- 202 files changed, 348 insertions(+), 349 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 39de6e690593a8..97456229969720 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -60,9 +60,9 @@ module.exports = { 'brace-style': ['error', '1tbs', { allowSingleLine: true }], 'capitalized-comments': ['error', 'always', { line: { - // Ignore all lines that have less characters than 50 and all lines that + // Ignore all lines that have less characters than 40 and all lines that // start with something that looks like a variable name or code. - ignorePattern: '^.{0,50}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]', + ignorePattern: '^.{0,40}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]|^ std', ignoreInlineComments: true, ignoreConsecutiveComments: true, }, diff --git a/benchmark/_cli.js b/benchmark/_cli.js index abd394694457c2..45e4c7a2bf05fb 100644 --- a/benchmark/_cli.js +++ b/benchmark/_cli.js @@ -28,7 +28,7 @@ function CLI(usage, settings) { } let currentOptional = null; - let mode = 'both'; // possible states are: [both, option, item] + let mode = 'both'; // Possible states are: [both, option, item] for (const arg of process.argv.slice(2)) { if (arg === '--') { @@ -59,7 +59,7 @@ function CLI(usage, settings) { this.optional[currentOptional] = arg; } - // the next value can be either an option or an item + // The next value can be either an option or an item mode = 'both'; } else if (['both', 'item'].includes(mode)) { // item arguments diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js index 584039a1e516e6..f426a32769d0dd 100644 --- a/benchmark/crypto/cipher-stream.js +++ b/benchmark/crypto/cipher-stream.js @@ -15,7 +15,7 @@ function main({ api, cipher, type, len, writes }) { cipher = 'AES192'; if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); - // use the legacy, just so that we can compare them. + // Use the legacy, just so that we can compare them. api = 'legacy'; } diff --git a/benchmark/crypto/hash-stream-creation.js b/benchmark/crypto/hash-stream-creation.js index faaa12a9e5d484..8ffbe148bb71a5 100644 --- a/benchmark/crypto/hash-stream-creation.js +++ b/benchmark/crypto/hash-stream-creation.js @@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, { function main({ api, type, len, out, writes, algo }) { if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); - // use the legacy, just so that we can compare them. + // Use the legacy, just so that we can compare them. api = 'legacy'; } @@ -54,7 +54,7 @@ function legacyWrite(algo, message, encoding, writes, len, outEnc) { h.update(message, encoding); var res = h.digest(outEnc); - // include buffer creation costs for older versions + // Include buffer creation costs for older versions if (outEnc === 'buffer' && typeof res === 'string') res = Buffer.from(res, 'binary'); } diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js index 934e7a0b11bdae..6ce7a6767e4880 100644 --- a/benchmark/crypto/hash-stream-throughput.js +++ b/benchmark/crypto/hash-stream-throughput.js @@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, { function main({ api, type, len, algo, writes }) { if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); - // use the legacy, just so that we can compare them. + // Use the legacy, just so that we can compare them. api = 'legacy'; } diff --git a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js index 1295ac850609ab..13153c20cad569 100644 --- a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js +++ b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js @@ -1,5 +1,5 @@ 'use strict'; -// throughput benchmark in signing and verifying +// Throughput benchmark in signing and verifying const common = require('../common.js'); const crypto = require('crypto'); const fs = require('fs'); diff --git a/benchmark/crypto/rsa-sign-verify-throughput.js b/benchmark/crypto/rsa-sign-verify-throughput.js index 4ea39d1eb6a6ce..846fa1b9a4bddb 100644 --- a/benchmark/crypto/rsa-sign-verify-throughput.js +++ b/benchmark/crypto/rsa-sign-verify-throughput.js @@ -1,5 +1,5 @@ 'use strict'; -// throughput benchmark in signing and verifying +// Throughput benchmark in signing and verifying const common = require('../common.js'); const crypto = require('crypto'); const fs = require('fs'); diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index bce5f5c996b0a8..cb5d98dc3279f6 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -1,4 +1,4 @@ -// test the throughput of the fs.WriteStream class. +// Test the throughput of the fs.WriteStream class. 'use strict'; const path = require('path'); diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index a1daa619a352aa..bc88330929c2fc 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -1,4 +1,4 @@ -// test the throughput of the fs.WriteStream class. +// Test the throughput of the fs.WriteStream class. 'use strict'; const path = require('path'); diff --git a/benchmark/net/tcp-raw-c2s.js b/benchmark/net/tcp-raw-c2s.js index 849b3651681e7f..fe320ddaa2716b 100644 --- a/benchmark/net/tcp-raw-c2s.js +++ b/benchmark/net/tcp-raw-c2s.js @@ -5,7 +5,7 @@ const common = require('../common.js'); const util = require('util'); -// if there are --dur=N and --len=N args, then +// If there are --dur=N and --len=N args, then // run the function with those settings. // if not, then queue up a bunch of child processes. const bench = common.createBenchmark(main, { @@ -36,7 +36,7 @@ function main({ dur, len, type }) { if (err) fail(err, 'connect'); - // the meat of the benchmark is right here: + // The meat of the benchmark is right here: bench.start(); var bytes = 0; diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js index 10c69fb8b2d4bf..89db42dc4f3e72 100644 --- a/benchmark/net/tcp-raw-pipe.js +++ b/benchmark/net/tcp-raw-pipe.js @@ -5,7 +5,7 @@ const common = require('../common.js'); const util = require('util'); -// if there are --dur=N and --len=N args, then +// If there are --dur=N and --len=N args, then // run the function with those settings. // if not, then queue up a bunch of child processes. const bench = common.createBenchmark(main, { diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js index d34434a3d02e41..73f4d292cf5541 100644 --- a/benchmark/net/tcp-raw-s2c.js +++ b/benchmark/net/tcp-raw-s2c.js @@ -122,7 +122,7 @@ function main({ dur, len, type }) { clientHandle.readStart(); - // the meat of the benchmark is right here: + // The meat of the benchmark is right here: bench.start(); setTimeout(() => { diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 9586b662eb17ed..a6064ee3c7545f 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1070,7 +1070,7 @@ const subprocess = spawn( ); setTimeout(() => { - subprocess.kill(); // does not terminate the node process in the shell + subprocess.kill(); // Does not terminate the node process in the shell }, 2000); ``` diff --git a/doc/api/domain.md b/doc/api/domain.md index 5ed1de4a4a23ca..0f53e958bd8976 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -128,7 +128,7 @@ if (cluster.isMaster) { // Anything can happen now! Be very careful! try { - // make sure we close down within 30 seconds + // Make sure we close down within 30 seconds const killtimer = setTimeout(() => { process.exit(1); }, 30000); @@ -148,7 +148,7 @@ if (cluster.isMaster) { res.setHeader('content-type', 'text/plain'); res.end('Oops, there was a problem!\n'); } catch (er2) { - // oh well, not much we can do at this point. + // Oh well, not much we can do at this point. console.error(`Error sending 500! ${er2.stack}`); } }); @@ -240,13 +240,13 @@ perhaps we would like to have a separate domain to use for each request. That is possible via explicit binding. ```js -// create a top-level domain for the server +// Create a top-level domain for the server const domain = require('domain'); const http = require('http'); const serverDomain = domain.create(); serverDomain.run(() => { - // server is created in the scope of serverDomain + // Server is created in the scope of serverDomain http.createServer((req, res) => { // Req and res are also created in the scope of serverDomain // however, we'd prefer to have a separate domain for each request. @@ -373,7 +373,7 @@ const d = domain.create(); function readSomeFile(filename, cb) { fs.readFile(filename, 'utf8', d.intercept((data) => { - // note, the first argument is never passed to the + // Note, the first argument is never passed to the // callback since it is assumed to be the 'Error' argument // and thus intercepted by the domain. diff --git a/doc/api/http.md b/doc/api/http.md index 0f228baf80577b..6a26fe79a6d514 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -101,7 +101,7 @@ http.get({ hostname: 'localhost', port: 80, path: '/', - agent: false // create a new agent just for this one request + agent: false // Create a new agent just for this one request }, (res) => { // Do stuff with response }); diff --git a/doc/api/http2.md b/doc/api/http2.md index c7a12b75b663f9..ac4385ba110a42 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2600,7 +2600,7 @@ const server = createSecureServer( ).listen(4443); function onRequest(req, res) { - // detects if it is a HTTPS request or HTTP/2 + // Detects if it is a HTTPS request or HTTP/2 const { socket: { alpnProtocol } } = req.httpVersion === '2.0' ? req.stream.session : req; res.writeHead(200, { 'content-type': 'application/json' }); @@ -3373,9 +3373,9 @@ const obs = new PerformanceObserver((items) => { const entry = items.getEntries()[0]; console.log(entry.entryType); // prints 'http2' if (entry.name === 'Http2Session') { - // entry contains statistics about the Http2Session + // Entry contains statistics about the Http2Session } else if (entry.name === 'Http2Stream') { - // entry contains statistics about the Http2Stream + // Entry contains statistics about the Http2Stream } }); obs.observe({ entryTypes: ['http2'] }); diff --git a/doc/api/inspector.md b/doc/api/inspector.md index 6af8b90aaf6238..0a11f6a1ff12eb 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -167,7 +167,7 @@ session.connect(); session.post('Profiler.enable', () => { session.post('Profiler.start', () => { - // invoke business logic under measurement here... + // Invoke business logic under measurement here... // some time later... session.post('Profiler.stop', (err, { profile }) => { diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 60230d916b3243..67475601af9517 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -109,7 +109,7 @@ Any other input values will be coerced to empty strings. ```js querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); -// returns 'foo=bar&baz=qux&baz=quux&corge=' +// Returns 'foo=bar&baz=qux&baz=quux&corge=' querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); // returns 'foo:bar;baz:qux' diff --git a/doc/api/stream.md b/doc/api/stream.md index 14bc50d3107283..c9d4b035ddd48c 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -135,7 +135,7 @@ const server = http.createServer((req, res) => { req.on('end', () => { try { const data = JSON.parse(body); - // write back something interesting to the user: + // Write back something interesting to the user: res.write(typeof data); res.end(); } catch (er) { @@ -413,7 +413,7 @@ Calling the [`stream.write()`][stream-write] method after calling [`stream.end()`][stream-end] will raise an error. ```js -// write 'hello, ' and then end with 'world!' +// Write 'hello, ' and then end with 'world!' const fs = require('fs'); const file = fs.createWriteStream('example.txt'); file.write('hello, '); @@ -684,7 +684,7 @@ pass.unpipe(writable); pass.on('data', (chunk) => { console.log(chunk.toString()); }); pass.write('ok'); // will not emit 'data' -pass.resume(); // must be called to make stream emit 'data' +pass.resume(); // Must be called to make stream emit 'data' ``` While `readable.readableFlowing` is `false`, data may be accumulating @@ -1211,7 +1211,7 @@ function parseHeader(stream, callback) { const remaining = split.join('\n\n'); const buf = Buffer.from(remaining, 'utf8'); stream.removeListener('error', callback); - // remove the 'readable' listener before unshifting + // Remove the 'readable' listener before unshifting stream.removeListener('readable', onReadable); if (buf.length) stream.unshift(buf); diff --git a/doc/api/util.md b/doc/api/util.md index bb200a571ae4dc..a713d3a402e372 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -158,7 +158,7 @@ const util = require('util'); const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001'); const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001'); -fn1(); // emits a deprecation warning with code DEP0001 +fn1(); // Emits a deprecation warning with code DEP0001 fn2(); // Does not emit a deprecation warning because it has the same code ``` diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index 2854bdb58743d1..7551af7f4e7f0f 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -131,7 +131,7 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { return; } - // backward compatibility, the user is explicitly + // Backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; this._writableState.destroyed = value; diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 786c21a1cecb62..b3a1e1933a743b 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -133,7 +133,7 @@ function ReadableState(options, stream, isDuplex) { // The number of writers that are awaiting a drain event in .pipe()s this.awaitDrain = 0; - // if true, a maybeReadMore has been scheduled + // If true, a maybeReadMore has been scheduled this.readingMore = false; this.decoder = null; @@ -188,7 +188,7 @@ Object.defineProperty(Readable.prototype, 'destroyed', { return; } - // backward compatibility, the user is explicitly + // Backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; } @@ -668,7 +668,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { var cleanedUp = false; function cleanup() { debug('cleanup'); - // cleanup event handlers once the pipe is broken + // Cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); @@ -744,7 +744,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { // tell the dest that it's being piped to dest.emit('pipe', src); - // start the flow if it hasn't been started already. + // Start the flow if it hasn't been started already. if (!state.flowing) { debug('pipe resume'); src.resume(); @@ -771,13 +771,13 @@ Readable.prototype.unpipe = function(dest) { var state = this._readableState; var unpipeInfo = { hasUnpiped: false }; - // if we're not piping anywhere, then do nothing. + // If we're not piping anywhere, then do nothing. if (state.pipesCount === 0) return this; - // just one destination. most common case. + // Just one destination. most common case. if (state.pipesCount === 1) { - // passed in one, but it's not the right one. + // Passed in one, but it's not the right one. if (dest && dest !== state.pipes) return this; @@ -823,7 +823,7 @@ Readable.prototype.unpipe = function(dest) { return this; }; -// set up data events if they are asked for +// Set up data events if they are asked for // Ensure readable listeners eventually get something Readable.prototype.on = function(ev, fn) { const res = Stream.prototype.on.call(this, ev, fn); @@ -892,7 +892,7 @@ function updateReadableListening(self) { state.readableListening = self.listenerCount('readable') > 0; if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise + // Flowing needs to be set to true now, otherwise // the upcoming resume will not flow. state.flowing = true; @@ -913,7 +913,7 @@ Readable.prototype.resume = function() { var state = this._readableState; if (!state.flowing) { debug('resume'); - // we flow only if there is no one listening + // We flow only if there is no one listening // for readable, but we still have to call // resume() state.flowing = !state.readableListening; @@ -983,7 +983,7 @@ Readable.prototype.wrap = function(stream) { if (state.decoder) chunk = state.decoder.write(chunk); - // don't skip over falsy values in objectMode + // Don't skip over falsy values in objectMode if (state.objectMode && (chunk === null || chunk === undefined)) return; else if (!state.objectMode && (!chunk || !chunk.length)) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 71be4ffe381624..4c60bf7d7a1bac 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -69,7 +69,7 @@ function WritableState(options, stream, isDuplex) { if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - // the point at which write() starts returning false + // The point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', @@ -82,7 +82,7 @@ function WritableState(options, stream, isDuplex) { this.needDrain = false; // at the start of calling end() this.ending = false; - // when end() has been called, and returned + // When end() has been called, and returned this.ended = false; // when 'finish' is emitted this.finished = false; @@ -123,7 +123,7 @@ function WritableState(options, stream, isDuplex) { // end up in an overlapped onwrite situation. this.bufferProcessing = false; - // the callback that's passed to _write(chunk,cb) + // The callback that's passed to _write(chunk,cb) this.onwrite = onwrite.bind(undefined, stream); // The callback that the user supplies to write(chunk,encoding,cb) @@ -135,7 +135,7 @@ function WritableState(options, stream, isDuplex) { this.bufferedRequest = null; this.lastBufferedRequest = null; - // number of pending user-supplied write callbacks + // Number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted this.pendingcb = 0; @@ -155,7 +155,7 @@ function WritableState(options, stream, isDuplex) { // count buffered requests this.bufferedRequestCount = 0; - // allocate the first CorkedRequest, there is always + // Allocate the first CorkedRequest, there is always // one allocated and free to use, and we maintain at most two var corkReq = { next: null, entry: null, finish: undefined }; corkReq.finish = onCorkedFinish.bind(undefined, corkReq, this); @@ -423,13 +423,13 @@ function onwriteError(stream, state, sync, er, cb) { // Defer the callback if we are being called synchronously // to avoid piling up things on the stack process.nextTick(cb, er); - // this can emit finish, and it will always happen + // This can emit finish, and it will always happen // after error process.nextTick(finishMaybe, stream, state); stream._writableState.errorEmitted = true; errorOrDestroy(stream, er); } else { - // the caller expect this to happen before if + // The caller expect this to happen before if // it is async cb(er); stream._writableState.errorEmitted = true; @@ -545,7 +545,7 @@ function clearBuffer(stream, state) { doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then + // If we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. @@ -703,7 +703,7 @@ Object.defineProperty(Writable.prototype, 'destroyed', { return; } - // backward compatibility, the user is explicitly + // Backward compatibility, the user is explicitly // managing destroyed this._writableState.destroyed = value; } diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index f1d5ade3edbdf3..6522d455909a24 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -567,7 +567,7 @@ TLSSocket.prototype._init = function(socket, wrap) { } if (options.ALPNProtocols) { - // keep reference in secureContext not to be GC-ed + // Keep reference in secureContext not to be GC-ed ssl._secureContext.alpnBuffer = options.ALPNProtocols; ssl.setALPNProtocols(ssl._secureContext.alpnBuffer); } diff --git a/lib/dgram.js b/lib/dgram.js index 49c41982ff1b5c..e48c117eed134b 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -253,7 +253,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) { exclusive = false; } - // defaulting address for bind to all interfaces + // Defaulting address for bind to all interfaces if (!address) { if (this.type === 'udp4') address = '0.0.0.0'; diff --git a/lib/domain.js b/lib/domain.js index 5032fd8e454c42..76b27dc058e8c2 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -305,7 +305,7 @@ Domain.prototype.add = function(ee) { if (ee.domain) ee.domain.remove(ee); - // check for circular Domain->Domain links. + // Check for circular Domain->Domain links. // This causes bad insanity! // // For example: diff --git a/lib/events.js b/lib/events.js index 2d7ae8945ff0b2..62fa33463d678e 100644 --- a/lib/events.js +++ b/lib/events.js @@ -374,7 +374,7 @@ EventEmitter.prototype.removeAllListeners = if (events === undefined) return this; - // not listening for removeListener, no need to emit + // Not listening for removeListener, no need to emit if (events.removeListener === undefined) { if (arguments.length === 0) { this._events = Object.create(null); diff --git a/lib/fs.js b/lib/fs.js index dc311ee1b1ac38..e8ba400a4b1de1 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -383,7 +383,7 @@ function readFileSync(path, options) { fs.closeSync(fd); if (size === 0) { - // data was collected into the buffers list. + // Data was collected into the buffers list. buffer = Buffer.concat(buffers, pos); } else if (pos < size) { buffer = buffer.slice(0, pos); @@ -649,7 +649,7 @@ function truncateSync(path, len) { if (len === undefined) { len = 0; } - // allow error to be thrown, but still close fd. + // Allow error to be thrown, but still close fd. const fd = fs.openSync(path, 'r+'); let ret; @@ -1453,7 +1453,7 @@ function realpathSync(p, options) { pos = result + 1; } - // continue if not a symlink, break if a pipe/socket + // Continue if not a symlink, break if a pipe/socket if (knownHard[base] || (cache && cache.get(base) === base)) { if (isFileType(statValues, S_IFIFO) || isFileType(statValues, S_IFSOCK)) { @@ -1599,7 +1599,7 @@ function realpath(p, options, callback) { pos = result + 1; } - // continue if not a symlink, break if a pipe/socket + // Continue if not a symlink, break if a pipe/socket if (knownHard[base]) { if (isFileType(statValues, S_IFIFO) || isFileType(statValues, S_IFSOCK)) { @@ -1614,7 +1614,7 @@ function realpath(p, options, callback) { function gotStat(err, stats) { if (err) return callback(err); - // if not a symlink, skip to the next path part + // If not a symlink, skip to the next path part if (!stats.isSymbolicLink()) { knownHard[base] = true; return process.nextTick(LOOP); diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index f15bf14d230139..9506604b5de379 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -99,7 +99,7 @@ const handleConversion = { // if the socket was created by net.Server if (socket.server) { - // the worker should keep track of the socket + // The worker should keep track of the socket message.key = socket.server._connectionKey; var firstTime = !this.channel.sockets.send[message.key]; @@ -383,15 +383,15 @@ ChildProcess.prototype.spawn = function(options) { continue; } - // stream is already cloned and piped, so close + // The stream is already cloned and piped, thus close it. if (stream.type === 'wrap') { stream.handle.close(); continue; } if (stream.handle) { - // when i === 0 - we're dealing with stdin - // (which is the only one writable pipe) + // When i === 0 - we're dealing with stdin + // (which is the only one writable pipe). stream.socket = createSocket(this.pid !== 0 ? stream.handle : null, i > 0); diff --git a/lib/internal/cluster/child.js b/lib/internal/cluster/child.js index 38d52948e56da3..d2f38a6b762b95 100644 --- a/lib/internal/cluster/child.js +++ b/lib/internal/cluster/child.js @@ -47,7 +47,7 @@ cluster._setupWorker = function() { } }; -// obj is a net#Server or a dgram#Socket object. +// `obj` is a net#Server or a dgram#Socket object. cluster._getServer = function(obj, options, cb) { let address = options.address; diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 4d566394bfb23c..6f1df1b6c15724 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -359,7 +359,7 @@ Console.prototype.trace = function trace(...args) { Console.prototype.assert = function assert(expression, ...args) { if (!expression) { args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`; - this.warn(...args); // the arguments will be formatted in warn() again + this.warn(...args); // The arguments will be formatted in warn() again } }; diff --git a/lib/internal/fs/read_file_context.js b/lib/internal/fs/read_file_context.js index d7543ffa5aafed..4961ee820a7e84 100644 --- a/lib/internal/fs/read_file_context.js +++ b/lib/internal/fs/read_file_context.js @@ -23,7 +23,7 @@ function readFileAfterRead(err, bytesRead) { else context.read(); } else { - // unknown size, just read until we don't get bytes. + // Unknown size, just read until we don't get bytes. context.buffers.push(context.buffer.slice(0, bytesRead)); context.read(); } diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index dc79a5b79abff1..695c991690d8d0 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -153,7 +153,7 @@ ReadStream.prototype._read = function(n) { else toRead = Math.min(this.end - this.bytesRead + 1, toRead); - // already read everything we were supposed to read! + // Already read everything we were supposed to read! // treat as EOF. if (toRead <= 0) return this.push(null); @@ -377,7 +377,7 @@ WriteStream.prototype.close = function(cb) { this.on('finish', this.destroy.bind(this)); } - // we use end() instead of destroy() because of + // We use end() instead of destroy() because of // https://github.com/nodejs/node/issues/2006 this.end(); }; diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 038c91443c7ea0..e329843df5ac65 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1737,7 +1737,7 @@ class Http2Stream extends Duplex { return !!(this[kState].flags & STREAM_FLAGS_HEADERS_SENT); } - // true if the Http2Stream was aborted abnormally. + // True if the Http2Stream was aborted abnormally. get aborted() { return !!(this[kState].flags & STREAM_FLAGS_ABORTED); } @@ -2245,7 +2245,7 @@ class ServerHttp2Stream extends Http2Stream { this[kAuthority] = headers[HTTP2_HEADER_AUTHORITY]; } - // true if the remote peer accepts push streams + // True if the remote peer accepts push streams get pushAllowed() { return !this.destroyed && !this.closed && @@ -2634,7 +2634,7 @@ function sessionOnError(error) { // When the session times out on the server, try emitting a timeout event. // If no handler is registered, destroy the session. function sessionOnTimeout() { - // if destroyed or closed already, do nothing + // If destroyed or closed already, do nothing if (this.destroyed || this.closed) return; const server = this[kServer]; diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index b7ded66157d565..def440da63c41c 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -235,7 +235,7 @@ function tryPackage(requestPath, exts, isMain) { // Set to an empty Map to reset. const realpathCache = new Map(); -// check if the file exists and is not a directory +// Check if the file exists and is not a directory // if using --preserve-symlinks and isMain is false, // keep symlinks intact, otherwise resolve to the // absolute realpath. @@ -907,7 +907,7 @@ Module._initPaths = function() { modulePaths = paths; - // clone as a shallow copy, for introspection. + // Clone as a shallow copy, for introspection. Module.globalPaths = modulePaths.slice(0); }; diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 28b9afe1cf9404..fa0334b8bfb2b0 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -262,7 +262,7 @@ function buildAllowedFlags() { constructor(...args) { super(...args); - // the super constructor consumes `add`, but + // The super constructor consumes `add`, but // disallow any future adds. this.add = () => this; } diff --git a/lib/internal/process/warning.js b/lib/internal/process/warning.js index eb90a7092959d8..223d8307bfaa50 100644 --- a/lib/internal/process/warning.js +++ b/lib/internal/process/warning.js @@ -46,7 +46,7 @@ function onOpen(cb) { } function onAcquired(message) { - // make a best effort attempt at writing the message + // Make a best effort attempt at writing the message // to the fd. Errors are ignored at this point. return (err, fd) => { if (err) diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index cc8e218498f995..810132c0cb2c86 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -31,7 +31,7 @@ function readAndResolve(iter) { } function onReadable(iter) { - // we wait for the next tick, because it might + // We wait for the next tick, because it might // emit an error with process.nextTick process.nextTick(readAndResolve, iter); } @@ -58,7 +58,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ }, next() { - // if we have detected an error in the meanwhile + // If we have detected an error in the meanwhile // reject straight away const error = this[kError]; if (error !== null) { @@ -95,7 +95,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ if (lastPromise) { promise = new Promise(wrapForNext(lastPromise, this)); } else { - // fast path needed to support multiple this.push() + // Fast path needed to support multiple this.push() // without triggering the next() queue const data = this[kStream].read(); if (data !== null) { @@ -160,7 +160,7 @@ const createReadableStreamAsyncIterator = (stream) => { finished(stream, (err) => { if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { const reject = iterator[kLastReject]; - // reject if we are waiting for data in the Promise + // Reject if we are waiting for data in the Promise // returned by next() and store the error if (reject !== null) { iterator[kLastPromise] = null; diff --git a/lib/internal/streams/legacy.js b/lib/internal/streams/legacy.js index 9790696bfc7131..41f39cc5f441bf 100644 --- a/lib/internal/streams/legacy.js +++ b/lib/internal/streams/legacy.js @@ -50,7 +50,7 @@ Stream.prototype.pipe = function(dest, options) { if (typeof dest.destroy === 'function') dest.destroy(); } - // don't leave dangling pipes when there are errors. + // Don't leave dangling pipes when there are errors. function onerror(er) { cleanup(); if (EE.listenerCount(this, 'error') === 0) { @@ -61,7 +61,7 @@ Stream.prototype.pipe = function(dest, options) { source.on('error', onerror); dest.on('error', onerror); - // remove all the event listeners that were added. + // Remove all the event listeners that were added. function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); diff --git a/lib/internal/timers.js b/lib/internal/timers.js index 3eb7192e2b0a5d..5b61696fc46328 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -62,7 +62,7 @@ function Timeout(callback, after, args, isRepeat) { '\nTimeout duration was set to 1.', 'TimeoutOverflowWarning'); } - after = 1; // schedule on next tick, follows browser behavior + after = 1; // Schedule on next tick, follows browser behavior } this._idleTimeout = after; diff --git a/lib/internal/url.js b/lib/internal/url.js index 81a4966288657e..c6d9ef8864a8e6 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1102,7 +1102,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', { const key = list[i]; const value = list[i + 1]; callback.call(thisArg, value, key, this); - // in case the URL object's `search` is updated + // In case the URL object's `search` is updated list = this[searchParams]; i += 2; } @@ -1369,7 +1369,7 @@ function pathToFileURL(filepath) { const outURL = new URL('file://'); if (resolved.includes('%')) resolved = resolved.replace(percentRegEx, '%25'); - // in posix, "/" is a valid character in paths + // In posix, "/" is a valid character in paths if (!isWindows && resolved.includes('\\')) resolved = resolved.replace(backslashRegEx, '%5C'); if (resolved.includes('\n')) diff --git a/lib/net.js b/lib/net.js index 46d4994927a6d0..e46dea49282c73 100644 --- a/lib/net.js +++ b/lib/net.js @@ -302,7 +302,7 @@ function Socket(options) { } } - // shut down the socket when we're finished with it. + // Shut down the socket when we're finished with it. this.on('end', onReadableStreamEnd); initSocketHandle(this); @@ -314,7 +314,7 @@ function Socket(options) { // buffer. if not, then this will happen when we connect if (this._handle && options.readable !== false) { if (options.pauseOnCreate) { - // stop the handle from reading and pause the stream + // Stop the handle from reading and pause the stream this._handle.reading = false; this._handle.readStop(); this.readableFlowing = false; @@ -377,7 +377,7 @@ function afterShutdown(status) { this.callback(); - // callback may come after call to destroy. + // Callback may come after call to destroy. if (self.destroyed) return; @@ -1069,7 +1069,7 @@ function afterConnect(status, handle, req, readable, writable) { self.emit('connect'); self.emit('ready'); - // start the first read, or get an immediate EOF. + // Start the first read, or get an immediate EOF. // this doesn't actually consume any bytes, because len=0. if (readable && !self.isPaused()) self.read(0); diff --git a/lib/querystring.js b/lib/querystring.js index 5839ca6b0d0d0b..bfb6fa33327d0c 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -62,7 +62,7 @@ const unhexTable = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // ... 255 ]; -// a safe fast alternative to decodeURIComponent +// A safe fast alternative to decodeURIComponent function unescapeBuffer(s, decodeSpaces) { var out = Buffer.allocUnsafe(s.length); var index = 0; diff --git a/lib/readline.js b/lib/readline.js index 9865b78adc9e99..46fc3047709915 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -183,7 +183,7 @@ function Interface(input, output, completer, terminal) { function onkeypress(s, key) { self._ttyWrite(s, key); if (key && key.sequence) { - // if the key.sequence is half of a surrogate pair + // If the key.sequence is half of a surrogate pair // (>= 0xd800 and <= 0xdfff), refresh the line so // the character is displayed appropriately. const ch = key.sequence.codePointAt(0); @@ -320,10 +320,10 @@ Interface.prototype._writeToOutput = function _writeToOutput(stringToWrite) { Interface.prototype._addHistory = function() { if (this.line.length === 0) return ''; - // if the history is disabled then return the line + // If the history is disabled then return the line if (this.historySize === 0) return this.line; - // if the trimmed line is empty then return the line + // If the trimmed line is empty then return the line if (this.line.trim().length === 0) return this.line; if (this.history.length === 0 || this.history[0] !== this.line) { @@ -470,7 +470,7 @@ Interface.prototype._insertString = function(c) { this._writeToOutput(c); } - // a hack to get the line refreshed if it's needed + // A hack to get the line refreshed if it's needed this._moveCursor(0); } }; diff --git a/lib/timers.js b/lib/timers.js index 14151d6d81d63e..9b3a1d65b1b75a 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -234,7 +234,7 @@ function insert(item, refed, start) { function TimersList(expiry, msecs) { this._idleNext = this; // Create the list with the linkedlist properties to - this._idlePrev = this; // prevent any unnecessary hidden class changes. + this._idlePrev = this; // Prevent any unnecessary hidden class changes. this.expiry = expiry; this.id = timerListId++; this.msecs = msecs; @@ -410,7 +410,7 @@ exports.unenroll = util.deprecate(unenroll, function enroll(item, msecs) { msecs = validateTimerDuration(msecs); - // if this item was already in a list somewhere + // If this item was already in a list somewhere // then we should unenroll it from that if (item._idleNext) unenroll(item); diff --git a/lib/url.js b/lib/url.js index 0e02dbc1312101..78dcbe713010e9 100644 --- a/lib/url.js +++ b/lib/url.js @@ -345,14 +345,14 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { // pull out port. this.parseHost(); - // we've indicated that there is a hostname, + // We've indicated that there is a hostname, // so even if it's empty, it has to be present. if (typeof this.hostname !== 'string') this.hostname = ''; var hostname = this.hostname; - // if hostname begins with [ and ends with ] + // If hostname begins with [ and ends with ] // assume that it's an IPv6 address. var ipv6Hostname = hostname.charCodeAt(0) === CHAR_LEFT_SQUARE_BRACKET && hostname.charCodeAt(hostname.length - 1) === CHAR_RIGHT_SQUARE_BRACKET; @@ -527,9 +527,9 @@ function autoEscapeStr(rest) { return escaped; } -// format a parsed object into a url string +// Format a parsed object into a url string function urlFormat(urlObject, options) { - // ensure it's an object, and not a string url. + // Ensure it's an object, and not a string url. // If it's an object, this is a no-op. // this way, you can call urlParse() on strings // to clean up potentially wonky urls. @@ -678,7 +678,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result[tkey] = this[tkey]; } - // hash is always overridden, no matter what. + // Hash is always overridden, no matter what. // even href="" will remove it. result.hash = relative.hash; @@ -688,9 +688,9 @@ Url.prototype.resolveObject = function resolveObject(relative) { return result; } - // hrefs like //foo/bar always cut to the protocol. + // Hrefs like //foo/bar always cut to the protocol. if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative + // Take everything except the protocol from relative var rkeys = Object.keys(relative); for (var rk = 0; rk < rkeys.length; rk++) { var rkey = rkeys[rk]; @@ -709,7 +709,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { } if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing + // If it's a known url protocol, then changing // the protocol does weird things // first, if it's not file:, then we MUST have a host, // and if there was a path @@ -770,7 +770,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { var noLeadingSlashes = result.protocol && !slashedProtocol.has(result.protocol); - // if the url is a non-slashed url, then relative + // If the url is a non-slashed url, then relative // links like ../.. should be able // to crawl up to the hostname, as well. This is strange. // result.protocol has already been set by now. diff --git a/lib/util.js b/lib/util.js index 82c92ad0be47cf..6bc255d694d0de 100644 --- a/lib/util.js +++ b/lib/util.js @@ -149,7 +149,7 @@ function formatWithOptions(inspectOptions, f) { str += f.slice(lastPos, i); lastPos = i + 1; continue; - default: // any other character is not a correct placeholder + default: // Any other character is not a correct placeholder continue; } if (lastPos !== i - 1) diff --git a/test/abort/test-addon-uv-handle-leak.js b/test/abort/test-addon-uv-handle-leak.js index 0bfb6cdb94b72d..47751954ab5728 100644 --- a/test/abort/test-addon-uv-handle-leak.js +++ b/test/abort/test-addon-uv-handle-leak.js @@ -45,7 +45,7 @@ if (process.argv[2] === 'child') { let state = 'initial'; - // parse output that is formatted like this: + // Parse output that is formatted like this: // uv loop at [0x559b65ed5770] has active handles // [0x7f2de0018430] timer diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index 7d1a37bd96055e..0160591746dc2e 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -10,7 +10,7 @@ const assert = require('assert'); const tmpdir = require('../../common/tmpdir'); tmpdir.refresh(); -// make a path that is more than 260 chars long. +// Make a path that is more than 260 chars long. // Any given folder cannot have a name longer than 260 characters, // so create 10 nested folders each with 30 character long names. let addonDestinationDir = path.resolve(tmpdir.path); diff --git a/test/addons/openssl-client-cert-engine/test.js b/test/addons/openssl-client-cert-engine/test.js index 1c0e4564a5c3e9..6466b0fd9d31ef 100644 --- a/test/addons/openssl-client-cert-engine/test.js +++ b/test/addons/openssl-client-cert-engine/test.js @@ -39,7 +39,7 @@ const server = https.createServer(serverOptions, (req, res) => { port: server.address().port, path: '/test', clientCertEngine: engine, // engine will provide key+cert - rejectUnauthorized: false, // prevent failing on self-signed certificates + rejectUnauthorized: false, // Prevent failing on self-signed certificates headers: {} }; diff --git a/test/async-hooks/test-callback-error.js b/test/async-hooks/test-callback-error.js index b52823c930677c..07293e0315931c 100644 --- a/test/async-hooks/test-callback-error.js +++ b/test/async-hooks/test-callback-error.js @@ -30,7 +30,7 @@ switch (arg) { return; } -// this part should run only for the master test +// This part should run only for the master test assert.ok(!arg); { // console.log should stay until this test's flakiness is solved diff --git a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js index 341b7b4c5dfd89..52a312dbdfe196 100644 --- a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js +++ b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js @@ -17,7 +17,7 @@ p.then(function afterResolution(val) { return val; }); -// init hooks after chained promise is created +// Init hooks after chained promise is created const hooks = initHooks(); hooks._allowNoInit = true; hooks.enable(); diff --git a/test/common/index.js b/test/common/index.js index 3d72a876eac281..26a8fb4befa6c2 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -236,7 +236,7 @@ function platformTimeout(ms) { ms = multipliers.two * ms; if (isAIX) - return multipliers.two * ms; // default localhost speed is slower on AIX + return multipliers.two * ms; // Default localhost speed is slower on AIX if (process.arch !== 'arm') return ms; diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index a8d97869703e58..a989d687b0bdf4 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -85,7 +85,7 @@ if (process.argv[2] !== 'child') { // Handle the death of workers worker.on('exit', function(code, signal) { - // don't consider this the true death if the worker + // Don't consider this the true death if the worker // has finished successfully // or if the exit code is 0 if (worker.isDone || code === 0) { @@ -219,7 +219,7 @@ if (process.argv[2] === 'child') { }); listenSocket.on('message', function(buf, rinfo) { - // receive udp messages only sent from parent + // Receive udp messages only sent from parent if (rinfo.address !== bindAddress) return; console.error('[CHILD] %s received %s from %j', diff --git a/test/internet/test-dns-promises-resolve.js b/test/internet/test-dns-promises-resolve.js index 430f4251379097..6291e0365c2fa4 100644 --- a/test/internet/test-dns-promises-resolve.js +++ b/test/internet/test-dns-promises-resolve.js @@ -31,7 +31,7 @@ const dnsPromises = require('dns').promises; ); } -// rrtype is undefined, it's same as resolve4 +// Setting rrtype to undefined should work like resolve4. { (async function() { const rrtype = undefined; diff --git a/test/js-native-api/test_array/test.js b/test/js-native-api/test_array/test.js index 75c181d9da8269..4ec05596cf63bc 100644 --- a/test/js-native-api/test_array/test.js +++ b/test/js-native-api/test_array/test.js @@ -45,7 +45,7 @@ assert.strictEqual(test_array.TestHasElement(array, array.length + 1), false); assert(test_array.NewWithLength(0) instanceof Array); assert(test_array.NewWithLength(1) instanceof Array); -// check max allowed length for an array 2^32 -1 +// Check max allowed length for an array 2^32 -1 assert(test_array.NewWithLength(4294967295) instanceof Array); { diff --git a/test/js-native-api/test_typedarray/test.js b/test/js-native-api/test_typedarray/test.js index 2a8cf18feb866c..91e17ecbe8bb2a 100644 --- a/test/js-native-api/test_typedarray/test.js +++ b/test/js-native-api/test_typedarray/test.js @@ -38,7 +38,7 @@ assert.strictEqual(externalResult[0], 0); assert.strictEqual(externalResult[1], 1); assert.strictEqual(externalResult[2], 2); -// validate creation of all kinds of TypedArrays +// Validate creation of all kinds of TypedArrays const buffer = new ArrayBuffer(128); const arrayTypes = [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, diff --git a/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js b/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js index fbf88d41650d24..703dd243760bb1 100644 --- a/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js +++ b/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js @@ -16,7 +16,7 @@ const BYE = 'bye'; if (cluster.isMaster) { const worker1 = cluster.fork(); - // verify that Windows doesn't support this scenario + // Verify that Windows doesn't support this scenario worker1.on('error', (err) => { if (err.code === 'ENOTSUP') throw err; }); diff --git a/test/known_issues/test-inspector-cluster-port-clash.js b/test/known_issues/test-inspector-cluster-port-clash.js index bc04e9907b168b..0c5580530995a5 100644 --- a/test/known_issues/test-inspector-cluster-port-clash.js +++ b/test/known_issues/test-inspector-cluster-port-clash.js @@ -29,7 +29,7 @@ function serialFork() { return new Promise((res) => { const worker = cluster.fork(); worker.on('error', (err) => assert.fail(err)); - // no common.mustCall since 1 out of 3 should fail + // No common.mustCall since 1 out of 3 should fail worker.on('online', () => { worker.on('message', common.mustCall((message) => { ports.push(message.debugPort); @@ -50,7 +50,7 @@ function serialFork() { if (cluster.isMaster) { cluster.on('online', common.mustCall((worker) => worker.send('dbgport'), 2)); - // block one of the ports with a listening socket + // Block one of the ports with a listening socket const server = net.createServer(); server.listen(clashPort, common.localhostIPv4, common.mustCall(() => { // try to fork 3 workers No.2 should fail diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 8257a221c98e4a..18f55837ab4b4d 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -90,7 +90,7 @@ common.expectsError(() => b.write('', 2048), outOfBoundsError); // throw when writing to negative offset common.expectsError(() => b.write('a', -1), outOfBoundsError); -// throw when writing past bounds from the pool +// Throw when writing past bounds from the pool common.expectsError(() => b.write('a', 2048), outOfBoundsError); // throw when writing to negative offset @@ -290,7 +290,7 @@ Buffer.alloc(1).write('', 1, 0); assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu'); { - // test that regular and URL-safe base64 both work + // Test that regular and URL-safe base64 both work const expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]; assert.deepStrictEqual(Buffer.from('//++/++/++//', 'base64'), Buffer.from(expected)); @@ -319,7 +319,7 @@ assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu'); assert.strictEqual(quote.length, bytesWritten); assert.strictEqual(quote, b.toString('ascii', 0, quote.length)); - // check that the base64 decoder ignores whitespace + // Check that the base64 decoder ignores whitespace const expectedWhite = `${expected.slice(0, 60)} \n` + `${expected.slice(60, 120)} \n` + `${expected.slice(120, 180)} \n` + @@ -418,7 +418,7 @@ assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKio', 'base64').toString(), '*'.repeat(20)); -// handle padding graciously, multiple-of-4 or not +// Handle padding graciously, multiple-of-4 or not assert.strictEqual( Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw==', 'base64').length, 32 @@ -762,7 +762,7 @@ assert.strictEqual(x.inspect(), ''); // Call .fill() first, stops valgrind warning about uninitialized memory reads. Buffer.allocUnsafe(3.3).fill().toString(); -// throws bad argument error in commit 43cb4ec +// Throws bad argument error in commit 43cb4ec Buffer.alloc(3.3).fill().toString(); assert.strictEqual(Buffer.allocUnsafe(NaN).length, 0); assert.strictEqual(Buffer.allocUnsafe(3.3).length, 3); @@ -809,7 +809,7 @@ common.expectsError( outOfRangeError ); -// ensure negative values can't get past offset +// Ensure negative values can't get past offset common.expectsError( () => Buffer.allocUnsafe(8).writeFloatLE(0.0, -1), outOfRangeError diff --git a/test/parallel/test-buffer-bytelength.js b/test/parallel/test-buffer-bytelength.js index 06cdda0b2feba9..3d419b316521e0 100644 --- a/test/parallel/test-buffer-bytelength.js +++ b/test/parallel/test-buffer-bytelength.js @@ -74,7 +74,7 @@ assert.strictEqual(Buffer.byteLength('∑éllö wørl∂!', 'utf-8'), 19); assert.strictEqual(Buffer.byteLength('κλμνξο', 'utf8'), 12); assert.strictEqual(Buffer.byteLength('挵挶挷挸挹', 'utf-8'), 15); assert.strictEqual(Buffer.byteLength('𠝹𠱓𠱸', 'UTF8'), 12); -// without an encoding, utf8 should be assumed +// Without an encoding, utf8 should be assumed assert.strictEqual(Buffer.byteLength('hey there'), 9); assert.strictEqual(Buffer.byteLength('𠱸挶νξ#xx :)'), 17); assert.strictEqual(Buffer.byteLength('hello world', ''), 11); diff --git a/test/parallel/test-buffer-copy.js b/test/parallel/test-buffer-copy.js index 82b71a1dd818e8..ec227a93741ec2 100644 --- a/test/parallel/test-buffer-copy.js +++ b/test/parallel/test-buffer-copy.js @@ -37,7 +37,7 @@ let cntr = 0; } { - // copy c into b, without specifying sourceEnd + // Copy c into b, without specifying sourceEnd b.fill(++cntr); c.fill(++cntr); const copied = c.copy(b, 0, 0); @@ -48,7 +48,7 @@ let cntr = 0; } { - // copy c into b, without specifying sourceStart + // Copy c into b, without specifying sourceStart b.fill(++cntr); c.fill(++cntr); const copied = c.copy(b, 0); @@ -135,7 +135,7 @@ common.expectsError( // When sourceStart is greater than sourceEnd, zero copied assert.strictEqual(b.copy(c, 0, 100, 10), 0); -// when targetStart > targetLength, zero copied +// When targetStart > targetLength, zero copied assert.strictEqual(b.copy(c, 512, 0, 10), 0); // Test that the `target` can be a Uint8Array. diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js index 006961173d2b0a..2a163f9e0c628e 100644 --- a/test/parallel/test-buffer-includes.js +++ b/test/parallel/test-buffer-includes.js @@ -287,7 +287,7 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { ); }); -// test truncation of Number arguments to uint8 +// Test truncation of Number arguments to uint8 { const buf = Buffer.from('this is a test'); assert.ok(buf.includes(0x6973)); diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 32176fe03c93dc..0f7d7824366215 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -175,7 +175,7 @@ assert.strictEqual( ); -// test optional offset with passed encoding +// Test optional offset with passed encoding assert.strictEqual(Buffer.from('aaaa0').indexOf('30', 'hex'), 4); assert.strictEqual(Buffer.from('aaaa00a').indexOf('3030', 'hex'), 4); @@ -581,7 +581,7 @@ assert.strictEqual(reallyLong.lastIndexOf(pattern), 3932160); pattern = reallyLong.slice(0, 2000000); // first 2/5ths. assert.strictEqual(reallyLong.lastIndexOf(pattern), 0); -// test truncation of Number arguments to uint8 +// Test truncation of Number arguments to uint8 { const buf = Buffer.from('this is a test'); assert.strictEqual(buf.indexOf(0x6973), 3); diff --git a/test/parallel/test-buffer-read.js b/test/parallel/test-buffer-read.js index 4c9f92259d3a7b..1adf0303566380 100644 --- a/test/parallel/test-buffer-read.js +++ b/test/parallel/test-buffer-read.js @@ -21,7 +21,7 @@ read(buf, 'readDoubleLE', [1], -6.966010051009108e+144); read(buf, 'readFloatBE', [1], -1.6691549692541768e+37); read(buf, 'readFloatLE', [1], -7861303808); -// testing basic functionality of readInt8() +// Testing basic functionality of readInt8() read(buf, 'readInt8', [1], -3); // Testing basic functionality of readInt16BE() and readInt16LE() @@ -36,7 +36,7 @@ read(buf, 'readInt32LE', [1], -806729475); read(buf, 'readIntBE', [1, 1], -3); read(buf, 'readIntLE', [2, 1], 0x48); -// testing basic functionality of readUInt8() +// Testing basic functionality of readUInt8() read(buf, 'readUInt8', [1], 0xfd); // Testing basic functionality of readUInt16BE() and readUInt16LE() diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index cfea22b02cfd12..cb10a414771372 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -39,7 +39,7 @@ try { assert.strictEqual(e.name, 'RangeError'); } -// should work with number-coercible values +// Should work with number-coercible values assert.strictEqual(SlowBuffer('6').length, 6); assert.strictEqual(SlowBuffer(true).length, 1); diff --git a/test/parallel/test-buffer-tostring-range.js b/test/parallel/test-buffer-tostring-range.js index a06163bac2df9a..9cda0d833559f2 100644 --- a/test/parallel/test-buffer-tostring-range.js +++ b/test/parallel/test-buffer-tostring-range.js @@ -11,13 +11,13 @@ assert.strictEqual(rangeBuffer.toString('ascii', +Infinity), ''); assert.strictEqual(rangeBuffer.toString('ascii', 3.14, 3), ''); assert.strictEqual(rangeBuffer.toString('ascii', 'Infinity', 3), ''); -// if end <= 0, empty string will be returned +// If end <= 0, empty string will be returned assert.strictEqual(rangeBuffer.toString('ascii', 1, 0), ''); assert.strictEqual(rangeBuffer.toString('ascii', 1, -1.2), ''); assert.strictEqual(rangeBuffer.toString('ascii', 1, -100), ''); assert.strictEqual(rangeBuffer.toString('ascii', 1, -Infinity), ''); -// if start < 0, start will be taken as zero +// If start < 0, start will be taken as zero assert.strictEqual(rangeBuffer.toString('ascii', -1, 3), 'abc'); assert.strictEqual(rangeBuffer.toString('ascii', -1.99, 3), 'abc'); assert.strictEqual(rangeBuffer.toString('ascii', -Infinity, 3), 'abc'); @@ -78,12 +78,12 @@ assert.strictEqual(rangeBuffer.toString('ascii', 0, '-1.99'), ''); assert.strictEqual(rangeBuffer.toString('ascii', 0, 1.99), 'a'); assert.strictEqual(rangeBuffer.toString('ascii', 0, true), 'a'); -// try toString() with a object as a encoding +// Try toString() with an object as an encoding assert.strictEqual(rangeBuffer.toString({ toString: function() { return 'ascii'; } }), 'abc'); -// try toString() with 0 and null as the encoding +// Try toString() with 0 and null as the encoding common.expectsError(() => { rangeBuffer.toString(0, 1, 2); }, { diff --git a/test/parallel/test-child-process-disconnect.js b/test/parallel/test-child-process-disconnect.js index a1aebf1e08a7cd..8ca39b5790e243 100644 --- a/test/parallel/test-child-process-disconnect.js +++ b/test/parallel/test-child-process-disconnect.js @@ -71,7 +71,7 @@ if (process.argv[2] === 'child') { let childFlag = false; let parentFlag = false; - // when calling .disconnect the event should emit + // When calling .disconnect the event should emit // and the disconnected flag should be true. child.on('disconnect', common.mustCall(function() { parentFlag = child.connected; diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js index 48521a7fdafe08..90ce482309b98f 100644 --- a/test/parallel/test-child-process-fork-net.js +++ b/test/parallel/test-child-process-fork-net.js @@ -35,7 +35,7 @@ if (process.argv[2] === 'child') { console.error(`[${id}] got socket ${m}`); - // will call .end('end') or .write('write'); + // Will call .end('end') or .write('write'); socket[m](m); socket.resume(); diff --git a/test/parallel/test-child-process-silent.js b/test/parallel/test-child-process-silent.js index ce916306d14e42..a2ebb3ffeb9385 100644 --- a/test/parallel/test-child-process-silent.js +++ b/test/parallel/test-child-process-silent.js @@ -50,7 +50,7 @@ if (process.argv[2] === 'pipe') { }); } else { - // testcase | start parent && child IPC test + // Testcase | start parent && child IPC test // testing: is stderr and stdout piped to parent const args = [process.argv[1], 'parent']; diff --git a/test/parallel/test-child-process-stdout-flush-exit.js b/test/parallel/test-child-process-stdout-flush-exit.js index 679d78269fc441..cc1fa83fa9aaec 100644 --- a/test/parallel/test-child-process-stdout-flush-exit.js +++ b/test/parallel/test-child-process-stdout-flush-exit.js @@ -23,7 +23,7 @@ const common = require('../common'); const assert = require('assert'); -// if child process output to console and exit +// If child process output to console and exit if (process.argv[2] === 'child') { console.log('hello'); for (let i = 0; i < 200; i++) { diff --git a/test/parallel/test-child-process-validate-stdio.js b/test/parallel/test-child-process-validate-stdio.js index 5e23a098841ed7..71edc0559755b2 100644 --- a/test/parallel/test-child-process-validate-stdio.js +++ b/test/parallel/test-child-process-validate-stdio.js @@ -14,7 +14,7 @@ assert.throws(() => _validateStdio('foo'), expectedError); // should throw if not a string or array assert.throws(() => _validateStdio(600), expectedError); -// should populate stdio with undefined if len < 3 +// Should populate stdio with undefined if len < 3 { const stdio1 = []; const result = _validateStdio(stdio1, false); @@ -24,7 +24,7 @@ assert.throws(() => _validateStdio(600), expectedError); assert.strictEqual(result.hasOwnProperty('ipcFd'), true); } -// should throw if stdio has ipc and sync is true +// Should throw if stdio has ipc and sync is true const stdio2 = ['ipc', 'ipc', 'ipc']; common.expectsError(() => _validateStdio(stdio2, true), { code: 'ERR_IPC_SYNC_FORK', type: Error } diff --git a/test/parallel/test-cli-syntax-eval.js b/test/parallel/test-cli-syntax-eval.js index cb4c4fd5688642..31fe2d3449d824 100644 --- a/test/parallel/test-cli-syntax-eval.js +++ b/test/parallel/test-cli-syntax-eval.js @@ -6,7 +6,7 @@ const { exec } = require('child_process'); const node = process.execPath; -// should throw if -c and -e flags are both passed +// Should throw if -c and -e flags are both passed ['-c', '--check'].forEach(function(checkFlag) { ['-e', '--eval'].forEach(function(evalFlag) { const args = [checkFlag, evalFlag, 'foo']; diff --git a/test/parallel/test-cli-syntax-piped-bad.js b/test/parallel/test-cli-syntax-piped-bad.js index 64e2d47931eea1..864497e8f75c94 100644 --- a/test/parallel/test-cli-syntax-piped-bad.js +++ b/test/parallel/test-cli-syntax-piped-bad.js @@ -6,7 +6,7 @@ const { spawnSync } = require('child_process'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] diff --git a/test/parallel/test-cli-syntax-piped-good.js b/test/parallel/test-cli-syntax-piped-good.js index 79716fcf394f56..b3467b037212ab 100644 --- a/test/parallel/test-cli-syntax-piped-good.js +++ b/test/parallel/test-cli-syntax-piped-good.js @@ -6,7 +6,7 @@ const { spawnSync } = require('child_process'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] diff --git a/test/parallel/test-cluster-disconnect-idle-worker.js b/test/parallel/test-cluster-disconnect-idle-worker.js index 5b7e73ba079115..63b8b925da0939 100644 --- a/test/parallel/test-cluster-disconnect-idle-worker.js +++ b/test/parallel/test-cluster-disconnect-idle-worker.js @@ -26,7 +26,7 @@ const cluster = require('cluster'); const fork = cluster.fork; if (cluster.isMaster) { - fork(); // it is intentionally called `fork` instead of + fork(); // It is intentionally called `fork` instead of fork(); // `cluster.fork` to test that `this` is not used cluster.disconnect(common.mustCall(() => { assert.deepStrictEqual(Object.keys(cluster.workers), []); diff --git a/test/parallel/test-cluster-disconnect.js b/test/parallel/test-cluster-disconnect.js index 1528233eb32df0..36def06a4c3dd2 100644 --- a/test/parallel/test-cluster-disconnect.js +++ b/test/parallel/test-cluster-disconnect.js @@ -52,7 +52,7 @@ if (cluster.isWorker) { }); }; - // test both servers created in the cluster + // Test both servers created in the cluster const testCluster = (cb) => { let done = 0; const portsArray = Array.from(serverPorts); diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index d6cccca5f3b2cd..7a3bc1c5cd1311 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -38,7 +38,7 @@ if (cluster.isMaster && process.argv.length !== 3) { const PIPE_NAME = common.PIPE; const worker = cluster.fork({ PIPE_NAME }); - // makes sure master is able to fork the worker + // Makes sure master is able to fork the worker cluster.on('fork', common.mustCall()); // makes sure the worker is ready @@ -57,14 +57,14 @@ if (cluster.isMaster && process.argv.length !== 3) { // Message from the child indicates it's ready and listening cp.on('message', common.mustCall(function() { const server = net.createServer().listen(PIPE_NAME, function() { - // message child process so that it can exit + // Message child process so that it can exit cp.send('end'); - // inform master about the unexpected situation + // Inform master about the unexpected situation process.send('PIPE should have been in use.'); }); server.on('error', function(err) { - // message to child process tells it to exit + // Message to child process tells it to exit cp.send('end'); // propagate error to parent process.send(err); diff --git a/test/parallel/test-cluster-master-kill.js b/test/parallel/test-cluster-master-kill.js index 4e21d8e906cfaf..2cc800398147f6 100644 --- a/test/parallel/test-cluster-master-kill.js +++ b/test/parallel/test-cluster-master-kill.js @@ -64,7 +64,7 @@ if (cluster.isWorker) { let alive = true; master.on('exit', common.mustCall((code) => { - // make sure that the master died on purpose + // Make sure that the master died on purpose assert.strictEqual(code, 0); // check worker process status diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index bb2d3495d95a4d..1f2978bdb5b406 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -67,7 +67,7 @@ if (cluster.isWorker) { // start worker const worker = cluster.fork(); - // when the worker is up and running, kill it + // When the worker is up and running, kill it worker.once('listening', common.mustCall(() => { worker.process.kill(KILL_SIGNAL); })); diff --git a/test/parallel/test-cluster-worker-no-exit.js b/test/parallel/test-cluster-worker-no-exit.js index d3ee67994bd474..7325759741592c 100644 --- a/test/parallel/test-cluster-worker-no-exit.js +++ b/test/parallel/test-cluster-worker-no-exit.js @@ -50,7 +50,7 @@ if (cluster.isMaster) { destroyed = true; }, 1000); }).once('exit', function() { - // worker should not exit while it has a connection + // Worker should not exit while it has a connection assert(destroyed, 'worker exited before connection destroyed'); success = true; }); diff --git a/test/parallel/test-cluster-worker-wait-server-close.js b/test/parallel/test-cluster-worker-wait-server-close.js index 849591e5734af9..ad3320327acd29 100644 --- a/test/parallel/test-cluster-worker-wait-server-close.js +++ b/test/parallel/test-cluster-worker-wait-server-close.js @@ -24,7 +24,7 @@ if (cluster.isWorker) { // Check worker events and properties process.once('disconnect', function() { - // disconnect should occur after socket close + // Disconnect should occur after socket close assert(serverClosed); clearInterval(keepOpen); }); diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index e94b6020652463..4a7a2fda683ef6 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -145,7 +145,7 @@ console.dirxml( // test console.trace() console.trace('This is a %j %d', { formatted: 'trace' }, 10, 'foo'); -// test console.time() and console.timeEnd() output +// Test console.time() and console.timeEnd() output console.time('label'); console.timeEnd('label'); diff --git a/test/parallel/test-constants.js b/test/parallel/test-constants.js index 945443d8866a2f..e68f972d36aa9a 100644 --- a/test/parallel/test-constants.js +++ b/test/parallel/test-constants.js @@ -19,7 +19,7 @@ assert.ok(binding.crypto); assert.strictEqual(binding[l][k][j], constants[j]); }); } - if (l !== 'os') { // top level os constant isn't currently copied + if (l !== 'os') { // Top level os constant isn't currently copied assert.strictEqual(binding[l][k], constants[k]); } }); diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 414404511f9064..c1abf12b8be3a3 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -199,7 +199,7 @@ for (const test of TEST_CASES) { } { - // trying to get tag before inputting all data: + // Trying to get tag before inputting all data: const encrypt = crypto.createCipheriv(test.algo, Buffer.from(test.key, 'hex'), Buffer.from(test.iv, 'hex'), @@ -209,7 +209,7 @@ for (const test of TEST_CASES) { } { - // trying to create cipher with incorrect IV length + // Trying to create cipher with incorrect IV length assert.throws(function() { crypto.createCipheriv( test.algo, diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 228e2cc8abdc81..bb0247bf5817b5 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -465,7 +465,7 @@ function testCipher1(key) { const plaintext = 'Keep this a secret? No! Tell everyone about node.js!'; const cipher = crypto.createCipher('aes192', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in hex let ciph = cipher.update(plaintext, 'utf8', 'hex'); // Only use binary or hex, not base64. @@ -488,7 +488,7 @@ function testCipher2(key) { 'jAfaFg**'; const cipher = crypto.createCipher('aes256', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in Base64 let ciph = cipher.update(plaintext, 'utf8', 'base64'); ciph += cipher.final('base64'); diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index dfa01e2422c23b..9f79abc70545dd 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -24,7 +24,7 @@ function testCipher1(key) { const plaintext = 'Keep this a secret? No! Tell everyone about node.js!'; const cipher = crypto.createCipher('aes192', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in hex let ciph = cipher.update(plaintext, 'utf8', 'hex'); // Only use binary or hex, not base64. @@ -61,7 +61,7 @@ function testCipher2(key) { 'jAfaFg**'; const cipher = crypto.createCipher('aes256', key); - // encrypt plaintext which is in utf8 format + // Encrypt plaintext which is in utf8 format // to a ciphertext which will be in Base64 let ciph = cipher.update(plaintext, 'utf8', 'base64'); ciph += cipher.final('base64'); diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 8e584100d9913b..5a63667c995b09 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -374,7 +374,7 @@ if (availableCurves.has('prime256v1') && availableHashes.has('sha256')) { crypto.createSign('SHA256').sign(ecPrivateKey); } -// invalid test: curve argument is undefined +// Invalid test: curve argument is undefined common.expectsError( () => crypto.createECDH(), { diff --git a/test/parallel/test-crypto-from-binary.js b/test/parallel/test-crypto-from-binary.js index 70bac93a9961cf..56d0cb72079f82 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -42,7 +42,7 @@ while (ucs2_control.length <= EXTERN_APEX) { } -// check resultant buffer and output string +// Check resultant buffer and output string const b = Buffer.from(ucs2_control + ucs2_control, 'ucs2'); // diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 60904cf08fec3d..de15f00bc918aa 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -81,7 +81,7 @@ assert.deepStrictEqual( `${cryptoType} with ${digest} digest failed to evaluate to expected hash` ); -// stream interface should produce the same result. +// Stream interface should produce the same result. assert.deepStrictEqual(a5, a3); assert.deepStrictEqual(a6, a3); assert.notStrictEqual(a7, undefined); diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index 4c85545b4e40b1..deacb45e8fa9dd 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -33,7 +33,7 @@ const { kMaxLength } = require('buffer'); const kMaxUint32 = Math.pow(2, 32) - 1; const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32); -// bump, we register a lot of exit listeners +// Bump, we register a lot of exit listeners process.setMaxListeners(256); common.expectWarning('DeprecationWarning', diff --git a/test/parallel/test-domain-http-server.js b/test/parallel/test-domain-http-server.js index 47e87b34be5bb3..5b1ef68106cfda 100644 --- a/test/parallel/test-domain-http-server.js +++ b/test/parallel/test-domain-http-server.js @@ -40,7 +40,7 @@ const server = http.createServer(function(req, res) { dom.on('error', function(er) { serverCaught++; console.log('horray! got a server error', er); - // try to send a 500. If that fails, oh well. + // Try to send a 500. If that fails, oh well. res.writeHead(500, { 'content-type': 'text/plain' }); res.end(er.stack || er.message || 'Unknown error'); }); @@ -50,7 +50,7 @@ const server = http.createServer(function(req, res) { // if you request 'baz', then it'll throw a JSON circular ref error. const data = JSON.stringify(objects[req.url.replace(/[^a-z]/g, '')]); - // this line will throw if you pick an unknown key + // This line will throw if you pick an unknown key assert.notStrictEqual(data, undefined); res.writeHead(200); diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index c38a07fef76b8c..e053d061610b11 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -48,7 +48,7 @@ const fileData = fs.readFileSync(filename); assert.strictEqual(Buffer.byteLength(data), fileData.length); -// test that appends data to a non empty file +// Test that appends data to a non empty file const filename2 = join(tmpdir.path, 'append-sync2.txt'); fs.writeFileSync(filename2, currentFileData); @@ -59,7 +59,7 @@ const fileData2 = fs.readFileSync(filename2); assert.strictEqual(Buffer.byteLength(data) + currentFileData.length, fileData2.length); -// test that appendFileSync accepts buffers +// Test that appendFileSync accepts buffers const filename3 = join(tmpdir.path, 'append-sync3.txt'); fs.writeFileSync(filename3, currentFileData); @@ -87,7 +87,7 @@ const fileData4 = fs.readFileSync(filename4); assert.strictEqual(Buffer.byteLength(String(num)) + currentFileData.length, fileData4.length); -// test that appendFile accepts file descriptors +// Test that appendFile accepts file descriptors const filename5 = join(tmpdir.path, 'append-sync5.txt'); fs.writeFileSync(filename5, currentFileData); diff --git a/test/parallel/test-fs-long-path.js b/test/parallel/test-fs-long-path.js index 74f63868b81054..11ec4d56fcea3f 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-long-path.js @@ -30,7 +30,7 @@ const assert = require('assert'); const tmpdir = require('../common/tmpdir'); -// make a path that will be at least 260 chars long. +// Make a path that will be at least 260 chars long. const fileNameLen = Math.max(260 - tmpdir.path.length - 1, 1); const fileName = path.join(tmpdir.path, 'x'.repeat(fileNameLen)); const fullPath = path.resolve(fileName); diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index d07aab53769299..f2ed9b9f68ed92 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -33,7 +33,7 @@ function nextdir() { return `test${++dirc}`; } -// mkdir creates directory using assigned path +// fs.mkdir creates directory using assigned path { const pathname = path.join(tmpdir.path, nextdir()); @@ -43,7 +43,7 @@ function nextdir() { })); } -// mkdir creates directory with assigned mode value +// fs.mkdir creates directory with assigned mode value { const pathname = path.join(tmpdir.path, nextdir()); diff --git a/test/parallel/test-fs-promises.js b/test/parallel/test-fs-promises.js index c4143fbb9bd027..749e0a6f087107 100644 --- a/test/parallel/test-fs-promises.js +++ b/test/parallel/test-fs-promises.js @@ -254,7 +254,7 @@ async function getHandle(dest) { await unlink(newLink); } - // testing readdir lists both files and directories + // Testing readdir lists both files and directories { const newDir = path.resolve(tmpDir, 'dir'); const newFile = path.resolve(tmpDir, 'foo.js'); @@ -326,8 +326,8 @@ async function getHandle(dest) { assert(stats.isDirectory()); } - // mkdirp require recursive option to be a boolean. - // Anything else generates an error. + // fs.mkdirp requires the recursive option to be of type boolean. + // Everything else generates an error. { const dir = path.join(tmpDir, nextdir(), nextdir()); ['', 1, {}, [], null, Symbol('test'), () => {}].forEach((recursive) => { diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index 740a3876a2d76c..b2b5192c789271 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -// simulate `cat readfile.js | node readfile.js` +// Simulate `cat readfile.js | node readfile.js` if (common.isWindows || common.isAIX) common.skip(`No /dev/stdin on ${process.platform}.`); diff --git a/test/parallel/test-fs-readfile-pipe.js b/test/parallel/test-fs-readfile-pipe.js index c9f7144c11a6f6..861ce20cfc798d 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -22,7 +22,7 @@ 'use strict'; const common = require('../common'); -// simulate `cat readfile.js | node readfile.js` +// Simulate `cat readfile.js | node readfile.js` if (common.isWindows || common.isAIX) common.skip(`No /dev/stdin on ${process.platform}.`); diff --git a/test/parallel/test-fs-readfile-zero-byte-liar.js b/test/parallel/test-fs-readfile-zero-byte-liar.js index ec0b9cf6922c8c..a3ba3985abd959 100644 --- a/test/parallel/test-fs-readfile-zero-byte-liar.js +++ b/test/parallel/test-fs-readfile-zero-byte-liar.js @@ -29,7 +29,7 @@ const fs = require('fs'); const dataExpected = fs.readFileSync(__filename, 'utf8'); -// sometimes stat returns size=0, but it's a lie. +// Sometimes stat returns size=0, but it's a lie. fs._fstat = fs.fstat; fs._fstatSync = fs.fstatSync; diff --git a/test/parallel/test-fs-readfilesync-pipe-large.js b/test/parallel/test-fs-readfilesync-pipe-large.js index cfa7ae06ac08e8..f8ad5a63318481 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -// simulate `cat readfile.js | node readfile.js` +// Simulate `cat readfile.js | node readfile.js` if (common.isWindows || common.isAIX) common.skip(`No /dev/stdin on ${process.platform}.`); diff --git a/test/parallel/test-fs-watchfile-bigint.js b/test/parallel/test-fs-watchfile-bigint.js index 76c619260e00d8..d5528bb2d3730f 100644 --- a/test/parallel/test-fs-watchfile-bigint.js +++ b/test/parallel/test-fs-watchfile-bigint.js @@ -52,7 +52,7 @@ const watcher = assert(prev.ino <= 0n); // Stop watching the file fs.unwatchFile(enoentFile); - watcher.stop(); // stopping a stopped watcher should be a noop + watcher.stop(); // Stopping a stopped watcher should be a noop } }, 2)); @@ -60,4 +60,4 @@ const watcher = // not trigger a 'stop' event. watcher.on('stop', common.mustCall(function onStop() {})); -watcher.start(); // starting a started watcher should be a noop +watcher.start(); // Starting a started watcher should be a noop diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index b3618792cdc756..0b28e0331d3f91 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -74,7 +74,7 @@ const watcher = assert(prev.ino <= 0); // Stop watching the file fs.unwatchFile(enoentFile); - watcher.stop(); // stopping a stopped watcher should be a noop + watcher.stop(); // Stopping a stopped watcher should be a noop } }, 2)); @@ -82,7 +82,7 @@ const watcher = // not trigger a 'stop' event. watcher.on('stop', common.mustCall(function onStop() {})); -watcher.start(); // starting a started watcher should be a noop +watcher.start(); // Starting a started watcher should be a noop // Watch events should callback with a filename on supported systems. // Omitting AIX. It works but not reliably. diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js index b137e55547201e..7f0ec116f1c632 100644 --- a/test/parallel/test-fs-write-file.js +++ b/test/parallel/test-fs-write-file.js @@ -82,7 +82,7 @@ fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) { })); })); -// test that writeFile accepts file descriptors +// Test that writeFile accepts file descriptors const filename4 = join(tmpdir.path, 'test4.txt'); fs.open(filename4, 'w+', common.mustCall(function(e, fd) { diff --git a/test/parallel/test-http-addrequest-localaddress.js b/test/parallel/test-http-addrequest-localaddress.js index ce2ae8d12e2b9a..5e4da01ab4a22d 100644 --- a/test/parallel/test-http-addrequest-localaddress.js +++ b/test/parallel/test-http-addrequest-localaddress.js @@ -15,17 +15,16 @@ const req = { agent.maxSockets = 0; -// localAddress is used when naming requests / sockets -// while using the Legacy API -// port 8080 is hardcoded since this does not create a network connection +// `localAddress` is used when naming requests / sockets while using the Legacy +// API. Port 8080 is hardcoded since this does not create a network connection. agent.addRequest(req, 'localhost', 8080, '127.0.0.1'); assert.strictEqual(Object.keys(agent.requests).length, 1); assert.strictEqual( Object.keys(agent.requests)[0], 'localhost:8080:127.0.0.1'); -// path is *not* used when naming requests / sockets -// port 8080 is hardcoded since this does not create a network connection +// `path` is *not* used when naming requests / sockets. +// Port 8080 is hardcoded since this does not create a network connection agent.addRequest(req, { host: 'localhost', port: 8080, diff --git a/test/parallel/test-http-agent-destroyed-socket.js b/test/parallel/test-http-agent-destroyed-socket.js index 7dbc1db9f93388..145dc484248ef0 100644 --- a/test/parallel/test-http-agent-destroyed-socket.js +++ b/test/parallel/test-http-agent-destroyed-socket.js @@ -49,7 +49,7 @@ const server = http.createServer(common.mustCall((req, res) => { request1.socket.destroy(); response.socket.once('close', common.mustCall(() => { - // assert request2 was removed from the queue + // Assert request2 was removed from the queue assert(!agent.requests[key]); process.nextTick(() => { // Assert that the same socket was not assigned to request2, diff --git a/test/parallel/test-http-agent-keepalive.js b/test/parallel/test-http-agent-keepalive.js index 917c4ee8101f9e..4d682a89ab7a54 100644 --- a/test/parallel/test-http-agent-keepalive.js +++ b/test/parallel/test-http-agent-keepalive.js @@ -39,7 +39,7 @@ const server = http.createServer(common.mustCall((req, res) => { res.destroy(); return; } else if (req.url === '/remote_close') { - // cache the socket, close it after a short delay + // Cache the socket, close it after a short delay const socket = res.connection; setImmediate(common.mustCall(() => socket.end())); } diff --git a/test/parallel/test-http-client-pipe-end.js b/test/parallel/test-http-client-pipe-end.js index 9aa645b12a2866..ee88ce3d96672a 100644 --- a/test/parallel/test-http-client-pipe-end.js +++ b/test/parallel/test-http-client-pipe-end.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// see https://github.com/joyent/node/issues/3257 +// See https://github.com/joyent/node/issues/3257 const common = require('../common'); const http = require('http'); diff --git a/test/parallel/test-http-incoming-matchKnownFields.js b/test/parallel/test-http-incoming-matchKnownFields.js index 14ba8acd021f68..4402cc519a8c76 100644 --- a/test/parallel/test-http-incoming-matchKnownFields.js +++ b/test/parallel/test-http-incoming-matchKnownFields.js @@ -7,7 +7,7 @@ function checkDest(field, result, value) { const dest = {}; const incomingMessage = new IncomingMessage(field); - // dest is changed by IncomingMessage._addHeaderLine + // Dest is changed by IncomingMessage._addHeaderLine if (value) incomingMessage._addHeaderLine(field, 'test', dest); incomingMessage._addHeaderLine(field, value, dest); diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index 8e63bdb8a9bbd2..c3aa86fc745b7b 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -45,7 +45,7 @@ const server = http.createServer(common.mustCall(function(req, res) { server.emit('requestDone'); }); - // in one case, actually send a response in 2 chunks + // In one case, actually send a response in 2 chunks case '/3': res.write('hello '); return setImmediate(function() { @@ -78,7 +78,7 @@ server.listen(0, common.mustCall(function() { countdown.dec(); }); - // immediately write the pipelined requests. + // Immediately write the pipelined requests. // Some of these will not have a socket to destroy! client.write(generator(seeds)); })); diff --git a/test/parallel/test-http-outgoing-finish.js b/test/parallel/test-http-outgoing-finish.js index 1fcd7cd0769db1..d5b94eb0f65b8f 100644 --- a/test/parallel/test-http-outgoing-finish.js +++ b/test/parallel/test-http-outgoing-finish.js @@ -48,7 +48,7 @@ function write(out) { let finishEvent = false; let endCb = false; - // first, write until it gets some backpressure + // First, write until it gets some backpressure while (out.write(buf)) {} // Now end, and make sure that we don't get the 'finish' event diff --git a/test/parallel/test-http-outgoing-settimeout.js b/test/parallel/test-http-outgoing-settimeout.js index 3dd27686153672..6e46973bc10631 100644 --- a/test/parallel/test-http-outgoing-settimeout.js +++ b/test/parallel/test-http-outgoing-settimeout.js @@ -17,7 +17,7 @@ const { OutgoingMessage } = require('http'); } { - // tests for settimeout method without socket + // Tests for settimeout method without socket const expectedMsecs = 23; const outgoingMessage = new OutgoingMessage(); outgoingMessage.setTimeout(expectedMsecs); diff --git a/test/parallel/test-http-readable-data-event.js b/test/parallel/test-http-readable-data-event.js index 1c48a451ef9714..ddaeca5fe7103c 100644 --- a/test/parallel/test-http-readable-data-event.js +++ b/test/parallel/test-http-readable-data-event.js @@ -13,7 +13,7 @@ const server = http.createServer((req, res) => { 'Content-Length': '' + (helloWorld.length + helloAgainLater.length) }); - // we need to make sure the data is flushed + // We need to make sure the data is flushed // before writing again next = () => { res.end(helloAgainLater); diff --git a/test/parallel/test-http-res-write-end-dont-take-array.js b/test/parallel/test-http-res-write-end-dont-take-array.js index 72268efcae3a84..39ac800d0d736c 100644 --- a/test/parallel/test-http-res-write-end-dont-take-array.js +++ b/test/parallel/test-http-res-write-end-dont-take-array.js @@ -61,7 +61,7 @@ server.once('request', common.mustCall((req, res) => { })); server.listen(0, function() { - // just make a request, other tests handle responses + // Just make a request, other tests handle responses http.get({ port: this.address().port }, (res) => { res.resume(); // do it again to test .end(Buffer); diff --git a/test/parallel/test-http-set-timeout-server.js b/test/parallel/test-http-set-timeout-server.js index 7984fdfc0ffbf0..793046e57f0786 100644 --- a/test/parallel/test-http-set-timeout-server.js +++ b/test/parallel/test-http-set-timeout-server.js @@ -58,7 +58,7 @@ test(function serverTimeout(cb) { test(function serverRequestTimeout(cb) { const server = http.createServer(common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -79,7 +79,7 @@ test(function serverRequestTimeout(cb) { test(function serverResponseTimeout(cb) { const server = http.createServer(common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = res.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -96,7 +96,7 @@ test(function serverResponseTimeout(cb) { test(function serverRequestNotTimeoutAfterEnd(cb) { const server = http.createServer(common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustNotCall()); assert.ok(s instanceof http.IncomingMessage); res.on('timeout', common.mustCall()); diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index 74eff427a43d30..3252ac7fc0af2a 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -97,7 +97,7 @@ server.on('listening', function() { }); }); -// now, see if the client sees the trailers. +// Now, see if the client sees the trailers. server.on('listening', function() { http.get({ port: this.address().port, diff --git a/test/parallel/test-http-upgrade-server2.js b/test/parallel/test-http-upgrade-server2.js index a6c142e60ac9aa..1a4d4038a50f8b 100644 --- a/test/parallel/test-http-upgrade-server2.js +++ b/test/parallel/test-http-upgrade-server2.js @@ -30,7 +30,7 @@ const server = http.createServer(function(req, res) { }); server.on('upgrade', function(req, socket, upgradeHead) { - // test that throwing an error from upgrade gets + // Test that throwing an error from upgrade gets // is uncaught throw new Error('upgrade error'); }); diff --git a/test/parallel/test-http-url.parse-auth-with-header-in-request.js b/test/parallel/test-http-url.parse-auth-with-header-in-request.js index eb96ac19c172ff..7a9a486bcc5dde 100644 --- a/test/parallel/test-http-url.parse-auth-with-header-in-request.js +++ b/test/parallel/test-http-url.parse-auth-with-header-in-request.js @@ -26,7 +26,7 @@ const http = require('http'); const url = require('url'); function check(request) { - // the correct authorization header is be passed + // The correct authorization header is be passed assert.strictEqual(request.headers.authorization, 'NoAuthForYOU'); } diff --git a/test/parallel/test-http-url.parse-auth.js b/test/parallel/test-http-url.parse-auth.js index ab597e132c8012..ac09c0e1b84216 100644 --- a/test/parallel/test-http-url.parse-auth.js +++ b/test/parallel/test-http-url.parse-auth.js @@ -26,7 +26,7 @@ const http = require('http'); const url = require('url'); function check(request) { - // the correct authorization header is be passed + // The correct authorization header is be passed assert.strictEqual(request.headers.authorization, 'Basic dXNlcjpwYXNzOg=='); } diff --git a/test/parallel/test-http-url.parse-basic.js b/test/parallel/test-http-url.parse-basic.js index c900d045d359b8..e68df80e9151d7 100644 --- a/test/parallel/test-http-url.parse-basic.js +++ b/test/parallel/test-http-url.parse-basic.js @@ -33,7 +33,7 @@ function check(request) { assert.strictEqual(request.method, 'GET'); // There are no URL params, so you should not see any assert.strictEqual(request.url, '/'); - // the host header should use the url.parse.hostname + // The host header should use the url.parse.hostname assert.strictEqual(request.headers.host, `${testURL.hostname}:${testURL.port}`); } @@ -51,7 +51,7 @@ server.listen(0, function() { // make the request const clientRequest = http.request(testURL); - // since there is a little magic with the agent + // Since there is a little magic with the agent // make sure that an http request uses the http.Agent assert.ok(clientRequest.agent instanceof http.Agent); clientRequest.end(); diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js index f58be0257c1fc5..6ca9e51e826859 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -54,7 +54,7 @@ server.listen(0, function() { // make the request const clientRequest = https.request(testURL); - // since there is a little magic with the agent + // Since there is a little magic with the agent // make sure that the request uses the https.Agent assert.ok(clientRequest.agent instanceof https.Agent); clientRequest.end(); diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index 83dfcfa20bdb1e..320359e3ec37bf 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -41,7 +41,7 @@ const s = http.createServer(common.mustCall((req, res) => { } ); - // undefined value should throw, via 979d0ca8 + // Undefined value should throw, via 979d0ca8 common.expectsError( () => res.setHeader('foo', undefined), { diff --git a/test/parallel/test-http2-client-destroy.js b/test/parallel/test-http2-client-destroy.js index 0a538e0f9e01e0..6c4adfe5b449c3 100644 --- a/test/parallel/test-http2-client-destroy.js +++ b/test/parallel/test-http2-client-destroy.js @@ -112,7 +112,7 @@ const Countdown = require('../common/countdown'); client.on('close', () => { server.close(); - // calling destroy in here should not matter + // Calling destroy in here should not matter client.destroy(); }); diff --git a/test/parallel/test-http2-client-onconnect-errors.js b/test/parallel/test-http2-client-onconnect-errors.js index ab166c22f0e9de..5c08478784924a 100644 --- a/test/parallel/test-http2-client-onconnect-errors.js +++ b/test/parallel/test-http2-client-onconnect-errors.js @@ -14,7 +14,7 @@ const { const http2 = require('http2'); const { NghttpError } = require('internal/http2/util'); -// tests error handling within requestOnConnect +// Tests error handling within requestOnConnect // - NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE (should emit session error) // - NGHTTP2_ERR_INVALID_ARGUMENT (should emit stream error) // - every other NGHTTP2 error from binding (should emit session error) diff --git a/test/parallel/test-http2-client-set-priority.js b/test/parallel/test-http2-client-set-priority.js index 411b762be89f0f..c41ec99031724a 100644 --- a/test/parallel/test-http2-client-set-priority.js +++ b/test/parallel/test-http2-client-set-priority.js @@ -27,7 +27,7 @@ const checkWeight = (actual, expect) => { })); }; -// when client weight is lower than 1, weight is 1 +// When client weight is lower than 1, weight is 1 checkWeight(-1, 1); checkWeight(0, 1); diff --git a/test/parallel/test-http2-compat-serverrequest-end.js b/test/parallel/test-http2-compat-serverrequest-end.js index 45a678d1a950d1..cee5fa47ad4744 100644 --- a/test/parallel/test-http2-compat-serverrequest-end.js +++ b/test/parallel/test-http2-compat-serverrequest-end.js @@ -18,7 +18,7 @@ server.listen(0, common.mustCall(function() { request.on('end', common.mustCall(() => { assert.strictEqual(request.complete, true); response.on('finish', common.mustCall(function() { - // the following tests edge cases on request socket + // The following tests edge cases on request socket // right after finished fires but before backing // Http2Stream is destroyed assert.strictEqual(request.socket.readable, request.stream.readable); diff --git a/test/parallel/test-http2-compat-serverresponse-createpushresponse.js b/test/parallel/test-http2-compat-serverresponse-createpushresponse.js index 1992d41af69a5d..5790a9942ce680 100644 --- a/test/parallel/test-http2-compat-serverresponse-createpushresponse.js +++ b/test/parallel/test-http2-compat-serverresponse-createpushresponse.js @@ -15,7 +15,7 @@ const server = h2.createServer((request, response) => { assert.strictEqual(response.stream.id % 2, 1); response.write(servExpect); - // callback must be specified (and be a function) + // Callback must be specified (and be a function) common.expectsError( () => response.createPushResponse({ ':path': '/pushed', diff --git a/test/parallel/test-http2-compat-serverresponse-end.js b/test/parallel/test-http2-compat-serverresponse-end.js index 0e846a5948e3cc..d7aaebca3d169c 100644 --- a/test/parallel/test-http2-compat-serverresponse-end.js +++ b/test/parallel/test-http2-compat-serverresponse-end.js @@ -253,7 +253,7 @@ const { } { - // finish should only trigger after 'end' is called + // Finish should only trigger after 'end' is called const server = createServer(mustCall((request, response) => { let finished = false; response.writeHead(HTTP_STATUS_OK, { foo: 'bar' }); diff --git a/test/parallel/test-http2-connect.js b/test/parallel/test-http2-connect.js index 6080dcb90e4c01..bef4ff79604ada 100644 --- a/test/parallel/test-http2-connect.js +++ b/test/parallel/test-http2-connect.js @@ -6,7 +6,7 @@ if (!hasCrypto) const { createServer, connect } = require('http2'); const { connect: netConnect } = require('net'); -// check for session connect callback and event +// Check for session connect callback and event { const server = createServer(); server.listen(0, mustCall(() => { diff --git a/test/parallel/test-http2-dont-lose-data.js b/test/parallel/test-http2-dont-lose-data.js index eb85277b7b124c..c73208f9555044 100644 --- a/test/parallel/test-http2-dont-lose-data.js +++ b/test/parallel/test-http2-dont-lose-data.js @@ -43,7 +43,7 @@ server.listen(0, () => { pushStream.on('end', common.mustCall(() => { assert.strictEqual(pushData, 'a push stream'); - // removing the setImmediate causes the test to pass + // Removing the setImmediate causes the test to pass setImmediate(function() { let data = ''; req.setEncoding('utf8'); diff --git a/test/parallel/test-http2-info-headers-errors.js b/test/parallel/test-http2-info-headers-errors.js index 6540747fd25a5f..a55e9df0269283 100644 --- a/test/parallel/test-http2-info-headers-errors.js +++ b/test/parallel/test-http2-info-headers-errors.js @@ -13,7 +13,7 @@ const { } = internalBinding('http2'); const { NghttpError } = require('internal/http2/util'); -// tests error handling within additionalHeaders +// Tests error handling within additionalHeaders // - every other NGHTTP2 error from binding (should emit stream error) const specificTestKeys = []; diff --git a/test/parallel/test-http2-misbehaving-multiplex.js b/test/parallel/test-http2-misbehaving-multiplex.js index b0b501eacbc5dd..3df3a6f893ddb8 100644 --- a/test/parallel/test-http2-misbehaving-multiplex.js +++ b/test/parallel/test-http2-misbehaving-multiplex.js @@ -17,7 +17,7 @@ server.on('stream', common.mustCall((stream) => { stream.respond(); stream.end('ok'); - // the error will be emitted asynchronously + // The error will be emitted asynchronously stream.on('error', common.expectsError({ type: NghttpError, code: 'ERR_HTTP2_ERROR', diff --git a/test/parallel/test-http2-respond-with-fd-errors.js b/test/parallel/test-http2-respond-with-fd-errors.js index f336d9caac1f8f..4e876c532fad45 100644 --- a/test/parallel/test-http2-respond-with-fd-errors.js +++ b/test/parallel/test-http2-respond-with-fd-errors.js @@ -18,7 +18,7 @@ const { } = internalBinding('http2'); const { NghttpError } = require('internal/http2/util'); -// tests error handling within processRespondWithFD +// Tests error handling within processRespondWithFD // (called by respondWithFD & respondWithFile) // - every other NGHTTP2 error from binding (should emit stream error) diff --git a/test/parallel/test-http2-server-errors.js b/test/parallel/test-http2-server-errors.js index bbdf312fc153d4..eeb9e79682e344 100644 --- a/test/parallel/test-http2-server-errors.js +++ b/test/parallel/test-http2-server-errors.js @@ -59,7 +59,7 @@ const h2 = require('http2'); })); server.on('stream', common.mustCall(function(stream) { - // there is no 'error' handler, and this will crash + // There is no 'error' handler, and this will crash stream.write('hello'); stream.resume(); diff --git a/test/parallel/test-http2-window-size.js b/test/parallel/test-http2-window-size.js index 164a778e1f8c54..adf4534d5bc92b 100644 --- a/test/parallel/test-http2-window-size.js +++ b/test/parallel/test-http2-window-size.js @@ -89,7 +89,7 @@ const initialWindowSizeList = [ (1 << 8) - 1, 1 << 8, 1 << 17, - undefined // use default window size which is (1 << 16) - 1 + undefined // Use default window size which is (1 << 16) - 1 ]; // Call `run` on each element in the cartesian product of buffersList and diff --git a/test/parallel/test-https-set-timeout-server.js b/test/parallel/test-https-set-timeout-server.js index e353f0afde5a92..c67155e9d53143 100644 --- a/test/parallel/test-https-set-timeout-server.js +++ b/test/parallel/test-https-set-timeout-server.js @@ -71,7 +71,7 @@ test(function serverRequestTimeout(cb) { const server = https.createServer( serverOptions, common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -95,7 +95,7 @@ test(function serverResponseTimeout(cb) { const server = https.createServer( serverOptions, common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = res.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); @@ -115,7 +115,7 @@ test(function serverRequestNotTimeoutAfterEnd(cb) { const server = https.createServer( serverOptions, common.mustCall((req, res) => { - // just do nothing, we should get a timeout event. + // Just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustNotCall()); assert.ok(s instanceof http.IncomingMessage); res.on('timeout', common.mustCall()); diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index a7f4b80716c917..f849ae800fc016 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -57,7 +57,7 @@ const cert3 = read('agent3-cert.pem'); const ca1 = read('ca1-cert.pem'); const ca2 = read('ca2-cert.pem'); -// different agents to use different CA lists. +// Different agents to use different CA lists. // this api is beyond bad. const agent0 = new https.Agent(); const agent1 = new https.Agent({ ca: [ca1] }); diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index bc81a8da0bc312..416adb39357ae1 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -65,7 +65,7 @@ test(function(parent, port) { s += c.toString(); }); res.on('end', function() { - // kill the worker before we start doing asserts. + // Kill the worker before we start doing asserts. // it's really annoying when tests leave orphans! parent.kill(); parent.on('exit', function() { diff --git a/test/parallel/test-net-keepalive.js b/test/parallel/test-net-keepalive.js index 49331abf040a30..9cc08af8fe4372 100644 --- a/test/parallel/test-net-keepalive.js +++ b/test/parallel/test-net-keepalive.js @@ -29,7 +29,7 @@ let clientConnection; const echoServer = net.createServer(function(connection) { serverConnection = connection; setTimeout(common.mustCall(function() { - // make sure both connections are still open + // Make sure both connections are still open assert.strictEqual(serverConnection.readyState, 'open'); assert.strictEqual(clientConnection.readyState, 'open'); serverConnection.end(); diff --git a/test/parallel/test-net-persistent-keepalive.js b/test/parallel/test-net-persistent-keepalive.js index 8756cd7d1b2960..85a2950273a6a3 100644 --- a/test/parallel/test-net-persistent-keepalive.js +++ b/test/parallel/test-net-persistent-keepalive.js @@ -8,7 +8,7 @@ let clientConnection; const echoServer = net.createServer(function(connection) { serverConnection = connection; setTimeout(function() { - // make sure both connections are still open + // Make sure both connections are still open assert.strictEqual(serverConnection.readyState, 'open'); assert.strictEqual(clientConnection.readyState, 'open'); serverConnection.end(); diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index e80731bc78fb0a..dda2d5acadb751 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -17,7 +17,7 @@ const server = net.createServer((socket) => { }); server.on('close', common.mustCall(() => { - // client and server should agree on the ports used + // Client and server should agree on the ports used assert.deepStrictEqual(serverRemotePorts, clientLocalPorts); assert.strictEqual(conns, 2); })); diff --git a/test/parallel/test-path-resolve.js b/test/parallel/test-path-resolve.js index abbbf4dd5f47b4..79c2d679204007 100644 --- a/test/parallel/test-path-resolve.js +++ b/test/parallel/test-path-resolve.js @@ -11,7 +11,7 @@ const backslashRE = /\\/g; const resolveTests = [ [ path.win32.resolve, - // arguments result + // Arguments result [[['c:/blah\\blah', 'd:/games', 'c:../a'], 'c:\\blah\\a'], [['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'], 'd:\\e.exe'], [['c:/ignore', 'c:/some/file'], 'c:\\some\\file'], diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 566a3eec546ba2..e54fa385fe3277 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -43,7 +43,7 @@ childProcess.exec( } ); -// test that preloading a throwing module aborts +// Test that preloading a throwing module aborts childProcess.exec( `"${nodeBinary}" ${preloadOption([fixtureA, fixtureThrows])} "${fixtureB}"`, function(err, stdout, stderr) { @@ -55,7 +55,7 @@ childProcess.exec( } ); -// test that preload can be used with --eval +// Test that preload can be used with --eval childProcess.exec( `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');"`, function(err, stdout, stderr) { @@ -64,7 +64,7 @@ childProcess.exec( } ); -// test that preload can be used with stdin +// Test that preload can be used with stdin const stdinProc = childProcess.spawn( nodeBinary, ['--require', fixtureA], @@ -132,7 +132,7 @@ childProcess.exec( } ); -// test that preloading with a relative path works +// Test that preloading with a relative path works process.chdir(fixtures.fixturesDir); childProcess.exec( `"${nodeBinary}" ${preloadOption(['./printA.js'])} "${fixtureB}"`, diff --git a/test/parallel/test-priority-queue.js b/test/parallel/test-priority-queue.js index f8526e6521c24b..f6318ede7ffbca 100644 --- a/test/parallel/test-priority-queue.js +++ b/test/parallel/test-priority-queue.js @@ -116,11 +116,11 @@ const PriorityQueue = require('internal/priority_queue'); queue.removeAt(5); assert.strictEqual(largest.position, 5); - // check that removing 2nd to last item works fine + // Check that removing 2nd to last item works fine queue.removeAt(6); assert.strictEqual(secondLargest.position, 6); - // check that removing the last item doesn't throw + // Check that removing the last item doesn't throw queue.removeAt(6); assert.strictEqual(queue.shift().value, 1); diff --git a/test/parallel/test-process-env-allowed-flags.js b/test/parallel/test-process-env-allowed-flags.js index dbc3b1ccd8c3c6..8b6adfb2224ad5 100644 --- a/test/parallel/test-process-env-allowed-flags.js +++ b/test/parallel/test-process-env-allowed-flags.js @@ -48,7 +48,7 @@ require('../common'); }); } -// assert all "canonical" flags begin with dash(es) +// Assert all "canonical" flags begin with dash(es) { process.allowedNodeEnvironmentFlags.forEach((flag) => { assert(/^--?[a-z8_-]+$/.test(flag), `Unexpected format for flag ${flag}`); diff --git a/test/parallel/test-process-external-stdio-close-spawn.js b/test/parallel/test-process-external-stdio-close-spawn.js index 93d7f795bd74ce..f7ee37c44629cd 100644 --- a/test/parallel/test-process-external-stdio-close-spawn.js +++ b/test/parallel/test-process-external-stdio-close-spawn.js @@ -7,7 +7,7 @@ const cp = require('child_process'); if (process.argv[2] === 'child') { process.on('message', common.mustCall((msg) => { assert.strictEqual(msg, 'go'); - // the following console.log is an integral part + // The following console.log is an integral part // of the test. If this regress, this call will // cause the process to exit with 1 console.log('logging should not cause a crash'); diff --git a/test/parallel/test-process-external-stdio-close.js b/test/parallel/test-process-external-stdio-close.js index 067a75ec93492a..9457161cf5ac91 100644 --- a/test/parallel/test-process-external-stdio-close.js +++ b/test/parallel/test-process-external-stdio-close.js @@ -7,7 +7,7 @@ const cp = require('child_process'); if (process.argv[2] === 'child') { process.on('message', common.mustCall((msg) => { assert.strictEqual(msg, 'go'); - // the following console.log is an integral part + // The following console.log is an integral part // of the test. If this regress, this call will // cause the process to exit with 1 console.log('logging should not cause a crash'); diff --git a/test/parallel/test-process-really-exit.js b/test/parallel/test-process-really-exit.js index c806d6c4aa4808..8445d220ca88b7 100644 --- a/test/parallel/test-process-really-exit.js +++ b/test/parallel/test-process-really-exit.js @@ -2,7 +2,7 @@ require('../common'); const assert = require('assert'); -// ensure that the reallyExit hook is executed. +// Ensure that the reallyExit hook is executed. // see: https://github.com/nodejs/node/issues/25650 if (process.argv[2] === 'subprocess') { process.reallyExit = function() { diff --git a/test/parallel/test-process-umask.js b/test/parallel/test-process-umask.js index 592463eca17a9d..85af91620709c7 100644 --- a/test/parallel/test-process-umask.js +++ b/test/parallel/test-process-umask.js @@ -44,7 +44,7 @@ const old = process.umask(mask); assert.strictEqual(process.umask(old), parseInt(mask, 8)); -// confirm reading the umask does not modify it. +// Confirm reading the umask does not modify it. // 1. If the test fails, this call will succeed, but the mask will be set to 0 assert.strictEqual(process.umask(), old); // 2. If the test fails, process.umask() will return 0 diff --git a/test/parallel/test-punycode.js b/test/parallel/test-punycode.js index 9f7f772e17b0fe..d7ad2ec21faa57 100644 --- a/test/parallel/test-punycode.js +++ b/test/parallel/test-punycode.js @@ -245,15 +245,15 @@ tests.forEach((testCase) => { // BMP code point assert.strictEqual(punycode.ucs2.encode([0x61]), 'a'); -// supplementary code point (surrogate pair) +// Supplementary code point (surrogate pair) assert.strictEqual(punycode.ucs2.encode([0x1D306]), '\uD834\uDF06'); // high surrogate assert.strictEqual(punycode.ucs2.encode([0xD800]), '\uD800'); -// high surrogate followed by non-surrogates +// High surrogate followed by non-surrogates assert.strictEqual(punycode.ucs2.encode([0xD800, 0x61, 0x62]), '\uD800ab'); // low surrogate assert.strictEqual(punycode.ucs2.encode([0xDC00]), '\uDC00'); -// low surrogate followed by non-surrogates +// Low surrogate followed by non-surrogates assert.strictEqual(punycode.ucs2.encode([0xDC00, 0x61, 0x62]), '\uDC00ab'); assert.strictEqual(errors, 0); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 72594ce719182d..175098aed77575 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -34,7 +34,7 @@ function createWithNoPrototype(properties) { }); return noProto; } -// folding block, commented to pass gjslint +// Folding block, commented to pass gjslint // {{{ // [ wonkyQS, canonicalQS, obj ] const qsTestCases = [ @@ -204,12 +204,12 @@ function check(actual, expected, input) { }); } -// test that the canonical qs is parsed properly. +// Test that the canonical qs is parsed properly. qsTestCases.forEach((testCase) => { check(qs.parse(testCase[0]), testCase[2], testCase[0]); }); -// test that the colon test cases can do the same +// Test that the colon test cases can do the same qsColonTestCases.forEach((testCase) => { check(qs.parse(testCase[0], ';', ':'), testCase[2], testCase[0]); }); @@ -445,5 +445,5 @@ qsUnescapeTestCases.forEach((testCase) => { createWithNoPrototype([{ key: 'f__', value: 'b_r' }])); qs.unescape = prevUnescape; } -// test separator and "equals" parsing order +// Test separator and "equals" parsing order check(qs.parse('foo&bar', '&', '&'), { foo: '', bar: '' }); diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index c08c6d8ce82e6a..90cb8f1584f04b 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -141,7 +141,7 @@ function isWarned(emitter) { assert.ok(called); } - // sending a single character with no newline + // Sending a single character with no newline { const fi = new FakeInput(); const rli = new readline.Interface(fi, {}); @@ -399,7 +399,7 @@ function isWarned(emitter) { }); } - // duplicate lines are removed from history when + // Duplicate lines are removed from history when // `options.removeHistoryDuplicates` is `true` { const fi = new FakeInput(); @@ -439,7 +439,7 @@ function isWarned(emitter) { rli.close(); } - // duplicate lines are not removed from history when + // Duplicate lines are not removed from history when // `options.removeHistoryDuplicates` is `false` { const fi = new FakeInput(); @@ -1087,7 +1087,7 @@ function isWarned(emitter) { assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'), false); }); - // wide characters should be treated as two columns. + // Wide characters should be treated as two columns. assert.strictEqual(internalReadline.isFullWidthCodePoint('a'.charCodeAt(0)), false); assert.strictEqual(internalReadline.isFullWidthCodePoint('あ'.charCodeAt(0)), diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index b1c88e2acee157..f61c64043fecc1 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -259,7 +259,7 @@ addTest('\x1b[H\x1b[5H\x1b[1;5H', [ { name: 'home', sequence: '\x1b[1;5H', code: '[H', ctrl: true }, ]); -// escape sequences broken into multiple data chunks +// Escape sequences broken into multiple data chunks addTest('\x1b[D\x1b[C\x1b[D\x1b[C'.split(''), [ { name: 'left', sequence: '\x1b[D', code: '[D' }, { name: 'right', sequence: '\x1b[C', code: '[C' }, @@ -267,7 +267,7 @@ addTest('\x1b[D\x1b[C\x1b[D\x1b[C'.split(''), [ { name: 'right', sequence: '\x1b[C', code: '[C' }, ]); -// escape sequences mixed with regular ones +// Escape sequences mixed with regular ones addTest('\x1b[DD\x1b[2DD\x1b[2^D', [ { name: 'left', sequence: '\x1b[D', code: '[D' }, { name: 'd', sequence: 'D', shift: true }, @@ -318,5 +318,5 @@ const runKeyIntervalTests = [ ]) ].reverse().reduce((acc, fn) => fn(acc), () => {}); -// run key interval tests one after another +// Run key interval tests one after another runKeyIntervalTests(); diff --git a/test/parallel/test-readline-set-raw-mode.js b/test/parallel/test-readline-set-raw-mode.js index db42a5a9495a9e..de47d14b03de8a 100644 --- a/test/parallel/test-readline-set-raw-mode.js +++ b/test/parallel/test-readline-set-raw-mode.js @@ -42,7 +42,7 @@ stream.pause = function() { pauseCalled = true; }; -// when the "readline" starts in "terminal" mode, +// When the "readline" starts in "terminal" mode, // then setRawMode(true) should be called const rli = readline.createInterface({ input: stream, @@ -86,5 +86,5 @@ assert(!resumeCalled); assert(pauseCalled); assert.deepStrictEqual(stream.listeners('keypress'), []); -// one data listener for the keypress events. +// One data listener for the keypress events. assert.strictEqual(stream.listeners('data').length, 1); diff --git a/test/parallel/test-repl-context.js b/test/parallel/test-repl-context.js index 0394129d45df19..378af1c14445e8 100644 --- a/test/parallel/test-repl-context.js +++ b/test/parallel/test-repl-context.js @@ -51,7 +51,7 @@ const stream = new ArrayStream(); // use the server to create a new context const context = server.createContext(); - // ensure that creating a new context does not + // Ensure that creating a new context does not // have side effects on the server assert.ok(server.underscoreAssigned); assert.strictEqual(server.lines.length, 1); @@ -63,7 +63,7 @@ const stream = new ArrayStream(); assert.ok(!server.underscoreAssigned); assert.strictEqual(server.lines.length, 0); - // ensure that assigning to '_' in the new context + // Ensure that assigning to '_' in the new context // does not change the value in our server. assert.ok(!server.underscoreAssigned); vm.runInContext('_ = 1000;\n', context); diff --git a/test/parallel/test-repl-end-emits-exit.js b/test/parallel/test-repl-end-emits-exit.js index d01be957d3990b..8de0a006dfc49b 100644 --- a/test/parallel/test-repl-end-emits-exit.js +++ b/test/parallel/test-repl-end-emits-exit.js @@ -43,7 +43,7 @@ function testTerminalMode() { }); r1.on('exit', function() { - // should be fired from the simulated ^D keypress + // Should be fired from the simulated ^D keypress terminalExit++; testRegularMode(); }); @@ -61,7 +61,7 @@ function testRegularMode() { }); r2.on('exit', function() { - // should be fired from the simulated 'end' event + // Should be fired from the simulated 'end' event regularExit++; }); } diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js index eff05a39203acd..2c42788be6ffcc 100644 --- a/test/parallel/test-repl-save-load.js +++ b/test/parallel/test-repl-save-load.js @@ -73,7 +73,7 @@ assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'), `${cmds.join('\n')}\n\n`); } -// make sure that the REPL data is "correct" +// Make sure that the REPL data is "correct" // so when I load it back I know I'm good testMe.complete('inner.o', function(error, data) { assert.deepStrictEqual(data, works); @@ -85,7 +85,7 @@ putIn.run(['.clear']); // Load the file back in putIn.run([`.load ${saveFileName}`]); -// make sure that the REPL data is "correct" +// Make sure that the REPL data is "correct" testMe.complete('inner.o', function(error, data) { assert.deepStrictEqual(data, works); }); diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index 5438c960b84cb1..b28923a49b1a5d 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -145,7 +145,7 @@ testMe.complete('inner.o', common.mustCall(function(error, data) { putIn.run(['.clear']); -// def has the params and { on a separate line +// The definition has the params and { on a separate line. putIn.run([ 'var top = function() {', 'r = function test (', @@ -173,7 +173,7 @@ testMe.complete('inner.o', getNoResultsFunction()); putIn.run(['.clear']); -// currently does not work, but should not break +// Currently does not work, but should not break putIn.run([ 'var top = function() {', 'r = function test (', @@ -187,7 +187,7 @@ testMe.complete('inner.o', getNoResultsFunction()); putIn.run(['.clear']); -// make sure tab completion works on non-Objects +// Make sure tab completion works on non-Objects putIn.run([ 'var str = "test";' ]); @@ -197,7 +197,7 @@ testMe.complete('str.len', common.mustCall(function(error, data) { putIn.run(['.clear']); -// tab completion should not break on spaces +// Tab completion should not break on spaces const spaceTimeout = setTimeout(function() { throw new Error('timeout'); }, 1000); @@ -551,7 +551,7 @@ editor.completer('var log = console.l', common.mustCall((error, data) => { })); { - // tab completion of lexically scoped variables + // Tab completion of lexically scoped variables const stream = new ArrayStream(); const testRepl = repl.start({ stream }); diff --git a/test/parallel/test-repl-tab.js b/test/parallel/test-repl-tab.js index 0ebc9490771598..f64a00d8bca99e 100644 --- a/test/parallel/test-repl-tab.js +++ b/test/parallel/test-repl-tab.js @@ -4,7 +4,7 @@ const assert = require('assert'); const repl = require('repl'); const zlib = require('zlib'); -// just use builtin stream inherited from Duplex +// Just use builtin stream inherited from Duplex const putIn = zlib.createGzip(); const testMe = repl.start('', putIn, function(cmd, context, filename, callback) { diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index f0f04fa79c3602..0f88c661b2992a 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -48,7 +48,7 @@ async function runReplTests(socket, prompt, tests) { let lineBuffer = ''; for (const { send, expect } of tests) { - // expect can be a single line or multiple lines + // Expect can be a single line or multiple lines const expectedLines = Array.isArray(expect) ? expect : [ expect ]; console.error('out:', JSON.stringify(send)); @@ -448,7 +448,7 @@ const errorTests = [ /'thefourtheye'/ ] }, - // empty lines in the REPL should be allowed + // Empty lines in the REPL should be allowed { send: '\n\r\n\r\n', expect: '' diff --git a/test/parallel/test-require-long-path.js b/test/parallel/test-require-long-path.js index 548a0b5425df39..c39d8f2a41fe1c 100644 --- a/test/parallel/test-require-long-path.js +++ b/test/parallel/test-require-long-path.js @@ -8,7 +8,7 @@ const path = require('path'); const tmpdir = require('../common/tmpdir'); -// make a path that is more than 260 chars long. +// Make a path that is more than 260 chars long. const dirNameLen = Math.max(260 - tmpdir.path.length, 1); const dirName = path.join(tmpdir.path, 'x'.repeat(dirNameLen)); const fullDirPath = path.resolve(dirName); diff --git a/test/parallel/test-stream-duplex-destroy.js b/test/parallel/test-stream-duplex-destroy.js index 1108413e72480f..3c38d2c364051c 100644 --- a/test/parallel/test-stream-duplex-destroy.js +++ b/test/parallel/test-stream-duplex-destroy.js @@ -76,7 +76,7 @@ const assert = require('assert'); duplex.on('end', common.mustNotCall('no end event')); duplex.on('finish', common.mustNotCall('no finish event')); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy duplex.on('error', common.mustNotCall('no error event')); duplex.on('close', common.mustCall()); diff --git a/test/parallel/test-stream-ispaused.js b/test/parallel/test-stream-ispaused.js index f45c0209ccdcb7..366d34e326ec7d 100644 --- a/test/parallel/test-stream-ispaused.js +++ b/test/parallel/test-stream-ispaused.js @@ -29,7 +29,7 @@ const readable = new stream.Readable(); // _read is a noop, here. readable._read = Function(); -// default state of a stream is not "paused" +// Default state of a stream is not "paused" assert.ok(!readable.isPaused()); // make the stream start flowing... diff --git a/test/parallel/test-stream-pipe-unpipe-streams.js b/test/parallel/test-stream-pipe-unpipe-streams.js index 49e02bea9cb695..c8a383bc61a24b 100644 --- a/test/parallel/test-stream-pipe-unpipe-streams.js +++ b/test/parallel/test-stream-pipe-unpipe-streams.js @@ -33,7 +33,7 @@ source.unpipe(dest1); assert.strictEqual(source._readableState.pipes, null); { - // test `cleanup()` if we unpipe all streams. + // Test `cleanup()` if we unpipe all streams. const source = Readable({ read: () => {} }); const dest1 = Writable({ write: () => {} }); const dest2 = Writable({ write: () => {} }); diff --git a/test/parallel/test-stream-pipeline.js b/test/parallel/test-stream-pipeline.js index 34928794cdc396..ef5a39fddd881f 100644 --- a/test/parallel/test-stream-pipeline.js +++ b/test/parallel/test-stream-pipeline.js @@ -172,7 +172,7 @@ const { promisify } = require('util'); rs.push('hello'); }, destroy: common.mustCall((err, cb) => { - // prevents fd leaks by destroying http pipelines + // Prevents fd leaks by destroying http pipelines cb(); }) }); diff --git a/test/parallel/test-stream-readable-destroy.js b/test/parallel/test-stream-readable-destroy.js index 8ad375e68b3e42..9f56467e203dd5 100644 --- a/test/parallel/test-stream-readable-destroy.js +++ b/test/parallel/test-stream-readable-destroy.js @@ -69,7 +69,7 @@ const assert = require('assert'); read.on('end', common.mustNotCall('no end event')); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy read.on('error', common.mustNotCall('no error event')); read.on('close', common.mustCall()); diff --git a/test/parallel/test-stream-readable-event.js b/test/parallel/test-stream-readable-event.js index 73ca80400ab289..8276e7ce4db533 100644 --- a/test/parallel/test-stream-readable-event.js +++ b/test/parallel/test-stream-readable-event.js @@ -58,7 +58,7 @@ const Readable = require('stream').Readable; r.push(Buffer.from('bl')); setTimeout(function() { - // assert we're testing what we think we are + // Assert we're testing what we think we are assert(r._readableState.reading); r.on('readable', common.mustCall()); }, 1); @@ -78,14 +78,14 @@ const Readable = require('stream').Readable; r.push(null); setTimeout(function() { - // assert we're testing what we think we are + // Assert we're testing what we think we are assert(!r._readableState.reading); r.on('readable', common.mustCall()); }, 1); } { - // pushing a empty string in non-objectMode should + // Pushing an empty string in non-objectMode should // trigger next `read()`. const underlyingData = ['', 'x', 'y', '', 'z']; const expected = underlyingData.filter((data) => data); diff --git a/test/parallel/test-stream-readable-flow-recursion.js b/test/parallel/test-stream-readable-flow-recursion.js index 6cc1ce65b1426e..fed4287445e035 100644 --- a/test/parallel/test-stream-readable-flow-recursion.js +++ b/test/parallel/test-stream-readable-flow-recursion.js @@ -30,7 +30,7 @@ const assert = require('assert'); const Readable = require('stream').Readable; -// throw an error if we trigger a nextTick warning. +// Throw an error if we trigger a nextTick warning. process.throwDeprecation = true; const stream = new Readable({ highWaterMark: 2 }); diff --git a/test/parallel/test-stream-readable-reading-readingMore.js b/test/parallel/test-stream-readable-reading-readingMore.js index 5ea91dfa8bad32..2198a889f0584f 100644 --- a/test/parallel/test-stream-readable-reading-readingMore.js +++ b/test/parallel/test-stream-readable-reading-readingMore.js @@ -37,7 +37,7 @@ const Readable = require('stream').Readable; // after which everything is governed by the .read() call assert.strictEqual(state.readingMore, expectedReadingMore.shift()); - // if the stream has ended, we shouldn't be reading + // If the stream has ended, we shouldn't be reading assert.strictEqual(state.ended, !state.reading); const data = readable.read(); diff --git a/test/parallel/test-stream-transform-destroy.js b/test/parallel/test-stream-transform-destroy.js index 47cce87264b5c1..c594d9989ae4de 100644 --- a/test/parallel/test-stream-transform-destroy.js +++ b/test/parallel/test-stream-transform-destroy.js @@ -72,7 +72,7 @@ const assert = require('assert'); transform.on('close', common.mustCall()); transform.on('finish', common.mustNotCall('no finish event')); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy transform.on('error', common.mustNotCall('no error event')); transform.destroy(expected); diff --git a/test/parallel/test-stream-transform-split-highwatermark.js b/test/parallel/test-stream-transform-split-highwatermark.js index f931d4f6ceb928..301d81bc904231 100644 --- a/test/parallel/test-stream-transform-split-highwatermark.js +++ b/test/parallel/test-stream-transform-split-highwatermark.js @@ -81,7 +81,7 @@ testTransform(0, 0, { }); } -// test non Duplex streams ignore the options +// Test non Duplex streams ignore the options { const r = new Readable({ readableHighWaterMark: 666 }); assert.strictEqual(r._readableState.highWaterMark, DEFAULT); diff --git a/test/parallel/test-stream-writable-destroy.js b/test/parallel/test-stream-writable-destroy.js index 5fbb7ae19b14dc..867571ef377a93 100644 --- a/test/parallel/test-stream-writable-destroy.js +++ b/test/parallel/test-stream-writable-destroy.js @@ -69,7 +69,7 @@ const assert = require('assert'); write.on('finish', common.mustNotCall('no finish event')); write.on('close', common.mustCall()); - // error is swallowed by the custom _destroy + // Error is swallowed by the custom _destroy write.on('error', common.mustNotCall('no error event')); write.destroy(expected); diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 7283aa493e688d..1123e66ddc5767 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -113,7 +113,7 @@ function test(decode, uncork, multi, next) { w.end(cnt('end')); w.on('finish', function() { - // make sure finish comes after all the write cb + // Make sure finish comes after all the write cb cnt('finish')(); assert.deepStrictEqual(actualChunks, expectChunks); next(); diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index a1bad84a8f55c8..92e4669dd4bc2c 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -423,7 +423,7 @@ const Transform = require('_stream_transform'); }); jp.end(); - // read one more time to get the 'end' event + // Read one more time to get the 'end' event jp.read(); process.nextTick(common.mustCall(function() { @@ -464,7 +464,7 @@ const Transform = require('_stream_transform'); }); js.end(); - // read one more time to get the 'end' event + // Read one more time to get the 'end' event js.read(); process.nextTick(common.mustCall(function() { diff --git a/test/parallel/test-stream2-unpipe-drain.js b/test/parallel/test-stream2-unpipe-drain.js index ac2a3a5b062c9d..4c283df6806c4a 100644 --- a/test/parallel/test-stream2-unpipe-drain.js +++ b/test/parallel/test-stream2-unpipe-drain.js @@ -28,7 +28,7 @@ const stream = require('stream'); class TestWriter extends stream.Writable { _write(buffer, encoding, callback) { console.log('write called'); - // super slow write stream (callback never called) + // Super slow write stream (callback never called) } } diff --git a/test/parallel/test-stream3-cork-end.js b/test/parallel/test-stream3-cork-end.js index e046d46368a4f9..8403e20fb1e8b2 100644 --- a/test/parallel/test-stream3-cork-end.js +++ b/test/parallel/test-stream3-cork-end.js @@ -21,7 +21,7 @@ const w = new Writable(); w._write = function(chunk, encoding, cb) { // Stream end event is not seen before the last write assert.ok(!seenEnd); - // default encoding given none was specified + // Default encoding given none was specified assert.strictEqual(encoding, 'buffer'); seenChunks.push(chunk); @@ -70,7 +70,7 @@ writeChunks(inputChunks, () => { // stream should not ended in current tick assert.ok(!seenEnd); - // buffered bytes should be seen in current tick + // Buffered bytes should be seen in current tick assert.strictEqual(seenChunks.length, 4); // did the chunks match diff --git a/test/parallel/test-stream3-cork-uncork.js b/test/parallel/test-stream3-cork-uncork.js index 91d27c916cef45..5b52ec0019feea 100644 --- a/test/parallel/test-stream3-cork-uncork.js +++ b/test/parallel/test-stream3-cork-uncork.js @@ -19,7 +19,7 @@ let seenEnd = false; const w = new Writable(); // lets arrange to store the chunks w._write = function(chunk, encoding, cb) { - // default encoding given none was specified + // Default encoding given none was specified assert.strictEqual(encoding, 'buffer'); seenChunks.push(chunk); @@ -65,7 +65,7 @@ writeChunks(inputChunks, () => { // trigger writing out the buffer w.uncork(); - // buffered bytes should be seen in current tick + // Buffered bytes should be seen in current tick assert.strictEqual(seenChunks.length, 4); // did the chunks match diff --git a/test/parallel/test-string-decoder-end.js b/test/parallel/test-string-decoder-end.js index 3dd445e6c7149b..b10756a4633fca 100644 --- a/test/parallel/test-string-decoder-end.js +++ b/test/parallel/test-string-decoder-end.js @@ -31,7 +31,7 @@ const encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2']; const bufs = [ '☃💩', 'asdf' ].map((b) => Buffer.from(b)); -// also test just arbitrary bytes from 0-15. +// Also test just arbitrary bytes from 0-15. for (let i = 1; i <= 16; i++) { const bytes = '.'.repeat(i - 1).split('.').map((_, j) => j + 0x78); bufs.push(Buffer.from(bytes)); diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js index f05b40a3ef4f72..9d8aa45f67895e 100644 --- a/test/parallel/test-stringbytes-external.js +++ b/test/parallel/test-stringbytes-external.js @@ -48,9 +48,9 @@ const size = 1 << 20; write_str = write_str.repeat(size); ucs2_control = ucs2_control.repeat(size); -// check resultant buffer and output string +// Check resultant buffer and output string b = Buffer.from(write_str, 'ucs2'); -// check fist Buffer created from write string +// Check fist Buffer created from write string for (let i = 0; i < b.length; i += 2) { assert.strictEqual(b[i], 0x61); assert.strictEqual(b[i + 1], 0); @@ -59,11 +59,11 @@ for (let i = 0; i < b.length; i += 2) { // Create another string to create an external string const b_ucs = b.toString('ucs2'); -// check control against external binary string +// Check control against external binary string const l_bin = b.toString('latin1'); assert.strictEqual(ucs2_control, l_bin); -// check control against external binary string +// Check control against external binary string const b_bin = b.toString('binary'); assert.strictEqual(ucs2_control, b_bin); @@ -72,7 +72,7 @@ const c_bin = Buffer.from(l_bin, 'latin1'); const c_ucs = Buffer.from(b_ucs, 'ucs2'); // make sure they're the same length assert.strictEqual(c_bin.length, c_ucs.length); -// make sure Buffers from externals are the same +// Make sure Buffers from externals are the same for (let i = 0; i < c_bin.length; i++) { assert.strictEqual(c_bin[i], c_ucs[i]); } @@ -82,7 +82,7 @@ assert.strictEqual(c_bin.toString('latin1'), ucs2_control); assert.strictEqual(c_ucs.toString('latin1'), ucs2_control); -// now let's test BASE64 and HEX encoding/decoding +// Now let's test BASE64 and HEX encoding/decoding const RADIOS = 2; const PRE_HALF_APEX = Math.ceil(EXTERN_APEX / 2) - RADIOS; const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS; diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js index 3ba33faf42369d..37677ada7f411c 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.js @@ -27,7 +27,7 @@ if (!common.hasCrypto) const assert = require('assert'); const tls = require('tls'); -// import fixtures directly from its module +// Import fixtures directly from its module const fixtures = require('../common/fixtures'); const cipher_list = ['AES128-SHA256', 'AES256-SHA256']; diff --git a/test/parallel/test-trace-events-api.js b/test/parallel/test-trace-events-api.js index cf11daa6edf869..1953e2add96c49 100644 --- a/test/parallel/test-trace-events-api.js +++ b/test/parallel/test-trace-events-api.js @@ -56,7 +56,7 @@ assert.strictEqual(tracing.enabled, false); assert.strictEqual(getEnabledCategories(), enabledCategories); tracing.enable(); -tracing.enable(); // purposefully enable twice to test calling twice +tracing.enable(); // Purposefully enable twice to test calling twice assert.strictEqual(tracing.enabled, true); assert.strictEqual(getEnabledCategories(), @@ -72,7 +72,7 @@ tracing2.enable(); assert.strictEqual(getEnabledCategories(), 'foo'); tracing2.disable(); -tracing2.disable(); // purposefully disable twice to test calling twice +tracing2.disable(); // Purposefully disable twice to test calling twice assert.strictEqual(getEnabledCategories(), enabledCategories); if (isChild) { diff --git a/test/parallel/test-trace-events-category-used.js b/test/parallel/test-trace-events-category-used.js index f4b839dddced35..3d584b1f2a85dd 100644 --- a/test/parallel/test-trace-events-category-used.js +++ b/test/parallel/test-trace-events-category-used.js @@ -17,7 +17,7 @@ tmpdir.refresh(); const procEnabled = cp.spawn( process.execPath, [ '--trace-event-categories', 'custom', - // make test less noisy since internal/test/binding + // Make test less noisy since internal/test/binding // emits a warning. '--no-warnings', '--expose-internals', @@ -35,7 +35,7 @@ procEnabled.once('close', common.mustCall(() => { const procDisabled = cp.spawn( process.execPath, [ '--trace-event-categories', 'other', - // make test less noisy since internal/test/binding + // Make test less noisy since internal/test/binding // emits a warning. '--no-warnings', '--expose-internals', diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index cbe8eea25740f2..b318658febbaea 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -180,7 +180,7 @@ const parseTests = { path: '/b/c' }, - // an unexpected invalid char in the hostname. + // An unexpected invalid char in the hostname. 'HtTp://x.y.cOm;a/b/c?d=e#f gi': { href: 'http://x.y.com/;a/b/c?d=e#f%20g%3Ch%3Ei', protocol: 'http:', diff --git a/test/parallel/test-v8-coverage.js b/test/parallel/test-v8-coverage.js index 5be68bf4b7947f..926d28f14e1a7f 100644 --- a/test/parallel/test-v8-coverage.js +++ b/test/parallel/test-v8-coverage.js @@ -113,7 +113,7 @@ function nextdir() { assert.strictEqual(fixtureCoverage, undefined); } -// disables async hooks before writing coverage. +// Disables async hooks before writing coverage. { const coverageDirectory = path.join(tmpdir.path, nextdir()); const output = spawnSync(process.execPath, [ diff --git a/test/parallel/test-vm-global-property-interceptors.js b/test/parallel/test-vm-global-property-interceptors.js index 8571fbe19fcb60..8fe5f8f3da91b2 100644 --- a/test/parallel/test-vm-global-property-interceptors.js +++ b/test/parallel/test-vm-global-property-interceptors.js @@ -108,7 +108,7 @@ vm.runInContext('k = 2;', ctx); assert.strictEqual(ctx.k, 2); assert.strictEqual(vm.runInContext('k;', ctx), 2); -// redefine properties on the global object +// Redefine properties on the global object assert.strictEqual(typeof vm.runInContext('encodeURI;', ctx), 'function'); assert.strictEqual(ctx.encodeURI, undefined); vm.runInContext(` diff --git a/test/parallel/test-windows-failed-heap-allocation.js b/test/parallel/test-windows-failed-heap-allocation.js index e03c9ee006eabd..ff8062855d6428 100644 --- a/test/parallel/test-windows-failed-heap-allocation.js +++ b/test/parallel/test-windows-failed-heap-allocation.js @@ -9,7 +9,7 @@ const assert = require('assert'); const { exec } = require('child_process'); if (process.argv[2] === 'heapBomb') { - // heap bomb, imitates a memory leak quickly + // Heap bomb, imitates a memory leak quickly const fn = (nM) => [...Array(nM)].map((i) => fn(nM * 2)); fn(2); } diff --git a/test/parallel/test-zlib-deflate-raw-inherits.js b/test/parallel/test-zlib-deflate-raw-inherits.js index bb53caa9b50a6d..34bf31058a1d6b 100644 --- a/test/parallel/test-zlib-deflate-raw-inherits.js +++ b/test/parallel/test-zlib-deflate-raw-inherits.js @@ -4,7 +4,7 @@ require('../common'); const { DeflateRaw } = require('zlib'); const { Readable } = require('stream'); -// validates that zlib.DeflateRaw can be inherited +// Validates that zlib.DeflateRaw can be inherited // with Object.setPrototypeOf function NotInitialized(options) { diff --git a/test/parallel/test-zlib-destroy.js b/test/parallel/test-zlib-destroy.js index d8eab42186a5fa..bbfce22ee2cf8a 100644 --- a/test/parallel/test-zlib-destroy.js +++ b/test/parallel/test-zlib-destroy.js @@ -5,7 +5,7 @@ require('../common'); const assert = require('assert'); const zlib = require('zlib'); -// verify that the zlib transform does clean up +// Verify that the zlib transform does clean up // the handle when calling destroy. const ts = zlib.createGzip(); diff --git a/test/parallel/test-zlib-dictionary.js b/test/parallel/test-zlib-dictionary.js index b7f6a138555237..11c8959cc68505 100644 --- a/test/parallel/test-zlib-dictionary.js +++ b/test/parallel/test-zlib-dictionary.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// test compression/decompression with dictionary +// Test compression/decompression with dictionary const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index 6104172c7ae590..d5ef9fe9d13ce7 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -36,7 +36,7 @@ let zlibPairs = [ [zlib.BrotliCompress, zlib.BrotliDecompress], ]; -// how fast to trickle through the slowstream +// How fast to trickle through the slowstream let trickle = [128, 1024, 1024 * 1024]; // tunable options for zlib classes. diff --git a/test/sequential/test-cli-syntax-bad.js b/test/sequential/test-cli-syntax-bad.js index 7c4c9c70d9097c..1512d9df4f1605 100644 --- a/test/sequential/test-cli-syntax-bad.js +++ b/test/sequential/test-cli-syntax-bad.js @@ -7,7 +7,7 @@ const fixtures = require('../common/fixtures'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] @@ -17,7 +17,7 @@ const syntaxArgs = [ // depending on the JavaScript engine. const syntaxErrorRE = /^SyntaxError: \b/m; -// test bad syntax with and without shebang +// Test bad syntax with and without shebang [ 'syntax/bad_syntax.js', 'syntax/bad_syntax', @@ -26,7 +26,7 @@ const syntaxErrorRE = /^SyntaxError: \b/m; ].forEach(function(file) { file = fixtures.path(file); - // loop each possible option, `-c` or `--check` + // Loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const _args = args.concat(file); const cmd = [node, ..._args].join(' '); @@ -38,7 +38,7 @@ const syntaxErrorRE = /^SyntaxError: \b/m; // no stdout should be produced assert.strictEqual(stdout, ''); - // stderr should have a syntax error message + // Stderr should have a syntax error message assert(syntaxErrorRE.test(stderr), `${syntaxErrorRE} === ${stderr}`); // stderr should include the filename diff --git a/test/sequential/test-cli-syntax-file-not-found.js b/test/sequential/test-cli-syntax-file-not-found.js index 2bfb0e38c75013..b3bb9723e2c78e 100644 --- a/test/sequential/test-cli-syntax-file-not-found.js +++ b/test/sequential/test-cli-syntax-file-not-found.js @@ -7,7 +7,7 @@ const fixtures = require('../common/fixtures'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] @@ -22,7 +22,7 @@ const notFoundRE = /^Error: Cannot find module/m; ].forEach(function(file) { file = fixtures.path(file); - // loop each possible option, `-c` or `--check` + // Loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const _args = args.concat(file); const cmd = [node, ..._args].join(' '); diff --git a/test/sequential/test-cli-syntax-good.js b/test/sequential/test-cli-syntax-good.js index 1c2b3cbe55db80..48581e7733da44 100644 --- a/test/sequential/test-cli-syntax-good.js +++ b/test/sequential/test-cli-syntax-good.js @@ -7,13 +7,13 @@ const fixtures = require('../common/fixtures'); const node = process.execPath; -// test both sets of arguments that check syntax +// Test both sets of arguments that check syntax const syntaxArgs = [ ['-c'], ['--check'] ]; -// test good syntax with and without shebang +// Test good syntax with and without shebang [ 'syntax/good_syntax.js', 'syntax/good_syntax', @@ -23,7 +23,7 @@ const syntaxArgs = [ ].forEach(function(file) { file = fixtures.path(file); - // loop each possible option, `-c` or `--check` + // Loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const _args = args.concat(file); diff --git a/test/sequential/test-debugger-debug-brk.js b/test/sequential/test-debugger-debug-brk.js index 086ee2788dee1c..65ee43061cb40c 100644 --- a/test/sequential/test-debugger-debug-brk.js +++ b/test/sequential/test-debugger-debug-brk.js @@ -9,7 +9,7 @@ const assert = require('assert'); const fixtures = require('../common/fixtures'); const spawn = require('child_process').spawn; -// file name here doesn't actually matter since +// File name here doesn't actually matter since // debugger will connect regardless of file name arg const script = fixtures.path('empty.js'); diff --git a/test/sequential/test-dgram-bind-shared-ports.js b/test/sequential/test-dgram-bind-shared-ports.js index 9f7e23ba0bdaf5..cc12d93787df14 100644 --- a/test/sequential/test-dgram-bind-shared-ports.js +++ b/test/sequential/test-dgram-bind-shared-ports.js @@ -89,7 +89,7 @@ if (cluster.isMaster) { assert.strictEqual(typeof port3, 'number'); process.send('success'); }); - // an error is expected only in the second worker + // An error is expected only in the second worker const socket3OnError = !isSecondWorker ? common.mustNotCall() : diff --git a/test/sequential/test-http-econnrefused.js b/test/sequential/test-http-econnrefused.js index ff4508963b9877..5650e7430859ca 100644 --- a/test/sequential/test-http-econnrefused.js +++ b/test/sequential/test-http-econnrefused.js @@ -95,7 +95,7 @@ function afterPing(result) { assert.ok(successRE.test(responses[6])); assert.ok(successRE.test(responses[7])); server.close(); - // we should go to process.on('exit') from here. + // We should go to process.on('exit') from here. break; } } diff --git a/test/sequential/test-inspector.js b/test/sequential/test-inspector.js index 237b65193fa86e..9aaabdc6c95472 100644 --- a/test/sequential/test-inspector.js +++ b/test/sequential/test-inspector.js @@ -212,7 +212,7 @@ async function testCommandLineAPI(session) { }); checkException(result); assert.strictEqual(result.result.value, true); - // after require the module appears in require.cache + // After require the module appears in require.cache result = await session.send( { 'method': 'Runtime.evaluate', 'params': { @@ -235,7 +235,7 @@ async function testCommandLineAPI(session) { }); checkException(result); assert.strictEqual(result.result.value, true); - // require again, should get fresh (empty) exports + // Require again, should get fresh (empty) exports result = await session.send( { 'method': 'Runtime.evaluate', 'params': { @@ -255,7 +255,7 @@ async function testCommandLineAPI(session) { }); checkException(result); assert.deepStrictEqual(JSON.parse(result.result.value), {}); - // both modules end up with the same module.parent + // Both modules end up with the same module.parent result = await session.send( { 'method': 'Runtime.evaluate', 'params': { diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index 6cfa4da04e2c04..9c60d15d9e93da 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -120,7 +120,7 @@ assert.throws( } console.error('test node_modules folders'); -// asserts are in the fixtures files themselves, +// Asserts are in the fixtures files themselves, // since they depend on the folder structure. require('../fixtures/node_modules/foo'); @@ -129,7 +129,7 @@ require('../fixtures/node_modules/foo'); // This one exists and should import the local module const my_path = require('../fixtures/path'); assert.ok(my_path.path_func instanceof Function); - // this one does not exist and should throw + // This one does not exist and should throw assert.throws(function() { require('./utils'); }, /^Error: Cannot find module '\.\/utils'$/); } @@ -215,7 +215,7 @@ try { } { - // make sure that module.require() is the same as + // Make sure that module.require() is the same as // doing require() inside of that module. const parent = require('../fixtures/module-require/parent/'); const child = require('../fixtures/module-require/child/'); diff --git a/test/sequential/test-net-listen-shared-ports.js b/test/sequential/test-net-listen-shared-ports.js index be33821bf6518c..78d94b4ae1e6b0 100644 --- a/test/sequential/test-net-listen-shared-ports.js +++ b/test/sequential/test-net-listen-shared-ports.js @@ -48,7 +48,7 @@ if (cluster.isMaster) { }); server2.on('error', function(err) { - // an error is expected on the second worker + // An error is expected on the second worker process.send(`server2:${err.code}`); }); diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js index 40995394ac5530..68d35dbdbc6a91 100644 --- a/test/sequential/test-stream2-stderr-sync.js +++ b/test/sequential/test-stream2-stderr-sync.js @@ -89,6 +89,6 @@ if (!process.argv[2]) { parent(); } else { children[process.argv[2]](); - // immediate process.exit to kill any waiting stuff. + // Immediate process.exit to kill any waiting stuff. process.exit(); } diff --git a/test/sequential/test-timers-blocking-callback.js b/test/sequential/test-timers-blocking-callback.js index 3d05a538ea5f6b..053bc767b8fa13 100644 --- a/test/sequential/test-timers-blocking-callback.js +++ b/test/sequential/test-timers-blocking-callback.js @@ -64,7 +64,7 @@ function blockingCallback(retry, callback) { if (callback) return callback(); } else { - // block by busy-looping to trigger the issue + // Block by busy-looping to trigger the issue common.busyLoop(TIMEOUT); timeCallbackScheduled = Date.now(); diff --git a/tools/eslint-rules/no-duplicate-requires.js b/tools/eslint-rules/no-duplicate-requires.js index 595c22360112ca..c0d036fab92deb 100644 --- a/tools/eslint-rules/no-duplicate-requires.js +++ b/tools/eslint-rules/no-duplicate-requires.js @@ -36,7 +36,7 @@ module.exports = (context) => { } function getRequiredModuleNameFromCall(node) { - // node has arguments and first argument is string + // Node has arguments and first argument is string if (node.arguments.length && isString(node.arguments[0])) { return node.arguments[0].value.trim(); } diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 208e13ffe74fc2..a7a87662ac21e6 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -48,7 +48,7 @@ module.exports = function(context) { function getRequiredModuleName(str) { var value = path.basename(str); - // check if value is in required modules array + // Check if value is in required modules array return requiredModules.indexOf(value) !== -1 ? value : undefined; } @@ -59,7 +59,7 @@ module.exports = function(context) { * @returns {undefined|String} required module name or undefined */ function getRequiredModuleNameFromCall(node) { - // node has arguments and first argument is string + // Node has arguments and first argument is string if (node.arguments.length && isString(node.arguments[0])) { return getRequiredModuleName(node.arguments[0].value.trim()); } From a70bafb3cc88b39cdf0fcfa7de6223f4435751a8 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 10 Feb 2019 12:39:23 +0100 Subject: [PATCH 184/213] console: prevent constructing console methods Ref: https://github.com/nodejs/node/issues/25987 PR-URL: https://github.com/nodejs/node/pull/26096 Refs: https://github.com/nodejs/node/issues/25987 Reviewed-By: Joyee Cheung Reviewed-By: Gabriel Schulhof --- lib/internal/console/constructor.js | 451 +++++++++++++------------- src/inspector_js_api.cc | 12 +- test/parallel/test-console-methods.js | 40 +++ 3 files changed, 281 insertions(+), 222 deletions(-) create mode 100644 test/parallel/test-console-methods.js diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 6f1df1b6c15724..b33fe42891e853 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -279,55 +279,235 @@ Console.prototype[kFormatForStderr] = function(args) { return util.formatWithOptions(opts, ...args); }; -Console.prototype.log = function log(...args) { - this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args)); -}; +const consoleMethods = { + log(...args) { + this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args)); + }, -Console.prototype.debug = Console.prototype.log; -Console.prototype.info = Console.prototype.log; -Console.prototype.dirxml = Console.prototype.log; -Console.prototype.warn = function warn(...args) { - this[kWriteToConsole](kUseStderr, this[kFormatForStderr](args)); -}; + warn(...args) { + this[kWriteToConsole](kUseStderr, this[kFormatForStderr](args)); + }, -Console.prototype.error = Console.prototype.warn; + dir(object, options) { + this[kWriteToConsole](kUseStdout, util.inspect(object, { + customInspect: false, + ...this[kGetInspectOptions](this._stdout), + ...options + })); + }, -Console.prototype.dir = function dir(object, options) { - options = { - customInspect: false, - ...this[kGetInspectOptions](this._stdout), - ...options - }; - this[kWriteToConsole](kUseStdout, util.inspect(object, options)); -}; + time(label = 'default') { + // Coerces everything other than Symbol to a string + label = `${label}`; + if (this._times.has(label)) { + process.emitWarning(`Label '${label}' already exists for console.time()`); + return; + } + trace(kTraceBegin, kTraceConsoleCategory, `time::${label}`, 0); + this._times.set(label, process.hrtime()); + }, -Console.prototype.time = function time(label = 'default') { - // Coerces everything other than Symbol to a string - label = `${label}`; - if (this._times.has(label)) { - process.emitWarning(`Label '${label}' already exists for console.time()`); - return; - } - trace(kTraceBegin, kTraceConsoleCategory, `time::${label}`, 0); - this._times.set(label, process.hrtime()); -}; + timeEnd(label = 'default') { + // Coerces everything other than Symbol to a string + label = `${label}`; + const hasWarned = timeLogImpl(this, 'timeEnd', label); + trace(kTraceEnd, kTraceConsoleCategory, `time::${label}`, 0); + if (!hasWarned) { + this._times.delete(label); + } + }, -Console.prototype.timeEnd = function timeEnd(label = 'default') { - // Coerces everything other than Symbol to a string - label = `${label}`; - const hasWarned = timeLogImpl(this, 'timeEnd', label); - trace(kTraceEnd, kTraceConsoleCategory, `time::${label}`, 0); - if (!hasWarned) { - this._times.delete(label); - } -}; + timeLog(label = 'default', ...data) { + // Coerces everything other than Symbol to a string + label = `${label}`; + timeLogImpl(this, 'timeLog', label, data); + trace(kTraceInstant, kTraceConsoleCategory, `time::${label}`, 0); + }, + + trace(...args) { + const err = { + name: 'Trace', + message: this[kFormatForStderr](args) + }; + Error.captureStackTrace(err, trace); + this.error(err.stack); + }, + + assert(expression, ...args) { + if (!expression) { + args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`; + this.warn(...args); // The arguments will be formatted in warn() again + } + }, + + // Defined by: https://console.spec.whatwg.org/#clear + clear() { + // It only makes sense to clear if _stdout is a TTY. + // Otherwise, do nothing. + if (this._stdout.isTTY) { + // The require is here intentionally to avoid readline being + // required too early when console is first loaded. + const { cursorTo, clearScreenDown } = require('readline'); + cursorTo(this._stdout, 0, 0); + clearScreenDown(this._stdout); + } + }, + + // Defined by: https://console.spec.whatwg.org/#count + count(label = 'default') { + // Ensures that label is a string, and only things that can be + // coerced to strings. e.g. Symbol is not allowed + label = `${label}`; + const counts = this[kCounts]; + let count = counts.get(label); + if (count === undefined) + count = 1; + else + count++; + counts.set(label, count); + trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, count); + this.log(`${label}: ${count}`); + }, + + // Defined by: https://console.spec.whatwg.org/#countreset + countReset(label = 'default') { + const counts = this[kCounts]; + if (!counts.has(label)) { + process.emitWarning(`Count for '${label}' does not exist`); + return; + } + trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, 0); + counts.delete(`${label}`); + }, + + group(...data) { + if (data.length > 0) { + this.log(...data); + } + this[kGroupIndent] += ' '; + }, + + groupEnd() { + this[kGroupIndent] = + this[kGroupIndent].slice(0, this[kGroupIndent].length - 2); + }, + + // https://console.spec.whatwg.org/#table + table(tabularData, properties) { + if (properties !== undefined && !ArrayIsArray(properties)) + throw new ERR_INVALID_ARG_TYPE('properties', 'Array', properties); + + if (tabularData === null || typeof tabularData !== 'object') + return this.log(tabularData); + + if (cliTable === undefined) cliTable = require('internal/cli_table'); + const final = (k, v) => this.log(cliTable(k, v)); + + const inspect = (v) => { + const depth = v !== null && + typeof v === 'object' && + !isArray(v) && + ObjectKeys(v).length > 2 ? -1 : 0; + const opt = { + depth, + maxArrayLength: 3, + ...this[kGetInspectOptions](this._stdout) + }; + return util.inspect(v, opt); + }; + const getIndexArray = (length) => ArrayFrom( + { length }, (_, i) => inspect(i)); + + const mapIter = isMapIterator(tabularData); + let isKeyValue = false; + let i = 0; + if (mapIter) { + const res = previewEntries(tabularData, true); + tabularData = res[0]; + isKeyValue = res[1]; + } + + if (isKeyValue || isMap(tabularData)) { + const keys = []; + const values = []; + let length = 0; + if (mapIter) { + for (; i < tabularData.length / 2; ++i) { + keys.push(inspect(tabularData[i * 2])); + values.push(inspect(tabularData[i * 2 + 1])); + length++; + } + } else { + for (const [k, v] of tabularData) { + keys.push(inspect(k)); + values.push(inspect(v)); + length++; + } + } + return final([ + iterKey, keyKey, valuesKey + ], [ + getIndexArray(length), + keys, + values, + ]); + } + + const setIter = isSetIterator(tabularData); + if (setIter) + tabularData = previewEntries(tabularData); + + const setlike = setIter || (mapIter && !isKeyValue) || isSet(tabularData); + if (setlike) { + const values = []; + let length = 0; + for (const v of tabularData) { + values.push(inspect(v)); + length++; + } + return final([setlike ? iterKey : indexKey, valuesKey], [ + getIndexArray(length), + values, + ]); + } + + const map = {}; + let hasPrimitives = false; + const valuesKeyArray = []; + const indexKeyArray = ObjectKeys(tabularData); + + for (; i < indexKeyArray.length; i++) { + const item = tabularData[indexKeyArray[i]]; + const primitive = item === null || + (typeof item !== 'function' && typeof item !== 'object'); + if (properties === undefined && primitive) { + hasPrimitives = true; + valuesKeyArray[i] = inspect(item); + } else { + const keys = properties || ObjectKeys(item); + for (const key of keys) { + if (map[key] === undefined) + map[key] = []; + if ((primitive && properties) || !hasOwnProperty(item, key)) + map[key][i] = ''; + else + map[key][i] = item == null ? item : inspect(item[key]); + } + } + } + + const keys = ObjectKeys(map); + const values = ObjectValues(map); + if (hasPrimitives) { + keys.push(valuesKey); + values.push(valuesKeyArray); + } + keys.unshift(indexKey); + values.unshift(indexKeyArray); -Console.prototype.timeLog = function timeLog(label = 'default', ...data) { - // Coerces everything other than Symbol to a string - label = `${label}`; - timeLogImpl(this, 'timeLog', label, data); - trace(kTraceInstant, kTraceConsoleCategory, `time::${label}`, 0); + return final(keys, values); + }, }; // Returns true if label was not found @@ -347,75 +527,6 @@ function timeLogImpl(self, name, label, data) { return false; } -Console.prototype.trace = function trace(...args) { - const err = { - name: 'Trace', - message: this[kFormatForStderr](args) - }; - Error.captureStackTrace(err, trace); - this.error(err.stack); -}; - -Console.prototype.assert = function assert(expression, ...args) { - if (!expression) { - args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`; - this.warn(...args); // The arguments will be formatted in warn() again - } -}; - -// Defined by: https://console.spec.whatwg.org/#clear -Console.prototype.clear = function clear() { - // It only makes sense to clear if _stdout is a TTY. - // Otherwise, do nothing. - if (this._stdout.isTTY) { - // The require is here intentionally to avoid readline being - // required too early when console is first loaded. - const { cursorTo, clearScreenDown } = require('readline'); - cursorTo(this._stdout, 0, 0); - clearScreenDown(this._stdout); - } -}; - -// Defined by: https://console.spec.whatwg.org/#count -Console.prototype.count = function count(label = 'default') { - // Ensures that label is a string, and only things that can be - // coerced to strings. e.g. Symbol is not allowed - label = `${label}`; - const counts = this[kCounts]; - let count = counts.get(label); - if (count === undefined) - count = 1; - else - count++; - counts.set(label, count); - trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, count); - this.log(`${label}: ${count}`); -}; - -// Defined by: https://console.spec.whatwg.org/#countreset -Console.prototype.countReset = function countReset(label = 'default') { - const counts = this[kCounts]; - if (!counts.has(label)) { - process.emitWarning(`Count for '${label}' does not exist`); - return; - } - trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, 0); - counts.delete(`${label}`); -}; - -Console.prototype.group = function group(...data) { - if (data.length > 0) { - this.log(...data); - } - this[kGroupIndent] += ' '; -}; -Console.prototype.groupCollapsed = Console.prototype.group; - -Console.prototype.groupEnd = function groupEnd() { - this[kGroupIndent] = - this[kGroupIndent].slice(0, this[kGroupIndent].length - 2); -}; - const keyKey = 'Key'; const valuesKey = 'Values'; const indexKey = '(index)'; @@ -423,118 +534,16 @@ const iterKey = '(iteration index)'; const isArray = (v) => ArrayIsArray(v) || isTypedArray(v) || isBuffer(v); -// https://console.spec.whatwg.org/#table -Console.prototype.table = function(tabularData, properties) { - if (properties !== undefined && !ArrayIsArray(properties)) - throw new ERR_INVALID_ARG_TYPE('properties', 'Array', properties); - - if (tabularData === null || typeof tabularData !== 'object') - return this.log(tabularData); - - if (cliTable === undefined) cliTable = require('internal/cli_table'); - const final = (k, v) => this.log(cliTable(k, v)); - - const inspect = (v) => { - const opt = { depth: 0, maxArrayLength: 3 }; - if (v !== null && typeof v === 'object' && - !isArray(v) && ObjectKeys(v).length > 2) - opt.depth = -1; - Object.assign(opt, this[kGetInspectOptions](this._stdout)); - return util.inspect(v, opt); - }; - const getIndexArray = (length) => ArrayFrom({ length }, (_, i) => inspect(i)); - - const mapIter = isMapIterator(tabularData); - let isKeyValue = false; - let i = 0; - if (mapIter) { - const res = previewEntries(tabularData, true); - tabularData = res[0]; - isKeyValue = res[1]; - } - - if (isKeyValue || isMap(tabularData)) { - const keys = []; - const values = []; - let length = 0; - if (mapIter) { - for (; i < tabularData.length / 2; ++i) { - keys.push(inspect(tabularData[i * 2])); - values.push(inspect(tabularData[i * 2 + 1])); - length++; - } - } else { - for (const [k, v] of tabularData) { - keys.push(inspect(k)); - values.push(inspect(v)); - length++; - } - } - return final([ - iterKey, keyKey, valuesKey - ], [ - getIndexArray(length), - keys, - values, - ]); - } - - const setIter = isSetIterator(tabularData); - if (setIter) - tabularData = previewEntries(tabularData); - - const setlike = setIter || (mapIter && !isKeyValue) || isSet(tabularData); - if (setlike) { - const values = []; - let length = 0; - for (const v of tabularData) { - values.push(inspect(v)); - length++; - } - return final([setlike ? iterKey : indexKey, valuesKey], [ - getIndexArray(length), - values, - ]); - } - - const map = {}; - let hasPrimitives = false; - const valuesKeyArray = []; - const indexKeyArray = ObjectKeys(tabularData); - - for (; i < indexKeyArray.length; i++) { - const item = tabularData[indexKeyArray[i]]; - const primitive = item === null || - (typeof item !== 'function' && typeof item !== 'object'); - if (properties === undefined && primitive) { - hasPrimitives = true; - valuesKeyArray[i] = inspect(item); - } else { - const keys = properties || ObjectKeys(item); - for (const key of keys) { - if (map[key] === undefined) - map[key] = []; - if ((primitive && properties) || !hasOwnProperty(item, key)) - map[key][i] = ''; - else - map[key][i] = item == null ? item : inspect(item[key]); - } - } - } - - const keys = ObjectKeys(map); - const values = ObjectValues(map); - if (hasPrimitives) { - keys.push(valuesKey); - values.push(valuesKeyArray); - } - keys.unshift(indexKey); - values.unshift(indexKeyArray); +function noop() {} - return final(keys, values); -}; +for (const method of Reflect.ownKeys(consoleMethods)) + Console.prototype[method] = consoleMethods[method]; -function noop() {} +Console.prototype.debug = Console.prototype.log; +Console.prototype.info = Console.prototype.log; +Console.prototype.dirxml = Console.prototype.log; +Console.prototype.error = Console.prototype.warn; +Console.prototype.groupCollapsed = Console.prototype.group; module.exports = { Console, diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 746cd68ac90c66..16116c9118fa96 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -272,7 +272,17 @@ void Initialize(Local target, Local unused, Environment* env = Environment::GetCurrent(context); Agent* agent = env->inspector_agent(); - env->SetMethod(target, "consoleCall", InspectorConsoleCall); + + v8::Local consoleCallFunc = + env->NewFunctionTemplate(InspectorConsoleCall, v8::Local(), + v8::ConstructorBehavior::kThrow, + v8::SideEffectType::kHasSideEffect) + ->GetFunction(context) + .ToLocalChecked(); + auto name_string = FIXED_ONE_BYTE_STRING(env->isolate(), "consoleCall"); + target->Set(context, name_string, consoleCallFunc).FromJust(); + consoleCallFunc->SetName(name_string); + env->SetMethod( target, "setConsoleExtensionInstaller", SetConsoleExtensionInstaller); if (agent->WillWaitForConnect()) diff --git a/test/parallel/test-console-methods.js b/test/parallel/test-console-methods.js new file mode 100644 index 00000000000000..00dc144761cb57 --- /dev/null +++ b/test/parallel/test-console-methods.js @@ -0,0 +1,40 @@ +'use strict'; +require('../common'); + +// This test ensures that console methods +// cannot be invoked as constructors + +const assert = require('assert'); + +const { Console } = console; +const newInstance = new Console(process.stdout); +const err = TypeError; + +const methods = [ + 'log', + 'warn', + 'dir', + 'time', + 'timeEnd', + 'timeLog', + 'trace', + 'assert', + 'clear', + 'count', + 'countReset', + 'group', + 'groupEnd', + 'table', + 'debug', + 'info', + 'dirxml', + 'error', + 'groupCollapsed', +]; + +for (const method of methods) { + assert.throws(() => new console[method](), err); + assert.throws(() => new newInstance[method](), err); + assert.throws(() => Reflect.construct({}, [], console[method]), err); + assert.throws(() => Reflect.construct({}, [], newInstance[method]), err); +} From 7ccffcbcb654652bf55db5569875f2373ca31b4f Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 24 Feb 2019 11:42:12 -0500 Subject: [PATCH 185/213] test: improve validation of report output This commit improves the validation of generated diagnostic reports. PR-URL: https://github.com/nodejs/node/pull/26289 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: James M Snell --- test/common/report.js | 189 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 184 insertions(+), 5 deletions(-) diff --git a/test/common/report.js b/test/common/report.js index ee3c1f720333f6..c544cd86787fab 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -2,6 +2,7 @@ 'use strict'; const assert = require('assert'); const fs = require('fs'); +const os = require('os'); const path = require('path'); function findReports(pid, dir) { @@ -27,16 +28,194 @@ function validate(report) { } function validateContent(data) { + try { + _validateContent(data); + } catch (err) { + err.stack += `\n------\nFailing Report:\n${data}`; + throw err; + } +} + +function _validateContent(data) { + const isWindows = process.platform === 'win32'; const report = JSON.parse(data); - // Verify that all sections are present. - ['header', 'javascriptStack', 'nativeStack', 'javascriptHeap', - 'libuv', 'environmentVariables', 'sharedObjects'].forEach((section) => { + // Verify that all sections are present as own properties of the report. + const sections = ['header', 'javascriptStack', 'nativeStack', + 'javascriptHeap', 'libuv', 'environmentVariables', + 'sharedObjects']; + if (!isWindows) + sections.push('resourceUsage', 'userLimits'); + + if (report.uvthreadResourceUsage) + sections.push('uvthreadResourceUsage'); + + checkForUnknownFields(report, sections); + sections.forEach((section) => { assert(report.hasOwnProperty(section)); + assert(typeof report[section] === 'object' && report[section] !== null); + }); + + // Verify the format of the header section. + const header = report.header; + const headerFields = ['event', 'location', 'filename', 'dumpEventTime', + 'dumpEventTimeStamp', 'processId', 'commandLine', + 'nodejsVersion', 'wordSize', 'arch', 'platform', + 'componentVersions', 'release', 'osName', 'osRelease', + 'osVersion', 'osMachine', 'host', 'glibcVersionRuntime', + 'glibcVersionCompiler']; + checkForUnknownFields(header, headerFields); + assert.strictEqual(typeof header.event, 'string'); + assert.strictEqual(typeof header.location, 'string'); + assert(typeof header.filename === 'string' || header.filename === null); + assert.notStrictEqual(new Date(header.dumpEventTime).toString(), + 'Invalid Date'); + if (isWindows) + assert.strictEqual(header.dumpEventTimeStamp, undefined); + else + assert(String(+header.dumpEventTimeStamp), header.dumpEventTimeStamp); + + assert(Number.isSafeInteger(header.processId)); + assert(Array.isArray(header.commandLine)); + header.commandLine.forEach((arg) => { + assert.strictEqual(typeof arg, 'string'); + }); + assert.strictEqual(header.nodejsVersion, process.version); + assert(Number.isSafeInteger(header.wordSize)); + assert.strictEqual(header.arch, os.arch()); + assert.strictEqual(header.platform, os.platform()); + assert.deepStrictEqual(header.componentVersions, process.versions); + assert.deepStrictEqual(header.release, process.release); + assert.strictEqual(header.osName, os.type()); + assert.strictEqual(header.osRelease, os.release()); + assert.strictEqual(typeof header.osVersion, 'string'); + assert.strictEqual(typeof header.osMachine, 'string'); + assert.strictEqual(header.host, os.hostname()); + + // Verify the format of the javascriptStack section. + checkForUnknownFields(report.javascriptStack, ['message', 'stack']); + assert.strictEqual(typeof report.javascriptStack.message, 'string'); + if (report.javascriptStack.stack !== undefined) { + assert(Array.isArray(report.javascriptStack.stack)); + report.javascriptStack.stack.forEach((frame) => { + assert.strictEqual(typeof frame, 'string'); + }); + } + + // Verify the format of the nativeStack section. + assert(Array.isArray(report.nativeStack)); + report.nativeStack.forEach((frame) => { + assert(typeof frame === 'object' && frame !== null); + checkForUnknownFields(frame, ['pc', 'symbol']); + assert.strictEqual(typeof frame.pc, 'string'); + assert(/^0x[0-9a-f]+$/.test(frame.pc)); + assert.strictEqual(typeof frame.symbol, 'string'); + }); + + // Verify the format of the javascriptHeap section. + const heap = report.javascriptHeap; + const jsHeapFields = ['totalMemory', 'totalCommittedMemory', 'usedMemory', + 'availableMemory', 'memoryLimit', 'heapSpaces']; + checkForUnknownFields(heap, jsHeapFields); + assert(Number.isSafeInteger(heap.totalMemory)); + assert(Number.isSafeInteger(heap.totalCommittedMemory)); + assert(Number.isSafeInteger(heap.usedMemory)); + assert(Number.isSafeInteger(heap.availableMemory)); + assert(Number.isSafeInteger(heap.memoryLimit)); + assert(typeof heap.heapSpaces === 'object' && heap.heapSpaces !== null); + const heapSpaceFields = ['memorySize', 'committedMemory', 'capacity', 'used', + 'available']; + Object.keys(heap.heapSpaces).forEach((spaceName) => { + const space = heap.heapSpaces[spaceName]; + checkForUnknownFields(space, heapSpaceFields); + heapSpaceFields.forEach((field) => { + assert(Number.isSafeInteger(space[field])); + }); + }); + + // Verify the format of the resourceUsage section on non-Windows platforms. + if (!isWindows) { + const usage = report.resourceUsage; + const resourceUsageFields = ['userCpuSeconds', 'kernelCpuSeconds', + 'cpuConsumptionPercent', 'maxRss', + 'pageFaults', 'fsActivity']; + checkForUnknownFields(usage, resourceUsageFields); + assert.strictEqual(typeof usage.userCpuSeconds, 'number'); + assert.strictEqual(typeof usage.kernelCpuSeconds, 'number'); + assert.strictEqual(typeof usage.cpuConsumptionPercent, 'number'); + assert(Number.isSafeInteger(usage.maxRss)); + assert(typeof usage.pageFaults === 'object' && usage.pageFaults !== null); + checkForUnknownFields(usage.pageFaults, ['IORequired', 'IONotRequired']); + assert(Number.isSafeInteger(usage.pageFaults.IORequired)); + assert(Number.isSafeInteger(usage.pageFaults.IONotRequired)); + assert(typeof usage.fsActivity === 'object' && usage.fsActivity !== null); + checkForUnknownFields(usage.fsActivity, ['reads', 'writes']); + assert(Number.isSafeInteger(usage.fsActivity.reads)); + assert(Number.isSafeInteger(usage.fsActivity.writes)); + } + + // Verify the format of the uvthreadResourceUsage section, if present. + if (report.uvthreadResourceUsage) { + const usage = report.uvthreadResourceUsage; + const threadUsageFields = ['userCpuSeconds', 'kernelCpuSeconds', + 'cpuConsumptionPercent', 'fsActivity']; + checkForUnknownFields(usage, threadUsageFields); + assert.strictEqual(typeof usage.userCpuSeconds, 'number'); + assert.strictEqual(typeof usage.kernelCpuSeconds, 'number'); + assert.strictEqual(typeof usage.cpuConsumptionPercent, 'number'); + assert(typeof usage.fsActivity === 'object' && usage.fsActivity !== null); + checkForUnknownFields(usage.fsActivity, ['reads', 'writes']); + assert(Number.isSafeInteger(usage.fsActivity.reads)); + assert(Number.isSafeInteger(usage.fsActivity.writes)); + } + + // Verify the format of the libuv section. + assert(Array.isArray(report.libuv)); + report.libuv.forEach((resource) => { + assert.strictEqual(typeof resource.type, 'string'); + assert.strictEqual(typeof resource.address, 'string'); + assert(/^0x[0-9a-f]+$/.test(resource.address)); + assert.strictEqual(typeof resource.is_active, 'boolean'); + assert.strictEqual(typeof resource.is_referenced, + resource.type === 'loop' ? 'undefined' : 'boolean'); }); - assert.deepStrictEqual(report.header.componentVersions, process.versions); - assert.deepStrictEqual(report.header.release, process.release); + // Verify the format of the environmentVariables section. + for (const [key, value] of Object.entries(report.environmentVariables)) { + assert.strictEqual(typeof key, 'string'); + assert.strictEqual(typeof value, 'string'); + } + + // Verify the format of the userLimits section on non-Windows platforms. + if (!isWindows) { + const userLimitsFields = ['core_file_size_blocks', 'data_seg_size_kbytes', + 'file_size_blocks', 'max_locked_memory_bytes', + 'max_memory_size_kbytes', 'open_files', + 'stack_size_bytes', 'cpu_time_seconds', + 'max_user_processes', 'virtual_memory_kbytes']; + checkForUnknownFields(report.userLimits, userLimitsFields); + for (const [type, limits] of Object.entries(report.userLimits)) { + assert.strictEqual(typeof type, 'string'); + assert(typeof limits === 'object' && limits !== null); + checkForUnknownFields(limits, ['soft', 'hard']); + assert(typeof limits.soft === 'number' || limits.soft === 'unlimited', + `Invalid ${type} soft limit of ${limits.soft}`); + assert(typeof limits.hard === 'number' || limits.hard === 'unlimited', + `Invalid ${type} hard limit of ${limits.hard}`); + } + } + + // Verify the format of the sharedObjects section. + assert(Array.isArray(report.sharedObjects)); + report.sharedObjects.forEach((sharedObject) => { + assert.strictEqual(typeof sharedObject, 'string'); + }); +} + +function checkForUnknownFields(actual, expected) { + Object.keys(actual).forEach((field) => { + assert(expected.includes(field), `'${field}' not expected in ${expected}`); + }); } module.exports = { findReports, validate, validateContent }; From 11bd5e07cbdc57aa819beb1509cc21f47b10f80f Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 28 Feb 2019 20:54:35 -0500 Subject: [PATCH 186/213] test: rename node-report suite to report This commit renames the "node-report" test suite to "report" in order to begin differentiating core's diagnostic reporting from the original node-report module on npm PR-URL: https://github.com/nodejs/node/pull/26371 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Minwoo Jung Reviewed-By: James M Snell --- .../test-fatal-error.js => report/test-report-fatal-error.js} | 0 .../test-api-getreport.js => report/test-report-getreport.js} | 0 .../test-signal.js => report/test-report-signal.js} | 0 .../test-api-nohooks.js => report/test-report-triggerreport.js} | 0 .../test-report-uncaught-exception.js} | 0 .../test-api-uvhandles.js => report/test-report-uv-handles.js} | 0 test/{node-report => report}/testcfg.py | 2 +- 7 files changed, 1 insertion(+), 1 deletion(-) rename test/{node-report/test-fatal-error.js => report/test-report-fatal-error.js} (100%) rename test/{node-report/test-api-getreport.js => report/test-report-getreport.js} (100%) rename test/{node-report/test-signal.js => report/test-report-signal.js} (100%) rename test/{node-report/test-api-nohooks.js => report/test-report-triggerreport.js} (100%) rename test/{node-report/test-exception.js => report/test-report-uncaught-exception.js} (100%) rename test/{node-report/test-api-uvhandles.js => report/test-report-uv-handles.js} (100%) rename test/{node-report => report}/testcfg.py (64%) diff --git a/test/node-report/test-fatal-error.js b/test/report/test-report-fatal-error.js similarity index 100% rename from test/node-report/test-fatal-error.js rename to test/report/test-report-fatal-error.js diff --git a/test/node-report/test-api-getreport.js b/test/report/test-report-getreport.js similarity index 100% rename from test/node-report/test-api-getreport.js rename to test/report/test-report-getreport.js diff --git a/test/node-report/test-signal.js b/test/report/test-report-signal.js similarity index 100% rename from test/node-report/test-signal.js rename to test/report/test-report-signal.js diff --git a/test/node-report/test-api-nohooks.js b/test/report/test-report-triggerreport.js similarity index 100% rename from test/node-report/test-api-nohooks.js rename to test/report/test-report-triggerreport.js diff --git a/test/node-report/test-exception.js b/test/report/test-report-uncaught-exception.js similarity index 100% rename from test/node-report/test-exception.js rename to test/report/test-report-uncaught-exception.js diff --git a/test/node-report/test-api-uvhandles.js b/test/report/test-report-uv-handles.js similarity index 100% rename from test/node-report/test-api-uvhandles.js rename to test/report/test-report-uv-handles.js diff --git a/test/node-report/testcfg.py b/test/report/testcfg.py similarity index 64% rename from test/node-report/testcfg.py rename to test/report/testcfg.py index e5ea1f57a035b3..c06b75ce5c7dca 100644 --- a/test/node-report/testcfg.py +++ b/test/report/testcfg.py @@ -3,4 +3,4 @@ import testpy def GetConfiguration(context, root): - return testpy.ParallelTestConfiguration(context, root, 'node-report') + return testpy.ParallelTestConfiguration(context, root, 'report') From 8814d03d4d397a655956f8a57ba914cf2146fa79 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 28 Feb 2019 21:03:31 -0500 Subject: [PATCH 187/213] doc,lib,test: rename node-report to report This commit completes the renaming of node-report to report in order to better differentiate core's reporting from the node-report npm module. PR-URL: https://github.com/nodejs/node/pull/26371 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Minwoo Jung Reviewed-By: James M Snell --- doc/api/report.md | 6 +++--- lib/internal/bootstrap/pre_execution.js | 2 +- lib/internal/process/execution.js | 4 ++-- test/common/index.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/report.md b/doc/api/report.md index 419fe33417345d..90173a1cfaa154 100644 --- a/doc/api/report.md +++ b/doc/api/report.md @@ -32,7 +32,7 @@ is provided below for reference. "/home/nodeuser/project/node/out/Release/node", "--experimental-report", "--diagnostic-report-uncaught-exception", - "/home/nodeuser/project/node/test/node-report/test-exception.js", + "/home/nodeuser/project/node/test/report/test-exception.js", "child" ], "nodejsVersion": "v12.0.0-pre", @@ -66,8 +66,8 @@ is provided below for reference. "javascriptStack": { "message": "Error: *** test-exception.js: throwing uncaught Error", "stack": [ - "at myException (/home/nodeuser/project/node/test/node-report/test-exception.js:9:11)", - "at Object. (/home/nodeuser/project/node/test/node-report/test-exception.js:12:3)", + "at myException (/home/nodeuser/project/node/test/report/test-exception.js:9:11)", + "at Object. (/home/nodeuser/project/node/test/report/test-exception.js:12:3)", "at Module._compile (internal/modules/cjs/loader.js:718:30)", "at Object.Module._extensions..js (internal/modules/cjs/loader.js:729:10)", "at Module.load (internal/modules/cjs/loader.js:617:32)", diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index 072112e68ba07f..25becacf28cf5e 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -11,7 +11,7 @@ function prepareMainThreadExecution() { // Only main thread receives signals. setupSignalHandlers(); - // Process initial configurations of node-report, if any. + // Process initial diagnostic reporting configuration, if present. initializeReport(); initializeReportSignalHandlers(); // Main-thread-only. diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index a35feaacce28ff..575484d509a491 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -102,7 +102,7 @@ function createFatalException() { // call that threw and was never cleared. So clear it now. clearDefaultTriggerAsyncId(); - // If node-report is enabled, call into its handler to see + // If diagnostic reporting is enabled, call into its handler to see // whether it is interested in handling the situation. // Ignore if the error is scoped inside a domain. // use == in the checks as we want to allow for null and undefined @@ -119,7 +119,7 @@ function createFatalException() { report.onUnCaughtException(er ? er.stack : undefined); } } - } catch {} // NOOP, node_report unavailable. + } catch {} // Ignore the exception. Diagnostic reporting is unavailable. } if (exceptionHandlerState.captureFn !== null) { diff --git a/test/common/index.js b/test/common/index.js index 26a8fb4befa6c2..efb13c3f675e1a 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -635,7 +635,7 @@ function skipIfInspectorDisabled() { function skipIfReportDisabled() { if (!process.config.variables.node_report) { - skip('Node Report is disabled'); + skip('Diagnostic reporting is disabled'); } } From 6e9a7e1048809577b1007f6bca5fa1f8a6ff3838 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 28 Feb 2019 15:43:07 -0800 Subject: [PATCH 188/213] tools: remove unneeded .gitignore entries Remove entries from `.gitignore` that are already covered by the generic `.*` entry on line 2 of the .gitignore file. PR-URL: https://github.com/nodejs/node/pull/26370 Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: James M Snell --- .gitignore | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.gitignore b/.gitignore index dad5a3efd8bcae..05e859c3066802 100644 --- a/.gitignore +++ b/.gitignore @@ -22,9 +22,7 @@ vgcore.* v8*.log perf.data perf.data.old -.waf* tags -.lock-wscript *.pyc doc/api.xml tmp/ @@ -34,9 +32,7 @@ iojs_g node node_g *.swp -.benchmark_reports icu_config.gypi -.eslintcache node_trace.*.log coverage/ !**/node_modules/**/coverage @@ -64,8 +60,6 @@ ipch/ *.opensdf *.VC.db *.VC.opendb -.vs/ -.vscode/ /*.exe /config.mk @@ -86,7 +80,6 @@ deps/icu*.tgz deps/icu-tmp ./node_modules android-toolchain/ -.svn/ # generated by gyp on Windows deps/openssl/openssl.props From 96a57654913d23364f7c31f83536e2b90022cfff Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 1 Mar 2019 21:30:03 -0800 Subject: [PATCH 189/213] tools: update extend to 3.0.2 Update `extend` to 3.0.2 as 3.0.1 is susceptible to a low-severity security issue. Refs: https://snyk.io/vuln/npm:extend:20180424 PR-URL: https://github.com/nodejs/node/pull/26392 Reviewed-By: Richard Lau Reviewed-By: Masashi Hirano Reviewed-By: Colin Ihrig --- tools/doc/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index c688e60c1577c8..5b8b52ac041187 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -108,9 +108,9 @@ "dev": true }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "foreach": { "version": "2.0.5", @@ -611,9 +611,9 @@ "integrity": "sha512-bWLv9BbWbbd7mlqqs2oQYnLD/U/ZqeJeJwbO0FG2zA1aTq+HTvxfHNKFa/HGCVyJpDiioUYaBhfiT6rgk+l4mg==" }, "trough": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.2.tgz", - "integrity": "sha512-FHkoUZvG6Egrv9XZAyYGKEyb1JMsFphgPjoczkZC2y6W93U1jswcVURB8MUvtsahEPEVACyxD47JAL63vF4JsQ==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.3.tgz", + "integrity": "sha512-fwkLWH+DimvA4YCy+/nvJd61nWQQ2liO/nF/RjkTpiOGi+zxZzVkhb1mvbHIIW4b/8nDsYI8uTmAlc0nNkRMOw==" }, "unherit": { "version": "1.1.1", From 2438a4350d7a47b8a0e13352bb644feb751f8ec5 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Sat, 23 Feb 2019 18:18:10 +0800 Subject: [PATCH 190/213] src: remove unused macro in env.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26273 Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca --- src/env.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/env.cc b/src/env.cc index aec43a0312d9ca..72966a07422ede 100644 --- a/src/env.cc +++ b/src/env.cc @@ -47,8 +47,6 @@ using v8::Undefined; using v8::Value; using worker::Worker; -#define kTraceCategoryCount 1 - // TODO(@jasnell): Likely useful to move this to util or node_internal to // allow reuse. But since we're not reusing it yet... class TraceEventScope { From cb2cbf2eca3523c9276e61ecfda4b5f958794a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Sun, 24 Feb 2019 15:18:26 -0500 Subject: [PATCH 191/213] src: remove already elevated Isolate namespce MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26294 Reviewed-By: Michaël Zasso Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- src/node_platform.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_platform.cc b/src/node_platform.cc index 139e2ebfc1f5ec..da28de0a844929 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -223,7 +223,7 @@ int WorkerThreadsTaskRunner::NumberOfWorkerThreads() const { } PerIsolatePlatformData::PerIsolatePlatformData( - v8::Isolate* isolate, uv_loop_t* loop) + Isolate* isolate, uv_loop_t* loop) : loop_(loop) { flush_tasks_ = new uv_async_t(); CHECK_EQ(0, uv_async_init(loop, flush_tasks_, FlushTasks)); @@ -434,11 +434,11 @@ void NodePlatform::CallDelayedOnForegroundThread(Isolate* isolate, std::unique_ptr(task), delay_in_seconds); } -bool NodePlatform::FlushForegroundTasks(v8::Isolate* isolate) { +bool NodePlatform::FlushForegroundTasks(Isolate* isolate) { return ForIsolate(isolate)->FlushForegroundTasksInternal(); } -void NodePlatform::CancelPendingDelayedTasks(v8::Isolate* isolate) { +void NodePlatform::CancelPendingDelayedTasks(Isolate* isolate) { ForIsolate(isolate)->CancelPendingDelayedTasks(); } From 030b7449411f01c7229479fbad32312a4905772d Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 6 Feb 2019 17:42:24 +0200 Subject: [PATCH 192/213] esm: process proxy Symbol.toString fix PR-URL: https://github.com/nodejs/node/pull/25963 Reviewed-By: John-David Dalton Reviewed-By: Anna Henningsen Reviewed-By: Gus Caplan Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Ruben Bridgewater --- lib/internal/bootstrap/node.js | 6 ++++++ test/es-module/test-esm-process.mjs | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 test/es-module/test-esm-process.mjs diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index a198674c139e9b..766f9a6f4c6674 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -347,6 +347,12 @@ function setupProcessObject() { const origProcProto = Object.getPrototypeOf(process); Object.setPrototypeOf(origProcProto, EventEmitter.prototype); EventEmitter.call(process); + Object.defineProperty(process, Symbol.toStringTag, { + enumerable: false, + writable: false, + configurable: false, + value: 'process' + }); // Make process globally available to users by putting it on the global proxy global.process = process; } diff --git a/test/es-module/test-esm-process.mjs b/test/es-module/test-esm-process.mjs new file mode 100644 index 00000000000000..24cf489a988565 --- /dev/null +++ b/test/es-module/test-esm-process.mjs @@ -0,0 +1,6 @@ +// Flags: --experimental-modules +import '../common'; +import assert from 'assert'; +import process from 'process'; + +assert.strictEqual(Object.prototype.toString.call(process), '[object process]'); From 846cba056e331d7e079a27c529c395eb453b2833 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 28 Feb 2019 22:16:24 -0800 Subject: [PATCH 193/213] doc: edit deprecation identifier info in Collaborator Guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Edit the deprecation identifier material in the Collaborator Guide for simplicity and clarity. PR-URL: https://github.com/nodejs/node/pull/26372 Reviewed-By: Colin Ihrig Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Anto Aravinth --- COLLABORATOR_GUIDE.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 9456d64c64ecb7..646bc408a5fa89 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -347,13 +347,11 @@ Runtime Deprecations and End-of-life APIs (internal or public) are breaking changes (`semver-major`). The TSC may make exceptions, deciding that one of these deprecations is not a breaking change. -All Documentation-Only and Runtime deprecations will be assigned a unique -identifier that can be used to persistently refer to the deprecation in -documentation, emitted process warnings, or errors thrown. Documentation for -these identifiers will be included in the Node.js API documentation and will -be immutable once assigned. Even if End-of-Life code is removed from Node.js, -the documentation for the assigned deprecation identifier must remain in the -Node.js API documentation. +All deprecations receive a unique and immutable identifier. Documentation, +warnings, and errors use the identifier when referring to the deprecation. The +documentation for the assigned deprecation identifier must always remain in the +API documentation. This is true even if the deprecation is no longer in use (for +example, due to removal of an End-of-Life deprecated API). A _Deprecation cycle_ is a major release during which an API has been in one of From 91b61452c352bccc2ade634a94f2e14a67863d97 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 28 Feb 2019 21:29:08 +0100 Subject: [PATCH 194/213] test: always activate colors if necessary PR-URL: https://github.com/nodejs/node/pull/26264 Refs: https://github.com/nodejs/node/pull/26261 Reviewed-By: Anna Henningsen Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell --- test/pseudo-tty/test-assert-colors.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/pseudo-tty/test-assert-colors.js b/test/pseudo-tty/test-assert-colors.js index e843bcb218a078..76001bf786bb5d 100644 --- a/test/pseudo-tty/test-assert-colors.js +++ b/test/pseudo-tty/test-assert-colors.js @@ -5,6 +5,10 @@ const assert = require('assert').strict; try { // Activate colors even if the tty does not support colors. process.env.COLORTERM = '1'; + // Make sure TERM is not set to e.g., 'dumb' and NODE_DISABLE_COLORS is not + // active. + process.env.TERM = 'FOOBAR'; + delete process.env.NODE_DISABLE_COLORS; assert.deepStrictEqual([1, 2, 2, 2], [2, 2, 2, 2]); } catch (err) { const expected = 'Expected values to be strictly deep-equal:\n' + From b6355ef60290b59edbd31bc6139a33b8b41a5ef1 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 22 Feb 2019 19:15:07 +0100 Subject: [PATCH 195/213] tty: improve color detection 1) Using `process.env.TERM = 'dumb'` should never return any colors. 2) `process.env.TERM = 'terminator'` supports 24 bit colors. 3) Add support for `process.env.TERM = 'rxvt-unicode-24bit'` 4) `Hyper` does not support true colors anymore. It should fall back to the xterm settings in regular cases. 5) `process.env.COLORTERM = 'truecolor'` should return 24 bit colors. PR-URL: https://github.com/nodejs/node/pull/26264 Refs: https://github.com/nodejs/node/pull/26261 Reviewed-By: Anna Henningsen Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell --- lib/internal/tty.js | 49 +++++++++++---------- test/pseudo-tty/test-tty-get-color-depth.js | 12 +++-- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/lib/internal/tty.js b/lib/internal/tty.js index ea0bea4bfac94c..45f278d542c107 100644 --- a/lib/internal/tty.js +++ b/lib/internal/tty.js @@ -36,22 +36,25 @@ const COLORS_16m = 24; // Copyright (C) 1996-2016 Free Software Foundation, Inc. Copying and // distribution of this file, with or without modification, are permitted // provided the copyright notice and this notice are preserved. -const TERM_ENVS = [ - 'eterm', - 'cons25', - 'console', - 'cygwin', - 'dtterm', - 'gnome', - 'hurd', - 'jfbterm', - 'konsole', - 'kterm', - 'mlterm', - 'putty', - 'st', - 'terminator' -]; +const TERM_ENVS = { + 'eterm': COLORS_16, + 'cons25': COLORS_16, + 'console': COLORS_16, + 'cygwin': COLORS_16, + 'dtterm': COLORS_16, + 'gnome': COLORS_16, + 'hurd': COLORS_16, + 'jfbterm': COLORS_16, + 'konsole': COLORS_16, + 'kterm': COLORS_16, + 'mlterm': COLORS_16, + 'putty': COLORS_16, + 'st': COLORS_16, + // https://github.com/da-x/rxvt-unicode/tree/v9.22-with-24bit-color + 'rxvt-unicode-24bit': COLORS_16m, + // https://gist.github.com/XVilka/8346728#gistcomment-2823421 + 'terminator': COLORS_16m +}; const TERM_ENVS_REG_EXP = [ /ansi/, @@ -68,7 +71,7 @@ const TERM_ENVS_REG_EXP = [ // https://github.com/chalk/supports-color, // https://github.com/isaacs/color-support. function getColorDepth(env = process.env) { - if (env.NODE_DISABLE_COLORS || env.TERM === 'dumb' && !env.COLORTERM) { + if (env.NODE_DISABLE_COLORS || env.TERM === 'dumb') { return COLORS_2; } @@ -117,7 +120,6 @@ function getColorDepth(env = process.env) { } return COLORS_16m; case 'HyperTerm': - case 'Hyper': case 'MacTerm': return COLORS_16m; case 'Apple_Terminal': @@ -130,10 +132,8 @@ function getColorDepth(env = process.env) { const termEnv = env.TERM.toLowerCase(); - for (const term of TERM_ENVS) { - if (termEnv === term) { - return COLORS_16; - } + if (TERM_ENVS[termEnv]) { + return TERM_ENVS[termEnv]; } for (const term of TERM_ENVS_REG_EXP) { if (term.test(termEnv)) { @@ -142,8 +142,11 @@ function getColorDepth(env = process.env) { } } - if (env.COLORTERM) + if (env.COLORTERM) { + if (env.COLORTERM === 'truecolor' || env.COLORTERM === '24bit') + return COLORS_16m; return COLORS_16; + } return COLORS_2; } diff --git a/test/pseudo-tty/test-tty-get-color-depth.js b/test/pseudo-tty/test-tty-get-color-depth.js index d4062f5fdb6d39..14151ec3fb2f01 100644 --- a/test/pseudo-tty/test-tty-get-color-depth.js +++ b/test/pseudo-tty/test-tty-get-color-depth.js @@ -3,6 +3,7 @@ const common = require('../common'); const assert = require('assert').strict; const { WriteStream } = require('tty'); +const { inspect } = require('util'); const fd = common.getTTYfd(); const writeStream = new WriteStream(fd); @@ -16,6 +17,8 @@ const writeStream = new WriteStream(fd); // Check different environment variables. [ [{ COLORTERM: '1' }, 4], + [{ COLORTERM: 'truecolor' }, 24], + [{ COLORTERM: '24bit' }, 24], [{ TMUX: '1' }, 8], [{ CI: '1' }, 1], [{ CI: '1', TRAVIS: '1' }, 8], @@ -29,7 +32,7 @@ const writeStream = new WriteStream(fd); [{ TERM_PROGRAM: 'iTerm.app', TERM_PROGRAM_VERSION: '3.0' }, 24], [{ TERM_PROGRAM: 'iTerm.app', TERM_PROGRAM_VERSION: '2.0' }, 8], [{ TERM_PROGRAM: 'HyperTerm' }, 24], - [{ TERM_PROGRAM: 'Hyper' }, 24], + [{ TERM_PROGRAM: 'Hyper' }, 1], [{ TERM_PROGRAM: 'MacTerm' }, 24], [{ TERM_PROGRAM: 'Apple_Terminal' }, 8], [{ TERM: 'xterm-256' }, 8], @@ -40,13 +43,16 @@ const writeStream = new WriteStream(fd); [{ TERM: 'fail' }, 1], [{ NODE_DISABLE_COLORS: '1' }, 1], [{ TERM: 'dumb' }, 1], - [{ TERM: 'dumb', COLORTERM: '1' }, 4], + [{ TERM: 'dumb', COLORTERM: '1' }, 1], + [{ TERM: 'terminator' }, 24], + [{ TERM: 'console' }, 4] ].forEach(([env, depth], i) => { const actual = writeStream.getColorDepth(env); assert.strictEqual( actual, depth, - `i: ${i}, expected: ${depth}, actual: ${actual}, env: ${env}` + `i: ${i}, expected: ${depth}, ` + + `actual: ${actual}, env: ${inspect(env)}` ); }); From 93d7fa3df3331d929200007e5ff4caa823343168 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sun, 27 Jan 2019 04:02:46 +0100 Subject: [PATCH 196/213] test: only inspect on failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The inspection was done in all cases so far and that's not necessary. Therefore this changed this behavior to only inspect the input on failure cases. PR-URL: https://github.com/nodejs/node/pull/26360 Reviewed-By: Richard Lau Reviewed-By: Michaël Zasso Reviewed-By: Rich Trott --- test/parallel/test-path-join.js | 7 ++++--- test/parallel/test-path-relative.js | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-path-join.js b/test/parallel/test-path-join.js index 945cf0e9b5d772..a9fb5b1e927552 100644 --- a/test/parallel/test-path-join.js +++ b/test/parallel/test-path-join.js @@ -131,11 +131,12 @@ joinTests.forEach((test) => { } else { os = 'posix'; } - const message = - `path.${os}.join(${test[0].map(JSON.stringify).join(',')})\n expect=${ + if (actual !== expected && actualAlt !== expected) { + const delimiter = test[0].map(JSON.stringify).join(','); + const message = `path.${os}.join(${delimiter})\n expect=${ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; - if (actual !== expected && actualAlt !== expected) failures.push(`\n${message}`); + } }); }); }); diff --git a/test/parallel/test-path-relative.js b/test/parallel/test-path-relative.js index bd2c3f75a52dd2..26521bc088a8f7 100644 --- a/test/parallel/test-path-relative.js +++ b/test/parallel/test-path-relative.js @@ -56,12 +56,13 @@ relativeTests.forEach((test) => { test[1].forEach((test) => { const actual = relative(test[0], test[1]); const expected = test[2]; - const os = relative === path.win32.relative ? 'win32' : 'posix'; - const message = `path.${os}.relative(${ - test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${ - JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; - if (actual !== expected) + if (actual !== expected) { + const os = relative === path.win32.relative ? 'win32' : 'posix'; + const message = `path.${os}.relative(${ + test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${ + JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; failures.push(`\n${message}`); + } }); }); assert.strictEqual(failures.length, 0, failures.join('')); From 4c254d62942eb6669ea67e4bfbc38cbc1ab2c4b3 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 28 Feb 2019 11:03:37 +0100 Subject: [PATCH 197/213] repl: use object writer for thrown errors This makes us use the defaults that were set for the REPL, i.e. aligns with the printing of expression completion values, and in particular enables color support. PR-URL: https://github.com/nodejs/node/pull/26361 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Anto Aravinth Reviewed-By: James M Snell --- lib/repl.js | 4 ++-- test/parallel/test-repl-pretty-stack.js | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index cbf3889aba3663..70abd8b7eadbc4 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -416,7 +416,7 @@ function REPLServer(prompt, (_, pre, line) => pre + (line - 1)); } } - errStack = util.inspect(e); + errStack = self.writer(e); // Remove one line error braces to keep the old style in place. if (errStack[errStack.length - 1] === ']') { @@ -426,7 +426,7 @@ function REPLServer(prompt, } if (errStack === '') { - errStack = `Thrown: ${util.inspect(e)}\n`; + errStack = `Thrown: ${self.writer(e)}\n`; } else { const ln = errStack.endsWith('\n') ? '' : '\n'; errStack = `Thrown:\n${errStack}${ln}`; diff --git a/test/parallel/test-repl-pretty-stack.js b/test/parallel/test-repl-pretty-stack.js index e4137b84a4c2b5..4bf18fa1c2da92 100644 --- a/test/parallel/test-repl-pretty-stack.js +++ b/test/parallel/test-repl-pretty-stack.js @@ -6,7 +6,7 @@ const assert = require('assert'); const repl = require('repl'); -function run({ command, expected }) { +function run({ command, expected, ...extraREPLOptions }) { let accum = ''; const inputStream = new ArrayStream(); @@ -19,7 +19,8 @@ function run({ command, expected }) { input: inputStream, output: outputStream, terminal: false, - useColors: false + useColors: false, + ...extraREPLOptions }); r.write(`${command}\n`); @@ -44,6 +45,18 @@ const tests = [ command: 'throw new Error(\'Whoops!\')', expected: 'Thrown:\nError: Whoops!\n' }, + { + command: '(() => { const err = Error(\'Whoops!\'); ' + + 'err.foo = \'bar\'; throw err; })()', + expected: 'Thrown:\n{ Error: Whoops!\n at repl:1:22 foo: \'bar\' }\n', + }, + { + command: '(() => { const err = Error(\'Whoops!\'); ' + + 'err.foo = \'bar\'; throw err; })()', + expected: 'Thrown:\n{ Error: Whoops!\n at repl:1:22 foo: ' + + "\u001b[32m'bar'\u001b[39m }\n", + useColors: true + }, { command: 'foo = bar;', expected: 'Thrown:\nReferenceError: bar is not defined\n' From 851a691678e3febad27d7bf906b1ab20f4c566d9 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 28 Feb 2019 22:25:59 +0100 Subject: [PATCH 198/213] zlib: report premature ends earlier Report end-of-stream when decompressing when we detect it, and do not wait until the writable side of a zlib stream is closed as well. Refs: https://github.com/nodejs/node/issues/26332 PR-URL: https://github.com/nodejs/node/pull/26363 Refs: https://github.com/nodejs/node/issues/26332 Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- lib/zlib.js | 10 +++++++ test/parallel/test-zlib-premature-end.js | 33 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/parallel/test-zlib-premature-end.js diff --git a/lib/zlib.js b/lib/zlib.js index 560435d7f1fff8..3bc82e36a82d1d 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -545,6 +545,16 @@ function processCallback() { return; } + if (availInAfter > 0) { + // If we have more input that should be written, but we also have output + // space available, that means that the compression library was not + // interested in receiving more data, and in particular that the input + // stream has ended early. + // This applies to streams where we don't check data past the end of + // what was consumed; that is, everything except Gunzip/Unzip. + self.push(null); + } + // finished with the chunk. this.buffer = null; this.cb(); diff --git a/test/parallel/test-zlib-premature-end.js b/test/parallel/test-zlib-premature-end.js new file mode 100644 index 00000000000000..9e191c4c88282c --- /dev/null +++ b/test/parallel/test-zlib-premature-end.js @@ -0,0 +1,33 @@ +'use strict'; +const common = require('../common'); +const zlib = require('zlib'); +const assert = require('assert'); + +const input = '0123456789'.repeat(4); + +for (const [ compress, decompressor ] of [ + [ zlib.deflateRawSync, zlib.createInflateRaw ], + [ zlib.deflateSync, zlib.createInflate ], + [ zlib.brotliCompressSync, zlib.createBrotliDecompress ] +]) { + const compressed = compress(input); + const trailingData = Buffer.from('not valid compressed data'); + + for (const variant of [ + (stream) => { stream.end(compressed); }, + (stream) => { stream.write(compressed); stream.write(trailingData); }, + (stream) => { stream.write(compressed); stream.end(trailingData); }, + (stream) => { stream.write(Buffer.concat([compressed, trailingData])); }, + (stream) => { stream.end(Buffer.concat([compressed, trailingData])); } + ]) { + let output = ''; + const stream = decompressor(); + stream.setEncoding('utf8'); + stream.on('data', (chunk) => output += chunk); + stream.on('end', common.mustCall(() => { + assert.strictEqual(output, input); + assert.strictEqual(stream.bytesWritten, compressed.length); + })); + variant(stream); + } +} From b2c77ec081a9d0cf8074f9d7d7e99b358017e94d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 1 Mar 2019 17:10:25 -0500 Subject: [PATCH 199/213] report: use triggerReport() to handle exceptions This commit uses the triggerReport() binding to handle uncaught exceptions and removes the custom onUncaughtException function. PR-URL: https://github.com/nodejs/node/pull/26386 Reviewed-By: Richard Lau Reviewed-By: James M Snell --- lib/internal/process/execution.js | 5 ++++- lib/internal/process/report.js | 2 +- src/node_report_module.cc | 30 +++++++----------------------- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index 575484d509a491..eb06dc04807741 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -116,7 +116,10 @@ function createFatalException() { report.syncConfig(config, false); if (Array.isArray(config.events) && config.events.includes('exception')) { - report.onUnCaughtException(er ? er.stack : undefined); + report.triggerReport(er ? er.message : 'Exception', + 'Exception', + null, + er ? er.stack : undefined); } } } catch {} // Ignore the exception. Diagnostic reporting is unavailable. diff --git a/lib/internal/process/report.js b/lib/internal/process/report.js index 141a150a715555..5d314cdeff0783 100644 --- a/lib/internal/process/report.js +++ b/lib/internal/process/report.js @@ -87,7 +87,7 @@ const report = { throw new ERR_INVALID_ARG_TYPE('err', 'Object', err); } - return nr.triggerReport(file, err.stack); + return nr.triggerReport('JavaScript API', 'API', file, err.stack); }, getReport(err) { emitExperimentalWarning('report'); diff --git a/src/node_report_module.cc b/src/node_report_module.cc index 0e3f8981b71aac..127e3258a8dfaa 100644 --- a/src/node_report_module.cc +++ b/src/node_report_module.cc @@ -35,7 +35,6 @@ using v8::V8; using v8::Value; // Internal/static function declarations -void OnUncaughtException(const FunctionCallbackInfo& info); static void Initialize(Local exports, Local unused, Local context); @@ -48,14 +47,16 @@ void TriggerReport(const FunctionCallbackInfo& info) { std::string filename; Local stackstr; - CHECK_EQ(info.Length(), 2); - stackstr = info[1].As(); + CHECK_EQ(info.Length(), 4); + String::Utf8Value message(isolate, info[0].As()); + String::Utf8Value trigger(isolate, info[1].As()); + stackstr = info[3].As(); - if (info[0]->IsString()) - filename = *String::Utf8Value(isolate, info[0]); + if (info[2]->IsString()) + filename = *String::Utf8Value(isolate, info[2]); filename = TriggerNodeReport( - isolate, env, "JavaScript API", __func__, filename, stackstr); + isolate, env, *message, *trigger, filename, stackstr); // Return value is the report filename info.GetReturnValue().Set( String::NewFromUtf8(isolate, filename.c_str(), v8::NewStringType::kNormal) @@ -79,22 +80,6 @@ void GetReport(const FunctionCallbackInfo& info) { .ToLocalChecked()); } -// Callbacks for triggering report on uncaught exception. -// Calls triggered from JS land. -void OnUncaughtException(const FunctionCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - Isolate* isolate = env->isolate(); - HandleScope scope(isolate); - std::string filename; - std::shared_ptr options = env->isolate_data()->options(); - - // Trigger report if requested - if (options->report_uncaught_exception) { - TriggerNodeReport( - isolate, env, "exception", __func__, filename, info[0].As()); - } -} - // Signal handler for report action, called from JS land (util.js) void OnUserSignal(const FunctionCallbackInfo& info) { Environment* env = Environment::GetCurrent(info); @@ -239,7 +224,6 @@ static void Initialize(Local exports, std::shared_ptr options = env->isolate_data()->options(); env->SetMethod(exports, "triggerReport", TriggerReport); env->SetMethod(exports, "getReport", GetReport); - env->SetMethod(exports, "onUnCaughtException", OnUncaughtException); env->SetMethod(exports, "onUserSignal", OnUserSignal); env->SetMethod(exports, "syncConfig", SyncConfig); } From b216f44513a8a7225827e29d0273d94d3956cbe3 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 1 Mar 2019 17:14:13 -0500 Subject: [PATCH 200/213] src: remove unnecessary function declaration PR-URL: https://github.com/nodejs/node/pull/26386 Reviewed-By: Richard Lau Reviewed-By: James M Snell --- src/node_report_module.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/node_report_module.cc b/src/node_report_module.cc index 127e3258a8dfaa..c9a3a28952ad86 100644 --- a/src/node_report_module.cc +++ b/src/node_report_module.cc @@ -34,11 +34,6 @@ using v8::String; using v8::V8; using v8::Value; -// Internal/static function declarations -static void Initialize(Local exports, - Local unused, - Local context); - // External JavaScript API for triggering a report void TriggerReport(const FunctionCallbackInfo& info) { Environment* env = Environment::GetCurrent(info); From 0579f4283fb8e19297377279494929b2dc2bc373 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 1 Mar 2019 18:00:51 -0500 Subject: [PATCH 201/213] report: use triggerReport() to handle signals This commit uses the triggerReport() binding to handle signals and removes the custom onUserSignal() function. PR-URL: https://github.com/nodejs/node/pull/26386 Reviewed-By: Richard Lau Reviewed-By: James M Snell --- lib/internal/process/report.js | 2 +- src/node_report.cc | 2 +- src/node_report_module.cc | 13 ------------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/internal/process/report.js b/lib/internal/process/report.js index 5d314cdeff0783..daf948258c3172 100644 --- a/lib/internal/process/report.js +++ b/lib/internal/process/report.js @@ -104,7 +104,7 @@ const report = { function handleSignal(signo) { if (typeof signo !== 'string') signo = config.signal; - nr.onUserSignal(signo); + nr.triggerReport(signo, 'Signal', null, ''); } module.exports = { diff --git a/src/node_report.cc b/src/node_report.cc index bd6e7100416e9c..4617fb627155de 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -377,7 +377,7 @@ static void PrintJavaScriptStack(JSONWriter* writer, std::string ss; if ((!strcmp(location, "OnFatalError")) || - (!strcmp(location, "OnUserSignal"))) { + (!strcmp(location, "Signal"))) { ss = "No stack.\nUnavailable.\n"; } else { String::Utf8Value sv(isolate, stackstr); diff --git a/src/node_report_module.cc b/src/node_report_module.cc index c9a3a28952ad86..31974f25104046 100644 --- a/src/node_report_module.cc +++ b/src/node_report_module.cc @@ -75,18 +75,6 @@ void GetReport(const FunctionCallbackInfo& info) { .ToLocalChecked()); } -// Signal handler for report action, called from JS land (util.js) -void OnUserSignal(const FunctionCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - Isolate* isolate = env->isolate(); - CHECK(info[0]->IsString()); - Local str = info[0].As(); - String::Utf8Value value(isolate, str); - std::string filename; - TriggerNodeReport( - isolate, env, *value, __func__, filename, info[0].As()); -} - // A method to sync up data elements in the JS land with its // corresponding elements in the C++ world. Required because // (i) the tunables are first intercepted through the CLI but @@ -219,7 +207,6 @@ static void Initialize(Local exports, std::shared_ptr options = env->isolate_data()->options(); env->SetMethod(exports, "triggerReport", TriggerReport); env->SetMethod(exports, "getReport", GetReport); - env->SetMethod(exports, "onUserSignal", OnUserSignal); env->SetMethod(exports, "syncConfig", SyncConfig); } From 3093617c0e73303ffc1cad4bb15f6526d73d0458 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 1 Mar 2019 18:20:12 -0500 Subject: [PATCH 202/213] src: remove unused variable PR-URL: https://github.com/nodejs/node/pull/26386 Reviewed-By: Richard Lau Reviewed-By: James M Snell --- src/node_report_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_report_module.cc b/src/node_report_module.cc index 31974f25104046..cf17db62db235b 100644 --- a/src/node_report_module.cc +++ b/src/node_report_module.cc @@ -204,7 +204,7 @@ static void Initialize(Local exports, Local unused, Local context) { Environment* env = Environment::GetCurrent(context); - std::shared_ptr options = env->isolate_data()->options(); + env->SetMethod(exports, "triggerReport", TriggerReport); env->SetMethod(exports, "getReport", GetReport); env->SetMethod(exports, "syncConfig", SyncConfig); From 2908e6313b7147c19cf36c27c24790e47443d61b Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 1 Mar 2019 19:15:38 -0500 Subject: [PATCH 203/213] report: rename location to trigger trigger more accurately describes the use of the field. Previously, location was just the name of the C++ function that called TriggerNodeReport(). PR-URL: https://github.com/nodejs/node/pull/26386 Reviewed-By: Richard Lau Reviewed-By: James M Snell --- doc/api/report.md | 2 +- src/node_errors.cc | 2 +- src/node_report.cc | 24 ++++++++++++------------ src/node_report.h | 4 ++-- test/common/report.js | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/api/report.md b/doc/api/report.md index 90173a1cfaa154..856cd80119ab79 100644 --- a/doc/api/report.md +++ b/doc/api/report.md @@ -23,7 +23,7 @@ is provided below for reference. { "header": { "event": "exception", - "location": "OnUncaughtException", + "trigger": "Exception", "filename": "report.20181221.005011.8974.001.json", "dumpEventTime": "2018-12-21T00:50:11Z", "dumpEventTimeStamp": "1545371411331", diff --git a/src/node_errors.cc b/src/node_errors.cc index 17394c863cd079..1c15b5558457d4 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -318,7 +318,7 @@ void OnFatalError(const char* location, const char* message) { Environment* env = Environment::GetCurrent(isolate); if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) { report::TriggerNodeReport( - isolate, env, message, __func__, "", Local()); + isolate, env, message, "FatalError", "", Local()); } #endif // NODE_REPORT fflush(stderr); diff --git a/src/node_report.cc b/src/node_report.cc index 4617fb627155de..85c66a51bf70dd 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -70,7 +70,7 @@ using v8::Value; static void WriteNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, const std::string& filename, std::ostream& out, Local stackstr, @@ -79,7 +79,7 @@ static void PrintVersionInformation(JSONWriter* writer); static void PrintJavaScriptStack(JSONWriter* writer, Isolate* isolate, Local stackstr, - const char* location); + const char* trigger); static void PrintNativeStack(JSONWriter* writer); #ifndef _WIN32 static void PrintResourceUsage(JSONWriter* writer); @@ -100,7 +100,7 @@ static std::atomic_int seq = {0}; // sequence number for report filenames std::string TriggerNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, std::string name, Local stackstr) { std::ostringstream oss; @@ -178,7 +178,7 @@ std::string TriggerNodeReport(Isolate* isolate, << "Writing Node.js report to file: " << filename << std::endl; } - WriteNodeReport(isolate, env, message, location, filename, *outstream, + WriteNodeReport(isolate, env, message, trigger, filename, *outstream, stackstr, &tm_struct); // Do not close stdout/stderr, only close files we opened. @@ -194,14 +194,14 @@ std::string TriggerNodeReport(Isolate* isolate, void GetNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, Local stackstr, std::ostream& out) { // Obtain the current time and the pid (platform dependent) TIME_TYPE tm_struct; LocalTime(&tm_struct); WriteNodeReport( - isolate, env, message, location, "", out, stackstr, &tm_struct); + isolate, env, message, trigger, "", out, stackstr, &tm_struct); } // Internal function to coordinate and write the various @@ -209,7 +209,7 @@ void GetNodeReport(Isolate* isolate, static void WriteNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, const std::string& filename, std::ostream& out, Local stackstr, @@ -228,7 +228,7 @@ static void WriteNodeReport(Isolate* isolate, writer.json_objectstart("header"); writer.json_keyvalue("event", message); - writer.json_keyvalue("location", location); + writer.json_keyvalue("trigger", trigger); if (!filename.empty()) writer.json_keyvalue("filename", filename); else @@ -280,7 +280,7 @@ static void WriteNodeReport(Isolate* isolate, writer.json_objectend(); // Report summary JavaScript stack backtrace - PrintJavaScriptStack(&writer, isolate, stackstr, location); + PrintJavaScriptStack(&writer, isolate, stackstr, trigger); // Report native stack backtrace PrintNativeStack(&writer); @@ -372,12 +372,12 @@ static void PrintVersionInformation(JSONWriter* writer) { static void PrintJavaScriptStack(JSONWriter* writer, Isolate* isolate, Local stackstr, - const char* location) { + const char* trigger) { writer->json_objectstart("javascriptStack"); std::string ss; - if ((!strcmp(location, "OnFatalError")) || - (!strcmp(location, "Signal"))) { + if ((!strcmp(trigger, "FatalError")) || + (!strcmp(trigger, "Signal"))) { ss = "No stack.\nUnavailable.\n"; } else { String::Utf8Value sv(isolate, stackstr); diff --git a/src/node_report.h b/src/node_report.h index 2aa55151d87dca..7d36557e669048 100644 --- a/src/node_report.h +++ b/src/node_report.h @@ -43,13 +43,13 @@ typedef struct tm TIME_TYPE; std::string TriggerNodeReport(v8::Isolate* isolate, node::Environment* env, const char* message, - const char* location, + const char* trigger, std::string name, v8::Local stackstr); void GetNodeReport(v8::Isolate* isolate, node::Environment* env, const char* message, - const char* location, + const char* trigger, v8::Local stackstr, std::ostream& out); diff --git a/test/common/report.js b/test/common/report.js index c544cd86787fab..5655602fe81f5d 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -58,7 +58,7 @@ function _validateContent(data) { // Verify the format of the header section. const header = report.header; - const headerFields = ['event', 'location', 'filename', 'dumpEventTime', + const headerFields = ['event', 'trigger', 'filename', 'dumpEventTime', 'dumpEventTimeStamp', 'processId', 'commandLine', 'nodejsVersion', 'wordSize', 'arch', 'platform', 'componentVersions', 'release', 'osName', 'osRelease', @@ -66,7 +66,7 @@ function _validateContent(data) { 'glibcVersionCompiler']; checkForUnknownFields(header, headerFields); assert.strictEqual(typeof header.event, 'string'); - assert.strictEqual(typeof header.location, 'string'); + assert.strictEqual(typeof header.trigger, 'string'); assert(typeof header.filename === 'string' || header.filename === null); assert.notStrictEqual(new Date(header.dumpEventTime).toString(), 'Invalid Date'); From b25694d7adfc7cbb18cbe98e9ca0850b2bac10c0 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 24 Jan 2019 12:40:41 -0500 Subject: [PATCH 204/213] meta: update note about building on smartOS 16 PR-URL: https://github.com/nodejs/node/pull/25684 Refs: https://github.com/nodejs/node/pull/25683 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- BUILDING.md | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 03e25f56a97f17..c940e7be1504ae 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -80,8 +80,8 @@ platforms. This is true regardless of entries in the table below. | GNU/Linux | Tier 1 | kernel >= 2.6.32, glibc >= 2.12 | x64, arm | | | GNU/Linux | Tier 1 | kernel >= 3.10, glibc >= 2.17 | arm64 | | | macOS/OS X | Tier 1 | >= 10.11 | x64 | | -| Windows | Tier 1 | >= Windows 7/2008 R2/2012 R2 | x86, x64 | [2](#fn2),[3](#fn3),[4](#fn4) | -| SmartOS | Tier 2 | >= 15 < 16.4 | x86, x64 | [1](#fn1) | +| Windows | Tier 1 | >= Windows 7/2008 R2/2012 R2 | x86, x64 | [1](#fn1),[2](#fn2),[3](#fn3) | +| SmartOS | Tier 2 | >= 16 | x64 | | | FreeBSD | Tier 2 | >= 11 | x64 | | | GNU/Linux | Tier 2 | kernel >= 3.13.0, glibc >= 2.19 | ppc64le >=power8 | | | AIX | Tier 2 | >= 7.1 TL04 | ppc64be >=power7 | | @@ -89,25 +89,16 @@ platforms. This is true regardless of entries in the table below. | GNU/Linux | Experimental | kernel >= 2.6.32, glibc >= 2.12 | x86 | limited CI | | Linux (musl) | Experimental | musl >= 1.0 | x64 | | -1: The gcc4.8-libs package needs to be installed, because node - binaries have been built with GCC 4.8, for which runtime libraries are not - installed by default. For these node versions, the recommended binaries - are the ones available in pkgsrc, not the one available from nodejs.org. - Note that the binaries downloaded from the pkgsrc repositories are not - officially supported by the Node.js project, and instead are supported - by Joyent. SmartOS images >= 16.4 are not supported because - GCC 4.8 runtime libraries are not available in their pkgsrc repository - -2: Tier 1 support for building on Windows is only on 64-bit +1: Tier 1 support for building on Windows is only on 64-bit hosts. Support is experimental for 32-bit hosts. -3: On Windows, running Node.js in Windows terminal emulators +2: On Windows, running Node.js in Windows terminal emulators like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty) for the tty channels to work correctly (e.g. `winpty node.exe script.js`). In "Git bash" if you call the node shell alias (`node` without the `.exe` extension), `winpty` is used automatically. -4: The Windows Subsystem for Linux (WSL) is not directly +3: The Windows Subsystem for Linux (WSL) is not directly supported, but the GNU/Linux build process and binaries should work. The community will only address issues that reproduce on native GNU/Linux systems. Issues that only reproduce on WSL should be reported in the From 3bc012373a01724e0ab471ab2f007648bbd34f3e Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 8 Feb 2019 14:34:43 +0100 Subject: [PATCH 205/213] inspector: print all listening addresses Some hostnames have multiple interfaces. Before this commit, the inspector only printed the first one. Now, it prints them all. No test. I can't think of a reliable way to test this on the CI matrix. PR-URL: https://github.com/nodejs/node/pull/26008 Fixes: https://github.com/nodejs/node/issues/13772 Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Eugene Ostroukhov Reviewed-By: James M Snell --- src/inspector_socket_server.cc | 40 ++++++++++++++++++---------------- src/inspector_socket_server.h | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc index 7ddbcd38fe299d..5f1bdbc1e68880 100644 --- a/src/inspector_socket_server.cc +++ b/src/inspector_socket_server.cc @@ -93,22 +93,6 @@ const char* MatchPathSegment(const char* path, const char* expected) { return nullptr; } -void PrintDebuggerReadyMessage(const std::string& host, - int port, - const std::vector& ids, - FILE* out) { - if (out == nullptr) { - return; - } - for (const std::string& id : ids) { - fprintf(out, "Debugger listening on %s\n", - FormatWsAddress(host, port, id, true).c_str()); - } - fprintf(out, "For help, see: %s\n", - "https://nodejs.org/en/docs/inspector"); - fflush(out); -} - void SendHttpResponse(InspectorSocket* socket, const std::string& response) { const char HEADERS[] = "HTTP/1.0 200 OK\r\n" "Content-Type: application/json; charset=UTF-8\r\n" @@ -235,6 +219,25 @@ class ServerSocket { int port_ = -1; }; +void PrintDebuggerReadyMessage( + const std::string& host, + const std::vector& server_sockets, + const std::vector& ids, + FILE* out) { + if (out == nullptr) { + return; + } + for (const auto& server_socket : server_sockets) { + for (const std::string& id : ids) { + fprintf(out, "Debugger listening on %s\n", + FormatWsAddress(host, server_socket->port(), id, true).c_str()); + } + } + fprintf(out, "For help, see: %s\n", + "https://nodejs.org/en/docs/inspector"); + fflush(out); +} + InspectorSocketServer::InspectorSocketServer( std::unique_ptr delegate, uv_loop_t* loop, const std::string& host, int port, FILE* out) @@ -276,7 +279,7 @@ void InspectorSocketServer::SessionTerminated(int session_id) { if (connected_sessions_.empty()) { if (was_attached && state_ == ServerState::kRunning && !server_sockets_.empty()) { - PrintDebuggerReadyMessage(host_, server_sockets_[0]->port(), + PrintDebuggerReadyMessage(host_, server_sockets_, delegate_->GetTargetIds(), out_); } if (state_ == ServerState::kStopped) { @@ -393,8 +396,7 @@ bool InspectorSocketServer::Start() { } delegate_.swap(delegate_holder); state_ = ServerState::kRunning; - // getaddrinfo sorts the addresses, so the first port is most relevant. - PrintDebuggerReadyMessage(host_, server_sockets_[0]->port(), + PrintDebuggerReadyMessage(host_, server_sockets_, delegate_->GetTargetIds(), out_); return true; } diff --git a/src/inspector_socket_server.h b/src/inspector_socket_server.h index 5c61b4e5ee3ddc..082de54ac68c79 100644 --- a/src/inspector_socket_server.h +++ b/src/inspector_socket_server.h @@ -73,10 +73,10 @@ class InspectorSocketServer { return server_sockets_.empty() && connected_sessions_.empty(); } - private: static void CloseServerSocket(ServerSocket*); using ServerSocketPtr = DeleteFnPtr; + private: void SendListResponse(InspectorSocket* socket, const std::string& host, SocketSession* session); std::string GetFrontendURL(bool is_compat, From a41138b0cfe12f6ec85fdeadaf807042bdcc29c1 Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Sun, 17 Feb 2019 19:28:06 +0800 Subject: [PATCH 206/213] test: remove duplicated buffer negative allocation test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26160 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Сковорода Никита Андреевич --- test/parallel/test-buffer-negative-length.js | 17 ----------------- .../test-buffer-no-negative-allocation.js | 7 ++++++- 2 files changed, 6 insertions(+), 18 deletions(-) delete mode 100644 test/parallel/test-buffer-negative-length.js diff --git a/test/parallel/test-buffer-negative-length.js b/test/parallel/test-buffer-negative-length.js deleted file mode 100644 index bf903b933d2689..00000000000000 --- a/test/parallel/test-buffer-negative-length.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const SlowBuffer = require('buffer').SlowBuffer; - -const bufferNegativeMsg = common.expectsError({ - code: 'ERR_INVALID_OPT_VALUE', - type: RangeError, - message: /^The value "[^"]*" is invalid for option "size"$/ -}, 5); -assert.throws(() => Buffer(-1).toString('utf8'), bufferNegativeMsg); -assert.throws(() => SlowBuffer(-1).toString('utf8'), bufferNegativeMsg); -assert.throws(() => Buffer.alloc(-1).toString('utf8'), bufferNegativeMsg); -assert.throws(() => Buffer.allocUnsafe(-1).toString('utf8'), bufferNegativeMsg); -assert.throws(() => Buffer.allocUnsafeSlow(-1).toString('utf8'), - bufferNegativeMsg); diff --git a/test/parallel/test-buffer-no-negative-allocation.js b/test/parallel/test-buffer-no-negative-allocation.js index b34477aa8c4b45..6d44e432f3c780 100644 --- a/test/parallel/test-buffer-no-negative-allocation.js +++ b/test/parallel/test-buffer-no-negative-allocation.js @@ -2,12 +2,13 @@ const common = require('../common'); const assert = require('assert'); +const { SlowBuffer } = require('buffer'); const msg = common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: RangeError, message: /^The value "[^"]*" is invalid for option "size"$/ -}, 12); +}, 15); // Test that negative Buffer length inputs throw errors. @@ -26,3 +27,7 @@ assert.throws(() => Buffer.allocUnsafe(-1), msg); assert.throws(() => Buffer.allocUnsafeSlow(-Buffer.poolSize), msg); assert.throws(() => Buffer.allocUnsafeSlow(-100), msg); assert.throws(() => Buffer.allocUnsafeSlow(-1), msg); + +assert.throws(() => SlowBuffer(-Buffer.poolSize), msg); +assert.throws(() => SlowBuffer(-100), msg); +assert.throws(() => SlowBuffer(-1), msg); From 50e42c9d64c47df8305d9db38a48e12039ffedbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Sun, 24 Feb 2019 13:51:50 -0500 Subject: [PATCH 207/213] test: improve test coverage in perf_hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26290 Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Anto Aravinth Reviewed-By: Ruben Bridgewater --- test/parallel/test-http2-perf_hooks.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/parallel/test-http2-perf_hooks.js b/test/parallel/test-http2-perf_hooks.js index 5dd8ad0f6d883b..4264915294827c 100644 --- a/test/parallel/test-http2-perf_hooks.js +++ b/test/parallel/test-http2-perf_hooks.js @@ -47,6 +47,14 @@ const obs = new PerformanceObserver(common.mustCall((items) => { assert.fail('invalid entry name'); } }, 4)); + +// Should throw if entryTypes are not valid +{ + const expectedError = { code: 'ERR_VALID_PERFORMANCE_ENTRY_TYPE' }; + const wrongEntryTypes = { entryTypes: ['foo', 'bar', 'baz'] }; + assert.throws(() => obs.observe(wrongEntryTypes), expectedError); +} + obs.observe({ entryTypes: ['http2'] }); const body = From cb62c24e1b896e059120cc66d14a738a9d22c212 Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Mon, 25 Feb 2019 20:49:38 +0800 Subject: [PATCH 208/213] src: reduce to simple `const char*` in OptionsParser > A lot of the `std::string` usage here could be reduced to simple `const char*`s if it's reasonable to expect the values to be known at compile-time. So this commit uses `const char*` to replace most of `std::string` in `OptionsParser`. PR-URL: https://github.com/nodejs/node/pull/26297 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Beth Griggs Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- src/node_options-inl.h | 48 +++++++++++++++++++++--------------------- src/node_options.h | 46 ++++++++++++++++++---------------------- 2 files changed, 45 insertions(+), 49 deletions(-) diff --git a/src/node_options-inl.h b/src/node_options-inl.h index 052c847f7ebdc4..4387ec54bc34cc 100644 --- a/src/node_options-inl.h +++ b/src/node_options-inl.h @@ -28,8 +28,8 @@ EnvironmentOptions* PerIsolateOptions::get_per_env_options() { namespace options_parser { template -void OptionsParser::AddOption(const std::string& name, - const std::string& help_text, +void OptionsParser::AddOption(const char* name, + const char* help_text, bool Options::* field, OptionEnvvarSettings env_setting) { options_.emplace(name, @@ -40,8 +40,8 @@ void OptionsParser::AddOption(const std::string& name, } template -void OptionsParser::AddOption(const std::string& name, - const std::string& help_text, +void OptionsParser::AddOption(const char* name, + const char* help_text, uint64_t Options::* field, OptionEnvvarSettings env_setting) { options_.emplace( @@ -53,8 +53,8 @@ void OptionsParser::AddOption(const std::string& name, } template -void OptionsParser::AddOption(const std::string& name, - const std::string& help_text, +void OptionsParser::AddOption(const char* name, + const char* help_text, int64_t Options::* field, OptionEnvvarSettings env_setting) { options_.emplace( @@ -66,8 +66,8 @@ void OptionsParser::AddOption(const std::string& name, } template -void OptionsParser::AddOption(const std::string& name, - const std::string& help_text, +void OptionsParser::AddOption(const char* name, + const char* help_text, std::string Options::* field, OptionEnvvarSettings env_setting) { options_.emplace( @@ -80,8 +80,8 @@ void OptionsParser::AddOption(const std::string& name, template void OptionsParser::AddOption( - const std::string& name, - const std::string& help_text, + const char* name, + const char* help_text, std::vector Options::* field, OptionEnvvarSettings env_setting) { options_.emplace(name, OptionInfo { @@ -93,8 +93,8 @@ void OptionsParser::AddOption( } template -void OptionsParser::AddOption(const std::string& name, - const std::string& help_text, +void OptionsParser::AddOption(const char* name, + const char* help_text, HostPort Options::* field, OptionEnvvarSettings env_setting) { options_.emplace( @@ -106,16 +106,16 @@ void OptionsParser::AddOption(const std::string& name, } template -void OptionsParser::AddOption(const std::string& name, - const std::string& help_text, +void OptionsParser::AddOption(const char* name, + const char* help_text, NoOp no_op_tag, OptionEnvvarSettings env_setting) { options_.emplace(name, OptionInfo{kNoOp, nullptr, env_setting, help_text}); } template -void OptionsParser::AddOption(const std::string& name, - const std::string& help_text, +void OptionsParser::AddOption(const char* name, + const char* help_text, V8Option v8_option_tag, OptionEnvvarSettings env_setting) { options_.emplace(name, @@ -123,27 +123,27 @@ void OptionsParser::AddOption(const std::string& name, } template -void OptionsParser::AddAlias(const std::string& from, - const std::string& to) { +void OptionsParser::AddAlias(const char* from, + const char* to) { aliases_[from] = { to }; } template -void OptionsParser::AddAlias(const std::string& from, +void OptionsParser::AddAlias(const char* from, const std::vector& to) { aliases_[from] = to; } template void OptionsParser::AddAlias( - const std::string& from, + const char* from, const std::initializer_list& to) { AddAlias(from, std::vector(to)); } template -void OptionsParser::Implies(const std::string& from, - const std::string& to) { +void OptionsParser::Implies(const char* from, + const char* to) { auto it = options_.find(to); CHECK_NE(it, options_.end()); CHECK_EQ(it->second.type, kBoolean); @@ -153,8 +153,8 @@ void OptionsParser::Implies(const std::string& from, } template -void OptionsParser::ImpliesNot(const std::string& from, - const std::string& to) { +void OptionsParser::ImpliesNot(const char* from, + const char* to) { auto it = options_.find(to); CHECK_NE(it, options_.end()); CHECK_EQ(it->second.type, kBoolean); diff --git a/src/node_options.h b/src/node_options.h index e92fd3c983191f..46963181aa47fb 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -239,43 +239,39 @@ class OptionsParser { struct NoOp {}; struct V8Option {}; - // TODO(addaleax): A lot of the `std::string` usage here could be reduced - // to simple `const char*`s if it's reasonable to expect the values to be - // known at compile-time. - // These methods add a single option to the parser. Optionally, it can be // specified whether the option should be allowed from environment variable // sources (i.e. NODE_OPTIONS). - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, bool Options::* field, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, uint64_t Options::* field, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, int64_t Options::* field, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, std::string Options::* field, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, std::vector Options::* field, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, HostPort Options::* field, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, NoOp no_op_tag, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); - void AddOption(const std::string& name, - const std::string& help_text, + void AddOption(const char* name, + const char* help_text, V8Option v8_option_tag, OptionEnvvarSettings env_setting = kDisallowedInEnvironment); @@ -286,15 +282,15 @@ class OptionsParser { // the option is presented in that form (i.e. with a '='). // If `from` has the form "--option-a ", the alias will only be expanded // if the option has a non-option argument (not starting with -) following it. - void AddAlias(const std::string& from, const std::string& to); - void AddAlias(const std::string& from, const std::vector& to); - void AddAlias(const std::string& from, + void AddAlias(const char* from, const char* to); + void AddAlias(const char* from, const std::vector& to); + void AddAlias(const char* from, const std::initializer_list& to); // Add implications from some arbitrary option to a boolean one, either // in a way that makes `from` set `to` to true or to false. - void Implies(const std::string& from, const std::string& to); - void ImpliesNot(const std::string& from, const std::string& to); + void Implies(const char* from, const char* to); + void ImpliesNot(const char* from, const char* to); // Insert options from another options parser into this one, along with // a method that yields the target options type from this parser's options From 63942de82c802b1b3d40f072d60f2a671668ead8 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Tue, 26 Feb 2019 15:21:29 -0800 Subject: [PATCH 209/213] src: extra-semi warning in node_platform.h https://clang.llvm.org/docs/DiagnosticsReference.html#wextra-semi PR-URL: https://github.com/nodejs/node/pull/26330 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Beth Griggs Reviewed-By: Ruben Bridgewater --- src/node_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_platform.h b/src/node_platform.h index ec48296b31e16b..f99f0f9b9bd2b7 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -62,7 +62,7 @@ class PerIsolatePlatformData : void PostIdleTask(std::unique_ptr task) override; void PostDelayedTask(std::unique_ptr task, double delay_in_seconds) override; - bool IdleTasksEnabled() override { return false; }; + bool IdleTasksEnabled() override { return false; } void Shutdown(); From fc9ba36fb236e22b89d2af53c0d6c1212d941b51 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 27 Feb 2019 23:24:05 +0800 Subject: [PATCH 210/213] src: fix typo in callback.cc PR-URL: https://github.com/nodejs/node/pull/26337 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- src/api/callback.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/callback.cc b/src/api/callback.cc index 4bcccb960c5556..6c6aec4573ed04 100644 --- a/src/api/callback.cc +++ b/src/api/callback.cc @@ -220,7 +220,7 @@ MaybeLocal MakeCallback(Isolate* isolate, MaybeLocal ret = InternalMakeCallback(env, recv, callback, argc, argv, asyncContext); if (ret.IsEmpty() && env->makecallback_depth() == 0) { - // This is only for legacy compatiblity and we may want to look into + // This is only for legacy compatibility and we may want to look into // removing/adjusting it. return Undefined(env->isolate()); } From 2595fbc8b1b70fc5fa6d88177f35ef7df0ecf079 Mon Sep 17 00:00:00 2001 From: Sagi Tsofan Date: Sun, 21 Oct 2018 21:48:05 +0300 Subject: [PATCH 211/213] http2: improve compatibility with http/1 When using the compatibility API the connection header is from now on ignored instead of throwing an `ERR_HTTP2_INVALID_CONNECTION_HEADERS` error. This logs a warning in such case to notify the user about the ignored header. PR-URL: https://github.com/nodejs/node/pull/23908 Fixes: https://github.com/nodejs/node/issues/23748 Reviewed-By: James M Snell Reviewed-By: Anatoli Papirovski Reviewed-By: Matteo Collina Reviewed-By: Ruben Bridgewater --- lib/internal/http2/compat.js | 25 +++++++++++++++++++ test/parallel/test-http2-server-set-header.js | 7 ++++++ 2 files changed, 32 insertions(+) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index da88f4d880ad67..286bc51683e494 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -45,6 +45,7 @@ const { } = constants; let statusMessageWarned = false; +let statusConnectionHeaderWarned = false; // Defines and implements an API compatibility layer on top of the core // HTTP/2 implementation, intended to provide an interface that is as @@ -58,6 +59,8 @@ function assertValidHeader(name, value) { err = new ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED(); } else if (value === undefined || value === null) { err = new ERR_HTTP2_INVALID_HEADER_VALUE(value, name); + } else if (!isConnectionHeaderAllowed(name, value)) { + connectionHeaderMessageWarn(); } if (err !== undefined) { Error.captureStackTrace(err, assertValidHeader); @@ -88,6 +91,23 @@ function statusMessageWarn() { } } +function isConnectionHeaderAllowed(name, value) { + return name !== constants.HTTP2_HEADER_CONNECTION || + value === 'trailers'; +} + +function connectionHeaderMessageWarn() { + if (statusConnectionHeaderWarned === false) { + process.emitWarning( + 'The provided connection header is not valid, ' + + 'the value will be dropped from the header and ' + + 'will never be in use.', + 'UnsupportedWarning' + ); + statusConnectionHeaderWarned = true; + } +} + function onStreamData(chunk) { const request = this[kRequest]; if (request !== undefined && !request.push(chunk)) @@ -539,6 +559,11 @@ class Http2ServerResponse extends Stream { [kSetHeader](name, value) { name = name.trim().toLowerCase(); assertValidHeader(name, value); + + if (!isConnectionHeaderAllowed(name, value)) { + return; + } + this[kHeaders][name] = value; } diff --git a/test/parallel/test-http2-server-set-header.js b/test/parallel/test-http2-server-set-header.js index 83f373ec21b314..13ca1142fa3892 100644 --- a/test/parallel/test-http2-server-set-header.js +++ b/test/parallel/test-http2-server-set-header.js @@ -11,6 +11,7 @@ const body = const server = http2.createServer((req, res) => { res.setHeader('foobar', 'baz'); res.setHeader('X-POWERED-BY', 'node-test'); + res.setHeader('connection', 'connection-test'); res.end(body); }); @@ -34,4 +35,10 @@ server.listen(0, common.mustCall(() => { req.end(); })); +const compatMsg = 'The provided connection header is not valid, ' + + 'the value will be dropped from the header and ' + + 'will never be in use.'; + +common.expectWarning('UnsupportedWarning', compatMsg); + server.on('error', common.mustNotCall()); From 3c277d7e92adf1464e41d27677fcdc05fec41a2b Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 5 Mar 2019 00:37:08 +0100 Subject: [PATCH 212/213] 2019-03-06, Version 11.11.0 (Current) Notable Changes * n-api: * Implement date object (Jarrod Connolly) https://github.com/nodejs/node/pull/25917 * util: * Add compact depth mode for `util.inspect()` (Ruben Bridgewater) https://github.com/nodejs/node/pull/26269 * worker: * Improve integration with native addons (Anna Henningsen) https://github.com/nodejs/node/pull/26175 * MessagePort.prototype.onmessage takes arguments closer to the Web specification now (Anna Henningsen) https://github.com/nodejs/node/pull/26082 --- CHANGELOG.md | 3 +- doc/api/n-api.md | 6 +- doc/api/util.md | 2 +- doc/changelogs/CHANGELOG_V11.md | 228 ++++++++++++++++++++++++++++++++ src/node_version.h | 6 +- 5 files changed, 237 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a941ec57aed64..aa6eab593b2f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,8 @@ release. -11.10.1
+11.11.0
+11.10.1
11.10.0
11.9.0
11.8.0
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 53d3d07f3af5da..1c26df5ba63667 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1530,7 +1530,7 @@ structure, in most cases using a `TypedArray` will suffice. #### napi_create_date @@ -2175,7 +2175,7 @@ This API returns various properties of a `DataView`. #### napi_get_date_value @@ -2784,7 +2784,7 @@ This API checks if the `Object` passed in is a buffer. ### napi_is_date diff --git a/doc/api/util.md b/doc/api/util.md index a713d3a402e372..31028c42ea43a7 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -375,7 +375,7 @@ stream.write('With ES6');